Skip to content

Instantly share code, notes, and snippets.

View atomictom's full-sized avatar

Thomas Manning atomictom

  • Google
  • Dublin, Ireland
View GitHub Profile
#!/usr/bin/python
# This file represents the ANN as it receives inputs from the simulation and does calculations depending on the input.
import threading
import time
import zmq
def connection(socket):
while True:
msg = socket.recv()
/* Thomas Manning
* Mon Feb 3 01:23:23 EST 2014
*
* About:
* This is a project to try to make as fast a prime generator
* as possible using parallel programming, the sieve of eratosthenes
* and many other optimizations.
*
* It's kind of big because of the use of a very large static array
* for wheel optimization (wheel size of 7). Using a good editor
#include <stdlib.h>
#include <stdio.h>
#define WHEEL_LENGTH 3
#define PRINT_LENGTH
#define PRINT_WHEEL
void n_primes(int * results, int n){
if(n < 1)
return;
#!/usr/bin/env python
# Recursive descent wrapper for objects containing objects
import functools
def recursive_descent(fn):
@functools.wraps(fn)
def wrapped(self, *args, **kwargs):
fn(self, *args, **kwargs)
#lang racket
; If a church numeral is like this: λf.λx.f(f(f...(f x))
; then just pass in 0 for 'x', and +1 for 'f' and for each 'f'
; we add one to x (0). So for no 'f's, we add 1 zero times and get
; 0. For 1 'f', we add 1 once and get 1, etc...
(define NUM
(lambda (n)
"Print a church numeral"
((n (lambda (x) (+ 1 x))) 0)))
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>
#define NUM_THREADS 8
#define PRINT_TIME
CC=gcc
CFLAGS=-Wall -O3 -g
LDFLAGS=-pthread
COMPILEONLY=-c
SOURCES=queue.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=$(firstword $(SOURCES:.c=))
.PHONY: clean run
.SUFFIXES:
function log(){
echo "$@" >> log
bash -c "$@"
}
#!/usr/bin/python
# TODO: Construct a topological ordering for the pushes so they happen
# correctly regardless of their order in the relations.txt file
import re
import sys
import os.path
from exeption import ValueError
# relations.txt -- A way to specify playlist relationships
#
# Comments begin with the '#' character and are ignored
#
# Currently, there's only one type of relation in relations.txt:
#
# 1. Push relations, which are specified using '->' like this:
# pusher_playlist -> pushed_playlist
# And works by pushing changes additions in one playlist to another
#