Skip to content

Instantly share code, notes, and snippets.

View klieret's full-sized avatar
💭
🦊

Kilian Lieret klieret

💭
🦊
View GitHub Profile
asdfasdf
@klieret
klieret / obsidian.md
Last active June 5, 2024 17:04
obsidian addons etc.
@klieret
klieret / demo.txt
Created July 17, 2023 13:16
demonstration
thiw is a demo
@klieret
klieret / latexclean.py
Last active January 18, 2020 13:43
Python script to clean LaTeX build/auxiliary files with the option of doing so recursively. Asks before removing files.
#!/usr/bin/env python3
"""
Clean LaTeX build files with the option of doing so recursively.
Asks before removing files.
https://gist.github.com/klieret/b3e032095d78269c811f4f8c85f6227b
Kilian Lieret 2020
MIT license
@klieret
klieret / product_call.py
Last active November 19, 2019 14:23
Oftentimes, we call functions over a wide range of parameter values, e.g. to generate plots for different scenarios. For multiple parameters, this leads to ugly multi-loops and cumbersome boilerplate. With this snippet it becomes one line.
from typing import Callable, Optional, Dict, Any
import itertools
from tqdm.auto import tqdm
def product_call(
fct: Callable,
static: Optional[Dict[str, Any]] = None,
multi: Optional[Dict[str, Any]] = None,
progress=False
) -> Tuple[List[Dict[str, Any]], List[Any]]:
@klieret
klieret / random_file_tree.py
Last active June 9, 2020 17:43
Create a random file tree in python, e.g. random subfolders and random files.
#!/usr/bin/env python3
""" AVAILABLE AS A PACKAGE ON github.com/klieret/randomfiletree """
import sys
import os
import random
import string
from pathlib import Path
#!/bin/bash
# script to go through all figures, search all of our *.tex
# files to see if the figure is still included, and
# if not, print it to standard output
# pipe to rm to delete the unused ones then.
set -e
latex_dir=""
#!/bin/bash
# Moves one file but searches through LaTeX source
# and also changes all path references to the file
# Arg 1: Current location of the file
# Arg 2: Target location of the file
set -e
latex_dir=""
@klieret
klieret / superComplexContourPlot.wl
Last active January 13, 2018 09:38
Complex contour Plot together with 1D Plot projections of real and imaginary part
(* ::Package:: *)
(* ::Code::Initialization::Plain:: *)
superComplexContourPlot::usage="Plots a contour plot of a real expression in a complex variable,
together with 1D projections of the depedence on the real/imaginary part of the variable.
Arg 1: Expression to plot
Arg 2: Variable to plot
Opt 3: Plot label (def: '')
Opt 5: {min real part, max real part} (def: {1,1})
Opt 6: {min im part, max im part} (def: {1,1})";
@klieret
klieret / texexpression.py
Last active January 4, 2018 14:28
Fixes/Workarounds for bugs in Mathematica's LaTeX Export: Problems with Subsuperscript and with nonsensical \left and \right tags.
#!/usr/bin/env pyton3
import re
import sys
subsup_regex = re.compile(r"\\text\{Subsuperscript\}\[([^\],]*),([^\],]*),([^\],]*)\]")
minimal_braces = True