Resizing a Xen disk image partition
1 # Stop & backup 2 xm stop sandbox 3 cp -a sandbox/ sandbox.bk 4 5 # Verify MD5 sum 6 md5sum sandbox/disk.img 7 4976347006df34843d29c939b5fc3742 sandbox/disk.img 8 md5sum sandbox.bk/disk.img 9 4976347006df34843d29c939b5fc3742 sandbox.bk/disk.img 10 11 # Create a 5Gb temp file 12 dd if=/dev/zero of=Tempfile bs=1024 count=5000000 13 14 # Append it to the existing image 15 cat Tempfile >> disk.img 16 rm Tempfile 17 18 # Resize the partition 19 resize2fs -f disk.img 20 21 # Check partition & start domU 22 fsck.ext3 disk.img 23 xm create -c sandbox.cfg
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