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
# Version: 0.1 (2025-01-18) | |
# License: MIT, use at your own risk | |
# | |
# This script disables the Lenovo-installed "Tobii experience" software and "nahimic" software. | |
# Tested on a Lenovo Legion Pro 5 (82WM) with Windows 11 24H2. | |
# Run it with `powershell.exe -noprofile -executionPolicy Bypass -File badlenovo.ps1` | |
# Following this script, you should be able to uninstall the "Tobii experience" app from the control panel (appwiz.cpl) | |
# | |
# After major updates, you may need to re-run this script. |
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
import {useEffect} from "react"; | |
/** | |
* A hook that runs an async function on mount with support for cancellation. | |
* | |
* If unmounting before the async function completes, the cleanup function will be called. | |
* @param fn {function} A function that takes a 'cancelled' function as its only argument. | |
* @param inputs {array?} An optional array of inputs to pass to useEffect. | |
* @param cleanup {function?} An optional cleanup function to run on unmount. | |
* |
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
/** | |
* Generate a UUIDv7 as a string (see also: https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/) | |
* | |
* This function was translated to javascript from the python implementation here: https://github.com/oittaa/uuid6-python | |
* | |
* The UUIDv7 format is designed to encode a Unix timestamp with | |
* arbitrary sub-second precision. The key property provided by UUIDv7 | |
* is that timestamp values generated by one system and parsed by | |
* another are guaranteed to have sub-second precision of either the | |
* generator or the parser, whichever is less. Additionally, the system |
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
""" | |
An example of how to use boto3 and a concurrent.futures process pool to upload files in parallel. | |
Bonus: when uploading files ending in .gz, the Content-Encoding metadata will be set automatically. | |
""" | |
import os | |
from concurrent.futures import ProcessPoolExecutor, as_completed | |
import boto3 | |
def concurrent_s3_upload(files, bucket, prefix, metadata, remove_gz_extension=True): |