This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
if [ $# = 0 ]; then | |
printf "usage: %s file [opts]\n" "$(basename "$0")" >&2 | |
exit 2 | |
fi | |
f=$1 | |
shift | |
if gpac -i "$f" inspect | grep -q DolbyVision; then | |
set -- -ab dby1 "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
set -o pipefail 2>/dev/null || : | |
aws_regions="\ | |
af-south-1 ap-east-1 ap-northeast-1 ap-northeast-2 ap-northeast-3 | |
ap-south-1 ap-southeast-1 ap-southeast-2 ca-central-1 eu-central-1 eu-north-1 | |
eu-south-1 eu-west-1 eu-west-2 eu-west-3 me-south-1 sa-east-1 us-east-1 | |
us-east-2 us-west-1 us-west-2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env awk -f | |
# usage: ere2bre <ere> | |
function bracket( \ | |
pattern, i, | |
c, c2, term, len, end \ | |
) { | |
++i # skip opening bracket | |
# ignore [] or [^] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# usage: shallow-clone <url> [ref] | |
url=$1 | |
ref=$2 | |
repo=$(basename "$url" .git) | |
head=$(git ls-remote "$url" HEAD | tail -n1 | cut -f1) | |
if [ ! "$head" ]; then exit 1; fi | |
if [ "$ref" ]; then | |
id=$(git ls-remote "$url" "$ref" "$ref^{}" | tail -n1 | cut -f1) | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Install | |
# 1. Install dependency: `pip3 install --user pyicloud` | |
# 2. Sign in to iCloud: `icloud --username [email protected]` | |
# 3. Copy file to somewhere in your `PATH` | |
# 4. Add `alias icloud-download="[email protected] icloud-download"` | |
# to ~/.profile or ~/.bashrc, etc | |
# 5. Use via eg. `icloud-download Documents/folder` | |
# which will download `folder` to your current directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add to ~/.profile or ~/.bashrc, etc | |
# Use it like: | |
# vm add ubuntu # or vm add ubuntu custom/ubuntu | |
# vm sh ubuntu | |
# <ctrl-x> to detach from shell | |
# vm sh ubuntu # returns to the same shell | |
# vm stop ubuntu && vm rm ubuntu | |
vm() { | |
case $1 in | |
ls) docker ps -a ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A script to build a dynamic Nginx module with the correct configure options. | |
set -eu | |
set -o pipefail 2>/dev/null || : | |
dir="$1" | |
if [ ! "$dir" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Functions to escape strings for use in utilities like grep, sed and ex | |
# Examples | |
# grep "$(bre "$foo")" file | |
# sed "s/$(ptrn "$foo")/$(repl "$bar")/g" file | |
# echo "s/$(exptrn "$foo")/$(exrepl "$bar")/g | %p | q" | ex file | |
bre() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
username=$1 | |
if [ ! "$username" ]; then | |
echo usage: $0 username >&2 | |
exit 1 | |
fi | |
if [ "`id -u`" != 0 ]; then |