summaryrefslogtreecommitdiff
path: root/archive/bin
diff options
context:
space:
mode:
Diffstat (limited to 'archive/bin')
-rwxr-xr-xarchive/bin/bedtime17
-rwxr-xr-xarchive/bin/debian-ftp-master158
-rwxr-xr-xarchive/bin/develacc-please39
-rwxr-xr-xarchive/bin/develacc-second-stage26
-rwxr-xr-xarchive/bin/rt25
-rwxr-xr-xarchive/bin/usbskelhere25
6 files changed, 290 insertions, 0 deletions
diff --git a/archive/bin/bedtime b/archive/bin/bedtime
new file mode 100755
index 00000000..d0fda52f
--- /dev/null
+++ b/archive/bin/bedtime
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+. $HOME/.shenv
+
+# someday, make this work instead:
+# <http://joeyh.name/blog/entry/a_programmable_alarm_clock_using_systemd/>
+
+(($EUID == 0)) || exec sudo "$0" "$@"
+
+WHEN="${1:-tomorrow 6am}"
+CMD="/home/spwhitton/bin/goodmorning"
+
+when=$(date +%s -d "$WHEN")
+
+loginctl lock-sessions
+systemd-inhibit --what=handle-lid-switch --why=goodmorning sh -c \
+ "rtcwake -m mem -t $when && /bin/su spwhitton -c $CMD"
diff --git a/archive/bin/debian-ftp-master b/archive/bin/debian-ftp-master
new file mode 100755
index 00000000..e410c021
--- /dev/null
+++ b/archive/bin/debian-ftp-master
@@ -0,0 +1,158 @@
+#!/bin/bash
+
+# debian-ftp-master -- set up some windows for doing work on Debian's ftp-master
+
+# Copyright (C) 2019 Sean Whitton
+#
+# GPL-3 or later
+
+set -e
+
+. $HOME/.shenv
+
+# # require irssi is already raiseable, as starting it is interactive in
+# # a way we can't easily wait for
+# if ! wmctrl -l | grep -q "irssi"; then
+# zenity --error --no-wrap --text="Please attach to irssi first."
+# exit 1
+# fi
+
+# # kill off any broken session (e.g. lost WiFi)
+# wmctrl -c "ftp-master session cleanup" ||:
+# wmctrl -c "ftp-master dak command session" ||:
+# wmctrl -c "ftp-master GNU mc session" ||:
+# wmctrl -c "*NEW notes*" ||:
+# # wait, in case xfce4-terminal prompted the user
+# while wmctrl -l | grep -q -E "ftp-master (session cleanup|dak command session|GNU mc session)"; do
+# sleep 1
+# done
+
+# # If there are no other Emacs frames open, the title of the frame will
+# # be emacs@$HOST rather than *NEW notes*, which means we can't control
+# # it. So, ensure one is open
+# if ! wmctrl -lx | grep -q "emacs.Emacs"; then
+# emacsclient -c -a '' -n -e '(switch-to-buffer "*scratch*")'
+# fi
+
+# first establish a control socket, so that the two interactive ssh
+# connections don't race to do this and one of them disables multiplexing
+ssh -fN ftp-master.debian.org
+
+# start Emacs on ftp-master
+ssh ftp-master.debian.org pgrep -u spwhitton emacs \
+ || ssh ftp-master.debian.org emacs --daemon &
+
+# # open zenity dialog first; i3 will not float it
+# zenity --question --no-wrap --no-markup \
+# --title="ftp-master session cleanup" \
+# --text="Kill tmux & Emacs sessions on ftp-master?" &
+# zenity_pid=$!
+# until wmctrl -l | grep -q "ftp-master session cleanup"; do
+# sleep 0.3
+# done
+
+monitors="$(xrandr -q | grep ' connected' | wc -l)"
+
+if ! wmctrl -l | grep -q "ftp-master dak command session"; then
+ first="$(i3-fresh-workspace)"
+
+ xfce4-terminal -x ssh-and-tmux \
+ ftp-master.debian.org dak "ftp-master dak command session"
+ until wmctrl -l | grep -q "ftp-master dak command session"; do
+ sleep 0.3
+ done
+ wmctrl -R "ftp-master dak command session"
+
+ # if we have the `layout tabbed` above, before any windows are opened,
+ # the workspace ends up with a tabbed container inside a tabbed
+ # container on buster's i3 (but not stretch's)
+ i3-msg layout tabbed
+
+ xfce4-terminal -x ssh-and-tmux \
+ ftp-master.debian.org mc "ftp-master GNU mc session"
+ until wmctrl -l | grep -q "ftp-master GNU mc session"; do
+ sleep 0.3
+ done
+ wmctrl -R "ftp-master GNU mc session"
+
+ emacsclient -c -a '' -n -e '(progn (switch-to-buffer "*NEW notes*") (text-mode))'
+ until wmctrl -l | grep -q "*NEW notes*"; do
+ sleep 0.3
+ done
+ wmctrl -R "*NEW notes*"
+
+ # Now we've the windows opened, arrange them. For some reason, in
+ # order to have the resize commands take effect, there has to be a
+ # pause before each resize command is issued, i.e. separate i3-msg
+ # calls separated by calls to sleep
+ monwidth="$(xdpyinfo | awk '/dimensions/{print $2}' | cut -dx -f1)"
+ if [ $monitors -gt 1 ] ; then
+ second="$(i3-fresh-workspace)"
+ i3-msg workspace "$first"
+ # ensure mc window is on primary output, since I spend more time
+ # in it (I think this is sensible!)
+ i3-msg move workspace to output primary
+ # move the dak control window
+ i3-msg focus left, focus left, move to workspace "$second"
+ # split windows
+ i3-msg move up
+ sleep 0.2
+ i3-msg resize set height 70 ppt
+ # machine-specific: move workspace 9 to the secondary monitor, if
+ # we know what that's called. Otherwise, user can just manually
+ # move workspace 9 to the correct monitor right after executing
+ # this script; workspace 7 will be left displayed on the primary
+ # monitor
+ if [ "$(hostname -f)" = "iris.silentflame.com" ]; then
+ i3-msg workspace "$second"
+ i3-msg move workspace to output LVDS-1
+ i3-msg workspace "$second"
+ else # no machine-specific config
+ # ensure dak control window focused
+ i3-msg workspace "$first"
+ fi
+ elif [ $monwidth -ge 1920 ]; then
+ # three column split (i.e. two mc columns and dak column) should
+ # work on a monitor this big (after some tweaking of mc's display
+ # settings)
+ i3-msg move down, focus up, focus left, move right, move right, move right
+ sleep 0.2
+ i3-msg resize set width 35 ppt, focus left
+ sleep 0.2
+ i3-msg resize set height 65 ppt, focus right
+ else
+ # small screen view
+ i3-msg focus left, split v, focus right, move left
+ sleep 0.2
+ i3-msg resize set height 30 ppt, focus up, focus left
+ fi
+else
+ wmctrl -a "ftp-master dak command session"
+ if [ "$(hostname -f)" = "iris.silentflame.com" ] \
+ && [ $monitors -gt 1 ]; then
+ i3-msg move workspace to output LVDS-1
+ wmctrl -a "ftp-master GNU mc session"
+ fi
+ i3-msg move workspace to output primary
+fi
+
+# ssh athena tmux send-keys -t irssi DOWN
+# ssh athena tmux send-keys -t irssi "\"/join -OFTC #debian-ftp-private\"" ENTER
+# # ssh athena tmux send-keys -t irssi ! l o c k SPACE N E W
+# # ssh athena tmux send-keys -t irssi LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT
+# i3-msg '[class="^Xfce4-terminal$" title="^irssi$"]' scratchpad show
+
+# # finally, get a little more space in the mc session
+# ssh ftp-master.debian.org tmux set -t mc status off
+
+# # clean everything up, per DMUP
+# wait $zenity_pid
+# zenity_exit=$?
+# wmctrl -c "*NEW notes*" ||:
+# if [ $zenity_exit = 0 ]; then
+# ssh ftp-master.debian.org tmux kill-server
+# ssh ftp-master.debian.org pkill -u spwhitton emacs
+# sleep 10
+# # --title needs to be different from the above so i3 floats the window
+# ssh ftp-master.debian.org pgrep -u spwhitton emacs && zenity --error --no-wrap --title="Session cleanup error" --text="Processes still running on ftp-master!"
+# fi
diff --git a/archive/bin/develacc-please b/archive/bin/develacc-please
new file mode 100755
index 00000000..63d86ecc
--- /dev/null
+++ b/archive/bin/develacc-please
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# Boot or resume develacc and open a VNC viewer. Suspend develacc,
+# mainly to save battery power, when the viewer is closed.
+#
+# This is mainly for when I want to work in develacc for a while, full
+# screen, almost as if my laptop was running sid.
+#
+# For work where I expect to be going back and forth between the VM
+# and the bare metal host or other VMs, it might be better to access
+# the VM via a normal, non-fullscreened virt-manager window rather
+# than full screen virt-viewer. Similarly if I have a large monitor
+# available, it might be more convenient not to have the VM viewer
+# fullscreened
+
+set -e
+
+. $HOME/.shenv
+
+VIRSH="virsh --connect qemu:///system"
+develacc="develacc.$(hostname -f)"
+
+if wmctrl -l | grep -q "$develacc"; then
+ wmctrl -a "$develacc"
+else
+ if $VIRSH list | grep -q "$develacc .*paused"; then
+ $VIRSH resume $develacc
+ elif ! $VIRSH list | grep -q $develacc; then
+ $VIRSH start $develacc
+ fi
+
+ virt-viewer -c qemu:///system --hotkeys=release-cursor=ctrl+alt \
+ -a -f -r $develacc # \
+ # && $VIRSH suspend $develacc &
+ until wmctrl -l | grep -q "$develacc"; do
+ sleep 0.3
+ done
+ i3-fresh-workspace --take-along
+fi
diff --git a/archive/bin/develacc-second-stage b/archive/bin/develacc-second-stage
new file mode 100755
index 00000000..1d95b4e0
--- /dev/null
+++ b/archive/bin/develacc-second-stage
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+. $HOME/.shenv
+
+# ---- configuration
+
+FOXIT="$HOME/lib/annex/big/software/FoxitReader.enu.setup.2.4.4.0911.x64.run.tar.gz"
+DEVELACC="$HOME/local/develacc"
+
+# ---- start develacc
+
+sudo virsh list | grep -q "develacc.$(hostname -f) .*running" \
+ || sudo virsh start develacc.$(hostname -f)
+
+# ---- install FoxitReader
+
+mkdir -p "$DEVELACC/tmp"
+cp -L "$FOXIT" "$DEVELACC/tmp"
+( cd "$DEVELACC/tmp" && tar axf $(basename $FOXIT))
+ssh root@develacc "/home/spwhitton/tmp/FoxitReader.enu.setup.*"
+
+# ---- clone dionysus annex & pair with home directory copy
+
+# TODO
diff --git a/archive/bin/rt b/archive/bin/rt
new file mode 100755
index 00000000..66c8a864
--- /dev/null
+++ b/archive/bin/rt
@@ -0,0 +1,25 @@
+#!/bin/bash
+. $HOME/.shenv
+
+# first check that there exist the dirs we need
+
+if [ ! -e "$HOME/local/rt/watch" -o ! -d "$HOME/local/rt/session" -o ! -d "$HOME/local/rt/incomplete" -o ! -e "$HOME/local/rt/complete" ]; then
+ echo "I was asked to start rtorrent, but one of the dirs in ~/local/rt is missing" >&2
+ echo "(myrepos fixups should do it)" >&2
+ exit 1
+fi
+
+# start rtorrent under dtach if it's not running
+
+if ! pgrep -u $LOGNAME rtorrent >/dev/null; then
+ rm -f $HOME/local/rt/session/dtach.socket
+ TERM=xterm nice -n 19 dtach -n $HOME/local/rt/session/dtach.socket rtorrent
+fi
+
+# if we're not at a dumb terminal (so this script can be shoved in a
+# crontab), try to attach what we (maybe) just made
+
+# this is a bashism
+if [ -t 1 ]; then
+ dtach -a $HOME/local/rt/session/dtach.socket
+fi
diff --git a/archive/bin/usbskelhere b/archive/bin/usbskelhere
new file mode 100755
index 00000000..d242e482
--- /dev/null
+++ b/archive/bin/usbskelhere
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+. $HOME/.shenv
+. $HOME/src/dotfiles/lib-src/tputfs.sh
+
+skelhere ()
+{
+ usbpubkeys
+ mkdir -p doc bin lib
+ cp -RLf ~/lib/annex/big/skel/usb/* .
+ cp ~/src/dotfiles/bin/{apple-setup.sh,dasl-setup.bat} bin
+ cp -L ~/lib/pro.terminal lib
+ cp -L "$HOME/lib/annex/doc/sounds/Rainy Mood pomodoro.mp3" lib
+ zip -j lib/spwhitton.zip lib/*.reg bin/*
+ # status now you might want to clone ~/lib/dionysus\; see comproc.org
+}
+
+while true; do
+ read -p "This might overwrite stuff in $(pwd). Is that okay? " yn
+ case $yn in
+ [Yy]* ) skelhere; break;;
+ [Nn]* ) exit;;
+ * ) echo "Please answer yes or no.";;
+ esac
+done