Skip to content

Instantly share code, notes, and snippets.

View mikaelhg's full-sized avatar
🏠
Working from home

Mikael Gueck mikaelhg

🏠
Working from home
View GitHub Profile
@mikaelhg
mikaelhg / FIXME.txt
Last active December 11, 2015 22:59
Fix some Camel Jetty documentation examples
http://camel.apache.org/jetty.html
incorrect:
<bean id="jetty" class="org.apache.camel.component.jetty.JettyHttpComponent">
<property name="socketConnectorProperties">
<properties>
<property name="acceptors" value="4"/>
<property name="maxIdleTime" value="300000"/>
</properties>
</property>
@mikaelhg
mikaelhg / AutocloseableDemo.java
Created February 13, 2013 08:27
AutocloseableDemo
package com.gueck.dogdash;
public class AutocloseableDemo {
private static class CreateException extends RuntimeException {}
private static class CloseException extends RuntimeException {}
private static class OperationException extends RuntimeException {}
@mikaelhg
mikaelhg / precise_sources_fi.list
Created April 11, 2013 10:46
Precise apt-get sources.list for Finnish mirrors
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://fi.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://fi.archive.ubuntu.com/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://fi.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://fi.archive.ubuntu.com/ubuntu/ precise-updates main restricted
@mikaelhg
mikaelhg / HazelTest.java
Last active December 16, 2015 14:09
Hazelcast vs. Infinispan
import com.carrotsearch.junitbenchmarks.BenchmarkOptions;
import com.carrotsearch.junitbenchmarks.BenchmarkRule;
import com.hazelcast.config.Config;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
@mikaelhg
mikaelhg / etc_apt_apt.conf.d_99fastdownload
Created April 28, 2013 19:57
Ubuntu automatic mirror configuration and fast package download for Vagrant guests
Acquire::http::Pipeline-Depth "15";
@mikaelhg
mikaelhg / gist:5747171
Created June 10, 2013 07:57
socat port forward
sudo socat TCP4-LISTEN:80,fork TCP4:localhost:9000
@mikaelhg
mikaelhg / check_clock.c
Created February 16, 2014 07:43
Run JDK check for Linux clock monotonicity manually
// gcc check_clock.c -ldl -o check_clock
// ripped from http://hg.openjdk.java.net/jdk8u/jdk8u-gate/hotspot/file/9c2ddd17626e/src/os/linux/vm/os_linux.cpp
#include <dlfcn.h>
#include <stdio.h>
#include <linux/time.h>
typedef int clockid_t;
int main(int argc, const char* argv[]) {
@mikaelhg
mikaelhg / OptionalDemo.java
Created April 25, 2014 20:34
Lambda / Optional demos
private static <T> boolean fillIf(final Supplier<T> supplier, final Consumer<T> consumer) {
return fillIf(supplier, consumer, null);
}
private static <T> boolean fillIf(final Supplier<? extends T> supplier, final Consumer<T> consumer, final Consumer<Exception> exceptionHandler) {
try {
final T data = supplier.get();
if (null == data) {
return false;
}
@mikaelhg
mikaelhg / ruby-inspect-parser.rb
Last active August 29, 2015 14:00
A Parslet parser for a random Ruby .inspect dump
#!/usr/bin/env ruby
require 'parslet'
require 'pp'
require 'awesome_print'
class InspectParser < Parslet::Parser
# TOKENS