From 31d0c02b0c7644d524f6f7a48af3dd1a65abaa2c Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Wed, 13 May 2020 17:54:18 -0400 Subject: renamed and deleted old scripts --- compiz-install.sh | 8 -------- dmenu-ssid.sh | 12 ------------ do_gen_base64key | 6 ------ do_gen_favicon | 19 ------------------- do_gen_gif | 21 --------------------- do_gen_meme | 12 ------------ do_split_cert | 3 --- docked.sh | 1 + dwm-fkeys.sh | 18 ------------------ dwm-launch.sh | 19 ------------------- dwm-status.sh | 12 ------------ findport.sh | 4 ++++ gen_base64key.sh | 6 ++++++ gen_favicon | 2 -- gen_favicon.sh | 19 +++++++++++++++++++ gen_meme.sh | 12 ++++++++++++ giffeinate | 22 ---------------------- giffeinate.sh | 22 ++++++++++++++++++++++ i3blocks-cpuload.sh | 8 +++++--- i3blocks-memory.sh | 2 +- mounter | 20 -------------------- mounter.sh | 20 ++++++++++++++++++++ mutt-open.sh | 3 +++ open-with-mutt | 3 --- ripper | 21 --------------------- ripper.sh | 21 +++++++++++++++++++++ split_cert.sh | 3 +++ status.sh | 8 -------- umounter | 21 --------------------- undocked.sh | 1 + unmounter.sh | 21 +++++++++++++++++++++ yt | 34 ---------------------------------- yt-player.sh | 34 ++++++++++++++++++++++++++++++++++ 33 files changed, 173 insertions(+), 265 deletions(-) delete mode 100755 compiz-install.sh delete mode 100755 dmenu-ssid.sh delete mode 100755 do_gen_base64key delete mode 100755 do_gen_favicon delete mode 100755 do_gen_gif delete mode 100755 do_gen_meme delete mode 100755 do_split_cert delete mode 100755 dwm-fkeys.sh delete mode 100755 dwm-launch.sh delete mode 100755 dwm-status.sh create mode 100755 findport.sh create mode 100755 gen_base64key.sh delete mode 100755 gen_favicon create mode 100755 gen_favicon.sh create mode 100755 gen_meme.sh delete mode 100755 giffeinate create mode 100755 giffeinate.sh delete mode 100755 mounter create mode 100755 mounter.sh create mode 100755 mutt-open.sh delete mode 100755 open-with-mutt delete mode 100755 ripper create mode 100755 ripper.sh create mode 100755 split_cert.sh delete mode 100755 status.sh delete mode 100755 umounter create mode 100755 unmounter.sh delete mode 100755 yt create mode 100755 yt-player.sh diff --git a/compiz-install.sh b/compiz-install.sh deleted file mode 100755 index 6625de6..0000000 --- a/compiz-install.sh +++ /dev/null @@ -1,8 +0,0 @@ -cd /tmp -mkdir aur -cd aur -wget https://aur.archlinux.org/cgit/aur.git/snapshot/compiz-core.tar.gz -tar xzvf compiz-core.tar.gz -cd compiz-core -makepkg -rs -sudo pacman -U compiz*.xz diff --git a/dmenu-ssid.sh b/dmenu-ssid.sh deleted file mode 100755 index fdffc02..0000000 --- a/dmenu-ssid.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -prompt=$(ifconfig | egrep -o '"(.*)"') -ssids=$(ifconfig wlan0 scan | cut -c 1-32 | awk 'NF' ) - - - -ssid=$( -dmenu -c -l 10 -p "$prompt" << EOF -$ssids -EOF -) diff --git a/do_gen_base64key b/do_gen_base64key deleted file mode 100755 index fd4eab5..0000000 --- a/do_gen_base64key +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -#$key=$(dd status=none if=/dev/urandom bs=512 count=4) -# base64 -w 0 -#echo "$key" | xclip -o -dd status=none if=/dev/urandom bs=512 count=4 | base64 -w 0 | xclip -i -echo Copied. diff --git a/do_gen_favicon b/do_gen_favicon deleted file mode 100755 index a7bbc66..0000000 --- a/do_gen_favicon +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -SIZES="16 32 64 128 256" - -[[ -z $1 ]] && exit 1; -temp_dir=$(mktemp -d /tmp/favicon.XXXXXXXXXX) - -for size in $SIZES -do - convert "$1" \ - -depth 8 \ - -background transparent \ - -flatten \ - -resize \ - "${size}x${size}" \ - "$temp_dir/$size.png" -done - -convert "$temp_dir/*" favicon.ico diff --git a/do_gen_gif b/do_gen_gif deleted file mode 100755 index bcd3b0c..0000000 --- a/do_gen_gif +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# Turn video files on STDIN into GIFs. - -FPS=${FPS:-10} -SCALE=${SCALE:-480} - -while [ $1 ] -do - BASENAME=$(echo $1 | cut -d'.' -f1) - FRAMEDIR=/tmp/$BASENAME-frames-$(date +%s) - - mkdir -p $FRAMEDIR - echo Writing frames... - ffmpeg -loglevel quiet -i $1 -vf scale=-1:$SCALE,fps=$FPS $FRAMEDIR/%05d.png - echo Creating GIF... - convert -loop 0 $FRAMEDIR/*.png $BASENAME.gif - rm -r $FRAMEDIR - echo Done. - shift -done diff --git a/do_gen_meme b/do_gen_meme deleted file mode 100755 index 258dba8..0000000 --- a/do_gen_meme +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Construct a memebot query from a list of memes and entered text. - -meme=$(dmenu -l 10 -p "Which meme?" < ~/.local/bin/.memes) -echo Top text? -read top -echo Bottom text? -read bottom -echo "$top,$bottom | $meme" | xclip -i -echo Copied. - diff --git a/do_split_cert b/do_split_cert deleted file mode 100755 index 0c58142..0000000 --- a/do_split_cert +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -openssl pkcs12 -in "$1" -nocerts -out "$1.pem" -nodes -openssl pkcs12 -in "$1" -nokeys -out "$1.crt" diff --git a/docked.sh b/docked.sh index 00b8a3c..22393d2 100755 --- a/docked.sh +++ b/docked.sh @@ -1,2 +1,3 @@ #!/bin/sh +xrandr xrandr --output VGA-0 --mode 1024x768 --pos 1920x312 --rotate normal --dpi 82 --output DP-0 --off --output DP-1 --off --output DP-2 --off --output DP-3 --primary --mode 1920x1080 --pos 0x0 --rotate normal --dpi 96 --output DP-4 --off diff --git a/dwm-fkeys.sh b/dwm-fkeys.sh deleted file mode 100755 index c656161..0000000 --- a/dwm-fkeys.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -choice=$( -dmenu -l 12 -i -b -p [Fn]: << EOF -F1: File Manager [Sleep] -F2: Wifi Scanner -F3: Browser -F4: Email -F5: Brightness Down -F6: Brightness Up -F7: Unused [Blank Screen] -F8: Mounter [Unmounter] -F9: Unused -F10: Unused [Vol Mute] -F11: Unused [Vol Down] -F12: Unused [Vol Up] -EOF -) diff --git a/dwm-launch.sh b/dwm-launch.sh deleted file mode 100755 index 62e4eba..0000000 --- a/dwm-launch.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -compton -cCGb -feh --bg-fill /var/wallpaper -xrdb ~/.Xresources -xautolock -locker ~/source/scripts/slock-fortune.sh & -~/source/scripts/dwm-status.sh & - -logfile="/var/log/dwm.log" - -while true; do - - if [ -O $logfile ]; then - dwm 2> $logfile - else - dwm 2>&1 > /dev/null - fi - -done diff --git a/dwm-status.sh b/dwm-status.sh deleted file mode 100755 index 52ad773..0000000 --- a/dwm-status.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -while true -do - date=$(date "+%a %b %d %I:%M %p") - batt=$(acpiconf -i 0 | egrep -o "([0-9]+%)") - disk=$(df -H | awk '{ if ($6 == "/") print $4 }') - #ssid=$(ifconfig | egrep -o '*ssid (.*) ') - idle=$(top -n | egrep -o '[0-9]+\.[0-9]% idle') - xsetroot -name "$ssid $idle $disk free $batt charged $date" - sleep 5 -done diff --git a/findport.sh b/findport.sh new file mode 100755 index 0000000..9aa11d9 --- /dev/null +++ b/findport.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +find /usr/local/poudriere/ports/default -type d -name "*$1*" + diff --git a/gen_base64key.sh b/gen_base64key.sh new file mode 100755 index 0000000..fd4eab5 --- /dev/null +++ b/gen_base64key.sh @@ -0,0 +1,6 @@ +#!/bin/sh +#$key=$(dd status=none if=/dev/urandom bs=512 count=4) +# base64 -w 0 +#echo "$key" | xclip -o +dd status=none if=/dev/urandom bs=512 count=4 | base64 -w 0 | xclip -i +echo Copied. diff --git a/gen_favicon b/gen_favicon deleted file mode 100755 index b65950a..0000000 --- a/gen_favicon +++ /dev/null @@ -1,2 +0,0 @@ -convert -define icon:auto-resize=72,64,48,32,16 logo.png -thumbnail "72x72>" \ - -background transparent -gravity center -extent 64x64 favicon.ico diff --git a/gen_favicon.sh b/gen_favicon.sh new file mode 100755 index 0000000..a7bbc66 --- /dev/null +++ b/gen_favicon.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +SIZES="16 32 64 128 256" + +[[ -z $1 ]] && exit 1; +temp_dir=$(mktemp -d /tmp/favicon.XXXXXXXXXX) + +for size in $SIZES +do + convert "$1" \ + -depth 8 \ + -background transparent \ + -flatten \ + -resize \ + "${size}x${size}" \ + "$temp_dir/$size.png" +done + +convert "$temp_dir/*" favicon.ico diff --git a/gen_meme.sh b/gen_meme.sh new file mode 100755 index 0000000..258dba8 --- /dev/null +++ b/gen_meme.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Construct a memebot query from a list of memes and entered text. + +meme=$(dmenu -l 10 -p "Which meme?" < ~/.local/bin/.memes) +echo Top text? +read top +echo Bottom text? +read bottom +echo "$top,$bottom | $meme" | xclip -i +echo Copied. + diff --git a/giffeinate b/giffeinate deleted file mode 100755 index 8e59600..0000000 --- a/giffeinate +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# Turn video files on STDIN into animated GIFs. - -FPS=${FPS:-10} -SCALE=${SCALE:-480} - -while [ $1 ] -do - BASENAME=$(echo $1 | cut -d'.' -f1) - FRAMEDIR=/tmp/$BASENAME-frames-$(date +%s) - - mkdir -p $FRAMEDIR - echo Writing frames... - ffmpeg -loglevel quiet -i $1 -vf scale=-1:$SCALE,fps=$FPS $FRAMEDIR/%05d.png - echo Creating GIF... - convert -loop 0 $FRAMEDIR/*.png $BASENAME.gif - rm -r $FRAMEDIR - echo Done. - shift -done - diff --git a/giffeinate.sh b/giffeinate.sh new file mode 100755 index 0000000..8e59600 --- /dev/null +++ b/giffeinate.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Turn video files on STDIN into animated GIFs. + +FPS=${FPS:-10} +SCALE=${SCALE:-480} + +while [ $1 ] +do + BASENAME=$(echo $1 | cut -d'.' -f1) + FRAMEDIR=/tmp/$BASENAME-frames-$(date +%s) + + mkdir -p $FRAMEDIR + echo Writing frames... + ffmpeg -loglevel quiet -i $1 -vf scale=-1:$SCALE,fps=$FPS $FRAMEDIR/%05d.png + echo Creating GIF... + convert -loop 0 $FRAMEDIR/*.png $BASENAME.gif + rm -r $FRAMEDIR + echo Done. + shift +done + diff --git a/i3blocks-cpuload.sh b/i3blocks-cpuload.sh index 8d61815..dd30311 100755 --- a/i3blocks-cpuload.sh +++ b/i3blocks-cpuload.sh @@ -1,16 +1,18 @@ #!/bin/sh -cpu_count=4 low=25 high=75 icon_low=󰒲 icon_mid=󰜎 icon_high=󱅝 -#min_avg_usage=$(vmstat | tail -1 | cut -w -f17) +cpu_count=$(sysctl -n hw.ncpu) avg_load=$(sysctl vm.loadavg | cut -w -f3) percent=$(echo "result = $avg_load / $cpu_count * 100; scale=0; result / 1" | bc -l) +mhz=$(sysctl -n dev.cpu.0.freq) +ghz=$(echo "result = $mhz / 1000; scale=1; result / 1" | bc -l) + [ $percent -lt $low ] && printf $icon_low [ $percent -ge $low ] && [ $percent -lt $high ] && printf $icon_mid [ $percent -ge $high ] && printf $icon_high -printf " %s%%\n" $percent +printf " %s%% %s GHz\n" $percent $ghz diff --git a/i3blocks-memory.sh b/i3blocks-memory.sh index e40c2df..308b2b1 100755 --- a/i3blocks-memory.sh +++ b/i3blocks-memory.sh @@ -1,4 +1,4 @@ #!/bin/sh icon=󰍛 -printf "$icon %s\n" $(vmstat -h | tail -1 | cut -w -f5) +printf "$icon %s\n" $(top -d 1 | grep Mem | cut -w -f2) diff --git a/mounter b/mounter deleted file mode 100755 index 98f0c13..0000000 --- a/mounter +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Get list of possible partitions to mount. Only select partitions that have -# not been mounted and display their name and size as dmenu options. -parts=$( - lsblk -nlpo NAME,SIZE,TYPE,MOUNTPOINT | grep "part $" | cut -f 1,4 -d' ' -) -[[ -z $parts ]] && exit 1 - -# Prompt for partition to mount. -choice=$( - echo "$parts" | dmenu -i -p "Mount which partition?" | cut -f 1 -d' ' -) -[[ -z $choice ]] && exit 1 - -# Create a mount directory if none exists. Use UUID for unique name. -mntdir="/mnt/$(lsblk -n "$choice" -o UUID | cut -f 1 -d' ')" -sudo mkdir -p "$mntdir" -sudo mount "$choice" "$mntdir" - diff --git a/mounter.sh b/mounter.sh new file mode 100755 index 0000000..98f0c13 --- /dev/null +++ b/mounter.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Get list of possible partitions to mount. Only select partitions that have +# not been mounted and display their name and size as dmenu options. +parts=$( + lsblk -nlpo NAME,SIZE,TYPE,MOUNTPOINT | grep "part $" | cut -f 1,4 -d' ' +) +[[ -z $parts ]] && exit 1 + +# Prompt for partition to mount. +choice=$( + echo "$parts" | dmenu -i -p "Mount which partition?" | cut -f 1 -d' ' +) +[[ -z $choice ]] && exit 1 + +# Create a mount directory if none exists. Use UUID for unique name. +mntdir="/mnt/$(lsblk -n "$choice" -o UUID | cut -f 1 -d' ')" +sudo mkdir -p "$mntdir" +sudo mount "$choice" "$mntdir" + diff --git a/mutt-open.sh b/mutt-open.sh new file mode 100755 index 0000000..162c4cf --- /dev/null +++ b/mutt-open.sh @@ -0,0 +1,3 @@ +#!/bin/sh +exec urxvt -e mutt -F ~/.muttrc "$@" + diff --git a/open-with-mutt b/open-with-mutt deleted file mode 100755 index 162c4cf..0000000 --- a/open-with-mutt +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -exec urxvt -e mutt -F ~/.muttrc "$@" - diff --git a/ripper b/ripper deleted file mode 100755 index 627012d..0000000 --- a/ripper +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# Magically makes things work. -sudo modprobe sg - -# Make sure scratch disk is available to rip to. -mountpoint /scratch || mount /scratch || exit 1 -echo "Mounted!" - -# Rip discs until told otherwise. -while : -do - outdir=$(mktemp -d /scratch/makemkvcon.XXXXX) - makemkvcon -r mkv disc:0 all $outdir >> $outdir/makemkvcon.log || exit 2 - eject - echo "Rip another? (Y/n)" - read confirm - [[ $confirm == "n" ]] && exit 0 - sleep 3; -done - diff --git a/ripper.sh b/ripper.sh new file mode 100755 index 0000000..627012d --- /dev/null +++ b/ripper.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Magically makes things work. +sudo modprobe sg + +# Make sure scratch disk is available to rip to. +mountpoint /scratch || mount /scratch || exit 1 +echo "Mounted!" + +# Rip discs until told otherwise. +while : +do + outdir=$(mktemp -d /scratch/makemkvcon.XXXXX) + makemkvcon -r mkv disc:0 all $outdir >> $outdir/makemkvcon.log || exit 2 + eject + echo "Rip another? (Y/n)" + read confirm + [[ $confirm == "n" ]] && exit 0 + sleep 3; +done + diff --git a/split_cert.sh b/split_cert.sh new file mode 100755 index 0000000..0c58142 --- /dev/null +++ b/split_cert.sh @@ -0,0 +1,3 @@ +#!/bin/sh +openssl pkcs12 -in "$1" -nocerts -out "$1.pem" -nodes +openssl pkcs12 -in "$1" -nokeys -out "$1.crt" diff --git a/status.sh b/status.sh deleted file mode 100755 index aa23534..0000000 --- a/status.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -date=$(date "+%a %b %d %I:%M %p") -batt=$(acpi -b | awk -F ', ' '{ print $2 }') -disk=$(df -H | awk '{ if ($6 == "/") print $4 }') -#ssid=$(ifconfig | egrep -o '*ssid (.*) ') -#idle=$(top -n | egrep -o '[0-9]+\.[0-9]% idle') -echo "$ssid $idle $disk free | $batt charged | $date" diff --git a/umounter b/umounter deleted file mode 100755 index 3c1822f..0000000 --- a/umounter +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# Get list of possible partitions to unmount. Only select partitions that have -# been mounted and display their name and size as dmenu options. -parts=$( - lsblk -nlpo NAME,SIZE,TYPE,MOUNTPOINT | grep "part .+$" | cut -f 1,4 -d' ' -) -[[ -z $parts ]] && exit 1 -exit - -# Prompt for partition to mount. -choice=$( - echo "$parts" | dmenu -i -p "Mount which partition?" | cut -f 1 -d' ' -) -[[ -z $choice ]] && exit 1 - -# Create a mount directory if none exists. Use UUID for unique name. -mntdir="/mnt/$(lsblk -n "$choice" -o UUID | cut -f 1 -d' ')" -sudo mkdir -p "$mntdir" -sudo mount "$choice" "$mntdir" - diff --git a/undocked.sh b/undocked.sh index ec2c9f3..b0f24c9 100755 --- a/undocked.sh +++ b/undocked.sh @@ -1,2 +1,3 @@ #!/bin/sh +xrandr xrandr --output VGA-0 --off --output DP-0 --off --output DP-1 --off --output DP-2 --off --output DP-3 --primary --mode 1920x1080 --pos 0x0 --rotate normal --dpi 96 --output DP-4 --off diff --git a/unmounter.sh b/unmounter.sh new file mode 100755 index 0000000..3c1822f --- /dev/null +++ b/unmounter.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Get list of possible partitions to unmount. Only select partitions that have +# been mounted and display their name and size as dmenu options. +parts=$( + lsblk -nlpo NAME,SIZE,TYPE,MOUNTPOINT | grep "part .+$" | cut -f 1,4 -d' ' +) +[[ -z $parts ]] && exit 1 +exit + +# Prompt for partition to mount. +choice=$( + echo "$parts" | dmenu -i -p "Mount which partition?" | cut -f 1 -d' ' +) +[[ -z $choice ]] && exit 1 + +# Create a mount directory if none exists. Use UUID for unique name. +mntdir="/mnt/$(lsblk -n "$choice" -o UUID | cut -f 1 -d' ')" +sudo mkdir -p "$mntdir" +sudo mount "$choice" "$mntdir" + diff --git a/yt b/yt deleted file mode 100755 index cde337f..0000000 --- a/yt +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# Do things with a YouTube URL. - -read url -printf "$url" -test -z $url && exit -title="$(youtube-dl -e "$url")" - -choice=$(dmenu -i -p "$title" << EOF -Watch -Listen -Download video -Download audio -EOF -) - -case $choice in - "Watch") - mpv "$url" --no-terminal & - ;; - "Listen") - mpv "$url" --no-terminal --no-video & - ;; - "Download Video") - youtube-dl "$url" --add-metadata - ;; - "Download Audio") - youtube-dl "$url" -x --audio-format flac --audio-quality 0 - ;; - *) - exit -esac - diff --git a/yt-player.sh b/yt-player.sh new file mode 100755 index 0000000..cde337f --- /dev/null +++ b/yt-player.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# Do things with a YouTube URL. + +read url +printf "$url" +test -z $url && exit +title="$(youtube-dl -e "$url")" + +choice=$(dmenu -i -p "$title" << EOF +Watch +Listen +Download video +Download audio +EOF +) + +case $choice in + "Watch") + mpv "$url" --no-terminal & + ;; + "Listen") + mpv "$url" --no-terminal --no-video & + ;; + "Download Video") + youtube-dl "$url" --add-metadata + ;; + "Download Audio") + youtube-dl "$url" -x --audio-format flac --audio-quality 0 + ;; + *) + exit +esac + -- cgit v1.2.3