Skip to content

Instantly share code, notes, and snippets.

View jklemmack's full-sized avatar

Johann Klemmack jklemmack

View GitHub Profile
<Query Kind="Program">
<NuGetReference>MedallionShell</NuGetReference>
<Namespace>System.Threading.Tasks</Namespace>
<Namespace>Medallion.Shell</Namespace>
<Namespace>Medallion.Shell.Streams</Namespace>
</Query>
DumpContainer dc;
async Task Main()
{ var input = @"D:\Temp\fieldtest.mxf".Dump("input file");
@jklemmack
jklemmack / gist:77d966e250502f6b4b8bf253ca6a097a
Last active June 28, 2017 00:36 — forked from witwall/gist:5334142
Here’s the code to replace images in PDFs, in Java and C#. It will replace the first image in the first page.
PdfReader pdf = new PdfReader("in.pdf");
PdfStamper stp = new PdfStamper(pdf, new FileOutputStream("c:\\out.pdf"));
PdfWriter writer = stp.getWriter();
Image img = Image.getInstance("image.png");
PdfDictionary pg = pdf.getPageN(1);
PdfDictionary res =
(PdfDictionary)PdfReader.getPdfObject(pg.get(PdfName.RESOURCES));
PdfDictionary xobj =
(PdfDictionary)PdfReader.getPdfObject(res.get(PdfName.XOBJECT));
if (xobj != null) {
@jklemmack
jklemmack / gist:09957fb0e05cf13181cd
Last active September 11, 2015 16:52 — forked from migajek/gist:dede8e9184a087e19bd9
Angular + ServiceStack's SSE
factory('sse', ['$rootScope', '$http', function($rootScope, $http) {
// https://gist.github.com/migajek
var splitOnFirst = function (s, c) { if (!s) return [s]; var pos = s.indexOf(c); return pos >= 0 ? [s.substring(0, pos), s.substring(pos + 1)] : [s]; };
return {
start: function(handlers) {
var opt = {};
var sse = new EventSource('/event-stream');
sse.addEventListener('message', function(e) {
var parts = splitOnFirst(e.data, ' ');
var selector = parts[0];
@jklemmack
jklemmack / index.html
Last active September 10, 2015 19:16 — forked from insin/index.html
Export a <table> to Excel - http://bl.ocks.org/insin/1031969
<!DOCTYPE html>
<html>
<head>
<title>tableToExcel Demo</title>
<script src="tableToExcel.js"></script>
</head>
<body>
<h1>tableToExcel Demo</h1>
<p>Exporting the W3C Example Table</p>

This choropleth uses a threshold scale for quantization, mapping arbitrary slices of a continuous domain to discrete values in the range. Unemployment rates ranging from 2 to 10% are quantized into different shades of purple.

var color = d3.scale.threshold()
    .domain([.02, .04, .06, .08, .10])
    .range(["#f2f0f7", "#dadaeb", "#bcbddc", "#9e9ac8", "#756bb1", "#54278f"]);