Archive for the ‘Uncategorized’ Category

Flush DNS Cache in OSX

November 2nd, 2012 No comments

I can never figure out why Apple has to be different, and especially why the change (break) stuff that already works fine. Today’s example: flushing the DNS cache.

From terminal, these are the commands to flush the cache on several (relatively) recent versions of OSX:

lookupd -flushcache

Leopard / Snow Leopard
dscacheutil -flushcache

Lion / Mountain Lion
sudo killall -HUP mDNSResponder

Categories: Uncategorized Tags:

Mountain Lion Timemachine Problems

October 15th, 2012 No comments

From the Apple discussion groups, drm31078 says:

Received another reply from synology pointing to Lion as the problem…

Here is what I received from my engineers.

This problem seems to have happened since OSX 10.7.
We use the open source – netatalk to support AFP and
it summarized that this problem also exists on Apple Time Capsule too.
( )

For the Macs that doesn’t trigger “Start New Backup” YET,
users may use the following method to try and fix the verification flag and avoid wiping out all old backup history.,08,27,169,fix-time-machine-sparsebundle-nas-b ased-backup-errors.html

Hey Apple are you seeing this?!?!

Netatalk 3.1 installation on Debian 6.0

August 27th, 2012 2 comments

I use a Debian 6.0 box running Netatalk to backup my Mac using Timemachine. This all worked nicely until recently upgrading to Mountain Lion when, big surprise, Timemachine/Netatalk became unreliable. This seems to happen pretty much every time Apple bumps OSX – for reasons know only to them, all sorts of breaking changes are required to change from one feline to another, while providing minimal value to users.

Some research later, it became clear that Mountain Lion needs Netatalk 3.1 (post 12/8/22) to run reliably.

The instructions here worked well:

Note: do not forget the “./bootstrap”. Also, missing from the requirements are autotools (automake) and libtool.

Quoted from github:

Install prerequisites:

    $ sudo apt-get install build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev

Download src:

    $ cd /usr/local/src
    $ git clone git://
    $ cd netatalk
    $ ./bootstrap

Find current version of Berkeley DB available

    $ apt-cache search libdb

Mine was 5.1, so I'll install that

    $ sudo apt-get install libdb5.1-dev db-util db5.1-util

Same for libgcrypt:

    $ apt-cache search libgcrypt
    $ sudo apt-get install libgcrypt11 libgcrypt11-dev

Configure install

    $ ./configure --with-init-style=debian --with-zeroconf


    $ make
    $ sudo checkinstall

Config is in /usr/local/etc/afp.conf
Categories: Uncategorized Tags:

Welcome back!

June 12th, 2012 No comments

Due to a faulty backup, recent (2012) posts are missing but will be restored as soon as I have a moment.

Categories: Uncategorized Tags:

Subtitles on XBMC

October 29th, 2011 No comments

Since minidlna doesn’t serve external subtitle files properly, merge the .srt and .avi files into an mkv file as follows:

mkvmerge -v -o movie.mkv movie.avi --sub-charset 0:UTF8 -s 0 -D -A

A more general purpose script:

INPUT=$(basename $1 .avi)
SRT=$(ls | grep $
SUB=$(ls | grep $INPUT.sub)
SSA=$(ls | grep $INPUT.ssa)
if [ "$SRT" != "" ]; then
#    mkvmerge -v -o $INPUT.mkv $1 $
    mkvmerge -v -o $INPUT.mkv $1 --sub-charset 0:UTF8 -s 0 -D -A $
#    mkvmerge -v -o $INPUT.mkv $1 $ --sub-charset 0:UTF8 -s 0 -D -A $
elif [ "$SUB" != "" ]; then
    mkvmerge -v -o $INPUT.mkv $1 $INPUT.sub
elif [ "$SSA" != "" ]; then
    mkvmerge -v -o $INPUT.mkv $1 $INPUT.ssa
    mkvmerge -v -o $INPUT.mkv $1

Unfortunately, this still doesn’t help for PS3, which doesn’t yet understand mkv.

Categories: Uncategorized Tags:

OCaml .ocamlinit

June 2nd, 2011 No comments

??Here handy trick I didn’t know about launching OCaml:

$ cat >> .ocamlinit
#use "topfind";;
#require "sdl";;
#require "sdlvideo";;

open Sdl
open Sdlvideo;;
open Str;;

.ocamlinit is sourced from the current directory, falling back to /home/user/.ocamlinit. you can explicitly override it via ocaml -init <filename>


Categories: Uncategorized Tags:

Google’s 8 Habits for Effective Managers

March 13th, 2011 No comments

Google did a data mining exercise to uncover what makes a good Google manager. and the 8 habits are:
Be a good coach
Empower your team, don’t micromanage
Express interest in team members’ success and personal wellbeing
Don’t be a sissy: Be productive and results-oriented
Be a good communicator and listen to your team
Help your employees with career development
Have a clear vision and strategy for the team
Have key technical skills so you can help the team
3 pitfalls:
Have trouble making a transition to the team
Lack a consistent approach to performance management and career development
Spend too little time managing and communicating


December 31st, 2010 No comments

The SystemRescueCd has all sorts of useful tools to restore ailing Linux systems.
Check it out at:

Grub Recovery on CentOS 5 with RAID

December 30th, 2010 No comments

I recently replaced the RAID 1 drives in my CentOS 5 box and had to reinstall the grub MBR. As the drives are a couple of TB each, I thought I’d try GPT instead of the old MBR partitioning, since soon all drives will exceed MBR’s 2TB limit. Luckily GPT is baked into RH/CentOS kernels (unlike many others).
Restoring the MBR was trickier than I expected and I made a couple of mistakes along the way – wish I had found the following description sooner:

In a nutshell run grub interactively and do the following:

# grub
grub> root (hd0,0)        
root (hd0,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd0)"...  16 sectors are embedded.
 Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
grub> quit
# reboot

OCaml for Mac

December 1st, 2010 1 comment

As I install most Linux/BSD software on Mac via Macports, I figured I’d forgo GODI and try to install OCaml the Macports way.

Everything went mostly smoothly except for ocamlnet which is installed as a dependency of batteries. By default, to avoid installing GPL software, Macports doesn’t build nethttpd and related modules. To work around this, perform the install as usual:

sudo port install caml-batteries

but this won’t install the httpd files. To the ocamlnet Portfile I had to add:

configure.args-append   -with-nethttpd

after configure.pre_args. Also, for ocamlnet 2.2.9, I had to patch src/ as follows:

-module CDC = CamomileLibrary.CamomileDefaultConfig
+module CDC = CamomileLibraryDefault.Config
-include CamomileLibrary.Main.Make(CamConfig)
+include CamomileLibrary.Make(CamConfig)
then port uninstall batteries (and ocamlnet), then reinstall.
Categories: Uncategorized Tags: