Skip to content

Instantly share code, notes, and snippets.

View witsch's full-sized avatar
💭
204 No Content

Andreas Zeidler witsch

💭
204 No Content
View GitHub Profile
@witsch
witsch / plugins.yaml
Last active March 23, 2024 17:41
start debugger pod from `k9s`
plugins:
debug:
shortCut: Shift-D
description: kubectl debug
scopes:
- pods
command: bash
background: false
args:
- -c
@witsch
witsch / rpi-busybox-httpd-stack.yaml
Created March 30, 2020 15:07
docker stack configuraion for hypriot/rpi-busybox-httpd
version: "3.7"
services:
hello:
image: hypriot/rpi-busybox-httpd
ports:
- "4000:80"
deploy:
replicas: 1
restart_policy:
@witsch
witsch / homebrew-migration.sh
Created January 11, 2017 20:50
Shell script to migrate symlinks created by Homebrew (see https://github.com/caskroom/homebrew-cask/issues/21913)
#!/bin/bash
which gfind || brew install findutils
gfind ~/Applications/ ~/Library/ /usr/local/ -type l -lname '/opt/homebrew-cask/*' -printf "ln -vsf '%l' '%p'\n" |\
sed s,/opt/homebrew-cask/,/usr/local/, |\
bash
@witsch
witsch / ldap-posixGroup-support.patch
Last active November 29, 2016 13:55
posixGroups support for Plone/Zope's `Products.LDAPUserFolder` (2.27)
diff --git a/Products/LDAPUserFolder/LDAPUserFolder.py b/Products/LDAPUserFolder/LDAPUserFolder.py
index 8402da3..60f9634 100644
--- Products/LDAPUserFolder/LDAPUserFolder.py
+++ Products/LDAPUserFolder/LDAPUserFolder.py
@@ -19,6 +19,7 @@ $Id$
import logging
import os
import random
+import re
try:
@witsch
witsch / buildout.cfg
Last active December 19, 2019 16:45
Patch for "posixGroup" support in `Products.LDAPUserFolder` 2.26 based on http://davidjb.com/blog/2010/06/plonezope-using-ldapuserfolder-with-posixgroups/
[buildout]
...
parts =
...
patches
...
[patches]
recipe = collective.recipe.patch
@witsch
witsch / net.devpi.devpi-server.plist
Created August 17, 2013 13:28
run `devpi-server` (http://devpi.net/) using `launchd` on OSX
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.devpi.devpi-server</string>
<key>ProgramArguments</key>
<array>
@witsch
witsch / conftest.py
Created August 16, 2013 12:56
example pytest session fixture reordering the tests
from pytest import fixture, Class
@fixture(scope="session", autouse=True)
def sort_tests_by_class_name(request):
session = request.node
key = lambda item: item.getparent(Class).obj.__name__
session.items[:] = sorted(session.items, key=key)
@witsch
witsch / metafoo.py
Last active December 18, 2015 01:49
metaclass prototype for collecting https://github.com/tomster/ezjail steps & stages
from operator import attrgetter
def counter():
count = 0
while True:
yield count
count += 1
@witsch
witsch / render.py
Created May 25, 2012 08:19
lookup and render a given path from inside a view etc
from tribaspace.router import Router
path = '/foo/bar'
newreq = Request.blank(path=path, base_url=request.application_url)
newreq.registry = registry
markup = Router(registry).handle_request(newreq)
print markup.body
@witsch
witsch / waitfor.py
Created May 9, 2012 10:41
helper script to wait until some process is listening to a given TCP port
#!/usr/bin/python
from socket import socket, gethostbyname, AF_INET, SOCK_STREAM
from sys import argv, exit
from time import sleep
def waitfor(*ports, **kw):
timeout = kw.get('timeout', 30)
host = kw.get('host', 'localhost')