Monday, March 17, 2014

Swap caps lock and escape on Mac

I'm a vim user, so I want a handy escape key, but I'm also enthusiastic, so sometimes I want caps lock.

I have a Macbook Air with 10.8.5. I got PCKeyboardHack and selected 'Change Caps Lock' to code 53 and 'Change Escape' to 57.

I had to keep the Modifier Keys options under System Preferences | Keyboard the same.

Monday, March 10, 2014

Mac does weird things with tar files

I ran across this problem while trying to edit an R package's source code. I downloaded the source .tar.gz, extracted it, made a modification, compressed it again, and tried to feed that into R. R complained with a bunch of weird errors:

._bipoilog_s_cint.c:1:1: warning: null character(s) ignored [enabled by default]
._bipoilog_s_cint.c:1:2: error: stray '\5' in program
._bipoilog_s_cint.c:1:2: error: stray '\26' in program
._bipoilog_s_cint.c:1:2: error: stray '\7' in program
._bipoilog_s_cint.c:1:5: warning: null character(s) ignored [enabled by default]
._bipoilog_s_cint.c:1:2: error: stray '\2' in program
._bipoilog_s_cint.c:1:7: warning: null character(s) ignored [enabled by default]
._bipoilog_s_cint.c:1:9: error: unknown type name 'Mac'
._bipoilog_s_cint.c:1:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'X'

Macs have special interpretations for ._* files that appear in tar archives. I got around this by using:

COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar xf poilog_0.4.tar.gz

And then after editing,

COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cf poilog_0.4.tar.gz poilog

Thanks go to Chris Johnsen in this thread.