Skip to content

Instantly share code, notes, and snippets.

View danrjohnson's full-sized avatar

Dan Johnson danrjohnson

  • Sprout Social
  • Chicago
View GitHub Profile
import docker
class DockerContainer():
def __init__(self, docker_client=None, **container_opts):
self.container_opts = container_opts
self.docker_client = docker_client or docker.from_env()
self.container = None
def __enter__(self):
@danrjohnson
danrjohnson / Vagrantfile
Created October 2, 2018 13:31
Kubernetes Demo -- Platform
# -*- mode: ruby -*-
# vi: set ft=ruby :
#Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
@danrjohnson
danrjohnson / Vagrantfile
Last active September 20, 2018 00:41
Kubernetes Training Materials
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@danrjohnson
danrjohnson / Vagrantfile
Created June 17, 2016 19:38
Vagrantfile with some extra disks for lvm testing
# -*- mode: ruby -*-
# vi: set ft=ruby :
file_to_disk1 = '.vagrant/data_disk1.vdi'
file_to_disk2 = '.vagrant/data_disk2.vdi'
file_to_disk3 = '.vagrant/data_disk3.vdi'
$prov_script = <<SCRIPT
sudo apt-get update
sudo apt-get install -f lvm2
@danrjohnson
danrjohnson / Vagrantfile
Last active December 11, 2017 16:53
SaltStack with Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
config.vm.box = "ubuntu/trusty32"
import cProfile
from cStringIO import StringIO
import os
import pstats
import tempfile
from django.conf import settings
class ProfilerMiddleware(object):
def process_view(self, request, callback, callback_args, callback_kwargs):
from datetime import date
from django.core.mail import send_mail
class Person(object):
def __init__(self, given_name, family_name, email, dob, *args, **kwargs):
self.given_name = given_name
self.family_name = family_name
self.email = email
self.dob = dob