Skip to content

Instantly share code, notes, and snippets.

View mfischer-zd's full-sized avatar

Michael S. Fischer mfischer-zd

  • Zendesk
  • San Francisco, CA
View GitHub Profile
@mfischer-zd
mfischer-zd / initialize_vault
Created June 8, 2016 13:47
Hashicorp Vault initialization script
#!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
from prompt_toolkit import prompt
from prompt_toolkit.validation import Validator, ValidationError
from socket import getfqdn
import hvac
import sys
import os
@mfischer-zd
mfischer-zd / gist:050965106f8b12a01b20
Created February 21, 2016 18:04
libreswan configurations for AWS VPC endpoints
# /etc/ipsec.d/eastwest.conf - left-hand configuration (endpoint to 10.0.0.0/16)
conn eastwest
# we use %defaultroute below so we don't need to specify the instance's internal IP address,
# which may change if the instance is stopped/started
left=%defaultroute
# This host's Elastic IP address (what we advertise ourselves to "right" as)
leftid=52.27.234.11
leftsubnet=10.0.0.0/16
leftrsasigkey=...
# gateway address for 10.1.0.0/16 ("right's" Elastic IP address)
@mfischer-zd
mfischer-zd / nlink_example.go
Created April 18, 2015 09:43
Go language: How to get the number of links to a file (Unix)
@mfischer-zd
mfischer-zd / consul_tag_helper
Last active August 29, 2015 14:18
consul_tag_helper
#!/usr/bin/env python
# vim: syn=python:ts=4:sw=4:et:ai
# Usage: consul_tag_helper
#
# This program is in the Public Domain.
#
# Place your consul configuration files in /etc/consul.boilerplate.d, instead
# of /etc/consul.d. Boilerplate JSON configuration files can contain an extra
# key under 'service' called 'tag_program'. 'tag_program' is a path to an
Bundler could not find compatible versions for gem "chef-zero":
In Gemfile:
chefspec (~> 3.2.0) ruby depends on
chef-zero (>= 1.6.2, ~> 1.6) ruby
chef-zero (2.0.2)
Bundler could not find compatible versions for gem "json":
In Gemfile:
chefspec (~> 3.2.0) ruby depends on
class NodeUpdateFromFile < ::Chef::Knife
deps do
require "chef/node"
require "chef/json_compat"
require "chef/knife/core/object_loader"
end
banner "knife node update from file FILE (options)"
def loader
@mfischer-zd
mfischer-zd / gist:5219325
Created March 22, 2013 06:10
Copy briefcase files before ssh
__SSH=$(type -path ssh 2>/dev/null);
function ssh()
{
# This function overrides ssh to rsync all files listed in $HOME/.briefcase to
# the remote server before logging in. It tries very hard to skip this if
# you're logging in as another user, but it cannot detect whether you have an
# alternate "User" defined in $HOME/.ssh/config or its /etc equivalent.
# USE WITH CAUTION!
local skip_sync;
@mfischer-zd
mfischer-zd / gist:3547202
Created August 31, 2012 01:13
SSHA crypted password generator
#!/usr/bin/env ruby
# Ruby script to generate SSHA (Good for LDAP)
require 'sha1'
require 'base64'
hash = "{SSHA}"+Base64.encode64(Digest::SHA1.digest(ENV['PASS']+ENV['SALT'])+ENV['SALT']).chomp!
puts 'userPassword: '+hash+"\n"