This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To begin with, the wikipedia left recursion algorithm is much eaiser to read: http://en.wikipedia.org/wiki/Left_recursion#Removing_indirect_left_recursion | |
So, we have the non-terminals A_1, and A_2: | |
A_1 -> A_2a | b | |
A_2 -> A_1c | ab | |
let's step through the algorithm: | |
i = 1 | |
j = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b64_char conv_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\\="; | |
//returns a base 64 string (malloc allocated) | |
b64_string ascii_to_base_64(ascii_string as, int ascii_char_count) | |
{ | |
//find how many ascii blocks of 3 we have (rounded up) | |
int three_blocks_in = (ascii_char_count/3)+(ascii_char_count%3?1:0); | |
//from that, how many base 64 blocks? | |
int characters_out = three_blocks_in*4; | |
//allocate b64 space | |
b64_string out_string = malloc(sizeof(b64_char)*(characters_out+1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
//just a quick method to print the thresholds of each of the "roulette cells" | |
void print_thresholds(float* random_inputs, int input_len) | |
{ | |
float p_acc=0; | |
for (int i = 0; i < input_len; ++i) | |
{ | |
printf("I:%2d L: %3f H: %3f\n",i,p_acc, p_acc+random_inputs[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CPP_FILES = $(wildcard *.markdown) | |
OBJ_FILES = $(patsubst %.markdown,%.pdf,$(CPP_FILES)) | |
%.pdf: %.markdown | |
pandoc -V geometry:margin=1in -S -o $@ $(patsubst %.pdf,%.markdown,$@) | |
all: $(OBJ_FILES) | |
clean: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct Tuple2 | |
{ | |
int a; | |
int b; | |
} Tuple2; | |
// array lengths | |
int sparseLength; | |
int denseLength; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.stats import t | |
import math | |
# Method from "Intuitive Biostatistics" pp. 285-286 | |
# | |
#@book{harvey1995intuitive, | |
# title={Intuitive Biostatistics}, | |
# author={Harvey Motulsky}, | |
# isbn={9780195086072}, | |
# lccn={95008166}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
module Main where | |
data Expr a where | |
N :: Float -> Expr Float | |
(:+) :: Expr Float -> Expr Float -> Expr Float | |
(:*) :: Expr Float -> Expr Float -> Expr Float | |
(:-) :: Expr Float -> Expr Float -> Expr Float | |
(:/) :: Expr Float -> Expr Float -> Expr Float | |
App :: (Float -> Float) -> Expr Float -> Expr Float |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%MatrixMarket matrix coordinate real general | |
%================================================================================= | |
% | |
% This ASCII file represents a sparse MxN matrix with L | |
% nonzeros in the following Matrix Market format: | |
% | |
% +----------------------------------------------+ | |
% |%%MatrixMarket matrix coordinate real general | <--- header line | |
% |% | <--+ | |
% |% comments | |-- 0 or more comment lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python2 | |
import sys | |
import json | |
import requests | |
apikey = "REDACTED" | |
def send_push(title, body): | |
print "Sending push. Title: [%s], body: [%s]\n" % (title, body) | |
apiurl = "https://api.pushbullet.com/v2/pushes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def updatedict(fails, d, k, m): | |
f = fails | |
fc = "failcount" | |
f[d] = f.get(d, dict()) | |
f[d][k] = f[d].get(k, dict()) | |
f[d][k][m] = f[d][k].get(m, dict()) | |
f[d][k][m][fc] = f[d][k][m].get(fc, 0) + 1 | |
return f |
OlderNewer