mirror of
https://codeberg.org/Mo8it/dotfiles.git
synced 2024-12-04 23:40:32 +00:00
Compare commits
6 commits
4abaf45e30
...
cd4b912bad
Author | SHA1 | Date | |
---|---|---|---|
cd4b912bad | |||
c1971b86b3 | |||
d5d5c2e8d7 | |||
278af2f184 | |||
0b8913458f | |||
d70b6cd470 |
12 changed files with 200 additions and 47 deletions
|
@ -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"
|
||||
|
|
|
@ -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..]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
shell /home/mo/.cargo/bin/zellij a -c --index 0
|
||||
#shell fish
|
||||
|
||||
scrollback_lines 100000
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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"] }
|
||||
|
|
53
.config/zellij/layouts/how_to_linux.yml
Normal file
53
.config/zellij/layouts/how_to_linux.yml
Normal 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"],
|
||||
}
|
39
.config/zellij/layouts/pgp.yml
Normal file
39
.config/zellij/layouts/pgp.yml
Normal 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"] }
|
45
.config/zellij/layouts/reco.yml
Normal file
45
.config/zellij/layouts/reco.yml
Normal 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"],
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import re
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
from getpass import getpass
|
||||
|
|
Loading…
Reference in a new issue