<?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>Schadenfreude &#187; hack</title>
	<atom:link href="http://www.ralree.com/tag/hack/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ralree.com</link>
	<description>Malicious enjoyment derived from observing someone else's misfortune</description>
	<lastBuildDate>Sun, 28 Feb 2010 04:18:37 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to set the RTC max_user_freq in newer kernels</title>
		<link>http://www.ralree.com/2009/07/19/how-to-set-the-rtc-max_user_freq-in-newer-kernels/</link>
		<comments>http://www.ralree.com/2009/07/19/how-to-set-the-rtc-max_user_freq-in-newer-kernels/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 01:03:07 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rtc]]></category>
		<category><![CDATA[sound]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.ralree.com/?p=22623</guid>
		<description><![CDATA[I found out today how to set the real time clock max frequencies in Ubuntu since they removed the possibility to do it from sysutil.conf from newer kernels.  Add the following to your /etc/rc.local or another startup script:
echo 2048 >/sys/class/rtc/rtc0/max_user_freq
echo 2048 >/proc/sys/dev/hpet/max-user-freq
Reboot, and you should get better performance from things like mplayer.
]]></description>
			<content:encoded><![CDATA[<p>I found out today how to set the real time clock max frequencies in Ubuntu since they removed the possibility to do it from <code>sysutil.conf</code> from newer kernels.  Add the following to your <code>/etc/rc.local</code> or another startup script:</p>
<pre><code>echo 2048 >/sys/class/rtc/rtc0/max_user_freq
echo 2048 >/proc/sys/dev/hpet/max-user-freq</code></pre>
<p>Reboot, and you should get better performance from things like mplayer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2009/07/19/how-to-set-the-rtc-max_user_freq-in-newer-kernels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greasemonkey Script to get Jabber Room for Google Group Chat</title>
		<link>http://www.ralree.com/2009/03/15/greasemonkey-script-to-get-jabber-room-for-google-group-chat/</link>
		<comments>http://www.ralree.com/2009/03/15/greasemonkey-script-to-get-jabber-room-for-google-group-chat/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 03:23:28 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[gchat]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google chat]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[pidgin]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.ralree.com/?p=22468</guid>
		<description><![CDATA[So, today I was invited to Google Group chat for the first time.  This would be really cool on a terminal that&#8217;s not equipped with an IM client, since it&#8217;s all done through the web with flash and magic.  But, since I don&#8217;t like having 2 IM clients running at the same time [...]]]></description>
			<content:encoded><![CDATA[<p>So, today I was invited to Google Group chat for the first time.  This would be really cool on a terminal that&#8217;s not equipped with an IM client, since it&#8217;s all done through the web with flash and magic.  But, since I don&#8217;t like having 2 IM clients running at the same time (Pidgin and the Flash one from Google), I decided I needed to rip out the Jabber Group Chat Room name from the invite page.  I got some tips from <a href="http://mkokotovich.blogspot.com/2007/12/google-talk-groupchat.html">this site</a>, and wrote a Greasemonkey script to do so.</p>
<p><a href="http://www.ralree.com/newblog/wp-content/uploads/2009/03/whoa.jpg"><img class="aligncenter size-full wp-image-22469" title="whoa" src="http://www.ralree.com/newblog/wp-content/uploads/2009/03/whoa.jpg" alt="whoa" width="531" height="271" /></a></p>
<p>All you have to do is copy the room name into the <strong>Join Chat</strong> window, and put in <strong>groupchat.google.com</strong> as the server.  I hope you find it useful.  If anyone knows how to make this a link that GNOME will throw at Pidgin, let me know.  That would be awesome.</p>
<h2><a href="http://github.com/hank/life/raw/6b085700963110559c3dca29a94a701a2f0ec2df/code/greasemonkey/google_talk_chat_channel.user.js">Get the Script</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2009/03/15/greasemonkey-script-to-get-jabber-room-for-google-group-chat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Putting Non-YouTube Videos in MxTube</title>
		<link>http://www.ralree.com/2008/08/07/putting-non-youtube-videos-in-mxtube/</link>
		<comments>http://www.ralree.com/2008/08/07/putting-non-youtube-videos-in-mxtube/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 06:49:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[videos]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/08/07/putting-non-youtube-videos-in-mxtube</guid>
		<description><![CDATA[So, you have your Jailbroken iPod Touch or iPhone with 2.0 firmware running OpenSSH, and you have MxTube 1.5 or better, of course. What if you want one of those pesky videos that YouTube deletes all the time, like Paris Hilton For President? Or maybe you want a full movie on your iPod without having to sync to iTunes since you’re stuck in Linux Land. Well, here’s how.]]></description>
			<content:encoded><![CDATA[<p>So, you have your <strong>Jailbroken</strong> iPod Touch or iPhone with 2.0 firmware running OpenSSH, and you have <a href="http://www.appleiphoneapps.com/2008/08/update-mxtube-v15-with-walkthrough/">MxTube 1.5 or better</a>, of course.  What if you want one of those pesky videos that YouTube deletes all the time, like Paris Hilton For President?  Or maybe you want a full movie on your iPod without having to sync to iTunes since you’re stuck in Linux Land.  Well, here’s how:</p>
<h2>Download the video</h2>
<p>This can be done lots of ways, but somehow obtain a version of the video that ffmpeg can read.  It can be just about any format.  Let’s assume that we get a file called <strong>paris.flv</strong>.</p>
<h2>Convert the video</h2>
<pre><code>
ffmpeg -i paris.flv -b 500000 -s 176x144 -ac 1 -ab 64000 paris-high.mp4
</code></pre>
<p>This will make a nice movie for us to play.  Let’s put it on the iPod:</p>
<pre><code>
scp paris-high.mp4 root@ipod:/var/mobile/Media/MxTube/
</code></pre>
<h2>Make the Thumbnail</h2>
<p>We need to grab a frame from the middle of the movie.  Let’s use <code>mplayer</code> for that!</p>
<pre><code>
mplayer -vo jpeg -frames 1 -ss 30 paris.flv
</code></pre>
<p>This will make a file called <strong>00000001.jpg</strong>.  Let’s put that in the right spot:</p>
<pre><code>
scp 00000001.jpg root@ipod:/var/mobile/Media/MxTube/paris.thm
</code></pre>
<h2>Add the video to the Library</h2>
<p>Edit <strong>/var/mobile/Library/MxTube/VideoLibrary.plist</strong> <em>on the iPod</em>.  Make a new <strong>dict</strong> entry in the list like so:</p>
<pre><code>
        &lt;dict&gt;
                &lt;key&gt;author&lt;/key&gt;
                &lt;string&gt;hank&lt;/string&gt;
                &lt;key&gt;duration&lt;/key&gt;
                &lt;string&gt;01:50&lt;/string&gt;
                &lt;key&gt;high&lt;/key&gt;
                &lt;string&gt;/var/mobile/Media/MxTube/paris-high.mp4&lt;/string&gt;
                &lt;key&gt;id&lt;/key&gt;
                &lt;string&gt;64ad536a6dQ&lt;/string&gt;
                &lt;key&gt;thumbnail&lt;/key&gt;
                &lt;string&gt;/var/mobile/Media/MxTube/paris.thm&lt;/string&gt;
                &lt;key&gt;title&lt;/key&gt;
                &lt;string&gt;Paris for President&lt;/string&gt;
        &lt;/dict&gt;
</code></pre>
<p>Just fill in the right filenames for the thumbnail and movie like you used above.  Also, change the author to yourself or the original director, and the duration accordingly.  Keep the id something random.  Also, you can change the display title as the last option there.</p>
<h2>Other Pro Tips</h2>
<p>Keep in mind that if you want to be able to delete the movie from the interface, you need to change the ownership on all the files to <strong>mobile:mobile</strong> using <code>chown</code>.</p>
<h2>Results!</h2>
<p>Well, it totally works, with sound even.</p>
<p><img src="http://ralree.com/assets/2008/8/7/IMG_0001.PNG" alt="Paris is at the Bottom" /></p>
<p><img src="http://ralree.com/assets/2008/8/7/IMG_0006.PNG" alt="Here's Paris in Full Glory" /></p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/08/07/putting-non-youtube-videos-in-mxtube/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Putting Images on the iPod Touch from Linux</title>
		<link>http://www.ralree.com/2008/08/06/putting-images-on-the-ipod-touch-from-linux/</link>
		<comments>http://www.ralree.com/2008/08/06/putting-images-on-the-ipod-touch-from-linux/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 05:37:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/08/07/putting-images-on-the-ipod-touch-from-linux</guid>
		<description><![CDATA[Idea
I wanted to put images on my iPod Touch without using iTunes since, as most of us know, there is no good way to use it from Linux.  It turns out there is a magic directory on the iPod Touch where it saves images from Safari.  I simply looked at how it saved [...]]]></description>
			<content:encoded><![CDATA[<h2>Idea</h2>
<p>I wanted to put images on my iPod Touch without using iTunes since, as most of us know, there is no <strong>good</strong> way to use it from Linux.  It turns out there is a magic directory on the iPod Touch where it saves images from Safari.  I simply looked at how it saved them, and applied it on my box here at home.</p>
<h2>Requirements</h2>
<ul>
<li>Jailbroken iPod Touch (I used WinPWN), with OpenSSH installed and working (the root password is <em>alpine</em>)</li>
<li>Firmware 2.0 (Though, 1.x may work, I just haven’t tried it)</li>
<li>A Linux box with a bash shell</li>
<li>Cool images</li>
<li><code>convert</code> and <code>mogrify</code> from ImageMagick installed</li>
</ul>
<h2>Method</h2>
<h5><span style="color:red;">These instructions might work for the iPhone as well.  YMMV</span></h5>
<p>All of your images must be in the format <strong>IMG_XXXX.YYY</strong> where <strong>XXXX</strong> is a number &lt; 9999, and <strong>YYY</strong> is either <strong>JPG</strong> or <strong>THM</strong> (THM is a thumbnail).  To rename our files, I use a simple trick I outlined in my last post:</p>
<pre><code>
EII=4; for i in *.jpg; do ls $i; \
NEWNAME=IMG_00`printf "%02d" $EII`.JPG; \
echo Renaming $i to $NEWNAME; \
mv $i $NEWNAME; EII=`expr $EII + 1`; done
</code></pre>
<p>That will rename all the JPEG files in order from 4 to, in my case, 62.  Now, I have to make the thumbnails:</p>
<pre><code>
for i in `ls *.JPG | cut -d '.' -f 1`; do \
convert $i.JPG -resize 75x75! $i.THM; \
done
</code></pre>
<p>The <strong>75&#215;75!</strong> part makes sure they are exactly those dimensions.  You end up with something like the following:</p>
<pre><code>
IMG_0004.JPG  IMG_0016.JPG  IMG_0028.JPG  IMG_0040.JPG  IMG_0052.JPG
IMG_0004.THM  IMG_0016.THM  IMG_0028.THM  IMG_0040.THM  IMG_0052.THM
IMG_0005.JPG  IMG_0017.JPG  IMG_0029.JPG  IMG_0041.JPG  IMG_0053.JPG
....
</code></pre>
<p>Now, note that the iPod can only display images under 100KB (to my knowledge).  If your high-res image is too large, it will just display the magnified 75&#215;75, which is <strong><em>really</em></strong><em></em> ugly.  So, make sure all your images fit that description, and if they don’t, <code>mogrify -resize</code> them until they do (or take other measures as necessary).  I used this:</p>
<pre><code>
mogrify -resize 400x *.JPG
</code></pre>
<p>All my images turned out to be between 30 and 90 KB.  This also keeps the aspect ratio, unlike the <strong>75&#215;75!</strong>.</p>
<p>Now, SSH into your iPod (if you can’t do this yet, google it).  You should have the following file:</p>
<pre><code>
/var/mobile/Media/DCIM/.MISC/Info.plist
</code></pre>
<p>Open this file in vi, and observe the <strong>plist&gt;dict&gt;integer</strong> part of the hierarchy:</p>
<pre><code>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
        &lt;key&gt;LastFileGroupNumber-100&lt;/key&gt;
        &lt;integer&gt;62&lt;/integer&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>
<p>So, I put <strong>62</strong> in there since the last image I have is numbered 0062.  It’s a very simple idea.  Now, just load them onto the iPod:</p>
<pre><code>
scp IMG_00* root@ipod:/var/mobile/Media/DCIM/100APPLE/
</code></pre>
<p>Let’s have a look from the iPod console!</p>
<pre><code>
HanksTouch:/var/mobile/Media/DCIM/100APPLE root# ls
IMG_0002.JPG  IMG_0014.THM  IMG_0027.JPG  IMG_0039.THM  IMG_0052.JPG
IMG_0002.THM  IMG_0015.JPG  IMG_0027.THM  IMG_0040.JPG  IMG_0052.THM
</code></pre>
<p>Beautiful.  Now, to test it…</p>
<p><img class="alignleft" src="http://ralree.com/assets/2008/8/6/IMG_0002.PNG" alt="" width="320" height="480" /><img class="alignleft" src="http://ralree.com/assets/2008/8/6/IMG_0001.PNG" alt="" width="320" height="480" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/08/06/putting-images-on-the-ipod-touch-from-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This Election Day, Hack a Diebold Voting Machine!</title>
		<link>http://www.ralree.com/2008/01/10/this-election-day-hack-a-diebold-voting-machine/</link>
		<comments>http://www.ralree.com/2008/01/10/this-election-day-hack-a-diebold-voting-machine/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 13:43:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[election 2008]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[voting]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/01/10/this-election-day-hack-a-diebold-voting-machine</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a href="http://farm1.static.flickr.com/148/414916629_0c20fcc85a_b.jpg" title="" rel="photoslice.diebold"><img src="http://ralree.com/assets/2008/1/10/hackadiebold.jpg" alt=""/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/01/10/this-election-day-hack-a-diebold-voting-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding bad JPEGs with Xorg hacks in Ubuntu</title>
		<link>http://www.ralree.com/2007/11/25/finding-bad-jpegs-with-xorg-hacks-in-ubuntu/</link>
		<comments>http://www.ralree.com/2007/11/25/finding-bad-jpegs-with-xorg-hacks-in-ubuntu/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 00:46:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[qiv]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/11/25/finding-bad-jpegs-with-xorg-hacks-in-ubuntu</guid>
		<description><![CDATA[So, I have all these JPEGs, and I want to know which ones are corrupt (specifically, ones that end prematurely).  qiv will spit out the following to STDERR when it finds one:

Premature end of JPEG file

So, this is nice, except it&#8217;s entirely unscriptable.  The solution I found was using the following script to [...]]]></description>
			<content:encoded><![CDATA[<p>So, I have all these JPEGs, and I want to know which ones are corrupt (specifically, ones that end prematurely).  <a href="http://www.klografx.net/qiv/">qiv</a> will spit out the following to <code>STDERR</code> when it finds one:</p>
<pre><code>
Premature end of JPEG file
</code></pre>
<p>So, this is nice, except it&#8217;s <strong><em>entirely unscriptable</strong></em>.  The solution I found was using the following script to the display the images in sequence:</p>
<pre><code>
perl -e 'for(glob("*.png *.jpg")){$output = `qiv "$_" 2&gt;&#038;1;`; if($output =~ /Premature/){print $_, "\n";}}'
</code></pre>
<p>All this does is mix <code>STDERR</code> with <code>STDOUT</code> for a <code>qiv</code> of the file, and check the output for the word &#8220;Premature&#8221;.  If it finds the word, it prints the filename.  Simple.</p>
<p>The only problem is that <code>qiv</code> doesnt have a way to just check whether a JPEG file is corrupt (and if there is a command line utility that does, please let me know).  To make it go thru the list, I wrote this little gem:</p>
<pre><code>
while(true); do xte "key q"; done
</code></pre>
<p>All this does is send the <code>q</code> key to the Xserver infinitely.  All I have to do is put focus on the first <code>qiv</code> window to make it and all subsequent <code>qiv</code> windows receive q&#8217;s.  So, just run it, and click on the window.  Then there are lots of flashes, and eventually that perl script will print out the names of the bad files.  It&#8217;s totally ghetto, but it&#8217;s the best I&#8217;ve got right now.  The point of this post is to hopefully find new ways to do this more programmatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/11/25/finding-bad-jpegs-with-xorg-hacks-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.380 seconds -->
