Skip to content

Instantly share code, notes, and snippets.

Xavier Shay xaviershay

View GitHub Profile
@xaviershay
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-#{key.tr("/", "-")}"
FileUtils.mkdir_p(File.dirname(path))
if File.exists?(path)
View gist:bded3a35ae0494ec8f11ff994051bd3f
SunkenGladesRunaway
SunkenGladesNadePool
SunkenGladesNadeTree
SunkenGladesMainPool
SunkenGladesMainPoolDeep
FronkeyWalkRoof
WallJump
DeathGauntlet
WallJumpMapStone
AboveFourthHealth
View gist:08957022c6377f123b741c6050f8888b
### Keybase proof
I hereby claim:
* I am xaviershay on github.
* I am xshay (https://keybase.io/xshay) on keybase.
* I have a public key ASDeCNUvU5aeS2wT6D9XGzYM5ScS9DKBJL-nRjE3ETsr2Qo
To claim this, I am signing this object:
@xaviershay
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.extend(ClassMethods)
klass.attributes # Force instantiation
end
def initialize(data)
data.each do |key, value|
instance_variable_set("@#{key}", value)
end
@xaviershay
xaviershay / standalone_rom_sql.rb
Created Jul 20, 2015
Standalone script to play around with ROM. http://rom-rb.org/
View standalone_rom_sql.rb
# Standalone script to try http://rom-rb.org/ with a database
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
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
ruby-2.0.0.353-22.el7_0.x86_64
$ rpm -qf /usr/share/ruby/csv.rb
ruby-libs-2.0.0.353-22.el7_0.x86_64
$ 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
View the-glass-cage.md

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.

@xaviershay
xaviershay / props.md
Last active Aug 29, 2015
Californa General Election Proposition Voting Guide
View props.md

Californa General Election Proposition Voting Guide

I can't even vote here, but this is where I live so I have opinions. I'm no expert on any of these issues, so am open to persuasion.

Prop 2: State Budget Stabilization Account

I don't even know what's going on here. It appears both sides of legislature are trying to dig themselves out of a pretty major budgetary defecit by setting requirements for paying down debts. They claim this is good for schools. Educate Our State feels they are crooks and not only would this be bad for schools, but schools have been getting the bad end of the budget for decades. Both sides are shouting at each other and I can't find the signal.

It is unanimously supported by democrat and republican candidates, so I'm slightly on a Yes vote. Could be a mistake: so was the 2005 Energy Policy Act.

View fracking.md

This weekend I spent many hours learning about hydraulic fracturing, commonly known as "fracking". I watched Gasland, Fracknation, and read pages and pages of articles, reports, and regulations.

There is a lot of FUD on both sides, but it seems clear there is a realistic probability that gas extraction has negative health impacts in a non-trivial number of communities. This probability, especially given the bad track record of the oil and gas industry, should be sufficient to justify more caution than is currently being applied.

I don't trust the US EPA. I am sure they have good individual people, but as an organisation they appear crippled by budget cuts and political pressure. The US government made an explicit bipartisan decision with the 2005 Energy Policy Act to reduce regulatory oversight on fracking, enabling companies to move faster with possibly dangerous technology. This is inexcusable. Gas prices in the US are less than half most of the world. Slow down.

Many farmers want drilling on their land

You can’t perform that action at this time.