Skip to content

Instantly share code, notes, and snippets.


Johannes Thönes jthoenes

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jthoenes on github.
  • I am jthoenes ( on keybase.
  • I have a public key ASBIR_vSjbR9LDgTFLo0QjlYNRCeUTfOXANacPlKejf5ogo

To claim this, I am signing this object:

jthoenes /
Created Aug 20, 2018
Create list of AWS IP ranges (ec2, in Frankfurt) for OpenVPN config
curl -s | jq -r '.prefixes[] | select(.service=="EC2") | select(.region=="eu-central-1") | .ip_prefix' | xargs -I {} ipcalc -nb {} | awk 'BEGIN {RS="";FS="\n"}{print $1, $2}' | awk '{print "route", $2, $4, "vpn_gateway"}'
View report.js
'use strict';
var PdfPrinter = require('pdfmake'),
moment = require('moment-timezone'),
path = require('path'),
fs = require('fs');
function resolvePath(relative) {
jthoenes / imageStorage.js
Created Mar 13, 2014
API for image storage function of Redactor Feature Request
View imageStorage.js
var storeImageLocally = function(imageFile, callback){
// result of asynchronous call which will store the file
var result = {
localUrl: 'filesystem:http://localhost:9000/persistent/someImage.jpg',
imageId: 'generated uid'
// call the callback with html to insert into redactor
callback('<img src="'+result.localUrl+'" data-image-id="'result.imageId'">');
View Gemfile
group :test do
gem 'cucumber'
gem 'capybara'
gem 'poltergeist'
gem 'rspec'
jthoenes /
Created Aug 1, 2012
Testing the Lambda Water
import java.util.Arrays;
import java.util.List;
public class LambdaIntro {
public static interface ItemWithIndexVisitor<E> {
public void visit(E item, int index);
finally {
try {
if (resultSet != null) {
} catch (SQLException ex) {
logger.error("Error in Database", ex);
} finally {
try {
public static <l> L[] createHeapPollution(L... args) {
Object[] elements = args;
elements[0] = Arrays.asList(12, 12);
return args;
public static void main(String... args) {
List<string>[] polluted = createHeapPollution(Arrays.asList("a", "b", "c"));
// java.lang.Integer cannot be cast to java.lang.String
You can’t perform that action at this time.