Skip to content

Instantly share code, notes, and snippets.

View pwnall's full-sized avatar
🎯
Currently focused on the needs of Fuchsia

Victor Costan pwnall

🎯
Currently focused on the needs of Fuchsia
View GitHub Profile
@pwnall
pwnall / rails_routing_format_bug.rb
Created December 22, 2015 02:23
Executable test case for rails 5.0 routing format bug
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# Activate the gem you are reporting the issue against.
@pwnall
pwnall / puzzle.txt
Last active August 29, 2015 14:07
Quick and dirty Sudoku solver
x x x 4 x 6 x x x
x 5 6 x x x 3 9 x
x 9 x x x x x 4 x
2 x x x 3 x x x 1
x x x 6 x 9 x x x
3 x x x 5 x x x 6
x 4 x x x x x 5 x
x 8 2 x x x 4 7 x
x x x 5 x 2 x x x
def no_repeats(year_start, year_end)
no_repeats=[]
(year_start..year_end).each do |yr|
no_repeats<<yr if no_repeat?(yr)
end
no_repeats
end
def no_repeat?(year)
num_seen=[]
### Keybase proof
I hereby claim:
* I am pwnall on github.
* I am pwnall (https://keybase.io/pwnall) on keybase.
* I have a public key whose fingerprint is 1CC4 CD57 EF01 392D 1DDF 2531 0C58 7774 D23E 223B
To claim this, I am signing this object:
@pwnall
pwnall / clocks.html
Created November 28, 2013 03:02
Experiment that measures the drift between the V8 clock and the Blink clock.
<!DOCTYPE html>
<script>
// Maximum difference between Blink's clock and V8's.
var maxDelta = 0;
// Measure clock differences for 30 seconds.
//
// Browsers will stop our JavaScript if it runs for too long without returning
@pwnall
pwnall / time.html
Created November 28, 2013 02:57
Experiment for proving that Date.now() goes back quite often by quite a bit in V8 on Windows.
<!DOCTYPE html>
<script>
// Watch out for the clock going backwards for 30 seconds.
//
// Browsers will stop our JavaScript if it runs for too long without returning
// control to the event loop.
var smallTest = function() {
var startTime = Date.now();
@pwnall
pwnall / google_form_voter.rb
Created October 6, 2013 20:41
Mechanizing a Google Form
require 'mechanize'
loop do
agent = Mechanize.new
agent.user_agent_alias = 'Mac Safari'
puts "Fetching form"
page = agent.get "https://docs.google.com/forms/d/15a7OlkEn9qDCxyG23a4ilS6SRa0c61p4el222OFqRAk/viewform"
@pwnall
pwnall / ll_test.rb
Created September 14, 2013 08:03
Test whether a Ruby VM has the hooks we need to implement label propagation for Police.
class LabeledString < String
def +(other)
LabeledString.new original_plus(other)
end
end
class String
alias_method :original_plus, :+
def +(other)
@pwnall
pwnall / gist:5523050
Created May 6, 2013 02:23
middleman-sprockets crashes middleman 3.1.beta (and master)
/home/pwnall/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/bundler/gems/middleman-sprockets-e5806151a349/lib/middleman-sprockets/sass_function_hack.rb:18:in `image_url': undefined local variable or method `sprockets_context' for #<Sass::Script::Functions::EvaluationContext:0x0000000153c9f0> (NameError)
(in /home/pwnall/workspace/mm-sprockets/source/stylesheets/all.css.sass)
from /home/pwnall/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/sass-3.2.8/lib/sass/script/funcall.rb:112:in `_perform'
from /home/pwnall/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/sass-3.2.8/lib/sass/script/node.rb:40:in `perform'
from /home/pwnall/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:298:in `visit_prop'
from /home/pwnall/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/sass-3.2.8/lib/sass/tree/visitors/base.rb:37:in `visit'
from /home/pwnall/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/sass-3.2.8/lib/sass/tree/visitors/perform.rb:100:in `visit'
@pwnall
pwnall / rice-1.4.3-on-fedora18.log
Created March 16, 2013 06:40
The rice gem (1.4.3) fails to install on Fedora 18 due to extension compilation errors.
/home/pwnall/.rbenv/versions/1.9.3-p194/bin/ruby extconf.rb
extconf.rb:20: Use RbConfig instead of obsolete and deprecated Config.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes