tfixed a few scripts here and there - scripts - various script and utils
 (HTM) git clone git://z3bra.org/scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 93a9c760af519f2f373191025c0062e4dad863ce
 (DIR) parent 1d8754a05e565e90c4be8f55e0b5c0e5f40436d3
 (HTM) Author: z3bra <willyatmailoodotorg>
       Date:   Mon, 21 Sep 2015 23:40:56 +0200
       
       fixed a few scripts here and there
       
       Diffstat:
         M link-open                           |       5 +++--
         M menu                                |       2 +-
         M prtmk                               |       4 ++--
         M prtup                               |       1 +
         M radio                               |       4 +++-
         M record                              |      26 ++++++++++++++++++++------
         M square                              |       7 +++++--
         M syscat                              |       7 +++++--
         M uplay                               |       2 +-
         M utf8.sh                             |       1 +
         M vroum                               |       2 +-
         M xgif                                |      12 +++++++-----
         M yawee                               |      17 +++++++++++++++--
         M ydl                                 |      24 +++++++++++++++++++++++-
         M ys                                  |       2 +-
       
       15 files changed, 89 insertions(+), 27 deletions(-)
       ---
 (DIR) diff --git a/link-open b/link-open
       t@@ -3,15 +3,16 @@
        URI="$*"
        
        case $URI in
       -    *.jpg|*.png) img "$URI";;
       +    *.jp*g|*.png) img "$URI";;
            *.webm|*.mp4|*.ogv) mplayer -geometry 1280x720 "$URI";;
       +    *.gif) mplayer -geometry 1280x720 "$URI";;
            *youtube.com/*) uplay "$URI";;
            *.html) dwb "$URI";;
            *) thingmenu -g 140x182            \
                "picture" "img '$URI'"      \
                "video"   "mplayer -cache 512 '$URI'"  \
                "kinda vid" "uplay '$URI'"  \
       -        "text file" "urxvt -e sh -c 'curl -s $URI | less -r'" \
       +        "text file" "urxvt -e sh -c 'curl -s $URI | less -X'" \
                "donlad" "~/bin/download $URI" \
                "web shit" "dwb '$URI'" 2>/dev/null
                ;;
 (DIR) diff --git a/menu b/menu
       t@@ -1,7 +1,7 @@
        #!/bin/bash
        thingmenu -g 140x224 \
            "pop a term"        "urxvt" \
       -    "chat on irc"       "urxvt -e sh -c 'dm irc ssh blink'" \
       +    "chat on irc"       "urxvt -e sh -c 'dm irc ssh wizards'" \
            "play a game"       "steam" \
            "frag people"       "ioquake3" \
            "surf the web"      "dwb" \
 (DIR) diff --git a/prtmk b/prtmk
       t@@ -3,8 +3,8 @@
        # z3bra - (c) wtfpl 2014
        # Create a Pkgfile from simple templates and user input
        
       -PKGFILE=~/src/ports/Pkgfile
       -PORTDIR=~/usr/ports
       +PKGFILE=$HOME/crux/templates/Pkgfile
       +PORTDIR=$HOME/crux/ports
        EDITOR=${EDITOR:-vim}
        
        daddy="z3bra <willy at mailoo dot org>"
 (DIR) diff --git a/prtup b/prtup
       t@@ -28,6 +28,7 @@ get_version() {
        
            # enter the git directory
            if cd $name 2>/dev/null; then
       +        git reset --hard
                git pull origin master
        
            elif test -n "$gitsource"; then
 (DIR) diff --git a/radio b/radio
       t@@ -1,3 +1,5 @@
        #!/bin/sh
        
       -mplayer -nocache http://radio.2f30.org:8000/live.ogg 2>&1 >/dev/null
       +STREAM=${1:-http://radio.2f30.org:8000/live.ogg}
       +
       +curl -s $STREAM | play -q - 2>/dev/null
 (DIR) diff --git a/record b/record
       t@@ -1,7 +1,21 @@
        #!/bin/sh
       -ffmpeg -y -f x11grab -s 1440x900 -i $DISPLAY -an $1.mkv
       -tput setaf 1
       -echo ABOUT TO MAKE WEBM FROM RECORDING, ^C TO ABORT
       -sleep 5
       -tput setaf default
       -ffmpeg -y -i $1.mkv -c:v libvpx -an -b:v 2000k -s 1440x900 $1.webm
       +
       +PIDNAME=recorder
       +FRAMERATE=25
       +RES=$(wattr wh `lsw -r` | tr \  x)
       +
       +usage() {
       +        echo "usage: $(basename $0) [-fk] <filename>" >&2
       +        exit 1
       +}
       +
       +case $1 in
       +        -f) FRAMERATE=50; shift 1 ;;
       +        -k) kill $(pidof -s $PIDNAME); exit 0 ;;
       +esac
       +
       +test -n "$1" && WEBM=$1 || usage
       +
       +echo Framerate: $FRAMERATE
       +exec -a $PIDNAME ffmpeg -f x11grab -s $RES -an -r $FRAMERATE -i :0.0 -c:v libvpx -b:v 5M -crf 10 -quality realtime -y -loglevel quiet $1
       +
 (DIR) diff --git a/square b/square
       t@@ -1,5 +1,8 @@
        #!/bin/sh
        
       +CHAR=${1:-▒▒}
       +
       +echo
       +for i in {0..7}; do echo -en " \e[0;3${i}m${CHAR}\e[0m"; done; echo
       +for i in {0..7}; do echo -en " \e[1;3${i}m${CHAR}\e[0m"; done; echo
        echo
       -for i in {0..7}; do echo -en " \e[0;3${i}m▒▒\e[0m"; done; echo
       -for i in {0..7}; do echo -en " \e[1;3${i}m▒▒\e[0m"; done; echo
 (DIR) diff --git a/syscat b/syscat
       t@@ -4,6 +4,7 @@ COLOR=${COLOR:-1}
        
        c() { printf '\e[1;3%sm' "$COLOR"; }
        d() { printf '\e[0;3%sm' "$COLOR"; }
       +n() { printf '\e[0sm'; }
        
        cpuinfo() {
            sed -n "/model\ name/s/^.*:\ //p" /proc/cpuinfo | sed 1q
       t@@ -14,7 +15,7 @@ wmname() {
        }
        
        fontname() {
       -    xrdb -query|sed "/URxvt\*font/s/^[^-]*-\*-\([^-]*\)-.*$/\1/p;d"
       +    xrdb -query|sed "/^*font/s/^[^-]*-\*-\([^-]*\)-.*$/\1/p;d"
        }
        
        cat <<EOF
       t@@ -24,7 +25,9 @@ $(c)HOSTNAME  $(d)$HOSTNAME
        $(c)WMNAME    $(d)$(wmname)
        $(c)TERMINAL  $(d)$TERM
        $(c)SHELL     $(d)$SHELL
       -$(c)FONT      $(d)$(fontname)
       +$(c)PKGCOUNT  $(d)$(pkginfo -i|wc -l)
        $(c)PROC      $(d)$(cpu -p)
        $(c)MEMORY    $(d)$(memory -u|xargs human)
        EOF
       +#$(c)FONT      $(d)$(fontname)
       +printf '\e[0m'
 (DIR) diff --git a/uplay b/uplay
       t@@ -1,4 +1,4 @@
        #!/bin/sh
        
        #curl "$(youtube-dl -g $*)" | mplayer -cache 1024 -
       -mplayer -cache 1024 "$(youtube-dl -g $*)" 
       +mplayer -really-quiet -cache 1024 "$(youtube-dl -g $*)" 
 (DIR) diff --git a/utf8.sh b/utf8.sh
       t@@ -48,3 +48,4 @@ fi
        for (( i=$min; i<$max; i++ )); do
            unichr $i
        done
       +echo
 (DIR) diff --git a/vroum b/vroum
       t@@ -3,7 +3,7 @@
        # z3bra - 2014 (c) wtfpl
        # window focus wrapper that sets borders and can focus next/previous window
        
       -BW=${BW:-2}                    # border width
       +BW=${BW:-6}                    # border width
        ACTIVE=${ACTIVE:-0xffffff}     # active border color
        INACTIVE=${INACTIVE:-0x323232} # inactive border color
        
 (DIR) diff --git a/xgif b/xgif
       t@@ -14,6 +14,7 @@ EOF
        }
        
        case $1 in
       +    -w) WID=$2; shift 2;;
            -h) usage && exit 0;;
             *) test $# -lt 1 && usage && exit 1
        esac
       t@@ -21,15 +22,16 @@ esac
        # the size of your window manager borders, to include them in the gif
        BORDERS=${BORDER:-2}
        FIFO=${FIFO:-/tmp/xgif-$$.fifo}
       +WID=${WID:-$(lsw -r)}
        
        # let the user grab a window
       -geom=$(xwininfo|grep -E "Wid|Hei|Abs"|sed 's/.*:\s*//g'|tr '\n' :|sed 's/:$//')
       +geom=$(wattr xywh $WID)
        
        # extract window size/position
       -x=$(echo $geom|cut -d: -f1)
       -y=$(echo $geom|cut -d: -f2)
       -w=$(echo $geom|cut -d: -f3)
       -h=$(echo $geom|cut -d: -f4)
       +x=$(echo $geom|cut -d\  -f1)
       +y=$(echo $geom|cut -d\  -f2)
       +w=$(echo $geom|cut -d\  -f3)
       +h=$(echo $geom|cut -d\  -f4)
        
        # add the borders to the width/heigh
        w=$(( $w + 2 * $BORDERS))
 (DIR) diff --git a/yawee b/yawee
       t@@ -1,9 +1,20 @@
        #!/bin/sh
        
       +WALL=$HOME/.wall.png
       +BLUR=10
       +
       +blur() {
       +    hsetroot -fill $WALL -blur ${1:-$BLUR}
       +}
       +
        while IFS=: read ev wid; do
            case $ev in
                # window creation
       -        16) wattr o $wid || corner md $wid ;;
       +        16) wattr o $wid || {
       +                corner md $wid
       +                test "$(lsw)" = "$wid" && blur &
       +            }
       +            ;;
        
                # mapping requests
                19) wattr o $wid \
       t@@ -11,7 +22,9 @@ while IFS=: read ev wid; do
                    || vroum $wid ;;
        
                # focus next window when deleting focused window
       -        18) wattr $(pfw) || vroum prev 2>/dev/null;;
       +        18) wattr $(pfw) || vroum prev 2>/dev/null
       +            test -z "$(lsw)" && blur 0 &
       +            ;;
        
                # entering window
                7) wattr o $wid || vroum $wid ;;
 (DIR) diff --git a/ydl b/ydl
       t@@ -3,7 +3,6 @@
        # z3bra - (c) wtfpl 2014
        # download the audio track of the first result of a youtube search
        # and add it to MPD library (will end up with a .mp3, for tags)
       -# Require :  ys (youtube search)
        
        MPD_DOWNLOAD_DIR=~/usr/msc/youtube/
        
       t@@ -11,6 +10,29 @@ usage() {
            echo "`basename $0` [-h] <query>"
        }
        
       +ys() {
       +        num=3
       +        regex='^.*<a href="\(/watch[^"]*\)"[^>]*>\([^<]*\)</a>.*$'
       +        output='\2 - http://youtube.com\1'
       +
       +        while getopts "hn:tu" OPT; do
       +            case  $OPT in
       +                n) num=$OPTARG;;
       +                t) output='\2';;
       +                u) output='http://youtube.com\1';;
       +                h) usage long; exit 0;;
       +                *) usage; exit 1;;
       +            esac
       +        done
       +
       +        shift $((OPTIND - 1))
       +
       +        query=$(echo $@ | tr ' ' '+')
       +        url="https://www.youtube.com/results?search_query=${query}"
       +
       +        curl -s "$url" | sed -n "s,$regex,$output,p" | sed ${num}q
       +}
       +
        # don't process if no argument given
        test $# -eq 0 && usage && exit 1
        
 (DIR) diff --git a/ys b/ys
       t@@ -33,6 +33,6 @@ done
        shift $((OPTIND - 1))
        
        query=$(echo $@ | tr ' ' '+')
       -url="http://www.youtube.com/results?search_query=${query}"
       +url="https://www.youtube.com/results?search_query=${query}"
        
        curl -s "$url" | sed -n "s,$regex,$output,p" | sed ${num}q