Skip to content

Instantly share code, notes, and snippets.


Eric Scrivner etscrivner

Block or report user

Report or block etscrivner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:986adaa563ead197293b
class ListedProduct(object):
def __init__(self, listed_product_tuple):
"""Takes a KeyedTuple and transforms it into a listed product.
:param listed_product_tuple: A KeyedTuple
:type listed_product_tuple: sqlalchemy.KeyedTuple
View gist:c9810bd8f85800b8d185
class ApiError(Exception): pass
class User(object):
"""Represents an authenticateable user"""
def __init__(self, email, password): = email
self.password = password
etscrivner /
Last active Aug 29, 2015
Sample interface for reading configuration files
import os
# Configuration variable names as constants
class Config(object):
etscrivner /
Last active Aug 29, 2015
Sample shell script to set environment variables for twelve-factor application
export MY_APP_NAME=superslice
export MY_APP_AWS_KEY=super-secret
export MY_APP_AWS_SECRET_KEY=super-super-secret
# Finally, call whatever command comes after this
etscrivner /
Last active Aug 29, 2015
Application using the simple config
import sys
import config
if __name__ == '__main__':
cfg = config.Config()
print 'Welcome to {}'.format(cfg.get(config.APP_NAME))
print sys.argv
etscrivner / localsettings-example
Last active Aug 29, 2015
Shell command to run simple script with local settings
View localsettings-example
user@computer:~/app$ ./ bin/ --app-arg1 arg1-val --app-arg2
Welcome to superslice
['bin/', '--app-arg1', 'arg1-val', '--app-arg2']
View gist:4f4e02e98465a7134e8d
import random
adjectives = [
'awkward', 'ginger', 'babyfaced', 'sloppy', 'hairy', 'sweaty',
'gangly', 'ugly', 'neckbeard', 'angry', 'constipated', 'wrinkly',
'porous', 'oozy', 'cuddly'
nouns = [
etscrivner / simple-redis-client.go
Created Sep 17, 2014
Simple redis client in Go
View simple-redis-client.go
package main
import (
etscrivner /
Created Sep 17, 2014
Simple redis client in rust
use std::io::TcpStream;
use std::str;
fn main() {
let mut client = match TcpStream::connect("", 6379) {
Ok(c) => c,
Err(e) => fail!("Failed: {}", e)
etscrivner /
Created Sep 24, 2014
Euler problem 1 in ocaml
let result = List.range 1 1000
|> List.filter ~f:(fun n -> (n mod 3) = 0 || (n mod 5) = 0)
|> List.reduce ~f:(+);;
You can’t perform that action at this time.