From d25bfbc4b61da3e905750ae9eb70b5c8983135be Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Mon, 13 Mar 2023 02:41:09 -0700 Subject: restructured directory --- backupz/gitbackup | 20 ++++++++++++++++++++ getlogs | 25 +++++++++++++++++++++++++ resources/quotes.txt | 11 +++++++++++ sh/getlogs | 25 ------------------------- sh/syncmusic | 32 -------------------------------- sh/tmuxstartscript | 19 ------------------- sh/w3msearch | 2 -- shs/backupz/gitbackup | 20 -------------------- shs/quotes.txt | 11 ----------- shs/tmuxsplitscreen | 20 -------------------- shs/writeinfotty | 16 ---------------- syncmusic | 32 ++++++++++++++++++++++++++++++++ tmuxsplitscreen | 20 ++++++++++++++++++++ tmuxstartscript | 19 +++++++++++++++++++ w3msearch | 2 ++ writeinfotty | 16 ++++++++++++++++ 16 files changed, 145 insertions(+), 145 deletions(-) create mode 100755 backupz/gitbackup create mode 100755 getlogs create mode 100644 resources/quotes.txt delete mode 100755 sh/getlogs delete mode 100755 sh/syncmusic delete mode 100755 sh/tmuxstartscript delete mode 100755 sh/w3msearch delete mode 100755 shs/backupz/gitbackup delete mode 100644 shs/quotes.txt delete mode 100755 shs/tmuxsplitscreen delete mode 100755 shs/writeinfotty create mode 100755 syncmusic create mode 100755 tmuxsplitscreen create mode 100755 tmuxstartscript create mode 100755 w3msearch create mode 100755 writeinfotty diff --git a/backupz/gitbackup b/backupz/gitbackup new file mode 100755 index 0000000..7ddce88 --- /dev/null +++ b/backupz/gitbackup @@ -0,0 +1,20 @@ +#!/bin/sh +CDIR=/tmp/backupz-gitbackup.commands +REMOTE=covalent.aberrantflux.xyz +rm $CDIR +for DIR in /srv/git/public /srv/git/private ; do + DNAME=$(basename "$DIR") + echo "mkdir -p /srv/backup/git/new/$DNAME /srv/backup/git/old/$DNAME" >> $CDIR + for REPO in "$DIR"/*.git ; do + RNAME=$(basename "$REPO") + echo "backing up $DNAME repo $RNAME" + SRC=root@canonical.aberrantflux.xyz:$REPO + TDEST=/srv/backup/git/new/$DNAME/$RNAME + FDEST=/srv/backup/git/old/$DNAME/$RNAME + echo "rm -rf $FDEST ; mv $TDEST $FDEST ; git clone --mirror $SRC $TDEST" >> $CDIR + done +done +echo "wrote commands" +cat $CDIR | ssh $REMOTE +rm $CDIR +echo "sent commands & finished clean-up" diff --git a/getlogs b/getlogs new file mode 100755 index 0000000..349c5ac --- /dev/null +++ b/getlogs @@ -0,0 +1,25 @@ +USER=AberrantFlux +REMOTELOGDIR=zncu@aberrantflux.xyz:/home/zncu/.znc/moddata/log/$USER/ +LOGDIR=~/log/irc +NETWORK=AndreiNet +rsync -avzP --rsh=ssh $REMOTELOGDIR $LOGDIR/$USER +echo "Logs available for:" +echo +for CHANNEL in $LOGDIR/$USER/$NETWORK/* +do + DATE=$(date -r $CHANNEL +"%Y-%m-%d %H:%M") + NAME="$(basename $CHANNEL)" + echo "$NAME - last edited $DATE" +done +while : +do + CHANNELSELECTION=exit + read -p "Enter the name of a channel to read the most recent log: [exit] " CHANNELSELECTION + CHANNELSELCTION="${CHANNELSELECTION:=exit}" + if [ $CHANNELSELCTION = exit ]; + then + break + fi + LASTLOG="$(ls -t $LOGDIR/$USER/$NETWORK/$CHANNELSELECTION | head -n1)" + less $LOGDIR/$USER/$NETWORK/$CHANNELSELECTION/$LASTLOG +done diff --git a/resources/quotes.txt b/resources/quotes.txt new file mode 100644 index 0000000..1293464 --- /dev/null +++ b/resources/quotes.txt @@ -0,0 +1,11 @@ +In the lighted inn. +Dying or dead. +There's someone listening in. +So much for small talk. +Fade out again. +Time well spent. +The child ephemeral. +Out of space. +Legal ghost. +Un chien andalou. +On the bed crept doubt. diff --git a/sh/getlogs b/sh/getlogs deleted file mode 100755 index 349c5ac..0000000 --- a/sh/getlogs +++ /dev/null @@ -1,25 +0,0 @@ -USER=AberrantFlux -REMOTELOGDIR=zncu@aberrantflux.xyz:/home/zncu/.znc/moddata/log/$USER/ -LOGDIR=~/log/irc -NETWORK=AndreiNet -rsync -avzP --rsh=ssh $REMOTELOGDIR $LOGDIR/$USER -echo "Logs available for:" -echo -for CHANNEL in $LOGDIR/$USER/$NETWORK/* -do - DATE=$(date -r $CHANNEL +"%Y-%m-%d %H:%M") - NAME="$(basename $CHANNEL)" - echo "$NAME - last edited $DATE" -done -while : -do - CHANNELSELECTION=exit - read -p "Enter the name of a channel to read the most recent log: [exit] " CHANNELSELECTION - CHANNELSELCTION="${CHANNELSELECTION:=exit}" - if [ $CHANNELSELCTION = exit ]; - then - break - fi - LASTLOG="$(ls -t $LOGDIR/$USER/$NETWORK/$CHANNELSELECTION | head -n1)" - less $LOGDIR/$USER/$NETWORK/$CHANNELSELECTION/$LASTLOG -done diff --git a/sh/syncmusic b/sh/syncmusic deleted file mode 100755 index 4b487c9..0000000 --- a/sh/syncmusic +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -REMOTEDIR=root@canonical.aberrantflux.xyz:/srv/music -LOCALDIR=$(pwd) -echo "Remote directory is at $REMOTEDIR" -echo "Local dir is at $LOCALDIR" -echo "To sync from remote to local, enter d. To sync from local to remote, enter u. To cancel, enter c" -printf "Direction: " -read DIRECTION - -if [ $DIRECTION = d ] -then - COMMAND="rsync -avzP $REMOTEDIR/* $LOCALDIR/" - echo "About to run $COMMAND - enter y to continue, or n to cancel" - printf "Confirm: " - read CONFIRMATION - if [ $CONFIRMATION = y ] - then - rsync -avzP $REMOTEDIR/* $LOCALDIR/ - fi -fi - -if [ $DIRECTION = u ] -then - COMMAND="rsync -avzP $LOCALDIR/* $REMOTEDIR/" - echo "About to run $COMMAND - enter y to continue, or n to cancel" - printf "Confirm: " - read CONFIRMATION - if [ $CONFIRMATION = y ] - then - rsync -avzP $LOCALDIR/* $REMOTEDIR/ - fi -fi diff --git a/sh/tmuxstartscript b/sh/tmuxstartscript deleted file mode 100755 index e0281ff..0000000 --- a/sh/tmuxstartscript +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -tmux new-session -d -sleep 0.05 -tmux send-keys "cd ~ ; ls" C-m -tmux split-pane -h -sleep 0.05 -tmux send-keys "cd ~/doc ; ls" C-m -tmux split-pane -v -sleep 0.05 -tmux send-keys "cd ~/src ; ls" C-m -tmux new-window -tmux split-pane -v -sleep 0.05 -tmux send-keys "alsamixer" C-m -tmux split-pane -h -sleep 0.05 -tmux send-keys "cmus" C-m -tmux select-window -t 1 -tmux attach diff --git a/sh/w3msearch b/sh/w3msearch deleted file mode 100755 index e451c58..0000000 --- a/sh/w3msearch +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -w3m www.google.com/search?q="$1" diff --git a/shs/backupz/gitbackup b/shs/backupz/gitbackup deleted file mode 100755 index 7ddce88..0000000 --- a/shs/backupz/gitbackup +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -CDIR=/tmp/backupz-gitbackup.commands -REMOTE=covalent.aberrantflux.xyz -rm $CDIR -for DIR in /srv/git/public /srv/git/private ; do - DNAME=$(basename "$DIR") - echo "mkdir -p /srv/backup/git/new/$DNAME /srv/backup/git/old/$DNAME" >> $CDIR - for REPO in "$DIR"/*.git ; do - RNAME=$(basename "$REPO") - echo "backing up $DNAME repo $RNAME" - SRC=root@canonical.aberrantflux.xyz:$REPO - TDEST=/srv/backup/git/new/$DNAME/$RNAME - FDEST=/srv/backup/git/old/$DNAME/$RNAME - echo "rm -rf $FDEST ; mv $TDEST $FDEST ; git clone --mirror $SRC $TDEST" >> $CDIR - done -done -echo "wrote commands" -cat $CDIR | ssh $REMOTE -rm $CDIR -echo "sent commands & finished clean-up" diff --git a/shs/quotes.txt b/shs/quotes.txt deleted file mode 100644 index 1293464..0000000 --- a/shs/quotes.txt +++ /dev/null @@ -1,11 +0,0 @@ -In the lighted inn. -Dying or dead. -There's someone listening in. -So much for small talk. -Fade out again. -Time well spent. -The child ephemeral. -Out of space. -Legal ghost. -Un chien andalou. -On the bed crept doubt. diff --git a/shs/tmuxsplitscreen b/shs/tmuxsplitscreen deleted file mode 100755 index 9f81bd3..0000000 --- a/shs/tmuxsplitscreen +++ /dev/null @@ -1,20 +0,0 @@ -tmux new-session -d -s userone-internal -tmux new-session -d -s usertwo-internal - -tmux new-session -d -s userone -sleep 0.05 -tmux send-keys -t userone "TMUX=''" C-m -tmux send-keys -t userone "tmux attach -t usertwo-internal" C-m -tmux split-pane -t userone -h -sleep 0.05 -tmux send-keys -t userone "TMUX=''" C-m -tmux send-keys -t userone "tmux attach -t userone-internal" C-m - -tmux new-session -d -s usertwo -sleep 0.05 -tmux send-keys -t usertwo "TMUX=''" C-m -tmux send-keys -t usertwo "tmux attach -t userone-internal" C-m -tmux split-pane -t usertwo -h -sleep 0.05 -tmux send-keys -t usertwo "TMUX=''" C-m -tmux send-keys -t usertwo "tmux attach -t usertwo-internal" C-m diff --git a/shs/writeinfotty b/shs/writeinfotty deleted file mode 100755 index 66de080..0000000 --- a/shs/writeinfotty +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -OUT="/dev/tty1" -QUOTES="/usr/local/share/abrquotes/quotes.txt" -TAGLINE="canonical" - -BUF="$BUF \n$(figlet -w 200 $(shuf -n 1 $QUOTES))" -BUF="$BUF \n$(figlet -w 200 "$HOSTNAME % $TAGLINE.")" -BUF="$BUF \n$(figlet -w 200 $(date +"%a. %I:%M."))" -BUF="$BUF\n" -BUF="$BUF $(neofetch)" -BUF="$BUF\n" -BUF="$BUF $(mpc stats)" -BUF="$BUF\nKai Stevenson 2023" - -printf "\033[2J" > $OUT -printf "$BUF" > $OUT diff --git a/syncmusic b/syncmusic new file mode 100755 index 0000000..4b487c9 --- /dev/null +++ b/syncmusic @@ -0,0 +1,32 @@ +#!/bin/sh +REMOTEDIR=root@canonical.aberrantflux.xyz:/srv/music +LOCALDIR=$(pwd) +echo "Remote directory is at $REMOTEDIR" +echo "Local dir is at $LOCALDIR" +echo "To sync from remote to local, enter d. To sync from local to remote, enter u. To cancel, enter c" +printf "Direction: " +read DIRECTION + +if [ $DIRECTION = d ] +then + COMMAND="rsync -avzP $REMOTEDIR/* $LOCALDIR/" + echo "About to run $COMMAND - enter y to continue, or n to cancel" + printf "Confirm: " + read CONFIRMATION + if [ $CONFIRMATION = y ] + then + rsync -avzP $REMOTEDIR/* $LOCALDIR/ + fi +fi + +if [ $DIRECTION = u ] +then + COMMAND="rsync -avzP $LOCALDIR/* $REMOTEDIR/" + echo "About to run $COMMAND - enter y to continue, or n to cancel" + printf "Confirm: " + read CONFIRMATION + if [ $CONFIRMATION = y ] + then + rsync -avzP $LOCALDIR/* $REMOTEDIR/ + fi +fi diff --git a/tmuxsplitscreen b/tmuxsplitscreen new file mode 100755 index 0000000..9f81bd3 --- /dev/null +++ b/tmuxsplitscreen @@ -0,0 +1,20 @@ +tmux new-session -d -s userone-internal +tmux new-session -d -s usertwo-internal + +tmux new-session -d -s userone +sleep 0.05 +tmux send-keys -t userone "TMUX=''" C-m +tmux send-keys -t userone "tmux attach -t usertwo-internal" C-m +tmux split-pane -t userone -h +sleep 0.05 +tmux send-keys -t userone "TMUX=''" C-m +tmux send-keys -t userone "tmux attach -t userone-internal" C-m + +tmux new-session -d -s usertwo +sleep 0.05 +tmux send-keys -t usertwo "TMUX=''" C-m +tmux send-keys -t usertwo "tmux attach -t userone-internal" C-m +tmux split-pane -t usertwo -h +sleep 0.05 +tmux send-keys -t usertwo "TMUX=''" C-m +tmux send-keys -t usertwo "tmux attach -t usertwo-internal" C-m diff --git a/tmuxstartscript b/tmuxstartscript new file mode 100755 index 0000000..e0281ff --- /dev/null +++ b/tmuxstartscript @@ -0,0 +1,19 @@ +#!/bin/sh +tmux new-session -d +sleep 0.05 +tmux send-keys "cd ~ ; ls" C-m +tmux split-pane -h +sleep 0.05 +tmux send-keys "cd ~/doc ; ls" C-m +tmux split-pane -v +sleep 0.05 +tmux send-keys "cd ~/src ; ls" C-m +tmux new-window +tmux split-pane -v +sleep 0.05 +tmux send-keys "alsamixer" C-m +tmux split-pane -h +sleep 0.05 +tmux send-keys "cmus" C-m +tmux select-window -t 1 +tmux attach diff --git a/w3msearch b/w3msearch new file mode 100755 index 0000000..e451c58 --- /dev/null +++ b/w3msearch @@ -0,0 +1,2 @@ +#!/bin/sh +w3m www.google.com/search?q="$1" diff --git a/writeinfotty b/writeinfotty new file mode 100755 index 0000000..66de080 --- /dev/null +++ b/writeinfotty @@ -0,0 +1,16 @@ +#!/bin/sh +OUT="/dev/tty1" +QUOTES="/usr/local/share/abrquotes/quotes.txt" +TAGLINE="canonical" + +BUF="$BUF \n$(figlet -w 200 $(shuf -n 1 $QUOTES))" +BUF="$BUF \n$(figlet -w 200 "$HOSTNAME % $TAGLINE.")" +BUF="$BUF \n$(figlet -w 200 $(date +"%a. %I:%M."))" +BUF="$BUF\n" +BUF="$BUF $(neofetch)" +BUF="$BUF\n" +BUF="$BUF $(mpc stats)" +BUF="$BUF\nKai Stevenson 2023" + +printf "\033[2J" > $OUT +printf "$BUF" > $OUT -- cgit v1.3.1