Skip to content

Instantly share code, notes, and snippets.

View jasonjohnson's full-sized avatar
👾

Jason Johnson jasonjohnson

👾
View GitHub Profile
class Scanner(object):
def __init__(self, stream):
self.offset = 0
self.stream = stream
def current(self):
return self.stream[self.offset]
def step(self):
self.offset += 1
@jasonjohnson
jasonjohnson / main.go
Created April 3, 2014 21:47
Golang AMQP
package main
import (
"fmt"
"github.com/streadway/amqp"
"log"
)
func main() {
connection, err := amqp.Dial("amqp://guest:guest@127.0.0.1:5672")
@jasonjohnson
jasonjohnson / p.pickle
Created March 2, 2014 17:02
Disallow python pickle opcodes.
cos
system
(S'/bin/sh'
tR.
@jasonjohnson
jasonjohnson / python.md
Last active August 29, 2015 13:55
A collection of resources for learning Python.

Introduction

The best way to learn Python is to write Python, but these guides will provide an excellent starting point for the library landscape, coding standards, and community. This is by no means comprehensive! Once this is in an actual repository I will gladly accept relevant modifications.

Guides

The Hitchhiker’s Guide to Python!

"This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis."

TSDB="/root/opentsdb/build/tsdb"
ZK="zk0,zk1,zk2"
IN="truncate.txt"
FN="sum"
START=`date -d '2 years ago' '+%Y/%m/%d-%H:%M'`
STOP=`date -d '4 hours ago' '+%Y/%m/%d-%H:%M'`
echo $START
#!/bin/bash
while true; do
let now=`date +%s`
let val=`shuf -i 70-85 -n 1`
echo "put my.cpu.load $now $val host=blick" | nc -w 30 localhost 4242
done
./build/tsdb tsd \
--port=4242 \
--staticroot=build/staticroot \
--cachedir=/home/jason/Projects/opentsdb-cache/ \
--zkquorum=127.0.0.1:2181
-module(main).
-export([run/0, hold/0, example/0]).
hold() ->
receive
% ...
after
1000 ->
io:format("Timed out: ~p~n", [self()])
import os
import sys
os.environ["PYSDL2_DLL_PATH"] = "lib"
import sdl2
import sdl2.ext as ext
def run():
ext.init()
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.3" jmeter="2.8 r1393162">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="eventlet + multiprocessing" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>