Skip to content

Instantly share code, notes, and snippets.

View niallo's full-sized avatar

Niall O'Higgins niallo

View GitHub Profile
public NodeService get() {
PyObject no = nodeServiceImplMongoClass.__call__(this.authService);
NodeService ns;
ns = (NodeService)no.__tojava__(NodeService.class);
return ns;
}
$ ./easy_install bcrypt
Searching for bcrypt
Reading http://pypi.python.org/simple/bcrypt/
Reading http://www.mindrot.org/py-bcrypt.html
No local packages or download links found for bcrypt
Best match: None
Traceback (most recent call last):
File "./easy_install", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "/home/niallo/qixenv/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/easy_install.py", line 1712, in main
--- py-bcrypt-0.1/setup.py 2006-05-22 04:53:27.000000000 -0700
+++ py-bcrypt-0.2/setup.py 2010-06-02 22:51:02.428704753 -0700
@@ -17,16 +17,16 @@
# $Id: setup.py,v 1.1.1.1 2006/05/22 11:53:27 djm Exp $
import sys
-from distutils.core import setup, Extension
+from setuptools import setup, Extension
-VERSION = "0.1"
--- setup.py 2006-05-22 04:53:27.000000000 -0700
+++ ../py-bcrypt-0.2/setup.py 2010-06-14 11:45:19.254713926 -0700
@@ -17,16 +17,16 @@
# $Id: setup.py,v 1.1.1.1 2006/05/22 11:53:27 djm Exp $
import sys
-from distutils.core import setup, Extension
+from setuptools import setup, Extension
-VERSION = "0.1"
def _get_image_mimetype(self, filename):
''' Use file(1) to determine the mimetype of the file '''
p = Popen(["file", "-i", filename], stdout=PIPE, stderr=PIPE)
(stdout, stderr) = p.communicate()
mime_type = stdout.split(':')[1].strip()
return mime_type
"""MongoDB UserStore implementation"""
try:
import cPickle as pickle
except ImportError:
import pickle
import pymongo
from pymongo import Connection
from pymongo.errors import ConnectionFailure
_xml_escapes = (tuple([('%c' % z, '\\u%04X' % z)
for z in range(20) if z not in (0x9, 0xA, 0xD)]))
def escape_low_xml(value):
''' Escape every ASCII character with a value less than 20 except for
certain codes allowed by XML v1.0 spec '''
for bad, good in _xml_escapes:
value = value.replace(bad, good)
return value
niallo@aztarac:~$ cat /etc/udev/rules.d/70-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", SYMLINK+="android_adb", MODE="0666", OWNER="niallo", GROUP="niallo"
def sub_get(d, key, default=0):
''' sub_get({ 'foo' : { 'bar' : 1 }}, 'foo.bar') returns 1 '''
if '.' not in key:
return d.get(key, default)
parts = key.split('.')
r = d
for p in parts:
r = r.get(p, default)
return r
@niallo
niallo / ctypes-test.py
Created May 14, 2011 21:02
ctypes circular definition work around
from ctypes import *
class NANNY_TIMER(Structure):
_fields_ = [("when", c_long),
("data", c_void_p),
("f", POINTER(NANNY_TIMER_CB))
]
# XXX is there a way around this hack for circular definition?
class NANNY_TIMED_T(Structure):