Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Fix Broken cmake files for llvm-3.5-dev
# See : https://bugs.launchpad.net/ubuntu/+source/llvm/+bug/1387011
target='/usr/share/llvm-3.5/cmake/LLVMConfig.cmake'
sudo patch --backup $target <<HEREDOC
--- original
@grodtron
grodtron / i2c_accelerometer.py
Created February 10, 2013 20:52
Test of i2c accelerometer + raspberry pi
#!/usr/bin/python
import smbus
import time
# Plot a graph of the z-axis acceleration using a Raspberry Pi connected
# to one of these: http://www.pololu.com/catalog/product/1250
# Datasheet: http://www.pololu.com/file/download/LSM303DLH.pdf?file_id=0J433
def main():
@grodtron
grodtron / range.sql
Created January 15, 2013 04:09
MySQL Trick to fairly quickly generate a range of numbers. I thought it was cool :)
DROP DATABASE IF EXISTS range_test;
CREATE DATABASE range_test;
USE range_test;
CREATE TABLE bools (
v BOOLEAN
);
INSERT INTO bools (v) VALUES (0), (1);
@grodtron
grodtron / .gitignore
Created November 14, 2012 00:20
Simple calculator program to demonstrate the command pattern in cpp
*.o
*.swp
*.swo
*.zip
test
@grodtron
grodtron / .gitignore
Created November 14, 2012 00:10
Simple calculator program to demonstrate the factory pattern in cpp
*.swp
*.swo
*.o
test
@grodtron
grodtron / ParallelMergeSort.java
Created September 23, 2012 16:04
Parallel and serial merge sort
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Comparator;
import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@grodtron
grodtron / .gitignore
Created August 7, 2012 21:43
An AVL tree implementation
tree
*.o
*.swp
@grodtron
grodtron / timer.cpp
Created August 7, 2012 17:03
A cpp timer class that provides nanosecond resolution
/*
* A class that provides a simple timer
* Works in Windows and Linux, resolution is hardware dependant
*
*
* Copyleft Gordon Bailey 2012 - All wrongs reserved
*
* */
#include "timer.h"
@grodtron
grodtron / .gitignore
Created July 23, 2012 04:49
Semi-golfed sorting algorithms
*.swp
*.o
sort
Makefile
@grodtron
grodtron / .gitignore
Created July 20, 2012 23:13
Simple implementation of a stack and Quicksort on that stack
Debug*
Stack.vcxproj*