summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/convertall6
-rwxr-xr-xbin/fixnet3
-rwxr-xr-xbin/kmode5
-rwxr-xr-xbin/macspoof11
-rwxr-xr-xbin/pastebin20
-rwxr-xr-xbin/pkgsiz11
-rwxr-xr-xbin/qgis2
-rwxr-xr-xbin/sandbar19
-rwxr-xr-xbin/timesum5
-rwxr-xr-xbin/tipiserve5
-rwxr-xr-xbin/vidsize10
-rwxr-xr-xbin/wminit13
12 files changed, 107 insertions, 3 deletions
diff --git a/bin/convertall b/bin/convertall
new file mode 100755
index 0000000..0b24e3a
--- /dev/null
+++ b/bin/convertall
@@ -0,0 +1,6 @@
+#!/command/execlineb -P
+forbacktickx -E file {
+ pipeline { pipeline { pipeline { find . -name \*.webm } sed "s/webm$/mp4/g" } sort } fdmove 3 0
+ pipeline { pipeline { find . -name \*.mp4 } sort }
+ comm -3 - /dev/fd/3
+} av1ify ${file}
diff --git a/bin/fixnet b/bin/fixnet
new file mode 100755
index 0000000..efe238e
--- /dev/null
+++ b/bin/fixnet
@@ -0,0 +1,3 @@
+#!/bin/execlineb -P
+redirfd -w 1 /run/fixnet
+printf x
diff --git a/bin/kmode b/bin/kmode
new file mode 100755
index 0000000..b0c0a65
--- /dev/null
+++ b/bin/kmode
@@ -0,0 +1,5 @@
+#!/command/execlineb -s1
+ifelse { test ${1} = 1 } {
+ riverctl keyboard-layout -variant colemak_dh us
+}
+riverctl keyboard-layout us
diff --git a/bin/macspoof b/bin/macspoof
new file mode 100755
index 0000000..eab9888
--- /dev/null
+++ b/bin/macspoof
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+
+dev="wlan0"
+
+prefix="$(ip link show "$dev" | awk '/link\/ether/ {print substr($2, 0, 8)}')"
+suffix="$(hexdump -n3 -e'3/1 "%02x:""\n"' /dev/urandom | cut -d: -f1-3)"
+address="$prefix:$suffix"
+
+ip link set "$dev" down
+ip link set "$dev" address "$address"
+ip link set "$dev" up
diff --git a/bin/pastebin b/bin/pastebin
index 87d26cf..184b57a 100755
--- a/bin/pastebin
+++ b/bin/pastebin
@@ -1,7 +1,10 @@
#!/bin/sh -eu
+base="https://0x0.st"
+field="file"
expires=
-while getopts e:h opt; do
+
+while getopts e:u:f:h opt; do
case "$opt" in
e)
if ! printf %d "$OPTARG" >/dev/null 2>&1; then
@@ -10,13 +13,21 @@ while getopts e:h opt; do
fi
expires="$OPTARG"
;;
+ u)
+ base="$OPTARG"
+ ;;
+ f)
+ field="$OPTARG"
+ ;;
h)
cat <<-EOF
Usage: ${0##*/} [-e EXPIRES] [FILE]
-Upload FILE (or stdin) to envs.sh and print the URL
+Upload FILE (or stdin) to a pastebin and print the URL
-e EXPIRES Set the expiration time, either hours or epoch milliseconds
+ -u URL Provide a different pastebin (default: https://0x0.st)
+ -f FIELD Use a different field name for the file (default: file)
EOF
exit 0
;;
@@ -26,14 +37,17 @@ Upload FILE (or stdin) to envs.sh and print the URL
;;
esac
done
+
shift $((OPTIND-1))
+
if [ $# -gt 1 ]; then
printf 'Usage: %s [-e EXPIRES] [FILE]\n' "${0##*/}"
exit 1
fi
+
file="${1:-/dev/stdin}"
[ "$file" = '-' ] && file="/dev/stdin"
-url="$(curl -fsS -F file=@"$file" ${expires:+-F expires="$expires"} https://envs.sh)"
+url="$(curl -fsS -F "$field"=@"$file" ${expires:+-F expires="$expires"} "$base")"
printf '%s\n' "$url"
wl-copy "$url"
diff --git a/bin/pkgsiz b/bin/pkgsiz
new file mode 100755
index 0000000..6ad7be0
--- /dev/null
+++ b/bin/pkgsiz
@@ -0,0 +1,11 @@
+#!/bin/sh
+apk info | xargs apk info -s | awk '
+/ installed size:$/ {
+ sub(/-[^-]+-r[0-9]+$/, "", $1)
+ pkg = $1
+}
+/[0-9]+ (.iB|B)/ {
+ sub(/iB$/, "", $2)
+ printf "%d%c\t%s\n", $1, $2, pkg
+}
+' | sort -h
diff --git a/bin/qgis b/bin/qgis
new file mode 100755
index 0000000..7bf8e75
--- /dev/null
+++ b/bin/qgis
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec nix run --offline nixpkgs#qgis
diff --git a/bin/sandbar b/bin/sandbar
new file mode 100755
index 0000000..5f0bf9c
--- /dev/null
+++ b/bin/sandbar
@@ -0,0 +1,19 @@
+#!/command/execlineb -s0
+multisubstitute {
+ define bg "100f0fff"
+ define fg "cecdc3ff"
+ define bl "205ea6ff"
+ define re "af3029ff"
+}
+/usr/bin/sandbar
+ -font "Fira Code Nerd Font:12"
+ -vertical-padding 2
+ -active-fg-color ${fg}
+ -active-bg-color ${bl}
+ -inactive-fg-color ${fg}
+ -inactive-bg-color ${bg}
+ -urgent-fg-color ${fg}
+ -urgent-bg-color ${re}
+ -title-fg-color ${fg}
+ -title-bg-color ${bl}
+ ${@}
diff --git a/bin/timesum b/bin/timesum
new file mode 100755
index 0000000..b6a03d1
--- /dev/null
+++ b/bin/timesum
@@ -0,0 +1,5 @@
+#!/usr/bin/awk -f
+BEGIN { FS = ":" }
+{ sub(/#.*/, "") }
+/\S/ { total += $2 * 60 + $3 }
+END { printf "%02d:%06.3f\n", total / 60, total % 60 }
diff --git a/bin/tipiserve b/bin/tipiserve
new file mode 100755
index 0000000..3ceaba6
--- /dev/null
+++ b/bin/tipiserve
@@ -0,0 +1,5 @@
+#!/command/execlineb -P
+importas -i HOME HOME
+s6-tcpserver 0.0.0.0 8000
+s6-tcpserver-access
+tipideed -f ${HOME}/tipidee.conf.cdb -d ${HOME}/dist
diff --git a/bin/vidsize b/bin/vidsize
new file mode 100755
index 0000000..9d07e85
--- /dev/null
+++ b/bin/vidsize
@@ -0,0 +1,10 @@
+#!/bin/sh -eu
+
+printf 'DURATION\tSIZE\tB/MIN\tFILE\n'
+for f in "$@"; do
+ dur=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$f" | cut -d. -f1)
+ size=$(ls -l "$f" | awk '{print $5}')
+ hsize=$(ls -lh "$f" | awk '{print $5}')
+ bpm=$((size/dur))
+ printf '%dh%02dm%02ds\t%s\t%d\t%s\n' $((dur/3600)) $((dur/60%60)) $((dur%60)) $hsize $bpm "$f"
+done
diff --git a/bin/wminit b/bin/wminit
new file mode 100755
index 0000000..8d7d313
--- /dev/null
+++ b/bin/wminit
@@ -0,0 +1,13 @@
+#!/command/execlineb -P
+importas -i XDG_RUNTIME_DIR XDG_RUNTIME_DIR
+if { forx var { WAYLAND_DISPLAY DISPLAY HYPRLAND_INSTANCE_SIGNATURE }
+ importas -i value ${var}
+ redirfd -w 1 ${XDG_RUNTIME_DIR}/wl_env/${var} printf "%s\n" ${value}
+}
+if { dbus-update-activation-environment
+ WAYLAND_DISPLAY
+ DISPLAY
+ HYPRLAND_INSTANCE_SIGNATURE
+ XDG_CURRENT_DESKTOP
+}
+redirfd -w 1 ${XDG_RUNTIME_DIR}/service/hyprland/data/ready printf "\n"