<?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>Aleksander Skjæveland Larsen &#187; code</title>
	<atom:link href="http://ogrim.no/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://ogrim.no</link>
	<description>This is my personal webpage, where I share the tings I make</description>
	<lastBuildDate>Wed, 16 Nov 2011 20:48:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Recursive unzip in bash</title>
		<link>http://ogrim.no/2011/10/recursive-unzip-in-bash/</link>
		<comments>http://ogrim.no/2011/10/recursive-unzip-in-bash/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 09:10:36 +0000</pubDate>
		<dc:creator>ogrim</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[debian]]></category>

		<guid isPermaLink="false">http://ogrim.no/?p=415</guid>
		<description><![CDATA[There is a lot of data I need to extract from archives, nested deeply within a silly folder structure. Doing it manually is out of the question. I had to modify this script I found at the Unix Stack Exchange slightly, in order to make it run as I wanted. It will run until it [...]]]></description>
			<content:encoded><![CDATA[<p>There is a lot of data I need to extract from archives, nested deeply within a silly folder structure. Doing it manually is out of the question. I had to modify this script I found at the <a href="http://unix.stackexchange.com/questions/4367/extracting-nested-zip-files">Unix Stack Exchange</a> slightly, in order to make it run as I wanted. It will run until it doesn&#8217;t find more .zip archive files, as it deletes them after extraction.</p>
<p>I put this into a file:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
shopt -s globstar nullglob
while set -- **/*.zip; [ $# -ge 1 ]
do
    for z
    do
        ( cd -- &quot;$(dirname &quot;$z&quot;)&quot; &amp;&amp;
            z=${z##*/} &amp;&amp;
            unzip -- &quot;$z&quot; &amp;&amp;
            rm -- &quot;$z&quot;
        )
    done
done
</pre>
<p>then made it executable with chmod +x and stuck it on my path. Now I can easily unzip all the archive files recursively, from the folder where I call the script.</p>
]]></content:encoded>
			<wfw:commentRss>http://ogrim.no/2011/10/recursive-unzip-in-bash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>stumpwm and cmus (or any other terminal program)</title>
		<link>http://ogrim.no/2011/05/stumpwm-cmus/</link>
		<comments>http://ogrim.no/2011/05/stumpwm-cmus/#comments</comments>
		<pubDate>Tue, 10 May 2011 11:53:48 +0000</pubDate>
		<dc:creator>ogrim</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[instructions]]></category>
		<category><![CDATA[stumpwm]]></category>

		<guid isPermaLink="false">http://ogrim.no/?p=368</guid>
		<description><![CDATA[Update 2nd September 2011: It seems I forgot to write how to configure gnome-terminal to keep the original title. In Profile Preferences go to Title and Command and set When terminal commands set their own titles to Prepend initial title. Stumpwm is an excellent tiling window manager written entirely in Common Lisp. It is fully [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 2nd September 2011:</strong> It seems I forgot to write how to configure gnome-terminal to keep the original title. In <em>Profile Preferences</em> go to <em>Title and Command</em> and set <em>When terminal commands set their own titles</em> to <em>Prepend initial title</em>.</p>
<p><a href="http://www.nongnu.org/stumpwm/">Stumpwm</a> is an excellent tiling window manager written entirely in Common Lisp. It is fully keyboard driven and hackable to the fullest. The wm is running in it&#8217;s own CLisp REPL, so you can connect with Slime+Emacs and hack directly. It is super easy to customize the wm, simply re-evaluate and you are good to go!</p>
<p><a href="http://cmus.sourceforge.net/">cmus</a> is an equally awesome program I enjoy using, a very efficient music player that runs in a terminal emulator.<br />
<img src="http://ogrim.no/wp-content/uploads/cmus-2.3.0.png" alt="" title="cmus-2.3.0" width="660" height="436" class="aligncenter size-full wp-image-369" /></p>
<p>I wanted to have a keybinding either bringing cmus in focus, or starting it if it isn&#8217;t running. As cmus is running in a terminal emulator, it wasn&#8217;t straight forward how to achieve this. I am using the Gnome Terminal, so this solution will have to be modified to work with other terminals. Of course, the code is added to the <code>.stumpwm</code> file, but you could also just evaluate it to try it out.</p>
<p><code>(defcommand cmus () ()<br />
  "Run or switch to CMus"<br />
  (run-or-raise "gnome-terminal -e cmus -t cmus"<br />
		'(:instance "gnome-terminal" :title "cmus")))</code></p>
<p>Now I just have to bind the command to an appropriate key</p>
<p><code>(define-key *root-map* (kbd "C-p") "cmus")</code></p>
<p>This works because I set the title of the terminal when I launch it. cmus changes the title based on what song is playing, so it will not work without doing this.</p>
]]></content:encoded>
			<wfw:commentRss>http://ogrim.no/2011/05/stumpwm-cmus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graffiti Markup Language</title>
		<link>http://ogrim.no/2010/01/graffiti-markup-language/</link>
		<comments>http://ogrim.no/2010/01/graffiti-markup-language/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 15:10:02 +0000</pubDate>
		<dc:creator>ogrim</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[pirate]]></category>

		<guid isPermaLink="false">http://ogrim.no/?p=306</guid>
		<description><![CDATA[Makup languages are fun. GML = Graffiti Markup Language from Evan Roth on Vimeo. Via http://thepiratesdilemma.com/]]></description>
			<content:encoded><![CDATA[<p>Makup languages are fun.</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8072358&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8072358&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object>
<p><a href="http://vimeo.com/8072358">GML = Graffiti Markup Language</a> from <a href="http://vimeo.com/fi5e">Evan Roth</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Via <a href="http://thepiratesdilemma.com/the-art-of-war/its-graffiti-markup-language-week">http://thepiratesdilemma.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ogrim.no/2010/01/graffiti-markup-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

