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
# I use this on Linux: | |
#!/bin/bash | |
# e - launch emacsclient or server. | |
ps ax | grep "emacs --daemon" | grep -v "grep" | |
if [ "$?" -eq "1" ] | |
then | |
/usr/bin/emacs --daemon | |
fi |
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 functools import wraps | |
def jsonp(view_func): | |
"""Wrap a json response in a callback, and set the mimetype (Content-Type) header accordingly | |
(will wrap in text/javascript if there is a callback). If the "callback" or "jsonp" paramters | |
are provided, will wrap the json output in callback({thejson}) | |
Usage: | |
@jsonp |
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
(function () { | |
// no point in having the function take only a day, or | |
// having a function at all for that matter... | |
var date = new Date(); | |
if (date.getDate() === 21 && | |
date.getMonth() === 4 && | |
date.getFullYear() === 2011) { | |
document.write('its the rapture'); | |
} else { |
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
# 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
Day job: Software Engineer at Meetup | |
Favorite Python project: nyanbar (https://github.com/apgwoz/nyanbar) | |
Favorite Conference: I don't go to many conferences. Clojure Conj was great last year. | |
Python Experience Level: Experty |
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
(ns ded | |
"Structural Data EDitor for Clojure with zippers. Inspired by Interlisp: http://larry.masinter.net/interlisp-ieee.pdf" | |
(:require [clojure.zip :as z]) | |
(:use [clojure.pprint :only (with-pprint-dispatch code-dispatch pprint)] | |
[clojure.repl :only (source-fn)])) | |
(defn print-hr | |
"Prints 30 dashes and a newline." | |
[c] | |
(println (apply str (repeat 30 c)))) |
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
;;; project-mode.el | |
;; | |
;; Author: Benjamin Cluff | |
;; Created: 02-Feb-2010 | |
;; | |
;; Synopsis: | |
;; * Finding files is greatly simplified (see key bindings) | |
;; * TAGS files for project files. | |
;; |
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
---------- Forwarded message ---------- | |
From: Mark S. Miller <[email protected]> | |
Date: Tue, Nov 16, 2010 at 3:44 PM | |
Subject: "Future of Javascript" doc from our internal "JavaScript Summit" | |
last week | |
To: [email protected] | |
On November 10th and 11th, a number of Google teams representing a variety | |
of viewpoints on client-side languages met to agree on a common vision for | |
the future of Javascript. |
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
/* | |
Yeah, so obviously I need to use a better salt for the key derivation, and of course I need to do a better job all together with other things (IV, etc). | |
This is just a test run for using libgcrypt to do symmetric encryption, however. | |
GCRY_KDF_PBKDF2 | |
gcry_kdf_derive ( const void *passphrase, size_t passphraselen, int algo, int subalgo, const void *salt, size_t saltlen, unsigned long iterations, size_t keysize, void *keybuffer ) |
OlderNewer