aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '.local')
-rw-r--r--.local/share/applications/discord.desktop1
-rwxr-xr-x.local/share/bin/ccpreview2
-rwxr-xr-x.local/share/bin/mk7
-rwxr-xr-x.local/share/bin/nginx-dev5
-rwxr-xr-x.local/share/bin/set-default32
-rwxr-xr-x.local/share/mode/switch.d/kitty25
-rwxr-xr-x.local/share/pass-extensions/duplicates.bash13
-rwxr-xr-x.local/share/pass-extensions/g.bash2
8 files changed, 78 insertions, 9 deletions
diff --git a/.local/share/applications/discord.desktop b/.local/share/applications/discord.desktop
index 676b330..403a457 100644
--- a/.local/share/applications/discord.desktop
+++ b/.local/share/applications/discord.desktop
@@ -7,3 +7,4 @@ Exec=discord
Icon=discord
Type=Application
Categories=Network;InstantMessaging;
+MimeType=x-scheme-handler/betterdiscord;
diff --git a/.local/share/bin/ccpreview b/.local/share/bin/ccpreview
index 914a6ad..9f13acc 100755
--- a/.local/share/bin/ccpreview
+++ b/.local/share/bin/ccpreview
@@ -55,6 +55,7 @@ _mpv \
--interpolation=no \
--stream-buffer-size=4k \
--profile=low-latency \
+ --speed=1.001 \
"$AUDIO_URL"
# video preview
@@ -65,6 +66,7 @@ _mpv \
--demuxer-lavf-o-add=framerate="$FRAMERATE" \
--demuxer-lavf-o-add=resolution="$RESOLUTION" \
--demuxer-lavf-o-add=rw_timeout=30000000 \
+ --speed=1.05 \
"$VIDEO_URL"
sleep infinity
diff --git a/.local/share/bin/mk b/.local/share/bin/mk
index ab0f586..b7e2b41 100755
--- a/.local/share/bin/mk
+++ b/.local/share/bin/mk
@@ -6,6 +6,13 @@ showmode() {
printf '\e[1A\e['$col'G\e[1;30m%s\e[0m\n' "$mode"
}
+mode_west() {
+ showmode 'west'
+ [ -z "$*" ] && set -- build
+ exec west "$@"
+}
+[ -e "west.yml" ] && mode_west "$@"
+
mode_cmake() {
showmode 'cmake'
builddir="build"
diff --git a/.local/share/bin/nginx-dev b/.local/share/bin/nginx-dev
index 4e9825d..10987fd 100755
--- a/.local/share/bin/nginx-dev
+++ b/.local/share/bin/nginx-dev
@@ -21,13 +21,14 @@ options:
-C enable server cache (disabled by default)
-v verbose mode (prints config before starting server)
-q quiet mode (disable access_log)
+ -x automatically open a browser
-h show this help
EOF
exit $1
}
ARGC=0
-while getopts hvp:Ct:q OPT; do
+while getopts hvp:Ct:qx OPT; do
[ $OPTIND -gt $ARGC ] && ARGC=$OPTIND
case $OPT in
h) usage 0 ;;
@@ -36,6 +37,7 @@ while getopts hvp:Ct:q OPT; do
v) print_config=1 ;;
C) cache_control="" ;;
q) access_log="/dev/null" ;;
+ x) open_browser=1 ;;
\?|*) usage 1 ;;
esac
done
@@ -76,6 +78,7 @@ http {
}
EOF
[ $print_config ] && cat "$config"
+[ $open_browser ] && (xdg-open "http://localhost:$port" 1> /dev/null 2> /dev/null &)
nginx -c "$config"
rm -f "$config" "$pidfile"
diff --git a/.local/share/bin/set-default b/.local/share/bin/set-default
new file mode 100755
index 0000000..d93f65c
--- /dev/null
+++ b/.local/share/bin/set-default
@@ -0,0 +1,32 @@
+#!/bin/sh
+SCRIPT_NAME="$(basename "$0")"
+
+usage() {
+ code=0
+ if [ -z "$1" ] ; then
+ cat << EOF
+Set desktop entry ENTRY as default application for opening files with the same
+type as FILE
+
+EOF
+ else
+ echo "error: $1" >&2
+ code=1
+ fi
+ cat << EOF
+usage:
+ $SCRIPT_NAME ENTRY FILE [FILE]
+EOF
+ exit $code
+}
+
+[ $# -eq 0 ] && usage
+DESKTOP_ENTRY="$1"; shift
+[ -z "$DESKTOP_ENTRY" ] && usage "no desktop entry"
+[ $# -lt 1 ] && usage "no reference file(s)"
+
+for file in "$@" ; do
+ mimetype="$(xdg-mime query filetype "$file")"
+ xdg-mime default "$DESKTOP_ENTRY" "$mimetype"
+done
+
diff --git a/.local/share/mode/switch.d/kitty b/.local/share/mode/switch.d/kitty
new file mode 100755
index 0000000..dddc41b
--- /dev/null
+++ b/.local/share/mode/switch.d/kitty
@@ -0,0 +1,25 @@
+#!/bin/sh
+mkcd "$XDG_CONFIG_HOME/kitty"
+
+cat << EOF > 'color.conf'
+background $bg
+foreground $fg
+
+color0 $color0
+color1 $color1
+color2 $color2
+color3 $color3
+color4 $color4
+color5 $color5
+color6 $color6
+color7 $color7
+color8 $color8
+color9 $color9
+color10 $color10
+color11 $color11
+color12 $color12
+color13 $color13
+color14 $color14
+color15 $color15
+EOF
+
diff --git a/.local/share/pass-extensions/duplicates.bash b/.local/share/pass-extensions/duplicates.bash
index cb1cbbc..3ba47aa 100755
--- a/.local/share/pass-extensions/duplicates.bash
+++ b/.local/share/pass-extensions/duplicates.bash
@@ -5,21 +5,18 @@ pass_names="$(pass names -l)"
[ $? -ne 0 ] && exit 1
pass_count="$(echo "$pass_names" | wc -l)"
-if [ "$pass_count" -gt 10 ] ; then
- cat << EOF >&2
-pass-duplicates needs to decrypt all your passwords one-by-one to cross-match
-them. This is all done in-memory, and nothing is saved to disk. You appear to
-have $pass_count passwords, so this may take some time...
-
-EOF
-fi
+pass_index=1
while read pass_name ; do
hash="$(pass show "$pass_name" | head -n1 | sha1sum | cut -c1-40)"
dupe_map["$pass_name"]="$hash"
dupe_tally["$hash"]=$(( ${dupe_tally["$hash"]} + 1 ))
+
+ printf '\rhashing... (%d/%d)' "$pass_index" "$pass_count" >&2
+ pass_index=$(( $pass_index + 1 ))
done < <(echo "$pass_names")
+printf '\r\e[2K' >&2
unique_duplicates=0
total_shared=0
diff --git a/.local/share/pass-extensions/g.bash b/.local/share/pass-extensions/g.bash
new file mode 100755
index 0000000..4ab3ace
--- /dev/null
+++ b/.local/share/pass-extensions/g.bash
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec pass git "$@"