Skip to content

Instantly share code, notes, and snippets.

Marcus Ilgner milgner

View GitHub Profile
@milgner
milgner / index.html.j2
Last active Feb 20, 2020
Auto-generate Podlove Web Player from MP3 folder
View index.html.j2
<html>
<body>
<script src="https://cdn.podlove.org/web-player/embed.js"></script>
{% for episode in episodes %}
<div id="player{{ loop.index0 }}"></div>
<script>
podlovePlayer('#player{{ loop.index0 }}', {
title: '{{ episode.title }}',
publicationDate: '{{ episode.publication_date }}',
poster: '{{ episode.poster_url }}',
@milgner
milgner / builder.ts
Created May 5, 2019
Auto-generated builder pattern in TypeScript
View builder.ts
class Builder<T> {
static ctor = undefined;
static propertyNames: Array<string> = undefined;
protected properties = {};
build(): T {
const builderDef = Object.getPrototypeOf(this).constructor;
const instance = new builderDef.ctor();
for (const prop of builderDef.propertyNames) {
@milgner
milgner / api.rb
Created Mar 27, 2018
Grape shared params error
View api.rb
# frozen_string_literal: true
require 'grape'
class API < Grape::API
helpers do
params :shared_params do
optional :shared1, type: String
optional :shared2, type: String
exactly_one_of :shared1, :shared2
end
@milgner
milgner / ssce_issue_23.go
Created Mar 5, 2016
Reproduces issue #23 from radix.v2
View ssce_issue_23.go
package main
import (
"github.com/mediocregopher/radix.v2/pool"
"github.com/op/go-logging"
"errors"
)
var logger = logging.MustGetLogger("issue23_ssce")
View gist:fa43c6af5b3274bf833d
### Keybase proof
I hereby claim:
* I am milgner on github.
* I am milgner (https://keybase.io/milgner) on keybase.
* I have a public key whose fingerprint is AEEE AC81 5481 C57A A2A6 C3AD E31D 682E 2F71 FB99
To claim this, I am signing this object:
@milgner
milgner / broadcom_on_fedora_20.patch
Created Jul 11, 2014
Broadcom Driver on Fedora 20
View broadcom_on_fedora_20.patch
diff -r a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
2074c2074
< cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, GFP_KERNEL);
---
> cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, &wl->conf->channel, GFP_KERNEL);
@milgner
milgner / gitlab_ssl_verify.patch
Created Apr 30, 2014
Gitlab CI: optional SSL certificate validation
View gitlab_ssl_verify.patch
--- a/app/models/network.rb
+++ b/app/models/network.rb
@@ -7,6 +7,7 @@ class Network
opts = {
body: api_opts.to_json,
headers: {"Content-Type" => "application/json"},
+ verify: verify?
}
endpoint = File.join(url, API_PREFIX, 'session.json')
@milgner
milgner / TeamCity_run_tests.bat
Created Feb 24, 2014
Script to run all test projects (which are based on Google test) in TeamCity
View TeamCity_run_tests.bat
@echo off
cd %~dp0..\build\%1\tests
call :treeProcess
goto :eof
:treeProcess
for %%e in (*.exe) do (
%%e --gtest_output=xml:%TEMP%\%%e.xml
echo ##teamcity[importData type='junit' path='%TEMP%\%%e.xml']
@milgner
milgner / ValidationResultToJunit.xsl
Created Feb 22, 2013
XSL to transform a validation result XML from the Windows Application Certification Kit into a JUnit XML which can be parsed by common Continuous Integration systems such as Jenkins. Copyright (C)2013 doo GmbH, licensed under MIT License. See https://github.com/doo/metro-driver for a tool which can install appx packages for automatic processing …
View ValidationResultToJunit.xsl
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:template match="REPORT">
<testsuites>
<xsl:apply-templates select="REQUIREMENTS/REQUIREMENT"/>
</testsuites>
</xsl:template>
@milgner
milgner / pkcs5.rb
Last active Dec 10, 2015
Basic PKCS5 support in JRuby
View pkcs5.rb
require 'java'
module OpenSSL
class PKCS5
java_import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator
java_import org.bouncycastle.crypto.digests.SHA1Digest
# it should probably support a non-bouncy-castle-digest as its 5th param, but nevermind
def self.pbkdf2_hmac(pass, salt, iter, keylen, digest)
generator = PKCS5S2ParametersGenerator.new
You can’t perform that action at this time.