Skip to content

Instantly share code, notes, and snippets.

View zopyx's full-sized avatar

Andreas Jung zopyx

View GitHub Profile
Stacktrace (aktuellster Aufruf als letztes):
File "zc/lockfile/__init__.py", line 84, in __init__
_lock_file(fp)
File "zc/lockfile/__init__.py", line 59, in _lock_file
raise LockError("Couldn't lock %r" % file.name)
mac=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
echo $mac
sudo ifconfig en0 ether $mac
@zopyx
zopyx / gist:95168f75d91d7b2e469c
Last active August 29, 2015 14:02
pyfilesystem and webdav
(Pdb) DAVFS('http://localhost:6080/exist/webdav/db/output//de/onkopedia/leitlinien/gastrointestinale-stromatumore-gist/current/', dict(username='admin', password='xx'))
<DAVFS: http://localhost:6080/exist/webdav/db/output//de/onkopedia/leitlinien/gastrointestinale-stromatumore-gist/current/>
(Pdb) DAVFS('http://localhost:6080/exist/webdav/db/output//de/onkopedia/leitlinien/gastrointestinale-stromatumore-gist/current/', dict(username='admin', password='xx')).listdir()
[u'metadata.json', u'styles.css', u'index-styles-inline.html', u'index_original_html.bin', u'gastrointestinale-stromatumore-gist.pdf', u'index.html']
(Pdb) DAVFS('http://localhost:6080/exist/webdav/db/output//de/onkopedia/leitlinien/gastrointestinale-stromatumore-gist/current/', dict(username='admin', password='xx')).open('index.html', 'wb')
*** ResourceNotFoundError: Resource not found: index.html
@zopyx
zopyx / gist:30de75cf3ae46110653e
Last active August 29, 2015 14:03
prefix matching lexicon
>>> lexicon = app.eteaching.portal_catalog.plone_lexicon
>>> words = lexicon.words()
>>> result = [w for w in words if w.startswith('foerd')]
>>> print result
['foerderbedingungen', 'foerderinstitutionen', 'foerdern', 'foerderpgm', 'foerderphasen', 'foerderprogramm', 'foerderprogramme', 'foerderprogrammen', 'foerderprojekte', 'foerderung', 'foerderung_uebersicht', 'foerderungen', 'foerderungsprogramm', 'foerderverein']
#
rom pyPdf import PdfFileWriter
from pyPdf import PdfFileReader
from reportlab.pdfgen import canvas
from cStringIO import StringIO
def stamp_pdf(in_pdfname, image_name):
pdf_in = PdfFileReader(file(in_pdfname, "rb"))
def context_property(name):
def getter(self):
return getattr(self.context, name)
def setter(self, value):
setattr(self.context, name, value)
def deleter(self):
delattr(self.context, name)
return property(getter, setter, deleter)
certificate_vocabulary = SimpleVocabulary([
xquery version "3.0";
module namespace services = "http://my/services";
import module namespace transform = "http://exist-db.org/xquery/transform";
declare namespace rest = "http://exquery.org/ns/restxq";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare
%rest:GET
Sie sind hier: Startseite
Es ist leider ein Fehler aufgetreten…
Dies ist die vollständige Fehlermeldung:
Zeige Fehlerbericht als Text
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
@zopyx
zopyx / gist:2fb8fc905db542807fe1
Created September 19, 2014 08:04
CORRECT copying of all fields from one Dexterity content object to another instance of the same type
def clone_plone_metadata(source, target):
""" Copy all metadata key-value pairs of the 'source'
Dexterity content-object to 'target'.
"""
from plone.dexterity.interfaces import IDexterityFTI
from plone.behavior.interfaces import IBehaviorAssignable
if not isinstance(source, target.__class__):
raise TypeError('source and target must be the same class ({} vs {})'.format(source.__class__, target.__class__))
Traceback (most recent call last):
File "/home/ajung/.buildout/eggs/zc.buildout-2.2.1-py2.7.egg/zc/buildout/buildout.py", line 1942, in main
getattr(buildout, command)(args)
File "/home/ajung/.buildout/eggs/zc.buildout-2.2.1-py2.7.egg/zc/buildout/buildout.py", line 622, in install
installed_files = self[part]._call(recipe.install)
File "/home/ajung/.buildout/eggs/zc.buildout-2.2.1-py2.7.egg/zc/buildout/buildout.py", line 1366, in _call
return f()
File "/home/ajung/.buildout/eggs/plone.recipe.codeanalysis-1.0rc1-py2.7.egg/plone/recipe/codeanalysis/__init__.py", line 120, in install
self.install_scripts()
File "/home/ajung/.buildout/eggs/plone.recipe.codeanalysis-1.0rc1-py2.7.egg/plone/recipe/codeanalysis/__init__.py", line 205, in install_scripts