Make sure ffmpeg is up-to-date:
brew update
brew upgrade ffmpeg
Convert a MOV into frames. Tweak the 2/1 if you want more or fewer frames.
| #!/bin/sh | |
| STAGED_GO_FILES=$(git diff --cached --name-only | grep ".go$") | |
| if [[ "$STAGED_GO_FILES" = "" ]]; then | |
| exit 0 | |
| fi | |
| GOLINT=$GOPATH/bin/golint | |
| GOIMPORTS=$GOPATH/bin/goimports |
| .PHONY: all tags clean test build install generate image release | |
| REGISTRY_REPO = <..redacted..> | |
| OK_COLOR=\033[32;01m | |
| NO_COLOR=\033[0m | |
| ERROR_COLOR=\033[31;01m | |
| WARN_COLOR=\033[33;01m | |
| # Build Flags |
| # given an array keys and a dictionary, recursively navigate down the dictionary to fetch value | |
| def _get_value(dict, keys=[], default=None): | |
| """ | |
| _get_value({"k":{"k1":"v1"}}, ["k", "k1"]) == "v1" | |
| """ | |
| if not keys: | |
| return default | |
| elif len(keys) == 1: | |
| return dict.get(keys[0], default) | |
| else: |
| import Foundation | |
| enum Result<T> { | |
| case success(T?) | |
| case failure(Error) | |
| } | |
| enum HTTPError: Error { | |
| case noResponse | |
| case unsuccesfulStatusCode(Int) |
Make sure ffmpeg is up-to-date:
brew update
brew upgrade ffmpeg
Convert a MOV into frames. Tweak the 2/1 if you want more or fewer frames.
| { | |
| "AWSEBDockerrunVersion": "1", | |
| "Image": { | |
| "Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>", | |
| "Update": "true" | |
| }, | |
| "Ports": [ | |
| { | |
| "ContainerPort": "443" | |
| } |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
| // Server for HTTPS protocol. Redirects to canonical hosts, reverse proxies requests to internal backing servers. | |
| package main | |
| import ( | |
| "crypto/tls" | |
| "flag" | |
| "log" | |
| "net/http" | |
| "net/http/httputil" | |
| "time" |
| local random = math.random | |
| local function uuid() | |
| local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' | |
| return string.gsub(template, '[xy]', function (c) | |
| local v = (c == 'x') and random(0, 0xf) or random(8, 0xb) | |
| return string.format('%x', v) | |
| end) | |
| end |
| /* | |
| If you have a horizontal (or vertical) scroll container and want to set the scroll to center a specific | |
| element in the container you can use the following super simple technique. | |
| I'm going to show you how it was derived, because it's important to know why, not just how. | |
| */ | |
| /* | |
| Setup: | |
| [HTML] | |
| <div class="outer"> |