Skip to main content

Posts

Showing posts from 2015

My experiment with golang and social counters

Starting with my frustration while building the scroll  website: the social buttons are freaking slow to load. Especially on pages that has a lot of scripts (like mine) it is way worse. The buttons usually take minutes to show up and when they do, each of them render differently from the rest. Thanks Facebook, Twitter and Google for that. So I went in and found a few options. It looks like people made a few scripts that will collect the counters via AJAX (on user browser) and render the buttons with images. Some use data URI to avoid triggering more requests, brilliant! Since I wanted to make something super simple and fast to use, I decided to have one script that does all of those. The server will keep track of the counters and put them in the script so everything needed is one and only one request. I needed 3 social networks and each of them has different ways to retrieve the counters so I figured the server has to make the requests asynchronously, cache the values for ...

Quick DNS switching script for Mac OS X

I'm too lazy to spend 1 minute every time I have to change DNS so I spent 10 minutes to wrote this script to do it quick. It currently supports Google, Open DNS and uFlix but it can support unlimited number of configurations. Get the script here:  https://gist.github.com/daohoangson/60ce8e0317213bc45c30 Use it like switch-dns-to.sh google You will need to enter the user password.

PDBS 2015

*PDBS stands for Personal Data Backup Strategy. I have always been paranoid regarding data loss. That's why I try to follow best practices in backing up data: 2 offline full machine backups to external HDDs, one in Hanoi, one in HCMC. I have done this since a few years ago when I was using the ThinkPad T41 laptop (circa 2007). The size of this backup grows linear with time and it is about 300GB these days (with TimeMachine). 1 online backup via Arq to Amazon Glacier for important archival data (how did I flirt with my wife, that kind of serious stuff). Before I started using Arq (early 2013), I made yearly dump of data to DVDs. This backup grows slowly until I met Sylvie and it started to explode, going around 150+ GB now. Mostly full size photos. 1 online backup for work related files are put in Dropbox because their apps (Windows and Mac) work really well. I believe they are the only one who uses delta sync, which is super fast. Since work data changes regularly, it make...