brian wickman - @wickman
[TOC]
Pants makes the manipulation and distribution of hermetically sealed Python environments
import os | |
from autobahn.resource import WebSocketResource, WSGIRootResource | |
from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol | |
from flask import Flask, render_template | |
from twisted.application import internet, service | |
from twisted.internet import reactor | |
from twisted.python.threadpool import ThreadPool | |
from twisted.web.server import Site |
[program:lss] | |
process_name=Shipper | |
command=java -jar /usr/local/logstash/bin/logstash-1.1.9-monolithic.jar agent --config /usr/local/logstash/conf/shipper.conf --log /usr/local/logstash/log/shipper.log | |
user=logstash | |
startretries=3 | |
redirect_stderr=true | |
std_out_logfile=NONE | |
startsecs=3 | |
environment=HOME="/usr/local/logstash/" |
This playbook has been removed as it is now very outdated. |
In [1]: policy = """{ | |
...: "Statement":[{ | |
...: "Effect":"Allow", | |
...: "Action":["s3:*"], | |
...: "Resource":["arn:aws:s3:::mybucket"]}]}""" | |
In [2]: import boto | |
In [4]: c = boto.connect_iam() | |
In [5]: instance_profile = c.create_instance_profile('myinstanceprofile') | |
In [6]: role = c.create_role('myrole') | |
In [7]: c.add_role_to_instance_profile('myinstanceprofile', 'myrole') |
try: | |
import numpypy as np # for compatibility with numpy in pypy | |
except: | |
import numpy as np # if using numpy in cpython | |
## Tri Diagonal Matrix Algorithm(a.k.a Thomas algorithm) solver | |
def TDMAsolver(a, b, c, d): | |
''' | |
TDMA solver, a b c d can be NumPy array type or Python list type. | |
refer to http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm |
#!/usr/bin/python | |
import re, urllib, urllib2 | |
class Spreadsheet(object): | |
def __init__(self, key): | |
super(Spreadsheet, self).__init__() | |
self.key = key | |
class Client(object): |
""" | |
A really stupid python template language inspired by coffeekup, markaby. | |
Do not use this code, it will ruin your day. A byproduct of insomnia. | |
TL;DR | |
----- | |
This module defines a template language that allows us to do: | |
d = Doc() |
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |