<?xml version="1.0" encoding="iso-8859-1"?>
        <?xml-stylesheet type="text/css" href="http://www.miek.nl/blog/"?>
<rss version="2.0"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:admin="http://webns.net/mvcb/"
 xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title>Miek</title>
<atom:link href="http://www.miek.nl/blog/rss.xml" rel="self" type="application/rss+xml" />
<link>http://www.miek.nl/blog</link>
<description>Thoughts on (technical) stuff</description>
<dc:language>en-us</dc:language>
<dc:creator>Miek Gieben</dc:creator>
<dc:date>2013-03-26T22:21:51+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />

<item>
<link>http://www.miek.nl/blog/archives/2013/02/27/persistent_synaptic_touchpad_settings_in_ubuntu_12_10/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2013/02/27/persistent_synaptic_touchpad_settings_in_ubuntu_12_10/index.html</guid>
<title>Persistent Synaptic Touchpad settings in Ubuntu 12.10+</title>
<dc:date>2013-02-27T20:29:45+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> linux</dc:subject>
<description><![CDATA[<p>I was wondering how to make my touchpad settings permanent in Ubuntu. I could find a few pointers on the net, like:</p>
<ul>
<li><p>http://tombuntu.com/index.php/2011/11/06/persistent-touchpad-configuration-in-ubuntu-11-10/</p></li>
<li><p>http://ubuntuforums.org/archive/index.php/t-1538147.html</p></li>
</ul>
<p>But sometimes it makes sense to look at your own system's documentation:</p>
<pre><code>% cd /usr/share/X11/xorg.conf.d
% head 50-synaptics.conf
# Example xorg.conf.d snippet that assigns the touchpad driver
# to all touchpads. See xorg.conf.d(5) for more information on
# InputClass.
# DO NOT EDIT THIS FILE, your distribution will likely overwrite
# it when updating. Copy (and rename) this file into
# /etc/X11/xorg.conf.d first.
# Additional options may be added in the form of
#   Option &quot;OptionName&quot; &quot;value&quot;
#
Section &quot;InputClass&quot;</code></pre>
<p>Which seems pretty obvious to me. I added</p>
<pre><code>Option &quot;TabButton2&quot; &quot;3&quot;
Option &quot;TabButton3&quot; &quot;2&quot;</code></pre>
<p>as my personal configuration.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2013/02/05/new_dutch_teletext_script/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2013/02/05/new_dutch_teletext_script/index.html</guid>
<title>New Dutch Teletext Script</title>
<dc:date>2013-02-05T14:17:41+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> perl</dc:subject>
<description><![CDATA[<p>Last week, the Dutch public broadcaster (<a href="http://www.nos.nl">NOS</a>) decided to &quot;fix&quot; their online teletext offering, there breaking <a href="http://www.miek.nl/blog/archives/2008/07/15/teletext_nl_script/index.htm%20l">an old script I had laying around</a>. Their new web interface (displaying gifs) can be found <a href="http://nos.nl/teletekst/#100_01">here</a>.</p>
<p>After <a href="https://twitter.com/bdekruijff">@bdekruijff</a> discovered their newly, hidden text feed, I decided to adapt the old script to this new situation. Thanks to <a href="http://utopia.knoware.nl/users/eprebel/Communication/Prestel/index.html">this page</a> I was able to (partially) reconstruct the feed. Most escape sequences are working, I'm still fiddling with finding Unicode chars for the &quot;Contiguous Graphics Set&quot;.</p>
<p><a href="https://github.com/miekg/tt">The code can be found at github</a> and is written in Perl. Or download a <a href="http://www.miek.nl/downloads/2013/tt">local version</a>.</p>
<p>Usage is the same: <code>tt 101</code> lists a page. It works best on a dark background. If you want to fix that, be my guest.</p>
<p>SCREENSHOT! (aka the ACID test page 702):</p>
<img src="http://miek.nl/downloads/2013/tt.png" />]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2013/01/30/make_me_a_sandwich_make_me_a_sandwich/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2013/01/30/make_me_a_sandwich_make_me_a_sandwich/index.html</guid>
<title>Make me a sandwich, MAKE me a sandwich</title>
<dc:date>2013-01-30T23:17:03+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> zsh</dc:subject>
<description><![CDATA[<p>We all know this comic:</p>
<img src="http://imgs.xkcd.com/comics/sandwich.png" />
<p>And now in <code>zsh</code>!</p>
<p>With the following snippet all commands that are started with an uppercase word will be prefixed with <code>sudo</code> and then executed.</p>
<p>So <em>MAKE me a sandwich</em>, becomes <em>sudo make me a sandwich</em>.</p>
<pre><code>accept-line() {
    local B
    B=(${=BUFFER})
    if [[ &quot;$B[1]&quot; != [A-Z]* ]]; then
        zle .accept-line
        return
    fi
    if [[ $B[1] != &quot;&quot; &amp;&amp; $B[1] == $B[1]:u ]]; then
        BUFFER=&quot;sudo $B[1]:l $B[2,-1]&quot;
    fi
    zle .accept-line
}</code></pre>
<p>And activate with:</p>
<pre><code>zle -N accept-line</code></pre>
<p>The avoid clashing with commands that <em>are</em> uppercase already (for instance <code>GET</code> and <code>POST</code>), it can be disabled by using a backslash. So using <code>GET</code> becomes <code>\GET</code>. (The same trick can be used to avoid expanding an alias).</p>
<h2 id="repo">Repo</h2>
<p>Any code changes will be done in <a href="https://github.com/miekg/SUDOsudo">this Git repo</a>.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2013/01/22/pandoc2rfc_and_xml2rfc/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2013/01/22/pandoc2rfc_and_xml2rfc/index.html</guid>
<title>Pandoc2rfc and xml2rfc</title>
<dc:date>2013-01-22T12:23:55+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> pandoc, linux</dc:subject>
<description><![CDATA[<p>Thanks to the help of Marc Petit-Huguenin I have been able to create (and upload) debian packages (install fine on Ubuntu) for Pandoc2rfc and xml2rfc. For Pandoc2rfc I choose to add a little shell script that calls pandoc and xml2rfc for you. So creating an I-D is as simple as:</p>
<pre><code>pandoc2rfc *.mkd    # or a few other extensions</code></pre>
<p>The shell script depends on <code>transform.xsl</code> to be installed in <code>/usr/lib/pandoc2rfc/</code>, allthough this can be overridden with a flag. When pandoc2rfc is installed you don't have carry the supports scripts inside your I-D's source repo. My pandoc2rfc I-D source directory now only has: <code>template.xml</code>, <code>abstract.pdc</code>, <code>back.pdc</code>, <code>middle.pdc</code> and a <code>bib/</code> directory with references.</p>
<h1 id="debian-packages">Debian packages</h1>
<p>As said there are now debian packages, see below on the setup. If you are finished you can install the pandoc2rfc and xml2rfc combo with:</p>
<pre><code>sudo apt-get install python-xml2rfc pandoc2rfc</code></pre>
<p>I'm still learning this create-deb-and-upload stuff, so some breakage might be expected....</p>
<p>With the help of Marc Petit-Huguenin I have access to a debian infra structure over at pandoc2rfc.implementers.org</p>
<p>Here's what you should probably put in your: /etc/apt/sources.list.d/pandoc2rfc.list:</p>
<pre><code>deb http://pandoc2rfc.implementers.org/ testing/$(ARCH)/
deb http://pandoc2rfc.implementers.org/ testing/all/
deb http://pandoc2rfc.implementers.org/ stable/$(ARCH)/
deb http://pandoc2rfc.implementers.org/ stable/all/
deb-src http://pandoc2rfc.implementers.org/ testing/source/
deb-src http://pandoc2rfc.implementers.org/ stable/source/</code></pre>
<p>Note that if the apt-transport-https package is installed then I recommend to use https instead:</p>
<pre><code>deb https://pandoc2rfc.implementers.org/ testing/$(ARCH)/
deb https://pandoc2rfc.implementers.org/ testing/all/
deb https://pandoc2rfc.implementers.org/ stable/$(ARCH)/
deb https://pandoc2rfc.implementers.org/ stable/all/
deb-src https://pandoc2rfc.implementers.org/ testing/source/
deb-src https://pandoc2rfc.implementers.org/ stable/source/</code></pre>
<p>All the packages are automatically signed, you can install the public key like this:</p>
<pre><code>wget https://pandoc2rfc.implementers.org/config/key.asc
sudo apt-key add key.asc</code></pre>
<p>The fingerprint of the key is as follow:</p>
<pre><code>CDB3 BC52 DFDC 8A58 35F1 714D 0309 943D 9AD0 8F3F</code></pre>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2013/01/20/google/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2013/01/20/google/index.html</guid>
<title>Google</title>
<dc:date>2013-01-20T10:30:25+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> life</dc:subject>
<description><![CDATA[<p>As I <a href="https://twitter.com/miekg/status/286597802228842498">tweeted</a>, I will be going to work for Google UK. The 18th of March 2013 will be my first work day. This also means we will be living in London starting somewhere in May 2013.</p>
<p>As of now, I'm finishing my remaining work at <a href="https://www.sidn.nl">SIDN</a>.</p>
<p>Needless to say, we are very much looking forward to start a new chapter in our lives :-) .</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2013/01/20/rdup_1_1_14/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2013/01/20/rdup_1_1_14/index.html</guid>
<title>rdup 1.1.14</title>
<dc:date>2013-01-20T10:23:59+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> rdup</dc:subject>
<description><![CDATA[<p>I've released rdup 1.1.14 in which some new features are added and a few minor bugs are squashed.</p>
<p>See the <a href="http://www.miek.nl/projects/rdup/">project page</a> for more information.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2013/01/19/vim_as_manpager/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2013/01/19/vim_as_manpager/index.html</guid>
<title>Vim as MANPAGER</title>
<dc:date>2013-01-19T18:59:17+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> vim</dc:subject>
<description><![CDATA[<p>I like Vim, so I try to use it at many places. Like in my shell (<code>set -o vi</code>), and when writing and coding.</p>
<p>After some Googling I found that Vim can also be used as a MANPAGER. But there is one nagging issue. To quit viewing the manual page you have to type ':q', which is one keystroke more then when using <code>less</code> as your MANPAGER... Needless to say: this is unacceptable.</p>
<p>Save this script in a file named <code>manpager</code>:</p>
<pre><code>col -b | view -c &#39;set ft=man nomod nolist&#39; \
-c &#39;map q &lt;ESC&gt;:quit!&lt;CR&gt;&#39; -</code></pre>
<p>Make it executable and then:</p>
<pre><code>export MANPAGER=/home/miekg/bin/manpager</code></pre>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2012/12/09/go_dns_api_change_with_rewrite_rules/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2012/12/09/go_dns_api_change_with_rewrite_rules/index.html</guid>
<title>Go DNS API change WITH rewrite rules!</title>
<dc:date>2012-12-09T20:06:44+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> go</dc:subject>
<description><![CDATA[<p>In the standard library the DNS types have been renamed from RR_MX to MX which I think is a good change. So I made the same change in Go DNS, but this time I'm providing <code>gofmt -r</code> rewrite rules. They all have the form:</p>
<pre><code>gofmt -r &#39;RR_A -&gt; A&#39; -w *.go</code></pre>
<p>And then for <em>all</em> the types, so it's quite a list.</p>
<p>Download the rewrite rules <a href="http://www.miek.nl/downloads/2012/rewrite">here</a> and use it like <code>$SHELL rewrite</code>.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2012/12/07/printing_mx_records_with_go_dns_take_3/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2012/12/07/printing_mx_records_with_go_dns_take_3/index.html</guid>
<title>Printing MX records with Go DNS, take #3</title>
<dc:date>2012-12-07T08:15:48+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> dns(sec)</dc:subject>
<description><![CDATA[<blockquote>
<p>I'm starting to get really happy about the Go DNS API, so invasive API changes are less and less likely.</p>
</blockquote>
<p>We want to create a little program that prints out the MX records of domains, like so:</p>
<pre><code>% mx miek.nl
miek.nl.        86400   IN      MX      10 elektron.atoom.net.</code></pre>
<p>Or</p>
<pre><code>% mx microsoft.com 
microsoft.com.  3600    IN      MX      10 mail.messaging.microsoft.com.</code></pre>
<p>We are using my <a href="https://github.com/miekg/dns">Go DNS package</a>. First the normal header of a Go program, with a bunch of imports. We need the <code>dns</code> package:</p>
<pre><code>package main

import (
    &quot;github.com/miekg/dns&quot;
    &quot;os&quot;
    &quot;net&quot;
    &quot;fmt&quot;
)</code></pre>
<p>Next we need to get the local nameserver to use:</p>
<pre><code>config, _ := dns.ClientConfigFromFile(&quot;/etc/resolv.conf&quot;)</code></pre>
<p>Then we create a <code>dns.Client</code> to perform the queries for us. In Go:</p>
<pre><code>c := new(dns.Client)</code></pre>
<p>We skip some error handling and assume a zone name is given. So we prepare our question. For that to work, we need:</p>
<ol style="list-style-type: decimal">
<li>a new packet (<code>dns.Msg</code>);</li>
<li>setting some header bits;</li>
<li>define a question section;</li>
<li>fill out the question section: <code>os.Args[1]</code> contains the zone name.</li>
</ol>
<p>Which translates into:</p>
<pre><code>m := new(dns.Msg)
m.SetQuestion(dns.Fqdn(os.Args[1]), dns.TypeMX)
m.RecursionDesired = true</code></pre>
<p>Then we need to finally 'ask' the question. We do this by calling the <code>Exchange()</code> function. The unused return value is the <code>rtt</code> (round trip time).</p>
<pre><code>r, _, err := c.Exchange(m, net.JoinHostPort(config.Servers[0], config.Port))</code></pre>
<p>Check if we got something sane. The following code snippet prints the answer section of the received packet:</p>
<p>Bail out on an error:</p>
<pre><code>if r == nil {
    fmt.Printf(&quot;*** error: %s\n&quot;, err.Error())
    return
}

if r.Rcode != dns.RcodeSuccess {
        fmt.Printf(&quot; *** invalid answer name %s after MX query for %s\n&quot;, os.Args[1], os.Args[1])
        return
}

// Stuff must be in the answer section
for _, a := range r.Answer {
        fmt.Printf(&quot;%v\n&quot;, a)
}</code></pre>
<p>And we are done.</p>
<h1 id="full-source">Full Source</h1>
<pre><code>package main

import (
    &quot;github.com/miekg/dns&quot;
    &quot;net&quot;
    &quot;os&quot;
    &quot;fmt&quot;
)

func main() {
    config, _ := dns.ClientConfigFromFile(&quot;/etc/resolv.conf&quot;)
    c := new(dns.Client)

    m := new(dns.Msg)
    m.SetQuestion(dns.Fqdn(os.Args[1]), dns.TypeMX)
    m.RecursionDesired = true

    r, _, err := c.Exchange(m, net.JoinHostPort(config.Servers[0], config.Port))
    if r == nil {
        fmt.Printf(&quot;*** error: %s\n&quot;, err.Error())
        return
    }

    if r.Rcode != dns.RcodeSuccess {
            fmt.Printf(&quot; *** invalid answer name %s after MX query for %s\n&quot;, os.Args[1], os.Args[1])
            return
    }
    // Stuff must be in the answer section
    for _, a := range r.Answer {
            fmt.Printf(&quot;%v\n&quot;, a)
    }
}</code></pre>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2012/12/03/nsec3/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2012/12/03/nsec3/index.html</guid>
<title>NSEC3</title>
<dc:date>2012-12-03T22:48:41+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> dns(sec)</dc:subject>
<description><![CDATA[<p>NSEC3 - A shadowy flight into the dangerous world of a record who does not exist.</p>
<p>Denial of Existence, a young loner on a crusade to champion the cause of the innocent, the helpless, the non-existent, in a world of records who operate above the law.</p>]]></description>

</item>
</channel>
</rss>
