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 drop_to_ipy(self, request, qs): | |
def fixterm(): | |
import os; os.system('reset') | |
from pprint import pprint; import IPython; IPython.Shell.IPShellEmbed(argv=[])() | |
def admin_from_model_instance(obj): | |
admin.site._registry[obj.__class__].__class__ | |
def model_from_admin_obj(): | |
return [[k,v] for k,v in admin.site._registry.items() if v.__class__==self.__class__][0][0] |
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 bash | |
# This script was made by a master bash hacker, hence to following 2 settings | |
set -o errexit | |
set -o nounset | |
cat << EOF | |
django-bootstrap -- generates a complete django project | |
usage: django-bootstrap [app_name] [project_name] [virtualenv_path/name] [admin_name (default=admin)] [admin_password (default=admin)] |
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
;; Adapted from https://github.com/swannodette/enlive-tutorial | |
;; Install clojure and leiningen, clone the above repo, do lein deps, then lein repl. | |
;; At that point, you just have to (load "tutorial/scrape1") then (in-ns 'tutorial.scrape1) | |
;; then (find-mp3s "http://www.aerialnoise.com/") and you're done. | |
(ns tutorial.scrape1 | |
(:require [net.cgrand.enlive-html :as html]) | |
(:require [clojure.contrib.str-utils2 :as str])) | |
(defn fetch-url [url] |
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
;; A naive translation of http://citizen428.net/blog/2010/09/04/erlang-bit-syntax-and-id3/ | |
; Tested at the REPL with a file from the ID3V1 test suite: http://www.id3.org/Developer_Information | |
;; Obviously macrology could give something more akin to Erlang's bit syntax w/error handling, etc. | |
; See PCL chapters 24 and 25 for example... | |
; http://www.gigamonkeys.com/book/practical-parsing-binary-files.html | |
; http://www.gigamonkeys.com/book/practical-an-id3-parser.html | |
(defpackage :id3 | |
(:use :cl) | |
(:export #:get-id3 |
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
(in-package :quickproject) | |
(defvar *after-make-project-hooks* nil | |
"A list of functions to call after MAKE-PROJECT is finished making a | |
project. It is called with the same arguments passed to | |
MAKE-PROJECT, except that NAME is canonicalized if necessary.") | |
;; TODO: Instead of &key docs do (when (stringp docs) ...)? | |
(defmacro defhook (name (&key docs) &body body) | |
"Define a function with the given NAME and an appropriate lambda list, |
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
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApILuZvCHXNtQOXOa2S1X7xpBIFzq4DrndbZc5jLCq/rOm/mUxnvXX3rpSRlJKcU2yTbL258qZKhuAt4BCA9s/4NIieahkoOorPdBh05jf+SA48JFD+DG+Y20LTfJfyzTTadIx4Hhn+81tq0n+fpCX+F7PnEOiAlrcXzR1bcNRvFXFuDJgzV1nT8U9lyep+sGpIYrp06UFEoR6rGCXfFYqY8tWP6/EWGR3nHNf8o2JcnCMaAh+yn9HERy8Eo4fCBrMTZ4Mtt39sI1qwixmyQObCTr7TcTP2CA4vBScFaYQAOaSfXDap9G0AD4a5kWkv64/QpQ9L2M+Mo3bHB9fMNHQQ== redline@redlaptop |
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 defenum (name (&rest keys)) | |
"Define a function named %NAME, that takes an argument KEY. If KEYS are | |
scalar values, the corresponding index in KEYS is return. Otherwise, the | |
associated value is returned." | |
`(defun ,(intern (format nil "%~A" (string-upcase name))) (key) | |
(let ((enum ',(loop for i = 0 then (1+ i) | |
for key in keys | |
collect (typecase key | |
(list key) | |
(t (cons key i)))))) |
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
git log master | grep -C 1 'Brit Butler' | grep 'commit ' | cut -d ' ' -f 2 | xargs git show > commits.txt | |
# I almost did this in lisp. Then I thought better of it. Update that resume! |
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
(ql:quickload '(cl-fad cl-ppcre)) | |
(defpackage :sloc | |
(:use :cl) | |
(:import-from :cl-fad #:walk-directory)) | |
(in-package :sloc) | |
(defvar *ext->syntax* | |
'(("factor" "^!.*")) |
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
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(ql:quickload '(yason closer-mop alexandria))) | |
;; Turns out cl-json does this just as fast without all the fuss. | |
;; Just (cl-json:encode-json (romreader:load-rom "foo.nes") stream). | |
(defpackage #:json-export | |
(:use :cl) | |
(:import-from #:closer-mop #:class-slots | |
#:slot-definition-name) |
OlderNewer