Skip to content

Instantly share code, notes, and snippets.

View johndstein's full-sized avatar

John Stein johndstein

View GitHub Profile
@johndstein
johndstein / zmq-ansible.yml
Created June 7, 2014 03:52
Ansible install zeromq 4
# probably a better more ansible way.
---
- name: Install zeromq 4.0.4
sudo: yes
shell: >
bash -c "wget http://download.zeromq.org/zeromq-4.0.4.tar.gz
&& tar xf zeromq-4.0.4.tar.gz
&& cd zeromq-4.0.4
&& ./configure
&& make
@johndstein
johndstein / install_python_ubuntu.sh
Created June 12, 2014 15:05
noob install python on ubuntu 14
sudo apt-get update
sudo apt-get -y install software-properties-common python-software-properties
@johndstein
johndstein / docker_ssh
Last active August 29, 2015 14:04
Docker you can ssh into.
docker run -i -t ubuntu:12.04 /bin/bash
apt-get update
apt-get install -y openssh-server
mkdir /var/run/sshd
mkdir /root/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwoal3xxr7FV0n2ozHa68XWCO14Z4oWfFz6RL+uWkMwRJ5MmmEyuVaH4DVEhAy5SAxShfRrELLzQn1nvaUCv7Ta8I0qoe/1l5DTDgU25Z4AAKLzn3gLudiW1hfpU1WOEUBVoEk+UpJ4lILFlMgSB0vpGwyiAqHteMafY26JVTwWYWPTnaVFl1HBJHIOjSa0extu23w7yp80g5e7ds/yYOX8GyCCjqfUwRtMdbsL6LTPomM92k3T+EiueLUfvAleE/G2hlVPJRweyibbSlaL2teh9AWx083kUiWyUyUT4kdJ4W1THors5v1koZHdAsgtXv6LKIMxwdapT7MmSOI0dmd vagrant@vagrant-ubuntu-precise-64" > /root/.ssh/authorized_keys
!!!! IMPORTANT !!!!
@johndstein
johndstein / settle.js
Created September 5, 2014 15:47
Bluebird .settle() bug
var Promise = require('bluebird');
var winston = require('winston');
// returns big old file report json from mcube if found or null if
// not found.
function doMcube(md5) {
return Promise.resolve({
some: {
crazy: 'json'
}
@johndstein
johndstein / node.ssl.js
Last active August 29, 2015 14:06
Node SSL Example
var Promise = require('bluebird');
var https = require('https');
var config = require('config');
var fs = require('fs');
var _ = require('lodash');
function _readFileSafe(path) {
try {
return fs.readFileSync(path);
} catch (err) {
@johndstein
johndstein / node.ssl.request.js
Created September 6, 2014 12:38
Node Request SSL Example
var Promise = require('bluebird');
var request = require('request');
var https = require('https');
var config = require('config');
var fs = require('fs');
function _readFileSafe(path) {
try {
return fs.readFileSync(path);
} catch (err) {
@johndstein
johndstein / Songs.md
Last active August 29, 2015 14:06
Mary Wedding Songs
song key notes
blue suede shoes C
I'm a believer G hang g end
hang on sloopy G
save the last dance for me E 123 bass
hold me, thrill me, kiss me, E
this magic moment C high c
kiss the girl C
sugar sugar D
@johndstein
johndstein / config.txt
Created October 8, 2014 17:21
kafka config
"kafka": {
"consumers": [{
"client": {
"connectionString": "localhost:2181"
},
"consumer": {
"topic": "job_result",
"groupId": "job_result"
}
}]
@johndstein
johndstein / wrap.promise.js
Created December 23, 2014 09:42
new promise catches all
#!/usr/bin/env node
var Promise = require("bluebird");
// function dosomething(n) {
// if (n === 7) {
// var err = new Error('seven error');
// return Promise.reject(err);
// //throw err;
// }
@johndstein
johndstein / stop_apps.py
Created February 13, 2015 17:25
Ansible stop all upstart jobs that begin with a given list of prefixes
#!/usr/bin/python
from glob import glob
DOCUMENTATION = '''
---
module: stop_apps
short_description: Stop all (upstart) jobs that start with given prefixes.
description:
- Calls stop on every upstart job that begins with one of the given
prefixes.