Skip to content

Instantly share code, notes, and snippets.

View hainesr's full-sized avatar

Robert Haines hainesr

View GitHub Profile
@hainesr
hainesr / bingo.rb
Created January 14, 2024 16:31
Simple Ruby method to generate bingo numbers
def bingo(max)
seen = []
while(seen.size < max)
r = Random.rand(1..max)
next if seen.include?(r)
seen << r
end
@hainesr
hainesr / zlib_deflate_tests.rb
Created May 13, 2018 16:03
Test the various default options for ruby Zlib::Deflate.
# Usage:
# ruby zlib_deflate_tests.rb < input_file
#
# Robert Haines
require 'zlib'
puts "Tests for Ruby Zlib\n-------------------\n\n"
comp = [
@hainesr
hainesr / detect-non-ascii.sh
Created October 23, 2013 20:28
Detect non-ASCII characters in a file.
grep --color='auto' -P -n "[\x80-\xFF]" <file>