Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

« Newer Snippets
Older Snippets »
Showing 11-20 of 24 total

rsync backup of a Mac

sudo /usr/local/bin/rsync -aREx --delete --exclude='.Spotlight-*' --exclude '/private/var/vm/*' [IP-address of Mac mini]::PowerBookBackup

Generate 20 random passwords

< /dev/urandom tr -cd '[:print:]' | fold -w 15 | head -n 20

Compiling on Ubuntu

sudo apt-get install build-essential

Testing from Class

Testing from class at Tue Jul 18 21:58:13 EDT 2006

Mark Selected Message as Read

tell application "Mail" to try
   tell message viewer 1 to set selected messages to {first message of beginning of (get selected mailboxes) whose read status is false}
   activate
on error
   beep
end try

Search and Replace in a file with sed

sed  -e 's/oldpat2/newpat2/g' file

Fix Terminal spacing bug

defaults write com.apple.Terminal FontWidthSpacing 1.003

Building tcpflow on OS X

curl -O http://www.circlemud.org/pub/jelson/tcpflow/tcpflow-0.21.tar.gz
tar -zxvf tcpflow-0.21.tar.gz
cd tcpflow-0.21
cp /usr/share/libtool/config.* . 
./configure --prefix=/usr/local
sudo make install

Events

I like being able to attach 'events' to buttons/links like this... don't think prototype can do this

$("a.codeButtonB").click(function(){$("pre.codeB").toggle()});

jQuery Example

$("#item li, #otheritem li").click(function(){
  $(this).css('color', '#c00');
});
« Newer Snippets
Older Snippets »
Showing 11-20 of 24 total