From f8d09c5cfd6d1d9595b64547dc9d29c63e40c5f2 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Thu, 5 Dec 2024 13:49:22 -0500 Subject: Moved .local/bin to scripts --- README.md | 17 +++++++++++++++++ run | 27 +++++++++++++++++++++++++++ runs/neovim | 12 ++++++++++++ runs/notes | 6 ++++++ runs/plan9 | 8 ++++++++ scripts/.DS_Store | Bin 0 -> 6148 bytes scripts/473 | 19 +++++++++++++++++++ scripts/9t | 6 ++++++ scripts/a | 6 ++++++ scripts/add2rss | 34 ++++++++++++++++++++++++++++++++++ scripts/b | 22 ++++++++++++++++++++++ scripts/colortest | 20 ++++++++++++++++++++ scripts/cs | 7 +++++++ scripts/days2finals.py | 23 +++++++++++++++++++++++ scripts/getUnicode | 12 ++++++++++++ scripts/internet | 10 ++++++++++ scripts/ipfetch | 3 +++ scripts/jdm | 12 ++++++++++++ scripts/keys | 10 ++++++++++ scripts/linkhandler | 26 ++++++++++++++++++++++++++ scripts/mismatch | 11 +++++++++++ scripts/mkwords | 5 +++++ scripts/money.py | 22 ++++++++++++++++++++++ scripts/mr | 3 +++ scripts/prompt | 3 +++ scripts/rebootPrompt | 3 +++ scripts/rotdir | 12 ++++++++++++ scripts/setWall | 6 ++++++ scripts/shutdownPrompt | 3 +++ scripts/testPort | 6 ++++++ scripts/theme | 14 ++++++++++++++ scripts/tmux-sessionizer | 29 +++++++++++++++++++++++++++++ scripts/unix | 26 ++++++++++++++++++++++++++ scripts/volume | 7 +++++++ scripts/weather | 10 ++++++++++ scripts/ytrss | 15 +++++++++++++++ util | 41 +++++++++++++++++++++++++++++++++++++++++ 37 files changed, 496 insertions(+) create mode 100644 README.md create mode 100755 run create mode 100755 runs/neovim create mode 100755 runs/notes create mode 100755 runs/plan9 create mode 100644 scripts/.DS_Store create mode 100755 scripts/473 create mode 100755 scripts/9t create mode 100755 scripts/a create mode 100755 scripts/add2rss create mode 100755 scripts/b create mode 100755 scripts/colortest create mode 100755 scripts/cs create mode 100755 scripts/days2finals.py create mode 100755 scripts/getUnicode create mode 100755 scripts/internet create mode 100755 scripts/ipfetch create mode 100755 scripts/jdm create mode 100755 scripts/keys create mode 100755 scripts/linkhandler create mode 100755 scripts/mismatch create mode 100755 scripts/mkwords create mode 100755 scripts/money.py create mode 100755 scripts/mr create mode 100755 scripts/prompt create mode 100755 scripts/rebootPrompt create mode 100755 scripts/rotdir create mode 100755 scripts/setWall create mode 100755 scripts/shutdownPrompt create mode 100755 scripts/testPort create mode 100755 scripts/theme create mode 100755 scripts/tmux-sessionizer create mode 100755 scripts/unix create mode 100755 scripts/volume create mode 100755 scripts/weather create mode 100755 scripts/ytrss create mode 100755 util diff --git a/README.md b/README.md new file mode 100644 index 0000000..17c5682 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Dotfiles + +## Folders in Home Folder + +- `~/personal/`: Holds Personal Folders that are created by `run` script + - `bin/`: Holds all executables; Things are copied here only, no changes + - `plan9/`: Plan9Port + - `neovim/`: Neovim source; binaries go to `bin/` + - `dotfiles/`: Dotfiles are edited here & copied to correct location + - `notes/`: Personal Notes repository + +## Install + +First execute `./run` which will handle things like installing Neovim & P9P. +Next to copy the files to the proper directory, run `./dev-env`, which will +copy config files to `~/.config/` folder and executables to `~/personal/bin/`. + diff --git a/run b/run new file mode 100755 index 0000000..8320158 --- /dev/null +++ b/run @@ -0,0 +1,27 @@ +#!/bin/zsh + +source util + +dry="0" +filter="" +script_dir=${0:a:h} + +while [[ $# -gt 0 ]]; do + if [[ "$1" == "--dry" ]]; then + dry="1" + else + filter="$1" + fi + shift +done + +log "$script_dir -- $filter" +cd $script_dir +scripts="$(find ./runs -maxdepth 1 -mindepth 1 -perm +111 -type f)" +for script in $scripts; do + if echo "$script" | grep -qv "$filter"; then + log "filtering $script" + continue + fi + execute ./$script +done diff --git a/runs/neovim b/runs/neovim new file mode 100755 index 0000000..5eab896 --- /dev/null +++ b/runs/neovim @@ -0,0 +1,12 @@ +#!/bin/zsh + +source ../util + +version="v0.10.2" + +git clone -b $version https://github.com/neovim/neovim.git $target/neovim +sudo dnf install -y cmake gettext lua lua-libs +cd $HOME/neovim +make CMAKE_BUILD_TYPE=RelWithDebInfo +make CMAKE_INSTALL_PREFIX=$target/bin install + diff --git a/runs/notes b/runs/notes new file mode 100755 index 0000000..de5e525 --- /dev/null +++ b/runs/notes @@ -0,0 +1,6 @@ +#!/bin/zsh + +source ../util + +git clone git@github.com:JacobMcDonnell/notes.git $target/notes + diff --git a/runs/plan9 b/runs/plan9 new file mode 100755 index 0000000..7beff82 --- /dev/null +++ b/runs/plan9 @@ -0,0 +1,8 @@ +#!/bin/zsh + +source ../util + +git clone https://github.com/9fans/plan9port.git $target/plan9 +cd $target/plan9 +./INSTALL + diff --git a/scripts/.DS_Store b/scripts/.DS_Store new file mode 100644 index 0000000..f2f4c44 Binary files /dev/null and b/scripts/.DS_Store differ diff --git a/scripts/473 b/scripts/473 new file mode 100755 index 0000000..3025d01 --- /dev/null +++ b/scripts/473 @@ -0,0 +1,19 @@ +#!/bin/sh + +NUMS="01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n" + +NUM="$(echo $NUMS | fzf)" + +SERVER="e5-cse-135-$NUM.cse.psu.edu" + +USER=$1 + +if [[ -z $NUM ]]; then + echo "Select a server number" + exit +elif [[ -z $USER ]]; then + echo "Provide a user name" + exit +fi + +ssh -Y $USER@$SERVER diff --git a/scripts/9t b/scripts/9t new file mode 100755 index 0000000..865b4a5 --- /dev/null +++ b/scripts/9t @@ -0,0 +1,6 @@ +#!/bin/sh + +SHELL=$PLAN9/bin/rc +font=/mnt/font/Menlo-Regular/15a/font +fontsrv & +9 9term -f $font diff --git a/scripts/a b/scripts/a new file mode 100755 index 0000000..df306a4 --- /dev/null +++ b/scripts/a @@ -0,0 +1,6 @@ +#!/bin/sh + +SHELL=$PLAN9/bin/rc +font=/mnt/font/Menlo-Regular/15a/font +9 fontsrv & +9 acme -a -f $font $@ \ No newline at end of file diff --git a/scripts/add2rss b/scripts/add2rss new file mode 100755 index 0000000..ab29362 --- /dev/null +++ b/scripts/add2rss @@ -0,0 +1,34 @@ +#!/bin/sh + +RSSFILE=~/.config/newsboat/urls + +if test -n "$1"; +then + URL=$1 +elif test ! -t 0; +then + URL=$(cat < /dev/stdin) +else + URL=$(xclip -o clipboard) + if test -n "$URL"; + then + notify-send "add2rss: copied $URL from clipboard" + else + notify-send "add2rss: no input" + exit + fi +fi + +if test -n "$2"; +then + URL="$URL \"$2\"" +fi + +if test -n "$(grep $URL $RSSFILE)"; +then + notify-send "add2rss: You already added this feed" +else + echo "$URL" >> $RSSFILE + notify-send "add2rss: Added" +fi + diff --git a/scripts/b b/scripts/b new file mode 100755 index 0000000..596b320 --- /dev/null +++ b/scripts/b @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Select `b` (or before it, or after) and assign Acme `addr` to selection +echo addr=dot | 9p write acme/$winid/ctl + +# Mark the current line and change `addr` to it +echo -n '__MARKER__' | 9p write acme/$winid/data +echo -n '/^.*__MARKER__/' | 9p write acme/$winid/addr + +# Process the line +line=$(9p read acme/$winid/data | sed 1q) +indentation=$(echo "$line" | sed -E 's/^( *).*$/\1/') +before_marker=$(echo "$line" | sed -E 's/b?__MARKER__.*$/{/') +after_marker=$(echo "$line" | awk -F'__MARKER__' '{print $2}') +[ "$after_marker" == "b" ] && after_marker="" + +# Compose the final block +block="$before_marker"$'\n'"$indentation "$'\n'"$indentation}$after_marker" + +# Change `addr` one more time and replace original line with my block +echo -n '/^.*__MARKER__.*\n?/' | 9p write acme/$winid/addr +echo "$block" | 9p write acme/$winid/data \ No newline at end of file diff --git a/scripts/colortest b/scripts/colortest new file mode 100755 index 0000000..f5b68f7 --- /dev/null +++ b/scripts/colortest @@ -0,0 +1,20 @@ +#!/bin/bash + +# https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html + +T='gYw' # The test text + +echo -e "\n 40m 41m 42m 43m\ + 44m 45m 46m 47m"; + +for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \ + '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \ + ' 36m' '1;36m' ' 37m' '1;37m'; + do FG=${FGs// /} + echo -en " $FGs \033[$FG $T " + for BG in 40m 41m 42m 43m 44m 45m 46m 47m; + do echo -en "$EINS \033[$FG\033[$BG $T \033[0m"; + done + echo; +done +echo diff --git a/scripts/cs b/scripts/cs new file mode 100755 index 0000000..f3090ba --- /dev/null +++ b/scripts/cs @@ -0,0 +1,7 @@ +#!/bin/sh + +[ -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/scripts/days2finals.py b/scripts/days2finals.py new file mode 100755 index 0000000..2111af6 --- /dev/null +++ b/scripts/days2finals.py @@ -0,0 +1,23 @@ +import datetime +now = datetime.datetime.now() + +finalsDate = datetime.datetime(2023, 5, 1, 0, 0, 0, 0) +breakDate = datetime.datetime(2023, 3, 3, 15, 0, 0, 0) +def getDays(date, name): + daysLeft = date - now + + weeks = daysLeft.days // 7 + days = daysLeft.days % 7 + minutes = daysLeft.seconds // 60 + hours = minutes // 60 + minutes %= 60 + + if (weeks < 0): + return f"{name.upper()} WEEK" + return f"{weeks} weeks {days} days and {hours} hours until {name} week" + +output = f"{getDays(finalsDate, 'finals')}" +#output += f"{getDays(breakDate, 'break')}" + + +print(output) diff --git a/scripts/getUnicode b/scripts/getUnicode new file mode 100755 index 0000000..13d7971 --- /dev/null +++ b/scripts/getUnicode @@ -0,0 +1,12 @@ +#!/bin/sh + +char=$(cut -d ';' -f1 ~/.local/share/unicode | dmenu -i -l 30 | sed "s/ .*//") + +[ -z "$char" ] && exit + +if [ -n "$1" ]; then + xdotool type "$char" +else + echo "$char" | tr -d '\n' | xclip -selection clipboard + notify-send "'$char' copied to clipboard." & +fi diff --git a/scripts/internet b/scripts/internet new file mode 100755 index 0000000..942eefe --- /dev/null +++ b/scripts/internet @@ -0,0 +1,10 @@ +#!/bin/sh + +[ "$(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 eth0 | grep 192.168.)" || IP="$(ip address | grep wlo | grep 192.168. )" + +IP="${IP%/*}" +IP="${IP##* }" + +echo $CONNECTION $IP diff --git a/scripts/ipfetch b/scripts/ipfetch new file mode 100755 index 0000000..05befda --- /dev/null +++ b/scripts/ipfetch @@ -0,0 +1,3 @@ +#!/bin/sh + +curl https://icanhazip.com diff --git a/scripts/jdm b/scripts/jdm new file mode 100755 index 0000000..d035b6e --- /dev/null +++ b/scripts/jdm @@ -0,0 +1,12 @@ +#!/bin/sh +declare -i count=1 # used as a reference throughout the script +for desktop in $XDG_DATA_HOME/xsessions/*.desktop # looks at all the desktop files in /usr/share/xsessions +do + name[$count]=$(grep "Name" $desktop | sed "s/Name=/$count /g") # grabs the name and adds it to an array + program[$count]=$(grep "Exec" $desktop | sed "s/Exec=//g") # grabs the path of the executable and adds it to an array + count=$((count+1)) +done +name[$count]="$count TTY" # adds an option for TTY +select=$(dialog --title "Jacob's Display Manager" --menu "Select a WM:" 0 0 0 ${name[*]} 3>&1 1>&2 2>&3 3>&-) # creates the menu box +[ "$select" != "$count" ] && [ "$select" != "0" ] && export wm=${program[$select]} && startx # startx if TTY is not selected +clear && cat /etc/motd # clears the ncurses prompt after executing and cat the message of the day file diff --git a/scripts/keys b/scripts/keys new file mode 100755 index 0000000..c525982 --- /dev/null +++ b/scripts/keys @@ -0,0 +1,10 @@ +#!/bin/sh +# This script is called on startup to remap keys. +# Decrease key repeat delay to 300ms and increase key repeat rate to 50 per second. +xset r rate 300 50 +# Map the caps lock key to super, and map the menu key to right super. +setxkbmap -option caps:super,altwin:menu_win +# When caps lock is pressed only once, treat it as escape. +killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape' +# Turn off caps lock if on since there is no longer a key for it. +xset -q | grep -q "Caps Lock:\s*on" && xdotool key Caps_Lock diff --git a/scripts/linkhandler b/scripts/linkhandler new file mode 100755 index 0000000..c13a462 --- /dev/null +++ b/scripts/linkhandler @@ -0,0 +1,26 @@ +#!/bin/sh + +# Feed script a url or file location. +# If an image, it will view in sxiv, +# if a video or gif, it will view in mpv +# if a music file or pdf, it will download, +# otherwise it opens link in browser. + +if [ -z "$1" ]; then + url="$(xclip -o)" +else + url="$1" +fi + +case "$url" in + *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) + notify-send "linkhandler: launching $url in mpv" && setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;; + *png|*jpg|*jpe|*jpeg|*gif) + curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *pdf|*cbz|*cbr) + curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *mp3|*flac|*opus|*mp3?source*) + qndl "$url" 'curl -LO' >/dev/null 2>&1 ;; + *) + [ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1 +esac diff --git a/scripts/mismatch b/scripts/mismatch new file mode 100755 index 0000000..38776bc --- /dev/null +++ b/scripts/mismatch @@ -0,0 +1,11 @@ +#!/bin/sh + +DICTFILE=/usr/share/dict/words + +[ -z $1 ] && words=$(< /dev/stdin) || words=$1 + +for word in $words +do + [ -z "$(grep -i "\b$word\b" $DICTFILE)" ] && echo $word +done + diff --git a/scripts/mkwords b/scripts/mkwords new file mode 100755 index 0000000..91a751d --- /dev/null +++ b/scripts/mkwords @@ -0,0 +1,5 @@ +#!/bin/sh + +[ -z "$1" ] && words="$(< /dev/stdin)" || words=$1 +echo $words | sed "s/ /\n/g" + diff --git a/scripts/money.py b/scripts/money.py new file mode 100755 index 0000000..4a36437 --- /dev/null +++ b/scripts/money.py @@ -0,0 +1,22 @@ +#!/usr/local/bin/python3 + +hours = int(input("Enter Hours Worked Per Week: ")) +wage = float(input("Enter Wage: ")) +tax = .13 + +checking = (hours * 4) * wage +checking -= checking * tax +savings = checking / 2 +checking -= savings + +miles = 830 +mpg = float(input("Enter Gas Milage: ")) +gasPrice = float(input("Enter Gas Price: ")) + +gas = (miles / mpg) * gasPrice + +expenses = gas + 10 + +checking -= expenses + +print(f"${checking+savings:,.2f} left over total\n${checking:,.2f} left over for checking each month\n${savings:,.2f} left over for savings each month\nCost of gas: ${gas:,.2f}") diff --git a/scripts/mr b/scripts/mr new file mode 100755 index 0000000..b3d7c48 --- /dev/null +++ b/scripts/mr @@ -0,0 +1,3 @@ +#!/bin/sh + +make run \ No newline at end of file diff --git a/scripts/prompt b/scripts/prompt new file mode 100755 index 0000000..5148d0a --- /dev/null +++ b/scripts/prompt @@ -0,0 +1,3 @@ +#!/bin/sh +[ "$(printf "No\nYes" | wofi -d -p "$1")" = "Yes" ] && $2 + diff --git a/scripts/rebootPrompt b/scripts/rebootPrompt new file mode 100755 index 0000000..4c3c361 --- /dev/null +++ b/scripts/rebootPrompt @@ -0,0 +1,3 @@ +#!/bin/sh + +prompt 'Reboot?' 'sudo reboot' diff --git a/scripts/rotdir b/scripts/rotdir new file mode 100755 index 0000000..86da6db --- /dev/null +++ b/scripts/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/scripts/setWall b/scripts/setWall new file mode 100755 index 0000000..2e63a0a --- /dev/null +++ b/scripts/setWall @@ -0,0 +1,6 @@ +#!/bin/sh + +[ -f "$1" ] && cp "$1" ~/.config/wall.png +[ -d "$1" ] && cp "$(find "$1" -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" -type f | shuf -n 1)" ~/.config/wall.png +xwallpaper --zoom ~/.config/wall.png + diff --git a/scripts/shutdownPrompt b/scripts/shutdownPrompt new file mode 100755 index 0000000..1be046d --- /dev/null +++ b/scripts/shutdownPrompt @@ -0,0 +1,3 @@ +#!/bin/sh + +prompt 'Shutdown?' 'sudo shutdown -h now' diff --git a/scripts/testPort b/scripts/testPort new file mode 100755 index 0000000..92e76d4 --- /dev/null +++ b/scripts/testPort @@ -0,0 +1,6 @@ +#!/bin/sh + +nc -vz $1 25565 ; + nc -vz $1 80 ; + nc -vz $1 443 ; +nc -vz $1 22 diff --git a/scripts/theme b/scripts/theme new file mode 100755 index 0000000..c6f0c2c --- /dev/null +++ b/scripts/theme @@ -0,0 +1,14 @@ +#!/bin/zsh +# Switch to Solarized Dark if we are currently in dark mode +if [[ "$(uname -s)" == "Darwin" ]]; then + val=$(defaults read -g AppleInterfaceStyle 2>/dev/null) + if [[ $val == "Dark" ]]; then + osascript -e 'tell application "Terminal" + set current settings of tabs of windows to settings set "PaperColor-dark" # Theme name + end tell' + else + osascript -e 'tell application "Terminal" + set current settings of tabs of windows to settings set "PaperColor-light" # Theme name + end tell' + fi +fi diff --git a/scripts/tmux-sessionizer b/scripts/tmux-sessionizer new file mode 100755 index 0000000..3780e18 --- /dev/null +++ b/scripts/tmux-sessionizer @@ -0,0 +1,29 @@ +#!/bin/zsh + +# This script is stolen from The Primeagen +# https://github.com/ThePrimeagen/.dotfiles/ + +if [[ $# -eq 1 ]]; then + selected=$1 +else + selected=$(find ~/Documents/Projects ~ ~/.config ~/Documents/Projects/git ~/Documents/Projects/Experiments -mindepth 1 -maxdepth 1 -type d | fzf) +fi + +if [[ -z $selected ]]; then + exit 0 +fi + +selected_name=$(basename "$selected" | tr . _) +tmux_running=$(pgrep tmux) + +if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then + tmux new-session -s $selected_name -c $selected + exit 0 +fi + +if ! tmux has-session -t=$selected_name 2> /dev/null; then + tmux new-session -ds $selected_name -c $selected +fi + +tmux switch-client -t $selected_name + diff --git a/scripts/unix b/scripts/unix new file mode 100755 index 0000000..a9fb96e --- /dev/null +++ b/scripts/unix @@ -0,0 +1,26 @@ +#!/bin/sh + +#original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes +#converted to shell by #nixers @ irc.unix.chat + +cat << 'eof' + ,_ ,_==▄▂ + , ▂▃▄▄▅▅▅▂▅¾. / / + ▄▆<´ "»▓▓▓%\ / / / / + ,▅7" ´>▓▓▓% / / > / >/% + ▐¶▓ ,»▓▓¾´ /> %/%// / / + ▓▃▅▅▅▃,,▄▅▅▅Æ\// ///>// />/ / + V║«¼.;→ ║<«.,`=// />//%/% / / + //╠<´ -²,)(▓~"-╝/¾/ %/>/ /> + / / / ▐% -./▄▃▄▅▐, /7//;//% / / + / ////`▌▐ %zWv xX▓▇▌//&;% / / + / / / %//%/¾½´▌▃▄▄▄▄▃▃▐¶\/& / + </ /)VY>7; \_ UNIX IS VERY SIMPLE IT JUST NEEDS A + / /</ //<///<_/%\▓ V%W%£)XY _/%‾\_, GENIUS TO UNDERSTAND ITS SIMPLICITY + / / //%/_,=--^/%/%%\¾%¶%%} /%%%%%%;\, + %/< /_/ %%%%%;X%%\%%;, _/%%%;, \ + / / %%%%%%;, \%%l%%;// _/%;, dmr + / %%%;, <;\-=-/ / + ;, l +eof diff --git a/scripts/volume b/scripts/volume new file mode 100755 index 0000000..ba26561 --- /dev/null +++ b/scripts/volume @@ -0,0 +1,7 @@ +#!/bin/sh + +vol="$(pamixer --get-volume-human)" + +[ "$vol" == "muted" ] && label="🔇" || label="🔊 $vol" + +echo "$label" diff --git a/scripts/weather b/scripts/weather new file mode 100755 index 0000000..664b0b1 --- /dev/null +++ b/scripts/weather @@ -0,0 +1,10 @@ +#!/bin/sh + +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 "°"}' ;} + +[ "$(stat -c %y "$HOME/.cache/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && getforecast +showweather diff --git a/scripts/ytrss b/scripts/ytrss new file mode 100755 index 0000000..8539b18 --- /dev/null +++ b/scripts/ytrss @@ -0,0 +1,15 @@ +#!/bin/sh + +if test -n "$1"; +then + id=$1 +elif test ! -t 0; +then + id=$(cat < /dev/stdin) +else + echo "ytrss: No Input" + exit +fi + +echo "https://www.youtube.com/feeds/videos.xml?channel_id="$id + diff --git a/util b/util new file mode 100755 index 0000000..4b0dff2 --- /dev/null +++ b/util @@ -0,0 +1,41 @@ +#!/bin/zsh + +set -o shwordsplit + +log() { + if [[ $dry == "1" ]]; then + echo "[DRY_RUN]: $1" + else + echo "$1" + fi +} + +execute() { + log "execute $@" + if [[ $dry == "1" ]]; then + return + fi + "$@" +} + +copy_dir() { + from=$1 + to=$2 + pushd $from + dirs="$(find . -maxdepth 1 -mindepth 1 -type d)" + for dir in $dirs; do + execute rm -rf $to/$dir + execute cp -r $dir $to/$dir + done + popd +} + +copy_file() { + from=$1 + to=$2 + name=$(basename $from) + + execute rm $to/$name + execute cp $from $to/$name +} + -- cgit v1.2.3