diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2023-01-19 19:13:38 -0500 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2023-01-19 19:13:38 -0500 |
| commit | 56919b86e5e8612e3cf432eb5b9a110f4526f0eb (patch) | |
| tree | 0ff1c4486f29dd6aca43ce365496de2fb4a7ade0 /.local | |
| parent | 6e11f434d71a49a6f3dd42d1471eaf7b46003717 (diff) | |
added some scripts and redshift
Diffstat (limited to '.local')
| -rwxr-xr-x | .local/bin/cs | 9 | ||||
| l--------- | .local/bin/html2pdf | 1 | ||||
| -rwxr-xr-x | .local/bin/internet | 4 | ||||
| -rwxr-xr-x | .local/bin/lfub | 24 | ||||
| -rwxr-xr-x | .local/bin/lower | 5 | ||||
| -rwxr-xr-x | .local/bin/macname | 8 | ||||
| -rwxr-xr-x | .local/bin/mismatch | 12 | ||||
| -rwxr-xr-x | .local/bin/mkwords | 5 | ||||
| -rwxr-xr-x | .local/bin/money | bin | 5030208 -> 0 bytes | |||
| -rwxr-xr-x | .local/bin/rotdir | 12 | ||||
| -rwxr-xr-x | .local/bin/upper | 5 | ||||
| -rwxr-xr-x | .local/bin/weather | 2 |
12 files changed, 65 insertions, 22 deletions
diff --git a/.local/bin/cs b/.local/bin/cs new file mode 100755 index 0000000..9819dbd --- /dev/null +++ b/.local/bin/cs @@ -0,0 +1,9 @@ +#!/bin/sh + +echo $@ + +[ -z "$(echo $@ | grep "\-l")" ] && str="a-z A-Z" || [ -z "$(echo $@ | grep "\-u")" ] && str="A-Z a-z" || (echo "cs: missing operand" && exit) +[ -z "$(echo $@ | sed 's/\-l//g;s/\-u//g')" ] && words=$(< /dev/stdin) || words="$(echo $@ | sed 's/\-l//g;s/\-u//g')" + +echo $words | tr $str + diff --git a/.local/bin/html2pdf b/.local/bin/html2pdf deleted file mode 120000 index aae33e2..0000000 --- a/.local/bin/html2pdf +++ /dev/null @@ -1 +0,0 @@ -/Users/jmm/Documents/Projects/Experiments/html2pdf/convert.sh
\ No newline at end of file diff --git a/.local/bin/internet b/.local/bin/internet index 70e48ec..942eefe 100755 --- a/.local/bin/internet +++ b/.local/bin/internet @@ -2,9 +2,9 @@ [ "$(connmanctl services | grep "Wired" | awk -F' ' '{print $2}')" = "Wired" ] && CONNECTION="Wired" || CONNECTION="$(connmanctl services | grep '*' | awk -F' ' '{print $2}')" -[ "$CONNECTION" = "Wired" ] && IP="$(ip address | grep dynamic | grep 192.168.)" || IP="$(ip address | grep wlo | grep 192.168. )" +[ "$CONNECTION" = "Wired" ] && IP="$(ip address | grep eth0 | grep 192.168.)" || IP="$(ip address | grep wlo | grep 192.168. )" IP="${IP%/*}" IP="${IP##* }" -printf $CONNECTION +echo $CONNECTION $IP diff --git a/.local/bin/lfub b/.local/bin/lfub new file mode 100755 index 0000000..9012f50 --- /dev/null +++ b/.local/bin/lfub @@ -0,0 +1,24 @@ +#!/bin/sh + +# This is a wrapper script for lb that allows it to create image previews with +# ueberzug. This works in concert with the lf configuration file and the +# lf-cleaner script. + +set -e + +cleanup() { + exec 3>&- + rm "$FIFO_UEBERZUG" +} + +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup HUP INT QUIT TERM PWR EXIT + lf "$@" 3>&- +fi diff --git a/.local/bin/lower b/.local/bin/lower deleted file mode 100755 index 3c651f5..0000000 --- a/.local/bin/lower +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/local/bin/python3 -while True: - userIn = input("> ").lower() - if userIn == "exit": break - print(userIn) diff --git a/.local/bin/macname b/.local/bin/macname deleted file mode 100755 index cc7fcc9..0000000 --- a/.local/bin/macname +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -name=$1 - -sudo scutil --set ComputerName $name && -sudo scutil --set HostName $name && -sudo scutil --set LocalHostName $name && -echo Done diff --git a/.local/bin/mismatch b/.local/bin/mismatch new file mode 100755 index 0000000..2987b2f --- /dev/null +++ b/.local/bin/mismatch @@ -0,0 +1,12 @@ +#!/bin/sh + +DICTFILE=/usr/share/dict/words + +[ -z $1 ] && words=$(< /dev/stdin) || words=$1 + +for word in $words +do + echo "Word: $word" + [ -z "$(grep -i "\b$word\b" $DICTFILE)" ] && echo $word +done + diff --git a/.local/bin/mkwords b/.local/bin/mkwords new file mode 100755 index 0000000..91a751d --- /dev/null +++ b/.local/bin/mkwords @@ -0,0 +1,5 @@ +#!/bin/sh + +[ -z "$1" ] && words="$(< /dev/stdin)" || words=$1 +echo $words | sed "s/ /\n/g" + diff --git a/.local/bin/money b/.local/bin/money Binary files differdeleted file mode 100755 index 5d3c65c..0000000 --- a/.local/bin/money +++ /dev/null diff --git a/.local/bin/rotdir b/.local/bin/rotdir new file mode 100755 index 0000000..86da6db --- /dev/null +++ b/.local/bin/rotdir @@ -0,0 +1,12 @@ +#!/bin/sh + +# When I open an image from the file manager in sxiv (the image viewer), I want +# to be able to press the next/previous keys to key through the rest of the +# images in the same directory. This script "rotates" the content of a +# directory based on the first chosen file, so that if I open the 15th image, +# if I press next, it will go to the 16th etc. Autistic, I know, but this is +# one of the reasons that sxiv is great for being able to read standard input. + +[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 +base="$(basename "$1")" +ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }' diff --git a/.local/bin/upper b/.local/bin/upper deleted file mode 100755 index e3d8d45..0000000 --- a/.local/bin/upper +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/local/bin/python3 -while True: - userIn = input("> ").upper() - if userIn == "EXIT": break - print(userIn) diff --git a/.local/bin/weather b/.local/bin/weather index a52a855..664b0b1 100755 --- a/.local/bin/weather +++ b/.local/bin/weather @@ -4,7 +4,7 @@ getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1 curl -sf "wttr.in/Ocean+City" > "$HOME/.cache/weatherreport" || exit 1 ;} showweather() { printf "%s" "$(sed '16q;d' "$HOME/.cache/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" -sed '13q;d' "$HOME/.cache/weatherreport" | grep -o "m\\(-+\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print "❄️",$1 "°","🌞",$2 "°"}' ;} +sed '13q;d' "$HOME/.cache/weatherreport" | grep -o "m\\(-+\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄",$1 "°","🌞",$2 "°"}' ;} [ "$(stat -c %y "$HOME/.cache/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && getforecast showweather |
