Skip to content

Instantly share code, notes, and snippets.

Xavier Shay xaviershay

Block or report user

Report or block xaviershay

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 gist:865e3cd84c5defe9ed65dd16de2ece80
View gist:005ca2ba734ab2bc4cded90e3680441f
symbols = %w(1L 1 1R 1L1 1R1 b bL bR bL1 bR1 b2 b3 c cL cR cL1 cR1 c2)
tape = %w(1R 1R cL1)
cursor = 0
L = -1
R = +1
state = 1
xaviershay / splits_io_analyzer.rb
Created Apr 7, 2018
Analyzing splits IO data
View splits_io_analyzer.rb
require 'net/http'
require 'json'
require 'fileutils'
game_id = "3414" # ori_de
def cache(key, &block)
path = "cache/key-#{"/", "-")}"
if File.exists?(path)
View gist:bded3a35ae0494ec8f11ff994051bd3f
View gist:08957022c6377f123b741c6050f8888b
### Keybase proof
I hereby claim:
* I am xaviershay on github.
* I am xshay ( on keybase.
* I have a public key ASDeCNUvU5aeS2wT6D9XGzYM5ScS9DKBJL-nRjE3ETsr2Qo
To claim this, I am signing this object:
xaviershay / migration_sql.rb
Created Aug 14, 2015
Get SQL output from a Rails migration
View migration_sql.rb
#!/usr/bin/env ruby
require_relative 'config/environment'
path = ARGV.shift || raise("specify migration as first argument")
require_relative path
filename = File.basename(path, ".rb")
timestamp, name = filename.split("_", 2)
View gist:a76a1bca03c212ff1c69
module ValueObject
def self.included(klass)
klass.attributes # Force instantiation
def initialize(data)
data.each do |key, value|
instance_variable_set("@#{key}", value)
xaviershay / standalone_rom_sql.rb
Created Jul 20, 2015
Standalone script to play around with ROM.
View standalone_rom_sql.rb
# Standalone script to try with a database
require 'bundler/inline'
gemfile do
source ''
gem 'rom'
gem 'rom-sql'
gem 'rom-rails'
gem 'activemodel'
View gist:985315a776e07c6fa4e6
$ cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)
$ rpm -qf /usr/bin/ruby
$ rpm -qf /usr/share/ruby/csv.rb
$ for x in $(ruby -e 'puts $LOAD_PATH'); do ls $x | grep -q json && echo $x; done
ls: cannot access /usr/local/share/ruby/site_ruby: No such file or directory
ls: cannot access /usr/local/lib64/ruby/site_ruby: No such file or directory
$ for x in $(ruby -rjson -e 'puts $LOAD_PATH'); do ls $x | grep -q json && echo $x; done

Cross-posted at Goodreads

"The Glass Cage" Review

What if the cost of machines that think is people who don’t?

Nicholas Carr's The Glass Cage is an important counterpoint to the dominant automation-at-all-costs mindset of Silicon Valley. That more automation is better is not as obvious a conclusion as many of us would like to believe. Carr is definitely not anti-technology though. This book is level-headed in discussing the positive and negative trends in automation, backed by a large amount of research. From pilots to doctors to inuit hunters, Carr present a comprehensive overview of automation across society today.

Three themes in particular stuck in my mind.

You can’t perform that action at this time.