Skip to content

Instantly share code, notes, and snippets.

View jensens's full-sized avatar
🕶️
Available for training, coaching and trouble-shooting (as usual)..

Jens W. Klein jensens

🕶️
Available for training, coaching and trouble-shooting (as usual)..
View GitHub Profile
@jensens
jensens / buildout.cfg
Created March 29, 2012 08:28
python buildout with lxml
[buildout]
parts = py
[py]
recipe = zc.recipe.egg
eggs = lxml
interpreter = py
@jensens
jensens / buildout.cfg
Created April 4, 2012 10:59
Minimla Plone 4.1
[buildout]
find-links +=
http://effbot.org/downloads/
parts =
instance
omelette
extends =
http://dist.plone.org/release/4.1-latest/versions.cfg
@jensens
jensens / buildout.cfg
Created April 4, 2012 13:15
Buildout which just adds setuptools to python
[buildout]
parts = py
[py]
recipe = zc.recipe.egg
eggs =
setuptools
interpreter = py
import unittest
import doctest
from pprint import pprint
from interlude import interact
from google.appengine.ext import testbed
optionflags = doctest.NORMALIZE_WHITESPACE | \
doctest.ELLIPSIS | \
doctest.REPORT_ONLY_FIRST_FAILURE
from plone.app.querystring.queryparser import getPathByUID, getNavigationRoot
def _multi_path(context, row):
values = []
for value in row.values.split():
if not '/' in value:
# It must be a UID
value = '/'.join(getPathByUID(context, value))
# take care of absolute paths without nav_root
nav_root = getNavigationRoot(context)
@jensens
jensens / plone_scroll_acab.py
Created October 18, 2013 08:51
All Colours Are Beautyful - Code to show Plone Logo at ACAB Wall https://2013.de.pycon.org/ - see video at http://www.youtube.com/watch?v=__w5u0QsV14 - more info and instructions at http://wiki.python-forum.de/PyConDe/2013/acab
from acabsl import send
from acabsl import update
import acabsl
import colorsys
import random
import time
PLONE_RGB = (0, 131, 190)
@jensens
jensens / .bash-slash-git-aware-prompt-slash-colors.sh
Created April 11, 2016 13:53
my colorful git aware prompt with abbreviations for workspace
# Regular
txtblk="$(tput setaf 0 2>/dev/null || echo '\e[0;30m')" # Black
txtred="$(tput setaf 1 2>/dev/null || echo '\e[0;31m')" # Red
txtgrn="$(tput setaf 2 2>/dev/null || echo '\e[0;32m')" # Green
txtylw="$(tput setaf 3 2>/dev/null || echo '\e[0;33m')" # Yellow
txtblu="$(tput setaf 4 2>/dev/null || echo '\e[0;34m')" # Blue
txtpur="$(tput setaf 5 2>/dev/null || echo '\e[0;35m')" # Purple
txtcyn="$(tput setaf 6 2>/dev/null || echo '\e[0;36m')" # Cyan
txtwht="$(tput setaf 7 2>/dev/null || echo '\e[0;37m')" # White
@jensens
jensens / utf8headers.sh
Created April 23, 2016 13:46
Add UTF8 headers to python files if not already in place
find . -name "*.py"|while read fn;do head -n1 "$fn"|grep -qv "^# \-\*\- coding" && sed -i "1i # -*- coding: utf-8 -*-" $fn;done
# -*- coding: utf-8 -*-
"""Setup tests for this package."""
from bda.aaf.site.testing import BDA_AAF_SITE_FUNCTIONAL_TESTING
from plone import api
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
import unittest
@jensens
jensens / configure.zcml
Created July 22, 2016 15:47
Cleanup LRF from ordering garbage. Upgrades plone.app.multilingual 2.0a3 to 2.0.1
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:zcml="http://namespaces.zope.org/zcml">
<browser:page
class=".upgradelrf.Upgrade"
for="plone.app.multilingual.content.lrf.LanguageRootFolder"
name="lp-migrate-lrf"
permission="cmf.ManagePortal"
/>