<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>0xcb0 Blog</title>
	<atom:link href="http://www.0xcb0.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.0xcb0.com</link>
	<description>thoughts, ideas and feelings around a coders everyday life</description>
	<lastBuildDate>Wed, 19 Oct 2011 14:39:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>running parallel bash tasks on OS X</title>
		<link>http://www.0xcb0.com/2011/10/19/running-parallel-bash-tasks-on-os-x/</link>
		<comments>http://www.0xcb0.com/2011/10/19/running-parallel-bash-tasks-on-os-x/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 14:38:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[brew]]></category>
		<category><![CDATA[homebrew]]></category>
		<category><![CDATA[parallel]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=388</guid>
		<description><![CDATA[How often did you needed to process huge amounts of small files, where a single task uses only a small amount of cpu and memory? However, today I need a script which does exactly this. I have a mysql table which contains the filenames located on my hard drive. Now I created a little script [...]]]></description>
			<content:encoded><![CDATA[<p>How often did you needed to process huge amounts of small files, where a single task uses only a small amount of cpu and memory?<br />
However, today I need a script which does exactly this.</p>
<p>I have a mysql table which contains the filenames located on my hard drive.<br />
Now I created a little script which processes a single file in under 3 seconds. Unfortunately for 10.000+ files this would take more than 8 hours. </p>
<p>So what if I could run them in parallel with a maximum of 10 parallel task&#8217;s being executed? This would really speed up the computation!</p>
<p>Luckily in 2005 Ole Tange from GNU merged the command line tools xxargs and parallel into the a single tool &#8216;<a href="http://www.gnu.org/software/parallel/" title="parallel" target="_blank">parallel</a>&#8216;.<br />
With this great tool there is no need to write any complicated script to accomplish such tasks.<br />
First you need to install it using <a href="https://github.com/mxcl/homebrew" title="homebrew" target="_blank">homebrew</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> parallel</pre></div></div>

<p>After that i had to add the path to my .profile</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Cellar<span style="color: #000000; font-weight: bold;">/</span>parallel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20110822</span><span style="color: #000000; font-weight: bold;">/</span>bin</pre></div></div>

<p>Here&#8217;s the basic usage:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> $<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;1<span style="color: #000099; font-weight: bold;">\n</span>2<span style="color: #000099; font-weight: bold;">\n</span>3<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> parallel <span style="color: #660033;">-j2</span> <span style="color: #ff0000;">&quot;echo the number is {.}&quot;</span></pre></div></div>

<p>This would echo the numbers 1, 2, 3 to the stdout with a maximum of 2 parallel running echo&#8217;s.<br />
Here&#8217;s the output:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">the number is <span style="color: #000000;">1</span>
the number is <span style="color: #000000;">3</span>
the number is <span style="color: #000000;">2</span></pre></div></div>

<p>As you can see printing a 3 outspeeds printing a 2 <img src='http://www.0xcb0.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>So here is my 1 liner to process all my files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> $<span style="color: #000000; font-weight: bold;">&gt;</span> mysql <span style="color: #660033;">-uroot</span> -p<span style="color: #7a0874; font-weight: bold;">&#91;</span>secretPW<span style="color: #7a0874; font-weight: bold;">&#93;</span> my_database <span style="color: #000000; font-weight: bold;">&lt;</span> \ 
    <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;SELECT filename FROM files&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>\ 
    <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'filename'</span> <span style="color: #000000; font-weight: bold;">|</span> parallel <span style="color: #660033;">-j10</span> <span style="color: #ff0000;">&quot;./processFile.sh {.}&quot;</span></pre></div></div>

<p>After using this it took only 37min to process my 10000+ files <img src='http://www.0xcb0.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2011/10/19/running-parallel-bash-tasks-on-os-x/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2011%2F10%2F19%2Frunning-parallel-bash-tasks-on-os-x%2F&amp;title=running%20parallel%20bash%20tasks%20on%20OS%20X" id="wpa2a_2">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2011/10/19/running-parallel-bash-tasks-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netbeans 7 and the missing JAX-RPC plugin</title>
		<link>http://www.0xcb0.com/2011/07/21/netbeans-7-and-the-missing-jax-rpc-plugin/</link>
		<comments>http://www.0xcb0.com/2011/07/21/netbeans-7-and-the-missing-jax-rpc-plugin/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 18:13:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[wsdl]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[jax]]></category>
		<category><![CDATA[jax-rpc]]></category>
		<category><![CDATA[jaxb binding]]></category>
		<category><![CDATA[missing plugin]]></category>
		<category><![CDATA[netbeans 7]]></category>
		<category><![CDATA[update center]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=384</guid>
		<description><![CDATA[I haven&#8217;t used Netbeans JAX binding for over a year. And the last time I used it, it was easy to find in the plugin menu of Netbeans 6. Now I&#8217;ve upgraded to Netbeans 7 and wasn&#8217;t able to find the plugin. Happily I found a page that advised me to add http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz to the [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t used Netbeans JAX binding for over a year.<br />
And the last time I used it, it was easy to find in the plugin menu of Netbeans 6.<br />
Now I&#8217;ve upgraded to Netbeans 7 and wasn&#8217;t able to find the plugin.<br />
Happily I found a page that advised me to add </p>
<pre>http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz</pre>
<p>to the Update Center.<br />
After that I got a huge list of updates, and my missing JAX-RPC.<br />
Now just: install, restart, update-again.<br />
Et voila, there is the missing &#8220;JAXB Binding&#8221; menu point that was searching for.</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2011/07/21/netbeans-7-and-the-missing-jax-rpc-plugin/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2011%2F07%2F21%2Fnetbeans-7-and-the-missing-jax-rpc-plugin%2F&amp;title=Netbeans%207%20and%20the%20missing%20JAX-RPC%20plugin" id="wpa2a_4">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2011/07/21/netbeans-7-and-the-missing-jax-rpc-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat java.net.BindException: Cannot assign requested address &#8211; made me crazy</title>
		<link>http://www.0xcb0.com/2011/07/06/tomcat-java-net-bindexception-cannot-assign-requested-address-made-me-crazy/</link>
		<comments>http://www.0xcb0.com/2011/07/06/tomcat-java-net-bindexception-cannot-assign-requested-address-made-me-crazy/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 18:52:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[weird]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=380</guid>
		<description><![CDATA[Today I migrated a Tomcat Server to a new host. Everything was in place but it won&#8217;t start showing me the following error: Tomcat java.net.BindException: Cannot assign requested address I&#8217;m happy &#8216;Nir Levy&#8216; had nearly the same problem 4 years ago. Here he describes what went wrong with his /etc/hosts configuration. My problem was that [...]]]></description>
			<content:encoded><![CDATA[<p>Today I migrated a Tomcat Server to a new host. Everything was in place but it won&#8217;t start showing me the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Tomcat java.net.BindException: Cannot assign requested address</pre></div></div>

<p>I&#8217;m happy &#8216;<a href="http://nirlevy.blogspot.com/">Nir Levy</a>&#8216; had nearly the same problem 4 years ago. <a href="http://nirlevy.blogspot.com/2007/12/tomcat-javanetbindexception-cannot.html">Here</a> he describes what went wrong with his /etc/hosts configuration.<br />
My problem was that I did not update the host name in the configuration for my module<br />
&#8220;/webapps/WEB-INF/classes/Configuration.properties&#8221;<br />
After that everything was fine <img src='http://www.0xcb0.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I *heart* blogs !</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2011/07/06/tomcat-java-net-bindexception-cannot-assign-requested-address-made-me-crazy/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2011%2F07%2F06%2Ftomcat-java-net-bindexception-cannot-assign-requested-address-made-me-crazy%2F&amp;title=Tomcat%20java.net.BindException%3A%20Cannot%20assign%20requested%20address%20%26%238211%3B%20made%20me%20crazy" id="wpa2a_6">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2011/07/06/tomcat-java-net-bindexception-cannot-assign-requested-address-made-me-crazy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mcrypt and PHP, on Mac OS X Snow Leopard 10.6.4</title>
		<link>http://www.0xcb0.com/2011/05/26/mcrypt-and-php-on-mac-os-x-snow-leopard-10-6-4/</link>
		<comments>http://www.0xcb0.com/2011/05/26/mcrypt-and-php-on-mac-os-x-snow-leopard-10-6-4/#comments</comments>
		<pubDate>Thu, 26 May 2011 12:15:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crypt]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[libmcrypt]]></category>
		<category><![CDATA[mcrypt]]></category>
		<category><![CDATA[Michael Gracie]]></category>
		<category><![CDATA[os x 10.6.4]]></category>
		<category><![CDATA[php 5.3.2]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=375</guid>
		<description><![CDATA[I found this great tutorial on how to install mcrypt into php under OS X 10.6.1 http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/ Works like charming with OS X 10.6.4 and PHP Version 5.3.2. #!/bin/bash mkdir src cd src wget http://museum.php.net/php5/php-5.3.2.tar.bz2 wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F&#38;ts=1306411641&#38;use_mirror=ignum tar xzvf php-5.3.2.tar.bz2 tar xzvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 [...]]]></description>
			<content:encoded><![CDATA[<p>I found <a href="http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/">this</a> great tutorial on how to install mcrypt into php under OS X 10.6.1<br />
<a href="http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/">http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/</a><br />
Works like charming with OS X 10.6.4 and PHP Version 5.3.2.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> src
<span style="color: #7a0874; font-weight: bold;">cd</span> src
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>museum.php.net<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>php-5.3.2.tar.bz2
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>downloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>project<span style="color: #000000; font-weight: bold;">/</span>mcrypt<span style="color: #000000; font-weight: bold;">/</span>Libmcrypt<span style="color: #000000; font-weight: bold;">/</span>2.5.8<span style="color: #000000; font-weight: bold;">/</span>libmcrypt-2.5.8.tar.gz?<span style="color: #007800;">r</span>=http<span style="color: #000000; font-weight: bold;">%</span>3A<span style="color: #000000; font-weight: bold;">%</span>2F<span style="color: #000000; font-weight: bold;">%</span>2Fsourceforge.net<span style="color: #000000; font-weight: bold;">%</span>2Fprojects<span style="color: #000000; font-weight: bold;">%</span>2Fmcrypt<span style="color: #000000; font-weight: bold;">%</span>2Ffiles<span style="color: #000000; font-weight: bold;">%</span>2FLibmcrypt<span style="color: #000000; font-weight: bold;">%</span>2F2.5.8<span style="color: #000000; font-weight: bold;">%</span>2F<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #007800;">ts</span>=<span style="color: #000000;">1306411641</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #007800;">use_mirror</span>=ignum
<span style="color: #c20cb9; font-weight: bold;">tar</span> xzvf php-5.3.2.tar.bz2
<span style="color: #c20cb9; font-weight: bold;">tar</span> xzvf libmcrypt-2.5.8.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> libmcrypt-2.5.8
<span style="color: #007800;">MACOSX_DEPLOYMENT_TARGET</span>=<span style="color: #000000;">10.6</span> <span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">'-O3 -fno-common -arch i386 -arch x86_64'</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">'-O3 -arch i386 -arch x86_64'</span> <span style="color: #007800;">CXXFLAGS</span>=<span style="color: #ff0000;">'-O3 -fno-common -arch i386 -arch x86_64'</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--disable-dependency-tracking</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-j6</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>php-5.3.2<span style="color: #000000; font-weight: bold;">/</span>ext<span style="color: #000000; font-weight: bold;">/</span>mcrypt
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>phpize
<span style="color: #007800;">MACOSX_DEPLOYMENT_TARGET</span>=<span style="color: #000000;">10.6</span> <span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">'-O3 -fno-common -arch i386 -arch x86_64'</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">'-O3 -arch i386 -arch x86_64'</span> <span style="color: #007800;">CXXFLAGS</span>=<span style="color: #ff0000;">'-O3 -fno-common -arch i386 -arch x86_64'</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-php-config</span>=<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>MacOSX10.6.sdk<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php-config <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-j6</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Completed install, now make sure to edit your php.ini&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;and check for <span style="color: #000099; font-weight: bold;">\&quot;</span>enable_dl = On<span style="color: #000099; font-weight: bold;">\&quot;</span> and add <span style="color: #000099; font-weight: bold;">\&quot;</span>extension=mcrypt.so<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> to the dynamic extentions<span style="color: #ff0000;">&quot;</span></pre></div></div>

<p>This is the little bash script I wrote according to his tutorial. This comes without any warranty!!!<br />
Be aware that you have to enter your root password twice while installing this script. </p>
<p>Big Thanks to Michael Gracie </p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2011/05/26/mcrypt-and-php-on-mac-os-x-snow-leopard-10-6-4/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2011%2F05%2F26%2Fmcrypt-and-php-on-mac-os-x-snow-leopard-10-6-4%2F&amp;title=mcrypt%20and%20PHP%2C%20on%20Mac%20OS%20X%20Snow%20Leopard%2010.6.4" id="wpa2a_8">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2011/05/26/mcrypt-and-php-on-mac-os-x-snow-leopard-10-6-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iTunes Sharing over ssh</title>
		<link>http://www.0xcb0.com/2011/03/30/itunes-sharing-over-ssh/</link>
		<comments>http://www.0xcb0.com/2011/03/30/itunes-sharing-over-ssh/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 11:54:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=367</guid>
		<description><![CDATA[Today I realized that I had not a single song on my notebook hard disk. Thanks to Last.FM Unfortunately &#8220;Simplify Media&#8221; has been adopted by Google Inc. and they do not offer a similar service yet. So I needed a solution to stream my iTunes from home to the office. If found a great solution [...]]]></description>
			<content:encoded><![CDATA[<p>Today I realized that I had not a single song on my notebook hard disk. Thanks to Last.FM <img src='http://www.0xcb0.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Unfortunately &#8220;Simplify Media&#8221; has been adopted by Google Inc. and they do not offer a similar service yet. So I needed a solution to stream my iTunes from home to the office. If found a great solution by &#8220;Robert Harder&#8221; which works like charm. (<a href="http://blog.iharder.net/2009/09/28/itunes-stream-itunes-over-ssh/">source</a>).<br />
This is the bash script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
dns-sd <span style="color: #660033;">-P</span> <span style="color: #ff0000;">&quot;Home iTunes&quot;</span> _daap._tcp <span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #000000;">3689</span> localhost.local. \ 
127.0.0.1 <span style="color: #ff0000;">&quot;Arbitrary text record&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;
<span style="color: #007800;">PID</span>=<span style="color: #007800;">$!</span>
<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-C</span> <span style="color: #660033;">-N</span> <span style="color: #660033;">-L</span> <span style="color: #000000;">3689</span>:localhost:<span style="color: #000000;">3689</span> username<span style="color: #000000; font-weight: bold;">@</span>dyndns_name.dyndns.org
<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #007800;">$PID</span></pre></div></div>

<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2011/03/30/itunes-sharing-over-ssh/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2011%2F03%2F30%2Fitunes-sharing-over-ssh%2F&amp;title=iTunes%20Sharing%20over%20ssh" id="wpa2a_10">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2011/03/30/itunes-sharing-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LE Mensa</title>
		<link>http://www.0xcb0.com/2011/03/11/le-mensa/</link>
		<comments>http://www.0xcb0.com/2011/03/11/le-mensa/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 17:08:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=360</guid>
		<description><![CDATA[This week I released my first OS X Dashboard Widget. It&#8217;s called &#8216;LE Mensa&#8217; and it displays all menues for all cafeterias in Leipzig, which are part of the student union. If you want to give it a try then visit the project page: http://stinfwww.informatik.uni-leipzig.de/~mai03fln/leMensa/ Today I updated it to version 0.15 !! It works [...]]]></description>
			<content:encoded><![CDATA[<p>This week I released my first OS X Dashboard Widget.<br />
It&#8217;s called &#8216;LE Mensa&#8217; and it displays all menues for all cafeterias in Leipzig, which are part of the student union.<br />
If you want to give it a try then visit the project page: <a href="http://stinfwww.informatik.uni-leipzig.de/~mai03fln/leMensa/">http://stinfwww.informatik.uni-leipzig.de/~mai03fln/leMensa/</a><br />
Today I updated it to version 0.15 !!</p>
<p>It works this way:<br />
1. I wrote a python script which extracts information from the student union homepage and transform it into xml.<br />
2. A .php script can call this .py script and give back those infos.<br />
3. The widget was written in Dashcode with jQuery as an additional package. So it&#8217;s mainly javascript, some html and css. The widget now calls this php script, retrieves the xml and displays it in a (hopefully) pretty way.</p>
<p>This is how it looks:<br />
<img src="http://stinfwww.informatik.uni-leipzig.de/~mai03fln/leMensa/LE_Mensa_Project_Blog/LE_Mensa_Blog/LE_Mensa_Blog_files/shapeimage_1.png" alt="Front View" /></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2011/03/11/le-mensa/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2011%2F03%2F11%2Fle-mensa%2F&amp;title=LE%20Mensa" id="wpa2a_12">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2011/03/11/le-mensa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python and building xml&#8217;s</title>
		<link>http://www.0xcb0.com/2010/11/09/python-and-building-xmls/</link>
		<comments>http://www.0xcb0.com/2010/11/09/python-and-building-xmls/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 14:57:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[leMensa]]></category>
		<category><![CDATA[pyxml]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=352</guid>
		<description><![CDATA[I&#8217;m working on a little Project called &#8220;leMensa&#8221;. Maybe later I&#8217;ll tell you more about it. While working on it I needed to build some xml documents with pyxml. Here&#8217;s what I found. A little help from Matt Croydon was all I needed to know. http://www.postneo.com/projects/pyxml/ Share on Facebook]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a little Project called &#8220;leMensa&#8221;. Maybe later I&#8217;ll tell you more about it.<br />
While working on it I needed to build some xml documents with pyxml.<br />
Here&#8217;s what I found. A little help from Matt Croydon was all I needed to know.</p>
<p><a href="http://www.postneo.com/projects/pyxml/">http://www.postneo.com/projects/pyxml/</a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2010/11/09/python-and-building-xmls/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2010%2F11%2F09%2Fpython-and-building-xmls%2F&amp;title=Python%20and%20building%20xml%26%238217%3Bs" id="wpa2a_14">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2010/11/09/python-and-building-xmls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fast calculation of fibonacci numbers in python</title>
		<link>http://www.0xcb0.com/2010/05/27/fast-calculation-of-fibonacci-numbers-in-python/</link>
		<comments>http://www.0xcb0.com/2010/05/27/fast-calculation-of-fibonacci-numbers-in-python/#comments</comments>
		<pubDate>Thu, 27 May 2010 17:09:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[fibonacci]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=345</guid>
		<description><![CDATA[I needed this for a challenge. If you need to reuse the values, it&#8217;s much faster with the memo. #!/usr/bin/python memo = &#123;0:0, 1:1&#125; def fib&#40;n&#41;: if not n in memo: memo&#91;n&#93; = fib&#40;n-1&#41; + fib&#40;n-2&#41; return memo&#91;n&#93; print fib&#40;100&#41; $./fib.py 354224848179261915075 Share on Facebook]]></description>
			<content:encoded><![CDATA[<p>I needed this for a challenge. If you need to reuse the values, it&#8217;s much faster with the memo.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python                                                                                                                                             </span>
memo = <span style="color: black;">&#123;</span><span style="color: #ff4500;">0</span>:<span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span>:<span style="color: #ff4500;">1</span><span style="color: black;">&#125;</span>
<span style="color: #ff7700;font-weight:bold;">def</span> fib<span style="color: black;">&#40;</span>n<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> n <span style="color: #ff7700;font-weight:bold;">in</span> memo:
        memo<span style="color: black;">&#91;</span>n<span style="color: black;">&#93;</span> = fib<span style="color: black;">&#40;</span>n-<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span> + fib<span style="color: black;">&#40;</span>n-<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> memo<span style="color: black;">&#91;</span>n<span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> fib<span style="color: black;">&#40;</span><span style="color: #ff4500;">100</span><span style="color: black;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$.<span style="color: #000000; font-weight: bold;">/</span>fib.py
<span style="color: #000000;">354224848179261915075</span></pre></div></div>

<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2010/05/27/fast-calculation-of-fibonacci-numbers-in-python/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2010%2F05%2F27%2Ffast-calculation-of-fibonacci-numbers-in-python%2F&amp;title=fast%20calculation%20of%20fibonacci%20numbers%20in%20python" id="wpa2a_16">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2010/05/27/fast-calculation-of-fibonacci-numbers-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Atbash Cipher</title>
		<link>http://www.0xcb0.com/2010/05/18/atbash-cipher/</link>
		<comments>http://www.0xcb0.com/2010/05/18/atbash-cipher/#comments</comments>
		<pubDate>Tue, 18 May 2010 17:11:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crypt]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Atbash]]></category>
		<category><![CDATA[caesar]]></category>
		<category><![CDATA[cipher]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=337</guid>
		<description><![CDATA[Just al little python script for preforming a Atbash encryption (roman alphabet). This type of cipher is older than Caesar cipher Maybe you can use it. -> Wikipedia article clear=&#34;abcdefghijklmnopqrstuvwxyz 1234567890&#34; c=&#34;&#34; for i in sys.argv&#91;1&#93;.lower&#40;&#41;: index=clear.index&#40;i&#41; c=c+clear&#91;abs&#40;len&#40;clear&#41;-index-1&#41;%len&#40;clear&#41;&#93; print c Example: $ ./atbash.sh &#34;This Is A Little Test&#34; r32sk2sk0kz2rrz6kr6sr $ ./atbash.sh &#34;$(./atbash.sh &#34;This Is A [...]]]></description>
			<content:encoded><![CDATA[<p>Just al little python script for preforming a Atbash encryption (roman alphabet). This type of cipher is older than Caesar cipher<br />
Maybe you can use it.<br />
-> <a href="http://en.wikipedia.org/wiki/Atbash">Wikipedia article</a></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">clear=<span style="color: #483d8b;">&quot;abcdefghijklmnopqrstuvwxyz 1234567890&quot;</span>
c=<span style="color: #483d8b;">&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>.<span style="color: black;">lower</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    index=clear.<span style="color: black;">index</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
    c=c+clear<span style="color: black;">&#91;</span><span style="color: #008000;">abs</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>clear<span style="color: black;">&#41;</span>-index-<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">%</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>clear<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> c</pre></div></div>

<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ .<span style="color: #000000; font-weight: bold;">/</span>atbash.sh <span style="color: #ff0000;">&quot;This Is A Little Test&quot;</span>
r32sk2sk0kz2rrz6kr6sr
$ .<span style="color: #000000; font-weight: bold;">/</span>atbash.sh <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(./atbash.sh &quot;This Is A Little Test&quot;)</span>&quot;</span>
this is a little <span style="color: #7a0874; font-weight: bold;">test</span></pre></div></div>

<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2010/05/18/atbash-cipher/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2010%2F05%2F18%2Fatbash-cipher%2F&amp;title=Atbash%20Cipher" id="wpa2a_18">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2010/05/18/atbash-cipher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hexadecimal xor de/encryption</title>
		<link>http://www.0xcb0.com/2010/05/05/hexadecimal-xor-deencryption/</link>
		<comments>http://www.0xcb0.com/2010/05/05/hexadecimal-xor-deencryption/#comments</comments>
		<pubDate>Wed, 05 May 2010 17:56:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[crypt]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[decryption]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[hexadecimal]]></category>
		<category><![CDATA[xor]]></category>

		<guid isPermaLink="false">http://www.0xcb0.com/?p=331</guid>
		<description><![CDATA[Here&#8217;s are 2 little scripts I wrote today for encoding/decoding XOR encrypted text. Script 1 (HexXorEncode.py) takes a string/text and a integer key value. Then it preforms and xor encryption on the string with the given key. #!/usr/bin/python import sys #Copyleft m.puchalla 2010 #Preforms a XOR Encoding with a specific string and returns a hexadecimal [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s are 2 little scripts I wrote today for encoding/decoding XOR encrypted text. </p>
<p>Script 1 (HexXorEncode.py) takes a string/text and a integer key value. Then it preforms and xor encryption on the string with the given key.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python                                                                                                                                                                      </span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #808080; font-style: italic;">#Copyleft m.puchalla 2010                                                                                                                                                                     </span>
<span style="color: #808080; font-style: italic;">#Preforms a XOR Encoding with a specific string and returns a hexadecimal representation of it                                                                                         </span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">!</span>=<span style="color: #ff4500;">3</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Usage:&quot;</span>,<span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>,<span style="color: #483d8b;">&quot; [String] [integer key]&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> baseN<span style="color: black;">&#40;</span>num,b,numerals=<span style="color: #483d8b;">&quot;0123456789abcdefghijklmnopqrstuvwxyz&quot;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>num == <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">and</span>  <span style="color: #483d8b;">&quot;0&quot;</span> <span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: black;">&#40;</span> baseN<span style="color: black;">&#40;</span>num // b, b<span style="color: black;">&#41;</span>.<span style="color: black;">lstrip</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;0&quot;</span><span style="color: black;">&#41;</span> + numerals<span style="color: black;">&#91;</span>num <span style="color: #66cc66;">%</span> b<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
s=<span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
key=baseN<span style="color: black;">&#40;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
sol=<span style="color: #483d8b;">&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #008000;">len</span><span style="color: black;">&#40;</span>s<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
    sol=sol+baseN<span style="color: black;">&#40;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>baseN<span style="color: black;">&#40;</span><span style="color: #008000;">ord</span><span style="color: black;">&#40;</span>s<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>^int<span style="color: black;">&#40;</span>key,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">16</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> sol</pre></div></div>

<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ .<span style="color: #000000; font-weight: bold;">/</span>HexXorEncode.py <span style="color: #ff0000;">&quot;this is a little test&quot;</span> <span style="color: #000000;">25</span>
6d71706a39706a39783975706d6d757c396d7c6a6d</pre></div></div>

<p>Here&#8217;s script number 2 (HexXorDecode.py) which simply reverses the process.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python                                                                                                                                                                      </span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #808080; font-style: italic;">#Copyleft m.puchalla 2010                                                                                                                                                                     </span>
<span style="color: #808080; font-style: italic;">#Decrypt a hex xor coded string with a key                                                                                                                                             </span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">&lt;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Usage:&quot;</span>,<span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>,<span style="color: #483d8b;">&quot; [XOR Code String] [integer key]&quot;</span>
    <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> baseN<span style="color: black;">&#40;</span>num,b,numerals=<span style="color: #483d8b;">&quot;0123456789abcdefghijklmnopqrstuvwxyz&quot;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>num == <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">and</span>  <span style="color: #483d8b;">&quot;0&quot;</span> <span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: black;">&#40;</span> baseN<span style="color: black;">&#40;</span>num // b, b<span style="color: black;">&#41;</span>.<span style="color: black;">lstrip</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;0&quot;</span><span style="color: black;">&#41;</span> + numerals<span style="color: black;">&#91;</span>num <span style="color: #66cc66;">%</span> b<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
s=<span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
key=baseN<span style="color: black;">&#40;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
sol=<span style="color: #483d8b;">&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>,<span style="color: #008000;">len</span><span style="color: black;">&#40;</span>s<span style="color: black;">&#41;</span>-<span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>:
    sol=sol+<span style="color: #008000;">chr</span><span style="color: black;">&#40;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>baseN<span style="color: black;">&#40;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span>s<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>+s<span style="color: black;">&#91;</span>i+<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,<span style="color: #ff4500;">16</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>^int<span style="color: black;">&#40;</span>key,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> sol</pre></div></div>

<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ .<span style="color: #000000; font-weight: bold;">/</span>HexXorDecode.py <span style="color: #ff0000;">&quot;6d71706a39706a39783975706d6d757c396d7c6a6d&quot;</span> <span style="color: #000000;">25</span>
this is a little <span style="color: #7a0874; font-weight: bold;">test</span></pre></div></div>

<p>If you like it, use it.</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.0xcb0.com/2010/05/05/hexadecimal-xor-deencryption/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.0xcb0.com%2F2010%2F05%2F05%2Fhexadecimal-xor-deencryption%2F&amp;title=hexadecimal%20xor%20de%2Fencryption" id="wpa2a_20">Share/Save</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.0xcb0.com/2010/05/05/hexadecimal-xor-deencryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

