Skip to content

Instantly share code, notes, and snippets.

@SuperMatt
SuperMatt / linux-suspend-hibernate-battery.md
Last active March 24, 2026 08:43
Fix battery drain during suspend on Linux (Modern Standby/s2idle laptops) — suspend-then-hibernate with Btrfs swap file

Fix: Battery Drain During Suspend on Linux (Modern Standby / s2idle laptops)

The Problem

On many modern laptops (especially AMD-based systems from Dell, Lenovo, HP, and others), closing the lid suspends the laptop — but it still drains roughly 3% battery per hour, potentially dying overnight. This is caused by the suspend mode the hardware uses.

Why This Happens

Modern AMD laptops and many recent laptops have dropped S3 sleep ("Suspend to RAM") in favour of Modern Standby (s2idle). You can confirm this:

@SuperMatt
SuperMatt / DUCKY_FEATHER_MOUSE_SWITCH_LEFT_RIGHT_MODE.md
Created October 25, 2024 04:55
Ducky Feather Mouse Switch Left Right mode

Ducky Feather Mouse Switch Left Right mode

This will tell you how to switch between left and right handed mode.

In this, I will be talking about the physical location of the button, not the "logical" mapping.

Step 1

Identify which button is mouse button 6.

@SuperMatt
SuperMatt / githubdark.itermcolors
Created December 5, 2023 19:05
Iterm Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.4117647111415863</real>
@SuperMatt
SuperMatt / windows-terminal.json
Created October 1, 2023 14:29
GitHub Dark Terminal Theme
{
"background": "#24292E",
"black": "#586069",
"blue": "#2188FF",
"brightBlack": "#959DA5",
"brightBlue": "#79B8FF",
"brightCyan": "#56D4DD",
"brightGreen": "#85E89D",
"brightPurple": "#B392F0",
"brightRed": "#F97583",
@SuperMatt
SuperMatt / Alacritty.yml
Last active January 11, 2026 12:48
Dark+ V2 Terminal Theme
primary:
background: '#181818'
foreground: '#C7C7C7'
normal:
black: '#000000'
red: '#CD3131'
green: '#0DBC79'
yellow: '#E5E510'
blue: '#2472C8'
magenta: '#BC3FBC'
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 7 2700X Eight-Core Processor
CPU Family: 0x17
@SuperMatt
SuperMatt / gist:84f57ba583b85a32a01df910125f7faf
Created April 4, 2019 19:21
Golang and VSCode with Snap and Flatpak
snap install go
flatpak install flathub com.visualstudio.code
flatpak override --user --env=GOROOT=/snap/go/current
git duff
_,.-''''''''-.
,-' ,.. -/|Y'' \
,,-' |` |',,`-' | \
,' /_\`...---' \
\ _.. -- '' `---.
| _. --L _|''
| ,,-' _. , . '' ,',L.|
|' _.` '/|- ,'`-.-:, |
resolution_type: GETDNS_RESOLUTION_STUB
dns_transport_list:
- GETDNS_TRANSPORT_TLS
tls_authentication: GETDNS_AUTHENTICATION_REQUIRED
tls_query_padding_blocksize: 128
edns_client_subnet_private : 1
idle_timeout: 10000
listen_addresses:
- 127.0.0.1
- 0::1
@SuperMatt
SuperMatt / main.go
Created August 9, 2017 14:32
How to use flags with subcommands.
package main
import (
"flag"
"fmt"
"os"
)
func main() {
verbose := flag.Bool("v", false, "verbose mode")