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 / 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 / bootstrap.py
Last active August 29, 2015 13:56
Jensens Plone Minimal buildout
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
@jensens
jensens / configure.zcml
Created May 7, 2014 12:54
disable set login time every time a a user logs in
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:monkey="http://namespaces.plone.org/monkey">
<include package="collective.monkeypatcher" file="meta.zcml" />
<monkey:patch
description="Patch setLoginTimes to disable that feature."
class="Products.PlonePAS.tools.membership.MembershipTool"
original="setLoginTimes"
replacement=".patches.setLoginTimes"
@jensens
jensens / howto
Created December 15, 2014 17:33
avoid setuptools 8 in a buildout
1) use bootstrap.py from http://downloads.buildout.org/2/bootstrap.py
2) edit buildout.cfg and pin versions to:
[versions]
setuptools = 7.0
zc.buildout = 2.2.5
3) create a virtualenv as usal:
@jensens
jensens / toggle_touchpad.sh
Last active February 7, 2017 11:49
Linux Script to Toggle Thinkpad Touchpad on/off
#!/bin/bash
# together with i3wm i bound this script to the blue thinkvantage button
# using:
# bindsym XF86Launch1 exec /usr/local/bin/toggle_touchpad.sh
# extract device id
DEVICE=`xinput --list|sed -n 's/.*SynPS\/2 Synaptics TouchPad.*id=\([0-9]*\).*/\1/p'`
# check its state
@jensens
jensens / config
Created February 10, 2015 19:19
.i3/config
# jensens i3wm config
set $mainscreen LVDS1
set $sidescreen VGA1
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
@jensens
jensens / example-1-after.xml
Created March 6, 2015 21:33
xml_pp formatting examples
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:security="http://namespaces.zope.org/security"
xmlns:zmi="http://namespaces.zope.org/zmi">
<!-- Standard configuration directives -->
<include
file="configuration-meta.zcml"
package=".Configuration"
/>
@jensens
jensens / xmlppformat.py
Last active August 29, 2015 14:16
Sublime 3 xml_pp (xmltwig) based xml auto formatter.
"""
Sublime 3 xml_pp (xmltwig) based xml auto formatter.
Setup in Sublime:
- sudo apt-get install xml-twig-tools
- in Sublime go to menu: Tools -> New Plugin...
- paste this file into the editor.
- save: use the preset location (~/.config/sublime-text-3/Packages/User)
and name it exactly "xmlppformat.py".
- in Sublime go to menu: Preferences -> Key Bindings - User
- add an keybinding i.e.:
@jensens
jensens / make_labels.py
Last active February 21, 2024 17:00
Create a bunch of same labels for each repo of an organization
# -*- coding: utf-8 -*-
"""
This script creates specific labels for all repositories of an organization.
before using it do a ``pip install PyGithub``.
"""
from github import Github
import argparse
# -*- coding: utf-8 -*-
import csv
import pprint
import memcache
import pylibmc
import random
import string
import time
CYCLES = 10000