Skip to content

Instantly share code, notes, and snippets.

View matutter's full-sized avatar

Mat Utter matutter

View GitHub Profile
@matutter
matutter / setupRoR.sh
Last active August 29, 2015 14:08
Setup RoR
echo '--> Run me with sudo privileges'
echo '--> If an error about a signature occurs add the key holder in the error'
apt-get update
apt-get install curl
\curl -L https://get.rvm.io | bash -s stable --rails
source ~/.rvm/scripts/rvm
rvm install ruby-2.1.4
rvm use ruby-2.1.4
rails new sample
#include <stdio.h>
#include <stdlib.h>
int populate( char word_array[40][15] )
{
FILE *words;
int end;
/* open the file */
@matutter
matutter / termios.h
Last active August 29, 2015 14:09
terminal emulator... in a terminal?
#include <iostream>
#include <unistd.h>
#include <termios.h>
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
@matutter
matutter / queues.cpp
Created November 11, 2014 21:41
using queues
#include <iostream>
#include <queue>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
using namespace std;
int main(int argc, char const *argv[])
@matutter
matutter / dfaMinimizer.cpp
Last active August 29, 2015 14:10
Minimal DFA.cpp computes minimal DFA by partition factoring.
/*
This is computationally terrible and resource abusive...
I just did this to finish some homework for me.
*/
#include <iostream>
#include "dfaMinimizer.hpp"
#include <vector>
#include <map>
@matutter
matutter / fft.md
Last active August 29, 2015 14:10
FFT polynomial multiplication walk through

given 'n' polynomials to mupliply,
3+x 2x^2+2

take the first polynomials coefficients,
3+x --> 3, 1

add enough slack coefficients n^2,
3, 1 --> 3, 1, 0, 0 indexed 0 1 2 3

@matutter
matutter / fastFib.at2
Created December 6, 2014 07:41
ATROBOTS fastest Fibonacci
#def N
#def F
#def I
#def FP
#def TMP
mov N 20
;non recursive fib
!fib
cmp N 1
@matutter
matutter / JCommand.hpp
Created December 24, 2014 18:34
C++ UDP Json tryParse object
/*
from: https://github.com/matutter/AirRocks-FlightController
JCommand -
SHOULD be the main JSON parsing type
WILL be exception safe
boost causes hangs and weird assemlber errors, v8 embedding is worse...
i NEED c++11 support... next time its going to be an Intel Edison
*/
#ifndef JSON_COMMAND_T
@matutter
matutter / cpuTimer.cpp
Last active August 29, 2015 14:12
CPU speed, requires c++11 or c++0x
#include <chrono>
#include <iostream>
#include <unistd.h>
class Timer {
private:
static inline unsigned long long CPUCycleCounter(void) {
unsigned long long int x;
__asm__ volatile (".byte 0x0F, 0x31" : "=A" (x));
@matutter
matutter / PureJavaJarExtract.java
Created June 2, 2015 02:19
Extract resources from a jar from jar
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication23;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;