Skip to content

Instantly share code, notes, and snippets.

busy, busy

Mike Bijon mbijon

busy, busy
View GitHub Profile
j-adamczyk /
Last active Nov 7, 2020
K-Means clustring with faiss library
import faiss
import numpy as np
class FaissKMeans:
def __init__(self, n_clusters=8, n_init=10, max_iter=300):
self.n_clusters = n_clusters
self.n_init = n_init
self.max_iter = max_iter
self.kmeans = None
# -*- coding: utf-8 -*-
Created on Fri Dec 21 18:59:49 2018
@author: Nhan Tran
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
mbijon /
Created Feb 7, 2020 — forked from rahul286/
rbenv ubuntu server cheatsheet
## ubuntu server with bash shell
git clone ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone ~/.rbenv/plugins/ruby-build
## verify
type rbenv
skitaoka /
Created Mar 27, 2019
AdaBound AMSBound for Keras
# coding: utf-8
Based on Luo et al. (2019). Adaptive Gradient Methods with Dynamic Bound of Learning Rate. In Proc. of ICLR 2019.
from tensorflow import keras
class AdaBound(keras.optimizers.Optimizer):
def __init__(self, lr=0.001, beta1=0.9, beta2=0.999, final_lr=0.1, gamma=1e-3, epsilon=None, weight_decay=0, amsbound=False, **kwargs):
super(AdaBound, self).__init__(**kwargs)
with keras.backend.name_scope(self.__class__.__name__):
johnhw /
Last active Nov 25, 2020
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
import random
duhaime /
Last active Nov 14, 2020
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
jiggneshhgohel /
Last active Jun 28, 2020
Doorkeeper (with JWT token) Server and Client applications configuration, references etc

Provider(aka Server)-side configuration, routes, controllers etc


Doorkeeper 4.2.6

Devise 4.2.0


mbijon / gist:2ddf2bfecd58e4921c1350f495261a80
Created Jun 20, 2017
Ruby AES Encryption using OpenSSL
View gist:2ddf2bfecd58e4921c1350f495261a80
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest =
View optional-polyfill.js
var scripts = ['app.a700a9a3e91a84de5dc0.js']; // script for all users
var newBrowser = (
'fetch' in window &&
'Promise' in window &&
'assign' in Object &&
'keys' in Object
if (!newBrowser) {
mbijon / juggernaut_channels.rb
Created Dec 22, 2016 — forked from maccman/juggernaut_channels.rb
Sinatra Server Side Event streaming with private channels.
View juggernaut_channels.rb
# Usage: redis-cli publish message.achannel hello
require 'sinatra'
require 'redis'
conns = {|h, k| h[k] = [] }
Thread.abort_on_exception = true
get '/' do
You can’t perform that action at this time.