Skip to content

Instantly share code, notes, and snippets.

View hynek's full-sized avatar
🌴
On vacation, very AFK

Hynek Schlawack hynek

🌴
On vacation, very AFK
View GitHub Profile
@mahmoud
mahmoud / get_leaf_paths.py
Created December 22, 2018 20:27
By request of @hynek :)
# https://twitter.com/hynek/status/1076048147074478080
from boltons.iterutils import remap
DATA = {"a": {"b": 1, "c": {"d": 2}}}
OUT = ["a.b", "a.c.d"]
def get_leaf_paths(root, with_val=False):
@ambv
ambv / enable_offline.py
Last active November 14, 2016 19:44
Make `pip install --no-index -f $PIP_DOWNLOAD_CACHE SomePackage` work.
#!/usr/bin/env python
"""
enable_offline.py - symlink files in your PIP_DOWNLOAD_CACHE so that
``pip install --find-links`` picks them up.
Inspired by http://tartley.com/?p=1423
Usage
-----
@sjl
sjl / nextlast.vim
Created September 21, 2012 15:36
next/last text objects
" Next and Last {{{
" Motion for "next/last object". "Last" here means "previous", not "final".
" Unfortunately the "p" motion was already taken for paragraphs.
"
" Next acts on the next object of the given type in the current line, last acts
" on the previous object of the given type in the current line.
"
" Currently only works for (, [, {, b, r, B, ', and ".
"