Skip to content

Instantly share code, notes, and snippets.

View gpoole's full-sized avatar

Greg Poole gpoole

  • Sydney, AU
View GitHub Profile
@gpoole
gpoole / .zshrc
Created April 4, 2020 04:00
sensible-zshrc with custom prompt
# Sensible, short .zshrc
# Gist page: git.io/vSBRk
# Raw file: curl -L git.io/sensible-zshrc
# GNU and BSD (macOS) ls flags aren't compatible
ls --version &>/dev/null
if [ $? -eq 0 ]; then
lsflags="--color --group-directories-first -F"
else
lsflags="-GF"
{
"dependencies": {
"com.thinksquirrel.fluviofx": "https://github.com/thinksquirrel/fluviofx.git#bug/2019-support",
"com.unity.ads": "2.0.8",
"com.unity.analytics": "3.3.2",
"com.unity.collab-proxy": "1.2.16",
"com.unity.package-manager-ui": "2.1.2",
"com.unity.purchasing": "2.0.6",
"com.unity.render-pipelines.high-definition": "5.7.2-preview",
"com.unity.textmeshpro": "2.0.1",
@gpoole
gpoole / encode-360-video.sh
Last active October 25, 2018 02:59
Encode 360 videos for Oculus Go
#!/bin/bash
ffmpeg -i $1 -vf scale=3840:2160,setdar=16:9 -c:v libx265 -preset slow -crf 28 -strict -2 -an $2
# Faster seeking:
# -x265-params "keyint=5:min-keyint=5"
@gpoole
gpoole / .gitignore
Last active July 8, 2019 01:17
Standard Unity gitignore
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Aa]ssets/AssetStoreTools*
QCAR/
# Visual Studio cache directory
@gpoole
gpoole / .gitattributes
Last active April 6, 2021 08:35
Standard Unity Git LFS include list
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
Get-ChildItem -Filter "*.mp4" | % { &ffmpeg -i $_ -c:v hap @([io.path]::ChangeExtension($_, "mov")) }
#!/usr/bin/env bash
# https://www.davidpashley.com/articles/writing-robust-shell-scripts/
set -ue
# Enable more complex glob patterns
shopt -s globstar
usage() {
echo "usage"
}

Hashing in node

  • Farmhash is really fast
  • sha1 is the fastest hash in crypto

Benchmarks

sha1 (crypto) x 222,654 ops/sec ±2.06% (79 runs sampled)
md5 (crypto) x 196,396 ops/sec ±1.82% (78 runs sampled)

Proxying Node apps with Charles

Setting up Charles to monitor outgoing Node app requests

// Enable the proxy for outgoing http requests made by this server (dev only)
if (process.env.APP_ENV === 'development' && process.env.http_proxy) {
  console.warn('http_proxy env variable is set, all outgoing requests will be proxied');
 globalTunnel.initialize();
@gpoole
gpoole / up-and-atom.sh
Last active May 26, 2017 03:08
Opens Atom from the terminal on the current OSX space/desktop (kwm/khd powered)
#!/bin/bash
# Note where we are
SPACE_ID=`kwmc query space active id`
# Open atom and wait a moment
atom .
sleep 1
# Bring Atom and us back to where we were