Skip to content

Instantly share code, notes, and snippets.

View hamaluik's full-sized avatar
👋
I may be slow to respond.

Kenton Hamaluik hamaluik

👋
I may be slow to respond.
View GitHub Profile
@hamaluik
hamaluik / flatshaded_frag.glsl
Created August 13, 2015 07:01
Flatshading GLSL Example
#extension GL_OES_standard_derivatives : enable
precision highp float;
precision highp int;
varying vec3 vViewPos;
vec3 normals_1_0(vec3 pos) {
vec3 fdx = dFdx(pos);
vec3 fdy = dFdy(pos);
return normalize(cross(fdx, fdy));
@hamaluik
hamaluik / .gitconfig
Created October 8, 2015 17:42
GIt config aliases
[alias]
history = log --pretty=format:'%C(cyan)%h%Cred%d %Creset%s%Cgreen [%cn] %C(blue)(%cr)' --decorate
@hamaluik
hamaluik / tusk post-commit
Last active October 16, 2015 23:52
Git hook for updating the version file
#!/bin/sh
# find node
NODE=$(which node)
# get the latest commit
COMMIT=$(git rev-parse HEAD)
# if it cannot find a node installation
if [[ -z $NODE ]]; then
#!/bin/sh
# make sure the behaviour works
haxe test.hxml
exit
@hamaluik
hamaluik / minify.js
Created October 27, 2015 01:36
Flow hook to minify the resulting javascript code (stores it in {{app.name}}.min.js).
// ./hooks/minify.js
var UglifyJS = require("uglify-js"); // run "npm install uglify-js" in the hooks directory first!
var fs = require('fs');
exports.hook = function(flow, done) {
var basePath = flow.project.project.app.output + '/web/' + flow.project.project.app.name;
var result = UglifyJS.minify(basePath + '.js', {
mangle: true // set to false if you run into issues
});
fs.writeFile(basePath + '.min.js', result.code, function(err) {
@hamaluik
hamaluik / qaxisangle.m
Created November 6, 2015 22:30
Matlab Quaternion Functions
function [ result ] = qaxisangle( axis, ang )
%QAXISANGLE Generates a quaternion which rotates by ang around axis
% some helpers
c = cos(ang / 2);
s = sin(ang / 2);
axis = axis ./ norm(axis);
result = [
c,
@hamaluik
hamaluik / PID.cs
Last active November 19, 2015 16:51
class PID
{
public double KP { get; set; }
public double KI { get; set; }
public double KD { get; set; }
public double SetPoint { get; set; }
public double MinSet { get; set; }
public double MaxSet { get; set; }
@hamaluik
hamaluik / snowkit.sh
Last active December 7, 2015 06:28
Setup snowkit
#!/bin/sh
haxelib git flow https://github.com/underscorediscovery/flow.git
haxelib git snow https://github.com/underscorediscovery/snow.git
haxelib git luxe https://github.com/underscorediscovery/luxe.git
haxelib git mint https://github.com/underscorediscovery/mint.git
wget http://build.luxeengine.com/snow/latest.all.zip
function [ varargout ] = trimzeros( varargin )
%TRIMZEROS Removes trailing "zero" datapoints from the input vectors
% At the end of the `emg` array are expected to be a series of 0.0 values which
% cause problems for data analysis. This function will remove those zeros from the
% input columns. Call this function using either:
% >> [ t, emg ] = trimzeros(t, emg);
% or:
% >> [ t, emg, force ] = trimzeros(t, emg, force);
if (nargin < 2) || (nargin > 3)
[alias]
ls = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
plog = log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
tlog = log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative
fuck = reset HEAD --hard
yolo = push -f
news = log -p @{1}..
d = diff -c HEAD
cleanup = !git clean -i -x -d -e "TAGS" -e 'tags' ; git fetch -p