From a28487fe6fbac72c7b1a752acab42dcc6ab46476 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 28 May 2025 14:24:58 -0400 Subject: Post server fs corruption --- NOTES.txt | 3 ++ files/nvim/init.vim | 76 +++++++++++++++----------- files/nvim/mini_starter_picture.diff | 57 +++++++++++--------- files/windows/MSI_util_v3.zip | Bin 0 -> 19006 bytes files/windows/xp_activate32.exe | Bin 0 -> 18432 bytes files/winxp/xp_activate32.exe | Bin 18432 -> 0 bytes flake.lock | 26 ++++----- hosts/iroha/scripts/game | 6 --- hosts/iroha/scripts/game.sh | 5 ++ hosts/iroha/scripts/prepare-network-mounts | 7 ++- hosts/iroha/scripts/rebuild-modules | 3 +- hosts/iroha/scripts/xbox-controller-battery | 2 + hosts/moyo/samba/smb.conf | 6 +-- hosts/moyo/scripts/id-dm-device | 2 + hosts/moyo/scripts/mount-luks | 11 ++-- hosts/sofue/incus.yaml | 80 ++++++++++++++++++++-------- hosts/yashinoki/configuration.nix | 2 +- nix/programs/bash.nix | 2 +- nix/programs/kitty.nix | 9 +++- nix/programs/nvim.nix | 2 +- nix/scripts.nix | 2 +- nix/system.nix | 1 + nix/user.nix | 1 + scripts/battery | 6 --- scripts/cpu-vulns | 2 - scripts/dbus-sway-environment | 5 -- scripts/desktop/7z-password | 2 + scripts/desktop/battery | 6 +++ scripts/desktop/cpu-vulns | 2 + scripts/desktop/dbus-sway-environment | 5 ++ scripts/desktop/discord-wayland | 2 + scripts/desktop/dmenu-emoji | 2 + scripts/desktop/dmenu-path | 3 ++ scripts/desktop/dmenu-path0 | 3 ++ scripts/desktop/gpg-pubkey | 2 + scripts/desktop/img-fstype | 2 + scripts/desktop/install-as-needed | 5 ++ scripts/desktop/looking-glass | 2 + scripts/desktop/moonrune-charset-utf8 | 6 +++ scripts/desktop/mount-nfs | 2 + scripts/desktop/rewrite-git | 8 +++ scripts/desktop/screenshot | 48 +++++++++++++++++ scripts/desktop/shift-jis-zip | 2 + scripts/desktop/sp | 6 +++ scripts/desktop/term-font-size | 20 +++++++ scripts/desktop/ts-date | 2 + scripts/desktop/wlsunset-toggle | 10 ++++ scripts/desktop/xbox360-ffmpeg-enc | 2 + scripts/discord-wayland | 2 - scripts/dmenu-emoji | 2 - scripts/dmenu-path | 3 -- scripts/dmenu-path0 | 3 -- scripts/gpg-pubkey | 2 - scripts/img-fstype | 2 - scripts/install-as-needed | 5 -- scripts/looking-glass | 2 - scripts/moonrune-charset-utf8 | 6 --- scripts/mount-nfs | 2 - scripts/rewrite-git | 8 --- scripts/screenshot | 48 ----------------- scripts/shift-jis-zip | 2 - scripts/sp | 6 --- scripts/sync/diff.sh | 8 +++ scripts/sync/pull.sh | 34 ++++++++++++ scripts/sync/push.sh | 34 ++++++++++++ scripts/term-font-size | 20 ------- scripts/ts-date | 2 - scripts/wlsunset-toggle | 10 ---- scripts/xbox360-ffmpeg-enc | 2 - 69 files changed, 405 insertions(+), 256 deletions(-) create mode 100644 files/windows/MSI_util_v3.zip create mode 100644 files/windows/xp_activate32.exe delete mode 100644 files/winxp/xp_activate32.exe delete mode 100755 hosts/iroha/scripts/game create mode 100755 hosts/iroha/scripts/game.sh create mode 100755 hosts/iroha/scripts/xbox-controller-battery create mode 100755 hosts/moyo/scripts/id-dm-device delete mode 100755 scripts/battery delete mode 100755 scripts/cpu-vulns delete mode 100755 scripts/dbus-sway-environment create mode 100755 scripts/desktop/7z-password create mode 100755 scripts/desktop/battery create mode 100755 scripts/desktop/cpu-vulns create mode 100755 scripts/desktop/dbus-sway-environment create mode 100755 scripts/desktop/discord-wayland create mode 100755 scripts/desktop/dmenu-emoji create mode 100755 scripts/desktop/dmenu-path create mode 100755 scripts/desktop/dmenu-path0 create mode 100755 scripts/desktop/gpg-pubkey create mode 100755 scripts/desktop/img-fstype create mode 100755 scripts/desktop/install-as-needed create mode 100755 scripts/desktop/looking-glass create mode 100755 scripts/desktop/moonrune-charset-utf8 create mode 100755 scripts/desktop/mount-nfs create mode 100755 scripts/desktop/rewrite-git create mode 100755 scripts/desktop/screenshot create mode 100755 scripts/desktop/shift-jis-zip create mode 100755 scripts/desktop/sp create mode 100755 scripts/desktop/term-font-size create mode 100755 scripts/desktop/ts-date create mode 100755 scripts/desktop/wlsunset-toggle create mode 100755 scripts/desktop/xbox360-ffmpeg-enc delete mode 100755 scripts/discord-wayland delete mode 100755 scripts/dmenu-emoji delete mode 100755 scripts/dmenu-path delete mode 100755 scripts/dmenu-path0 delete mode 100755 scripts/gpg-pubkey delete mode 100755 scripts/img-fstype delete mode 100755 scripts/install-as-needed delete mode 100755 scripts/looking-glass delete mode 100755 scripts/moonrune-charset-utf8 delete mode 100755 scripts/mount-nfs delete mode 100755 scripts/rewrite-git delete mode 100755 scripts/screenshot delete mode 100755 scripts/shift-jis-zip delete mode 100755 scripts/sp create mode 100755 scripts/sync/diff.sh create mode 100755 scripts/sync/pull.sh create mode 100755 scripts/sync/push.sh delete mode 100755 scripts/term-font-size delete mode 100755 scripts/ts-date delete mode 100755 scripts/wlsunset-toggle delete mode 100755 scripts/xbox360-ffmpeg-enc diff --git a/NOTES.txt b/NOTES.txt index 17fc8e2..9642404 100644 --- a/NOTES.txt +++ b/NOTES.txt @@ -40,4 +40,7 @@ yashinoki * https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/blob/main/config?ref_type=heads * https://lore.kernel.org/lkml/20250505110946.1095363-15-mingo@kernel.org/ +== Server + * https://serverfault.com/a/211083 + // vim: set syntax=asciidoc: diff --git a/files/nvim/init.vim b/files/nvim/init.vim index 017f128..7325928 100644 --- a/files/nvim/init.vim +++ b/files/nvim/init.vim @@ -58,30 +58,39 @@ set clipboard+=unnamedplus " Session options. set ssop=skiprtp,blank,buffers,folds,winsize,terminal set vop-=curdir -let view_dir = expand('~/c/sessions/views') -if !isdirectory(view_dir) - call mkdir(view_dir, 'p', 0700) -endif -let &viewdir=view_dir - -" Staggered backups. -if isdirectory(expand('/mnt/store/backup/vim')) - set backupdir=/mnt/store/backup/vim// -else - set backupdir=~/c/sessions/backup// -endif -set backup - -" Swap file directory. -set directory=~/c/sessions/swaps// +if isdirectory(expand('~/c')) + let view_dir = expand('~/c/sessions/views') + if !isdirectory(view_dir) + call mkdir(view_dir, 'p', 0755) + endif + let &viewdir=view_dir + + " Staggered backups. + let backup_dir = '/mnt/store/backup/vim' + if !isdirectory(backup_dir) + let backup_dir = expand('~/c/sessions/backup//') + if !isdirectory(backup_dir) + call mkdir(backup_dir, 'p', 0755) + endif + endif + let &backupdir=backup_dir + set backup -if has('persistent_undo') - let undo_dir = expand('~/c/sessions/undo') - if !isdirectory(undo_dir) - call mkdir(undo_dir, 'p', 0700) + " Swap file directory. + let swap_dir = expand('~/c/sessions/swaps//') + if !isdirectory(swap_dir) + call mkdir(swap_dir, 'p', 0755) + endif + let &directory=swap_dir + + if has('persistent_undo') + let undo_dir = expand('~/c/sessions/undo') + if !isdirectory(undo_dir) + call mkdir(undo_dir, 'p', 0755) + endif + let &undodir=undo_dir + set undofile endif - let &undodir=undo_dir - set undofile endif " Colorscheme. @@ -240,7 +249,11 @@ function get_lsp_name() if next(active_clients) == nil then return '' else - return '+'..active_clients[1].name + str = '<' + for _, v in pairs(active_clients) do + str = str .. v.name .. '+' + end + return str:sub(1, -2) .. '>' end end @@ -257,8 +270,7 @@ end -- LSP configs. if os.getenv('NIX_SHELL') ~= nil then vim.diagnostic.config({ virtual_text = true }) - local lsp = require('lspconfig') - lsp.clangd.setup({ + vim.lsp.config('clangd', { cmd = { 'clangd', '-j=4', @@ -285,7 +297,7 @@ if os.getenv('NIX_SHELL') ~= nil then } }, }) - lsp.ruff.setup({}) + vim.lsp.enable({'clangd', 'ruff', 'ty'}) -- https://github.com/neovim/nvim-lspconfig/issues/2626#issuecomment-2117022664 -- https://github.com/neovim/nvim-lspconfig/issues/2508 vim.api.nvim_create_autocmd('BufReadPre', { @@ -306,11 +318,13 @@ if os.getenv('NIX_SHELL') ~= nil then end -- Set sessions folder and autowrite. -require('mini.sessions').setup({ - autoread = false, - autowrite = true, - directory = '~/c/sessions' -}) +if vim.fn.isdirectory(vim.fn.expand('~/c')) then + require('mini.sessions').setup({ + autoread = false, + autowrite = true, + directory = '~/c/sessions' + }) +end -- Completion. require('mini.completion').setup({ diff --git a/files/nvim/mini_starter_picture.diff b/files/nvim/mini_starter_picture.diff index 3ecd564..b64025c 100644 --- a/files/nvim/mini_starter_picture.diff +++ b/files/nvim/mini_starter_picture.diff @@ -1,5 +1,5 @@ diff --git a/lua/mini/starter.lua b/lua/mini/starter.lua -index 3e0570f3..0f4a384e 100644 +index cc10d101..78c4e5c1 100644 --- a/lua/mini/starter.lua +++ b/lua/mini/starter.lua @@ -138,7 +138,7 @@ @@ -11,7 +11,7 @@ index 3e0570f3..0f4a384e 100644 --- timer:stop() --- return --- end -@@ -239,6 +239,9 @@ MiniStarter.config = { +@@ -248,6 +248,9 @@ MiniStarter.config = { -- If `nil` (default), default items will be used (see |mini.starter|). items = nil, @@ -21,7 +21,7 @@ index 3e0570f3..0f4a384e 100644 -- Header to be displayed before items. Converted to single string via -- `tostring` (use `\n` to display several lines). If function, it is -- evaluated first. If `nil` (default), polite greeting will be used. -@@ -249,6 +252,12 @@ MiniStarter.config = { +@@ -258,6 +261,12 @@ MiniStarter.config = { -- evaluated first. If `nil` (default), default usage help will be shown. footer = nil, @@ -34,7 +34,7 @@ index 3e0570f3..0f4a384e 100644 -- Array of functions to be applied consecutively to initial content. -- Each function should take and return content for Starter buffer (see -- |mini.starter| and |MiniStarter.get_content()| for more details). -@@ -373,7 +382,7 @@ MiniStarter.refresh = function(buf_id) +@@ -382,7 +391,7 @@ MiniStarter.refresh = function(buf_id) data.footer = H.normalize_header_footer(config.footer or H.default_footer) -- Evaluate content @@ -43,20 +43,24 @@ index 3e0570f3..0f4a384e 100644 local hooks = config.content_hooks or H.default_content_hooks for _, f in ipairs(hooks) do content = f(content, buf_id) -@@ -400,6 +409,12 @@ MiniStarter.refresh = function(buf_id) +@@ -409,6 +418,16 @@ MiniStarter.refresh = function(buf_id) -- Apply current query (clear command line afterwards) H.make_query(buf_id) + -+ local timer = vim.loop.new_timer() -+ timer:start(0, 0, vim.schedule_wrap(function() -+ timer:stop() -+ H.draw_picture(config, false) -+ end)) ++ -- The picture drawn here used to get cleared at some point ++ -- that _usually_ came before any scheduled timers fired. ++ -- That seems to not happen anymore (nvim-0.11.1, kitty 0.42.1). ++ H.draw_picture(config, false) ++ --local timer = vim.loop.new_timer() ++ --timer:start(0, 0, vim.schedule_wrap(function() ++ -- timer:stop() ++ -- H.draw_picture(config, false) ++ --end)) end --- Close Starter buffer -@@ -731,18 +746,45 @@ MiniStarter.gen_hook.aligning = function(horizontal, vertical) +@@ -738,18 +757,45 @@ MiniStarter.gen_hook.aligning = function(horizontal, vertical) local win_id = vim.fn.bufwinid(buf_id) if win_id < 0 then return end @@ -104,7 +108,7 @@ index 3e0570f3..0f4a384e 100644 return MiniStarter.gen_hook.padding(left_pad, top_pad)(content) end end -@@ -1005,7 +1047,7 @@ H.default_footer = [[ +@@ -1012,7 +1058,7 @@ H.default_footer = [[ Type query to filter items deletes latest character from query resets current query @@ -113,7 +117,7 @@ index 3e0570f3..0f4a384e 100644 executes action of current item closes this buffer]] -@@ -1046,8 +1088,54 @@ end +@@ -1053,8 +1099,54 @@ end H.apply_config = function(config) MiniStarter.config = config end @@ -169,7 +173,7 @@ index 3e0570f3..0f4a384e 100644 if config.autoopen then local on_vimenter = function() -@@ -1059,7 +1147,7 @@ H.create_autocommands = function(config) +@@ -1066,7 +1158,7 @@ H.create_autocommands = function(config) vim.cmd('noautocmd lua MiniStarter.open()') end @@ -178,7 +182,7 @@ index 3e0570f3..0f4a384e 100644 vim.api.nvim_create_autocmd('VimEnter', au_opts) end -@@ -1105,9 +1193,11 @@ H.normalize_header_footer = function(x) +@@ -1112,9 +1204,11 @@ H.normalize_header_footer = function(x) end -- Work with buffer content --------------------------------------------------- @@ -191,7 +195,7 @@ index 3e0570f3..0f4a384e 100644 -- Add header lines for _, l in ipairs(header) do H.content_add_line(content, { H.content_unit(l, 'header', 'MiniStarterHeader') }) -@@ -1118,7 +1208,7 @@ H.make_initial_content = function(header, items, footer) +@@ -1125,7 +1219,7 @@ H.make_initial_content = function(header, items, footer) H.content_add_items(content, items) -- Add footer lines @@ -200,7 +204,7 @@ index 3e0570f3..0f4a384e 100644 for _, l in ipairs(footer) do H.content_add_line(content, { H.content_unit(l, 'footer', 'MiniStarterFooter') }) end -@@ -1321,11 +1411,22 @@ H.make_buffer_autocmd = function(buf_id) +@@ -1328,11 +1422,23 @@ H.make_buffer_autocmd = function(buf_id) au('VimResized', function() MiniStarter.refresh(buf_id) end, 'Refresh') au('CursorMoved', function() H.position_cursor_on_current_item(buf_id) end, 'Position cursor') @@ -214,16 +218,17 @@ index 3e0570f3..0f4a384e 100644 end, 'On BufLeave') + + au('BufEnter', function() -+ local timer = vim.loop.new_timer() -+ timer:start(0, 0, vim.schedule_wrap(function() -+ timer:stop() -+ H.draw_picture(config, false) -+ end)) ++ H.draw_picture(config, false) ++ --local timer = vim.loop.new_timer() ++ --timer:start(0, 0, vim.schedule_wrap(function() ++ -- timer:stop() ++ -- H.draw_picture(config, false) ++ --end)) + end, 'On BufEnter') end H.apply_buffer_options = function(buf_id) -@@ -1338,7 +1439,7 @@ H.apply_buffer_options = function(buf_id) +@@ -1345,7 +1451,7 @@ H.apply_buffer_options = function(buf_id) vim.api.nvim_feedkeys('\28\14', 'nx', false) -- Having `noautocmd` is crucial for performance: ~9ms without it, ~1.6ms with it @@ -232,7 +237,7 @@ index 3e0570f3..0f4a384e 100644 local options = { -- Taken from 'vim-startify' -@@ -1385,12 +1486,8 @@ H.apply_buffer_mappings = function(buf_id) +@@ -1392,12 +1498,8 @@ H.apply_buffer_mappings = function(buf_id) buf_keymap('', 'MiniStarter.eval_current_item()') @@ -247,7 +252,7 @@ index 3e0570f3..0f4a384e 100644 -- Make all special symbols to update query for _, key in ipairs(vim.split(H.get_config().query_updaters, '')) do -@@ -1466,21 +1563,21 @@ H.is_something_shown = function() +@@ -1473,21 +1575,21 @@ H.is_something_shown = function() end -- Utilities ------------------------------------------------------------------ @@ -272,7 +277,7 @@ index 3e0570f3..0f4a384e 100644 -- Avoid hit-enter-prompt local max_width = vim.o.columns * math.max(vim.o.cmdheight - 1, 0) + vim.v.echospace -@@ -1529,7 +1626,7 @@ H.eval_fun_or_string = function(x, string_as_cmd) +@@ -1536,7 +1638,7 @@ H.eval_fun_or_string = function(x, string_as_cmd) if type(x) == 'function' then return x() end if type(x) == 'string' then if string_as_cmd then diff --git a/files/windows/MSI_util_v3.zip b/files/windows/MSI_util_v3.zip new file mode 100644 index 0000000..0731688 Binary files /dev/null and b/files/windows/MSI_util_v3.zip differ diff --git a/files/windows/xp_activate32.exe b/files/windows/xp_activate32.exe new file mode 100644 index 0000000..1b0018a Binary files /dev/null and b/files/windows/xp_activate32.exe differ diff --git a/files/winxp/xp_activate32.exe b/files/winxp/xp_activate32.exe deleted file mode 100644 index 1b0018a..0000000 Binary files a/files/winxp/xp_activate32.exe and /dev/null differ diff --git a/flake.lock b/flake.lock index f0b8b68..de777c0 100644 --- a/flake.lock +++ b/flake.lock @@ -14,11 +14,11 @@ ] }, "locked": { - "lastModified": 1746723111, - "narHash": "sha256-hgN/VKry/B58P3Zv7H3zjqKVXs98jin4lfFO7WN+ghY=", + "lastModified": 1748213360, + "narHash": "sha256-P8gM26UIseGdje0MZNqpngQHMbKJWQpu53DK9fbgnZI=", "ref": "refs/heads/master", - "rev": "bbdc4ed66aa171f89f675aa1c82316477d5fd47e", - "revCount": 127, + "rev": "2fa7ea95c891981684a55b41977172d040c2cc55", + "revCount": 130, "type": "git", "url": "https://git.akon.city/camu" }, @@ -88,11 +88,11 @@ ] }, "locked": { - "lastModified": 1747978958, - "narHash": "sha256-pQQnbxWpY3IiZqgelXHIe/OAE/Yv4NSQq7fch7M6nXQ=", + "lastModified": 1748391243, + "narHash": "sha256-7sCuihzsTRZemtbTXaFUoGJUfuQErhKEcL9v7HKIo1k=", "owner": "nix-community", "repo": "home-manager", - "rev": "7419250703fd5eb50e99bdfb07a86671939103ea", + "rev": "f5b12be834874f7661db4ced969a621ab2d57971", "type": "github" }, "original": { @@ -176,11 +176,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1748026106, - "narHash": "sha256-6m1Y3/4pVw1RWTsrkAK2VMYSzG4MMIj7sqUy7o8th1o=", + "lastModified": 1748370509, + "narHash": "sha256-QlL8slIgc16W5UaI3w7xHQEP+Qmv/6vSNTpoZrrSlbk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "063f43f2dbdef86376cc29ad646c45c46e93234c", + "rev": "4faa5f5321320e49a78ae7848582f684d64783e9", "type": "github" }, "original": { @@ -199,11 +199,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1748115910, - "narHash": "sha256-XrtByWu6NjrGq1nysW4XsliVLslZXXKzCKHSC6QM5dY=", + "lastModified": 1748439094, + "narHash": "sha256-gZaw+Y0KSNnNCO86kED3y5NMWrG06TXq6L4vl/UQ3vU=", "owner": "nix-community", "repo": "NUR", - "rev": "24dcce023477b994838e387ae042c6b93a749288", + "rev": "cc59c871120ee0ea17ba17dd3f26d60bb21bc49d", "type": "github" }, "original": { diff --git a/hosts/iroha/scripts/game b/hosts/iroha/scripts/game deleted file mode 100755 index c716f7e..0000000 --- a/hosts/iroha/scripts/game +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env sh -sudo su -c 'echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level' -#read -p "Waiting..." -sudo scx_bpfland -sudo su -c 'echo auto > /sys/class/drm/card0/device/power_dpm_force_performance_level' - diff --git a/hosts/iroha/scripts/game.sh b/hosts/iroha/scripts/game.sh new file mode 100755 index 0000000..c8d626d --- /dev/null +++ b/hosts/iroha/scripts/game.sh @@ -0,0 +1,5 @@ +#! /usr/bin/env sh +sudo su -c 'echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level' +read -p "Waiting..." +#sudo scx_bpfland +sudo su -c 'echo auto > /sys/class/drm/card0/device/power_dpm_force_performance_level' diff --git a/hosts/iroha/scripts/prepare-network-mounts b/hosts/iroha/scripts/prepare-network-mounts index 7559c26..06cf01b 100755 --- a/hosts/iroha/scripts/prepare-network-mounts +++ b/hosts/iroha/scripts/prepare-network-mounts @@ -1,5 +1,4 @@ #! /usr/bin/env sh - -/home/andrew/scripts/mount-nfs /srv/nfs/c /home/andrew/c -/home/andrew/scripts/mount-nfs /srv/nfs/pics /home/andrew/pics -/home/andrew/scripts/mount-nfs /srv/nfs/torrents /mnt/store/files/ext/torrents +$HOME/scripts/mount-nfs /srv/nfs/c /mnt/nfs/c +$HOME/scripts/mount-nfs /srv/nfs/pics /mnt/nfs/pics +$HOME/scripts/mount-nfs /srv/nfs/samba /mnt/nfs/samba diff --git a/hosts/iroha/scripts/rebuild-modules b/hosts/iroha/scripts/rebuild-modules index 9a0d902..ad400f8 100755 --- a/hosts/iroha/scripts/rebuild-modules +++ b/hosts/iroha/scripts/rebuild-modules @@ -1,3 +1,4 @@ #! /usr/bin/env sh -sudo emerge --ask --verbose v4l2loopback xpad-noone \=games-util/xone-0.3_p20240226 nvidia-drivers +#sudo emerge --ask --verbose v4l2loopback xpad-noone \=games-util/xone-0.3_p20240226 nvidia-drivers +sudo emerge --ask --verbose xpad-noone v4l2loopback diff --git a/hosts/iroha/scripts/xbox-controller-battery b/hosts/iroha/scripts/xbox-controller-battery new file mode 100755 index 0000000..84913cc --- /dev/null +++ b/hosts/iroha/scripts/xbox-controller-battery @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +cat /sys/class/power_supply/gip0.0/capacity_level diff --git a/hosts/moyo/samba/smb.conf b/hosts/moyo/samba/smb.conf index 1ca1afa..5781f4f 100644 --- a/hosts/moyo/samba/smb.conf +++ b/hosts/moyo/samba/smb.conf @@ -11,16 +11,16 @@ max log size = 50 passdb backend = tdbsam allow insecure wide links = yes - kernel oplocks = no + kernel oplocks = yes socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=32768 SO_SNDBUF=32768 getwd cache = true acl allow execute always = yes ea support = yes store dos attributes = yes -[code] +[samba] comment = code - path = /srv/nfs/c + path = /srv/nfs/samba valid users = andrew guest ok = no browseable = yes diff --git a/hosts/moyo/scripts/id-dm-device b/hosts/moyo/scripts/id-dm-device new file mode 100755 index 0000000..b7d5781 --- /dev/null +++ b/hosts/moyo/scripts/id-dm-device @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +sudo sudo dmsetup info /dev/$1 diff --git a/hosts/moyo/scripts/mount-luks b/hosts/moyo/scripts/mount-luks index 1d89cd2..5be1aaa 100755 --- a/hosts/moyo/scripts/mount-luks +++ b/hosts/moyo/scripts/mount-luks @@ -1,10 +1,11 @@ #! /usr/bin/env sh + sudo cryptsetup luksOpen /dev/mapper/moyo--vg1-moyo--store0--raid1 moyo-store0 sudo mount /dev/mapper/moyo-store0 /mnt/store0 -sudo mount --bind /mnt/store0/c /srv/nfs/c -sudo mount --bind /mnt/store0/media/pics /srv/nfs/pics -sudo mount --bind /mnt/store0/torrents /srv/nfs/torrents -$HOME/scripts/export-nfs /srv/nfs + +sudo mount --bind /mnt/store0/nfs/c /srv/nfs/c +sudo mount --bind /mnt/store0/nfs/pics /srv/nfs/pics +sudo mount --bind /mnt/store0/nfs/samba /srv/nfs/samba $HOME/scripts/export-nfs /srv/nfs/c $HOME/scripts/export-nfs /srv/nfs/pics -$HOME/scripts/export-nfs /srv/nfs/torrents +$HOME/scripts/export-nfs /srv/nfs/samba diff --git a/hosts/sofue/incus.yaml b/hosts/sofue/incus.yaml index b01d237..407e604 100644 --- a/hosts/sofue/incus.yaml +++ b/hosts/sofue/incus.yaml @@ -29,14 +29,14 @@ container: security.syscalls.intercept.bpf.devices: "true" security.syscalls.intercept.mknod: "true" security.syscalls.intercept.mount: "true" - security.syscalls.intercept.mount.allowed: ext4,fat32,ntfs + security.syscalls.intercept.mount.allowed: ext4,fat32,ntfs,udf security.syscalls.intercept.mount.shift: "true" security.syscalls.intercept.sched_setscheduler: "true" security.syscalls.intercept.setxattr: "true" security.syscalls.intercept.sysinfo: "true" volatile.base_image: b57963b527b192cbd262777b137333def448e7dc21fbf954e75a51f1b8acef5c volatile.cloud-init.instance-id: 8d938ed8-c204-48e1-9670-f3aea059fd57 - volatile.eth0.host_name: veth4220df45 + volatile.eth0.host_name: veth812d6ba0 volatile.eth0.hwaddr: 00:16:3e:c3:79:59 volatile.idmap.base: "0" volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000},{"Isuid":true,"Isgid":false,"Hostid":1000,"Nsid":1000,"Maprange":1},{"Isuid":true,"Isgid":false,"Hostid":1001001,"Nsid":1001,"Maprange":999998999},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":17},{"Isuid":false,"Isgid":true,"Hostid":18,"Nsid":17,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000018,"Nsid":18,"Maprange":82},{"Isuid":false,"Isgid":true,"Hostid":100,"Nsid":100,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000101,"Nsid":101,"Maprange":73},{"Isuid":false,"Isgid":true,"Hostid":97,"Nsid":174,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000175,"Nsid":175,"Maprange":999999825}]' @@ -47,6 +47,12 @@ container: volatile.uuid: 85cd7ef4-2e99-4d9b-ad55-a0b311d3a7d0 volatile.uuid.generation: 85cd7ef4-2e99-4d9b-ad55-a0b311d3a7d0 devices: + 8bitdom30: + gid: "97" + mode: "0666" + productid: "0024" + type: unix-hotplug + vendorid: 0ca3 PipewireSocket1: bind: container connect: unix:/run/user/1000/pipewire-0 @@ -78,6 +84,7 @@ container: type: proxy uid: "1000" binder: + gid: "100" mode: "0666" path: /dev/binder source: /dev/binder @@ -88,8 +95,8 @@ container: source: /dev/sr0 type: unix-block code: - path: /home/andrew/c - source: /home/andrew/c + path: /mnt/nfs/c + source: /mnt/nfs/c type: disk data: path: /mnt/data @@ -105,6 +112,10 @@ container: productid: "0201" type: unix-hotplug vendorid: 04d9 + ext_ssd: + path: /mnt/ext_ssd + source: /mnt/ext_ssd + type: disk googlepixel: mode: "0666" productid: 4ee7 @@ -160,6 +171,7 @@ container: listen: tcp:0.0.0.0:14356 type: proxy hwbinder: + gid: "100" mode: "0666" path: /dev/hwbinder source: /dev/hwbinder @@ -207,8 +219,12 @@ container: pci: 0000:0f:00.0 type: gpu pics: - path: /home/andrew/pics - source: /home/andrew/pics + path: /mnt/nfs/pics + source: /mnt/nfs/pics + type: disk + samba: + path: /mnt/nfs/samba + source: /mnt/nfs/samba type: disk ssd: path: /mnt/ssd @@ -218,10 +234,12 @@ container: path: /mnt/store source: /mnt/store type: disk - torrents: - path: /mnt/store/files/ext/torrents - source: /mnt/store/files/ext/torrents - type: disk + switchpro: + gid: "97" + mode: "0666" + productid: "2009" + type: unix-hotplug + vendorid: 057e tty: mode: "0666" path: /dev/tty @@ -265,6 +283,7 @@ container: source: /dev/video1 type: unix-char vndbinder: + gid: "100" mode: "0666" path: /dev/vndbinder source: /dev/vndbinder @@ -334,14 +353,14 @@ container: security.syscalls.intercept.bpf.devices: "true" security.syscalls.intercept.mknod: "true" security.syscalls.intercept.mount: "true" - security.syscalls.intercept.mount.allowed: ext4,fat32,ntfs + security.syscalls.intercept.mount.allowed: ext4,fat32,ntfs,udf security.syscalls.intercept.mount.shift: "true" security.syscalls.intercept.sched_setscheduler: "true" security.syscalls.intercept.setxattr: "true" security.syscalls.intercept.sysinfo: "true" volatile.base_image: b57963b527b192cbd262777b137333def448e7dc21fbf954e75a51f1b8acef5c volatile.cloud-init.instance-id: 8d938ed8-c204-48e1-9670-f3aea059fd57 - volatile.eth0.host_name: veth4220df45 + volatile.eth0.host_name: veth812d6ba0 volatile.eth0.hwaddr: 00:16:3e:c3:79:59 volatile.idmap.base: "0" volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000},{"Isuid":true,"Isgid":false,"Hostid":1000,"Nsid":1000,"Maprange":1},{"Isuid":true,"Isgid":false,"Hostid":1001001,"Nsid":1001,"Maprange":999998999},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":17},{"Isuid":false,"Isgid":true,"Hostid":18,"Nsid":17,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000018,"Nsid":18,"Maprange":82},{"Isuid":false,"Isgid":true,"Hostid":100,"Nsid":100,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000101,"Nsid":101,"Maprange":73},{"Isuid":false,"Isgid":true,"Hostid":97,"Nsid":174,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000175,"Nsid":175,"Maprange":999999825}]' @@ -352,6 +371,12 @@ container: volatile.uuid: 85cd7ef4-2e99-4d9b-ad55-a0b311d3a7d0 volatile.uuid.generation: 85cd7ef4-2e99-4d9b-ad55-a0b311d3a7d0 expanded_devices: + 8bitdom30: + gid: "97" + mode: "0666" + productid: "0024" + type: unix-hotplug + vendorid: 0ca3 PipewireSocket1: bind: container connect: unix:/run/user/1000/pipewire-0 @@ -383,6 +408,7 @@ container: type: proxy uid: "1000" binder: + gid: "100" mode: "0666" path: /dev/binder source: /dev/binder @@ -393,8 +419,8 @@ container: source: /dev/sr0 type: unix-block code: - path: /home/andrew/c - source: /home/andrew/c + path: /mnt/nfs/c + source: /mnt/nfs/c type: disk data: path: /mnt/data @@ -414,6 +440,10 @@ container: name: eth0 network: incusbr0 type: nic + ext_ssd: + path: /mnt/ext_ssd + source: /mnt/ext_ssd + type: disk googlepixel: mode: "0666" productid: 4ee7 @@ -469,6 +499,7 @@ container: listen: tcp:0.0.0.0:14356 type: proxy hwbinder: + gid: "100" mode: "0666" path: /dev/hwbinder source: /dev/hwbinder @@ -516,13 +547,17 @@ container: pci: 0000:0f:00.0 type: gpu pics: - path: /home/andrew/pics - source: /home/andrew/pics + path: /mnt/nfs/pics + source: /mnt/nfs/pics type: disk root: path: / pool: default type: disk + samba: + path: /mnt/nfs/samba + source: /mnt/nfs/samba + type: disk ssd: path: /mnt/ssd source: /mnt/ssd @@ -531,10 +566,12 @@ container: path: /mnt/store source: /mnt/store type: disk - torrents: - path: /mnt/store/files/ext/torrents - source: /mnt/store/files/ext/torrents - type: disk + switchpro: + gid: "97" + mode: "0666" + productid: "2009" + type: unix-hotplug + vendorid: 057e tty: mode: "0666" path: /dev/tty @@ -578,6 +615,7 @@ container: source: /dev/video1 type: unix-char vndbinder: + gid: "100" mode: "0666" path: /dev/vndbinder source: /dev/vndbinder @@ -609,7 +647,7 @@ container: name: sofue status: Running status_code: 103 - last_used_at: 2025-05-02T10:45:55.80642907Z + last_used_at: 2025-05-27T23:32:26.92570937Z location: none type: container project: iroha diff --git a/hosts/yashinoki/configuration.nix b/hosts/yashinoki/configuration.nix index 06a6700..932637a 100644 --- a/hosts/yashinoki/configuration.nix +++ b/hosts/yashinoki/configuration.nix @@ -139,7 +139,7 @@ in { }; users.users.andrew.extraGroups = [ "networkmanager" ]; - fileSystems."/home/andrew/c" = { + fileSystems."/mnt/nfs/c" = { device = "moyo:/srv/nfs/c"; fsType = "nfs4"; options = disks.nfs_options; diff --git a/nix/programs/bash.nix b/nix/programs/bash.nix index ca6b7d9..4fb9cd3 100644 --- a/nix/programs/bash.nix +++ b/nix/programs/bash.nix @@ -9,7 +9,7 @@ programs.bash = { enable = true; shellAliases = { - cp = "rsync -avz"; + cp = "rsync -av"; top = "htop"; bc = "bc -l"; pgrep = "pgrep -f"; diff --git a/nix/programs/kitty.nix b/nix/programs/kitty.nix index c070871..74b6c6a 100644 --- a/nix/programs/kitty.nix +++ b/nix/programs/kitty.nix @@ -17,7 +17,6 @@ in { mode = "enabled"; enableBashIntegration = true; }; - # @TODO: https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.active_tab_title_template extraConfig = '' shell ${pkgs.bashInteractive}/bin/bash --login update_check_interval 0 @@ -41,6 +40,7 @@ in { cursor_trail_decay 0.075 0.425 cursor_trail_start_threshold 3 cursor #${colo.foreground} + #cursor none cursor_text_color background foreground #${colo.foreground} background #${colo.background} @@ -72,6 +72,11 @@ in { active_border_color #${colo.color4} bell_border_color #${colo.color1} inactive_border_color #${colo.color3} + active_tab_foreground #${colo.background} + active_tab_background #${colo.color5} + active_tab_font_style bold-italic + inactive_tab_foreground #${colo.background} + inactive_tab_background #${colo.color4} url_color #${colo.color5} enabled_layouts splits,stack ''; @@ -79,12 +84,12 @@ in { home.file.".config/kitty/quick-access-terminal.conf".text = '' lines 18 background_opacity 0.925 + output_name ${loc.monitors.monitor1} kitty_override startup_session=quick-access-session.conf kitty_override placement_strategy=bottom-right kitty_override window_padding_width=0 12 8 0 ''; home.file.".config/kitty/quick-access-session.conf".text = '' - output_name ${loc.monitors.monitor1} layout splits launch --var window=main launch --location=vsplit --bias=17.1 /home/andrew/dl/tmp/clock/a.out diff --git a/nix/programs/nvim.nix b/nix/programs/nvim.nix index 5c70f35..b12ad52 100644 --- a/nix/programs/nvim.nix +++ b/nix/programs/nvim.nix @@ -185,7 +185,7 @@ in { footer_offset = ${toString s.footer-offset}, picture = { path = '${s.picture}', - kitty = true, + kitty = os.getenv('TERM') == 'xterm-kitty', width = ${toString s.width}, position = '${s.position}', padding = { diff --git a/nix/scripts.nix b/nix/scripts.nix index e8c63f6..c965157 100644 --- a/nix/scripts.nix +++ b/nix/scripts.nix @@ -21,7 +21,7 @@ in { '') ] ++ (lib.lists.forEach loc.scripts.imports (x: pkgs.writeTextFile { name = x; - text = (builtins.readFile ../scripts/${x}); + text = (builtins.readFile ../scripts/desktop/${x}); executable = true; destination = "/bin/${x}"; })); diff --git a/nix/system.nix b/nix/system.nix index 5f1943e..92b95df 100644 --- a/nix/system.nix +++ b/nix/system.nix @@ -87,6 +87,7 @@ appimage-run i2c-tools pciutils + smartmontools lm_sensors libdrm libva-utils diff --git a/nix/user.nix b/nix/user.nix index 0050182..01d6e84 100644 --- a/nix/user.nix +++ b/nix/user.nix @@ -108,6 +108,7 @@ in { "ts-date" "term-font-size" "shift-jis-zip" + "7z-password" "moonrune-charset-utf8" "gpg-pubkey" "img-fstype" diff --git a/scripts/battery b/scripts/battery deleted file mode 100755 index c09992a..0000000 --- a/scripts/battery +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env sh -shopt -s nullglob -for bat in /sys/class/power_supply/BAT* -do -cat $bat/{capacity,status} -done diff --git a/scripts/cpu-vulns b/scripts/cpu-vulns deleted file mode 100755 index e55ad9c..0000000 --- a/scripts/cpu-vulns +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -tail -n +1 /sys/devices/system/cpu/vulnerabilities/* diff --git a/scripts/dbus-sway-environment b/scripts/dbus-sway-environment deleted file mode 100755 index 249d610..0000000 --- a/scripts/dbus-sway-environment +++ /dev/null @@ -1,5 +0,0 @@ -#! /usr/bin/env sh - -dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK -systemctl --user stop pipewire{,-pulse}.{socket,service} xdg-desktop-portal xdg-desktop-portal-wlr -systemctl --user start pipewire{,-pulse}.{socket,service} xdg-desktop-portal xdg-desktop-portal-wlr diff --git a/scripts/desktop/7z-password b/scripts/desktop/7z-password new file mode 100755 index 0000000..72e90f9 --- /dev/null +++ b/scripts/desktop/7z-password @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +7z a -p -mhe=on $1 $2 diff --git a/scripts/desktop/battery b/scripts/desktop/battery new file mode 100755 index 0000000..c09992a --- /dev/null +++ b/scripts/desktop/battery @@ -0,0 +1,6 @@ +#! /usr/bin/env sh +shopt -s nullglob +for bat in /sys/class/power_supply/BAT* +do +cat $bat/{capacity,status} +done diff --git a/scripts/desktop/cpu-vulns b/scripts/desktop/cpu-vulns new file mode 100755 index 0000000..e55ad9c --- /dev/null +++ b/scripts/desktop/cpu-vulns @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +tail -n +1 /sys/devices/system/cpu/vulnerabilities/* diff --git a/scripts/desktop/dbus-sway-environment b/scripts/desktop/dbus-sway-environment new file mode 100755 index 0000000..249d610 --- /dev/null +++ b/scripts/desktop/dbus-sway-environment @@ -0,0 +1,5 @@ +#! /usr/bin/env sh + +dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK +systemctl --user stop pipewire{,-pulse}.{socket,service} xdg-desktop-portal xdg-desktop-portal-wlr +systemctl --user start pipewire{,-pulse}.{socket,service} xdg-desktop-portal xdg-desktop-portal-wlr diff --git a/scripts/desktop/discord-wayland b/scripts/desktop/discord-wayland new file mode 100755 index 0000000..ec8a106 --- /dev/null +++ b/scripts/desktop/discord-wayland @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +discord --ignore-gpu-blocklist --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=VaapiVideoDecoder --use-gl=desktop --enable-gpu-rasterization --enable-zero-copy diff --git a/scripts/desktop/dmenu-emoji b/scripts/desktop/dmenu-emoji new file mode 100755 index 0000000..07c1900 --- /dev/null +++ b/scripts/desktop/dmenu-emoji @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +jq -r ".[] | .emoji + \" \" + (.aliases[0])" /etc/emoji.json diff --git a/scripts/desktop/dmenu-path b/scripts/desktop/dmenu-path new file mode 100755 index 0000000..9c8122a --- /dev/null +++ b/scripts/desktop/dmenu-path @@ -0,0 +1,3 @@ +#! /usr/bin/env sh +# https://github.com/ema/dotfiles/blob/fb7f5cab530daba74edefb9cecb401262db063a9/bin/dmenu_path +printf $PATH -print0 | tr ':' '\0' | uniq -z | xargs -0 ls -Llu --time-style=+%s | awk '/^(-|l)/ { printf $6" "$7"\n" }' | sort -rn | cut -d' ' -f 2 diff --git a/scripts/desktop/dmenu-path0 b/scripts/desktop/dmenu-path0 new file mode 100755 index 0000000..593ecf6 --- /dev/null +++ b/scripts/desktop/dmenu-path0 @@ -0,0 +1,3 @@ +#! /usr/bin/env sh +# https://github.com/ema/dotfiles/blob/fb7f5cab530daba74edefb9cecb401262db063a9/bin/dmenu_path +printf $PATH -print0 | tr ':' '\0' | uniq -z | xargs -0 ls -Llu --time-style=+%s | awk '/^(-|l)/ { printf $6" "$7"\0" }' | sort -zrn | cut -z -d' ' -f 2 diff --git a/scripts/desktop/gpg-pubkey b/scripts/desktop/gpg-pubkey new file mode 100755 index 0000000..5353972 --- /dev/null +++ b/scripts/desktop/gpg-pubkey @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +gpg --export -a "Andrew Opalach " diff --git a/scripts/desktop/img-fstype b/scripts/desktop/img-fstype new file mode 100755 index 0000000..82df6b8 --- /dev/null +++ b/scripts/desktop/img-fstype @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +blkid -o value -s TYPE $1 diff --git a/scripts/desktop/install-as-needed b/scripts/desktop/install-as-needed new file mode 100755 index 0000000..9db4ff1 --- /dev/null +++ b/scripts/desktop/install-as-needed @@ -0,0 +1,5 @@ +#! /usr/bin/env sh +export NIXPKGS_ALLOW_UNFREE=1 +PKG=$1 +shift +nix shell --impure --expr "with (import (builtins.getFlake ''nixpkgs'') {});$PKG" --command "$@" diff --git a/scripts/desktop/looking-glass b/scripts/desktop/looking-glass new file mode 100755 index 0000000..5ce9cf4 --- /dev/null +++ b/scripts/desktop/looking-glass @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +looking-glass-client -c 192.168.1.192 -f /dev/shm2/looking-glass win:dontUpscale diff --git a/scripts/desktop/moonrune-charset-utf8 b/scripts/desktop/moonrune-charset-utf8 new file mode 100755 index 0000000..d3e8343 --- /dev/null +++ b/scripts/desktop/moonrune-charset-utf8 @@ -0,0 +1,6 @@ +#! /usr/bin/env bash +if [[ "$1" == "china"]]; then + iconv -f GBK -t UTF8 "$2" -o "$3" +elif [[ "$1" == "jp"]]; then + iconv -f SHIFT-JIS -t UTF8 "$2" -o "$3" +fi diff --git a/scripts/desktop/mount-nfs b/scripts/desktop/mount-nfs new file mode 100755 index 0000000..a07f4cf --- /dev/null +++ b/scripts/desktop/mount-nfs @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +sudo mount -t nfs4 -o noatime,nodiratime,rw,hard,fsc,proto=tcp,timeo=600,retrans=2,nfsvers=4,minorversion=2 moyo:$1 $2 diff --git a/scripts/desktop/rewrite-git b/scripts/desktop/rewrite-git new file mode 100755 index 0000000..b48ba4d --- /dev/null +++ b/scripts/desktop/rewrite-git @@ -0,0 +1,8 @@ +#! /usr/bin/env sh +git filter-branch --commit-filter ' + GIT_AUTHOR_NAME="Andrew Opalach"; + GIT_AUTHOR_EMAIL="andrew@akon.city"; + GIT_COMMITTER_NAME="Andrew Opalach"; + GIT_COMMITTER_EMAIL="andrew@akon.city"; + git commit-tree -S "$@"; +' HEAD diff --git a/scripts/desktop/screenshot b/scripts/desktop/screenshot new file mode 100755 index 0000000..ddeb73a --- /dev/null +++ b/scripts/desktop/screenshot @@ -0,0 +1,48 @@ +#! /usr/bin/env bash + +if [[ $1 == "qrcode" || $1 == "color" ]]; then + mime_type="text/plain" +else + dir="$HOME/pics/screenshots/`date +'%m-%Y'`" + if [ ! -d $dir ]; then mkdir -p $dir; fi + while : ; do + filename="screenshot-`date +'%m-%d-%y'`-`hexdump -n 3 -e '1/4 "%02X"' /dev/random`" + [ -e $dir/$filename.* ] || break + done + if [[ $1 == "video" ]]; then + output="$dir/$filename"".mkv" + mime_type="video/x-matroska" + else + output="$dir/$filename"".png" + mime_type="image/png" + fi +fi + +parseqr () { zbarimg -q1 - | cut -d ':' -f 2-; } +parsecolor () { magick - -format '%[pixel:p{0,0}]' txt:- | awk 'END {printf $3}'; } + +if [[ $XDG_SESSION_TYPE == "wayland" ]]; then + copy="wl-copy -t $mime_type" + case $1 in + "qrcode") grim -t png -g "$(slurp)" - | parseqr | $copy ;; + "color") grim -t ppm -g "$(slurp -p)" - | parsecolor | $copy ;; + "video") wf-recorder -a -g "$(slurp)" -f $output ;; + "main") grim -t png -o DP-1 $output ;; + "full") grim -t png $output ;; + "output") grim -t png -g "$(slurp -o)" $output ;; + *) grim -t png -g "$(slurp)" $output ;; + esac +else + copy="xclip -selection clipboard -target $mime_type -i" + case $1 in + "full") import -window root $output ;; + *) + area=$(slop -f "%g") || exit 1 + read -r G < <(echo $area) + import -window root -crop $G $output ;; + esac +fi + +if [[ $1 != "qrcode" && $1 != "color" && $1 != "video" && -f $output ]]; then + cat $output | $copy; +fi diff --git a/scripts/desktop/shift-jis-zip b/scripts/desktop/shift-jis-zip new file mode 100755 index 0000000..30dab2e --- /dev/null +++ b/scripts/desktop/shift-jis-zip @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +unzip -O shift-jis "$1" diff --git a/scripts/desktop/sp b/scripts/desktop/sp new file mode 100755 index 0000000..19d38a1 --- /dev/null +++ b/scripts/desktop/sp @@ -0,0 +1,6 @@ +#! /usr/bin/env sh +if [ $# -eq 0 ]; then + wl-paste | aspell -a +else + echo "$@" | aspell -a +fi diff --git a/scripts/desktop/term-font-size b/scripts/desktop/term-font-size new file mode 100755 index 0000000..0637b12 --- /dev/null +++ b/scripts/desktop/term-font-size @@ -0,0 +1,20 @@ +#! /usr/bin/env python3 + +import array +import fcntl +import termios +import os + +def get_term_res(): + buf = array.array('H', [0, 0, 0, 0]) + fcntl.ioctl(1, termios.TIOCGWINSZ, buf) + return buf[2], buf[3] + +def get_term_dimensions(): + return os.get_terminal_size() + +x_px, y_px = get_term_res() +size = get_term_dimensions() +x_cell, y_cell = size.columns, size.lines + +print('width : {}, height: {}'.format(x_px / float(x_cell), y_px / float(y_cell))) diff --git a/scripts/desktop/ts-date b/scripts/desktop/ts-date new file mode 100755 index 0000000..f16517f --- /dev/null +++ b/scripts/desktop/ts-date @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +date -d @$1 diff --git a/scripts/desktop/wlsunset-toggle b/scripts/desktop/wlsunset-toggle new file mode 100755 index 0000000..7dcd06e --- /dev/null +++ b/scripts/desktop/wlsunset-toggle @@ -0,0 +1,10 @@ +#! /usr/bin/env sh +# | +CORDS=$(cat $HOME/.config/home-cords || echo '') +LAT=$(echo $CORDS | cut -d '|' -f 1) +LONG=$(echo $CORDS | cut -d '|' -f 2) +if pidof wlsunset; then + pkill wlsunset +else + wlsunset -l $LAT -L $LONG & +fi diff --git a/scripts/desktop/xbox360-ffmpeg-enc b/scripts/desktop/xbox360-ffmpeg-enc new file mode 100755 index 0000000..aab754f --- /dev/null +++ b/scripts/desktop/xbox360-ffmpeg-enc @@ -0,0 +1,2 @@ +#! /usr/bin/env sh +ffmpeg -i "$1" -c:a aac -strict experimental -ac 2 -c:v libx264 -profile:v high -crf 23 "$2" diff --git a/scripts/discord-wayland b/scripts/discord-wayland deleted file mode 100755 index ec8a106..0000000 --- a/scripts/discord-wayland +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -discord --ignore-gpu-blocklist --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=VaapiVideoDecoder --use-gl=desktop --enable-gpu-rasterization --enable-zero-copy diff --git a/scripts/dmenu-emoji b/scripts/dmenu-emoji deleted file mode 100755 index 07c1900..0000000 --- a/scripts/dmenu-emoji +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -jq -r ".[] | .emoji + \" \" + (.aliases[0])" /etc/emoji.json diff --git a/scripts/dmenu-path b/scripts/dmenu-path deleted file mode 100755 index 9c8122a..0000000 --- a/scripts/dmenu-path +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/env sh -# https://github.com/ema/dotfiles/blob/fb7f5cab530daba74edefb9cecb401262db063a9/bin/dmenu_path -printf $PATH -print0 | tr ':' '\0' | uniq -z | xargs -0 ls -Llu --time-style=+%s | awk '/^(-|l)/ { printf $6" "$7"\n" }' | sort -rn | cut -d' ' -f 2 diff --git a/scripts/dmenu-path0 b/scripts/dmenu-path0 deleted file mode 100755 index 593ecf6..0000000 --- a/scripts/dmenu-path0 +++ /dev/null @@ -1,3 +0,0 @@ -#! /usr/bin/env sh -# https://github.com/ema/dotfiles/blob/fb7f5cab530daba74edefb9cecb401262db063a9/bin/dmenu_path -printf $PATH -print0 | tr ':' '\0' | uniq -z | xargs -0 ls -Llu --time-style=+%s | awk '/^(-|l)/ { printf $6" "$7"\0" }' | sort -zrn | cut -z -d' ' -f 2 diff --git a/scripts/gpg-pubkey b/scripts/gpg-pubkey deleted file mode 100755 index 5353972..0000000 --- a/scripts/gpg-pubkey +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -gpg --export -a "Andrew Opalach " diff --git a/scripts/img-fstype b/scripts/img-fstype deleted file mode 100755 index 82df6b8..0000000 --- a/scripts/img-fstype +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -blkid -o value -s TYPE $1 diff --git a/scripts/install-as-needed b/scripts/install-as-needed deleted file mode 100755 index 9db4ff1..0000000 --- a/scripts/install-as-needed +++ /dev/null @@ -1,5 +0,0 @@ -#! /usr/bin/env sh -export NIXPKGS_ALLOW_UNFREE=1 -PKG=$1 -shift -nix shell --impure --expr "with (import (builtins.getFlake ''nixpkgs'') {});$PKG" --command "$@" diff --git a/scripts/looking-glass b/scripts/looking-glass deleted file mode 100755 index 5ce9cf4..0000000 --- a/scripts/looking-glass +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -looking-glass-client -c 192.168.1.192 -f /dev/shm2/looking-glass win:dontUpscale diff --git a/scripts/moonrune-charset-utf8 b/scripts/moonrune-charset-utf8 deleted file mode 100755 index d3e8343..0000000 --- a/scripts/moonrune-charset-utf8 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash -if [[ "$1" == "china"]]; then - iconv -f GBK -t UTF8 "$2" -o "$3" -elif [[ "$1" == "jp"]]; then - iconv -f SHIFT-JIS -t UTF8 "$2" -o "$3" -fi diff --git a/scripts/mount-nfs b/scripts/mount-nfs deleted file mode 100755 index a07f4cf..0000000 --- a/scripts/mount-nfs +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -sudo mount -t nfs4 -o noatime,nodiratime,rw,hard,fsc,proto=tcp,timeo=600,retrans=2,nfsvers=4,minorversion=2 moyo:$1 $2 diff --git a/scripts/rewrite-git b/scripts/rewrite-git deleted file mode 100755 index b48ba4d..0000000 --- a/scripts/rewrite-git +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env sh -git filter-branch --commit-filter ' - GIT_AUTHOR_NAME="Andrew Opalach"; - GIT_AUTHOR_EMAIL="andrew@akon.city"; - GIT_COMMITTER_NAME="Andrew Opalach"; - GIT_COMMITTER_EMAIL="andrew@akon.city"; - git commit-tree -S "$@"; -' HEAD diff --git a/scripts/screenshot b/scripts/screenshot deleted file mode 100755 index ddeb73a..0000000 --- a/scripts/screenshot +++ /dev/null @@ -1,48 +0,0 @@ -#! /usr/bin/env bash - -if [[ $1 == "qrcode" || $1 == "color" ]]; then - mime_type="text/plain" -else - dir="$HOME/pics/screenshots/`date +'%m-%Y'`" - if [ ! -d $dir ]; then mkdir -p $dir; fi - while : ; do - filename="screenshot-`date +'%m-%d-%y'`-`hexdump -n 3 -e '1/4 "%02X"' /dev/random`" - [ -e $dir/$filename.* ] || break - done - if [[ $1 == "video" ]]; then - output="$dir/$filename"".mkv" - mime_type="video/x-matroska" - else - output="$dir/$filename"".png" - mime_type="image/png" - fi -fi - -parseqr () { zbarimg -q1 - | cut -d ':' -f 2-; } -parsecolor () { magick - -format '%[pixel:p{0,0}]' txt:- | awk 'END {printf $3}'; } - -if [[ $XDG_SESSION_TYPE == "wayland" ]]; then - copy="wl-copy -t $mime_type" - case $1 in - "qrcode") grim -t png -g "$(slurp)" - | parseqr | $copy ;; - "color") grim -t ppm -g "$(slurp -p)" - | parsecolor | $copy ;; - "video") wf-recorder -a -g "$(slurp)" -f $output ;; - "main") grim -t png -o DP-1 $output ;; - "full") grim -t png $output ;; - "output") grim -t png -g "$(slurp -o)" $output ;; - *) grim -t png -g "$(slurp)" $output ;; - esac -else - copy="xclip -selection clipboard -target $mime_type -i" - case $1 in - "full") import -window root $output ;; - *) - area=$(slop -f "%g") || exit 1 - read -r G < <(echo $area) - import -window root -crop $G $output ;; - esac -fi - -if [[ $1 != "qrcode" && $1 != "color" && $1 != "video" && -f $output ]]; then - cat $output | $copy; -fi diff --git a/scripts/shift-jis-zip b/scripts/shift-jis-zip deleted file mode 100755 index 30dab2e..0000000 --- a/scripts/shift-jis-zip +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -unzip -O shift-jis "$1" diff --git a/scripts/sp b/scripts/sp deleted file mode 100755 index 19d38a1..0000000 --- a/scripts/sp +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env sh -if [ $# -eq 0 ]; then - wl-paste | aspell -a -else - echo "$@" | aspell -a -fi diff --git a/scripts/sync/diff.sh b/scripts/sync/diff.sh new file mode 100755 index 0000000..61ff628 --- /dev/null +++ b/scripts/sync/diff.sh @@ -0,0 +1,8 @@ +#! /usr/bin/env sh +set -e +REMOTE="$(cat remote)" +if [ ! -d $REMOTE ]; then + echo "Path $REMOTE does not exist." + exit 1 +fi +diff --brief --recursive --new-file --no-dereference . $REMOTE diff --git a/scripts/sync/pull.sh b/scripts/sync/pull.sh new file mode 100755 index 0000000..1bf5b48 --- /dev/null +++ b/scripts/sync/pull.sh @@ -0,0 +1,34 @@ +#! /usr/bin/env sh + +set -e + +SOURCE="$(cat remote)/" +if [ ! -d $SOURCE ]; then + echo "Path $SOURCE does not exist." + exit 1 +fi + +ARGS=() +FORCE=0 +while getopts 'cfdr' opt; do + case "$opt" in + c) # Changes + ARGS+=('--delete') + ;; + f) # Full + ARGS+=('--checksum') + ;; + d) # Dry + ARGS+=('--dry-run') + ;; + r) # Revert + FORCE=1 + ;; + esac +done + +if [ $FORCE = 0 ]; then + ARGS+=('--update') +fi + +rsync --archive --itemize-changes "${ARGS[@]}" $SOURCE . diff --git a/scripts/sync/push.sh b/scripts/sync/push.sh new file mode 100755 index 0000000..3adbd02 --- /dev/null +++ b/scripts/sync/push.sh @@ -0,0 +1,34 @@ +#! /usr/bin/env sh + +set -e + +DEST="$(cat remote)" +if [ ! -d $DEST ]; then + echo "Path $DEST does not exist." + exit 1 +fi + +ARGS=() +FORCE=0 +while getopts 'cfdr' opt; do + case "$opt" in + c) # Changes + ARGS+=('--delete') + ;; + f) # Full + ARGS+=('--checksum') + ;; + d) # Dry + ARGS+=('--dry-run') + ;; + r) # Revert + FORCE=1 + ;; + esac +done + +if [ $FORCE = 0 ]; then + ARGS+=('--update') +fi + +rsync --archive --itemize-changes "${ARGS[@]}" ./ $DEST diff --git a/scripts/term-font-size b/scripts/term-font-size deleted file mode 100755 index 0637b12..0000000 --- a/scripts/term-font-size +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/bin/env python3 - -import array -import fcntl -import termios -import os - -def get_term_res(): - buf = array.array('H', [0, 0, 0, 0]) - fcntl.ioctl(1, termios.TIOCGWINSZ, buf) - return buf[2], buf[3] - -def get_term_dimensions(): - return os.get_terminal_size() - -x_px, y_px = get_term_res() -size = get_term_dimensions() -x_cell, y_cell = size.columns, size.lines - -print('width : {}, height: {}'.format(x_px / float(x_cell), y_px / float(y_cell))) diff --git a/scripts/ts-date b/scripts/ts-date deleted file mode 100755 index f16517f..0000000 --- a/scripts/ts-date +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -date -d @$1 diff --git a/scripts/wlsunset-toggle b/scripts/wlsunset-toggle deleted file mode 100755 index 7dcd06e..0000000 --- a/scripts/wlsunset-toggle +++ /dev/null @@ -1,10 +0,0 @@ -#! /usr/bin/env sh -# | -CORDS=$(cat $HOME/.config/home-cords || echo '') -LAT=$(echo $CORDS | cut -d '|' -f 1) -LONG=$(echo $CORDS | cut -d '|' -f 2) -if pidof wlsunset; then - pkill wlsunset -else - wlsunset -l $LAT -L $LONG & -fi diff --git a/scripts/xbox360-ffmpeg-enc b/scripts/xbox360-ffmpeg-enc deleted file mode 100755 index aab754f..0000000 --- a/scripts/xbox360-ffmpeg-enc +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env sh -ffmpeg -i "$1" -c:a aac -strict experimental -ac 2 -c:v libx264 -profile:v high -crf 23 "$2" -- cgit v1.2.3-101-g0448