Blog / Howto

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 …

A simple Python program for exporting a list of dictionaries to a PDF table using ReportLab

April 16, 2013

I’m currently working on a project where I need to generate some reports in PDF format. Pretty much all of them use tables to display some data from a database, so I created this small program for easily exporting a list of dictionaries to a table in a PDF file.

data_to_pdf.py

from operator import itemgetter

from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch
from reportlab.lib.pagesizes import letter
from reportlab.platypus import Paragraph, …

How to do port forwarding through SSH tunneling on Ubuntu 12.04

January 29, 2013

The place I was staying in last night requires me to register my devices’ MAC addresses with their access points to be given access. I couldn’t help but think that they could be tracking my online activities with this.

Of course, the reason they’re probably doing MAC Address Filtering is to make it harder for people not staying in the hotel to piggyback off their connection. Most places will just have a Wi-Fi password. But …

How to add self-signed certificates to the certificate store on Ubuntu Linux 12.04 to remove security warnings in Google Chrome

January 28, 2013

I use self-signed certificates for my websites and I finally found the security warnings in Google Chrome (Chromium) annoying enough that I decided to do something about it. When you’re accessing your sites many times a day, that extra step of clicking “continue” adds up. The solution is to add the certificate and make it “trusted” in the certificate store that Google Chrome uses.

On Windows, this is very easy to do. You simply export …