This file contains 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/bash | |
# | |
# curl -fsSL http://bit.ly/YXV7L3 | bash -e | |
# | |
# | |
set -e | |
DIR=$HOME/bin | |
[ -d "$DIR" ] || mkdir -p "$DIR" |
This file contains 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
# screenrc | |
encoding UTF-8 | |
# Behaviour | |
termcapinfo xterm ti@:te@ | |
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # Tell screen how to set colors. AB = background, AF=foreground | |
#attrcolor b ".I" # Allow bold colors - NB: This fucks up dircolors in iTerm2 | |
defbce "on" # Erase background with current bg color | |
altscreen on | |
#term xterm-256color |
This file contains 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/bash | |
SSH_ENV="$HOME/.ssh/environment.$HOSTNAME" | |
start () { | |
if [ -f "$SSH_ENV" ]; then | |
source "$SSH_ENV" | |
if kill -0 "$SSH_AGENT_PID" 2>/dev/null; then | |
echo "Run 'source $SSH_ENV'" >&2 | |
return |
This file contains 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 gawk | |
# | |
# Only print stuff inside the puppet class: | |
#$0 ~ /^[ \t]*$/ {on = 0} | |
# | |
BEGIN { | |
cls_name=""; | |
} |
This file contains 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/bash | |
set -e | |
## requires running as root because filesystem package won't install otherwise, | |
## giving a cryptic error about /proc, cpio, and utime. As a result, /tmp | |
## doesn't exist. | |
[ $( id -u ) -eq 0 ] || { echo "must be root"; exit 1; } | |
tmpdir=$( mktemp -d ) |
This file contains 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
$ time aws ec2 describe-instances --instance-ids "$(curl -s http://169.254.169.254/latest/meta-data/instance-id)" --query 'Reservations[*].Instances[*].Tags' --output text | |
Owner amit.bakshi | |
Billing_Code ops | |
Name ops-deploy-003 | |
Hostgroup ops-deploy | |
Megatron_Deployment deploy | |
real 0m1.016s | |
user 0m0.321s | |
sys 0m0.134s |
This file contains 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
OPTS_SPEC="\ | |
$(basename $0 .sh) subcommand <options> | |
subcommands: | |
data - download a dataset | |
-- | |
h,help show help | |
d,debug debug output | |
v,verbose verbose output |
This file contains 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
$ ~/parse-with-help-from-git.sh data --game-tag foo | |
Hi from the data command | |
INPUT_FILE= | |
DATASET= | |
GAME_TAG=foo | |
[amit.bakshi@gii1302greendog bin (master)] | |
$ ~/parse-with-help-from-git.sh data --bad-arg foo | |
error: unknown option `bad-arg' | |
usage: parse-with-help-from-git subcommand <options> | |
subcommands: |
This file contains 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
#upstart script for a jenkins swarm agent | |
description "upstart script for jenkins-master" | |
start on started networking | |
stop on runlevel [016] | |
# respawn the job up to 10 times within a 10 second period. | |
# If the job exceeds these values, it will be stopped and | |
# marked as failed. |
This file contains 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
// Modify the following JSON object such that the SnapshotId of device /dev/sda1 is 'snap-12345678' and size is 4, | |
// while maintaining the structure of the of the object. | |
// You can't make assumptions about how it is formatted, except to say it's legal json. | |
[ | |
{ | |
"Ebs": { | |
"VolumeSize": 32, | |
"SnapshotId": "snap-ee16314e", | |
"DeleteOnTermination": true |
OlderNewer