Twitter (not set)
Blog (not set)
Website (not set)

0 score

Alert me by email when a disconnected or unreachable server comes back online

 $ while ! ping -c1 the_host_down; do sleep 1; done && date | mail -s 'the host is back!' me@example.com

Oct. 10, 2011, 8:26 p.m.janos

0 score

Add timestamp to the output of ping

 $ ping some_host | while read LINE; do echo $(date): $LINE; done

Oct. 10, 2011, 8:13 p.m.janos

0 score

Test a one-liner with echo commands first, pipe to bash when ready

 $ paste <(ls) <(ls | tr A-Z a-z) | while read OLD NEW; do echo mv -v $OLD $NEW; done | sh

Oct. 8, 2011, 1 p.m.janos

0 score

Find the most recently modified files in a directory and all subdirectories

 $ find /path/to/dir -type f | perl -ne 'chomp(@files = <>); my $p = 9; foreach my $f (sort { (stat($a))[$p] <=> (stat($b))[$p] } @files) { print scalar localtime((stat($f))[$p]), "\t", $f, "\n" }' | tail

Oct. 4, 2011, 10:25 p.m.janos

0 score

Delete unversioned files in a Subversion checkout directory and all subdirectories

 $ svn st | grep ^? | sed -e 's/^? *//' | xargs -i{} echo rm -fr "{}"

Oct. 3, 2011, 8:22 p.m.janos