Skip to content

Instantly share code, notes, and snippets.

@atomicstack
atomicstack / VolumeUp.scpt
Last active August 28, 2021 22:25
AppleScript one-liner to increase volume by 10%, for use with Stream Deck and OSA script plugin (Note: app restart required after any script update in the Stream Deck configurator, see https://github.com/gabrielperales/streamdeck-osascript/issues/2)
set volume output volume ((get output volume in (get volume settings)) + 10)
https://github.com/atomicstack/setup-scripts/blob/main/rebuild-tmux.sh
lepton ~/bash_perl  zmodload zsh/sched
lepton ~/bash_perl  sched --help
lepton ~/bash_perl  sched
lepton ~/bash_perl  echo $zsh_scheduled_events
lepton ~/bash_perl  sched -o +10 echo hello world
lepton ~/bash_perl  echo $zsh_scheduled_events
1640831449:-o:echo hello world
lepton ~/bash_perl 
lepton ~/bash_perl  echo $zsh_scheduled_events
@atomicstack
atomicstack / print-figlet-fonts.sh
Last active January 30, 2022 04:45
print examples of every installed figlet font. nicer than showfigfonts as it uses --termwidth and --filter border
#!/bin/bash
for f in /usr/share/figlet/*; do
font_name=$(basename "$f" | awk -F '.' '{print $1}')
message=" $font_name "
banner=$(toilet --filter border --font $font_name --termwidth "$message" 2>/dev/null)
[[ -z "$banner" ]] && continue
echo -e "$font_name:\n$banner\n"
done
@atomicstack
atomicstack / gist:7654627f74355b2b5e8c15289744479a
Created February 5, 2022 06:15
update zsh completion for tmux
% sudo cp -v $HOME/git_tree/zsh/Completion/Unix/Command/_tmux /opt/homebrew/Cellar/zsh/5.8_1/share/zsh/functions/_tmux
@atomicstack
atomicstack / url-extractor
Created February 8, 2022 09:21
useful for sample repositories, such as kb6
javascript console:
to_fetch = []; $('.machine_names').each(function(i, item) { var u = $(item).attr('href'); if (u.match('rar$')) { to_fetch.push(window.location.origin + "/" + u) } }); console.log(JSON.stringify(to_fetch))
shell:
jq -r '.[]' < 'kb6.json' | vipe | ( while read u; do wget --continue --no-glob "$u"; sleep 60; done )
@atomicstack
atomicstack / batch-mp3-decoder.sh
Last active February 10, 2022 18:23
(zsh) shell one-liner to walk a directory tree and use lame to decode all the mp3s within
find $PWD -type d | ( while read d; do pushd $d; for mp3_filename in *.mp3(N); do lame --quiet --decode "$mp3_filename" && echo $PWD/$(basename "$PWD/$
mp3_filename" .mp3).wav | tee -a converted.txt; done; popd; done ) | ts '[%F %T]'
@atomicstack
atomicstack / dupe-remover.sh
Created March 5, 2022 22:25
removes files with duplicate SHA-256 hashes. tweaked enhancement of https://gist.github.com/atomicstack/2c5501f6210b6a303b626f447d50d487
find . -type f -print0 | xargs -0 sha256sum | pv -l -s $( find . -type f | wc -l ) | sponge | perl -naE 'my $hash = shift @F; $seen{$hash}++ or next; $ENV{UNLINK_FILES} and unlink "@F"; my $result = $! ? "failed" : ""; say qq{unlinked @F $result}'
@atomicstack
atomicstack / brew-tmux-build-HEAD.sh
Created March 27, 2022 07:18
brew commands to build and upgrade tmux from its source repository
brew install --head tmux
brew upgrade --fetch-HEAD tmux
@atomicstack
atomicstack / brew-active-path.zsh
Created March 27, 2022 07:25
zsh function to display the install path for a given brew package
function brew-active-path() {
brew info "$1" | perl -naE 'm/[*]$/ and say($F[0])'
}