Skip to content

Instantly share code, notes, and snippets.

View jsimnz's full-sized avatar

John-Alan Simmons jsimnz

  • Source
  • Toronto, Canada
View GitHub Profile
@jsimnz
jsimnz / serializer.go
Created August 4, 2023 09:32
Bond Protobuf Serializer
package db
import (
"fmt"
"reflect"
"github.com/go-bond/bond"
"google.golang.org/protobuf/proto"
)

Keybase proof

I hereby claim:

  • I am jsimnz on github.
  • I am jsimnz (https://keybase.io/jsimnz) on keybase.
  • I have a public key whose fingerprint is 1653 F905 AF2B 5AC2 6C2A FC26 7ED2 D05C A37C 408B

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jsimnz on github.
  • I am jsimnz (https://keybase.io/jsimnz) on keybase.
  • I have a public key whose fingerprint is A5BE E801 3C3E F93A DEBC 3B76 7F69 37D7 94B4 5CE5

To claim this, I am signing this object:

import Image
import glob
import numpy as np
from sklearn.neural_network import MLPClassifier
def l2b(label):
if label == "good":
return 1
return 0
import theano
import glob
import Image
from pylearn2.models import mlp
from pylearn2.training_algorithms import sgd
from pylearn2.termination_criteria import EpochCounter
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
import numpy as np
from random import randint, shuffle
from SimpleCV import *
class Trainer():
def __init__(self, classes, trainPaths):
self.classes = classes
self.trainPaths = trainPaths
def getExtractors(self):
var netg = document.getElementById("netgraph");
evt = document.createEvent("MouseEvents");
evt.initEvent("mouswheel", true, true);
evt.deltaY = 50 // the amount you actuall scroll
evt.clientX = 100 // Mouse X position when you're scrolling
evt.clientY = 100 // Mouse Y position when you're scrolling
netg.dispatchEvent(evt);
@jsimnz
jsimnz / Ruby Before method hook
Created October 22, 2015 21:47
An example of wrapping class methods in a before hook
require "active_support"
class TokenMgr
def before(caller)
puts 'Getting token...'
end
end
class API
include ActiveSupport::Callbacks
#!/usr/bin/env ruby
require 'nokogiri'
require 'uri'
# opens every file in the given dir tree and converts any html img tags to rails image_tag calls
#
# example usage:
# ruby convert.rb ~/my_rails_app/app/views
#
@jsimnz
jsimnz / GoogleIOImageScrapper.go
Created April 18, 2014 04:39
A web scraper to pull all the images off of developer.android.com to find the embedded GoogleIO 2014 redeem codes
package main
import (
"fmt"
"io/ioutil"
"net/http"
"regexp"
"strings"
"time"