Skip to content

Instantly share code, notes, and snippets.

@gdemin
gdemin / laptop-s2idle-to-deep.md
Created January 25, 2025 13:24 — forked from julianlam/laptop-s2idle-to-deep.md
Changing laptop suspend from s2idle to deep sleep #blog

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

@gdemin
gdemin / txt-to-google-keep-notes.py
Created December 14, 2019 20:21 — forked from sliceofbytes/txt-to-google-keep-notes.py
Add Text Files as Google Keep Notes
#Import a directory of text files as google keep notes.
#Text Filename is used for the title of the note.
import gkeepapi, os
username = '[email protected]'
password = 'your app password'
keep = gkeepapi.Keep()
success = keep.login(username,password)
@gdemin
gdemin / global.R
Last active August 29, 2015 14:14 — forked from SachaEpskamp/global.R
library("shiny")
library("foreign")