Skip to content

Instantly share code, notes, and snippets.

Ross Lawley rozza

Block or report user

Report or block rozza

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rozza
rozza / JavadocFilter.java
Created Mar 7, 2019 — forked from benjchristensen/JavadocFilter.java
Doclet for filtering public classes from Javadoc
View JavadocFilter.java
import java.lang.reflect.Array;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
import com.sun.javadoc.Doc;
import com.sun.javadoc.DocErrorReporter;
View MongoClientSettingsSpec.groovy
MongoClientSettings expected = MongoClientSettings.builder()
.applyToClusterSettings(new Block<ClusterSettings.Builder>() {
@Override
void apply(final ClusterSettings.Builder builder) {
builder.hosts([new ServerAddress('host1', 1), new ServerAddress('host2', 2)])
.mode(ClusterConnectionMode.MULTIPLE)
.requiredReplicaSetName('test')
.serverSelectionTimeout(25000, TimeUnit.MILLISECONDS)
.maxWaitQueueSize(10 * 7) // maxPoolSize * waitQueueMultiple
.localThreshold(30, TimeUnit.MILLISECONDS)
@rozza
rozza / DocumentToBinary.java
Created Sep 22, 2015
Example of static helpers to convert to and from InputStreams
View DocumentToBinary.java
package example;
import org.bson.BsonBinaryReader;
import org.bson.BsonBinaryWriter;
import org.bson.Document;
import org.bson.codecs.Codec;
import org.bson.codecs.DecoderContext;
import org.bson.codecs.DocumentCodec;
import org.bson.codecs.EncoderContext;
import org.bson.io.BasicOutputBuffer;
@rozza
rozza / SomeAbstractClass.java
Created Jul 11, 2014
Abstract class with a static member that can't be called
View SomeAbstractClass.java
package org.example;
public abstract class SomeAbstractClass {
SomeAbstractClass(){}
/**
* The name of the SomeAbstractClass instance.
*
* @return the name
View gist:7e3285cfd8bf5340408d
# First add a rule for all local traffic to port 80 to go into pipe 1
# 100 is the rule number which will be used for referencing the rule later
sudo ipfw add 100 pipe 1 ip from 127.0.0.1 to 127.0.0.1 dst-port http
# To display the rule use
# sudo ipfw show 100
# configure the settings of the pipe as you please
# 50kbit/s bandwidth
sudo ipfw pipe 1 config bw 50Kbit
# 200ms lag
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

View scala.breakpoint.scala
import scala.tools.nsc.interpreter._
import scala.tools.nsc.Settings
//USAGE EXAMPLE: import break._;break[someClass]("MainObject" -> MainObject)
object break{
def echo(x: Any) = Console.println(x)
def break[T: Manifest](args: NamedParam*) = {
View transcript
scala> class Bippy(xs: List[Int]) extends improving.TypesafeProxy(xs) { def isEmpty = true }
defined class Bippy
scala> val bippy = new Bippy(1 to 10 toList)
bippy: Bippy = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
scala> bippy.slice(3, 7)
[proxy] $line4.$read.$iw.$iw.bippy.slice(3, 7)
res1: List[Int] = List(4, 5, 6, 7)
View Json.scala
import util.parsing.json.JSON
import io.Source
import scala.language.dynamics
object Example extends App{
val json = """{
"name" : "Adam Slodowy",
"active": "true",
"roles" : [ "teacher", "admin" ],
@rozza
rozza / .slate
Created Jan 3, 2013
My .slate configuration - use it to automatically place my apps when going to and from dual monitor.
View .slate
# ~/.slate configuration
#
# Two modes:
#
# * Single Screen
# No real config, I manage this myself - aka TODO
#
# * Dual Screen
# I want chat and comms on my small monitor and out the way.
# Sublime, Chrome and iTerm on the big screen.
You can’t perform that action at this time.