Skip to content

Instantly share code, notes, and snippets.

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 / configure.zcml
Created Jul 22, 2016
Cleanup LRF from ordering garbage. Upgrades plone.app.multilingual 2.0a3 to 2.0.1
View configure.zcml
<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"
/>
@jensens
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.

View test_subjects_under_ctx.py
# -*- 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 / utf8headers.sh
Created Apr 23, 2016
Add UTF8 headers to python files if not already in place
View utf8headers.sh
find . -name "*.py"|while read fn;do head -n1 "$fn"|grep -qv "^# \-\*\- coding" && sed -i "1i # -*- coding: utf-8 -*-" $fn;done
@jensens
jensens / .bash-slash-git-aware-prompt-slash-colors.sh
Created Apr 11, 2016
my colorful git aware prompt with abbreviations for workspace
View .bash-slash-git-aware-prompt-slash-colors.sh
# 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
View bench-mc.py
# -*- coding: utf-8 -*-
import csv
import pprint
import memcache
import pylibmc
import random
import string
import time
CYCLES = 10000
@jensens
jensens / make_labels.py
Last active Aug 29, 2015
Create a bunch of same labels for each repo of an organization
View make_labels.py
# -*- 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
@jensens
jensens / xmlppformat.py
Last active Aug 29, 2015
Sublime 3 xml_pp (xmltwig) based xml auto formatter.
View xmlppformat.py
"""
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 / example-1-after.xml
Created Mar 6, 2015
xml_pp formatting examples
View example-1-after.xml
<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"
/>
View 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
You can’t perform that action at this time.