Check These Out
Using netcat, usuallly installed on debian/ubuntu.
Also to test against a sample server the following two commands may help
echo got milk? | netcat -l -p 25
python -c "import SocketServer; SocketServer.BaseRequestHandler.handle = lambda self: self.request.send('got milk?\n'); SocketServer.TCPServer(('0.0.0.0', 25), SocketServer.BaseRequestHandler).serve_forever()"
Uses the extremely cool utilities netcat and expect.
"expect" logs in & monitors for server PING checks.
When a PING is received it sends the PONG needed to stay connected.
IRC commands to try: HELP, TIME, MOTD, JOIN and PRIVMSG
The "/" in front of IRC commands are not needed, e.g. type JOIN #mygroup
Learn about expect: http://tldp.org/LDP/LGNET/issue48/fisher.html
The sample output shows snippets from an actual IRC session.
Please click UP button if you like it!
This will make your bash scripts better!!
process-getopt is a wrapper around getopt(1) for bash that lets you define command line options (eg -h, --help) and descriptions through a single function call. These definitions are then used in runtime processing of command line options as well as in generating help and man pages. It also saves a little time in coding and in producing nicely formatted documentation. It is quite similar to GNU's argp in glibc for compiled languages and OptionParse for python.
See: Linux Gazette article 162: http://tldp.org/LDP/LGNET/162/hepple.html,
http://sourceforge.net/projects/process-getopt, http://bhepple.freeshell.org/oddmuse/wiki.cgi/process-getopt
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"
}
For each cpu set mask and then monitor your cpu infos. Temp,load avg. etc.
For example for 2nd cpu or 2nd core
taskset 0x00000002 yes > /dev/null &
For example for 3rd cpu or 3rd core
taskset 0x00000004 yes > /dev/null &
For example for 4th cpu or 4th core
taskset 0x00000008 yes > /dev/null &
Monitor your cpu temp with this command if you want
watch -n1 "acpi -t"
Load avg. from top command
top
kerim@bayner.com
http://www.bayner.com/
find . -type f -iname '*.flac' # searches from the current folder recursively for .flac audio files
| # the output (a .flac audio files with relative path from ./ ) is piped to
while read FILE; do FILENAME="${FILE%.*}"; flac -cd "$FILE" | lame -b 192 - "${FILENAME}.mp3"; done
# for each line on the list:
# FILE gets the file with .flac extension and relative path
# FILENAME gets FILE without the .flac extension
# run flac for that FILE with output piped to lame conversion to mp3 using 192Kb bitrate