View gist:404331
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
public NodeService get() { | |
PyObject no = nodeServiceImplMongoClass.__call__(this.authService); | |
NodeService ns; | |
ns = (NodeService)no.__tojava__(NodeService.class); | |
return ns; | |
} |
View gist:417776
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
$ ./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 |
View gist:423534
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
--- 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" |
View py-bcrypt-setuptools.diff
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
--- 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" |
View gist:452168
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 _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 |
View gist:489130
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
"""MongoDB UserStore implementation""" | |
try: | |
import cPickle as pickle | |
except ImportError: | |
import pickle | |
import pymongo | |
from pymongo import Connection | |
from pymongo.errors import ConnectionFailure |
View escape_low_xml.py
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
_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 |
View gist:754896
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
niallo@aztarac:~$ cat /etc/udev/rules.d/70-android.rules | |
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", SYMLINK+="android_adb", MODE="0666", OWNER="niallo", GROUP="niallo" |
View subget.py
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 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 |
View ctypes-test.py
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 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): |
OlderNewer