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
#!/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', |
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
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) |
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
#!/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)): |
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 <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) |
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 <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; |
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 <stdint.h> | |
int64_t gcd(int64_t a, int64_t b){ | |
if(!b) | |
return a; | |
return gcd(b, a%b); | |
} |
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
<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> |
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
#!/usr/bin/python | |
# Simulation for Neural Network | |
import pygame | |
import pygame.draw | |
import random | |
from pygame.locals import * |
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
# 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) |
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
#!/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: |
OlderNewer