diff --git a/QtProject.conf b/QtProject.conf index e46b631..91d9d39 100644 --- a/QtProject.conf +++ b/QtProject.conf @@ -1,8 +1,8 @@ [FileDialog] -history=file:///home/klein/Downloads, file:///home/klein, file:///home/klein/Videos/Screenrecords, file:///home/klein/Downloads/DeDRM, file:///home/klein/Pictures/screenshots +history=file:///home/klein/Downloads/DeDRM, file:///home/klein/Pictures/screenshots, file:///home/klein/codeWS/Python3/tone_generator/waveform_visualizer, file:///home/klein/codeWS/C/ZenithLock, file:///home/klein, file:///home/klein/Downloads lastVisited=file:///home/klein/Downloads qtVersion=5.15.8 shortcuts=file:, file:///home/klein sidebarWidth=90 -treeViewHeader=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\x3\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1\xec\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0\xff\0\0\0\x1\0\0\0\0\0\0\0?\0\0\0\x1\0\0\0\0\0\0\0@\0\0\0\x1\0\0\0\0\0\0\0n\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff) +treeViewHeader=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1\xec\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0\xff\0\0\0\x1\0\0\0\0\0\0\0?\0\0\0\x1\0\0\0\0\0\0\0@\0\0\0\x1\0\0\0\0\0\0\0n\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff) viewMode=Detail diff --git a/htop/htoprc b/htop/htoprc index f633fdb..a98e7d3 100644 --- a/htop/htoprc +++ b/htop/htoprc @@ -39,14 +39,14 @@ column_meter_modes_0=1 1 1 column_meters_1=RightCPUs2 Tasks LoadAverage Uptime column_meter_modes_1=1 2 2 2 tree_view=0 -sort_key=46 +sort_key=47 tree_sort_key=0 sort_direction=-1 tree_sort_direction=1 tree_view_always_by_pid=0 all_branches_collapsed=0 screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command -.sort_key=PERCENT_CPU +.sort_key=PERCENT_MEM .tree_sort_key=PID .tree_view=0 .tree_view_always_by_pid=0 diff --git a/nvim/init.lua b/nvim/init.lua index 2f4b12f..1170fa0 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -12,3 +12,17 @@ require('vimwiki') -- Load Compilation Integrations: require('compilation').setup() + +-- Load and setup Encrypted File Handler. +require("encrypted_file_handler").setup({ + prompt_method = "vim_ui", -- change to "dmenu" or "terminal" if desired + decryption_methods = { + -- Optionally, define custom methods for non-standard extensions: + -- vault = function(pass, orig, tmp) + -- return string.format("my_custom_decrypt -i %s -o %s -p %s", vim.fn.shellescape(orig), vim.fn.shellescape(tmp), vim.fn.shellescape(pass)) + -- end, + }, + cleanup_timeout = 0, -- set a timeout (in seconds) if you prefer auto-deletion after some time + debug = false, +}) + diff --git a/nvim/lua/encrypted_file_handler.lua b/nvim/lua/encrypted_file_handler.lua new file mode 100644 index 0000000..04b703e --- /dev/null +++ b/nvim/lua/encrypted_file_handler.lua @@ -0,0 +1,234 @@ +-- File: lua/encrypted_file_handler.lua +local M = {} + +-- Default configuration; users can override these via setup() +local config = { + -- Patterns for encrypted files (Lua patterns, so escape the dot) + file_patterns = { "%.pgp$", "%.gpg$", "%.enc$", "%.aes$", "%.kdbx$", "%.vault$" }, + -- Passphrase prompt method: "vim_ui", "dmenu", or "terminal" + prompt_method = "vim_ui", + -- Custom decryption methods by extension; leave empty to use builtins + -- e.g., config.decryption_methods["kdbx"] = function(pass, orig, tmp) ... end + decryption_methods = {}, + -- Automatically delete decrypted temp file when buffer is closed + auto_cleanup = true, + -- Optional timeout (in seconds) to auto-delete decrypted file (0 = disabled) + cleanup_timeout = 0, + -- Debug flag (prints extra info) + debug = false, +} + +-- Merge user config with defaults +function M.setup(user_config) + config = vim.tbl_extend("force", config, user_config or {}) + if config.debug then + print("Encrypted file handler loaded with config:") + print(vim.inspect(config)) + end + M.setup_autocmds() +end + +-- Check if the filename matches any encrypted file pattern +local function is_encrypted_file(filename) + for _, pattern in ipairs(config.file_patterns) do + if filename:match(pattern) then + return true + end + end + return false +end + +-- Prompt the user for a passphrase via different methods. +-- The callback is called with the entered passphrase. +local function prompt_passphrase(callback) + if config.prompt_method == "vim_ui" then + vim.ui.input({ prompt = "Enter decryption passphrase: ", secret = true }, function(input) + callback(input) + end) + elseif config.prompt_method == "dmenu" then + -- dmenu: call it synchronously via io.popen + local handle = io.popen("dmenu -p 'Enter decryption passphrase:'") + local result = handle:read("*a") or "" + handle:close() + result = result:gsub("\n", "") -- trim newline + callback(result) + elseif config.prompt_method == "terminal" then + -- Terminal: create a temporary floating window to ask for input. + local bufnr = vim.api.nvim_create_buf(false, true) + local width = 50 + local height = 1 + local opts = { + relative = "editor", + width = width, + height = height, + row = (vim.o.lines - height) / 2, + col = (vim.o.columns - width) / 2, + border = "single", + } + local win = vim.api.nvim_open_win(bufnr, true, opts) + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "Enter decryption passphrase:" }) + -- Fallback: use vim.fn.input for capturing input (note: this does not hide the input) + local result = vim.fn.input("Passphrase: ") + vim.api.nvim_buf_delete(bufnr, { force = true }) + callback(result) + else + -- Default fallback: vim.ui.input + vim.ui.input({ prompt = "Enter decryption passphrase: ", secret = true }, function(input) + callback(input) + end) + end +end + +-- Built-in decryption command generators +local builtin_methods = { + pgp = function(pass, orig, tmp) + -- GPG: passphrase is fed via stdin using --passphrase-fd 0 + return string.format("gpg --batch --yes --passphrase-fd 0 --output %s --decrypt %s", + vim.fn.shellescape(tmp), vim.fn.shellescape(orig)) + end, + gpg = function(pass, orig, tmp) + return string.format("gpg --batch --yes --passphrase-fd 0 --output %s --decrypt %s", + vim.fn.shellescape(tmp), vim.fn.shellescape(orig)) + end, + enc = function(pass, orig, tmp) + -- OpenSSL: passphrase is provided inline (note: this exposes it in the process list) + return string.format("openssl enc -aes-256-cbc -d -in %s -out %s -pass pass:%s", + vim.fn.shellescape(orig), vim.fn.shellescape(tmp), vim.fn.shellescape(pass)) + end, + aes = function(pass, orig, tmp) + return string.format("openssl enc -aes-256-cbc -d -in %s -out %s -pass pass:%s", + vim.fn.shellescape(orig), vim.fn.shellescape(tmp), vim.fn.shellescape(pass)) + end, +} + +-- Determines which decryption command to use based on the file extension. +-- Returns the command string or nil plus an error message. +local function get_decryption_command(ext, pass, orig, tmp) + ext = ext:lower() + local method = nil + if ext == "pgp" or ext == "gpg" then + method = config.decryption_methods[ext] or builtin_methods.gpg + elseif ext == "enc" or ext == "aes" then + method = config.decryption_methods[ext] or builtin_methods.enc + else + -- For custom types (e.g. kdbx, vault), require a user-supplied method. + method = config.decryption_methods[ext] + if not method then + return nil, "No decryption method defined for extension: " .. ext + end + end + if type(method) == "function" then + return method(pass, orig, tmp) + elseif type(method) == "string" then + return string.format(method, vim.fn.shellescape(tmp), vim.fn.shellescape(orig), vim.fn.shellescape(pass)) + else + return nil, "Invalid decryption method configuration for extension: " .. ext + end +end + +-- Decrypts the file and opens the decrypted content in a new, secure buffer. +function M.decrypt_and_open(original_file) + local ext = original_file:match("^.+%.([^.]+)$") + if not ext then + print("Unable to determine file extension for decryption.") + return + end + + prompt_passphrase(function(passphrase) + if not passphrase or passphrase == "" then + print("Decryption cancelled: No passphrase provided.") + return + end + + local tmp_file = vim.fn.tempname() -- temporary file path + local cmd, err = get_decryption_command(ext, passphrase, original_file, tmp_file) + if not cmd then + print("Decryption error: " .. err) + return + end + + if config.debug then + print("Running decryption command: " .. cmd) + end + + -- For GPG, we need to feed the passphrase via stdin. + local stdin = (ext == "pgp" or ext == "gpg") and passphrase or nil + local output = vim.fn.system(cmd, stdin) + local exit_code = vim.v.shell_error + if exit_code ~= 0 then + print("Decryption failed. Please check your passphrase and method.") + if config.debug then + print("Command output: " .. output) + end + return + end + + -- Open the decrypted file in a new buffer + vim.cmd("edit " .. vim.fn.fnameescape(tmp_file)) + local bufnr = vim.api.nvim_get_current_buf() + -- Set buffer options: nofile, no swapfile, readonly + vim.bo[bufnr].buftype = "nofile" + vim.bo[bufnr].swapfile = false + vim.bo[bufnr].readonly = true + + -- Store the original encrypted file and temp file paths in buffer variables + vim.api.nvim_buf_set_var(bufnr, "original_encrypted_file", original_file) + vim.api.nvim_buf_set_var(bufnr, "decrypted_temp_file", tmp_file) + + -- Setup automatic cleanup when the buffer is unloaded or wiped out + if config.auto_cleanup then + vim.api.nvim_create_autocmd({ "BufUnload", "BufWipeout" }, { + buffer = bufnr, + callback = function() + if vim.loop.fs_stat(tmp_file) then + os.remove(tmp_file) + if config.debug then + print("Cleaned up temporary decrypted file: " .. tmp_file) + end + end + end, + }) + -- Optionally, add a timer to auto-delete the file after a set timeout + if config.cleanup_timeout and config.cleanup_timeout > 0 then + vim.defer_fn(function() + if vim.loop.fs_stat(tmp_file) then + os.remove(tmp_file) + if config.debug then + print("Auto-cleanup: Deleted temporary decrypted file after timeout: " .. tmp_file) + end + end + end, config.cleanup_timeout * 1000) + end + end + end) +end + +-- Autocommand callback: if the file being opened matches an encrypted pattern, +-- schedule decryption. +local function on_buf_read_pre(args) + local filename = args.file + if filename and is_encrypted_file(filename) then + vim.schedule(function() + M.decrypt_and_open(filename) + end) + end +end + +-- Setup autocommands to hook into BufReadPre and BufNewFile events. +function M.setup_autocmds() + vim.api.nvim_create_autocmd({ "BufReadPre", "BufNewFile" }, { + callback = on_buf_read_pre, + }) +end + +-- Expose a user command to manually trigger decryption. +vim.api.nvim_create_user_command("DecryptFile", function(opts) + local file = opts.args + if file == "" then + file = vim.fn.expand("%:p") + end + M.decrypt_and_open(file) +end, { nargs = "?" }) + +return M + diff --git a/pulse/c0f9fc52df2043f48a5be7573ed5ba89-runtime b/pulse/c0f9fc52df2043f48a5be7573ed5ba89-runtime new file mode 120000 index 0000000..31bf552 --- /dev/null +++ b/pulse/c0f9fc52df2043f48a5be7573ed5ba89-runtime @@ -0,0 +1 @@ +/tmp/pulse-58qoFfsaYS60 \ No newline at end of file diff --git a/qutebrowser/bookmarks/urls b/qutebrowser/bookmarks/urls index af3859a..f317bb2 100644 --- a/qutebrowser/bookmarks/urls +++ b/qutebrowser/bookmarks/urls @@ -199,3 +199,5 @@ https://www.netdata.cloud/blog/understanding-huge-pages/ Understanding Huge Page https://docs.gitea.com/installation/database-prep Database Preparation | Gitea Documentation https://docs.gitea.com/installation/install-from-binary Installation from binary | Gitea Documentation qute://help/img/cheatsheet-big.png cheatsheet-big.png (3342×2060) +https://github.com/arc90/git-sweep arc90/git-sweep: A command-line tool that helps you clean up Git branches that have been merged into master. +https://github.com/proxifly/free-proxy-list proxifly/free-proxy-list: 🚀 Free HTTP, SOCKS4, & SOCKS5 Proxy List * Updated every 5 minutes * diff --git a/qutebrowser/quickmarks b/qutebrowser/quickmarks index 2d5d652..b310f5a 100644 --- a/qutebrowser/quickmarks +++ b/qutebrowser/quickmarks @@ -50,3 +50,4 @@ musicfundamentals https://c4elink.org/course/view.php?id=8005 gh https://github.com/ dir http://67.174.71.117:8000/ legfi https://auth.togetherwork.com/auth/realms/omegafi/protocol/openid-connect/auth?client_id=legfi&redirect_uri=https%3A%2F%2Fwww.legfi.com%2Fauth%2Flogin&state=ab792cdb-739d-4c9c-8081-ac83f704f78b&response_mode=fragment&response_type=code&scope=openid&nonce=ddbff00d-5a39-4579-9e72-ea4c4d2c2548 +proxy-list https://github.com/proxifly/free-proxy-list diff --git a/tox/klein9393.db b/tox/klein9393.db index a8f2448..b80ca4e 100644 Binary files a/tox/klein9393.db and b/tox/klein9393.db differ diff --git a/tox/klein9393.ini b/tox/klein9393.ini index 66e1f4a..3d68788 100644 Binary files a/tox/klein9393.ini and b/tox/klein9393.ini differ diff --git a/tox/klein9393.lock b/tox/klein9393.lock index db7682a..b50db61 100644 --- a/tox/klein9393.lock +++ b/tox/klein9393.lock @@ -1,5 +1,5 @@ -4131249 +278279 qtox kernelpanic c0f9fc52df2043f48a5be7573ed5ba89 -ff4e2629-d43f-4442-b9bf-0696c20f2803 +c5203c8c-031a-432d-ae45-c9919daa8e71 diff --git a/tox/qtox.ini b/tox/qtox.ini index 5584bfc..41030da 100644 --- a/tox/qtox.ini +++ b/tox/qtox.ini @@ -69,8 +69,8 @@ dialogGeometry=@ByteArray() dialogSettingsGeometry=@ByteArray() dialogSplitterState=@ByteArray() splitterState=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x2\0\0\0\xff\0\0\x2\b\0\0\0\0\x4\x1\0\0\0\x1\0) -windowGeometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x6J\0\0\0'\0\0\r\xb5\0\0\x4\xa5\0\0\x6L\0\0\0)\0\0\r\xb3\0\0\x4\xa3\0\0\0\0\0\0\0\0\a\x80\0\0\x6L\0\0\0)\0\0\r\xb3\0\0\x4\xa3) -windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\ah\0\0\x4{\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0) +windowGeometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\np\0\0\0\xca\0\0\xe$\0\0\x3\f\0\0\nr\0\0\0\xcc\0\0\xe\"\0\0\x3\n\0\0\0\0\0\0\0\0\a\x80\0\0\nr\0\0\0\xcc\0\0\xe\"\0\0\x3\n) +windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\0\0\0\x3\xb1\0\0\x2?\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0) [Video] camVideoFPS=@Variant(\0\0\0\x87\x41\xf0\0\0)