Migrate to Hugo From Octopress
Jun 23, 2019
Two weeks ago I decided to migrate my blog from Octopress to Hugo. I have been using Octopress as my blog engine since 2013 and I don’t have any problems with it. I can easily generate my blog as a static site with Octopress and host it on Github. It is a lot better setup than using Wordpress which requires database and PHP server. However, Octopress is not actively developed anymore and this is one of the reasons why I decided to migrate my blog to Hugo.
How to Run Code Snippet in Heroku Rails Console
Aug 18, 2018
Often in my day to day work, I need to run a snippet in rails console to fix or investigate issues. Since our application is hosted on Heroku, I can do this by running heroku rails console --app app-name and in a matter of seconds I am connected to the rails console on production.
In some cases, I need to run a really long code snippet especially if the fix needs to touch a lot of data.
Download CSV Test in Go
Jun 23, 2018
In the project I am working on, I have to write a test for a function that download CSV from external website and store it locally. I am pretty new in Go so please let me know if I am doing it wrong.
The function is pretty simple, it uses the Go net/http package to send a GET request and os package to write the HTTP response to a local file.
Google Spreadsheet as JSON API
Dec 25, 2017
Data store is an important piece in most of the modern applications. The implementation can range from a simple text file to a complicated database systems. In this blog post, I will show you how to use Google Spreadsheet as a data store for your application.
Google Spreadsheet provides a convenient way to store, edit, share and retrieve data. This makes Google Spreadsheet appealing if you want to quickly prototype an app and don’t want to spend time building a CRUD interface to manage your data.
Trello Card Repeater
Dec 17, 2017
I’ve been using Trello as my primary task managers for the past couple of years. Recently, I found a very useful feature in Trello that helps me automating the creation of repetitive tasks.
This feature allows you to tell Trello to create a card on specified time such as daily, weekly, monthly or annually.
At the moment, I am using this feature to create a few daily tasks that I want to do first in the morning such as meditation, coding exercise and learning chinese.
Run Sidekiq Jobs Without Starting Worker Process
Aug 06, 2017
You can add the code snippet below to config/initializers/sidekiq.rb if you don’t want to start a separate sidekiq workers.
The configuration below will make sure that the sidekiq jobs will be executed without worker process.
This is handy if you don’t want to open an extra terminal tab or tmux window for worker process.
1 2 3 4 5 # config/initializers/sidekiq.rb if Rails.env.development? require 'sidekiq/testing' Sidekiq::Testing.inline! end See the official Sidekiq wiki for more information: https://github.
Regular Expression For A String Containing One Word But Not Another
Jul 28, 2017
Last weekend, one our apps that is hosted on Heroku were reporting a lot of R14 errors.
R14 is an error that thrown by Heroku if the machine is running out of memory.
I quickly jumped into (logentries)[https://logentries.com/] to download the log file and opened it in Sublime Text.
However, I was having problem finding the request that is causing the problem because we also have our background job workers reporting R14 errors.
Monitor Background Jobs with New Relic Query Language
Jul 01, 2017
Background In this blog post, I’ll show you how to set up an alert to monitor your sidekiq jobs using New Relic Query Language and New Relic Alert.
I was given a task to find a solution to monitor our sidekiq jobs. In the past, I used New Relic Sidekiq Plugin ( https://newrelic.com/plugins/secondimpression/131 ) to do this.
The plugin is a Ruby app that connects to your Redis instance, retrieves all of the sidekiq metrics such as jobs, queues and send it to New Relic using the agent library.
Setting Up Elasticsearch Watcher to Check For Cluster Status on Elastic Cloud
Jan 30, 2017
Last week, I was busy migrating our staging and production Elasticsearch clusters from AWS Elasticsearch to Elastic Cloud. The reason behind this migration is because we need dynamic scripting feature in our application and Elastic Cloud is the only managed Elasticsearch hosting that currently supports dynamic scripting.
In terms of pricing, Elastic Cloud is slightly more expensive than AWS Elasticsearch. I think this is because they are using AWS EC2 under the hood.
Setting Up L2TP VPN to Bypass Great Firewall Of China
Jan 11, 2017
Last month, I traveled to China for the second time. Unlike my first trip, this time I am more prepared to bypass the great firewall of China.
During my first trip in China, I was mainly relying on simple SSH tunnel to get access to Gmail and all other blocked services. This solution is unrealiable because I couldn’t use it on my Android phone. Aside from that, I also kept having constant dropouts which explained in this blog post http://blog.