Skip to content

Instantly share code, notes, and snippets.

View mroth's full-sized avatar

Matthew Rothenberg mroth

View GitHub Profile
@mroth
mroth / PRIVACY_POLICY.md
Created December 3, 2024 03:15
Wastewater Trends Privacy Policy

Privacy Policy version 1.0 for the Wastewater Trends iOS app

The Wastewater Trends iOS app does not collect any user data of any kind. The app only accesses the internet to download wastewater data from public servers.

@mroth
mroth / randpool_test.go
Created June 4, 2024 21:44
buffered randomness throughput benchmarks
package main
import (
"bufio"
"crypto/rand"
"fmt"
"testing"
)
func BenchmarkRandReads(b *testing.B) {
@mroth
mroth / randpool_test.go
Last active June 30, 2023 17:24
buffered randomness throughput benchmarks
package main
import (
"bufio"
"crypto/rand"
"strconv"
"testing"
)
func BenchmarkRandReads(b *testing.B) {
@mroth
mroth / conversion.go
Last active June 11, 2022 14:39
Inconsistent overflow behavior between amd64 and arm64 on a float64->int64 conversion following math.Ceil
package main
import (
"fmt"
"math"
)
func main() {
var f float64 = math.MaxInt64 + 1
c := math.Ceil(f)
@mroth
mroth / raceexec_test.go
Created January 4, 2019 22:38
Debugging interesting behavior with a common pattern for testing subprocesses and the race detector.
package raceexec
import (
"log"
"os"
"os/exec"
"testing"
"time"
)
benchmark old ns/op new ns/op delta
BenchmarkRegister-4 1767 2250 +27.33%
BenchmarkUnregister-4 2956 3406 +15.22%
BenchmarkBroadcast/1-4 637 901 +41.44%
BenchmarkBroadcast/10-4 2022 2195 +8.56%
BenchmarkBroadcast/100-4 20755 20312 -2.13%
BenchmarkBroadcast/500-4 103296 104309 +0.98%
BenchmarkBroadcast/1000-4 191801 196909 +2.66%
BenchmarkBroadcast/10000-4 2539621 2751075 +8.33%
BenchmarkBroadcast/100000-4 45231751 49716303 +9.91%
@mroth
mroth / git-music.sh
Last active January 25, 2017 17:58
Adds the currently playing iTunes track to your prepared git commit message.
#!/bin/bash
# Adds the currently playing iTunes track to your prepared commit message.
#
# To install, save in repo as chmod +x to .git/hooks/prepare-commit-msg
SONG=`osascript -e 'tell application "iTunes" to if player state is playing then "♬ : " & artist of current track & " / " & name of current track'`
if [[ $SONG ]]; then
echo -e "$(cat $1)\n\n$SONG" > $1
fi
@mroth
mroth / VBox.log
Created August 20, 2015 12:24
docker-machine create error
VirtualBox VM 5.0.2 r102096 darwin.amd64 (Aug 13 2015 18:38:03) release log
00:00:00.035033 Log opened 2015-08-20T12:17:55.276622000Z
00:00:00.035034 Build Type: release
00:00:00.035045 OS Product: Darwin
00:00:00.035050 OS Release: 14.5.0
00:00:00.035055 OS Version: Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64
00:00:00.035143 DMI Product Name: MacBookPro12,1
00:00:00.035189 DMI Product Version: 1.0
00:00:00.035195 Host RAM: 16384MB total, 7593MB available
00:00:00.035197 Executable: /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless
@mroth
mroth / gist:8d0b685df435d1409038
Created July 24, 2014 17:58
Pondering Elixir pipes
# A very common pattern in Elixir is to define a method that pipes the first
# argument through a series of transformations, for example here is some actual
# Elixir code I just wrote.
@spec encode(String.t) :: String.t
def encode(plaintext) do
plaintext
|> encipher
|> chunk
end
@mroth
mroth / errormsg.txt
Created May 4, 2014 21:25
Tweets that crash TweetStream
ERROR: MultiJson::DecodeError occured in stream