Mounting a remote network drive with SSHFS on OSX
- Install SSHFS
http://code.google.com/p/macfuse/
- Read documentation
http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS
- Create symlink
1 ln -s /Applications/sshfs.app/Contents/Resources/sshfs-static /usr/local/bin/sshfs
- Mount drive
1 mkdir /Volumes/mount_name 2 sshfs -p 666 server:/ /Volumes/mount_name -oreconnect,ping_diskarb,volname=mount_name
- References
http://lifehacker.com/software/ssh/geek-to-live—mount-a-file-system-on-your-mac-over-ssh-246129.php
ImageMagick and OpenEXR
I could not get OpenEXR delegate to work in ImageMagick. There was no reason for it in config.log. It just silently refused to get configured. I debugged the configure script and found out that PKG _CONFIG was unset. So this fixed it. The—enable-hdri should be optional.
1 ./configure PKG_CONFIG=/usr/bin/pkg-config --prefix=/usr/local/stow/imagemagick --enable-hdri
Fixing how nginx sends request URI to the backend server.
I needed to send an URI through Nginx to the backend servers (Mongrel) intact. However Nginx was constantly unescaping the URI , and removed slashes in the process. That resulted in an invalid URL at the backend server. The fix was simple, but extremely hard to find. Just remove the trailing slash from the proxy_pass directive, like below.
Invalid URI is sent to the backend server with this configuration of Nginx.
1 proxy_pass http://backend1:3000/;
Valid, untampered URI is sent with this configuration of Nginx.
1 proxy_pass http://backend1:3000;
Installing ImageMagick from sources and using xstow to handle the installation.
I really hate installing software outside of the package manager, because that is not the way of a stable system. Xstow helps the agony those times that sourceball installations are necessary (e.g for new features). Here’s how to install imagemagick with xstow. If you haven’t installed xstow yet, then follow the relevant instructions in this snippet
1 sudo apt-get install libmagick9-dev # needed for sane image support 2 cd /tmp 3 wget ftp://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/ImageMagick-6.4.2-7.tar.bz2 4 tar xjvf ImageMagick-6.4.2-7.tar.bz2 5 sudo mv ImageMagick-6.4.2 /usr/src 6 cd /usr/src 7 sudo ln -s ImageMagick-6.4.2 imagemagick 8 cd imagemagick 9 ./configure --prefix=/usr/local/stow/imagemagick 10 make 11 sudo make install 12 cd /usr/local/stow 13 sudo xstow imagemagick
Using expect for automation of bulk scp copying.
Expect can come in handy when you can’t configure ssh public key authentication on the servers :) (and the system “architect” hasn’t yet realized the wonderfulness of a log host).
1 #!/bin/bash 2 # 3 # Usage: script <username> <password> <build> 4 # 5 # Example ./copy_logs_from_production.sh marko hubbabubba current 6 # 7 8 username=$1 9 password=$2 10 build=$3 11 mkdir $build 12 13 instance_1_server=10.0.0.1 14 instance_2_server=10.0.0.1 15 instance_3_server=10.0.0.2 16 instance_4_server=10.0.0.2 17 instance_5_server=10.0.0.3 18 instance_6_server=10.0.0.3 19 instance_7_server=10.0.0.4 20 instance_8_server=10.0.0.4 21 instance_9_server=10.0.0.5 22 23 servers=("$instance_1_server" "$instance_2_server" "$instance_3_server" "$instance_4_server" "$instance_5_server" "$instance_6_server" "$instance_7_server" "$instance_8_server" "$instance_9_server" ) 24 i=1 25 for server in ${servers[@]}; do 26 expect -c " 27 # exp_internal 1 # uncomment for debugging 28 spawn /usr/bin/scp $username@$server:/var/logs/application/$build/server${i}/error.log $build/error-${i}.log 29 expect { 30 "*password:*" { send $password\r\n; interact } 31 eof { exit } 32 } 33 exit 34 " 35 let "i=i+1" 36 done 37