├── .gitignore ├── .nixd.json ├── Makefile ├── README.md ├── bin ├── btfix ├── build ├── cb ├── cpufast ├── cpusched ├── cpuslow ├── dev ├── f ├── fehrandom ├── fssh ├── ghpatch ├── gist ├── gpt ├── jjj ├── journal-add ├── lint ├── lower ├── nixs ├── pack ├── scratch ├── screen2mp4 ├── screen2webm ├── sharecrypt ├── sortlen ├── task-add ├── tgshare ├── todogrep ├── tpl ├── unpack ├── upper ├── webm2mp4 └── workspace-create ├── dotfiles ├── emacs │ ├── .gitignore │ ├── chemacs.el │ ├── early-init.el │ ├── init.el │ ├── profiles.el │ └── profiles │ │ ├── active │ │ ├── default │ │ ├── .gitignore │ │ ├── config.org │ │ ├── early-init.el │ │ └── init.el │ │ ├── dev │ │ ├── .gitignore │ │ ├── config.el │ │ ├── config.org │ │ ├── early-init.el │ │ └── init.el │ │ └── main │ │ ├── .gitignore │ │ ├── config.org │ │ ├── early-init.el │ │ └── init.el ├── linx │ ├── .gitignore │ └── link.sh ├── nvim │ ├── .gitignore │ ├── .root │ ├── Makefile │ ├── after │ │ └── ftplugin │ │ │ ├── javascript.lua │ │ │ ├── lua.lua │ │ │ ├── make.lua │ │ │ ├── snippets.lua │ │ │ ├── typescript.lua │ │ │ └── typescriptreact.lua │ ├── colors │ │ ├── dynamic.lua │ │ └── static.lua │ ├── init.lua │ ├── lazy-lock.json │ ├── linters │ │ ├── ast-grep │ │ │ ├── .root │ │ │ ├── rule-tests │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── react-memo-no-simple-comparison-snapshot.yml │ │ │ │ │ ├── react-memo-no-simple-expression-snapshot.yml │ │ │ │ │ ├── react-no-useless-effect-ref-assign-snapshot.yml │ │ │ │ │ ├── react-useref-no-useless-assignment-computation-snapshot.yml │ │ │ │ │ └── ts-array-no-useless-spread-snapshot.yml │ │ │ │ ├── react-prop-object-always-recreated-test.yml │ │ │ │ ├── react-useeffect-no-useless-ref-assignment.yml │ │ │ │ ├── react-usememo-no-simple-expression.yml │ │ │ │ ├── react-useref-no-useless-assignment-computation-test.yml │ │ │ │ └── ts-array-no-useless-spread-test.yml │ │ │ ├── rules │ │ │ │ ├── react-prop-object-always-recreated.yml │ │ │ │ ├── react-useeffect-no-useless-ref-assignment.yml │ │ │ │ ├── react-usememo-no-simple-expression.yml │ │ │ │ ├── react-useref-no-useless-assignment-computation.yml │ │ │ │ └── ts-array-no-useless-spread.yml │ │ │ └── sgconfig.yml │ │ ├── eslint │ │ ├── golangci.yml │ │ ├── oxlint.json │ │ ├── prettier.json │ │ ├── revive.toml │ │ ├── selene-vim.toml │ │ ├── selene.toml │ │ └── stylua.toml │ ├── lua │ │ ├── config │ │ │ ├── colors-hex.lua │ │ │ ├── filetype.lua │ │ │ ├── init.lua │ │ │ ├── lazy.lua │ │ │ ├── mappings.lua │ │ │ ├── options.lua │ │ │ └── theme.lua │ │ ├── lib │ │ │ ├── buffer.lua │ │ │ ├── bus.lua │ │ │ ├── env.lua │ │ │ ├── fs.lua │ │ │ ├── init.lua │ │ │ ├── is.lua │ │ │ ├── lazy.lua │ │ │ ├── log.lua │ │ │ ├── map.lua │ │ │ ├── metatable.lua │ │ │ ├── module.lua │ │ │ ├── node.lua │ │ │ ├── path.lua │ │ │ ├── random.lua │ │ │ ├── shell.lua │ │ │ ├── string.lua │ │ │ ├── table.lua │ │ │ ├── term.lua │ │ │ ├── treesitter.lua │ │ │ ├── ui │ │ │ │ ├── datepicker.lua │ │ │ │ └── init.lua │ │ │ └── uv.lua │ │ └── modules │ │ │ ├── completion │ │ │ ├── blink.lua │ │ │ ├── codeium.lua │ │ │ ├── copilot.lua │ │ │ ├── snippets.lua │ │ │ └── supermaven.lua │ │ │ ├── core │ │ │ ├── image.lua │ │ │ ├── syslang.lua │ │ │ └── tracker.lua │ │ │ ├── language-support │ │ │ ├── breadcrumbs.lua │ │ │ ├── code-actions.lua │ │ │ ├── comments.lua │ │ │ ├── diagnostics.lua │ │ │ ├── formatting.lua │ │ │ ├── languages │ │ │ │ ├── lua.lua │ │ │ │ ├── markdown.lua │ │ │ │ ├── nix.lua │ │ │ │ └── typescript.lua │ │ │ ├── linting.lua │ │ │ ├── lsp.lua │ │ │ ├── mason.lua │ │ │ ├── null.lua │ │ │ ├── rainbow.lua │ │ │ ├── refactoring.lua │ │ │ └── tree-sitter.lua │ │ │ ├── mini.lua │ │ │ ├── misc │ │ │ ├── bufferize.lua │ │ │ ├── colorizer.lua │ │ │ ├── diagrams.lua │ │ │ ├── highlight-on-yank.lua │ │ │ ├── highlight-words.lua │ │ │ ├── inspect.lua │ │ │ └── which-key-map.lua │ │ │ ├── neorg.lua │ │ │ ├── neovide.lua │ │ │ ├── profiler.lua │ │ │ ├── snacks.lua │ │ │ ├── term.lua │ │ │ ├── theme.lua │ │ │ ├── ui │ │ │ ├── auto-resize.lua │ │ │ ├── headlines.lua │ │ │ ├── indent-guides.lua │ │ │ ├── input.lua │ │ │ ├── modes.lua │ │ │ ├── noice.lua │ │ │ ├── notifications.lua │ │ │ ├── statusline.lua │ │ │ └── window-maximize.lua │ │ │ ├── wiki │ │ │ ├── cmp.lua │ │ │ ├── conceal.lua │ │ │ └── init.lua │ │ │ └── workflow │ │ │ ├── buffer.lua │ │ │ ├── command-menu.lua │ │ │ ├── debug.lua │ │ │ ├── file-management.lua │ │ │ ├── folds.lua │ │ │ ├── fzf.lua │ │ │ ├── git.lua │ │ │ ├── gpt.lua │ │ │ ├── javelin.lua │ │ │ ├── leap.lua │ │ │ ├── mkdirp.lua │ │ │ ├── namu.lua │ │ │ ├── outline.lua │ │ │ ├── reset-view.lua │ │ │ ├── retirement.lua │ │ │ ├── rooter.lua │ │ │ ├── search.lua │ │ │ ├── sessions.lua │ │ │ ├── telescope.lua │ │ │ ├── term-wrappers.lua │ │ │ ├── text-editing.lua │ │ │ ├── tmux.lua │ │ │ ├── treesj.lua │ │ │ ├── undotree.lua │ │ │ └── yank-location.lua │ ├── plugins │ │ ├── syslang │ │ │ ├── .luarc.json │ │ │ ├── .root │ │ │ ├── ftplugin │ │ │ │ └── syslang.lua │ │ │ ├── lua │ │ │ │ ├── syslang.lua │ │ │ │ └── syslang │ │ │ │ │ ├── folding.lua │ │ │ │ │ ├── indent.lua │ │ │ │ │ └── lib.lua │ │ │ └── queries │ │ │ │ └── syslang │ │ └── tslib │ │ │ ├── .root │ │ │ ├── Makefile │ │ │ └── rplugin │ │ │ └── node │ │ │ └── tslib │ │ │ ├── .gitignore │ │ │ ├── .root │ │ │ ├── package.json │ │ │ ├── pnpm-lock.yaml │ │ │ ├── src │ │ │ ├── api │ │ │ │ ├── API.ts │ │ │ │ └── index.ts │ │ │ ├── examples.ts │ │ │ ├── main.ts │ │ │ ├── modules │ │ │ │ ├── chrono.ts │ │ │ │ ├── dev.ts │ │ │ │ └── index.ts │ │ │ └── types.ts │ │ │ └── tsconfig.json │ ├── snippets_snipmate │ │ ├── all.snippets │ │ ├── html.snippets │ │ ├── javascript.snippets │ │ ├── lua.snippets │ │ ├── make.snippets │ │ ├── markdown.snippets │ │ ├── sh.snippets │ │ ├── snippets.snippets │ │ ├── typescript.snippets │ │ └── vue.snippets │ └── snippets_vscode │ │ ├── all.json │ │ ├── go.json │ │ ├── html.json │ │ ├── javascript.json │ │ ├── lua.json │ │ ├── make.json │ │ ├── markdown.json │ │ ├── package.json │ │ ├── sh.json │ │ ├── snippets.json │ │ ├── syslang.json │ │ ├── typescript.json │ │ ├── typescriptreact.json │ │ └── vue.json ├── ranger │ ├── .gitignore │ ├── rc.conf │ ├── rifle.conf │ └── scope.sh ├── stignore-global ├── wezterm │ └── wezterm.lua ├── wired │ └── wired.ron ├── xmodmap └── yazi │ ├── keymap.toml │ ├── theme.toml │ └── yazi.toml ├── flake.lock ├── flake.nix ├── home-manager ├── apps.nix ├── colors.nix ├── desktop │ ├── common.nix │ ├── hyprland.nix │ ├── i3.nix │ └── xdg-desktop-entries.nix ├── gtk.nix ├── layers │ ├── communication.nix │ ├── custom │ │ ├── daemon.nix │ │ ├── default.nix │ │ ├── journal.nix │ │ ├── vault-mount.sh │ │ ├── vault-passwd.sh │ │ ├── vault-unmount.sh │ │ ├── vault.nix │ │ └── wiki.nix │ ├── development │ │ ├── bash.nix │ │ ├── c.nix │ │ ├── clojure.nix │ │ ├── default.nix │ │ ├── dotnet.nix │ │ ├── golang.nix │ │ ├── java.nix │ │ ├── lua.nix │ │ ├── misc.nix │ │ ├── nix.nix │ │ ├── nodejs.nix │ │ ├── python.nix │ │ └── rust.nix │ ├── file-management.nix │ ├── media.nix │ ├── password-management.nix │ └── pentesting.nix ├── mime.nix ├── misc │ ├── obsidian.nix │ └── remarkable.nix ├── options │ └── colors.nix ├── overlays │ └── burp.nix ├── programs │ ├── bat.nix │ ├── chrome-canary.nix │ ├── chromium.nix │ ├── emacs.nix │ ├── eza.nix │ ├── fish.nix │ ├── fzf.nix │ ├── git │ │ ├── default.nix │ │ ├── git-branch.sh │ │ ├── git-id.sh │ │ ├── git-standup.sh │ │ ├── git-status-deep.sh │ │ └── git-undo.sh │ ├── kitty.nix │ ├── navi.nix │ ├── neovim.nix │ ├── rofi.nix │ ├── starship.nix │ ├── tmux │ │ ├── default.nix │ │ ├── tmux-workspace.sh │ │ └── tmux.conf │ ├── zathura.nix │ └── zoxide.nix ├── roles │ ├── battlestation.nix │ └── workstation.nix ├── services │ ├── dunst.nix │ ├── picom.nix │ └── polybar │ │ ├── bci.sh │ │ ├── bluetooth.sh │ │ ├── core.sh │ │ ├── default.nix │ │ ├── task.sh │ │ └── vpn.sh ├── utilities.nix └── xresources.nix ├── modules ├── audio.nix ├── base.nix ├── bluetooth.nix ├── fonts.nix ├── ld.nix ├── packages │ └── qimgv │ │ └── default.nix ├── virtualisation.nix └── xorg.nix ├── navi ├── docker.cheat ├── docs.cheat ├── git.cheat ├── go.cheat ├── linux.cheat ├── mysql.cheat ├── network.cheat ├── nix.cheat ├── project-setup.cheat ├── ssh.cheat ├── syncthing.cheat └── system.cheat ├── overlays └── default.nix ├── roles ├── battlestation.nix └── workstation.nix ├── scripts ├── flakey.sh └── swap.sh └── statix.toml /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bin/cb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -- "${@:-$(" 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/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/gpt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | BOT='\033[33m' 6 | NC='\033[0m' 7 | 8 | messages=() 9 | 10 | trim() { 11 | local var="$*" 12 | var="${var#"${var%%[![:space:]]*}"}" 13 | var="${var%"${var##*[![:space:]]}"}" 14 | printf '%s' "$var" 15 | } 16 | 17 | function complete { 18 | local message="$1" 19 | local data 20 | messages+=("{\"role\": \"system\", \"content\": $(echo "$message" | jq -R -s '.')}") 21 | processed_messages=$(printf '%s,' "${messages[@]}") 22 | processed_messages="[${processed_messages::-1}]" 23 | # --arg model "gpt-3.5-turbo" \ 24 | data=$(jq -n \ 25 | --arg model "gpt-4" \ 26 | --argjson messages "$processed_messages" \ 27 | '{ model: $model, messages: $messages }' \ 28 | | sed 's/\]\[/,/g') 29 | 30 | response=$(curl -s https://api.openai.com/v1/chat/completions \ 31 | -H "Content-Type: application/json" \ 32 | -H "Authorization: Bearer $OPENAI_API_KEY" \ 33 | -d "$data") 34 | 35 | message=$(echo "$response" | jq '.choices[].message.content') 36 | printable_message=$(echo "$response" | jq -r '.choices[].message.content') 37 | printable_message=$(trim "$printable_message") 38 | echo -e "${BOT}Bot:${NC} $printable_message" 39 | 40 | messages+=("{\"role\": \"assistant\", \"content\": $message}") 41 | } 42 | 43 | while true; do 44 | read -r -p $'\e[35mYou:\e[0m ' message 45 | complete "$message" 46 | done 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/lint: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | # export ESLINT_USE_FLAT_CONFIG=false 6 | 7 | LINTED=0 8 | 9 | if [ -f "go.mod" ]; then 10 | TARGET="${1:-./...}" 11 | golangci-lint run --enable-all --exclude-use-default -e "ALL_CAPS" -e "cuddled" -e "SA9004" -e "a blank import should" "$TARGET" 12 | exit 13 | fi 14 | 15 | if [ -f "package.json" ]; then 16 | TARGET="${1:-.}" 17 | if [ -d "$TARGET/src" ]; then 18 | TARGET="$TARGET/src" 19 | fi 20 | echo "Linting $TARGET" 21 | ESLINT_USE_FLAT_CONFIG=false ~/brain/core/linter/eslint/node_modules/eslint/bin/eslint.js -c ~/.config/nvim/linters/eslint/dist/main.js --no-eslintrc "$TARGET" 22 | # ~/brain/core/linter/eslint/node_modules/eslint/bin/eslint.js -c ~/.config/nvim/linters/eslint/dist/main.js --no-eslintrc "$TARGET" 23 | LINTED=1 24 | fi 25 | 26 | if [ -f "tsconfig.json" ]; then 27 | echo "Checking types..." 28 | npx tsc --noEmit 29 | LINTED=1 30 | fi 31 | 32 | if [ "$LINTED" -eq 0 ]; then 33 | echo "FATAL: Unknown project type." 34 | fi 35 | -------------------------------------------------------------------------------- /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/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 +2 -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 | -------------------------------------------------------------------------------- /bin/pack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | case $1 in 4 | *.tar.xz) tar cJvf "$1" "$2" ;; 5 | *.tar.bz2) tar cjvf "$1" "$2" ;; 6 | *.tar.gz) tar czvf "$1" "$2" ;; 7 | *.tar) tar cpvf "$1" "$2" ;; 8 | *.gz) gzip -c -9 -n "$2" >"$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 | -------------------------------------------------------------------------------- /bin/scratch: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | SCRATCH_TEMPLATES_DIR=~/.config/scratch 6 | SCRATCH_INSTANCES_DIR=~/scratch 7 | 8 | # get templates 9 | TEMPLATES=$(ls "$SCRATCH_TEMPLATES_DIR") 10 | 11 | main() { 12 | # select template 13 | TEMPLATE=$(echo "$TEMPLATES" | fzf) 14 | if [[ -n "$TEMPLATE" ]]; then 15 | echo "$TEMPLATE" 16 | # set instance name 17 | DEFAULT_INSTANCE_NAME="$TEMPLATE-$(petname)-$(petname)" 18 | echo "$DEFAULT_INSTANCE_NAME" 19 | read -e -r -p "Name:" -i "$DEFAULT_INSTANCE_NAME" INSTANCE_NAME 20 | if [[ -n "$INSTANCE_NAME" ]]; then 21 | INSTANCE_DIR="$SCRATCH_INSTANCES_DIR/$INSTANCE_NAME" 22 | # copy template to instance 23 | cp -pvr "$SCRATCH_TEMPLATES_DIR/$TEMPLATE" "$INSTANCE_DIR" 24 | cd "$INSTANCE_DIR" 25 | # prepare 26 | make prepare 27 | # tmux vim + dev 28 | tmux new-session -s "scratch-$INSTANCE_NAME" -d "vim" 29 | tmux split-window -h "nvim" 30 | tmux split-window -h "make dev" 31 | tmux select-pane -L 32 | tmux -2 attach-session -d 33 | fi 34 | fi 35 | } 36 | 37 | main 38 | 39 | -------------------------------------------------------------------------------- /bin/screen2mp4: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | IFS=$'\n\t' 3 | 4 | if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then 5 | if [ "$#" -ne 1 ]; then 6 | echo "screen2mp4 target.mp4" 7 | exit 0 8 | fi 9 | 10 | OUTPUT="${1%.mp4}.mp4" 11 | 12 | read -r -p "Record audio? [y/N] " audio 13 | case $audio in 14 | [Yy]*) 15 | source=$(pactl list sources short | grep bluez | rg -v input | awk '{print $1}') 16 | audio=(-f pulse -ac 2 -i "$source") 17 | audio_conv=(-c:a aac) 18 | ;; 19 | *) 20 | audio=() 21 | ;; 22 | esac 23 | 24 | if [ ${#audio[@]} -eq 0 ]; then 25 | read -r -p "Record microphone? [y/N] " mic 26 | case $mic in 27 | [Yy]*) 28 | audio=(-f pulse -ac 2 -i default) 29 | audio_conv=(-c:a aac) 30 | ;; 31 | *) ;; 32 | esac 33 | fi 34 | 35 | slop=$(slop -f "%x %y %w %h %g %i") || exit 1 36 | IFS=$' ' read -r X Y W H _ < <(echo """$slop") 37 | W=$((W + W % 2)) 38 | H=$((H + H % 2)) 39 | 40 | trap '' INT 41 | echo "Recording..." 42 | 43 | if [ ${#audio[@]} -gt 0 ]; then 44 | ffmpeg -loglevel "16" -f "x11grab" -framerate "60" -s "${W}x$H" -i ":0.0+$X,$Y" "${audio[@]}" -preset ultrafast -pix_fmt yuv420p "$OUTPUT".mkv 45 | else 46 | ffmpeg -loglevel "16" -f "x11grab" -framerate "60" -s "${W}x$H" -i ":0.0+$X,$Y" -preset ultrafast -pix_fmt yuv420p "$OUTPUT".mkv 47 | fi 48 | trap - INT 49 | if [ ${#audio_conv[@]} -gt 0 ]; then 50 | ffmpeg -i "$OUTPUT".mkv -c copy "${audio_conv[@]}" -movflags +faststart "$OUTPUT" 51 | else 52 | ffmpeg -i "$OUTPUT".mkv -c copy -movflags +faststart "$OUTPUT" 53 | fi 54 | rm "$OUTPUT".mkv 55 | while true; do 56 | read -r -p "Preview? [y/N] " preview 57 | case $preview in 58 | [Yy]*) 59 | mpv "$OUTPUT" 60 | break 61 | ;; 62 | *) 63 | break 64 | ;; 65 | esac 66 | done 67 | fi 68 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bin/upper: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | cat | tr '[:lower:]' '[:upper:]' 6 | 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bin/workspace-create: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -uf -o pipefail 3 | IFS=$'\n\t' 4 | 5 | WORKSPACE_NAME=$1 6 | WORKSPACE_PATH="$HOME/brain/config/workspaces/$WORKSPACE_NAME.yml" 7 | 8 | if [ -z "$WORKSPACE_NAME" ]; then 9 | echo "Usage: workspace-create " 10 | exit 1 11 | fi 12 | 13 | if [ -f "$WORKSPACE_PATH" ]; then 14 | echo "Workspace already exists: $WORKSPACE_PATH" 15 | exit 1 16 | fi 17 | 18 | CWD=$(pwd) 19 | 20 | cat <"$WORKSPACE_PATH" 21 | session_name: $WORKSPACE_NAME 22 | start_directory: $CWD 23 | suppress_history: false 24 | 25 | # Global options: 26 | # 27 | # before_script: ./bootstrap 28 | # shell_command_before: "echo ${PWD}" 29 | # shell_command_before: 30 | # - cmd: echo ${PWD} 31 | # sleep_before: 1 32 | # sleep_after: 1 33 | # enter: false 34 | 35 | # Layouts: 36 | # 37 | # Main horizontal | main | 38 | # layout: main-horizontal | a | b | 39 | # options: 40 | # main-pane-height: 35 41 | # 42 | # Main vertical | ma | a | 43 | # layout: main-vertical | in | b | 44 | # options: 45 | # main-pane-width: 35 46 | # 47 | # Tiled | a | b | 48 | # layout: tiled | c | d | 49 | # 50 | # Extra: even-horizontal, even-vertical 51 | 52 | windows: 53 | - window_name: dev 54 | layout: main-vertical 55 | options: 56 | main-pane-width: 100 57 | panes: 58 | - focus: true 59 | - window_name: exit 60 | options: 61 | automatic-rename: true 62 | panes: 63 | - pane 64 | 65 | # - window_name: example 66 | # shell_command_before: cd backend 67 | # panes: 68 | # - pane with a single command 69 | # - shell_command: 70 | # - pane with 71 | # - multiple commands 72 | EOF 73 | 74 | nvim "$WORKSPACE_PATH" 75 | 76 | echo "Created workspace: $WORKSPACE_PATH" 77 | -------------------------------------------------------------------------------- /dotfiles/emacs/.gitignore: -------------------------------------------------------------------------------- 1 | eln-cache 2 | auto-save-list 3 | undo 4 | -------------------------------------------------------------------------------- /dotfiles/emacs/chemacs.el: -------------------------------------------------------------------------------- 1 | ;;; https://github.com/plexus/chemacs2/chemacs.el 2 | -------------------------------------------------------------------------------- /dotfiles/emacs/early-init.el: -------------------------------------------------------------------------------- 1 | ;;; https://github.com/plexus/chemacs2/blob/main/early-init.el 2 | -------------------------------------------------------------------------------- /dotfiles/emacs/init.el: -------------------------------------------------------------------------------- 1 | ;;; https://github.com/plexus/chemacs2/blob/main/init.el 2 | -------------------------------------------------------------------------------- /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 | ) 10 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/active: -------------------------------------------------------------------------------- 1 | main 2 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/default/.gitignore: -------------------------------------------------------------------------------- 1 | straight 2 | etc 3 | var 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/dev/.gitignore: -------------------------------------------------------------------------------- 1 | straight 2 | etc 3 | var 4 | -------------------------------------------------------------------------------- /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/emacs/profiles/dev/config.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Emacs configuration 2 | #+DESCRIPTION: An org-babel based emacs configuration 3 | #+LANGUAGE: en 4 | #+PROPERTY: results silent 5 | 6 | * Boot 7 | ** Evil 8 | #+BEGIN_SRC emacs-lisp 9 | (use-package evil 10 | :straight t 11 | :init 12 | ;; (setq evil-undo-system 'undo-fu) 13 | (setq evil-want-integration t) 14 | (setq evil-want-keybinding nil) 15 | (setq evil-want-C-u-scroll t) 16 | (setq evil-want-C-i-jump t) 17 | (setq evil-want-C-u-delete t) 18 | (setq evil-want-C-w-delete t) 19 | (setq evil-want-Y-yank-to-eol t) 20 | (setq evil-respect-visual-line-mode t) 21 | (setq evil-undo-system 'undo-tree) 22 | (setq evil-search-module 'evil-search) 23 | (setq evil-split-window-below t) 24 | (setq evil-vsplit-window-right t) 25 | :config 26 | (evil-mode 1) 27 | (evil-global-set-key 'motion "j" 'evil-next-visual-line) 28 | (evil-global-set-key 'motion "k" 'evil-previous-visual-line) 29 | (evil-set-initial-state 'messages-buffer-mode 'normal) 30 | (evil-set-initial-state 'dashboard-mode 'normal)) 31 | #+END_SRC 32 | 33 | * Theme 34 | #+BEGIN_SRC emacs-lisp 35 | (use-package doom-themes 36 | :ensure t 37 | :config 38 | (customize-set-variable 'doom-molokai-brighter-comments t) 39 | (switch-theme 'doom-molokai)) 40 | #+END_SRC 41 | -------------------------------------------------------------------------------- /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/emacs/profiles/dev/init.el: -------------------------------------------------------------------------------- 1 | ;;; init.el -*- lexical-binding: t ; eval: (view-mode -1); -*- 2 | 3 | ;; security 4 | (setq gnutls-verify-error (getenv "INSECURE") 5 | tls-checktrust gnutls-verify-error 6 | tls-program '("gnutls-cli --x509cafile %t -p %p %h" 7 | ;; compatibility fallbacks 8 | "gnutls-cli -p %p %h" 9 | "openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof")) 10 | 11 | ;; package management 12 | (setq package-enable-at-startup nil) 13 | (setq-default straight-use-package-by-default t) 14 | (defvar bootstrap-version) 15 | (let ((bootstrap-file 16 | (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) 17 | (bootstrap-version 5)) 18 | (unless (file-exists-p bootstrap-file) 19 | (with-current-buffer 20 | (url-retrieve-synchronously 21 | "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 22 | 'silent 'inhibit-cookies) 23 | (goto-char (point-max)) 24 | (eval-print-last-sexp))) 25 | (load bootstrap-file nil 'nomessage)) 26 | (straight-use-package 'use-package) 27 | (use-package use-package-ensure-system-package :straight t) 28 | (use-package straight :custom (straight-use-package-by-default t)) 29 | 30 | ;; set custom file 31 | (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) 32 | (if (file-exists-p custom-file) (load custom-file)) 33 | 34 | (straight-use-package 35 | '(org :host github :repo "emacs-straight/org-mode" :local-repo "org")) 36 | (run-with-idle-timer 1 nil (lambda () 37 | (require 'org) 38 | (org-babel-load-file (expand-file-name "config.org" user-emacs-directory)) 39 | )) 40 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/main/.gitignore: -------------------------------------------------------------------------------- 1 | straight 2 | etc 3 | var 4 | undo 5 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/main/early-init.el: -------------------------------------------------------------------------------- 1 | ;; performance 2 | (defvar cpm--file-name-handler-alist file-name-handler-alist) 3 | (defvar default-file-name-handler-alist file-name-handler-alist) 4 | (setq-default frame-title-format nil) 5 | (setq-default frame-inhibit-implied-resize t) 6 | (setq-default inhibit-startup-screen t) 7 | (setq-default inhibit-splash-screen t) 8 | (setq-default inhibit-startup-message t) 9 | (setq file-name-handler-alist nil) 10 | (setq frame-inhibit-implied-resize t) 11 | (setq desktop-restore-forces-onscreen nil) 12 | (setq inhibit-compacting-font-caches t) 13 | (setq load-prefer-newer t) 14 | (setq file-name-handler-alist nil) 15 | 16 | ;; disable garbage collection during load 17 | ; (lexical-let ((old-gc-treshold gc-cons-threshold)) 18 | ; (setq gc-cons-threshold most-positive-fixnum) 19 | ; (add-hook 'after-init-hook 20 | ; (lambda () (setq gc-cons-threshold old-gc-treshold)))) 21 | 22 | (setq initial-scratch-message nil) 23 | (push '(menu-bar-lines . 0) default-frame-alist) 24 | (push '(tool-bar-lines . 0) default-frame-alist) 25 | (push '(vertical-scroll-bars) default-frame-alist) 26 | (advice-add #'x-apply-session-resources :override #'ignore) 27 | 28 | ;; disable package.el 29 | (setq package-enable-at-startup nil) 30 | -------------------------------------------------------------------------------- /dotfiles/emacs/profiles/main/init.el: -------------------------------------------------------------------------------- 1 | ;; load path 2 | (add-to-list 'load-path "~/.emacs.d/lisp/") 3 | (let ((default-directory "~/.emacs.d/lisp/")) 4 | (normal-top-level-add-subdirs-to-load-path)) 5 | 6 | ;; setup straight.el package manager 7 | (defvar bootstrap-version) 8 | (let ((bootstrap-file 9 | (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) 10 | (bootstrap-version 5)) 11 | (unless (file-exists-p bootstrap-file) 12 | (with-current-buffer 13 | (url-retrieve-synchronously 14 | "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" 15 | 'silent 'inhibit-cookies) 16 | (goto-char (point-max)) 17 | (eval-print-last-sexp))) 18 | (load bootstrap-file nil 'nomessage)) 19 | 20 | ;; package management utils 21 | (straight-use-package 'use-package) 22 | (use-package use-package-ensure-system-package :straight t) 23 | (use-package straight :custom (straight-use-package-by-default t)) 24 | 25 | ;; load org and configuration 26 | (straight-use-package 27 | '(org :host github :repo "emacs-straight/org-mode" :local-repo "org")) 28 | 29 | (run-with-idle-timer 1 nil (lambda () 30 | (require 'org) 31 | (org-babel-load-file (expand-file-name "config.org" user-emacs-directory)) 32 | )) 33 | -------------------------------------------------------------------------------- /dotfiles/linx/.gitignore: -------------------------------------------------------------------------------- 1 | linxlog 2 | linx-client.conf 3 | -------------------------------------------------------------------------------- /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/.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 | time-tracker.json 16 | -------------------------------------------------------------------------------- /dotfiles/nvim/.root: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/3rd/config/5cc0d43e3910aa27bf6bd75910fd7656ba9ef693/dotfiles/nvim/.root -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/lua.lua: -------------------------------------------------------------------------------- 1 | vim.cmd("iabbr != ~=") 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/make.lua: -------------------------------------------------------------------------------- 1 | vim.bo.expandtab = false 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/snippets.lua: -------------------------------------------------------------------------------- 1 | vim.bo.expandtab = false 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/typescript.lua: -------------------------------------------------------------------------------- 1 | vim.cmd("runtime! ftplugin/javascript.lua") 2 | -------------------------------------------------------------------------------- /dotfiles/nvim/after/ftplugin/typescriptreact.lua: -------------------------------------------------------------------------------- 1 | vim.cmd("runtime! ftplugin/typescript.lua") 2 | -------------------------------------------------------------------------------- /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/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/linters/ast-grep/.root: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/3rd/config/5cc0d43e3910aa27bf6bd75910fd7656ba9ef693/dotfiles/nvim/linters/ast-grep/.root -------------------------------------------------------------------------------- /dotfiles/nvim/linters/ast-grep/rule-tests/__snapshots__/react-memo-no-simple-comparison-snapshot.yml: -------------------------------------------------------------------------------- 1 | id: react-memo-no-simple-comparison 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 | - source: useMemo 10 | style: secondary 11 | start: 0 12 | end: 7 13 | - source: useMemo(() => a - b + 12, [a, b]) 14 | style: secondary 15 | start: 0 16 | end: 33 17 | useMemo(() => a === 2, [a]);: 18 | labels: 19 | - source: () => a === 2 20 | style: primary 21 | start: 8 22 | end: 21 23 | - source: useMemo 24 | style: secondary 25 | start: 0 26 | end: 7 27 | - source: useMemo(() => a === 2, [a]) 28 | style: secondary 29 | start: 0 30 | end: 27 31 | useMemo(() => a === b, [a, b]);: 32 | labels: 33 | - source: () => a === b 34 | style: primary 35 | start: 8 36 | end: 21 37 | - source: useMemo 38 | style: secondary 39 | start: 0 40 | end: 7 41 | - source: useMemo(() => a === b, [a, b]) 42 | style: secondary 43 | start: 0 44 | end: 30 45 | useMemo(() => a === test(b), [a]);: 46 | labels: 47 | - source: () => a === test(b) 48 | style: primary 49 | start: 8 50 | end: 27 51 | - source: useMemo 52 | style: secondary 53 | start: 0 54 | end: 7 55 | - source: useMemo(() => a === test(b), [a]) 56 | style: secondary 57 | start: 0 58 | end: 33 59 | useMemo(() => { return a === b; }, [a, b]);: 60 | labels: 61 | - source: () => { return a === b; } 62 | style: primary 63 | start: 8 64 | end: 33 65 | - source: useMemo 66 | style: secondary 67 | start: 0 68 | end: 7 69 | - source: useMemo(() => { return a === b; }, [a, b]) 70 | style: secondary 71 | start: 0 72 | end: 42 73 | -------------------------------------------------------------------------------- /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/__snapshots__/react-no-useless-effect-ref-assign-snapshot.yml: -------------------------------------------------------------------------------- 1 | id: react-no-useless-effect-ref-assign 2 | snapshots: 3 | ? | 4 | useEffect(() => { 5 | ref.current = value; 6 | ref.current = value; 7 | }, [value]) 8 | : labels: 9 | - source: ref.current = value 10 | style: primary 11 | start: 20 12 | end: 39 13 | - source: useEffect 14 | style: secondary 15 | start: 0 16 | end: 9 17 | - source: |- 18 | useEffect(() => { 19 | ref.current = value; 20 | ref.current = value; 21 | }, [value]) 22 | style: secondary 23 | start: 0 24 | end: 75 25 | ? | 26 | useEffect(() => { 27 | ref.current = value; 28 | }, [value]) 29 | : labels: 30 | - source: ref.current = value 31 | style: primary 32 | start: 20 33 | end: 39 34 | - source: useEffect 35 | style: secondary 36 | start: 0 37 | end: 9 38 | - source: |- 39 | useEffect(() => { 40 | ref.current = value; 41 | }, [value]) 42 | style: secondary 43 | start: 0 44 | end: 52 45 | ? | 46 | useEffect(() => { 47 | ref.current.x = value; 48 | ref.current.x = value; 49 | }, [value]) 50 | : labels: 51 | - source: ref.current.x = value 52 | style: primary 53 | start: 20 54 | end: 41 55 | - source: useEffect 56 | style: secondary 57 | start: 0 58 | end: 9 59 | - source: |- 60 | useEffect(() => { 61 | ref.current.x = value; 62 | ref.current.x = value; 63 | }, [value]) 64 | style: secondary 65 | start: 0 66 | end: 79 67 | ? | 68 | useEffect(() => { 69 | ref.current.x = value; 70 | }, [value]) 71 | : labels: 72 | - source: ref.current.x = value 73 | style: primary 74 | start: 20 75 | end: 41 76 | - source: useEffect 77 | style: secondary 78 | start: 0 79 | end: 9 80 | - source: |- 81 | useEffect(() => { 82 | ref.current.x = value; 83 | }, [value]) 84 | style: secondary 85 | start: 0 86 | end: 54 87 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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