Skip to content

Instantly share code, notes, and snippets.

View cheeyeo's full-sized avatar
💭
Researching on use of transformers in computer vision

Chee Yeo cheeyeo

💭
Researching on use of transformers in computer vision
View GitHub Profile
@cheeyeo
cheeyeo / Makefile
Created June 9, 2023 14:36 — forked from alexedwards/Makefile
Boilerplate Makefile for Go projects
# Change these variables as necessary.
MAIN_PACKAGE_PATH := ./cmd/example
BINARY_NAME := example
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
@cheeyeo
cheeyeo / ColabReconnect.js
Created March 13, 2023 20:00 — forked from josepdecid/ColabReconnect.js
Colab Reconnect
// 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');
@cheeyeo
cheeyeo / custom_client_error_boto3.py
Created June 23, 2020 15:43
Creating a boto3 ClientError manually!
raise ClientError(operation_name='InvalidKeyPair.Duplicate', error_response={
'Error': {
'Code': 'Duplicate',
'Message': 'This is a custom message'
}
}
)
@cheeyeo
cheeyeo / notes.md
Created January 15, 2019 11:31
Adding value to k8 secret

To add a value to a secret we need to ensure it is base64 encoded without whitespace

E.g.

echo -n 'true' | base64 -w0
@cheeyeo
cheeyeo / docker.sh
Created July 16, 2018 08:36
Creating docker container script from phusion ? 2016...?
# example multistage process docker build script from https://blog.phusion.nl/2016/08/31/efficiently-and-conveniently-building-ruby-and-node-js-application-docker-containers-for-production-2
set -e
export IMAGE_NAME=tinco/express-example
export RUN_BUILD="docker run -it --rm -v $PWD:/usr/src/app -w /usr/src/app node:6"
export TEST_COMMAND="./node_modules/mocha/bin/mocha"
function run_image() {
# 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, ",
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')
@cheeyeo
cheeyeo / freeukgen_interview.rb
Created October 8, 2016 15:36 — forked from benwbrum/freeukgen_interview.rb
Coding challenge/interview prompt for Free UK Genealogy developer
# 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="")
@cheeyeo
cheeyeo / destructuring.js
Created October 3, 2016 11:15 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@cheeyeo
cheeyeo / xor_keras.py
Created September 3, 2016 13:27 — forked from cburgdorf/xor_keras.py
Comparing XOR between tensorflow and keras
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'))