Skip to content

Instantly share code, notes, and snippets.

@mizzao
mizzao / cloudSettings
Last active July 15, 2021 03:11
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-02-23T20:44:09.529Z","extensionVersion":"v3.4.3"}
@mizzao
mizzao / bot.land.d.ts
Created October 13, 2019 17:39
Bot Land TypeScript bindings
declare const IS_OWNED_BY_ME = 256;
declare const ALLY = 0;
declare const ENEMY = 1;
declare const CHIP = 1024;
declare const CPU = 512;
declare const BOT = 8;
declare const ANYTHING;
declare enum EntityMatchFlags {
IS_OWNED_BY_ME = 256,
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import math
import seaborn as sns
def define_strats(h=10):
return np.linspace(1, h+1, h+1, dtype=int)
@mizzao
mizzao / zooniverse_realtime_api.md
Last active December 22, 2015 22:39
zooniverse real-time command api examples

See https://gist.github.com/arfon/a79777b68dc512c06043 for general API discussion. Also, Arfon has a PDF file outlining our whiteboard design for this API.

Overall vision for the realtime research API:

  • Refactor Ouroboros to allow support for subject retiring, assignment (including client side), and custom interface commands.
  • Find an appropriate project for CrowdSynth or engagement-style experiments. Design interface tweaks, messaging, and other interventions into the project.
  • Subscriber gets access key to experiment on users for a given project. Access has certain limits such as max percentage of users, and time limit (2 months) etc.
  • Subscriber listens to Kafka stream (using DB replication library) for users coming online.
  • Subscriber sends a user request command (with possible time demand) to API when an interesting user comes online. API responds with either 200 (OK) or 403 (denied). If OK, these users are available for sending commands.
  • Control of users via commands is available for the spe
import cplex
import numpy as np
if __name__ == "__main__":
#The histogram data, 250 histograms with 3 bins
prob = cplex.Cplex()
hists = 250
bins = 3
pairs = bins*(bins-1)/2
@mizzao
mizzao / jquery.draggable.js
Last active August 29, 2015 13:58 — forked from keriati/jquery.draggable.js
That code was a pile of shit, and couldn't handle a lot of things - among others, the handle not being a direct child of the draggable, and binding a billion event handlers, etc
(function($) {
$.fn.drags = function(opt) {
opt = $.extend({handle:"",cursor:"move"}, opt);
if(opt.handle === "") {
var $el = this;
} else {
var $parent = this;
var $el = this.find(opt.handle);