├── bin ├── superlint ├── lower ├── upper ├── cpufast ├── cpusched ├── cpuslow ├── gist ├── todogrep ├── sortlen ├── btfix ├── nvtop ├── xr ├── journal-add ├── fehrandom ├── fehrandomoled ├── watchsync ├── claudefix ├── tgshare ├── fssh ├── ghpatch ├── sharecrypt ├── cb ├── pack ├── f ├── jjj ├── task-add ├── screen2webm ├── format ├── unpack ├── nixs ├── webm2mp4 ├── asusfanprofile ├── build ├── tpl ├── dev ├── tcc ├── typecheck ├── lint ├── scratch ├── gpt ├── workspace-create └── screen2mp4 ├── dotfiles ├── nvim │ ├── .root │ ├── plugins │ │ ├── tslib │ │ │ ├── .root │ │ │ ├── rplugin │ │ │ │ └── node │ │ │ │ │ └── tslib │ │ │ │ │ ├── .root │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── src │ │ │ │ │ ├── api │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ └── API.ts │ │ │ │ │ ├── modules │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── dev.ts │ │ │ │ │ │ └── chrono.ts │ │ │ │ │ ├── types.ts │ │ │ │ │ ├── examples.ts │ │ │ │ │ └── main.ts │ │ │ │ │ ├── tsconfig.json │ │ │ │ │ └── package.json │ │ │ └── Makefile │ │ └── syslang │ │ │ ├── .root │ │ │ ├── ftplugin │ │ │ └── syslang.lua │ │ │ ├── queries │ │ │ └── syslang │ │ │ ├── .luarc.json │ │ │ └── lua │ │ │ └── syslang │ │ │ └── folding.lua │ ├── linters │ │ ├── ast-grep │ │ │ ├── .root │ │ │ ├── rule-tests │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── react-useref-no-useless-assignment-computation-snapshot.yml │ │ │ │ │ ├── react-memo-no-simple-expression-snapshot.yml │ │ │ │ │ └── react-memo-no-simple-comparison-snapshot.yml │ │ │ │ ├── react-useref-no-useless-assignment-computation-test.yml │ │ │ │ ├── react-usememo-no-simple-expression.yml │ │ │ │ ├── react-useeffect-no-useless-ref-assignment.yml │ │ │ │ ├── react-prop-object-always-recreated-test.yml │ │ │ │ └── ts-array-no-useless-spread-test.yml │ │ │ ├── sgconfig.yml │ │ │ └── rules │ │ │ │ ├── react-useref-no-useless-assignment-computation.yml │ │ │ │ ├── ts-array-no-useless-spread.yml │ │ │ │ ├── react-prop-object-always-recreated.yml │ │ │ │ ├── react-useeffect-no-useless-ref-assignment.yml │ │ │ │ └── react-usememo-no-simple-expression.yml │ │ ├── eslint │ │ ├── selene.toml │ │ ├── stylua.toml │ │ ├── prettier.json │ │ ├── revive.toml │ │ └── golangci.yml │ ├── after │ │ ├── lsp │ │ │ ├── bashls.lua │ │ │ ├── eslint.lua │ │ │ ├── html.lua │ │ │ ├── zls.lua │ │ │ ├── dockerls.lua │ │ │ ├── tailwindcss.lua │ │ │ ├── cssmodules_ls.lua │ │ │ ├── csharp_ls.lua │ │ │ ├── clangd.lua │ │ │ ├── cssls.lua │ │ │ ├── yamlls.lua │ │ │ ├── nills.lua │ │ │ ├── rust_analyzer.lua │ │ │ ├── ast_grep.lua │ │ │ ├── jsonls.lua │ │ │ ├── gopls.lua │ │ │ ├── lua_ls.lua │ │ │ └── vtsls.lua │ │ └── ftplugin │ │ │ ├── make.lua │ │ │ ├── lua.lua │ │ │ ├── snippets.lua │ │ │ ├── typescript.lua │ │ │ └── typescriptreact.lua │ ├── snippets_snipmate │ │ ├── all.snippets │ │ ├── snippets.snippets │ │ ├── vue.snippets │ │ ├── markdown.snippets │ │ ├── html.snippets │ │ ├── javascript.snippets │ │ ├── lua.snippets │ │ ├── typescript.snippets │ │ └── make.snippets │ ├── snippets_vscode │ │ ├── all.json │ │ ├── markdown.json │ │ ├── snippets.json │ │ ├── vue.json │ │ ├── typescript.json │ │ ├── html.json │ │ ├── javascript.json │ │ ├── lua.json │ │ ├── syslang.json │ │ └── package.json │ ├── lua │ │ ├── lib │ │ │ ├── ui │ │ │ │ └── init.lua │ │ │ ├── random.lua │ │ │ ├── node.lua │ │ │ ├── metatable.lua │ │ │ ├── shell.lua │ │ │ ├── lazy.lua │ │ │ ├── uv.lua │ │ │ ├── map.lua │ │ │ ├── env.lua │ │ │ ├── term.lua │ │ │ ├── bus.lua │ │ │ ├── string.lua │ │ │ ├── log.lua │ │ │ ├── init.lua │ │ │ ├── is.lua │ │ │ ├── path.lua │ │ │ └── bun.lua │ │ ├── modules │ │ │ ├── language-support │ │ │ │ ├── languages │ │ │ │ │ ├── lua.lua │ │ │ │ │ ├── nix.lua │ │ │ │ │ └── typescript.lua │ │ │ │ ├── mason.lua │ │ │ │ ├── diagnostics.lua │ │ │ │ ├── linting.lua │ │ │ │ ├── rainbow.lua │ │ │ │ └── breadcrumbs.lua │ │ │ ├── workflow │ │ │ │ ├── term-wrappers.lua │ │ │ │ ├── undotree.lua │ │ │ │ ├── mkdirp.lua │ │ │ │ ├── leap.lua │ │ │ │ ├── rooter.lua │ │ │ │ ├── treesj.lua │ │ │ │ ├── search.lua │ │ │ │ ├── trim-line-trailing-space.lua │ │ │ │ ├── reset-view.lua │ │ │ │ ├── tmux.lua │ │ │ │ ├── term.lua │ │ │ │ └── outline.lua │ │ │ ├── misc │ │ │ │ ├── highlight-cword.lua │ │ │ │ ├── highlight-on-yank.lua │ │ │ │ ├── inspect.lua │ │ │ │ ├── colorizer.lua │ │ │ │ ├── highlight-words.lua │ │ │ │ ├── bufferize.lua │ │ │ │ └── which-key-map.lua │ │ │ ├── ui │ │ │ │ ├── window-maximize.lua │ │ │ │ ├── input.lua │ │ │ │ ├── modes.lua │ │ │ │ ├── notifications.lua │ │ │ │ ├── headlines.lua │ │ │ │ └── noice.lua │ │ │ ├── orgmode.lua │ │ │ ├── core │ │ │ │ └── time-tracker.lua │ │ │ ├── neorg.lua │ │ │ ├── builtins │ │ │ │ ├── clipboard.lua │ │ │ │ └── macros.lua │ │ │ ├── wiki │ │ │ │ └── conceal.lua │ │ │ ├── profiler.lua │ │ │ ├── slides.lua │ │ │ ├── completion │ │ │ │ └── supermaven.lua │ │ │ └── mini.lua │ │ └── config │ │ │ ├── filetype.lua │ │ │ └── lazy.lua │ ├── colors │ │ └── dynamic.lua │ ├── .gitignore │ └── init.lua ├── .gitignore ├── ranger │ ├── .gitignore │ └── rc.conf ├── emacs │ ├── profiles │ │ ├── active │ │ ├── dev │ │ │ ├── .gitignore │ │ │ ├── early-init.el │ │ │ ├── config.el │ │ │ ├── config.org │ │ │ └── init.el │ │ ├── default │ │ │ ├── .gitignore │ │ │ └── early-init.el │ │ └── main │ │ │ ├── .gitignore │ │ │ ├── early-init.el │ │ │ └── init.el │ ├── .gitignore │ ├── chemacs.el │ ├── init.el │ ├── early-init.el │ └── profiles.el ├── linx │ ├── .gitignore │ └── link.sh ├── xmodmap └── stignore-global ├── home-manager ├── services │ ├── dunst.nix │ └── polybar │ │ ├── task.sh │ │ ├── core.sh │ │ ├── bci.sh │ │ ├── bluetooth.sh │ │ └── vpn.sh ├── layers │ ├── custom │ │ ├── vault-passwd.sh │ │ ├── vault-unmount.sh │ │ ├── vault-mount.sh │ │ ├── default.nix │ │ ├── journal.nix │ │ ├── wiki.nix │ │ ├── daemon.nix │ │ └── vault.nix │ ├── communication.nix │ ├── development │ │ ├── nix.nix │ │ ├── java.nix │ │ ├── bash.nix │ │ ├── c.nix │ │ ├── dotnet.nix │ │ ├── clojure.nix │ │ ├── misc.nix │ │ ├── python.nix │ │ ├── rust.nix │ │ ├── default.nix │ │ ├── lua.nix │ │ ├── nodejs.nix │ │ └── golang.nix │ ├── password-management.nix │ ├── file-management.nix │ ├── media.nix │ └── pentesting.nix ├── misc │ ├── remarkable.nix │ └── obsidian.nix ├── programs │ ├── chromium.nix │ ├── emacs.nix │ ├── chrome-canary.nix │ ├── bat.nix │ ├── ghostty.nix │ ├── navi.nix │ ├── rofi.nix │ ├── git │ │ ├── git-standup.sh │ │ ├── git-id.sh │ │ ├── git-status-deep.sh │ │ └── git-branch.sh │ ├── mise.nix │ ├── eza.nix │ ├── zoxide.nix │ ├── neovim.nix │ ├── tmux │ │ ├── default.nix │ │ └── tmux-workspace.sh │ ├── fzf.nix │ ├── starship.nix │ └── zathura.nix ├── desktop │ ├── common.nix │ ├── hyprland.disabled.nix │ └── xdg-desktop-entries.nix ├── gtk.nix ├── roles │ ├── battlestation.nix │ └── workstation.nix ├── xresources.nix ├── mime.nix └── apps.nix ├── navi ├── go.cheat ├── docs.cheat ├── project-setup.cheat ├── workflow.cheat ├── syncthing.cheat ├── ssh.cheat ├── mysql.cheat ├── system.cheat ├── nix.cheat ├── network.cheat ├── linux.cheat ├── git.cheat └── docker.cheat ├── statix.toml ├── .gitignore ├── .nixd.json ├── roles └── battlestation.nix ├── overlays └── default.nix ├── scripts ├── swap.sh └── flakey.sh ├── README.md └── modules ├── llm.nix ├── ld.nix ├── hyprland.nix ├── bluetooth.nix ├── packages └── qimgv │ └── default.nix ├── virtualisation.nix ├── xorg.nix └── audio.nix /bin/superlint: -------------------------------------------------------------------------------- 1 | lint -------------------------------------------------------------------------------- /dotfiles/nvim/.root: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dotfiles/.gitignore: -------------------------------------------------------------------------------- 1 | /agents 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/.root: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/.root: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/syslang/.root: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dotfiles/ranger/.gitignore: -------------------------------------------------------------------------------- 1 | plugins 2 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/active: -------------------------------------------------------------------------------- 1 | main 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/bashls.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/eslint.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/html.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/zls.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_snipmate/all.snippets: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_vscode/all.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/dockerls.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/tailwindcss.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/.root: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dotfiles/linx/.gitignore: -------------------------------------------------------------------------------- 1 | linxlog 2 | linx-client.conf 3 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/cssmodules_ls.lua: -------------------------------------------------------------------------------- 1 | return {} 2 | -------------------------------------------------------------------------------- /dotfiles/emacs/.gitignore: -------------------------------------------------------------------------------- 1 | eln-cache 2 | auto-save-list 3 | undo 4 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/dev/.gitignore: -------------------------------------------------------------------------------- 1 | straight 2 | etc 3 | var 4 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/make.lua: -------------------------------------------------------------------------------- 1 | vim.bo.expandtab = false 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/eslint: -------------------------------------------------------------------------------- 1 | /home/rabbit/brain/core/linter/eslint/ -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/default/.gitignore: -------------------------------------------------------------------------------- 1 | straight 2 | etc 3 | var 4 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/lua.lua: -------------------------------------------------------------------------------- 1 | vim.cmd("iabbr != ~=") 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/snippets.lua: -------------------------------------------------------------------------------- 1 | vim.bo.expandtab = false 2 | -------------------------------------------------------------------------------- /home-manager/services/dunst.nix: -------------------------------------------------------------------------------- 1 | { services.dunst.enable = true; } 2 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/main/.gitignore: -------------------------------------------------------------------------------- 1 | straight 2 | etc 3 | var 4 | undo 5 | -------------------------------------------------------------------------------- /dotfiles/emacs/chemacs.el: -------------------------------------------------------------------------------- 1 | ;;; https://github.com/plexus/chemacs2/chemacs.el 2 | -------------------------------------------------------------------------------- /dotfiles/emacs/init.el: -------------------------------------------------------------------------------- 1 | ;;; https://github.com/plexus/chemacs2/blob/main/init.el 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/syslang/ftplugin/syslang.lua: -------------------------------------------------------------------------------- 1 | require("syslang").setup() 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/typescript.lua: -------------------------------------------------------------------------------- 1 | vim.cmd("runtime! ftplugin/javascript.lua") 2 | -------------------------------------------------------------------------------- /dotfiles/emacs/early-init.el: -------------------------------------------------------------------------------- 1 | ;;; https://github.com/plexus/chemacs2/blob/main/early-init.el 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/typescriptreact.lua: -------------------------------------------------------------------------------- 1 | vim.cmd("runtime! ftplugin/typescript.lua") 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/src/api/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from "./API"; 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/syslang/queries/syslang: -------------------------------------------------------------------------------- 1 | /home/rabbit/brain/core/syslang/tree-sitter-syslang/queries/ -------------------------------------------------------------------------------- /home-manager/layers/custom/vault-passwd.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | encfsctl passwd "@vault_path@" 4 | -------------------------------------------------------------------------------- /home-manager/layers/custom/vault-unmount.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | fusermount -u "@mount_path@" 4 | -------------------------------------------------------------------------------- /navi/go.cheat: -------------------------------------------------------------------------------- 1 | % golang 2 | 3 | # link a relative package 4 | go mod edit -replace = 5 | 6 | -------------------------------------------------------------------------------- /statix.toml: -------------------------------------------------------------------------------- 1 | nix_version = '2.4' 2 | ignore = ['.direnv'] 3 | disabled = [ 4 | "repeated_keys" 5 | ] 6 | -------------------------------------------------------------------------------- /dotfiles/xmodmap: -------------------------------------------------------------------------------- 1 | 2 | clear lock 3 | keycode 66 = Hyper_R 4 | add mod3 = Hyper_R 5 | keycode 94 = Shift_L 6 | -------------------------------------------------------------------------------- /home-manager/layers/custom/vault-mount.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | encfs "@vault_path@" "@mount_path@" 4 | -------------------------------------------------------------------------------- /home-manager/misc/remarkable.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ rmapi ]; 5 | } 6 | -------------------------------------------------------------------------------- /bin/lower: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | cat | tr '[:upper:]' '[:lower:]' 6 | 7 | -------------------------------------------------------------------------------- /bin/upper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | cat | tr '[:lower:]' '[:upper:]' 6 | 7 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/csharp_ls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | init_options = { 3 | AutomaticWorkspaceInit = true, 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /home-manager/layers/communication.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ telegram-desktop ]; 5 | } 6 | -------------------------------------------------------------------------------- /home-manager/layers/custom/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | # 4 | ./journal.nix 5 | ./wiki.nix 6 | ]; 7 | } 8 | -------------------------------------------------------------------------------- /home-manager/misc/obsidian.nix: -------------------------------------------------------------------------------- 1 | { inputs, pkgs, pkgs-stable, ... }: 2 | 3 | { 4 | home.packages = [ pkgs.obsidian ]; 5 | } 6 | -------------------------------------------------------------------------------- /navi/docs.cheat: -------------------------------------------------------------------------------- 1 | % docs 2 | 3 | # Start markdown preview (inlyne) 4 | inlyne 5 | 6 | $ path_to_file: fd -t f 7 | -------------------------------------------------------------------------------- /bin/cpufast: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | sudo cpupower -c all frequency-set -g performance 6 | -------------------------------------------------------------------------------- /bin/cpusched: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | sudo cpupower -c all frequency-set -g schedutil 6 | -------------------------------------------------------------------------------- /bin/cpuslow: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | sudo cpupower -c all frequency-set -g powersave 6 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_snipmate/snippets.snippets: -------------------------------------------------------------------------------- 1 | snippet snip 2 | snippet ${1:trigger} "${2:description}" 3 | ${0:${VISUAL}} 4 | 5 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/ui/init.lua: -------------------------------------------------------------------------------- 1 | local datepicker = require("lib/ui/datepicker") 2 | 3 | return { 4 | datepicker = datepicker, 5 | } 6 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/src/modules/index.ts: -------------------------------------------------------------------------------- 1 | export * as chrono from "./chrono"; 2 | export * as dev from "./dev"; 3 | -------------------------------------------------------------------------------- /home-manager/layers/development/nix.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ statix nixfmt-classic ]; 5 | } 6 | 7 | -------------------------------------------------------------------------------- /navi/project-setup.cheat: -------------------------------------------------------------------------------- 1 | % project setup 2 | 3 | # Setup global ast-grep sgconfig.yml 4 | cp ~/.config/nvim/linters/ast-grep/sgconfig.yml . 5 | -------------------------------------------------------------------------------- /navi/workflow.cheat: -------------------------------------------------------------------------------- 1 | % workflow 2 | 3 | # linter: clear global eslint cache 4 | pkill -9 eslint_d; rm -r $HOME/.config/nvim/linters/eslint/output 5 | -------------------------------------------------------------------------------- /bin/gist: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | # go install github.com/andreimarcu/linx-client@latest 6 | linx-client "$@" 7 | -------------------------------------------------------------------------------- /bin/todogrep: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then 6 | rg 'TODO|FIXME|WARN|BUG' 7 | fi 8 | -------------------------------------------------------------------------------- /bin/sortlen: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | 4 | cat | perl -e 'print sort { length $a <=> length $b || $a =~ y/ \t//c <=> $b =~ y/ \t//c } <>' 5 | 6 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_vscode/markdown.json: -------------------------------------------------------------------------------- 1 | { 2 | "boil": { 3 | "prefix": "boil", 4 | "body": [ 5 | "", 6 | "" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /home-manager/layers/development/java.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; 5 | [ 6 | # 7 | jdk 8 | ]; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /navi/syncthing.cheat: -------------------------------------------------------------------------------- 1 | % syncthing 2 | 3 | # Reset index database 4 | curl -X POST -H "X-API-Key: " "http://localhost:8384/rest/system/reset?folder=" 5 | -------------------------------------------------------------------------------- /home-manager/layers/password-management.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ 5 | # 6 | keepassxc 7 | pass 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /home-manager/layers/development/bash.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ 5 | # 6 | shfmt 7 | shellcheck 8 | ]; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /home-manager/programs/chromium.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.chromium = { 3 | enable = true; 4 | # commandLineArgs = [ "--disable-backgrounding-occluded-windows" ]; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rule-tests/__snapshots__/react-useref-no-useless-assignment-computation-snapshot.yml: -------------------------------------------------------------------------------- 1 | id: react-useref-no-useless-assignment-computation 2 | snapshots: {} 3 | -------------------------------------------------------------------------------- /home-manager/layers/development/c.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ 5 | # 6 | gcc 7 | clang-tools 8 | cppcheck 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /home-manager/layers/development/dotnet.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ 5 | # disgusting 6 | dotnet-sdk_8 7 | csharp-ls 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # public 2 | 3 | .st* 4 | .git-alt 5 | .gitignore-alt 6 | 7 | /assets 8 | /hosts 9 | /ssh 10 | /workspaces 11 | 12 | *private* 13 | /dotfiles/emacs/url 14 | /workflow 15 | -------------------------------------------------------------------------------- /home-manager/layers/development/clojure.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, ... }: 2 | 3 | { 4 | 5 | home.packages = with pkgs; 6 | [ 7 | # 8 | babashka 9 | ]; 10 | 11 | } 12 | 13 | -------------------------------------------------------------------------------- /bin/btfix: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | IFS=$'\n\t' 3 | 4 | sudo hciconfig hci0 down 5 | sudo rmmod btusb 6 | sudo modprobe btusb 7 | sudo hciconfig hci0 up 8 | sleep 1 9 | bluetoothctl power on 10 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/clangd.lua: -------------------------------------------------------------------------------- 1 | return { 2 | filetypes = { 3 | "cc", 4 | "c", 5 | "cpp", 6 | "objc", 7 | "objcpp", 8 | "cuda", 9 | "proto", 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /dotfiles/stignore-global: -------------------------------------------------------------------------------- 1 | (?d)node_modules 2 | (?d)dist 3 | (?d).cache 4 | (?d).parcel-cache 5 | (?d).temp 6 | (?d).nuxt 7 | (?d)build/* 8 | (?d)web-modules 9 | (?d)debug 10 | (?d)target 11 | -------------------------------------------------------------------------------- /home-manager/programs/emacs.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | { 4 | programs.emacs = { 5 | enable = true; 6 | package = pkgs.emacs; 7 | # extraConfig = ""; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /bin/nvtop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | while true; do 4 | clear 5 | nvidia-smi 6 | read -rsn1 -t 0.5 key 7 | if [ "$key" = "q" ]; then 8 | echo "Exiting." 9 | break 10 | fi 11 | done 12 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/cssls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | settings = { 3 | css = { lint = { unknownAtRules = "ignore" } }, 4 | scss = { lint = { unknownAtRules = "ignore" } }, 5 | }, 6 | handlers = {}, 7 | } 8 | -------------------------------------------------------------------------------- /home-manager/programs/chrome-canary.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, inputs, ... }: 2 | 3 | { 4 | home.packages = [ 5 | # 6 | # inputs.browser-previews.packages.${pkgs.system}.google-chrome-dev 7 | ]; 8 | } 9 | -------------------------------------------------------------------------------- /dotfiles/nvim/colors/dynamic.lua: -------------------------------------------------------------------------------- 1 | vim.opt.background = "dark" 2 | vim.g.colors_name = "dynamic" 3 | vim.cmd.highlight("clear") 4 | 5 | package.loaded["config/theme"] = nil 6 | require("lush")(require("config/theme")) 7 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/syslang/.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", 3 | "Lua.diagnostics.globals": ["vim", "log", "throw", "is", "lib"] 4 | } 5 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/src/modules/dev.ts: -------------------------------------------------------------------------------- 1 | import { RPCFunction } from "../types"; 2 | 3 | export const test: RPCFunction = ({ plugin, api }) => { 4 | return api.fn.bufnr("%"); 5 | }; 6 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/selene.toml: -------------------------------------------------------------------------------- 1 | std="~/.config/nvim/linters/selene-vim" 2 | 3 | [rules] 4 | global_usage = "allow" 5 | multiple_statements = "allow" 6 | incorrect_standard_library_use = "allow" 7 | mixed_table = "allow" 8 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/yamlls.lua: -------------------------------------------------------------------------------- 1 | local schemastore = require("schemastore") 2 | 3 | return { 4 | settings = { 5 | yaml = { 6 | schemas = require("schemastore").yaml.schemas(), 7 | }, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /navi/ssh.cheat: -------------------------------------------------------------------------------- 1 | % ssh 2 | 3 | # Mount remote directory 4 | mkdir -p 5 | sshfs -o reconnect : 6 | 7 | # Unmount remote directory 8 | fusermount -u 9 | -------------------------------------------------------------------------------- /bin/xr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | xrandr --output DisplayPort-1 --mode 1920x1080 --pos 2880x0 --rotate normal -r 120 --panning 0x0+0+0 4 | # xrandr --output DisplayPort-1 --mode 3840x1080 --pos 2880x0 --rotate normal -r 120 --panning 0x0+0+0 5 | -------------------------------------------------------------------------------- /dotfiles/linx/link.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | ln -sf "$(dirname "$(readlink -f "$0")")/linx-client.conf" ~/.config/linx-client.conf 6 | ln -sf "$(dirname "$(readlink -f "$0")")/linxlog" ~/.linxlog 7 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_vscode/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "snip": { 3 | "prefix": "snip", 4 | "body": [ 5 | "snippet ${1:trigger} \"${2:description}\"", 6 | "\t${0:$TM_SELECTED_TEXT}", 7 | "" 8 | ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /home-manager/programs/bat.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.bat = { 3 | enable = true; 4 | config = { 5 | theme = "base16"; 6 | italic-text = "always"; 7 | }; 8 | }; 9 | 10 | programs.fish.shellAliases = { cat = "bat"; }; 11 | } 12 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/src/types.ts: -------------------------------------------------------------------------------- 1 | import type API from "./api"; 2 | import type { NvimPlugin } from "neovim"; 3 | 4 | export type RPCFunction = (args: { plugin: NvimPlugin; input: T; api: API }) => Promise | U; 5 | -------------------------------------------------------------------------------- /home-manager/layers/development/misc.nix: -------------------------------------------------------------------------------- 1 | { pkgs, pkgs-stable, ... }: 2 | 3 | { 4 | home.packages = with pkgs; 5 | [ 6 | # 7 | duckdb 8 | ] ++ (with pkgs-stable; 9 | [ 10 | # 11 | postman 12 | ]); 13 | } 14 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/nills.lua: -------------------------------------------------------------------------------- 1 | return { 2 | ["nil"] = { 3 | nix = { 4 | binary = "nix", 5 | maxMemoryMB = nil, 6 | flake = { 7 | autoEvalInputs = true, 8 | autoArchive = true, 9 | }, 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /home-manager/layers/development/python.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, ... }: 2 | 3 | { 4 | 5 | home.packages = with pkgs; [ 6 | # 7 | conda 8 | uv 9 | (python3.withPackages (python-pkgs: with python-pkgs; [ pandas requests ])) 10 | ]; 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /home-manager/layers/file-management.nix: -------------------------------------------------------------------------------- 1 | { pkgs, pkgs-stable, ... }: 2 | 3 | { 4 | home.packages = with pkgs; 5 | [ 6 | # 7 | ranger 8 | ] ++ [ 9 | # 10 | pkgs-stable.yazi 11 | pkgs-stable.pcmanfm 12 | ]; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /home-manager/programs/ghostty.nix: -------------------------------------------------------------------------------- 1 | { config, inputs, pkgs, pkgs-master, lib, ... }: 2 | 3 | { 4 | imports = [ ../colors.nix ]; 5 | 6 | programs.ghostty.enable = true; 7 | programs.ghostty.package = inputs.ghostty.packages.${pkgs.system}.default; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_snipmate/vue.snippets: -------------------------------------------------------------------------------- 1 | snippet boil "boilerplate" 2 | 5 | 6 | 11 | 12 | 14 | 15 | -------------------------------------------------------------------------------- /home-manager/desktop/common.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | { 4 | home.pointerCursor = { 5 | name = "Vanilla-DMZ"; 6 | package = pkgs.vanilla-dmz; 7 | size = lib.mkDefault 32; 8 | gtk.enable = true; 9 | x11.enable = true; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /bin/journal-add: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TEXT=$(yad --entry --text "Journal entry:" --width 600) 4 | DEST=~/brain/wiki/journal 5 | 6 | if [ "$TEXT" != "" ]; then 7 | DATE=$(date "+%Y-%m-%d %H:%M:%S") 8 | ENTRY="$DATE: $TEXT" 9 | 10 | echo "$ENTRY" >>"$DEST" 11 | fi 12 | -------------------------------------------------------------------------------- /bin/fehrandom: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | cd ~/brain/config/assets/wallpapers || exit 6 | RANDOM_WALLPAPER=$(find . -type f | shuf -n 1) 7 | cp "$RANDOM_WALLPAPER" ~/.config/wallpaper 8 | 9 | feh --bg-fill --no-fehbg "$HOME/.config/wallpaper" 10 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/language-support/languages/lua.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "language-support/languages/lua", 3 | hosts = "*", 4 | plugins = { 5 | { 6 | "rafcamlet/nvim-luapad", 7 | cmd = { "Luapad", "LuaRun" }, 8 | }, 9 | }, 10 | }) 11 | -------------------------------------------------------------------------------- /.nixd.json: -------------------------------------------------------------------------------- 1 | { 2 | "options": { 3 | "enable": true, 4 | "target": { 5 | "args": [ 6 | "--expr", 7 | "(import { configuration = ./hosts/spaceship/configuration.nix; }).options" 8 | ], 9 | "installable": "" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /bin/fehrandomoled: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | cd ~/brain/config/assets/wallpapers || exit 6 | RANDOM_WALLPAPER=$(find . -type f | shuf -n 1) 7 | cp "$RANDOM_WALLPAPER" ~/.config/wallpaper 8 | 9 | feh --bg-fill --no-fehbg "$HOME/.config/wallpaper" 10 | -------------------------------------------------------------------------------- /home-manager/programs/navi.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.navi = { 3 | enable = true; 4 | settings.cheats.paths = [ "~/brain/config/navi" ]; 5 | }; 6 | 7 | programs.fish.shellAliases = { 8 | n = "navi"; 9 | navibest = "navi --best-match --query $argv"; 10 | }; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /bin/watchsync: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # https://unix.stackexchange.com/questions/48235/can-i-watch-the-progress-of-a-sync-operation 3 | 4 | watch -n1 'grep -E "(Dirty|Write)" /proc/meminfo; echo; ls /sys/block/ | while read device; do awk "{ print \"$device: \" \$9 }" "/sys/block/$device/stat"; done' 5 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/stylua.toml: -------------------------------------------------------------------------------- 1 | call_parentheses = "Always" 2 | collapse_simple_statement = "ConditionalOnly" 3 | column_width = 119 4 | indent_type = "Spaces" 5 | indent_width = 2 6 | line_endings = "Unix" 7 | quote_style = "AutoPreferDouble" 8 | 9 | [sort_requires] 10 | enabled = true 11 | -------------------------------------------------------------------------------- /home-manager/layers/development/rust.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ rustup ]; 5 | 6 | home.sessionPath = [ "$HOME/.cargo/bin" ]; 7 | 8 | programs.fish = { 9 | shellInit = '' 10 | set -x PATH $HOME/.cargo/bin $PATH 11 | ''; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /navi/mysql.cheat: -------------------------------------------------------------------------------- 1 | % mysql 2 | 3 | # Create database 4 | mysql -u -p -e "create database character set UTF8mb4 collate utf8mb4_bin" 5 | 6 | # Export databse 7 | mysqldump -u -p > 8 | 9 | # Import database 10 | mysql -u -p 11 | -------------------------------------------------------------------------------- /bin/claudefix: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | IFS=$'nt' 4 | 5 | claude config set --global parallelTasksCount 5 6 | claude config set --global preferredNotifChannel terminal_bell 7 | 8 | claude mcp add sequential-thinking -s user -- npx -y @modelcontextprotocol/server-sequential-thinking 9 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/rust_analyzer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | settings = { 3 | ["rust-analyzer"] = { 4 | assist = { importGranularity = "module", importPrefix = "by_self" }, 5 | cargo = { loadOutDirsFromCheck = true }, 6 | procMacro = { enable = true }, 7 | }, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rule-tests/react-useref-no-useless-assignment-computation-test.yml: -------------------------------------------------------------------------------- 1 | id: react-useref-no-useless-assignment-computation 2 | valid: 3 | - useRef(value) 4 | - useRef(() => 1) 5 | - "useRef({ value: 1 })" 6 | invalid: 7 | - useRef(compute()) 8 | - useRef(compute(value)) 9 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/sgconfig.yml: -------------------------------------------------------------------------------- 1 | ruleDirs: 2 | - /home/rabbit/.config/nvim/linters/ast-grep/rules 3 | testConfigs: 4 | - testDir: /home/rabbit/.config/nvim/linters/ast-grep/rule-tests 5 | utilDirs: 6 | - /home/rabbit/.config/nvim/linters/ast-grep/utils 7 | languageGlobs: 8 | tsx: ["*.ts"] 9 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/workflow/term-wrappers.lua: -------------------------------------------------------------------------------- 1 | local scooter = function() 2 | lib.term.open({ cmd = "scooter" }) 3 | end 4 | 5 | return lib.module.create({ 6 | name = "term-wrappers", 7 | hosts = "*", 8 | mappings = { 9 | { "n", "tf", scooter, "Scooter" }, 10 | }, 11 | }) 12 | -------------------------------------------------------------------------------- /home-manager/gtk.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | 3 | { 4 | gtk = { 5 | enable = true; 6 | iconTheme = { 7 | name = "Arc"; 8 | package = pkgs.arc-icon-theme; 9 | }; 10 | theme = { 11 | name = "Arc-Dark"; 12 | package = pkgs.arc-theme; 13 | }; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /home-manager/services/polybar/task.sh: -------------------------------------------------------------------------------- 1 | #!/run/current-system/sw/bin/bash 2 | export PATH="/run/current-system/sw/bin/:$PATH" 3 | 4 | TASK=$(/home/rabbit/go/bin/core task current -e) 5 | RESULT=" EVERY SECOND COUNTS" 6 | if [ "$TASK" != "" ]; then 7 | RESULT="%{F#f97e48} $TASK" 8 | fi 9 | echo "$RESULT" 10 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_snipmate/markdown.snippets: -------------------------------------------------------------------------------- 1 | snippet boil 2 | --- 3 | layout: "@layouts/ArticleLayout.astro" 4 | title: "$1" 5 | description: "$1" 6 | date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} 7 | --- 8 | 9 | # $1 10 | 11 | There I was, sitting in my chair, thinking about $1. 12 | -------------------------------------------------------------------------------- /home-manager/services/polybar/core.sh: -------------------------------------------------------------------------------- 1 | #!/run/current-system/sw/bin/bash 2 | 3 | export PATH="/run/current-system/sw/bin/:$PATH" 4 | 5 | # ACTION="$1" 6 | # if [[ $ACTION = "right" ]]; then 7 | # exit 8 | # fi 9 | 10 | RESPONSE=$(curl -s http://localhost:9000/polybar/status || echo "%{F#d13048}") 11 | echo "$RESPONSE" 12 | -------------------------------------------------------------------------------- /bin/tgshare: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then 6 | if [ "$#" -ne 1 ]; then 7 | echo "tgshare file.ext" 8 | fi 9 | file=$(readlink -f "$1") 10 | telegram-desktop -sendpath "$file" 11 | wmctrl -x -a Telegram.TelegramDesktop 12 | fi 13 | 14 | -------------------------------------------------------------------------------- /home-manager/programs/rofi.nix: -------------------------------------------------------------------------------- 1 | { pkgs, pkgs-stable, ... }: 2 | 3 | { 4 | programs.rofi = { 5 | enable = true; 6 | font = "Fira 14"; 7 | location = "center"; 8 | theme = "Arc-Dark"; 9 | package = with pkgs-stable; 10 | rofi.override { plugins = [ rofi-calc rofi-file-browser ]; }; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /bin/fssh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then 6 | HOST=$(grep "Host " ~/.ssh/config | grep -v '\*' | cut -b 6- | sort | uniq | fzf --prompt="host > ") 7 | if test "$HOST" != ""; then 8 | echo "SSH: $HOST" 9 | ssh "$HOST" 10 | fi 11 | fi 12 | 13 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES2020", 5 | "outDir": "dist", 6 | "skipLibCheck": true, 7 | "strictNullChecks": true 8 | }, 9 | "include": ["src/**/*"], 10 | "exclude": ["node_modules", "**/*.test.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /home-manager/layers/development/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | # 4 | ./bash.nix 5 | ./c.nix 6 | ./clojure.nix 7 | ./dotnet.nix 8 | ./golang.nix 9 | ./java.nix 10 | ./lua.nix 11 | ./misc.nix 12 | ./nix.nix 13 | ./nodejs.nix 14 | ./python.nix 15 | ./rust.nix 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/misc/highlight-cword.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "highlight-cword", 3 | -- hosts = "*", 4 | plugins = { 5 | { 6 | "nvimdev/cwordmini.nvim", 7 | event = "CursorHold", 8 | opts = { 9 | exclude = { "markdown", "syslang" }, 10 | }, 11 | }, 12 | }, 13 | }) 14 | -------------------------------------------------------------------------------- /home-manager/layers/media.nix: -------------------------------------------------------------------------------- 1 | { pkgs, pkgs-stable, ... }: 2 | 3 | { 4 | home.packages = [ 5 | # 6 | pkgs.mpv 7 | pkgs.espeak-ng 8 | pkgs-stable.ffmpeg-full 9 | # pkgs.qimgv 10 | ] ++ (if (pkgs.system == "x86_64-linux") then 11 | [ 12 | # davinci-resolve 13 | ] 14 | else 15 | [ ]); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /roles/battlestation.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, ... }: 2 | 3 | { 4 | imports = [ 5 | ./workstation.nix 6 | ../modules/syncthing.private.nix 7 | ../modules/tailscale.private.nix 8 | ../modules/security.private.nix 9 | ]; 10 | 11 | environment.systemPackages = with pkgs; [ ]; 12 | 13 | services.avahi.enable = true; 14 | } 15 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/random.lua: -------------------------------------------------------------------------------- 1 | ---@param length number 2 | ---@return string 3 | local random_string = function(length) 4 | length = length or 32 5 | local res = "" 6 | for _ = 1, length do 7 | res = res .. string.char(math.random(97, 122)) 8 | end 9 | return res 10 | end 11 | 12 | return { 13 | string = random_string, 14 | } 15 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/config/filetype.lua: -------------------------------------------------------------------------------- 1 | return { 2 | filename = { 3 | [".env"] = "dotenv", 4 | ["Makefile"] = "make", 5 | }, 6 | extension = { 7 | conf = "conf", 8 | astro = "astro", 9 | env = "dotenv", 10 | mdx = "markdown", 11 | dsl = "dsl", 12 | }, 13 | pattern = { 14 | ["%.env%.[%w_.-]+"] = "dotenv", 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /bin/ghpatch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | if [[ $# -ne 1 ]]; then 6 | echo "usage: ghpatch " 7 | exit 1 8 | fi 9 | 10 | PATCH_URL="$1" 11 | if [[ ! "${PATCH_URL: -4}" == ".patch" ]]; then 12 | PATCH_URL="${PATCH_URL}.patch" 13 | fi 14 | 15 | echo "Fetching patch: ${PATCH_URL}" 16 | curl -s -L "$PATCH_URL" | patch -p1 17 | -------------------------------------------------------------------------------- /bin/sharecrypt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | TMPFILE=$(mktemp /tmp/sharecrypt.XXXXXX) 6 | cat - | openssl enc -e -aes-256-cbc -a -salt --pbkdf2 >"$TMPFILE" 7 | 8 | linx-client "$TMPFILE" 9 | CLIPBOARD_TEXT=$(xclip -o -selection clipboard) 10 | 11 | echo "curl -s $CLIPBOARD_TEXT | openssl enc -d -aes-256-cbc -a -salt -pbkdf2" 12 | 13 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rules/react-useref-no-useless-assignment-computation.yml: -------------------------------------------------------------------------------- 1 | id: react-useref-no-useless-assignment-computation 2 | message: The function that computes the initial value of this ref executes on every render. 3 | severity: error 4 | language: tsx 5 | rule: 6 | pattern: useRef($EXPR) 7 | constraints: 8 | EXPR: 9 | kind: call_expression 10 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/ast_grep.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | enabled = false, 4 | cmd = { "ast-grep", "lsp" }, 5 | single_file_support = false, 6 | root_markers = { "sgconfig.yml" }, 7 | root_dir = function(bufnr, on_dir) 8 | if vim.fs.root(bufnr, "sgconfig.yml") then 9 | -- 10 | on_dir(vim.fn.getcwd()) 11 | end 12 | end, 13 | } 14 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/workflow/undotree.lua: -------------------------------------------------------------------------------- 1 | vim.g.undotree_RelativeTimestamp = 0 2 | return lib.module.create({ 3 | name = "workflow/undotree", 4 | hosts = "*", 5 | plugins = { 6 | { 7 | "mbbill/undotree", 8 | keys = { 9 | { "u", ":UndotreeToggle:UndotreeFocus", desc = "Undo tree" }, 10 | }, 11 | }, 12 | }, 13 | }) 14 | -------------------------------------------------------------------------------- /dotfiles/nvim/.gitignore: -------------------------------------------------------------------------------- 1 | sandbox 2 | *.log 3 | *.db 4 | 5 | plugins/image.nvim 6 | plugins/image2.nvim 7 | plugins/nyancat.nvim 8 | plugins/time-tracker.nvim 9 | plugins/testing.nvim 10 | plugins/sqlite.nvim 11 | plugins/hlchunk.nvim 12 | plugins/nvim-ufo 13 | plugins/diagram.nvim 14 | plugins/blink.cmp 15 | plugins/bunvim 16 | plugins/tiny-code-action.nvim 17 | time-tracker.json 18 | -------------------------------------------------------------------------------- /home-manager/roles/battlestation.nix: -------------------------------------------------------------------------------- 1 | { inputs, lib, config, pkgs, ... }: 2 | 3 | { 4 | imports = [ 5 | # 6 | ./workstation.nix 7 | ../layers/custom/private.nix 8 | ../layers/custom/vault.nix 9 | ../services/syncthing.private.nix 10 | ../misc/remarkable.nix 11 | ]; 12 | 13 | home.packages = with pkgs; 14 | [ 15 | # 16 | ]; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /bin/cb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -- "${@:-$("$1" ;; 9 | *.zip) zip -r "$1" "$2" ;; 10 | *.7z) 7z a "$1" "$2" ;; 11 | *) echo "Error: Cannot determine packing method for '$1'." ;; 12 | esac 13 | 14 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles.el: -------------------------------------------------------------------------------- 1 | ( 2 | ("default" . ( 3 | (user-emacs-directory . "~/.emacs.d/profiles/default") 4 | (straight-p . t) 5 | )) 6 | ("main" . ( 7 | (user-emacs-directory . "~/.emacs.d/profiles/main") 8 | )) 9 | ("dev" . ( 10 | (user-emacs-directory . "~/.emacs.d/profiles/dev") 11 | )) 12 | ) 13 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/jsonls.lua: -------------------------------------------------------------------------------- 1 | local schemastore = require("schemastore") 2 | 3 | return { 4 | filetypes = { "json", "jsonc" }, 5 | root_markers = { ".git" }, 6 | init_options = { 7 | provideFormatter = true, 8 | }, 9 | settings = { 10 | json = { 11 | schemas = schemastore.json.schemas(), 12 | validate = { enable = true }, 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/node.lua: -------------------------------------------------------------------------------- 1 | local rpc = function(function_name) 2 | local nvim_function_name = "Node_" .. function_name:gsub("%.", "_") 3 | return function(...) 4 | return vim.fn[nvim_function_name](...) 5 | end 6 | end 7 | 8 | return { 9 | dev = { 10 | test = rpc("dev.test"), 11 | }, 12 | chrono = { 13 | to_schedule = rpc("chrono.toSchedule"), 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /home-manager/layers/development/lua.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ 5 | # 6 | lua-language-server 7 | stylua 8 | (lua5_1.withPackages (ps: 9 | with ps; [ 10 | # 11 | luacheck 12 | moonscript 13 | luarocks 14 | busted 15 | luafilesystem 16 | penlight 17 | ])) 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /overlays/default.nix: -------------------------------------------------------------------------------- 1 | { inputs, ... }: { 2 | additions = final: _prev: import ../pkgs { pkgs = final; }; 3 | modifications = final: prev: 4 | { 5 | # example = prev.example.overrideAttrs (oldAttrs: rec {}); 6 | }; 7 | 8 | apple-silicon = inputs.apple-silicon.overlays.apple-silicon-overlay; 9 | neovim-nightly-overlay = inputs.neovim-nightly-overlay.overlays.default; 10 | } 11 | -------------------------------------------------------------------------------- /bin/f: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | # export FZF_DEFAULT_OPTS="--ansi --preview-window 'right:60%' --preview 'bat --color=always --style=header,grid --line-range :300 {}'" 6 | # main() { 7 | # local file 8 | # file=$(fd -tf . | fzf) 9 | # if [[ -z "$file" ]]; then 10 | # exit 11 | # fi 12 | # $EDITOR "$file" 13 | # } 14 | # main 15 | 16 | yazi 17 | # superfile 18 | -------------------------------------------------------------------------------- /home-manager/layers/custom/journal.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | 3 | let journalPath = "$HOME/brain/wiki/journal"; 4 | in { 5 | home.packages = with pkgs; [ yad ]; 6 | 7 | home.sessionVariables = { }; 8 | 9 | xsession.windowManager.i3.config.keybindings = { 10 | "Mod3+d" = "exec ~/.config/bin/journal-add"; 11 | }; 12 | 13 | programs.fish.shellAliases = { j = "nvim ${journalPath}"; }; 14 | } 15 | -------------------------------------------------------------------------------- /home-manager/programs/git/git-standup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | 4 | git log --author="$(git config user.email)" --format="%C(yellow)%h%Creset|%C(bold blue)%s%Creset|%C(green)%ad%Creset %+|-" --shortstat --date=format:"%Y-%m-%d %H:%M" | grep -v "^$" | paste -d"|" - - | sed -E "s/([0-9]+) insertions?\(\+\)/\x1b[32m\1+\x1b[0m/g; s/([0-9]+) deletions?\(-\)/\x1b[31m\1-\x1b[0m/g" | column -t -s'|' 5 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/ui/window-maximize.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "ui/window-maximize", 3 | hosts = "*", 4 | plugins = { 5 | { 6 | "declancm/maximize.nvim", 7 | opts = { 8 | default_keymaps = false, 9 | }, 10 | }, 11 | }, 12 | mappings = { 13 | { "n", "f", "lua require('maximize').toggle()", "Toggle maximize" }, 14 | }, 15 | }) 16 | -------------------------------------------------------------------------------- /home-manager/programs/mise.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, pkgs-master, lib, ... }: 2 | 3 | # https://mise.jdx.dev/configuration.html#global-config-config-mise-config-toml 4 | { 5 | programs.mise = { 6 | enable = true; 7 | settings = { 8 | tools = { 9 | # 10 | guck = "latest"; 11 | }; 12 | # aliases = { 13 | # cnode = "20"; 14 | # }; 15 | }; 16 | }; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /home-manager/layers/custom/wiki.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | 3 | let 4 | wiki_root = "$HOME/brain/wiki"; 5 | task_root = "$HOME/brain/wiki"; 6 | in 7 | { 8 | home.sessionVariables = { 9 | TASK_ROOT = task_root; 10 | WIKI_ROOT = wiki_root; 11 | }; 12 | 13 | programs.fish.shellAliases = { 14 | wiki = "core wiki"; 15 | task = "core task"; 16 | tt = "core task interactive"; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /home-manager/programs/eza.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | { 4 | programs.eza = { 5 | enable = true; 6 | enableFishIntegration = false; 7 | enableNushellIntegration = false; 8 | }; 9 | 10 | programs.fish.shellAliases = { 11 | l = "eza -l --group-directories-first"; 12 | la = "eza -alBhg --group-directories-first --time-style long-iso"; 13 | tree = "eza --tree --icons"; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/default/early-init.el: -------------------------------------------------------------------------------- 1 | ;;; early-init.el -*- lexical-binding: t; no-byte-compile: t -*- 2 | (setq gc-cons-threshold most-positive-fixnum 3 | gc-cons-percentage 0.6) 4 | 5 | (setq package-enable-at-startup nil) 6 | (setq package-quickstart nil) 7 | 8 | (setq frame-inhibit-implied-resize t) 9 | (setq inhibit-splash-screen t) 10 | (setq use-file-dialog nil) 11 | 12 | (setq comp-deferred-compilation nil) 13 | -------------------------------------------------------------------------------- /home-manager/programs/zoxide.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.zoxide.enable = true; 3 | 4 | programs.fish = { 5 | functions = { 6 | zz = { 7 | body = '' 8 | set path (zoxide query -l | fzf --preview 'zoxide query {}') 9 | if test -n "$path" 10 | cd "$path" 11 | end 12 | ''; 13 | }; 14 | }; 15 | shellAliases = { zq = "zoxide query -l"; }; 16 | }; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/misc/highlight-on-yank.lua: -------------------------------------------------------------------------------- 1 | local setup = function() 2 | vim.api.nvim_create_autocmd("TextYankPost", { 3 | group = vim.api.nvim_create_augroup("highlight-on-yank", {}), 4 | pattern = "*", 5 | callback = function() 6 | vim.highlight.on_yank() 7 | end, 8 | }) 9 | end 10 | 11 | return lib.module.create({ 12 | name = "misc/highlight-on-yank", 13 | hosts = "*", 14 | setup = setup, 15 | }) 16 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_snipmate/html.snippets: -------------------------------------------------------------------------------- 1 | snippet boil "boilerplate" 2 | 3 | 4 | 5 | App 6 | 7 | 8 | 9 | 10 | 11 | 12 | $0 13 | 14 | 15 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_snipmate/javascript.snippets: -------------------------------------------------------------------------------- 1 | snippet bvstory "vue story" 2 | import $1 from './$1.vue'; 3 | 4 | export default { 5 | title: 'Components/$1', 6 | component: $1, 7 | }; 8 | 9 | const Template = (_, { argTypes }) => ({ 10 | components: { $1 }, 11 | props: Object.keys(argTypes), 12 | template: '<$1 v-bind="$$props" />', 13 | }); 14 | 15 | export const Default = Template.bind({}); 16 | Default.args = { 17 | $0 18 | }; 19 | -------------------------------------------------------------------------------- /home-manager/services/polybar/bci.sh: -------------------------------------------------------------------------------- 1 | #!/run/current-system/sw/bin/bash 2 | 3 | export PATH="/run/current-system/sw/bin/:$PATH" 4 | 5 | # ACTION="$1" 6 | # if [[ $ACTION = "right" ]]; then 7 | # exit 8 | # fi 9 | 10 | STATUS_PATH="/tmp/core-bci-polybar" 11 | 12 | if [ -f "$STATUS_PATH" ]; then 13 | if [ $(($(date +%s) - $(date -r "$STATUS_PATH" +%s))) -le 5 ]; then 14 | cat "$STATUS_PATH" 15 | exit 0 16 | fi 17 | fi 18 | 19 | echo "BCI OFF" 20 | -------------------------------------------------------------------------------- /dotfiles/ranger/rc.conf: -------------------------------------------------------------------------------- 1 | # mappings 2 | copymap h 3 | copymap 4 | map dD console delete 5 | map dT console trash 6 | map dd cut 7 | map yy copy 8 | map yp yank path 9 | map yd yank dir 10 | map pp paste 11 | map dc get_cumulative_size 12 | map . set show_hidden! 13 | map e edit 14 | 15 | unmap q 16 | 17 | # image support 18 | set preview_images true 19 | set preview_images_method ueberzug 20 | 21 | # icons 22 | default_linemode devicons 23 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_vscode/vue.json: -------------------------------------------------------------------------------- 1 | { 2 | "boil": { 3 | "prefix": "boil", 4 | "description": "\"boilerplate\"", 5 | "body": [ 6 | "", 9 | "", 10 | "", 15 | "", 16 | "", 18 | "" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/workflow/mkdirp.lua: -------------------------------------------------------------------------------- 1 | local setup = function() 2 | vim.api.nvim_create_autocmd({ "BufWritePre" }, { 3 | group = vim.api.nvim_create_augroup("mkdirp", {}), 4 | pattern = "*", 5 | callback = function(ctx) 6 | local dir = vim.fn.fnamemodify(ctx.file, ":p:h") 7 | pcall(vim.fn.mkdir, dir, "p") 8 | end, 9 | }) 10 | end 11 | 12 | return lib.module.create({ 13 | name = "workflow/mkdirp", 14 | hosts = "*", 15 | setup = setup, 16 | }) 17 | -------------------------------------------------------------------------------- /dotfiles/nvim/init.lua: -------------------------------------------------------------------------------- 1 | vim.loader.enable(true) 2 | -- vim.loader.reset() 3 | 4 | if vim.env.PROF then 5 | local snacks_path = vim.fn.stdpath("data") .. "/lazy/snacks.nvim" 6 | vim.opt.rtp:append(snacks_path) 7 | local has_snacks, snacks = pcall(require, "snacks.profiler") 8 | if has_snacks then 9 | snacks.startup({ 10 | startup = { 11 | event = "VeryLazy", -- "VimEnter", "UIEnter", "VeryLazy", 12 | }, 13 | }) 14 | end 15 | end 16 | 17 | require("config") 18 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tslib", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "./dist/main.js", 6 | "source": "./src/main.ts", 7 | "scripts": { 8 | "build": "tsc", 9 | "build:watch": "tsc --watch" 10 | }, 11 | "dependencies": { 12 | "chrono-node": "^2.7.0", 13 | "neovim": "^4.10.1" 14 | }, 15 | "devDependencies": { 16 | "@types/node": "^20.6.3", 17 | "typescript": "^5.2.2" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /bin/jjj: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | DEVICE=$(find /dev/input/by-id/ -name "*event-mouse" | sort | tail -1) 6 | OFFSET=5 7 | 8 | [ "$DEVICE" = "" ] && echo "Cannot find mouse event device" && exit 1 9 | echo "Using ${DEVICE}" 10 | 11 | while true; do 12 | evemu-event "$DEVICE" --type EV_REL --code REL_X --value "$OFFSET" --sync 13 | evemu-event "$DEVICE" --type EV_REL --code REL_X --value "-$OFFSET" --sync 14 | echo -n "#" 15 | sleep 10 16 | done 17 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/metatable.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.decorate_non_enumerable = function(target, nonIterableProps) 4 | local metatable = getmetatable(target) or {} 5 | local originalIndex = metatable.__index 6 | 7 | metatable.__index = function(t, key) 8 | if nonIterableProps[key] then return nonIterableProps[key] end 9 | if originalIndex then return originalIndex(t, key) end 10 | return t[key] 11 | end 12 | 13 | setmetatable(target, metatable) 14 | end 15 | 16 | return M 17 | -------------------------------------------------------------------------------- /home-manager/layers/pentesting.nix: -------------------------------------------------------------------------------- 1 | { pkgs, pkgs-stable, ... }: 2 | 3 | { 4 | nixpkgs.overlays = [ (import ../overlays/burp.nix) ]; 5 | 6 | home.packages = with pkgs; 7 | [ 8 | # 9 | burppro 10 | ffuf 11 | whatweb 12 | gobuster 13 | # wafw00f 14 | # cewl 15 | nmap 16 | sqlmap 17 | ] ++ (if (system == "x86_64-linux") then 18 | [ 19 | # 20 | pkgs-stable.ghidra 21 | ] 22 | else 23 | [ ]); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/shell.lua: -------------------------------------------------------------------------------- 1 | local resolve = require("lib/path") 2 | 3 | ---@param str string 4 | local escape = function(str) 5 | return vim.fn.shellescape(str) 6 | end 7 | 8 | ---@param str string 9 | ---@param input? string 10 | local exec = function(str, input) 11 | return vim.fn.system(str, input) 12 | end 13 | 14 | ---@param path string 15 | local open = function(path) 16 | vim.ui.open(path) 17 | end 18 | 19 | return { 20 | escape = escape, 21 | exec = exec, 22 | open = open, 23 | } 24 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rule-tests/react-usememo-no-simple-expression.yml: -------------------------------------------------------------------------------- 1 | id: react-usememo-no-simple-expression 2 | valid: 3 | - useMemo(() => compute(a), [a]); 4 | - | 5 | useMemo(() => { 6 | console.log("check"); 7 | return a === b; 8 | }, [a, b]); 9 | - useMemo(() => a === test(b), [a]); 10 | invalid: 11 | - useMemo(() => a === b, [a, b]); 12 | - useMemo(() => a === 2, [a]); 13 | - useMemo(() => a - b + 12, [a, b]); 14 | - useMemo(() => { return a === b; }, [a, b]); 15 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/orgmode.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "orgmode", 3 | enabled = false, 4 | hosts = { "spaceship", "death" }, 5 | plugins = { 6 | { 7 | "nvim-orgmode/orgmode", 8 | event = "VeryLazy", 9 | ft = { "org" }, 10 | config = function() 11 | require("orgmode").setup({ 12 | org_agenda_files = "~/orgfiles/**/*", 13 | org_default_notes_file = "~/orgfiles/refile.org", 14 | }) 15 | end, 16 | }, 17 | }, 18 | }) 19 | -------------------------------------------------------------------------------- /bin/task-add: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TEXT=$(yad --entry --text "Inbox entry:" --width 600) 4 | DEST=~/brain/wiki/_inbox/tasks 5 | 6 | # https://stackoverflow.com/questions/3183444/check-for-valid-link-url 7 | regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' 8 | 9 | if [ "$TEXT" != "" ]; then 10 | DATE=$(date "+%Y-%m-%d") 11 | ENTRY="$DATE: $TEXT" 12 | 13 | if [[ $TEXT =~ $regex ]]; then 14 | DEST=~/brain/wiki/_inbox/links 15 | fi 16 | 17 | echo "$ENTRY" >>"$DEST" 18 | fi 19 | 20 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/misc/inspect.lua: -------------------------------------------------------------------------------- 1 | local inspect = function() 2 | for _, i1 in ipairs(vim.fn.synstack(vim.fn.line("."), vim.fn.col("."))) do 3 | local i2 = vim.fn.synIDtrans(i1) 4 | local n1 = vim.fn.synIDattr(i1, "name") 5 | local n2 = vim.fn.synIDattr(i2, "name") 6 | print(n1, "->", n2) 7 | end 8 | vim.api.nvim_exec2("Inspect", {}) 9 | end 10 | 11 | return lib.module.create({ 12 | name = "misc/inspect", 13 | hosts = "*", 14 | mappings = { 15 | { "n", "", inspect }, 16 | }, 17 | }) 18 | -------------------------------------------------------------------------------- /bin/screen2webm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then 6 | if [ "$#" -ne 1 ]; then 7 | echo "screen2webm target.webm" 8 | exit 0 9 | fi 10 | 11 | slop=$(slop -f "%x %y %w %h %g %i") || exit 1 12 | IFS=$' ' read -r X Y W H _ < <(echo "$slop") 13 | W=$((W + W % 2)) 14 | H=$((H + H % 2)) 15 | 16 | ffmpeg -f alsa -ac 2 -i pulse -f x11grab -s "${W}x$H" -i ":0.0+$X,$Y" -r 60 -acodec libvorbis -ab 320000 -vb 840000 -vcodec libvpx -threads 0 "$1" 17 | fi 18 | 19 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/prettier.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "semi": true, 5 | "singleQuote": false, 6 | "printWidth": 110, 7 | "quoteProps": "as-needed", 8 | "bracketSpacing": true, 9 | "bracketSameLine": false, 10 | "arrowParens": "always", 11 | "useTabs": false, 12 | "experimentalTernaries": true, 13 | "overrides": [ 14 | { 15 | "files": "*.astro", 16 | "plugins": ["prettier-plugin-astro"], 17 | "options": { 18 | "parser": "astro" 19 | } 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/core/time-tracker.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "core/tracker", 3 | -- enabled = false, 4 | hosts = { "spaceship", "death" }, 5 | plugins = { 6 | { 7 | "3rd/time-tracker.nvim", 8 | dependencies = { 9 | "3rd/sqlite.nvim", 10 | }, 11 | dir = lib.path.resolve(lib.env.dirs.vim.config, "plugins", "time-tracker.nvim"), 12 | event = "VeryLazy", 13 | opts = { 14 | data_file = vim.fn.stdpath("config") .. "/time-tracker.db", 15 | }, 16 | }, 17 | }, 18 | }) 19 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/workflow/leap.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "leap", 3 | hosts = "*", 4 | plugins = { 5 | { 6 | "ggandor/leap.nvim", 7 | lazy = false, 8 | config = function() 9 | local leap = require("leap") 10 | leap.opts.labels = "sfnjklhodweimbuyvrgtaqpcxz" 11 | leap.opts.safe_labels = "sfnut" 12 | 13 | vim.keymap.set({ "n", "x", "o" }, "r", "(leap)") 14 | vim.keymap.set({ "n", "x", "o" }, "R", "(leap-backward)") 15 | end, 16 | }, 17 | }, 18 | }) 19 | -------------------------------------------------------------------------------- /bin/format: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | FORMATTED=0 6 | 7 | if [ -f "go.mod" ]; then 8 | TARGET="${1:-./...}" 9 | # TODO: format "$TARGET" 10 | exit 11 | fi 12 | 13 | if [ -f "package.json" ]; then 14 | TARGET="${1:-.}" 15 | if [ -d "$TARGET/src" ]; then 16 | TARGET="$TARGET/src" 17 | fi 18 | echo "Formatting $TARGET" 19 | prettier -w "$TARGET" --config ~/.config/nvim/linters/prettier.json 20 | FORMATTED=1 21 | fi 22 | 23 | if [ "$FORMATTED" -eq 0 ]; then 24 | echo "FATAL: Unknown project type." 25 | fi 26 | -------------------------------------------------------------------------------- /home-manager/programs/neovim.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ proximity-sort ]; 5 | 6 | programs.neovim = { 7 | enable = true; 8 | defaultEditor = true; 9 | extraLuaPackages = ps: 10 | with ps; [ 11 | # 12 | magick 13 | busted 14 | # luafilesystem 15 | ]; 16 | extraPackages = with pkgs; [ imagemagick gcc ]; 17 | withNodeJs = true; 18 | }; 19 | 20 | programs.fish.shellAliases = { 21 | v = "/home/rabbit/.nix-profile/bin/with-vendors nvim"; 22 | }; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /bin/unpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -f "$1" ]; then 4 | case "$1" in 5 | *.tar.bz2) tar xvjf "$1" ;; 6 | *.tar.gz) tar xvzf "$1" ;; 7 | *.bz2) bunzip2 "$1" ;; 8 | *.rar) unrar x "$1" ;; 9 | *.gz) gunzip "$1" ;; 10 | *.tar) tar xvf "$1" ;; 11 | *.tbz2) tar xvjf "$1" ;; 12 | *.tgz) tar xvzf "$1" ;; 13 | *.zip) unzip "$1" ;; 14 | *.Z) uncompress "$1" ;; 15 | *.7z) 7z x "$1" ;; 16 | *) echo "Error: Cannot determine unpacking method for '$1'." ;; 17 | esac 18 | else 19 | echo "'$1' is not a valid file!" 20 | fi 21 | 22 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/neorg.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "neorg", 3 | enabled = false, 4 | hosts = { "spaceship", "death" }, 5 | plugins = { 6 | { 7 | "nvim-neorg/neorg", 8 | -- build = ":Neorg sync-parsers", 9 | dependencies = { "nvim-lua/plenary.nvim" }, 10 | ft = { "norg" }, 11 | config = function() 12 | require("neorg").setup({ 13 | load = { 14 | ["core.defaults"] = {}, 15 | ["core.concealer"] = {}, 16 | }, 17 | }) 18 | end, 19 | }, 20 | }, 21 | }) 22 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/config/lazy.lua: -------------------------------------------------------------------------------- 1 | local lazy_root_path = lib.env.dirs.vim.lazy.root 2 | 3 | return { 4 | root = lazy_root_path, 5 | defaults = { lazy = true }, 6 | git = { log = { "-5" } }, 7 | ui = { border = "rounded" }, 8 | performance = { 9 | rtp = { 10 | reset = false, 11 | paths = {}, 12 | disabled_plugins = { 13 | -- "matchit", 14 | -- "matchparen", 15 | -- "tutor", 16 | "gzip", 17 | "netrwPlugin", 18 | "tarPlugin", 19 | "tohtml", 20 | "zipPlugin", 21 | }, 22 | }, 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /navi/system.cheat: -------------------------------------------------------------------------------- 1 | % system 2 | 3 | # systemd-analyze time 4 | systemd-analyze time 5 | 6 | # systemd-analyze time (user) 7 | systemd-analyze time --user 8 | 9 | # systemd-analyze blame 10 | systemd-analyze blame 11 | 12 | # systemd-analyze blame (user) 13 | systemd-analyze blame --user 14 | 15 | # systemd-analyze critical-chain 16 | systemd-analyze critical-chain 17 | 18 | # systemd-analyze critical-chain (user) 19 | systemd-analyze critical-chain --user 20 | 21 | # systemd-analyze dump 22 | systemd-analyze dump 23 | 24 | # systemd-analyze dump (user) 25 | systemd-analyze dump --user 26 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/misc/colorizer.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "misc/colorizer", 3 | hosts = "*", 4 | plugins = { 5 | { 6 | "brenoprata10/nvim-highlight-colors", 7 | -- enabled = false, 8 | event = "VeryLazy", 9 | config = function() 10 | require("nvim-highlight-colors").setup({ 11 | render = "background", 12 | enable_tailwind = false, 13 | -- exclude_buftypes = { 14 | -- "prompt", 15 | -- "popup", 16 | -- }, 17 | }) 18 | end, 19 | }, 20 | }, 21 | }) 22 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_vscode/typescript.json: -------------------------------------------------------------------------------- 1 | { 2 | "bcontext": { 3 | "prefix": "bcontext", 4 | "description": "\"context\"", 5 | "body": [ 6 | "import { createContext, useContext \\} from \"react\";", 7 | "", 8 | "type $1ContextType = {", 9 | "\t$2", 10 | "\\};", 11 | "", 12 | "const $1Context = createContext<$1ContextType>({\\} as $1ContextType);", 13 | "", 14 | "export const $1Provider = $1Context.Provider;", 15 | "", 16 | "export const use$1 = () => useContext($1Context);", 17 | "" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /home-manager/programs/tmux/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs, pkgs-stable, ... }: 2 | 3 | let 4 | scripts = { 5 | tmux-workspace = pkgs.writeShellScriptBin "tmux-workspace" 6 | (builtins.readFile ./tmux-workspace.sh); 7 | }; 8 | in { 9 | 10 | # https://github.com/nix-community/home-manager/blob/master/modules/programs/tmux.nix 11 | # programs.tmux = { enable = true; }; 12 | # xdg.configFile."tmux/tmux.conf".source = ./tmux.conf; 13 | 14 | home.packages = with pkgs; [ tmux pkgs-stable.tmuxp scripts.tmux-workspace ]; 15 | programs.fish.shellAliases = { t = "tmux-workspace"; }; 16 | } 17 | -------------------------------------------------------------------------------- /home-manager/programs/fzf.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.fzf = { 3 | enable = true; 4 | enableFishIntegration = true; 5 | changeDirWidgetCommand = 6 | "fd --color always --hidden --follow --exclude .git --type d"; 7 | changeDirWidgetOptions = 8 | [ "--ansi --preview 'eza --color always --tree {} | head -500'" ]; 9 | fileWidgetCommand = 10 | "fd --color always --type f --hidden --follow --exclude .git"; 11 | fileWidgetOptions = [ 12 | "--ansi --preview-window=right:60% --preview 'bat --style=plain --color=always --line-range :500 {}'" 13 | ]; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/language-support/languages/nix.lua: -------------------------------------------------------------------------------- 1 | -- local null_ls = require("null-ls") 2 | 3 | -- TODO: rework hooks based on this signature 4 | return lib.module.create({ 5 | name = "language-support/languages/nix", 6 | hosts = "*", 7 | hooks = { 8 | treesitter = { 9 | "nix", 10 | }, 11 | null = { 12 | -- null_ls.builtins.diagnostics.statix, 13 | -- null_ls.builtins.code_actions.statix, 14 | -- null_ls.builtins.diagnostics.deadnix, 15 | -- null_ls.builtins.formatting.nixfmt.with({ extra_args = { "--width", "80" } }), 16 | }, 17 | }, 18 | }) 19 | -------------------------------------------------------------------------------- /home-manager/services/polybar/bluetooth.sh: -------------------------------------------------------------------------------- 1 | #!/run/current-system/sw/bin/bash 2 | 3 | export PATH="/run/current-system/sw/bin/:$PATH" 4 | 5 | ACTION="$1" 6 | 7 | if [[ $ACTION = "right" ]]; then 8 | if [ "$(bluetoothctl show | grep "Powered: yes" | wc -c)" -eq 0 ]; then 9 | bluetoothctl power on 10 | else 11 | bluetoothctl power off 12 | fi 13 | exit 14 | fi 15 | 16 | if [ "$(hciconfig | grep "UP RUNNING" | wc -c)" -eq 0 ]; then 17 | echo "%{F#66ffffff}" 18 | else 19 | if [ "$(hcitool con | wc -l)" -eq 1 ]; then 20 | echo "" 21 | else 22 | echo "%{F#2193ff}" 23 | fi 24 | fi 25 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rules/ts-array-no-useless-spread.yml: -------------------------------------------------------------------------------- 1 | id: ts-array-no-useless-spread 2 | message: Useless array spread before non-mutating method 3 | severity: error 4 | language: tsx 5 | rule: 6 | pattern: "[...$TARGET].$METHOD($$$)" 7 | constraints: 8 | TARGET: 9 | not: 10 | has: 11 | kind: identifier 12 | regex: Array 13 | METHOD: 14 | regex: at|concat|entries|every|filter|find|findIndex|findLast|findLastIndex|flat|flatMap|forEach|includes|indexOf|join|keys|lastIndexOf|map|reduce|reduceRight|slice|some|toLocaleString|toReversed|toSorted|toSpliced|toString|values|with 15 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/lazy.lua: -------------------------------------------------------------------------------- 1 | local env = require("lib/env") 2 | 3 | local lazy_plugin_path = env.dirs.vim.lazy.plugin 4 | 5 | local install = function() 6 | if not vim.loop.fs_stat(lazy_plugin_path) then 7 | vim.fn.system({ 8 | "git", 9 | "clone", 10 | "--filter=blob:none", 11 | "https://github.com/folke/lazy.nvim.git", 12 | "--branch=stable", 13 | lazy_plugin_path, 14 | }) 15 | end 16 | end 17 | 18 | local setup = function(plugins, config) 19 | require("lazy").setup(plugins, config) 20 | end 21 | 22 | return { 23 | install = install, 24 | setup = setup, 25 | } 26 | -------------------------------------------------------------------------------- /home-manager/layers/custom/daemon.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | 3 | let 4 | build_dir = "/home/rabbit/brain/core/rewrite/daemon"; 5 | # command = "/bin/sh -c 'go run . daemon start'"; 6 | command = "/bin/sh -c '/home/rabbit/go/bin/core daemon start'"; 7 | in { 8 | systemd.user.services.core = { 9 | Unit.Description = "Core Service"; 10 | Install.WantedBy = [ "graphical-session.target" ]; 11 | Service = { 12 | WorkingDirectory = "${build_dir}"; 13 | ExecStart = "${command}"; 14 | # "${pkgs.watchexec}/bin/watchexec --no-discover-ignore -w . -r ${command}"; 15 | }; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /scripts/swap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd)" 6 | REMOTE=$(git remote -v | grep origin | grep fetch | awk '{print $2}') 7 | 8 | function swap() { 9 | TMP_PATH=$(tr -dc A-Za-z0-9 Private" 17 | else 18 | echo "Private -> Public" 19 | fi 20 | 21 | swap "$ROOT/.git" "$ROOT/.git-alt" 22 | swap "$ROOT/.gitignore" "$ROOT/.gitignore-alt" 23 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/src/examples.ts: -------------------------------------------------------------------------------- 1 | import { NvimPlugin } from "neovim"; 2 | 3 | const plugin = {} as NvimPlugin; 4 | 5 | plugin.registerCommand( 6 | "EchoMessage", 7 | async () => { 8 | try { 9 | await plugin.nvim.outWrite("Dayman (ah-ah-ah) \n"); 10 | } catch (error) { 11 | console.error(error); 12 | } 13 | }, 14 | { sync: false } 15 | ); 16 | 17 | plugin.registerAutocmd( 18 | "BufEnter", 19 | async (fileName) => { 20 | await plugin.nvim.buffer.append("BufEnter for a JS File?"); 21 | }, 22 | { sync: false, pattern: "*.js", eval: 'expand("")' } 23 | ); 24 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/workflow/rooter.lua: -------------------------------------------------------------------------------- 1 | local setup = function() 2 | local group = vim.api.nvim_create_augroup("rooter", {}) 3 | vim.api.nvim_create_autocmd("BufEnter", { 4 | group = group, 5 | callback = function() 6 | if vim.g.rooter_done then return end 7 | local target = lib.path.find_root() 8 | if not target then return end 9 | vim.g.rooter_done = true 10 | pcall(vim.api.nvim_clear_autocmds, { group = group }) 11 | vim.fn.chdir(target) 12 | end, 13 | }) 14 | end 15 | 16 | return lib.module.create({ 17 | name = "workflow/rooter", 18 | hosts = "*", 19 | setup = setup, 20 | }) 21 | -------------------------------------------------------------------------------- /bin/nixs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | CACHE_FILE=~/.nixs.cache 6 | 7 | function update_all() { 8 | echo "Updating package list..." 9 | nix-env -qaP --description | sort -u >"$CACHE_FILE" 10 | } 11 | 12 | if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then 13 | if [[ -f "$CACHE_FILE" ]]; then 14 | if [[ -n $(find "$CACHE_FILE" -mtime +30 -print) ]]; then 15 | update_all 16 | fi 17 | else 18 | update_all 19 | fi 20 | 21 | PACKAGE=$(fzf <"$CACHE_FILE" | cut -d" " -f1) 22 | if [ "$PACKAGE" != "" ]; then 23 | echo "Installing: $PACKAGE" 24 | nix-env -iA "$PACKAGE" 25 | fi 26 | fi 27 | -------------------------------------------------------------------------------- /home-manager/desktop/hyprland.disabled.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | home.packages = with pkgs; [ 5 | grim 6 | gtk3 7 | imv 8 | mimeo 9 | primary-xwayland 10 | pulseaudio 11 | slurp 12 | waypipe 13 | wf-recorder 14 | wl-clipboard 15 | wl-mirror 16 | wl-mirror-pick 17 | xdg-utils-spawn-terminal 18 | ydotool 19 | ]; 20 | 21 | home.sessionVariables = { 22 | MOZ_ENABLE_WAYLAND = 1; 23 | QT_QPA_PLATFORM = "wayland"; 24 | LIBSEAT_BACKEND = "logind"; 25 | }; 26 | 27 | xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; 28 | xdg.mimeApps.enable = true; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/dev/early-init.el: -------------------------------------------------------------------------------- 1 | ;;; early-init.el -*- lexical-binding: t; eval: (view-mode -1); -*- 2 | 3 | ;; gc defer 4 | (setq gc-cons-threshold most-positive-fixnum) 5 | 6 | ;; package management 7 | (setq package-enable-at-startup nil) 8 | (advice-add #'package--ensure-init-file :override #'ignore) 9 | 10 | ;; ui: disable elements 11 | (setq tool-bar-mode nil 12 | menu-bar-mode nil) 13 | (when (fboundp 'set-scroll-bar-mode) 14 | (set-scroll-bar-mode nil)) 15 | 16 | ;; ui: disable frame resize 17 | (setq frame-inhibit-implied-resize t) 18 | 19 | ;; ignore X resources 20 | (advice-add #'x-apply-session-resources :override #'ignore) 21 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/builtins/clipboard.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "clipboard", 3 | setup = function() 4 | -- https://discourse.nixos.org/t/problem-with-the-neovim-clipboard/55770 5 | vim.g.clipboard = { 6 | name = "xclip", 7 | copy = { 8 | ["+"] = { "xclip", "-quiet", "-i", "-selection", "clipboard" }, 9 | ["*"] = { "xclip", "-quiet", "-i", "-selection", "primary" }, 10 | }, 11 | paste = { 12 | ["+"] = { "xclip", "-o", "-selection", "clipboard" }, 13 | ["*"] = { "xclip", "-o", "-selection", "primary" }, 14 | }, 15 | cache_enabled = 1, 16 | } 17 | end, 18 | }) 19 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/syslang/lua/syslang/folding.lua: -------------------------------------------------------------------------------- 1 | local setup = function() 2 | local group = vim.api.nvim_create_augroup("syslang:folds", { clear = true }) 3 | local bufnr = vim.api.nvim_get_current_buf() 4 | 5 | vim.api.nvim_create_autocmd({ "BufWinEnter" }, { 6 | group = group, 7 | buffer = bufnr, 8 | callback = function() 9 | vim.cmd("silent! loadview") 10 | end, 11 | }) 12 | vim.api.nvim_create_autocmd({ "BufWinLeave", "BufWritePost" }, { 13 | group = group, 14 | buffer = bufnr, 15 | callback = function() 16 | vim.cmd("silent! mkview") 17 | end, 18 | }) 19 | end 20 | 21 | return { 22 | setup = setup, 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ceci n'est pas une pipe 2 | 3 | This repository contains most of the plumbing that powers my workflow. 4 | 5 | Many things are unpolished, and there are many references to things that are not public, but you might be able to find & borrow some useful gems. 6 | 7 | **Points of interest:** 8 | 9 | - [Neovim configuration](dotfiles/nvim) 10 | - [Neovim setup](https://github.com/search?q=repo%3A3rd%2Fconfig%20syslang&type=code) for [Syslang](https://github.com/3rd/syslang), my custom document syntax 11 | - [Emacs configuration (dead)](dotfiles/emacs) 12 | - NixOS [modules](modules) and [roles](roles) 13 | - Home Manager [modules](home-manager) 14 | - [Scripts](bin) 15 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rules/react-prop-object-always-recreated.yml: -------------------------------------------------------------------------------- 1 | id: react-prop-object-always-recreated 2 | message: Avoid recreating object/array literals as JSX props 3 | severity: warning 4 | language: tsx 5 | ignores: 6 | - "./**/*.test.tsx" 7 | - "./**/*.spec.tsx" 8 | rule: 9 | kind: jsx_expression 10 | inside: 11 | stopBy: end 12 | any: 13 | - kind: jsx_self_closing_element 14 | has: 15 | kind: identifier 16 | regex: ^[A-Z] 17 | - kind: jsx_opening_element 18 | has: 19 | kind: identifier 20 | regex: ^[A-Z] 21 | has: 22 | any: 23 | - kind: object 24 | - kind: array 25 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_vscode/html.json: -------------------------------------------------------------------------------- 1 | { 2 | "boil": { 3 | "prefix": "boil", 4 | "description": "\"boilerplate\"", 5 | "body": [ 6 | "", 7 | "", 8 | "\t", 9 | "\t\tApp", 10 | "\t\t", 11 | "\t\t", 12 | "\t\t", 13 | "\t\t", 14 | "\t", 15 | "\t", 16 | "\t\t$0", 17 | "\t", 18 | "" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/workflow/treesj.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "treesj", 3 | hosts = "*", 4 | plugins = { 5 | { 6 | "Wansmer/treesj", 7 | dependencies = { "nvim-treesitter/nvim-treesitter" }, 8 | opts = { 9 | use_default_keymaps = false, 10 | check_syntax_error = true, 11 | max_join_length = 150, 12 | cursor_behavior = "hold", 13 | notify = false, 14 | dot_repeat = false, 15 | }, 16 | }, 17 | }, 18 | mappings = { 19 | { 20 | "n", 21 | "J", 22 | function() 23 | require("treesj").toggle() 24 | end, 25 | "Toggle join", 26 | }, 27 | }, 28 | }) 29 | -------------------------------------------------------------------------------- /home-manager/services/polybar/vpn.sh: -------------------------------------------------------------------------------- 1 | #!/run/current-system/sw/bin/bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | export PATH="/run/current-system/sw/bin/:$PATH" 6 | 7 | INFO="$( ( (pgrep -a openforti | head -n 1 | awk '{print $1 }') || (pgrep -a openvpn | head -n 1 | awk '{print $1 }') || (pgrep -a charon | head -n 1 | awk '{print $1 }')) | head -n 1)" 8 | if [ "$INFO" != "" ]; then 9 | printf "VPN: %s" "$INFO" 10 | exit 0 11 | fi 12 | 13 | INFO=$(mullvad status 2>/dev/null) 14 | if [[ $INFO == *"Connected"* ]]; then 15 | LOCATION=$(echo "$INFO" | grep -oP "Your connection appears to be from: \K.*") 16 | printf "Mullvad: %s" "$LOCATION" 17 | exit 0 18 | fi 19 | 20 | echo "" 21 | -------------------------------------------------------------------------------- /modules/llm.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, pkgs-stable, options, ... }: 2 | { 3 | 4 | # environment.systemPackages = with pkgs; 5 | # [ (pkgs.ollama.override { acceleration = "cuda"; }) ]; 6 | # 7 | # services.open-webui = { 8 | # package = pkgs-stable.open-webui; 9 | # enable = true; 10 | # port = 9999; 11 | # environment = { 12 | # ANONYMIZED_TELEMETRY = "False"; 13 | # DO_NOT_TRACK = "True"; 14 | # SCARF_NO_ANALYTICS = "True"; 15 | # OLLAMA_API_BASE_URL = "http://127.0.0.1:11434/api"; 16 | # OLLAMA_BASE_URL = "http://127.0.0.1:11434"; 17 | # WEBUI_URL = "http://localhost:9999"; 18 | # PORT = "9999"; 19 | # }; 20 | # }; 21 | } 22 | -------------------------------------------------------------------------------- /modules/ld.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, pkgs-stable, lib, ... }: 2 | 3 | { 4 | # boot.binfmt.emulatedSystems = [ "x86_64-linux" ]; 5 | 6 | # https://www.reddit.com/r/NixOS/comments/1d7zvgu/nvim_cant_find_standard_library_headers/ 7 | programs.nix-ld = { 8 | enable = true; 9 | libraries = with pkgs; [ 10 | stdenv.cc.cc 11 | 12 | (runCommand "steamrun-lib" { } 13 | "mkdir $out; ln -s ${steam-run.fhsenv}/usr/lib64 $out/lib") 14 | ]; 15 | }; 16 | 17 | system.activationScripts.ldso = { 18 | deps = [ ]; 19 | text = '' 20 | mkdir -p /lib64 21 | ln -sfn ${pkgs.glibc}/lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 22 | ''; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /modules/hyprland.nix: -------------------------------------------------------------------------------- 1 | # https://wiki.hypr.land/Nix/Hyprland-on-NixOS/ 2 | # https://wiki.hypr.land/Nvidia/ 3 | 4 | { inputs, pkgs, ... }: { 5 | nix.settings = { 6 | substituters = [ "https://hyprland.cachix.org" ]; 7 | trusted-substituters = [ "https://hyprland.cachix.org" ]; 8 | trusted-public-keys = 9 | [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; 10 | }; 11 | 12 | programs.hyprland = { 13 | enable = true; 14 | package = 15 | inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; 16 | portalPackage = 17 | inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_vscode/javascript.json: -------------------------------------------------------------------------------- 1 | { 2 | "bvstory": { 3 | "prefix": "bvstory", 4 | "description": "\"vue story\"", 5 | "body": [ 6 | "import $1 from './$1.vue';", 7 | "", 8 | "export default {", 9 | "\ttitle: 'Components/$1',", 10 | "\tcomponent: $1,", 11 | "\\};", 12 | "", 13 | "const Template = (_, { argTypes \\}) => ({", 14 | "\tcomponents: { $1 \\},", 15 | "\tprops: Object.keys(argTypes),", 16 | "\ttemplate: '<$1 v-bind=\"\\$\\$props\" />',", 17 | "\\});", 18 | "", 19 | "export const Default = Template.bind({\\});", 20 | "Default.args = {", 21 | "\t$0", 22 | "\\};" 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /navi/nix.cheat: -------------------------------------------------------------------------------- 1 | % nix 2 | 3 | # list installed packages (user) 4 | nix-env -q 5 | 6 | # uninstall package (user) 7 | nix-env -e 8 | 9 | # find why a package is installed (why-depends) 10 | nix why-depends /run/current-system 11 | 12 | # analyze what takes space in the nix store 13 | nix-du --root /run/current-system/sw -s -O2 | dot -Tsvg > nixstoregraph.svg 14 | xdg-open nixstoregraph.svg 15 | 16 | # repair /nix/store 17 | sudo nix-store --verify --check-contents --repair 18 | 19 | $ system_package: nix path-info -r /run/current-system 20 | $ user_package_name: nix-env -q | awk '{gsub(/-[0-9]+.*/, ""); print}' 21 | $ max_size: echo 100MB --- --fzf-overrides '--no-select-1' 22 | -------------------------------------------------------------------------------- /dotfiles/nvim/snippets_snipmate/lua.snippets: -------------------------------------------------------------------------------- 1 | snippet #! 2 | #!/usr/bin/env lua 3 | $1 4 | 5 | snippet for 6 | for ${1:i}=${2:1},${3:10} do 7 | ${0:print(i)} 8 | end 9 | 10 | snippet forp 11 | for ${1:i},${2:v} in pairs(${3:table_name}) do 12 | ${0:-- body} 13 | end 14 | 15 | snippet fori 16 | for ${1:i},${2:v} in ipairs(${3:table_name}) do 17 | ${0:-- body} 18 | end 19 | 20 | snippet styluaignore "stylua ignore" 21 | -- stylua: ignore 22 | 23 | snippet class 24 | local ${1:Name} = {} 25 | $1.__index = $1 26 | 27 | function $1.new(${2:args}) 28 | local self = setmetatable({ 29 | $0 30 | }, $1) 31 | return self 32 | end 33 | 34 | function $1:method(arg) 35 | print(self.field, arg) 36 | end 37 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/lsp/gopls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | cmd = { "gopls", "-remote=auto", "-remote.debug=:0" }, 3 | settings = { 4 | gopls = { 5 | analyses = { 6 | unusedparams = true, 7 | unreachable = false, 8 | ST1003 = false, 9 | }, 10 | codelenses = { 11 | generate = true, 12 | gc_details = true, 13 | test = true, 14 | tidy = true, 15 | }, 16 | usePlaceholders = true, 17 | completeUnimported = true, 18 | staticcheck = true, 19 | matcher = "fuzzy", 20 | diagnosticsDelay = "500ms", 21 | symbolMatcher = "fuzzy", 22 | gofumpt = false, 23 | buildFlags = { "-tags", "integration" }, 24 | }, 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/misc/highlight-words.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "misc/highlight-words", 3 | hosts = "*", 4 | plugins = { 5 | { 6 | "dvoytik/hi-my-words.nvim", 7 | -- event = "VeryLazy", 8 | config = function() 9 | require("hi-my-words").setup() 10 | lib.map.map("n", "m", ":HiMyWordsToggle", { silent = true, desc = "Toggle word highlight" }) 11 | lib.map.map("n", "M", ":HiMyWordsClear", { silent = true, desc = "Clear word highlights" }) 12 | end, 13 | keys = { 14 | { "m", desc = "Toggle word highlight" }, 15 | { "M", desc = "Clear word highlights" }, 16 | }, 17 | }, 18 | }, 19 | }) 20 | -------------------------------------------------------------------------------- /home-manager/layers/development/nodejs.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, pkgs-stable, ... }: 2 | 3 | { 4 | 5 | home.packages = with pkgs; [ 6 | # 7 | nodejs_22 8 | electron 9 | pkgs-stable.quick-lint-js 10 | # bun 11 | ]; 12 | 13 | home = { 14 | sessionPath = [ "$HOME/.npm/global/bin" "$HOME/.pnpm" ]; 15 | sessionVariables = { 16 | NODE_PATH = "$HOME/.npm/global/lib/node_modules"; 17 | NODE_OPTIONS = ""; 18 | PNPM_HOME = "$HOME/.pnpm"; 19 | ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; 20 | }; 21 | activation = { 22 | npm_set_prefix = lib.hm.dag.entryAfter [ "writeBoundary" ] '' 23 | ${pkgs.nodejs_latest}/bin/npm set prefix ~/.npm/global 24 | ''; 25 | }; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /bin/webm2mp4: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | convert_file() { 6 | file="$1" 7 | if [[ "$file" == *.webm ]]; then 8 | filename="${file%.*}" 9 | if [ -f "$file" ]; then 10 | if ffmpeg -hwaccel cuda -i "$file" -c:v hevc_nvenc -preset lossless -c:a copy "${filename}.mp4" -nostdin -loglevel error; then 11 | echo "$file" 12 | else 13 | echo "Error: Failed to convert $file" >&2 14 | fi 15 | else 16 | echo "Error: File not found: $file" >&2 17 | fi 18 | fi 19 | } 20 | 21 | if [ $# -eq 0 ]; then 22 | echo "Usage: $0 [file2.webm] ... or $0 *" >&2 23 | exit 1 24 | fi 25 | 26 | for file in "$@"; do 27 | convert_file "$file" 28 | done 29 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/ui/input.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "ui/input", 3 | hosts = "*", 4 | plugins = { 5 | { 6 | "stevearc/dressing.nvim", 7 | event = "VeryLazy", 8 | opts = { 9 | input = { 10 | win_options = { 11 | winblend = 0, 12 | winhighlight = "NormalFloat:Normal", 13 | }, 14 | override = function(conf) 15 | conf.col = -1 16 | conf.row = 0 17 | return conf 18 | end, 19 | }, 20 | select = { 21 | enabled = true, 22 | backend = { "fzf_lua", "fzf", "builtin" }, 23 | }, 24 | }, 25 | }, 26 | { "MunifTanjim/nui.nvim" }, 27 | }, 28 | }) 29 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/misc/bufferize.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "misc/bufferize", 3 | hosts = { "spaceship", "death" }, 4 | plugins = { 5 | { 6 | "AndrewRadev/bufferize.vim", 7 | cmd = { 8 | "Bufferize", 9 | "Bmessages", 10 | "Bnotifications", 11 | }, 12 | config = function() 13 | vim.g.bufferize_command = "tabnew" 14 | vim.api.nvim_create_user_command("Bmessages", "Bufferize messages", { 15 | desc = "Open messages in new buffer", 16 | }) 17 | vim.api.nvim_create_user_command("Bnotifications", "Bufferize Notifications", { 18 | desc = "Open notifications in new buffer", 19 | }) 20 | end, 21 | }, 22 | }, 23 | }) 24 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/ui/modes.lua: -------------------------------------------------------------------------------- 1 | local colors = require("config/colors-hex") 2 | 3 | return lib.module.create({ 4 | name = "ui/modes", 5 | hosts = "*", 6 | plugins = { 7 | { 8 | "mvllow/modes.nvim", 9 | lazy = false, 10 | config = function() 11 | require("modes").setup({ 12 | colors = { 13 | insert = colors.cyan, 14 | visual = "#c881de", 15 | copy = colors.common.cword, 16 | delete = colors.red, 17 | }, 18 | line_opacity = 0.3, 19 | set_cursor = true, 20 | set_cursorline = true, 21 | set_number = true, 22 | ignore = { "NvimTree", "TelescopePrompt" }, 23 | }) 24 | end, 25 | }, 26 | }, 27 | }) 28 | -------------------------------------------------------------------------------- /modules/bluetooth.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, options, ... }: 2 | 3 | { 4 | 5 | environment.systemPackages = with pkgs; [ bluetuith ]; 6 | hardware.bluetooth = { 7 | enable = true; 8 | package = pkgs.bluez; 9 | powerOnBoot = true; 10 | settings = { 11 | General = { 12 | Enable = "Source,Sink,Media,Socket"; 13 | ControllerMode = "bredr"; 14 | FastConnectable = true; 15 | Experimental = true; 16 | KernelExperimental = true; 17 | }; 18 | LE = { EnableAdvMonInterleaveScan = 1; }; 19 | }; 20 | }; 21 | services.blueman.enable = true; 22 | 23 | services.udev.extraRules = '' 24 | SUBSYSTEM=="usb", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0029", ATTR{authorized}="0" 25 | ''; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /navi/network.cheat: -------------------------------------------------------------------------------- 1 | % network 2 | 3 | # Kill a process running on a given port 4 | lsof -i : \ 5 | | awk '{l=$2} END {print l}' \ 6 | | xargs kill 7 | 8 | # List IP addresses connected on a given port 9 | netstat -tn 2>/dev/null \ 10 | | grep : \ 11 | | awk '{print $5}' \ 12 | | cut -d: -f1 \ 13 | | sort \ 14 | | uniq -c \ 15 | | sort -nr \ 16 | | head 17 | 18 | # Find primary, local IP address 19 | ifconfig \ 20 | | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' \ 21 | | grep -Eo '([0-9]*\.){3}[0-9]*' \ 22 | | grep -v '127.0.0.1' \ 23 | | tail -n1 24 | 25 | # Find external, public IP address 26 | dig +short myip.opendns.com @resolver1.opendns.com 27 | 28 | # List open ports and processes 29 | sudo lsof -i -P -n | grep LISTEN 30 | -------------------------------------------------------------------------------- /navi/linux.cheat: -------------------------------------------------------------------------------- 1 | % linux 2 | 3 | # journal (all) 4 | journalctl -e 5 | 6 | # journal (current boot) 7 | journalctl -b -e 8 | 9 | # journal (kernel) 10 | journalctl -k -e 11 | 12 | # journal (..warn) 13 | journalctl -e -p 4 14 | 15 | # journal (system) 16 | journalctl --system -e 17 | 18 | # journal (user) 19 | journalctl --user -e 20 | 21 | # query mime handler 22 | XDG_UTILS_DEBUG_LEVEL=3 xdg-mime query default 23 | 24 | # disable ipv6 25 | sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 26 | sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 27 | 28 | # enable ipv6 29 | sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 30 | sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 31 | 32 | # libinput: debug key events 33 | sudo libinput debug-events --show-keycodes 34 | -------------------------------------------------------------------------------- /bin/asusfanprofile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | 4 | asusctl fan-curve --mod-profile performance -f cpu --data 40c:10%,42c:15%,45c:20%,50c:50%,60c:70%,65c:80%,70c:90%,72c:95% 5 | asusctl fan-curve --mod-profile performance -f gpu --data 40c:10%,42c:15%,45c:20%,50c:50%,60c:70%,65c:80%,70c:90%,72c:95% 6 | asusctl fan-curve --mod-profile performance -e true 7 | asusctl fan-curve --mod-profile balanced -f cpu --data 40c:10%,42c:15%,45c:20%,50c:50%,60c:70%,65c:80%,70c:90%,72c:95% 8 | asusctl fan-curve --mod-profile balanced -f gpu --data 40c:10%,42c:15%,45c:20%,50c:50%,60c:70%,65c:80%,70c:90%,72c:95% 9 | asusctl fan-curve --mod-profile balanced -e true 10 | echo "" 11 | 12 | echo "--- FAN CURVE ---" 13 | asusctl fan-curve -g 14 | echo "--- PROFILE ---" 15 | asusctl profile -p 16 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/src/main.ts: -------------------------------------------------------------------------------- 1 | import API from "./api"; 2 | import * as modules from "./modules"; 3 | import type { NvimPlugin } from "neovim"; 4 | 5 | export default function myplugin(plugin: NvimPlugin) { 6 | plugin.setOptions({ 7 | dev: false, // reload module on invocation 8 | alwaysInit: false, // init on each invocation 9 | }); 10 | 11 | for (const [moduleName, mod] of Object.entries(modules)) { 12 | for (const [fnName, fn] of Object.entries(mod)) { 13 | const name = `Node_${moduleName}_${fnName}`; 14 | const isAsync = fn.constructor.name === "AsyncFunction"; 15 | const api = new API(plugin); 16 | plugin.registerFunction(name, ([input]) => fn({ api, plugin, input }), { sync: !isAsync }); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /home-manager/layers/development/golang.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, pkgs-stable, ... }: 2 | 3 | { 4 | home.packages = with pkgs; 5 | [ 6 | # 7 | gotools 8 | golangci-lint 9 | gotest 10 | gopls 11 | ] ++ (if (system == "x86_64-linux") then 12 | [ 13 | # 14 | pkgs-stable.jetbrains.goland 15 | ] 16 | else 17 | [ ]); 18 | 19 | programs.go = { 20 | enable = true; 21 | env = { 22 | GOPATH = "${config.home.homeDirectory}/go"; 23 | GOBIN = "${config.home.homeDirectory}/go/bin"; 24 | }; 25 | # package = pkgs.go_1_21; 26 | }; 27 | 28 | home.sessionPath = [ "$HOME/go/bin" ]; 29 | 30 | programs.fish = { 31 | shellInit = '' 32 | set -x PATH $HOME/go/bin $PATH 33 | ''; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /bin/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then 6 | # local 7 | if [ -f "build.sh" ]; then 8 | ./build.sh 9 | exit 0 10 | fi 11 | 12 | # make 13 | if [ -f "Makefile" ]; then 14 | if grep -q "build:" "Makefile"; then 15 | make build 16 | else 17 | make 18 | fi 19 | exit 0 20 | fi 21 | 22 | # go 23 | if [ -f "go.mod" ]; then 24 | go build 25 | exit 0 26 | fi 27 | 28 | # cargo 29 | if [ -f "Cargo.toml" ]; then 30 | cargo build --release 31 | exit 0 32 | fi 33 | 34 | # js 35 | if [ -f "package.json" ]; then 36 | if [ -f "yarn.lock" ]; then 37 | yarn build 38 | else 39 | npm run build 40 | fi 41 | exit 0 42 | fi 43 | fi 44 | -------------------------------------------------------------------------------- /modules/packages/qimgv/default.nix: -------------------------------------------------------------------------------- 1 | { lib, stdenv, fetchFromGitHub, cmake, pkg-config, libsForQt5, opencv4, exiv2 2 | , mpv-unwrapped, }: 3 | 4 | stdenv.mkDerivation { 5 | pname = "qimgv"; 6 | version = "unstable-2024-07-27"; 7 | src = fetchFromGitHub { 8 | owner = "easymodo"; 9 | repo = "qimgv"; 10 | rev = "82e6b7537002b86b4ab20954aab5bf0db7c25752"; 11 | hash = "sha256-FboaMevbzsKZSfbalVI4Kwwgp4Lbct3KDE6xKufzGtc="; 12 | }; 13 | 14 | nativeBuildInputs = [ cmake pkg-config libsForQt5.wrapQtAppsHook ]; 15 | 16 | buildInputs = with libsForQt5; [ 17 | exiv2 18 | mpv-unwrapped 19 | opencv4 20 | qtbase 21 | qtimageformats 22 | qtsvg 23 | qttools 24 | ]; 25 | 26 | cmakeFlags = [ "-DVIDEO_SUPPORT=ON" "-DEXIV2=ON" "-DOPENCV_SUPPORT=ON" ]; 27 | } 28 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rules/react-useeffect-no-useless-ref-assignment.yml: -------------------------------------------------------------------------------- 1 | id: react-useeffect-no-useless-ref-assignment 2 | message: Useless ref assignment in useEffect 3 | severity: error 4 | language: tsx 5 | rule: 6 | inside: 7 | kind: call_expression 8 | has: 9 | kind: identifier 10 | regex: useEffect 11 | stopBy: end 12 | all: 13 | - any: 14 | - pattern: $REF.current = $VALUE 15 | - pattern: $REF.current.$$$ = $VALUE 16 | - not: 17 | inside: 18 | kind: arrow_function 19 | stopBy: end 20 | has: 21 | stopBy: end 22 | kind: expression_statement 23 | not: 24 | any: 25 | - pattern: $REF.current = $VALUE; 26 | - pattern: $REF.current.$$$ = $VALUE; 27 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/workflow/search.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "workflow/search", 3 | hosts = "*", 4 | plugins = { 5 | { 6 | "MagicDuck/grug-far.nvim", 7 | opts = { headerMaxWidth = 80 }, 8 | cmd = "GrugFar", 9 | keys = { 10 | { 11 | "", 12 | function() 13 | local grug = require("grug-far") 14 | local ext = vim.bo.buftype == "" and vim.fn.expand("%:e") 15 | grug.open({ 16 | transient = true, 17 | prefills = { 18 | filesFilter = ext and ext ~= "" and "*." .. ext or nil, 19 | }, 20 | }) 21 | end, 22 | mode = { "n", "v" }, 23 | desc = "Search and Replace", 24 | }, 25 | }, 26 | }, 27 | }, 28 | }) 29 | -------------------------------------------------------------------------------- /modules/virtualisation.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | environment.systemPackages = with pkgs; [ 5 | # 6 | lazydocker 7 | distrobox 8 | ]; 9 | 10 | # hardware.nvidia-container-toolkit.enable = true; 11 | virtualisation = { 12 | oci-containers.backend = "docker"; 13 | docker = { 14 | enable = true; 15 | enableOnBoot = true; 16 | # new docker shitfest 17 | package = pkgs.docker_25; 18 | # package = pkgs.stable.docker; 19 | # extraOptions = "--default-runtime=nvidia"; 20 | }; 21 | libvirtd = { 22 | enable = true; 23 | qemu.package = pkgs.qemu_kvm; 24 | }; 25 | # virtualisation.podman = { 26 | # enable = true; 27 | # dockerCompat = true; 28 | # defaultNetwork.settings = { dns_enabled = true; }; 29 | # }; 30 | }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /modules/xorg.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, options, ... }: 2 | 3 | { 4 | environment.systemPackages = with pkgs; [ 5 | # 6 | libinput 7 | xclip 8 | xsel 9 | wmctrl 10 | xdotool 11 | xorg.xdpyinfo 12 | xorg.xev 13 | xorg.xhost 14 | xorg.xkill 15 | xorg.xmodmap 16 | xorg.xwininfo 17 | ]; 18 | 19 | services = { 20 | xserver = { 21 | enable = true; 22 | xkb.layout = "us"; 23 | synaptics.enable = false; 24 | }; 25 | libinput = { 26 | enable = true; 27 | mouse.accelProfile = "flat"; 28 | touchpad = { 29 | clickMethod = "clickfinger"; 30 | disableWhileTyping = true; 31 | tapping = true; 32 | additionalOptions = '' 33 | Option "PalmDetection" "on" 34 | ''; 35 | }; 36 | }; 37 | }; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/uv.lua: -------------------------------------------------------------------------------- 1 | -- https://neovim.io/doc/user/luvref.html#luv-timer-handle 2 | 3 | local setTimeout = function(callback, timeout) 4 | timeout = timeout or 0 5 | local timer = vim.uv.new_timer() 6 | timer:start(timeout, 0, function() 7 | timer:stop() 8 | timer:close() 9 | vim.schedule(callback) 10 | end) 11 | return timer 12 | end 13 | 14 | local setInterval = function(callback, interval) 15 | interval = interval or 0 16 | local timer = vim.uv.new_timer() 17 | timer:start(interval, interval, function() 18 | vim.schedule(callback) 19 | end) 20 | return timer 21 | end 22 | 23 | local clearInterval = function(timer) 24 | timer:stop() 25 | timer:close() 26 | end 27 | 28 | return { 29 | setTimeout = setTimeout, 30 | setInterval = setInterval, 31 | clearInterval = clearInterval, 32 | } 33 | -------------------------------------------------------------------------------- /bin/tpl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | # paths 6 | CWD=$PWD 7 | TEMPLATES_DIR=~/brain/projects/templates 8 | 9 | pick_template() { 10 | cd "$TEMPLATES_DIR" 11 | fd . -td -d 1 | fzf 12 | } 13 | 14 | main() { 15 | # select template 16 | local selected_template source destination 17 | selected_template=$(pick_template) 18 | if [[ -z "$selected_template" ]]; then 19 | exit 20 | fi 21 | source="$TEMPLATES_DIR/$selected_template" 22 | echo "Source: $source" 23 | 24 | # select destination 25 | echo -n 'Destination: ' 26 | read -i "$CWD/" -e -r destination 27 | 28 | # apply 29 | if [ -d "$destination" ]; then 30 | cp -r "$source""/*" "$destination" 31 | else 32 | cp -r "$source" "$destination" 33 | fi 34 | cd "$destination" 35 | git init 36 | } 37 | 38 | main 39 | 40 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/revive.toml: -------------------------------------------------------------------------------- 1 | ignoreGeneratedHeader = false 2 | severity = "warning" 3 | confidence = 0.8 4 | errorCode = 0 5 | warningCode = 0 6 | 7 | enableAllRules = true 8 | 9 | [rule.blank-imports] 10 | disabled = true 11 | [rule.file-header] 12 | disabled = true 13 | [rule.max-public-structs] 14 | disabled = true 15 | [rule.line-length-limit] 16 | disabled = true 17 | [rule.function-length] 18 | disabled = true 19 | [rule.exported] 20 | disabled = true 21 | [rule.banned-characters] 22 | disabled = true 23 | 24 | [rule.argument-limit] 25 | arguments = [5] 26 | [rule.function-result-limit] 27 | arguments = [3] 28 | [rule.cognitive-complexity] 29 | arguments = [70] 30 | [rule.add-constant] 31 | arguments = [{maxLitCount = "3",allowStrs ="\"\"",allowInts="0,1,2",allowFloats="0.0,0.,1.0,1.,2.0,2."}] 32 | 33 | [rule.cyclomatic] 34 | disabled = true 35 | -------------------------------------------------------------------------------- /home-manager/layers/custom/vault.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | let 4 | vault_path = "$HOME/brain/storage/vault.encfs"; 5 | mount_path = "$HOME/brain/storage/vault"; 6 | in { 7 | home.packages = with pkgs; [ encfs ]; 8 | 9 | home.file = { 10 | ".local/bin/vault-mount" = { 11 | executable = true; 12 | source = pkgs.replaceVars ./vault-mount.sh { 13 | vault_path = "${vault_path}"; 14 | mount_path = "${mount_path}"; 15 | }; 16 | }; 17 | ".local/bin/vault-unmount" = { 18 | executable = true; 19 | source = 20 | pkgs.replaceVars ./vault-unmount.sh { mount_path = "${mount_path}"; }; 21 | }; 22 | ".local/bin/vault-passwd" = { 23 | executable = true; 24 | source = 25 | pkgs.replaceVars ./vault-passwd.sh { vault_path = "${vault_path}"; }; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /bin/dev: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then 6 | # local 7 | if [ -f "dev.sh" ]; then 8 | ./dev.sh 9 | exit 0 10 | fi 11 | 12 | # make 13 | if [ -f "Makefile" ]; then 14 | if grep -q "dev:" "Makefile"; then 15 | make dev 16 | elif grep -q "watch:" "Makefile"; then 17 | make watch 18 | fi 19 | fi 20 | 21 | # go 22 | if [ -f "go.mod" ]; then 23 | echo "$*" 24 | watchexec -e go -r -- go test 25 | exit 0 26 | fi 27 | 28 | # cargo 29 | if [ -f "Cargo.toml" ]; then 30 | echo "$*" 31 | cargo watch -x "run -- $*" 32 | exit 0 33 | fi 34 | 35 | # js 36 | if [ -f "package.json" ]; then 37 | if [ -f "yarn.lock" ]; then 38 | yarn dev 39 | else 40 | npm run dev 41 | fi 42 | exit 0 43 | fi 44 | fi 45 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/map.lua: -------------------------------------------------------------------------------- 1 | ---@enum option 2 | local default_options = { 3 | desc = "", 4 | buffer = false, 5 | expr = false, 6 | nowait = false, 7 | remap = false, 8 | silent = false, 9 | unique = false, 10 | } 11 | 12 | ---@alias MappingMode "n"|"i"|"v"|"x"|"!"|"s"|"" 13 | 14 | ---@param mode MappingMode|MappingMode[] 15 | ---@param lhs string 16 | ---@param rhs string|function 17 | ---@param optionsOrDescription? table|string 18 | local map = function(mode, lhs, rhs, optionsOrDescription) 19 | local opts = default_options 20 | if type(optionsOrDescription) == "table" then 21 | opts = table.merge(opts, optionsOrDescription) 22 | elseif type(optionsOrDescription) == "string" then 23 | opts.desc = optionsOrDescription 24 | end 25 | vim.keymap.set(mode, lhs, rhs, opts) 26 | end 27 | 28 | return { 29 | map = map, 30 | } 31 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rules/react-usememo-no-simple-expression.yml: -------------------------------------------------------------------------------- 1 | id: react-usememo-no-simple-expression 2 | message: Simple expression in useMemo 3 | severity: error 4 | language: tsx 5 | rule: 6 | any: 7 | - pattern: useMemo(() => { return $EXPR }, $DEPS) 8 | - pattern: useMemo(() => $EXPR, $DEPS) 9 | # not: 10 | # has: 11 | # regex: "\\?\\." 12 | constraints: 13 | EXPR: 14 | any: 15 | - kind: binary_expression 16 | - kind: unary_expression 17 | - kind: number 18 | - kind: string 19 | - kind: "null" 20 | - kind: undefined 21 | - kind: "true" 22 | - kind: "false" 23 | - kind: identifier 24 | not: 25 | has: 26 | stopBy: end 27 | any: 28 | - kind: call_expression 29 | - kind: new_expression 30 | DEPS: 31 | not: 32 | regex: "\\[\\]" 33 | -------------------------------------------------------------------------------- /home-manager/desktop/xdg-desktop-entries.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | 3 | { 4 | xdg.desktopEntries = { 5 | excalidraw = { 6 | type = "Application"; 7 | name = "Excalidraw"; 8 | exec = ''sh -c "\\$BROWSER --app='https://app.excalidraw.com'"''; 9 | terminal = false; 10 | }; 11 | ytmusic = { 12 | type = "Application"; 13 | name = "YouTube Music"; 14 | exec = ''sh -c "\\$BROWSER --app='https://music.youtube.com'"''; 15 | terminal = false; 16 | }; 17 | figma = { 18 | type = "Application"; 19 | name = "Figma"; 20 | exec = ''sh -c "\\$BROWSER --app='https://figma.com'"''; 21 | terminal = false; 22 | }; 23 | chef = { 24 | type = "Application"; 25 | name = "CyberChef"; 26 | exec = ''sh -c "\\$BROWSER --app='https://gchq.github.io/CyberChef'"''; 27 | terminal = false; 28 | }; 29 | }; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/lib/env.lua: -------------------------------------------------------------------------------- 1 | local resolve = require("lib/path").resolve 2 | 3 | local get = function(name) 4 | return os.getenv(name) 5 | end 6 | 7 | local resolve_cache_dir = function(path) 8 | return resolve(vim.fn.stdpath("cache"), path) 9 | end 10 | 11 | local resolve_data_dir = function(path) 12 | return resolve(vim.fn.stdpath("data"), path) 13 | end 14 | 15 | return { 16 | dirs = { 17 | home = get("HOME"), 18 | vim = { 19 | backup = resolve_cache_dir("backup"), 20 | cache = vim.fn.stdpath("cache"), 21 | config = vim.fn.stdpath("config"), 22 | data = vim.fn.stdpath("data"), 23 | sessions = resolve_cache_dir("session"), 24 | undo = resolve_cache_dir("undo"), 25 | view = resolve_cache_dir("view"), 26 | lazy = { 27 | root = resolve_data_dir("lazy"), 28 | plugin = resolve_data_dir("lazy/lazy.nvim"), 29 | }, 30 | }, 31 | }, 32 | get = get, 33 | } 34 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rule-tests/react-useeffect-no-useless-ref-assignment.yml: -------------------------------------------------------------------------------- 1 | id: react-useeffect-no-useless-ref-assignment 2 | valid: 3 | - | 4 | useEffect(() => { 5 | console.log($VALUE) 6 | }, []) 7 | - | 8 | useEffect(() => { 9 | couldBeASideEffect(); 10 | ref.current = value; 11 | ref.current = value; 12 | }, []) 13 | - useEffect(() => { 14 | couldBeASideEffect(); 15 | ref.current.x = value; 16 | ref.current.x = value; 17 | }, []) 18 | invalid: 19 | - | 20 | useEffect(() => { 21 | ref.current = value; 22 | }, [value]) 23 | - | 24 | useEffect(() => { 25 | ref.current = value; 26 | ref.current = value; 27 | }, [value]) 28 | - | 29 | useEffect(() => { 30 | ref.current.x = value; 31 | }, [value]) 32 | - | 33 | useEffect(() => { 34 | ref.current.x = value; 35 | ref.current.x = value; 36 | }, [value]) 37 | -------------------------------------------------------------------------------- /home-manager/programs/starship.nix: -------------------------------------------------------------------------------- 1 | { 2 | programs.starship = { 3 | enable = true; 4 | settings = { 5 | add_newline = true; 6 | character = { 7 | success_symbol = "[➜](bold green)"; 8 | error_symbol = "✗"; 9 | }; 10 | directory = { 11 | truncate_to_repo = true; 12 | truncation_length = 2; 13 | }; 14 | cmd_duration = { 15 | min_time = 10; 16 | format = "[$duration](bold yellow) "; 17 | }; 18 | hostname = { ssh_only = true; }; 19 | git_status = { disabled = true; }; 20 | git_commit = { 21 | commit_hash_length = 4; 22 | tag_symbol = "🔖 "; 23 | }; 24 | git_branch = { 25 | truncation_length = 32; 26 | truncation_symbol = "…"; 27 | symbol = " "; 28 | format = "[\\($symbol$branch\\)]($style) "; 29 | # ignore_branches = [ "master" "main" ]; 30 | }; 31 | }; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /dotfiles/nvim/lua/modules/workflow/trim-line-trailing-space.lua: -------------------------------------------------------------------------------- 1 | return lib.module.create({ 2 | name = "workflow/trim-line-trailing-space", 3 | hosts = "*", 4 | setup = function() 5 | -- https://stackoverflow.com/questions/77747363/remove-white-spaces-added-in-nvim-on-save 6 | vim.api.nvim_create_autocmd("FileType", { 7 | group = vim.api.nvim_create_augroup("trim_whitespaces", { clear = true }), 8 | desc = "Trim trailing white spaces", 9 | -- pattern = "bash,c,cpp,lua,java,go,php,javascript,make,python,rust,perl,sql,markdown", 10 | callback = function() 11 | vim.api.nvim_create_autocmd("BufWritePre", { 12 | pattern = "", 13 | callback = function() 14 | local curpos = vim.api.nvim_win_get_cursor(0) 15 | vim.cmd([[keeppatterns %s/\s\+$//e]]) 16 | vim.api.nvim_win_set_cursor(0, curpos) 17 | end, 18 | }) 19 | end, 20 | }) 21 | end, 22 | }) 23 | -------------------------------------------------------------------------------- /navi/git.cheat: -------------------------------------------------------------------------------- 1 | % git 2 | 3 | # Create backdated commit for staged files 4 | git commit --date=" days ago" -m "" 5 | 6 | # Forcefully push to remote 7 | git push -f 8 | 9 | # Add git submodule 10 | git submodule add 11 | 12 | # Remove local commits (destroy changes) 13 | git reset --hard HEAD~ 14 | 15 | # Remote local commits (keep changes) 16 | git reset --soft HEAD~ 17 | 18 | # Find branches containing a given commit 19 | git branch -a --contains "" 20 | 21 | # Delete local branch 22 | git branch -d 23 | 24 | # Delete remote branch 25 | git push origin --delete 26 | 27 | # Remove file from git history (filter-branch tree-filter) 28 | git filter-branch --tree-filter 'rm -f ' HEAD 29 | 30 | $ local_branch: git branch 31 | $ remote_branch: git branch -r 32 | $ path_to_file: fd -t f 33 | -------------------------------------------------------------------------------- /dotfiles/nvim/plugins/tslib/rplugin/node/tslib/src/api/API.ts: -------------------------------------------------------------------------------- 1 | // https://github.dev/neovim/node-client/tree/master/packages/neovim/src/api/Neovim.ts 2 | 3 | import type { NvimPlugin } from "neovim"; 4 | 5 | class API { 6 | plugin: NvimPlugin; 7 | 8 | constructor(plugin: NvimPlugin) { 9 | this.plugin = plugin; 10 | } 11 | 12 | get nvim() { 13 | return this.plugin.nvim; 14 | } 15 | 16 | cmd(cmd: string) { 17 | return this.plugin.nvim.commandOutput(cmd); 18 | } 19 | 20 | fn: Record Promise> = new Proxy( 21 | {}, 22 | { 23 | get: (_, name: string) => { 24 | return (...args: unknown[]) => { 25 | return this.plugin.nvim.callFunction(name, args); 26 | }; 27 | }, 28 | } 29 | ); 30 | 31 | fnAtomic(calls: [string, unknown[]][]): Promise { 32 | return this.plugin.nvim.callAtomic(calls); 33 | } 34 | } 35 | 36 | export default API; 37 | -------------------------------------------------------------------------------- /navi/docker.cheat: -------------------------------------------------------------------------------- 1 | % docker 2 | 3 | # Remove docker image 4 | docker image rm 5 | 6 | # Delete docker image 7 | docker rmi 8 | 9 | # Clean none/dangling docker images 10 | docker rmi $(docker images --filter "dangling=true" -q --no-trunc) -f 11 | 12 | # Build and tag docker image from ./Dockerfile 13 | docker build -t : . 14 | 15 | # Stop docker container 16 | docker stop 17 | 18 | # Kill docker container 19 | docker kill 20 | 21 | # Delete all running and stopped docker containers 22 | docker rm -f $(docker ps -aq) 23 | 24 | # Open a shell inside a docker container 25 | docker exec -it sh 26 | 27 | # Print and watch docker container logs 28 | docker logs -f 29 | 30 | $ image_id: docker images --- --headers 1 --column 3 31 | $ container_id: docker ps --- --headers 1 --column 1 32 | 33 | % docker-compose 34 | 35 | # Print and watch docker-compose service logs 36 | docker-compose logs -f --tail 100 37 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/dev/config.el: -------------------------------------------------------------------------------- 1 | (use-package evil 2 | :straight t 3 | :init 4 | ;; (setq evil-undo-system 'undo-fu) 5 | (setq evil-want-integration t) 6 | (setq evil-want-keybinding nil) 7 | (setq evil-want-C-u-scroll t) 8 | (setq evil-want-C-i-jump t) 9 | (setq evil-want-C-u-delete t) 10 | (setq evil-want-C-w-delete t) 11 | (setq evil-want-Y-yank-to-eol t) 12 | (setq evil-respect-visual-line-mode t) 13 | (setq evil-undo-system 'undo-tree) 14 | (setq evil-search-module 'evil-search) 15 | (setq evil-split-window-below t) 16 | (setq evil-vsplit-window-right t) 17 | :config 18 | (evil-mode 1) 19 | (evil-global-set-key 'motion "j" 'evil-next-visual-line) 20 | (evil-global-set-key 'motion "k" 'evil-previous-visual-line) 21 | (evil-set-initial-state 'messages-buffer-mode 'normal) 22 | (evil-set-initial-state 'dashboard-mode 'normal)) 23 | 24 | (use-package doom-themes 25 | :ensure t 26 | :config 27 | (customize-set-variable 'doom-molokai-brighter-comments t) 28 | (switch-theme 'doom-molokai)) 29 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rule-tests/__snapshots__/react-memo-no-simple-expression-snapshot.yml: -------------------------------------------------------------------------------- 1 | id: react-memo-no-simple-expression 2 | snapshots: 3 | useMemo(() => a - b + 12, [a, b]);: 4 | labels: 5 | - source: () => a - b + 12 6 | style: primary 7 | start: 8 8 | end: 24 9 | useMemo(() => a === 2, [a]);: 10 | labels: 11 | - source: () => a === 2 12 | style: primary 13 | start: 8 14 | end: 21 15 | useMemo(() => a === b, [a, b]);: 16 | labels: 17 | - source: () => a === b 18 | style: primary 19 | start: 8 20 | end: 21 21 | useMemo(() => a === test(b), [a]);: 22 | labels: 23 | - source: () => a === test(b) 24 | style: primary 25 | start: 8 26 | end: 27 27 | useMemo(() => { return a === b; }, [a, b]);: 28 | labels: 29 | - source: return a === b; 30 | style: primary 31 | start: 16 32 | end: 31 33 | - source: '{ return a === b; }' 34 | style: secondary 35 | start: 14 36 | end: 33 37 | -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rule-tests/react-prop-object-always-recreated-test.yml: -------------------------------------------------------------------------------- 1 | id: react-prop-object-always-recreated 2 | valid: 3 | - | 4 | const Component = () => { 5 | return 26 | } 27 | invalid: 28 | - | 29 | const Component = () => { 30 | return 35 | } 36 | - | 37 | const Component = () => { 38 | return