Skip to content

Instantly share code, notes, and snippets.

View jon-ruckwood's full-sized avatar

Jonathan Ruckwood jon-ruckwood

  • London, England
View GitHub Profile
@tcovo
tcovo / EmbeddedServerCommand.java
Created January 11, 2013 17:17
EmbeddedServerCommand for Dropwizard services, to be used as an alternative for ServerCommand when it is desirable for the service to not block the thread it was started on, and allow stopping the service programmatically. Some modifications must be made to the Service class to make use of this functionality. An example JUnit test is provided to…
package com.example;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import com.yammer.dropwizard.Service;
import com.yammer.dropwizard.cli.EnvironmentCommand;
import com.yammer.dropwizard.config.Configuration;
import com.yammer.dropwizard.config.Environment;
import com.yammer.dropwizard.config.ServerFactory;
import com.yammer.dropwizard.lifecycle.ServerLifecycleListener;
@jon-ruckwood
jon-ruckwood / module-info.java
Last active February 9, 2017 11:38
Example Java 9 module definition with explanations
/*
Modules are not required, although usage is encouraged. This allows existing code to work within Java 9.
Code defined outside of a module is put in an `unnamed module`
Unnamed is a special module that is able to read from *all* other modules, *but* only the exported code (see below)
All of this is automatic when your code compiles. It allows your existing code to continue working as expected.
This is an example `module descriptor`.
It should be placed directly under the `src` dir, e.g. for in Maven `src/main/java/`
Must be named `module-info.java`.
*/
@kissgyorgy
kissgyorgy / osx_defaults.sh
Last active June 1, 2017 05:56
Change OS X defaults
# prevent the creation of .DS_Store files on network drives
# http://hints.macworld.com/article.php?story=2005070300463515
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
#---------------------------------------------------------------------
# Disable/enable Dashboard:
# http://hints.macworld.com/article.php?story=20050723123302403
defaults write com.apple.dashboard mcx-disabled -boolean YES
package hu.akarnokd.reactiveflowbridge;
import java.util.Objects;
import java.util.concurrent.Flow;
import java.util.function.Function;
/**
* Bridge between Reactive-Streams API and the Java 9 Flow API.
*/
public final class ReactiveFlowBridge {
@kimble
kimble / DropwizardTestServer.java
Created May 25, 2012 19:15
JUnit @rule for running Dropwizard integration test. Ps! This is just a proof of concept. There are probably some landminds lying around waiting to go off, especially around lifecycle management and static state
package com.developerb.dropwizard;
import com.yammer.dropwizard.AbstractService;
import com.yammer.dropwizard.Service;
import com.yammer.dropwizard.cli.Command;
import com.yammer.dropwizard.config.Configuration;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
@jon-ruckwood
jon-ruckwood / tips_and_tricks.md
Last active January 24, 2020 10:27
Tips and Tricks

jq

Transform JSON into a table to displayed in a terminal:

$ aws dynamodb describe-table --table-name foobar | jq -r "[ .Table.GlobalSecondaryIndexes[] 
    | { IndexName, IndexStatus, Backfilling } ] 
    | (.[0] | keys | @tsv), (.[] | map(.) | @tsv)"

Backfilling IndexName IndexStatus
@codefromthecrypt
codefromthecrypt / opentracing-zipkin.md
Last active October 27, 2021 01:44
My ramble on OpenTracing (with a side of Zipkin)

I've had many people ask me questions about OpenTracing, often in relation to OpenZipkin. I've seen assertions about how it is vendor neutral and is the lock-in cure. This post is not a sanctioned, polished or otherwise muted view, rather what I personally think about what it is and is not, and what it helps and does not help with. Scroll to the very end if this is too long. Feel free to add a comment if I made any factual mistakes or you just want to add a comment.

So, what is OpenTracing?

OpenTracing is documentation and library interfaces for distributed tracing instrumentation. To be "OpenTracing" requires bundling its interfaces in your work, so that others can use it to time distributed operations with the same library.

So, who is it for?

OpenTracing interfaces are targeted to authors of instrumentation libraries, and those who want to collaborate with traces created by them. Ex something started a trace somewhere and I add a notable event to that trace. Structure logging was recently added to O

@jboner
jboner / how-akka-maps-to-eai-patterns.txt
Last active October 9, 2022 21:57
How Akka maps to EAI Patterns
# How Akka maps to EAI Patterns
Might be up for debate or just plain wrong. Just some notes I scribbled down some time ago.
-----------------------------------------------------------------------------------------------------------------
EAI PATTERN AKKA PATTERN REFERENCE
-----------------------------------------------------------------------------------------------------------------
Point to Point Channel Regular Actor Communication http://www.eaipatterns.com/PointToPointChannel.html
Event-Driven Consumer Regular Actor Receive http://www.eaipatterns.com/EventDrivenConsumer.html
Message Selector Actor with Stash http://www.eaipatterns.com/MessageSelector.html
@mlafeldt
mlafeldt / x.md
Created February 16, 2016 15:48
Providing a Homebrew tap backed by private GitHub repo

First of all, install Homebrew itself.

As the tap is a private Git repo, you need to generate a GitHub token with repo scope and then add this token to your ~/.netrc file like this:

machine github.com
  login <your GitHub user>
  password <your GitHub token>
@jnschulze
jnschulze / osx_ramdisk.sh
Last active February 5, 2024 13:48
Move Chrome, Safari and iTunes Cache to Ramdisk.
#!/bin/bash
# Size at the end is * 2048 where 2048 = 1 MB, so 1572864 = 768 MB
#DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://1572864`
DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://2097152`
/usr/sbin/diskutil erasevolume HFS+ "RamDiskCache" $DISK
CACHEDIR="/Volumes/RamDiskCache/$USER"