Code Dump: channeldown.sh

Building on youtube.sh, this downloads an entire youtube channel. Usefull for marathon viewing sessions. #!/bin/bash if [ “x$1” = “x” ] then echo channeldown “(username)” exit fi if [ ! “x$2” = “x” ] then MAX=$2 else MAX=100 fi USER=$1 i=1 while [ $i -lt “$MAX” ] do wget http://gdata.youtube.com/feeds/api/users/$USER/uploads\?start-index=”$i”\&max-results=50 -O $USER.$i.raw let “i+=50” done […]

Read More

Code Dump: youtube.sh

Downloads youtube videos using youtube-dl. I built it to download multiple videos in a row. Put each url in a pair of single quotes. “`bash #!/bin/bash SETDIR=”/downloads/watch/misc” DIRFLAG=0 for ARG in $* do ARG=”$(echo “$ARG” | sed ‘s/feature=[a-z_+]*&//’)” # http://www.youtube.com/watch?feature=player_embedded&v=qeK0KmtYNaA # http://www.youtube.com/watch?v=kV832rfjcas&feature=related echo “$ARG” if [ x$ARG = x ] then exit elif [ x$ARG […]

Read More

Code Dump: Brighty

For some reason, on my Acer Aspire laptop, Ubuntu doesn’t seem to respond to the brightness settings, but this script works. It’s probably not terribly safe, but it add a good 20-30 minutes of battery life when I set it to the lowest setting I can see. “`bash #!/bin/bash function helpa { echo brighty [ […]

Read More

Code Dump: rand.sh

Generates random strings. I got tired of having to go to [random.org](http://random.org “Random.org”), and this takes like 2 seconds. “`bash VERSION=3 NUM=0 LEN=0 MODE=0 ALLOW=”” for Y in $@ do if [ $Y = “-n” ] then MODE=1 ALLOW=$ALLOW”0-9″ elif [ $Y = “-s” ] then MODE=5 ALLOW=$ALLOW’!@#$%^&*()-_=+’ elif [ $Y = “-l” ] then […]

Read More

Code Dump: Core.sh and Startconky.sh

Used to randomly select from several wallpapers and apply a specific conky theme to it. core.sh “`bash #!/bin/sh TOTAL=$(ls /home/michael/.conky/ | grep png | wc -l) if [ “x$1” != “x” ] then if [ $1 -gt -1 ] && [ $1 -lt $(ls /home/michael/.conky/| grep png | wc -l) ] then URAND=0 RANDER=$1 else […]

Read More

Rsyslog – Log only to first match.

Giving the tilde (~) as an action causes that message to be discarded. There’s also the ampersand syntax – if a line starts with & it is considered an additional action for the previous line’s selector. So something like this: > mail.* /var/log/mail.log > & ~ > > kern.* /var/log/kern.log > & ~ > > […]

Read More