Shell
Installing cronjobs out of scripts
Weather in...
Recording terminal-sessions
Perf - More than just counters
Perf is a profiler tool for Linux 2.6+ based systems that abstracts away CPU hardware differences in Linux performance measurements and presents a simple commandline interface. Perf is based on the perf_events interface exported by recent versions of the Linux kernel. This article demonstrates the perf tool through example runs.
Replace text in files
It's pretty comfortable to search and replace text in files using perl and regular expressions. Using one single command we can search, replace and create backups of all the files at once.
Let's create a file first:
echo "perl is Kewl" >> regtext.txt;
Now let's do the trick:
perl -p -i.bak -e 's/k|Kewl/cool/g' regtext.txt
This command will search for Kewl in regtext.txt and will replace it with cool and it will create a backupfile called regtext.txt.bak.
Oneliner: Permutation using ruby
➜ ~ ruby -e 'puts %w[t o m].permutation.map &:join'
tom
tmo
otm
omt
mto
mot
Monitoring memcached
memcachetop is a nice perl-script for displaying live stats from memcached. The author kept portability in mind, so it has not much dependencies and might run on many systems.
Using the mouse-wheel to scroll in GNU screen
For scrolling with the mouse-wheel in GNU screen, the following line is needed in ~/.screenrc:
termcapinfo xterm*|rxvt*|kterm*|Eterm* ti@:te@