Skip to content

Instantly share code, notes, and snippets.

View heldeen's full-sized avatar
🎯
Focusing

Heath Eldeen heldeen

🎯
Focusing
  • Salt Lake City, UT
View GitHub Profile
@heldeen
heldeen / createAwsProdCreds.sh
Last active August 29, 2015 14:21
Simple script for AWS STS, cross account access. You need this because you understand the security concerns and have a separate account for your production site, right?
aws sts assume-role --role-arn "arn:aws:iam::<ACCOUNT_ID>:path/to/yourProdRole" \
--role-session-name "session-reason" \
--query "Credentials.{AccessKeyId,SecretAccessKey,SessionToken}" \
--output text | awk 'BEGIN {print "[default]";} { print "aws_access_key_id =",$1,"\naws_secret_access_key =",$2,"\naws_session_token =",$3,"\naws_security_token =",$3; }' > ~/.aws/credentials.tmp
# wait for the AWS CLI to finish before we copy the file into place
sleep 5
cp ~/.aws/credentials ~/.aws/credentials.bak
cp ~/.aws/credentials.tmp ~/.aws/credentials
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@abramsm
abramsm / gist:9237098
Created February 26, 2014 19:52
Configuration for fast start embedded Zookeeper, useful for unit tests
InstanceSpec spec = new InstanceSpec(null, -1, -1, -1, true, -1, 2000, 10);
System.setProperty("zookeeper.serverCnxnFactory", "org.apache.zookeeper.server.NettyServerCnxnFactory");
myKeeper = new TestingServer(spec);
String keeperPort = String.valueOf(spec.getPort());
System.setProperty("zk.servers", "localhost:" + keeperPort);
zkClient = CuratorFrameworkFactory.builder()
.sessionTimeoutMs(60000)
.connectionTimeoutMs(10000)
.connectString("localhost:" + keeperPort)
.retryPolicy(new RetryOneTime(1000))