Skip to content

Instantly share code, notes, and snippets.

View wojtha's full-sized avatar

Vojtěch Kusý wojtha

View GitHub Profile
@wojtha
wojtha / .gitattributes
Created October 22, 2020 21:45 — forked from tekin/.gitattributes
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
*.cpp diff=cpp
*.hpp diff=cpp
*.cc diff=cpp
*.hh diff=cpp
*.m diff=objc
*.mm diff=objc
@wojtha
wojtha / getdeep.py
Created April 28, 2022 08:22 — forked from av1m/getdeep.py
Crosses a list or dictionary in an elegant way using list or str as key
"""Utility functions"""
from functools import reduce
from operator import getitem
from typing import Any, Mapping, Union
def getdeep(data: Mapping, map_list: Union[list, str], default: Any = None) -> Any:
"""Iterate nested dictionary|list and can return default value if key not found