<?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>The Road to Elysium &#187; Snippets</title>
	<atom:link href="http://jorge.fbarr.net/category/snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://jorge.fbarr.net</link>
	<description>The life of a geek, father and husband</description>
	<lastBuildDate>Wed, 16 Nov 2011 14:43:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Vim: Commenting out multiple lines</title>
		<link>http://jorge.fbarr.net/2011/01/17/vim-commenting-out-multiple-lines/</link>
		<comments>http://jorge.fbarr.net/2011/01/17/vim-commenting-out-multiple-lines/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 10:31:26 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://jorge.fbarr.net/?p=1149</guid>
		<description><![CDATA[There are two ways to do this without a vim plugin: Select your lines with VISUAL BLOCK (CTRL-V), then press I to insert before all highlighted lines. Next type your comment character (#, ;, depending on the language), then press ESC twice. Select your lines with VISUAL LINE (SHIFT-V) then type: s/^/# In other words, [...]]]></description>
			<content:encoded><![CDATA[<p>There are two ways to do this without a vim plugin:</p>
<ol>
<li>Select your lines with VISUAL BLOCK (<strong>CTRL-V</strong>), then press <strong>I</strong> to insert before all highlighted lines. Next type your comment character (<strong>#</strong>, <strong>;</strong>, depending on the language), then press <strong>ESC</strong> twice.</li>
<li>Select your lines with VISUAL LINE (<strong>SHIFT-V</strong>) then type:</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">s<span style="color: #000000; font-weight: bold;">/</span>^<span style="color: #000000; font-weight: bold;">/</span><span style="color: #666666; font-style: italic;">#</span></pre></div></div>

<p>In other words, substitute the selected start of lines with the <strong>#</strong> character.</p>
]]></content:encoded>
			<wfw:commentRss>http://jorge.fbarr.net/2011/01/17/vim-commenting-out-multiple-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select browser from variable DISPLAY</title>
		<link>http://jorge.fbarr.net/2010/10/20/select-browser-from-variable-display/</link>
		<comments>http://jorge.fbarr.net/2010/10/20/select-browser-from-variable-display/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 09:20:11 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[dual]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[separate]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[x-screen]]></category>

		<guid isPermaLink="false">http://jorge.fbarr.net/?p=1141</guid>
		<description><![CDATA[I have two monitors at work, which I like to use in a separate X-screen setup. Meaning that each monitor has an own X-server running on it. Thing is though, I like to use Firefox on Monitor 1, while I use Google Chrome on Monitor 2. So with this script, right-clicking a link in Monitor [...]]]></description>
			<content:encoded><![CDATA[<p>I have two monitors at work, which I like to use in a separate X-screen setup. Meaning that each monitor has an own X-server running on it. Thing is though, I like to use Firefox on Monitor 1, while I use Google Chrome on Monitor 2. So with this script, right-clicking a link in Monitor 1 will open it up in Firefox, while if I do so on Monitor 2, it will open it up in Google Chrome. Very nifty. Just go to <b>System -> Preferences -> Preferred Applications</b> (if you&#8217;re using GNOME like moi) and select this script instead of a regular browser.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># A little script that selects a browser</span>
<span style="color: #666666; font-style: italic;"># to show an URL on, based on the variable</span>
<span style="color: #666666; font-style: italic;"># DISPLAY on a separate X-screen setup.</span>
<span style="color: #666666; font-style: italic;"># In other words, the active monitor.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Jorge Enrique Barrera &lt;jorge@fbarr.net&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DISPLAY</span>&quot;</span> = <span style="color: #ff0000;">&quot;:0.0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</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>firefox <span style="color: #007800;">$1</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DISPLAY</span>&quot;</span> = <span style="color: #ff0000;">&quot;:0.1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</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>google-chrome <span style="color: #007800;">$1</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jorge.fbarr.net/2010/10/20/select-browser-from-variable-display/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python password generator</title>
		<link>http://jorge.fbarr.net/2010/09/15/python-password-generator/</link>
		<comments>http://jorge.fbarr.net/2010/09/15/python-password-generator/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 15:07:08 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://jorge.fbarr.net/?p=1111</guid>
		<description><![CDATA[#!/usr/bin/env python # Filename: passgen.py &#160; import random, string &#160; mystr = string.ascii_letters+string.digits random_string = &#91;&#93; &#160; while len&#40;random_string&#41; &#60;= 8: random_string.append&#40;random.choice&#40;mystr&#41;&#41; print &#34;&#34;.join&#40;random_string&#41;]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># Filename: passgen.py</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">random</span>, <span style="color: #dc143c;">string</span>
&nbsp;
mystr = <span style="color: #dc143c;">string</span>.<span style="color: black;">ascii_letters</span>+<span style="color: #dc143c;">string</span>.<span style="color: black;">digits</span>
random_string = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>random_string<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span>= <span style="color: #ff4500;">8</span>:
    random_string.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">random</span>.<span style="color: black;">choice</span><span style="color: black;">&#40;</span>mystr<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>random_string<span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jorge.fbarr.net/2010/09/15/python-password-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedding subtitles srt into avi files with mencoder</title>
		<link>http://jorge.fbarr.net/2010/03/17/embedding-subtitles-srt-into-avi-files-with-mencoder/</link>
		<comments>http://jorge.fbarr.net/2010/03/17/embedding-subtitles-srt-into-avi-files-with-mencoder/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 08:59:09 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://jorge.fbarr.net/?p=942</guid>
		<description><![CDATA[Easier than you might think: $ mencoder -sub movie_subtitle.srt -ovc xvid -xvidencopts bitrate=-700000 -oac copy -o new.movie.name.avi movie.avi]]></description>
			<content:encoded><![CDATA[<p>Easier than you might think:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ mencoder <span style="color: #660033;">-sub</span> movie_subtitle.srt <span style="color: #660033;">-ovc</span> xvid <span style="color: #660033;">-xvidencopts</span> <span style="color: #007800;">bitrate</span>=-<span style="color: #000000;">700000</span> <span style="color: #660033;">-oac</span> copy <span style="color: #660033;">-o</span> new.movie.name.avi movie.avi</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jorge.fbarr.net/2010/03/17/embedding-subtitles-srt-into-avi-files-with-mencoder/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Removing your Master Boot Record (MBR)</title>
		<link>http://jorge.fbarr.net/2009/11/26/removing-your-master-boot-record-mbr/</link>
		<comments>http://jorge.fbarr.net/2009/11/26/removing-your-master-boot-record-mbr/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 08:42:20 +0000</pubDate>
		<dc:creator>jorge</dc:creator>
				<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://jorge.fbarr.net/?p=816</guid>
		<description><![CDATA[Removing MBR (including the partition table): # dd if=/dev/null of=/dev/sdX bs=512 count=1 Removing MBR (excluding the partition table): # dd if=/dev/null of=/dev/sdX bs=446 count=1 sdX is the device you want to remove the MBR of (like a USB-stick).]]></description>
			<content:encoded><![CDATA[<p>Removing MBR (including the partition table):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># dd if=/dev/null of=/dev/sdX bs=512 count=1</span></pre></div></div>

<p>Removing MBR (excluding the partition table):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># dd if=/dev/null of=/dev/sdX bs=446 count=1</span></pre></div></div>

<p><b>sdX</b> is the device you want to remove the MBR of (like a USB-stick).</p>
]]></content:encoded>
			<wfw:commentRss>http://jorge.fbarr.net/2009/11/26/removing-your-master-boot-record-mbr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

