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
@daniarleagk
daniarleagk / .block
Last active May 10, 2021 14:09
Z-Order curve range query
license: mit
height: 1024
@provos
provos / inorder-neighbour-traversal.cpp
Created October 23, 2016 14:17
VEX code for getting an in-order traversal of the neighbours of a point; assumes connected primitives.
/* returns the in-order neighbours of a point - based on matching primitives */
void inorder_neighbours(int point_number; int points[] /* returned */) {
int nc = neighbourcount(geoself(), point_number);
resize(points, nc);
int prims[] = pointprims(geoself(), point_number);
int points_in_prim[] = primpoints(geoself(), prims[0]);
//
// WE EXPECT THREE POINTS PER PRIMITIVE!!!
@kbarbary
kbarbary / simd-vmv.c
Created October 8, 2016 18:29
Vector-matrix-vector multiplication with SIMD (AVX) intrinsics
// Doing the operation:
//
// | a a a a | | y |
// x * A * y = [ x x x x ] | a a a a | | y |
// | a a a a | | y |
// | a a a a | | y |
//
// with SIMD intrinics (specifically AVX).
//
// adapted from https://gist.github.com/rygorous/4172889
@ideasman42
ideasman42 / fill_poly_v2i_n.c
Last active August 18, 2023 03:07
Raster poly-filling by Darel Rex Finley, optimized by Campbell Barton.
/* C99, public domain licensed */
#include <limits.h>
#include <stdbool.h>
#include <math.h>
/* utilities */
#define SWAP(type, a, b) do { \
type sw_ap; \
@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active January 13, 2025 03:52
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@bmhatfield
bmhatfield / .profile
Last active January 29, 2025 11:11
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@wellsie
wellsie / text-overlay.sh
Created April 1, 2016 00:07
GraphicsMagick text overlay
#!/bin/bash -eux
gm convert -font helvetica -fill blue -pointsize 36 -draw "text 15,50 'hello'" source.jpg destination.jpg
@jackrusher
jackrusher / core.cljs
Last active June 4, 2021 19:59
The simplest possible @thing_clj physics + @Quilist demo
(ns gumball-machine.core
(:require [thi.ng.color.core :as col]
[thi.ng.math.core :as m]
[thi.ng.geom.core :as g]
[thi.ng.geom.core.vector :refer [vec3]]
[thi.ng.geom.physics.core :as ph]
[thi.ng.geom.sphere :refer [sphere]]
[quil.core :as q :include-macros true]))
(def particles
@jackrusher
jackrusher / koch-like.clj
Created January 18, 2016 10:57
A quick 3D L-system implementation using Toxi's https://github.com/thi-ng libraries.
(defn grow [pos rot points len]
(let [[x y z] (last rot) ;; :( no M33 and no (g/rotate-xyz _ (vec3 x y z))
corners (map #(-> % (g/rotate-x x) (g/rotate-y y) (g/rotate-z z) (g/+ (last pos)))
[(vec3 0 0 0) (vec3 -1 0 0) (vec3 0 -1 0) (vec3 0 1 0)
(vec3 -1 0 len) (vec3 0 -1 len) (vec3 0 1 len) (vec3 0 0 len)])]
[(conj (pop pos) (last corners))
rot
(conj points (map gu/tessellate-3 (g/faces (apply cub/cuboid corners))))]))
(defn build-lsystem [l-system angle len]
@bishboria
bishboria / springer-free-maths-books.md
Last active March 24, 2025 13:36
Springer made a bunch of books available for free, these were the direct links