Just wanted to save this off finally. Not that having it here will help me if I am locked up but…
If you enabled Magic SysRq (CONFIG_MAGIC_SYSRQ=y, found in make menuconfig at Kernel hacking -> Magic SysRq key) in your kernel you can cleanly reboot if evil freezes your system with the following keyboard combination:
Alt-SysRq-R (keyboard in raw mode)
Alt-SysRq-S (save unsaved data to disk)
Alt-SysRq-E (send termination signal)
Alt-SysRq-I (send kill signal)
Alt-SysRq-U (remount all mounted file systems)
Alt-SysRq-B (reboots the system)
More info at WP including some nice mnemonic’s for helping to remember.
I work with long lists and WinSQL a lot. I always find myself wishing these long lists had commas at the end for pasting into a SQL where clause using “IN” for the list. This can be accomplished in one of two ways.
From the command line:
sed "s/$/,/g" <FILENAME>
I usually pipe the output there to a new file.
In vi (from command mode):
:%s/$/,/g
The “%” says to perfom the substitution on the whole file. In both cases we are doing a substitution of “$” (the end of the line) with a “,”.
Tags: automation, replace, sed, substitute, vi
There are multiple ways to skin this cat. For now one of the simplest.
#!/bin/sh
while read LINE
do
...DO SOME STUFF WITH THE ${LINE}...
done <somefile.txt
Replace “somefile.txt” with the file you want to process.
I find it useful to set the window title of my terminals for long running processes so I can see at a glace what is happening in the window or where in the process running in that window is at. In scripts I will use the following:
echo "\033]0;Window for ${USER}\007"
Of course replace “Window for ${USER}” with whatever is appropriate for your use.