Skip to content

Instantly share code, notes, and snippets.

nnoremap ; :
imap jj <ESC>
execute pathogen#infect()
syntax on
filetype plugin indent on
set noswapfile
set ts=2
set ignorecase
set expandtab
set softtabstop=2
@GoWind
GoWind / currying.clj
Last active March 28, 2018 15:24
Currying macro
(defn variadic-list?
[arglist]
(reduce (fn [v m] (or v (= m (symbol '&)))) false arglist))
(defn variadic?
[argslists]
(some variadic-list? argslists))
(defn argslists->counts
@GoWind
GoWind / kochcurve.clj
Created June 3, 2017 11:38
A simple kochcurve fractal illustration
(ns kochcurve.core
(:require [quil.core :as q]
[quil.middleware :as m]))
@GoWind
GoWind / infix.clj
Created March 5, 2017 11:54
An infix reader in Clojure
(ns infix)
;; Parse a set of expressions in infix format to something clojure can evaluate
(defmacro expand-infix [expr]
(cond (number? expr)
expr
(symbol? expr)
expr
(not (= (count expr) 3))
(throw (Exception. ">3 items "))
@GoWind
GoWind / quicksort.clj
Created March 4, 2017 11:06
Y Combinator implementation of quicksort
;; A y combinator implementation of quicksort in Clojure
(def g
(((fn [f]
(f f))
(fn [func]
(fn [k]
(cond
(empty? k)
k
(= (count k) 1)
@GoWind
GoWind / totp.py
Created January 28, 2017 08:35
TOTP implementation
import hashlib
import time
import math
import hmac
def lpad(x, padlen=16):
if len(x) >= padlen:
return x
return '0'*(padlen-len(x)) + x
@GoWind
GoWind / vimrc
Created December 6, 2016 14:05
my vimrc file
nnoremap ; :
set ts=2
set shiftwidth=2
set expandtab
syntax on
filetype indent on
call pathogen#infect("~/.vim/bundle/{}")
set statusline=%F
set statusline+=%=
@GoWind
GoWind / rungkutta.clj
Created December 1, 2016 12:13
A Rung-Kutta 2nd order solver for ordinary differential equations
(ns rungkutta)
;; I used materials from the following website
;; as I found them very easy to understand
;; http://nm.mathforcollege.com/
;; this is a constant, compute this only once so that we save some time
(def g (double (* -2.2067 (Math/pow 10 -12))))
(def k (double (* -81 (Math/pow 10 8))))
(defn rk2

Keybase proof

I hereby claim:

  • I am GoWind on github.
  • I am govind (https://keybase.io/govind) on keybase.
  • I have a public key whose fingerprint is 18B6 161F 3761 D82E BD15 5AA5 A4E2 7754 FD37 948F

To claim this, I am signing this object:

(defmacro reverser
[f]
`(fn [& more#] ;use gensym to prevent variable capture
(apply ~f (reverse more#))))