Skip to content

Instantly share code, notes, and snippets.

View mattjbarlow's full-sized avatar
🎯
Focusing

Matt Barlow mattjbarlow

🎯
Focusing
View GitHub Profile
Tue Jan 24 21:08:34 UTC 2017

Keybase proof

I hereby claim:

  • I am mattjbarlow on github.
  • I am mattjbarlow (https://keybase.io/mattjbarlow) on keybase.
  • I have a public key whose fingerprint is 9752 3067 E16F C68D 5515 74B7 C5DB A32E E694 D8F4

To claim this, I am signing this object:

@mattjbarlow
mattjbarlow / gist:242b66cdae6938d34419
Created December 22, 2014 15:40
Chef Shell in Test Kitchen
cd into /tmp/kitchen.
/opt/chef/embedded/bin/gem install chef-zero
/opt/chef/embedded/bin/chef-zero -d
knife cookbook upload -a -c client.rb
chef-shell -z -c client.rb -o '<YOUR RECIPE>'
@mattjbarlow
mattjbarlow / .emacs
Created September 8, 2014 19:08
.emacs for Chef users
;;; set EDITOR to emacsclient so that knife commands open in your Emacs session.
(server-start)
;;; You should have tons of buffers, ibuffer makes them easy to manage.
(require 'ibuffer)
;;; For editing markdwon files
(require 'markdown-mode)
;;; For heat and other templates
(require 'yaml-mode)
;;; Setup a workgroup for Chef. Split windows with test specs and recipes and shell.
import time
import socket
import datetime
import random
TCP_IP = '127.0.0.1'
TCP_PORT = 2003
tstamp = int(time.mktime(datetime.datetime.utcnow().timetuple()))
tstamp = datetime.datetime.utcnow()
@mattjbarlow
mattjbarlow / GitEvents.py
Last active August 29, 2015 14:05
Git Events
import requests
import time
import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 2003
github_user = 'mattjbarlow'
for a in range(1,10):
events_url = 'https://api.github.com/users/' + github_user + '/events?page=' + str(a)
def self.validate_numeric(spec, min, max)
# binding.pry
if spec.is_a? Fixnum
return false unless spec >= min && spec <= max
return true
end
# Lists of invidual values, ranges, and step values all share the validity range for type
spec.split(/\/|-|,/).each do |x|
next if x == '*'
# when outputting certificates, view user IDs distinctly from keys:
fixed-list-mode
# short-keyids are trivially spoofed; it's easy to create a long-keyid collision; if you care about strong key identifiers, you always want to see the fingerprint:
keyid-format 0xlong
with-fingerprint
# when multiple digests are supported by all recipients, choose the strongest one:
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
# preferences chosen for new keys should prioritize stronger algorithms:
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 BZIP2 ZLIB ZIP Uncompressed
# If you use a graphical environment (and even if you don't) you should be using an agent:
localhost:chef $ tree -d
.
├── CondeNast
│   └── 1939771-Rails
│   ├── attributes
│   ├── files
│   │   └── default
│   ├── libraries
│   ├── providers
│   ├── recipes
@mattjbarlow
mattjbarlow / start-statsd-graphite.sh
Last active August 29, 2015 14:00
StatsD and Graphite Start Script
#!/bin/bash
# start carbon data collection daemon - default port: 2003 --------------------
mkdir -p /var/log/carbon
/opt/graphite/bin/carbon-cache.py start --logdir=/var/log/carbon
# configure graphite ----------------------------------------------------------
mkdir -p /var/log/graphite
cat << EOF > /opt/graphite/webapp/graphite/local_settings.py
LOG_DIR = '/var/log/graphite'