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 <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);
}
#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 <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#define NUM_THREADS 2
#define PRIME_LIMIT ((int)1e9)
#!/usr/bin/python
import pygame, pygame.camera
from pygame.camera import Camera
from pygame.locals import *
pygame.init()
pygame.camera.init()
class CameraDisplay(object):
def __init__(self, size=(640, 480)):
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;
// Format of formulas: [(](shorthand|longhand)[count][)][count]
//
// shorthand is case sensitive and is the symbol notation (e.g. C for Carbon, Co for Cobalt and Hg for Lead)
// longhand is the full element name and is not case sensitive (e.g. Carbon, CARBON, CaRBoN, lead)
// If a count is left out, it's implicitly '1', else you can put a count after a shorthand or longhand element
// You can group element with parenthesis and apply counts to the groups. (e.g. C2(HO)2)
#!/usr/bin/python
import json
from collections import Counter
json_data = open('reddits.json')
data = json.load(json_data)
stop_words = set(['a', 'about', 'above', 'across', 'after', 'afterwards', 'again', 'against', 'all', 'almost', 'alone', 'along', 'already', 'also', 'although', 'always', 'am', 'among', 'amongst', 'amoungst', 'amount', 'an', 'and', 'another', 'any', 'anyhow', 'anyone', 'anything', 'anyway', 'anywhere', 'are', 'around', 'as', 'at', 'back', 'be', 'became', 'because', 'become', 'becomes', 'becoming', 'been', 'before', 'beforehand', 'behind', 'being', 'below', 'beside', 'besides', 'between', 'beyond', 'bill', 'both', 'bottom', 'but', 'by', 'call', 'can', 'cannot', 'cant', 'co', 'computer', 'con', 'could', 'couldnt', 'cry', 'de', 'describe', 'detail', 'did', 'do', 'done', 'down', 'due', 'during', 'each', 'eg', 'eight', 'either', 'eleven', 'else', 'elsewhere', 'empty', 'enough', 'etc', 'even', 'ever', 'every', 'everyone', 'everything', 'everywhere', 'except', 'few', 'fifteen', 'fifty', 'fill',