<?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>heipei's weblog &#187; Gentoo</title>
	<atom:link href="http://heipei.net/category/gentoo/feed/" rel="self" type="application/rss+xml" />
	<link>http://heipei.net</link>
	<description>Johannes 'heipei' Gilger</description>
	<lastBuildDate>Sun, 01 Apr 2012 16:47:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Photo and video post-processing using Linux</title>
		<link>http://heipei.net/2012/02/08/photo-and-video-post-processing-using-linux/</link>
		<comments>http://heipei.net/2012/02/08/photo-and-video-post-processing-using-linux/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 17:42:41 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Fotos]]></category>
		<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=888</guid>
		<description><![CDATA[As you might have noticed I tend to shoot a lot of photos (and recently the occasional video) on events such as parties and birthdays. Being a Linux user, and a strong believer in straight-out-of-camera shots, I tend to shy away from individual post-processing for my shots. I might crop the occasional shot, especially when [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://heipei.net/weblog/imagemagick.png" class="alignleft"/>As you might have noticed I tend to shoot a lot of photos (and recently the occasional video) on events such as parties and birthdays. Being a Linux user, and a strong believer in straight-out-of-camera shots, I tend to shy away from individual post-processing for my shots. I might crop the occasional shot, especially when it is to be used in a blog-post or something similar, but usually I simply like to throw a batch of images into a simple workflow to upload them to the web.</p>
<p><b>Photos</b><br />
When uploading photos to my <a href="http://photos.heipei.net/">llgal gallery</a>, I resize and sharpen them so they don&#8217;t take up quite as much storage and bandwidth. I start by using the EXIF auto-rotation flag to losslessly rotate any upright photos:<br />
<code>jhead -autorot IMG_*.JPG</code>Next, I rename the photos so there are no filename collisions when I throw together photos from different events:<br />
<code>exiftool '-FileName&lt;EVENT_ ${CreateDate}_$filename' -d %Y%m%d IM*.JPG</code><br />
Finally, if I want to upload the batch, I resize and sharpen the photos using the excellent imagemagick tools. Careful! <tt>mogrify</tt> will modify images in-place, so be sure to apply it on a copy of your original JPGs:<br />
<code>mogrify -resize "1024x1024&gt;" -unsharp 1x1+1+0 -sampling-factor 2x2 *.JPG</code>After that the folder with the photos is a simple <tt>scp</tt> and <tt>llgal</tt> call away from making it into my gallery.</p>
<p><b>Videos</b><br />
<img src="http://heipei.net/weblog/ffmpeg.png" class="alignleft"/>I&#8217;ve just recently started shooting video, but I already love the functionality on my EOS 60D. Even though I use the Magic Lantern firmware (you absolutely should too!) to reduce the bitrate of the videos by half, the 1080p25 videos from the EOS are still way too large to be used in any reasonable way, so it&#8217;s a good idea to compress them. I start by merging all the videos of an event into one file, using the mkvtools package:<br />
<code>mkvmerge MVI_0001.MOV + MVI_0002.MOV -o MVI_EVENT.MOV</code><br />
Next, I use ffmpeg to downscale and recompress the video and audio. Depending on your distribution, you might need to install extra packages from special repositories to do this:<br />
<code>ffmpeg -i MVI_EVENT.MOV -s 854x480 -b 2048k -vcodec libx264 -acodec libfaac -ac 2 -ar 48000 -ab 128k MVI_EVENT.mp4</code><br />
This will give you a nice small file with very good quality, even if it takes a while to render. The adjusting knob is the bitrate behind the <tt>-b</tt> parameter. Be careful not to change the framerate of the original video using <tt>-r</tt>, this will degrade quality and take forever because frames will have to be interpolated!</p>
<p>The ffmpeg-call could certainly be optimized, and I&#8217;m happy to hear about any suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2012/02/08/photo-and-video-post-processing-using-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WEP cracking with aircrack-ng</title>
		<link>http://heipei.net/2010/11/05/wep-cracking-with-aircrack-ng/</link>
		<comments>http://heipei.net/2010/11/05/wep-cracking-with-aircrack-ng/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 23:21:06 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unterwegs]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=865</guid>
		<description><![CDATA[Up until recently I thought of quickly cracking a WEP-enabled wireless as complicated. I was under the impression that not only special wireless NICs were needed to perform the necessary attack, but furthermore some time, a lot of luck and extensive knowledge of the necessary tools were absolutely necessary. I had seen videos of someone [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://media.heipei.net/aircrack.jpg" alt="Aircrack" class="alignleft"/>Up until recently I thought of quickly cracking a WEP-enabled wireless as complicated. I was under the impression that not only special wireless NICs were needed to perform the necessary attack, but furthermore some time, a lot of luck and extensive knowledge of the necessary tools were absolutely necessary. I had seen videos of someone using Kismac to discover a WEP-key in about 10 minutes, but since my Airport Extreme does not support packet injection and I didn&#8217;t follow up on it, I quickly forgot about it.</p>
<p>For some reason I delved into the topic again about a month ago. I realized that my tiny and cheap Acer Aspire One 110L, with its Atheros NIC (AR242x, 802.11abg) does in fact possess the ability to inject packets. Out of curiosity I had to try it for myself. This is not meant as a tutorial for cracking WEP (there is <a href="http://www.aircrack-ng.org/doku.php?id=simple_wep_crack">a comprehensive guide</a> for aircrack), but rather as an encouragement to try it yourself, or at least to think very hard if you&#8217;re still using WEP.</p>
<p>The most shocking thing I discovered was that the number of necessary packets to crack WEP had dramatically decreased with new attack methods. The aircrack-team talks about 20k / 40k packets (with the new PTW attack, origin and paper <a href="http://www.cdc.informatik.tu-darmstadt.de/aircrack-ptw/">here</a>) for cracking 64bit/128bit WEP, which is well below the 1000k packets I read about in the past. At a rate of 500 packets/s this amounts to less than 5 minutes of time needed. This is still a lot if you have to depend on legitimate network traffic and don&#8217;t have a few days of time. To speed things up, packet re-injection is the way to go today. It works like this: You wait and try to record an ARP-request (which should be no problem if someone is on the network), and then replay this request back to the network, meaning you simply re-inject the same packet you captured. For every ARP-request, the AP/router should respond with an ARP-reply, which in turn is a new data packet and the kind of packet you want to capture in order to get to 20k/40k unique IVs (initialization vectors). Now imagine doing this re-injection at a rate of 500 packets/s and you get the point.</p>
<p>A few caveats:</p>
<ul>
<li>If nobody&#8217;s on the network you won&#8217;t be able to capture an ARP-request. Tough luck ;)</li>
<li>If someone is on the network but you missed their initial ARP you can try disassociating them</li>
<li>I wasn&#8217;t able to do fake auth with the AP, which is why I had to replay the ARPs as long as the original client was still associated</li>
<li>If you wan&#8217;t to make extra sure you capture all the interesting replies you can keep Kismac running along airodump-ng</li>
<li>I suppose this is illegal in Germany. Oh well, I did it while on vacation ;)</li>
</ul>
<p>The nice thing about this attack:</p>
<ul>
<li>Really fast (think &#8216;car&#8217; and &#8216;battery slowly discharging&#8217;)</li>
<li>Not much storage needed to capture packets</li>
<li>Cracking efficiently possible, even on a laptop</li>
<li>If used for malicious purposes, the kind of people still using WEP will be the last to notice a few thousands extra 802.11 packets over a 5-minute span</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2010/11/05/wep-cracking-with-aircrack-ng/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ALIX 2D13: 2.6.35, LEDs, lighttpd, lmsensors</title>
		<link>http://heipei.net/2010/08/04/alix-2d13-2-6-35-leds-lighttpd-lmsensors/</link>
		<comments>http://heipei.net/2010/08/04/alix-2d13-2-6-35-leds-lighttpd-lmsensors/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 14:14:06 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=864</guid>
		<description><![CDATA[It&#8217;s a good thing I waited a few days before releasing my next ALIX-post. I was gonna talk about the leds-alix module and where to download it, but in the meantime 2.6.35 was released and already contains all the necessary code. So, besides this post there is a new config: Linux 2.6.35 vanilla for ALIX [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/heipei/4842861201/" title="ALIX 2D13 by heipei, on Flickr"><img src="http://farm5.static.flickr.com/4154/4842861201_eaa6258442_m.jpg" width="240" height="160" alt="ALIX 2D13" class="alignright"/></a>It&#8217;s a good thing I waited a few days before releasing my next ALIX-post. I was gonna talk about the leds-alix module and where to download it, but in the meantime 2.6.35 was released and already contains all the necessary code. So, besides this post there is a new config: <a href="http://heipei.net/files/config-2.6.35-alix">Linux 2.6.35 vanilla for ALIX 2D13</a>. A few changes to the 2.6.34-config I posted last time:
<ul>
<li>I didn&#8217;t choose the Geode GL/GX last time, doh!</li>
<li>The kernel is no longer tickless (performs better)</li>
<li>Threw out some modular crypto-stuff (which I missed the last time)</li>
</ul>
<p>There are <strong>three front-LEDs</strong> on the ALIX board, so nothing fancy. The interesting is that there are predefined triggers for these LEDs in <tt>/sys/class/leds/</tt> which will make the LEDs display one of the following: heartbeat = load average (blinking speed), ide-disk (write access to the cf-card), timer, etc. Just try <tt>cat trigger</tt> to see the possible values. There is also the possibility to trigger on matches from iptables (think: traffic on port 22 ;). However my iptables userland seems to be outdated, so I will have to report about this another time.</p>
<p><img src="http://heipei.net/weblog/lighttpd.png" alt="Lighttpd" class="alignleft"/>Furthermore I tried using <strong>lighttpd</strong> instead of gatling on my fat external drive, and it performed even better, using slightly less CPU. In the kernel I activated the deadline IO-scheduler as default (while keeping CFQ and NOOP as an option), let&#8217;s see how that plays out. I&#8217;m still not getting more than 9MB/s using Samba, while the CPU is mostly idle and lighty completely saturates the 100MBit link, really annoying.</p>
<p><strong>lm_sensors</strong> on the ALIX are no problem either. Just try my kernel-config or make sure to activate the basic I2C-stuff and <tt>CONFIG_SCx200_ACB</tt>. My ALIX runs at comfy 42°C when not under load.</p>
<p>I already talked about using <strong>tmpfs for some of the directories</strong> written to frequently (<tt>/tmp, /var/tmp, /var/run, /var/log, /var/lock</tt>). I don&#8217;t care about logs right now, so I don&#8217;t mind losing them on reboot. Some daemons however complain or won&#8217;t start if their log-directories aren&#8217;t set up, so you should do that with an init-script. I uploaded <a href="http://heipei.net/files/heipei.sh.txt">my script here</a>, which will work with Debian and also sets up two LEDs and the deadline scheduler in case it isn&#8217;t the default.</p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2010/08/04/alix-2d13-2-6-35-leds-lighttpd-lmsensors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ALIX 2D13: First impressions</title>
		<link>http://heipei.net/2010/07/30/alix-2d13-first-impressions/</link>
		<comments>http://heipei.net/2010/07/30/alix-2d13-first-impressions/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 16:07:10 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=863</guid>
		<description><![CDATA[I desperately needed a new toy, and found the perfect match with the ALIX 2D13 board from Swiss manufacturer PCEngines. I&#8217;ve had good experiences with the WRAP-board more than four years ago, so I knew about the quality of their products. This post should serve as a quick introduction and point out some caveats if [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/heipei/4842861201/" title="ALIX 2D13 by heipei, on Flickr"><img src="http://farm5.static.flickr.com/4154/4842861201_eaa6258442.jpg" width="500" height="334" alt="ALIX 2D13" class="aligncenter"/></a>I desperately needed a new toy, and found the perfect match with the <a href="http://pcengines.ch/alix2d13.htm">ALIX 2D13</a> board from Swiss manufacturer <a href="http://pcengines.ch/index.htm">PCEngines</a>. I&#8217;ve had <a href="http://heipei.net/2006/03/09/wireless-router-application-platform-wrap/">good experiences with the WRAP-board more than four years ago</a>, so I knew about the quality of their products. This post should serve as a quick introduction and point out some caveats if you want to setup and use an ALIX 2D13.</p>
<p><b>Specs</b><br />
<img src="http://media.heipei.net/alix2d13.jpg" alt="ALIX 2D13" class="alignright"/>PCEngines has an <a href="http://www.pcengines.ch/alix.htm">overview over the ALIX-line</a> as well as the <a href="http://www.pcengines.ch/alix2d13.htm">specs of the ALIX 2D13</a>, so this is just a short rundown:
<ul>
<li>500 MHz AMD Geode LX800 (x86)</li>
<li>256 MB DDR DRAM</li>
<li>3 Ethernet NICs (Via VT6105M 10/100)</li>
<li>Furthermore: 2x USB ports, MiniPCI-slot, CF-slot, serial port</li>
</ul>
<p>I chose the 2D13 model since I wanted 3 ethernet NICs and the added battery (for keeping system time after a reboot) seemed like a good idea. The ALIX boards can be bought in many variations, some even providing VGA/sound to be used as a thin client. I ordered my ALIX at the <a href="http://varia-store.com/">Varia-Store</a>, where they offer a complete bundle of ALIX-2D13-board, enclosure, power supply and CF-card for a mere €145 including shipping in Germany. I ordered on Tuesday at noon and the package arrived Thursday afternoon.</p>
<p><span id="more-863"></span><br />
<b>Operating system / prerequisites</b><br />
You probably want to run Linux on these babies, otherwise you can stop reading ahead. There are some things you really need before you get started:
<ul>
<li>CF-card reader on your computer (for installing the OS to the CF-card)</li>
<li>Serial connection (think USB-to-Serial converter, pl2303) to access the ALIX</li>
</ul>
<p>I chose to install Debian on the ALIX, since I&#8217;m familiar with it and it has little overhead. I found these guides to be helpful, even if not completely up to date or correct: <a href="http://peter.molnar.cc/2008/04/11/installing-debian-gnulinux-on-a-alix-board/">Guide 1</a>, <a href="http://mac.tuxfinder.com/wordpress/2009/06/11/installing-linux-debian-lenny-on-an-alix-board/">Guide 2</a>. But careful! Don&#8217;t mount the ALIX board in its enclosure until you&#8217;re sure that your ALIX boots, since removing the CF-card requires taking the board out again ;).<br />
The next thing I did was to build a custom kernel, since Debian only includes 2.6.26 and has everything you&#8217;ll never need compiled as modules. I built a next-to-minimal kernel on my workstation (<a href="http://tinkering-is-fun.blogspot.com/2009/12/configuring-linux-kernel-for-use-on.html">this site</a> helped a lot) and it seems to work just fine so far. The config is <a href="http://heipei.net/files/config-2.6.34-alix2d13.txt">here</a>. An important thing if you compile somewhere else is to make sure you use<code>ARCH=i386 make menuconfig<br />
ARCH=i386 make -j3</code> when configuring and compiling your kernel for the ALIX.<br />
People already using CF-cards or small embedded devices probably know to use <tt>noatime</tt> where possible and mount <tt>/tmp, /var/tmp, /var/run, /var/log, /var/lock</tt> as tmpfs to go easy on the CF-cards limited write cycles.</p>
<p><b>Performance / Applications</b><br />
I bought the ALIX to play around with it but also to evaluate its possible use as a Samba-fileserver and CUPS printserver for my flat, and maybe even a small shellserver in case I&#8217;m away from home and my workstation isn&#8217;t running. With an energy-consumption of about 5-6W you can have it running 24/7, the fact that it doesn&#8217;t have any moving parts only adds to that. Booting takes a few seconds by the way, not that it matters.</p>
<p>The first measurements I did were with scp from the ALIX to my WS, which maxed out at 3.5MB/s because OpenSSH used up the CPU on the ALIX. Next I tried using Samba (to and from) and got a mere 6.5MB/s throughput reading from the ALIX and an attached USB-drive. This was with the stock kernel however, and using my own 2.6.34-kernel I was able to transmit more than 9MB/s using Samba. I had a stupid line in my <tt>smb.conf</tt> which might explain the 6.5MB/s I got before. Make sure to remove this line!:<code>socket options = IPTOS_LOWDELAY TCP_NODELAY SO_RCVBUF=16384 SO_SNDBUF=16384</code>I then did another test using <a href="http://www.fefe.de/gatling/">fefes gatling web/ftp/samba-server</a> on the ALIX and my USB-drive in HTTP-mode with wget and was able to completely saturate the 100MBit-link, which is why I suspect to be able to do the same thing with Samba as well.<br />
For customers of Aachens Uni-DSL it should be interesting to know that I managed to max out my 8Mbit-DSL-line (about 700kB/s) using <tt>vpnc</tt> on the ALIX with enough idle CPU left. Using <tt>vpnc</tt> and doing a <tt>git pull</tt> on the ALIX resulted in only a slight slowdown since git was busy saving/packing objects it received. Performance using <tt>git daemon</tt> on the ALIX and pulling from there were acceptable as well.</p>
<p>All of these measurements are highly unscientific and side-effects or misconfigurations could have had negative effects, so one should read these rates as minimal assurances.</p>
<p><b>Conclusion</b><br />
After the first full day of using the ALIX I&#8217;m impressed. The CPU is powerful enough for most tasks and with a little custom configuration some things can be sped up considerably. I don&#8217;t see any problems for the intended use as a file-server, by whichever way the files are served. The next step will be hooking up my printer.</p>
<p>If you intend to use encrypted filesystems on the ALIX you should do some research first. While the AMD Geode does have hardware support for AES, OpenSSL does not seem to use it and I&#8217;m not quite sure about any cryptofs. Another common thing the ALIX might be used for is wireless LAN. The MiniPCI-slot can take a variety of wireless NICs, but I don&#8217;t need yet another AP at the moment.</p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2010/07/30/alix-2d13-first-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command-line warriors, part one</title>
		<link>http://heipei.net/2010/06/30/command-line-warriors-part-one/</link>
		<comments>http://heipei.net/2010/06/30/command-line-warriors-part-one/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 14:19:18 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Fotos]]></category>
		<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=862</guid>
		<description><![CDATA[This is a post about some things you might have used a graphical tool for in the past, but which can be done just as well using command-line tools. Since I keep finding these little gems I hope I can continue this kind of post in the future. I&#8217;ll try to categorize the tips and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://media.heipei.net/terminal.png" alt="Terminal" class="alignleft"/>This is a post about some things you might have used a graphical tool for in the past, but which can be done just as well using command-line tools. Since I keep finding these little gems I hope I can continue this kind of post in the future. I&#8217;ll try to categorize the tips and I&#8217;ll only post the functionality I recently discovered and use myself, so this is not a reference for any of the programs mentioned.</p>
<p><b>Photography</b><br />
You accidentally selected &#8220;Delete All&#8221; on your digital cameras and now your photos are gone? You even fear they might have been overwritten by photos taken after the accident? Fear not, the same thing happened to me, and I was able to restore all the photos from the event plus photos going back as far as three months from my CF card in my 400d using the <a href="http://www.cgsecurity.org/wiki/PhotoRec"><b>PhotoRec</b></a> software.</p>
<p>Cameras today often have an orientation sensor, so pictures taken in portrait mode will automatically be rotated. But this usually happens in the viewer, while the orientation is simply an EXIF tag. Of course this takes up precious computing time and not every viewer supports it. <b><a href="http://www.sentex.net/~mwandel/jhead/">jhead</a></b> can not only display EXIF information in a consistent manner but can also rotate pictures lossless and clear the orientation-tag afterwards. The call is <code>jhead -autorot *.JPG</code><br />
If you want to rename your images using EXIF-information, <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/"><b>exiftool</b></a> is the way to go. The command <code>exiftool '-FileName&lt;Party_ ${CreateDate}_${filename}' -d %Y%m%d *.jpg</code> would prefix all the photos with &#8220;Party&#8221; and the create-date, while keeping the original filename as the suffix. exiftool can shift dates too, if you ever forget to adjust for daylight saving.</p>
<p>When uploading the images you&#8217;ll often want to resize them. The <a href="http://www.imagemagick.org/"><b>ImageMagick</b></a> collection can do just that, and many other things (like sharpening etc.). If you <code>mogrify -resize 1600x1600</code> your photos will be resized to 1600px maximum edge length, while keeping the ratio. But be careful, mogrify overwrites the pictures in place!</p>
<p><b>Music</b><br />
Thanks to services like <a href="http://www.video2mp3.net/">video2mp3.net/</a> you can download a lot of music from YouTube. But sometimes there is silence at the end or the beginning of a song, and a whole collection of songs might have differing levels of volume. To cut an mp3 you can use <a href="http://mp3splt.sourceforge.net/mp3splt_page/home.php"><b>mp3splt</b></a> like this to cut everything after 03:30 minutes:<code>mp3splt file.mp3 00.00 03.30</code>The sound levels can be normalized, losslessly, using <a href="http://mp3gain.sourceforge.net/"><b>mp3gain</b></a>:<code>mp3gain -rk *</code></p>
<p><b>Misc</b><br />
When pretty-printing flat text files I use <a href="http://www.gnu.org/software/a2ps/"><b>a2ps</b></a> to format them nicely and get a PostScript-document. a2ps however does not support UTF-8, while the only characters I care about (German Umlauts) can be represented using Latin1 just fine. So, one can use iconv to convert them on the fly like this:<code>iconv --from-code=UTF-8 --to-code=LATIN1 textfile.txt|a2ps --font 9 -E -B -r --column=1 > out.ps</code></p>
<p>To export images from a PDF-file I discovered <a href="http://gd.tuwien.ac.at/linuxcommand.org/man_pages/pdfimages1.html"><b>pdfImages</b></a>, which is part of the xpdf-suite. Use it like this:<code>pdfimages -j foo.pdf  bar</code></p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2010/06/30/command-line-warriors-part-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSH: Reuse existing connections / Reverse tunnel</title>
		<link>http://heipei.net/2010/02/02/openssh-reuse-existing-connections-reverse-tunnel/</link>
		<comments>http://heipei.net/2010/02/02/openssh-reuse-existing-connections-reverse-tunnel/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 15:48:00 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=801</guid>
		<description><![CDATA[You often hear the phrase &#8220;the swiss knife of &#8230;&#8221;. Well, for networking, OpenSSH clearly deserves that title in my opinion. Besides the obvious feature of providing secure logins with different options for mutual authentication, it can also be used to transfer files. It is also a core component of software like git, which depend [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openssh.org/"><img src="/weblog/openssh.png" alt="OpenSSH" class="alignleft" style="border:0px"/></a>You often hear the phrase &#8220;the swiss knife of &#8230;&#8221;. Well, for networking, OpenSSH clearly deserves that title in my opinion. Besides the obvious feature of providing secure logins with different options for mutual authentication, it can also be used to transfer files. It is also a core component of software like git, which depend on ssh to securely push changes instead of reinventing their own server and dealing with the whole authentication/authorization stuff once again.<br />
I&#8217;ve blogged about <a href="http://heipei.net/2008/08/28/ssh-through-proxyintermediate-host/">using SSH to access hosts behind a firewall/router more conveniently</a>, and I really suggest you sit down and read the manpage front-to-back, it will probably be rewarding for your current workflow.</p>
<p><b>Reusing a connection</b><br />
Anyway, today I wanted to present another advanced feature, one I only stumbled upon while learning for an upcoming exam. The slides mentioned the possibility to share connections on one SSH-channel (to the same destination, obviously). Now, why do you need more than one connection in the first place? Well, sometimes you just need the space, and using screen just doesn&#8217;t cut it. Or you use git or scp to the same host you&#8217;re logged in already interactively. In that case, you just have to establish one connection and any further connection will use the first one. The benefit? Login is way faster, almost instantly, because the whole handshake and authentication doesn&#8217;t have to take place again. The caveat: You&#8217;ll have to close your master-connection last, otherwise the other connections will drop too. For me that&#8217;s no problem, since the host I use most of the time is also the host I&#8217;ve got a session open with 24/7 (IRC).</p>
<p>I&#8217;m just gonna show the fully automated version here, though you can use it manually as well, just when you need it. A better description can be found <a href="http://www.debian-administration.org/articles/290">here</a>. To automate it, put this in your <tt>~/.ssh/config</tt> (you don&#8217;t have a config yet? shocking!):<br />
<code>ControlMaster auto<br />
ControlPath /tmp/%r@%h:%p</code>As usual, you can put it at the very top to apply for all hosts or you can activate it for specific hosts by putting below a <tt>Host</tt> declaration. Now all you have to do is use <tt>ssh host</tt> as usual. You&#8217;ll see it&#8217;s working when you terminate the connection:<br />
<tt>Shared connection to host.de closed.</tt></p>
<p><b>Reverse tunnel</b><br />
Yes, you can tunnel with OpenSSH. You can even have it act as a SOCKS proxy, which is really neat when combined with Firefox-plugins like FoxyProxy. But you can also reverse-tunnel your way out of a closed network (or NATed network for that matter) when you don&#8217;t have access to any intermediate host (like the router/firewall). It&#8217;s easy:<br />
<code>ssh -NR 12345:localhost:22 home.de</code>This assumes you&#8217;re issuing the command from the machine that you want to access (from home) later on. It will bind the port 12345 on home.de so that it is forwarded to port 22 (SSH) on the local host. Yeah, it requires some reverse thinking too to get it right ;) The <tt>-N</tt>-switch prevents a login, by the way. Obviously it is of little use if your home.de has a flaky dialup connection, so you might want to reverse-tunnel to a stable endpoint (or use something like autossh).</p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2010/02/02/openssh-reuse-existing-connections-reverse-tunnel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>msmtp queueing for offline use</title>
		<link>http://heipei.net/2009/11/17/msmtp-queueing-for-offline-use/</link>
		<comments>http://heipei.net/2009/11/17/msmtp-queueing-for-offline-use/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 19:15:51 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unterwegs]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=715</guid>
		<description><![CDATA[When you start using a small and slow laptop over an unreliable GPRS connection (say while travelling in an ICE at 300km/h) you start noticing certain things that are missing from your current shell-setup. One of these problems manifests itself when you want to send the mail you just typed in mutt. Fortunately there is [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://heipei.net/weblog/mutt-icon.png" alt="mutt" class="alignleft"/>When you start using a small and slow laptop over an unreliable GPRS connection (say while travelling in an ICE at 300km/h) you start noticing certain things that are missing from your current shell-setup. One of these problems manifests itself when you want to send the mail you just typed in mutt. Fortunately there is an easy and elegant fix (if you use mutt with msmtp): <a href="http://sourceforge.net/projects/msmtp/files/msmtpqueue/">msmtpqueue</a>. This gives you three little scripts to enqueue, list and send messages which would otherwise have gone directly into msmtp. Just put them somewhere and then add this to your .muttrc:<code>set sendmail="$HOME/local/bin/msmtp-enqueue -i"<br />
macro index \Cy "!$HOME/local/bin/msmtp-runqueue&lt;enter&gt;"</code>Now &#8220;sending&#8221; mail from mutt happens instantly and you can manually push the batch of mails out to your smtp once the train has stopped in a station and your reception is stable ;). <tt>msmtp-listqueue</tt> shows you the queued mails while <tt>msmtp-runqueue</tt> mails them (using msmtp of course!). For the downstream-direction of offline mutt-usage there&#8217;s <a href="http://software.complete.org/software/wiki/offlineimap/">offlineimap</a>, but I feel like this deserves an extra post ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2009/11/17/msmtp-queueing-for-offline-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aspire One / X.org screen blanking</title>
		<link>http://heipei.net/2009/11/14/aspire-one-x-org-screen-blanking/</link>
		<comments>http://heipei.net/2009/11/14/aspire-one-x-org-screen-blanking/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 11:39:14 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=709</guid>
		<description><![CDATA[When using X on my Acer Aspire One (110L) and playing videos with mplayer, X would occasionally blank the screen after a few minutes without any way out but to suspend/resume to get your X back. This didn&#8217;t only happen with mplayer, and it didn&#8217;t have anything to do with xscreensaver.Anyway, after some digging I [...]]]></description>
			<content:encoded><![CDATA[<p>When using X on my Acer Aspire One (110L) and playing videos with mplayer, X would occasionally blank the screen after a few minutes without any way out but to suspend/resume to get your X back. This didn&#8217;t only happen with mplayer, and it didn&#8217;t have anything to do with xscreensaver.Anyway, after some digging I found that adding<code>        Option          "FramebufferCompression"        "off"</code>to the <tt>Device</tt>-section of my xorg.conf resolved the problem.<br />
Another cool thing I found out while going through ssh manpages is that you can silence the motd on login simply by touching <tt>~/.hushlogin</tt>.</p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2009/11/14/aspire-one-x-org-screen-blanking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gentoo Wallpaper</title>
		<link>http://heipei.net/2009/11/13/gentoo-wallpaper/</link>
		<comments>http://heipei.net/2009/11/13/gentoo-wallpaper/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 09:26:30 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=702</guid>
		<description><![CDATA[I just found this wallpaper I seem to have made in &#8217;06 (around August) and posted to the Gentoo Forums. It never went anywhere, but it would be a shame to let it go to waste, so here you go. Don&#8217;t ask for any higher resolutions though ;) Download it in 800&#215;600, 1024&#215;768 or 1280&#215;1024.]]></description>
			<content:encoded><![CDATA[<p>I just found this wallpaper I seem to have made in &#8217;06 (around August) and <a href="http://forums.gentoo.org/viewtopic-p-3495740.html#3495740">posted to the Gentoo Forums</a>. It never went anywhere, but it would be a shame to let it go to waste, so here you go. Don&#8217;t ask for any higher resolutions though ;)<br />
<a href="http://heipei.net/weblog/gentoo-heipei-800x600.jpg"><img src="http://heipei.net/weblog/gentoo-heipei-thumb.jpg" alt="Gentoo Wallpaper" class="aligncenter"/></a><br />
Download it in <a href="http://heipei.net/weblog/gentoo-heipei-800x600.jpg">800&#215;600</a>, <a href="http://heipei.net/weblog/gentoo-heipei-1024x768.jpg">1024&#215;768</a> or <a href="http://heipei.net/weblog/gentoo-heipei-1280x1024.jpg">1280&#215;1024</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2009/11/13/gentoo-wallpaper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>256 colors galore!</title>
		<link>http://heipei.net/2009/10/18/256-colors-galore/</link>
		<comments>http://heipei.net/2009/10/18/256-colors-galore/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 10:39:08 +0000</pubDate>
		<dc:creator>Jojo</dc:creator>
				<category><![CDATA[Geekstuff]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://heipei.net/?p=680</guid>
		<description><![CDATA[My weblog is littered with widespread tips about configuration for common shell tools and I post the occasional screenshot to flickr just to show off. I often get mails/comments regarding the used colorschemes and configs, so I thought it would be a good idea to create a separate page for these configs (and to keep [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://heipei.net/linux/"><img src="/weblog/256colors_page.png" alt="256 colors Linux" class="aligncenter"/></a>My weblog is littered with widespread tips about configuration for common shell tools and I post the occasional screenshot to flickr just to show off. I often get mails/comments regarding the used colorschemes and configs, so I thought it would be a good idea to create <a href="http://heipei.net/linux/">a separate page</a> for these configs (and to keep that up-to-date).</p>
<p>Comments and improvements can be directed to me via email or as a comment to this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://heipei.net/2009/10/18/256-colors-galore/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

