Skip to content

Instantly share code, notes, and snippets.

@davidoram
davidoram / main.go
Created October 6, 2022 00:53
Load test HTTP server with 'golang.org/x/time/rate' rate limiter
package main
/*
Run via `go run main.go`
Test via `curl -i localhost:4000`
Load test via https://github.com/rakyll/hey
hey -n 500000 -c 50 -q 166 -m GET http://localhost:4000
Summary:
@davidoram
davidoram / convert-card-number-to-barcode.rb
Created February 26, 2024 22:15
Convert a FlyBuys card number to a barcode
#!/usr/bin/env ruby
# Convert a FlyBuys card number to a barcode
def get_check_sum_from_thirteen_digit_code(card_number)
evens = 0
odds = 0
# Loop over all characters
card_number.chars.each_with_index do |character, index|
# Don't include the last character - 1