<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Odie5533</title>
	
	<link>http://odie5533.com</link>
	<description />
	<lastBuildDate>Tue, 06 Jul 2010 00:59:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Odie5533" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="odie5533" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Twisted Python RDT/RTSP Library and Stream Downloader</title>
		<link>http://odie5533.com/twisted-python-rdt-rtsp-library-and-stream-downloader-346</link>
		<comments>http://odie5533.com/twisted-python-rdt-rtsp-library-and-stream-downloader-346#comments</comments>
		<pubDate>Tue, 01 Jun 2010 03:09:51 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=346</guid>
		<description><![CDATA[Twisted is a great framework for Python, but they don&#8217;t support RDT or RTSP protocol used for streaming Real video. The RDT/RTSP handler in MPlayer is a bit buggy and suffers from disconnect problems when receiving RTSP packets after switching to raw mode for RDT (though perhaps such occurrences are out of specification, they do [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://twistedmatrix.com/trac/">Twisted</a> is a great framework for Python, but they don&#8217;t support <a href="http://en.wikipedia.org/wiki/Real_Data_Transport">RDT</a> or <a href="http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol">RTSP</a> protocol used for streaming Real video. The RDT/RTSP handler in <a href="http://en.wikipedia.org/wiki/MPlayer">MPlayer</a> is a bit buggy and suffers from disconnect problems when receiving RTSP packets after switching to raw mode for RDT (though perhaps such occurrences are out of specification, they do still occur). Thus, I set off to create my own.</p>
<p>The library includes support for RTSP, RDT, <a href="http://en.wikipedia.org/wiki/Session_Description_Protocol">SDPP</a>, ASMRP, and <a href="https://common.helixcommunity.org/2003/HCS_SDK_r5/htmfiles/rmff.htm">RMFF</a>, and it is all in pure Python and Pythonically coded where possible (see sdpp.py). It requires Python 2.6 and the Twisted Python library. The library has only one known bug, and I can&#8217;t for the life of me find it. Perhaps another set of eyes will effect a solution.</p>
<p>To use the library to simply download an RTSP stream:<br />
<code>python rdt.py -u &lt;URL&gt; -f &lt;FILENAME&gt;</code></p>
<p>If you like this post, <b>please comment</b>. Commenting is fast, anonymous, and greatly appreciated.<br />
<a href="/programs/RDT-RTSP/Twisted RDT-RTSP Library 2010-07-05.zip">Download the Twisted Python RDT-RTSP Library here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/twisted-python-rdt-rtsp-library-and-stream-downloader-346/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatically Download Songs from Grooveshark</title>
		<link>http://odie5533.com/automatically-download-songs-from-grooveshark-334</link>
		<comments>http://odie5533.com/automatically-download-songs-from-grooveshark-334#comments</comments>
		<pubDate>Mon, 31 May 2010 01:11:42 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=334</guid>
		<description><![CDATA[Because manually downloading songs from Grooveshark is too tedious, here&#8217;s a nice process to automatically save all the songs you listen to on Grooveshark. Unlike other methods, this does not use any extra bandwidth so you don&#8217;t need to listen to the song and download it, once is enough. Update After doing some searching, I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Because <a href="http://odie5533.com/downloading-mp3-songs-from-grooveshark-322">manually downloading songs from Grooveshark</a> is too tedious, here&#8217;s a nice process to automatically save all the songs you listen to on Grooveshark. Unlike other methods, this does not use any extra bandwidth so you don&#8217;t need to listen to the song and download it, once is enough.<span id="more-334"></span></p>
<p><font color="red">Update</font> After doing some searching, I&#8217;ve found a FireFox plugin caled <a href="https://addons.mozilla.org/en-US/firefox/addon/3006/">Video DownloadHelper</a> which performs much the same function as the program I&#8217;ve written, but is more stable and integrated directly into FireFox. Its only downside is that it doesn&#8217;t automatically download the songs as you listen, you need to start downloading the ones you want. But it is more stable than my program and much more user friendly. Be sure to use Mp3tag (listed below) to quickly rename all the files you&#8217;ve downloaded.</p>
<p>Download and install the following pre-requisites:</p>
<ol>
<li>Python 2.6.5 &#8211; <a href="http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi">http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi</a></li>
<li>dpkt 1.7 &#8211; <a href="http://dpkt.googlecode.com/files/dpkt-1.7.win32.exe">http://dpkt.googlecode.com/files/dpkt-1.7.win32.exe</a></li>
<li>pypcap 1.1 &#8211; <a href="/programs/Grooveshark/pcap-1.1.win32-py2.6.exe">pcap-1.1.win32-py2.6.exe</a></li>
</ol>
<p>Save this Python program into a folder of its own: <a href="/programs/Grooveshark/groovegrab.py">groovegrab.py</a></p>
<p>Run the program using <code>python groovegrab.py</code></p>
<p>As you listen to songs on Grooveshark, the folder will populate with mp3 files. Each are named Track_X.mp3. But there&#8217;s a really neat, easy way to rename them. Download <a href="http://www.mp3tag.de/en/download.html">Mp3tag</a> and in the program go to File > Change Directory and choose the directory where the mp3 files are. Select all the mp3 files in the main pane and go to Convert > Tag to Filename.</p>
<p>Enjoy your perfectly named mp3 files from a Grooveshark listening session.</p>
<p>Thanks to dugsong for <a href="http://code.google.com/p/dpkt/">dpkt</a> and <a href="http://code.google.com/p/pypcap/">pypcap</a>, and thanks to Andrew Brampton for his <a href="http://bramp.net/blog/follow-http-stream-with-decompression">tutorial on dpkt/pypcap</a>!</p>
<p>If you liked this post, please comment. Commeting is fast, anonymous, and greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/automatically-download-songs-from-grooveshark-334/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Downloading MP3 Songs From Grooveshark</title>
		<link>http://odie5533.com/downloading-mp3-songs-from-grooveshark-322</link>
		<comments>http://odie5533.com/downloading-mp3-songs-from-grooveshark-322#comments</comments>
		<pubDate>Sun, 30 May 2010 14:28:07 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=322</guid>
		<description><![CDATA[A friend of mine recently introduced me to Grooveshark, a website offering streaming radio similar to Pandora but which allows you to specify what song you would like to listen to rather than listening in a guided method as Pandora offers. I wondered if it was possible to save songs which are streamed from Grooveshark. [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine recently introduced me to <a href="http://grooveshark.com">Grooveshark</a>, a website offering streaming radio similar to <a href="http://www.pandora.com/">Pandora</a> but which allows you to specify what song you would like to listen to rather than listening in a guided method as Pandora offers. I wondered if it was possible to save songs which are streamed from Grooveshark.</p>
<p><img src="http://i45.tinypic.com/xdhv9d.png"/><br />
<span id="more-322"></span></p>
<p>The simplest method is to just record whatever the computer plays. This can be done using <a href="http://audacity.sourceforge.net/">Audacity</a>, or anything which will record the audio the computer is currently playing. I found an application which uses this method to record audio from streaming websites. <a href="http://www.recordstreamingaudio.net/download-grooveshark-music.html">Streaming Audio Recorder</a> records streaming audio by all audio coming from the computer. This is a very naive approach and suffers from quality degradation if the file was not originally going to be re-encoded, but it has the advantage of working in all cases.</p>
<p>Another approach is to capture the stream urls as they are played. Examples of this are WmRecorder, Jaksta, and Orbit Grab++. The stream is then requested a second time and the program records the response. This method downloads each stream twice, once from the original site, then again using the capture program. This works for many sites, but Grooveshark has a handshake challenge which breaks this method.</p>
<p>A final approach, and perhaps the best, is to capture the stream the first time. Unlike the previous approach, it downloads the stream only once. To accomplish this method on Grooveshark, I used <a href="http://www.wireshark.org/">WireShark</a>.</p>
<p><b><u>Downloading the mp3 from Grooveshark:</u></b></p>
<ol>
<li>In <a href="http://www.wireshark.org/">WireShark</a>, go to Capture > Options. Under Capture Filter, enter in <code>port 80</code> and start the capture.</li>
<li>Begin listening to the song on Grooveshark and many new lines should begin scrolling in WireShark. At the top of WireShark is a Filter: box. Enter in <code>http.content_type == "audio/mpeg"</code>, press enter, and only one line should appear (more lines if more than one song was played).</li>
<li>Click the line once and if it comes up processing, hit Stop. Then in the middle pane click the Media Type line (again, Stop if necessary). Right-click the Media Type line and choose Export Selected Packet Bytes&#8230; Then save the file somewhere as an mp3 file, choosing All Files as the filetype.</li>
</ol>
<p>The nice thing about this method is that no extra packets are sent to Grooveshark, so the method is undetectable.</p>
<p>If you liked this post, please comment. Commenting is fast, anonymous, and greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/downloading-mp3-songs-from-grooveshark-322/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GIMP Resize and Match DPI in Scheme</title>
		<link>http://odie5533.com/gimp-resize-and-match-dpi-in-scheme-304</link>
		<comments>http://odie5533.com/gimp-resize-and-match-dpi-in-scheme-304#comments</comments>
		<pubDate>Mon, 17 May 2010 03:33:29 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[Scheme]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=304</guid>
		<description><![CDATA[Resize-match-dpi is a GIMP Script-Fu script written in Scheme to resize or scale an image along with scaling the DPI. Let&#8217;s consider an image being scanned which is 4.75&#8243; x 4.70&#8243;. We scan the image at 300 DPI with a pixel resolution of 1425 x 1409 and we want to scale it down to 1280&#215;1266. [...]]]></description>
			<content:encoded><![CDATA[<p>Resize-match-dpi is a GIMP Script-Fu script written in Scheme to resize or scale an image along with scaling the DPI. Let&#8217;s consider an image being scanned which is 4.75&#8243; x 4.70&#8243;. We scan the image at 300 DPI with a pixel resolution of 1425 x 1409 and we want to scale it down to 1280&#215;1266. Using IrfanView, XNView, GIMP, and other programs will rescale the image, but the DPI will still be 300. This means when the image is viewed on a monitor or printed out it will appear too small (4.27&#8243; x 4.22&#8243;). This script scales the DPI to match the new pixel resolution so it will still appear as 4.75&#8243; x 4.70&#8243;.</p>
<p>If you like this post, please comment. Commenting is fast, anonymous, and greatly appreciated.<span id="more-304"></span></p>
<p>To install the script, save it as resize-match-dpi.scm into C:\Users\Odie\.gimp-2.6\scripts\. Open up GIMP and the script will appear under the Script-Fu menu at the top of an image window. If you are really adventurous, I&#8217;ve included a small wrapper allowing the script to be called from the console as follows:</p>
<pre>"C:\Program Files\GIMP-2.0\bin\gimp-console-2.6" -i -b "(resize_match_dpi \"input.bmp\" \"output.bmp\" 1280 0)" -b "(gimp-quit 0)"</pre>
<p>resize-match-dpi.scm:</p>

<div class="wp_syntax"><div class="code"><pre class="scheme" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">; Released under the GNU GPL 3.0 or later</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span>resize<span style="color: #66cc66;">-</span>match<span style="color: #66cc66;">-</span>dpi image drawable newwidth newheight<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let*</span> <span style="color: #66cc66;">&#40;</span>
	 <span style="color: #66cc66;">&#40;</span>oldwidth <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>width image<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	 <span style="color: #66cc66;">&#40;</span>oldheight <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>height image<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	 <span style="color: #66cc66;">&#40;</span>newdpi <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">=</span> newheight <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">set!</span> newheight <span style="color: #66cc66;">&#40;</span>round <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">/</span> oldheight oldwidth<span style="color: #66cc66;">&#41;</span> newwidth<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">=</span> newwidth <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">set!</span> newwidth <span style="color: #66cc66;">&#40;</span>round <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">/</span> oldwidth oldheight<span style="color: #66cc66;">&#41;</span> newheight<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">set!</span> newdpi <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">/</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span> newwidth <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>get<span style="color: #66cc66;">-</span>resolution image<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> oldwidth<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>undo<span style="color: #66cc66;">-</span>group<span style="color: #66cc66;">-</span>start image<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>scale image newwidth newheight<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>set<span style="color: #66cc66;">-</span>resolution image newdpi newdpi<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>undo<span style="color: #66cc66;">-</span>group<span style="color: #66cc66;">-</span>end image<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span>resize_match_dpi filename output newwidth newheight<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>image    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>file<span style="color: #66cc66;">-</span><span style="color: #b1b100;">load</span> RUN<span style="color: #66cc66;">-</span>NONINTERACTIVE filename filename<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
         <span style="color: #66cc66;">&#40;</span>drawable <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>get<span style="color: #66cc66;">-</span>active<span style="color: #66cc66;">-</span>layer image<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>resize<span style="color: #66cc66;">-</span>match<span style="color: #66cc66;">-</span>dpi image drawable newwidth newheight<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>file<span style="color: #66cc66;">-</span>save RUN<span style="color: #66cc66;">-</span>NONINTERACTIVE image drawable output output<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>delete image<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">define</span> <span style="color: #66cc66;">&#40;</span>resize_match_dpi_multi pattern outdir newwidth newheight<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>filelist <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cadr</span> <span style="color: #66cc66;">&#40;</span>file<span style="color: #66cc66;">-</span>glob pattern <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>while <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">not</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null?</span> filelist<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	   <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>filename <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> filelist<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
		  <span style="color: #66cc66;">&#40;</span>image    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>file<span style="color: #66cc66;">-</span><span style="color: #b1b100;">load</span> RUN<span style="color: #66cc66;">-</span>NONINTERACTIVE
						 filename filename<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
		  <span style="color: #66cc66;">&#40;</span>drawable <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>get<span style="color: #66cc66;">-</span>active<span style="color: #66cc66;">-</span>layer image<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
		  <span style="color: #66cc66;">&#40;</span>outf <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">string-append</span> outdir <span style="color: #ff0000;">&quot;/&quot;</span> filename<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	     <span style="color: #66cc66;">&#40;</span>resize<span style="color: #66cc66;">-</span>match<span style="color: #66cc66;">-</span>dpi image drawable newwidth newheight<span style="color: #66cc66;">&#41;</span>
	     <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>file<span style="color: #66cc66;">-</span>save RUN<span style="color: #66cc66;">-</span>NONINTERACTIVE image drawable outf outf<span style="color: #66cc66;">&#41;</span>
	     <span style="color: #66cc66;">&#40;</span>gimp<span style="color: #66cc66;">-</span>image<span style="color: #66cc66;">-</span>delete image<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	   <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">set!</span> filelist <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> filelist<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>script<span style="color: #66cc66;">-</span>fu<span style="color: #66cc66;">-</span>register <span style="color: #ff0000;">&quot;resize-match-dpi&quot;</span>
  <span style="color: #ff0000;">&quot;&lt;Image&gt;/Script-Fu/Resize Match DPI&quot;</span>
  <span style="color: #ff0000;">&quot;Resize and match DPI&quot;</span>
  <span style="color: #ff0000;">&quot;odie5533&quot;</span>
  <span style="color: #ff0000;">&quot;odie5533&quot;</span>
  <span style="color: #ff0000;">&quot;2010-05-16&quot;</span>
  <span style="color: #ff0000;">&quot;RGB*&quot;</span>
  SF<span style="color: #66cc66;">-</span>IMAGE <span style="color: #ff0000;">&quot;Image&quot;</span>  <span style="color: #cc66cc;">0</span>
  SF<span style="color: #66cc66;">-</span>DRAWABLE <span style="color: #ff0000;">&quot;Drawable&quot;</span> <span style="color: #cc66cc;">0</span>
&nbsp;
  SF<span style="color: #66cc66;">-</span>VALUE  <span style="color: #ff0000;">&quot;New width&quot;</span> <span style="color: #ff0000;">&quot;1280&quot;</span>
  SF<span style="color: #66cc66;">-</span>VALUE  <span style="color: #ff0000;">&quot;New height&quot;</span> <span style="color: #ff0000;">&quot;0&quot;</span>
<span style="color: #66cc66;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/gimp-resize-and-match-dpi-in-scheme-304/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TinyPic Command Line Uploader in AWK</title>
		<link>http://odie5533.com/tinypic-command-line-uploader-in-awk-286</link>
		<comments>http://odie5533.com/tinypic-command-line-uploader-in-awk-286#comments</comments>
		<pubDate>Wed, 05 May 2010 15:05:37 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Awk]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[TinyPic]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=286</guid>
		<description><![CDATA[This AWK script uploads an image to TinyPic.com and returns the direct url to the uploaded image. Example script usage: $ awk -f tinypic.awk The_Grass_Snake_-_Natrix_natrix.jpg http://i39.tinypic.com/dlnb6r.jpg Let me start by saying I have no idea why I wrote this in AWK. I&#8217;ve only used AWK once before for a very short one-liner. I find AWK [...]]]></description>
			<content:encoded><![CDATA[<p>This AWK script uploads an image to <a href="http://tinypic.com">TinyPic.com</a> and returns the direct url to the uploaded image.</p>
<p>Example script usage:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-f</span> tinypic.awk The_Grass_Snake_-_Natrix_natrix.jpg
http:<span style="color: #000000; font-weight: bold;">//</span>i39.tinypic.com<span style="color: #000000; font-weight: bold;">/</span>dlnb6r.jpg</pre></div></div>

<p>Let me start by saying I have no idea why I wrote this in AWK. I&#8217;ve only used AWK once before for a very short one-liner. I find AWK to be better than Perl, but worse than Python. It does make for a light and portable language: the Windows AWK executable (<a href="http://gnuwin32.sourceforge.net/packages/gawk.htm">available here</a>) is only 345 KB, combine with Windows cURL (<a href="http://curl.haxx.se/download.html#Win32">available here</a>) which is 405 KB and you&#8217;re still under a meg for both. My bloated Python install is over 100 MB and I just installed <a href="http://strawberryperl.com/">Strawberry Perl</a> which is 174 MB.</p>
<p>If you like this post, please comment. Commenting is fast, anonymous, and much appreciated.<span id="more-286"></span></p>
<p>Here&#8217;s the script. Save as tinypic.awk</p>

<div class="wp_syntax"><div class="code"><pre class="awk" style="font-family:monospace;"><span style="color: #C20CB9; font-weight: bold;">BEGIN</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	file = <span style="color: #4107D5; font-weight: bold;">ARGV</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
	<span style="color:#808080;"># parse file extension</span>
	<span style="color: #07D589; font-weight: bold;">split</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>file, arr, <span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
	file_ext = arr<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #07D589; font-weight: bold;">length</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>arr<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
&nbsp;
	<span style="color:#808080;">#2&gt;&amp;1 works on Win/Linux. Since the output is filtered anyway</span>
	<span style="color:#808080;">#it shouldn't bother anything</span>
	<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;curl tinypic.com 2&gt;&amp;1&quot;</span> | <span style="color: #0BD507; font-weight: bold;">getline</span> <span style="color:#000088;">$0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color:black;">&gt;</span> <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>
	        <span style="color:#808080;"># parse necessary post variables from the HTML page</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #07D589; font-weight: bold;">match</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color:#000088;">$0</span>, <span style="color: #ff0000;">&quot;form action=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://s(.)&quot;</span>, arr<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
			server = arr<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #07D589; font-weight: bold;">match</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color:#000088;">$0</span>, <span style="color:black;">/</span>id=<span style="color: #ff0000;">&quot;uid&quot;</span> value=<span style="color: #ff0000;">&quot;([^&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color:black;">+</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color:black;">/</span>, arr<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
			uid = arr<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #07D589; font-weight: bold;">match</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color:#000088;">$0</span>, <span style="color:black;">/</span>name=<span style="color: #ff0000;">&quot;upk&quot;</span> value=<span style="color: #ff0000;">&quot;([^&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color:black;">+</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color:black;">/</span>, arr<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
			upk = arr<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
	<span style="color:#808080;"># compile curl command to upload the file</span>
	curl_cmd = <span style="color: #07D589; font-weight: bold;">sprintf</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;curl -L -F UPLOAD_IDENTIFIER=<span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span> -F upk=<span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span> -F domain_lang=<span style="color: #000099; font-weight: bold;">\&quot;</span>en<span style="color: #000099; font-weight: bold;">\&quot;</span> -F action=<span style="color: #000099; font-weight: bold;">\&quot;</span>upload<span style="color: #000099; font-weight: bold;">\&quot;</span> -F MAX_FILE_SIZE=<span style="color: #000099; font-weight: bold;">\&quot;</span>500000000<span style="color: #000099; font-weight: bold;">\&quot;</span> -F shareopt=<span style="color: #000099; font-weight: bold;">\&quot;</span>true<span style="color: #000099; font-weight: bold;">\&quot;</span> -F the_file=<span style="color: #000099; font-weight: bold;">\&quot;</span>@%s<span style="color: #000099; font-weight: bold;">\&quot;</span> -F file_type=<span style="color: #000099; font-weight: bold;">\&quot;</span>image<span style="color: #000099; font-weight: bold;">\&quot;</span> -F dimension=<span style="color: #000099; font-weight: bold;">\&quot;</span>1600<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>http://s%s.tinypic.com/upload.php<span style="color: #000099; font-weight: bold;">\&quot;</span> -H <span style="color: #000099; font-weight: bold;">\&quot;</span>Expect:<span style="color: #000099; font-weight: bold;">\&quot;</span> -e <span style="color: #000099; font-weight: bold;">\&quot;</span>http://tinypic.com<span style="color: #000099; font-weight: bold;">\&quot;</span> 2&gt;&amp;1&quot;</span>, uid, upk, file, server<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
&nbsp;
	<span style="color:#808080;"># upload the picture and parse where the picture URL</span>
	<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>curl_cmd | <span style="color: #0BD507; font-weight: bold;">getline</span> <span style="color:#000088;">$0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color:black;">&gt;</span> <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #07D589; font-weight: bold;">match</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color:#000088;">$0</span>, <span style="color:black;">/</span>name=<span style="color: #ff0000;">&quot;pic&quot;</span> value=<span style="color: #ff0000;">&quot;([^&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color:black;">+</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color:black;">/</span>, arr<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
			img = arr<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #07D589; font-weight: bold;">match</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color:#000088;">$0</span>, <span style="color:black;">/</span>name=<span style="color: #ff0000;">&quot;ival&quot;</span> value=<span style="color: #ff0000;">&quot;([^&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color:black;">+</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #ff0000;">&quot;/, arr))
			ival = arr[1];
	}
	printf(&quot;</span>http<span style="color:black;font-weight:bold;">:</span><span style="color:black;">//</span>i<span style="color:black;">%</span>s.tinypic.com<span style="color:black;">/%</span>s<span style="color:black;">%</span>s<span style="color: #ff0000;">&quot;, ival, img, &quot;</span>.<span style="color: #ff0000;">&quot; file_ext);
}</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/tinypic-command-line-uploader-in-awk-286/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xdsl: Using an Original Xbox as a Network Attached Storage Device (NAS), SSH server, BitTorrent client, and more</title>
		<link>http://odie5533.com/xdsl-xbox-nas-ssh-bittorrent-242</link>
		<comments>http://odie5533.com/xdsl-xbox-nas-ssh-bittorrent-242#comments</comments>
		<pubDate>Thu, 22 Apr 2010 10:16:14 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=242</guid>
		<description><![CDATA[X-DSL is a Linux distribution for the original Xbox. The old Xbox sells for about $35 on eBay and can be used as an NAS for both IDE and SATA hard drives and can be used as a BitTorrent client. For the sake of brevity, I will assume the Xbox already has XBMC installed and [...]]]></description>
			<content:encoded><![CDATA[<p>X-DSL is a Linux distribution for the original Xbox. The old Xbox sells for about $35 on eBay and can be used as an NAS for both IDE and SATA hard drives and can be used as a BitTorrent client.</p>
<p>For the sake of brevity, I will assume the Xbox already has XBMC installed and the ability to FTP files to the Xbox and execute xbe files.</p>
<p>Software used:<br />
<a href="http://fs03n4.sendspace.com/dl/fe0bd8a32f31bc621be0d7e02d083350/4932998c1d278061/6irs4o/Xdsl0.7beta0.01.iso">Xdsl iso</a>, and use <a href="http://www.7-zip.org/">7-zip</a> to extract the iso<br />
SSH/Putty<br />
FileZilla or any FTP client<br />
<a href="http://www.realvnc.com/cgi-bin/download.cgi">RealVNC</a></p>
<p><font size="4">Part 1: Uploading Xdsl via FTP</font><br />
Extract the files in the the Xdsl iso. Create an FTP session with the Xbox. Copy the KNOPPIX folder from the extracted iso to the Xbox&#8217;s E: drive. Open the KNOPPIX folder on the Xbox and copy minirt24.gz and linux24 to this folder. E:\KNOPPIX should now have three files, one of which is named KNOPPIX, and no further subdirectories. Also copy README-FTP\linuxboot.cfg to E:\linuxboot.cfg. Now make a folder in the E:\Apps directory called simply Linux and copy the default.xbe file to E:\Apps\Linux\default.xbe.</p>
<p>In total, four files are copied and the overall structure is:<br />
E:\linuxboot.cfg<br />
E:\Apps\Linux\default.xbe<br />
E:\KNOPPIX\KNOPPIX<br />
E:\KNOPPIX\linux24<br />
E:\KNOPPIX\minirt24.gz</p>
<p>In XBMC run the Linux default.xbe. The Xromwell blue screen will appear. Select the hard drive and press A. It should boot directly into Xdsl.</p>
<p><font size="4">Part 2: Installing Xdsl</font><br />
The D-pad and left joystick move the mouse. Press Y to right-click the desktop and go to System > Daemons > ssh > start. Open putty/ssh and connect to the Xbox with username admin and password xbox. Then run the command <code>xbox-loopbackinstall</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span>192.168.1.101
root<span style="color: #000000; font-weight: bold;">@</span>192.168.1.101<span style="color: #ff0000;">'s password: xbox
xbox-loopbackinstall</span></pre></div></div>

<p>Go through the menus and when it asks for the size of the loopback filesystem, change it from 200 to 600. Continue through selecting for the defaults. After it&#8217;s finished, reboot the Xbox:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">reboot</pre></div></div>

<p><font size="4">Part 3: Configuring Xdsl for SSH and VNC</font><br />
After the Xbox is done rebooting, go back in Xbmc and run Xromwell again and select the hard drive. This time a menu will appear. Choose XDSL Loopback, the second choice. Start the ssh daemon again (right-click the desktop and go to System > Daemons > ssh > start). Connect to the Xbox using Putty/ssh again. Users who are using ssh will need to remove the key from their system:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-R</span> 192.168.1.101</pre></div></div>

<p>To set the ssh daemon to start when Xdsl boots, enter the following. If you are using Putty on Windows, copy it to the clipboard then right-click the Putty window to paste.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc5.d<span style="color: #000000; font-weight: bold;">/</span>S20ssh <span style="color: #660033;">-sfn</span></pre></div></div>

<p>Now on the Xbox go right-click the desktop and go to MyDSL > MyDSL Browser. In the left panel expand + net and scroll down and select vnc4x-1.4.6.dsl. Click the Install Selected button. Close out of the MyDSL Browser and right-click the desktop and go to MyDsl > vncserver > vnc4x0. Start up the RealVNC client and enter the Xbox&#8217;s IP and click connect.</p>
<p><font size="4">Part 4: Installing BitTorrent</font><br />
Now, using RealVNC, right-click the desktop XDSL Upgrades > Upgrade to GNU Utils, then XDSL Upgrades > Enable Apt. Right-click desktop, MyDSL > MyDSL Browser. Install net > bittorrent-cli.dsl.</p>
<p>Now in the ssh session enter:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-sfn</span> <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>python2.2 <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>python</pre></div></div>

<p>Mount the E: drive, then open a screen session and su to the regular user (dsl):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda50
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>hda50<span style="color: #000000; font-weight: bold;">/</span>torrents
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">screen</span>
<span style="color: #c20cb9; font-weight: bold;">screen</span>
<span style="color: #c20cb9; font-weight: bold;">su</span> dsl</pre></div></div>

<p>BitTorrent can be run using the following command.</p>
<pre>$ btdownloadcurses --saveas /mnt/hda50/torrents --minport 52130 --maxport 52140 CompletelyLegalLinuxDistribution.torrent</pre>
<p>Note: VNC uses about 70% of the CPU. Only run it when you have to; use SSH.</p>
<p>To start more than one torrent, press [Ctrl]+[A], then [C] and type the command with the next torrent. [Ctrl]+[A],[P] and [Ctrl]+[A],[N] go back and forth between the two buffers.</p>
<p>That&#8217;s all for now. You can use SFTP to access the hard drive, SSH, VNC, and BitTorrent. Let me know in the comments if you enjoyed this tutorial. Comments are always appreciated.</p>
<p><font size="4">Part 5: Serving files using Samba</font><br />
Per a request in the comments, here&#8217;s how to have the Xbox serve files using Samba.</p>
<p>In Xdsl, right-click the desktop and  go to MyDSL > MyDSL Browser. In the left pane, click the [+] net, and then find samba.dsl and click it. Click the Install Selected button at the top of the window.</p>
<p>Open up an SSH session to Xdsl. Enter the following commands, but you may need to change WORKGROUP to MSHOME. These commands backup your Samba configuration file, then change the workgroup, and finally add the E, F, and G partitions as shares. Copy the entire contents of the following, then right-click in Putty to paste them.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf.bak
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/^\tworkgroup = .*$/\tworkgroup = WORKGROUP/'</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/;  encrypt passwords/encrypt passwords/'</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;[E]<span style="color: #000099; font-weight: bold;">\n</span>   path = /mnt/hda50<span style="color: #000099; font-weight: bold;">\n</span>   public = yes<span style="color: #000099; font-weight: bold;">\n</span>   writable = yes<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>[F]<span style="color: #000099; font-weight: bold;">\n</span>   path = /mnt/hda55<span style="color: #000099; font-weight: bold;">\n</span>   public = yes<span style="color: #000099; font-weight: bold;">\n</span>   writable = yes<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>[G]<span style="color: #000099; font-weight: bold;">\n</span>   path = /mnt/hda56<span style="color: #000099; font-weight: bold;">\n</span>   public = yes<span style="color: #000099; font-weight: bold;">\n</span>   writable = yes<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf
<span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;mount /dev/hda55<span style="color: #000099; font-weight: bold;">\n</span>mount /dev/hda56<span style="color: #000099; font-weight: bold;">\n</span>nmbd -D -s /opt/samba/smb.conf<span style="color: #000099; font-weight: bold;">\n</span>smbd -D -s /opt/samba/smb.conf<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>bootlocal.sh</pre></div></div>

<p>Now you need to mount the other partitions, restart Samba, and set a new Samba password for root. Just hit enter twice when it asks for a password to use a blank password.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda55
<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda56
nmbd <span style="color: #660033;">-D</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf
smbd <span style="color: #660033;">-D</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>samba<span style="color: #000000; font-weight: bold;">/</span>smb.conf
<span style="color: #c20cb9; font-weight: bold;">sudo</span> smbpasswd <span style="color: #660033;">-a</span> root</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/xdsl-xbox-nas-ssh-bittorrent-242/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Wiki Parser v0.1 – Read Wikipedia Offline</title>
		<link>http://odie5533.com/wikiparserv01-read-wikipedia-offline-236</link>
		<comments>http://odie5533.com/wikiparserv01-read-wikipedia-offline-236#comments</comments>
		<pubDate>Thu, 15 Apr 2010 04:13:00 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Wiki]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=236</guid>
		<description><![CDATA[Wiki Parser is a Python program which takes a Wikipedia dump and hosts it locally, offline. To save disk space, Wiki Parser keeps the dump compressed and serves articles to a web browser without decompressing the entire file. I originally created it to serve up Wikipedia articles from a compressed version, but seek times on [...]]]></description>
			<content:encoded><![CDATA[<p>Wiki Parser is a Python program which takes a Wikipedia dump and hosts it locally, offline. To save disk space, Wiki Parser keeps the dump compressed and serves articles to a web browser without decompressing the entire file. I originally created it to serve up Wikipedia articles from a compressed version, but seek times on the compressed file were too great and the program really only works on smaller Wikipedias such as the Simple English Wikipedia.</p>
<p><a href="http://download.wikimedia.org/simplewiki/20100401/">Download the latest dump of Simple English Wikipedia here</a><br />
<a href="programs/WikiParser/Wiki Parser v0.1.zip">Download Wiki Parser v0.1 here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/wikiparserv01-read-wikipedia-offline-236/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>microdc2 for Windows/Cygwin</title>
		<link>http://odie5533.com/microdc2-for-windows-cygwin-226</link>
		<comments>http://odie5533.com/microdc2-for-windows-cygwin-226#comments</comments>
		<pubDate>Sat, 10 Apr 2010 04:09:02 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Snapshot]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=226</guid>
		<description><![CDATA[microdc2 (http://corsair626.no-ip.org/microdc/) is a command-line Direct Connect client originally developed for flavors of Linux. This is a version compiled for Windows/Cygwin and requires a Cygwin environment to run. This program provides a command line version of Direct Connect on Windows which is especially useful if you run an SSHd server with GNU Screen on Windows [...]]]></description>
			<content:encoded><![CDATA[<p>microdc2 (<a href="http://corsair626.no-ip.org/microdc/">http://corsair626.no-ip.org/microdc/</a>) is a command-line <a href="http://en.wikipedia.org/wiki/Direct_Connect_%28file_sharing%29">Direct Connect</a> client originally developed for flavors of Linux. This is a version compiled for Windows/Cygwin and requires a <a href="http://www.cygwin.com/">Cygwin</a> environment to run. This program provides a command line version of Direct Connect on Windows which is especially useful if you run an SSHd server with GNU Screen on Windows and want to be able to remotely manage a Direct Connect client. Read the README.WIN.TXT for installation instructions and read the README for usage instructions.</p>
<p><a href="programs/microdc2/microdc2-0.15.6.zip">Download microdc2 v0.15.6 for Windows/Cygwin here</a></p>
<div class="wp-caption aligncenter" style="width: 438px"><img src="programs/microdc2/microdc2.png"/><p class="wp-caption-text">microdc2</p></div>
]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/microdc2-for-windows-cygwin-226/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Twisted Python library to replicate packets</title>
		<link>http://odie5533.com/using-twisted-python-library-to-replicate-packets-195</link>
		<comments>http://odie5533.com/using-twisted-python-library-to-replicate-packets-195#comments</comments>
		<pubDate>Sat, 01 Aug 2009 13:43:54 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Twisted]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=195</guid>
		<description><![CDATA[Most of the programming I do is packet replication and automation. My workflow is to first analyze the handshakes and protocols in FireFox with the Tamper Data add-on. I use WireShark to nail down the interaction details. Finally, I recreate everything using the Twisted library in Python. Here&#8217;s a boilerplate to quickly recreate packets using [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the programming I do is packet replication and automation. My workflow is to first analyze the handshakes and protocols in FireFox with the <a href="http://tamperdata.mozdev.org/">Tamper Data add-on</a>. I use <a href="http://www.wireshark.org/">WireShark</a> to nail down the interaction details. Finally, I recreate everything using the <a href="http://twistedmatrix.com/trac/">Twisted</a> library in Python.</p>
<p>Here&#8217;s a boilerplate to quickly recreate packets using Twisted. It requests and saves a copy of Google.com. Simply replace with your favorite URL, or un-comment the two lines and comment the other getPage to send a POST request.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> twisted.<span style="color: black;">web</span> <span style="color: #ff7700;font-weight:bold;">import</span> client
<span style="color: #ff7700;font-weight:bold;">from</span> twisted.<span style="color: black;">internet</span> <span style="color: #ff7700;font-weight:bold;">import</span> reactor
&nbsp;
agent = <span style="color: #483d8b;">&quot;Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12 (.NET CLR 3.5.30729)&quot;</span>
headers = <span style="color: black;">&#123;</span><span style="color: #483d8b;">'Accept'</span>:<span style="color: #483d8b;">'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'</span>, <span style="color: #483d8b;">'Accept-Language'</span>:<span style="color: #483d8b;">'en-us,en;q=0.5'</span>, <span style="color: #483d8b;">'Accept-Charset'</span>:<span style="color: #483d8b;">'ISO-8859-1,utf-8;q=0.7'</span><span style="color: black;">&#125;</span>
headers_post = headers.<span style="color: #dc143c;">copy</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
headers_post<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Content-Type'</span><span style="color: black;">&#93;</span> = <span style="color: #483d8b;">'application/x-www-form-urlencoded'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> success<span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Success!&quot;</span>
    f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'save.html'</span>,<span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
    f.<span style="color: black;">write</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>
    f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    reactor.<span style="color: black;">stop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> failure<span style="color: black;">&#40;</span>fail<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> fail.<span style="color: black;">getErrorMessage</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    reactor.<span style="color: black;">stop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> request<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    url = <span style="color: #483d8b;">&quot;http://google.com/&quot;</span>
    d = client.<span style="color: black;">getPage</span><span style="color: black;">&#40;</span>url, headers=headers, agent=agent<span style="color: black;">&#41;</span>
    <span style="color: #808080; font-style: italic;">#post_data = &quot;&quot;</span>
    <span style="color: #808080; font-style: italic;">#d = client.getPage(url, postdata=post_data, method=&quot;POST&quot;, headers=headers_post, agent=agent)</span>
    d.<span style="color: black;">addCallback</span><span style="color: black;">&#40;</span>success<span style="color: black;">&#41;</span>.<span style="color: black;">addErrback</span><span style="color: black;">&#40;</span>failure<span style="color: black;">&#41;</span>
&nbsp;
request<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
reactor.<span style="color: black;">run</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>To make it continually request the same page, change the success method to this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> success<span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Success!&quot;</span>
    f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'save.html'</span>,<span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
    f.<span style="color: black;">write</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>
    f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    reactor.<span style="color: black;">callLater</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0.5</span>, request<span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/using-twisted-python-library-to-replicate-packets-195/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rewind</title>
		<link>http://odie5533.com/rewind-176</link>
		<comments>http://odie5533.com/rewind-176#comments</comments>
		<pubDate>Tue, 28 Jul 2009 04:20:20 +0000</pubDate>
		<dc:creator>odie5533</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://odie5533.com/?p=176</guid>
		<description><![CDATA[I got an email today: Hello, Unfortunately but your data is damaged un-fixable Thank you, www.000webhost.com Data damaged un-fixable! But I&#8217;m smart; I make backups. I found the file in my backup folder, extracted the SQL, then opened it to verify everything was fine. I only make backups every few months, but I had made [...]]]></description>
			<content:encoded><![CDATA[<p>I got an email today:</p>
<blockquote><p>Hello,</p>
<p>Unfortunately but your data is damaged un-fixable</p>
<p>Thank you,<br />
www.000webhost.com</p></blockquote>
<p>Data damaged un-fixable! But I&#8217;m smart; I make backups. I found the file in my backup folder, extracted the SQL, then opened it to verify everything was fine. I only make backups every few months, but I had made one this month on the July 7th. When I do backups I backup all my websites and carefully label them and file them away on one of my hard drives, then I burn a copy of my entire backup folder to a DVD, just in case my backup hard drive dies. Sadly, this past month when I was making backups, I mislabeled one. Wouldn&#8217;t you know it had to be the one with data damaged un-fixable. The SQL file belonged to a different site, and my blog&#8217;s data really is gone.</p>
<p>Google cache has some of the old posts and I&#8217;ll work on moving the ones that matter which are really only two posts. This backup is from November 2008. Not much lost since I haven&#8217;t been active lately, but data loss is never fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://odie5533.com/rewind-176/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
