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
anonymous
anonymous / emacs.memory.leak.aka.distnoted.patch.diff
Created January 22, 2014 03:45
This is a patch (with commentary) that fixes a memory leak in 24.3 for OSX Mavericks (10.9) users who experience excessive resource consumption by distnoted.
From 8ab91751069e391a95151c6716a546b1732ade92 Mon Sep 17 00:00:00 2001
From: JP <twitter:canoeberry>
Date: Sun, 19 Jan 2014 11:58:54 +0000
Subject: [PATCH] partial memleak fix
This patch was created by JP (twitter: @canoeberry) based on a memleak fix by Dirk (emacs committer) below:
https://github.com/mirrors/emacs/commit/57ae6509a3b6a274f89b9caea0284c6156470625
This memory leak is fixed in the trunk as of now and will be in the next official release: 24.4.
@tgfrerer
tgfrerer / gradient.glsl
Last active June 17, 2024 07:23
glsl gradient mapping - achieves similar looks as photoshop's (or other graphics editors') gradients with colour stops.
// _____ ___
// / / / / gradient.glsl
// / __/ * / /__ (c) ponies & light, 2014. All rights reserved.
// /__/ /_____/ poniesandlight.co.uk
//
// Created by tgfrerer on 18/03/2014.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@jackrusher
jackrusher / dbpedia.clj
Created June 1, 2014 07:14
Some leftover code from a livecoding data gathering/analysis in Clojure workshop I taught in Berlin a few days ago. (N.B. This code is meant to help one understand the concepts involved -- if one were to put something like this in production, it'd be much better to use one of the many excellent open source libraries available for this purpose.)
;; semantic web data is often formatted as RDF/XML, but I think that
;; format is horrible, so I generally prefer to use something like
;; n-triples (N3):
;; https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/n-triples.html
;; for the sake of this gist we'll limit ourselves to the flavor of N3
;; produced by dbpedia
(def fetch-n3
"Fetch N3 data for a given dbpedia resource. Expects a URL like
@gfredericks
gfredericks / brainfuck.clj
Last active August 29, 2015 14:02
A lazy brainfuck interpreter in Clojure
(ns brainfuck
"A lazy brainfuck interpreter.
Memory consists of a fixed-length array of bytes in the range
0..255, where arithmetic wraps around. Moving the data pointer
out of the range of memory throws a SEGFAULT error.
Input must be given as a string or sequence when calling one
of the eval functions, and if the program tries to read after
input has been exhausted an exception will be thrown.")
@staltz
staltz / introrx.md
Last active April 17, 2025 06:34
The introduction to Reactive Programming you've been missing
# Welcome to Sonic Pi v2.0
use_bpm 140
in_thread do
loop do
4.times do
3.times do
sample :ambi_choir, amp: 0.8
sleep 2
end
@favila
favila / async-util.clj
Created November 28, 2014 17:06
Some missing pieces of core.async. as-transducer: Make a transducer function easily without Clojure 1.7. go-pipe: async/pipe, but returns the go-loop. fast-pipeline-blocking: faster than async/pipeline-blocking, but unordered results. blocking-consumer: consume a channel with multiple worker threads.
(ns favila.async-util
"Some missing pieces of core.async.
as-transducer: Make a transducer function easily without Clojure 1.7.
go-pipe: async/pipe, but returns the go-loop.
fast-pipeline-blocking: faster than async/pipeline-blocking, but unordered results.
blocking-consumer: consume a channel with multiple worker threads."
(:require [clojure.core.async :as async
:refer [go go-loop <! >! <!! >!! close! take! put! chan]]))
(ns maya)
(defmacro math->
" (math-> 1 + 5 * 2 / 3) ;=> (-> 1 (+ 5) (* 2) (/ 3)) ;=> 4 "
[exp & f-x-pairs]
(if (even? (count f-x-pairs))
`(-> ~exp
~@(for [[f x] (partition 2 f-x-pairs)]
(list f x)))
(throw (Exception. "f-x-pairs should be even."))))
@H2CO3
H2CO3 / SpnMap.hpp
Created January 13, 2015 18:20
SpnHashMap, rewritten in C++
//
// SpnMap: Sparkling's hash table, in C++
// Created by Arpad Goretity on 13/01/2015
//
#include <vector>
#include <utility>
#include <cstdint>
#include <climits>
#include <cassert>