Tuan Anh

container nerd. k8s || GTFO

Refined Twitter

An extension that makes Chrome always use the mobile web version of Twitter, which is much faster and better looking than the old desktop web version. When you open a link that would normally be to desktop Twitter, this extension redirects you to the mobile web version and makes it wider.

Good thing about this is when clicking back button in browser, mobile Twitter get you back to where you were, unlike the desktop version.

They also offer a desktop version - Anatine.

link bài gốc

Geo dynamic upstream with nginx

I recently had to setup nginx as load balancer at work. Due to the reason that one of our customer is in China, we have to add few China servers to our load balancer and route everything from China to those instead.

Turn out it’s quite easy to do it with nginx and geo package. You will need nginx-full or compile nginx yourself with geo package.

After setting nginx with geoip. Create a new configuration in site-available, symlink to site-enabled to enable it.

The content of the fie should look like this

upstream first_upstream  {
    ip_hash; # for sticky session
    server <first-01>;
    server <first-02>;

upstream second_upstream {
    server <second-01>;
    server <second-02>;

map $geoip_country_code $preferred_upstream {
    default first_upstream;
    CN second_upstream; # use second_upstream for those from China (CN)

server {
    location / {
        proxy_pass http://$preferred_upstream/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

Build command line tools with Node.js

Everything you need to know about building command line tools with Node.js.

link bài gốc

Classic Programmer Paintings

Painters and Hackers: nothing in common whatsoever, but this are classical painters depictions of software engineering (techincally, might not be all classical but hey, this is just a tumblr)

The curators that created this Tumblr are genius. Here is one: “Frontend programmer” - a 16th century painting by Giovanni Battista Moroni.

Or this one: “Sysadmin grants sudo privileges to developer on production web server” - Andrea del Verrocchio and Leonardo da Vinci

link bài gốc

Google kick-starts engineering team in Singapore

Great news indeed! Now one can work at one of the most prestigious company in the world and stay close to his family. Singapore is only less than 2 hours away from Vietnam.

You can view all opening positions here

link bài gốc

Why JSON doesn't support comments

“I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn’t. Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.” - Douglas Crockford

link bài gốc

Implement autocomplete with redis

Very nice implementation of doing autocomplete with redis. From antirez - redis author himself.

I tried it in Node.js and it works very well for this purpose, over 10x improvement over traditional SQL LIKE.

redis autocomplete

link bài gốc

Concurrency and parallelism

My interest shifted to Go lang these days. However, I didn’t want to jump right into coding but reading about its design first.

For example, this slide here is pretty fascinating on how golang deals with concurrency and parallelism, a concept I believe many people often make mistake and confuse between them.

link bài gốc

Welcome the second Pom to my family

47 days old. She’s the latest furry cute little addition to my family.

We haven’t named her yet though.

Setting up SSL certificate with Deis

Now that Let’s Encrypt offers free SSL, there is no reason not to use it to secure your apps. Setting up Deis to use SSL is easy too.

I haven’t yet figured it out how to renew the cert automatically. Last I checked, they (Deis) doesn’t support this yet. They may be integrated into deis-router in near future.