THEAARBS sysadmin - nets - 2018-12-29 13:18:36

Raw #!/bin/bash # Bound to Mod+n # Set menu properties mymenu=$(setmenu -l) # Where network documents are stored Docs="/home/$USER/Documents/networks/" # Where should log files be stored Logs="/home/$USER/Logs/" MenuChoices=\ "Info Servers Networking Workstations Printers Ping PullRC Reboot ShoVer Time Entry VPN" runprefix= tty=$(tty) case $tty in *tty1|"not a tty") runprefix="$TERMINAL -e" ;; esac ClearExit() { clear exit 0 } SecurePW() { PassFile=$(mktemp) echo "$Password" >$PassFile } Say() { (echo "$1" "$2" | lolcat) notify-send "$1" "$2" } MainMenu() { Chosen=$(cat /tmp/nets-names | $mymenu "Choose a network:") || ClearExit clear [[ $Chosen = "Time Entry" ]] && timeentry && ClearExit for i in $Docs* ; do [[ $Chosen = $( (sed "3q;d" $i) | awk '{print $2;}' | cut -d '"' -f2) ]] && Document=$i done [[ -z $Document ]] && ClearExit ScanDoc $Document CommandMenu } CommandMenu() { CommandChoice=$(echo -e "$MenuChoices" | $mymenu "$Network Command:") clear [[ -z $CommandChoice ]] && ClearExit case $CommandChoice in "Info") openfile $Document ; exit 0 ;; "Time Entry") timeentry $Network ; exit 0 ;; "VPN") connectvpn "$VPNType" "$VPNName" "$Network" ; exit 0 ;; *) SubMenu ;; esac } SubMenu() { case $CommandChoice in Ping) ChosenHost=$(echo -e "$ServerChoices\n$SwitchChoices\n$WorkPCChoices\n$DeviceChoices" | \ $mymenu "$Network Choose a device to ping:") ;; Reboot) ChosenHost=$(echo -e "$ServerChoices" | $mymenu "$Network Choose a device to reboot:") ;; PullRC) ChosenHost=$(echo -e "$CiscoChoices\nALL!

THEAARBS tools - linkhandler - 2018-12-28 09:17:26

Raw #!/bin/bash # Imgur client id # Required for indirect imgur links imgurClientId="" # Temp file directory tmpDir="/tmp/linkhandler" # Handlers imgHandler="feh" gifHandler="mpv --quiet --loop" vidHandler="mpv --quiet" dwnHandler="tsp wget" bcpHandler="bandcamp-dl" redHandler="rtv" browser=$BROWSER ## Templates imgFiles="png apng jpg jpeg jpe bmp tiff" # Images imgSites="i.imgur.com/ \|i.redd.it/ \|deviantart.com/ \|tinypic.com/ \|unsplash.com/photos/ \|gyazo.com/ \|prnt.sc/ " gifFiles="gif webm" # Gifs gifSites="gfycat.com/ \|giphy.com/ \|gph.is/ \|gifbin.com/ \|clips.twitch.tv/ \|streamable.com/ " vidFiles="mkv mp4 mov mpv flv avi" # Video vidSites="youtube.

THEAARBS menus - netmenu - 2018-10-05 22:47:05

Raw #!/bin/bash # Network tools menu # Bound to Mod+F6 mymenu=$(setmenu -l) IOFile=$(mktemp) amitty=$(tty) case $amitty in *tty1|"not a tty") runprefix="$TERMINAL -o $IOFile -e" ;; esac MenuChoices=\ "cisco connect to dig killvpn nmtui nmgui clonesite ping pingsubnet smtp ssh keys ssl query speedof lan speedof wifi speedof wan trace route newnet vm vnc whois winbox wireshark" MenuCommands() { case $choice in "cisco") Menu_Cisco ;; "killvpn") killvpn ;; "nmtui") $runprefix nmtui ;; "nmgui") nm-connection-editor ;; "clonesite") Util_CloneSite ;; "connect to") Menu_ConnectTo ;; "ping") $runprefix cping $(inprompt "Hostname or IP:") ;; "pingsubnet") $(ifinstalled nmap) && $runprefix pingsubnet $(inprompt "Subnet to ping:") ;; "smtp") Menu_SMTP ;; "ssh keys") Menu_SSH ;; "ssl query") Util_SSLQuery ;; "speedof lan") $runprefix speedof -l ;; "speedof wifi") $runprefix speedof -w ;; "speedof wan") speedof -i ;; "trace route") $(ifinstalled traceroute) && Util_TraceRoute ;; "newnet") sudo systemctl restart NetworkManager ;; "dig") $(ifinstalled dig) && Util_Dig ;; "vm") $(ifinstalled virtualbox) && Menu_VM ;; "vnc") $(ifinstalled vncviewer) && vncviewer ;; "whois") $(ifinstalled whois) && Util_Whois ;; "winbox") $(ifinstalled winbox) && winbox ;; "wireshark") $(ifinstalled wireshark-gtk) && sudo wireshark-gtk ;; esac } Say() { (echo "$1" "$2" | lolcat) notify-send "$1" "$2" } GetKeyFile() { KeyFile="$(find /home/$USER/.

THEAARBS tools - speedof - 2018-08-04 13:03:49

Raw #!/bin/bash Say() { echo -e "$1\n$2" ; notify-send "$1" "$2" ;} get_interfaces() { for i in $all_interfaces ; do interface_name="${BLOCK_INSTANCE:-$i}" case $interface_name in eno*|eth*) LanInterface=$interface_name ;; wlp*|wlan*) WLanInterface=$interface_name ;; esac done ;} speed_meter() { $(ifinstalled speedometer) && all_interfaces=$(ls /sys/class/net) get_interfaces $all_interfaces case $1 in lan) the_interface=$LanInterface ;; wlan) the_interface=$WLanInterface ;; esac [[ -z $(ip addr show $the_interface | perl -n -e '/inet ([^\/]+)/ && print $1') ]] && Say "⛔ Error: interface $the_interface is not connected" || speedometer -t $the_interface ;} get_speedlimits() { $(ifinstalled speedtest) && Say "⌛ Testing internet speeds.

THEAARBS tools - syncworkflow - 2018-07-07 03:11:46

Raw #!/bin/bash # Bound to Mod+UpArrow and Mod+DownArrow MenuChoices=\ "all browsers calendar documents dotfiles hosts hugo pictures projects scripts ssh vpn" choices=${MenuChoices//'\n'/ } choices=($choices) # Set dmenu properties mymenu=$(setmenu -l) # # --- User-defined variables # ServerHost should also be defined in ~/.ssh/config # for key-authenticated sshfs connections to the # backup repository ServerHost="nas" # SyncPath should be the path to a writeable directory # inside your backup repository SyncPath="/media/home-nas/6eece2a2-d4d4-47d6-bb12-ae9db150e8e6/rsync_computers" # NASMountRoot is the 'root' directory of your # backup repository; this will be mounted to a local # directory NASMountRoot=".

ASSSS -- A Simple Server Sync Script - 2018-05-06 03:11:46

Raw #!/bin/bash # A Simple Server Sync Script ### Required packages # rsync -- runs the data sync process # cifs-utils -- for windows/smb shares # sshfs -- for ssh mounts # msmtp -- for email notifications ### User-defined variables # Name the backup job BackupName="Client Name Backup" # The path where logs should be stored LogFolder="$HOME/Logs/client" # The path to the source/root folder to be backed up SourcePath="/media/clientmounts/client-name" # The path to the backup target/repository TargetPath="/media/repo-name/client-name/sync" # The command used to mount the backup source SourceMountCommand="sshfs hostname.

THEAARBS menus - search - 2018-05-06 03:11:46

Raw #!/bin/bash # A menu script for easy web searching. # Bound to Mod+s SearchSites=\ "DuckDuckGo ArchWiki BandCamp IMDB Reddit Rev Wikipedia YouTube" SearchCommands() { case "$Choice" in r|Reddit) $runprefix rtv -s "$Query" ;; yt|YouTube) $runprefix youtube-viewer $Query ;; rev|Rev) $BROWSER "https://revolutiontt.me/browse.php?search=$Query" ;; ddg|DuckDuckGo) $BROWSER "https://duckduckgo.com/?q=$Query&t=ffab&atb=v1-1" ;; aw|ArchWiki) $BROWSER "https://wiki.archlinux.org/index.php?search=$Query" ;; w|Wikipedia) $BROWSER "https://en.wikipedia.org/?search=$Query" ;; bc|BandCamp) $BROWSER "https://bandcamp.com/search?q=$Query" ;; im|IMDB) $BROWSER "http://www.imdb.com/find?ref_=nv_sr_fn&q=$Query&s=all" ;; esac ;} runprefix= mymenu=$(setmenu -l) Query=${@:2} Choice=$1 amitty=$(tty) case $amitty in *tty1|"not a tty") runprefix="$TERMINAL -e" ;; esac if [ -z "$Choice" ]; then Choice=$(echo -e "$SearchSites" | $mymenu "🔎 Search where") ; fi if [ -z "$Query" ]; then Query=$(inprompt "🔎 Search terms") ; fi if [ -z "$Query" ]; then clear ; exit 1 ; fi if [ -z "$Choice" ]; then Choice="ddg" ; fi SearchCommands clear

THEAARBS tools - backup - 2018-05-06 03:11:46

Raw #!/bin/bash # Bound to Mod+Backspace # Set menu properties mymenu=$(setmenu) # # --- User-defined variables # ServerHost should also be defined in ~/.ssh/config # for key-authenticated sshfs connections to the # backup repository ServerHost="nas" # NASPath should be the path to a writeable directory # inside your backup repository NASPath="/media/home-nas/9c360a84-078b-4cc5-9515-a38f3f84daa5/backup" # NASMountRoot is the 'root' directory of your # backup repository; this will be mounted to a local # directory NASMountRoot=".

THEAARBS menus - config - 2018-05-05 22:59:24

Raw #!/bin/bash # A menu script for conveniently accessing config files # Bound to Mod+F2 # Each menu choice has a file to edit # or command to run in the MenuCommands() function MenuChoices=\ "alias appearance audio backup bash bookmarks contacts disks hosts i3 i3blocks input mpd mpv mutt newsboat printers profile ranger rss screens scripts ssh startup surf synergy tmux vim x zathura" MenuCommands(){ case $chosen in alias) openfile ~/.

THEAARBS menus - recordmenu - 2018-05-05 22:47:05

Raw #!/bin/bash # Recording options menu # Bound to Mod+Insert # Usage: # `record`: Ask for recording type via dmenu # `record screencast`: Record both audio and screen # `record video`: Record only screen # `record audio`: Record only audio # `record kill`: Kill existing recording # # If there is already a running instance, user will be prompted to end it. mymenu=$(setmenu -l) updateicon() { \ echo "$1" > /tmp/recordingicon pkill -RTMIN+9 i3blocks } killrecording() { recpid="$(cat /tmp/recordingpid)" # kill with SIGTERM, allowing finishing touches.

THEAARBS tools - publish - 2018-05-05 03:11:46

Raw #!/bin/bash # Bound to Mod+Shift+Backspace # Publish a Hugo site to a remote server # User-defined variables are set in # ~/.config/hugosites.conf file Say() { echo "$1" "$2" ; notify-send "$1" "$2" ; echo "$1" "$2" >> $LogFile ;} ConfigFile="/home/$USER/.config/hugosites.conf" ConfigFiletmp='/tmp/hugosites.conf' if egrep -q -v '^#|^[^ ]*=[^;]*' "$ConfigFile" then Say "🗞️ Config file is unclean, cleaning it..." egrep '^#|^[^ ]*=[^;&]*' "$ConfigFile" > "$ConfigFiletmp" cp "$ConfigFiletmp" "$ConfigFile" fi source "$ConfigFile" runprefix= # Set menu properties mymenu=$(setmenu -l) amitty=$(tty) case $amitty in *tty1|"not a tty") runprefix="$TERMINAL -e" ;; esac mkdir -p $PathToLogs/push LogFile="$PathToLogs/push/$(date +%b%d)/$(date +%H%M).

THEAARBS menus - dmenuhandler - 2018-04-29 09:17:26

Raw #!/bin/bash # Feed this script a URL and choose what opens it # Bound to Mod+y MenuChoices=\ "$READER $IMGVIEWER $BROWSER w3m mpv mpv (loop) mpv (float) wget stream-dl bandcamp-dl" runprefix= mymenu=$(setmenu -l) amitty=$(tty) case $amitty in *tty1|"not a tty") runprefix="$TERMINAL -e" ;; esac if [ -z $1 ] ; then url=$(inprompt "URL:") || exit else url=$1 ; fi handle_url() { if [[ "${#1}" -gt 30 ]] then visual="${1:0:20}"..."${1: -7}" else visual="$1" fi echo $visual choice=$(echo -e "$MenuChoices" | $mymenu "Handler for $visual:") clear case "$choice" in "$READER") $runprefix $READER "$1" &disown ;; "IMGVIEWER") $IMGVIEWER "$1" &disown ;; "$BROWSER") $BROWSER "$1" & disown ;; w3m) $runprefix w3m "$1" ;; mpv) mpv -quiet "$1" & disown ;; "mpv (loop)") mpv -quiet --loop "$1" & disown ;; "mpv (float)") mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" /dev/video0 "$1" & disown ;; wget) wget "$1" & disown ;; stream-dl) youtube-dl "$1" & disown ;; bandcamp-dl) cd ~/Downloads bandcamp-dl "$1" >/dev/null && notify-send "👍 Finished downloading" "$(basename $1)" || notify-send "⛔ Error downloading" "$(basename $1)" ;; esac ;} handle_url $url

THEAARBS tools - extract - 2016-05-04 13:03:49

Raw #!/bin/bash Dir=$(pwd) Say() { echo "$1" "$2" | lolcat ; notify-send "$1" "$2" ;} MultipleFiles() { for f in $Dir/* do ExtractFile $(basename $f) done ;} ExtractFile() { Name=${1%.*} mkdir $Name && cd $Name case $1 in *.tar.bz2|*.tbz2) Com="tar xvjf ../$1" ;; *.tar.gz|*.tgz) Com="tar xvzf ../$1" ;; *.tar.xz) Com="tar xvJf ../$1" ;; *.tar) Com="tar xvf ../$1" ;; *.lzma) Com="unlzma ../$1" ;; *.bz2) Com="bunzip2 ../$1" ;; *.rar) Com="unrar x -ad .