Skip to content

Instantly share code, notes, and snippets.

View terryjbates's full-sized avatar

Terry Bates terryjbates

View GitHub Profile
@terryjbates
terryjbates / open_source_licenses.md
Created December 16, 2022 00:34 — forked from nicolasdao/open_source_licenses.md
What you need to know to choose an open source license.
@terryjbates
terryjbates / java_shop_politics.txt
Created April 13, 2018 22:13
Java Shop Politics
1
Michael O. ChurchRants, essays, and diatribes.APRIL 13, 2012 BY MICHAELOCHURCHJava Shop PoliticsOnce, I was at a company that was considering (and eventually did so) moving its infrastructure over to Java, and there was a discussionabout the danger of “Java Shop Politics”. It would seem strange to any non-programmer that a company’s choice of programminglanguage would alter the political environment– these languages are just tools, right? Well, no. In this case, almost all of us knew exactlywhat was being talked about. Most software engineers have direct experience with Java Shop Politics, and it has a distinct and unpleasantflavor.
When Unix and C were developed, they were designed by people who had already experienced firsthand the evils of Big Software, ormonolithic systems comprised of hundreds of thousands of lines of code without attention paid to modularity, that had often swelled tothe point where no one understood the whole system. (In the 1970s, these monoliths were often written in assembly l
@terryjbates
terryjbates / test_pep257_conformance.py
Last active April 25, 2017 23:28
Notes on creating a pep257 test function
# -*- coding: utf-8 -*-
"""Use tox or py.test to run the test-suite. Lifted straight from pydocstyle/test_integration.py."""
from __future__ import with_statement
from collections import namedtuple
import os
import sys
# Reset to known good commit
git reset --hard 394c02dc893c358f2faa37b2c6635ba7c881b96f
# Push changes to gh
git push --force
# Fetch changes from upstream
git fetch upstream
# Merge upstream changes
########################## timer.py
# Import timings
import time
class Timer(object):
def __init__(self, verbose=False):
self.verbose = verbose
def __enter__(self):
@terryjbates
terryjbates / load_gen.py
Created February 12, 2016 01:17
Ramping load generator from Sys Perf book
#!/usr/bin/env python
import sys
import os
import random
IOSIZE = 8192
QUANTA = IOSIZE
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@terryjbates
terryjbates / tmux.conf
Last active October 31, 2015 19:49
tmux.conf config to be shared from the PragPub book
# Change the Prefix key to Ctrl-a and not Ctrl-b
set -g prefix C-a
unbind C-b
# Change default delay
set -s escape-time 1
# Set pane and reference window indexing to 1
set -g base-index 1
setw -g pane-base-index 1
@terryjbates
terryjbates / popen-example.py
Created November 29, 2012 01:21
Python code snippet with processing of stdout output gotten from Popen
#!/usr/bin/env python
import subprocess
p = subprocess.Popen(["/bin/ls", "-l"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
for line in p.stdout:
print line.strip()
for output in file.stdout.readlines():
if "FontCache" in output: