Archive for November, 2006

Downloading from the web [advanced]

Please don’t just execute the following!!! Read them and try to understand them if you are interested.

URL=http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/
wget $URL -O - |grep -oE '[^"]+\.torrent' |
while read line;
do echo $URL$line;
done | xargs ktorrent

wget http://joyoftech.com/joyoftech/index.html -O - --quiet |
grep "http://joyoftech.com/joyoftech/$i -O todayscomic;
done;
kuickshow todayscomic 

seq --format http://www.rapcheck.de/home/module/hc_download_out.php?DLID=%g 1 5000 >urls1.txt
wget -i urls1.txt --referer=http://www.rapcheck.de/home/index.php
grep -i ' urls2.txt
wget -i ../urls2.txt --continue -nc 

File urls2.txt is attached: urls2.txt (txt, 228 KB).
Btw: UserFriendly doesn’t like suckers … they seem to have banned me ;-)

No Comments

I don’t like the ordering in find, but bashs!

[user@thiscomputer linux]$ find -name "dvorak" /var/ /usr/
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]
[user@thiscomputer linux]$ !:0 !:4 !:3 !:1 !:2
find /usr/ /var/ -name "dvorak"

No Comments

Folgen und Reihen

{ seq 3 40|while read i; do echo -n $((10000/2**$i)) "+"; done; echo 0; }|bc

No Comments

Get a nice pic for your desktop every day

Gets a daily picture from a site and sets the softlink “newest” to it.

Needs executable rights on the shellscript and a

The shell script next.sh:

DATE=$(date +%y%m%d)
SERVER=antwrp.gsfc.nasa.gov
URL=http://${SERVER}/apod/ap${DATE}.html
NEWIMG=${DATE}.img
[ -e $NEWIMG ] && exit;
rm -rf *.jpg *.png *.gif
wget --recursive --level=1 $URL --accept jpg,png,gif --no-clobber --no-directories --tries=0
FIRST=$( ls -U *_f.* *_big.* *.jpg *.png *.gif 2>/dev/null|head -n 1 );
if [[ "$FIRST" != "" ]]; then
cp $FIRST $NEWIMG
unlink newest
ln -s $NEWIMG newest
fi

If you want a cronjob for that, use e.g.:

0,30 * * * * cd bgimg/astro/data; sh ../next.sh

Don’t forget to set the background image of your window manager to the link … obviously

,

No Comments

Thats one crazy shell script

Its a download manager, more or less.

while sleep 600;
do
ps -A|grep wget|cut -d " " -f 1|sort -n|while read i; do kill -STOP $i; done;
ps -A|grep wget|cut -d " " -f 1|sort -n|head -n 4|while read i; do kill -CONT $i; done;
done

3rd line: Stops all wget processes.
4th line: Continues the first 4 (number can vary).

No Comments