Skip to content

Instantly share code, notes, and snippets.

View vvuk's full-sized avatar

Vladimir Vukicevic vvuk

  • San Francisco, CA
View GitHub Profile
In the Twitter tab, open up the browser console (Menu -> Developer -> Web Console, Control-Shift-K on Windows).
Copy/paste the following into the console:
window.addEventListener("keypress", function(event) { event.stopPropagation(); }, true);
Enjoy unbroken Twitter Web UI.

Sensor data coming in from [GAME_]ROTATION_VECTOR is a quaternion with the following axes:

  • +X is Y dot Z (along the short axis for a rectangular phone, pointing right)
  • +Y tangential to the device's screen, pointing upwards (along the long axis for a rectangular phone)
  • +Z perpendicular to the device's screen, pointing outwards (towards the viewer when looking at a phone screen)

When the phone is held in "VR" orientation:

  • it is rotated 90 degrees around the Z axis (to get it to landscape mode)
  • it is rotated 90 degrees around the Y axis (to flip it upwards to be held directly in front of the eyes instead of flat)

The coordinate space that's desired when the phone is held in the VR orientation:

vladimir@shepherd[765]$ make
/mingw64/bin/python src/etc/dl-snapshot.py x86_64-pc-windows-gnu
running: PowerShell.exe /nologo -Command (New-Object System.Net.WebClient).DownloadFile('https://static.rust-lang.org/cargo-dist/2015-04-02/cargo-nightly-x86_64-pc-windows-gnu.tar.gz', 'target/dl/cargo-nightly-x86_64-pc-windows-gnu.tar.gz')
extracting cargo-nightly-x86_64-pc-windows-gnu
extracting cargo-nightly-x86_64-pc-windows-gnu/cargo
extracting cargo-nightly-x86_64-pc-windows-gnu/cargo/bin
extracting cargo-nightly-x86_64-pc-windows-gnu/cargo/bin/cargo.exe
extracting cargo-nightly-x86_64-pc-windows-gnu/cargo/etc
extracting cargo-nightly-x86_64-pc-windows-gnu/cargo/etc/bash_completion.d
extracting cargo-nightly-x86_64-pc-windows-gnu/cargo/etc/bash_completion.d/cargo
@vvuk
vvuk / test.rs
Created September 12, 2015 20:27
extern crate libc;
use std::marker::{Send, Sync};
use std::ptr;
struct OneStruct {
p: *mut libc::c_void,
}
struct TwoStruct {
platform\inprocess/mod.rs:115:68: 115:70 error: cannot move out of borrowed content
platform\inprocess/mod.rs:115 let send_ports: Vec<OpaqueMpscChannel> = ports.iter().map(|&x| OpaqueMpscChannel::new(x)).collect();
^~
platform\inprocess/mod.rs:115:69: 115:70 note: attempting to move value to here
platform\inprocess/mod.rs:115 let send_ports: Vec<OpaqueMpscChannel> = ports.iter().map(|&x| OpaqueMpscChannel::new(x)).collect();
^
platform\inprocess/mod.rs:115:69: 115:70 help: to prevent the move, use `ref x` or `ref mut x` to capture value by reference
platform\inprocess/mod.rs:171:24: 171:28 error: cannot move out of borrowed content
platform\inprocess/mod.rs:171 let receiver = self.receiver.into_inner();
^~~~
@vvuk
vvuk / foo.rs
Created September 18, 2015 16:45
pub struct MpscReceiverSet{
select: mpsc::Select,
handles: Vec<mpsc::Handle<mpsc::Receiver<MpscChannelMessage>>>,
receivers: Vec<MpscReceiver>,
}
impl MpscReceiverSet {
pub fn new() -> Result<MpscReceiverSet,MpscError> {
Ok(MpscReceiverSet {
select: mpsc::Select::new(),
@vvuk
vvuk / foo.rs
Created September 18, 2015 17:35
pub struct MpscReceiverSet {
receivers: Vec<MpscReceiver>,
}
impl MpscReceiverSet {
pub fn new() -> Result<MpscReceiverSet,MpscError> {
Ok(MpscReceiverSet {
receivers: vec![],
})
}

Count the buckets, in two different date ranges (corresponding to the time periods when 44 was in beta, and current release)

$ node bucket-count.js -o 20151214-20160125-counts.json 2015-12-14:2016-01-25
$ node bucket-count.js -o 20160125-20160224-counts.json 2016-01-25:2016-02-24

Make a weights.json file for mapping release population to beta. We don't filter on release version anywhere here, since we care just about the population (though we could filter for more potential accuracy).

$ node weight.js 20160125-20160224-counts.json release 20151214-20160125-counts.json beta weights.json
First do counts for the two date ranges
$ node bucket-count.js -o 20150112-20150223-counts.js 2015-01-12:2015-02-23
$ node bucket-count.js -o 20150224-20150331-counts.js 2015-02-24:2015-03-31
Then create the beta-as-release weights. The numbers are mean "We have .13x as many linux users on release channel as we do on beta".
$ node weight.js 20150112-20150223-counts.js beta 20150224-20150331-counts.js release beta-release-weights.json
0.130 Linux
0.212 Mac OS X
1.531 Windows XP, Single Intel GPU
@vvuk
vvuk / broken.txt
Created August 7, 2016 20:42
Broken link
"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\amd64\\link.exe"
"/LIBPATH:C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\amd64"
"/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.10586.0\\ucrt\\x64"
"/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.10586.0\\um\\x64"
"/NOLOGO"
"/NXCOMPAT"
"/LIBPATH:C:\\rust\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib"
"C:\\projects\\rust-mozjs\\target\\debug\\stack_limit-922c7c41650bafe5.0.o"
"/OUT:C:\\projects\\rust-mozjs\\target\\debug\\stack_limit-922c7c41650bafe5.exe"
"/OPT:REF,ICF"