Skip to content

Instantly share code, notes, and snippets.

View kirtfitzpatrick's full-sized avatar

Kirt Fitzpatrick kirtfitzpatrick

View GitHub Profile
@kirtfitzpatrick
kirtfitzpatrick / ec2_hostname.rb
Created April 9, 2012 21:27
Knife Ec2 Hostname Script - for Chef
#!/usr/bin/env ruby
# This script is intended to preprocess a knife ec2 server create command and
# generate a user_data script in the /tmp folder that will rename the host
# to match whatever the node name is before the chef bootstrapping process
# begins. It then splits the knife command in front of the --node-name or -N
# options and inserts "--user-data /tmp/server-01.userdata" (in the example
# below) and execs the command.
#
# Usage:
function _cdk_completer {
STACK_CMDS="list synthesize bootstrap deploy destroy diff metadata init context docs doctor"
if [ "$3" == "cdk" ]; then
COMPREPLY=($(compgen -W "$STACK_CMDS" $2))
elif [[ -d "cdk.out" ]] && ! [[ "$2" == "-"* ]]; then
TEMPLATES=$(ls -1 cdk.out/*.template.json | awk '{split($0,t,/\/|\./); print t[3]}')
COMPREPLY=($(compgen -W "$TEMPLATES" $2))
else
COMPREPLY=()
@kirtfitzpatrick
kirtfitzpatrick / webm2m4a.sh
Created January 22, 2023 03:40 — forked from elijahtsai/webm2m4a.sh
ffmpeg webm to m4a
#!/bin/zsh
mkdir f a
for i in *.webm
do
ffmpeg -i "$i" -write_xing 0 -c:a alac "f/${i:r}.m4a"
afconvert -v -f m4af -d aac@48000 "f/${i:r}.m4a" "a/${i:r}.m4a"
done