-
su
-
echo 'event=button/lid.*' >> /etc/acpi/events/lm_lid
-
echo 'action=/etc/acpi/lid.sh' >> /etc/acpi/events/lm_lid
-
Find out your session type:
$XDG_SESSION_TYPE
-
vi /etc/acpi/lid.sh
:Change USERNAME to your username (
whoami
)X11:
This file contains 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
""" | |
Retry a function after `sleep` secionds for a max of `maxtries` | |
""" | |
def retry(sleep=0.1, maxtries=10): | |
# wrapper for sleep-retrying a function call. use with `@retry()` | |
from time import sleep as _sleep | |
def wrap1(f): | |
def wrap2(*a, __count=0, **kw): | |
try: |
This file contains 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
#!/usr/bin/env python3 | |
def get_json(doi:str) -> dict: | |
# get citation dict from doi string | |
import re | |
import urllib.request | |
from urllib.error import HTTPError | |
import json | |
from pprint import pprint |
This file contains 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
# Encrypt archives | |
# https://askubuntu.com/questions/95920/encrypt-tar-gz-file-on-create | |
# Pack: | |
tar -cz FILENAMES | gpg -c -o ARCHIVE.tgz.gpg | |
# Unpack: | |
gpg -d your_archive.tgz.gpg | tar xz | |
#### |