Home
Benjamin's Blog
Cancel

Re-using the last bash command argument

Tired of re-typing the same argument twice for different commands? For bash there is an easy solution: mkdir testdir cd !$ The '!$' maps to the last argument of the previous command, a real time...

Extracting mp4 files from AVCHD without transcoding

My new Sony digital camera stores movies inside an AVCHD container. Luckily this format is supported on OSX natively and you can at least browse all clips inside with ease. However, if you want to ...

Simple UDP relay with NAT latching in Python

When you're building a VOIP server you soon encounter the problem that a client is behind a NAT (instead of a directly reachable public IP). In this scenario the server can't send packets directly ...

Magnet handler script for Firefox on OSX

One thing I was missing when downloading torrents with 'magnet:' links was an easy way to transfer this link to my bittorent client (which is running on a different server). After copy-pasting many...

A better solution to C++ enums

One of the more popular posts on this blog is about textual enums in C++. You can find it here I've received a very friendly e-mail this weekend from Anton Bachin, the author of the better enums l...

Logging port access with iptables and logwatch

I've recently installed a program (let's call it Foo) on my home server that requires one port (let's call that 12345) to be forwarded from the public interface on my ADSL modem to my internal serv...

Easy chroot jail creation

While setting up an SSH jump host I had the need for a small chroot environment that users would end up in. The 'regular' way is to create a jail directory somewhere, set up basic directories (/bin...

Running autossh with OSX automator

On my work OSX laptop I have a need to have some ports forwarded to my NAS at home, until now I've been manually running the ssh command (using a script) but this becomes very annoying when connect...

Fixing bash tab completion in XFCE

On my headless Linux NAS I'm running a VNC server to run the occasional X11 program remotely. Because I don't need a full desktop environment, I used XFCE. However, when using a terminal session I ...

Removing partial duplicate file names with awk

I needed to clean up a bunch of files recently that contained both a common and unique part, something like this: Show_Episode1-ID_12345.mp4 Show_Episode1-ID_67890.mp4 Note that there are two co...