Skip to content

Instantly share code, notes, and snippets.

@kolja
kolja / fashionworld.jpg
Last active February 7, 2019 13:49
Kolja's Fashion World
fashionworld.jpg
@kolja
kolja / primes.clj
Created November 9, 2017 18:21
calculate prime numbers and prime factors with clojure
(ns primes.core)
(defn- primes
"returns a lazy list of prime numbers via the sieve of eratosthenes"
([]
(primes (iterate inc 2)))
([[head & tail]]
(cons head
(lazy-seq (primes (remove #(and (not= % head)
(zero? (mod % head))) tail))))))
@kolja
kolja / balanced.cljs
Last active September 20, 2017 14:18
find out if a string with parens is balanced
#!/usr/local/bin/lumo
(ns balanced.core
(:require [lumo.core :refer [*command-line-args*]]
[clojure.string :refer [join]]))
(defn is-pair? [ch1 ch2]
(let [pairs {"(" ")"
"[" "]"
"{" "}"}]
(= (get pairs ch1) ch2)))
@kolja
kolja / sphere.cljs
Last active May 22, 2017 11:08
create a sphere from cubes
#!/usr/local/bin/lumo
(ns sphere.core
(:require [lumo.core :refer [*command-line-args*]]
[clojure.string :refer [join]]
[cljs.reader :refer [read-string]]))
(defn sqr [n] (* n n))
(defn sqrt [n] (.sqrt js/Math n))
(defn cbrt [n] (.cbrt js/Math n))
(defn abs [n] (.abs js/Math n))
// ==UserScript==
// @name aws-login
// @source
// @downloadURL
// @version 0.1.0
// @description login to AWS
// @author kolja
// @include *://signin.aws.amazon.com/saml
// @run-at document-idle
// @grant none
@kolja
kolja / add.js
Created October 26, 2014 12:44
Add Numbers by passing them to the same function in succession
var add = function(x) {
add.sum = add.sum || 0;
add.sum += x;
add.valueOf = function() {
return add.sum;
};
return add;
};
-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
owGbwMvMwMV46WzJSv/3XXsZTx94lsQQYin7oFopKT+lUsmqWik5JzM1rwTEykvM
TVWyUspOrUxKLE7Vy8xXyMtPSdXLKlaAqtFRKkstKs7MzwOqMtAz1zNSqtUBKQdp
TsvMS08tKijKBJmlZGJsapJskmaSZGZkYmRqZGBoaWmcapZslmKUnGJukmhpkpaa
ZpGYlAI0MiO/uATFViWwmfGZKUBRFyNnF3MTR0sTN1c3C0cnF6BcKVgiydzQIikx
0dQkycLMPCnJ0MzIwMQ8LSU5xTLZINnUwACksDi1COal/JysRJBjgUJlmcmpSL5N
zyzJKE3CobyksgDEL09NiofqjE/KzEsBehU5LAyBKpNLMkFaDU0MjQ2MLI0NDXSU
@kolja
kolja / daily.coffee
Last active December 18, 2015 09:59
cli to read and write "diary entries" to CouchDB
#!/usr/local/bin/coffee
nopt = require 'nopt'
nano = require('nano')('http://localhost:5984/dailies')
optionDef =
"u": String # user
"m": String # Message
"l": Number
"t": [String, Array] # Tags