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
from functools import wraps | |
from logging import getLogger, DEBUG | |
logger = getLogger(__name__) | |
def log_io(level: int=DEBUG, enter: bool=False, exit: bool=False): | |
""" | |
Decorator factory that logs function input arguments and return values | |
at the specified logging level. |
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
// Source: https://www.reddit.com/r/rustjerk/comments/103et69/who_said_there_was_no_random_number_generator_in/ | |
// Source: https://play.rust-lang.org/?version=stable&mode=release&edition=2021&gist=966e4fb514d128f9790be2fce84f8cbe | |
use std::collections::HashSet; | |
fn getrandom(dest: &mut [u8]) { | |
for byte in dest.iter_mut() { | |
for _bit in 0..8 { | |
let mut set = HashSet::new(); | |
set.insert(0u8); |
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
* create virtual environment `python -m venv /path/to/venv` | |
* activate venv | |
* python -m pip install --upgrade pip | |
* pip install twine | |
* pip install wheel | |
* python setup.py sdist bdist_wheel | |
* ls dist | |
* make sure you have the TestPyPI and PyPI repository URLs in your ~/.pypirc | |
* make sure you have the path to your certificate bundle in your ~/.pypirc |
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 | |
# https://wiki.archlinux.org/index.php/GRUB/Tips_and_tricks#Hide_GRUB_unless_the_Shift_key_is_held_down | |
set -e | |
prefix="/usr" | |
exec_prefix="${prefix}" | |
datarootdir="${prefix}/share" | |
export TEXTDOMAIN=grub | |
export TEXTDOMAINDIR="${datarootdir}/locale" |