Skip to content

Instantly share code, notes, and snippets.

View paulsmith's full-sized avatar
😀
Hi, friends

Paul Smith paulsmith

😀
Hi, friends
View GitHub Profile
"""
I've been thinking lately about how perfect Redis would be for storing a
simple social graph. I posited that it would be relatively few lines of code,
and that it'd be clean code too. So here it is: a basic social graph built on Redis.
"""
class FriendGraph(object):
def __init__(self, ring):
self.ring = ring
@onyxfish
onyxfish / elections.chicagotribune.com.vcl
Created November 3, 2010 18:55
Elections Center Varnish Configuration File
backend app1 {
.host = "1.1.1.1";
.port = "80";
}
backend app2 {
.host = "2.2.2.2";
.port = "80";
}
import traceback
class WebApp(object):
def __init__(self, obj):
self.obj = obj
def __call__(self, environ, start_response):
try:
path = filter(bool, environ["PATH_INFO"].split("/"))
@wadey
wadey / index.html
Created December 3, 2010 22:06
SimpleGeo Advanced getLocation Example
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="http://cdn.simplegeo.com/js/1.2/simplegeo.context.jq.min.js"></script>
<script type="text/javascript" src="http://github.com/simplegeo/polymaps/raw/v2.4.0/polymaps.js"></script>
</head>
<body>
<script type="text/javascript">
function someLibraryCode(callback, dataProvider) {
dataProvider(function (error, data) {
if (error) {
callback(error);
return;
}
var newData = mungeData(data);
callback(null, newData);
});
}
@dustin
dustin / tcpproxy.go
Last active December 16, 2015 18:39
hex dumping tcp proxy
package main
import (
"encoding/hex"
"flag"
"io"
"io/ioutil"
"log"
"net"
"os"
@proppy
proppy / README.md
Last active August 1, 2016 13:32
isoc: yet another "standard" container format

isoc

isoc is yet another "standard" container format.

It brings together the best bits of Docker Image Specification 1.0 and App Container Specification 0.3.0+git into a comprehensive yet portable container archive format, at the cost of a "few" duplicated bytes.

Layout

An isoc image is a appc image embedded in a docker image, but also a docker image embedded in a appc image. Some people might describe it as an iso-contained container format.

@nilsjesper
nilsjesper / Random Donald Trump Word Salad Robot
Last active November 23, 2016 16:18
This is a quick bash script to make your Mac speak a random line from Donald Trump's Washington Post Editorial Interview. Because it sounds even crazier spoken by your computer. Just copy and paste into your terminal and hit return.
curl -s -N --location https://www.washingtonpost.com/blogs/post-partisan/wp/2016/03/21/a-transcript-of-donald-trumps-meeting-with-the-washington-post-editorial-board/ \
| perl -0ne 'my @list = $_ =~ m/<p>TRUMP:(.*?)<\/p>/smg; print $list[rand @list]' \
| say --progress -i -r 300 -v Alex
@brianboyer
brianboyer / gist:1696819
Created January 29, 2012 02:21
Lion dev environment notes
@rbranson
rbranson / gist:03d88e3733c6ee098a89
Last active July 25, 2017 15:17
My Thoughts on Rust

Rust is the first language that has emerged in the past few years that solves enough of my problems that it would be worth not only learning & teaching an entirely new language, but also sacrificing the maturity of the language ecosystems I’ve become accustomed to.

I highly suggest you read the "Guide" provided by the language developers or this won't make much sense. These are just some of my thoughts and are intended to highlight particular things that stand out to me. I am just a practitioner and not an expert in any of these languages, so I have probably made some incorrect assumptions and out-of-date assertions. Bare with me.

Rust feels like the first time momentum has gained behind a true systems programming language that uses modern PL design techniques to prevent common errors when dealing with memory. It seems like others have previously either been too anemic to be worth adopting or too abstract to provide proper control. The type system and assignment semantics are designed specifically to preven