Skip to content

Instantly share code, notes, and snippets.

@codefromthecrypt
codefromthecrypt / gist:3924666
Created October 20, 2012 20:24
Issue 1110: TagApi syntax for EC2
http://code.google.com/p/jclouds/issues/detail?id=1110
In both setting and getting tags, the value is optional. I'd suggest mapping the following syntax:
void apply(Map<String, Optional<String>> tags, Iterable<String> resourceIds)
http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateTags.html
FluentIterable<Tag> list();
FluentIterable<Tag> filter(Multimap<String, String> filter);
@codefromthecrypt
codefromthecrypt / gist:4366867
Created December 24, 2012 00:24
level 1 uri parser
/**
*
* @param template
* URI string that can be in level 1 <a href="http://tools.ietf.org/html/rfc6570">RFC6570</a> form.
*
* @param variables
* to the URI string
* @throws IllegalArgumentException
* if there's a problem in the input data
*/
@codefromthecrypt
codefromthecrypt / directional-dns-mappings.json
Last active December 16, 2015 15:19
regions in dns providers
{
"dynect": {
"11": ["AG", "AI", "AN", "AW", "BB", "BL", "BM", "BS", "BZ", "CA", "CR", "CU", "DM", "DO", "GD", "GL", "GP", "GT", "HN", "HT", "JM", "KN", "KY", "LC", "MF", "MQ", "MS", "MX", "NI", "PA", "PM", "PR", "SV", "TC", "TT", "US", "VC", "VG", "VI"],
"United States": ["al", "ak", "as", "az", "ar", "aa", "ae", "ap", "ca", "co", "ct", "de", "dc", "fm", "fl", "ga", "gu", "hi", "id", "il", "in", "ia", "ks", "ky", "la", "me", "mh", "md", "ma", "mi", "mn", "ms", "mo", "mt", "ne", "nv", "nh", "nj", "nm", "ny", "nc", "nd", "mp", "oh", "ok", "or", "pw", "pa", "pr", "ri", "sc", "sd", "tn", "tx", "ut", "vt", "vi", "va", "wa", "wv", "wi", "wy"],
"Canada": ["ab", "bc", "mb", "nb", "nl", "nt", "ns", "nu", "on", "pe", "qc", "sk", "yt"],
"12": ["AR", "BO", "BR", "CL", "CO", "EC", "FK", "GF", "GY", "PE", "PY", "SR", "UY", "VE"],
"13": ["AD", "AL", "AT", "AX", "BA", "BE", "BG", "BY", "CH", "CZ", "DE", "DK", "EE", "ES", "EU", "FI", "FO", "FR", "FX", "GB", "GG", "GI", "GR", "HR",
@codefromthecrypt
codefromthecrypt / gist:5556794
Last active December 17, 2015 05:19
example json rendering of a denominator ResourceRecordSet with geo profiles for amazon elbs in multiple regions. In this example, the record set is a part of an UltraDNS directional pool. https://github.com/Netflix/denominator/wiki/Geo
[{
"name": "app.denominator.io.",
"type": "CNAME",
"ttl": 300,
"rdata": [{
"cname": "app-denominator-io-1840524669.eu-west-1.elb.amazonaws.com."
}
],
"profiles": [{
"type": "geo",
@codefromthecrypt
codefromthecrypt / jclouds-getting started
Last active December 17, 2015 10:09
How to get started in jclouds: the straw-man
1. send an email to subscribe to all lists out of the following:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
2. fork the jclouds org repos of interest (these are mirrors of https://git-wip-us.apache.org/repos/asf/incubator-REPO)
- https://github.com/jclouds/jclouds
- https://github.com/jclouds/jclouds-chef
- https://github.com/jclouds/jclouds-karaf
@codefromthecrypt
codefromthecrypt / gist:7372371
Created November 8, 2013 15:12
checks to see how expensive a one-time reflective call to getDeclaredMethods is..
import com.google.caliper.Benchmark;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import java.io.Serializable;
import java.lang.reflect.Method;
/** tests the impact of checking an interface to see if it is functional. */
public class IsFunctionalInterfaceBench {
@Benchmark int notFunctional(int reps) {
package playground.caliper;
import com.google.caliper.Benchmark;
import com.google.common.base.Charsets;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Executor;
import retrofit.RestAdapter;
import retrofit.client.Client;
hello
@codefromthecrypt
codefromthecrypt / zk-destruction
Created April 24, 2015 15:43
So you think you're resilient?
# fun times with byteman http://byteman.jboss.org/documentation.html
cat << 'EOF' > chaos.btm
RULE throw ConnectionLoss on ZooKeeper.getData entry
CLASS org.apache.zookeeper.ZooKeeper
METHOD getData
AT ENTRY
IF true
DO traceln("ZK needs more problems");
@codefromthecrypt
codefromthecrypt / example zipkin trace with 3 spans
Created October 14, 2015 01:46
example zipkin trace with 3 spans
[
{
"traceId": "5e27c67030932221",
"name": "GET",
"id": "5e27c67030932221",
"annotations": [
{
"endpoint": {
"serviceName": "zipkin-web",
"ipv4": "172.17.0.86",