This file contains hidden or 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
""" | |
TODO: | |
move fit function to GameBoard | |
assert all ships on playing board | |
game board keeps record of players ships | |
players call to game board and get proper access to game state and own board. | |
create frp board | |
ship observes its own location for hits | |
posts damage or detroyed signal to location on the board |
This file contains hidden or 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
create temporary sequence predictor_seq; | |
CREATE temporary TABLE linear_systems_test_data( id INTEGER NOT NULL, lhs DOUBLE PRECISION[], rhs DOUBLE PRECISION); | |
insert into linear_systems_test_data values (nextval('predictor_seq'), '{352137.0,84.7067061967771,-150.185137392799,122.050417659229,-74.0884874537119,99.7911494563722,-3.7907455558484,181224.690513009,106938.029173016,69336.1362009346,18335.0,12.7007088793537,-250.440511627437,-62.5561474971013,-292.703374755409,-167.012940969203,-78.511449979818,9451.24681999999,5585.85191537643,3628.50938401}'::float[], 88920344.0 ); | |
insert into linear_systems_test_data values (nextval('predictor_seq'), '{84.7067061967771,176105.544243727,61.0252088296143,-73.1971959184637,7.54222162981446,-48.6063990056131,-37.7170700467655,-11006.0678697046,-11871.4874441653,-10787.6157862104,12.7007088793537,9313.85168737771,-31.2780737485506,-85.9645308238089,-89.8568249242787,-78.6462830692247,10.8622991388217,-566.613529886409,-617.49619500345,-565.289335368564}'::float[] |
This file contains hidden or 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 | |
from lxml import html # would prefer not to parse html but currently this is the only option | |
# set these to whatever your gogs account is | |
username = "username" | |
password = "password" | |
cookie_filename = "gogs.cookies" | |
gogs_url = "your_gogs_url" | |
gogs_port = "3000" |
This file contains hidden or 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
/* | |
Command Pattern Continued | |
Adapted from https://en.wikipedia.org/wiki/Command_pattern#JavaScript | |
& http://www.onjava.com/pub/a/onjava/2006/04/05/ajax-mutual-exclusion.html | |
Application: Wallace Variation for Lamports Bakery Algorithm for implementing mutex in javascript | |
*/ |
This file contains hidden or 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
/* Generic Command Pattern in Javascript */ | |
/* Adapted from https://en.wikipedia.org/wiki/Command_pattern#JavaScript */ | |
/* Application: Wallace Variation for Lamports Bakery Algorithm for implementing mutex in javascript */ | |
/* The Invoker function */ | |
var Invoke = function(){ | |
var _commands = []; | |
this.storeAndExecute = function(command){ | |
_commands.push(command); | |
command.execute(); |
This file contains hidden or 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 "fmt" | |
type OkCoin struct { | |
futures map[string]map[string]map[string]string | |
spot map[string]map[string]map[string]string | |
} | |
func OkCoinApi() OkCoin { |
This file contains hidden or 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 pylab import * | |
from scipy.ndimage import measurements | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import time | |
import sys | |
import signal | |
def signal_handler(signal, frame): | |
sys.exit(0) |
This file contains hidden or 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
# basic linear regression in pure python (no numpy!) | |
# class and function usable for streams | |
# refactored from http://code.activestate.com/recipes/578914-simple-linear-regression-with-pure-python/ | |
import math | |
def mean(series): | |
return sum(series) / len(series) | |
def standard_deviation(series, ave): |
This file contains hidden or 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
def GetSleepTime(self, resources): | |
'''Determines the minimum number of seconds that a program must wait | |
before hitting the server again without exceeding the rate_limit | |
imposed for the currently authenticated user. | |
Returns: | |
The minimum seconds that the api must have to sleep before query again | |
''' | |
if resources[0] == '/': | |
resources = resources[1:] |
This file contains hidden or 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
# hello world in GAS syntax | |
# to compile and run | |
# $ yasm -f elf -p gas helloGAS.s 2>&1 | |
.text # section declaration | |
# we must export the entry point to the ELF linker or | |
.global _start # loader. They conventionally recognize _start as their | |
# entry point. Use ld -e foo to override the default. | |
_start: |