scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit d2bab9ab415800907c73b356ae858041b7c3cc42
parent f95fbbbe252a55eb6c8f71fcd1bf55b23b5b2fdb
Author: z3bra <willyatmailoodotorg>
Date:   Wed Jan  6 23:19:53 +0100

Various things

Diffstat:
autoup | 6+++---
beepop | 13++++++-------
ddg | 8++++++++
dlaunch | 10++++++++++
dm | 4+++-
link-open | 6+++---
log | 8++++++++
mailbar | 11++++++-----
maillist | 4++--
menu | 4++--
prtup | 6+++---
square | 4++--
sslget | 7+++++++
syscat | 10+++++-----
takeoffdir | 6+++++-
udmenu | 10+++++-----
vroum | 3++-
xwait | 0
18 files changed, 80 insertions(+), 40 deletions(-)
diff --git a/autoup b/autoup @@ -1,9 +1,9 @@ #!/bin/sh -SSHUSER=z3bra -SSHKEY=$HOME/.ssh/autoupload +SSHUSER=egull +SSHKEY=$HOME/.ssh/phobos SERVER=raw.z3bra.org -WEBROOT=/var/www/http/raw.z3bra.org +WEBROOT=/var/http/raw.z3bra.org WEBDIR=dev/random test -z "$1" && exit 1 || FILENAME=$(basename $1) diff --git a/beepop b/beepop @@ -7,13 +7,11 @@ default_geometry() { x=$(wattr w `lsw -r`) y=$(wattr h `lsw -r`) - width=256 + width=140 height=28 - offy=10 - offx=20 - #offy=64 - #offx=$(( x - $width )) + offy=44 + offx=$(( x - $width - 25 )) echo "${width}x${height}+${offx}+${offy}" } @@ -21,16 +19,17 @@ default_geometry() { FIFO=/tmp/beepop.fifo GEOM=$(default_geometry) SLEEP=3 +CHAR="$(/usr/bin/printf '\uE054')" case $(basename $0) in beepop) test -p $FIFO || mkfifo $FIFO tail -f $FIFO | while read LINE; do - . $HOME/.wmrc + . $HOME/.theme ( - echo "%{l}%{F${HL}} %{F-}$LINE" + echo "%{r}$LINE %{F${HL}}$CHAR" sleep $SLEEP ) | lemonbar -d -g "$GEOM" -f "$FONT" -f "$ICON" -B "#00000000" -F "$FG" done diff --git a/ddg b/ddg @@ -0,0 +1,7 @@ +#!/bin/sh + +BROWSER=${BROWSER:-"/usr/bin/surf"} +BASEURL="https://duckduckgo.com/lite?q=" + +QUERY=$(thinglaunch -o -p 'ddg: ' | tr ' ' '+') +$BROWSER "${BASEURL}${QUERY}"+ \ No newline at end of file diff --git a/dlaunch b/dlaunch @@ -0,0 +1,10 @@ +#!/bin/sh + +FONT="monospace:size=8:antialias=true" +NB='black' +NF='white' +SB='white' +SF='black' + + +dmenu_run -fn "$FONT" -nb "$NB" -nf "$NF" -sb "$SB" -sf "$SF" $@ diff --git a/dm b/dm @@ -3,7 +3,7 @@ # z3bra - (c) wtfpl 2014 # Create/list/attach/detach applications using dtach -sockdir=~/var/run +sockdir=/tmp/dm keyseq= list() { @@ -15,6 +15,8 @@ usage() { echo "`basename $0` [-hl] <alias> [command]" } +test -d $sockdir || mkdir -p $sockdir + while getopts "hl" opt; do case $opt in l) list; exit 0 ;; diff --git a/link-open b/link-open @@ -10,7 +10,7 @@ case $URI in *.webm|*.mp4|*.ogv) mplayer -geometry 1280x720 "$URI";; *.gif) mplayer -geometry 1280x720 "$URI";; *youtube.com/*) uplay "$URI";; - *.html) dwb "$URI";; + *.html) surf "$URI";; *.txt) st -e sh -c "curl -s '$URI'|less -R";; gopher://*) st -e cgo $URI ;; *) thingmenu -g 140x182 -x \ @@ -18,8 +18,8 @@ case $URI in "video" "mplayer -cache 512 '$URI'" \ "kinda vid" "uplay '$URI'" \ "text file" "st -e sh -c 'curl -s $URI | less -X'" \ - "donlad" "~/bin/download $URI" \ - "web shit" "dwb '$URI'" 2>/dev/null \ + "donlad" "download $URI" \ + "web shit" "surf '$URI'" 2>/dev/null \ "yank fuck" "echo '$URI' | tr -d '\n' | xsel -i" ;; esac diff --git a/log b/log @@ -0,0 +1,7 @@ +#!/bin/sh + +NOTE=${1:-random} +LOGDIR=$HOME/data/notes + +test -d $LOGDIR || mkdir -p $LOGDIR +ts >> $LOGDIR/$NOTE+ \ No newline at end of file diff --git a/mailbar b/mailbar @@ -1,15 +1,16 @@ #!/bin/sh -MAILDIR=$HOME/var/mail -MAILBOX='inbox crux lobsters' +. $HOME/.theme -. $HOME/.wmrc +MAILDIR=$HOME/data/mail +MAILBOX='inbox crux lobsters' COL1="%{F$HL}" COL2="%{F$FG}" mailcount() { - case $1 in + BOX=$1 + case $BOX in crux) CHAR=''; DIR=$MAILDIR/lists/$1/new ;; inbox) CHAR=''; DIR=$MAILDIR/$1/new ;; lobsters) CHAR=''; DIR=$MAILDIR/lists/$1/new ;; @@ -47,4 +48,4 @@ openbox() { while :; do formatbar sleep 5 -done | lemonbar -d -B"#00000000" -f"$FONT" -f"$ICON" -g130x32+1300 | openbox +done | lemonbar -d -f "$FONT" -f "$ICON" -B"#00000000" -g140x32+1300+16 | openbox diff --git a/maillist b/maillist @@ -1,7 +1,7 @@ #!/bin/sh -INBOX=$HOME/var/mail/inbox -MBASE=$HOME/var/mail +INBOX=$HOME/data/mail/inbox +MBASE=$HOME/data/mail LISTS='crux lobsters' crawl() { diff --git a/menu b/menu @@ -1,10 +1,10 @@ #!/bin/bash -thingmenu -g 140x224 \ +thingmenu -g 140x225 \ "chat on irc" "st -e sh -c 'dm irc ssh wizards'" \ "run around" "defrag" \ "frag people" "quake3e" \ "play a game" "steam" \ "pop a term" "st" \ - "surf the web" "dwb" \ + "surf the web" "dillo" \ "scrot this shit" "xscreenshot | if2png | imgurup | xsel -pi" \ "want some more?" "thinglaunch" 2> /dev/null diff --git a/prtup b/prtup @@ -3,9 +3,9 @@ # z3bra - (c) wtfpl 2014 # Update git hashes in a Pkgfile -PKGMK_ARCH=64 source /etc/pkgmk.conf +PKGMK_ARCH=64 . /etc/pkgmk.conf -echo_color () { +echo_color() { tput bold tput setaf $1 shift @@ -65,7 +65,7 @@ update_pkgfile() { main() { # we'll need the $name var later - source Pkgfile + . ./Pkgfile # get the git hashes get_version diff --git a/square b/square @@ -3,6 +3,6 @@ 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 +for i in `seq 0 7`; do printf " [0;3${i}m${CHAR}"; done; echo +for i in `seq 0 7`; do printf " [1;3${i}m${CHAR}"; done; echo echo diff --git a/sslget b/sslget @@ -0,0 +1,6 @@ +#!/bin/sh +# +# retrieve SSL certificate of a website +# it assumes 443 to be the default SSL port + +echo | openssl s_client -connect $@:443 2>&1| sed '/BEGIN CERT/,/END CERT/p;d'+ \ No newline at end of file diff --git a/syscat b/syscat @@ -2,9 +2,9 @@ COLOR=${COLOR:-7} -c() { printf '\e[1;3%sm' "$COLOR"; } -d() { printf '\e[0;3%sm' "$COLOR"; } -n() { printf '\e[0sm'; } +c() { printf '[1;3%sm' "$COLOR"; } +d() { printf '[0;3%sm' "$COLOR"; } +n() { printf ''; } cpuinfo() { sed -n "/model\ name/s/^.*:\ //p" /proc/cpuinfo | sed 1q @@ -21,7 +21,7 @@ fontname() { cat <<EOF $(c)SYSTEM $(d)$(crux) $(c)KERNEL $(d)$(uname -r) -$(c)HOSTNAME $(d)$HOSTNAME +$(c)HOSTNAME $(d)$(hostname) $(c)WMNAME $(d)$(wmname) $(c)TERMINAL $(d)$TERM $(c)SHELL $(d)$SHELL @@ -30,4 +30,4 @@ $(c)PROC $(d)$(cpu -p) $(c)MEMORY $(d)$(memory -u|xargs human) EOF #$(c)FONT $(d)$(fontname) -printf '\e[0m' +n diff --git a/takeoffdir b/takeoffdir @@ -1,6 +1,10 @@ #!/bin/sh +TAKEOFF_DIR=/tmp/takeoff + +mkdir -p $TAKEOFF_DIR + # file either created or modified -wendy -m 136 -f ~/var/takeoff -v | while read ev file; do +wendy -m 136 -f $TAKEOFF_DIR -v | while read ev file; do $HOME/bin/autoup "$file" done diff --git a/udmenu b/udmenu @@ -1,10 +1,10 @@ #!/bin/sh FONT="monospace:size=8:antialias=true" -NB='#14120f' -NF='#42403d' -SB='#42403d' -SF='#f1e8d9' +NB='black' +NF='white' +SB='white' +SF='black' -dmenu -fn "$FONT" -nb "$NB" -nf "$NF" -sb "$SB" -sf "$SF" $@ +ifne dmenu -fn "$FONT" -nb "$NB" -nf "$NF" -sb "$SB" -sf "$SF" $@ diff --git a/vroum b/vroum @@ -53,5 +53,6 @@ test -z "$wid" && { echo "$(basename $0): no window to focus" >&2; exit 1; } wtf $wid # set focus on it chwso -r $wid # raise windows -setborder active $wid # activate the new window setborder inactive $CUR # set inactive border on current window +#setborder active $wid # activate the new window +chwb -s $BW $wid diff --git a/xwait b/xwait Binary files differ.