Merge branch 'main' of github.com:nidionis/svr
This commit is contained in:
@@ -37,4 +37,5 @@ pacman --noconfirm -S git-filter-repo
|
|||||||
pacman --noconfirm -S xorg-setxkbmap
|
pacman --noconfirm -S xorg-setxkbmap
|
||||||
pacman --noconfirm -S xorg-xhost
|
pacman --noconfirm -S xorg-xhost
|
||||||
pacman --noconfirm -S qemu-full
|
pacman --noconfirm -S qemu-full
|
||||||
|
pacman --noconfirm -S qbittorrent
|
||||||
mandb #rend possible la commande apropos
|
mandb #rend possible la commande apropos
|
||||||
|
|||||||
+4
-3
@@ -1,14 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
clone ()
|
clone ()
|
||||||
{
|
{
|
||||||
URL=ssh://git@6.tcp.eu.ngrok.io:11272
|
URL=git@github.com:
|
||||||
|
PROFIL_NAME=nidionis
|
||||||
|
DEFAULT_ADDR=""
|
||||||
if [ $# -ne "1" ]; then
|
if [ $# -ne "1" ]; then
|
||||||
PROFIL_NAME="$1";
|
PROFIL_NAME="$1";
|
||||||
PROJECT_NAME="$2";
|
PROJECT_NAME="$2";
|
||||||
else
|
else
|
||||||
PROFIL_NAME=painpain
|
|
||||||
PROJECT_NAME="$1";
|
PROJECT_NAME="$1";
|
||||||
fi
|
fi
|
||||||
git clone --recurse-submodules $URL/$PROFIL_NAME/$PROJECT_NAME.git;
|
git clone --recurse-submodules $URL$PROFIL_NAME/$PROJECT_NAME.git;
|
||||||
}
|
}
|
||||||
clone "$@"
|
clone "$@"
|
||||||
|
|||||||
+20
-69
@@ -1,95 +1,48 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
# ---- ensure spacy and model ----
|
|
||||||
try:
|
|
||||||
import spacy
|
|
||||||
except ImportError:
|
|
||||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "spacy"])
|
|
||||||
import spacy
|
|
||||||
|
|
||||||
def load_model(name="fr_core_news_sm"):
|
|
||||||
try:
|
|
||||||
return spacy.load(name)
|
|
||||||
except OSError:
|
|
||||||
subprocess.check_call([sys.executable, "-m", "spacy", "download", name])
|
|
||||||
return spacy.load(name)
|
|
||||||
|
|
||||||
# ---- args ----
|
# ---- args ----
|
||||||
argparser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
argparser.add_argument("-v","--vault", default=".", help="Path to Obsidian vault")
|
parser.add_argument("-v", "--vault", default=".", help="Path to Obsidian vault")
|
||||||
argparser.add_argument("-d","--dict", default="Dictionary", help="Name of the dictionary directory")
|
parser.add_argument("-d", "--dict", default="Dictionary", help="Name of the dictionary directory")
|
||||||
args = argparser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# ---- config ----
|
# ---- config ----
|
||||||
VAULT_DIR = Path(args.vault)
|
VAULT_DIR = Path(args.vault)
|
||||||
DICT_DIR = VAULT_DIR / args.dict
|
DICT_DIR = VAULT_DIR / args.dict
|
||||||
WORD_REGEX = re.compile(r"\b[a-zA-Z]{3,}\b")
|
WORD_REGEX = re.compile(r"\b[a-zA-Z]{3,}\b")
|
||||||
|
|
||||||
nlp = load_model("fr_core_news_sm")
|
|
||||||
|
|
||||||
# ---- prep ----
|
# ---- prep ----
|
||||||
DICT_DIR.mkdir(exist_ok=True)
|
DICT_DIR.mkdir(exist_ok=True)
|
||||||
lemma_map = defaultdict(lambda: {"forms": set(), "files": set()})
|
lemma_map = defaultdict(lambda: {"forms": set(), "files": set()})
|
||||||
|
|
||||||
# ---- scan ----
|
# ---- stopwords ----
|
||||||
|
STOPWORDS = {
|
||||||
nlp.Defaults.stop_words.add(os.path.basename(os.getcwd()))
|
os.path.basename(os.getcwd()), "author", "jpeg", "jpg", "post", "like", "likes", "repost",
|
||||||
nlp.Defaults.stop_words.add("author")
|
"avatar", "bsky", "media", "thumbnail", "thumnail", "http", "https", "com", "followers",
|
||||||
nlp.Defaults.stop_words.add("jpeg")
|
"following", "unknown", "date", "social", "replier", "replie", "for", "you", "from",
|
||||||
nlp.Defaults.stop_words.add("jpg")
|
"to", "script", "grep", "localhost", "sudo", "not"
|
||||||
nlp.Defaults.stop_words.add("post")
|
}
|
||||||
nlp.Defaults.stop_words.add("like")
|
|
||||||
nlp.Defaults.stop_words.add("likes")
|
|
||||||
nlp.Defaults.stop_words.add("repost")
|
|
||||||
nlp.Defaults.stop_words.add("avatar")
|
|
||||||
nlp.Defaults.stop_words.add("bsky")
|
|
||||||
nlp.Defaults.stop_words.add("media")
|
|
||||||
nlp.Defaults.stop_words.add("thumnail")
|
|
||||||
nlp.Defaults.stop_words.add("http")
|
|
||||||
nlp.Defaults.stop_words.add("https")
|
|
||||||
nlp.Defaults.stop_words.add("com")
|
|
||||||
nlp.Defaults.stop_words.add("followers")
|
|
||||||
nlp.Defaults.stop_words.add("following")
|
|
||||||
nlp.Defaults.stop_words.add("unknown")
|
|
||||||
nlp.Defaults.stop_words.add("date")
|
|
||||||
nlp.Defaults.stop_words.add("social")
|
|
||||||
nlp.Defaults.stop_words.add("thumbnail")
|
|
||||||
nlp.Defaults.stop_words.add("replier")
|
|
||||||
nlp.Defaults.stop_words.add("replie")
|
|
||||||
nlp.Defaults.stop_words.add("for")
|
|
||||||
nlp.Defaults.stop_words.add("you")
|
|
||||||
nlp.Defaults.stop_words.add("from")
|
|
||||||
nlp.Defaults.stop_words.add("to")
|
|
||||||
nlp.Defaults.stop_words.add("script")
|
|
||||||
nlp.Defaults.stop_words.add("grep")
|
|
||||||
nlp.Defaults.stop_words.add("localhost")
|
|
||||||
nlp.Defaults.stop_words.add("sudo")
|
|
||||||
nlp.Defaults.stop_words.add("not")
|
|
||||||
|
|
||||||
|
# ---- scan vault ----
|
||||||
for md_file in VAULT_DIR.rglob("*.md"):
|
for md_file in VAULT_DIR.rglob("*.md"):
|
||||||
if "Dictionary" in md_file.parts:
|
if DICT_DIR.name in md_file.parts:
|
||||||
continue
|
continue
|
||||||
text = md_file.read_text(encoding="utf-8", errors="ignore")
|
text = md_file.read_text(encoding="utf-8", errors="ignore").lower()
|
||||||
words = WORD_REGEX.findall(text.lower())
|
words = WORD_REGEX.findall(text)
|
||||||
doc = nlp(" ".join(words))
|
for word in words:
|
||||||
for token in doc:
|
if word in STOPWORDS:
|
||||||
if token.is_stop:
|
|
||||||
continue
|
continue
|
||||||
lemma = token.lemma_
|
lemma_map[word]["forms"].add(word)
|
||||||
if lemma.isalpha() and lemma not in nlp.Defaults.stop_words:
|
lemma_map[word]["files"].add(md_file)
|
||||||
lemma_map[lemma]["forms"].add(token.text)
|
|
||||||
lemma_map[lemma]["files"].add(md_file)
|
|
||||||
|
|
||||||
print(f"Found {len(lemma_map)} lemmas.")
|
print(f"Found {len(lemma_map)} lemmas.")
|
||||||
|
|
||||||
# ---- write ----
|
# ---- write dictionary ----
|
||||||
for lemma, data in lemma_map.items():
|
for lemma, data in lemma_map.items():
|
||||||
if len(data["files"]) < 2:
|
if len(data["files"]) < 2:
|
||||||
continue
|
continue
|
||||||
@@ -106,6 +59,4 @@ for lemma, data in lemma_map.items():
|
|||||||
rel_path = md.relative_to(VAULT_DIR)
|
rel_path = md.relative_to(VAULT_DIR)
|
||||||
f.write(f"- [[{rel_path}]]\n")
|
f.write(f"- [[{rel_path}]]\n")
|
||||||
|
|
||||||
|
|
||||||
print(f"Dictionary generated in {DICT_DIR}")
|
print(f"Dictionary generated in {DICT_DIR}")
|
||||||
|
|
||||||
|
|||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
root="${1:-.}"
|
||||||
|
|
||||||
|
find "$root" -type f -print0 |
|
||||||
|
while IFS= read -r -d '' file; do
|
||||||
|
printf -- "---\n%s\n-\n" "$file"
|
||||||
|
cat -- "$file"
|
||||||
|
printf "\n"
|
||||||
|
done
|
||||||
|
|
||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
~/code/pycharm-2025.3.3/bin/pycharm
|
||||||
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then
|
||||||
|
echo "Usage: $0 arg1 [arg2] [arg3]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# interactive session check
|
||||||
|
if [ -t 0 ]; then
|
||||||
|
echo -n "Delete existing output files? [y/N]: "
|
||||||
|
read ans
|
||||||
|
case "$ans" in
|
||||||
|
y|Y) rm -f *.school ;;
|
||||||
|
*) echo "Aborted"; exit 0 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# process input file
|
||||||
|
while IFS= read -r line; do
|
||||||
|
new_f="${line%.*}.school"
|
||||||
|
f > "$new_f"
|
||||||
|
done < "$FILE"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
+1
-1
@@ -3,4 +3,4 @@
|
|||||||
cat $MACHINE_DIR/usr/etc/openvpn/.pot.swp
|
cat $MACHINE_DIR/usr/etc/openvpn/.pot.swp
|
||||||
#openvpn /etc/openvpn/client/ch-free-2.protonvpn.tcp.ovpn
|
#openvpn /etc/openvpn/client/ch-free-2.protonvpn.tcp.ovpn
|
||||||
#openvpn /etc/openvpn/client/ch-free-4.protonvpn.tcp.ovpn
|
#openvpn /etc/openvpn/client/ch-free-4.protonvpn.tcp.ovpn
|
||||||
openvpn /etc/openvpn/client/ch-free-6.protonvpn.tcp.ovpn
|
wg-quick up /etc/openvpn/client/my.conf
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ export IMAGE_REG="jpg|jpeg|png|gif|bmp|webp|tiff|ico|heic|svg|jfif"
|
|||||||
|
|
||||||
export MEDIA_REG="\.(${AUDIO_REG}|${VIDEO_REG}|${IMAGE_REG})$"
|
export MEDIA_REG="\.(${AUDIO_REG}|${VIDEO_REG}|${IMAGE_REG})$"
|
||||||
|
|
||||||
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
|
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/opt"
|
||||||
PATH="$PATH:$SBIN_DIR"
|
PATH="$PATH:$SBIN_DIR"
|
||||||
PATH="$PATH:$BIN_DIR"
|
PATH="$PATH:$BIN_DIR"
|
||||||
export PATH
|
export PATH
|
||||||
|
|||||||
@@ -29,11 +29,12 @@ qemu-system-x86_64 \
|
|||||||
-m "$RAM" \
|
-m "$RAM" \
|
||||||
-cpu host \
|
-cpu host \
|
||||||
-smp "$CPUS" \
|
-smp "$CPUS" \
|
||||||
-boot d \
|
|
||||||
-cdrom "$ISO" \
|
-cdrom "$ISO" \
|
||||||
-drive file="$IMG",format=qcow2 \
|
-nic user \
|
||||||
-device virtio-vga \
|
-drive file="$IMG",format=qcow
|
||||||
-display default,show-cursor=on \
|
#-boot d \
|
||||||
-nic user,hostfwd=tcp::2222-:22 \
|
# -netdev user,id=net0,dns=1.1.1.1 \
|
||||||
-virtfs local,id=share,path="$SHARE",security_model=none,mount_tag=hostshare
|
# -device virtio-net-pci,netdev=net0 \
|
||||||
|
# -display default,show-cursor=on \
|
||||||
|
# -virtfs local,id=share,path="$SHARE",security_model=none,mount_tag=hostshare
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
|
||||||
if [ "$#" -lt 1 ] || [ "$#" -gt 1 ]; then
|
if [ "$#" -lt 1 ] ; then
|
||||||
echo "Usage: $0 alias"
|
echo "Usage: $0 alias"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user