Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kevinjqiu on github.
  • I am idempotent (https://keybase.io/idempotent) on keybase.
  • I have a public key ASA8HFKJJnSqbA5jfAgQwxSs54LPFrV7ta_mERbrmX1TjQo

To claim this, I am signing this object:

from tests.integration import fixtures
server = fixtures.couch_server()
testdb = server.create('test')
testdb.save(fixtures.get_user_design_doc())
testdb.save(fixtures.get_user_doc('joe', 'hart'))
testdb.save(fixtures.get_user_doc('tim', 'cahill'))
testdb.save(fixtures.get_user_doc('chris', 'smalling'))
FROM node:0.12.2
COPY . /app
RUN npm install -g bower
RUN cd /app; npm install; bower install --allow-root;
WORKDIR /app
VOLUME ["/certs"]
#!/bin/bash
# Most of this is credited to
# https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy
# With a few minor edits
# to run iptables commands you need to be root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root."
return 1
fi
version: "2"
services:
nginx:
image: nginx
ports:
- "80:80"
links:
- web
command: /bin/bash -c "echo -e 'upstream backend { server web:5000; }\nserver { listen 80; location / { proxy_pass http://backend; }}' > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
web:
import abc
import json
import re
import arrow
def read_entries():
with open('buy.json') as f:
entries = map(json.loads, (line for line in f.readlines() if line))
return entries
@kevinjqiu
kevinjqiu / Chapter2.md
Last active January 26, 2016 02:27
Fluent Python Notes

Chapter 2 An Array of Sequences

list comprehension no longer leaks variables

use * in tuple unpacking.

This can be used to facilitate car, cdr:

package main
import (
"fmt"
"os"
"strconv"
"math"
"runtime"
)
<!-- product.php -->
<?php
class Product {
function __construct() {
}
}
?>
<!-- client.php -->
<?php
import time
def test0():
assert False
def test1():
time.sleep(1)
assert True