Skip to content

Instantly share code, notes, and snippets.

View .direnvrc
#
# Python
#
export PYENV_ROOT=${PYENV_ROOT:-$HOME/.pyenv}
# Usage:
# Add to .envrc file:
# use python 3.7.5
use_python() {
# Install pyenv for management of Python versions
@rnorth
rnorth / tips.md
Created Mar 13, 2020
Machine Relevance Show and Tell - staying sane and being effective while working from home
View tips.md
View couchbase_failures.txt
richardnorth@mbp ~/g/t/testcontainers-java> while true
./gradlew couchbase:clean couchbase:test --tests "org.testcontainers.couchbase.*" -i --no-build-cache | tee /dev/fd/2 | tail -n10 | ~/personalbin/nfy
sleep 1; clear
end
Initialized native services in: /Users/richardnorth/.gradle/native
Found daemon DaemonInfo{pid=56918, address=[00bfe441-56b5-4f8f-9ce6-0b7dd6e736f1 port:59163, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1573844859729, context=DefaultDaemonContext[uid=cbb29f0d-797d-4a3a-bc17-fc477d02c3a9,javaHome=/Users/richardnorth/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/193.5096.12/IntelliJ IDEA 2019.3 EAP.app/Contents/jbr/Contents/Home,daemonRegistryDir=/Users/richardnorth/.gradle/daemon,pid=56918,idleTimeout=10800000,priority=NORMAL,daemonOpts=-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-agentlib:jdwp=transpo
View ToxiProxyTest.java
import com.github.dockerjava.api.command.InspectContainerResponse;
import eu.rekawek.toxiproxy.Proxy;
import eu.rekawek.toxiproxy.ToxiproxyClient;
import eu.rekawek.toxiproxy.model.ToxicDirection;
import eu.rekawek.toxiproxy.model.ToxicList;
import org.junit.Rule;
import org.junit.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
View testcontainers_principles.md

Testcontainers general principles

Tips for developing/maintaining Testcontainers forks:

  • Some general tips (most important at the top):
    • Have an easy-to-use API that is simple for people to use and read
    • Make common tasks intuitive and nice to use. Make less common tasks possible, but not at the expense of the common tasks. It's better not to support a niche feature than to degrade the common features.
    • Guide people towards doing sensible things, rather than letting them fall into traps.
    • Be idiomatic for the language and framework
    • Give users coarse-grained tools rather than a fine-grained bag of components to figure out how to assemble
@rnorth
rnorth / agenda
Last active Nov 13, 2018
agenda: exports today's calendar entries from Mac Calendar.app into a markdown file to enable note-taking
View agenda
#!/usr/bin/swift
//
// agenda: exports today's calendar entries from Mac Calendar.app into a markdown file to enable note-taking
//
// Example usage:
// agenda > agenda-$(date +%Y-%m-%d).md
//
import EventKit
View count_dep_loc.fish
cat cp.txt | grep /Users | while read line 115ms
tr ":" "\n"
end | sort | uniq | sed 's/.jar/-sources.jar/g' | while read jar
unzip -p $jar
end | wc -l
@rnorth
rnorth / _notes.md
Last active Jul 18, 2017
2.0 API refactor thoughts
View _notes.md

Testcontainers v2.0 API changes - idea 1

This is a rough sketch of how a revised API for Testcontainers could look - don't read too much into it.

Key goals:

  • How it works should be simple and obvious for the benefit of users and contributors
  • Don't lose too much in-IDE 'discoverability' of the API when compared with the current implementation
  • Break dependency on JUnit to allow usage with other testing frameworks
  • Have separate APIs for configuring containers and using a running container
View SeleniumComposeUITest.java
package com.example;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testcontainers.containers.BrowserWebDriverContainer;
import org.testcontainers.containers.DockerComposeContainer;
@rnorth
rnorth / mvn-release
Last active Sep 7, 2016
Alternative tool for performing Maven Releases - simpler and easier to reason about
View mvn-release
#!/usr/bin/env bash
# Maven release helper. Copyright (c) 2016 Richard North <rich.north@gmail.com>
# Usage: mvn-release.sh PROFILES
# where PROFILES should be any maven profile activations to pass through, e.g. `-PprofileA`
#
# Based on this article: https://axelfontaine.com/blog/final-nail.html
#
# IMPORTANT: follow setup steps in that article for required POM configuration settings
set -o errexit