Skip to content

Instantly share code, notes, and snippets.

View johndstein's full-sized avatar

John Stein johndstein

View GitHub Profile
@johndstein
johndstein / ansible_nvm_node.yml
Created June 7, 2014 02:31
Ansible task to install nvm and node
# Here is how to install nvm and node in an Ansible task.
# I tried a bunch of different things, and as usual it's simple, but you have to get it right.
# The important part is that you have to shell with /bin/bash -c and source nvm.sh
---
- name: Install nvm
shell: >
curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh
creates=/home/{{ ansible_user_id }}/.nvm/nvm.sh
- name: Install node and set version
@johndstein
johndstein / mongo-ansible.yml
Created June 7, 2014 03:51
Ansible install mongodb
# Install mongodb
---
- name: Add mongo ppa key
sudo: yes
apt_key: >
keyserver=hkp://keyserver.ubuntu.com:80
id=7F0CEB10
state=present
- name: Add mongo sources list
@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 / kafka.cheat.md
Last active October 11, 2017 22:43
Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1