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
@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

@xaviershay
xaviershay / check-for-fixes.rb
Last active Aug 29, 2015
Finds all github issue URLs in project comments and exits non-zero if any of them are no longer open.
View check-for-fixes.rb
#!/usr/bin/env ruby
require 'tmpdir'
require 'net/http'
require 'openssl'
require 'uri'
require 'json'
require 'date'
def file_cache(key)
View safe_bundle_standalone.sh
#!/bin/bash
set -ex
bundle install --standalone
digest=$(md5 -q Gemfile)
cmd="raise \"Gemfile changed\" if %x[md5 -q Gemfile].chomp != \"${digest}\""
echo $cmd > bundle/bundler/setup.rb.new
cat bundle/bundler/setup.rb >> bundle/bundler/setup.rb.new
@xaviershay
xaviershay / github_requests.md
Last active Apr 11, 2018
Pull request feature requests
View github_requests.md

Hello Github,

Pull requests are not serving me well on large reviews. Here are some problems and suggested enhancements that would make me happy.

  • Mark comment as "resolved" (see google docs for an example). As code changes, comments get lost or made redundant, and it is not clear (to either the author or reviewers) which are still relevant and which have been addressed. Resolving a comment doesn't need to make it dissappear, but I need to be able to see "which comments have not been addressed" somehow. This feature would be the most useful to me.
  • Reply to a comment. This can be done in effect on line comments (assuming there is only one), but cannot on PR comments. Particularly with many threads, the lack of this makes a review hard to follow.
  • Explicit "approve/block" life cycle. The block is actually more important to me ... often on a PR that has been incrementally improved I want to "block" final merge of it until I get a chance to rebase/squash and generally pretty it up. The block can be over
View 2013_reading.md

2013 Reading List

I read sixty-six books this year, one more than last. You can find the full list over at Good Reads, but here are my top picks.

Philosophy

A Manual For Creating Atheists by Peter Boghossian

The best book on teaching critical thinking I have read. Includes "intervention dialogues" transcripts, plenty of research, genuine compassion and empathy for other people, plus a wealth of experience in the author, who has been teaching philosophy and talking about faith for decades.

View two-factor
#!/usr/bin/env ruby --disable-gems
# Roll your own two-factor authentication! Place this file on a USB key, make
# it executable, then run:
#
# two-factor --setup
#
# Now place each TOTP secret in its own file in the `keys/` directory. I like
# to name them after the website they apply to, but any name is fine. To
# generate a token, plug in your USB key and:
@xaviershay
xaviershay / mobility.md
Last active Dec 28, 2015
Mobility routine, 17th November 2013
View mobility.md

Time: 25-30 minutes.

Goal: Better back, front, and overhead squats. Very basic gymnastic conditioning.

"Limber 11" ([video][limber-11])

  • Foam roll ITB, 10 passes
  • Foam roll aductors, 10 passes
  • Ball glutes, 30-60s each
  • Bent leg cross, 5 each side
@xaviershay
xaviershay / bm_sorted_set.rb
Last active Dec 28, 2015
Benchmark showing sorted set being slower when rbtree is used. https://github.com/ruby/ruby/blob/trunk/lib/set.rb#L575
View bm_sorted_set.rb
require 'set'
require 'benchmark'
begin
require 'rbtree'
puts "using rbtree"
# https://github.com/ruby/ruby/blob/trunk/lib/set.rb#L575
rescue LoadError
puts "NOT using rbtree"
end
@xaviershay
xaviershay / ruby_live_gc_stats.rb
Created Nov 10, 2013
naive jstat proof-of-concept for ruby
View ruby_live_gc_stats.rb
Thread.new do
GC::Profiler.enable
current_message = ""
epoch = Time.now
total_time = 0
gc_events = 0
heap_use = 0
heap_size = 0
fmt = "%7s %5s %15s %15s %10s"
You can’t perform that action at this time.