Skip to content

Instantly share code, notes, and snippets.

View jannismain's full-sized avatar
πŸ“–

Jannis Mainczyk jannismain

πŸ“–
View GitHub Profile
@jannismain
jannismain / .gitconfig
Created April 1, 2022 14:13 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
Python 6 hrs 26 mins β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 65.0%
TeX 1 hr 18 mins β–ˆβ–ˆβ–Šβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 13.3%
XML 40 mins β–ˆβ–β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 6.8%
CSS 31 mins β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 5.3%
Other 23 mins β–Šβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 3.9%
@jannismain
jannismain / import_from_gist.py
Last active May 14, 2020 20:26 — forked from koji-kojiro/import_from_gist.py
[Python] import from Gist
#!/usr/bin/env python3
def load_gist(gist_id):
"""translate Gist ID to URL"""
from json import load
from urllib.request import urlopen
gist_api = urlopen("https://api.github.com/gists/" + gist_id)
@jannismain
jannismain / CompactJSONEncoder.py
Last active February 15, 2026 01:56
A JSON Encoder in Python, that puts small lists on single lines.
#!/usr/bin/env python3
from __future__ import annotations
import json
class CompactJSONEncoder(json.JSONEncoder):
"""A JSON Encoder that puts small containers on single lines."""
CONTAINER_TYPES = (list, tuple, dict)