diff --git a/global/.config/doom/config.el b/global/.config/doom/config.el index 2443a8a..e4cb117 100644 --- a/global/.config/doom/config.el +++ b/global/.config/doom/config.el @@ -23,7 +23,7 @@ ;; ;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light) ;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13)) -(setq doom-font (font-spec :family "JetBrainsMono Nerd Font" :size 12.0)) +(setq doom-font (font-spec :family "JetBrainsMono Nerd Font" :size 11.0)) ;; ;; If you or Emacs can't find your font, use 'M-x describe-font' to look them ;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to @@ -79,6 +79,7 @@ (setq org-attach-method 'cp) ;; copy file to an attachments dir. (setq org-attach-id-dir "~/org/attachments/") +(setq org-export-with-broken-links t) (setq org-adapt-indentation t) (setq org-startup-indented t) (setq org-indent-mode t) @@ -125,26 +126,60 @@ ;; For company-mode users, ;; (add-to-list 'company-backends 'hledger-company) -(use-package! org-roam - ;; :ensure nil - :custom - (org-roam-directory "~/org/roam/") - (org-roam-capture-templates - '(("d" "default" plain - "%?\n\n\n* Key Features\n* Problems\n* Impact\n* Related:\n\n* References:\n" - :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n#+filetags:\n#+date: %U\n")))) - (custom-set-faces - '((org-roam-link org-roam-link-current) - :foreground "#e24888" :underline t)) - :config - ;; (org-roam-db-autosync-mode) - (setq org-roam-completion-everywhere t) - (setq org-roam-database-connector 'sqlite-builtin) - (setq org-roam-db-node-include-function - (lambda () - (not (member "ATTACH" (org-get-tags))))) - ) +(require 'org-download) +(add-hook 'dired-mode-hook 'org-download-enable) + +;; (use-package! org-roam +;; ;; :ensure nil +;; :custom +;; (org-roam-directory "~/org/roam/") +;; (org-roam-capture-templates +;; '(("d" "default" plain +;; "%?\n\n\n* Key Features\n* Problems\n* Impact\n* Related:\n\n* References:\n" +;; :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" +;; "#+title: ${title}\n#+filetags:\n#+date: %U\n")))) +;; (custom-set-faces +;; '((org-roam-link org-roam-link-current) +;; :foreground "#e24888" :underline t)) +;; :config +;; ;; (org-roam-db-autosync-mode) +;; (setq org-roam-completion-everywhere t) +;; (setq org-roam-database-connector 'sqlite-builtin) +;; (setq org-roam-db-node-include-function +;; (lambda () +;; (not (member "ATTACH" (org-get-tags))))) +;; ) + +(defvar my/blog-post-directory "~/fz0x1.wtf/posts/" + "Directory for new blog posts captured with org-capture.") + +(defconst my/cyr->lat + '((?а . "a") (?б . "b") (?в . "v") (?г . "g") (?д . "d") (?е . "e") (?ё . "e") + (?ж . "zh") (?з . "z") (?и . "i") (?й . "i") (?к . "k") (?л . "l") (?м . "m") + (?н . "n") (?о . "o") (?п . "p") (?р . "r") (?с . "s") (?т . "t") (?у . "u") + (?ф . "f") (?х . "h") (?ц . "ts") (?ч . "ch") (?ш . "sh") (?щ . "sch") + (?ъ . "") (?ы . "y") (?ь . "") (?э . "e") (?ю . "yu") (?я . "ya"))) + + +(defun my/slugify (str) + (let ((res (mapconcat + (lambda (ch) (or (cdr (assoc ch my/cyr->lat)) + (char-to-string ch))) + (string-to-list (downcase str)) ""))) + (setq res (replace-regexp-in-string "[^a-z0-9-]+" "-" res)) + (setq res (replace-regexp-in-string "-\\{2,\\}" "-" res)) + (string-trim res "-+" "-+"))) + +(defvar my/blog-last-title "" + "origin title var") + +(defun my/blog-post-path () + (let* ((title (read-string "Article name: ")) + (slug (my/slugify title)) + (date (format-time-string "%Y-%m-%d")) + (file (format "%s-%s.org" date slug))) + (setq my/blog-last-title title) + (expand-file-name file my/blog-post-directory))) (setq org-default-priority ?D) @@ -214,6 +249,12 @@ "* [%<%Y-%m-%d>] [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n:PROPERTIES:\n:ID: %(org-id-new)\n:END:\n Source: %:link\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n%?" :empty-lines 0) + ("b" "Blog post" plain + (file my/blog-post-path) + "#+title: %(or my/blog-last-title \"\")\n#+date: %U\n\n%?" + :empty-lines 1 + :unnarrowed t) + ("L" "Unselected web capture" entry (file+headline "~/org/inbox.org" "Web links") @@ -291,6 +332,7 @@ ("book") ("movie") ("inbox") + ("abandoned") )) @@ -319,6 +361,7 @@ ("meeting" . (:foreground "magenta" :weight bold)) ("CRITICAL" . (:foreground "red1" :weight bold)) ("job" . (:foreground "medium spring green" :weight bold)) + ("abandoned" . (:foreground "medium spring grey18" :weight bold)) ) ) @@ -364,7 +407,7 @@ PRIORITY may be one of the characters ?A, ?B, or ?C." ;; ------------------ Priority A ------------------ (tags "PRIORITY=\"A\"" ((org-agenda-skip-function - '(or (org-agenda-skip-entry-if 'todo 'done) + '(or (org-agenda-skip-entry-if 'todo 'done) (org-agenda-skip-entry-if 'todo '("STRT" "HOLD")))) (org-agenda-overriding-header "High‑priority unfinished tasks:"))) diff --git a/global/.config/doom/init.el b/global/.config/doom/init.el index 3b60f00..c1e05a9 100644 --- a/global/.config/doom/init.el +++ b/global/.config/doom/init.el @@ -46,7 +46,7 @@ ophints ; highlight the region an operation acts on (popup +defaults) ; tame sudden yet inevitable temporary windows ;;tabs ; a tab bar for Emacs - ;;treemacs ; a project drawer, like neotree but cooler + treemacs ; a project drawer, like neotree but cooler ;;unicode ; extended unicode support for various languages (vc-gutter +pretty) ; vcs diff in the fringe vi-tilde-fringe ; fringe tildes to mark beyond EOB @@ -84,7 +84,7 @@ :checkers syntax ; tasing you for every semicolon you forget - (spell +hunspell +everywhere +flyspell) ; tasing you for misspelling misspelling + (spell +hunspell +flyspell) ; tasing you for misspelling misspelling grammar ; tasing grammar mistake every you make :tools @@ -154,7 +154,7 @@ ;;nim ; python + lisp at the speed of c ;;nix ; I hereby declare "nix geht mehr!" ;;ocaml ; an objective camel - (org +roam2 +pretty +habits +journal) ; organize your plain life in plain text + (org +habits +journal) ; organize your plain life in plain text ;;php ; perl's insecure younger brother ;;plantuml ; diagrams for confusing people more ;;graphviz ; diagrams for confusing yourself even more diff --git a/global/.config/doom/packages.el b/global/.config/doom/packages.el index c6bbf08..cede118 100644 --- a/global/.config/doom/packages.el +++ b/global/.config/doom/packages.el @@ -55,3 +55,5 @@ (package! org-super-links :recipe (:host github :repo "toshism/org-super-links")) (package! hledger-mode) +(package! htmlize) +(package! org-download) diff --git a/global/.zshrc b/global/.zshrc index bc0feb9..71e75d8 100644 --- a/global/.zshrc +++ b/global/.zshrc @@ -147,3 +147,5 @@ fi source $HOME/.zshrc-additional source $HOME/.zshrc-secrets eval "$(pyenv init -)" + +[ -f "/home/fz0x1/.ghcup/env" ] && . "/home/fz0x1/.ghcup/env" # ghcup-env \ No newline at end of file diff --git a/global/scripts/bin/screenshot.sh b/global/scripts/bin/screenshot.sh index 79bc1a0..cee021e 100755 --- a/global/scripts/bin/screenshot.sh +++ b/global/scripts/bin/screenshot.sh @@ -14,11 +14,13 @@ if [[ "$(uname)" == "Darwin" ]]; then elif [[ "$(uname)" == "Linux" ]]; then case $mode in full) - maim -o $screenshot + maim -o "$screenshot" + echo "$screenshot" | xsel --clipboard --input notify-send "Screenshot created: $screenshot" ;; region) - maim -o --select $screenshot + maim -o --select "$screenshot" + echo "$screenshot" | xsel --clipboard --input notify-send "Screenshot created: $screenshot" ;; *) diff --git a/linux/.config/mimeapps.list b/linux/.config/mimeapps.list index 457cd40..c3bb634 100644 --- a/linux/.config/mimeapps.list +++ b/linux/.config/mimeapps.list @@ -3,7 +3,6 @@ image/webp=librewolf.desktop; ; image/png=org.xfce.ristretto.desktop; ; image/jpeg=org.xfce.ristretto.desktop; text/plain=nvim.desktop; -text/html=nvim.desktop; x-scheme-handler/http=librewolf.desktop; x-scheme-handler/https=librewolf.desktop; x-scheme-handler/terminal=Alacritty.desktop; diff --git a/linux/.zshenv b/linux/.zshenv index e73aaf5..e4172a3 100644 --- a/linux/.zshenv +++ b/linux/.zshenv @@ -19,6 +19,8 @@ export PATH=$PATH:$GOPATH/bin export PATH=$PATH:/usr/local/go/bin ## cargo export PATH=$PATH:$HOME/.cargo/bin +## ruby +export PATH=$PATH:$HOME/.local/share/gem/ruby/3.4.0/bin ## color export TERM=tmux-256color ## default gui browser diff --git a/linux/scripts/bin/dirstat b/linux/scripts/bin/dirstat new file mode 100755 index 0000000..3985e5b --- /dev/null +++ b/linux/scripts/bin/dirstat @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +target_dir="$1" +if [ ! -d "$target_dir" ]; then + echo "❌ Dir not found: $target_dir" + return 1 +fi + +total_lines=0 +echo "📁 Analyze dir: $target_dir" + +for f in "$target_dir"/*; do + [ -f "$f" ] || continue + lines=$(wc -l <"$f") + size=$(stat -c %s "$f") + mod=$(date -d @"$(stat -c %Y "$f")" +"%Y-%m-%d %H:%M:%S") + sha=$(shasum -a 256 "$f" | cut -d ' ' -f 1) + total_lines=$((total_lines + lines)) + printf "%-30s %10s bytes %5s lines %s SHA256: %s\n" "$(basename "$f")" "$size" "$lines" "$mod" "$sha" +done + +echo "📊 Total lines of code in the dir: $total_lines" diff --git a/linux/scripts/bin/ex b/linux/scripts/bin/ex new file mode 100755 index 0000000..200880a --- /dev/null +++ b/linux/scripts/bin/ex @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +### ARCHIVE EXTRACTION +# usage: ex +if [ -f "$1" ]; then + case $1 in + *.tar.bz2) tar xjf "$1" ;; + *.tar.gz) tar xzf "$1" ;; + *.bz2) bunzip2 "$1" ;; + *.rar) unrar x "$1" ;; + *.gz) gunzip "$1" ;; + *.tar) tar xf "$1" ;; + *.tbz2) tar xjf "$1" ;; + *.tgz) tar xzf "$1" ;; + *.zip) unzip "$1" ;; + *.Z) uncompress "$1" ;; + *.7z) 7z x "$1" ;; + *.deb) ar x "$1" ;; + *.tar.xz) tar xf "$1" ;; + *.tar.zst) unzstd "$1" ;; + *) echo "'$1' cannot be extracted via ex()" ;; + esac +else + echo "'$1' is not a valid file" +fi