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
package tm; | |
public final class MachinesLibrary | |
{ | |
private MachinesLibrary() {} | |
public static TuringMachine EqualBinaryWords() | |
{ | |
TuringMachine newTM = new TuringMachine(); | |
newTM.addState("q1"); |
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
package main; | |
import java.io.File; | |
import java.util.LinkedList; | |
import java.util.Scanner; | |
public class GetExtensions | |
{ | |
private static int fileCounter; |
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 random import shuffle | |
from itertools import chain, combinations | |
def powerset(iterable): | |
"powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)" | |
s = list(iterable) | |
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1)) | |
players = 15 |
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
leavePayoffs = ( (0, 0), (-1, 3), (2, 2), (1, 5), (4, 4), (3, 7), (6, 6), (5, 9), (8, 8), (7, 11), (10, 10) ) | |
#leavePayoffs = ( (0, 0), (-1, 1), (2, -2), (-3, 3), (4, -4), (-5, 5), (6, -6), (-7, 7), (8, -8), (-9, 9), (10, -10) ) | |
backgroundPriors = [(0.99999, 1.0)] | |
lambdas = [(sum([lam[0] for lam in backgroundPriors])/len(backgroundPriors) , sum([lam[1] for lam in backgroundPriors])/len(backgroundPriors))]*len(leavePayoffs) | |
expectedPayoffs = [(0.0, 0.0)]*len(leavePayoffs) # initial values are overwritten, don't fret over them | |
lambdasGivenStay = [(0.0, 1.0)]*(len(leavePayoffs)-1) # initial values are overwritten, don't fret over them | |
getPlayer = lambda node: node%2 # returns 0 for player 1's decision nodes and 1 for player 2's nodes | |
other = lambda player: (player+1)%2 # returns the other player | |
lambdaThreshold = lambda a1, a2, b1, b2: (float(a2) - b2) / (-a1 + a2 + b1 - b2) | |
maxRounds = 10 |
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 urllib2 | |
profileId = "103814799814962680687" | |
fileName = "C:\\Users\\Nikolas\\Dropbox\\public\\plusones.html" | |
response = urllib2.urlopen('https://plus.google.com/_/plusone/get?oid='+profileId) | |
text = response.read().decode("utf-8") | |
textLines = text.split('\n') | |
linkList = [] | |
for line in textLines: |
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 requests, json, pickle, time, datetime, sqlite3 as lite, sys | |
steamKeyFileName = 'steamwebapikey.txt' | |
matchesFileName = 'matches.pkl' | |
# get steam api key | |
try: | |
steamKeyFile = open(steamKeyFileName, 'rb') | |
steamKey = pickle.load(steamKeyFile) | |
steamKeyFile.close() |
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 | |
import urllib | |
import urlparse | |
import time | |
import os | |
searchTerm = "software engineer" | |
websites = ["indeed.com", "monster.com"] |
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 requests, json, time, pickle, re, os | |
myAccount = 68186278 #REPLACE THIS WITH YOUR STEAM ID | |
matchCountMe = 0 # how many of my latest matches to look for players in (set to 0 to fetch current live match) | |
matchCountOthers = 10 # how many matches from each other player to look at | |
matchExtra = 5 # buffer of extra matches to fetch for other players in case some need to be thrown out | |
steamKeyFileName = 'steamwebapikey.txt' | |
serverLogFile = 'C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\server_log.txt' | |
logFileName = 'teammates.txt' |
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 struct | |
import sys | |
import os | |
MAX_OUTPUT_SIZE = 1 << 24 # 16 megabytes | |
def load_binary_file(fn, nbytes=100000000): | |
data = [] | |
with open(fn, "rb") as src: | |
byte = src.read(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
filenames = ("TILS2(4).model", "TILS2(4').model") | |
index = [set(), set()] | |
for i in (0,1): | |
filename = filenames[i] | |
model = "" | |
for line in open(filename): | |
if line.startswith('interpretation'): | |
index[i].add(model) | |
model = "" |