Skip to content

Instantly share code, notes, and snippets.

View coopernurse's full-sized avatar

James Cooper coopernurse

View GitHub Profile
#
# node.js project fabfile
#
# dependencies:
# fabric (apt-get install fabric)
# node-jslint (http://github.com/reid/node-jslint)
# expresso (or replace with whatever node.js test tool you're using)
#
from fabric.api import local
@coopernurse
coopernurse / gist:867730
Created March 13, 2011 00:16
my .emacs from pycon
(require 'compile)
(require 'thingatpt)
(require 'flymake)
;;
;;
(setq-default indent-tabs-mode nil)
(global-font-lock-mode 1)
;; PyFlakes for Python code
@coopernurse
coopernurse / gist:904526
Created April 5, 2011 20:53
gevent - limit example
#!/usr/bin/env python
import sys
from gevent import Greenlet
from gevent.pool import Pool
from gevent.server import StreamServer
from gevent.socket import create_connection
bind_addr = '127.0.0.1'
port = 32392
@coopernurse
coopernurse / limit.py
Created April 8, 2011 22:32
gevent concurrency test script
#!/usr/bin/env python
import sys
import gevent
from gevent import Greenlet
from gevent.pool import Pool
from gevent.server import StreamServer
from gevent.socket import create_connection
bind_addr = '127.0.0.1'
@coopernurse
coopernurse / gist:923228
Created April 16, 2011 16:05
STOMP example with group id
#!/usr/bin/env python
import sys
import time
import logging
import random
import threading
from stompy import Client
port = 61613
@coopernurse
coopernurse / gist:923763
Created April 17, 2011 04:30
two-mode-mode.el example for aspen simplates
;; two-mode-mode.el -- switches between tcl and sgml(html) modes
;; $Id: two-mode-mode.el,v 1.4 2004/11/19 17:00:12 davidw Exp $
;; Copyright 1999-2004 The Apache Software Foundation
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;; http://www.apache.org/licenses/LICENSE-2.0
# in diesel's http.py HttpServer class:
# read_body is new
def __init__(self, method, url, version, remote_addr=None, read_body=True):
self.read_body = read_body
def __call__(self, addr):
'''Since an instance of HttpServer is passed to the Service
class (with appropriate request_handler established during
initialization), this __call__ method is what's actually
@coopernurse
coopernurse / gist:1052546
Created June 29, 2011 00:01
swank error
;; when running: (clojure.xml/parse "http://search.twitter.com/search.atom?&q=clojure")
Debugger entered: nil
(condition-case error (slime-net-read) (error (debug) (slime-net-close process t) (error "net-read error: %S" error)))
slime-net-read-or-lose(#<process SLIME Lisp>)
slime-process-available-input(#<process SLIME Lisp>)
slime-net-filter(#<process SLIME Lisp> ", :content [{:tag :name, :attrs nil, :content [\\\"mahata (Yasunori MAHATA)\\\"]} {:tag :uri, :attrs nil, :content [\\\"http://twitter.com/mahata\\\"]}]}]}]}\n\" :repl-result)000015(:return (:ok nil) 3)")
recursive-edit()
byte-code("\306 @\307=\203!^@\310\311\312\"\210\313\311!\211A@)\242\314=\203!
debug(error (error "Connection closed."))
signal(error ("Connection closed."))
@coopernurse
coopernurse / gist:1174475
Created August 26, 2011 21:27
attempt at noir middleware that uses (binding)
(ns votenoir.requtil)
(def *request*)
(defn absolute-url
"Converts uri into a full URL based on the current request
For example, given a current request URL of:
http://example.com:9000/foo/bar
Deployed as foo.war (so /foo is the servlet context path)
Then: (absolute-url \"/baz\") returns: http://example.com:9000/foo/baz"
$>beans
#domain = Catalina:
Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,j2eeType=Servlet,name=default
Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,j2eeType=Servlet,name=jsp
Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,name=jsp,type=JspMonitor
Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/StingrayTest,j2eeType=Servlet,name=default ...