Skip to content

Instantly share code, notes, and snippets.

View tym-xqo's full-sized avatar
🙀

Thomas Yager-Madden tym-xqo

🙀
View GitHub Profile
@tym-xqo
tym-xqo / deploy_oao-postgres.sh
Last active October 13, 2016 20:08
Running oao-postgres and dbadmin at Rackspace
#!/bin/bash
gcloud docker -a
docker pull us.gcr.io/lexical-cider-93918/oao-postgres:_build.72c78d4
docker run -id --name=oao-postgres-data us.gcr.io/lexical-cider-93918/oao-postgres:_build.72c78d4 tail -F /dev/null
sleep 20
docker run -d --name=oao-postgres-service --volumes-from=oao-postgres-data us.gcr.io/lexical-cider-93918/oao-postgres:_build.72c78d4
docker pull us.gcr.io/lexical-cider-93918/dbadmin:_build.f00437d
docker run -id --name=dbadmin-data us.gcr.io/lexical-cider-93918/dbadmin:_build.f00437d script tail -F /dev/null
sleep 20
docker run -d --name=dbadmin-service --volumes-from=dbadmin-data --link oao-postgres-service:postgres us.gcr.io/lexical-cider-93918/dbadmin:_build.f00437d
@tym-xqo
tym-xqo / k8s_deploy_oao-postgres.sh
Last active December 23, 2015 22:16
(Re)deploy postgres at GCE with kubernetes
#!/bin/bash
git clone git@github.com:OAODEV/k8s-resources.git
kubectl replace --force -f k8s-resources/warehouse/postgres.yaml
@tym-xqo
tym-xqo / namer.py
Last active October 5, 2015 12:14
arbitrary two-word name generator
#!/usr/bin/env python3
#coding: utf-8
import random
from AppKit import NSPasteboard, NSArray
def namer():
adjectives = ("aliased",
"angelic",
"anonymous",
def status_post(message, nickname, color):
token = os.getenv('STATUSTOKEN')
payload = {
'status': message,
'color': color,
'token': token
}
url = 'http://status.pedicel.xyz:5007'
headers = {'content-type': "application/json"}
url = '/'.join([url, nickname])
@tym-xqo
tym-xqo / date-loop.sh
Created March 18, 2016 20:20
loop-by-date.sh
#!/bin/bash
last="2016-02-23"
first="2015-12-31"
i=1
while [[ $last > $first ]]; do
this=$(date -I -d "$last - 3 days")
printf -v j "%02d" $i
@tym-xqo
tym-xqo / keep-docker-machine-up.bash
Last active May 10, 2016 19:16
docker-machine up and env set (good for adding to .bashrc)
#!/bin/bash
if [ $(docker-machine status default) != 'Running' ]; then
echo "start docker VM now [y/n]?"
read -n 1 start
if [ "$start" = "n" ]; then
:
else
docker-machine start default
eval $(docker-machine env default)
@tym-xqo
tym-xqo / Dockerfile
Last active December 8, 2022 22:13
pg_service.conf + psycopg2 example
FROM python:3-alpine
# install requirements for psycopg2
RUN apk update && apk add -u \
postgresql-dev \
gcc \
python3-dev \
musl-dev
RUN pip3 install psycopg2
@tym-xqo
tym-xqo / example.txt
Created March 22, 2017 17:07
Export data from interactive python shell
$ python
>>> import sys
>>> v = 'some value for this variable'
>>> x = open('/path/to/somefile', 'w')
>>> sys.stdout = x
>>> print(v)
>>> x.close()
$ cat /path/to/somefile
some value for this variable
$
@tym-xqo
tym-xqo / index.html
Last active December 6, 2017 17:15 — forked from gka/index.html
simple tables in D3
<!DOCTYPE html>
<html>
<head>
<title>Simple tables in D3</title>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://cdn.jsdelivr.net/npm/d3-jetpack@2.0.15/build/d3-jetpack.min.js"></script>
<style type="text/css">
body { font-family: 'Helvetica Neue', Helvetica; font-weight: 300; padding: 20px;}
th { text-align: left; }
@tym-xqo
tym-xqo / sql_handler.py
Last active February 14, 2018 15:47
Frontmatter handler for SQL files
import re
import sqlite3
import unittest
import frontmatter
from frontmatter import YAMLHandler
class SQLHandler(YAMLHandler):
""" Subclass of YAMLHandler that uses SQL comment indicators `/* <comment> */` as frontmatter