diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:56:17 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:56:17 -0400 |
commit | 9e82c96713989a7565eadac505b36e3dbe91cd5a (patch) | |
tree | 7c2f998cc9d06f97bfe10ce1ee844121b662f595 /.local/bin | |
parent | 3adcf542289a0883924ae9b9be8b898c36702c95 (diff) |
Added, removed, renamed scripts
Diffstat (limited to '.local/bin')
31 files changed, 34 insertions, 260 deletions
diff --git a/.local/bin/alarm b/.local/bin/alarm deleted file mode 100755 index 2909ecf..0000000 --- a/.local/bin/alarm +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | [ $1 = "-h" -o $1 = "--help" ] && echo "usage: alarm time sound_file" && exit 0 | ||
4 | [ $# != 2 ] && echo "usage: alarm time sound_file" && exit 1 | ||
5 | |||
6 | echo "alarm set for $1" | ||
7 | echo "$(basename "$2") is the alarm tone" | ||
8 | |||
9 | while [ $(date +%H:%M) != "$1" ] | ||
10 | do | ||
11 | sleep 1 | ||
12 | done | ||
13 | |||
14 | amixer -q sset Master 100% unmute | ||
15 | pkill -RTMIN+10 i3blocks | ||
16 | mpv --loop=inf $2 | ||
17 | |||
diff --git a/.local/bin/backups/assimilate b/.local/bin/backups/assimilate deleted file mode 100755 index fd6ed7f..0000000 --- a/.local/bin/backups/assimilate +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Full system backup with borg | ||
3 | |||
4 | # Validate argument - should either be onsite or offsite to specify location | ||
5 | ERRMSG="error: please specify either onsite or offsite" | ||
6 | [ $# -ne 1 ] && echo $ERRMSG && exit 1 | ||
7 | [ "$1" != "onsite" -a "$1" != "offsite" ] && echo $ERRMSG && exit 1 | ||
8 | |||
9 | # Set variables | ||
10 | LOCATION="$1" | ||
11 | SUDO_OPTS="--preserve-env=BORG_PASSCOMMAND,PASSWORD_STORE_DIR" | ||
12 | CREATE_OPTS="--warning --stats --show-rc --exclude-caches --one-file-system" | ||
13 | LOG="$HOME/.config/borg/log" | ||
14 | |||
15 | # Hack to get repository passphrase from pass | ||
16 | # The passcommand will be invoked as root, so use sudo to run it as the user calling the script | ||
17 | # who owns the password store. The environmental variable PASSWORD_STORE_DIR is passed through | ||
18 | # SUDO_OPTS to the borg commands, and then passed to this command from the borg command | ||
19 | # by the same means. This allows custom password store locations to work with this script. | ||
20 | export BORG_PASSCOMMAND="sudo $SUDO_OPTS -u $USER pass Borg-Backup/$(hostname)-$LOCATION" | ||
21 | |||
22 | # Create variables and function to monitor exit status | ||
23 | WARNING=0 | ||
24 | ERROR=0 | ||
25 | check_rc() { | ||
26 | rc=$1 | ||
27 | [ $1 -eq 1 ] && WARNING=1 | ||
28 | [ $1 -eq 2 ] && ERROR=1 | ||
29 | } | ||
30 | |||
31 | # Start backup | ||
32 | echo -e "\n$LOCATION $(date)\n" >> $LOG | ||
33 | notify-send "beginning $LOCATION backup" | ||
34 | |||
35 | # Backup root partition | ||
36 | sudo $SUDO_OPTS borg create $CREATE_OPTS \ | ||
37 | --exclude '/dev/*' \ | ||
38 | --exclude '/proc/*' \ | ||
39 | --exclude '/sys/*' \ | ||
40 | --exclude '/tmp/*' \ | ||
41 | --exclude '/mnt/*' \ | ||
42 | --exclude '/media/*' \ | ||
43 | "/mnt/$LOCATION-backup/$(hostname)::root-{now:%Y-%m-%d}" / 2>>$LOG | ||
44 | check_rc $? | ||
45 | |||
46 | # Backup boot parition | ||
47 | sudo $SUDO_OPTS borg create $CREATE_OPTS \ | ||
48 | "/mnt/$LOCATION-backup/$(hostname)::boot-{now:%Y-%m-%d}" /boot 2>>$LOG | ||
49 | check_rc $? | ||
50 | |||
51 | # Send notifications based on return codes of archives | ||
52 | |||
53 | [ $WARNING -eq 1 ] && notify-send "One or more archives produced a warning" \ | ||
54 | "Please check the log at $LOG" | ||
55 | |||
56 | [ $ERROR -eq 1 ] && notify-send -u critical \ | ||
57 | "One or more archives produced an error and was unable to complete" \ | ||
58 | "Please check the log at $LOG" | ||
59 | |||
60 | [ $WARNING -eq 0 -a $ERROR -eq 0 ] && notify-send "$LOCATION backup complete" | ||
diff --git a/.local/bin/check-repos b/.local/bin/check-repos deleted file mode 100755 index d528ce6..0000000 --- a/.local/bin/check-repos +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd $HOME/repos | ||
4 | for repo in $(ls) | ||
5 | do | ||
6 | [ -d $repo/.git ] && echo $repo && \ | ||
7 | echo "------------------------------------------------------" && \ | ||
8 | git --git-dir=$repo/.git --work-tree=$repo status 2>/dev/null && \ | ||
9 | echo "------------------------------------------------------" | ||
10 | done | ||
diff --git a/.local/bin/cmus/toggle-mode b/.local/bin/cmus/toggle-mode deleted file mode 100755 index e73edc6..0000000 --- a/.local/bin/cmus/toggle-mode +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Toggles the cmus aaa mode (all,album,artist) | ||
3 | |||
4 | cmus-remote -C "toggle aaa_mode" | ||
5 | mode=$(cmus-remote -Q | grep "aaa_mode" | cut -d ' ' -f 3) | ||
6 | artist=$(cmus-remote -Q | grep "tag artist" | cut -d ' ' -f 3-) | ||
7 | album=$(cmus-remote -Q | grep "tag album" | cut -d ' ' -f 3-) | ||
8 | |||
9 | [ "$mode" = "all" ] && dunstctl close-all && notify-send "Playing from full library" \ | ||
10 | && exit | ||
11 | [ "$mode" = "artist" ] && dunstctl close-all && notify-send "Playing by artist: $artist" \ | ||
12 | && exit | ||
13 | [ "$mode" = "album" ] && dunstctl close-all && notify-send "Playing from album: $album" \ | ||
14 | && exit | ||
diff --git a/.local/bin/cmus/toggle-shuf b/.local/bin/cmus/toggle-shuf deleted file mode 100755 index 57c2606..0000000 --- a/.local/bin/cmus/toggle-shuf +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Toggle and report status of shuffle mode in cmus | ||
3 | |||
4 | cmus-remote --shuffle | ||
5 | status=$(cmus-remote -Q | grep shuffle | cut -d ' ' -f 3) | ||
6 | dunstctl close-all | ||
7 | [ "$status" = "true" ] && notify-send "Shuffle on" || notify-send "Shuffle off" | ||
diff --git a/.local/bin/cryptusb/create-cryptusb b/.local/bin/create-cryptusb index e0f49fe..77d232e 100755 --- a/.local/bin/cryptusb/create-cryptusb +++ b/.local/bin/create-cryptusb | |||
@@ -30,5 +30,3 @@ sudo mkfs.ext4 "/dev/mapper/$map_name" | |||
30 | sudo cryptsetup close "$map_name" | 30 | sudo cryptsetup close "$map_name" |
31 | 31 | ||
32 | echo "done" | 32 | echo "done" |
33 | |||
34 | |||
diff --git a/.local/bin/cryptusb/sync-cryptusb b/.local/bin/cryptusb/sync-cryptusb deleted file mode 100755 index 6ba2737..0000000 --- a/.local/bin/cryptusb/sync-cryptusb +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Syncs important files to encrypted USB | ||
3 | |||
4 | mount-device && \ | ||
5 | rsync -avP --exclude="virtual_machines*" --exclude="media*" \ | ||
6 | --exclude="*.iso" --exclude="*.qcow2" \ | ||
7 | $HOME/ /mnt/cryptusb/$USER@$(hostname)/ && \ | ||
8 | unmount-device | ||
diff --git a/.local/bin/exiti3 b/.local/bin/exiti3 deleted file mode 100755 index 0fe76bf..0000000 --- a/.local/bin/exiti3 +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | read -p "Exit i3 [Y]/n?" exit | ||
3 | [ "$exit" = "Y" ] && i3-msg exit | ||
4 | |||
diff --git a/.local/bin/get-pkgs b/.local/bin/get-pkgs deleted file mode 100755 index 19e64f3..0000000 --- a/.local/bin/get-pkgs +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Creates files containing lists of installed and manually installed packages | ||
3 | # in cache directory | ||
4 | |||
5 | pkgdir="$HOME/.cache/packages" | ||
6 | apt list --installed | tail -n+2 | cut -d '/' -f 1 > $pkgdir/installed | ||
7 | apt list --manual-installed | tail -n+2 | | ||
8 | cut -d '/' -f 1 > $pkgdir/manual-installed | ||
diff --git a/.local/bin/getmail b/.local/bin/getmail new file mode 100755 index 0000000..c36137e --- /dev/null +++ b/.local/bin/getmail | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ping -c 1 9.9.9.9 >/dev/null && mbsync -a && notify-send "Mail Synced" | ||
diff --git a/.local/bin/getpass b/.local/bin/getpass index bfa344f..1f9b3b5 100755 --- a/.local/bin/getpass +++ b/.local/bin/getpass | |||
@@ -3,13 +3,12 @@ | |||
3 | pb=$PASSWORD_STORE_DIR | 3 | pb=$PASSWORD_STORE_DIR |
4 | [ -z "$PASSWORD_STORE_CLIP_TIME" ] && ct=45 || ct=$PASSWORD_STORE_CLIP_TIME | 4 | [ -z "$PASSWORD_STORE_CLIP_TIME" ] && ct=45 || ct=$PASSWORD_STORE_CLIP_TIME |
5 | chars=$(echo $pb | wc -c) | 5 | chars=$(echo $pb | wc -c) |
6 | accts=$(find $pb -type f -name "*.gpg" | cut -c 2- | \ | 6 | accts=$(find $pb -type f -name "*.gpg" | cut -c 2- | cut -c $chars- | \ |
7 | grep -v ".*-OTP.gpg\|.*-2farecovery.gpg" | cut -c $chars- | \ | ||
8 | rev | cut -c 5- | rev) | 7 | rev | cut -c 5- | rev) |
9 | acct="$(echo "$accts" | dmenu)" | 8 | acct="$(echo "$accts" | dmenu)" |
10 | [ "$acct" = "" ] && exit | 9 | [ "$acct" = "" ] && exit |
11 | pass show $acct | xclip -r -selection "primary" \ | 10 | pass show $acct | head -1 | xclip -r -selection "primary" \ |
12 | && pass show $acct | xclip -r -selection "clipboard" \ | 11 | && pass show $acct | head -1 | xclip -r -selection "clipboard" \ |
13 | && notify-send "Password Copied to Clipboard" \ | 12 | && notify-send "Password Copied to Clipboard" \ |
14 | && sleep $ct \ | 13 | && sleep $ct \ |
15 | && pkill xclip | 14 | && pkill xclip |
diff --git a/.local/bin/getpass-otp b/.local/bin/getpass-otp index 535cc31..19c0c0e 100755 --- a/.local/bin/getpass-otp +++ b/.local/bin/getpass-otp | |||
@@ -3,7 +3,7 @@ | |||
3 | pb=$PASSWORD_STORE_DIR | 3 | pb=$PASSWORD_STORE_DIR |
4 | [ -z "$PASSWORD_STORE_CLIP_TIME" ] && ct=45 || ct=$PASSWORD_STORE_CLIP_TIME | 4 | [ -z "$PASSWORD_STORE_CLIP_TIME" ] && ct=45 || ct=$PASSWORD_STORE_CLIP_TIME |
5 | chars=$(echo $pb | wc -c) | 5 | chars=$(echo $pb | wc -c) |
6 | accts=$(find $pb -type f -name "*-OTP.gpg" | cut -c $chars- | \ | 6 | accts=$(find $pb -type f -name "*.gpg" | cut -c $chars- | \ |
7 | rev | cut -c 5- | rev) | 7 | rev | cut -c 5- | rev) |
8 | acct="$(echo "$accts" | dmenu)" | 8 | acct="$(echo "$accts" | dmenu)" |
9 | pass otp code $acct | xclip -r -selection "primary" \ | 9 | pass otp code $acct | xclip -r -selection "primary" \ |
diff --git a/.local/bin/id-init b/.local/bin/id-init index 72f8cbe..0634fe4 100755 --- a/.local/bin/id-init +++ b/.local/bin/id-init | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | tmpfile="$(mktemp)" | 3 | tmpfile="$(mktemp)" |
4 | chmod 700 $tmpfile | 4 | chmod 700 $tmpfile |
5 | echo "pass ssh" > $tmpfile | 5 | echo "pass homelab/ssh" > $tmpfile |
6 | export SSH_ASKPASS="$tmpfile" | 6 | export SSH_ASKPASS="$tmpfile" |
7 | export SSH_ASKPASS_REQUIRE="force" | 7 | export SSH_ASKPASS_REQUIRE="force" |
8 | ssh-add | 8 | ssh-add |
diff --git a/.local/bin/init-tv b/.local/bin/init-tv new file mode 100755 index 0000000..17e7111 --- /dev/null +++ b/.local/bin/init-tv | |||
@@ -0,0 +1,3 @@ | |||
1 | xrandr --output HDMI-A-1 --auto --right-of DisplayPort-0 --mode 3840x2160 | ||
2 | bgscript | ||
3 | #--set underscan on --set "underscan vborder" 60 --set "underscan hborder" 70 --right-of DisplayPort-0 --mode 1920x1080 | ||
diff --git a/.local/bin/kill-libvirtd b/.local/bin/kill-libvirtd deleted file mode 100755 index 2ea802d..0000000 --- a/.local/bin/kill-libvirtd +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Stop all running domains and networks, and then stop all libvirtd daemons | ||
3 | |||
4 | # Save running domains | ||
5 | rundoms="$(virsh list | grep running | awk '{print $2}')" | ||
6 | for dom in $rundoms | ||
7 | do | ||
8 | virsh managedsave $dom | ||
9 | done | ||
10 | |||
11 | # Stop network | ||
12 | virsh net-destroy default | ||
13 | |||
14 | # Stop libvirtd | ||
15 | sudo systemctl stop libvirtd >/dev/null | ||
16 | sudo systemctl stop libvirtd-ro.socket >/dev/null | ||
17 | sudo systemctl stop libvirtd-admin.socket >/dev/null | ||
18 | sudo systemctl stop libvirtd.socket >/dev/null | ||
19 | sudo systemctl stop virtlogd >/dev/null | ||
20 | sudo systemctl stop virtlogd-admin.socket >/dev/null | ||
21 | sudo systemctl stop virtlogd.socket >/dev/null | ||
22 | sudo systemctl stop systemd-machined >/dev/null | ||
diff --git a/.local/bin/kill-steam b/.local/bin/kill-steam deleted file mode 100755 index 5572ae7..0000000 --- a/.local/bin/kill-steam +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | pkill -f steam | ||
diff --git a/.local/bin/lock b/.local/bin/lock deleted file mode 100755 index 223ac59..0000000 --- a/.local/bin/lock +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Locks the screen with a blurred screenshot of the current window as the lock image | ||
3 | # Also pauses any music that is playing | ||
4 | |||
5 | maim | convert - -paint 5 ~/.cache/lock.png | ||
6 | [ "$(cmus-remote -Q | head -1 | cut -d ' ' -f 2)" != "playing" ] || cmus-remote --pause | ||
7 | i3lock -u -e -i ~/.cache/lock.png | ||
diff --git a/.local/bin/merge-renovate b/.local/bin/merge-renovate new file mode 100755 index 0000000..ce23161 --- /dev/null +++ b/.local/bin/merge-renovate | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | image="$1" | ||
4 | [ "$image" = "" ] && echo "error: no image specified" && exit 1 | ||
5 | git checkout -b renovate/$image master | ||
6 | git pull --no-edit origin renovate/$image | ||
7 | git checkout master | ||
8 | git merge --no-ff --no-edit renovate/$image | ||
diff --git a/.local/bin/dmenu/mount-device b/.local/bin/mount-device index c2decd5..6b644df 100755 --- a/.local/bin/dmenu/mount-device +++ b/.local/bin/mount-device | |||
@@ -8,7 +8,7 @@ | |||
8 | devs="$(lsblk -lpo NAME,FSTYPE,SIZE,TYPE,MOUNTPOINT | grep "part\s*$\|crypto_LUKS" | awk '{print $1,"-",$3}')" | 8 | devs="$(lsblk -lpo NAME,FSTYPE,SIZE,TYPE,MOUNTPOINT | grep "part\s*$\|crypto_LUKS" | awk '{print $1,"-",$3}')" |
9 | [ "$devs" = "" ] && exit 0 | 9 | [ "$devs" = "" ] && exit 0 |
10 | dev="$(echo "$devs" | dmenu -i -p "Select device" | cut -d ' ' -f 1)" | 10 | dev="$(echo "$devs" | dmenu -i -p "Select device" | cut -d ' ' -f 1)" |
11 | [ "$dev" = "" ] && exit 0 | 11 | [ "$dev" = "" ] && exit 1 |
12 | 12 | ||
13 | # Open and map drive if it is encrypted | 13 | # Open and map drive if it is encrypted |
14 | crypt=0 | 14 | crypt=0 |
diff --git a/.local/bin/mount-media b/.local/bin/mount-media index e748941..f35e4af 100755 --- a/.local/bin/mount-media +++ b/.local/bin/mount-media | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # Uses sshfs to locally mount media directories | 2 | # Uses sshfs to locally mount media directories |
3 | # Check if the media computer is reachable and if so mount the media | 3 | # Check if the media computer is reachable and if so mount the media |
4 | ping -W 0.01 -c 1 prometheus >/dev/null && \ | 4 | ping -W 0.01 -c 1 docker >/dev/null && \ |
5 | sshfs sisko@prometheus:/mnt/raid/media/ $HOME/media/prometheus/ | 5 | sshfs docker:/srv/docker/arr/data/media $HOME/media |
6 | 6 | ||
diff --git a/.local/bin/start-vm b/.local/bin/start-vm deleted file mode 100755 index 5ffea03..0000000 --- a/.local/bin/start-vm +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Starts libvirtd, default network, and optionally any domains given as arguments | ||
3 | |||
4 | pgrep libvirtd >/dev/null || sudo systemctl start libvirtd | ||
5 | virsh net-start default | ||
6 | for domain in "$@" | ||
7 | do | ||
8 | virsh start $domain | ||
9 | done | ||
diff --git a/.local/bin/stop-alarm b/.local/bin/stop-alarm deleted file mode 100755 index 4607b11..0000000 --- a/.local/bin/stop-alarm +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | pkill mpv | ||
4 | amixer -q sset Master 50% | ||
5 | pkill -RTMIN+10 i3blocks | ||
diff --git a/.local/bin/stop-vm b/.local/bin/stop-vm deleted file mode 100755 index 6c92250..0000000 --- a/.local/bin/stop-vm +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Stops domains given as arguments | ||
3 | |||
4 | opts=$(getopt -o 'as' -l 'all,save' -- "$@") | ||
5 | eval set -- "$opts" | ||
6 | all=0 | ||
7 | save=0 | ||
8 | while true | ||
9 | do | ||
10 | case $1 in | ||
11 | '-a'|'--all') all=1; shift; continue ;; | ||
12 | '-s'|'--save') save=1; shift; continue ;; | ||
13 | '--') shift; break;; | ||
14 | esac | ||
15 | done | ||
16 | |||
17 | [ $all -eq 1 ] && domains="$(virsh list | grep running | awk '{print $2}')" || domains="$@" | ||
18 | for domain in $domains | ||
19 | do | ||
20 | [ $save -eq 1 ] && virsh managedsave $domain || virsh shutdown $domain | ||
21 | done | ||
diff --git a/.local/bin/sync-cryptusb b/.local/bin/sync-cryptusb new file mode 100755 index 0000000..46daef9 --- /dev/null +++ b/.local/bin/sync-cryptusb | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/bin/sh | ||
2 | # Syncs important files to encrypted USB | ||
3 | |||
4 | mount-device && \ | ||
5 | rsync -avP --delete-after --exclude="virtual_machines*" --exclude="media*" \ | ||
6 | --exclude="*.iso" --exclude="*.qcow2" --exclude="*.zip" --exclude="*.img"\ | ||
7 | $HOME/ /mnt/cryptusb/$USER@$(hostname)/ | ||
8 | unmount-device | ||
diff --git a/.local/bin/sync-music b/.local/bin/sync-music index 4619a23..3338c48 100755 --- a/.local/bin/sync-music +++ b/.local/bin/sync-music | |||
@@ -1,4 +1,5 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # Sync music from media computer to local computer | 2 | # Sync music from media computer to local computer |
3 | 3 | ||
4 | rsync -av sisko@prometheus:/mnt/raid/media/music/ $HOME/media/music/ | 4 | rsync -av samadmin@jellyfin:/mnt/media/music/beets $HOME/media/music/ |
5 | #rsync -av $HOME/media/music/ mobian@192.168.88.252:~/Music/ | ||
diff --git a/.local/bin/theme/get-gradient b/.local/bin/theme/get-gradient deleted file mode 100755 index 91f9391..0000000 --- a/.local/bin/theme/get-gradient +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # Gets and sets a color gradient for cava | ||
3 | |||
4 | start="$1" | ||
5 | end="$2" | ||
6 | colors=$(~/.local/bin/theme/gradient.py $start $end 7) | ||
7 | |||
8 | num=1 | ||
9 | path="$HOME/.config/cava/config" | ||
10 | for color in $colors; do | ||
11 | sed -i "s/gradient_color_$num.*$/gradient_color_$num = '$color'/" $path | ||
12 | num=$((num+1)) | ||
13 | done | ||
diff --git a/.local/bin/theme/gradient.py b/.local/bin/theme/gradient.py deleted file mode 100755 index f95bb07..0000000 --- a/.local/bin/theme/gradient.py +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | #!/usr/bin/python3 | ||
2 | # Gets a color gradient based on input color and number | ||
3 | # Depends on python3-colour | ||
4 | |||
5 | import colour,sys | ||
6 | |||
7 | if len(sys.argv) != 4: | ||
8 | print("arg error") | ||
9 | sys.exit(1) | ||
10 | |||
11 | start = sys.argv[1] | ||
12 | end = sys.argv[2] | ||
13 | num = int(sys.argv[3]) | ||
14 | |||
15 | grad = colour.color_scale(colour.hex2hsl(start),colour.hex2hsl(end),num) | ||
16 | grad_hex = [] | ||
17 | for hsl in grad: | ||
18 | grad_hex.append(colour.hsl2hex(hsl)) | ||
19 | |||
20 | for color in grad_hex: | ||
21 | sys.stdout.write(color + "\n") | ||
22 | |||
23 | |||
24 | |||
diff --git a/.local/bin/dmenu/unicode-select b/.local/bin/unicode-select index b797691..b797691 100755 --- a/.local/bin/dmenu/unicode-select +++ b/.local/bin/unicode-select | |||
diff --git a/.local/bin/dmenu/unmount-device b/.local/bin/unmount-device index 239663d..239663d 100755 --- a/.local/bin/dmenu/unmount-device +++ b/.local/bin/unmount-device | |||
diff --git a/.local/bin/who-depends b/.local/bin/who-depends deleted file mode 100755 index d1fb0c2..0000000 --- a/.local/bin/who-depends +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Script that takes a package as an argument and returns installed packages | ||
4 | # that are dependent on it | ||
5 | |||
6 | [ $# -eq 1 ] || echo "usage: who-depends package" | ||
7 | apt list --installed | tail -n+2 | cut -d '/' -f 1 > /tmp/whodepends | ||
8 | pkg="$1" | ||
9 | deps_all=$(apt-cache rdepends $pkg | tail -n+3 | sed "s/^\s*//") | ||
10 | for dep in $deps_all | ||
11 | do | ||
12 | grep -lq "$dep" /tmp/whodepends && echo "$dep" | ||
13 | done | ||
diff --git a/.local/bin/yt-fix b/.local/bin/yt-fix index 69e771a..efb76ad 100755 --- a/.local/bin/yt-fix +++ b/.local/bin/yt-fix | |||
@@ -7,7 +7,7 @@ stdin() { | |||
7 | do | 7 | do |
8 | ext=".$(echo $infile | rev | cut -d '.' -f 1 | rev)" | 8 | ext=".$(echo $infile | rev | cut -d '.' -f 1 | rev)" |
9 | ext_length=${#ext} | 9 | ext_length=${#ext} |
10 | remove=$((12+$ext_length)) | 10 | remove=$((15+$ext_length)) |
11 | filename="$(echo $infile | rev | cut -c $remove- | rev)" | 11 | filename="$(echo $infile | rev | cut -c $remove- | rev)" |
12 | mv "$infile" "$filename$ext" | 12 | mv "$infile" "$filename$ext" |
13 | done | 13 | done |
@@ -18,7 +18,7 @@ cli() { | |||
18 | do | 18 | do |
19 | ext=".$(echo $infile | rev | cut -d '.' -f 1 | rev)" | 19 | ext=".$(echo $infile | rev | cut -d '.' -f 1 | rev)" |
20 | ext_length=${#ext} | 20 | ext_length=${#ext} |
21 | remove=$((12+$ext_length)) | 21 | remove=$((15+$ext_length)) |
22 | filename="$(echo $infile | rev | cut -c $remove- | rev)" | 22 | filename="$(echo $infile | rev | cut -c $remove- | rev)" |
23 | mv "$infile" "$filename$ext" | 23 | mv "$infile" "$filename$ext" |
24 | done | 24 | done |
@@ -39,4 +39,3 @@ do | |||
39 | done | 39 | done |
40 | 40 | ||
41 | [ $read_stdin -eq 0 ] && cli "$@" || stdin | 41 | [ $read_stdin -eq 0 ] && cli "$@" || stdin |
42 | |||