Skip to content

Instantly share code, notes, and snippets.

View jannismain's full-sized avatar
📖

Jannis Mainczyk jannismain

📖
  • codecentric
  • Munich, Germany
View GitHub Profile
@jannismain
jannismain / google_docstrings_markdown_example.py
Last active January 8, 2024 16:37
Google Docstrings Example
​"""Example Google style docstrings.
This module demonstrates documentation as specified by the `Google Python
Style Guide <http://google.github.io/styleguide/pyguide.html>`_.
Docstrings may extend over multiple lines. Sections are created
with a section header and a colon followed by a block of indented text.
Example:
Examples can be given using either the ``Example`` or ``Examples``
sections. Sections support any reStructuredText formatting, including
@jannismain
jannismain / .markdownlint-cli2.jsonc
Last active May 22, 2023 07:43
configure markdownlint-cli2 to lint math in CLI and pre-commit hook properly
{
"markdownItPlugins": [
["markdown-it-texmath"]
],
"config": {
"MD013": false
}
}
@jannismain
jannismain / git-cleanup-repo
Last active July 20, 2022 10:56 — forked from robmiller/git-cleanup-repo
A script for cleaning up Git repositories; it deletes branches that are fully merged into your default branch, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
#!/bin/bash
# git-cleanup-repo
#
# Adapted by Jannis Mainczyk <[email protected]>
# - support different default branches
# - add output per step
# Adapted by Rob Miller <[email protected]>
# Original by Yorick Sijsling
default_branch=${1:-master}
read -p "Continue with default branch '${default_branch}' (y/N)? "
@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 October 25, 2024 15:50
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)