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 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
#!/usr/bin/ruby
# Prints the number of cores on your system.
# Requires the ohai rubygem.
require 'rubygems'
require 'ohai'
ohai = Ohai::System.new
ohai.all_plugins
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
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: https://github.com/pwnall/mit_hack_2012/blob/master/app/controllers/session_controller.rb#L17

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: https://github.com/pwnall/mit_hack_2012/blob/master/app/models/profile.rb#L38

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
pwnall / build_coffeescript.sh
Created Jun 29, 2012
Builder for encap packages for Ruby, the Sass compiler, Node.js and the CoffeeScript compiler
View build_coffeescript.sh
#### 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
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 0.48.3.1, 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/0.48.3.1
## --------- ##
## Platform. ##
@pwnall
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'
@pwnall
pwnall / fedora_kernel37.sh
Created Dec 1, 2012 — forked from mikefaille/Fed_install_3.7_rc6_krnl
Fedora install kernel 3.7 rc7 x64
View fedora_kernel37.sh
sudo yum install http://kojipkgs.fedoraproject.org/packages/kernel/3.7.0/0.rc7.git0.1.fc19/x86_64/kernel-3.7.0-0.rc7.git0.1.fc19.x86_64.rpm http://kojipkgs.fedoraproject.org/packages/kernel/3.7.0/0.rc7.git0.1.fc19/x86_64/kernel-devel-3.7.0-0.rc7.git0.1.fc19.x86_64.rpm http://kojipkgs.fedoraproject.org/packages/kernel/3.7.0/0.rc7.git0.1.fc19/x86_64/kernel-headers-3.7.0-0.rc7.git0.1.fc19.x86_64.rpm http://kojipkgs.fedoraproject.org/packages/kernel/3.7.0/0.rc7.git0.1.fc19/x86_64/kernel-modules-extra-3.7.0-0.rc7.git0.1.fc19.x86_64.rpm --nogpg
@pwnall
pwnall / chrome_android_buid.md
Last active Dec 14, 2015
Step-by-step instructions for setting up a VM that builds Chrome for Android
View chrome_android_buid.md

Build Instructions for libchromewebview.so

This document contains step-by-step instructions for building a Chromium-powered Android WebView.

Chromium's build process is a bit fussy, and the Android target is even more fussy, so the least painful way of getting it done is to set up a VM with the exact software that the build process was designed for. The steps below accomplish this.

@pwnall
pwnall / 00-mapnik_failed_1082.md
Last active Dec 14, 2015
mapnik failed to build on 10.8.2
View 00-mapnik_failed_1082.md

The output from HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install mapnik

  • stdout is in brew_install_stdout.log
  • stderr is in brew_install_stderr.log

The contents of ~/Library/Logs/Homebrew/mapnik/config.log is in library_logs_homebrew_mapnik_config.log

The output from brew doctor is in brew_doctor_output.log

You can’t perform that action at this time.