Skip to content

Instantly share code, notes, and snippets.

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 / stmce.rst
Last active Jul 24, 2017
sublime multi cursor edit
View stmce.rst

Multi-Edit in SublimeText2/ Linux

Multicursor Block/ Columns Selection

  • Ctrl+Alt+[Up, Down] creates multicursor block
  • Ctrl+Alt+[Left, Right] expands as block
jensens /
Last active Mar 23, 2017
Calculate the check digit of an Austrian social insurance number; Berechnen der Prüfziffer einer österreichischen Sozialversicherungsnummer
# -*- coding: utf-8 -*-
"""Calculate the check digit of an Austrian social insurance number
Berechnen der Prüfziffer einer österreichischen Sozialversicherungsnummer
copyright Klein & Partner KG.
License: Gnu Public License 2.0
jensens /
Created Nov 3, 2016
Plone Image Proxy View
# -*- coding: utf-8 -*-
from plone import api
from plone.namedfile.interfaces import IStableImageScale
from plone.namedfile.scaling import ImageScale
from import AnnotationStorage
from Products.Five import BrowserView
from zExceptions import NotFound
from zope.interface import alsoProvides
from zope.interface import implementer
from zope.publisher.interfaces import IPublishTraverse
jensens / configure.zcml
Created Jul 22, 2016
Cleanup LRF from ordering garbage. Upgrades 2.0a3 to 2.0.1
View configure.zcml
jensens / INSTALL.rst
Last active Apr 13, 2019
sentry setup with docker-compose
View INSTALL.rst

In order to run this image do: docker-compose up -d to get all up. On first run DB initialization and initial user setup is done like so:

First start a bash in the container: docker-compose exec sentry /bin/bash. Then, inside bash, do sentry upgrade wait until it asks you for an inital user. When finished exit the bash.

When in doubt check with docker-compose ps if all went fine.

# -*- coding: utf-8 -*-
"""Setup tests for this package."""
from plone import api
from import setRoles
from import TEST_USER_ID
import unittest
jensens /
Created Apr 23, 2016
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
jensens /
Created Apr 11, 2016
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
# -*- coding: utf-8 -*-
import csv
import pprint
import memcache
import pylibmc
import random
import string
import time
CYCLES = 10000
jensens /
Last active Aug 29, 2015
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