Skip to content

Instantly share code, notes, and snippets.

View nottombrown's full-sized avatar

Tom B Brown nottombrown

View GitHub Profile
extension Optional {
func try<U>(f: (T) -> U) -> Optional<U> {
if let unwrapped = self {
return f(unwrapped)
} else {
return nil
}
}
}
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
for family in UIFont.familyNames(){
println(family)
for fontName in UIFont.fontNamesForFamilyName("\(family)") {
println(" \(fontName)")
}
}
@nottombrown
nottombrown / nottombrown_pub.asc
Last active August 29, 2015 14:25
Tom Brown's public PGP key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: Mailvelope v0.13.1
Comment: Tom Brown's public key - https://www.mailvelope.com
xsFNBFWwA9UBEACsVDSAwJ3xBxRwLGn7FE1ABen2+74OSz6+aqjLVvoBoTxw
L5DBnirOoWiOr/RSoRGUQfw80mfZpXdOWeUfh6i3h6G6pRcXa5USXD3pQmOM
K5K6KJGG2d6CjIlKczDQVrvx6AVtzlF+ezNffWciFWWDDWClguwntVxMehhG
0vSyllzYQcEOkgCx/Cz1ptqQFgzyJI0eInIRJg+912oXsxzDAy5qzht1JVge
J5aeGxr2R8BJiaTMVlCqaMcfJnzzGRuefBhruQGYLdxyUJd6fRjiZUTjZ9UM
k77m9Ezsao/sZQJgpuuf1DZTlHoE72bEi8Xt1JQdUz8fGPTIO39M5kNXW54o
# A "put it in a dictionary" Q-learning agent
import gym
import numpy as np
env = gym.make('FrozenLake-v0')
env.monitor.start('recordings', force=True)
# Initialize Q matrix to zeros
Q = np.zeros((env.observation_space.n, env.action_space.n))
@nottombrown
nottombrown / id_rsa.pub
Last active August 7, 2016 23:52
Tom Brown's public SSH key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0VouipRoYqWdJlTyKRhfGZ/Dyz2f2lRDdXElkBklUdN6TbJzaGkaUoDtOw5gq1X2pb15egvE5qEdtZqoPVUA1cyo9XlF8dK1LMR+wj7HNst3ynAZN98vIoiYwzIXKaECe5lBQ2e8+t3yA/WVn731wvvR+DHsG7DFGugND4HOLDfpfY+8AW0Thc0mROUDV0yhjuF6NWPqxuxgzExKD+huc8cJqVPzv9xiLQ1KdTms25739rhn28zhPLpyupUVbz1XB+SXOJFEFLdQzKszAeoaLFsZuZ+7yAAUUDJabVTQ/YtUxqGq5H8QTE7Jk6Zpz+QJM/yZ4o8UQ82XpXO9Ae/ctw== [email protected]

Keybase proof

I hereby claim:

  • I am nottombrown on github.
  • I am nottombrown (https://keybase.io/nottombrown) on keybase.
  • I have a public key ASDVHNVLxMWL4cN7DHIkg-aKMwpJb4qAZ-y0Yo-mM8qyXgo

To claim this, I am signing this object:

# Based on https://github.com/tensorflow/tensorflow/issues/2652#issue-158487397
import tensorflow as tf
tf.reset_default_graph()
def run(on_gpu):
tf.reset_default_graph()
tf.set_random_seed(42) # Try to set up determinism
with tf.device('/gpu:0' if on_gpu else '/cpu:0'):
a = tf.random_normal([16, 16])
b = tf.get_variable('b', shape = [], initializer = tf.constant_initializer(value = 0.0))
#!/bin/sh
# ----------------------------------------------------------------------
# Copyright (C) 2005-2011 Karl J. Runge <[email protected]>
# All rights reserved.
#
# This file is part of Xdummy.
#
# Xdummy is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
@nottombrown
nottombrown / imagenet1000_clsid_to_human.txt
Created January 31, 2018 01:08 — forked from yrevar/imagenet1000_clsidx_to_labels.txt
text: imagenet 1000 class id to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',