Check These Out
$python -c "DEV = '/dev/input/event4'
#if event0 doesn't work, try event1 event2 etc
fo = open(DEV)
def interpret(keycode,state):
if state == 0:
print '%i up'%keycode
if state == 1:
print '%i down'%keycode
if state == 2:
print '%i repeat'%keycode
while 1:
line = fo.read(16)
if ord(line[10]) != 0:
keycode,state = line[10],line[12]
interpret(ord(keycode),ord(state))
"
Useful for CSV files. In the command, the file in question is comma delimited but contains double quoted fields containing commas and contains no @ symbols (as confirmed with http://www.commandlinefu.com/commands/view/9998/delimiter-hunting). This command converts the delimiting commas to @s while preserving the commas in the fields using the "uniqueString" to mark the ends of lines.
You can display, save and restore the value of $IFS using conventional Bash commands, but these functions, which you can add to your ~/.bashrc file make it really easy.
To display $IFS use the function ifs shown above. In the sample output, you can see that it displays the characters and their hexadecimal equivalent.
This function saves it in a variable called $saveIFS:
$ sifs () { saveIFS=$IFS; }
Use this function to restore it
$ rifs () { IFS=$saveIFS; }
Add this line in your ~/.bashrc file to save a readonly copy of $IFS:
$ declare -r roIFS=$IFS
Use this function to restore that one to $IFS
$ rrifs () { IFS=$roIFS; }
Replace 60 with the number of minutes until you want the machine to shut down.
Alternatively give an absolute time in the format hh:mm (shutdown -h 9:30)
Or shutdown right away (shutdown -h now)
Uses the shell builtin `declare` with the '-f' flag to output only functions to grep out only the function names.
You can use it as an alias or function like so:
alias shfunctions="builtin declare -f | command grep --color=never -E '^[a-zA-Z_]+\ \(\)'"
shfunctions () { builtin declare -f | command grep --color=never -E '^[a-zA-Z_]+\ \(\)'; }
Find when debian packages were installed on a system.
Create a progress dialog with custom title and text using zenity.
check your load with top... Start more of these jobs to get an multi-core cpu busy...