Update tmux and add local bins

This commit is contained in:
Hunter Haugen 2024-03-22 14:26:28 -07:00
parent e58102cf1a
commit f88286d60b
Signed by: hunner
GPG key ID: EF99694AA599DDAD
13 changed files with 184 additions and 3 deletions

@ -1 +1 @@
Subproject commit 4e2dc2a5065f5e8e67366700f803c733682e8f8c Subproject commit f7b6da07ab55fe32ee5f7d62da56d8e5ac691a92

@ -1 +1 @@
Subproject commit 15acc6172300bc2eb13c81718dc53da6ae69de4f Subproject commit 489a96189778a21d2f5f4dbbbc0ad2cec8f6c854

@ -1 +1 @@
Subproject commit 44af8d8eff820eedd9702704d832ceda6732b34c Subproject commit 25cb91f42d020f675bb0a2ce3fbd3a5d96119efa

66
local/bin/emoji-menu Executable file
View file

@ -0,0 +1,66 @@
#!/usr/bin/env bash
#
# Emoji Menu
#
# Quickly find emojis and copy to clipboard.
#
#
# To install:
#
# 1. Clean-up https://unicode.org/Public/emoji/11.0/emoji-test.txt
# grep -Po '(?<= #).*'
#
# 2. Install xclip and rofi
# sudo apt install xclip rofi
#
# 3. Assign to a keyboard combination
# Try xbindkeys
#
set -e
# Emoji database location
EMOJI_MENU_DB=${EMOJI_MENU_DB:-"$HOME/.emoji-menu-db"}
# Command to run after user chooses an emoji
EMOJI_MENU_COMMAND=${EMOJI_MENU_COMMAND:-'xclip -selection clipboard'}
# Report usage
usage() {
echo "Usage: $(basename "$0") [-t | -c <command>] [-f <filepath> ]" 1>&2
echo
echo " -f <filepath> Use a custom emoji database."
echo " -c <command> Apply a custom command to the emoji choice."
echo " -t Simulate typing the emoji choice with the keyboard."
echo
exit "$1"
}
# Type result using xdotool
typeResult() {
awk '{ print "type " $0 }' | xdotool -
}
# Get Options
while getopts ":c:f:th" o; do
case "${o}" in
f) EMOJI_MENU_DB="${OPTARG}" ;;
c) EMOJI_MENU_COMMAND="${OPTARG}" ;;
t) EMOJI_MENU_COMMAND=typeResult ;;
h) usage 0 ;;
*) usage 1 ;;
esac
done
# Default DB
if [ ! -e "$EMOJI_MENU_DB" ]; then
wget -O "$EMOJI_MENU_DB" 'http://bit.ly/emoji-menu-db'
fi
# Rofi can handle large inputs and emojis
rofi -p '🔍' -width 610 -dmenu \
< "$EMOJI_MENU_DB" \
| grep -oP '^[^\s]+' \
| tr -d '\n' \
| ${EMOJI_MENU_COMMAND}

31
local/bin/flash_keeb.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
echo Need the sudo pass first...
sudo echo OK
if [ ! -f "${HOME}/Downloads/firmware.zip" ]; then
echo Could not find firmware.zip
exit 1
fi
FILES=$(unzip -l ~/Downloads/firmware.zip | awk '{print $4}' | rg -v '(Name|^$|----)')
FILE=$(echo $FILES | head -n1)
if [ -z "$FILE" ]; then
echo Could not find firmware file in firmware.zip
exit 1
fi
echo Found firmware file: $FILE
unzip -o ~/Downloads/firmware.zip "$FILE" -d /tmp
echo Reset the keeb.....
sleep 5
sudo mount /dev/sdb /mnt/keeb
sudo cp /tmp/$FILE /mnt/keeb
sudo umount /mnt/keeb
echo Flashed!
echo "Remove firmware.zip? (y/n)"
read -r REMOVE
if [ "$REMOVE" = "y" ]; then
rm ~/Downloads/firmware.zip
fi

2
local/bin/keeb.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
xset r rate 200 30

6
local/bin/office-hdmi.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
xrandr --output eDP-1-1 --auto
xrandr --output HDMI-1-1 --auto
xrandr --output HDMI-1-1 --left-of eDP-1-1
xrandr --output HDMI-1-1 --primary

19
local/bin/talon_pedal.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
pedal_down="enable"
pedal_up="disable"
if [ xsleep = x"$1" ]; then
pedal_down="disable"
pedal_up="enable"
fi
line=""
aseqdump -p "USB Uno MIDI Interface" | while true ; do
read -r line
case $(echo "$line" | tr -s " " | cut -d " " -f 4-8) in
"0, controller 67, value 0") echo "actions.speech.${pedal_up}()" | ~/.talon/bin/repl ;;
"0, controller 67, value 127") echo "actions.speech.${pedal_down}()" | ~/.talon/bin/repl ;;
*) echo "other stuff: $(echo "$line" | tr -s " " | cut -d " " -f 4-8)" ;;
esac
done

16
local/bin/talon_state.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
if [ x = x"$1" ]; then
echo "wrong"
exit 1
fi
if [ "wake" = "$1" ]; then
echo 'actions.speech.enable()' | ~/.talon/bin/repl
exit 0
fi
if [ "sleep" = "$1" ]; then
echo 'actions.speech.disable()' | ~/.talon/bin/repl
exit 0
fi
echo "what?"
exit 1

8
local/bin/twomon.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
xrandr --output eDP-1-1 --auto
xrandr --output DP-1-2 --auto
xrandr --output HDMI-1-1 --auto
xrandr --output DP-1-2 --left-of eDP-1-1
xrandr --output HDMI-1-1 --left-of DP-1-2
xrandr --output DP-1-2 --primary

3
local/bin/use_avid.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
echo 'actions.sound.set_microphone("Avid Mbox Mini Analog Stereo")' | ~/.talon/bin/repl

3
local/bin/uuid.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
uuidgen | tr -d '\n' | xclip

View file

@ -0,0 +1,27 @@
#!/bin/bash
# brew install x265
# brew install ffmpeg
# brew install youtube-dl
# brew install imagemagick
ID='https://www.youtube.com/watch?v=p0JspnMuyig' # YouTube video ID, i.e. https://www.youtube.com/watch?v={ID}
# fetch the video file with youtube-dl
# convert it to MP4 (not really needed, but keeps the filename predictable)
if [ ! -f $ID.mp4 ]; then
youtube-dl --output '%(id)s.%(ext)s' --recode-video mp4 $ID
fi
# convert the video file to GIF with ffmpeg
START='00:08:52.000' # start 4 seconds in
LENGTH='00:00:25.000' # end after 5 seconds
SIZE='400x300' # size of the output GIF
ffmpeg -ss $START -i $ID.mp4 -pix_fmt rgb8 -r 10 -s $SIZE -t $LENGTH $ID-unoptimized.gif
# optimize the GIF with imagemagick
convert -layers Optimize $ID-unoptimized.gif $ID.gif
# credits:
# http://www.commandlinefu.com/commands/view/10002/create-an-animated-gif-from-a-youtube-video
# http://superuser.com/a/436109/106809