Instantly share code, notes, and snippets.

View Orderings.cs
public static IEnumerable<List<T>> AllOrderings<T>(List<T> unordered, List<T> ordered)
if (unordered.Count == 0)
yield return ordered;
foreach (var permutation in GetPermutations(unordered, unordered.Count))
View gist:3da817c58b47d324d074dfe0227d475b
// given a temp object like this:
class Temp
Temp() : idx(0), good(true)
AL_INFO << "Temp zero-argo ctor " << idx;
import java.util.Random;
* Generates a sequence of pseudo-random numbers such that they never repeat. Can handle sequence sizes up to
* length Int.MAX_VALUE. Will throw exceptions if you ask for more than that; maps the entire [0, Integer.MAX_VALUE]
* range onto itself but in a random order
* <link></link>
public class PreshingRandomSequence {
public static final int MAX_INT_PRIME = 2147483587;
* Class that allows for streaming collection of count, mean, stddev
* Allows combining multiple independent instances
* Allows _replacement_ of values in the stream (i.e. if one of the values of your data population changes
* you can replace it). Replacing values introduces some tiny error, but in testing that error is < 1e-9 even
* in extreme conditions.
public class StreamStats {
private long count = 0;
View 00_input.conf
input {
lumberjack {
# The port to listen on
port => 5043
# The paths to your ssl cert and key
ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder/logstash-forwarder.crt"
ssl_key => "/etc/pki/tls/private/logstash-forwarder/logstash-forwarder.key"
# default type, but this will already be set by logstash-forwarder anyways
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Brainfuck {
public static void main(String[] args) throws IOException {
int maxTapeSize = 10000;
View gist:9879696
public class CacheBeans {
private static final AtomicInteger cacheCounter = new AtomicInteger(0);
public EhCacheManagerFactoryBean ecmfb() {
EhCacheManagerFactoryBean ecmfb = new EhCacheManagerFactoryBean();
// cannot share the cache managers
package com.github.steveash.gist;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.TestContext;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.aspectj.AnnotationTransactionAspect;
* Test Execution Listener that resets the references to the Annotation Transaction Aspect's
package com.github.steveash.util;
import static;
import static;
import static;
import static java.lang.Math.abs;
import static java.lang.Math.max;
import java.util.Arrays;