Skip to content

Instantly share code, notes, and snippets.

@nl5887
nl5887 / Makefile
Created September 11, 2015 16:36
grapviz tcpdump
LAYOUT=circo
SOURCES = $(wildcard *.dot)
TARGETS = $(SOURCES:.dot=.svg)
%.svg:%.dot
dot -Tsvg -K${LAYOUT} "$^" -o "$@"
all: $(TARGETS)
clean:
@pagreczner
pagreczner / negroniGorillaMux.go
Last active August 9, 2016 08:50
Negroni and Gorilla Mux with Middleware example - golang
package main
import (
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
)
func main() {
router := mux.NewRouter()
apiV1 := router.PathPrefix("/api/v1").Subrouter()
@hmmbug
hmmbug / graphite
Created April 28, 2014 17:32
ubuntu 14.04 + graphite + nginx
# goes in /etc/nginx/sites-available & link in ../sites-enabled
upstream graphite {
server unix:///tmp/uwsgi.sock;
}
server {
listen 9002;
server_name localhost;
@jasonbartz
jasonbartz / uwsgi_on_pypy.md
Last active August 16, 2017 11:02
uwsgi and pypy

Deploying pypy on uwsgi

Instructions are kind of sporadic around the internet, so I thought I would gather them all in one place. The following example uses a Flask app as the thing deployed. You should only have to this once, and then you can pass the bin around.

Requirements

  • pypy 2.x (tested)
  • uwsgi 1.9.11+ (trunk as of this gist)

Build translated pypy binary and pypy lib.

@kwlzn
kwlzn / Makefile
Created May 6, 2014 00:37
uWSGI + pex Makefile
PYTHON := python2.6
BUILD_DIR := buildtmp
AURORA_CLUSTER := test
AURORA_ROLE := $(shell whoami)
UWSGI_VER = 2.0.4
UWSGI_DIR = uwsgi-$(UWSGI_VER)
UWSGI_FILE = $(UWSGI_DIR).tar.gz
UWSGI_URL = http://projects.unbit.it/downloads/$(UWSGI_FILE)
@kyleclegg
kyleclegg / RestKit Local Loading
Last active January 28, 2018 23:38
RestKit - Load data from local json file
NSString *filePath = [[NSBundle mainBundle] pathForResource:JohnSmith ofType:@"json"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
if (data) {
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
KCUser *appUser = [[KCUser alloc] init];
NSString* MIMEType = @"application/json";
NSError* error;
NSData *data = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
id parsedData = [RKMIMETypeSerialization objectFromData:data MIMEType:MIMEType error:&error];
@kwlzn
kwlzn / uwsgi-pex.md
Last active June 13, 2018 15:55
uWSGI + pex

Building a test pex

setup.py

yakuza:src kw$ cat testapp/setup.py
#!/usr/bin/env python

from distutils.core import setup
### autoscale.tf
data "template_file" "userdata" {
template = "${file("templates/userdata.tpl")}"
vars {
region = "${var.region}"
file_system_id = "${aws_efs_file_system.prod-efs.id}"
}
}
resource "aws_launch_configuration" "mig5-prod-lc" {
@psobot
psobot / yaml_file.py
Created August 8, 2012 20:28
Real-time YAML object access in Python
"""
liveyamlfile.py
Live Pythonic attribute access to properties in a yaml file.
by Peter Sobot (hi@psobot.com), August 8, 2012
"""
import os
import time
import yaml
import logging
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log logs/error.log debug;
#pid logs/nginx.pid;
daemon off;