Skip to content

Instantly share code, notes, and snippets.

View garlandkr's full-sized avatar
🎯
Focusing

Ken Garland garlandkr

🎯
Focusing
View GitHub Profile
@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():
<phpunit
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
stopOnFailure="true"
backupGlobals="true"
convertWarningsToExceptions="true">
<testsuites>
<testsuite name="all">
@garlandkr
garlandkr / optawatch.py
Created August 8, 2013 14:52
Using inotify to monitor system file changed in a directory and take action.
#!/usr/bin/env python
import re
import os
import logging
import argparse
import pyinotify
import subprocess