Skip to content

Instantly share code, notes, and snippets.

jcrubino jcrubino

Block or report user

Report or block jcrubino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ighashtag_calc.py
from bs4 import BeautifulSoup
from requests import get
import json
import re
import emoji
css = "script"
View ring_buffer
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
View json.rs
// 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)]
@jcrubino
jcrubino / battleship.py
Last active Aug 29, 2015
Battleship NG in Python
View battleship.py
"""
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
View madlib_example.sql
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[]
View gist:6007affdea9f871f481c
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"
@jcrubino
jcrubino / gist:70a38ae46b034ae8f056
Last active Aug 29, 2015
Command Pattern Continued
View gist:70a38ae46b034ae8f056
/*
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
*/
@jcrubino
jcrubino / gist:5bd10e19fe7b661ad51c
Last active Aug 29, 2015
Generic Command Pattern Javascript
View gist:5bd10e19fe7b661ad51c
/* 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();
@jcrubino
jcrubino / gist:880a73ce75b5e341acd7
Created Nov 27, 2014
Start of OkCoin Websocket Api
View gist:880a73ce75b5e341acd7
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 {
You can’t perform that action at this time.