nix on kil
Some checks failed
/ lint (push) Failing after 32s

This commit is contained in:
Jana Dönszelmann 2026-01-19 19:08:00 +01:00
parent b84f878dbd
commit acd7def6ed
No known key found for this signature in database
28 changed files with 5069 additions and 143 deletions

50
scriptlib/scriptlib.py Normal file
View file

@ -0,0 +1,50 @@
from math import *;
# import numpy as np
from pathlib import Path
import subprocess
import os
from pprint import pprint
from itertools import *
Path.__repr__ = lambda i: f"p'{str(i)}'"
kilo = 1000
mega = 1000 * kilo
giga = 1000 * mega
tera = 1000 * giga
peta = 1000 * tera
b = 1
kib = 1024
mib = 1024 * kib
gib = 1024 * mib
tib = 1024 * gib
pib = 1024 * tib
inch = 0.0254
yard = 0.9144
def cwd():
return Path.cwd()
def ls(d = None):
if d is None:
d = cwd()
return list(Path(d).iterdir())
def glob(expr):
return list(cwd().glob(expr))
def run(cmd, only_stdout=True):
res = subprocess.run(cmd, capture_output=True, text=True, shell=True)
if only_stdout:
return str(res.stdout)
else:
return res
def cat(file):
return open(file, "r").read()
print_ = print
print = pprint