Skip to content

Instantly share code, notes, and snippets.

View copiousfreetime's full-sized avatar

Jeremy Hinegardner copiousfreetime

View GitHub Profile
@copiousfreetime
copiousfreetime / lemon-sugar-cookies.md
Last active June 24, 2019 15:44
lemon-sugar-cookies.md

Lemon Sugar Cookies

Dough

  • 230 g unsalted, room temperature butter

  • 350 g sugar

  • 8 g vanilla

  • 2 room temperature eggs

  • 55 g lemon juice (about 1 lemon's worth)

  • 2 lemons, zested

@copiousfreetime
copiousfreetime / 01-README.md
Last active April 15, 2019 04:00
setup-aws-machine

Bootstrap up a new aws machine

@copiousfreetime
copiousfreetime / yajl-gzip-stream-parse.rb
Created January 18, 2019 23:00
Using Yajl to stream parse a gzipped file
#!/usr/bin/env ruby
require 'yajl'
require 'zlib'
require 'hitimes'
metric = ::Hitimes::TimedValueMetric.new('yajl')
infile = ARGV.shift
count = 0
buffer_size = 1024 * 64
@copiousfreetime
copiousfreetime / beacon-case.rb
Created September 22, 2018 17:09
Using ruby case statement
case [beacon_event.data.event, open_visits.any?]
when [BeaconEvent::ENTERED, true]
# beacon sent another entered event and the visit is already registered
when [BeaconEvent::ENTERED, false]
# beacon sent entered event and the visit hasn't been registered
when [BeaconEvent::EXITED, true]
# beacon sent an exited event and the visit is registered
when [BeaconEvent::EXITED, false]
# beacon sent an exited event and the visit is not registered
@copiousfreetime
copiousfreetime / dicegen
Created April 19, 2017 23:57
Diceware passphrase generator
#!/usr/bin/env ruby
require 'securerandom'
def diceword(words)
key = 5.times.map { (SecureRandom.random_number(6) + 1).to_s } .join('')
words[key]
end
words = Hash.new.tap do |h|
/**
* Testing name lookup in C on OSX Sierra
*
* compile: cc -o name-test ./getaddrinfo.c
*
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
% env | grep GEM
% /opt/rubies/ruby-2.2.2/bin/gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.2
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0
- USER INSTALLATION DIRECTORY: /Users/jeremy/.gem/ruby/2.2.0
- RUBY EXECUTABLE: /opt/rubies/ruby-2.2.2/bin/ruby
- EXECUTABLE DIRECTORY: /opt/rubies/ruby-2.2.2/bin
@copiousfreetime
copiousfreetime / log.txt
Created March 16, 2016 21:55
gem installing / uninstall in user dir
% export GEM_HOME=tmp/gem/a
% gem install envolve
Fetching: envolve-1.1.0.gem (100%)
Successfully installed envolve-1.1.0
1 gem installed
% gem list -d envolve
*** LOCAL GEMS ***
source 'https://rubygems.org'
gem 'rack'
gem 'grape'
@copiousfreetime
copiousfreetime / triage-repo
Last active January 8, 2016 18:24
A quick script to open the next issue in a repo
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'octokit', '~> 4.2'
gem 'trollop', '~> 2.1'
gem 'launchy', '~> 2.4'
gem 'netrc', '~> 0.11'