Pear Code
Colors in Git

$ git config --global color.ui true

How to send POST with curl?
$ curl -d "param1=value1&param2=value2" http://example.com/resource.cgi
$ curl -F "fileupload=@filename.txt" http://example.com/resource.cgi

For a RESTful HTTP POST containing XML or JSON, use this:

$ curl -X POST -d @filename http://example.com/path/to/resource
First things you need to do after Ubuntu installation

First things you need to do after Ubuntu installation:
- sudo apt-get install compizconfig-settings-manager (turn on panel autohide and change icons size)
- sudo apt-get install vim
- sudo apt-get install pysdm (partitions automount; Storage Device Manager)

Write your own and extend this list ;)

MemoryError and numpy / matplotlib

If you see MemoryError in your application running within Apache (in my case with wsgi [mod_wsgi]) it is probably because of SELinux.

You have to allow httpd to execute code from the /tmp directory

root # setsebool httpd_tmp_exec on

More info: http://docs.fedoraproject.org/en-US/Fedora/13/html/Managing_Confined_Services/sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html

Problem with eAccelerator and Doctrine 2

When you see message “Class X is not a valid entity or mapped super class” you can solve this problem with adding two lines to the .htaccess file:

php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0
There is also article which describes problem mentioned above.
How to set/change host in Symfony 2 command?

$host = $this->getContainer()->getParameter('host');
$this->getContainer()->get('router')->getContext()->setHost($host);

$this->getContainer()->get('router')->getContext()->setScheme('https');
$this->getContainer()->get('router')->getContext()->setBaseUrl('/web');

scp dir / file with spaces

scp user@host:'"/home/user/file with spaces"' .

Python SMTP Debugging Server

python -m smtpd -n -c DebuggingServer localhost:1025

Google chart API (images) doesn’t allow negative values for line chart. Is it a joke?

Adding a startup script in Ubuntu / Debian

Create script in /etc/init.d:

case "$1" in
    start)
        #something here
    ;;
    stop)
        killproc -TERM /usr/local/bin/noip2
    ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac
exit 0

Add script to rc.d:

update-rc.d script defaults