Skip to content

Instantly share code, notes, and snippets.

View armhold's full-sized avatar

George Armhold armhold

View GitHub Profile
@armhold
armhold / envious.go
Created October 10, 2018 18:32
show that envy fails to set GO_ENV to "test" until Reload() is called
package envious
import (
"github.com/gobuffalo/envy"
"testing"
)
// fails
func TestGO_ENV(t *testing.T) {
assertTestMode(t)
@armhold
armhold / standalone_test.go
Last active December 14, 2017 14:01
unit test for bleve prefix query matching
package main
import (
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/analysis/lang/en"
"strings"
"testing"
)
type Book struct {
@armhold
armhold / tuning.py
Created June 3, 2016 16:27
tuning hyperparameters
best_model = None
best_val_acc = 0
best_lr = None
num_trials=10
for trial in range(num_trials):
# best so far is 2.74799e-4, aka 10 ** -3.5609848520174077
#lr_exp = np.random.uniform(-5, 2)
lr_exp = np.random.uniform(-3.65, -3.2)
lr = 10 ** lr_exp
@armhold
armhold / training_george_net.py
Created June 3, 2016 16:23
code from the python notebook for training george_net
from cs231n.classifiers.convnet import *
#lr = 10 ** -3.45855
lr = 10 ** -3.2
reg = 10 ** -4.92902
weight_scale = 10 ** -1.62151
model = GeorgeNet(num_convnets=3, num_affine=3,
hidden_dim=500, # default: 500
@armhold
armhold / convnet.py
Created June 3, 2016 16:20
An MxN layer convolutional network with the following architecture: [conv-relu-pool] x N - [affine] x M - [softmax]
import numpy as np
from cs231n.layers import *
from cs231n.fast_layers import *
from cs231n.layer_utils import *
# a Convolutional Network by armhold
class GeorgeNet(object):
"""
@armhold
armhold / lightspeed.go
Created April 28, 2016 16:15
relativistic distance calculator
// quick back of envelope calculations for computing distance traveled (from traveler's perspective)
// when constantly accelerating at 9.8 m/s^2.
package main
import (
"fmt"
"math"
)
const (
package main
import (
"fmt"
"io/ioutil"
"log"
"path"
"github.com/fsnotify/fsnotify"
)
#
# RVM profile
#
# /etc/profile.d/rvm.sh # sh extension required for loading.
#
if
[ -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" ] &&
test "`ps -p $$ -o comm=`" != dash &&
test "`ps -p $$ -o comm=`" != sh
end of file reached
/Users/foo/.rvm/gems/ruby-1.9.3-p362/gems/rsolr-1.0.8/lib/rsolr/connection.rb:15:in `execute'
/Users/foo/.rvm/gems/ruby-1.9.3-p362/gems/sunspot_rails-2.0.0/lib/sunspot/rails/solr_instrumentation.rb:14:in `block in execute_with_as_instrumentation'
/Users/foo/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
/Users/foo/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/foo/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
/Users/foo/.rvm/gems/ruby-1.9.3-p362/gems/sunspot_rails-2.0.0/lib/sunspot/rails/solr_instrumentation.rb:12:in `execute_with_as_instrumentation'
/Users/foo/.rvm/gems/ruby-1.9.3-p362/gems/rsolr-1.0.8/lib/rsolr/client.rb:166:in `execute'
/Users/foo/.rvm/gems/ruby-1.9.3-p362/gems/rsolr-1.0.8/lib/rsolr/client.rb:161:in `send_and_receive'
(eval):2:in `post'
@armhold
armhold / rails4-emoji-bug
Last active December 19, 2015 03:48
demonstrates encoding bug in Rails4
#!/usr/bin/env ruby
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.0.0' # NB: works fine with 3.2.13
gem 'mysql2'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.