Skip to content

Instantly share code, notes, and snippets.

View thouis's full-sized avatar

Thouis (Ray) Jones thouis

  • Broad Institute
  • Cambridge, MA, USA
View GitHub Profile
@thouis
thouis / 0_reuse_code.js
Created May 12, 2016 01:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
import sys
import h5py
import numpy as np
def pygame(h5, name, board, moves):
for idx in range(board.shape[0]):
for plane in range(board.shape[1]):
if plane < 44:
# different board orderings
f = board[idx, plane, ...].T[:, ::-1]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
local grad = require 'autograd'
local nn = require 'nn'
local W1 = torch.FloatTensor(1, 1, 10, 10):normal()
local pooler = nn.SpatialMaxPooling(2, 2, 2, 2)
local unpooler = nn.SpatialMaxUnpooling(pooler)
-- not sure why these lines are necessary.
pooler.indices = torch.FloatTensor()
pooler.output = torch.FloatTensor()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from math import tan, floor
def f5(element):
assert len(element) % 2 == 0
for idx in range(0 ,len(element), 2):
sub = element[idx:idx+2].lower()
v1 = ord(sub[0]) - ord('a') + 1
v2 = ord(sub[1]) - ord('a') + 1
if 8 - floor(tan(v1 * v2)) < 0:
print v1 * v2, "bad"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thouis
thouis / gist:ed15adbfe620c8be064b
Created April 3, 2015 01:03
PLY file to minecraft world via CanaryRaspberryJuice plugin
import plyfile
import pylab
import sys
import mcpi.minecraft as minecraft
import mcpi.block as block
import numpy as np
scale = 150
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="lshw-B.02.16" />
<style type="text/css">
.first {font-weight: bold; margin-left: none; padding-right: 1em;vertical-align: top; }
.second {padding-left: 1em; width: 100%; vertical-align: center; }
.id {font-family: monospace;}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.