This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#image processing resources | |
from skimage.io import imread, imshow | |
from skimage.filters import gaussian, threshold_otsu | |
from skimage.feature import canny | |
from skimage.transform import probabilistic_hough_line, rotate | |
#testing | |
import numpy as np | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change these variables as necessary. | |
MAIN_PACKAGE_PATH := ./cmd/example | |
BINARY_NAME := example | |
# ==================================================================================== # | |
# HELPERS | |
# ==================================================================================== # | |
## help: print this help message | |
.PHONY: help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Interval time to check if runtime is disconnected | |
interval = 1000 * 60; | |
// Busy/Reconnect button top-right | |
reloadButton = document.querySelector('#connect > paper-button > span') | |
setInterval(() => { | |
if (reloadButton.innerText == 'Reconnect') { | |
reloadButton.click(); | |
console.log('Restarting'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Keras tokenizer lacks serialization. Therefore I created the below to address this without changing the API. | |
# (Since I don't know how long it'll take for keras to support it) | |
# The Tokenizer __init__ should be modified to take the word_stats dictionary as a kwarg, | |
# and a method added to the class to return the stats | |
# Expiermentally this works, but I am not sure of any nuances in the Tokenizer class. | |
def test_tokenizer(): | |
texts = ["It was the best of times, it was the worst of times, it was the age of wisdom", | |
"it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, ", | |
"it was the season of Light, it was the season of Darkness, it was the spring of hope, ", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers import Dense | |
from keras.utils.io_utils import HDF5Matrix | |
import numpy as np | |
def create_dataset(): | |
import h5py | |
X = np.random.randn(200,10).astype('float32') | |
y = np.random.randint(0, 2, size=(200,1)) | |
f = h5py.File('test.h5', 'w') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a Person class which will print the following output when run: | |
# Jane Doe | |
# John Smith | |
# YOUR CODE GOES HERE | |
class Person | |
attr_accessor :first_name, :last_name | |
def initialize(first_name="", last_name="") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from keras.models import Sequential | |
from keras.layers.core import Activation, Dense | |
from keras.optimizers import SGD | |
X = np.array([[0,0],[0,1],[1,0],[1,1]], "float32") | |
y = np.array([[0],[1],[1],[0]], "float32") | |
model = Sequential() | |
model.add(Dense(2, input_dim=2, activation='sigmoid')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'oat/adapters/hal' | |
class BooticAdapter < Oat::Adapters::HAL | |
def type(*types) | |
property :_class, *types | |
end | |
def curie(link_opts) | |
data[:_links][:curies] ||= [] | |
data[:_links][:curies] << link_opts | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Expng do | |
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks] | |
def png_parse(<< | |
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, | |
_length :: size(32), | |
"IHDR", | |
width :: size(32), | |
height :: size(32), |
NewerOlder