Skip to content

Instantly share code, notes, and snippets.

Currently focused on the needs of Google Chrome

Victor Costan pwnall

Currently focused on the needs of Google Chrome
Block or report user

Report or block pwnall

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:4056e1e94f8694d0fd12
### Keybase proof
I hereby claim:
* I am pwnall on github.
* I am 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:
View gist:d47582382fa69d2a6cd8
def no_repeats(year_start, year_end)
(year_start..year_end).each do |yr|
no_repeats<<yr if no_repeat?(yr)
def no_repeat?(year)
pwnall / puzzle.txt
Last active Aug 29, 2015
Quick and dirty Sudoku solver
View puzzle.txt
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
View picasa_download.rb
# Backs up all the photos from Google Picasa Web Albums.
# The script downloads the original version of the photos, and is not limited to
# 1600x1200 thumbnails.
# Author:: Victor Costan
# Copyright:: Copyright (C) 2010 Victor Costan
# License:: MIT
require 'yaml'
View cpu_count.rb
# Prints the number of cores on your system.
# Requires the ohai rubygem.
require 'rubygems'
require 'ohai'
ohai =
View facebook_token.rb
# Wraps an OAuth2 access token for Facebook.
class FacebookToken < ActiveRecord::Base
# The user whose token this is.
belongs_to :user
validates :user, :presence => true
# A unique ID on the Facebook site for the user owning this token.
validates :external_uid, :length => 1..32, :presence => true
# The OAuth2 access token.
pwnall / gist:2519877
Created Apr 28, 2012
Multiple HTTP requests in a single Rails controller action
View gist:2519877

Whenever users sign into my application, or access its homepage, I check to see if I have recent Facebook data for them. If not, I synchronously fetch the data from Facebook. I'd do it asynchronously, but I don't want to add logic for rendering the homepage with incomplete information.

The controller code is the if statement that starts here:

Facebook data is cached in the Profile model (each user has a profile), and in the UserFriendship model.

The model code that does the fetches is here:

The code calls some code in the fbgraph gem to fetch profile information. It also calls the method below, which uses curl to follow redirects:

pwnall /
Created Jun 29, 2012
Builder for encap packages for Ruby, the Sass compiler, Node.js and the CoffeeScript compiler
#### node-coffeescript-1.3.3 encap package
## Requires: nodejs-0.8.0
## Set up the encap cage.
# NOTE: this dance ensures that the build process is properly contained
sudo mkdir /usr/local/encap/node-coffeescript-1.3.3
sudo chown $USER:$USER /usr/local/encap/node-coffeescript-1.3.3
## Build and install in the encap cage.
pwnall / config.log
Created Aug 11, 2012
config.log after attempting to install Inkscape
View config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by inkscape configure, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --disable-dependency-tracking --enable-lcms --disable-poppler-cairo --prefix=/usr/local/Cellar/inkscape/
## --------- ##
## Platform. ##
pwnall / Gemfile
Created Oct 18, 2012
Grader sample code
View Gemfile
source :rubygems
gem 'sinatra', '>= 1.3.1', require: 'sinatra/base'
gem 'shotgun', '>= 0.9'
gem 'thin', '>= 1.3.1'
You can’t perform that action at this time.