Skip to content

Instantly share code, notes, and snippets.

View michaelskyba's full-sized avatar
🕒

Michael Skyba michaelskyba

🕒
View GitHub Profile
@michaelskyba
michaelskyba / spell
Last active April 20, 2022 02:26
Small script for checking if a word is spelled correctly
#!/bin/sh
doc='
spell: check spelling of a word
usage: spell <word> [number]
"number": number of close matches that are shown if the word is spelled incorrectly
'
[ -z "$1" ] \
&& echo "$doc" \
@michaelskyba
michaelskyba / automate
Last active May 21, 2021 12:54
used to automate UIs
#!/bin/sh
# usage: "automate <text file>", where a text file contains a list of commands
# commands:
# move <x> <y> - moves the mouse an xy position
# click - click the mouse
# right_click - right-click the mouse
# key <key> - press a key on the keyboard
# pause <seconds> - wait some time
#!/bin/sh
# Script to easily find xy values for moving the mouse
# This is a helper script for the "automate" script
# Usage: xy <list of titles>
# E.g. you are on youtube and want to move the mouse to a video thumbnail
# (maybe clicking it), then to the youtube logo
# You would do:
@michaelskyba
michaelskyba / cl
Last active September 30, 2021 21:12
#!/bin/sh
doc='
cl: clock utility
this is just a wrapper around the commands by "terdon": https://superuser.com/a/611582
countdown: cl c <seconds> ["command to be run after finishing it"]
stopwatch: cl s
c stands for countdown and s stands for stopwatch
#!/bin/sh
# a case statement works way better than the terrible xdg-open
# usage: msk_open <file>
# Get the raw filetype
type=$(file -i "$1")
# Parse file -i
type=${type#*: }
#!/bin/sh
unread=$XDG_CONFIG_HOME/msk/rss/rss_unread
marked=$XDG_CONFIG_HOME/msk/rss/rss_marked
touch "$marked"
case "$1" in
get|mark|mark_get) [ "$2" ] || . err ;;
esac
missed() {
@michaelskyba
michaelskyba / msk_music
Last active February 27, 2023 03:18
Allow symbolic links for playlist functionality
#!/bin/sh
[ -z "$1" -o -z "$2" ] && . err
music_dir=$1
tracks=$2
# Otherwise wc could error on a non-existent
[ -f "$tracks" ] || touch "$tracks"
--- old
+++ new
@@ -35,7 +35,7 @@
0) echo 'No more tracks in queue. Please refresh the database, or set $MSK_MUSIC_REFRESH.' && exit 1 ;;
# No tracks, but user wants automatic refreshing
- 1) find "$MUSIC_DIR" -type f | shuf > "$XDG_DATA_HOME/msk_music/tracks" ;;
+ 1) find "$MUSIC_DIR" -type f -name "*.mp4" | shuf > "$XDG_DATA_HOME/msk_music/tracks" ;;
esac
fi
@michaelskyba
michaelskyba / msk_pass
Last active March 28, 2022 15:39
script to use budgetpass inside dmenu
#!/bin/sh
# msk_pass: uses bpass in dmenu
# use in sxhkd
picked=$(ls $BP_HOME | dmenu)
[ $picked ] && exit
master=$(:| dmenu)
[ $master ] && exit
#!/bin/sh
doc='
msk_display: display a short text in an image using imagemagick
useful for e.g. showing Japanese characters in a proper font
usage: msk_display "<text>"
sxiv is not called with &, so you might want to run msk_display ... &
'