Skip to content

Instantly share code, notes, and snippets.

View wunki's full-sized avatar
🏠
Working from my home in the Netherlands.

Petar Radošević wunki

🏠
Working from my home in the Netherlands.
View GitHub Profile
@wunki
wunki / wercker.yml
Created June 20, 2013 20:41
Wercker deployment script for Clojure.
box: wercker/default
services:
- wercker/postgresql
- wercker/rabbitmq
- wercker/redis
build:
steps:
- script:
name: install clojure
code: |
@wunki
wunki / Main.hs
Created August 6, 2013 19:12
Pinki, first working draft.
{-# LANGUAGE OverloadedStrings #-}
{-
Pinki is a command line tool which helps you share files on S3 by
creating a static HTML page which is uploaded together with the file.
You could say it's Hakyll for file sharing.
-}
module Main where
(defun wunki-folder-for-account (folder)
"Returns the correct folder for this account"
(lambda (msg)
(if msg
(let ((account (nth 1 (split-string (mu4e-message-field msg :maildir) "/"))))
(format "%s/%s" account folder)))))
@wunki
wunki / compression.clj
Created January 26, 2014 20:21
Most simple form of string compression.
(defn string-compression
"Compresses a string by appending the count after the repeat of each
letter. For example: \"aabccccaaa\" would become \"a2b1c4a3\".
If the compressed string is larger than the original, it should return the
original."
[s]
(let [cnt-orig (count s)
compress-fn (fn [coll c]
(if (empty? coll)
@wunki
wunki / 10-keyboard.conf
Last active August 29, 2015 13:57
Keyboard configuration for Dvorak in X11.
Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "XkbLayout" "dvorak"
Option "XkbVariant" "dvorak"
Option "XkbOptions" "ctrl:nocaps"
EndSection
@wunki
wunki / anonymous-gist.clj
Last active August 29, 2015 13:57
Type annotation for rename-keys
(ann ^:no-check clojure.set/rename-keys [(Map Any Any) (Map Keyword Keyword) -> (Map Any Any)])
;; Type Error (gibbon/service/postgres.clj:23:7) Type mismatch:
;; Expected: (Map Any Any)
;; Actual: (TFn [[a :variance :covariant] [b :variance :covariant]] (APersistentMap a b))
@wunki
wunki / concurrent.rs
Created March 20, 2014 11:41
Concurrent #2
fn main() {
for num in range(0, 100) {
spawn(proc() println!("Hello"))
}
}
@wunki
wunki / 01-multiples.rs
Created March 20, 2014 13:47
Euler - Problem 1
/***
*
* If we list all the natural numbers below 10 that are multiples of 3 or 5, we
* get 3, 5, 6 and 9. The sum of these multiples is 23.
*
* Find the sum of all the multiples of 3 or 5 below 1000.
*
***/
fn is_multiple(num: int) -> bool {
@wunki
wunki / 01-multiples.rs
Created March 20, 2014 14:05
Total in FP and OOP
/***
*
* If we list all the natural numbers below 10 that are multiples of 3 or 5, we
* get 3, 5, 6 and 9. The sum of these multiples is 23.
*
* Find the sum of all the multiples of 3 or 5 below 1000.
*
***/
fn is_multiple(num: int) -> bool {
clojure.lang.ExceptionInfo: Request: [{:body {:foo "bar"}, :query-string nil, :uri "/users"}]<BR>==> Error: [{:foo disallowed-key, :username missing-required-key}]<BR>==> Context: [:body]
    data: {:type :coercion-error,
           :schema {:username java.lang.String},
           :data {:foo "bar"},
           :context :body}

Try destructuring it with slingshot: