Skip to content

Instantly share code, notes, and snippets.

View cburgmer's full-sized avatar

Christoph Burgmer cburgmer

View GitHub Profile
@cburgmer
cburgmer / index.js
Created April 16, 2021 20:30
Work around Wiremock not supporting server send events (SSE) when recording HTTP traffic. This proxy will sit between Wiremock and target and close the connection proactively from the client side.
// Proxy that will close any connection for a response with the partial payload "event: end"
// This allows us to treat server send events (SSE) as if the server would close the connection, easing integration with regular HTTP tools
const http = require("http"),
httpProxy = require("http-proxy"),
zlib = require("zlib");
const target = process.env.TARGET_BASE_URL || "http://localhost:8000",
port = process.env.PORT || 3333;
const proxy = httpProxy.createProxyServer({});
@cburgmer
cburgmer / sync_credentials.sh
Last active November 14, 2023 13:43
Sync gopass to Keypass using kpcli
#!/usr/bin/env bash
set -Eeuo pipefail
readonly gopass_prefix=""
generate_empty_store() {
local target_file="$1"
local master_password=""
{
@cburgmer
cburgmer / concourse-proxy.js
Last active May 10, 2019 18:13
Concourse CI 5 supports CC.XML. This is a proxy for unauthorised access to that new API.
#!/usr/bin/env node
// Concourse CI 5 supports CC.XML
// This small program will allow unauthorised access to the new API, while we
// figure out how to get existing monitors on to OAuth and friends.
const concourseUrl = 'http://localhost:8080';
const port = 8081;
const flyTarget = 'proxy';
const flyExecutablePath = 'fly';
@cburgmer
cburgmer / rearrange_double_sided_scan.sh
Created January 6, 2019 16:22
Scan two sided documents with a one-side only scanner
#!/bin/bash
readonly TMP_DIR="/tmp/rearrange_double_sided_scan.$$"
pages_rearranged() {
local dir="$1"
local count
count=$(( $(ls "$dir" | wc -l) / 2 ))
paste -d '\n' \
@cburgmer
cburgmer / example.js
Last active November 11, 2017 17:44
Mock Document for Google Apps Scripts, this implements a partial interface of https://developers.google.com/apps-script/reference/document/document
var doc = fakeDocument(
aParagraph('some text'),
aBookmark('my-id')
);
doc.getBody().getNumChildren();
// => 2
doc.getBody().getChild(0).getText();
// => 'some text'
@cburgmer
cburgmer / slackbot_reminder_bitbucket_pullrequests.py
Last active January 4, 2022 16:24 — forked from joemaffia/slackbot_reminder_bitbucket_pullrequests.py
Slack Bot reminder for Bitbucket pull requests
import os
import sys
import requests
import json
POST_URL = 'https://slack.com/api/chat.postMessage'
REPOSITORY_PR = 'https://{{ your corporate server }}/rest/api/1.0/projects/{{ your project }}/repos/{{ your repo }}/pull-requests?state=OPEN'
SLACK_CHANNEL = '#{{ your channel }}'
@cburgmer
cburgmer / join_junit_xml.sh
Last active August 29, 2015 14:23
How to join JUnit XML files when all you have is basic Unix commands
# For test cases wrapped with <testsuites>. For a single <testsuite> adapt accordingly.
find . -name "*.xml" -exec cat {} \; \
| sed "/<\?xml [^>]*\?>/d" | sed "/<\/*testsuites>/d" \
| (echo '<?xml version="1.0" encoding="UTF-8"?>' && echo '<testsuites>' && cat && echo '</testsuites>') \
> joined_xml
mv joined_xml joined.xml # Avoid the output being mixed up with the input
@cburgmer
cburgmer / gist:87f520a66f083a9deed8
Created January 12, 2015 21:12
CSS Critic reporter to find offending pixels
csscritic.addReporter({
reportComparison: function (comparison) {
if (imagediff.equal(comparison.pageImage, comparison.referenceImage)) {
return;
}
var d = imagediff.diff(comparison.pageImage, comparison.referenceImage, {align: 'top'}).data;
var pixelDiff = [], i;
for (i=0; i < d.length; i += 4) {
if (d[i] !== 0 || d[i+1] !== 0 || d[i+2] !== 0 || d[i+3] !== 255) {
pixelDiff.push([d[i], d[i+1], d[i+2], d[i+3]]);
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['ayepromise'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('ayepromise'));
} else {
root.ayepromise = factory(root.ayepromise);
}
}(this, function (ayepromise) {
'use strict';
@cburgmer
cburgmer / install.txt
Created July 11, 2014 20:31
Take a screenshot with selenium from node
npm install selenium-webdriver
npm install selenium-server-standalone-jar
npm install phantomjs