Skip navigation.

My pasteblog

This is not my Zettelkasten but a durable .bash_history

Posts tagged with "cli"

bash sort integer

,

Seems I am getting disconnected from the world of the cl.

ls | sort -g

*sigh* busadm == Windows-World... :frown:

bash Variable inkrementieren increment

,

EIN -- FUER -- ALLE -- MAL!
i=$(($i+1))

mathmagicians

,

Bought a book explaining mental arithmetic and wrote a quick bash script to pose subtraction-questions:
while (true); do clear; pause=6;divisibleBy=1; max=999; min=11; rnumber1=$(((RANDOM%(max-min+divisibleBy))/divisibleBy*divisibleBy+min)); echo $rnumber1; max=$[${rnumber1}-1]; rnumber2=$(((RANDOM%(max-min+divisibleBy))/divisibleBy*divisibleBy+min)); echo $rnumber2; echo $rnumber1 "minus" $rnumber2 | festival --tts; sleep $pause; result=$[$rnumber1-$rnumber2]; echo "-------"; echo $result; echo "======="; echo $result | festival --tts; echo ""; done


Random code taken from http://tldp.org/LDP/abs/html/randomvar.html

Mastering The Linux Shell - Bash Shortcuts Explained

,

snapshot metadata YouTube 1981aLaN

, , ,

I have used http://code.google.com/intl/de-DE/apis/youtube/1.0/developers_guide_php.html to download the metadata of the great track&field video "channel" by http://www.youtube.com/1981aLaN and stored Title, ID, URL, description and duration in a csv file.

I will now use this data to download all videos with http://www.arrakis.es/~rggi3/youtube-dl/

Read more...

bash spaces filename

,

bash $IFS ls -1
find $dir -name '*.foo' | while read f;do echo $f;done

egrep

, , , ...

egrep "image.*s.*(Los|sport)" /var/log/apache2/access_log | awk '{print $1}' | sort -n | uniq -c | sort -rn

a video in a pic

, ,

mplayer -nosound -vo jpeg my_video_file.avi
montage *jpg join.jpg
montage.exe -tile 10x10 -geometry 160x84+2+2 -label '%f' 0000* join.jpg


mplayer -ss 1:00:23 -nosound -vo jpeg:outdir=foobar my_video_file.avi

resizing images

, , ,

I know that I know nothing.

And I especially know that I always forget `imagemagick`s command line options :( So here is a tagged remedy:

for f in `ls *JPG`; do echo $f; convert -resize 800x800 $f $f; done


And to rename based on exif tags:
for f in `ls *.JPG`; do echo $f; create_date=""; create_date=`exiftime "$f" 2>&1 | grep -i image\ created | cut -d" " -f3 | sed -e 's/:/-/g'`;if [ "$create_date" != "" ];then echo $create_date;fi;done

shell script via Apache/PHP

, , , ...

NOPASSWD: /bin/sh, /path/to/script.sh
script.sh chmod 6755

session file pictures to gallery-directory

,

Extract links from session file:
sed.exe -n 's/^..\(http.*jpg\)/\1/p' < tamper.win | grep -v google |sort | uniq > tamper.url

process tamper.url (in parent dir)
for f in `cat ../tamper.url`;do echo $f; f2=`../urlencode.php $f`;f3="coffee_tamper_`date --iso-8601`_${f2}";curl $f -o $f2; convert -resize '360x360>' $f2 $f3;cp $f3 /path/to/htdocs/images/ ;done

urlencode.php
cpr@1300:~$ cat urlencode.php
#!/usr/bin/php
<?php
echo urlencode($argv[1]);
?>
November 2009
S M T W T F S
October 2009December 2009
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30