Dynamic Syntax Highlighting in Vim

I’m a huge fan of syntax highlighting in my editor Vim. One thing I started to miss was that user defined type miss out on the highlighting, because Vim does not know about them. Wouldn’t it be cool to have some sort of automatic support that detect your types and adds them to the correct highlighting group? I call this “dynamic syntax highlighting”. As a proof-of-concept I took the tagbar plugin, and modified it a little to take advantage of the language detection (specifically the types).
Read more →

Updated DNS syntax file for VIM

When editing zone files with vim I always get annoyed by the fact that the syntax highlighting did not understand newer types ’n stuff. I never did anything about until now. Download this vim syntax file and drop it in ~/.vim/syntax. It adds newer (DNSSEC) types and base64 highlighting. Base64 only works when there are no embedded spaces (patch welcome to fix that btw!)
Read more →

Munin port traffic plugin

I wanted to look at the increase in ntp traffic now that I’ve joined the pool.ntp.org ranks. Unfortunately munin didn’t have a watch-port-x-and-draw-something-plugin. So I wrote my own based upon the ip_ plugin. The plugin monitors both v6, v4, tcp and udp and plots them together, as send and received. Just symlink the port number to the plugin: ip_port_123 -> ip_port_ For it to work, you do need some iptables rules, so yes, this plugin only works in Linux.
Read more →

ath9k under Linux

For some reason I was experiencing wifi disconnects with the ath9k wifi driver under Linux (Ubuntu 12.04). After reading numerous blogs and bug reports (disable ipv6, use hwcrypto=0, etc.), I suspected it was the power management that was somehow disabling the driver, in turn leading to a disconnect. This will probably be fixed in newer kernels (Ubuntu 12.04 ships 3.2.x). For now I took a shortcut and disabled the power management on the wlan0 interface.
Read more →

Convert vim colors to gvim colors

I’ve tweaked my vim color scheme quite a bit and tried to keep the colors of gvim (which I use less often) in sync. This keeping in sync hasn’t worked out, so I wrote this little script to convert the vim colors to the gvim ones: Download the makegvim script, and use it like: $ ./makegvim < ~/.vim/colors/<yourfile> > /tmp/x $ mv /tmp/x ~/.vim/colors/<yourfile> And now the colors of gvim should be identical to those of vim.
Read more →

Cherry-picking remote branches

I’ve create a little tool (actually an XSLT file) that helps to write RFCs. Browsing my github repo I found two different forks. And browsing those forks, I saw some commits I wanted to have. But how do you merge a commit from a forked git repository? Turns out it is not that difficult. The commit I want has the hash 5a11e88ddbef4ce7513aae93bdcd377449f45efb. The steps: Create a remote branch: git remote add hamnis https://github.
Read more →

color me, color you

In the xoria256m post, I introduced my xoria256 like color scheme. Again, inspired by solarized, I extended this to other applications. So now I use this in the following apps: vim (see that previous post); mutt (idem); zsh; dircolors; git (a bit). zsh See this file to setup the colors. Then in my prompt I have stuff like: PS1=$'${vcs_info_msg_0_}$FG[067]%(1j.$myjobs% $FX[reset].$FX[reset])$FG[179]%#$FX[reset] ' RPS1="$RPSL%$MAXMID<...<$mypath$RPSR$FG[239]$FX[bold]$__ZH$FX[reset]${vcs_info_msg_1_}" RPSR=$'$FX[reset]$FG[009]%(0?.$FG[reset]. $E)$FX[reset]' For zsh I have two files that make up my prompt:
Read more →

Xoria256m color scheme

I recently came across solarized. 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. 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: vim-scripts. Unlike solarized it doesn’t come with a custom palette, just use Tango in gnome-terminal (or whatever your favorite is).
Read more →

Opposite of J

In VIM you can use the command J to join to lines: hello -> J -> hello goodday goodday Where the cursor is positioned somewhere on the ‘hello’ line. 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. hello goodday -> K -> goodday hello The following mapping does that: map K kddpkJ In words:
Read more →

OpenSSH and Kerberos

[Personal note to self:] I’m assuming LDAP en Kerberos completely setup and configured and working. You get your TGT after a kinit, etc. And then you want to utilize Kerberos to password-less login using ssh. I have a client machine foton.atoom.net, from this machine you want to login to the server. The server is elektron.atoom.net. On the client the command, hostname -f should return the fqdn of your host, in my case:
Read more →

GNOME 3.2 Wishlist

Zeitgeist integration; Focus follows mouse working. As in ‘alt-tab’ obeys this too. See bug 597190; Easier workspace switching; Themes; Much smaller window titlebars; An easier way to find your windows, maybe a windowlist in the panel.
Read more →

Stay out of my windows

It’s called a resize grip, you can’t disable it (seems to be a common theme nowadays…) and it sucks. Stay the FUCK out of my windows with this crap!
Read more →

OpenSSH 5.7 for Ubuntu 10.10

I need hardlink support in sftp and the newest ssh version provides this. But there are no packages for Ubuntu 10.10. Therefor I backported OpenSSH from Ubuntu 11.04 to 10.10. Here you can find these packages: 64 bit openssh-client_5.7p1-1ubuntu1_amd64.deb openssh-server_5.7p1-1ubuntu1_amd64.deb ssh-askpass-gnome_5.7p1-1ubuntu1_amd64.deb sshfs_2.2-1build1_amd64.deb 32 bit openssh-client_5.7p1-1ubuntu1_i386.deb openssh-server_5.7p1-1ubuntu1_i386.deb ssh-askpass-gnome_5.7p1-1ubuntu1_i386.deb sshfs_2.2-1build1_i386.deb all ssh_5.7p1-1ubuntu1_all.deb ssh-krb5_5.7p1-1ubuntu1_all.deb The minimum upgrade consists of installing openssh-client and openssh-server.
Read more →

Hardlink support in sshfs

OpenSSH 5.7 adds hardlink support to the sftp protocol: sftp(1)/sftp-server(8): add a protocol extension to support a hard link operation. It is available through the “ln” command in the client. The old “ln” behaviour of creating a symlink is available using its “-s” option or through the preexisting “symlink” command This is awesome as I can use that to make rdup work (better) with sshfs. I’ve created a patch to add hardlink support to sshfs.
Read more →

Bash Hate, Zsh Love

…Or why shell scripting is not really programming. Two scripts, one called bash-hate: #!/bin/bash count=0 cat /dev/null - | while read line; do ((count++)) done echo $count and the other one zsh-love: #!/bin/zsh count=0 cat /dev/null - | while read line; do ((count++)) done echo $count Then: % cat testfile | ./bash-hate 0 % cat testfile | ./zsh-love 9 (Yes, I know about subshells. Just learn a real programming language.)
Read more →

Git, $Id$ and file names

It is already possible to use filters in Git. But embedding the current file name in the expanded string is somewhat harder. You can do this by some edit wrapper which inserts the file name “at the right time”, but I think it is much more cleaner to do this in the git-filter script. For Puppet I want system administrators to see from which directory in the Git repository the file came from, like so:
Read more →

First post running Ubuntu 10.10

Well, the upgrade was easy enough, some weird LDAP database corruption that was fixed easily by running db4.7_recover in /var/lib/ldap. There is something fishy going on in /etc/nsswitch and using ‘files’ instead of compat. Got lots of segfaults: [90474.491264] zsh[5668]: segfault at bfcf07ef ip 001be398 sp bfce4efc error 6 in libnss_files-2.12.1.so[1bc000+a000] Not enough for a bug report (yet), I still need to examine this further.
Read more →

Fuzzy fonts in Chromium Browser Under Linux

I did a small upgrade to the newest version of Chromium and all of the sudden the fonts in the browser area were all blurry and fuzzy… After some searching it turned out that WebKit (which Chromium uses for the rendering) uses the settings from font-config instead of the whatever you click inside your DE’s configuration tools. % fc-match -v Arial | egrep 'family|hint' family: "Arial"(s) familylang: "en"(s) hintstyle: 1(i)(w) <- '1' means slight hinting hinting: FcTrue(w) autohint: FcFalse(s) And to remedy the situation:
Read more →

Hibernate and suspend with Ubuntu 9.10

I have an Asus EeePC on which I’ve installed Ubuntu 9.10. But now I wanted a working hibernate (suspend to disk) and suspend (suspend to memory). Hibernate was working out of the box (well the going to sleep part, at least), but resuming took almost as long as a cold boot. Another thing was that my wireless was broken after a resume. On my happiness scale (range: 0-10) this scored a 3.
Read more →

Ubuntu Lucid Alpha-3

I want to upgrade my server to the new Ubuntu and switch to 64 bit on my main server. This is how I managed to get Ubuntu Lucid (Alpha 3) running on my (test) machine, with RAID1 + BTRFS and 64 bit. It is a running story on how I spend my Saturday afternoon, you might need some decent Linux knowledge to follow my lead. Here we go. The following lists sums up my needs and troubles:
Read more →

upstart and booting with init=/bin/bash

One of the oldest tricks in the sys admin’s arsenal is booting with init=/bin/bash. You’ll need this when you want to reset the password for root for instance. It used to go like this: Boot with init=/bin/bash and after some time you greeted with a prompt ala root@(none):/# Most often I then took the following steps: mount -o rw,remount / /etc/init.d/networking start Now you also have networking, so you may upgrade the system with apt-get or whatever… You are now a happy puppy.
Read more →

My f() function in Zsh (and maybe Bash)

Familiar with the following? You are aware of (shell)file which contains a interesting line and you think: “I want to execute this line on the command prompt”. Most people will do the following: % more <file> [select interesting bit with your mouse] [paste]<enter> And the code gets executed. I propose the following function: f(), which does the following: It opens the file in $EDITOR (:= vim of course); You delete everything you don’t want to execute; What’s left gets executed; And it is added to your shell’s history.
Read more →

Inotify

This is a translation from this article which is published in Dutch During our work at Octrooicentrum Nederland somebody came up with the following question. During the night a file was created in a directory and he wanted to know who (which process) was responsible for that. My first reaction was: “Can’t be done”. However, that evening I thought of inotify which could be of help. With inotify you can watch your file system and get notified when “something” (read, write, create, etc.
Read more →

New layout

After running with the old style for a couple of years I wanted something new. And after a few days battling with Wordpress I decided to stay with nb, because it just rules. The theme is loosly based on the design from Wordpress called SimplicitlyDark and the css from daring fireball. But still a new (clean) style. During the restyling I also fixed the archives and found out that nb cannot handle articles with [[ in their name.
Read more →

Dymo 400 Label Writer in Ubuntu (Jaunty/Karmic)

Apparently the cups driver (ppd) for Ubuntu (in both Karmic and Jaunty) is not installed by default, see this and this for more information. The strange thing is that if you look at openprinting.org, it says Dymo LabelWriter 400 Supplied with CUPS Works perfectly. Supplied with cups??? Works perfectly?? How, where, when?? Well: % apt-get source cups % ls -l cups-1.3.9/ppd/dymo.ppd -rw-rw-r-- 1 miekg miekg 24K Nov 27 2007 cups-1.3.9/ppd/dymo.ppd And that’s your ppd file.
Read more →

Fedora 11 vs Ubuntu 9.10

My small and very personal comparison between Fedora 11 (which I run on my laptop) and Ubuntu 9.10 which is my main Linux distribution. yum vs apt-get yum is a lot slower than apt-get why do I need connectivity when using yum search Why does yum defaults to ‘N’ (no) when I ask it to install software? All in all I like apt-get a lot better. Default resolution Ubuntu 9.10 configured my EeeBox and monitor out of the box, Fedora 11 didn’t.
Read more →

KPN redux

I installed my new laptop with Fedora 11, and I must say that it is a very nice distribution. I’m even contemplating leaving PulseAudio enabled, ‘cause it just works. Unlike ubuntu. To update my story on the KPN dongle (dongel). I just used it on this laptop and it worked out of the box. The only thing you need to remember is that you need to insert the stick before booting you machine.
Read more →

Use upstart to replace rc.local

On my new netbook I wanted to get rid of gdm and just start X right away. I use auto-login anyway so it is a bit stupid to first start gdm and then immediately start X. So I removed gdm and edited /etc/rc.local to start X: su - miekg -c xinit xterm But this sort of does not work anymore in Ubuntu Karmic. Karmic now uses upstart as an init replacement.
Read more →

Goodbye charm, welcome up

I’ve bought a new 11.1" netbook from Asus, this is going to replace my aging 4G Surf (named charm). I’ve named the new one up, so I’m hoping the Large Hadron Collider is up and running soon and discovers a new flavor of quarks - ‘cause I’m running out of names. (strange is already allocated if I ever buy a Mac and run Linux on that, top and bottom just don’t sound right).
Read more →