Skip to content

Instantly share code, notes, and snippets.

Avatar

Thouis (Ray) Jones thouis

  • Broad Institute
  • Cambridge, MA, USA
View GitHub Profile
View gist:dde3ce657c9c61e8b63d65da32839036
import requests
import time
# https://github.com/twitterdev/enterprise-scripts-python/blob/main/Engagement-API/generate_user_access_tokens.py
from generate_user_access_tokens import request_token, get_user_authorization, get_user_access_tokens, CONSUMER_KEY, CONSUMER_SECRET
MY_ID = "PUT_YOUR_TWITTER_ID_NUMBER_HERE"
def create_url():
View wordle_list.txt
aahed
aalii
aargh
aarti
abaca
abaci
aback
abacs
abaft
abaka
View gist:721e970685827013f17220f7f8b70a73
import os
from urllib import request
import numpy as np
import pandas as pd
# grab a large corpus of words, sorted by usage counts (Peter Norvig)
if not os.path.isfile('count_1w.txt'):
request.urlretrieve("https://norvig.com/ngrams/count_1w.txt",
"count_1w.txt")
@thouis
thouis / Players.ipynb
Last active Jan 2, 2020
OGS Player stats
View Players.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View delete_old_tweets.py
import sys
import twitter
import time
# see https://python-twitter.readthedocs.io/en/latest/getting_started.html
api = twitter.Api(consumer_key=CONSUMER_KEY,
consumer_secret=CONSUMER_SECRET,
access_token_key=ACCESS_TOKEN,
access_token_secret=ACCESS_SECRET)
View Sphere sampling.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View keybase.md

Keybase proof

I hereby claim:

  • I am thouis on github.
  • I am thouis (https://keybase.io/thouis) on keybase.
  • I have a public key whose fingerprint is A4F6 3AF2 C0E4 8CAE 7501 2BDE 2904 0D09 3557 95A4

To claim this, I am signing this object:

View depth_to_space.py
def depth_to_space(x, blocksize=2):
b, k, d, r, c = x.shape
r1 = x.reshape((b, k // (blocksize ** 2), blocksize, blocksize, d, r, c))
r2 = r1.transpose(0, 1, 4, 5, 2, 6, 3)
return r2.reshape((b, k // (blocksize ** 2), d, r * blocksize, c * blocksize))
@thouis
thouis / rand.py
Last active Aug 11, 2019
more straightforward adjusted rand error
View rand.py
# coding=utf-8
import numpy as np
import scipy.sparse as sparse
# Evaluation code courtesy of Juan Nunez-Iglesias, taken from
# https://github.com/janelia-flyem/gala/blob/master/gala/evaluate.py
def adapted_rand(seg, gt, all_stats=False):
"""Compute Adapted Rand error as defined by the SNEMI3D contest [1]
View batchnorm.py
import tensorflow as tf
from tensorflow.python import control_flow_ops
# from http://stackoverflow.com/a/34634291
def batch_norm(x, n_out, phase_train, scope='bn', affine=True):
"""
Batch normalization on convolutional maps.
Args:
x: Tensor, 4D BHWD input maps
n_out: integer, depth of input maps