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 / code.js
Last active April 9, 2023 08:04
DOM manipulation and Fetch API
async function asyncSleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
async function onSearchClick(event) {
const cityNameInput = document.getElementById('city-name');
const cityName = cityNameInput.value;
PackageManager packageManager = getActivity().getPackageManager();
List<ApplicationInfo> applicationInfos =
Log.e("ConfirmImportantSitesDialogFragment", applicationInfos.toString());
for (ApplicationInfo applicationInfo : applicationInfos) {
// Log.e("ConfirmImportantSitesDialogFragment",
// "ComponentFactory: " + applicationInfo.appComponentFactory);
"ClassName: " + applicationInfo.className);
pwnall / rmdb.js
Created March 14, 2018 23:08
Workaround for OOM when deleting a large IndexedDB database
// 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 =;
request.onsuccess = () => { resolve(request.result); };
request.onerror = () => { reject(request.error); };
pwnall /
Last active February 26, 2024 19:11
Get the fonts needed by Chromium's LayoutTests on Fedora Linux
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/
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 / fcc_nn_comment.txt
Created June 4, 2017 01:04
My comment on FCC's net neutrality proposal
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 / yunmai_protocol.txt
Created January 29, 2017 11:38
Yunmai smart scale (M1301, M1302, M1303) Bluetooth LE protocol notes
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
pwnall / .vimrc
Created March 31, 2016 01:10
My .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 /
Last active March 26, 2016 05:37
Comparing the performance of generating 32-bit and 53-bit random numbers using the hat package vs the node.js built-in crypto module
crypto = require 'crypto'
hat = require 'hat'
hatRandom32 = -> +hat(32, 10)
cryptoRandom32 = ->
buffer = crypto.randomBytes(4)
hatRandom53 = -> +hat(53, 10)
cryptoRandom53 = ->
pwnall / happy_birthday.macro
Created December 31, 2015 03:30
Macro for a BB-8 to dance to the Happy Birthday song.
# Happy Birthday dear robots.
# Music:
# Launch code:
flag $brakeOnEnd :on
flag $exclusiveDrive :on
flag $markerOnEnd :on
flag $stopOnDisconnect :on