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:
| # 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 } |
| # 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 |
| 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 |
I hereby claim:
To claim this, I am signing this object:
| -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)). |
| -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; |
| 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. | |
| */ |
| { | |
| "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" | |
| }, |
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.
| 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. | |
| * |