Skip to content

Instantly share code, notes, and snippets.

@m0tive
m0tive / .gitconfig
Created September 6, 2016 14:24
git fresh-checkout
[alias]
tracked = "!f(){ git rev-parse --symbolic-full-name --abbrev-ref $1@{u}; }; f"
fresh-checkout = "!f(){ B=$1; T=$(git tracked $B) R=$(git rev-parse $B); git branch -D $B && git checkout -b $B $T && git cherry-pick $T..$R; }; f"
#!/bin/bash
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@m0tive
m0tive / core.lua
Created November 18, 2015 18:27
Wrap the lua core methods so you don't overwrite them
do
local lua = {}
local core = setmetatable({}, { __index = lua, })
_G = setmetatable(_G, { __index = core })
for k,v in pairs(_G) do
if k ~= "_G" then
lua[k] = v
@m0tive
m0tive / gist:37e8ec0aae962af359f7
Created April 10, 2015 11:56
array and hash for lua
-- I haven't tested these, they probably don't work
local object = {
type = function(self) return getmetatable(self).__index end,
}
local hash = {
data = function(self) return getmetatable(self).data end,
set = function(self, key, value) rawset(self.data, key, value) end,
@m0tive
m0tive / gist:1884821
Created February 22, 2012 12:33
export google history
require 'mechanize'
require 'logger'
require 'date'
## Call:
## $ ruby export.rb <gmail> <password>
caFile = File.join(File.dirname(__FILE__), 'cacert.pem')
if not File.exists? caFile
require 'net/http'
class Transform
{
public:
calcMatrix(); // builds a matrix from m_T and m_R
setFromMatrix(const Matrix& mat); // sets m_T and m_R
getRotation();
setRotation(const Quat& r);
getTranslation();