Freitag, 14. Dezember 2012

Poor man's ASCII table

If you don't have your ASCII table at hand:

 (0..16).each do |i|
   vals = (i*8 .. i*8 + 7)
   puts (i*8).to_s + " " + vals.map {|i| i.chr}.join(" ") + "\n"
 end

Montag, 3. Dezember 2012

List comprehensions in Haskell

List comprehensions in Haskell sind schon verdammt praktisch:

[(i,j,k) |i <- [1..10], j <- [1..10], k <- [1..10], i*i + j*j = k*k]
 liefert alle Tripel a,b,c, für die

  a² + b² = c²

gilt

Montag, 23. Juli 2012

Binding apps to spaces in Mac OS X

Ever wanted to pin a certain app to a fixed screen in Spaces? Easily done:
  • switch to the space you want to use (must have been created by you - automatically created ones apparently won't work)
  • right-click the icon for your app in the Dock
  • select "Assign to" -> "This desktop"

Dienstag, 10. Januar 2012

NTFS and Mac OS X woes

Every once in a while, when trying to mount a NTFS drive on Mac OS X with NTFS-3G + MacFuse, I get an error stating "NTFS-3G could not mount - unclean shutdown".

Contrary to the message box that pops up, mount -o force .. doesn't help; what helps is:

sudo mkdir /Volumes/NTFS

sudo /usr/local/bin/ntfs-3g -o force /dev/rdisk2s1 /Volumes/NTFS/

This will create a directory /Volumes/NTFS and mount the NTFS drive there (assuming /dev/rdisk2s1 is the correct device, of course).