Skip to content

Instantly share code, notes, and snippets.

View kinkerl's full-sized avatar

Dennis Schwertel kinkerl

  • germany, remote
View GitHub Profile
@kinkerl
kinkerl / gist:88f9015108185db8ddd8
Last active August 29, 2015 14:16
Django middleware to discard to long urls to prevent strange injections and errors with inferior databases
from django.http import Http404
class GracefullDiscardLongURLMiddleware:
def process_request(self, request): # pylint: disable-msg=R0201
if len(request.path) >= 255:
raise Http404
@kinkerl
kinkerl / icinga2json.py
Last active December 16, 2015 02:19
converts icinga status files (*.dat) to a json file.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import json
tobj = list()
statusfile = 'serverstatus.dat'
statusfile_output = 'serverstatus.json'
currentobj = dict()
reg = re.compile(r'^\s*$')
@kinkerl
kinkerl / download.py
Created December 27, 2012 20:00
google music backup download
#!/usr/bin/env python
# https://github.com/simon-weber/Unofficial-Google-Music-API
from gmusicapi.api import Api
from getpass import getpass
import os
import requests
def init():
@kinkerl
kinkerl / supervisord.sh
Created August 8, 2012 09:39 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@kinkerl
kinkerl / pre-commit
Created July 30, 2012 09:07 — forked from spulec/pre-commit
Yipit Pre-commit Hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@kinkerl
kinkerl / mosh.sh
Created May 9, 2012 08:51
mosh failover to regular shell, took from https://github.com/keithw/mosh/issues/232
#!/usr/bin/env bash
mosh "$@"
[ $? -eq 5 ] && ssh "$@"
@kinkerl
kinkerl / gist:1364864
Created November 14, 2011 19:26
Inject onboard in a magic panel
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import gobject
import sys
import subprocess
import time
@kinkerl
kinkerl / gist:301428
Created February 11, 2010 11:13
A simple crossplatform autostart helper
#!/usr/bin/env python
#taken from http://29a.ch/2009/3/17/autostart-autorun-with-python
#example:
#import os
#import autorun
#autorun.add("myapp", os.path.abspath(__file__))
"""A simple crossplatform autostart helper"""