Skip to content

Instantly share code, notes, and snippets.

View Spaxe's full-sized avatar
🏹

Xavier Ho Spaxe

🏹
View GitHub Profile
@Spaxe
Spaxe / compression_encryption.py
Created March 22, 2017 13:00
compression + encryption (2015)
#!/usr/bin/env python3
import gzip
import simplecrypt
def compress_and_encrypt(sample, secret):
print('sample:', sample)
sample_bytes = sample.encode('utf-8')
print('sample_bytes:', sample_bytes)
compressed = gzip.compress(sample_bytes)
print('compressed:', compressed)
@Spaxe
Spaxe / display-cache.js
Created February 6, 2017 05:20
Display all images from cache
// From http://stackoverflow.com/questions/5876805/view-google-chromes-cached-pictures
var cached_anchors = $$('a');
for (var i in cached_anchors) {
var ca = cached_anchors[i];
if(ca.href.search('sprite') < 0 && ca.href.search('.png') > -1 || ca.href.search('.gif') > -1 || ca.href.search('.jpg') > -1) {
var a = document.createElement('a');
a.href = ca.innerHTML;
a.target = '_blank';
@Spaxe
Spaxe / style.css
Created November 29, 2016 04:36
Twine Stylesheet
body {
/* Master background picture */
background-image: url('assets/beach.png');
background-size: cover;
/* Typography */
font: 16px Georgia, Serif;
color: black;
}
// Used to generate Texture Array asset
// Menu button is available in GameObject > Create Texture Array
// See CHANGEME in the file
using UnityEngine;
using UnityEditor;
public class TextureArray : MonoBehaviour {
[MenuItem("GameObject/Create Texture Array")]
static void Create()
@Spaxe
Spaxe / proposal.md
Created June 23, 2016 00:19
GCAP16 talk proposal draft

Session Description

Physics is common in video games, but hard to code for beginners.

Learn about velocity, forces and acceleration. Emulate gravity, wind and magnets with mass. Control time as discrete steps. Overcome common pitfalls like irregular update cycles and overshooting. Bring realism to your game with motion drag, surface friction, and elasticity.

Sometimes plugging in a physics engine is not enough. Engines are often fixed in functionality. You will learn the foundation of mechanical physics, and that knowledge will help you extending the wildest physics feature you can add to your games.

This talk will be most educational for the audience interested in learning more about physics programming, games developers, or anyone generally curious about how it works.

ERROR in ./src/app.js
Module build failed: ReferenceError: Unknown plugin "transform-flow-comments" specified in "base" at 0, attempted to resolve relative to "/Users/spaxe/dev/3d-model-viewer/src"
at /Users/spaxe/dev/3d-model-viewer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:179:17
at Array.map (native)
at Function.normalisePlugins (/Users/spaxe/dev/3d-model-viewer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:155:20)
at OptionManager.mergeOptions (/Users/spaxe/dev/3d-model-viewer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:277:36)
at OptionManager.init (/Users/spaxe/dev/3d-model-viewer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:465:10)
at File.initOptions (/Users/spaxe/dev/3d-model-viewer/node_modules/babel-core/lib/transformation/file/index.js:194:75)
at new File (/Users/spaxe/dev/3d-model-viewer/node_modules/babel-core/lib/transformation/file/index.js:123:22)
$ pip install rasterio --upgrade
Collecting rasterio
Downloading rasterio-0.33.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (19.3MB)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 19.3MB 74kB/s
Requirement already up-to-date: snuggs in /usr/local/lib/python2.7/site-packages/snuggs-1.3.1-py2.7.egg (from rasterio)
Requirement already up-to-date: enum34 in /usr/local/lib/python2.7/site-packages/enum34-1.1.2-py2.7.egg (from rasterio)
Requirement already up-to-date: click-plugins in /usr/local/lib/python2.7/site-packages/click_plugins-1.0.3-py2.7.egg (from rasterio)
Collecting numpy (from rasterio)
Downloading numpy-1.11.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.9MB)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 3.9MB 374kB/s
./check-code.sh
+ pep8 tests integration_tests --max-line-length 120
+ pylint -j 2 --reports no datacube examples/band_stats.py
+ py.test -r sx --cov datacube --durations=5 datacube examples tests
============================================ test session starts ============================================
platform darwin -- Python 2.7.11, pytest-2.9.0, py-1.4.31, pluggy-0.3.1
rootdir: /Users/ho03b/dev/agdc-v2, inifile: pytest.ini
plugins: cov-2.2.1
collected 98 items