Blog / Linux

How to prevent your Linux server from crashing due to php5 ‘oom-killer’ (out of memory) errors

October 29, 2013

I’ve been running this WordPress blog on a Rackspace VPS for a few years now and at one point over 2 years ago, my server running Ubuntu 10.04 would crash from time to time, usually after I publish a new post. The server would run out of memory, which would then use the swap. The swap would run out as well, causing the server to be unresponsive. I had to do a hard reboot of …

How to continuously monitor your Wi-Fi’s signal strength in Ubuntu

October 1, 2013

I was staying at an apartment last night that didn’t have its own Wi-Fi so I had to borrow from a neighbor. However, the signal was very weak and I had to find just the right spot in my apartment to get a decent connection.

Ubuntu has a utility called iwconfig that lets you view your wireless connection’s signal strength. Typing in‘iwconfig wlan0’ (where ‘wlan0’ is the interface name) in a shell would return …

How to share your local web server to the Internet using a reverse SSH tunnel

July 25, 2013

I was recently working with integrating Stripe payments with a Django app. Since it's a subscription-based web application, it made a lot of sense for us to use webhooks, which Stripe supports. You basically set a URL in your Stripe account settings where Stripe could POST when an event occurs (eg. trial ends, subscription canceled due to an unpaid invoice, etc.). This eliminates the need of having to poll the Stripe server to check …

How to detect new sound devices using command line in Ubuntu 12.04

June 17, 2013

I sometimes connect my Ubuntu laptop to my LCD TV via the HDMI port to watch movies. When I plug in the cable the display works right away but the new sound device (the TV’s speakers) is usually not detected unless I log off and re-login.

An easier way to do this is to restart the pulseaudio service to detect the TV’s speakers via command line. To do this just type:

pulseaudio –kill

The pulseaudio …

How to set an older kernel version as the default in GRUB during bootup (Ubuntu 12.04)

May 23, 2013

I updated my Ubuntu's kernel (Sputnik kernel for the Dell XPS 13) a couple of days ago but I quickly noticed that this new kernel (verson 3.2.0-43-generic) broke the backlight brightness adjustment setting of my laptop. It was basically stuck at the highest setting which is way too bright for me when working in the dark.

I thought about possibly rolling back the version, but then realized there's actually no need to roll …