This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the intersected dict from x and y | |
lambda x,y: {i:x[i] for i in set(x.keys()) & set(y.keys())} | |
# Get from x only the keys in list y, assuming y is a list, tuple or set.. | |
lambda x,y: {i:x[i] for i in set(x.keys()) & set(y)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lambda filters: "&".join(map(lambda kv: '%s=%s' % kv, filters.iteritems())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
curry = lambda f, g: partial( | |
lambda F, G, *args, **kwargs: F(G(*args,**kwargs)), | |
f, g | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cProfile | |
import pstats | |
def measure(func): | |
""" The decorator. """ | |
def profiling(*args, **kwargs): | |
""" The profiler. """ | |
prof = cProfile.Profile() | |
prof.enable() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def time[A](a: => A) = { | |
val now = System.nanoTime | |
val result = a | |
val micros = (System.nanoTime - now) / 1000 | |
println("%d microseconds".format(micros)) | |
result | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Code Completion | |
Plug 'shougo/deoplete.nvim' | |
" Plug 'roxma/nvim-completion-manager' | |
" Snippets | |
Plug 'shougo/neosnippet.vim' | |
Plug 'shougo/neosnippet-snippets' | |
" Ctags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# Requires https://github.com/junegunn/fzf | |
git checkout "$(git branch | awk '{print $NF}' | fzf)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#_( | |
DEPS='' | |
OPTS=' | |
-J-Xms256m -J-Xmx256m -J-client | |
' | |
exec clojure $OPTS -Sdeps "$DEPS" "$0" "$@" | |
) | |
(require '[clojure.edn :as edn] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
# TODO Fix multiple remotes | |
readarray LOCAL <<< $(git branch --no-color | awk '{print $NF}') | |
readarray REMOTE <<< $(git branch -r | sed 's/.*origin\///g') | |
REMOTE_ONLY=($(echo ${LOCAL[@]} ${LOCAL[@]} ${REMOTE[@]} | tr ' ' '\n' | sort | uniq -u)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
ykman info > /dev/null | |
SELECTED=$(ykman oath list | rofi -dmenu) | |
if [ -n "${SELECTED}" ]; then | |
ykman oath code ${SELECTED} | awk '{ print $NF }' | xsel -b | |
fi |
OlderNewer