Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Tan jtan189

View GitHub Profile
@jtan189
jtan189 / kmeans.py
Created Feb 19, 2020 — forked from mblondel/kmeans.py
Fuzzy K-means and K-medians
View kmeans.py
# 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 Jan 24, 2019 — forked from marcan/bloom.py
Simple Bloom filter implementation in Python 3 (for use with the HIBP password list)
View bloom.py
#!/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):
View gist:98e4d27d16227ceae4db74c5b1696a0a
Verifying that "jtan189.id" is my Blockstack ID. https://onename.com/jtan189
View keybase.md

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 Sep 29, 2012
Java PBKDF2 Password Hashing Code
View JavaPasswordSecurity.java
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
You can’t perform that action at this time.