How to Remove All Unused Linux Kernel Headers, Images and Modules

Use the following command to remove
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

#Then regenerate grub menu,
sudo update-grub to regenerate grub list
Credit goes to original source

Pip install z3c.rml error Ubuntu

When installing z3c.rml, I have encounter the following error message:
fatal error: libxml/xmlversion.h: No such file or directory ... 'gcc' failed:
if you see something related to libxml and libxslt when you trace back then the following packages may solve the problem:
sudo apt-get install libxslt1-dev libxslt1.1
sudo apt-get install libxml2 libxml2-dev

How to make a Django model ForeignKey optional

Looks like you need to have both blank=True and null=True to make a ForeignKey optional in a django model

Auto Fix Indentation Problem for Python code

Use autopep8, on Ubuntu you may need install autopep8 using the follow method,
sudo python -m easy_install autopep8
# dry run, does not do real changing
autopep python_script.py 
# format the code; it is a good idea to back up your code before executing
autopep8 -i python_script.py 
Please note if you run the following command to install autopep8, you may end up getting the wrong package pep8 which check the formatting only.
sudo apt-get install pep8

PyQt Menubar in Ubuntu does not show

Have you ever wondered why Menubar defined in your program using PyQt does not show in Ubuntu? However it works fine in Window. Well here is the answer: Menubar is outside the application in Ubuntu. You can find it in global menu. Look for it at the top left corner next to the close/mini/max icon.

CentOS Httpd Reverse Proxy Using VirtualHost

Make modifications to file /etc/httpd/conf/httpd.conf by adding the following lines to it:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName ncw0116.com
ProxyRequests off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
Then restart httpd:sudo /etc/init.d/httpd restart , you could visit your new website by omitting the port number 8080. I could also call the upper method as port forwarding.

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...