The goal of this gist is to setup waypipe to automically run locally on user login and remotely when you connect to it. In both cases, this is managed by systemd user session and assumes that is running. This took way too long to figure out, so I hope it helps someone (or me) in the future.
| #!/usr/bin/env bash | |
| # bw-ssh-add.sh | |
| # Load an SSH key stored in Bitwarden into ssh-agent | |
| # Must be sourced so BW_SESSION persists. | |
| # Add this in ~/.zshrc or ~/.bashrc: | |
| # bw-ssh-add() { | |
| # source ~/bin/bw-ssh-add.sh "$@" | |
| # } |
| [ | |
| { | |
| "key": "h", | |
| "command": "editor.action.scrollLeftHover", | |
| "when": "editorHoverFocused" | |
| }, | |
| { | |
| "key": "j", | |
| "command": "editor.action.scrollDownHover", | |
| "when": "editorHoverFocused" |
| { | |
| "vim.smartRelativeLine": true, | |
| "editor.cursorSurroundingLines": 8, | |
| "editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?", | |
| "vim.leader": "<space>", | |
| "vim.normalModeKeyBindings": [ | |
| { | |
| "before": ["<leader>", "e"], | |
| "commands": ["workbench.view.explorer"] | |
| }, |
| // Original script: https://gist.github.com/leodevbro/2987e8874a18b2086ea6cc1aa3c494e8 | |
| // v2.5 | |
| // Google Apps Script is a coding language based on JavaScript. | |
| // This Apps Script code helps us to sort addresses by most threads. | |
| // A thread is a group of messages, as a conversation. | |
| const modes = { | |
| inbox: "inbox", // to analyze threads in the "Inbox" folder | |
| outbox: "outbox", // to analyze threads in the "Sent" folder |
Gavin Sinclair, January 2022
I use Karabiner (configured with Gosu) to make advanced key mappings on my Apple computer. Karabiner allows you to create “layers”, perhaps simulating those on a programmable mechanical keyboard. I make good use of these layers to give me easy access (home-row or nearby) to all symbols and navigational controls, and even a numpad.
The motivation is to keep hand movement to a minimum. Decades of coding on standard keyboards has unfortunately left me with hand and wrist pain. I will soon enough own a small split keyboard which will force me to use layers to access symbols etc., so this Karabiner solution, which has evolved over months, is a training run for that.
One thing I noticed ever since I bought my second Dell XPS was that the battery life was relatively abysmal when the laptop was asleep. I'd suspend my laptop at work, bring the laptop home, and the next morning I'd be down 25-50% of my battery life! More than once, I'd leave my laptop for a couple days and come back to a completely dead laptop1.
My first inclination was that the laptop was waking up on its own. It does happen occasionally with Linux (which, in an of itself, is pretty concerning2), but in this case, I was reasonably certain it wasn't the case, as evidenced by the battery drop overnight when waking a still-sleeping laptop.
While there are a plethora of articles online about sleep/standby (suspend to RAM) and hibernate (suspend to disk), the root cause was that some hardware configurations support three different modes of sleep: s2idle, shallow, and deep.
According to the [Linux Kernel documentation](https://www.kernel.org/doc/html/v4.15/admin-guide/pm/sleep-states
| SUBSYSTEM=="i2c-dev", ACTION=="add",\ | |
| ATTR{name}=="NVIDIA i2c adapter*",\ | |
| TAG+="ddcci",\ | |
| TAG+="systemd",\ | |
| ENV{SYSTEMD_WANTS}+="ddcci@$kernel.service" |
| # Use systemd for managing NVIDIA driver suspend in drivers ====>>> PRIOR to version 470 <<<===== | |
| # https://download.nvidia.com/XFree86/Linux-x86_64/450.66/README/powermanagement.html | |
| # https://forums.developer.nvidia.com/t/unable-to-set-nvidia-kernel-module-parameters/161306 | |
| # Please note: In Fedora Linux you may need to just install the xorg-x11-drv-nvidia-power pakage | |
| # as sugested by @goombah88 in the comments below. | |
| TMP_PATH=/var/tmp | |
| TMPL_PATH=/usr/share/doc/nvidia-driver-460/ | |
| echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=${TMP_PATH}" | sudo tee /etc/modprobe.d/nvidia-power-management.conf |