Skip to content

Instantly share code, notes, and snippets.

View nutjob4life's full-sized avatar
💭
Contemplating next hair color

Sean Kelly nutjob4life

💭
Contemplating next hair color
View GitHub Profile
@nutjob4life
nutjob4life / gist:5467262
Created April 26, 2013 13:09
The buildout
[buildout]
extends = http://dist.plone.org/release/4.3-latest/versions.cfg
parts = plone
[plone]
recipe = plone.recipe.zope2instance
user = admin:admin
http-address = 8081
# environment-vars = TZ America/New_York
plone01 216 > hostname
plone01.sixfeetup.com
plone01 217 > date -u
Fri Jul 12 21:50:47 UTC 2013
plone01 218 > telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Host: plone.org
class X(object):
def __init__(self, value):
self.value = value
def __cmp__(self, other):
print 'I am %x, comparing my %d with other %x %d' % (id(self), self.value, id(other), other.value)
return cmp(self.value, other.value)
a = [X(2), X(1), X(3)]
X(1) in a
File "/Users/kelly/.buildout/eggs/z3c.relationfield-0.6.2-py2.7.egg/z3c/relationfield/event.py", line 82, in updateRelations
catalog.unindex(rel)
File "/Users/kelly/.buildout/eggs/zc.relation-1.0-py2.7.egg/zc/relation/catalog.py", line 546, in unindex
self.unindex_doc(self._relTools['dump'](rel, self, {}))
File "/Users/kelly/.buildout/eggs/zc.relation-1.0-py2.7.egg/zc/relation/catalog.py", line 556, in unindex_doc
self._remove(relToken, tokens, data['name'])
File "/Users/kelly/.buildout/eggs/zc.relation-1.0-py2.7.egg/zc/relation/catalog.py", line 621, in _remove
data = dataset[key]
KeyError: <class 'plone.directives.form.schema.Schema'>
@nutjob4life
nutjob4life / bag.py
Created November 6, 2013 21:34
Example of making an RDF "Bag" with rdflib in Python
# encoding: utf-8
import rdflib
book = rdflib.URIRef(u'urn:isbn:978-3-16-148410-0')
bookType = rdflib.URIRef(u'urn:publishing:schema:book')
authorPredicate = rdflib.URIRef(u'http://purl.org/dc/terms/creator')
joyce = rdflib.URIRef(u'urn:foaf:registered-people:joyce')
kelly = rdflib.URIRef(u'http://twitter.org/nutjob4life')
mattmann = rdflib.URIRef(u'http://people.apache.org/mattmann')
@nutjob4life
nutjob4life / sample.rdf
Created November 6, 2013 21:37
Sample RDF containing a bag
<?xml version='1.0' encoding='utf-8'?>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:dc='http://purl.org/dc/terms/'>
<rdf:Description rdf:about='urn:isbn:978-3-16-148410-0'>
<rdf:type rdf:resource='urn:publishing:schema:book'/>
<dc:creator>
<rdf:Bag>
<rdf:li rdf:resource='http://people.apache.org/mattmann'/>
<rdf:li rdf:resource='http://twitter.org/nutjob4life'/>
<rdf:li rdf:resource='urn:foaf:registered-people:joyce'/>
[versions]
Pillow = 1.7.5
Products.DocFinderTab = 1.0.5
Products.PloneHotfix20110720 = 1.2
Products.PythonField = 1.1.3
Products.TALESField = 1.1.3
Products.TemplateFields = 1.2.5
Products.Zope-Hotfix-20110622 = 1.0
collective.recipe.backup = 1.3
collective.recipe.omelette = 0.11
from setuptools import setup, find_packages
setup(
name='fancy',
version='1.0.0',
author='Mike',
author_email='[email protected]',
description='Fancy installable package',
entry_points={
'console_scripts': [
@nutjob4life
nutjob4life / gist:443f2c2d93dc334b7223
Created May 7, 2014 20:01
Last 48 lines of my ~/.emacs file
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
@nutjob4life
nutjob4life / gist:e6eb3978e07133f35fe8
Created May 27, 2014 20:12
When developing a Python package ...
[buildout]
extensions = buildout.packagename
parts = python
develop = .
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = ${buildout:package-name}