Starting TextWrangler from command line

July 29, 2007

I used to open files in the Mac OS X Terminal via open -a TextWrangler FILE. Even easier is edit FILE. I am only wondering if the edit command also exists if no TextWrangler is installed?? Another nice command is twdiff FILE1 FILE2, which displays the differences between text files.

Setting the cygwin title for telnet/ssh

July 12, 2007

Per default cygwin sets the PS1 variable so that the window title always shows the current directory. However, if you use telnet/ssh to login to a different computer, the title isn’t changed. If you tend to have several windows open (like myself), you end up with a lot of cygwin windows with unmeaningful names.

This morning I finally decided to do something about it, and wrote quick wrapper scripts for telnet. The script should be fairly self-explanatory:


#!/bin/sh

#
# Wrapper script to set window title to the host contacted.
#

# Helper function to set title of window
function settitle() { echo -ne “\e]2;$@\a\e]1;$@\a”; }

#
# Default cygwin PS1 also sets the title, effectively overriding any custom settings.
# We therefore set PS1 to zero, and restore it afterwards.
#
PS1_BCKUP=$PS1
PS1=
# Make sure PS1 is restored even in case of interrupts
trap “PS1=$PS1_BCKUP” 0
trap “exit 2″ 1 2 3 15

settitle $1
/usr/bin/telnet $1

irq_vectors.h: No such file or directory

June 25, 2007

This error has driven me nuts while trying to compile a kernel module. The problem occured when I tried to compile a kernel module … After hours, I found the reason; the Makefile I was using set the CFLAGS variable explicitly:


$(MAKE) CFLAGS="$(TARGET_CFLAGS)"

However, this prevents the Makefile to further extend the CFLAGS variable. The solution was not to pass the CFLAGS variable on the command line, but set it in the environment instead:


CFLAGS:=$(TARGET_CFLAGS)
...
$(MAKE)

Emacs & German Umlaute

June 13, 2007

Make the default emacs of Mac OS X accept umlaute and display iso-8859-1 files correctly:

cat ~/.emacs
(set-terminal-coding-system ‘iso-latin-1)
;http://theotp1.physik.uni-ulm.de/~ste/comp/emacs/gnus/draft/G_E_C_Draft.html
(set-language-environment “Latin-1″)
;http://www.velofahren.de/emacs-umlaute-faq.html
(set-input-mode (car (current-input-mode))
(nth 1 (current-input-mode))

iTerm & German Umlaute

June 13, 2007

With default settings you cannot enter German umlaute in iTerm: If you type ‘รค’ it becomes ‘a’. This has bugged me for a while now, up to the point where I actually read the iTerm FAQ :-)

This works for me:

  • Create a ~/.inputrc:
    set meta-flag on
    set input-meta on
    set output-meta on
    set convert-meta off
  • Adapt your iTerm terminal profile settings:
    • Terminal type should be identical to the content of the $TERM variable (ansi is default and seems also to work with vi and emacs)
    • Terminal encoding should be Unicode (UTF-8)

Next step will be to make umlaute also work in Emacs and vi :-)

Writing a flash image with cygwin

June 2, 2007

You can write an image to a flash card using cygwin dd:

dd if=my.img of=/dev/sd? bs=1024 conv=sync

if= specifies the image to write, of= the output device (Windows device names are mapped to UNIX ones). bs=1024 conv=sync ensures that only complete blocks (normally 1024 bytes) are written. If the image size does not fit, zeros are appended. This helps if you receive mysterious “No space left on device” errors.

Alternatively use the Windows physdiskwrite.exe program.


Follow

Get every new post delivered to your Inbox.