Skip to content

Instantly share code, notes, and snippets.

@nickrw
nickrw / sshv
Created January 23, 2013 02:12
#!/bin/bash
# A quick and dirty script for quickly SSHing to local vagrant virtual machines.
# It assumes default Vagrant port forwards. Your first VM is at 2222, your second
# is at 2200. Anything more than that and you're in trouble.
# Why? Because:
#
# $ ( time vagrant ssh -c echo ) 2>&1 | grep real
# real 0m4.870s
@nickrw
nickrw / .vimrc
Last active December 11, 2015 14:49
" Don't enter vi-compatible mode if called as 'vi' instead of 'vim'
set nocompatible
" Show the mode (duh)
set showmode
" Syntax hilighting (duh)
syntax on
" Allow edited files to set modes in a modeline.
@nickrw
nickrw / volsay.sh
Created April 19, 2013 12:43
volsay: Wrapper around OSX's `say' command, which sets the system volume to the requested level, then restores volume / mute state once speech is complete.
#!/bin/bash
function usage() {
echo "usage: $0 <volume (0-100)> <say args...>"
echo
echo "Unmutes and sets the system volume to volume%, passing the remaining"
echo "arguments to the OSX \`say' command, restoring volume / mute setting"
echo "to previous values after the speech has completed."
exit 1
}
su - alan
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist
exit
cat <<EOF | at tomorrow
osascript -e 'set volume output muted false'
osascript -e 'set volume output volume 100'
open "http://www.youtube.com/watch?v=sTSA_sWGM44"
EOF
awk '/^[0-9]{2}:[0-9]{2} <@twgbot> (Game|Fun) starting! (.*):/ { sub("^(.*:){2}\\s",""); total += NF; count++ } END {print "Average of " total/count " players per game. " count " games played."}' \#werewolf.log
{
"Statement": [
{
"Sid": "PackerSecurityGroupAccess",
"Action": [
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:DescribeSecurityGroups",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress"
{
"Statement": [
{
"Sid": "PackerAMIAccess",
"Action": [
"ec2:CreateImage",
"ec2:RegisterImage",
"ec2:DescribeImages"
],
"Effect": "Allow",
#!/bin/bash
rdom () { local IFS=\> ; read -d \< E C ;}
base_ami=$(while rdom; do
if [[ $E = description ]]; then
if [[ $C =~ ^ami- ]]; then
echo $C
fi
fi
done < /var/lib/jenkins/jobs/packer-base/lastSuccessful/build.xml | head -n 1)
#!/bin/bash
# Debian package dependencies: html-xml-utils qprint w3m
parcel=$1
from=$2
to=$3
tmp=/tmp/parcelforce_$parcel
#!/bin/bash
# usage: ./remove-mkv-subtitles.sh [--no-dry] [path(s)]
# Script to find MKV files in the given paths and remove subtitle tracks from them. Dry run by default.
# (usually) non-default dependencies: mkvtoolnix, dc
remvsub(){
set -e