Skip to content

Instantly share code, notes, and snippets.

View choffmeister's full-sized avatar

Christian Hoffmeister choffmeister

View GitHub Profile
package io.airfocus.common.logging
import com.fasterxml.jackson.core.JsonGenerator
import net.logstash.logback.argument.StructuredArgument
import net.logstash.logback.marker.LogstashMarker
import spray.json._
case class JsonAppendingMarker(members: (String, JsValue)*) extends LogstashMarker("JSON_MARKER") with StructuredArgument {
override def writeTo(generator: JsonGenerator): Unit = {
def recursion(current: JsValue): Unit = current match {
convert favicon.png -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 57x57 \) \
\( -clone 0 -resize 64x64 \) \
\( -clone 0 -resize 72x72 \) \
\( -clone 0 -resize 110x110 \) \
\( -clone 0 -resize 114x114 \) \
\( -clone 0 -resize 120x120 \) \
@choffmeister
choffmeister / git-count.sh
Created September 4, 2015 15:16
Git count added/deleted lines
#!/bin/bash
git diff master..HEAD --numstat | grep 'src/' | awk '{a+=$1; d+=$2} END {print a, d}'
#!/usr/bin/python
import subprocess
import os
import re
import sys
import itertools
sprint_regex = '^sprint\-(\d+)?$'
semver_regex = '^v(\d+)\.(\d+)\.(\d+)(\-(.*))?$'
#!/usr/bin/python
import subprocess
import os
import re
import sys
import time
import datetime
def log_info(msg):
path("test") {
extract(ctx => ctx.request.entity.dataBytes) { body =>
complete {
val processing = body
.map { chunk =>
//println(s"Received ${chunk.length} bytes")
chunk
}
.map { chunk =>
// simulate slow processing speed
@choffmeister
choffmeister / mock-router.js
Last active October 25, 2015 10:16
A simple mock router implementation
// The MIT License (MIT)
// Copyright (c) 2015 Christian Hoffmeister
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
Bluebird.prototype.flatThen = function (promise, transform) {
return new Bluebird(function (resolve, reject) {
promise
.then(function (value1) {
transform(value1)
.then(function (value2) {
resolve(value2);
})
.catch(function (err2) {
reject(err2);
var argv = require('yargs').argv,
bower = require('main-bower-files'),
coffee = require('gulp-coffee'),
concat = require('gulp-concat'),
connect = require('connect'),
filter = require('gulp-filter'),
gif = require('gulp-if'),
gulp = require('gulp'),
gutil = require('gulp-util'),
jade = require('gulp-jade'),