<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>Pear Code</title><generator>Tumblr (3.0; @pearcode)</generator><link>http://code.gruszka.info/</link><item><title>Colors in Git</title><description>&lt;p&gt;&lt;pre&gt;$ git config --global color.ui true&lt;/pre&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/22662147785</link><guid>http://code.gruszka.info/post/22662147785</guid><pubDate>Tue, 08 May 2012 20:46:03 +0200</pubDate></item><item><title>How to send POST with curl?</title><description>&lt;pre&gt;$ curl -d "param1=value1&amp;amp;param2=value2" &lt;a href="http://example.com/resource.cgi"&gt;http://example.com/resource.cgi&lt;/a&gt;&lt;/pre&gt;
&lt;pre&gt;$ curl -F "fileupload=@filename.txt" &lt;a href="http://example.com/resource.cgi"&gt;http://example.com/resource.cgi&lt;/a&gt;&lt;/pre&gt;&lt;p&gt;

&lt;/p&gt;&lt;p&gt;
For a RESTful HTTP POST containing XML or JSON, use this:
&lt;/p&gt;&lt;pre&gt;$ curl -X POST -d @filename &lt;a href="http://example.com/path/to/resource"&gt;http://example.com/path/to/resource&lt;/a&gt;&lt;/pre&gt;</description><link>http://code.gruszka.info/post/22504858913</link><guid>http://code.gruszka.info/post/22504858913</guid><pubDate>Sun, 06 May 2012 09:54:22 +0200</pubDate><category>linux</category></item><item><title>First things you need to do after Ubuntu installation</title><description>&lt;p&gt;First things you need to do after Ubuntu installation:&lt;br/&gt;
- sudo apt-get install compizconfig-settings-manager (turn on panel autohide and change icons size)&lt;br/&gt;
- sudo apt-get install vim&lt;br/&gt;
- sudo apt-get install pysdm (partitions automount; Storage Device Manager)&lt;/p&gt;

&lt;p&gt;Write your own and extend this list ;)&lt;/p&gt;</description><link>http://code.gruszka.info/post/21973244135</link><guid>http://code.gruszka.info/post/21973244135</guid><pubDate>Sat, 28 Apr 2012 14:46:00 +0200</pubDate><category>linux</category><category>ubuntu</category></item><item><title>MemoryError and numpy / matplotlib</title><description>&lt;p&gt;If you see MemoryError in your application running within Apache (in my case with wsgi [mod_wsgi]) it is probably because of SELinux.&lt;/p&gt;

&lt;p&gt;You have to allow httpd to execute code from the /tmp directory&lt;/p&gt;

&lt;pre&gt;root # setsebool httpd_tmp_exec on&lt;/pre&gt;

&lt;p&gt;More info: &lt;a href="http://docs.fedoraproject.org/en-US/Fedora/13/html/Managing_Confined_Services/sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html"&gt;http://docs.fedoraproject.org/en-US/Fedora/13/html/Managing_Confined_Services/sect-Managing_Confined_Services-The_Apache_HTTP_Server-Booleans.html&lt;/a&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/21841801320</link><guid>http://code.gruszka.info/post/21841801320</guid><pubDate>Thu, 26 Apr 2012 12:02:00 +0200</pubDate><category>Apache</category><category>linux</category><category>matplotlib</category><category>numpy</category><category>python</category><category>wsgi</category><category>mod_wsgi</category></item><item><title>Problem with eAccelerator and Doctrine 2</title><description>&lt;p&gt;When you see message &amp;#8220;Class X is not a valid entity or mapped super class”  you can solve this problem with adding two lines to the .htaccess file:&lt;/p&gt;

&lt;pre&gt;
php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0
&lt;/pre&gt;

There is also &lt;a href="http://wildlyinaccurate.com/eaccelerator-and-doctrine-2/"&gt;article&lt;/a&gt; which describes problem mentioned above.</description><link>http://code.gruszka.info/post/21776023071</link><guid>http://code.gruszka.info/post/21776023071</guid><pubDate>Wed, 25 Apr 2012 12:04:44 +0200</pubDate><category>php</category><category>symfony2</category></item><item><title>How to set/change host in Symfony 2 command?</title><description>&lt;p&gt;&lt;pre class="sh_php"&gt;
$host = $this-&amp;gt;getContainer()-&amp;gt;getParameter('host');
$this-&amp;gt;getContainer()-&amp;gt;get('router')-&amp;gt;getContext()-&amp;gt;setHost($host);

$this-&amp;gt;getContainer()-&amp;gt;get('router')-&amp;gt;getContext()-&amp;gt;setScheme('https');
$this-&amp;gt;getContainer()-&amp;gt;get('router')-&amp;gt;getContext()-&amp;gt;setBaseUrl('/web');
&lt;/pre&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/20517790139</link><guid>http://code.gruszka.info/post/20517790139</guid><pubDate>Thu, 05 Apr 2012 10:02:41 +0200</pubDate><category>php</category><category>symfony</category><category>symfony2</category></item><item><title>scp dir / file with spaces</title><description>&lt;p&gt;&lt;pre class="sh_sh"&gt;
scp user@host:'"/home/user/file with spaces"' .
&lt;/pre&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/18007944938</link><guid>http://code.gruszka.info/post/18007944938</guid><pubDate>Tue, 21 Feb 2012 14:21:52 +0100</pubDate><category>linux</category></item><item><title>Python SMTP Debugging Server</title><description>&lt;p&gt;&lt;pre class="sh_sh"&gt;python -m smtpd -n -c DebuggingServer localhost:1025&lt;/pre&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/17208530327</link><guid>http://code.gruszka.info/post/17208530327</guid><pubDate>Tue, 07 Feb 2012 14:42:16 +0100</pubDate><category>python</category></item><item><title>Google chart API (images) doesn’t allow negative values for line chart. Is it a joke?</title><description>&lt;p&gt;Google chart API (images) doesn’t allow negative values for line chart. Is it a joke?&lt;/p&gt;</description><link>http://code.gruszka.info/post/16764485283</link><guid>http://code.gruszka.info/post/16764485283</guid><pubDate>Mon, 30 Jan 2012 17:48:00 +0100</pubDate></item><item><title>Adding a startup script in Ubuntu / Debian</title><description>&lt;p&gt;Create script in /etc/init.d:
&lt;/p&gt;&lt;pre class="sh_sh"&gt;
case "$1" in
    start)
        #something here
    ;;
    stop)
        killproc -TERM /usr/local/bin/noip2
    ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac
exit 0
&lt;/pre&gt;


&lt;p&gt;Add script to rc.d:
&lt;/p&gt;&lt;pre&gt;update-rc.d script defaults&lt;/pre&gt;</description><link>http://code.gruszka.info/post/16753091432</link><guid>http://code.gruszka.info/post/16753091432</guid><pubDate>Mon, 30 Jan 2012 09:18:00 +0100</pubDate><category>linux</category><category>bash</category></item><item><title>Using INSERT IGNORE with MySQL to prevent duplicate key errors</title><description>&lt;p&gt;&lt;pre class="sh_sql"&gt;
INSERT IGNORE INTO mytable
    (primaryKey, field1, field2)
VALUES
    ('abc', 1, 2),
    ('def', 3, 4),
    ('ghi', 5, 6);
&lt;/pre&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/16297053913</link><guid>http://code.gruszka.info/post/16297053913</guid><pubDate>Sun, 22 Jan 2012 18:55:01 +0100</pubDate><category>mysql</category><category>sql</category></item><item><title>Colorized tail</title><description>&lt;p&gt;&lt;pre class="sh_sh"&gt;
tailcolor() {
    tail -f -n5000 $1 | perl -pe "s/$2/\e[1;31;43m$&amp;amp;\e[0m/g"
}
&lt;/pre&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/16296988985</link><guid>http://code.gruszka.info/post/16296988985</guid><pubDate>Sun, 22 Jan 2012 18:53:51 +0100</pubDate><category>linux</category><category>shell</category></item><item><title>Display available memory on Linux / Ubuntu</title><description>&lt;p&gt;&lt;pre class="sh_sh"&gt;cat /proc/meminfo&lt;/pre&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/16296933216</link><guid>http://code.gruszka.info/post/16296933216</guid><pubDate>Sun, 22 Jan 2012 18:52:50 +0100</pubDate><category>linux</category><category>shell</category></item><item><title>Compare Directories using Diff in Linux</title><description>&lt;p&gt;Use this command:
&lt;/p&gt;&lt;pre class="sh_sh"&gt;
diff -qr --exclude=.svn dir1 dir2|sort
&lt;/pre&gt;

&lt;p&gt;-q = print result only where files are different&lt;/p&gt;
&lt;p&gt;-r = recursive&lt;/p&gt;
&lt;p&gt;&amp;#8212;exclude = use it if something has to be excluded&lt;/p&gt;</description><link>http://code.gruszka.info/post/16296871109</link><guid>http://code.gruszka.info/post/16296871109</guid><pubDate>Sun, 22 Jan 2012 18:51:43 +0100</pubDate><category>linux</category><category>shell</category></item><item><title>How to trim non-breaking space in PHP</title><description>&lt;p&gt;Use this snippet:
&lt;/p&gt;&lt;pre class="sh_php"&gt;
$trim = trim($text, " \xC2\xA0\n\t\r\0\x0B");
&lt;/pre&gt;

&lt;p&gt;\xC2\xA0 is non-breaking space (alt+space in mac os x)&lt;/p&gt;</description><link>http://code.gruszka.info/post/16296728927</link><guid>http://code.gruszka.info/post/16296728927</guid><pubDate>Sun, 22 Jan 2012 18:49:11 +0100</pubDate><category>php</category></item><item><title>How to create *.tar.gz and *.tar.bz2 files</title><description>&lt;p&gt;tar.gz:
&lt;/p&gt;&lt;pre class="sh_sh"&gt;
$ tar -zcvf archive_name.tar.gz directory_to_compress
&lt;/pre&gt;

&lt;p&gt;tar.bz2:
&lt;/p&gt;&lt;pre class="sh_sh"&gt;
$ tar -jcvf archive_name.tar.bz2 directory_to_compress
&lt;/pre&gt;</description><link>http://code.gruszka.info/post/16296614559</link><guid>http://code.gruszka.info/post/16296614559</guid><pubDate>Sun, 22 Jan 2012 18:47:07 +0100</pubDate><category>linux</category><category>shell</category></item><item><title>How to exclude dir in grep</title><description>&lt;p&gt;Add parameter &amp;#8212;exclude-dir to the grep command:
&lt;/p&gt;&lt;pre class="sh_sh"&gt;
grep -R --exclude-dir=example_dir "something" *
&lt;/pre&gt;</description><link>http://code.gruszka.info/post/16296472441</link><guid>http://code.gruszka.info/post/16296472441</guid><pubDate>Sun, 22 Jan 2012 18:44:32 +0100</pubDate><category>linux</category><category>shell</category></item><item><title>How To Clone or Copy a VirtualBox Virtual Disk</title><description>&lt;p&gt;&lt;pre&gt;VBoxManage clonehd "DiskToClone.vdi" "ClonedDisk.vdi"&lt;/pre&gt;

or

&lt;pre&gt;VBoxManage internalcommands setvdiuuid "CopiedDisk.vdi"&lt;/pre&gt;&lt;/p&gt;</description><link>http://code.gruszka.info/post/16296336161</link><guid>http://code.gruszka.info/post/16296336161</guid><pubDate>Sun, 22 Jan 2012 18:42:02 +0100</pubDate><category>virtualbox</category><category>virtualization</category></item><item><title>Terminal colors in Python</title><description>&lt;p&gt;It depends on what platform you are on. The most common way to do this is by printing ANSI escape sequences. For a simple example, here is some python code:
&lt;/p&gt;&lt;pre class="sh_python"&gt;
class bcolors:
    HEADER = '\033[95m'
    OKBLUE = '\033[94m'
    OKGREEN = '\033[92m'
    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'

    def disable(self):
        self.HEADER = ''
        self.OKBLUE = ''
        self.OKGREEN = ''
        self.WARNING = ''
        self.FAIL = ''
        self.ENDC = ''
&lt;/pre&gt;

&lt;p&gt;To use code like this, you can do something like:
&lt;/p&gt;&lt;pre class="sh_python"&gt;
print bcolors.WARNING + "Warning: No active frommets remain. Continue?" + bcolors.ENDC
&lt;/pre&gt;
Source: &lt;a href="http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python"&gt;http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python&lt;/a&gt;</description><link>http://code.gruszka.info/post/16295659900</link><guid>http://code.gruszka.info/post/16295659900</guid><pubDate>Sun, 22 Jan 2012 18:29:35 +0100</pubDate></item><item><title>Python pretty print</title><description>&lt;p&gt;Simply &amp;#8220;print&amp;#8221; show objects in ugly format. If you want to see object nice formatted use instruction below:
&lt;/p&gt;&lt;pre class="sh_python"&gt;
from pprint import pprint

data = data = [(1, {'a':'A', 'b':'B', 'c':'C', 'd':'D'}), (2, {'e':'E', 'f':'F', 'g':'G', 'h':'H', 'i':'I', 'j':'J', 'k':'K', 'l':'L'})]
pprint(data, indent=4, depth=3)
&lt;/pre&gt;

&lt;pre&gt;
[   (1, {   'a': 'A', 'b': 'B', 'c': 'C', 'd': 'D'}),
    (   2,
        {   'e': 'E',
            'f': 'F',
            'g': 'G',
            'h': 'H',
            'i': 'I',
            'j': 'J',
            'k': 'K',
            'l': 'L'})]
&lt;/pre&gt;

&lt;p&gt;The amount of indentation added for each recursive level is specified by indent; the default is one.&lt;/p&gt;

&lt;p&gt;The number of levels which may be printed is controlled by depth. By default, there is no constraint on the depth of the objects being formatted.&lt;/p&gt;</description><link>http://code.gruszka.info/post/16295530959</link><guid>http://code.gruszka.info/post/16295530959</guid><pubDate>Sun, 22 Jan 2012 18:27:12 +0100</pubDate><category>python</category></item></channel></rss>

