Skip to content

Instantly share code, notes, and snippets.

View garlandkr's full-sized avatar
🎯
Focusing

Ken Garland garlandkr

🎯
Focusing
View GitHub Profile
ansible-playbook -i inventory create-ec2-instance.yml --limit dev-web-server-78a -vv
Traceback (most recent call last):
File "/usr/local/bin/ansible-playbook", line 309, in <module>
sys.exit(main(sys.argv[1:]))
File "/usr/local/bin/ansible-playbook", line 150, in main
inventory = ansible.inventory.Inventory(options.inventory, vault_password=vault_pass)
File "/usr/local/lib/python2.7/site-packages/ansible/inventory/__init__.py", line 100, in __init__
self.parser = InventoryDirectory(filename=host_list)
File "/usr/local/lib/python2.7/site-packages/ansible/inventory/dir.py", line 58, in __init__
parser = InventoryParser(filename=fullpath)
# This will cause full debug output to go to the console
import boto
boto.set_stream_logger('foo')
ec2 = boto.connect_ec2(debug=2)
@garlandkr
garlandkr / .bashrc
Last active August 29, 2015 14:03
bash prompt with updating epoch
umask 002
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias bp='vim ~/.bash_profile'
alias sbp='source ~/.bash_profile'
alias cls='clear'
@garlandkr
garlandkr / sites.yml
Created May 13, 2014 21:43
Nginx site linker for Ansible
# Link a list of sites from the playbook
{% for sitename in nginx.sitenames %}
- name: link nginx sites
file: src=/etc/nginx/sites-available/{{ sitename }}.conf dest=/etc/nginx/sites-enabled/{{ sitename }}.conf state=link
{% endfor %}
openssl genrsa -des3 -out trexglobal.com.key 4096
openssl req -new -key trexglobal.com.key -out trexglobal.com.csr
cp -v trexglobal.com.{key,original}
openssl rsa -in trexglobal.com.original -out trexglobal.com.key
rm -v trexglobal.com.original
openssl x509 -req -days 9999 -in trexglobal.com.csr -signkey trexglobal.com.key -out trexglobal.com.crt
//==============================================================================
// Casper generated Sun Jan 26 2014 10:54:09 GMT-0500 (EST)
//======================c========================================================
var x = require('casper').selectXPath;
ERROR: the recorded sequence does not start with a url openning.
casper.waitForSelector(".main-nav a:nth-child(2) .nav-in",
function success() {
test.assertExists(".main-nav a:nth-child(2) .nav-in");
this.click(".main-nav a:nth-child(2) .nav-in");
@garlandkr
garlandkr / notes.md
Created November 20, 2013 01:25 — forked from dutc/notes.md

schedule

6:30 - 6:40: settling in
6:40 - 7:00: Julian, quick introduction to PyPy
7:00 - 7:10: Andy, quick introduction to CLI
7:10 - 7:15: James, NYC Python announcements
7:15 - 8:30: James, CPython workshop
8:30 - 9:00: mingling + sponsor announcements

themes

@garlandkr
garlandkr / mainsite.conf
Created November 19, 2013 22:39
attempt to proxy multiple servers in nginx
upstream mysite {
server unix:/tmp/gunicorn.sock fail_timeout=0;
}
upstream php5-fpm {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name mysite.com;
<filter>
<whitelist>
<directory suffix=".php">sites</directory>
<directory suffix=".inc">sites</directory>
<directory suffix=".install">sites</directory>
<directory suffix=".module">sites</directory>
<directory suffix=".php">profiles</directory>
<directory suffix=".inc">profiles</directory>
<directory suffix=".install">profiles</directory>
<directory suffix=".module">profiles</directory>
@garlandkr
garlandkr / snapshot.py
Created September 20, 2013 14:05
Make EBS snapshots based on tags
untitled text 3.txt
untitled text 31.txt
#!/usr/bin/env python
import boto
import argparse
import time, datetime, sys, logging, socket, re
from dateutil.relativedelta import relativedelta
def get_creds():