1
0
Fork 0
mirror of https://codeberg.org/Mo8it/dotfiles.git synced 2024-12-04 23:40:32 +00:00

Compare commits

...

6 commits

Author SHA1 Message Date
cd4b912bad Update Julia 2022-09-26 16:21:10 +02:00
c1971b86b3 Use env 2022-09-24 21:45:26 +02:00
d5d5c2e8d7 Use last snapshot 2022-09-24 21:45:19 +02:00
278af2f184 Add zellij layouts 2022-09-24 15:24:37 +02:00
0b8913458f Adjust zellij config 2022-09-24 15:23:40 +02:00
d70b6cd470 Add tasks to advlabdb layout 2022-09-22 01:48:04 +02:00
12 changed files with 200 additions and 47 deletions

View file

@ -8,4 +8,4 @@ fi
# User specific environment and startup programs
export GOPATH="$HOME/go"
export PATH="$HOME/.npm-global/bin:$PATH:$HOME/.cargo/bin:$GOPATH/bin"
export PATH="$HOME/.npm-global/bin:$PATH:$HOME/.cargo/bin:$GOPATH/bin:$HOME/bin/julia/bin"

View file

@ -4,7 +4,6 @@ if status is-interactive
# Interactive environment variables
set -gx EDITOR /usr/bin/nvim
set -gx JULIA_NUM_THREADS 16
# Setup
## Zoxide
@ -73,6 +72,10 @@ if status is-interactive
flatpak run org.getzola.zola $argv
end
function julia
JULIA_NUM_THREADS=16 LD_PRELOAD=/usr/lib64/libstdc++.so.6 ~/bin/julia/bin/julia $argv
end
## Taskwarrior
function ta -w task -d "Add no priority task"
task add project:$argv[1] $argv[2..]

View file

@ -1,5 +1,4 @@
shell /home/mo/.cargo/bin/zellij a -c --index 0
#shell fish
scrollback_lines 100000

View file

@ -1,5 +1,5 @@
---
default_shell: fish
default_shell: /usr/bin/fish
default_layout: default
@ -26,20 +26,20 @@ keybinds:
key: [Alt: "m"]
- action: [NewPane: ,]
key: [Alt: "n"]
- action: [Resize: Increase]
key: [Alt: "+"]
- action: [Resize: Decrease]
key: [Alt: "-"]
- action: [GoToNextTab]
key: [Alt: "o"]
- action: [GoToPreviousTab]
key: [Alt: "i"]
- action: [NewTab: ,]
key: [Alt: "t"]
- action: [FocusNextPane]
key: [Alt: "k"]
- action: [FocusPreviousPane]
key: [Alt: "j"]
- action: [Resize: Increase]
key: [Alt: "+"]
- action: [Resize: Decrease]
key: [Alt: "-"]
- action: [NewTab: ,]
key: [Alt: "t"]
- action: [GoToNextTab]
key: [Alt: "o"]
- action: [GoToPreviousTab]
key: [Alt: "i"]
- action: [Detach]
key: [Alt: "D"]
locked:
@ -47,7 +47,7 @@ keybinds:
key: [Alt: "L"]
resize:
- action: [SwitchToMode: Normal]
key: [Char: "\n", Esc]
key: [Char: "q", Esc]
- action: [Resize: Left]
key: [Char: "h"]
- action: [Resize: Down]
@ -56,17 +56,9 @@ keybinds:
key: [Char: "k"]
- action: [Resize: Right]
key: [Char: "l"]
- action: [Resize: Increase]
key: [Char: "+"]
- action: [Resize: Decrease]
key: [Char: "-"]
- action: [Resize: Increase]
key: [Alt: "+"]
- action: [Resize: Decrease]
key: [Alt: "-"]
pane:
- action: [SwitchToMode: Normal]
key: [Char: "\n", Esc]
key: [Char: "q", Esc]
- action: [MoveFocus: Left]
key: [Char: "h"]
- action: [MoveFocus: Right]
@ -87,13 +79,9 @@ keybinds:
key: [Char: "w"]
- action: [TogglePaneEmbedOrFloating, SwitchToMode: Normal]
key: [Char: "e"]
- action: [Resize: Increase]
key: [Alt: "+"]
- action: [Resize: Decrease]
key: [Alt: "-"]
move:
- action: [SwitchToMode: Normal]
key: [Char: "\n", Esc]
key: [Char: "q", Esc]
- action: [MovePane: Left]
key: [Char: "h"]
- action: [MovePane: Down]
@ -104,20 +92,16 @@ keybinds:
key: [Char: "l"]
tab:
- action: [SwitchToMode: Normal]
key: [Char: "\n", Esc]
- action: [GoToPreviousTab]
key: [Char: "h", Char: "k"]
- action: [GoToNextTab]
key: [Char: "l", Char: "j"]
key: [Char: "q", Esc]
- action: [CloseTab, SwitchToMode: Normal]
key: [Char: "x"]
- action: [ToggleActiveSyncTab, SwitchToMode: Normal]
key: [Char: "s"]
scroll:
- action: [SwitchToMode: Normal]
key: [Char: "q", Esc]
- action: [EditScrollback, SwitchToMode: Normal]
key: [Char: "e"]
- action: [SwitchToMode: Normal]
key: [Char: "\n", Esc]
- action: [ScrollDown]
key: [Char: "j"]
- action: [ScrollUp]

View file

@ -47,3 +47,9 @@ tabs:
"cd ~/code/advlabdb && poetry run ./run.py; poetry shell",
],
}
- direction: Vertical
name: "tasks"
parts:
- direction: Vertical
run:
command: { cmd: fish, args: ["-C", "vp advlabdb"] }

View file

@ -0,0 +1,53 @@
---
template:
direction: Horizontal
parts:
- direction: Vertical
borderless: true
split_size:
Fixed: 1
run:
plugin:
location: "zellij:tab-bar"
- direction: Vertical
body: true
- direction: Vertical
borderless: true
split_size:
Fixed: 2
run:
plugin:
location: "zellij:status-bar"
tabs:
- direction: Vertical
name: "lazygit"
parts:
- direction: Vertical
run:
command:
{
cmd: fish,
args: ["-C", "cd ~/code/hosted/how_to_linux && lazygit"],
}
- direction: Vertical
name: "nvim"
focus: true
parts:
- direction: Vertical
run:
command:
{
cmd: fish,
args: ["-C", "cd ~/code/hosted/how_to_linux/src && nvim"],
}
- direction: Vertical
name: "run"
parts:
- direction: Vertical
run:
command:
{
cmd: fish,
args: ["-C", "cd ~/code/hosted/how_to_linux && mdbook serve"],
}

View file

@ -0,0 +1,39 @@
---
template:
direction: Horizontal
parts:
- direction: Vertical
borderless: true
split_size:
Fixed: 1
run:
plugin:
location: "zellij:tab-bar"
- direction: Vertical
body: true
- direction: Vertical
borderless: true
split_size:
Fixed: 2
run:
plugin:
location: "zellij:status-bar"
tabs:
- direction: Vertical
name: "jupyterlab"
focus: true
parts:
- direction: Vertical
run:
command:
{
cmd: fish,
args: ["-C", "cd ~/Downloads/pgp && ./container.fish"],
}
- direction: Vertical
name: "shell"
parts:
- direction: Vertical
run:
command: { cmd: fish, args: ["-C", "cd ~/Downloads/pgp"] }

View file

@ -0,0 +1,45 @@
---
template:
direction: Horizontal
parts:
- direction: Vertical
borderless: true
split_size:
Fixed: 1
run:
plugin:
location: "zellij:tab-bar"
- direction: Vertical
body: true
- direction: Vertical
borderless: true
split_size:
Fixed: 2
run:
plugin:
location: "zellij:status-bar"
tabs:
- direction: Vertical
name: "lazygit"
parts:
- direction: Vertical
run:
command: { cmd: fish, args: ["-C", "cd ~/code/ReCo.jl && lazygit"] }
- direction: Vertical
name: "nvim"
focus: true
parts:
- direction: Vertical
run:
command: { cmd: fish, args: ["-C", "cd ~/code/ReCo.jl && nvim"] }
- direction: Vertical
name: "run"
parts:
- direction: Vertical
run:
command:
{
cmd: fish,
args: ["-C", "cd ~/code/ReCo.jl && julia scripts/update.jl"],
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
import json
import re

View file

@ -1,5 +1,6 @@
#!/usr/bin/python3
#!/usr/bin/env python3
import json
import subprocess
from getpass import getpass
from os import environ
@ -18,9 +19,9 @@ def decorated_print(str: str):
def write_home_visible_includes():
home_visible_content = set(
run(
"fd -d 1 '.*' ~", check=True, stdout=subprocess.PIPE, text=True
).stdout.split()
run("fd -d 1 '.*' ~", check=True, stdout=subprocess.PIPE, text=True)
.stdout.strip()
.split()
)
home_visible_excludes = []
@ -67,6 +68,18 @@ def mounted_backup_drive():
return mounted_drives_path / mounted_backup_drives[ind]
def get_parent_snapshot(env):
snapshots_json = run(
"restic snapshots -q --latest 1 --json",
env=env,
check=True,
stdout=subprocess.PIPE,
text=True,
).stdout.strip()
return json.loads(snapshots_json)[-1]["id"]
def pre_backup():
password = getpass("Restic repo password: ")
@ -94,20 +107,31 @@ def pre_backup():
env = environ.copy()
env["RESTIC_REPOSITORY"] = repo
env["RESTIC_PASSWORD"] = password
env["RESTIC_COMPRESSION"] = "auto"
if init_repo:
run("restic init", env=env, check=True)
parent_snapshot = None
else:
parent_snapshot = get_parent_snapshot(env)
return env
decorated_print(f"Parent snapshot: {parent_snapshot}")
return env, parent_snapshot
def backup(env):
def backup(env, parent_snapshot):
home_visible_includes = CONFIG_PATH / "home_visible_includes.txt"
includes = CONFIG_PATH / "includes.txt"
excludes = CONFIG_PATH / "excludes.txt"
if parent_snapshot is not None:
parent_arg = "--parent " + parent_snapshot
else:
parent_arg = ""
run(
f"restic backup -v --files-from {home_visible_includes} --files-from {includes} --exclude-file {excludes}",
f"restic backup -v {parent_arg} --files-from {home_visible_includes} --files-from {includes} --exclude-file {excludes}",
env=env,
check=True,
)
@ -120,9 +144,9 @@ def post_backup(env):
def main():
env = pre_backup()
env, parent_snapshot = pre_backup()
backup(env)
backup(env, parent_snapshot)
post_backup(env)

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
import subprocess
from getpass import getpass