Skip to content

Instantly share code, notes, and snippets.

View gswallow's full-sized avatar

Greg Swallow gswallow

  • Indianapolis, IN, USA
View GitHub Profile
Created assaymatic-migrate.
Updated env vars from qa-env/environments/qa2/all.env and restarted assaymatic-migrate.
Set env vars and restarted assaymatic-migrate.
v1.7.1: Pulling from indigobio/assaymatic-daemonizer
6ffe5d2d6a97: Already exists
f4e00f994fd4: Already exists
e99f3d1fc87b: Already exists
a3ed95caeb02: Already exists
ededd75b6753: Already exists
@gswallow
gswallow / create-kubectl-creds.sh
Created July 25, 2017 21:34
H4XOR YOUR K8S CLUSTER!
#!/bin/bash
echo "So you lost your credentials, eh? No worries."
echo
echo "What's the DNS name of your cluster? (k8s.mycluster.net)"
read $cluster
echo "What's the name of your KOPS_STATE_STORE S3 bucket? (s3://my-bucket)"
read $KOPS_STATE_STORE
mkdir -p /tmp/$cluster
bundle list
Gems included by the bundle:
* addressable (2.5.1)
* attribute_struct (0.4.2)
* aws-sdk-core (2.10.9)
* aws-sigv4 (1.0.0)
* bogo (0.2.10)
* bogo-cli (0.2.12)
* bogo-config (0.2.2)
* bogo-ui (0.1.24)
scp site_input_repo.tar.gz <empire minion>
ssh ubuntu@<empire_minion>
docker login
docker pull indigobio/web-daemonizer:<tag>
docker run -t -i indigobio/web-daemonizer:<tag> /bin/bash
copy qa-env/XXX/all.env and paste in a file on the container
change the lines in all.env, on the container, so that bash can source them as environment variables.
start a second ssh session
docker cp site_input_repo.tar.gz <container>:/
cd /
db.batches.update({ $and: [ { "state": "processing" }, { "processing_at": { "$lte": new Date(Date.now() - 10800) } } ] }, { "$set": { "state": "failed" } }, { multi: true })
db.batches.update({ $and: [ { "state": "converting" }, { "converting_at": { "$lte": new Date(Date.now() - 10800) } } ] }, { "$set": { "state": "failed" } }, { multi: true })
@gswallow
gswallow / ascent-batches.py
Last active April 20, 2017 17:43
Datadog check
import time
import types
import bson
from pymongo import (
MongoClient,
ReadPreference,
uri_parser,
version as py_version,
)
@gswallow
gswallow / rds_create_role.py
Created October 14, 2016 14:51
AWS Lambda to create roles in an RDS instance, once it receives a notification from SNS
import json
import boto3
from psycopg2 import connect
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
""" IAM policy:
{
"Version": "2012-10-17",
"Statement": [
#!/bin/bash
sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install openssl-devel
sudo yum -y install Cython --enablerepo=epel
wget https://ftp.postgresql.org/pub/source/v9.4.9/postgresql-9.4.9.tar.gz
wget http://initd.org/psycopg/tarballs/PSYCOPG-2-6/psycopg2-2.6.2.tar.gz
tar xzf postgresql-9.4.9.tar.gz
tar xzf psycopg2-2.6.2.tar.gz
require 'spec_helper'
%w(ansible
ca-certificates
curl
python-lockfile
python-pip
python-setuptools
software-properties-common
unzip
@gswallow
gswallow / deregister_ecs_instance.py
Last active August 16, 2016 21:12
An AWS Lambda that deregisters stopped / replaced ECS cluster instances. For use with an SNS notification topic and auto scaling groups.
import json
import boto3
"""
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [