Skip to content

Instantly share code, notes, and snippets.

View milanboers's full-sized avatar
🙃

Milan Boers milanboers

🙃
View GitHub Profile
@milanboers
milanboers / clone.bash
Last active July 10, 2026 23:20
Clone all repositories of a Github user
curl -s https://api.github.com/users/milanboers/repos | grep \"clone_url\" | awk '{print $2}' | sed -e 's/"//g' -e 's/,//g' | xargs -n1 git clone
@milanboers
milanboers / MillerRabin.scala
Last active May 1, 2016 05:12
Deterministic version of the Miller-Rabin primality test for Scala
//MillerRabin.scala
import scala.language.implicitConversions
object MillerRabin {
implicit class MillerRabin(n: Long) {
private lazy val asl : Array[BigInt] = if (n < 2047L) Array(2L)
else if (n < 1373653L) Array(2L, 3L)
else if (n < 9080191L) Array(31L, 73L)
else if (n < 25326001L) Array(2L, 3L, 5L)
else if (n < 3215031751L) Array(2L, 3L, 5L, 7L)