Skip to content

Instantly share code, notes, and snippets.

💭
🐝 Bzz!

Christopher Robert Van Wiemeersch cvan

View GitHub Profile
@cvan
cvan / adb-shell-getprop.js
Created Apr 16, 2019
output `adb shell getprop` to a file
View adb-shell-getprop.js
adb shell getprop > props__$(date +%F_%T).ini
@cvan
cvan / vimeo-add-video-to-channel.js
Last active Apr 16, 2019
automatically add a Vimeo video to your Vimeo channel playlist (JavaScript browser code snippet)
View vimeo-add-video-to-channel.js
// 1. Ensure you are signed in (if not, visit https://vimeo.com/log_in).
// 2. Set `VIMEO_CHANNEL_ID` below to the channel ID corresponding to the channel you want to add the video to.
// The channel ID appears at the end of the channel URL (e.g., https://vimeo.com/channels/1434599).
// See the other script for a snippet to run to navigate to your list of channels.
// 3. If you're logged in, from a video page on Vimeo, enter this in the Console from your browser's Dev Tools:
VIMEO_CHANNEL_ID = 1434599; document.querySelector('.collections-button').click(); setTimeout(() => { document.querySelector(`input[id="${VIMEO_CHANNEL_ID}"]`).checked = true; }, 500); window.close();
@cvan
cvan / webvr-moonrise-history.md
Last active Apr 9, 2019
WebVR History: Project Moonrise (by @caseyyee and @cvan; Mozilla, 2017)
View webvr-moonrise-history.md

Using Myk Melez's qbrt project, @cvan's maintained a forked branch, vr, as the foundation for building a standalone, self-contained executable of Desktop Firefox w/ enabled-by-default WebVR Support.

Done in March – April 2017 at Mozilla in the Mixed Reality program, this experiment was led by @cvan and @caseyyee, codenamed Moonrise.

image

  • Moonrise could generate Windows, macOS, and Linux releases of a wrapper program of this branch of qbrt.
  • Moonrise's default start page was a WebVR-powered Lobby experience
  • Moonrise could connect to a user's Steam account (if the user was already locally authenticated in the Steam app, Steam's user-management APIs worked witho
@cvan
cvan / gh-latest-releases.js
Last active Apr 8, 2019
GitHub Releases: Get list of URLs to download (w/ grouping and filtering by filename patterns + platform/architecture)
View gh-latest-releases.js
// Source: https://gist.github.com/cvan/d37e7d78ce114ba15e3736af18acfdac
// Author: CVAN <https://cvan.io>
const fs = require('fs');
const os = require('os');
const path = require('path');
// Source: https://gist.github.com/cvan/ef28f73b88b991d4a9705314b2af2e78#file-system-js
// Author: CVAN <https://cvan.io>
// Useful helper snippet for understanding the capabilities of a user's system from Node.js' built-in `process.arch` and `process.platform`.
const system = {
@cvan
cvan / help.js
Last active Apr 8, 2019
[Node.js] get Operating-System Platform (Windows, macOS, Linux) and Architecture (x32, x64, etc.) (without any third-party npm dependencies)
View help.js
const os = require('os');
// See docs: https://nodejs.org/api/os.html
const usage = {};
usage[`require('os').type()`] = {
value: os.type(),
otherValues: [
'Linux', 'Darwin', 'Windows_NT'
],
@cvan
cvan / downloader.js
Last active Apr 8, 2019
download URLs to disk (without any third-party npm dependencies)
View downloader.js
// Source: https://gist.github.com/cvan/da899090fa6c38f87dacbef95ea5d785#file-downloader-js
// Author: CVAN <https://cvan.io>
const fs = require('fs');
const http = require('http');
const https = require('https');
const path = require('path');
const URL = require('url');
const utils = {};
utils.getSafeTimestamp = () => new Date().toISOString().slice(0, 23).replace(/:/g, '.');
@cvan
cvan / get-truthy-querystring.js
Last active Apr 5, 2019
get truthy value from key from `URLSearchParams`
View get-truthy-querystring.js
const qs = new URLSearchParams(window.location.search);
function getTruthyQS (key) {
if (!qs || !qs.has(key)) {
return false;
}
const valueLower = (qs.get('key') || '').trim().toLowerCase();
return valueLower === '' || valueLower === '1' || valueLower === 'true' || valueLower === 'yes' || valueLower === 'on';
}
View fix-youtube-vq.js
//(function () {
// const
playerEl = document.getElementById('movie_player');
if (!playerEl) {
return;
}
// const
YOUTUBE_QUALITY_SIZES = [4320, 2880, 2160, 1440, 1080, 720, 480, 360, 240, 144];
// const
@cvan
cvan / youtube-force-quality.md
Last active Mar 30, 2019
Force video quality with YouTube (notes for Firefox Reality)
View youtube-force-quality.md

Forcing a better default playback quality of YouTube videos

If a user is browsing videos on YouTube.com from a web browser on a higher-end device (e.g., VR headsets), the user has to manually override the playback quality of a video through the playback-controls bar at the bottom of the video: Settings > Quality.


Forcing a different playback quality of a YouTube video

  1. Load a YouTube video. Example: https://www.youtube.com/watch?v=ELU-43DMNT4
  2. Then paste some of this code in the DevTools' Console.
  3. You'll notice the quality changes to the highest available for the video.
@cvan
cvan / firefox-reality-screenshot-burst.sh
Created Mar 19, 2019
capture a sequence of screenshots while Firefox Reality launches
View firefox-reality-screenshot-burst.sh
# Stop FxR.
adb shell am force-stop org.mozilla.vrbrowser
# Launch FxR.
adb shell am start -a android.intent.action.VIEW -n org.mozilla.vrbrowser/org.mozilla.vrbrowser.VRBrowserActivity
# Capture a bunch of screenshots so we can be sure that we get the frame we want.
for i in `seq 1 20`; do (adb exec-out screencap -p > /opt/mozillareality/fxr-screen-saves/screenshots/$(date +%F_%T)_$(LC_CTYPE=C tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= < /dev/urandom | head -c 32 | xargs).png); done
You can’t perform that action at this time.