CS:GO launch failure fix

The symptom: CS:GO launched to a black screen and just crash right after. The OS I’m using is Pop!_OS 21.10. The fix here is sudo apt install libtcmalloc-minimal4 cd <YOUR_STEAM_HOME_DIR>/steamapps/common/Counter-Strike\ Global\ Offensive/bin/linux64 # backup the old file mv libtcmalloc_minimal.so.0 libtcmalloc_minimal.so.0.bak mv libtcmalloc_minimal.so.4 libtcmalloc_minimal.so.4.bak ln -s /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4 libtcmalloc_minimal.so.0 ln -s /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4 libtcmalloc_minimal.so.4 The game should be able to launch after this. However, if you do “verify integrity of game files”, you will need to do this fix again.
Read more →

Public ECR and private subnets

Hôm trước mình hơi băn khoăn chút việc nếu sử dụng public ECR (public.ecr.aws) với sử dụng 1 k8s cluster trong private subnets, thì bandwidth từ việc pull images về trong private subnets sẽ đc tính thế nào. Tính vào cho NAT gateway? Hay tính vào cho S3 Gateway Endpoint? Vì public ECR sử dụng S3 làm storage nên trong trường hợp ngon nghẻ nhất là bandwidth đc tính vào Gateway endpoint thì ngon :)
Read more →

Shure MV7 working on Linux

I read many posts regarding Shure MV7 doesn’t work at all on Linux: here, here and here. It got me nervous as I already bought this on Amazon and return is not an option since I live in Vietnam. However, when I receive the mic today, it just works, right out of the box, on Pop!_OS (v 21.04). The only thing different with the vanilla Pop!_OS distro is I switch to pirewire for audio instead of pulseaudio.
Read more →

Using k8s kind “rootlessly” without Docker

So you probably already heard the news Docker Desktop is no longer free. While this mostly affect macOS and Windows users and I use Pop!_OS, I still would like to see if we can get by without Docker at all. I’ve been using nerdctl for quite awhile now and while nerdctl mostly fill my needs for docker CLI, I “kinda” need kind CLI to create test cluster for testing purpose. However kind still needs docker.
Read more →

Làm quen với Pod Security Admission (PSA)

K8s 1.22 giới thiệu Pod Security Admission (sau này gọi tắt là PSA) phiên bản alpha, để thay thế cho Pod Security Policy (PSP). Bài viết này sẽ hướng dẫn qua cách bạn setup PSA và sử dụng PSA 1 cách cơ bản nhất. Enable PSA # Để cho mục đích lab đơn giản, mình sẽ sử dụng kind để tạo 1 cluster local. Mình sẽ tạo 1 cluster và enable PSA lên với config như sau
Read more →

My blogging setup these days

Previous setup # I used a small VPS instance on RamNode to host my blog previously. No particular reason. I just happened to have lots of unused credits there. I have a local git repo on my Macbook. Setup a git hook to trigger jekyll build on the VPS. Nothing fancy. No CI/CD whatsoever. The new setup # I recently migrated my blog from self-hosted on RamNode to Cloudflare Pages.
Read more →

How to write Node modules with Rust

TLDR: there’s a sample repo here if you’re lazy to read this post. The sample repo include GitHub Actions sample for CI as well. The Rust bit # It’s very simple. You write your function in Rust #[js_function(3)] fn say_hello(ctx: CallContext) -> Result<JsString> { let name = ctx.get::<JsString>(0)?.into_utf8()?; let name = name.as_str()?; let s = ctx.env.create_string_from_std(format!("Hello, {}!", name))?; Ok(s) } And then you expose it to Node.js runtime with
Read more →

What the fuck is even GitOps

Nguồn gốc # 2017, term GitOps đc WeaveWorks promote lên với bài viết “Operations by Pull Request”, đại để là k8s system state đc lưu ở 1 git repo changes made thông qua pull request rồi chạy CI/CD pipeline có công cụ hỗ trợ detect configuration drift và reconciler. Nhìn qua thì cũng chẳng có gì đặc biệt vì từ 2016, khi bên mình triển khai Kubernetes, mình cũng đã CI/CD và store system state ở git repo rồi.
Read more →

Distributed tracing is the new structured logging

Structured logging # Một best practice vẫn được recommend cho tới bây giờ là structured logging. Structured log là 1 dạng logging theo kiểu key=val để có thể giúp chúng ta dễ dàng parse log và đưa vào 1 log store để tiện query và phân tích. logger.info({ request_time: 1000, payload_size: 2000 }) sau đó 1 đoạn structured log sẽ đc generated ra kiểu này, ngoài các metadata chúng ta log thì còn đi kèm thêm 1 số metadata khác như timestamp, hostname, deployment name, pod name, etc.
Read more →

The state of Linux on desktop (2020)

I got fed up with macOS. While the new hardware(Apple Silicon) got amazing feedbacks, the OS itself is so lag behind. I got a Windows 10 desktop at home and heck, it was even much more pleasant to use than using macOS. As a typical user (web browsing, mail and office stuff), Windows 10 is very good. As a developer, it’s getting a lot better with WSL/Microsoft Terminal/etc… I decided to give Linux another evaluation test.
Read more →

Using Cloudflare Warp on Linux

Cloudflare Warp is currently not supporting Linux. However, since it’s just Wireguard underneath, we can still use it unofficially. Install wgcf and wireguard-tools # Get wgcf from its repo. Install wireguard-tools. I use Manjaro so I will use pacman for this pacman -S wireguard-tools. Generate Wireguard config # You can now use wgcf to register, and then generate Wireguard config. wgcf register wgcf generate register command will create a file named wgcf-account.
Read more →

An extremely fast streaming SAX parser for Node.js

An extremely fast streaming SAX parser for Node.js, written in C++
Read more →

camaro v6

Breaking changes in camaro v6: require Node 12 or newer. Major performance improvement.
Read more →

From Zsh to Fish on macOS

How to migrate from Zsh to Fish shell
Read more →

kubectl run generators removed

kubectl run generators removed from kubectl 1.18, except one for generating pod.
Read more →

Using Synology NFS as external storage with Kubernetes

A step by step guide on how to use Synology NFS as external storage with Kubernetes
Read more →

Debugging Kubernetes: Unable to connect to the server: EOF

We had an EC2 instance retirement notice email from AWS. It was our Kubernetes master node. I thought to myself: we can simply just terminate and launch a new instance. I’ve done it many times. It’s no big deal. However, this time, when our infra engineer did that, we were greeted with this error when trying to access our cluster. Unable to connect to the server: EOF All the apps are still fine.
Read more →

How to setup reverse proxy for homelab with Caddy server

The end goal is to be able to expose apps deployed locally on homelab publicly. I don’t want to expose multiple ports to the Internet for several reasons: I have to create multiple port-forwarding rules. The address not memorable because I need to remember the ports. Eg: homeip.example.com:32400 for Plex, homeip.example.com:1194 for VPN, and so on… The alternative is to use reverse proxy. setup reverse proxy setup port forward (80 & 443) for reverse proxy config reverse proxy to proxy the local apps Reverse proxy # I would have gone with nginx but I want to tinker with Caddy.
Read more →

Tips for first time rack buyer

Everything you should know before buying your first homelab rack.
Read more →

How to setup a home VPN with Synology NAS

Currently, I’m working on building my homelab. It’s still a very much work in progress but everything is coming along nicely. I plan to host lots of stuff in my homelab and be able to access it while I’m not at home. I don’t feel comfortable exposing them all to the Internet so VPN to the rescue. The setup is straight forward. It’s different, depends on your lab equipment but the steps are always the same.
Read more →

How to adopt UniFi Security Gateway to an existing network

I’m by no mean a network expert. This is just my personal experience when I setup my USG to my existing network. In my case, I was using Orbi RBK as my router and access point. With USG in place, I will use the Orbi in access point mode. The USG will be replacing the Orbi as my router. My current network is using 10.0.0.1/8 IP range. By default, USG uses 192.
Read more →

Dynamic DNS with CloudFlare

I use this project oznu/docker-cloudflare-dns1 where the author implements everything in bash, curl and jq. There were a bunch of projects that does this DDNS with CloudFlare but I chose this project because of this uniqueness. To use this, you just have to create an API token with Cloudflare that has these permissions: Zone - Zone Settings - Read Zone - Zone - Read Zone - DNS - Edit Also, set zone resources to All zones.
Read more →

Traffic from #1 post on Hacker News

My last post recently featured #1 on Hacker News. This surprises me a little bit because when I first posted the link, there were little interest (~15 points) in it. I shake it off and went on with my day. Few days later, when I was browsing Hacker News, my blog post was featured right there on the home page through someone else’s submission. The post stays at #1 for ~ 12 hours before drift off to page 2.
Read more →

The story behind my talk: Cloud Cost Optimization at Scale: How we use Kubernetes and spot instances to reduce EC2 billing up to 80%

This is the story behind my talk: “Cloud Cost Optimization at Scale: How we use Kubernetes and spot instances to reduce EC2 billing up to 80%”. Now before I tell this story, I will admit first hand that the actual number is lower than 80%. 2015 # The story began in mid 2015 when I was employed by one of my ex-employer. It was a .NET framework shop that struggled to scale in both performance and cost at the time.
Read more →

Thoughts on Workers KV

Infrequent write / frequent read # I tried to build a todobackend.com with Cloudflare workers and Workers KV. However, the specs runner keeps failing, inconsistently. Meaning they would pass this run and fail the next. Manual tests usually doesn’t have this problem. This tells me it seems Workers KV is not synchronous or the data replication is slow. Turns out, it’s mentioned right there in the Workers KV’s docs; emphasises are mine.
Read more →

reader

Another experiment with Cloudflare workers. I haven’t use Worker KV here though. reader is a service that mimic reader mode on browser and let user shares the reader mode view on the web. It’s still super buggy now due to lib that I use is quite abandoned at the moment. I just want to whip out something that works first. Something I learnt from reading Cloudflare workers docs while doing this:
Read more →

Experiment with Cloudflare Workers

I’ve been meaning to try Cloudflare Workers with my blog. Given that it’s static website, it should be straight forward to do. They (Cloudflare) makes it incredibly easy to migrate. Their tutorial works just fine with a minor exception regarding the DNS setup. The whole process took like 5 mins overall. I just had to do an additional step of setting up an A record of my domain to 192.0.2.1 so that they can be resolved to Cloudflare Workers.
Read more →

Brag document

There’s this idea that, if you do great work at your job, people will (or should!) automatically recognize that work and reward you for it with promotions / increased pay. In practice, it’s often more complicated than that – some kinds of important work are more visible/memorable than others. It’s frustrating to have done something really important and later realize that you didn’t get rewarded for it just because the people making the decision didn’t understand or remember what you did.
Read more →

Debugging with git bisect

Suppose I have this project with 5 commits. You can clone it from here. Say, there’s a regression bug in the master branch but a lot has been added to master after the feature was first inroduced. How would I go debugging this? Which commits break it? Usually, we would go manually and see which commit would possibly do this but if the project is large and active, it’s a quite troulesome process.
Read more →

The state of tiling window manager on Windows 10

The state # 1. Workspacer # Opensource. Best in term of feature set. Closest thing to an actual tiling window manager on Windows 10. Have some weird bugs that’s quite annoying. Development velocity is slow. 2. Bug.n # Opensource. Written in scripting language - AutoHotkey. Require AutoHotkey installed. 3. PowerToys # Opensourced by Microsoft. Not really tiling. It’s still manual process. Very stable for daily use.
Read more →

A beginner guide to CPU air cooling

I was researching about CPU air coolers for the best CPU air cooler and I learnt a lot of stuff. Thought this might be useful to some of you. Most of the stuff below are copy and pasted from various sources. This serves as a basic guide for absolute beginners like me when it comes to CPU air cooling. TL;DR: Noctua NH-D15 is the best air CPU cooler out there.
Read more →

Advanced filtering and sorting with redis (part 2)

With the recent introduction of Redis modules (since Redis v4), redis is now a lot more flexible than the old redis. Previously in part 1, if you want to mimic the sorting and filtering behavior, you need to use set/sorted set and do the intersection/union by yourself. Not anymore. Meet RediSQL # RediSQL is an in-memory SQL engine, built on top of Redis as Redis module. It’s pretty much SQL under the hood now.
Read more →

Pi-hole

I’ve heard a lot of praise about Pi-hole project but hadn’t gotten around actually trying it yet until recently. Pi-hole is a network-wide ad-blocking solution via local DNS. You set it up as a local DNS server and it will block all the ads that match the rule from DNS level. This way, you don’t have to setup adblock on each and every devices you have, especially tablets and mobiles. See example of VnExpress without adblock below.
Read more →

Microsoft Sculpt Ergonomic Desktop review

While i’m a hardcore mechanical keyboard fan, this is my very fisrt split (partially), ergonomic keyboard. The keyboard comes in tenkeyless size and a separated numpad. It’s a bit bigger for my taste but I can live with that. I’m more accustomed to a smaller board. 60%-65% is usually the sweet spot for me. The sculpt keyboard uses wireless but probably not Bluetooth which makes me wonder if I can find the replacement USB receiver dongle if I ever lost it.
Read more →

Optimal team size

Recently, I saw this tweet on Twitter. This is regarding the challenge of adding more engineers to a project in relation to the number of communication lines. This is easy to notice adding 1 more engineer to the team will increase no. of communication lines quite a bit because the function to calculate no. of communications lines in regard to no. of engineers is O(n*n), no wonder why it’s steep. More on that later.
Read more →

From macOS to Windows 10

I’m an Apple fan no doubt but recently, I’ve been using Windows 10 exclusively at work and to be honest, I’ve grown to quite fond of Windows 10. For the first time since 2008, I’m seriously thinking about buying a Windows laptop. With the recent introduction of Ryzen 3000 series, I was so tempted to build a PC again for the first time since 2006 (my last build was 13 years ago!
Read more →

Tips on reducing WASM file size with Emscripten

Optimize for size over performance # If size is more important than performance, you can use -Os flag. I tried with camaro and the file size reduce from 176KB down to 130KB. It’s worth a try. Disable assertion, debug # Try adding these flags: -s ASSERTIONS=0 and -DNDEBUG to emcc. Using emmaloc # Try using emmalloc which is a smaller malloc version available in emcc by adding -s 'MALLOC="emmalloc"' flag
Read more →

Choosing a wireless router in 2019

I found this guide to be extremely helpful. It was written in 2018 but the basic concepts are still true. Do read it if you want to learn what factors to consider when buying a wireless router in 2019. Tldr; I ended up buying Netgear Orbi RBK40. Or money is not a constraint, then Netgear Orbi RBK50. Here’re why: 802.11AC is a must. AX is not available yet. 3 and 4 streams are still expensive for home usage.
Read more →

Some lessons learnt after converting a native module to WebAssembly

I released my first WebAssembly module here on GitHub. Here are some lessons I learnt during the process. Please don’t take it for granted. These things might be true, or not. I’m not sure. I just worked on it for the last few days. Cache WebAssembly instance to save some time on initialization # const Module = require('yourmodule') const mod = Module() const resolveCache = new Map() mod.onRuntimeInitialized = function() { resolveCache.
Read more →

How to delete Redis keys using pattern

So Googling this question show a common approach using KEYS command and then pipe them to DEL command, which looks something like this in Lua script local keys = redis.call('keys', ARGV[1]) for i=1,#keys,5000 do redis.call('del', unpack(keys, i, math.min(i+4999, #keys))) end return keys Doing things like this would be fine for development where the keyspace is small and frequent of use is low. However, if you were to do this at a larger keyspace and a lot more frequent, the KEYS command will block Redis instance and making other commands to fail.
Read more →

Autocomplete at speed of light

tldr: RediSearch - a full text search redis module that is super fast. I learnt of RediSearch 2 years ago. It was a young project back then but seems very promising at time. When I revisit it last year, it’s quite mature already and was about to hit v1.0 so I did another test drive. The result was so good I put it on production few weeks later. Its pros are:
Read more →

2018: year in review

TLDR: ✨ 2018 in review ✨ 👩🏻‍💼 My wife got promoted 👨‍💻 Another amazing year at work for me 🏠 We bought a house 🤑 We paid off the loan early 🎤 Gave 2 public talks (or 1. The first one is a rather small audience - 50-ish people) We bought a house # My wife and I went for a major decision earlier this year. We decided to buy a house with a little loan.
Read more →

My keyboard layout

Over the years, I customized my keyboard layout a lot (Bootmapper client then and QMK Toolbox now) and this is what I ended up using. It’s pretty much HHKB layout with some QMK hacks on top. Change CAPLOCK to CTRL # CAPLOCK is useless to me so I change it to CTRL. I also set it up to use Mod-Tap key which will act as CTRL if I hold it but works as BACKSPACE if I tap it.
Read more →

Favorite QMK hacks

macOS media keys # macOS media keys are supported on QMK: KC__MUTE, KC__VOLUP, KC__VOLDOWN, etc… This is essential if you’re using macOS. Grave Escape # If you’re using a 60% keyboard, or any other layout with no F-row, you will have noticed that there is no dedicated Escape key. Grave Escape is a feature that allows you to share the grave key (` and ~) with Escape.
Read more →

Fastest way to transform XML to JSON in Node.js

camaro is an utility to transform XML to JSON using a template engine powered by XPath syntax which looks like this Here are some benchmarks I ran with the sample data I usually have to deal with (XML data ranges from 1-10MB) camaro x 809 ops/sec ±1.51% (86 runs sampled) rapidx2j x 204 ops/sec ±1.22% (81 runs sampled) xml2json x 53.73 ops/sec ±0.58% (68 runs sampled) xml2js x 40.57 ops/sec ±7.
Read more →

Sharding and IDs

So I was going through this post from Instagram Engineering blog while researching for some sharding solutions. The solution is quite elegant and I decided to port this to MySQL. Turns out, it’s harder than I thought since we’re using a pretty dated MySQL version at work. There is no sequence, just AUTO_INCREMENTAL. In order to use the code snippet for PL/PGSQL, I would have to find a way to mimic nextval function.
Read more →

Advanced filtering and sorting with redis (part 1)

Set and sorted set are extremely powerful data types for filtering and sorting stuff with redis. Basic filtering # Let’s start with something simple. Usually filtering is just a matter of union and intersection. Let’s say: filter all hotels that are 3 or 4 star and have both spa and pool. For this, we just have to create a set for each of the filter criteria and do union/intersection accordingly.
Read more →

Notes on GraphQL

Some personal notes while working with GraphQL Only enable GraphiQL in development. GraphQL is quite “chatty” by default. Use something like Facebook’s DataLoader for batching requests. DataLoader is not responsible for pagination. Implementation will be varied based on different backends. Apollo GraphQL is pretty awesome. Check out some of their open-source libraries. Using cacheKeyFn for batching function (DataLoader) with multiple parameters. Related issue: #75 GraphQL is much more prone to attack because of its flexibility.
Read more →

Kubernetes Meetup #2 slide

Read more →

The Birth & Death of JavaScript

Read more →

Advice to new managers

Read more →

DejaLu - a new open source email client by Sparrow’s author

Read more →

Series and parallel execution with async/await

Read more →

2017: year in review

Best year at work yet! # I worked on a project (with a several members of my team) to migrate our apps onto Kubernetes cluster since the beginning of 2017. We’ve been using Kubernetes in production since. Convince and guide other teams to follow our initiative to migrate to Kubernetes. 💸 Significantly reduce our AWS bills with the use of spot instances / spot fleet while maintaining high availability of the system.
Read more →

Building containers in pure Bash and C

Read more →

A better way to go through terminal command history

In the past, I used to use Ctrl+R to search my terminal command history but it’s unreliable. I couldn’t wrap my head around how it search sometimes. Thanksfully, I was introduced to fzf and it’s has been a wonderful little gem. The power of fzf is much more than just searching through command history, depends on how creative you are. The one I show here is just an example of how powerful fzf is.
Read more →

The silence of the Lambda

Read more →

Traits of a good leader

Found this on HackerNews. Very much on point, though I don’t quite agree with the last item. You have to have your people’s back, this is the most important thing… be there for them, insulate them from problems and management stupidity and always fight for them. Lead by example, never ask them to do something you won’t do yourself. Communicate, I have booked on afternoon a week from 14:00pm till 16:00 and more to just talk with my team and discuss everything from work, to weather, sports, to bitch and moan against the company, etc…
Read more →

node-prune

Read more →

kompression - koa compression middleware with support for brotli

Read more →

Docker Containers on the Desktop

Read more →

If Your Boss Could Do Your Job, You’re More Likely to Be Happy at Work

Read more →

Kubernetes-hosted application checklist (part 1)

At work, we’ve been running Kubernetes (k8s) in production for almost 1 year. During this time, I’ve learnt a few best practices for designing and deploying an application hosted on k8s. I thought I might share it today and hopefully it will be useful to newbie like me. Liveness and readiness probes # Liveness probe: check whether your app is running Readiness probe: check whether your app is ready to accept incoming request Liveness probe is only check after the readiness probe passes.
Read more →

Kubernetes-hosted application checklist (part 2)

This part is about how to define constraint to the scheduler on where/how you want your app container to be deployed on the k8s cluster. Node selector # Simpleast form of constraint for pod placement. You attach labels to nodes and you specify nodeSelector in your pod configuration. When to use # you want to deploy redis instance to memory-optimized (R3, R4) instance group for example. Affinity and anti-affinity # Affinity and anti-affinity is like nodeSelector but much more advanced, with more type of constraints you can apply to the default scheduler.
Read more →

Minimal Node.js docker container

Bitnami recently releases a prod version of their bitnami-docker-node with much smaller size due to stripping a bunch of unncessary stuff for runtime. If your app does not require compiling native modules, you can use it as is. No changes required. However, if you do need to compile native modules, you can still use their development image as builder and copy stuff over to prod image after. I try with one of my app and the final image size reduce from 333 MB down to just 56 MB 💪 !
Read more →

Non-privileged containers FTW

Read more →

Recent Node.js TSC fuss

Read more →

node-pre-gyp and CI

Read more →

tldr

A better man page. This is insanely useful 👍 tar Archiving utility. Often combined with a compression method, such as gzip or bzip. - Create an archive from files: tar cf target.tar file1 file2 file3 - Create a gzipped archive: tar czf target.tar.gz file1 file2 file3 - Extract an archive in a target folder: tar xf source.tar -C folder - Extract a gzipped archive in the current directory: tar xzf source.
Read more →

Getting started with WebAssembly

WebAssembly Binary Toolkit - Easiest way to setup WebAssembly binary toolkit. Or if you prefer to manually install it. wat2js - Compile WebAssembly .wat files to a common js module WebAssembly spec - WebAssembly Specification Some examples modules siphash24 - SipHash (2-4) implemented in pure Javascript and WebAssembly. blake2b - Blake2b implemented in WASM xsalsa20 - XSalsa20 implemented in Javascript and WebAssembly
Read more →

The power of 2 random choices

Read more →

camaro

Read more →

Parsing XML at the Speed of Light

This chapter describes various performance tricks that allowed the author to write a very high-performing parser in C++: pugixml. While the techniques were used for an XML parser, most of them can be applied to parsers of other formats or even unrelated software (e.g., memory management algorithms are widely applicable beyond parsers). Found out about this gem, recommended by the author of “Writing a Really, Really Fast JSON Parser”.
Read more →

Redisearch - full text search with Redis

Read more →

minideb - a small base image based on Debian

Read more →

Using alpine as base Docker image

I recently updated all of my personal Dockerfiles that I have for multiple purposes to use alpine as base image. Prior this, I just use ubuntu as the base image and don’t have much care about built-images size. However, using Kubernetes, having small images size can make rolling out update speed much faster. Some tips for reducing Docker image size that I found during my research: Using smaller base image (alpine, busybox, etc.
Read more →

Running twemproxy on kubernetes

Read more →

Setting up traefik as Ingress controller for Kubernetes

Just my own experience setting up traefik as Ingress controller on Kubernetes. Install helm # brew install kubernetes-helm Init helm # helm init Install traefik chart with helm # Download the default values.yaml file and edit it depends on your needs. Then issue the below command. I want to install it to kube-system namespace hence the --namespace kube-system. helm install --name my-traefik --namespace kube-system --values values.yaml stable/traefik If you make a mistake and want to remove it
Read more →

n-api: add support for abi stable module API

Read more →

codis - proxy based redis cluster

Read more →

Redis as a JSON store

Read more →

Spot instances best practices

TLDR Build Price-Aware Applications Check the Price History: In general, picking older generations of instances will result in lower net prices and fewer interruptions. Use Multiple Capacity Pools: By having the ability to run across multiple pools, you reduce your application’s sensitivity to price spikes that affect a pool or two (in general, there is very little correlation between prices in different capacity pools). For example, if you run in five different pools your price swings and interruptions can be cut by 80%.
Read more →

Debugging why k8s autoscaler wouldn’t scale down

Symptom: autoscaler works (it can scale up) but for some reasons, it doesn’t scale down after the load goes away. I spent sometimes debugging and turns out, it’s not really a bug per se. More of a bad luck pod placement on my Kubernetes cluster. I first added --v=4 to get more verbose logging in cluster-autoscaler and watch kubectl get logs -f cluster-autoscaler-xxx. I notice this line from the logs
Read more →

smaz.js - a Node.js module binding for smaz

Read more →

Setting up fluentd log forwarding from Kubernetes to AWS Cloudwatch Logs

Fluentd Docker image to send Kuberntes logs to CloudWatch Very easy to setup. Good option for centralized logging if all of your infrastructures are already in AWS. echo -n "accesskeyhere" > aws_access_key echo -n "secretkeyhere" > aws_secret_key kubectl create secret --namespace=kube-system generic fluentd-secrets --from-file=aws_access_key --from-file=aws_secret_key kubectl apply -f fluentd-cloudwatch-daemonset.yaml On a side note, I think i will need to move fluend configuration file to secret as I just want to collect logs from certain namespace/filter.
Read more →

GopherCon 2016: Kelsey Hightower - Building a custom Kubernetes scheduler

Read more →

Kubernetes spot termination notice handler

Read more →

Fix Terminal no longer uses keychain in MacOS Sierra

Since Sierra, I got prompted for my ssh key password everytime. After digging a bit, it seems Apple just changes it recently. On macOS, specifies whether the system should search for passphrases in the user’s keychain when attempting to use a particular key. When the passphrase is provided by the user, this option also specifies whether the passphrase should be stored into the keychain once it has been verified to be correct.
Read more →

Why we choose Kubernetes over ECS

Read more →

Bring in the Goddamn Adults Already

Time and time again, the young startup promotes their longest-tenured young engineer to become CTO of their 20-something startup. And it makes sense on the surface, because it’s their “best” engineer. And why not? They’ve been there for so long that they know the system they’ve built more than anyone else. But now they have two problems: they lose their “best” engineer, and on top of that, they gain what’s probably a shit manager.
Read more →

Using ioredis with twemproxy

Read more →

kube-monkey

Read more →

Automate Let’s Encrypt certificate genernation for Kubernetes Ingress

Read more →

mycli

Read more →

Sharing secret data in Kubernetes

Read more →

Distelli - Your DevOps Dashboard for Kubernetes

Read more →

Using squid proxy to bypass 3rd party API IP whitelisting

How to setup squid proxy to bypass IP whitelisting
Read more →

Getting started with Kubernetes

Just some of my notes while learning about Kubernetes. I use Google Compute Engine to install mine. Installation # To install Kubernetes, it’s as easy as copy and paste the below command curl -sS https://get.k8s.io | bash If you want to customize some default options, you can edit environment variables curl -sS https://get.k8s.io | MULTIZONE=true KUBERNETES_PROVIDER=gce KUBE_GCE_ZONE=asia-east1-b NUM_NODES=4 bash There’re more environment variables that you can take a look in kubernetes/cluster/gce/config-default.
Read more →

Should I use yarn?

Read more →

The state of tiling window manager for OS X

Read more →

AMP’ed

Read more →

Breaking changes between v4 LTS and v6 LTS

Read more →

mincss

Read more →

Xbox Scorpio vs PS Neo

Read more →

Do’s and Don’ts of AWS Lambda

Read more →

How to import csv file in MySQL

Read more →

No More Vietnam

Read more →

Mildly interesting npm modules

Not in any particular order errno by rvagg worker-farm by rvagg node-timsort microlock thenby.js thenBy is a javascript micro library that helps sorting arrays on multiple keys lz-string node-expat You use Node.js for speed? You process XML streams? Then you want the fastest XML parser: libexpat! Fuse Lightweight fuzzy-search, in JavaScript, with zero dependencies
Read more →

AWS Lambda

So a few months back, when I read of AWS lambda, I instantly fell in love with it though not having any immediate use with it. AWS lambda is perfect for those wish to build microservices. There are many benefits of doing this such as independent deployment, security and scability. But I’m not going to talk about this within this post. This post is merely my experience with AWS Lambda.
Read more →

Flynn 1.0

Read more →

Open-source PaaS on AWS

Read more →

Work hard and go home

Read more →

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.
Read more →

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.
Read more →

Build command line tools with Node.js

Read more →

Classic Programmer Paintings

Read more →

Google kick-starts engineering team in Singapore

Read more →

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.
Read more →

Concurrency and parallelism

Read more →

Implement autocomplete with redis

Read more →

Welcome the second Pom to my family

Read more →

Setting up SSL certificate with Deis

Read more →

Search airport by city name

I recently came across a case where I have an airport list (my data), city list (input data) and I have to map them. The thing is not all the airport and city have similar name. They can be very different like Vieux Fort city and Hewanorra International Airport (UVF). I need to come up with a small service that take city name as input and output their possible nearby airports.
Read more →

How to install Discourse without Docker

I purchased a dead cheap VPS for 5$ a month which come with 2GB of memory, 80GB disk space and quite decent CPU. The downside is they uses a very old kernel (2.6.32-042stab108.8 to be specific) while the official Discourse installation guide use Docker which require a more recent one (3.x). Docker sure makes it easy to install Discourse but it’s the only reason that newer kernel is required. After a quick research, I found this Ansible playbook.
Read more →

A look back at 2015

I kicked off 2015 with lots of anxiety. I reconnect with my best friend from secondary school (then; wife now). For the first time in years, I really wanted to move back to Vietnam. Early in 2015, I went back to Thailand after Tet holiday, start looking around for a job in Vietnam or any job that accept remote workers to smooth the transition. I found one later in May-June. They only require me to work in Thailand for awhile (1 month) so that I can get accustom with how they work there.
Read more →

MariaDB Raises $9M More, Michael Howard Named New CEO, Monty Widenius CTO

Read more →

Chuyện tiền nong

ngồi lẩm nhẩm: mình đi làm mấy năm, nhìn lại thấy tài chính rối tung, tài sản thì chả có gì; cơ hội thì bỏ qua 1 đống. thôi thì bây giờ học cũng chưa quá muộn. tránh mang nợ # nói chung có thì xài, không có thì đừng có vay nợ để xài. xài thẻ debit cũng có nhiều cái hay lắm. hết tiền rồi mà muốn mua món gì đó thì phải ra ngân hàng deposit hoặc chuyển khoản từ ngân hàng khác sang.
Read more →

Better MySQL pagination

Consider this SELECT * from Bookings LIMIT 5000,10 versus this SELECT * from Bookings INNER JOIN (Select id FROM BOOKING LIMIT 5000,10) AS result USING (id) My Bookings table has merely 6000 records yet the first query takes approx ~10 seconds which is outrageous. Luckily, we can optimize this using late lookups like in query 2. In the second query, we select id from Bookings and then join the original table back.
Read more →

Performance at Rest

Read more →

Qmail

qmail is a mail transfer agent (MTA) that runs on Unix. It was written, starting December 1995, by Daniel J. Bernstein (djb) as a more secure replacement for the popular Sendmail program. Một chút background: vào khoảng những năm 80,90 của thế kỷ trước, các máy chủ email và dns thường sử dụng Sendmail và BIND9. Tuy nhiên, 2 phần mềm này có cực kì nhiều lỗi. djb viết ra qmail và djbdns để thay thế 2 phần mềm này và tuyên bố 2 phần mềm này là “bug-free”.
Read more →

Explicit over clever

I always prefer explicit over clever, hacky hack. Explicit make the code looks clearer, more maintainable and leaning toward a more predictable behavior (aka junior developers will be less likely to mess it up). Take an example of this code where I have a folder called providers. This here below is the content of the index.js file which basically read all the files in that folder (except index.js), require them and then module.
Read more →

Step by step how to install Deis on AWS

Deis (pronounced DAY-iss) is an open source PaaS that makes it easy to deploy and manage applications on your own servers. Deis builds upon Docker and CoreOS to provide a lightweight PaaS with a Heroku-inspired workflow. I struggled installing Deis and it took me several times to get it right. Deis’s documentation is correct but not very straight forward so I decided to write this to help others that struggle like me.
Read more →

Metalsmith - a static site generator written in Node.js

Read more →

Possibly the easiest way to setup rtorrent/rutorrent

Installation script which is cumbersome, not very easy to use and sometimes goes unmaintained but you don’t know about that yet and ended messing up your VPS file system. In this post, I will show you how to setup rtorrent/rutorrent with Docker. It’s rather easy and requires minimal knowledge about Linux in general. Grab a KVM VPS from RamNode # I’m going with RamNode here but you can use any VPS provider you want.
Read more →

Snapp

Read more →

Stuff you may not know about console

console.table() # var Person = function(name, age) { this.name = name this.age = age } var person_list = [ new Person('wayne', 10), new Person('cristiano', 20), new Person('david', 30), new Person('bastian', 40) ] console.table(person_list, ['name', 'age']) // filtering columns console.table(person_list) You’ll get a nice table like this console.time() # console.time('Operation A') var arr = [] for (var i =0; i < 100000; ++i) { arr.push(i) } console.timeEnd('Operation A') > Operation A: 395.
Read more →

Node.js happy coding

Node.js best practices
Read more →

ES6 in Node.js

Read more →

Go Native - Calling C++ From NodeJS

Read more →

Atom is slow but that’s okay

I started using Atom from one of those early beta build. I wasn’t impressed. At that time, it was really slow (still is), taking several seconds just to load the app, freeze frequently when I tried to open log file (few MBs) and a bunch of other small bugs here and there. So I went back to Sublime and just keep an eye on Atom once in awhile (I left it in /Applications untouched)
Read more →

Efficient branching workflow with git flow

Read more →

Hello, HotelQuickly!

Read more →

Cancelling $http request in AngularJS

It’s as simple as this. Basically you return a promise (canceller) and let those who call your service ability to cancel via canceller.resolve('reason goes here'). Alternatively, you can provide a function cancel which does the same as canceller.resolve() if you don’t want to expose the canceller promise. .service('MyService', function($http, $q) { this.canceller = $q.defer() this.my_func = function(params) { params.timeout = canceller.promise return { promise: $http.get(url, params), canceller: canceller } } }) To verify if your code is working as expected, you can check in Network tab in Developer Tools.
Read more →

How to install ZeroMQ on Ubuntu

Before installing, make sure you have installed all the needed packages sudo apt-get install libtool pkg-config build-essential autoconf automake sudo apt-get install libzmq-dev Install libsodium # git clone git://github.com/jedisct1/libsodium.git cd libsodium ./autogen.sh ./configure && make check sudo make install sudo ldconfig Install zeromq # # latest version as of this post is 4.1.2 wget http://download.zeromq.org/zeromq-4.1.2.tar.gz tar -xvf zeromq-4.1.2.tar.gz cd zeromq-4.1.2 ./autogen.sh ./configure && make check sudo make install sudo ldconfig Verify to see if zeromq installed correctly # I’m familiar with Node.
Read more →

My first Hackathon

So I went to my first hackathon this weekend and it was fun. There are plenty of pizza, soda, beer for everyone. Chances to meet up with many awesome, cool people from various places. The way I think of hackathons is like: a contest to see which team can come up with the coolest idea and quickly create a working prototype for it by glueing libraries and datasets together. Well, it’s exactly like that.
Read more →

Vì sao tôi thích xài email hơn là điện thoại

Phone call leaves no trace # Tôi cũng không rõ cái này là tốt hay xấu nữa nhưng theo kinh nghiệm bản thân thì xấu nhiều hơn tốt. Tôi hay quên nên đã từng gặp khá nhiều trường hợp cãi nhau vì bạn B quả quyết đã nói/bàn vấn đề đó qua điện thoại. Bởi vậy sau này tự tập cho bản thân thói quen sau khi bàn bạc gì đó qua phone thì sẽ viết 1 email follow-up để tóm tắt lại những ý đã bàn qua cuộc gọi vừa rồi.
Read more →

Markdown table sucks. Let’s use jekyll’s data files instead

Creating a table in markdown sucks, especially if the table is quite big with some styled elements. Back before knowing data files, I came up with a plugin to help with this. First, I create folder to keep my JSON data files. I wrapped it in a simple plugin to generate inline javascript call (AJAX) to render the table upon finish loading. {% jsontable myjsonfilename %} This works as expected but it’s only feasible for simple table structure.
Read more →

Tắt tiếng của tab ở Chrome

Read more →

A collective list of Manchester United players' autobiographies

Read more →

MusicBrainz Picard

Read more →

The Codeless Code - Fables and Kōans for the Software Engineer

Read more →

Đặc quyền con người qua trò ném giấy vào thùng

(…) when conservatives go on about “equality of opportunity, not equality of outcome,” they’re either blinded to the fact that equality of opportunity doesn’t exist or they’re aware of that fact and simply being disingenuous. Be aware of the opportunities that we enjoy, which others may not. Our success might not be merely our own, can hopefully instill in us some empathy for people who didn’t have similar opportunities.
Read more →

Về một thách thức trong quá trình học hỏi

Mỗi đất nước, dân tộc, văn hóa, thậm chí mỗi cá nhân là một vũ trụ phức tạp, chứ không phải là những nhân vật của một vở kịch tuyên truyền thô thiển: người này giỏi, người kia kém, trắng đen rõ ràng và bất biến. Thách thức trong quá trình học hỏi là nhận biết được sự phức tạp, những xung đột, những chấn thương, bế tắc, những năng lượng của một quốc gia, một nền văn hóa.
Read more →

Love

Read more →

Managing multiple SSH tunnels is easy with Secure Pipes

The best OS X app for managing SSH tunnels: local forward, remote forward and auto toggle socks proxy. Free for OS X 10.9 and up
Read more →

Official Oracle driver for Node.JS

Currently at v0.2. node-oracledb makes use of C API for performance which makes it more like a “thick client”. That mean you are required to install Oracle’s client lbiraries1. Though versioned as 0.2, node-oracledb already supports a lot of features such as connection pooling, statement caching, client-result caching, etc… node-oracledb is not yet available through npm. You will have to clone and run npm install manually by yourself. Windows support is still pretty rough but I don’t actually care much.
Read more →

Atom switches to io.js

Great news for io.js team. There are quite a few big names in OSS joining the io.js train already, namely NW.js, Atom. To be fair, I don’t want io.js to merge back to nodejs if they succeed. The more I read about nodejs and Joyent, the more I hate them. io.js should just proceed on their own. As for Atom, it still fails to impress me after a long time. Loading application alone (no project) is approx~ 2 seconds for me1 which is unacceptable.
Read more →

BitTorrent Sync as an alternate backup solution

How to setup BitTorrent Sync as an alternative backup solution along side with Dropbox (or whatever you’re using to backup)
Read more →

Incremental regeneration in latest jekyll build

Incremental regeneration is now available in jekyll. Build speed is faster than before.
Read more →

Theming Apache’s mod_autoindex directory listing

By default, your shared folder with mod_autoindex enabled looks like this. The icons looks like they were from Windows 3.1 era. I am by no mean a designer but looking at this seriously make me want to vomit. I decided to take a quick look at mod_autoindex’s documentation and grab some free icons from Dribbble to make it better. Turns out, it’s easier than I thought. Theming is supported out-of-the-box with mod_autoindex.
Read more →

Some of the most useful tips I learn when working with NodeJS

modules management with npm # Nodejs comes with an amazing package manager called npm. Start a project with npm init which will then create a configuration file named package.json, keeping track of all the modules your project is using. You don’t have to manually manage this file yourself. If you want to add a package to package.json you can add --save parameter when installing it. npm install koa-static --save Also, you should ignore npm_modules folder when git push because whoever clone the repo can do npm install by themselves.
Read more →

Install io.js on Mac OS X

How to install iojs on Mac OS X with nvm
Read more →

How the Other Half Works: an Adventure in the Low Status of Software Engineers

Bill had been a Wall Street quant and had “Vice President” in his title, noting that VP is a mid-level and often not managerial position in an investment bank. His current title was Staff Software Engineer, which was roughly Director-equivalent. He’d taught a couple of courses and mentored a few interns, but he’d never been an official manager. So he came to me for advice on how to appear more “managerial” for the VP-level application.
Read more →

Things software developers wish they had known in their 20s

The era in which a common career trajectory is to become a lifer at some software company and work one’s way up to higher and higher internal positions has been over for a long time (This era had already been over in the 1990s when I was a young programmer). You don’t owe the company you work for anything beyond what you put your name on when you signed the employee agreement.
Read more →

How movies could change your perception

Read more →

Fix WELD-001408 unsatisfied dependencies for type error when deploying to GlassFish

Read more →

REST APIs made easy with StrongLoop

StrongLoop allows you to quickly create REST APIs using their graphic interface and CLI. SLC also supports debugging, profiling, tracing, deploying as well as monitoring features. Creating REST APIs with slc is as easy as creating datasource and model. StrongLoop will do the rest for you. I was very tempted to use StrongLoop for a recent project but I had to deal with a legacy database that use a very old odbc driver which force me to use node.
Read more →

Microsoft HoloLens

Microsoft is really on a roll lately. They are on the right track to regain their cool factor among devs. The device looks truly impressive and based on what we know so far, it looks a lot better than Google Glass and Oculus Rift. When you change the way you see the world, you can change the world you see. It’s interesting that Microsoft calls this holographic technology instead of augumented reality.
Read more →

Create a contact form with jekyll

Simpleast way to create a contact form on jekyll
Read more →

Fuck callbacks! Let’s use generators

Let’s write a simple function hello that return a string when called. var hello = function () { return 'Hello ' + name; } Now convert it into a generator. Call hello() this time will return you an Object instead: the generator. var hello = function *() { return 'Hello ' + name; } Let’s consider the following snippet. var hello = function *() { yield 'Stopped here!'; return 'Hello ' + name; } var generator = hello('Clark Kent'); console.
Read more →

IO performance benchmark on RamNode

Last update: 2015-01-18 I read a IO performance benchmark today comparing AWS vs DigitalOcean. It makes me curious about the IO performance on RamNode. Of course I wouldn’t expect something high since I’m running in one of the lowest tier offerred by them (It’s not even 100% SSD but just some kind of hybrid SSD-Cached). I will also ignore read test since all the VPS are container-based and read is probably heavily-cached anyway.
Read more →

bluebird - a promise library with unmatched performance

The documentation of bluebird is so much better than Q - the library which I’m currently using. bluebird with nodejs is even better: it can convert an existing promise-unaware API to promise-returning API which is so awesome. Thid feature works with most popular libraries (which use error as first arg (as they all should)). I’m sold!! Usage # function getConnection(urlString) { return new Promise(function(resolve) { //Without new Promise, this throwing will throw an actual exception var params = parse(urlString); resolve(getAdapater(params).
Read more →

So I upgraded my VPS

I have little to none demand for web server’s power since my blog is static, plus a couple of small web apps I test on the VPS now and then. Recently, my interests shifted to Ionic framework, nodejs, mongodb and angularjs. I had quite a few ideas for pet projects, mostly for the purpose of learning. I decided to upgrade my VPS to a bit better plan - 256MB of RAM.
Read more →

Scaling node.js application with cluster

node.js’s single thread default architecture prevents it from utilizing multi-cores machines. When you create a new node.js application in WebStorm for example, this is what you get: var debug = require('debug')('myApp'); var app = require('../app'); app.set('port', process.env.PORT || 3000); var server = app.listen(app.get('port'), function() { debug('Express server listening on port ' + server.address().port); }); // in app.listen method app.listen = function(){ var server = http.createServer(this); return server.listen.apply(server, arguments); }; This code snippet will create a simple HTTP server on the given port, executed in a single-threaded process; doesn’t matter how many cores your machine has.
Read more →

io.js v1.0.0 released

A fork of node.js with faster release cycle and open source governance. io.js v1.0.0 also marks the return of Ben Noordhuis with third most commits in node.js as a technical commitee. For those who don’t know about Ben Noordhuis’s story1. Here’s a short version: Ben Noorddhuis was a major contributor to NodeJS and a voluntee Ben Noorddhuis rejected a pull request2 that would have made pronoun in the document gender neutral.
Read more →

Using AngularJS with jekyll

How to make AngularJS works with jekyll since both are using double curly braces syntax
Read more →

A minimal iTerm2 setup

My current machine is a Macbook Air 11 inches so screen estate is a luxury thing. I’ve always try to maximise the use of my screen by things like moving Dock to the side (and auto hide, delay set to 0), making use of multiple Mission Control desktop,etc… It always strikes me that even though iTerm2 already supports tmux out-out-the-box, it still has all that title bar and tab bar. They are basically useless to me.
Read more →

AngularJS diary - Day 4

##Update ng-model of one controller from another Using $broadcast to broadcast a message (or $emit) and put listener on that message on receiver. // unrelated controllers -> $rootScope broadcasts App.controller('Ctrl1', function($rootScope, $scope) { $rootScope.$broadcast('msgid', msg); }); App.controller('Ctrl2', function($scope) { $scope.$on('msgid', function(event, msg) { console.log(msg); }); }); When to use $broadcast and when to use $emit? $broadcast — dispatches the event downwards to all child scopes, $emit — dispatches the event upwards through the scope hierarchy.
Read more →

Pretender - a mock server library

Read more →

The next bullet on my resume: AngularJS

I started a HTML5 hybrid mobile app project recently. Before I start coding the frontend, I had to decide which client side JavaScript framework I will be using. The choice narrows down between AngularJS (Ionic framework) and Ember. Of those two, AngularJS is obviously the more popular choice. There’re many frameworks built on AngularJS; thousands of questions on StackOverflow; lots of open-source projects base on AngularJS on GitHub. There are many great frameworks out there but few has gained so much developer mindshare like AngularJS.
Read more →

How to setup rtorrent, rutorrent on Ubuntu

A simple tutorial on how to setup a seedbox running rtorrent/rutorrent on Ubuntu VPS
Read more →

Using GitHub issue tracker as comment system for your static blog

Using GitHub issue tracker as comment system for your static blog
Read more →

Resume-driven developer

A resume-driven developer can’t seem to use the same technology, in the same way all over again. When assigned an easy task, he will find ways to over-engineering a solution that will make it less boring. He loves injecting new technology into the current project, often without any upfront with other developers (well, this could be very bad since it may introduces competing UI framework, multiples data access methods, repeated functionalities, etc.
Read more →

Shower thought about movie recommedation

Once in awhile, when I see a movie that I like, I go to IMDB and find out who directed it; who are the main actor/actress; what are the others highly rated movies of that director, main actor/actress. Then I will go on systematically watching one film after another. Given that they are good enough to keep me going. The result is decidedly mixed. It doesn’t always turn out to be good as I want but it works, to a degree.
Read more →

Inline Google fonts to further reduce number of blocking CSS resources

Using .woff fonts to further reduce number of blocking CSS resources, with fallbacks to make it compatible with old browsers.
Read more →

Contexts is the perfect companion app for Amethyst

Contexts.app is the perfect companion app for Amethyst
Read more →

How to burn a bootable ISO file to USB stick on OS X

A simple command to burn a bootable ISO file to an USB stick on OS X. No need to install any extra software.
Read more →

Awesome maching learning

A curated list of maching learning frameworks, libraries and softwares.
Read more →

Deferred font loading and using localStorage as cache

Loading custom font is slow even if you’re using CDN. You can use deferred font loading and make use of localStorage for storing loaded font.
Read more →

How to fix Logon failed for login 'username' due to trigger execution error with mssql

How to fix Logon failed for login 'username' due to trigger execution error with SQL Server
Read more →

nodejs: callback vs promise

Asynchronous code war between callback and promise
Read more →

How to setup Sublime-IJulia with Sublime Text

I love Sublime Text. I prefer to do all of my development in Sublime Text if possible, especially when Julia Studio or Juno don’t offer much addtional features. The instructions on GitHub repo is a bit confusing so I decided to rewrite it steps by steps how to set Sublime-IJulia up on OS X. I can’t say for other OS though. I suppose that you have already had homebrew and julia installed (v0.
Read more →

A conversation with stranger

A short conversation with a total stranger.
Read more →

Social sharing button without embedding sharing script crap

How to include social sharing buttons on your website without embedding social script crap
Read more →

When static website isn’t fast enough

I have recently taken a look at my website loading speed again. A bit about my website, as of currently: I hosted my website on a smallest, cheapest VPS plan at RamNode ($15 per year, massive plan) which shares the physical machine with a numerous other people. This website is powered by jekyll - a static site generator. The website is using a custom theme, based on Bootstrap.
Read more →

New theme

Read more →

BAT script to execute commands on remote Unix machine with PuTTY

Read more →

youtube-dl - A must have little gem in your toolbelt

youtube-dl is a small command-line program to download videos from YouTube.com and a few more sites. Installing youtube-dl is as easy as brew install youtube-dl on OS X. youtube-dl allows you to download from many online audio/video sharing websites, not just Youtube. You can use it to download all videos from a playlist, from a channel or simply extracting the audio from a Youtube link. From a channel:
Read more →

Shorter code is better?

Which one do you prefer: shorter code or more legible code? As for me, legibility of the code always come first. Working in a team will make one realize the importance of code legibility sooner or later. Your code is not for you alone to read. It should be friendly and easy for whoever has to maintain your code as well. It’s not easy to write elegant code but it’s much easier to write legible code.
Read more →

Where is the safest seat on airplane?

Read more →

Filco Majestouch 2 Ninja Italian Red (TKL) review

This is a short review of a Filco Majestouch 2 Ninja TKL (Italian Red version). I ordered mine from eBay and the keyboard arrived 3 days later. The keyboard came with some additional keycaps (WASD and Escape keys in red and black) and a keycap puller. First impression # This thing is sexy as hell. This was one of the main reason I purchase this board to begin with.
Read more →

Filco Majestouch 2 Italian Red (TKL) with blue switches

My latest addition to my keyboard collection: an Italian Red Filco Majestouch 2 (tenkeyless version) with blue switches. It’s really hard to find a shop with Filco in stock here in Thailand. I could only find one with black switch in stock, which I am not a huge fan of as it’s the linear type with no tactile feedback and too stiff for my taste. Other shops mostly stock Razer, Rocco, SteelSeries and Ducky.
Read more →

How to find table name when knowing column name and column value in Oracle

How to find list of tables which contains a column with certain name and value in Oracle
Read more →

Some useful use cases for Java Reflection

Some examples of useful use cases for Java Reflection
Read more →

Poker 2 keyboard with Granite and Dolch keycaps

I’m thinking of getting a Poker 2 keyboard and a Granite keycap set just for the sake of looking at “her”. She’s so beautiful, it hurts. My current favorite keyboard is the Laptop Pro with the Matias Silent Switch. It’s so fun to type on though I prefer the shape of the HHKB Pro 2. The downside of HHKB Pro 2 is the lack of supply for novelty keycaps. Poker 2 is the closest thing to HHKB’s form factor at the moment I believe.
Read more →

Force Safari to refresh website’s favicon

How to force Safari to refresh website’s favicon by deleting its icons cache
Read more →

How to setup your VPS as a seedbox in under 15 mins

A tutorial on how to setup your VPS as a seedbox in under 15 minutes. Zero Linux knowledge required.
Read more →

A poor man’s seedbox for $15 a year

How to setup your own seedbox for only $15 a year. Possibly the cheapest seedbox option out there : )
Read more →

LaunchRocket

A Mac PreferencePane for managing services with launchd/launchctl.
Read more →

Download accelerators, managers for Mac

The complete, up-to-date list of all the download accelerators, managers for Mac out there. Pick your favorite.
Read more →

How to lazy-load CSS with JavaScript

How to defer loading (lazy-load) stylesheet with JavaScript to speedup rendering process and improve PageSpeed score.
Read more →

Java 9 is coming with money API

Java 9 is coming with money API, read more about this API at java.net
Read more →

SafariTabSwitching

Safari Tab Switching is a Safari SIMBL plugin which allow switching between tabs using Cmd+1-9.
Read more →

Maxel - a native download accelerator for OS X

Maxel - a native download accelerator for OS X
Read more →

A better sitemap for jekyll

jekyll sitemap use site.time for lastmod so it doesn’t really reflect the actual last modified date of the post but the last updated date of the site instead. I’m not so sure if lastmod attribute has much effect on Google’s crawl rate/SEO to your site since it’s optional but I’m a little picky even when it comes to small thing like this. Since last modified date is available from the source file, it should be generated automatically from that.
Read more →

jQuery Tips and Tricks

Compilation of jQuery tips and tricks by StackOverflow members
Read more →

Is Mailbox (for Mac) the last email client you ever need?

Is Mailbox (for Mac) the last email client you ever need?
Read more →

Fix unable to download huge files with varnish

A simple fix for unable to download huge files with varnish (using pipe).
Read more →

Lift - an app that put your goals into action

Lift - an app that help you to be a better person than you were yesterday
Read more →

Localization with jekyll

Learn how to easily create a multilingual jekyll site without the need of installing any plugin
Read more →

My favorite tiling window manager for OS X

The best tiling window manager for OS X, based on xmonad.
Read more →

How to setup Discourse local dev environment on OS X

The easiest way to setup Discourse local development environment on OS X
Read more →

Post scheduling with jekyll

Easiest way to setup post scheduling with jekyll using cronjob.
Read more →

CloudFlare to offer free-SSL by mid-October

Read more →

jekyll full-text search without jQuery or plugin

Adding full-text search on top of your jekyll websites without using jQuery or plugin
Read more →

Another attempt at regular blogging

I believe blogging help me learn better. In order to write about a subject, first I have to understand it throughly. Blogging is a way to documentating all your thought, your understanding into words. Many people I talked with afraid of being wrong on the Internet. Don’t be. I do it all the time. I learnt a lot from the feedbacks. If the feedback is right, you then learn something new, which is great.
Read more →

jekyll plugin directory

An attempt to create a complete jekyll plugin directory. Submit yours now.
Read more →

Make your jekyll blog a little bit more SEO-friendly

Content is the king but making the site a bit more SEO-friendly (or should I say Google-friendly?) doesn’t hurt. Load speed # Relevant link: Optimize the hell out of your website for PageSpeed. Sitemap # Help Google’s bots crawl your site better. jekyll provides it as a plugin. Structure data markup # Use Google’s structure data markup helper to generate structure data markup code. Use [structure data testing tool](Structured Data Testing Tool) to verify it afterward.
Read more →

Paginated post plugin for jekyll

I was wondering if anyone has created one like this before and stumbled across this issue on octopress repo. imathis came up with this proposition for paginated post. The primary page would be the standard post url. Successive pages would be at post-url/2/index.html, etc. The atom feed will still show the full un-broken post. A unified post will live at post-url/all/index.html containing a print-friendly, un-broken version of the post.
Read more →

How to use jekyll plugins with GitHub Pages

A trick to use any kind of plugin you want with GitHub Pages
Read more →

Writing your first jekyll plugin

Tutorial on how to write your first jekyll plugin.
Read more →

Embedding Liquid code snippet with jekyll

If you want to share some Liquid code snippet or say some Django code, jekyll would try to process it as it looks like valid Liquid template and throw some weird errors. The solution is to use raw tag. Again, I cannot use raw tag nested inside raw tag. Though, you would probably never have to do it, unless writing a blog post about something like this. {% raw %}
Read more →

Monthly/yearly post archive generator plugin for jekyll

A jekyll plugin to generate monthly/yearly archive so you can access them via URL like example.org/2014/08/.
Read more →

Blogging with jekyll

I started using jekyll with Github Pages few years back but Github Pages didn’t allow plugins at the time and I do want to hack a bit around jekyll for my needs so I gradually move to self-hosting. As for static blog doesn’t require much resource, I opted for the lowest package on RamNode which goes for $15 a year (a bit over a buck a month for a 128MB RAM VPS).
Read more →

BetterTube - A jekyll plugin for embedding YouTube videos

BetterTube is a jekyll plugin for embedding YouTube videos. It’s responsive and PageSpeed-friendly by making use of defer iframe loading.
Read more →

Optimizing the hell out of your site for PageSpeed

Static assets bundling # I wrote a post about static assets combine on jekyll but the idea is similar to other framework. You can even do this on Wordpress via plugin called W3TC IIRC. As for your theme’s images, use CSS sprites to combine it to a single image. There are many tools for this purpose. This step is critial because number of requests has a very high impact on page load.
Read more →

Static assets combine with jekyll

Make use of static assets combine (bundling) to reduce number of requests, making your site loads significantly faster.
Read more →

Things you may not know about JavaScript array

Some fun (weird) stuff about JavaScript array.
Read more →

How to connect to remote Postgres DB through ssh tunnel

How to connect to a remote Postgres database securely through SSH tunnel
Read more →

Returning query result as json array with Oracle 10G

How to turn ref cursor into json object in Oracle 10G. An equivalent version of row_to_json of Postgres in Oracle 10G.
Read more →

Setup custom error page for jekyll on nginx

How to setup custom error page for jekyll on nginx.
Read more →

Speed up jekyll site generation with rsync

A little trick to help speeding up jekyll site generation process by skipping certain static files during generation and sync using rsync instead.
Read more →

Hydra - an open-source window manager for OS X written in Lua

Read more →

Clean code/dirty code

I like to think of myself as a perfectionist. I like going back and forth re- evaluate all the possible options and come up with the cleanest, best, perfect alternative (I can think of) out there. If you are like me and you got to maintain someone else’s bad code, this is gonna be a real nightmare. You just want to scratch everything and start over again. Unfortunately, management people doesn’t think so and you don’t get the luxury of times you need.
Read more →

How to use SSH tunnel to access blocked websites

Requirements # An UNIX server/VPS (since it’s cheaper than Windows server/VPS). Lowest package would probably do. Location: not in the the same area/country as you. A little copy/paste skill. No Unix commands knowledge required. Howto # If you’re on Unix/OS X, open Terminal app and issue the command ssh -D 1080 [email protected]_or_domain This command will connect to your server/VPS using ssh and open a ssh tunnel on port 1080 of your computer.
Read more →

How to code like a dick in JS

The goal of this post is to make simple things look complicated. 1. Invert logic # Let’s start with something easy. Instead of if (x && y) { ... } // easy Write this instead if (!(!x || !y)) { ... } // good enough 2. Extended unicode chars for variable names # Use of extended unicode chars, especially those that are not visible in console like \r, \t, etc…
Read more →

Cakebrew

Read more →

Matias Laptop Pro review

A short review of the Matias Laptop Pro, a wireless mechanical keyboard by Matias.
Read more →

Programming is like writing a book

Read more →

How to install Discourse on DigitalOcean

Read more →

Tự do ngôn luận

Con trai hỏi bố: - Bố ơi, tự do ngôn luận là gì hả bố? Bố: - À, là ngay cả 1 thằng ngốc cũng được quyền phát biểu con à. Con trai: - Vậy không có tự do ngôn luận là sao? Bố: - Là nơi đó chỉ có những thằng ngốc mới có quyền nói. Con trai: - ??? Rất đơn giản và dễ hiểu phải không?
Read more →

Be happy

Elizabeth Smart has the kind of fame no one would want: In the summer of 2002, at the age of 14, she became one of the nation’s most famous kidnap victims when she was abducted from her bedroom in Salt Lake City, where she lived with her devout Mormon family. Smart was raped by him nearly every day, sometimes several times a day. The only other person in their camp was Mitchell’s wife, Wanda Barzee, who treated Smart like her slave
Read more →

Matias Quiet Pro black matte case mod

Read more →

My must-have Cydia tweaks/apps

I thought iOS 7 has spoiled me to the point I don’t think I would need to jailbreak. I mean, there’re now Notification Center and Control Center which is a much better improvement (even though Control Center is not customizable). Turns out I was wrong. A few weeks with Cydia and I have found quite a few awesome apps/tweaks. Here’re some on the top of my must-have list. f.lux # Have you ever beem waken up by your phone in the middle of the night and got blinded by how bright the screen was?
Read more →

Matias Ergo Pro

Read more →

GasMask keycap

Read more →

Features vs. Benefits

Read more →

Google Nexus 5 review

Read more →

Phân tâm

Dạo này tôi chủ động không đọc tin tức buổi sáng, mặc dù có thói quen này từ rất lâu rồi. Việc đọc báo cũng giống như 1 dạng nghiện thuốc vậy. Như trước đây, không đọc báo 1 ngày là cảm giác như là tôi đang bỏ qua rất nhiều chuyện đang xảy ra. Nhưng … thực ra việc đọc báo 1 cách ngấu nghiến mới chính là cách làm cho tôi tốn thời gian vào những việc chẳng liên quan gì tới cuộc sống của tôi.
Read more →

IntelliJ IDEA 13 released

Read more →

If humans evolved from monkeys, then why are there still monkeys?

Read more →

Who Needs Stored Procedures, Anyways? (2004 post)

Read more →

IntelliJ IDEA 13 to be released with Java 7 Bundled Mac Installer

Read more →

How to use Source Code Pro font with JetBrains IDE

Source Code Pro is a very nice font but the lack of italic variant makes it unusable (out of the box) in any of JetBrains products. In order to workaround this, you can rather: Copy Source Code Pro’s ttf fonts to folder /Library/Java/Home/lib/fonts (OS X Mavericks) according to this comment on GitHub. It works fine for me. Apparently, by doing this, IntelliJ will pick the regular variant and use it where italic is needed.
Read more →

FastR - an implementation of R in Java

Read more →

What goes into what in MVC

Explain MVC like I’m 5. View:“Hey, controller, the user just told me he wants item 4 deleted.” Controller:“Hmm, having checked his credentials, he is allowed to do that… Hey, model, I want you to get item 4 and do whatever you do to delete it.” Model:“Item 4… got it. It’s deleted. Back to you, Controller.” Controller:“Here, I’ll collect the new set of data. Back to you, view.” View:“Cool, I’ll show the new set to the user now.
Read more →

How to group posts by month in Jekyll archive page

Read more →

The six most common species of code

Read more →

History of the browser user-agent string

Good read. And then Google built Chrome, and Chrome used Webkit, and it was like Safari, and wanted pages built for Safari, and so pretended to be Safari. And thus Chrome used WebKit, and pretended to be Safari, and WebKit pretended to be KHTML, and KHTML pretended to be Gecko, and all browsers pretended to be Mozilla, and Chrome called itself Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.
Read more →

Hyde

Read more →

Humble New Tab Page

Read more →

Letter to a young programmer

From Guido van Rossum - inventor of Python. I heard you enjoy a certain programming language named Python. Programming is a wonderful activity. I am a little jealous that you have access to computers at your age; when I grew up I didn’t even know what a computer was! I was an electronics hobbyist though, and my big dream was to build my own electronic calculator from discrete components. I never did do that, but I did build several digital clocks, and it was amazing to build something that complex and see it work.
Read more →

Pinboard tab sets

Read more →

Nexus 5 and Android KitKat

Read more →

Snip - another screenshot capture/annotation tool

Read more →

Flamingo for Mac

Read more →

Free OCR solution on OS X

Tesseract OCR is probably the best open source OCR engine available. It allows you to convert text from an image. Install tesseract # I suppose you already have homebrew installed. If not, copy and paste this into Terminal. ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" Once you got homebrew, installing tesseract is as simple as brew install tesseract Automate the process # tesseract accepts input as image. If you input is PDF, you will have to convert it to image first, perferably TIFF format.
Read more →

Amethyst - A tiling window manager for OS X

Read more →

Fixing Mac App Store error 100 when purchasing app

Read more →

FACEMATH

Read more →

Dropshelf

An alternative to Yoink and DragonDrop. Yoink is still a better choice IMO; however Dropshelf has few cool features that are not available in Yoink such as multiple shelves; dragging to any edges. Yoink has a great feature which I don’t know why none of the like-apps haven’t considered adding: “move window to mouse location where drag is initiated”. It helps a lot in reducing mouse cursor movement. The last alternative, DragonDrop, on the other hand, is very buggy and use a rather ‘inconvinient’ method (shake the mouse cursor) for displaying the drop window.
Read more →

FileBot

Read more →

Why We Hate Infographics And Why You Should

Read more →

Liquid

Read more →

Minbox

Read more →

Volume Scroll

Read more →

namebench

Read more →

Contexts for Mac

Read more →

Droplr Draw

Read more →

Link Post in Jekyll

Link post is nothing but the post’s title linking to another url instead of the post url. You need to specify where it points to. I use link here but you can just use any name you feel like using. And then in post.html layout and index.html homepage. You just need to check if link is set; change the title’s href to the link variable of the post. You may need to change page variable to post when looping inside your index.
Read more →

Nginx Plus

I myself would love to see nginxorg to go into another direction, like CloudFlare is currently doing, taking advantages of their expertise in serving http and stuff. That way, Nginx Plus will be more of an addon service, a complement to nginxorg instead of an alternative. On the other hand, I’m always tempted at checking out tengine for its dynamic module loading support. I now have one more reason to do so.
Read more →

Shiori - A Pinboard & Delicious Client for OS X

Read more →

Korean Buses Now Wirelessly Charge as They Drive

Read more →

Magic

Read more →

Z-Type

Read more →

How Koreans Solve Their Parking Issue and Saving Oil

Read more →

How To Fake Database Design

In short: Every “noun” gets its own table. “many to many” relationship get their own tables “one to many” relationship require the table that “owns” another table have its id in that other table Any time a table has an id that refers to a row in another table, use a foreign key constraint to make sure that id really exists Doing this would probably results in many tables but it would help ensuring the 3NF(every non-key attrib must provide a fact about key, the whole key and nothing but the key) quite easily and go further for 4NF and 5NF - the ultimate, super-uber normal form (Jeez who need 5NF!
Read more →

homebrew-cask

Read more →

Daring Fireball User Custom Style

Read more →

Layouts v2.0

Read more →

MailDrop.cc - Free Throwaway Email Address

Read more →

Trolling Or Just Pure Stupidity!?

Saw this in TM2’s mailing list early this morning. Since TM 2 is Open Sourced, so why we (unregistered non-commercial users) need to pay for the license keys? I do not remember paying for the license keys for any Open Sourced program in the last decade. It seems to me that the Open Source tag is a ploy to ‘attract’ developers, however, keeping the revenue to the owner himself.
Read more →

Effeckt.css

Read more →

A Proposal to A Better Format for Research Paper

Read more →

Finally

Read more →