Skip to content

Instantly share code, notes, and snippets.

View andreisavu's full-sized avatar
👨‍💻

Andrei Savu andreisavu

👨‍💻
View GitHub Profile
@rantav
rantav / read.md
Created September 12, 2012 07:40
Using newrelic with maven, Java

When using newrelic in java, it isn't obvious how to mavenize things. Newrelic has two java jars: newrelic.jar and newrelic-api.jar. There's also another newrelic.yaml of course. For development you need the api.jar in your classpath. In production you want the api jar in the classpath, but also newrelic.jar as an agent. Newrelic have a good explanation about how to set up newrelic.jar as an agent but they don't have anything regarding how to develop and get the api jar in place using maven, so here goes...

Add the repository:

<repositories>
  <repository>
    <id>newrelic</id>

newrelic

@chids
chids / dropwizard-json-round-trip-test.java
Created May 22, 2012 14:20
Dropwizard representation round trip test (instance -> json -> instance)
public static <T> void jsonRoundTripTest(final T instance) throws Exception {
final String clazz = instance.getClass().getName();
final String fixtureName = instance.getClass().getSimpleName().toLowerCase();
final String fixture = jsonFixture("fixtures/" + fixtureName + ".json");
assertThat(clazz + " bad json,",
asJson(instance),
is(fixture));
T deserialized;
try {
deserialized = fromJson(fixture, (Class<T>)instance.getClass());
@tankchintan
tankchintan / gist:1335220
Last active November 30, 2019 00:17
Procedure for installing and setting Sun JDK Java on Default Amazon Linux AMI
# First verify the version of Java being used is not SunJSK.
java -version
# Get the latest Sun Java SDK from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
wget http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpm
# Rename the file downloaded, just to be nice
mv jdk-7u1-linux-i586.rpm\?e\=1320265424\&h\=916f87354faed15fe652d9f76d64c844 jdk-7u1-linux-i586.rpm
# Install Java
@ericmoritz
ericmoritz / counter.py
Created March 22, 2011 21:04
A counter stored in Riak that handles conflict resolutions on read
import logging
import riak
log = logging.getLogger(__name__)
class RiakCounter(object):
def __init__(self, bucket, key):
self.bucket = bucket
self.bucket.set_allow_multiples(True)
self.key = key