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
@pwnall
pwnall / rmdb.js
Created Mar 14, 2018
Workaround for OOM when deleting a large IndexedDB database
View rmdb.js
// Opens a connection to an IndexedDB database.
//
// @param [String] name the IDB database name
// @return [Promise<IDBDatabase>] a connection to the opened database
function OpenDatabase(name) {
return new Promise((resolve, reject) => {
const request = indexedDB.open(name);
request.onsuccess = () => { resolve(request.result); };
request.onerror = () => { reject(request.error); };
});
@pwnall
pwnall / get_layout_test_fonts.sh
Last active Jul 26, 2019
Get the fonts needed by Chromium's LayoutTests on Fedora Linux
View get_layout_test_fonts.sh
sudo mkdir -p /usr/share/fonts/opentype
sudo mkdir -p /usr/share/fonts/truetype
sudo dnf install -y ipa-gothic-fonts ipa-pgothic-fonts ipa-mincho-fonts ipa-pmincho-fonts
sudo mkdir -p /usr/share/fonts/opentype/ipafont-gothic
sudo cp /usr/share/fonts/ipa-gothic/ipag.ttf /usr/share/fonts/opentype/ipafont-gothic/
sudo cp /usr/share/fonts/ipa-pgothic/ipagp.ttf /usr/share/fonts/opentype/ipafont-gothic/
sudo mkdir -p /usr/share/fonts/opentype/ipafont-mincho
sudo cp /usr/share/fonts/ipa-mincho/ipam.ttf /usr/share/fonts/opentype/ipafont-mincho/
sudo cp /usr/share/fonts/ipa-pmincho/ipamp.ttf /usr/share/fonts/opentype/ipafont-mincho/
View dnd_crasher_notes.txt
renderer side
-> DragMsg_TargetDragLeave (browser -> renderer IPC)
----
-> RenderWidget::OnDragTargetDragLeave
-> WebFrameWidgetBase::dragTargetDragLeave
-> DragController::dragExited
on the browser side, the message is sent by RenderWidgetHostImpl::DragTargetDragLeave, which is referenced at
@pwnall
pwnall / fcc_nn_comment.txt
Created Jun 4, 2017
My comment on FCC's net neutrality proposal
View fcc_nn_comment.txt
Dear FCC,
I have a PhD in Computer Science from MIT and I've spent most of my professional life as a software engineer working on Web technology. I have lived the early years of my life in a Communist country, Romania, so I have some first-person experience with censorship and its impact on people.
Net neutrality is essential to healthy competition on the Web. This is not an ideological debate, it is a hard fact following from the many studies that showed minor increases in latency cause a website huge audience losses.
The existence of zero-rating deals demonstrates that ISPs will not hesitate to differentiate between sites in return for revenue. Giving them full power to do so will get us stuck with the status quo, which is a local optimum.
Imagine that, in the early 2000s, Microsoft and Yahoo could have inked deals with ISPs, to slow down Google and negate its speed advantage. The US economy would have lost the huge productivity boom that came from faster and better Web search, and Google might not hav
@pwnall
pwnall / yunmai_protocol.txt
Created Jan 29, 2017
Yunmai smart scale (M1301, M1302, M1303) Bluetooth LE protocol notes
View yunmai_protocol.txt
Yunmai smart scale (M1301, M1302, M1303) Bluetooth LE protocol notes
Commands are written to GATT attribute 0xffe9 of service 0xffe5. Responses come
as value change notifications for GATT attribute 0xffe4 of service 0xffe0. These
are 16-bit Bluetooth LE UUIDs, so nnnn is 0000nnnn-0000-1000-8000-00805F9B34FB.
-----
Packet Structure
View .vimrc
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
colorscheme default
" Add plugins installed in bundle/ to the runtime path.
call pathogen#infect()
set tabstop=2
set softtabstop=2
@pwnall
pwnall / crypto_vs_hat.coffee
Last active Mar 26, 2016
Comparing the performance of generating 32-bit and 53-bit random numbers using the hat package vs the node.js built-in crypto module
View crypto_vs_hat.coffee
crypto = require 'crypto'
hat = require 'hat'
hatRandom32 = -> +hat(32, 10)
cryptoRandom32 = ->
buffer = crypto.randomBytes(4)
buffer.readUInt32LE(0)
hatRandom53 = -> +hat(53, 10)
cryptoRandom53 = ->
@pwnall
pwnall / happy_birthday.macro
Created Dec 31, 2015
Macro for a BB-8 to dance to the Happy Birthday song.
View happy_birthday.macro
# Happy Birthday dear robots.
#
# Music: https://www.youtube.com/watch?v=4MpMOWldf1c
# Launch code: https://github.com/pwnall/node-sphero-pwn-cli
flag $brakeOnEnd :on
flag $exclusiveDrive :on
flag $markerOnEnd :on
flag $stopOnDisconnect :on
@pwnall
pwnall / rails_routing_format_bug.rb
Created Dec 22, 2015
Executable test case for rails 5.0 routing format bug
View rails_routing_format_bug.rb
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 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
You can’t perform that action at this time.