Skip to content

Instantly share code, notes, and snippets.

View RustingSword's full-sized avatar
🤦‍♂️

RustingSword

🤦‍♂️
View GitHub Profile
#!/usr/bin/python2
#! coding: utf-8
class QuadTree(object):
"""An implementation of a quad-tree.
 
This QuadTree started life as a version of [1] but found a life of its own
when I realised it wasn't doing what I needed. It is intended for static
geometry, ie, items such as the landscape that don't move.
 
#!/usr/bin/env python
#
# Copyright 2008-2014 Jose Fonseca
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@RustingSword
RustingSword / plotpath.py
Created January 17, 2014 02:37
plot dtw path between two trajectories
#!/usr/bin/python
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import sys
mpl.rcParams['legend.fontsize'] = 10
fig = plt.figure()
@RustingSword
RustingSword / pass.py
Created December 27, 2013 09:10
possible gesture password
possible = {1 : [2,4,5,6,8],
2 : [1,3,4,5,6,7,9],
3 : [2,4,5,6,8],
4 : [1,2,3,5,7,8,9],
5 : [1,2,3,4,6,7,8,9],
6 : [1,2,3,5,7,8,9],
7 : [2,4,5,6,8],
8 : [1,3,4,5,6,7,9],
9 : [2,4,5,6,8]}
@RustingSword
RustingSword / config
Created December 1, 2013 06:47
moc configuration files
Theme = transparent-background
ReadTags = no
Keymap = keymap
Autonext = yes
AlsaMixer1 = Master
AlsaMixer2 = PCM
PlaylistFullPaths = no
#include <stdio.h>
//assumes little endian
void printBits(size_t const size, void const * const ptr)
{
unsigned char *b = (unsigned char*) ptr;
unsigned char byte;
int i, j;
for (i=size-1;i>=0;i--)
{
!---------------------------
!Xft
!---------------------------
Xft.dpi: 96
Xft.antialias: true
Xft.hinting: true
Xft.hintstyle: hintfull
!---------------------------
!URxvt
@RustingSword
RustingSword / Makefile
Created November 9, 2013 15:31
a simple makefile for single latex document using rubber
TARGET = result.pdf
PDF_VIEWER = okular
.PHONY: all clean distclean
all: $(TARGET)
%.pdf: %.tex
rubber -f --pdf -m xelatex $<
rubber-info --check $<
@RustingSword
RustingSword / gen_tra.py
Created November 7, 2013 13:54
toy script to generate 10 groups of random trajectory
#!/usr/bin/env python2
from random import randint, uniform, choice
directions = [[1, 1, 1, -1], [-1, 1]]
filelist = open('newlist', 'w')
filelist.write(str(110)+'\n')
for i in range(10):
x_direction = []
y_direction = []
coin = choice([0, 1])
#include "bitmap.h"
void set_bitmap(bitmap_t b, int i)
{
b[i/8] |= 1 << (i & 7);
}
void unset_bitmap(bitmap_t b, int i)
{
b[i/8] &= ~(1 << (i & 7));