Skip to content

Instantly share code, notes, and snippets.

@skratchdot
skratchdot / say_fns.sh
Created October 11, 2019 14:48
some helper functions for the OSX say command (random words, random voices, etc)
## say with a random voice
say_rand () {
say -v $(say -v ? | awk '{print $1}' | shuf -n1) "$@"
}
## say with a random english voice
say_rand_en () {
say -v $(say -v ? | grep en_ | awk '{print $1}' | shuf -n1) "$@"
}
@skratchdot
skratchdot / cleanlocks.sh
Created September 5, 2019 15:13
cleanlocks - a bash script to clean all the packge-lock.json files in a monorepo
#!/usr/bin/env bash
find . -type f -name package-lock.json -not -regex ".*node_modules.*" -delete
@skratchdot
skratchdot / generate-sox-sines.sh
Created February 8, 2019 14:45
generate all the different file types supported by sox
#!/bin/bash
for i in $(sox −h | grep "AUDIO FILE FORMATS: " | sed -e "s/AUDIO FILE FORMATS: //")
do
FNAME="sox-sine.$i"
echo "$FNAME"
sox -n "$FNAME" synth .1 sine 440
mediainfo "$FNAME"
# remove files that can't be read by sox
soxi "$FNAME" || rm "$FNAME"
@skratchdot
skratchdot / gif-to-mp4.sh
Created January 1, 2019 17:23
convert a gif to an mp4 using ffmpeg
#!/bin/bash
# https://unix.stackexchange.com/questions/40638/how-to-do-i-convert-an-animated-gif-to-an-mp4-or-mv4-on-the-command-line/294892#294892
ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4
@skratchdot
skratchdot / phone-signals.md
Last active May 1, 2020 00:15
a few phone signals via sox
@skratchdot
skratchdot / list-all-commands.sh
Created December 21, 2018 17:23
list-all-commands.sh
#!/usr/bin/env bash
# found these useful commands here:
# https://unix.stackexchange.com/questions/60776/list-all-files-binaries-in-current-path/60808#60808
#
# compgen -c # will list all the commands you could run.
# compgen -a # will list all the aliases you could run.
# compgen -b # will list all the built-ins you could run.
# compgen -k # will list all the keywords you could run.
@skratchdot
skratchdot / index.js
Last active April 26, 2017 03:11
Chrome Canary Headless Audio
import webdriver from 'selenium-webdriver';
const getDriver = async () =>
new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities({
browserName: 'chrome',
chromeOptions: {
args: ['headless'],
binary: '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'
@skratchdot
skratchdot / nvm-list-globals.sh
Created January 14, 2017 15:41
List all the globals you've ever installed with nvm
#!/bin/bash
find ~/.nvm/versions/node/*/lib/node_modules \
-mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sort | uniq
@skratchdot
skratchdot / _jscodeshift-transforms.md
Last active December 9, 2016 15:42
jscodeshift transforms