Skip to content

Instantly share code, notes, and snippets.

busy, busy

Mike Bijon mbijon

busy, busy
View GitHub Profile
/* License:
* Public domain.
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
j-adamczyk /
Last active Nov 20, 2021
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 9, 2021
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 9, 2021
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 Jul 8, 2021
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) {