Skip to content

Instantly share code, notes, and snippets.

View cvan's full-sized avatar
🚌
🌊

Christopher Van Wiemeersch cvan

🚌
🌊
View GitHub Profile
@cvan
cvan / vimeo-spa-hijack-link-clicks.js
Created May 21, 2019 01:59
Vimeo.com script: hijack SPA links to do synchronous page loads (instead of single-page-app URL routing)
@cvan
cvan / oculusvr-video-setup.sh
Last active September 6, 2022 13:54
`adb` commands to call for capturing high-res videos on Oculus VR headsets
#!/bin/sh
# `adb` commands to call for capturing high-res videos on Oculus VR headsets
#
# Usage:
#
# curl https://gist.githubusercontent.com/cvan/54535a41db8a67d0370971f6e393675d/raw/c2183adf4bf0e85edc422a13599eba54e62ee473/video-setprop.sh > /tmp/oculusvr-video-setup.sh
# chmod +x /tmp/oculusvr-video-setup.sh
# ./tmp/oculusvr-video-setup.sh
#
@cvan
cvan / qsutils.js
Last active May 13, 2019 17:16
QSUtils: a query-string utility for browser/client-side JavaScript. supports case-insensitive, truthy, typed values, defaults. (demo: https://qsutils.glitch.me/)
/**
* QSUtils: a query-string utility for browser/client-side JavaScript.
*
* supports case-insensitive, truthy, typed values, defaults.
*
* demo: https://qsutils.glitch.me/
*/
class QSUtils {
constructor () {
this.qs = new URLSearchParams(window.location.search);
@cvan
cvan / adb-shell-getprop.js
Created April 16, 2019 03:34
output `adb shell getprop` to a file
adb shell getprop > props__$(date +%F_%T).ini
@cvan
cvan / vimeo-add-video-to-channel.js
Last active April 16, 2019 02:52
automatically add a Vimeo video to your Vimeo channel playlist (JavaScript browser code snippet)
// 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 April 9, 2019 10:25
WebVR History: Project Moonrise (by @caseyyee and @cvan; Mozilla, 2017)

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 April 8, 2019 10:12
GitHub Releases: Get list of URLs to download (w/ grouping and filtering by filename patterns + platform/architecture)
// 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 October 23, 2023 04:10
[Node.js] get Operating-System Platform (Windows, macOS, Linux) and Architecture (x32, x64, etc.) (without any third-party npm dependencies)
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 April 8, 2019 10:11
download URLs to disk (without any third-party npm dependencies)
// 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 April 5, 2019 19:12
get truthy value from key from `URLSearchParams`
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';
}