Check These Out
This uses ssh to transfer the contents of one Mac's clipboard to another's. This only works with plain text, sadly. Trying to transfer images will just clear out the remote machine's clipboard, and rich text will be converted to plain text. Using the "Remote Login" must be enabled on the remote machine (via System Preferences' Sharing panel) for this to work.
Shows all block devices in a tree with descruptions of what they are.
Now put more interesting stuff on the script in replacement of hostname, even entire functions, etc, and stuff.
hosta> cat myScript.sh
#!/bin/sh
[ $1 == "client" ] && hostname || cat $0 | ssh $1 /bin/sh -s client
hosta> myScript.sh hostb
hostb
hosta>
capture 2000 packets and print the top 10 talkers
Rotates log files with "gz"-extension in a directory for 7 days and enumerates the number in file name.
i.e.: logfile.1.gz > logfile.2.gz
I needed this line due to the limitations on AIX Unix systems which do not ship with the rename command.
Add this to .vimrc to automatically give scripts with a shebang (e.g., #!/usr/bin/perl) executable permissions when saving.
Found @ http://stackoverflow.com/questions/817060/creating-executable-files-in-linux/817522#817522
CSR.csr MUST be exists before
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
Convert some SVG files into PNG using ImageMagick's convert command.
Run the conversions in parallel to save time.
This is safer than robinro's forkbomb approach :-)
xargs runs four processes at a time -P4
This is the setup I'm using for my largest project. It gives 357 lines per page (per side), which makes it fairly easy to carry around a significant amount of code on a few sheets of paper. Try it.
(I stick to the 80 column convention in my coding. For wider code, you'll have to adjust this.)