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
class Hash; alias :+ :merge; end; Home,Mobile,Work,Gizmo = 1,2,3,7 | |
# **** My classes. DO NOT EDIT from here ********************************* # | |
class VSP | |
@vsptab = {} | |
def self.tab; @vsptab; end | |
attr_reader :fmt, :name, :repeat, :tmo | |
def initialize *args | |
attrib = args.pop | |
args << attrib and attrib = {} unless attrib.class == Hash | |
@pfx, @fmt, @name = 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 software is Copyright (c) 2010 | |
Michael Wild. All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions | |
are met: | |
- Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. |
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 python | |
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE | |
# Written by Nathan Hamiel (2010) | |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
from optparse import OptionParser | |
class RequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): |
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
# Object-oriented API | |
# | |
# Memory usage (iteration, object count, memory size) | |
# 100 5637 1562216 | |
# 200 5529 1491528 | |
# 300 5422 1426264 | |
# 400 5758 1587376 | |
# 500 5422 1426288 | |
# 600 5416 1440456 | |
# 700 5610 1515056 |
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 gevent | |
import gevent.pool | |
class GroupWithExceptionCatching(gevent.pool.Group): | |
def __init__(self, *args): | |
super(GroupWithExceptionCatching, self).__init__(*args) | |
self._error_handlers = {} | |
def _wrap_errors(self, func): | |
"""Wrap a callable for triggering error handlers |
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
;; Objective | |
;; 1. Learn Clojure by doing Clojure | |
;; | |
;; Pre-requisites | |
;; You need to have a running Clojure REPL | |
;; see: http://clojure.org/getting_started | |
; Hello World in Clojure | |
(println "Hello World") |
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
license: gpl-3.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
# First install tmux | |
brew install tmux | |
# For mouse support (for switching panes and windows) | |
# Only needed if you are using Terminal.app (iTerm has mouse support) | |
Install http://www.culater.net/software/SIMBL/SIMBL.php | |
Then install https://bitheap.org/mouseterm/ | |
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ |
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
from collections import defaultdict | |
class BadMatch(NameError): | |
"""Exception when your args don't match a pattern""" | |
pass | |
class Any(object): | |
""" | |
>>> 'wutup' == Any() | |
True |
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 os | |
import sys | |
import traceback | |
from functools import wraps | |
from multiprocessing import Process, Queue | |
def processify(func): | |
'''Decorator to run a function as a process. | |
Be sure that every argument and the return value |
OlderNewer