GIT: checking if repos are up-to-date

It's only going to work if you clone all of your git repos at the same place, but here it is:

function chkgit() {
    wd="$(pwd)"
    cd ~/git &&
    for i in $(ls)
    do
        cd $i
        echo -e "Checking $i ..."
        git pull
        cd ..
    done
    cd $wd
}

BASH: password generator

function genpasswd() {
    tr -dc [:alnum:][:punct:] < /dev/urandom | head -c ${1:-8} | xargs -0
}

The password will be 8 characters long if no argument is specified.

MISC: copying all links from an apache dir-listing page

it's doable with a simple shell function (to put in your ~/.bashrc for example):

function dumphttplinks() {
        lynx -dump "$1" | awk '/http/{print $2}' > temp.txt
        grep 'mp4\|flac' temp.txt > list.txt
        rm temp.txt
}
alias dump=dumphttplinks

The grep line will search for any line containing any of the specified words (here mp4 and flac, but you can add whatever you want) and put them into a list.txt file, to only get exactly what needed.

BASH: $PS1 colors

Here's a list of colors you can use with $PS1

# Regular Colors
Black='\e[0;30m'        # Black
Red='\e[0;31m'          # Red
Green='\e[0;32m'        # Green
Yellow='\e[0;33m'       # Yellow
Blue='\e[0;34m'         # Blue
Purple='\e[0;35m'       # Purple
Cyan='\e[0;36m'         # Cyan
White='\e[0;37m'        # White

# High Intensity
IBlack='\e[0;90m'       # Black
IRed='\e[0;91m'         # Red
IGreen='\e[0;92m'       # Green
IYellow='\e[0;93m'      # Yellow
IBlue='\e[0;94m'        # Blue
IPurple='\e[0;95m'      # Purple
ICyan='\e[0;96m'        # Cyan
IWhite='\e[0;97m'       # White

Color_Off='\e[0m'       # Text Reset

MISC: changing terminal title

Changing the terminal title (e;g. when SSH'd into a computer) is done using the PS1 variable.

PS1="\[\e]0;\u@\h: \w\a\]\[$IGreen\]\h \[$IYellow\]\w \[$IGreen\]:\[$Color_Off\] "