Skip to content

Instantly share code, notes, and snippets.

View jthoenes's full-sized avatar
👣

Johannes Thönes jthoenes

👣
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jthoenes on github.
  • I am jthoenes (https://keybase.io/jthoenes) on keybase.
  • I have a public key ASBIR_vSjbR9LDgTFLo0QjlYNRCeUTfOXANacPlKejf5ogo

To claim this, I am signing this object:

@jthoenes
jthoenes / command.sh
Created August 20, 2018 11:59
Create list of AWS IP ranges (ec2, in Frankfurt) for OpenVPN config
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | 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"}'
@jthoenes
jthoenes / report.js
Last active August 29, 2015 14:21 — forked from renatoargh/report.js
// http://www.highcharts.com/docs/export-module/render-charts-serverside
'use strict';
var PdfPrinter = require('pdfmake'),
printer,
moment = require('moment-timezone'),
path = require('path'),
fs = require('fs');
function resolvePath(relative) {
@jthoenes
jthoenes / imageStorage.js
Created March 13, 2014 09:18
API for image storage function of Redactor Feature Request
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'">');
}
@jthoenes
jthoenes / Gemfile
Created September 2, 2012 15:16
Code for Testing Google Analytics Custom Events with Capybara and Poltergeist: http://blog.jthoenes.net/2012/09/02/testing-google-analytics-custom-events-with-capybara-and-poltergeist/
group :test do
gem 'cucumber'
gem 'capybara'
gem 'poltergeist'
gem 'rspec'
end
@jthoenes
jthoenes / LambdaIntro.java
Created August 1, 2012 10:32
Testing the Lambda Water
package net.jthoenes.blog.spike.lambda;
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) {
resultSet.close();
}
} 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