Skip to content

Instantly share code, notes, and snippets.

Brock Wilcox awwaiid

Block or report user

Report or block awwaiid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View blah.pl
use HOI::Match;
psub point_extract =>
"point (x _) :: r" => sub { my %args = @_; $args{x} + point_extract($args{r}) },
"nil" => sub { 0 };
point_extract(
[
{"type" => "point", "val" => [ 1, 2 ]},
{"type" => "point", "val" => [ 2, 4 ]},
@awwaiid
awwaiid / sim.rb
Created Mar 20, 2014
Simulate UCLA games
View sim.rb
#!/usr/bin/env ruby
require 'csv'
require 'pp'
$season = {}
# Data from http://www.spreadsheet-sports.com/2014-ncaa-tournament-data/
CSV.foreach('2014 Game Results Data.csv', headers: true, return_headers: true) do |game|
$season[game["Team"]] ||= []<< game
View gist:d3abbac44473a9db453b
awwaiid@totoro:~$ ruby -e 'puts RubyVM::InstructionSequence.compile("puts %w(hello world)").disasm'
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1 ( 1)
0002 putself
0003 putstring "hello"
0005 putstring "world"
0007 newarray 2
0009 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
0011 leave
@awwaiid
awwaiid / gist:ad7b0eb0ffb2eafa4e39
Created Dec 3, 2014
index a given array of records
View gist:ad7b0eb0ffb2eafa4e39
# app/searchers/elasticsearch/bulk_indexable.rb
# This was my sketch of an idea for a way to index a specific given set of records
# "records" here is an array of units, which it batches with #each_slice
def index_records(records, new_index=nil)
Rails.logger.info("[ElasticSearch] Indexing given records")
records.each_slice(BULK_OPERATION_LIMIT) do |record_batch|
batch_index(record_batch, new_index)
end
@awwaiid
awwaiid / output
Created Jan 11, 2015
Runtime types
View output
# Run with ruby 2.2.0 (2.1.5 did weird things with the binding
awwaiid@misao:~/projects/ruby/run-time-types$ ./rtt.rb
howdy, steve
TYPE CHANGE! La::Tee::Da#hmm n String -> Fixnum
TYPE CHANGE! La::Tee::Da @foo Fixnum -> String
Hmm... 23
hiya
TYPE CHANGE! Object# x Fixnum -> String
@awwaiid
awwaiid / polly6
Last active Aug 29, 2015
polly6 -- a cli music wrapper
View polly6
#!/usr/bin/env perl6
use v6;
use File::Find;
# This is the mapping we use to play a file
my @play_commands =
/\.ogg$/ => 'ogg123',
/\.mp3$/ => 'mpg123',
/\.m4a$/ => 'mplayer',
@awwaiid
awwaiid / gist:fc6e88ff1ecd846bc438
Created Apr 9, 2015
Skip to next song or exit
View gist:fc6e88ff1ecd846bc438
my $in_break = False;
signal(Signal::SIGINT).tap: {
exit if $in_break;
$in_break = True;
say "Going to next song...";
sleep 5; # Give them a chance to interrupt again
$in_break = False;
}
@awwaiid
awwaiid / DCBPW Info
Last active Aug 29, 2015
DCBPW Info
View DCBPW Info
Email dcbpw-organizers@google-groups.com with any questions!
ACT (server for our conference website) is having some issues (the YAPC::NA site is down as well), which I've let them know about. In case it doesn't come up, here is some basic info:
Silver Spring Civic Building, registration @9am, first talk @10am
1 Veterans Pl Silver Spring, MD 20910
https://www.google.com/maps/place/Silver+Spring+Civic+Center/@38.997376,-77.02455,15z/data=!4m2!3m1!1s0x0:0x85f73077e6b965fd
Saturday Opening
9:00 Registration
@awwaiid
awwaiid / jirablame
Created Aug 17, 2015
Git annotation including jira ticket key
View jirablame
#!/usr/bin/ruby
# Add this to your .vimrc; then highlight lines and do ",ga"
# vmap ,ga :<C-U>!git blame -v -L <C-R>=line("'<")<CR>,<C-R>=line("'>")<CR> -e % \| jirablame <CR>
require 'date'
commit = {}
ticket = {}
View SDL+Coro
Err... see http://gist.github.com/327467 for the most up-to-date version
#!/usr/bin/perl
use strict;
use SDL;
use SDL::App;
use SDL::Game::Rect;
use SDL::Event;
use SDL::Events;
You can’t perform that action at this time.