Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Anderson tomwhoiscontrary

View GitHub Profile
View Order.java
package uk.co.initech.sandbox;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
View OrderLine.java
package uk.co.initech.sandbox;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
@Entity
public class OrderLine {
View A.java
package com.stackoverflow.jaizen;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
@Entity
public class A {
@tomwhoiscontrary
tomwhoiscontrary / .hgignore
Created Mar 9, 2012
A bloated but bland .hgignore
View .hgignore
.hgignore
syntax:glob
.byecycle
.classpath
.checkstyle
.nbattrs
.nbintdb
.settings
antlib
antlog.bat
View CircularQueue.java
public class CircularQueue<T> {
private T[] queue = newArray(5);
private int front = 0;
private int rear = 0;
public void enqueue(T element) {
if (front == (rear + 1) % queue.length) {
expandCapacity();
}
View Sorter.java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class Sorter {
public static void main(String[] args) {
@SuppressWarnings("unchecked")
View dashboards.sql
create table Dashboard (
id integer not null,
name varchar(255),
primary key (id)
);
create table User (
id integer not null,
name varchar(255),
primary key (id)
@tomwhoiscontrary
tomwhoiscontrary / print_call_and_return.rb
Created Mar 4, 2013
What do you think gets printed as Exhibit F?
View print_call_and_return.rb
#! /usr/bin/ruby
def print_call_and_return(string, &block)
puts string
block.call unless !block
"return"
end
puts "=== exhibit A ==="
View top
27727 elastics 20 0 31.9g 30g 6984 S 8 47.9 14:19.24 /usr/lib/jvm/java-6-sun/bin/java -Xms30g -Xmx30g -Xss256k -Djava.awt.headless=true -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:GCPauseIntervalMill
6895 www-data 20 0 28.5g 28g 1256 R 105 45.1 4881:55 /usr/bin/python /opt/graphite/bin/carbon-cache.py start
28369 logstash 20 0 16.5g 766m 6008 S 173 1.2 104:12.72 /usr/bin/java -jar /opt/logstash-monolithic.jar agent --pluginpath /opt/logstash_plugins --config /etc/logstash/logstash.conf --log /var/log/logstash_indexer.notlog
14562 nobody 20 0 753m 53m 644 S 0 0.1 395:29.49 java -XX:+UseConcMarkSweepGC -jar /usr/lib/riemann/riemann.jar /etc/riemann/riemann.config
26906 rabbitmq 20 0 509m 56m 1000 S 45 0.1 1786:24 /usr/lib/er
@tomwhoiscontrary
tomwhoiscontrary / Recv.java
Last active Dec 25, 2015
Demonstrating my inability to write a simple receiver with Bunny's low-level API
View Recv.java
import java.io.IOException;
import java.util.concurrent.Executors;
import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.DefaultConsumer;
import com.rabbitmq.client.Envelope;
You can’t perform that action at this time.