Runs a single-user instance of Seq in Docker with NGINX offloading of a mkcert certificate, listening on port 45341. It also runs the Seq GELF listener in a third container.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.atomicfu.atomic | |
import kotlinx.atomicfu.update | |
import kotlinx.datetime.Clock | |
import kotlinx.datetime.Instant | |
import kotlin.time.Duration | |
/** | |
* Simple implementation of [Clock] for testing. Once created, the clock is | |
* stopped and returns the same instant unless it is reset, advanced or retarded. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mjs.stream.utils; | |
import java.util.stream.Stream; | |
import java.util.stream.StreamSupport; | |
public class StreamUtils { | |
/** | |
* Converts a stream into an iterable for use by, e.g. Spring CrudRepository classes. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "retry-axios", | |
"version": "1.0.0", | |
"description": "Retry function for axios promise-based HTTP client", | |
"scripts": { | |
"test": "jest --coverage" | |
}, | |
"dependencies": { | |
"is-retry-allowed": "^1.1.0" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(zipper). | |
-compile(compile_all). | |
-include_lib("eunit/include/eunit.hrl"). | |
%% Tail-recursive implementation of zip/2 | |
%% that combines items into 2-tuples. | |
zip(Xs, Ys) -> lists:reverse(zip(Xs, Ys, [])). | |
% Stop when either list finishes. | |
zip([], _, Zs) -> Zs; | |
zip(_, [], Zs) -> Zs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(index). | |
-export([get_file_contents/1,show_file_contents/1, | |
index_file/1, word_index/1]). | |
-include_lib("eunit/include/eunit.hrl"). | |
%% Index the words in the specified file. | |
index_file(Filename) -> | |
word_index(get_file_contents(Filename)). |
I hereby claim:
- I am mjstrasser on github.
- I am mjstrasser (https://keybase.io/mjstrasser) on keybase.
- I have a public key whose fingerprint is F541 37DC 4A71 A203 BEE9 F12C A13D 44D8 2E90 4858
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/ssh/gateway' | |
module Net | |
module SSH | |
# A class that manages URLs, tunnelling them if necessary. | |
class Tunnels | |
HP = Struct.new(:host, :port) do | |
def to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logging class that logs nothing. The default is INFO logging to $stderr. | |
class NullLog < WEBrick::BasicLog | |
def log(level, data) | |
# Do nothing. | |
end | |
end | |
# Subclass of WEBrick::HTTPProxyServer that injects HTTP headers into the request. | |
# | |
# Specifying a RequestCallback proc does not work because the WEBrick::HTTPRequest object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run Pimp My Light for a while | |
require 'httparty' | |
COLOURS = [:red, :orange, :green] | |
PML_URL = 'http://pimpmylight.catchpole.net/?update=%s' | |
TOTAL = ARGV.length > 0 ? ARGV[0].to_i : 5 | |
COUNTS = { red: 0, orange: 0, green: 0, except: 0 } |