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
# SAPD Neighborhood Watch Db | |
# Parses San Antonio Police Neighborhood Calls pdfs into json for dbs | |
# | |
# | |
# Dev Env: Ubuntu 12.04 | |
# Licensed under the GNU General Public License: http://www.gnu.org/licenses/gpl.html | |
# Requires xpdf utils available at the command line (not a python library (yet)) | |
# pymongo & Mongodb | |
# pdfs from http://www.sanantonio.gov/neighborhoodpolicecalls/policecalls.aspx | |
# |
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 numpy as np | |
class RingBuffer(np.ndarray): | |
'A multidimensional ring buffer.' | |
def __new__(cls, input_array): | |
obj = np.asarray(input_array).view(cls) | |
return obj |
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
// http://is.gd/gWewbP | |
extern mod extra; | |
use extra::treemap::TreeMap; | |
use extra::json::ToJson; | |
use extra::serialize::Decodable; | |
use json = extra::json; | |
// structs are required for decoding a JSON object into a Rust object | |
#[deriving(Decodable)] |
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
""" | |
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 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 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 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 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 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 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) |