This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
# Configuration variable names as constants | |
APP_NAME = 'MY_APP_NAME' | |
APP_AWS_KEY = 'MY_APP_AWS_KEY' | |
APP_AWS_SECRET_KEY = 'MY_APP_AWS_SECRET_KEY' | |
class Config(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import config | |
if __name__ == '__main__': | |
cfg = config.Config() | |
print 'Welcome to {}'.format(cfg.get(config.APP_NAME)) | |
print sys.argv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
adjectives = [ | |
'awkward', 'ginger', 'babyfaced', 'sloppy', 'hairy', 'sweaty', | |
'gangly', 'ugly', 'neckbeard', 'angry', 'constipated', 'wrinkly', | |
'porous', 'oozy', 'cuddly' | |
] | |
nouns = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"bufio" | |
"fmt" | |
"net" | |
"strconv" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::TcpStream; | |
use std::str; | |
fn main() { | |
let mut client = match TcpStream::connect("127.0.0.1", 6379) { | |
Ok(c) => c, | |
Err(e) => fail!("Failed: {}", e) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def read_google(q): | |
return requests.get('https://www.google.com', params={'q': q}) | |
def bunch_of_requests(): | |
results = [] | |
for i in range(100): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let result = List.range 1 1000 | |
|> List.filter ~f:(fun n -> (n mod 3) = 0 || (n mod 5) = 0) | |
|> List.reduce ~f:(+);; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> (sys.getsizeof([False]*2) - sys.getsizeof([True]*1)) * 8 | |
64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
pu = !git branch | grep '^\\*' | cut -c3- | xargs git push origin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/gui | |
(require graphics/graphics) | |
(open-graphics) | |
(define vp (open-viewport "A Picture Language" 500 500)) | |
(define draw (draw-viewport vp)) | |
(define (clear) ((clear-viewport vp))) | |
(define line (draw-line vp)) | |
(define (make-vect x y) |