Install PyQt in a virtualenv with Pip

Noticed that pip install pyqt isn't working? At least at the time of writing this blog it isn't..

This is the error that I got:
IOError: [Errno 2] No such file or directory: setup.py

It seems they didn't package it well and it's using configure.py to install. So …

Continue reading »

Ignoring every channels join/part/quit messages in IRSSI

Tired of all those join part messages?

/ignore \* joins  
/ignore \* parts  
/ignore \* quits  
/save

Read more about ignore /help ignore

Taken from Archwiki: https://wiki.archlinux.org/index.php/Irssi

Continue reading »

Create tar archive of changed/added files in a git commit

The following command first gets the changed and added files of a git commit and then creates a tar archive of those changed files.

git show {{COMMIT_ID}} --name-status | grep -Ew '^M|A' | awk '{ print $2 }' | xargs tar czf usb-passthrough.tar.gz

Continue reading »

Full migration/clone of linux installation to a new system(Without reinstalling)

I'm switching to a new laptop, but don't want to have to install Archlinux again. So instead of re-installing I will try to copy all files and hope the system will work. In this blogpost I will describe the steps and issues I encountered while doing so.

Status: Succeeded!!!!

Summary …

Continue reading »

Only use worker when required on heroku with Django/Python

For a mobile project I required a background worker which sents an email with 300 generated QR codes zipped together as attachment. This costs quite some time so we need a background worker to execute this task.

I wanted to achieve the following result:

  • When the user wants to generate …

Continue reading »

Using Sendgrid with Django on Heroku (How to find your Sendgrid password on Heroku)

While setting up sentgrid I was searching for my password of sendgrid, but coudn't find it. You can get it in the following way:

heroku config --long

Which will show the parameters:
SENDGRID_PASSWORD, SENDGRID_USERNAME

After you get your username don't forget to add it to django settings:

EMAIL\_HOST = 'smtp …

Continue reading »

Django Custom View Decorator with Arguments

To make my life easier I made a simple decorator which checks if the parameters are present in the request.POST or request.GET and returns a response if they are not.

It accepts a list of parameters in string format and will loop through each parameter to check if …

Continue reading »

Simple function to return json in Django

Just a small code snippet I use when I need to return json, comments are welcomed.

from django.http import HttpResponse  
from django.utils import simplejson as json

def json_response(dict_to_convert_to_json):  
    return HttpResponse(json.dumps(dict_to_convert_to_json),
                        mimetype="application/json")

To use it in your view you just do it this …

Continue reading »

Chinese New Year 2012

The Chinese New Year aka Spring Festival is the most important festival in Chinese culture. All the people travel back to their hometown, because most of them are working/studying in cities far from their own hometown. That means all train tickets are sold the day they get available and …

Continue reading »

Importing a SQL dump in postgres

I always keep forgetting how to import a SQL dump into postgres and found it always hard to find the right documentation. So I thought lets share it:

psql -d dbname -U username -f dumpfile.sql

This should also work with files created by pgdump.

Continue reading »