scriptlib
This commit is contained in:
parent
ddb92ea0c5
commit
816c61985d
5 changed files with 67 additions and 19 deletions
|
|
@ -12,7 +12,7 @@ let
|
||||||
"cp-ser" = cp-media "ser" "shows";
|
"cp-ser" = cp-media "ser" "shows";
|
||||||
"cp-ani" = cp-media "ani" "anime";
|
"cp-ani" = cp-media "ani" "anime";
|
||||||
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
|
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
|
||||||
"p" = calc;
|
"p" = builtins.trace calc calc;
|
||||||
"s" = "systemctl";
|
"s" = "systemctl";
|
||||||
"j" = "journalctl";
|
"j" = "journalctl";
|
||||||
"ju" = "journalctl -u";
|
"ju" = "journalctl -u";
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,11 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
calc = "${pkgs.python313}/bin/python -i ${pkgs.writeText "init.py" ''
|
calc = "${pkgs.python313}/bin/python -i ${pkgs.writeText "init.py" ''
|
||||||
from math import *;
|
import sys
|
||||||
# import numpy as np
|
sys.path.append("${../../scriptlib}")
|
||||||
|
sys.path.append("${pkgs.python313Packages.numpy}/lib/python3.13/site-packages/")
|
||||||
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
|
|
||||||
|
|
||||||
|
from scriptlib import *
|
||||||
''} ";
|
''} ";
|
||||||
cp-media =
|
cp-media =
|
||||||
name: media:
|
name: media:
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
# diff-editor = "${pkgs.meld}/bin/meld";
|
# diff-editor = "${pkgs.meld}/bin/meld";
|
||||||
};
|
};
|
||||||
|
|
||||||
# core.fsmonitor = "${pkgs.watchman}/bin/watchman";
|
|
||||||
core.fsmonitor = "watchman";
|
core.fsmonitor = "watchman";
|
||||||
core.watchman.register-snapshot-trigger = true;
|
core.watchman.register-snapshot-trigger = true;
|
||||||
|
|
||||||
|
|
@ -60,7 +59,7 @@
|
||||||
"--from"
|
"--from"
|
||||||
"closest_bookmark(@-)"
|
"closest_bookmark(@-)"
|
||||||
"--to"
|
"--to"
|
||||||
"@-"
|
"@"
|
||||||
];
|
];
|
||||||
catchup = [
|
catchup = [
|
||||||
"rebase"
|
"rebase"
|
||||||
|
|
@ -70,6 +69,15 @@
|
||||||
"tronk()"
|
"tronk()"
|
||||||
"--skip-emptied"
|
"--skip-emptied"
|
||||||
];
|
];
|
||||||
|
move = [
|
||||||
|
"rebase"
|
||||||
|
"-r"
|
||||||
|
];
|
||||||
|
mdiff = [
|
||||||
|
"diff"
|
||||||
|
"--from"
|
||||||
|
"tronk()"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
templates = {
|
templates = {
|
||||||
|
|
@ -119,7 +127,7 @@
|
||||||
|
|
||||||
git = {
|
git = {
|
||||||
push-bookmark-prefix = "jdonszelmann/";
|
push-bookmark-prefix = "jdonszelmann/";
|
||||||
private-commits = "description(glob:'wip:*')";
|
private-commits = "description(glob:'wip:*') | description(glob:'trial:*')";
|
||||||
write-change-id-header = true;
|
write-change-id-header = true;
|
||||||
|
|
||||||
fetch = [
|
fetch = [
|
||||||
|
|
|
||||||
50
scriptlib/scriptlib.py
Normal file
50
scriptlib/scriptlib.py
Normal 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
|
||||||
1
server exited unexpectedly
Normal file
1
server exited unexpectedly
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Ptmux;_Ga=d,q=2,d=a\\
|
||||||
Loading…
Add table
Add a link
Reference in a new issue