Skip to content

Instantly share code, notes, and snippets.

View mark-kubacki's full-sized avatar
🎏

Mark Kubacki mark-kubacki

🎏
  • Germany, European Union
View GitHub Profile
## Syntax highlighting of HTML with mixed-ins, for the editor Nano.
##
syntax "html" "\.(html|mak)$"
magic "HTML document text"
color brightblue start="<" end=">"
color red "&[^;[[:space:]]]*;"
# AngularJS and similar
color brightwhite start="\{\{" end="\}\}"
color green "ng-[^>\"\ \=]*"
color green start="ng-[^>\"\ \=]*\=\"" end="\""
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/iconsets/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
@mark-kubacki
mark-kubacki / fields.go
Last active August 29, 2015 14:05
how to accept incoming email utilizing services of Mailgun
func BindHexEncodedField(field *[]byte) func(string, []string, binding.Errors) binding.Errors {
return func(fieldName string, formVals []string, errs binding.Errors) binding.Errors {
var err error
*field, err = hex.DecodeString(formVals[0])
if err != nil {
errs.Add([]string{fieldName}, binding.DeserializationError, err.Error())
}
return errs
}
}
@mark-kubacki
mark-kubacki / mailing.py
Created September 20, 2011 15:47
Modul zum Versenden von Emails
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.header import Header
from email.Utils import COMMASPACE, formatdate
from email import Encoders
try:
import turbomail
@mark-kubacki
mark-kubacki / fakemail.py
Created September 20, 2011 15:52
Dummy Email Server (genauer MTA)
#!/usr/bin/env python
#
# fakemail (Python version)
#
# $Id: fakemail.py,v 1.4 2011/06/09 16:57:10 ashtong Exp $
import asyncore
import getopt
import os
@mark-kubacki
mark-kubacki / limited_csv_fun.py
Created September 20, 2011 16:05
Beispiel: CSV Dateien einlesen
import csv
__all__ = ['read_csv_file']
def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs):
csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs)
for row in csv_reader:
yield [unicode(cell, 'utf-8', errors='ignore') for cell in row]
def read_csv_file(filename):
@mark-kubacki
mark-kubacki / gist:1379050
Created November 19, 2011 16:57 — forked from j2labs/gist:1042778
JSON speed test with many implementations
#!/usr/bin/env python
# The output geneally looks like this:
#
# $ ./serialization.py
# Dumping:
# json: 6.40960884094
# simplejson: 6.82945179939
# cjson: 2.23045802116
# ujson: 0.806604146957
@mark-kubacki
mark-kubacki / backup.sh
Last active July 4, 2016 20:28
naive multi-processing backup script in BASH
#!/bin/bash
#
# Backup script that tries to utilize all available disc spindles and cores.
# For every target archive ("sink") create a file "sink.list"
# which contains what to backup ("sources") linewise.
# (Prefer plzip to xz if you have the former at hand.)
#
# wrapper to: tar sort xargs xz
#
# run: ./backup.sh run *.list
@mark-kubacki
mark-kubacki / newrelic-sysmond.service
Created July 5, 2016 21:58
Newrelic Sysmond unit file for systemd and Docker. Works with CoreOS and --storage-driver "overlay2" and "overlay".
[Unit]
Description=newrelic-sysmond
After=docker.service
[Service]
ProtectHome=true
ProtectSystem=full
PIDFile=/run/newrelic-sysmond.pid
ExecStartPre=-/bin/bash -c "[[ -x /opt/sbin/nrsysmond ]] || (mkdir -p /opt/sbin; docker pull newrelic/nrsysmond:latest && rsync -au $(docker inspect newrelic/nrsysmond:latest | jq -r '.[0].GraphDriver.Data.UpperDir // .[0].GraphDriver.Data.RootDir')/usr/sbin/nrsysmond /opt/sbin/)"