Skip to content

Instantly share code, notes, and snippets.

@Velrok
Velrok / Default (OSX).sublime-keymap
Created May 6, 2013 09:43
My SublimeRepl keybindings.
[
{ "keys": ["ctrl+s"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
{ "keys": ["shift+ctrl+s"], "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},
{ "keys": ["ctrl+f"], "command": "repl_transfer_current", "args": {"scope": "file"}},
{ "keys": ["shift+ctrl+f"], "command": "repl_transfer_current", "args": {"scope": "file", "action":"view_write"}},
{ "keys": ["ctrl+l"], "command": "repl_transfer_current", "args": {"scope": "lines"}},
{ "keys": ["shift+ctrl+l"], "command": "repl_transfer_current", "args": {"scope": "lines", "action":"view_write"}},
{ "keys": ["ctrl+b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
{ "keys": ["shift+ctrl+b"], "command": "repl_transfer_current", "args": {"scope": "block", "action":"view_write"}}
]
@Velrok
Velrok / vimrc
Last active December 17, 2015 09:59
My experimental vimrc.
" Use pathogen to easily modify the runtime path to include all
" " plugins under the ~/.vim/bundle directory
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
syntax on
filetype plugin indent on
set scrolloff=5 " allways show at least 3 lines
set wildmode=longest,list
@Velrok
Velrok / send_xbmc_nitification.json
Created May 26, 2013 14:54
Example post content for XBMC notifications.
/* Send this to http://<IP>:<PORT>/jsonrpc
Also set header:
Content-Type: application/json
*/
{"jsonrpc":"2.0",
"method": "GUI.ShowNotification",
"params": {"title": "Twitter Username",
"message": "Example Message.",
"image": "preview_image_url",
"displaytime": 25000},
@Velrok
Velrok / what-to-move-to-let.clj
Created June 6, 2013 14:10
Some example code to answer the question of when to move results into a let.
;; using a let to store intermediat results
(defn recommendations [scores user]
(let [user-row (.viewRow (:matrix scores)
(get (:row-mapping scores)
user))
sorted-by-score (sort-by #(get % 1)
(non-zero user-row))]
(map (fn [[item, score]]
{:item item, :score score})
sorted-by-score)))
@Velrok
Velrok / incanter_extensions.clj
Created June 14, 2013 13:01
A collection of methods related to incanter datasets that I found myself writing.
(ns athena.incanter-extensions
(:use [incanter.core :only [head $ $where nrow dataset? to-dataset]])
(:import [java.lang Math]))
(defn tail
"Like incanter.core/head but returning the tail."
([mat] (tail 10 mat))
([len mat]
(let [upper-bound (nrow mat)
@Velrok
Velrok / invitation.md
Last active December 18, 2015 14:19
Clojure Intro Workshop email text.

Hi.

Also this is not an Adcloud Event, we are mailing you, because it's the same workshop we held last month at Adcloud. Due to limited space capacities we could not fitt in all the people that where interessted.

So if you are still interessted, we will repeat a improved version of the workshop this thursday at the Cologne Clojure User Group.

Feel free to join us:

https://plus.google.com/events/c1volcdbebka7e9t27phh8mdjdk

Hi.

Though this isn't an Adcloud Event, we're mailing you because it's the same workshop we held last month at Adcloud. (Previously, we didn't have space for all the interested people.)

So if you are still interested, we will repeat an (improved) workshop this Thursday at the Cologne Clojure User Group.

Feel free to join us:

On Google Plus: https://plus.google.com/events/c1volcdbebka7e9t27phh8mdjdk

@Velrok
Velrok / all-paralell.clj
Created June 28, 2013 22:15
I indendet to see how to use fold to utilize pralell processing just to see that its prallel without the use of fold and pmap :/
(ns reducers.core
;(:require [clojure.core.reducers :as r])
)
(def N (iterate inc 0))
(def finish 6e6)
; this is just for testing if a random map function will stop the parelleltiy
(defn only-even [x]
@Velrok
Velrok / sleep.applescript
Created June 30, 2013 23:40
Apple Script -> Sleep
tell application "Finder"
sleep
end tell
@Velrok
Velrok / remove-merged-branches.sh
Last active December 19, 2015 04:49
Deletes all git branches that are already merged into master.
git branch --merged master | grep -v 'master$' | xargs git branch -d