$ pip install flask
$ pip install flask-login
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
(defmacro loop-vars | |
"Like loop, but will automatically populate recur points where the special | |
var recur-> is found. | |
Mostly useful in mutable contexts, where some external factor causes the | |
recur bindings to change. | |
" | |
[bindings & body] | |
{:pre [(and (vector? bindings) | |
(even? (count bindings)))]} |
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
(defn half | |
[s] | |
(bit-shift-right (count s) 1)) ;; faster division by 2 | |
(defn left-right | |
[v] | |
(let [v (if-not (vector? v) (vec v) v) | |
h (half v)] | |
[(subvec v 0 h) (subvec v h)])) |
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
(def ^{:const true :private true} | |
base-62-alphabet | |
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") | |
(defn encode | |
"Encodes v in a new base of ks." | |
[ks v] | |
(let [base (count ks)] | |
(apply str | |
(reduce |
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
backend primary { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
} | |
acl purge { | |
"127.0.0.1"; | |
} | |
sub vcl_recv { |
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
#!/usr/bin/env python2 | |
import sys | |
import pickle | |
class QueueError(Exception): | |
pass | |
class Queue: | |
def __init__(self, *args): |
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
⨀_⨀ | |
⨂_⨂ | |
(/◔ ◡ ◔)/ | |
°ﺑ° | |
(¬_¬) | |
(´・ω・`) | |
(ʘ_ʘ) | |
(ʘ‿ʘ) | |
(๏̯͡๏ ) | |
(◕_◕) |
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
def string_process(s): | |
cs = map(ord, '{0}'.format(s)) | |
clist = ''.join(['>' + c for c in | |
['+' * n for n in | |
[(i-i%10)/10 for i in cs]]]) | |
cell_zero = ''.join(['<' * n for n in [len(cs)]]) + '-' | |
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 string, random | |
print ' '+' '.join(string.ascii_uppercase) + '\n'+' +'+''.join(['-' for x in range(52)])+'\n'+''.join([chr(x)+' | '+' '.join([chr(random.randrange(33,127)) for x in range(26)])+'\n' for x in xrange(65,91)]) |
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, string, time | |
TEST = False | |
def timeit(func, *args): | |
'''Simple timeit wrapper for functions.''' | |
start = time.time() | |
func(*args) | |
elapsed = time.time() - start |