This file contains hidden or 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
{ | |
graphitePort: 2003 | |
, graphiteHost: "localhost" | |
, port: 8125 | |
, statusPort: 8126 | |
, statusAddr: "0.0.0.0" | |
, flushBuckets: [ | |
{ | |
pattern: "^pagetime\.domload.*" | |
, flushInterval: 60000 |
This file contains hidden or 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
from nyanbar import NyanBar | |
progress = NyanBar() | |
import time | |
for n in range(100): | |
time.sleep(.1) | |
progress.update(n) |
This file contains hidden or 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
# wtf8.py | |
import codecs | |
def encode(input, errors='strict'): | |
return input.encode('utf-8', errors).decode('latin-1', errors).encode('utf-8', errors), len(input) | |
def decode(input, errors='strict'): | |
return input.decode('utf-8', errors).encode('latin-1', errors).decode('utf-8', errors), len(input) | |
class StreamWriter(codecs.StreamWriter): |
This file contains hidden or 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 greenlet | |
class ContinuationError(Exception): pass | |
def callcc(f): | |
saved = [greenlet.getcurrent()] | |
def cont(val): | |
if saved[0] == None: | |
raise ContinuationError("one shot continuation called twice") |
This file contains hidden or 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
;; orbitz Mode | |
;; Need to add the ERC hook in emacs for it to work: | |
;; (add-hook 'erc-send-pre-hook 'erc-maybe-orbitz) | |
(define-minor-mode erc-orbitz-mode | |
"Toggle automatic orbitzing everything you type in ERC." | |
nil " orbitz") | |
(defun erc-maybe-orbitz (ignore) | |
"Change the text to orbitz text, if `erc-orbitz-mode' is non-nil." |
This file contains hidden or 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
(defun three-quarters-window () | |
"Resizes current window big" | |
(interactive) | |
(let ((size (- (truncate (* .75 (frame-height))) (window-height)))) | |
(if (> size 0) | |
(enlarge-window size)))) | |
(global-set-key "\C-x7" 'three-quarters-window) |
This file contains hidden or 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
""" | |
example ported to python + greenlet from Revisiting Coroutines http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.58.4017 | |
""" | |
import greenlet | |
class ContinuationError(Exception): pass | |
def call_cc(f): | |
saved = [greenlet.getcurrent()] |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "../src/hashmap.h" | |
#define NUM_TESTS 1 | |
int PASSED = 0; |
This file contains hidden or 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 java.util.Date; | |
import java.util.Map; | |
import java.util.HashMap; | |
public class FooMap { | |
public static <K, V> Map<K, V> map(Object ... items) { | |
Map<K, V> m = new HashMap<K, V>(); | |
// potentially off by 1, but this is just a test anyway. | |
for (int i = 0; i < items.length; i += 2) { |
This file contains hidden or 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
#ifndef _SN_UTILS_H | |
#define _SN_UTILS_H | |
#include <stdio.h> | |
#include "error.h" | |
#define TODO(x) do {fprintf(stderr, "TODO: Didn't do that yet: %s %s:%d\n", \ | |
x, __FILE__, __LINE__);} while (0); | |
#define ERROR(t, x) do { \ |