Skip to content

Instantly share code, notes, and snippets.

@jinpan
jinpan / requirements.txt
Created January 16, 2015 20:16
Server Binary Reloader
PyYAML==3.11
argh==0.26.1
argparse==1.2.1
pathtools==0.1.2
watchdog==0.8.2
wsgiref==0.1.2
generate.py < buffers
1 from math import cos
2 from math import sin
3
4
5 def generate_pricepath(f, ticks):
6 return [round(f(tick), 2)
7 for tick in range(ticks)]
8
9
import (
"io"
"encoding/csv"
)
clientPermissions = make(map[string]Permission)
type Permission struct {
isAdmin bool
isUnlimited bool
package main
import (
"container/list"
"fmt"
"math"
"math/rand"
)
type Datum struct {
{"pokemon":[{"id":"151","name":"Mew","level":100,"hp":218,"maxhp":330,"moves":[{"name":"Pound","pp":20,"maxpp":20,"power":40,"type":"normal"},{"name":"Mega Punch","pp":19,"maxpp":20,"power":80,"type":"normal"},{"name":"Psychic","pp":20,"maxpp":20,"power":90,"type":"psychic"},{"name":"AncientPower","pp":20,"maxpp":20,"power":60,"type":"rock"}]},{"id":"149","name":"Dragonite","level":100,"hp":315,"maxhp":315,"moves":[{"name":"Twister","pp":20,"maxpp":20,"power":40,"type":"dragon"},{"name":"Slam","pp":20,"maxpp":20,"power":80,"type":"normal"},{"name":"Wing Attack","pp":20,"maxpp":20,"power":60,"type":"flying"}]},{"id":"145","name":"Zapdos","level":100,"hp":285,"maxhp":285,"moves":[{"name":"Peck","pp":20,"maxpp":20,"power":35,"type":"flying"},{"name":"ThunderShock","pp":20,"maxpp":20,"power":40,"type":"electric"},{"name":"Drill Peck","pp":20,"maxpp":20,"power":80,"type":"flying"},{"name":"Thunder","pp":20,"maxpp":20,"power":120,"type":"electric"}]},{"id":"3","name":"Venusaur","level":100,"hp":279,"maxhp":279,"mov
go to file:///home/jin/Projects/wearable_pokemon/server/test.html#1
go to file:///home/jin/Projects/wearable_pokemon/server/test.html#2
msg2 = {"attack": 0}; ws.send(JSON.stringify(msg2));
msg2 = {"attack": 0}; ws.send(JSON.stringify(msg2));
@jinpan
jinpan / RobotPlayer (jinpan).java
Last active December 31, 2015 09:49
Basic Players for 2013 BC
package INSN;
import battlecode.common.Direction;
import battlecode.common.MapLocation;
import battlecode.common.RobotController;
import battlecode.common.RobotType;
import battlecode.common.Team;
public class RobotPlayer {
public static void run(RobotController rc) {
@jinpan
jinpan / gist:7260819
Created November 1, 2013 04:04
BULLS AND COWS, HAND ASSEMBLED BY YOURS TRULY.
.include "/shared/bsim/beta.uasm" // include instruction macros
.include "/shared/bsim/lab5checkoff.uasm" // include test jig
// TEMPLATE for Lab 5
count_bull_cows: // your subroutine must have this name
PUSH(LP) // standard subroutine entry sequence
PUSH(BP)
MOVE(SP, BP)
@jinpan
jinpan / gist:7227281
Created October 30, 2013 04:35
Random passwords (http://xkcd.com/936/)
everywhere-substantial-boiling-tragedies
entirely-general-shouting-$500,000
just-affirmative-co-occurring-meetings
still-successful-cracking-shavings
never-daily-bringing-designers
across-nervous-pretending-projects
nevertheless-central-blanching-members
mainly-local-shaking-efforts
about-hopeful-transpiring-unions
always-negro-appeal-making-decades