Skip to content

Instantly share code, notes, and snippets.

View postspectacular's full-sized avatar
🎉
Celebrating 24 years of building open source tools

Karsten Schmidt postspectacular

🎉
Celebrating 24 years of building open source tools
View GitHub Profile
@postspectacular
postspectacular / rsakeypairgen.clj
Created October 21, 2014 21:22
RSA keypair generator w/ Clojure (requires Bouncycastle & unlimited JCE). Based on bundled example (org.bouncycastle.openpgp.examples.RSAKeyPairGenerator)
;; usage:
;;
;; (-> (rsa-keypair 2048)
;; (generate-secret-key "alice@example.org" "hello")
;; (export-keypair "alice.pub" "alice.sec" true))
(import
'[java.util Date]
'[java.security SecureRandom KeyPair KeyPairGenerator]
'[org.bouncycastle.jce.provider BouncyCastleProvider]
@postspectacular
postspectacular / gist:453c72b62f47d870cce0
Created November 5, 2014 14:32
ffmpeg animated gif (optionally w/ watermark)
# 12fps resize to 640x360
ffmpeg -f image2 -r 12 -i frame-%04d.png -pix_fmt rgb24 -r 12 -s 640x360 anim.gif
# with watermark
ffmpeg -f image2 -r 12 -i frame-%04d.png -pix_fmt rgb24 -r 12 -s 640x360 -vf "movie=credits.png [watermark]; [in][watermark] overlay=10:10 [out]" anim.gif

Toxi's Lebkuchen (plain "Elisen" style)

Spice blend

  • 3 whole star anise
  • 15 whole cardamon pods
  • 2 tblsp ground cinnamon (or ~0.75 stick)
  • 1.5 tblsp ground cloves
  • 0.5 tsp ground coriander
  • 0.75 tsp ground ginger
@postspectacular
postspectacular / hsv2rgb.ino
Last active February 22, 2024 12:53
Super compact HSV/RGB conversions for Arduino/C
int redPin = 6;
int greenPin = 5;
int bluePin = 9;
float col[3];
float hue = 0.0;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
@postspectacular
postspectacular / gist:a50083bdd22441a295d0
Created February 19, 2015 12:05
High quality JPG conversion w/ IM
convert -strip -interlace Plane -sampling-factor 4:2:0 -define jpeg:dct-method=float -quality 90% src.jpg dest.jpg
@postspectacular
postspectacular / coloredmesh.cljs
Last active August 29, 2015 14:17
geom-webgl workaround for individual colored faces: Until face/vertex attributes are implemented in https://github.com/thi-ng/geom, colored meshes for WebGL apps can be achieved by building the attribute buffers (semi)manually...
(ns coloredmesh
(:require
[thi.ng.geom.core :as g]
[thi.ng.geom.core.vector :as v]
[thi.ng.geom.core.matrix :as mat :refer [M44]]
[thi.ng.geom.aabb :as a]
[thi.ng.geom.core.utils :as gu]
[thi.ng.geom.webgl.core :as gl]
[thi.ng.geom.webgl.arrays :as arrays]
[thi.ng.geom.webgl.animator :as anim]
@postspectacular
postspectacular / fps.cljs
Last active March 8, 2016 19:36
Reagent/re-frame FPS visualization component & tick handler example
;; dependencies:
;; [cljsjs/react "0.12.2-5"]
;; [reagent "0.5.0"]
;; [re-frame "0.2.0"]
;; [cljs-log "0.2.1"]
(ns example.fps
(:require-macros
[reagent.ratom :refer [reaction]]
[cljs-log.core :refer [info]])
@postspectacular
postspectacular / ebug.cljs
Created April 16, 2015 18:05
Clojurescript eduction reduce bug?
;; CLJS 0.0-3196
(reduce conj [] (eduction (filter identity) [1 2 3 4]))
;; [1 2 3 4]
(defrecord Foo [state])
(defn add-foo [foo x] (Foo. (conj (:state foo) x)))
(reduce add-foo (Foo. []) (sequence (filter identity) [1 2 3 4]))
;; => #cljs.user.Foo{:state [1 2 3 4]}
Below I collected relevant links and papers more or less pertaining to the subject of tetrahedral meshes.
It's an ever-growing list.
------------------------------
Relevant links:
http://en.wikipedia.org/wiki/Types_of_mesh
http://en.wikipedia.org/wiki/Tetrahedron
http://en.wikipedia.org/wiki/Simplicial_complex
@postspectacular
postspectacular / gist:b62565c0e788e8f27dfd
Last active August 29, 2015 14:22
geom-webgl mesh handling with & without vertex attributes (temp. workaround until fully implemented)
(require
'[thi.ng.geom.core :as g]
'[thi.ng.geom.core.vector :as v :refer [vec2 vec3]]
'[thi.ng.geom.core.matrix :refer [M44]]
'[thi.ng.geom.core.utils :as gu]
'[thi.ng.geom.aabb :as a]
'[thi.ng.geom.plane :as pl]
'[thi.ng.geom.quad :as q]
'[thi.ng.geom.webgl.core :as gl]
'[thi.ng.geom.webgl.buffers :as buf]