Skip to content

Instantly share code, notes, and snippets.

@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

@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 / 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 / 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 / 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 / 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"}}
]
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<style type="text/css">
#contacts .avatar {
@Velrok
Velrok / .slate
Last active December 14, 2015 22:59 — forked from trishume/.slate
# Configs
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
# config keyboardLayout dvorak
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
@Velrok
Velrok / cleanup_latex.sh
Created March 8, 2013 10:16
Remove all the files that latex generates.
#!/bin/bash
for i in aux bbl blg fdb_latexmk fls out synctex.gz log toc lof lot
do
rm *.$i
done
@Velrok
Velrok / dict_traverser.py
Last active December 14, 2015 15:38
Taming all the trees.
def traverse_dict(node, leaf_fn, node_fn=lambda v, path: None, path=tuple()):
for k, v in node.iteritems():
current_path = path + tuple([k])
if isinstance(v, dict):
node_fn(v, current_path)
traverse_dict(v, leaf_fn, node_fn, current_path)
elif isinstance(v, list):
current_path = current_path + tuple(["[*]"])
for i in v:
if isinstance(i, dict):