Skip to content

Instantly share code, notes, and snippets.

View irskep's full-sized avatar
💭
~emo song lyrics~

Steve Landey irskep

💭
~emo song lyrics~
View GitHub Profile
@irskep
irskep / Camel Case Class Fixer.py
Created November 21, 2010 06:13
Add snake_case version of camelCase methods to classes
import re
camel_re = re.compile(r'([a-z]+[A-Z])+[a-z]+')
def fix_camel_case(camel_class):
for camel_attr in dir(camel_class):
if camel_re.match(camel_attr):
snake_attr = ''.join(char if char.islower() or char.isdigit() else "_%s" % char.lower()
for char in camel_attr)
setattr(camel_class, snake_attr, getattr(camel_class, camel_attr))
@irskep
irskep / string_list_cmp.py
Created November 24, 2010 02:02
Comparator for sorting a list of lists of strings
import itertools
x = [['a', 'bcd'], ['ab', 'c']]
def cmp(a, b):
iter1 = itertools.chain(*a)
iter2 = itertools.chain(*b)
for ca, cb in itertools.izip(iter1, iter2):
if ca < cb:
return -1
elif ca > cb:
@irskep
irskep / multidim_arr.py
Created November 24, 2010 02:42
Multidimensional arrays in Python: missing since before you were born
def multidim_arr(*dims):
return [multidim_arr(*dims[1:]) for i in xrange(dims[0])] if dims else 0
==> Cloning git://github.com/stevedekorte/io.git
Updating /Users/stephen/Library/Caches/Homebrew/io--git
==> cmake .. -DCMAKE_INSTALL_PREFIX='/usr/local/Cellar/io/HEAD' -DCMAKE_BUILD_TY
==> make install
Scanning dependencies of target copy_basekit_headers
[ 0%] Copying files: /tmp/homebrew-io-HEAD-9qHX//tmp/homebrew-io-HEAD-9qHX/libs/basekit/source/*.h to /tmp/homebrew-io-HEAD-9qHX/io-build/_build/headers
[ 0%] Built target copy_basekit_headers
Scanning dependencies of target copy_coroutine_headers
[ 0%] Copying files: /tmp/homebrew-io-HEAD-9qHX//tmp/homebrew-io-HEAD-9qHX/libs/coroutine/source/*.h to /tmp/homebrew-io-HEAD-9qHX/io-build/_build/headers
[ 1%] Built target copy_coroutine_headers
Warning: It appears you have MacPorts or Fink installed.
Software installed with MacPorts and Fink are known to cause problems.
If you experience issues try uninstalling these tools.
/usr/local/git/bin/git
==> Cloning git://github.com/stevedekorte/io.git
Updating /Users/stephen/Library/Caches/Homebrew/io--git
==> cmake .. -DCMAKE_INSTALL_PREFIX='/usr/local/Cellar/io/HEAD' -DCMAKE_BUILD_TY
==> make install
Scanning dependencies of target copy_basekit_headers
[ 0%] Copying files: /tmp/homebrew-io-HEAD-tEoL//tmp/homebrew-io-HEAD-tEoL/libs/basekit/source/*.h to /tmp/homebrew-io-HEAD-tEoL/io-build/_build/headers
...
darwin.link.dll bin.v2/libs/python/build/darwin-4.2.1/release/threading-multi/libboost_python-mt.dylib
ld: warning: in /Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib, missing required architecture x86_64 in file
Undefined symbols:
"_PyErr_Occurred", referenced from:
boost::python::detail::list_base::insert(boost::python::api::object const&, boost::python::api::object const&)in list.o
boost::python::detail::str_base::startswith(boost::python::api::object const&, boost::python::api::object const&, boost::python::api::object const&) constin str.o
boost::python::detail::str_base::startswith(boost::python::api::object const&, boost::python::api::object const&) constin str.o
boost::python::detail::str_base::rfind(boost::python::api::object const&, boost::python::api::object const&) constin str.o
boost::python::detail::str_base::find(boost::python::api::object const&, boost::python::api::object const&) constin str.o
@irskep
irskep / Hacker Trading Cards
Created January 23, 2011 05:48
Made in preparation for the spring 2011 CWRU career fair
Name
Type
Description
Beard Bonus
Paul Buchheit
More Than Just The Gmail Guy
Paul's a CWRU grad. We put him on here to try to get him to give a talk or interview at the CWRU Hacker Society. So, Paul, if you see this please email sj@case.edu!
John McCarthy
@irskep
irskep / gist:1169080
Created August 24, 2011 20:13 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job: Student, Python developer at Yelp, iPad freelancer
Favorite Python project: pyglet game programming library
Favorite Conference: PyOhio
Python Experience Level: 5 years and 100k+ lines
@irskep
irskep / interfaces.py
Created September 11, 2011 07:14
Interfaces for Python 3
"""A simple demonstration of class decorators.
Consider this example:
class Printer(object):
def print(self, string:str) -> types.NoneType:
pass
Printer.print() takes one string argument and returns None.
@irskep
irskep / build_ios.sh
Created November 8, 2011 20:20
graphviz configure errors.txt
#!/bin/sh
echo export SDKROOT='"'${SDKROOT}'"'
echo export IPHONEOS_DEPLOYMENT_TARGET='"'${IPHONEOS_DEPLOYMENT_TARGET}'"'
echo export NATIVE_ARCH='"'${NATIVE_ARCH}'"'
echo export NATIVE_ARCH_ACTUAL='"'${NATIVE_ARCH_ACTUAL}'"'
echo export PLATFORM_DEVELOPER_BIN_DIR='"'${PLATFORM_DEVELOPER_BIN_DIR}'"'
echo export OPT='"'${OPT}'"'
echo export SRCROOT='"'${SRCROOT}'"'