Skip to content

Instantly share code, notes, and snippets.

View atomictom's full-sized avatar

Thomas Manning atomictom

  • Google
  • Dublin, Ireland
View GitHub Profile
#include <stdlib.h>
#include <stdio.h>
#define WHEEL_LENGTH 7
#define PRINT_LENGTH
#define PRINT_WHEEL
void n_primes(int * results, int n){
if(n < 1)
return;
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int64_t gcd(int64_t a, int64_t b){
if(!b)
return a;
return gcd(b, a%b);
}
@atomictom
atomictom / index.html
Created February 12, 2014 19:58
Playing with three.js
<html>
<head>
<title>My first Three.js app</title>
<style>
canvas { width: 100%; height: 100% }
html,body { overflow: hidden; margin: 0 }
</style>
</head>
<body>
<script src="three.js"></script>
#!/usr/bin/python
# Simulation for Neural Network
import pygame
import pygame.draw
import random
from pygame.locals import *
# Pseudo code for the sockets
# Game
def connection(player, socket=zqm.socket(zqm.REQ)):
while True:
# Send to the NN
info = player.get_info()
info_p = info.pickle()
socket.send(info_p)
#!/usr/bin/python
#This file represents the simulation as it receives commands from the ANN and executes an action depending on the command.
import threading
import time
import zmq
def connection(socket):
while True:
#!/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)