tfuck it, commit everything, at least it's save somewhere - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 6b577e4f61229e5812efeef63e08ecbd255fb3c1
(DIR) parent 6078f8fdacf1fe2350048d557a21f549fd156885
(HTM) Author: z3bra <willyatmailoodotorg>
Date: Tue, 17 Nov 2015 01:21:47 +0100
fuck it, commit everything, at least it's save somewhere
Diffstat:
M bars | 4 ++--
M cdump | 19 +------------------
A changewall | 16 ++++++++++++++++
M img | 1 -
A ix | 3 +++
M link-open | 17 +++++++++++------
M memory | 2 +-
M menu | 7 ++++---
M square | 2 +-
A sshmenu | 9 +++++++++
A teletype | 0
A udmenu | 10 ++++++++++
A uplaylist | 6 ++++++
M ushot | 2 +-
M vroum | 14 ++++++++++----
A xurls | 7 +++++++
M yawee | 20 ++++++++++++--------
17 files changed, 94 insertions(+), 45 deletions(-)
---
(DIR) diff --git a/bars b/bars
t@@ -1,8 +1,8 @@
#!/bin/sh
. $HOME/.wmrc
-COL2="%{B#66ffffff}"
-COL1="%{B#66000000}"
+COL2="%{B#66000000}"
+COL1="%{B#ff000000}"
START=$COL1
SEP=$COL2
(DIR) diff --git a/cdump b/cdump
t@@ -1,20 +1,3 @@
#!/bin/sh
-for NUM in $(seq 0 7); do
- CN=$(xrdb -query | grep "^\*color${NUM}:"| cut -d':' -f2 | tr -d ' ')
- printf "\e[0;3${NUM}m%s " $CN
-done
-echo
-for NUM in $(seq 0 7); do
- printf "\e[0;3${NUM}m███████ "
-done
-echo
-for NUM in $(seq 0 7); do
- printf "\e[1;3${NUM}m███████ "
-done
-echo
-for NUM in $(seq 0 7); do
- CN=$(xrdb -query | grep "^\*color$((${NUM} + 8)):"| cut -d':' -f2 | tr -d ' ')
- printf "\e[1;3${NUM}m%s " $CN
-done
-printf "\e[0m\n"
+xrdb -query | grep -P '^\*color[0-9]*:' | tr -d '\t' | cut -d: -f2 | hex2col
(DIR) diff --git a/changewall b/changewall
t@@ -0,0 +1,16 @@
+#!/bin/sh
+
+WALLDIR=$HOME/usr/pics/bg
+
+setwall() {
+ WALL=$(readlink -f $1)
+ hsetroot -fill $WALL
+ hsetroot -fill $WALL -blur 8 -write $HOME/.blur.png
+ ln -sf $WALL ~/.wall.png
+}
+
+test -n "$1" && setwall $1 && exit
+
+find $WALLDIR -name '*.png' | meh -list | while read WALL; do
+ setwall $WALL
+done
(DIR) diff --git a/img b/img
t@@ -1,7 +1,6 @@
#!/bin/sh
IMAGE=/tmp/`basename $1`
-echo "Downloading image.."
curl -s "$1" > $IMAGE
meh $IMAGE
rm $IMAGE
(DIR) diff --git a/ix b/ix
t@@ -0,0 +1,3 @@
+#!/bin/sh
+
+curl -sF "f:1=<-" ix.io
(DIR) diff --git a/link-open b/link-open
t@@ -2,18 +2,23 @@
URI="$*"
+# yank URI first, just in case :)
+printf '%s' "$URI" | xsel -i
+
case $URI in
*.jp*g|*.png) img "$URI";;
*.webm|*.mp4|*.ogv) mplayer -geometry 1280x720 "$URI";;
*.gif) mplayer -geometry 1280x720 "$URI";;
*youtube.com/*) uplay "$URI";;
*.html) dwb "$URI";;
+ *.txt) st -e sh -c "curl -s '$URI'|less -R";;
+ gopher://*) st -e cgo $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 -X'" \
- "donlad" "~/bin/download $URI" \
- "web shit" "dwb '$URI'" 2>/dev/null
+ "picture" "img '$URI'" \
+ "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
;;
esac
(DIR) diff --git a/memory b/memory
t@@ -24,7 +24,7 @@ memused () {
b=$(grep ^Buffers /proc/meminfo | awk '{print $2}')
c=$(grep ^Cached /proc/meminfo | awk '{print $2}')
- echo "($t - $f - $c - $b)" | bc
+ echo "($t - $f - $c - $b) * 1000" | bc
}
# display the memory used in percentage
(DIR) diff --git a/menu b/menu
t@@ -1,9 +1,10 @@
#!/bin/bash
thingmenu -g 140x224 \
- "pop a term" "urxvt" \
- "chat on irc" "urxvt -e sh -c 'dm irc ssh wizards'" \
+ "chat on irc" "st -e sh -c 'dm irc ssh wizards'" \
+ "run around" "defrag" \
+ "frag people" "quake3e" \
"play a game" "steam" \
- "frag people" "ioquake3" \
+ "pop a term" "st" \
"surf the web" "dwb" \
"scrot this shit" "xscreenshot | if2png | imgurup | xsel -pi" \
"want some more?" "thinglaunch" 2> /dev/null
(DIR) diff --git a/square b/square
t@@ -1,6 +1,6 @@
#!/bin/sh
-CHAR=${1:-▒▒}
+CHAR=${1:-██}
echo
for i in {0..7}; do echo -en " \e[0;3${i}m${CHAR}\e[0m"; done; echo
(DIR) diff --git a/sshmenu b/sshmenu
t@@ -0,0 +1,9 @@
+#!/bin/sh
+
+gethosts() {
+ sed "/Host/s/Host //p;d" $HOME/.ssh/config | grep -v '*' | cut -d\ -f1
+}
+
+TARGET=$(gethosts | slmenu -l 8 -p "host:")
+
+test -n "$TARGET" && ssh $TARGET
(DIR) diff --git a/teletype b/teletype
Binary files differ.
(DIR) diff --git a/udmenu b/udmenu
t@@ -0,0 +1,10 @@
+#!/bin/sh
+
+FONT="-windows-codingfonttobi1-medium-r-normal--12-90-96-96-c-70-iso8859-1"
+NB='#14120f'
+NF='#42403d'
+SB='#42403d'
+SF='#f1e8d9'
+
+
+dmenu -fn "$FONT" -nb "$NB" -nf "$NF" -sb "$SB" -sf "$SF" $@
(DIR) diff --git a/uplaylist b/uplaylist
t@@ -0,0 +1,6 @@
+#!/bin/sh
+#
+# play a youtube playlist with player
+curl -s "$1" | cut -d'"' -f2 | grep 'watch?v='| sort | uniq |
+ cut -d\& -f1 | sed 's@^@http://www.youtube.com@' |
+ xargs -I% sh -c 'mplayer -really-quiet -cache 1024 "$(youtube-dl -g %)"'
(DIR) diff --git a/ushot b/ushot
t@@ -2,7 +2,7 @@
FILE=${1:-/dev/null}
-xscreenshot | if2png | tee $FILE | imgurup
+xscreenshot | iffpng | tee $FILE | imgurup
sed 1q ~/.imgurlog | xsel -pi
test -n "$1" && meh $1
(DIR) diff --git a/vroum b/vroum
t@@ -3,9 +3,9 @@
# z3bra - 2014 (c) wtfpl
# window focus wrapper that sets borders and can focus next/previous window
-BW=${BW:-6} # border width
+BW=${BW:-8} # border width
ACTIVE=${ACTIVE:-0xffffff} # active border color
-INACTIVE=${INACTIVE:-0x323232} # inactive border color
+INACTIVE=${INACTIVE:-0x646464} # inactive border color
# get current window id
CUR=$(pfw)
t@@ -26,8 +26,14 @@ setborder() {
test "$(wattr xywh $2)" = "$(wattr xywh $ROOT)" && return
case $1 in
- active) chwb -s $BW -c $ACTIVE $2 ;;
- inactive) chwb -s $BW -c $INACTIVE $2 ;;
+ active)
+ chwb -s $BW -c $ACTIVE $2
+ chwb2 -O $ACTIVE -I 000000 -i 4 -o 4 $2
+ ;;
+ inactive)
+ chwb -s $BW -c $INACTIVE $2
+ chwb2 -O $INACTIVE -I 000000 -i 4 -o 4 $2
+ ;;
esac
}
(DIR) diff --git a/xurls b/xurls
t@@ -0,0 +1,7 @@
+#!/bin/sh
+
+protocols='[a-zA-Z]+://'
+hostchars='[-a-zA-Z0-9._+]+'
+pathchars='[-a-zA-Z0-9._+#=?&:;%/!~()]+'
+
+grep -aPo "${protocols}${hostchars}${pathchars}" | tac
(DIR) diff --git a/yawee b/yawee
t@@ -1,7 +1,8 @@
#!/bin/sh
WALL=$HOME/.wall.png
-BLUR=10
+BLUR=$HOME/.blur.png
+#BLUR=10
blur() {
hsetroot -fill $WALL -blur ${1:-$BLUR}
t@@ -10,18 +11,21 @@ blur() {
while IFS=: read ev wid; do
case $ev in
# window creation
- 16) wattr o $wid || {
- corner md $wid
- test "$(lsw)" = "$wid" && blur &
- }
+ 16) wattr o $wid || corner md $wid
;;
# mapping requests
- 19) wattr o $wid || vroum $wid ;;
+ 19) wattr o $wid || {
+ vroum $wid &
+ #test $(lsw|wc -l) -eq 1 && hsetroot -fill $BLUR
+ }
+ ;;
# focus next window when deleting focused window
- 18) wattr $(pfw) || vroum prev 2>/dev/null
- test -z "$(lsw)" && blur 0 &
+ 18) wattr $(pfw) || {
+ vroum prev 2>/dev/null
+ #test -z "$(lsw)" && hsetroot -fill $WALL
+ }
;;
# entering window