This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# hybrid-sleep | |
# specify how many seconds to sleep before hibernation in each battery range | |
# format is THRESHOLD=TIME ... | |
# when battery is below THRESHOLD, sleep for TIME and then hibernate | |
# it must go from 100 to 0 to work properly. | |
# example: 100=3600 50=1800 20=600 10=0 | |
# that represents: | |
# - if battery is between 100 and 51%, then sleep 1h, then hibernate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// type Untokenize<S extends string, T extends string[] = []> = S extends `${infer R}.${infer U}` ? Untokenize<U, [...T, R]> : [ ...T, S]; | |
type GetKeyPaths <T extends object> = { | |
[P in keyof T]: P extends string | |
? T[P] extends object | |
? `${P}.${GetKeyPaths<T[P]>}` | P | |
: P | |
: never | |
}[keyof T] |