This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import Column, Integer, String | |
class Animal(Base): | |
__tablename__ = 'animals' | |
id = Column(Integer, primary_key=True) | |
common_name = Column(String) | |
latin_name = Column(String) | |
kingdom = Column(String) | |
def __init__(self, common_name, latin_name, kingdom): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost:chef $ tree -d | |
. | |
├── CondeNast | |
│ └── 1939771-Rails | |
│ ├── attributes | |
│ ├── files | |
│ │ └── default | |
│ ├── libraries | |
│ ├── providers | |
│ ├── recipes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 == '*' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>' |