Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Petar Radošević wunki

🏠
Working from home
Block or report user

Report or block wunki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wunki
wunki / wercker.yml
Created Jun 20, 2013
Wercker deployment script for Clojure.
View wercker.yml
box: wercker/default
services:
- wercker/postgresql
- wercker/rabbitmq
- wercker/redis
build:
steps:
- script:
name: install clojure
code: |
@wunki
wunki / Main.hs
Created Aug 6, 2013
Pinki, first working draft.
View Main.hs
{-# 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
View gist:6896949
(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 Jan 26, 2014
Most simple form of string compression.
View compression.clj
(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 Aug 29, 2015
Keyboard configuration for Dvorak in X11.
View 10-keyboard.conf
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 Aug 29, 2015
Type annotation for rename-keys
View anonymous-gist.clj
(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))
View concurrent.rs
fn main() {
for num in range(0, 100) {
spawn(proc() println!("Hello"))
}
}
@wunki
wunki / 01-multiples.rs
Created Mar 20, 2014
Euler - Problem 1
View 01-multiples.rs
/***
*
* 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 Mar 20, 2014
Total in FP and OOP
View 01-multiples.rs
/***
*
* 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 {
View gist:11252574
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:

You can’t perform that action at this time.