It creates randomised pairings from the given inputs.
Simple:
╭─{ yaauie@durin:~ }
╰─● rando-pair Alice Bob Charlie Donald Evelyn Frank Gertrude
#!/usr/bin/env ruby | |
# Given STDIN of unix timestamps (one or more per line), | |
# analyze the weekly distribution at hourly granularity. | |
day_counts_by_hour = [] | |
$stdin.each_line do |line| | |
next if line.chomp.empty? |
# encoding: utf-8 | |
require 'pry' | |
module Kernel | |
alias_method :raise_without_pry, :raise | |
def raise_with_pry(*a, &b) | |
# `exit true` to continue *without* raising. | |
binding.pry || raise_without_pry(*a, &b) | |
end | |
alias_method :raise, :raise_with_pry |
# quick and dirty back-port of Ruby 2.1's Exception#cause | |
class Exception | |
def self.new(*args) | |
allocate.tap do |exception| | |
exception.send(:initialize, *args) | |
exception.cause = $! | |
end | |
end | |
# @return [Exception, nil] |
(cd $(bundle show yajl-ruby)/ext/yajl; sed -i '.bak' 's/inline void/static void/g' yajl_ext.h yajl_ext.c; make clean all) |
#!/usr/bin/ruby | |
# encoding: utf-8 | |
module Where | |
extend self | |
def where(cmd) | |
return enum_for(:where, cmd) unless block_given? | |
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] | |
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| | |
exts.each do |ext| |
#!/usr/bin/env ruby | |
require 'shellwords' | |
require 'time' | |
END { | |
zookeeper = ARGV.shift || fail("Usage #{$0} <zookeeper>") | |
$stderr.puts("Getting stats via #{zookeeper}") | |
one_five_fifteen = [] |
grammar Iso8601; | |
temporal : year (HYPHEN subyear)? offset? EOF | |
; | |
subyear : month (HYPHEN submonth)? | |
| W_LITERAL week (HYPHEN subweek)? | |
| Q_LITERAL quarter (HYPHEN subquarter)? | |
| oday (T_LITERAL subday)? | |
; |
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'json' | |
begin | |
$stdout.puts(JSON.pretty_generate(JSON.load($stdin.read))) | |
rescue JSON::ParserError => e | |
$stderr.puts(e.message) | |
exit 1 |
package com.yaauie.guava-utils; | |
import com.google.common.collect.ImmutableBiMap; | |
import com.google.common.collect.ImmutableCollection; | |
import com.google.common.collect.ImmutableList; | |
import com.google.common.collect.ImmutableMap; | |
import com.google.common.collect.ImmutableSet; | |
import com.google.common.collect.ImmutableSortedMap; | |
import com.google.common.collect.ImmutableSortedSet; |