Twitter Updates

Saturday, 1 November 2008

Saving Space/Backing up on OS X

I am currently running Mac OS X 10.5 Leopard, Which Snow Leopard is set to replace with a smaller more efficient code base. Until it is released I found a few folders that can be occasionally delted. This has all been triggered by me trying to figure out what I need to save/archive on my macbook so that I could restore it if it all went wrong.

All these commands/paths are from the terminal (dont type the $). it can be found in /Applications/Utilities/Terminal.app


$cd ~/Library/Caches
$du -h -s

du is a program to report disk usage. It reports my cache as 1.2GB.
This is just a Temporary storage for programs and should be safe to delete its contents
$rm -r ~/Library/Caches/*

I also use the online printers photobox, their uploading software seems to have left another massive cache else where.

$cd ~/Library/Application\ Support/Photobox
$du -h -s

du reports 386MB an exact copy of what I uploaded from from the same disk, what a rubbish program! Lets get rid of that as well
$rm -r ~/Library/Application\ Support/Photobox/*

NB: Just noticed this folder as well
$cd ~/Library/iTunes/iPod\ Software\ Updates/
$du -h -s


This reports an extra 1.1G of downloaded software updates. no need to back these up/keep them.
$rm -r ~/Library/iTunes/iPod\ Software\ Updates/

Summary: these folders are not needed and just take up space
$rm -r ~/Library/Caches/*
$rm -r ~/Library/Application\ Support/Photobox/*
$rm -r ~/Library/iTunes/iPod\ Software\ Updates/

For me they took a 2.5GB Library folder down to 152MB!

Wednesday, 29 October 2008

ruby flick-1.0.2 gem and rake docs

When running 'gem server' flickr-1.0.2 gem did not have any docs available (on OS X10.5 at least). So to add the flickr rdoc into the gem server :

find the location of your gems, you can use locate.
$locate flickr
/Library/Ruby/Gems/1.8/doc/flickr-1.0.2
/Library/Ruby/Gems/1.8/gems/flickr-1.0.2

$cd /Library/Ruby/Gems/1.8/gems/flickr-1.0.2
$rake rdoc
$mkdir
/Library/Ruby/Gems/1.8/doc/flickr-1.0.2/rdoc
$cp
/Library/Ruby/Gems/1.8/gems/flickr-1.0.2/doc/* /Library/Ruby/Gems/1.8/doc/flickr-1.0.2/rdoc

Now start the gem server and the rdoc link should be active.
$gem server

Tuesday, 28 October 2008

Display command output from bash script

To directly display the output from a command in a bash script (do not forget to set executable on the file $chmod u+x bashtest.sh) Where bashtest.sh is the name of the script file.

#!/bin/bash

#List home directory (note the back ticks)
echo `ls -l ~`

#Store command output as a variable
i=`ls -l ~`
echo $i

Sunday, 26 October 2008

Ruby Gems & gem_server

The default Leopard Ruby installation does not include the gem_server by default.
NB: it is now called gem server (no underscore)

I performed a gem update then the gem server worked.
$ gem update --system

$ gem server


gems are Ruby libraries that add functionality to the basic install.

NB:
Some gems require you to build the documentation. in this case cd to the gem location and call
$rake docs
or
$rake rdocs

you can view a gems doc directly by pasting the gem docs folder into your web browser.

Thursday, 23 October 2008

.bashrc history tips

Some usefiul lines in my .bashrc

#Reload Bashrc
alias reload='source ~/.bashrc'

#Save history correctly when using multiple terminals
# Dont save duplicate lines or blank lines in to history
export HISTCONTROL=ignoreboth
export HISTSIZE=1000
#Append changes to history instead of overwrite full file
alias exit='history -a && exit'

An alternative to the line above is
# make it append, rather than overwrite the history
shopt -s histappend
Advantages of the alias exit it will group the output of each terminal in the history file, rather than a all terminals adding there input on the fly.

Wednesday, 22 October 2008

Linux Flickr command line(broken)

Installing a linux flickr command line uploader
http://micampe.it/projects/flickruploadr

$ cd ~/Bin
$ wget http://micampe.it/files/FlickrUploadr-1.0.0.tar.gz
$ tar -xvz FlickrUploadr-1.0.0.tar.gz

could not find the pyhton xmltramp package under apt get so had to manually add it
http://pypi.python.org/pypi/xmltramp/

$ cd /usr/lib/python2.5/site-packages/
$ sudo wget http://www.aaronsw.com/2002/xmltramp/xmltramp.py

Now to configure the uploader
$ cd ~/Bin/FlickrUploadr-1.0.0
$ sudo python setup.py install

Now Run Uploader
$ Uploadr
and WHOO Segmentation fault just what I wanted. But I was calling it from a no Xwindow terminal.

Any way my flickr page munkymorgy.net

Monday, 20 October 2008

MS Visio Block Connection Points

In Visio it is easy to move and add extra connection points to an object.

Just select the 'Connection Point Tool' from the drop down menu next to the normal arrow tool.


You can then click and drag the pre-drawn connection points or CTRL-Left click add new connection points