<?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>Filed under: linux | Miek</title>
<atom:link href="http://www.miek.nl/blog/archives/linux/index-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>2012-02-04T04:15:11+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />

<item>
<link>http://www.miek.nl/blog/archives/2011/12/24/convert_vim_colors_to_gvim_colors/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/12/24/convert_vim_colors_to_gvim_colors/index.html</guid>
<title>Convert vim colors to gvim colors</title>
<dc:date>2011-12-24T00:08:12+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> linux, programming</dc:subject>
<description><![CDATA[<p>I've tweaked my vim color scheme
<a href="http://www.miek.nl/blog/archives/2011/09/11/xoria256m_color_scheme/index.html">quite a bit</a>
and tried
to keep the colors of gvim (which I use less often) in sync.</p>

<p>This keeping in sync hasn't worked out, so I wrote this little
script to convert the vim colors to the gvim ones:</p>

<p>Download the <a href="http://www.miek.nl/downloads/2011/makegvim">makegvim script</a>, and
use it like:</p>

<pre><code>$ ./makegvim &lt; ~/.vim/colors/&lt;yourfile&gt; &gt; /tmp/x
$ mv /tmp/x ~/.vim/colors/&lt;yourfile&gt;
</code></pre>

<p>And now the colors of <code>gvim</code> should be identical to those of <code>vim</code>.</p>

<p>Note: colors like <code>000</code> must be used like <code>cterm=0</code> otherwise
the conversion fails (the script isn't that smart).</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/12/13/cherry-picking_remote_branches/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/12/13/cherry-picking_remote_branches/index.html</guid>
<title>Cherry-picking remote branches</title>
<dc:date>2011-12-13T08:51:14+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> linux, programming</dc:subject>
<description><![CDATA[<p>I've create a little tool (actually an XSLT file) that
helps to write RFCs. Browsing my <a href="https://github.com/miekg/pandoc2rfc">github repo</a>
I found two different forks. And browsing those
forks, I saw some commits I wanted to have.</p>

<p>But how do you merge a commit from a forked git repository?
Turns out it is not that difficult.</p>

<p>The commit I want has 
the hash <a href="https://github.com/hamnis/pandoc2rfc/commit/5a11e88ddbef4ce7513aae93bdcd377449f45efb">5a11e88ddbef4ce7513aae93bdcd377449f45efb</a>.</p>

<p>The steps:</p>

<ul>
<li><p>Create a remote branch:</p>

<pre><code>git remote add hamnis https://github.com/hamnis/pandoc2rfc
</code></pre></li>
<li><p>Fetch the contents of it:</p>

<pre><code>git fetch hamnis
</code></pre></li>
<li><p>Cherry-pick the commit you need:</p>

<pre><code>git cherry-pick -c 5a11e88ddbef4ce7513aae93bdcd377449f45efb
[master 7501f13] transform.xsl: Supporting the output from pandoc 1.8.2.1:  
* table/title 
instead of table/caption  
* table/tgroup/thead/row/entry instead of table/thead/tr/th  
* table/tgroup/tbody/row/entry instead of table/tbody/tr/td
 Author: Trygve Laugstøl &lt;trygvis@inamo.no&gt;
 1 files changed, 3 insertions(+), 3 deletions(-)
</code></pre></li>
</ul>

<p>Voila. </p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/12/05/linux_considered_harmless/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/12/05/linux_considered_harmless/index.html</guid>
<title>Linux considered harmless</title>
<dc:date>2011-12-05T09:48:12+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> thoughts, linux</dc:subject>
<description><![CDATA[<p>At the conferences I visit (<a href="http://www.ietf.org/">IETF</a>, <a href="http://www.ripe.net/">RIPE</a>, etc.), I see almost all
nerds carrying Mac books. True, there are also people daring to use
Windows, but I'll ignore those for now. Only a minority of the people use an Open
Unix on their laptops, be it Linux or FreeBSD.
(Yes, I do not consider Mac OS X a true open source operating system).</p>

<p>I like to think of people going to IETFs as tinkerers: they want to develop
new protocols or make existing ones better. I would say perfect Linux users!</p>

<p>But no, most of them prefer Mac OS X, why? Because "it just works". And this is true. If
you use Linux on a laptop you will probably need to fiddle a little to get
everything working. On Mac OS X this isn't the case, it will just work.</p>

<p>Why do <em>I</em> still prefer Linux? Because it has thought me everything I know about
computers. Especially in the old days, it needed a lot of hand holding to get
boring things like sound working.  I want to stay sharp, on the edge and get to
know (new) stuff. I want to run a mailer daemon on my server, I want to play
with new code. I want to get distracted and sometimes I'm forced to get my
hands dirty and figure out how PulseAudio works. This takes, but, you will always learn something new.</p>

<p>If "Mail App" grinds away on the CPU and takes the load up to 100% you're stuck.
If "mutt" has such a problem (if ever!), I can probably fix this. </p>

<p>And this is the crux of the matter... How can it be that people who want
to tinker with stuff be content with a platform which is specifically designed
to prevent tinkering?</p>

<p>I'm convinced <a href="http://www.ubuntu.com">Ubuntu</a> can deliver the same user experience
as <a href="http://www.apple.com">Apple</a>, but with 100% open source software.</p>

<blockquote>
  <p>Keep on tinkering!</p>
</blockquote>

<h2>Related reading</h2>

<ul>
<li><a href="http://www.law.harvard.edu/news/2011/11/30_zittrain-the-personal-computer-is-dead.html">The personal computer is dead</a></li>
</ul>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/09/18/color_me_color_you/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/09/18/color_me_color_you/index.html</guid>
<title>color me, color you</title>
<dc:date>2011-09-18T09:50:03+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> zsh, linux</dc:subject>
<description><![CDATA[<p>In <a href="http://www.miek.nl/blog/archives/2011/09/11/xoria256m_color_scheme/index.html">the xoria256m post</a>, 
I introduced my xoria256 like color scheme. Again, inspired by 
<a href="http://ethanschoonover.com/solarized">solarized</a>, I extended
this to other applications. So now I use this in the following apps:</p>

<ul>
<li>vim (see that previous post);</li>
<li>mutt (idem);</li>
<li>zsh;</li>
<li>dircolors;</li>
<li>git (a bit).</li>
</ul>

<h2>zsh</h2>

<p>See this file 
<a href="https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/spectrum.zsh">to setup the colors</a>. 
Then in my prompt I have stuff like:</p>

<pre><code>PS1=$'${vcs_info_msg_0_}$FG[067]%(1j.$myjobs% $FX[reset].$FX[reset])$FG[179]%#$FX[reset] '
RPS1="$RPSL%$MAXMID&lt;...&lt;$mypath$RPSR$FG[239]$FX[bold]$__ZH$FX[reset]${vcs_info_msg_1_}"
RPSR=$'$FX[reset]$FG[009]%(0?.$FG[reset]. $E)$FX[reset]'
</code></pre>

<p>For zsh I have two files that make up my prompt:</p>

<ul>
<li><a href="http://www.miek.nl/downloads/2011/zprompt">zprompt</a>, primary prompt setup;</li>
<li><a href="http://www.miek.nl/downloads/2011/zvcs">zvcs</a>, version control <code>vcs_info</code> stuff.</li>
</ul>

<p>Also see <a href="http://www.miek.nl/blog/archives/2008/02/20/my_zsh_prompt_setup/index.html">this older blog post</a> on this setup. 
This leads to a prompt looking like this (click for larger):</p>

<p>The normal prompt is very plain. Almost nothing is shown, left the
prompt <code>%</code> and on the right the PWD <code>~</code>:
<a href="http://miek.nl/gfx/2011/prompt-local.png"><img width="600px"
src="http://miek.nl/gfx/2011/prompt-local.png" title="Zsh " /></a></p>

<p>When logging in to a remote server, the hostname appears on the
right:
<a href="http://miek.nl/gfx/2011/prompt-remote.png"><img width="600px"
src="http://miek.nl/gfx/2011/prompt-remote.png" title="Zsh " /></a></p>

<p>When a program ends abnormally the exitcode is shown, in words (<code>-INT</code>)
and red when it isn't zero:
<a href="http://miek.nl/gfx/2011/prompt-exitcode.png"><img width="600px"
src="http://miek.nl/gfx/2011/prompt-exitcode.png" title="Zsh " /></a></p>

<p>When you background an app. the number of bg jobs appear in blue. The
one with the <code>+</code> is the current job. Multiple jobs are separated with commas:
<a href="http://miek.nl/gfx/2011/prompt-background.png"><img width="600px"
src="http://miek.nl/gfx/2011/prompt-background.png" title="Zsh " /></a></p>

<p>When you enter a git/svn/hg directory, the right side shows the type
(git, svn, hg) and on the left you get the current branch. 
<a href="http://miek.nl/gfx/2011/prompt-git.png"><img width="600px"
src="http://miek.nl/gfx/2011/prompt-git.png" title="Zsh " /></a></p>

<h1>dircolors</h1>

<p>Modified from Solarized, not quite finished, but certainly looks nice (IMHO).
See <a href="http://www.miek.nl/downloads/2011/dircolors">this dircolors file</a>, I use
it like:</p>

<pre><code>eval $(dircolors ./dircolors)
</code></pre>

<h1>git</h1>

<p>The <code>alias</code> section from my <code>.gitconfig</code>:</p>

<pre><code>[alias]
        st = status
        ci = commit
        br = branch
        co = checkout
        df = diff
        lg = log -p
        pl = pull
        ps = push
        timeline = log --graph \"--pretty=format:%C(192)%h%Creset by %C(bold 239)%an%Creset (%ar)%C(182)%d%Creset%n%s%n%b\" --all
</code></pre>

<p>The colors are selected with <code>%C(number)</code>.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/09/11/xoria256m_color_scheme/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/09/11/xoria256m_color_scheme/index.html</guid>
<title>Xoria256m color scheme</title>
<dc:date>2011-09-11T15:59:27+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> linux, programming</dc:subject>
<description><![CDATA[<p>I recently came across <a href="http://ethanschoonover.com/solarized">solarized</a>. 
I started to use it immediately
for vim and mutt, but after a few days the low contrast of the color scheme
started to annoy me. Oh and btw, I'm red/green color blind.</p>

<p>I went searching and found "xoria256" a color scheme suited for 256 color
terminal and a dark background. There is even a Ubuntu/Debian package
for it: <code>vim-scripts</code>. Unlike solarized it doesn't come with a custom palette, just
use Tango in gnome-terminal (or whatever your favorite is).</p>

<p>But of course I wasn't completely happy with it as I wanted some more
blue-ish colors in there.</p>

<p>So tweaked it a little, and this is the result:</p>

<p><a href="http://miek.nl/gfx/2011/vim-xoria256.png"><img width="400px"
src="http://miek.nl/gfx/2011/vim-xoria256.png" title="Xoria256m with VIM" /></a></p>

<p>I've also ported it over to mutt, so that it has a matching color theme.</p>

<ul>
<li><a href="http://miek.nl/downloads/2011/xoria256.vim">Download the vim color scheme</a>;</li>
<li><a href="http://miek.nl/downloads/2011/color-xoria">Download mutt color scheme</a>.</li>
</ul>

<p>Note: I haven't changed the name of the color scheme, but it should be
called something different, xoria256m or something. It is also still a
work-in-progress, I will probably open a git repository on github soonish.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/08/13/opposite_of_j/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/08/13/opposite_of_j/index.html</guid>
<title>Opposite of J</title>
<dc:date>2011-08-13T13:34:31+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> linux</dc:subject>
<description><![CDATA[<p>In VIM you can use the command <code>J</code> to join to lines:</p>

<pre><code>hello       -&gt; J -&gt;  hello goodday
goodday
</code></pre>

<p>Where the cursor is positioned somewhere on the 'hello' line.</p>

<p>But I often find myself wanting to use the opposite, I 
want 'hello' to be put after 'goodday'. The cursor is now
positioned on the 'goodday' line.</p>

<pre><code>hello
goodday    -&gt; K -&gt; goodday hello
</code></pre>

<p>The following mapping does that:</p>

<pre><code>map     K       kddpkJ
</code></pre>

<p>In words:</p>

<ol>
<li>Go up 1 line: <code>k</code></li>
<li>Delete the entire line: <code>dd</code></li>
<li>Paste line below the current one: <code>p</code></li>
<li>Go up again: <code>k</code> </li>
<li>Perform the join: <code>J</code></li>
</ol>

<p>In less words: switch the lines and then do a join.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/08/12/vim_setup/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/08/12/vim_setup/index.html</guid>
<title>VIM setup</title>
<dc:date>2011-08-12T09:04:13+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> go, linux</dc:subject>
<description><![CDATA[<p>After several years I decided to use a different color scheme for VIM.
Also I'm going for force myself to use VIM's folding abilities and use
<code>make</code> from within VIM.</p>

<p>For good measure I also want to use Omni-completion when writing Go
code:</p>

<p><img width="600" src="http://www.miek.nl/gfx/2011/omni.jpg" alt="omni completion screenshot"/> </p>

<p>Btw, this screenshots also shows the <code>solarized</code> (dark) colorscheme.</p>

<h1>Coloring</h1>

<p>Google for <code>solarized</code>. In my <code>.vimrc</code>:</p>

<pre><code>let g:solarized_termcolors=256
colorscheme solarized
</code></pre>

<h1>Make from VIM</h1>

<p>Use <code>:make</code> inside the editor and jump through the errors with:</p>

<pre><code>:cn         // next compile error
:cp         // previous compile error
</code></pre>

<p>There are more options, but I want to be able to remember them...</p>

<h1>Folding</h1>

<p>Settings in <code>.vimrc</code>:</p>

<pre><code>" folding settings
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=0
</code></pre>

<p>And the commands that I will probably use most often:</p>

<pre><code>zM          // close all folds
zR          // open all folds

za          // toggle fold under cursor
zA          // toggle fold under cursor recursively
</code></pre>

<p>Other important ones:</p>

<pre><code>zo          // open fold under cursor
zO          // open all under cursor recursively

zc          // close fold under cursor
zC          // close all under cursor recursively
</code></pre>

<h1>Spell checking</h1>

<p>Setting in <code>.vimrc</code>:</p>

<pre><code>" toggle spelling control-E -&gt; en, control-N -&gt; dutch (nederlands)                   
map     &lt;C-E&gt;    :setlocal spell! spelllang=en&lt;CR&gt;
imap    &lt;C-E&gt;    &lt;ESC&gt;:setlocal spell! spelllang=en&lt;CR&gt;i
map     &lt;C-N&gt;    :setlocal spell! spelllang=nl&lt;CR&gt;
imap    &lt;C-N&gt;    &lt;ESC&gt;:setlocal spell! spelllang=nl&lt;CR&gt;i
</code></pre>

<p>Commands to use (this is the only one I use)</p>

<pre><code>z=          // Show corrections for a word
</code></pre>

<h1>Toggle switches</h1>

<p>Switches for paste-mode, cursorline, numbering  disable search highlighting.</p>

<pre><code>set pastetoggle=&lt;F7&gt;

" search hilight
map     &lt;F8&gt;   :nohlsearch&lt;CR&gt;
imap    &lt;F8&gt;   &lt;ESC&gt;:nohlsearch&lt;CR&gt;a
vmap    &lt;F8&gt;   &lt;ESC&gt;:nohlsearch&lt;CR&gt;gv

" numbering
map     &lt;F10&gt;   :set nu!&lt;CR&gt;
imap    &lt;F10&gt;   &lt;ESC&gt;:set nu!&lt;CR&gt;i
vmap    &lt;F10&gt;   &lt;ESC&gt;:set nu!&lt;CR&gt;gv

" toggle cursorline
map     &lt;F9&gt;   :set cursorline!&lt;CR&gt;
imap    &lt;F9&gt;   &lt;ESC&gt;:set cursorline!&lt;CR&gt;
</code></pre>

<h1>Omni completion (Go specific)</h1>

<p>See <a href="https://github.com/nsf/gocode">https://github.com/nsf/gocode</a>. After
you've installed that, you can use <code>control-X control-O</code> to bring up
the omni completion window. With the VIM files in <code>go/misc/vim</code> you also
have the following commands:</p>

<pre><code>    :Fmt                // Gofmt your code
    :Import strings     // add package 'strings' to the import list
    :Drop strings       // drop package 'strings' from the import list
</code></pre>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/07/25/openssh_and_kerberos/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/07/25/openssh_and_kerberos/index.html</guid>
<title>OpenSSH and Kerberos</title>
<dc:date>2011-07-25T22:19:58+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> linux</dc:subject>
<description><![CDATA[<p>[Personal note to self:]</p>

<p>I'm assuming LDAP en Kerberos completely setup and configured and working. You
get your TGT after a <code>kinit</code>, etc.
And then you want to utilize Kerberos to password-less login using ssh.</p>

<p>I have a client machine <code>foton.atoom.net</code>, from this machine you want to login
to the server.
The server is <code>elektron.atoom.net</code>.</p>

<p>On the client the command, <code>hostname -f</code> should return the fqdn of your host, in
my case:</p>

<pre><code>$ hostname -f
foton.atoom.net
</code></pre>

<p>We're are using the fqdn in the Kerberos configuration, so they should match.
On the server, it should also return the fqdn:</p>

<pre><code>$ hostname -f
elektron.atoom.net
</code></pre>

<h2>Configuring Kerberos and OpenSSH</h2>

<p>On <code>foton.atoom.net</code> aka the client, add a host principle and export the key:</p>

<pre><code># kadmin
kadmin: addprinc -randkey host/foton.atoom.net
kadmin: ktadd -k /tmp/foton.keytab host/foton.atoom.net
kadmin: exit
#
</code></pre>

<p>Now you should have the file <code>/tmp/foton.keytab</code>. This must be imported the 
server's keytab file. In essence this file contains the password (set wth -randkey)
for the host foton.atoom.net.</p>

<p>Next copy the file to the server:</p>

<pre><code># scp /tmp/foton.keytab miekg@elektron.atoom.net:/tmp
</code></pre>

<p>On the server <code>elektron.atoom.net</code>, you need to import the key file and then
destroy it. A keytab file should be handled as a plain text password.
Merging the keytab from <code>foton.atoom.net</code> with the existing keytab is 
done as follows, (maybe this can be done more efficient):</p>

<pre><code># ktulil
&gt; ktutil: read_kt /etc/krb5.keytab
&gt; ktutil: read_kt /tmp/foton.keytab
&gt; ktutil: write_kt /etc/krb5.keytab1
&gt; ktutil: quit
# mv /etc/krb5.keytab1 /etc/krb5.keytab
# rm /tmp/foton.keytab
</code></pre>

<p>In <code>/etc/ssh/sshd_config</code> you need the settings:</p>

<pre><code># Kerberos options
KerberosAuthentication yes
KerberosOrLocalPasswd yes
KerberosTicketCleanup yes

# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
</code></pre>

<p>In Ubuntu installing <code>openssh-server</code> and Kerberos should be enough to have the basics.</p>

<p>And that ... should be it. I'm testing this setup on another client to see
if it really works and I have covered everything.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/04/17/gnome_3_2_wishlist/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/04/17/gnome_3_2_wishlist/index.html</guid>
<title>GNOME 3.2 Wishlist</title>
<dc:date>2011-04-17T10:24:41+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> linux</dc:subject>
<description><![CDATA[<ul>
<li>Zeitgeist integration;</li>
<li>Focus follows mouse working. As in 'alt-tab' obeys this too. See 
<a href="https://bugzilla.gnome.org/show_bug.cgi?id=597190">bug 597190</a>;</li>
<li>Easier workspace switching;</li>
<li>Themes;</li>
<li><em>Much</em> smaller window titlebars;</li>
<li>An easier way to find your windows, maybe a windowlist in the panel.</li>
</ul>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2011/04/09/stay_out_of_my_windows/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2011/04/09/stay_out_of_my_windows/index.html</guid>
<title>Stay out of my windows</title>
<dc:date>2011-04-09T12:22:55+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> linux</dc:subject>
<description><![CDATA[<p>It's called a resize grip, you can't disable it (seems to be a common theme
nowadays...) and it sucks.</p>

<blockquote>
  <p>Stay the FUCK out of my windows with this crap!</p>
</blockquote>

<p><img src="http://www.miek.nl/downloads/2011/resize-grip.jpg"/></p>]]></description>

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

