Navigation

Linux bash tricks and tips

Read all txt files, convert from UCS-2 to UTF-8 and print lines with text:

for f in *.txt; do cat $f | iconv -f UCS-2 -t UTF-8 | grep "Text"; done

Convert picture to 1x1px (average color/color summary) | except blank/empty lines and comments:

convert storm/000020196.png -resize 1x1  txt:- | grep -v '^$\|^\s*\#'

Send voice track to google for convert to text (i think that it doesnt work):

wget --post-file='sr140227.wav' --user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7' --header='Content-Type: audio/x-flac; rate=16000;' -O 'recognized.json' 'https://www.google.com/speech-api/v1/recognize?client=chromium&lang=ar-Q...

curl -X POST --data-binary @sr140227.wav --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7' --header 'Content-Type: audio/x-flac; rate=16000;' 'https://www.google.com/speech-api/v1/recognize?client=chromium&lang=ar-Q...

Infinite loop - kill all process --Older-than 20sec named "winexe" than wait 1s

while [ 1 ]; do killall -9 -o 20s winexe; sleep 1; done

Print all process

ps aux
ps -eo uid,pid,etime,command | grep winexe

continue...