I hereby claim:
- I am justinclayton on github.
- I am justinclayton (https://keybase.io/justinclayton) on keybase.
- I have a public key ASBhfnoIncfKAYyzMnFfzxG_bBFuwKvwtaHLIjyhUvrC7Qo
To claim this, I am signing this object:
#!/usr/bin/env bash -eio pipefail | |
ROOT_ID=$(aws organizations list-roots | jq -r '.Roots[0].Id') | |
name=$1 | |
email=$2 | |
ou_name=$3 | |
create-account() { | |
aws organizations create-account --account-name $1 --email $2 |
aws ce get-cost-and-usage \ | |
--granularity DAILY \ | |
--time-period Start=$(date -v-1d +%Y-%m-%d),End=$(date +%Y-%m-%d) \ | |
--metrics UnblendedCost \ | |
| jq -r '.ResultsByTime[].Total.UnblendedCost.Amount' \ | |
| ruby -e 'puts "$#{gets.to_f.round(2)}"' |
I hereby claim:
To claim this, I am signing this object:
# Map prefix to Ctrl-a | |
unbind C-b | |
set -g prefix C-a | |
bind C-a send-prefix | |
bind r source-file ~/.tmux.conf | |
# Rename your terminals | |
#set -g set-titles on |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Alpha Component</key> | |
<real>1</real> | |
<key>Blue Component</key> | |
<real>0.20784313976764679</real> |
#!/usr/bin/env python | |
# coding=UTF-8 | |
import math, subprocess, re, sys | |
p = subprocess.Popen(['pmset', '-g', 'batt'], stdout=subprocess.PIPE) | |
output = p.communicate()[0] | |
# sample output | |
# "Now drawing from 'AC Power'\n -InternalBattery-0 (id=4522083)\t47%; charging; 2:00 remaining present: true\n" |
# nearest-rank percentile, assumes sorted array | |
function ceil(valor) | |
{ | |
return (valor == int(valor)) ? valor : int(valor)+1 | |
} | |
function p(k, values) { | |
return values[ceil((k / 100) * length(values))] | |
} |
variable "yes" { default = true } | |
data "template_file" "maybe" { | |
count = "${ var.yes == false ? 0 : 1 }" | |
template = "YES" | |
} | |
output "maybe" { | |
value = "${ var.yes == false ? "" : element(concat(data.template_file.maybe.*.rendered, list("")), 0) }" # <-- :_( | |
} |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Alpha Component</key> | |
<real>1</real> | |
<key>Blue Component</key> | |
<real>0.20784313976764679</real> |
asg_to_ips() { | |
local asg=$1 | |
local instances=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names ${asg} \ | |
| jq '[.AutoScalingGroups[].Instances[].InstanceId]') | |
aws ec2 describe-instances --instance-ids ${instances} | jq -r '.Reservations[].Instances[].PrivateIpAddress' | |
} |