Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jtan189
jtan189 / kmeans.py
Created February 19, 2020 16:34 — forked from mblondel/kmeans.py
Fuzzy K-means and K-medians
# Copyright Mathieu Blondel December 2011
# License: BSD 3 clause
import numpy as np
import pylab as pl
from sklearn.base import BaseEstimator
from sklearn.utils import check_random_state
from sklearn.cluster import MiniBatchKMeans
from sklearn.cluster import KMeans as KMeansGood
@jtan189
jtan189 / bloom.py
Created January 24, 2019 22:24 — forked from marcan/bloom.py
Simple Bloom filter implementation in Python 3 (for use with the HIBP password list)
#!/usr/bin/python3
#
# Simple Bloom filter implementation in Python 3
# Copyright 2017 Hector Martin "marcan" <marcan@marcan.st>
# Licensed under the terms of the MIT license
#
# Written to be used with the Have I been pwned? password list:
# https://haveibeenpwned.com/passwords
#
# Download the pre-computed filter here (968MB, k=11, false positive p=0.0005):
Verifying that "jtan189.id" is my Blockstack ID. https://onename.com/jtan189

Keybase proof

I hereby claim:

  • I am jtan189 on github.
  • I am jtan (https://keybase.io/jtan) on keybase.
  • I have a public key ASArAOyseL73hhmQKaJIwZMoydBE2rNmwYxuK9VKWjiTDAo

To claim this, I am signing this object:

@jtan189
jtan189 / JavaPasswordSecurity.java
Created September 29, 2012 15:10
Java PBKDF2 Password Hashing Code
import java.security.SecureRandom;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/*
* PBKDF2 salted password hashing.
* Author: havoc AT defuse.ca