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

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@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;
@jboner
jboner / latency.txt
Last active May 4, 2024 21:16
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@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;
@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
@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"
@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
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@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
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 {