diff options
Diffstat (limited to 'pkgs/sources/scripts/source/small_functions')
5 files changed, 0 insertions, 301 deletions
diff --git a/pkgs/sources/scripts/source/small_functions/brightness.sh b/pkgs/sources/scripts/source/small_functions/brightness.sh deleted file mode 100755 index a7272279..00000000 --- a/pkgs/sources/scripts/source/small_functions/brightness.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -help() { - cat <<EOF -This is a system brightness manager - -USAGE: - $NAME up [VALUE] | down [VALUE] - -OPTIONS: - --help | -h - Output this help and exit. - - --version | -v - Output the version and exit. - -COMMANDS: - up [VALUE] - Increase the brightness by VALUE or 5%. - - down [VALUE] - Decrease the brightness by VALUE or 5%. - -ARGUMENTS: - VALUE := [[seq 0 100]] - The amount to increase/decrease the brightness. In percentage -EOF -} - -BACKLIGHT="/sys/class/%BACKLIGHT_NAME" - -brightness() { - offset="$1" - - max="$(cat $BACKLIGHT/max_brightness)" - cur="$(cat $BACKLIGHT/brightness)" - percentage="$(echo | awk --assign=cur="$cur" --assign=max="$max" '{printf cur / max}')" - - new="$(echo | awk --assign=per="$percentage" --assign=offset="$offset" '{printf per + (offset / 10)}')" - - output="$(echo | awk --assign=new="$new" --assign=max="$max" '{printf max * new}')" - - msg "echo \"$output\" > $BACKLIGHT/brightness" -} - -for arg in "$@"; do - case "$arg" in - "--help" | "-h") - help - exit 0 - ;; - "--version" | "-v") - version - exit 0 - ;; - esac -done - -case "$1" in -"up") - shift 1 - value="5" - [ -n "$1" ] && value="$1" - brightness "+$value" - ;; -"down") - shift 1 - value="-5" - [ -n "$1" ] && value="$1" - brightness "-$value" - ;; -*) - die "The command '$1' does not exist! See '--help' for a list" - ;; -esac - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/small_functions/nato.py b/pkgs/sources/scripts/source/small_functions/nato.py deleted file mode 100755 index e9d15f56..00000000 --- a/pkgs/sources/scripts/source/small_functions/nato.py +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env python3 -# originally from here: https://cgit.pacien.net/desktop-utilities/ - -import sys - -alphabet = { - "nato": { - "A": "Alfa", # No idea why this is not just 'Alpha' .. - "B": "Bravo", - "C": "Charlie", - "D": "Delta", - "E": "Echo", - "F": "Foxtrot", - "G": "Golf", - "H": "Hotel", - "I": "India", - "J": "Juliett", - "K": "Kilo", - "L": "Lima", - "M": "Mike", - "N": "November", - "O": "Oscar", - "P": "Papa", - "Q": "Quebec", - "R": "Romeo", - "S": "Sierra", - "T": "Tango", - "U": "Uniform", - "V": "Victor", - "W": "Whiskey", - "X": "X-ray", - "Y": "Yankee", - "Z": "Zulu", - "0": "Nadazero", - "1": "Unaone", - "2": "Bissotwo", - "3": "Terrathree", - "4": "Kartefour", - "5": "Pantafive", - "6": "Soxisix", - "7": "Setteseven", - "8": "Oktoeight", - "9": "Novenine", - ",": "Comma", - "/": "Forward slash", - ".": "Stop/Decimal", - }, - "german": { - "A": "Aachen", - "Ä": "Umlaut Aachen", - "B": "Berlin", - "C": "Chemnitz", - "D": "Düsseldorf", - "E": "Essen", - "F": "Frankfurt", - "G": "Goslar", - "H": "Hamburg", - "I": "Ingelheim", - "J": "Jena", - "K": "Köln", - "L": "Leipzig", - "M": "München", - "N": "Nürnberg", - "O": "Offenbach", - "Ö": "Umlaut Offenbach", - "P": "Potsdam", - "Q": "Quickborn", - "R": "Rostock", - "S": "Salzwedel", - "ẞ": "Eszett", - "T": "Tübingen", - "U": "Unna", - "Ü": "Umlaut Unna", - "V": "Völklingen", - "W": "Wuppertal", - "X": "Xanten", - "Y": "Ypsilon", - "Z": "Zwickau", - }, -} - - -def str_to_telephony(phrase, language): - language_alphabet = alphabet[language] - - return [ - language_alphabet[c] if c in language_alphabet else c for c in phrase.upper() - ] - - -language = sys.argv[1] -if language not in ["nato", "german"]: - print( - f"Langugae '{language}' is not a valid language, only 'nato' and 'german' are!", - file=sys.stderr, - ) - exit(1) - -print( - "\n".join( - str_to_telephony( - " ".join(sys.argv[2:]), - language, - ) - ) -) diff --git a/pkgs/sources/scripts/source/small_functions/screenshot_persistent.sh b/pkgs/sources/scripts/source/small_functions/screenshot_persistent.sh deleted file mode 100755 index 4308b8d2..00000000 --- a/pkgs/sources/scripts/source/small_functions/screenshot_persistent.sh +++ /dev/null @@ -1,22 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# only generate a path (this could lead to a time-of-check/time-of-use bug) -tmp="$(mktmp --dry-run)" - -if grim -g "$(slurp)" "$tmp"; then - name="$(rofi -dmenu -p "Name of screenshot: " -l 0)" - screen_shot_path="$HOME/media/pictures/screenshots/$name.png" - while [ -f "$screen_shot_path" ]; do - notify-send "Warning" 'Screenshot name already in use!' - name="$(rofi -dmenu -p "New name of screenshot: " -l 0)" - screen_shot_path="$HOME/media/pictures/screenshots/$name.png" - done - - mv "$tmp" "$screen_shot_path" - alacritty -e lf -command ":{{ set sortby atime; set reverse!; }}" -fi - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/small_functions/screenshot_temporary.sh b/pkgs/sources/scripts/source/small_functions/screenshot_temporary.sh deleted file mode 100755 index 8968ca79..00000000 --- a/pkgs/sources/scripts/source/small_functions/screenshot_temporary.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -grim -g "$(slurp)" | wl-copy - -# vim: ft=sh diff --git a/pkgs/sources/scripts/source/small_functions/update-sys.sh b/pkgs/sources/scripts/source/small_functions/update-sys.sh deleted file mode 100755 index d28247f6..00000000 --- a/pkgs/sources/scripts/source/small_functions/update-sys.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -help() { - cat <<EOF -This is a NixOS System flake update manager. - -USAGE: - $NAME [--branch <branchname>] [--help] - -OPTIONS: - --branch | -b BRANCHNAME - select a branch to update from. - - --mode | -m MODE - select a mode to update with - - --help | -h - output this help. -ARGUMENTS: - BRANCHNAME := [[ git branch --list --format '%(refname:short)' ]] - The name of the branch to deploy the config from - - MODE := switch|boot|test|build|dry-build|dry-activate|edit|repl|build-vm|build-vm-with-bootloader - See the 'nixos-rebuild' manpage for more information about these modes. -EOF - exit "$1" -} -default_branch=$(mktmp) -BRANCH="" - -while [ "$#" -gt 0 ]; do - case "$1" in - "--help" | "-h") - help 0 - ;; - "--branch" | "-b") - if [ -n "$2" ]; then - BRANCH="$2" - else - error "$1 requires an argument" - help 1 - fi - shift 2 - ;; - "--mode" | "-m") - if [ -n "$2" ]; then - MODE="$2" - else - error "$1 requires an argument" - help 1 - fi - shift 2 - ;; - *) - error "the option $1 does not exist!" - help 1 - ;; - esac -done - -cd /etc/nixos || die "No /etc/nixos" -msg "Starting system update..." -git remote update origin --prune >/dev/null 2>&1 -if ! [ "$BRANCH" = "" ]; then - git switch "$BRANCH" >/dev/null 2>&1 && msg2 "Switched to branch '$BRANCH'" -fi -msg2 "Updating git repository..." -git pull --rebase - -git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' >"$default_branch" & - -msg2 "Updating system..." -if [ -n "$MODE" ]; then - nixos-rebuild "$MODE" -else - nixos-rebuild switch -fi - -git switch "$(cat "$default_branch")" >/dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'" -msg "Finished Update!" - -# vim: ft=sh |