This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://trac.ffmpeg.org/wiki/Encode/VP9 | |
# Converts video file to webm using two-pass encoding | |
# Installation on Mac: add script to /usr/local/bin | |
# Usage: | |
# webm ./path/to/video.mp4 | |
# Outputs ./path/to/video.mp4.webm | |
# Max size is 720 pixels wide. Change -vf scale to adjust |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec4 getLutColor(vec2 rg, float sliceNo, std::Texture2d colorLutTex, vec2 gridSize) { | |
vec2 pixelSize = 1.0 / colorLutTex.size; | |
vec2 scale = 1.0 / gridSize; | |
float row = floor(sliceNo * scale.x); | |
float col = sliceNo - row * gridSize.x; // mod(sliceNo, gridSize.x); | |
vec2 colorLutCoords = (vec2(col, row) + rg) * scale; | |
// offset by 0.5 pixel and fit within range [0.5px, width-0.5px] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# export all arproj found in sub directories. e.g. you want to export several projects in one folder | |
for i in */*.arproj | |
do | |
echo "============================" | |
/Applications/Spark\ AR\ Studio/Spark\ AR\ Studio.app/Contents/MacOS/sparkTerminalAppleMac export "$i" -d ./ | |
echo "============================" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Batch encode webm files in a directory | |
for i in *.webm; | |
do | |
ffmpeg -y -i $i -b:v 0 -crf 30 -pass 1 -an -f webm /dev/null | |
ffmpeg -y -i $i -vf scale=640:640:force_original_aspect_ratio=decrease -b:v 0 -crf 30 -pass 2 "_${i}" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const R = require('Reactive') | |
const Patches = require('Patches') | |
const Animation = require('Animation') | |
let frame = 0 | |
const td = Animation.timeDriver({durationMilliseconds: 1, loopCount: Infinity, mirror: false}) | |
td.onAfterIteration().subscribe(() => { | |
frame ++ | |
Patches.inputs.setScalar('currentFrame', frame) | |
Patches.inputs.setPulse('frame', R.once()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# This command converts audio according to the specifications listed in the Spark docs: | |
# https://sparkar.facebook.com/ar-studio/learn/documentation/docs/audio | |
# mono m4a, 44.1kHz sample rate, 16-bit-depth resolution | |
# Usage: | |
# convert-audio.sh myaudio.mp3 converted.m4a | |
# Notes: | |
# Always use m4a for output file type | |
# Change "64k" to a higher value to improve bitrate/quality. e.g. 96k 128k 192k |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Resize plane to match screen size | |
*/ | |
const Scene = require('Scene') | |
const camera = Scene.root.find('Camera') | |
const plane = Scene.root.find('plane0') | |
plane.width = camera.focalPlane.width | |
plane.height = camera.focalPlane.height |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The client lib for the generator will override some browser methods in order to | |
generate video or gifs of the page that it runs on. This guarantees that frames | |
won't be dropped, and the framerate will be consistent. | |
Global method overrides | |
- setTimeout | |
- setInterval | |
- requestAnimationFrame | |
Set currentTime of videos | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A simple script to backup an organization's GitHub repositories. | |
# NOTE: if you have more than 100 repositories, you'll need to step thru the list of repos | |
# returned by GitHub one page at a time, as described at https://gist.github.com/darktim/5582423 | |
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files | |
GHBU_ORG=${GHBU_ORG-"<REPLACE_ME>"} # the GitHub organization whose repos will be backed up | |
# (if you're backing up a user's repos instead, this should be your GitHub username) | |
GHBU_UNAME=${GHBU_UNAME-"<REPLACE_ME>"} # the username of a GitHub account (to use with the GitHub API) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "ShadowShader" { | |
Properties{ | |
_Color("Main Color", Color) = (1,1,1,1) | |
_MainTex("Base (RGB)", 2D) = "white" {} | |
_Cutoff("Cutout", Range(0,1)) = 1.0 | |
} | |
SubShader{ | |
Pass{ | |
Alphatest Greater[_Cutoff] SetTexture[_MainTex] |