From 4e7bd5c881f564c7d9740c396296f51bee8e2ede Mon Sep 17 00:00:00 2001 From: Ian Keane Date: Wed, 18 Sep 2024 23:25:15 -0400 Subject: [PATCH] Migrate scripts folder to org tangle file --- scripts.org | 308 ++++++++++++++++++ slackware/home/bin/scripts/colors | 18 - slackware/home/bin/scripts/colortest | 7 - slackware/home/bin/scripts/dmenu_run_top | 19 -- slackware/home/bin/scripts/dmenuunicode | 18 - slackware/home/bin/scripts/fcp | 248 -------------- slackware/home/bin/scripts/gapcycle | 15 - .../home/bin/scripts/generate-passphrase | 2 - slackware/home/bin/scripts/jbrowse | 1 - slackware/home/bin/scripts/languagecycle | 7 - slackware/home/bin/scripts/layoutcycle | 37 --- slackware/home/bin/scripts/notifyme | 1 - slackware/home/bin/scripts/passphrase | 2 - .../home/bin/scripts/prune_local_branches | 3 - slackware/home/bin/scripts/solid | 4 - slackware/home/bin/scripts/sugar | 87 ----- slackware/home/bin/scripts/themepick | 6 - slackware/home/bin/scripts/transparency | 11 - 18 files changed, 308 insertions(+), 486 deletions(-) create mode 100644 scripts.org delete mode 100755 slackware/home/bin/scripts/colors delete mode 100755 slackware/home/bin/scripts/colortest delete mode 100755 slackware/home/bin/scripts/dmenu_run_top delete mode 100755 slackware/home/bin/scripts/dmenuunicode delete mode 100755 slackware/home/bin/scripts/fcp delete mode 100755 slackware/home/bin/scripts/gapcycle delete mode 100755 slackware/home/bin/scripts/generate-passphrase delete mode 100755 slackware/home/bin/scripts/jbrowse delete mode 100755 slackware/home/bin/scripts/languagecycle delete mode 100755 slackware/home/bin/scripts/layoutcycle delete mode 100755 slackware/home/bin/scripts/notifyme delete mode 100755 slackware/home/bin/scripts/passphrase delete mode 100755 slackware/home/bin/scripts/prune_local_branches delete mode 100755 slackware/home/bin/scripts/solid delete mode 100755 slackware/home/bin/scripts/sugar delete mode 100755 slackware/home/bin/scripts/themepick delete mode 100755 slackware/home/bin/scripts/transparency diff --git a/scripts.org b/scripts.org new file mode 100644 index 0000000..8d4e92e --- /dev/null +++ b/scripts.org @@ -0,0 +1,308 @@ +#+PROPERTY: header-args :mkdirp yes +#+title:General-Use Scripts +* Purpose +This repo contains scripts that I like to have available from my $PATH +#+TOC: headlines 2 +* GUI-ish +- Glue scripts for sxhkd / bspwm / polybar +** Dmenu_run_top +- Dmenu configured how I like it +*** TODO +- test monospace instead of bitstream +- remove flavours placeholder (once flavours is ready) +- consider moving this to an alias +#+begin_src sh :tangle ~/bin/dmenu_run_top +#!/bin/sh + +# start flavours +norm_fg="#C0C5CE" +norm_bg="#1B2B34" +sel_fg="#1B2B34" +sel_bg="#99C794" +# end flavours + +dmenu_run \ + -i \ + -fn BitstreamVeraSansMono:size=11 \ + -l 15 \ + -nf "$norm_fg" \ + -nb "$norm_bg" \ + -sf "$sel_fg" \ + -sb "$sel_bg" +#+end_src + +** Dmenuunicode +- Get emojis from dmenu +*** TODO +- make work on mac +- recreate the emojis file and test +#+begin_src sh :tangle ~/bin/dmenuunicode + #!/bin/sh + + # Get user selection via dmenu from emoji file. + chosen=$(cut -d ';' -f1 ~/.local/share/emoji | dmenu -i -l 30 | sed "s/ .*//") + + # Exit if none chosen. + [ -z "$chosen" ] && exit + + # If you run this command with an argument, it will automatically insert the + # character. Otherwise, show a message that the emoji has been copied. + if [ -n "$1" ]; then + xdotool type "$chosen" + else + printf "$chosen" | xclip -selection clipboard + notify-send "'$chosen' copied to clipboard." & + fi +#+end_src + +** Languagecycle +- Cycle between a couple languages +- Better handled through polybar probably +*** TODO +- Add support for 3+ languages +#+begin_src fish :tangle ~/bin/languagecycle +#!/usr/bin/fish + +if [ (xkblayout-state print "%n") = "Russian" ] + setxkbmap -layout us + else + setxkbmap -layout ru + end +#+end_src + +** Layoutcycle +- Cycle windows between different layouts +*** TODO +- Currently this adds layouts to an endless list of layouts which can cause lag +- This should be fixed but I'm not sure if I even like using alternate layouts +#+begin_src fish :tangle ~/bin/layoutcycle +#!/usr/bin/fish + +bsp-layout next --layouts tall,grid,rgrid,tiled + +set layout (bsp-layout get) + +if ps -aux | grep layoutcycle | grep -v grep + exit +else if [ $layout = "tall" ] + notify-send -t 1000 "Layout: Tall" (echo \ + " ______________ \n" \ + " | |____| \n" \ + " | |____| \n" \ + " | |____| \n" \ + " |________|____| " ) +else if [ $layout = "grid" ] + notify-send -t 1000 "Layout: hGrid" (echo \ + " ____________ \n" \ + " | | | | \n" \ + " |___|___|___| \n" \ + " | | | | \n" \ + " |___|___|___| " ) +else if [ $layout = "rgrid" ] + vgrid + notify-send -t 1000 "Layout: vGrid" (echo \ + " ____________ \n" \ + " |_____|_____| \n" \ + " |_____|_____| \n" \ + " |_____|_____| " ) +else if [ $layout = "tiled" ] + notify-send -t 1000 "Layout: Tiled" (echo \ + " ______________ \n" \ + " | | | \n" \ + " | |____| \n" \ + " | | | | \n" \ + " |________|__|_| " ) +end + +#+end_src + +* Appearance +** Colors +> Taken from https://stackoverflow.com/questions/69138165/how-to-get-the-rgb-values-of-a-256-color-palette-terminal-color +- Returns a representation of your currently set color scheme +#+begin_src sh :tangle ~/bin/colors +#!/bin/sh + +xdef="$HOME/.Xresources" + +colors=( $( sed -re '/^!/d; /^$/d; /^#/d; s/(\*color)([0-9]):/\10\2:/g;' $xdef | grep 'color[01][0-9]:' | sort | sed 's/^.*: *//g' ) +) + +echo +for i in {0..7}; do echo -en "\e[$((30+$i))m ${colors[i]} \u2588\u2588 \e[0m\n"; done +echo +for i in {8..15}; do echo -en "\e[1;$((22+$i))m ${colors[i]} \u2588\u2588 \e[0m\n"; done +echo -e "\n" +#+end_src + +** Gapcycle +- Cycle between 3 window gap sizes I find aesthetic +*** TODO +- This is broken +#+begin_src fish :tangle ~/bin/gapcycle + #!/usr/bin/fish + + set gap (bspc config window_gap) + + if [ $gap = 40 ] + set new_gap 18 + else if [ $gap = 18 ] + set new_gap 12 + else if [ $gap = 12 ] + set new_gap 0 + else if [ $gap = 0 ] + set new_gap 40 + end + + bspc config window_gap $new_gap +#+end_src + +** Themepick +- Broken in nix until I find an equivalent base16 theme setter and / or setup flavours +#+begin_src fish :tangle ~/bin/themepick + #!/usr/bin/fish + + set theme (flavours list | tr ' ' '\n' | dmenu) + + flavours apply $theme && + eval ~/.config/base16-shell/scripts/base16-$theme.sh +#+end_src + +** Opaque-windows +*** TODO +- Handle this through lemonbar instead +#+begin_src fish :tangle ~/bin/opaque-windows + #!/usr/bin/fish + if ps -aux | grep picom | grep -v grep + pkill picom + end +#+end_src + +** Transparent-windows +#+begin_src fish :tangle ~/bin/transparent-windows + #!/usr/bin/fish + if ps -aux | grep picom | grep -v grep + pkill picom + end + + sleep 0.2 + picom \ + --conf /dev/null \ + -i 0.8 \ + --active-opacity 1.0 \ + --focus-exclude "x = 0 && y = 0 && override_redirect = true" & +#+end_src + +* Password Management +- Some basic scripts to help gnu password-store suit my preferences +** Generate-passphrase +- Generates a pseudo-random CorrectHorseBatteryStaple-style password + - I prefer this for passwords I might have to type manually occasionally +*** TODO +- This may be better as an alias +#+begin_src bash :tangle ~/bin/generate-passphrase + #!/bin/bash + shuf -n3 /usr/share/dict/words | tr -d '\n' +#+end_src +** Passphrase +- This more specifically inserts the generated passphrase into gnu pass +#+begin_src fish :tangle ~/bin/passphrase + #!/usr/bin/fish + generate-passphrase | pass insert -e $argv +#+end_src + +* Git +** Prune_local_branches +*** TODO +- Don't do this. Use a git alias. +#+begin_src bash :tangle ~/bin/passphrase +#!/bin/bash +git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -r -n 1 git branch -D +#+end_src + +* APIs +** Sugar +- Get blood sugar from nightscout + - Useful for gui integrations +*** TODO +- Remove lemobar, test with polybar +- Handle API endpoint as a secret +#+begin_src python :tangle ~/bin/sugar + #!/usr/bin/python3 + import sys + import requests + import json + from termcolor import colored + + tmux = '--tmux' in sys.argv + lemonbar = '--lb' in sys.argv + + down = '\u2193' # ↓ + falling = '\u2798' # ➘ + flat = '\u2192' # → + rising = '\u279a' # ➚ + up = '\u2191' # ↑ + + url = # TODO interpolate or parameterize + options = '/api/v1/entries.json?count=1&token=phone-7631d7eebc79825b' + + try: + res = requests.get(url + options) + except: + sys.exit() + + sugar = res.json()[0] + + + delta = sugar['delta'] + sgv = sugar['sgv'] + direction = sugar['direction'] + + if delta < -10: + arrow = down + if delta >= -10 and delta < -1: + arrow = falling + if delta >= -1 and delta <= 1: + arrow = flat + if delta > 1 and delta <= 10: + arrow = rising + if delta > 10: + arrow = up + + if (sgv >= 225 or sgv <= 80): + color = 'red' + elif ((sgv >= 180 and sgv <= 225) + or (sgv <= 100 and sgv >= 80)): + color = 'yellow' + else: + color = 'green' + + if tmux: + print(f'#[bg={color}] ' + + str(round(sugar['sgv'], 1)) + ' ' + + arrow + ' ' + + '(' + str(delta) + ')' + ) + elif lemonbar: + print(str(round(sugar['sgv'], 1)) + ' ' + + arrow + ' ' + + '(' + str(delta) + ')' + ) + else: + print(colored(str(sugar['sgv']) + + ' ' + arrow + ' ' + + '(' + str(delta) + ')', + color)) +#+end_src +* Mac-specific +** Jbrowse +*** TODO +- Probably handle these as aliases +#+begin_src sh :tangle ~/bin + /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser "https://everblue.atlassian.net/browse/"$1 & +#+end_src +** NotifyMe +#+begin_src sh :tangle ~/bin + osascript -e 'display notification "done!" with title "Notification"' +#+end_src + diff --git a/slackware/home/bin/scripts/colors b/slackware/home/bin/scripts/colors deleted file mode 100755 index 469cc66..0000000 --- a/slackware/home/bin/scripts/colors +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# https://stackoverflow.com/questions/69138165/how-to-get-the-rgb-values-of-a-256-color-palette-terminal-color - - - - - -xdef="$HOME/.Xresources" - -colors=( $( sed -re '/^!/d; /^$/d; /^#/d; s/(\*color)([0-9]):/\10\2:/g;' $xdef | grep 'color[01][0-9]:' | sort | sed 's/^.*: *//g' ) -) - -echo -for i in {0..7}; do echo -en "\e[$((30+$i))m ${colors[i]} \u2588\u2588 \e[0m\n"; done -echo -for i in {8..15}; do echo -en "\e[1;$((22+$i))m ${colors[i]} \u2588\u2588 \e[0m\n"; done -echo -e "\n" diff --git a/slackware/home/bin/scripts/colortest b/slackware/home/bin/scripts/colortest deleted file mode 100755 index 65ea8b6..0000000 --- a/slackware/home/bin/scripts/colortest +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -for i in {0..255} ; do - printf "\x1b[38;5;${i}m%3d " "${i}" - if (( $i == 15 )) || (( $i > 15 )) && (( ($i-15) % 12 == 0 )); then - echo; - fi -done diff --git a/slackware/home/bin/scripts/dmenu_run_top b/slackware/home/bin/scripts/dmenu_run_top deleted file mode 100755 index f281261..0000000 --- a/slackware/home/bin/scripts/dmenu_run_top +++ /dev/null @@ -1,19 +0,0 @@ -#! - -# bg's need # in front - -# start flavours -norm_fg="#C0C5CE" -norm_bg="#1B2B34" -sel_fg="#1B2B34" -sel_bg="#99C794" -# end flavours - -dmenu_run \ - -i \ - -fn BitstreamVeraSansMono:size=11 \ - -l 15 \ - -nf "$norm_fg" \ - -nb "$norm_bg" \ - -sf "$sel_fg" \ - -sb "$sel_bg" diff --git a/slackware/home/bin/scripts/dmenuunicode b/slackware/home/bin/scripts/dmenuunicode deleted file mode 100755 index b25876f..0000000 --- a/slackware/home/bin/scripts/dmenuunicode +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# The famous "get a menu of emojis to copy" script. - -# Get user selection via dmenu from emoji file. -chosen=$(cut -d ';' -f1 ~/.local/share/emoji | dmenu -i -l 30 | sed "s/ .*//") - -# Exit if none chosen. -[ -z "$chosen" ] && exit - -# If you run this command with an argument, it will automatically insert the -# character. Otherwise, show a message that the emoji has been copied. -if [ -n "$1" ]; then - xdotool type "$chosen" -else - printf "$chosen" | xclip -selection clipboard - notify-send "'$chosen' copied to clipboard." & -fi diff --git a/slackware/home/bin/scripts/fcp b/slackware/home/bin/scripts/fcp deleted file mode 100755 index bf48d2b..0000000 --- a/slackware/home/bin/scripts/fcp +++ /dev/null @@ -1,248 +0,0 @@ -#!/bin/sh - -# TODO: -# * Look into ssh-hp :). (ie the slowness from ssh may just be from small -# buffers). -# * bring back stderr, currently there is no notification of errors, not even -# ENODIR or device full. -# * fcp src1 src2 src3 ... dst/ doesn't work (but glob does). -# Need to take the last positional arg as dest (and unset it) then use -# positional args at sources. Go through each one and make sure they are all -# local because we don't support mixed remote and local. -# * Doesn't work when the remote end is android. Although if I ssh over and run -# the fcp_ script manually it does work!?! (Maybe something about android -# tar, saw something else (what?) making a fifo instead of pipe.) -# * There are a couple of calls to eval in which any redirect characters -# (angle brackets) could lose our output. They need to be escaped. -# * Not sure about the handling of paths ending in slash or not is proper. -# (Eg where we rename the dest file.) -# I assume if it has no slash it the directory being sent should be renamed -# to the destination name -# (unless it is an existing directory on the dest host). -# * If the receiving (connecting) nc is started before the sending (server) -# one it will wait for one second and try again. They are started in the -# right order but if there are delays in starting the interpreter or -# something that sleep may have to be changed to something more robust. -# * If you want something more sophisticated look at http://www.slac.stanford.edu/~abh/bbcp/ - -portno=4365 -comp="" - -usage() { - cat </dev/null || { - ret=$? - usage - exit $ret -} -eval "set -- $(getopt -o hcp: -l help -- "${@}")" - -# Sometimes set and/or getopt leave a -- there when it shouldn't be -[ "$a1" != "--" ] && [ "$1" = "--" ] && shift - -while [ -n "$1" ];do - case "$1" in - -h|--help) - usage - exit - ;; - -c) comp="-z" ;; - -p) - portno="$2" - shift - ;; - --) - shift - break - ;; - -*) - echo "Unrecognized argument: $1" - usage - exit 1 - ;; - *) break ;; - esac - shift -done - -while [ -n "$1" ];do - case "$1" in - *) - if [ -z "$srcpath" ];then - srcpath="$1" - elif [ -z "$dstpath" ];then - dstpath="$1" - else - echo "Too many positional arguments (expected 2)." >&2 - echo "Try escaping any globs in the destination path." >&2 - usage - exit 1 - fi - ;; - esac - shift -done - -if [ -z "$srcpath" ];then - usage - exit 1 -fi -[ "$srcpath" = "." ] && srcpath="./" -[ "$srcpath" = ".." ] && srcpath="../" -[ "$dstpath" = "." ] && dstpath="./" -[ "$dstpath" = ".." ] && dstpath="../" -[ -z "$dstpath" ] && dstpath="./" - -case "$srcpath" in - *\\:*) continue ;; - *:*) - srchost="${srcpath%%:*}" - srcpath="${srcpath#*:}" - ;; -esac -case "$dstpath" in - *\\:*) continue ;; - *:*) - dsthost="${dstpath%%:*}" - dstpath="${dstpath#*:}" - ;; -esac - -sendcmd() { - dsthost="${1#*@}" - srcpath="$2" - srcdir="$(dirname "$srcpath")" - srcbase="$(basename "$srcpath")" - dstpath="$3" - [ "${dstpath%/}" = "$dstpath" ] && dstbase="$(basename "$dstpath")" - cat </dev/null | grep -q check-device || trans=v -pv=pv -type pv >/dev/null 2>&1 || pv=cat -# Try nc twice, with a one second timeout. In case we get called before the -# remote end has started up. May need to come up with something more -# sophisticated in situations where we have to wait longer for the initial -# setup. -echo "\$srcbase" | tar -cT- ${comp} "\$trans" | - \$pv | ( nc -q 0 -w 3 "${dsthost#*@}" $portno 2>/dev/null || - { sleep 1 && nc -q 0 -w 3 "${dsthost#*@}" $portno ; } ) -EOS -} - -recvcmd() { - dstpath="$1" - srcbase="$(basename "$2")" - cat </dev/null | grep -q check-device || trans=-v -pv=pv -type pv >/dev/null 2>&1 || pv=cat -if [ "\$dstbase" != '-' ] ;then - mkdir -p "\$dstdir" || exit \$? - cd "\$dstdir" || exit \$? -fi -nc -lp $portno -w 20 | \$pv | { - if [ "\$dstbase" != '-' ] ;then - tar -x ${comp} "\$trans" - else - cat - fi - } -EOS -} - -rpc() { - ssh "$1" "export ff=/tmp/fcp_$$_\$\$_cmd ; cat > \$ff ; nohup sh -c \"sh \$ff && rm -f \$ff\" /dev/null 2>&1 &" - [ $? -ne 0 ] && echo "Try escaping any ':' in a path if it is not supposed to be a host seperator." >&2 -} - -myip() { - # dig and nslookup and hosts aren't on all machines and don't look in - # /etc/hosts. Getent isn't everywhere and sometimes returns ipv6 addreses on - # non-ipv6 enabled hosts. getent ahostsv4 I don't know how prevalent that is. - tip="$(ping -c1 -W0.1 ${1#*@} 2>&1 | tr -d '():' | awk '/^PING/{print $3}')" - [ -n "$tip" ] && - ip route get "$tip" | sed -n 's/^.*src \([^ ]*\).*$/\1/p' -} - -if [ -n "$dsthost" ] && [ -n "$srchost" ];then - recvcmd "$dstpath" "$srcpath" | rpc "$dsthost" - sendcmd "$dsthost" "$srcpath" "$dstpath" | rpc "$srchost" - exit $? -elif [ -n "$dsthost" ];then - recvcmd "$dstpath" "$srcpath" | rpc "$dsthost" - sendcmd "$dsthost" "$srcpath" "$dstpath" > /tmp/fcp_$$_cmd - sh /tmp/fcp_$$_cmd - rm /tmp/fcp_$$_cmd - exit $? -elif [ -n "$srchost" ];then - dsthost="$(myip "$srchost")" - [ -z "$dsthost" ] && { - echo "Couldn't find route to $srchost" >&2 - exit 1 - } - recvcmd "$dstpath" "$srcpath" > /tmp/fcp_$$_cmd - sh /tmp/fcp_$$_cmd & - sendcmd "$dsthost" "$srcpath" "$dstpath" | rpc "$srchost" - wait - rm /tmp/fcp_$$_cmd - exit $? -else - srcdir="$(dirname "$srcpath")" - srcbase="$(basename "$srcpath")" - if [ -d "$dstpath" ] || [ "${dstpath%/}" != "$dstpath" ];then - dstdir="$dstpath" - else - dstdir="$(dirname "$dstpath")" - fi - # TODO: Handle file renames. - dstpath="`eval echo ${dstpath}`" - mkdir -p "$dstpath" - tar -C "$srcdir" -c "$srcbase" | tar -C "$dstdir" -x - exit $? -fi - diff --git a/slackware/home/bin/scripts/gapcycle b/slackware/home/bin/scripts/gapcycle deleted file mode 100755 index 194e1bf..0000000 --- a/slackware/home/bin/scripts/gapcycle +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/fish - -set gap (bspc config window_gap) - -if [ $gap = 40 ] - set new_gap 18 -else if [ $gap = 18 ] - set new_gap 12 -else if [ $gap = 12 ] - set new_gap 0 -else if [ $gap = 0 ] - set new_gap 40 -end - -bspc config window_gap $new_gap diff --git a/slackware/home/bin/scripts/generate-passphrase b/slackware/home/bin/scripts/generate-passphrase deleted file mode 100755 index b368798..0000000 --- a/slackware/home/bin/scripts/generate-passphrase +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -shuf -n3 /usr/share/dict/words | tr -d '\n' diff --git a/slackware/home/bin/scripts/jbrowse b/slackware/home/bin/scripts/jbrowse deleted file mode 100755 index 612416d..0000000 --- a/slackware/home/bin/scripts/jbrowse +++ /dev/null @@ -1 +0,0 @@ -/Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser "https://everblue.atlassian.net/browse/"$1 & diff --git a/slackware/home/bin/scripts/languagecycle b/slackware/home/bin/scripts/languagecycle deleted file mode 100755 index de11442..0000000 --- a/slackware/home/bin/scripts/languagecycle +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/fish - -if [ (xkblayout-state print "%n") = "Russian" ] - setxkbmap -layout us - else - setxkbmap -layout ru - end diff --git a/slackware/home/bin/scripts/layoutcycle b/slackware/home/bin/scripts/layoutcycle deleted file mode 100755 index 5f54f7d..0000000 --- a/slackware/home/bin/scripts/layoutcycle +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/fish - -bsp-layout next --layouts tall,grid,rgrid,tiled - -set layout (bsp-layout get) - -if ps -aux | grep layoutcycle | grep -v grep - exit -else if [ $layout = "tall" ] - notify-send -t 1000 "Layout: Tall" (echo \ - " ______________ \n" \ - " | |____| \n" \ - " | |____| \n" \ - " | |____| \n" \ - " |________|____| " ) -else if [ $layout = "grid" ] - notify-send -t 1000 "Layout: hGrid" (echo \ - " ____________ \n" \ - " | | | | \n" \ - " |___|___|___| \n" \ - " | | | | \n" \ - " |___|___|___| " ) -else if [ $layout = "rgrid" ] - vgrid - notify-send -t 1000 "Layout: vGrid" (echo \ - " ____________ \n" \ - " |_____|_____| \n" \ - " |_____|_____| \n" \ - " |_____|_____| " ) -else if [ $layout = "tiled" ] - notify-send -t 1000 "Layout: Tiled" (echo \ - " ______________ \n" \ - " | | | \n" \ - " | |____| \n" \ - " | | | | \n" \ - " |________|__|_| " ) -end diff --git a/slackware/home/bin/scripts/notifyme b/slackware/home/bin/scripts/notifyme deleted file mode 100755 index 3ea60b9..0000000 --- a/slackware/home/bin/scripts/notifyme +++ /dev/null @@ -1 +0,0 @@ -osascript -e 'display notification "done!" with title "Notification"' diff --git a/slackware/home/bin/scripts/passphrase b/slackware/home/bin/scripts/passphrase deleted file mode 100755 index 3976fb9..0000000 --- a/slackware/home/bin/scripts/passphrase +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/fish -generate-passphrase | pass insert -e $argv diff --git a/slackware/home/bin/scripts/prune_local_branches b/slackware/home/bin/scripts/prune_local_branches deleted file mode 100755 index 817f611..0000000 --- a/slackware/home/bin/scripts/prune_local_branches +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -r -n 1 git branch -D diff --git a/slackware/home/bin/scripts/solid b/slackware/home/bin/scripts/solid deleted file mode 100755 index 70ebfdb..0000000 --- a/slackware/home/bin/scripts/solid +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/fish -if ps -aux | grep picom | grep -v grep - pkill picom -end diff --git a/slackware/home/bin/scripts/sugar b/slackware/home/bin/scripts/sugar deleted file mode 100755 index 8d1dbaf..0000000 --- a/slackware/home/bin/scripts/sugar +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/python3 -import sys -import requests -import json -from termcolor import colored - -# sample request: - -# [ -# { -# "_id": "629672ecb982f4a1be3a7dd6", -# "device": "xDrip-DexcomG5", -# "date": 1654026986232, -# "dateString": "2022-05-31T19:56:26.232Z", -# "sgv": 185, -# "delta": 0.996, -# "direction": "Flat", -# "type": "sgv", -# "filtered": 0, -# "unfiltered": 0, -# "rssi": 100, -# "noise": 1, -# "sysTime": "2022-05-31T19:56:26.232Z", -# "utcOffset": -240, -# "mills": 1654026986232 -# } -# ] - -tmux = '--tmux' in sys.argv -lemonbar = '--lb' in sys.argv - -down = '\u2193' # ↓ -falling = '\u2798' # ➘ -flat = '\u2192' # → -rising = '\u279a' # ➚ -up = '\u2191' # ↑ - -url = 'http://blood.dump.town' -options = '/api/v1/entries.json?count=1&token=phone-7631d7eebc79825b' - -try: - res = requests.get(url + options) -except: - sys.exit() - -sugar = res.json()[0] - - -delta = sugar['delta'] -sgv = sugar['sgv'] -direction = sugar['direction'] - -if delta < -10: - arrow = down -if delta >= -10 and delta < -1: - arrow = falling -if delta >= -1 and delta <= 1: - arrow = flat -if delta > 1 and delta <= 10: - arrow = rising -if delta > 10: - arrow = up - -if (sgv >= 225 or sgv <= 80): - color = 'red' -elif ((sgv >= 180 and sgv <= 225) - or (sgv <= 100 and sgv >= 80)): - color = 'yellow' -else: - color = 'green' - -if tmux: - print(f'#[bg={color}] ' + - str(round(sugar['sgv'], 1)) + ' ' + - arrow + ' ' + - '(' + str(delta) + ')' - ) -elif lemonbar: - print(str(round(sugar['sgv'], 1)) + ' ' + - arrow + ' ' + - '(' + str(delta) + ')' - ) -else: - print(colored(str(sugar['sgv']) + - ' ' + arrow + ' ' + - '(' + str(delta) + ')', - color)) diff --git a/slackware/home/bin/scripts/themepick b/slackware/home/bin/scripts/themepick deleted file mode 100755 index 35faebc..0000000 --- a/slackware/home/bin/scripts/themepick +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/fish - -set theme (flavours list | tr ' ' '\n' | dmenu) - -flavours apply $theme && -eval ~/.config/base16-shell/scripts/base16-$theme.sh diff --git a/slackware/home/bin/scripts/transparency b/slackware/home/bin/scripts/transparency deleted file mode 100755 index d58b5f5..0000000 --- a/slackware/home/bin/scripts/transparency +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/fish -if ps -aux | grep picom | grep -v grep - pkill picom -end - -sleep 0.2 -picom \ - --conf /dev/null \ - -i 0.8 \ - --active-opacity 1.0 \ - --focus-exclude "x = 0 && y = 0 && override_redirect = true" &