Skip to content

Instantly share code, notes, and snippets.

View m3tti's full-sized avatar

Mathäus m3tti

View GitHub Profile
@m3tti
m3tti / pdf-to-text.cljs
Last active May 1, 2025 14:23
Convert PDF to text with pdf.js
(ns pdf-to-txt
(:require
["pdfjs-dist" :as pdfjs]))
(assoc!
pdfjs.GlobalWorkerOptions
:workerSrc "https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.worker.mjs")
(defn cleanup-text [txt]
(.replaceAll txt "\"" "'"))
@m3tti
m3tti / password-hash.clj
Last active August 31, 2024 04:06
Babashka / Clojure password hashing
(import java.security.SecureRandom)
(import javax.crypto.SecretKeyFactory)
(import javax.crypto.spec.PBEKeySpec)
(defn bytes->hex [byt]
(apply str (map #(format "%02x" %) byt)))
(defn hex->bytes [hex]
(.toByteArray (BigInteger. hex 16)))