From 7e5d880156130d877d47032fc175ad14b7edff53 Mon Sep 17 00:00:00 2001 From: "Arthur K." Date: Fri, 7 Nov 2025 09:52:16 +0300 Subject: [PATCH 1/2] --- .local/bin/scripts/vpn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.local/bin/scripts/vpn b/.local/bin/scripts/vpn index dc9b88e..3cfe8b8 100755 --- a/.local/bin/scripts/vpn +++ b/.local/bin/scripts/vpn @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x PIPE="/var/run/vpnd.sock" send_cmd() { @@ -19,11 +19,11 @@ if resolvectl domain "$DEFAULT_LINK" | grep -q 'wzray.com'; then IS_LOCAL=1 fi -IFNAME="rix" +IFNAME='ext' while [ "$#" -gt 0 ]; do case "$1" in - 'm'|'msk') IFNAME='msk';; + 'i'|'int') IFNAME='int';; '-v'|'--verbose') VERBOSE=1;; *) echo "Wrong argument!"; exit 1;; esac From d93f63cf824e82da096fffab1eba64d0d1a8911a Mon Sep 17 00:00:00 2001 From: "Arthur K." Date: Tue, 11 Nov 2025 00:41:42 +0300 Subject: [PATCH 2/2] --- .config/X11/runonce | 1 - .config/clangd/config.yaml | 2 +- .config/nvim/.gitignore | 1 + .config/nvim/.luarc.json | 41 --- .config/nvim/lazy-lock.json | 66 +++-- .config/nvim/lua/config/filetypes.lua | 36 +++ .config/nvim/lua/config/init.lua | 3 +- .config/nvim/lua/config/mappings.lua | 7 +- .config/nvim/lua/lsp/init.lua | 15 +- .config/nvim/lua/plugins/init.lua | 38 +-- .config/nvim/lua/plugins/multilayout.lua | 30 +++ .config/nvim/lua/plugins/telescope.lua | 17 +- .config/nvim/lua/plugins/theme.lua | 1 + .config/nvim/lua/plugins/ufo.lua | 49 ++-- .config/tmux/keybinds.conf | 5 + .config/zsh/.zshenv | 14 +- .config/zsh/.zshrc | 53 ++-- .config/zsh/modes.sh | 77 ++++-- .config/zsh/modes/dt.sh | 7 + .gitconfig | 5 + .local/bin/scripts/bin | 23 +- .local/bin/scripts/cat-files | 7 + .local/bin/scripts/dunstctl-set-paused | 4 + .local/bin/scripts/gor | 6 +- .local/bin/scripts/md | 2 + .local/bin/scripts/my.itmo | 326 ----------------------- .local/bin/scripts/ollama | 5 +- .local/bin/scripts/tg | 2 +- .local/bin/scripts/unplug | 4 + .local/bin/scripts/virt | 3 + .local/bin/scripts/vpn | 53 ++-- .local/bin/scripts/vpnd | 93 ++----- .local/bin/scripts/wdate | 9 + .local/bin/scripts/xr | 14 +- .local/bin/source/src_add_path | 7 +- .local/bin/source/src_venv | 18 +- .local/bin/statusbar/sb-battery | 2 +- .local/bin/statusbar/sb-silent | 1 + .local/bin/statusbar/sb-vpn | 35 ++- .ssh/config | 15 +- 40 files changed, 448 insertions(+), 649 deletions(-) create mode 100644 .config/nvim/.gitignore delete mode 100644 .config/nvim/.luarc.json create mode 100644 .config/nvim/lua/config/filetypes.lua create mode 100644 .config/nvim/lua/plugins/multilayout.lua create mode 100644 .config/zsh/modes/dt.sh create mode 100755 .local/bin/scripts/cat-files create mode 100755 .local/bin/scripts/dunstctl-set-paused delete mode 100755 .local/bin/scripts/my.itmo create mode 100755 .local/bin/scripts/unplug create mode 100755 .local/bin/scripts/virt create mode 100755 .local/bin/scripts/wdate create mode 100755 .local/bin/statusbar/sb-silent diff --git a/.config/X11/runonce b/.config/X11/runonce index d707607..da1241b 100755 --- a/.config/X11/runonce +++ b/.config/X11/runonce @@ -1,4 +1,3 @@ -clipmenud & flameshot & # vim: ft=sh diff --git a/.config/clangd/config.yaml b/.config/clangd/config.yaml index b928d58..572ad75 100644 --- a/.config/clangd/config.yaml +++ b/.config/clangd/config.yaml @@ -7,4 +7,4 @@ CompileFlags: If: PathMatch: '.*\.(cpp|hpp)' CompileFlags: - Add: [ -std=c++20 ] + Add: [ -std=c++23 ] diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore new file mode 100644 index 0000000..9bbbeea --- /dev/null +++ b/.config/nvim/.gitignore @@ -0,0 +1 @@ +.luarc.json diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json deleted file mode 100644 index 0059061..0000000 --- a/.config/nvim/.luarc.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "workspace.library": [ - "/home/wzray/.local/share/nvim/lazy/neodev.nvim/types/stable", - "/usr/share/nvim/runtime/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-surround/lua", - "/home/wzray/.local/share/nvim/lazy/telescope-fzf-native.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-tree.lua/lua", - "/home/wzray/.local/share/nvim/lazy/cmp-nvim-lsp/lua", - "/home/wzray/.local/share/nvim/lazy/cmp-buffer/lua", - "/home/wzray/.local/share/nvim/lazy/lspkind.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/lualine.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-web-devicons/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-treesitter-textobjects/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-treesitter-context/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-treesitter/lua", - "/home/wzray/.local/share/nvim/lazy/indent-blankline.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-notify/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-colorizer.lua/lua", - "/home/wzray/.local/share/nvim/lazy/mason.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/lazy.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/LuaSnip/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-lastplace/lua", - "/home/wzray/.local/share/nvim/lazy/telescope.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/Navigator.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/trouble.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/bufferline.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/Comment.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-lspconfig/lua", - "/home/wzray/.local/share/nvim/lazy/neodev.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/onedark.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/plenary.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/fidget.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-autopairs/lua", - "/home/wzray/.local/share/nvim/lazy/todo-comments.nvim/lua", - "/home/wzray/.local/share/nvim/lazy/nvim-cmp/lua", - "/home/wzray/.local/share/nvim/lazy/telescope-emoji.nvim/lua", - "/usr/share/nvim/runtime", - "/home/wzray/.dotfiles/.config/nvim/lua", - "${3rd}/luv/library" - ] -} \ No newline at end of file diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index c20ee07..d80f1e0 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,43 +1,55 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "c1851d5c519611dfc451b6582961b2602e0af89b" }, + "LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, + "fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "iptables": { "branch": "master", "commit": "0d18b1e468f547dd7e2c494d42bc134a1e0eac7e" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, - "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, - "mason.nvim": { "branch": "main", "commit": "7c7318e8bae7e3536ef6b9e86b9e38e74f2e125e" }, - "multilayout.nvim": { "branch": "main", "commit": "613ec4ace9097a4464a558777aaf6a15b3d8bd78" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" }, + "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, + "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "multilayout.nvim": { "branch": "main", "commit": "105f22f6329f19a1824f58774d1899f2a69a5e77" }, "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, - "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" }, + "nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-dap": { "branch": "master", "commit": "4c0e3a98465fac963dfde898cc8b878094153a43" }, + "nvim-java": { "branch": "main", "commit": "3d56b7461facb42f135e25b2636bf220a7f0ed42" }, + "nvim-java-core": { "branch": "main", "commit": "229ebcdfa33c75cf746f97c46c2893b2de3626e5" }, + "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, + "nvim-java-refactor": { "branch": "main", "commit": "b51a57d862338999059e1d1717df3bc80a3a15c0" }, + "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, - "nvim-lspconfig": { "branch": "master", "commit": "61e5109c8cf24807e4ae29813a3a82b31821dd45" }, - "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, - "nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" }, - "nvim-tree.lua": { "branch": "master", "commit": "e7d1b7dadc62fe2eccc17d814354b0a5688621ce" }, - "nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" }, - "nvim-treesitter-context": { "branch": "master", "commit": "5c48b8ba1b0b7b25feb6e34e7eb293ea893aedc4" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "0e3be38005e9673d044e994b1e4b123adb040179" }, - "nvim-web-devicons": { "branch": "master", "commit": "f1420728f59843eb2ef084406b3d0201a0a0932d" }, - "onedark.nvim": { "branch": "master", "commit": "11de4da47f3e69cb70c3ae9816bd8af166cbe121" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" }, + "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, + "nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" }, + "nvim-tree.lua": { "branch": "master", "commit": "68c67adfabfd1ce923839570507ef2e81ab8a408" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "660861b1849256398f70450afdf93908d28dc945" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, + "nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" }, + "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, + "onedark.nvim": { "branch": "master", "commit": "918e89e6993b2901eea47b9f4eb666d53c2542a6" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "quickfix-reflector.vim": { "branch": "master", "commit": "6a6a9e28e1713b9e9db99eec1e6672e5666c01b9" }, + "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, "telescope-emoji.nvim": { "branch": "master", "commit": "86248d97be84a1ce83f0541500ef9edc99ea2aa1" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, - "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "vim-bbcode": { "branch": "master", "commit": "6fb28c6deae5844ee2bf0b97ef2fea04bd3d4eac" }, - "vim-caddyfile": { "branch": "master", "commit": "24fe0720551883e407cb70ae1d7c03f162d1d5a0" }, - "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "vim-caddyfile": { "branch": "master", "commit": "6d60d5af0d73f20b88ec388a9d70188d55ed8223" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-nftables": { "branch": "master", "commit": "26f8a506c6f3e41f1e4a8d6aa94c9a79a666bbff" }, - "vim-peekaboo": { "branch": "master", "commit": "cc4469c204099c73dd7534531fa8ba271f704831" }, - "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" } + "vim-peekaboo": { "branch": "master", "commit": "2a8a3187ba6b15201b2563a3f0331fcdf49da36c" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "vim-wakatime": { "branch": "master", "commit": "d7973b157a632d1edeff01818f18d67e584eeaff" } } diff --git a/.config/nvim/lua/config/filetypes.lua b/.config/nvim/lua/config/filetypes.lua new file mode 100644 index 0000000..87bddaa --- /dev/null +++ b/.config/nvim/lua/config/filetypes.lua @@ -0,0 +1,36 @@ +local function has_ansible_root(path, recursive) + if not recursive then + return vim.uv.fs_stat( + vim.fs.joinpath(vim.fs.dirname(path), 'ansible.cfg') + ) + end + + return vim.fs.find('ansible.cfg', { + path = vim.fs.dirname(path), + upward = true, + limit = 1 + })[1] +end + +local function yaml_filetype(recursive, p2) + return function (path) + print(p2) + if has_ansible_root(path, recursive) then + return "yaml.ansible" + else + return "yaml" + end + end +end + +vim.filetype.add({ + extension = { + ['yaml'] = yaml_filetype(false), + ['yml'] = yaml_filetype(false), + }, + pattern = { + [".*/roles/.*/tasks/.*%.ya?ml"] = yaml_filetype(true), + [".*/roles/.*/handlers/.*%.ya?ml"] = yaml_filetype(true), + [".*/playbooks/.*%.ya?ml"] = yaml_filetype(true), + }, +}) diff --git a/.config/nvim/lua/config/init.lua b/.config/nvim/lua/config/init.lua index b8af3fe..5468c1c 100644 --- a/.config/nvim/lua/config/init.lua +++ b/.config/nvim/lua/config/init.lua @@ -1,3 +1,4 @@ -require("config.mappings") require("config.options") +require("config.mappings") require("config.autocmd") +require("config.filetypes") diff --git a/.config/nvim/lua/config/mappings.lua b/.config/nvim/lua/config/mappings.lua index 5fc4a31..55d4263 100644 --- a/.config/nvim/lua/config/mappings.lua +++ b/.config/nvim/lua/config/mappings.lua @@ -23,7 +23,7 @@ map({ 'n', 'v' }, 'j', 'v:count == 0 ? "gj" : "j"', { expr = true, silent = true -- Copy and paste from clipboard map({ 'n', 'v' }, 'y', '"+y') -map({ 'n', 'v' }, 'Y', '"+Y') +map({ 'n', 'v' }, 'Y', '"+y$') map({ 'n', 'v' }, 'p', '"+p') map({ 'n', 'v' }, 'P', '"+P') @@ -49,3 +49,8 @@ map('i', '', '') -- Move lines quickly map('n', '', ':m-2', { silent = true }) map('n', '', ':m+1', { silent = true }) + +map('n', 'dt', ':diffthis', { silent = true }) +map('n', 'do', ':diffoff', { silent = true }) + +map('n', 'lr', ':LspR') diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index 14b0793..6249249 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -19,7 +19,7 @@ local servers = { yamlls = require('lsp.yamlls'), } -vim.lsp.set_log_level('info') +-- vim.lsp.set_log_level('info') local on_attach = function(_, bufnr) local nmap = function(keys, func) @@ -33,6 +33,10 @@ local on_attach = function(_, bufnr) nmap('gr', require('telescope.builtin').lsp_references) nmap('gt', require('telescope.builtin').lsp_type_definitions) + -- nmap('gd', vim.lsp.buf.definition) + -- nmap('gr', vim.lsp.buf.references) + -- nmap('gt', vim.lsp.buf.type_definition) + nmap('sd', require('telescope.builtin').diagnostics) nmap('ds', require('telescope.builtin').lsp_document_symbols) nmap('as', require('telescope.builtin').lsp_dynamic_workspace_symbols) @@ -42,17 +46,22 @@ local on_attach = function(_, bufnr) nmap('', vim.lsp.buf.signature_help) nmap('gI', require('telescope.builtin').lsp_implementations) + -- nmap('gI', vim.lsp.buf.implementation) nmap('gD', vim.lsp.buf.declaration) nmap('F', vim.lsp.buf.format) end local capabilities = require('cmp_nvim_lsp').default_capabilities() -local lspconfig = require('lspconfig') +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true +} for server_name, config in pairs(servers) do - lspconfig[server_name].setup(vim.tbl_deep_extend('keep', { + vim.lsp.config(server_name, vim.tbl_deep_extend('keep', { capabilities = capabilities, on_attach = on_attach, }, config)) + vim.lsp.enable(server_name) end diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index 7e406c7..39dd18a 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -1,10 +1,11 @@ return { + 'Winseven4lyf/vim-bbcode', 'isobit/vim-caddyfile', + 'junegunn/vim-peekaboo', + 'nfnty/vim-nftables', 'rcarriga/nvim-notify', 'stefandtw/quickfix-reflector.vim', - 'nfnty/vim-nftables', 'tpope/vim-fugitive', - 'junegunn/vim-peekaboo', 'tpope/vim-sleuth', 'vim-scripts/iptables', { 'akinsho/bufferline.nvim', opts = {}, dependencies = { 'navarasu/onedark.nvim' } }, @@ -13,36 +14,7 @@ return { { 'kylechui/nvim-surround', version = '*', event = 'VeryLazy', opts = {} }, { 'lukas-reineke/indent-blankline.nvim', main = 'ibl', opts = {} }, { 'norcalli/nvim-colorizer.lua', opts={ '*' }, dependencies = { 'navarasu/onedark.nvim' } }, - -- { 'wakatime/vim-wakatime', event = 'VeryLazy' }, + { 'wakatime/vim-wakatime', event = 'VeryLazy' }, { 'williamboman/mason.nvim', opts = {} }, - 'Winseven4lyf/vim-bbcode', - - - { 'mrsobakin/multilayout.nvim' , opts = { - layouts = { - ru = { - -- Names of this layout, as `libukb` reports. - names = { "Russian" }, - from = [[ёйцукенгшщзхъфывапролджэячсмитьбю.Ё"№;:?ЙЦУКЕНГШЩЗХЪ/ФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,]], - to = [[`qwertyuiop[]asdfghjkl;'zxcvbnm,./~@#$^&QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]], - } - }, - aliases = { - -- Maximum length of default commands aliases. - -- Increasing this value leads to longer startup times. - max_length = 2, - -- Extra commands that you want to alias. - -- They are aliased regardless of `max_length`. - extra = { "sort" }, - }, - -- Whether to use `libukb`. If this is set to false, `langmap` - -- won't automatically switch when your layout does. - use_libukb = true, - -- Path to the `libukb.so`. If `nil`, ukb will be automatically - -- downloaded, builded and installed in the neovim data directory. - libukb_path = nil, - -- Function of type `callback(layout: string)`. Called whenever - -- current keyboard layout changes. - callback = nil, - }} + { dir = '~/.local/share/nvim/preseed/' }, -- 'https://git.netizen.se/vim-preseed', } diff --git a/.config/nvim/lua/plugins/multilayout.lua b/.config/nvim/lua/plugins/multilayout.lua new file mode 100644 index 0000000..6220119 --- /dev/null +++ b/.config/nvim/lua/plugins/multilayout.lua @@ -0,0 +1,30 @@ +return { + 'mrsobakin/multilayout.nvim', + opts = { + layouts = { + ru = { + -- Names of this layout, as `libukb` reports. + names = { "Russian" }, + from = [[ёйцукенгшщзхъфывапролджэячсмитьбю.Ё"№;:?ЙЦУКЕНГШЩЗХЪ/ФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,]], + to = [[`qwertyuiop[]asdfghjkl;'zxcvbnm,./~@#$^&QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]], + } + }, + aliases = { + -- Maximum length of default commands aliases. + -- Increasing this value leads to longer startup times. + max_length = 2, + -- Extra commands that you want to alias. + -- They are aliased regardless of `max_length`. + extra = { "sort" }, + }, + -- Whether to use `libukb`. If this is set to false, `langmap` + -- won't automatically switch when your layout does. + use_libukb = true, + -- Path to the `libukb.so`. If `nil`, ukb will be automatically + -- downloaded, builded and installed in the neovim data directory. + libukb_path = nil, + -- Function of type `callback(layout: string)`. Called whenever + -- current keyboard layout changes. + callback = nil, + } +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 724ece8..d1acea9 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -10,6 +10,7 @@ return { config = function() local actions = require('telescope.actions') + require('telescope').setup { defaults = { mappings = { @@ -18,8 +19,12 @@ return { [''] = false, [""] = actions.move_selection_next, [""] = actions.move_selection_previous, - [""] = actions.smart_send_to_qflist + actions.open_qflist, + -- [""] = actions.smart_send_to_qflist + actions.open_qflist, + [""] = require("trouble.sources.telescope").open }, + n = { + [""] = require("trouble.sources.telescope").open + } }, }, } @@ -34,11 +39,17 @@ return { }) end) - vim.keymap.set('n', '?', require('telescope.builtin').live_grep) - vim.keymap.set('n', 'wf', require('telescope.builtin').grep_string) + vim.keymap.set('n', '?', require('telescope.builtin').live_grep) + vim.keymap.set('n', 'wf', require('telescope.builtin').grep_string) vim.keymap.set('n', 'of', require('telescope.builtin').oldfiles) vim.keymap.set('n', 'af', require('telescope.builtin').git_files) vim.keymap.set('n', 'sf', require('telescope.builtin').find_files) vim.keymap.set('n', '.', require('telescope').extensions.emoji.emoji) + + + -- Use this to add more results without clearing the trouble list + -- local add_to_trouble = require("trouble.sources.telescope").add + + local telescope = require("telescope") end } diff --git a/.config/nvim/lua/plugins/theme.lua b/.config/nvim/lua/plugins/theme.lua index a6c2dee..e8b19e9 100644 --- a/.config/nvim/lua/plugins/theme.lua +++ b/.config/nvim/lua/plugins/theme.lua @@ -38,5 +38,6 @@ return { } vim.o.termguicolors = true vim.cmd.colorscheme 'onedark' + vim.cmd.hi 'clear @spell' end, } diff --git a/.config/nvim/lua/plugins/ufo.lua b/.config/nvim/lua/plugins/ufo.lua index 8ab9530..dc4dcef 100644 --- a/.config/nvim/lua/plugins/ufo.lua +++ b/.config/nvim/lua/plugins/ufo.lua @@ -1,30 +1,23 @@ return { - -- 'kevinhwang91/nvim-ufo', - -- dependencies = { - -- 'kevinhwang91/promise-async' - -- }, - -- config = function() - -- vim.defer_fn(function() - -- vim.o.foldcolumn = '0' - -- vim.o.foldlevel = 99 - -- vim.o.foldlevelstart = 99 - -- vim.o.foldenable = true - -- - -- vim.keymap.set('n', 'zR', require('ufo').openAllFolds) - -- vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) - -- - -- local capabilities = vim.lsp.protocol.make_client_capabilities() - -- capabilities.textDocument.foldingRange = { - -- dynamicRegistration = false, - -- lineFoldingOnly = true - -- } - -- local language_servers = vim.lsp.get_clients() - -- for _, ls in ipairs(language_servers) do - -- require('lspconfig')[ls].setup({ - -- capabilities = capabilities - -- }) - -- end - -- require('ufo').setup() - -- end, 0) - -- end + 'kevinhwang91/nvim-ufo', + dependencies = { + 'kevinhwang91/promise-async' + }, + config = function() + vim.defer_fn(function() + vim.o.foldcolumn = '0' + vim.o.foldlevel = 99 + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + + vim.keymap.set('n', 'zR', require('ufo').openAllFolds) + vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) + + require('ufo').setup({ + provider_selector = function(bufnr, filetype, buftype) + return {'treesitter', 'indent'} + end + }) + end, 0) + end } diff --git a/.config/tmux/keybinds.conf b/.config/tmux/keybinds.conf index 3c15dcc..3cc1439 100644 --- a/.config/tmux/keybinds.conf +++ b/.config/tmux/keybinds.conf @@ -32,6 +32,8 @@ unbind-key -T copy-mode-vi V unbind-key -T copy-mode-vi C-v unbind-key -T copy-mode-vi C-c unbind-key -T copy-mode-vi Escape +# unbind-key -T copy-mode-vi / +# unbind-key -T copy-mode-vi ? bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel bind-key -T copy-mode-vi v send-keys -X begin-selection @@ -40,4 +42,7 @@ bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle bind-key -T copy-mode-vi C-c send-keys -X cancel bind-key -T copy-mode-vi Escape send-keys -X clear-selection +bind-key -T copy-mode-vi ? command-prompt -T search -p "(search down)" { send-keys -X search-forward "%%" } +bind-key -T copy-mode-vi / command-prompt -T search -p "(search up)" { send-keys -X search-backward "%%" } + # vim: ft=tmux diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv index 505dfba..6b03206 100644 --- a/.config/zsh/.zshenv +++ b/.config/zsh/.zshenv @@ -1,8 +1,13 @@ set -a -PATH="$HOME/.local/share/go/bin:$PATH" +PATH="\ +$HOME/.local/share/go/bin:\ +$HOME/.local/share/dotnet:\ +$PATH" PATH="${$(find -L ~/.local/bin ! -name '.*' -type d -printf %p:)%%:}:$PATH" +TIMEFMT=$'\ncmd\t%J\nreal\t%*E\nuser\t%U\nsys\t%S\ncpu\t%P' + # lc vars LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8" @@ -35,14 +40,15 @@ XDG_PICTURES_DIR="$HOME/" XDG_VIDEOS_DIR="$HOME/" # default configs -ANDROID_HOME="${HOME}/.local/share/android" +ANDROID_HOME="${HOME}/.local/share/android-home" ANDROID_USER_HOME="${HOME}/.local/share/android-home" +ANDROID_AVD_HOME="${ANDROID_HOME}/avd" BAT_THEME="TwoDark" EDITOR="/usr/bin/nvim" GNUPGHOME='~/.local/share/gnupg' GOPATH="${HOME}/.local/share/go" GPG_TTY="$(tty)" -JAVA_HOME="/usr/lib/jvm/java-23-openjdk" +JAVA_HOME="/usr/lib/jvm/java-21-openjdk" LESS="-x4 --wheel-lines 3 --mouse" MANPAGER="sh -c 'col -bx | bat -l man -p --theme Monokai\ Extended'" MANROFFOPT="-c" @@ -53,5 +59,7 @@ GRADLE_USER_HOME="${HOME}/.local/share/gradle" DOCKER_CONFIG="${HOME}/.local/share/docker" COMPOSE_BAKE=true GIT_DISCOVERY_ACROSS_FILESYSTEM=1 +DOTNET_CLI_TELEMETRY_OPTOUT=1 # clippy <3 +DOTNET_ROOT="${HOME}/.local/share/dotnet" set +a diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 7adba07..77228fc 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -23,7 +23,6 @@ autoload -U select-word-style select-word-style b # options -setopt extendedglob setopt auto_pushd # keybinds @@ -58,7 +57,10 @@ alias lsd='/usr/bin/ls' alias l="ls -lh" alias la="ls -lah" alias ll="ls -lh" +alias ltr='ls -lt' alias lt="ls -ltr" +alias lss='ls -lS' +alias lsr='ls -lSr' # set bat as help pager alias -g -- --help='--help 2>&1 | bat --language=help --style=plain --theme Monokai\ Extended' @@ -84,12 +86,12 @@ alias sudo='sudo ' # allow aliases with sudo alias rz='exec zsh' alias venv='source src_venv' alias ex='source src_example' -alias ap='source src_add_path' +alias pa='source src_add_path' alias info='pinfo' alias bat='bat ' alias img='nsxiv' alias xclip='xclip -selection clipboard' -alias xxclip='head -c-1 | xclip -selection clipboard' +alias xcp='perl -pe "chomp if eof" | xclip -selection clipboard' alias rgf='rg --files | rg' alias wt='watch --color -d -cn 0.1 ' alias .e='set -a && source .env && set +a' @@ -97,30 +99,37 @@ alias vimu='vim -u /dev/null' alias reswap="sudo bash -c 'echo Working...; swapoff /swapfile && sudo swapon /swapfile'" alias make="make -j$(nproc)" alias py='python3' +alias q='qalc' alias neofetch='fastfetch' alias open='xdg-open' alias m.='if mount | grep -q "$(pwd)"; then umount -l .; cd .; else mount .; cd .; fi' alias rs='stow -R .' alias sst='ssh -t' +alias rdj='rmdir ./*' +alias qr='qrencode -t ansiutf8' # function aliases bl() { brightnessctl set "$1"% > /dev/null; } nosw() { alacritty --class 'noswallow' -e "$@"; }; compdef _command nosw -t() { taskell "${1:-${HOME}/.taskell.md}"; } vims() { filepath="$(type "$1" | rev | cut -d ' ' -f 1 | rev)"; [ $? -eq 0 ] && vim "${filepath}"; }; compdef _command vims tl() { tree -C "$@" | bat }; compdef _tree tl -diff() { /usr/bin/diff --color -u "$@" | delta; }; compdef _files di +diff() { /usr/bin/diff --color -u "$@" | delta; }; compdef _files di; # compdef compdef -a '_git; _git-commit' gdc # todo compdef '_files -g "*.md"' md -compdef _ollama ollama + +# ansible +alias ap='ansible-playbook' +alias ag='ansible-galaxy' # git aliases gl() { git log --decorate "$@" | bat }; compdef '_git; _git-log' gl -gus() { git branch --set-upstream-to="${1:?}/${2:?}" "${2:?}"}; compdef '_git; _git-push' gus -gpo() { git push --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)" "$@"} +gus() { git branch --set-upstream-to="${1:?}/${2:?}" "${2:?}" }; compdef '_git; _git-push' gus +gpo() { git push --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)" "$@" } +gru() { git remote get-url "${1-origin}" }; compdef '_gor' gru alias ga="git add" +alias ga.="git add ." # always fatfinger this alias gb="git branch" alias gc="git commit" alias gca="git commit --allow-empty-message --amend --no-edit" @@ -131,7 +140,8 @@ alias gcls="git clone --depth=1" alias gcm="git commit --allow-empty-message -m ''" alias gcd='git commit --no-gpg-sign' alias gcmd="git commit --allow-empty-message -m '' --no-gpg-sign" -alias gcn="git clean" +alias gcn="git clean -nfd" +alias gcn!="git clean -fd" alias gcp="git cherry-pick" alias gd="git diff" alias gds="gd --staged" @@ -148,10 +158,12 @@ alias grjs="git rebase --cancel" alias grm="git remote" alias grs="git restore --staged" alias grt="git reset" +alias grt!="git reset --hard" alias gsm='git submodule' alias grc='git rm --cached' alias gs="git status" -alias gsc="git switch -c" +alias gs.='git status .' +alias gsc="git switch -C" alias gsh="git show" alias gsj="git stash" alias gsp="git stash pop" @@ -159,6 +171,10 @@ alias gt="git tag" alias gus="git fetch --unshallow" alias gdj='DELTA_FEATURES="+side-by-side" gd' alias gdsj='DELTA_FEATURES="+side-by-side" gds' +alias gshj='DELTA_FEATURES="+side-by-side" gsh' +alias gcln='git clean -nxfd' +alias gcln!='git clean -xfd' +alias gct="gc -am 'Add files via upload :trollface:'" # docker aliases alias d='docker' @@ -166,17 +182,22 @@ alias dc='docker compose' alias d!='/usr/bin/docker' alias dc!='d! compose' -alias dj='dc up -d --force-recreate' -alias djl='dc up -d --force-recreate && dl' -alias dl='dc logs -f' -alias dk='dc down' -alias dv='d volume' alias di='d image' +alias dj='dc up -d --force-recreate' +alias djb='dj --build' +alias djbl='djb && dl' +alias djl='dj && dl' +alias dk='dc down' +alias dl='dc logs -f' alias dr='d run --rm -it' +alias drs='dc restart' +alias drsl='dc restart && dl' +alias dv='d volume' # tmux stuff tn() { tmux new-session -s "${1-"$(basename "$(pwd)")"}" } -alias ta="tmux a -t" +alias ta='tmux a -t' +# ta() { tmux a -t "$1" }; compdef '_tmux; _tmux-attach-session' ta # disable xon control chars stty -ixon diff --git a/.config/zsh/modes.sh b/.config/zsh/modes.sh index e5c8188..793f812 100644 --- a/.config/zsh/modes.sh +++ b/.config/zsh/modes.sh @@ -1,3 +1,5 @@ +#!/usr/bin/zsh + mode::enable() { local mode_path="${HOME}/.config/zsh/modes/$1.sh" [ ! -f "$mode_path" ] && echo "Mode not found!" && return 1 @@ -11,6 +13,18 @@ mode::enable() { } +mode::get_functions() { + perl -ne '/^(?>function\s+)?([\x21-\x7e]+)\s*\(\)/ && print "$1\n"' < "$1" +} + +mode::get_variables() { + perl -ne '/^(?>declare\s+(?>--?\w+\s*)+\s*)?\s*([\x21-\x3c\x3e-\x7e]+)=.*$/ && print "$1\n"' < "$1" +} + +mode::get_aliases() { + perl -ne '/^(?:noglob\s+)?alias ([\x21-\x3c\x3e-\x7e]+)=/ && print "$1\n"' < "$1" +} + mode::disable() { export PS1="${MODE__OLD_PS1}" local mode_path="${HOME}/.config/zsh/modes/$MODE__ACTIVE_MODE.sh" @@ -18,45 +32,78 @@ mode::disable() { unset -v "MODE__OLD_PS1" unset -v "MODE__ACTIVE_MODE" - for mode_variable in $(perl -ne '/^(?>declare\s+(?>--?\w+\s*)+\s*)?\s*([\x21-\x3c\x3e-\x7e]+)=.*$/ && print "$1\n"' < "$mode_path"); do + for mode_variable in $(mode::get_variables "$mode_path"); do unset "$mode_variable" done - for mode_function in $(perl -ne '/^(?>function\s+)?([\x21-\x7e]+)\s*\(\)/ && print "$1\n"' < "$mode_path"); do + for mode_function in $(mode::get_functions "$mode_path"); do unset -f "$mode_function" done - for mode_alias in $(perl -ne '/^alias ([\x21-\x3c\x3e-\x7e]+)=/ && print "$1\n"'< "$mode_path"); do + for mode_alias in $(mode::get_aliases "$mode_path"); do unalias "$mode_alias" done } mode::help() { - echo "USAGE" - echo " mode [-h]" + echo "Usage:" echo " mode " - echo " mode" echo - echo "OPTIONS" - echo " -h for help lol" - echo - echo "AVAILABLE MODES" + echo "Available modes:" for mode in ~/.config/zsh/modes/*; do printf " %s\n" "$(basename "${mode%.sh}")" done } -m() { - [ -n "$MODE__ACTIVE_MODE" ] && mode::disable && return - local cmd="${1:?}" - case "$cmd" in +m() { + [ -n "$MODE__ACTIVE_MODE" ] && { + mode::disable + [ -z "$1" ] && return + } + + [ -z "$1" ] && { + echo 'Error: Missing mode name!' + mode::help + return 1 + } >&2 + + case "$1" in "-h"|"--help") mode::help ;; *) - mode::enable "$cmd" || mode::help >&2 + mode::enable "$1" || mode::help >&2 ;; esac } + +mm() { + [ -z "$MODE__ACTIVE_MODE" ] && return 1 + + local mode_path="${HOME}/.config/zsh/modes/$MODE__ACTIVE_MODE.sh" + + echo "Active mode: $MODE__ACTIVE_MODE" + + echo + echo 'Aliases: ' + for mode_alias in $(mode::get_aliases "$mode_path"); do + printf ' ' + alias "$mode_alias" + done + + echo + echo 'Functions:' + for mode_function in $(mode::get_functions "$mode_path"); do + echo " $mode_function" + done + + echo + echo 'Variables:' + for mode_variable in $(mode::get_variables "$mode_path"); do + echo " $mode_variable" + done +} + +alias 'm?'=mm diff --git a/.config/zsh/modes/dt.sh b/.config/zsh/modes/dt.sh new file mode 100644 index 0000000..dcd8b1f --- /dev/null +++ b/.config/zsh/modes/dt.sh @@ -0,0 +1,7 @@ +alias db='dotnet build' +alias df='dotnet format' +alias dt='dotnet test' +alias dr='dotnet restore' +noglob alias df?='dotnet format --verify-no-changes' +alias dff='df; df; df?' +alias da='dff && db && dt' diff --git a/.gitconfig b/.gitconfig index d3389de..48892c7 100644 --- a/.gitconfig +++ b/.gitconfig @@ -21,3 +21,8 @@ [safe] directory = /home/wzray/Services/cpu directory = /home/wzray/Services/cpu/* +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true diff --git a/.local/bin/scripts/bin b/.local/bin/scripts/bin index 7ed7eac..8fd0639 100755 --- a/.local/bin/scripts/bin +++ b/.local/bin/scripts/bin @@ -6,17 +6,19 @@ declare -a files while [ "$#" -gt 0 ]; do case "$1" in - "-s") SILENT=1;; + "-"*) SILENT=1;; *) files+=("$1");; esac shift done -if [ "$#" -gt 0 ]; then - r="$(curl -X PUT --data-binary "@$1" "$URL" 2>/dev/null)" - ext="$(basename -- "$1")" - ext=".${ext##*.}" - [ "$ext" = ".$1" ] && ext= +if [ "${#files}" -gt 0 ]; then + for file in "${files[@]}"; do + r="$(curl -X PUT --data-binary "@$file" "$URL" 2>/dev/null)" + ext="$(basename -- "$file")" + ext=".${ext##*.}" + [ "$ext" = ".$file" ] && ext= + done else if [ "$SILENT" = 1 ]; then TMP_FILENAME="$(mktemp)" @@ -26,9 +28,8 @@ else else r="$(curl -X PUT --data-binary @- "$URL" 2>/dev/null)" fi + [ -n "$TMP_FILENAME" ] && rm "$TMP_FILENAME" fi - -r="$(tr -d $'\n' <<< "$r")" -xclip -selection clipboard <<< "$r$ext" -echo "$r$ext" -[ -n "$TMP_FILENAME" ] && rm "$TMP_FILENAME" +r="$(tr -d $'\n' <<< "$r$ext")" +xclip -selection clipboard <<< "$r" +echo "$r" diff --git a/.local/bin/scripts/cat-files b/.local/bin/scripts/cat-files new file mode 100755 index 0000000..b73723d --- /dev/null +++ b/.local/bin/scripts/cat-files @@ -0,0 +1,7 @@ +#!/bin/bash + +while IFS=$'\n' read -r file; do + echo "$file:" + cat "$file" + printf "\n\n" +done < <(find "${1?}" -type f) diff --git a/.local/bin/scripts/dunstctl-set-paused b/.local/bin/scripts/dunstctl-set-paused new file mode 100755 index 0000000..f7288f3 --- /dev/null +++ b/.local/bin/scripts/dunstctl-set-paused @@ -0,0 +1,4 @@ +#!/bin/sh + +dunstctl set-paused "$1" +pkill -37 dwmblocks diff --git a/.local/bin/scripts/gor b/.local/bin/scripts/gor index 2359cc3..be0eddd 100755 --- a/.local/bin/scripts/gor +++ b/.local/bin/scripts/gor @@ -3,7 +3,11 @@ url="$(git remote get-url "${1:-origin}")" if [[ "$url" =~ ^https?:\/\/ ]]; then - xdg-open "$url" + xdg-open "${url%.git}" +# elif [[ "$url" =~ ([a-zA-Z0-9_.-]+):(.*) ]]; then +# url="https://${BASH_REMATCH[1]}/${BASH_REMATCH[2]}" +# url="${url%.git}" +# xdg-open "$url" elif [[ "$url" =~ ^[a-zA-Z0-9_-]+@([a-zA-Z0-9_.-]+):(.*) ]]; then url="https://${BASH_REMATCH[1]}/${BASH_REMATCH[2]}" url="${url%.git}" diff --git a/.local/bin/scripts/md b/.local/bin/scripts/md index 3659d03..9f22ac5 100755 --- a/.local/bin/scripts/md +++ b/.local/bin/scripts/md @@ -34,6 +34,8 @@ main() { "--template=${HOME}/.local/share/default.html" "--variable=published_time=$(date -Iseconds -d"$(stat "$1" | grep 'Birth:' | sed 's/.*Birth:\s//')")" ) + + set -e pandoc "${pandoc_options[@]}" <(shift_header "$1") > "$FILENAME" && echo "$FILENAME" && firefox "$FILENAME" & disown diff --git a/.local/bin/scripts/my.itmo b/.local/bin/scripts/my.itmo deleted file mode 100755 index bed5108..0000000 --- a/.local/bin/scripts/my.itmo +++ /dev/null @@ -1,326 +0,0 @@ -#!/bin/sh -# shellcheck disable=all -"exec" "${HOME}/.local/share/venv/statusbar/bin/python3" "-u" "$0" "$@" - -import datetime -import json -import os -import signal -import sys -import time -import traceback - -from collections.abc import Callable -from dataclasses import dataclass -from typing import Literal, Any, TypeVar -from urllib.parse import urlparse - -import requests -from bs4 import BeautifulSoup, Tag - -EMOJI_BY_STATUS = { - 0: '🟡', - 1: '🟢', - 2: '🔴', -} -TIMEOUT = 30 -CONFIG_FILE = f"{os.environ['HOME']}/.my.itmo" -CACHE_FILE = f"{os.environ['HOME']}/.cache/my_itmo.cache" -SECRET_FILE = f"{os.environ['HOME']}/.secrets/my_itmo.secret" -PIPE_FILE = f"{os.environ['XDG_RUNTIME_DIR']}/my.itmo.pipe" - -T = TypeVar('T') - - -def run_forever(fn: Callable, *args, **kwargs): - while True: - try: - fn(*args, **kwargs) - except Exception: - print(traceback.format_exc()) - - -def run_until_successful(fn: Callable[..., T], *args, **kwargs) -> T: - while True: - try: - return fn(*args, **kwargs) - except Exception: - pass - - -def send_message(chat_id: int, text: str, token: str): - requests.post(f"https://api.telegram.org/bot{token}/sendMessage", data={ - 'chat_id': chat_id, - 'parse_mode': 'HTML', - 'text': text - }) - - -@dataclass -class StatusObject: - id: int - name: str - notice: str - status: Literal[0, 1, 2] - status_name: str - updated_at: datetime.datetime - created_at: datetime.datetime - - @staticmethod - def from_dict(data: dict[str, Any]): - data['updated_at'] = datetime.datetime.strptime(data['updated_at'].replace("+03:00", ''), '%Y-%m-%dT%H:%M:%S') - data['created_at'] = datetime.datetime.strptime(data['created_at'].replace("+03:00", ''), '%Y-%m-%dT%H:%M:%S') - - return StatusObject(**data) - - -class ApiException(Exception): - status_code: int - body: str - - def __init__(self, status_code: int, body: str): - super().__init__(status_code, body) - self.status_code = status_code - self.body = body - - def __str__(self): - return f'Status code: {self.status_code}\nBody: {self.body}' - - -class Api: - _session: requests.Session - _username: str - _password: str - _access_token: str - _refresh_token: str - _expires_in: int - _refresh_expires_in: int - - def __init__(self, username: str, password: str, *, access_token: str | None = None, - refresh_token: str | None = None, expires_in: int | None = None, - refresh_expires_in: int | None = None, cookies: Any | None = None): - self._session = requests.Session() - self._username = username - self._password = password - self._refresh_token = refresh_token if refresh_token else '' - self._expires_in = expires_in if expires_in else 0 - self._refresh_expires_in = refresh_expires_in if refresh_expires_in else 0 - if cookies: self._session.cookies.update(cookies) - self._access_token = access_token if access_token else '' - if access_token: self._session.headers.update({'Authorization': f'Bearer {access_token}'}) - self._ensure_authorized() - - - def _first_auth(self): - self._session.headers.clear() - self._session.cookies.clear() - code_request = run_until_successful(self._session.get, 'https://id.itmo.ru/auth/realms/itmo/protocol/openid-connect/auth', params={ - 'protocol': 'oauth2', - 'response_type': 'code', - 'client_id': 'student-personal-cabinet', - 'redirect_uri': 'https://my.itmo.ru/login/callback', - 'scope': 'openid profile', - }, timeout=2) - soup = BeautifulSoup(code_request.text, features='html.parser') - form = soup.find('form') - if not isinstance(form, Tag): - raise ApiException(code_request.status_code, code_request.text) - - url = form.get_attribute_list('action')[0] - auth_request = run_until_successful(self._session.post, url, data={'username': self._username, 'password': self._password}) - if auth_request.status_code != 200: - raise ApiException(auth_request.status_code, auth_request.text) - - parsed_url_params = {a.split('=')[0]: a.split('=')[1] for a in urlparse(auth_request.url).query.split('&')} - - self._get_and_save_tokens({ - 'code' : parsed_url_params['code'], - 'client_id': 'student-personal-cabinet', - 'redirect_uri': 'https://my.itmo.ru/login/callback', - 'audience': '', - 'response_type': 'code', - 'grant_type': 'authorization_code', - 'code_verifier': '' - }) - - - def _renew(self): - self._session.headers.clear() - self._session.cookies.clear() - self._get_and_save_tokens({ - 'refresh_token': self._refresh_token, - 'scopes': 'openid profile', - 'client_id': 'student-personal-cabinet', - 'grant_type': 'refresh_token' - }) - - - def _get_and_save_tokens(self, data: Any): - tokens_request = run_until_successful(self._session.post, 'https://id.itmo.ru/auth/realms/itmo/protocol/openid-connect/token', data=data, timeout=2) - if tokens_request.status_code != 200: - raise ApiException(tokens_request.status_code, tokens_request.text) - tokens = tokens_request.json() - self._access_token = tokens['access_token'] - self._expires_in = int(time.time()) + tokens['expires_in'] - 10 - self._refresh_expires_in = int(time.time()) + tokens['refresh_expires_in'] - 10 - self._refresh_token = tokens['refresh_token'] - self._session.headers.update({"Authorization": f"Bearer {tokens_request.json()['access_token']}"}) - - - def _ensure_authorized(self): - current_time = int(time.time()) - - if self._access_token and self._expires_in > current_time: - return - elif self._refresh_token and self._refresh_expires_in > current_time: - self._renew() - else: - self._first_auth() - - - def _make_request(self, method: Literal["GET", "POST"], endpoint: str): - self._ensure_authorized() - r = run_until_successful(self._session.request, method, f'https://my.itmo.ru/api/{endpoint}', timeout=2) - - if r.status_code == 403: - self._first_auth() # do full reauth if 403 after self._ensure_authorized() - r = run_until_successful(self._session.request, method, f'https://my.itmo.ru/api/{endpoint}', timeout=2) - - if r.status_code != 200 or r.json()['error_code'] != 0: - raise ApiException(r.status_code, r.text) - - return r.json() - - - def get_status_list(self): - return [StatusObject.from_dict(obj) for obj in self._make_request('GET', 'requests/my')['result']] - - - def to_dict(self) -> Any: - return { - 'username': self._username, - 'password': self._password, - 'access_token': self._access_token, - 'refresh_token': self._refresh_token, - 'expires_in': self._expires_in, - 'refresh_expires_in': self._refresh_expires_in, - 'cookies': self._session.cookies.get_dict() - } - - - @staticmethod - def from_dict(data: Any): - return Api( - data['username'], - data['password'], - access_token = data['access_token'], - refresh_token = data['refresh_token'], - expires_in = data['expires_in'], - refresh_expires_in = data['refresh_expires_in'], - cookies = data['cookies'], - ) - - -def listen_for_messages(api: Api, timeout=TIMEOUT, filter_func: Callable[[StatusObject], bool] | None = None): - prev_msg = None - while True: - msg = list(filter(filter_func, api.get_status_list())) - - if not msg or msg == prev_msg: - time.sleep(timeout) - continue - - prev_msg = msg - yield msg - time.sleep(timeout) - - -format_status = lambda status: f"{EMOJI_BY_STATUS[status.status]} {status.notice.split('.')[0].strip()}" -format_message = lambda status: f"{EMOJI_BY_STATUS[status.status]} {status.name}\n\n{status.notice}" - - -class IDsFilter: - _ids: list[str] - _update_time: float - - def __init__(self): - self._ids = [] - self._update_dict() - - - def __call__(self, status: StatusObject) -> bool: - if self._update_time + TIMEOUT < time.time(): - self._update_dict() - - return str(status.id) in self._ids - - def _update_dict(self): - self._update_time = time.time() - try: - with open(CONFIG_FILE) as file: - self._ids = file.read().strip().replace(' ', '').split(',') - except Exception: - self._ids = [] - - -class LastUpdateFilter: - _update_time: datetime.datetime - - def __init__(self, ignore_now = False) -> None: - self._update_time = datetime.datetime.fromtimestamp(0) if not ignore_now else datetime.datetime.now() - - def __call__(self, status: StatusObject): - return status.updated_at >= self._update_time - - def update(self): - self._update_time = datetime.datetime.now() - - -def main(): - api = None - - if os.path.isfile(CACHE_FILE): - with open(CACHE_FILE) as file: - api = Api.from_dict(json.load(file)) - - if os.path.isfile(SECRET_FILE): - with open(SECRET_FILE) as secret_file: - data = json.load(secret_file) - - owner_id = data['owner_id'] - bot_token = data['bot_token'] - - if not api: - api = Api(data['username'], data['password']) - else: - print("Missing secret file!", file=sys.stderr) - exit(1) - - def die(*_): - with open(CACHE_FILE, 'w') as file: - json.dump(api.to_dict(), file) - if os.path.isfile(PIPE_FILE): - os.remove(PIPE_FILE) - exit(0) - - signal.signal(signal.SIGTERM, die) - signal.signal(signal.SIGINT, die) - - for message in listen_for_messages(api, filter_func=IDsFilter()): - with open(PIPE_FILE, 'w') as file: - print('\n'.join(map(format_status, message))) - file.write(' '.join(map(format_status, message))) - - update_filter = LastUpdateFilter(ignore_now=True) - for message in listen_for_messages(api, filter_func=update_filter): - formatted_messages = list(map(format_message, message)) - print('\n---\n'.join(formatted_messages)) - for message in formatted_messages: - send_message(owner_id, message, bot_token) - update_filter.update() - - -if __name__ == "__main__": - run_forever(main) - -# vim: ft=python diff --git a/.local/bin/scripts/ollama b/.local/bin/scripts/ollama index 9d2ca8c..b5ede54 100755 --- a/.local/bin/scripts/ollama +++ b/.local/bin/scripts/ollama @@ -1,9 +1,6 @@ #!/bin/bash flags="-it" - -if [ ! -t 0 ] || [ ! -t 1 ]; then - flags= -fi +{ [ ! -t 0 ] || [ ! -t 1 ]; } && flags= docker --context=higpu exec $flags ollama-ollama-1 ollama "$@" diff --git a/.local/bin/scripts/tg b/.local/bin/scripts/tg index a45444b..bba8021 100755 --- a/.local/bin/scripts/tg +++ b/.local/bin/scripts/tg @@ -88,7 +88,7 @@ main() { fi [ -n "${print_response:+_}" ] && echo "$resp" - [ "$(jq .ok <<<"$resp")" = "true" ] || jq <<< "$resp" >&2 + # [ "$(jq .ok <<<"$resp")" = "true" ] || jq <<< "$resp" >&2 } main "$@" diff --git a/.local/bin/scripts/unplug b/.local/bin/scripts/unplug new file mode 100755 index 0000000..3fdf038 --- /dev/null +++ b/.local/bin/scripts/unplug @@ -0,0 +1,4 @@ +#!/bin/sh + +xr internal +systemctl suspend diff --git a/.local/bin/scripts/virt b/.local/bin/scripts/virt new file mode 100755 index 0000000..aeb50f3 --- /dev/null +++ b/.local/bin/scripts/virt @@ -0,0 +1,3 @@ +#!/bin/sh +sudo systemctl start libvirtd +sudo virsh net-start default diff --git a/.local/bin/scripts/vpn b/.local/bin/scripts/vpn index 3cfe8b8..9de23f1 100755 --- a/.local/bin/scripts/vpn +++ b/.local/bin/scripts/vpn @@ -1,11 +1,5 @@ #!/bin/bash -x -PIPE="/var/run/vpnd.sock" -send_cmd() { - [ -p $PIPE ] && echo "$@" > $PIPE && \ - cat < $PIPE -} - send_router_cmd() { touch "${HOME}/.local/state/.vpn_loading" pkill -36 dwmblocks @@ -13,51 +7,40 @@ send_router_cmd() { rm "${HOME}/.local/state/.vpn_loading" } +awg-quick() { + PIPE="/var/run/vpnd.sock" + + [ -p $PIPE ] && + echo "$@" > $PIPE && + cat < $PIPE +} + DEFAULT_LINK="$(resolvectl status | grep 'Default Route: yes' -B10 | grep 'Link' | tail -1 | grep -Eo '\(.*\)' | tr -d '()')" if resolvectl domain "$DEFAULT_LINK" | grep -q 'wzray.com'; then IS_LOCAL=1 fi -IFNAME='ext' +IFNAME="awg_ext" while [ "$#" -gt 0 ]; do case "$1" in - 'i'|'int') IFNAME='int';; - '-v'|'--verbose') VERBOSE=1;; - *) echo "Wrong argument!"; exit 1;; + i|int|internal) IFNAME='awg_int';; + *) echo "Wrong argument!" >&2; exit 1;; esac shift done -if [ -z "${VERBOSE}" ]; then - exec &>/dev/null +UP_NAME="$(ip link | grep 'awg_' | cut -d ' ' -f 2 | sed 's,:,,')" + +if [ -n "$UP_NAME" ]; then + awg-quick down "$UP_NAME" +elif [ -n "$IS_LOCAL" ]; then + send_router_cmd toggle else - set -x + awg-quick up "${IFNAME}" fi -UP_NAME="$(send_cmd status)" - -if [ -n "$IS_LOCAL" ]; then - if [ -n "$UP_NAME" ]; then - send_cmd down - else - send_router_cmd toggle - fi -else - if [ -n "${UP_NAME}" ]; then - if [ "${UP_NAME}" != "${IFNAME}" ]; then - send_cmd down - send_cmd up "$IFNAME" - else - send_cmd down - fi - else - send_cmd up "$IFNAME" - fi -fi - - pkill -36 dwmblocks # vim: ft=bash diff --git a/.local/bin/scripts/vpnd b/.local/bin/scripts/vpnd index c529be0..22c042f 100755 --- a/.local/bin/scripts/vpnd +++ b/.local/bin/scripts/vpnd @@ -1,92 +1,49 @@ #!/bin/bash # shellcheck disable=SC2034 -die() { - [ -n "$oc_pid" ] && kill -s TERM "$oc_pid" - echo "exitting..." - rm -f $PIPE - exit 0 -} - -trap 'die' SIGTERM SIGQUIT SIGINT - PIPE="/var/run/vpnd.sock" -oc_pid= -up_name= [ -p $PIPE ] && exit 1 [ "$(id -u)" != "0" ] && exit 1 +trap 'die' SIGTERM SIGQUIT SIGINT + declare -a CONFIGS -for config in /etc/openconnect/config_*; do - config="$(basename "$config")" - CONFIGS+=("${config#config_}") +for config in /etc/amnezia/amneziawg/*; do + config="$(basename "$config")" + CONFIGS+=("${config%.conf}") done -COMMANDS=("up" "down" "status") +COMMANDS=("up" "down") -is_really_up() { - [ -n "$oc_pid" ] && if ! kill -0 "$oc_pid"; then - oc_pid= - up_name= - fi +die() { + rm $PIPE + exit 0 } in_arr() { - declare -n arr="$2" + declare -n arr="$2" - for value in "${arr[@]}"; do - [ "$value" = "$1" ] && return 0 - done - return 1 -} - -down() { - is_really_up - [ -z "$oc_pid" ] && return - kill -s TERM "$oc_pid" - wait "$oc_pid" - oc_pid= - up_name= -} - -up() { - is_really_up - [ -n "$oc_pid" ] && down - openconnect --config "/etc/openconnect/config_$1" & - oc_pid="$!" - up_name="$1" -} - -status() { - is_really_up - echo "$up_name" > $PIPE + for value in "${arr[@]}"; do + [ "$value" = "$1" ] && return 0 + done + return 1 } main() { - mkfifo $PIPE -m666 + mkfifo $PIPE -m666 - while :; do - read -r cmd ifname < $PIPE - if ! in_arr "$cmd" "COMMANDS"; then - echo "ERROR: Invalid command $cmd" > $PIPE - else - case "$cmd" in - "up") - if ! in_arr "$ifname" "CONFIGS"; then - echo "ERROR: Invalid interface $ifname" > $PIPE - else - up "$ifname" - echo "$ifname" > $PIPE - fi - ;; - "down") down; echo "down" > $PIPE;; - "status") status;; - esac + while :; do + read -r cmd ifname < $PIPE - fi - done + if ! in_arr "$ifname" "CONFIGS"; then + echo "ERROR: Invalid interface $ifname" > $PIPE + elif ! in_arr "$cmd" "COMMANDS"; then + echo "ERROR: Invalid command $cmd" > $PIPE + else + awg-quick "$cmd" "$ifname" > $PIPE 2>&1 + fi + done } -echo "Running..." main diff --git a/.local/bin/scripts/wdate b/.local/bin/scripts/wdate new file mode 100755 index 0000000..c9721a1 --- /dev/null +++ b/.local/bin/scripts/wdate @@ -0,0 +1,9 @@ +#!/bin/sh + +trap 'echo; exit' 'INT' + +while :; do + printf '\r' + date "$@" | tr -d '\n' + sleep 0.99 +done diff --git a/.local/bin/scripts/xr b/.local/bin/scripts/xr index 583ecd6..e632aa8 100755 --- a/.local/bin/scripts/xr +++ b/.local/bin/scripts/xr @@ -1,7 +1,5 @@ #!/bin/bash -# supress stderr - change_dpi() { sed -i -E --follow-symlinks "s/Xft\.dpi: .*?/Xft\.dpi: $1/g" ~/.Xresources sed -i -E --follow-symlinks "s/Xcursor\.size: .*?/Xcursor\.size: $2/g" ~/.Xresources @@ -20,7 +18,7 @@ EXT_MON="$(xrandr | grep -ow "\(DP-[0-9]\) connected" | cut -d " " -f 1)" INT_MODELINE=$(cvt 1560 1040 90 | grep "Modeline" | cut -d " " -f 2- | tr -d '"') INT_RES="$(echo $INT_MODELINE | cut -d ' ' -f 1 | tr -d '\"')" -if [[ -z "${EXT_MON}" ]]; then +if [[ -z "${EXT_MON}" ]] || [ "$1" = "internal" ]; then xrandr --output eDP-1 --pos 0x0 --mode "3120x2080" --rate 90 --primary --output DP-1 --off --output DP-2 --off --output DP-3 --off --output DP-4 --off xrandr --delmode eDP-1 "${INT_RES}" xrandr --rmmode "${INT_RES}" @@ -29,9 +27,13 @@ else : xrandr --rmmode "${INT_RES}" # shellcheck disable=all - xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution - xrandr --addmode eDP-1 "${INT_RES}" - xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary + + # temp remove edp + # xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution + # xrandr --addmode eDP-1 "${INT_RES}" + # xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary + + xrandr --output eDP-1 --off --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary change_dpi 96 24 fi diff --git a/.local/bin/source/src_add_path b/.local/bin/source/src_add_path index 5431081..8b218a3 100644 --- a/.local/bin/source/src_add_path +++ b/.local/bin/source/src_add_path @@ -1,15 +1,14 @@ [ -z "$1" ] && { - echo "Missing path parameter!" >&2 + echo 'Missing path parameter!' >&2 return 1 } full_path="$(readlink -e "$1")" - -[ ! -d "$full_path" ] && { +[ -d "$full_path" ] || { echo "Path doesn't exist!" >&2 return 1 } -export PATH="$full_path:$PATH" +[[ ":$PATH:" == *":${full_path}:"* ]] || export PATH="$full_path:$PATH" # vim: ft=sh diff --git a/.local/bin/source/src_venv b/.local/bin/source/src_venv index 2191ddf..03795b6 100644 --- a/.local/bin/source/src_venv +++ b/.local/bin/source/src_venv @@ -19,8 +19,18 @@ help() { } +deactivate_or_unset() { + if command -v deactivate >/dev/null 2>&1; then + deactivate + else + unset VIRTUAL_ENV + unset VIRTUAL_ENV_PROMPT + fi +} + + remove() { - [ -n "${VIRTUAL_ENV}" ] && deactivate + [ -n "${VIRTUAL_ENV}" ] && deactivate_or_unset rm -rf "${VENV_FOLDER}" } @@ -53,9 +63,9 @@ VENV_FOLDER="${VENV_FOLDER_PATH}/${VENV_FOLDER_NAME}" # shellcheck disable=SC2015 case "${OPERATION}" in - c) [ -z "${VIRTUAL_ENV}" ] && create_or_activate || help >&2;; - d) [ -n "${VIRTUAL_ENV}" ] && deactivate || help >&2;; - r) [ -d "${VENV_FOLDER}" ] && remove || help >&2;; + c) [ -z "${VIRTUAL_ENV}" ] && create_or_activate || help >&2;; + d) [ -n "${VIRTUAL_ENV}" ] && deactivate_or_unset || help >&2;; + r) [ -d "${VENV_FOLDER}" ] && remove || help >&2;; esac # vim: ft=sh diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery index 5b12415..872d0a6 100755 --- a/.local/bin/statusbar/sb-battery +++ b/.local/bin/statusbar/sb-battery @@ -42,7 +42,7 @@ for battery_path in /sys/class/power_supply/!(AC*); do status_symbol="${custom_icons["$device_name"]}" elif [ "$capacity" -eq 100 ]; then status_symbol=" " - elif [[ "$status" = "Discharging" && "$capacity" -le 20 ]]; then + elif [ "$status" = "Discharging" ] && [ "$capacity" -le 20 ]; then status_symbol="❗" [ -n "$sep" ] && sep="" || sep=" "; fi diff --git a/.local/bin/statusbar/sb-silent b/.local/bin/statusbar/sb-silent new file mode 100755 index 0000000..2708d79 --- /dev/null +++ b/.local/bin/statusbar/sb-silent @@ -0,0 +1 @@ +dunstctl is-paused -e && echo '' diff --git a/.local/bin/statusbar/sb-vpn b/.local/bin/statusbar/sb-vpn index 276f398..fb9d2f3 100755 --- a/.local/bin/statusbar/sb-vpn +++ b/.local/bin/statusbar/sb-vpn @@ -5,26 +5,33 @@ exit 0 } -PIPE="/var/run/vpnd.sock" send_cmd() { - [ -p $PIPE ] && echo "$@" > $PIPE && \ - cat < $PIPE + PIPE="/var/run/vpnd.sock" + [ -p $PIPE ] && echo "$@" > $PIPE && cat < $PIPE } -IFNAME="$(send_cmd status)" +router_status() { + ssh -i "$HOME"/.ssh/id_watcher router vpn status laptop 2>/dev/null +} -case "$IFNAME" in - "msk") IFNAME="Moscow";; - "rix") IFNAME="Riga";; +case "$(ip link | grep 'awg_' | cut -d ' ' -f2 | tr -d ':' | sed 's,awg_,,')" in + "int") IFNAME="󰻌 Saint-Petersburg";; + "ext") IFNAME="󰦝 Riga";; esac -if [ -n "$IFNAME" ]; then - echo "󰦝 $IFNAME" +[ -n "$IFNAME" ] && { + echo "$IFNAME" exit 0 -fi +} -DEFAULT_LINK="$(resolvectl status | grep 'Default Route: yes' -B10 | grep 'Link' | tail -1 | grep -Eo '\(.*\)' | tr -d '()')" +DEFAULT_LINK="$( + resolvectl status | \ + grep 'Default Route: yes' -B10 | \ + grep 'Link' | \ + tail -1 | \ + grep -Eo '\(.*\)' | \ + tr -d '()' +)" -if resolvectl domain "$DEFAULT_LINK" | grep -q 'wzray.com'; then - [ "$(ssh router vpn status laptop 2>/dev/null)" = '1' ] && echo "󰦝 Local" -fi +resolvectl domain "$DEFAULT_LINK" | grep -q 'wzray.com' && \ + [ "$(router_status)" = '1' ] && echo "󰦝" diff --git a/.ssh/config b/.ssh/config index 6a993af..fb67fd0 100644 --- a/.ssh/config +++ b/.ssh/config @@ -2,6 +2,13 @@ Host * AddKeysToAgent yes IdentityFile ~/.ssh/id_ed25519 +Host vm.zvray.ru + Port 22 + User root + StrictHostKeyChecking no + UpdateHostkeys no + UserKnownHostsFile /dev/null + Host *.zvray.ru mx*.wzray.com User root Port 8022 @@ -15,11 +22,16 @@ Host laptop laptop.*.wzray.com Host hicpu hicpu.spb.wzray.com User root +Host higpu-docker-storage + HostName higpu.spb.wzray.com + User root + Port 2201 + Host git.wzray.com User git Port 2201 -Host 192.168.1.1 10.161.0.1 10.161.0.2 10.162.0.1 openwrt router ap gateway router.*.wzray.com ap.*.wzray.com openwrt.*.wzray.com gateway.*.wzray.com +Host 192.168.1.1 10.161.0.1 10.161.0.2 10.162.0.1 openwrt router ap gateway router.*.wzray.com ap.*.wzray.com openwrt.*.wzray.com User root UserKnownHostsFile /dev/null IdentityFile /dev/null @@ -27,3 +39,4 @@ Host 192.168.1.1 10.161.0.1 10.161.0.2 10.162.0.1 openwrt router ap gateway rout UpdateHostkeys no PubkeyAcceptedAlgorithms +ssh-rsa HostkeyAlgorithms +ssh-rsa + LogLevel ERROR