Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am rstiller on github.
  • I am rstiller (https://keybase.io/rstiller) on keybase.
  • I have a public key ASANeG0VGS45X0HAZ245O26P2cwGhi-QN3eOtXd1la8imAo

To claim this, I am signing this object:

@rstiller
rstiller / test.js
Created September 28, 2018 07:43
javascript cartesian product using generator functions (streaming)
/*
streaming cartesian product elements uses less memory ...
*/
const generator = cartesianProductSimplified(['a', 'b'], [1, 2, 3, 4], ['x', 'y', 'z']);
/* prints
[ 'a', 1, 'x' ]
[ 'a', 1, 'y' ]
[ 'a', 1, 'z' ]
[ 'a', 2, 'x' ]
[ 'a', 2, 'y' ]
@rstiller
rstiller / output.txt
Created November 16, 2013 22:02
output from PACKER_LOG=1 packer validate ubuntu-13.10-en_US https://github.com/rstiller/packer-virtualbox/blob/master/ubuntu-13.10-en_US
2013/11/16 22:59:49 Packer Version: 0.3.11
2013/11/16 22:59:49 Packer Target OS/Arch: linux amd64
2013/11/16 22:59:49 Detected home directory from env var: /home/user
2013/11/16 22:59:49 Attempting to open config file: /home/user/.packerconfig
2013/11/16 22:59:49 File doesn't exist, but doesn't need to. Ignoring.
2013/11/16 22:59:49 Packer config: &{PluginMinPort:0 PluginMaxPort:0 Builders:map[amazon-ebs:packer-builder-amazon-ebs amazon-chroot:packer-builder-amazon-chroot amazon-instance:packer-builder-amazon-instance digitalocean:packer-builder-digitalocean openstack:packer-builder-openstack virtualbox:packer-builder-virtualbox vmware:packer-builder-vmware] Commands:map[build:packer-command-build fix:packer-command-fix inspect:packer-command-inspect validate:packer-command-validate] PostProcessors:map[vagrant:packer-post-processor-vagrant] Provisioners:map[ansible-local:packer-provisioner-ansible-local chef-solo:packer-provisioner-chef-solo file:packer-provisioner-file puppet-masterless:packer-provisioner-
@rstiller
rstiller / User.json
Created September 7, 2012 11:11
ModelToREST
{
'User': {
'meta': { // the basic information for source code generation
'package': 'mtr.model',
'extends': 'BaseObject', // an entity can extend every non-final type
},
'endpoints': {
'path': '/users/', /* exposes some endpoints relative to this path:
@rstiller
rstiller / gist:3217422
Created July 31, 2012 14:29
ByteToStringPerformanceTest
package test;
import org.junit.Test;
public class StringPerformanceTest {
@Test
public void bytesToString() throws Exception {
for (int i = 0; i < 10; i++) {
bytesToString(10000000);
@rstiller
rstiller / gist:3216398
Created July 31, 2012 11:47
StringPerformanceTest (String to bytes)
package test;
import java.nio.charset.Charset;
import org.junit.Test;
public class StringPerformanceTest {
@Test
public void stringToBytes() throws Exception {
package test;
import java.io.IOException;
import java.io.OutputStream;
public class Base64OutputStream extends OutputStream {
public static final int DEFAULT_BUFFER_SIZE = 65536;
public static final String DEFAULT_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
public static final String BASE64_URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
@rstiller
rstiller / gist:3182073
Created July 26, 2012 13:39
SecureCookie impl.
package cooky;
import java.io.ByteArrayOutputStream;
import java.util.Arrays;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
/**
@rstiller
rstiller / DBCursorReader.java
Created June 7, 2012 20:59
Simple Util Classes for Jackson. DBCursorReader makes a MongoDB DBCursor accessable as Reader e.g. for processing MongoDB Data with Jackson. MongoGenerator stores JSON objects in MongoDB Collections.
package com.github.rstiller.mongo;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.Array;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import org.bson.types.Binary;