Skip to content

Instantly share code, notes, and snippets.

@guns
guns / ffmpeg2.0.patch
Created August 27, 2013 03:35
Patch for cinelerra-cv ffmpeg2.0.patch
diff --git a/cinelerra/ffmpeg.C b/cinelerra/ffmpeg.C
index 6ab6047..f1cd308 100644
--- a/cinelerra/ffmpeg.C
+++ b/cinelerra/ffmpeg.C
@@ -33,9 +33,9 @@ int FFMPEG::init(char *codec_string) {
return 1;
}
- context = avcodec_alloc_context();
+ context = avcodec_alloc_context3(codec);
@guns
guns / ggs.clj
Created October 13, 2013 09:36
John Korpi's Golden Grid System, rewritten in Garden. This is just a first draft, and excludes the CSS reset and normalizations. Garden: https://github.com/noprompt/garden/
(ns com.metablu.www.ggs
"Joni Korpi's Golden Grid System.
http://goldengridsystem.com/"
(:require [garden.def :refer [defstyles]]
[garden.stylesheet :refer [at-media]]
[garden.units :refer [em percent percent*]]))
(def line 24.0)
(def column (percent (/ 100.0 18.0)))
(def font-size 16.0)

Deferred reference validation

technomancy, from technomancy/slamhound#19:

“I’ve thought a bit about trying to walk all defmacro bodies in the namespace and check for symbols with a namespace, but that would almost positively result in false positives.”

“I’d rather not handle this than handle this in a way that would have edge cases which could make it go looking for vars that don’t exist.”

@guns
guns / tools.cli.proposal.mail
Last active December 28, 2015 22:48
tools.cli proposal
On Sun 25 Aug 2013 at 09:05:15PM -0500, gaz jones wrote:
> Hey, i am the current maintainer of tools.cli - i have very little
> time to make any changes to it at the moment (kids :) ). I'm not sure
> what the process is for adding you as a developer or transferring
> ownership etc but if I'm happy to do so as I have no further plans for
> working on it.
Hello Gareth,
@guns
guns / muttrc
Created November 23, 2013 20:50
Encrypt mail only to recipients with public keys
# Encrypt mail only to recipients with public keys
set my_cryptlist=`gpg --list-keys | ruby -e '\
puts $stdin.read.scan(/<(.*?)>/)\
.map { |(e)| "\\\\\\\\<%s\\\\\\\\>" % Regexp.escape(Regexp.escape(Regexp.escape(e))) }\
.join("\\\\|")'`
send-hook ~A "set crypt_autoencrypt=no"
send-hook "~t ($my_cryptlist)" "set crypt_autoencrypt=yes"
@guns
guns / readline.patch
Last active December 29, 2015 09:49
gherkin readline() patch
diff --git a/gherkin b/gherkin
index 2567adf..aeb97e6 100755
--- a/gherkin
+++ b/gherkin
@@ -37,15 +37,12 @@ pb_get="^$"
pb_unget="^$"
readline() {
- IFS=$'\n\b'
+ local IFS=$'\n\b'
@guns
guns / minimum_edit_distance.clj
Last active December 29, 2015 09:59
A naive implementation of minimum edit distance (Levenshtein distance) in Clojure.
(ns minimum-edit-distance
"A naive implementation of minimum edit distance in Clojure.
From: https://www.stanford.edu/class/cs124/lec/med.pdf
Initialization:
D(i,0) = i
D(0,j) = j
@guns
guns / bar.clj
Created January 14, 2014 21:40
fireplace#source() issue
(ns bar
(:refer-clojure :exclude [defn]))
(defmacro defn [& _])
;; Any type of error class, as CLJS uses js/Error
(defn e! [fmt & args]
(throw (AssertionError. (apply format fmt args))))
;; Exception message takes precedence over :validation-msg
["-i" "--input-directory DIR"
:validate-fn #(cond (not (ok-path? %))
(e! "Input directory path %s is malformed" (pr-str %))
(let [f (File. %)]
@guns
guns / gist:621b622738baec56c4b9
Created May 1, 2014 17:10
Type scaffolding of Clojure objects
(defn type-scaffold
"https://gist.github.com/mpenet/2053633, originally by cgrand"
[^Class cls]
(let [ms (map (fn [^Method m]
[(.getDeclaringClass m)
(symbol (.getName m))
(map #(symbol (.getCanonicalName ^Class %)) (.getParameterTypes m))])
(.getMethods cls))
idecls (mapv (fn [[^Class cls ms]]
(let [decls (map (fn [[_ s ps]] (str (list s (into ['this] ps))))