Skip to content

Instantly share code, notes, and snippets.

@craigleonard
craigleonard / gist:205ba0986933a47e9902
Created February 16, 2015 13:40
Embedded Jetty hosting a Jetty 2 Application
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
public class Main {
@craigleonard
craigleonard / Client.java
Created November 1, 2017 17:39
Cassandra Leadership Election
package com.github.craigleonard.leadershipelection;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.Session;
import java.net.InetSocketAddress;
public class Client {
package oauth;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
class CodeFlags {
public static final int FLAG_INCLUDE_VERSIONS = 0x1;
public static final int FLAG_INCLUDE_FILES = 0x2;
public static final int FLAG_INCLUDE_CATEGORY_AND_TAGS = 0x4;
public static final int FLAG_INCLUDE_SHARED_ACCOUNTS = 0x8;