Bash tab completion for the npx command
Save complete_npx
in your home folder and then source it on your .bash_profile
with:
. ~/complete_npx.sh
root = true | |
[*] | |
charset = utf-8 | |
end_of_line = lf | |
indent_size = 4 | |
insert_final_newline = true | |
[{Makefile,*.sh}] | |
indent_style = tab |
#!/usr/bin/env bash | |
# | |
# Slide an image to the left using ffmpeg | |
# | |
# Usage: | |
# ./slide photo_input.jpg video_output.mp4 | |
# | |
# See: | |
# https://ffmpeg.org/ffmpeg-filters.html#overlay-1 | |
# https://easings.net/ |
#!/usr/bin/env bash | |
# | |
# Make your server get traffic from port 80 without having to run it with sudo privilege. | |
# Based on: Running Jenkins on Port 80 or 443 using iptables | |
# https://wiki.jenkins.io/display/JENKINS/Running+Jenkins+on+Port+80+or+443+using+iptables | |
# allow traffic on ports 80 and 8080 | |
sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT | |
sudo iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT |
#!/usr/bin/env node | |
class CancelError extends Error { | |
constructor(message) { | |
super(message) | |
this.name = 'CancelError' | |
} | |
} | |
function random(minimum, maximum) { |
function check_for_virtual_env { | |
[ -d .git ] || git rev-parse --git-dir &> /dev/null | |
if [ $? == 0 ]; then | |
local ENV_NAME=`basename \`pwd\`` | |
if [ "${VIRTUAL_ENV##*/}" != $ENV_NAME ] && [ -e $WORKON_HOME/$ENV_NAME/bin/activate ]; then | |
workon $ENV_NAME && export CD_VIRTUAL_ENV=$ENV_NAME | |
fi | |
elif [ $CD_VIRTUAL_ENV ]; then |
#!/usr/bin/env bash | |
# | |
# Scale up or down the duration of the given video | |
# The final video will be in the mp4 format | |
# | |
# Usage: | |
# scale-duration <video-path> <desired-duration> | |
# | |
# Options: | |
# video-path The video to scale |
Simple example of how to properly launch background jobs and then gracefully terminate them.
EXIT
signal, but then after killing workers we get an unwanted "Terminated" message.exit
when cleaning, to break out of the infinite loop#!/usr/bin/env bash | |
# | |
# Reset Quick Look and all of its cache | |
# | |
# Usage: | |
# ./delete-quicklook-cache | |
main() { | |
qlmanage -r cache > /dev/null | |
local exit_code=$? |