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 / 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 / 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 / singleton_logger.rb
Created November 2, 2010 11:31
Simple logger using Ruby's built in Singleton module
require 'singleton'
class SimpleLogger
include Singleton
attr_accessor :level
ERROR=1
WARNING=2
INFO=3
@cheeyeo
cheeyeo / test.exs
Last active September 25, 2022 19:56
Example of mocking a web api in ExUnit in Elixir using Meck
# https://github.com/eproxus/meck
# add meck as a dependency in mix.exs
defmodule GithubIssuesTest do
use ExUnit.Case
import :meck
setup_all do
new(Issues.GithubIssues)
on_exit fn -> unload end
@cheeyeo
cheeyeo / gist:7aa4a5cf0db050d6216d
Last active September 13, 2021 21:29 — forked from beanieboi/gist:ad526faf063181f336a2
Codeship Nginx Config for Heroku
daemon off;
# Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;
events {
use epoll;
accept_mutex on;
worker_connections 1024;
}
@cheeyeo
cheeyeo / concept.js
Last active March 19, 2021 08:45
tracking when window.open closes
// http://stackoverflow.com/questions/3291712/is-it-possible-to-open-a-popup-with-javascript-and-then-detect-when-the-user-clo
// The window.opener property refers to the page that spawned this popup.
// For example, if I wrote a function named callingPageFunction on my original page, I would call it from the popup like this:
$(window).unload(function() {
window.opener.callingPageFunction()
});
var wnd = window.open("file.html", "youruniqueid", "width=400, height=300");
@cheeyeo
cheeyeo / README.md
Created February 18, 2011 19:19 — forked from anonymous/README.md
EM + Twitter Stream example

Getting started

First add your twitter username and password. Then server.rb and once it's started open websocket.html in your browser. You should see some tweets appear. If not take a look at the javascript console.

@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() {