tremove useless scripts - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 1d8754a05e565e90c4be8f55e0b5c0e5f40436d3
(DIR) parent e4297e8a0b26e183874b14c565fed4eff2d5d92a
(HTM) Author: z3bra <willyatmailoodotorg>
Date: Mon, 21 Sep 2015 23:39:16 +0200
remove useless scripts
Diffstat:
D fullscreen | 42 -------------------------------
D grid | 91 -------------------------------
D mfp | 11 -----------
D pass | 50 -------------------------------
A pulsar | 12 ++++++++++++
D pulse | 17 -----------------
6 files changed, 12 insertions(+), 211 deletions(-)
---
(DIR) diff --git a/fullscreen b/fullscreen
t@@ -1,42 +0,0 @@
-#!/bin/sh
-#
-# z3bra - 2014 (c) wtfpl
-# toggle the fullscreen state of a window
-
-# this file is used to store the previous geometry of a window
-FSFILE=${FSFILE:-~/.fwin}
-
-# it's pretty simple, but anyway...
-usage() {
- echo "usage: $(basename $0) <wid>"
- exit 1
-}
-
-# exit if no argument given
-test -z "$1" && usage
-
-# this will unset the fullscreen state of any fullscreen window if there is one.
-# this way, there will only be one window in fullscreen at a time, and no window
-# will loose their previous geometry info
-test -f $FSFILE && wtp $(cat $FSFILE)
-
-# if file exist and contain our window id, it means that out window is in
-# fullscreen mode
-if test -f $FSFILE && grep -q $1 $FSFILE; then
- # if the window we removed was our window, delete the file, so we can
- # fullscreen it again later
- rm -f $FSFILE
-
-else
- # if not, then put the current window in fullscreen mode, after saving its
- # geometry and id to $FSFILE we also remove any border from this window.
- wattr xywhi $1 > $FSFILE
- wtp $(wattr xywh `lsw -r`) $1
- chwb -s 0 $1
-fi
-
-# now focus the window, and put it in front, no matter which state we're in, and
-# put the cursor on its bottom-right corner (for consistency)
-vroum $1
-wmp -a $(wattr xy $1)
-wmp -r $(wattr wh $1)
(DIR) diff --git a/grid b/grid
t@@ -1,91 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2015 Greduan <me@greduan.com>, licensed under the WTFPL license
-#
-# When used puts all the windows in a grid and when you focus one of the windows
-# it puts all the windows back to their original location and focuses the window
-# you switched to.
-# depends on: wew focus.sh
-
-GAP=${GAP:-20}
-ROOT=$(lsw -r)
-SW=$(wattr w $ROOT)
-SH=$(wattr h $ROOT)
-SH=$(wattr h $ROOT)
-PFW=$(pfw)
-TEMP=$(mktemp) && wattr xywhi $(lsw) > $TEMP
-BW=2
-
-# reduce the screen area at first, so we won't have to do it later... It will
-# greatly improve expressions, trust me!
-SW=$(( SW - GAP - 2*BW ))
-SH=$(( SH - GAP - 2*BW ))
-
-# figure out the dimensions of the windows and locations
-NB=$(wc -l < $TEMP)
-
-# calculate the size of the grid using the square root of the number of windows
-ROWS=$(echo "sqrt($NB)" | bc)
-COLS=$ROWS
-
-# for each row...
-for r in `seq 1 $ROWS`; do
-
- # .. if we're on the last row, display all the remaining windows
- # eg: if we have 12 windows, the square root would be 3 (truncated).
- # so the script would draw a 3x3 grid. This would leave 3 windows apart. To
- # avoid this, we set the number of columns of the last row as
- #
- # 12 - 3 * (3-1)
- # => 12 - 3 * 2
- # => 12 - 6
- # == 6
- # so we will have 6 windows on the last row, instead of 3.
- # This do not lead to the best looking grid, I know (the best one would be
- # 3x4), but it's the simplest algo I've found. Don't forget we're playing
- # with shell scripts here, not matlab..
- test $r -eq $ROWS && COLS=$(( NB - ROWS * (ROWS-1) ))
-
- # for each column of each row..
- for c in `seq 1 $COLS`; do
-
- # exit if we don't have other windows to display
- test $(( (r-1)*r + c )) -gt $NB && break
-
- # heigh of windows (total heigh minus gaps and borders)
- H=$(( SH/ROWS - GAP - BW ))
- # same for width
- W=$(( SW/COLS - GAP - BW ))
-
- # and the tricky part..
- # The X offset is the width * the actual column (starting from 0) + the
- # gaps/borders multiplied by the column number (draw it on a sheet of
- # paper like me, it will make much more sense!
- X=$(( W * (c-1) + c*(GAP + BW) ))
- # same for the Y offset
- Y=$(( H * (r-1) + r*(GAP + BW) ))
-
- # finally, teleport the window to the place we just calculated.
- # the sed trick is used to get the corresponding line number in the file
- # holding the window infos.
- wtp $X $Y $W $H $(sed "$(( (r-1)*r + c ))p;d" $TEMP | cut -d\ -f5)
- done
-done
-
-# loop through wew to hear for when you focus a new window
-wew | while IFS=: read ev wid; do
- case $ev in
- 4)
- while read line; do
- wtp $line
- done < $TEMP
- vroum $wid
- exit
- ;;
- esac
- # TODO: add a thing so that if the same window is clicked it puts windows
- # back and focuses the same window
-done
-
-# cleanup
-rm $TEMP
(DIR) diff --git a/mfp b/mfp
t@@ -1,11 +0,0 @@
-#!/bin/sh
-#
-# z3bra - 2015 (c) wtfpl
-# plays mix from http://musicforprogramming.net in random order
-
-curl -s http://musicforprogramming.net/rss.php \
- | grep comments \
- | sed 's/\s*<.\?comments>\s*//g' \
- | shuf \
- | tr '\n' ' ' \
- | xargs mplayer -nocache 2>&1 >/dev/null
(DIR) diff --git a/pass b/pass
t@@ -1,50 +0,0 @@
-#!/bin/sh
-# z3bra - 2015 (c) wtfpl
-# simple password manager
-# depends on: gpg2
-
-FILE=${FILE:-~/.pass}
-GPGID=willy
-
-usage() {
- echo "usage: $(basename $0) [-ad <name>]" >&2
- exit 1
-}
-
-encrypt() {
- gpg2 -e -r $GPGID | sponge $FILE
-}
-
-decrypt() {
- gpg2 -d --batch --quiet -u $GPGID $FILE
-}
-
-pass_lst() {
- decrypt | cut -d: -f1
-}
-
-pass_add() {
- printf "password for '$1':"; read -s PASS; echo
- printf "do it again! '$1':"; read -s PASS2; echo
- test "$PASS" != "$PASS2" && echo "nope, sorry." && exit 1
- decrypt | (cat; echo "${1}:${PASS}") | encrypt
-}
-
-pass_get() {
- decrypt | grep -E "^${1}:" | cut -d: -f2-
-}
-
-pass_del() {
- decrypt | grep -vE "^${1}:" | encrypt
-}
-
-test -f $FILE || encrypt < /dev/null
-# only list password names and exit
-test $# -lt 1 && pass_lst && exit 0
-
-case $1 in
- -h) usage ;;
- -a) pass_add "$2" ;;
- -d) pass_del "$2" ;;
- *) pass_get "$@" ;;
-esac
(DIR) diff --git a/pulsar b/pulsar
t@@ -0,0 +1,12 @@
+#!/bin/sh
+
+FREQ=${FREQ:-0.05}
+
+while :; do
+ COLORS=$(tac < ~/.colors | cat - ~/.colors | tr -d '#')
+ for c in $COLORS; do
+ CUR=$(pfw)
+ test "`wattr wh $CUR`" != "`wattr wh $(lsw -r)`" && chwb -c $c $CUR
+ sleep $FREQ
+ done
+done
(DIR) diff --git a/pulse b/pulse
t@@ -1,17 +0,0 @@
-#!/bin/sh
-
-FREQ=${FREQ:-0.05}
-
-# pulsing red
-COLORS="443232 553232 664444 774444 885656 aa5656 bb6464 cc6464 dd7272 ff7272 dd7272 cc6464 bb6464 aa5656 885656 774444 664444 553232 443232"
-
-# fast blinking
-COLORS="ffffff eeeeee dddddd cccccc bbbbbb aaaaaa 888888 777777 666666 555555 444444 555555 666666 777777 888888 aaaaaa bbbbbb cccccc dddddd eeeeee"
-
-while :; do
- for c in $COLORS; do
- CUR=$(pfw)
- test "`wattr wh $CUR`" != "`wattr wh $(lsw -r)`" && chwb -s 2 -c $c $CUR
- sleep $FREQ
- done
-done