Organising
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script will compile or run another finishing operation on a document. I
|
||||
# have this script run via vim.
|
||||
#
|
||||
# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
|
||||
# presentations. Runs scripts based on extention or shebang.
|
||||
#
|
||||
# Note that .tex files which you wish to compile with XeLaTeX should have the
|
||||
# string "xelatex" somewhere in a comment/command in the first 5 lines.
|
||||
|
||||
file=$(readlink -f "$1")
|
||||
dir=${file%/*}
|
||||
base="${file%.*}"
|
||||
ext="${file##*.}"
|
||||
|
||||
cd "$dir" || exit 1
|
||||
|
||||
textype() { \
|
||||
command="pdflatex"
|
||||
( head -n5 "$file" | grep -qi 'xelatex' ) && command="xelatex"
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
grep -qi addbibresource "$file" &&
|
||||
biber --input-directory "$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base"
|
||||
}
|
||||
|
||||
case "$ext" in
|
||||
# Try to keep these cases in alphabetical order.
|
||||
[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;;
|
||||
c) cc "$file" -o "$base" && "$base" ;;
|
||||
cpp) g++ "$file" -o "$base" && "$base" ;;
|
||||
cs) mcs "$file" && mono "$base".exe ;;
|
||||
go) go run "$file" ;;
|
||||
h) sudo make install ;;
|
||||
java) javac -d classes "$file" && java -cp classes "${1%.*}" ;;
|
||||
m) octave "$file" ;;
|
||||
md) if [ -x "$(command -v lowdown)" ]; then
|
||||
lowdown -d nointem -e super "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf
|
||||
elif [ -x "$(command -v groffdown)" ]; then
|
||||
groffdown -i "$file" | groff > "$base.pdf"
|
||||
else
|
||||
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
||||
fi ; ;;
|
||||
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;;
|
||||
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;;
|
||||
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
|
||||
py) python "$file" ;;
|
||||
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
|
||||
rs) cargo build ;;
|
||||
sass) sassc -a "$file" "$base.css" ;;
|
||||
scad) openscad -o "$base".stl "$file" ;;
|
||||
sent) setsid -f sent "$file" 2>/dev/null ;;
|
||||
tex) textype "$file" ;;
|
||||
*) head -n1 "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
|
||||
esac
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Syncs repositories and downloads updates, meant to be run as a cronjob.
|
||||
|
||||
notify-send " Repository Sync" "Checking for package updates..."
|
||||
|
||||
sudo yay -Syyuw --noconfirm || notify-send "Error downloading updates.
|
||||
Check your internet connection, if pacman is already running, or run update manually to see errors."
|
||||
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||
|
||||
if pacman -Qu | grep -v "\[ignored\]"
|
||||
then
|
||||
notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
|
||||
else
|
||||
notify-send " Repository Sync" "Sync complete. No new packages for update."
|
||||
fi
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Toggles all cronjobs off/on.
|
||||
# Stores disabled crontabs in ~/.consaved until restored.
|
||||
|
||||
([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set as a cron job to check for new RSS entries for newsboat.
|
||||
# If newsboat is open, sends it an "R" key to refresh.
|
||||
|
||||
/usr/bin/notify-send "📰 Updating RSS feeds..."
|
||||
|
||||
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
|
||||
|
||||
echo > /tmp/newsupdate
|
||||
pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
|
||||
/usr/bin/newsboat -x reload
|
||||
rm -f /tmp/newsupdate
|
||||
pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
|
||||
/usr/bin/notify-send "📰 RSS feed update complete."
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Feed this script a link and it will give dmenu
|
||||
# some choice programs to use to open it.
|
||||
feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
|
||||
|
||||
case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dl\\nqueue yt-dl audio" | dmenu -i -p "Open it with?")" in
|
||||
"copy url") echo "$feed" | xclip -selection clipboard ;;
|
||||
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
|
||||
"queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;;
|
||||
"queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;;
|
||||
"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
|
||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
|
||||
lynx) lynx "$feed" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
files="$(find -L "$HOME/Tower/Library" -name '*.pdf' -or -name '*.epub')"
|
||||
|
||||
options=$(echo "$files" | xargs --delimiter="\n" basename -a)
|
||||
|
||||
chosen=$(echo "$options" | dmenu -i -ix -c -l 30)
|
||||
|
||||
[ -z "$chosen" ] && exit
|
||||
|
||||
line="$(($chosen + 1))"
|
||||
|
||||
file="$(echo "$files" | sed "${line}q;d")"
|
||||
|
||||
zathura "$file"
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Gives a dmenu prompt to mount unmounted drives and Android phones. If
|
||||
# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll
|
||||
# be prompted to give a mountpoint from already existsing directories. If you
|
||||
# input a novel directory, it will prompt you to create that directory.
|
||||
|
||||
getmount() { \
|
||||
[ -z "$chosen" ] && exit 1
|
||||
# shellcheck disable=SC2086
|
||||
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
||||
[ "$mp" = "" ] && exit 1
|
||||
if [ ! -d "$mp" ]; then
|
||||
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1
|
||||
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
|
||||
fi
|
||||
}
|
||||
|
||||
mountusb() { \
|
||||
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
|
||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||
sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0
|
||||
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}')
|
||||
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted"
|
||||
partitiontype="$(lsblk -no "fstype" "$chosen")"
|
||||
case "$partitiontype" in
|
||||
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
|
||||
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";;
|
||||
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
|
||||
esac
|
||||
notify-send "💻 USB mounting" "$chosen mounted to $mp."
|
||||
}
|
||||
|
||||
mountandroid() { \
|
||||
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
||||
chosen="$(echo "$chosen" | cut -d : -f 1)"
|
||||
getmount "$HOME -maxdepth 3 -type d"
|
||||
simple-mtpfs --device "$chosen" "$mp"
|
||||
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
|
||||
simple-mtpfs --device "$chosen" "$mp"
|
||||
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
|
||||
}
|
||||
|
||||
asktype() { \
|
||||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
||||
case $choice in
|
||||
USB) mountusb ;;
|
||||
Android) mountandroid ;;
|
||||
esac
|
||||
}
|
||||
|
||||
anddrives=$(simple-mtpfs -l 2>/dev/null)
|
||||
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
|
||||
|
||||
if [ -z "$usbdrives" ]; then
|
||||
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
|
||||
echo "Android device(s) detected."
|
||||
mountandroid
|
||||
else
|
||||
if [ -z "$anddrives" ]; then
|
||||
echo "USB drive(s) detected."
|
||||
mountusb
|
||||
else
|
||||
echo "Mountable USB drive(s) and Android device(s) detected."
|
||||
asktype
|
||||
fi
|
||||
fi
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is the SUDO_ASKPASS variable, meaning that it will be used as a
|
||||
# password prompt if needed.
|
||||
|
||||
dmenu -P -p "$1" <&- && echo
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A dmenu prompt to unmount drives.
|
||||
# Provides you with mounted partitions, select one to unmount.
|
||||
# Drives mounted at /, /boot and /home will not be options to unmount.
|
||||
|
||||
unmountusb() {
|
||||
[ -z "$drives" ] && exit
|
||||
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||
[ -z "$chosen" ] && exit
|
||||
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
|
||||
}
|
||||
|
||||
unmountandroid() { \
|
||||
chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
|
||||
[ -z "$chosen" ] && exit
|
||||
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
|
||||
}
|
||||
|
||||
asktype() { \
|
||||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1
|
||||
case "$choice" in
|
||||
USB) unmountusb ;;
|
||||
Android) unmountandroid ;;
|
||||
esac
|
||||
}
|
||||
|
||||
drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
|
||||
|
||||
if ! grep simple-mtpfs /etc/mtab; then
|
||||
[ -z "$drives" ] && echo "No drives to unmount." && exit
|
||||
echo "Unmountable USB drive detected."
|
||||
unmountusb
|
||||
else
|
||||
if [ -z "$drives" ]
|
||||
then
|
||||
echo "Unmountable Android device detected."
|
||||
unmountandroid
|
||||
else
|
||||
echo "Unmountable USB drive(s) and Android device(s) detected."
|
||||
asktype
|
||||
fi
|
||||
fi
|
||||
@@ -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/emojis | 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
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "starting"
|
||||
echo "$1"
|
||||
|
||||
file="${1:-$HOME/Downloads}"
|
||||
|
||||
[ -d "$file" ] && file="$file/$(ls -Art "$file" | tail -n 1)"
|
||||
|
||||
echo "continuing"
|
||||
echo "$file"
|
||||
|
||||
case "$file" in
|
||||
*ergodox*.hex)
|
||||
wally-cli "$file" ;;
|
||||
# *png|*jpg|*jpe|*jpeg|*gif)
|
||||
# curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
# *pdf|*cbz|*cbr)
|
||||
# curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
# *mp3|*flac|*opus|*mp3?source*)
|
||||
# qndl "$1" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
# *)
|
||||
# [ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1
|
||||
esac
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
# add binaries to PATH if they aren't added yet
|
||||
# affix colons on either side of $PATH to simplify matching
|
||||
case ":${PATH}:" in
|
||||
*:"$HOME/.local/share/../bin":*)
|
||||
;;
|
||||
*)
|
||||
# Prepending path in case a system-installed binary needs to be overridden
|
||||
export PATH="$HOME/.local/share/../bin:$PATH"
|
||||
;;
|
||||
esac
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A general, all-purpose extraction script. Not all extraction programs here
|
||||
# are installed by LARBS automatically.
|
||||
#
|
||||
# Default behavior: Extract archive into new directory
|
||||
# Behavior with `-c` option: Extract contents into current directory
|
||||
|
||||
while getopts "hc" o; do case "${o}" in
|
||||
c) extracthere="True" ;;
|
||||
*) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;;
|
||||
esac done
|
||||
|
||||
if [ -z "$extracthere" ]; then
|
||||
archive="$(readlink -f "$*")" &&
|
||||
directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
|
||||
mkdir -p "$directory" &&
|
||||
cd "$directory" || exit 1
|
||||
else
|
||||
archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)"
|
||||
fi
|
||||
|
||||
[ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1
|
||||
|
||||
if [ -f "$archive" ] ; then
|
||||
case "$archive" in
|
||||
*.tar.bz2|*.tbz2) tar xvjf "$archive" ;;
|
||||
*.tar.xz) tar -xf "$archive" ;;
|
||||
*.tar.gz|*.tgz) tar xvzf "$archive" ;;
|
||||
*.tar.zst) tar -I zstd -xf "$archive" ;;
|
||||
*.lzma) unlzma "$archive" ;;
|
||||
*.bz2) bunzip2 "$archive" ;;
|
||||
*.rar) unrar x -ad "$archive" ;;
|
||||
*.gz) gunzip "$archive" ;;
|
||||
*.tar) tar xvf "$archive" ;;
|
||||
*.zip) unzip "$archive" ;;
|
||||
*.Z) uncompress "$archive" ;;
|
||||
*.7z) 7z x "$archive" ;;
|
||||
*.xz) unxz "$archive" ;;
|
||||
*.exe) cabextract "$archive" ;;
|
||||
*) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
|
||||
esac
|
||||
else
|
||||
printf "File \"%s\" not found.\\n" "$archive"
|
||||
fi
|
||||
@@ -1,94 +0,0 @@
|
||||
const fs = require('fs');
|
||||
|
||||
const input = fs.readFileSync('./Chris S. Coaching Tracker - Weekly Tracker.csv', 'utf8');
|
||||
|
||||
const rows = [];
|
||||
|
||||
const week = {
|
||||
'Chest': null,
|
||||
'Right thigh': null,
|
||||
'Left thigh': null,
|
||||
'Waist': null,
|
||||
'Left biceps': null,
|
||||
'Right biceps': null,
|
||||
}
|
||||
|
||||
let year = 2023;
|
||||
|
||||
input.split("\n").forEach((line) => {
|
||||
if (line.includes(' 1 Jan')) {
|
||||
year++;
|
||||
}
|
||||
const map = {
|
||||
'R Arm': 'Right biceps',
|
||||
'L Arm': 'Left biceps',
|
||||
'Navel': 'Waist',
|
||||
'Chest': 'Chest',
|
||||
'R Leg': 'Right thigh',
|
||||
'L Leg': 'Left thigh',
|
||||
}
|
||||
for (let key in map) {
|
||||
const val = map[key];
|
||||
const match = line.match(new RegExp(`${key},([^,]+)`));
|
||||
if (match) {
|
||||
week[val] = (1*match[1]).toPrecision(3);
|
||||
}
|
||||
}
|
||||
if (line.startsWith('"Sun')) {
|
||||
const match = line.match(/^"(Sun[^"]+)\s*"/)[1];
|
||||
const date = new Date(`${match} UTC`);
|
||||
date.setFullYear(year);
|
||||
|
||||
for (let key in week) {
|
||||
const val = week[key];
|
||||
rows.push(`BODYMEASURE,${date.toJSON().split('T')[0]},${key},${val},cm`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
['Weight', 'Weight(1)', 'Weight(2)', 'Weight(3)'].forEach((name) => {
|
||||
const weightInput = fs.readFileSync(`./${name}.csv`, 'utf8').split("\n");
|
||||
|
||||
weightInput.shift();
|
||||
for (let i = 0; i < weightInput.length;) {
|
||||
if (!weightInput[i] || !weightInput[i + 1]) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
const date = new Date(`${weightInput[i].substring(2, weightInput[i].length - 2)} UTC`);
|
||||
const [time, weight, change, bmi, fat, muscle, bone, water] = weightInput[i + 1].split(',')
|
||||
|
||||
if (weight && weight !== '--') {
|
||||
const [kg, units] = weight.split(' ');
|
||||
rows.push(`BODYMEASURE,${date.toJSON().split('T')[0]},Weight,${kg},${units}`);
|
||||
}
|
||||
|
||||
if (fat && fat !== '--') {
|
||||
const [perc, units] = fat.split(' ');
|
||||
rows.push(`BODYMEASURE,${date.toJSON().split('T')[0]},Fat,${perc},${units}`);
|
||||
}
|
||||
|
||||
if (muscle && muscle !== '--' && weight && weight !== '--') {
|
||||
const [kg, units] = muscle.split(' ');
|
||||
const weightKg = weight.split(' ')[0];
|
||||
const perc = (100 * kg / weightKg).toPrecision(3);
|
||||
rows.push(`BODYMEASURE,${date.toJSON().split('T')[0]},Muscles,${perc},%`);
|
||||
}
|
||||
|
||||
if (water && water !== '--') {
|
||||
const [perc, units] = water.split(' ');
|
||||
rows.push(`BODYMEASURE,${date.toJSON().split('T')[0]},Water,${perc},${units}`);
|
||||
}
|
||||
|
||||
i++;
|
||||
while (weightInput[i] && weightInput[i][0] !== '"') {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
rows.sort();
|
||||
|
||||
rows.unshift('TABLE,DATE,BODYPART_NAME,MEASURE,UNIT');
|
||||
|
||||
fs.writeFileSync('./fnfImport.csv', rows.join("\n"));
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Creating development directories"
|
||||
|
||||
mkdir "$HOME/Code"
|
||||
mkdir "$HOME/Code/DevOps" # For server and computer admin
|
||||
mkdir "$HOME/Code/FSharp"
|
||||
mkdir "$HOME/Code/JavaScript"
|
||||
mkdir "$HOME/Code/Scala"
|
||||
mkdir "$HOME/Code/Rust"
|
||||
mkdir "$HOME/Code/PHP"
|
||||
mkdir "$HOME/Code/Tutorials" # For doing tutorials/courses
|
||||
mkdir "$HOME/Code/Sites" # Websites in any language
|
||||
mkdir "$HOME/Code/MobileApps" # Mobile apps in any language
|
||||
mkdir "$HOME/Code/Tests" # Small test files/scripts
|
||||
@@ -1,8 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
doas tee /etc/udev/rules/90-backlight.rules <<HRD
|
||||
SUBSYSTEM=="backlight", ACTION=="add" \
|
||||
RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness", \
|
||||
RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
|
||||
HRD
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
sudo pacman --noconfirm --needed -S python-pyqt5 hplip nss-mdns
|
||||
|
||||
sudo sed -i 's/hosts: files mymachines myhostname resolve [!UNAVAIL=return] dns/hosts: files mymachines myhostname mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns/' /etc/nsswitch.conf
|
||||
|
||||
sudo systemctl enable --now avahi-daemon
|
||||
|
||||
hp-setup -i 192.168.2.77
|
||||
|
||||
lpoptions -d DeskJet_3700
|
||||
|
||||
lpoptions -o PageSize=A4
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
doas tee /etc/NetworkManager/conf.d <<HRD
|
||||
[main]
|
||||
dhcpd=dhclient
|
||||
HRD
|
||||
|
||||
doas tee /etc/iwd/main.conf <<HRD
|
||||
[Network]
|
||||
EnableNetworkConfiguration=True
|
||||
EnableIPv6=True
|
||||
HRD
|
||||
|
||||
doas systemctl enable --now iwd
|
||||
doas systemctl enable --now NetworkManager
|
||||
|
||||
nmtui
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/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 no url given. Opens browser. For using script as $BROWSER.
|
||||
[ -z "$1" ] && { "$BROWSER"; exit; }
|
||||
|
||||
case "$1" in
|
||||
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*)
|
||||
setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
|
||||
*png|*jpg|*jpe|*jpeg|*gif)
|
||||
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
*pdf|*cbz|*cbr)
|
||||
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
*mp3|*flac|*opus|*mp3?source*)
|
||||
qndl "$1" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
*)
|
||||
[ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1
|
||||
esac
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# opout: "open output": A general handler for opening a file's intended output,
|
||||
# usually the pdf of a compiled document. I find this useful especially
|
||||
# running from vim.
|
||||
|
||||
basename="$(echo "${*}" | sed 's/\.[^\/.]*$//')"
|
||||
|
||||
case "${*}" in
|
||||
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
|
||||
*.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
|
||||
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
@@ -1,12 +0,0 @@
|
||||
sudo tee /etc/modprobes.d/r8169.conf <<HRD
|
||||
# Do not load the r819 realtek module to force it to use r8168 instead for
|
||||
# better reliability
|
||||
# https://wiki.archlinux.org/title/Network_configuration/Ethernet#Troubleshooting
|
||||
blacklist r8169
|
||||
HRD
|
||||
|
||||
# Rebuild kernel modules
|
||||
sudo mkinitcpio -p linux
|
||||
|
||||
echo "Please restart your computer to update kernel modules"
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
export MASTERPW=$(zenity --password)
|
||||
|
||||
echo "https://tower.scarif.space" | wl-copy
|
||||
|
||||
enpass &
|
||||
|
||||
echo "$MASTERPW" | wl-copy
|
||||
|
||||
read -n 1 -r -s -p $'Press enter when you have synced enpass...\n'
|
||||
|
||||
dwmc toggleview 0
|
||||
|
||||
echo "" | wl-copy
|
||||
|
||||
CHECKPW=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort list 2>&1)
|
||||
|
||||
while [[ "$CHECKPW" == *level=fatal* ]]; do
|
||||
export MASTERPW=$(zenity --password)
|
||||
CHECKPW=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort list)
|
||||
done
|
||||
|
||||
echo "Password set successfuly"
|
||||
|
||||
setupssh
|
||||
setupdev
|
||||
setupfirefox
|
||||
setupnextcloud
|
||||
setupobsidian
|
||||
@@ -1,8 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
doas tee /etc/udev/rules/90-backlight.rules <<HRD
|
||||
SUBSYSTEM=="backlight", ACTION=="add" \
|
||||
RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness", \
|
||||
RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
|
||||
HRD
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo "Creating development directories"
|
||||
|
||||
mkdir "$HOME/Code"
|
||||
mkdir "$HOME/Code/DevOps" # For server and computer admin
|
||||
mkdir "$HOME/Code/FSharp"
|
||||
mkdir "$HOME/Code/JavaScript"
|
||||
mkdir "$HOME/Code/Scala"
|
||||
mkdir "$HOME/Code/Rust"
|
||||
mkdir "$HOME/Code/PHP"
|
||||
mkdir "$HOME/Code/Tutorials" # For doing tutorials/courses
|
||||
mkdir "$HOME/Code/Sites" # Websites in any language
|
||||
mkdir "$HOME/Code/MobileApps" # Mobile apps in any language
|
||||
mkdir "$HOME/Code/Tests" # Small test files/scripts
|
||||
@@ -1,18 +0,0 @@
|
||||
#! /usr/bin/zsh
|
||||
|
||||
FIREFOX=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Firefox" 2>&1)
|
||||
FIREFOXUN=$(echo "$FIREFOX" | grep -Po "(?<=login: )\w+")
|
||||
|
||||
wait_for_copy() {
|
||||
timeout 60s wl-paste --watch sh -c 'kill $PPID' >/dev/null 2>&1
|
||||
}
|
||||
|
||||
echo $FIREFOXUN | wl-copy
|
||||
|
||||
firefox "https://accounts.firefox.com/signin?action=email&service=sync" &
|
||||
|
||||
enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort copy "Firefox"
|
||||
|
||||
read -s -k $'?Press enter when you have synced Firefox...\n'
|
||||
|
||||
echo "" | wl-copy
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/zsh
|
||||
|
||||
# 1. Fetch credentials (Enpass logic remains the same)
|
||||
TOWER=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Scarif: Tower" 2>&1)
|
||||
TOWERUN=$(echo "$TOWER" | grep -Po "(?<=login: )\w+")
|
||||
|
||||
# Helper function to wait for a clipboard change
|
||||
wait_for_copy() {
|
||||
# We use wl-paste --watch but kill it after the first event
|
||||
# This mimics the 'clipnotify' behavior of pausing the script
|
||||
timeout 60s wl-paste --watch sh -c 'kill $PPID' >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# 2. Start the process
|
||||
echo "https://tower.scarif.space" | wl-copy
|
||||
mkdir -p "$HOME/Tower"
|
||||
|
||||
# Launch Nextcloud (Standard NixOS/Wayland path)
|
||||
nextcloud &
|
||||
|
||||
# 3. The Sequence
|
||||
# Wait for you to paste the URL, then copy the username
|
||||
wait_for_copy
|
||||
echo "$TOWERUN" | wl-copy
|
||||
|
||||
# Wait for you to paste the username, then copy the password
|
||||
wait_for_copy
|
||||
enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort copy "Scarif: Tower"
|
||||
|
||||
# 4. Finalize
|
||||
read -s -k $'?Press enter when you have synced Nextcloud... \n'
|
||||
|
||||
# Clear clipboard for security
|
||||
wl-copy --clear
|
||||
|
||||
# Symbolic links (NixOS usually manages fonts via config, but manual links still work)
|
||||
ln -s "$HOME/Tower/Library/Pictures/Wallpapers/7680x2160" "$HOME/.local/share/wallpapers"
|
||||
@@ -1,4 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
ln -sf ~/Tower/Notes/_downloads ~/Downloads/Notes
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
sudo pacman --noconfirm --needed -S python-pyqt5 hplip nss-mdns
|
||||
|
||||
sudo sed -i 's/hosts: files mymachines myhostname resolve [!UNAVAIL=return] dns/hosts: files mymachines myhostname mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns/' /etc/nsswitch.conf
|
||||
|
||||
sudo systemctl enable --now avahi-daemon
|
||||
|
||||
hp-setup -i 192.168.2.77
|
||||
|
||||
lpoptions -d DeskJet_3700
|
||||
|
||||
lpoptions -o PageSize=A4
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Setting up SSH"
|
||||
|
||||
# Extract the login details from enpass
|
||||
LABS=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Scarif: Labs" 2>&1)
|
||||
LABSUN=$(echo "$LABS" | grep -Po "(?<=login: )\w+")
|
||||
LABSPW=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort pass "Scarif: Labs")
|
||||
|
||||
SSHPATH="$HOME/.ssh/id_ed25519" # The path to the SSH key file
|
||||
TITLE="$USER@$(cat /etc/hostname)" # The title for the SSH key
|
||||
|
||||
# Generate the SSH key if it does not exist
|
||||
[ ! -f $SSHPATH ] && ssh-keygen -t ed25519 -f "$SSHPATH" -N "" -q
|
||||
|
||||
KEY=$(cat "$SSHPATH.pub")
|
||||
|
||||
# A method to generate the parameters for creating an SSH key on gitea
|
||||
generate_post_data() {
|
||||
cat <<EOF
|
||||
{
|
||||
"key": "$KEY",
|
||||
"read_only": false,
|
||||
"title": "$TITLE"
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
CREDENTIALS="$LABSUN:$LABSPW" # The credentials to pass to the API
|
||||
KEYS_URL="https://$CREDENTIALS@labs.scarif.space/api/v1/user/keys"
|
||||
|
||||
# Get all the existing keys
|
||||
KEYS=$(curl -X GET -s -S --url "$KEYS_URL")
|
||||
|
||||
KEY_EXISTS=$(echo $KEYS | jq --arg TITLE "$TITLE" 'map(.title)|contains([$TITLE])')
|
||||
|
||||
if [[ $KEY_EXISTS == true ]]; then
|
||||
# Extract the ids of the keys with the same title as this machine
|
||||
IDS=$(echo "$KEYS" | jq --arg TITLE "$TITLE" 'map(select(.title == $TITLE))[].id')
|
||||
|
||||
# Loop through the keys and remove them from gitea to be replaced by the new one
|
||||
if [ ! -z "$IDS" ]; then
|
||||
for ID in $IDS; do
|
||||
echo "Deleting key with ID $ID"
|
||||
curl -X DELETE \
|
||||
-s -S \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type:application/json" \
|
||||
--url "$KEYS_URL/$ID" > /dev/null
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Save the new key in gitea
|
||||
curl -X POST \
|
||||
-s -S \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type:application/json" \
|
||||
--data "$(generate_post_data)" \
|
||||
--url "$KEYS_URL" > /dev/null
|
||||
|
||||
HTTP_REPLACE="s/https:\/\/labs\.scarif\.space\//git@labs.scarif.space:/"
|
||||
|
||||
# for dir in $(ls "$HOME/.local/src"); do
|
||||
# dir="$HOME/.local/src/$dir"
|
||||
# if [ -d $dir ]; then
|
||||
# cd "$dir"
|
||||
# SSH_URL=$(git remote get-url origin | sed "$HTTP_REPLACE")
|
||||
# git remote set-url origin "$SSH_URL"
|
||||
# fi
|
||||
# done
|
||||
|
||||
DOTFILES_SSH_URL=$(git --git-dir "$HOME/.config/dotfiles/.git" --work-tree="$HOME" remote get-url origin | sed "$HTTP_REPLACE")
|
||||
git --git-dir "$HOME/.config/dotfiles/.git" --work-tree="$HOME" remote set-url origin "$DOTFILES_SSH_URL"
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
doas systemctl enable --now expressvpn.service
|
||||
|
||||
VPN=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "ExpressVPN Activation Code" 2>&1)
|
||||
VPNPW=$(echo "$LABS" | grep -Po "(?<=pass : ).+(?=\")")
|
||||
|
||||
echo "$VPNPW" | xclip -selection clipboard -i
|
||||
|
||||
expressvpn activate
|
||||
|
||||
expressvpn autoconnect true
|
||||
|
||||
expressvpn connect smart
|
||||
|
||||
echo "" | xclip -selection clipboard -i
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
doas tee /etc/NetworkManager/conf.d <<HRD
|
||||
[main]
|
||||
dhcpd=dhclient
|
||||
HRD
|
||||
|
||||
doas tee /etc/iwd/main.conf <<HRD
|
||||
[Network]
|
||||
EnableNetworkConfiguration=True
|
||||
EnableIPv6=True
|
||||
HRD
|
||||
|
||||
doas systemctl enable --now iwd
|
||||
doas systemctl enable --now NetworkManager
|
||||
|
||||
nmtui
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prints all batteries, their percentage remaining and an emoji corresponding
|
||||
# to charge status ( for plugged up, for discharging on battery, etc.).
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) notify-send " Battery module" ": discharging
|
||||
: not charging
|
||||
: stagnant charge
|
||||
: charging
|
||||
: charged
|
||||
: battery very low!
|
||||
- Scroll to change adjust xbacklight." ;;
|
||||
4) xbacklight -inc 10 ;;
|
||||
5) xbacklight -dec 10 ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
# Loop through all attached batteries and format the info
|
||||
for battery in /sys/class/power_supply/BAT?*; do
|
||||
# If non-first battery, print a space separator.
|
||||
[ -n "${capacity+x}" ] && printf " "
|
||||
# Sets up the status and capacity
|
||||
case "$(cat "$battery/status")" in
|
||||
"Full") status="" ;;
|
||||
"Discharging") status="" ;;
|
||||
"Charging") status="" ;;
|
||||
"Not charging") status="" ;;
|
||||
"Unknown") status="" ;;
|
||||
esac
|
||||
capacity=$(cat "$battery/capacity")
|
||||
# Will make a warn variable if discharging and low
|
||||
[ "$status" = "" ] && [ "$capacity" -le 75 ] && status=""
|
||||
[ "$status" = "" ] && [ "$capacity" -le 50 ] && status=""
|
||||
[ "$status" = "" ] && [ "$capacity" -le 25 ] && status=""
|
||||
[ "$status" = "" ] && [ "$capacity" -le 10 ] && status=""
|
||||
# Prints the info
|
||||
printf "%s %d%%" "$status" "$capacity";
|
||||
done && exit 0
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Status bar module for disk space
|
||||
# $1 should be drive mountpoint, otherwise assumed /.
|
||||
|
||||
location=${1:-/}
|
||||
|
||||
[ -d "$location" ] || exit
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;;
|
||||
3) notify-send "💽 Disk module" "\- Shows used hard drive space.
|
||||
- Click to show all disk info." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
case "$location" in
|
||||
"/home"* ) icon="🏠" ;;
|
||||
"/mnt"* ) icon="💾" ;;
|
||||
*) icon="🖥";;
|
||||
esac
|
||||
|
||||
printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Show wifi 📶 and percent strength or 📡 if none.
|
||||
# Show 🌐 if connected to ethernet or ❎ if none.
|
||||
# Show 🔒 if a vpn connection is active
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
|
||||
3) notify-send "🌐 Internet module" "\- Click to connect
|
||||
: no wifi connection
|
||||
: wifi connection with quality
|
||||
: no ethernet
|
||||
🌐: ethernet working
|
||||
: vpn is active
|
||||
" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
|
||||
down) wifiicon=" " ;;
|
||||
up) wifiicon="$(awk '/^\s*w/ { print "", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
|
||||
esac
|
||||
|
||||
printf "%s%s%s\n" "$wifiicon" "$(sed "s/down//;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*//" /sys/class/net/tun*/operstate 2>/dev/null)"
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Displays number of unread mail and an loading icon if updating.
|
||||
# When clicked, brings up `neomutt`.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e neomutt ;;
|
||||
2) setsid -f mw sync >/dev/null ;;
|
||||
3) notify-send " Mail module" "\- Shows unread mail
|
||||
- Shows if syncing mail
|
||||
- Left click opens neomutt
|
||||
- Middle click syncs mail" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
|
||||
|
||||
pidof mbsync >/dev/null 2>&1 && icon=""
|
||||
|
||||
[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "$unread$icon"
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This loop will update the mpd statusbar module whenever a command changes the
|
||||
# music player's status. mpd must be running on X's start for this to work.
|
||||
|
||||
while : ; do
|
||||
mpc idle >/dev/null && kill -45 "$(pidof "${STATUSBAR:-dwmblocks}")" || break
|
||||
done
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*//g;/\\[playing\\].*/d" | paste -sd ' ' -;}
|
||||
|
||||
pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause
|
||||
2) mpc toggle | filter ;; # right click, pause/unpause
|
||||
3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing.
|
||||
- when paused.
|
||||
- Left click opens ncmpcpp.
|
||||
- Middle click pauses.
|
||||
- Scroll changes track.";; # right click, pause/unpause
|
||||
4) mpc prev | filter ;; # scroll up, previous
|
||||
5) mpc next | filter ;; # scroll down, next
|
||||
6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
*) mpc status | filter ;;
|
||||
esac
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Displays number of unread news items and an loading icon if updating.
|
||||
# When clicked, brings up `newsboat`.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid "$TERMINAL" -e newsboat ;;
|
||||
2) setsid -f newsup >/dev/null exit ;;
|
||||
3) notify-send " News module" "\- Shows unread news items
|
||||
- Shows if updating with \`newsup\`
|
||||
- Left click opens newsboat
|
||||
- Middle click syncs RSS feeds
|
||||
<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print " " $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)"
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Displays number of upgradeable packages.
|
||||
# For this to work, have a `pacman -Sy` command run in the background as a
|
||||
# cronjob every so often as root. This script will then read those packages.
|
||||
# When clicked, it will run an upgrade via pacman.
|
||||
#
|
||||
# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook:
|
||||
#
|
||||
# [Trigger]
|
||||
# Operation = Upgrade
|
||||
# Type = Package
|
||||
# Target = *
|
||||
#
|
||||
# [Action]
|
||||
# Description = Updating statusbar...
|
||||
# When = PostTransaction
|
||||
# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e sb-popupgrade ;;
|
||||
2) notify-send "$(/usr/bin/pacman -Qu)" ;;
|
||||
3) notify-send " Upgrade module" ": number of upgradable packages
|
||||
- Left click to upgrade packages
|
||||
- Middle click to show upgradable packages" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
pacman -Qu | grep -Fcv "[ignored]" | sed "s/^//;s/^0$//g"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
printf "Beginning upgrade.\\n"
|
||||
|
||||
yay -Syu
|
||||
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||
|
||||
printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
|
||||
read -r _
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prints the current volume or 🔇 if muted.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid -f "$TERMINAL" -e pulsemixer ;;
|
||||
2) pamixer -t ;;
|
||||
4) pamixer --allow-boost -i 1 ;;
|
||||
5) pamixer --allow-boost -d 1 ;;
|
||||
3) notify-send "📢 Volume module" "\- Shows volume , if muted.
|
||||
- Middle click to mute.
|
||||
- Scroll to change." ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
[ $(pamixer --get-mute) = true ] && echo && exit
|
||||
|
||||
vol="$(pamixer --get-volume)"
|
||||
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -gt "30" ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
|
||||
echo "$icon $vol%"
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
err() { echo "Usage:
|
||||
tag [OPTIONS] file
|
||||
Options:
|
||||
-a: artist/author
|
||||
-t: song/chapter title
|
||||
-A: album/book title
|
||||
-n: track/chapter number
|
||||
-N: total number of tracks/chapters
|
||||
-d: year of publication
|
||||
-g: genre
|
||||
-c: comment
|
||||
You will be prompted for title, artist, album and track if not given." && exit 1 ;}
|
||||
|
||||
while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in
|
||||
a) artist="${OPTARG}" ;;
|
||||
t) title="${OPTARG}" ;;
|
||||
A) album="${OPTARG}" ;;
|
||||
n) track="${OPTARG}" ;;
|
||||
N) total="${OPTARG}" ;;
|
||||
d) date="${OPTARG}" ;;
|
||||
g) genre="${OPTARG}" ;;
|
||||
c) comment="${OPTARG}" ;;
|
||||
f) file="${OPTARG}" ;;
|
||||
*) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
|
||||
esac done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
file="$1"
|
||||
|
||||
[ ! -f "$file" ] && echo "Provide file to tag." && err
|
||||
|
||||
[ -z "$title" ] && echo "Enter a title." && read -r title
|
||||
[ -z "$artist" ] && echo "Enter an artist." && read -r artist
|
||||
[ -z "$album" ] && echo "Enter an album." && read -r album
|
||||
[ -z "$track" ] && echo "Enter a track number." && read -r track
|
||||
|
||||
case "$file" in
|
||||
*.ogg) echo "Title=$title
|
||||
Artist=$artist
|
||||
Album=$album
|
||||
Track=$track
|
||||
Total=$total
|
||||
Date=$date
|
||||
Genre=$genre
|
||||
Comment=$comment" | vorbiscomment -w "$file" ;;
|
||||
*.opus) echo "Title=$title
|
||||
Artist=$artist
|
||||
Album=$album
|
||||
Track=$track
|
||||
Total=$total
|
||||
Date=$date
|
||||
Genre=$genre
|
||||
Comment=$comment" | opustags -i -S "$file" ;;
|
||||
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
|
||||
*.flac) echo "TITLE=$title
|
||||
ARTIST=$artist
|
||||
ALBUM=$album
|
||||
TRACKNUMBER=$track
|
||||
TOTALTRACKS=$total
|
||||
DATE=$date
|
||||
GENRE=$genre
|
||||
DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;;
|
||||
*) echo "File type not implemented yet." ;;
|
||||
esac
|
||||
@@ -1,21 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
avdmanager -v delete avd -n main
|
||||
|
||||
doas pacman --noconfirm -Rns jdk11-openjdk maven ant gradle wget
|
||||
|
||||
yay -Rns --noconfirm --needed \
|
||||
android-sdk-cmdline-tools-latest \
|
||||
android-sdk-build-tools \
|
||||
android-sdk-platform-tools \
|
||||
android-platform
|
||||
|
||||
[ -d /opt/android-sdk ] && sudo rm -rf /opt/android-sdk
|
||||
|
||||
doas groupdel android-sdk
|
||||
|
||||
yarn global remove nativescript @vue/cli
|
||||
|
||||
[ -d "$HOME/.android" ] && sudo rm -rf "$HOME/.android"
|
||||
[ -d "$HOME/.local/share/android" ] && sudo rm -rf "$HOME/.local/share/android"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Clears the build files of a LaTeX/XeLaTeX build.
|
||||
# I have vim run this file whenever I exit a .tex file.
|
||||
|
||||
case "$1" in
|
||||
*.tex)
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyg|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete
|
||||
rm -rdf "$dir/_minted-$(basename -- $base)"
|
||||
;;
|
||||
*) printf "Give .tex file as argument.\\n" ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user