Skip to content

Instantly share code, notes, and snippets.

View Antrikshy's full-sized avatar

Antriksh Yadav Antrikshy

View GitHub Profile
@Antrikshy
Antrikshy / interrupt_handling_python_script.py
Created February 21, 2022 00:49
Python snippet for elegantly handling interruptions, like keyboard interrupts, in simple scripts that can be structured around this
import signal
import sys
def _handle_interrupt(signum, _):
signal.signal(signum, signal.SIG_IGN)
# Any cleanup steps go here
sys.exit(signal.SIGINT)
signal.signal(signal.SIGINT, _handle_interrupt)
# Rest of script...
@Antrikshy
Antrikshy / persistence.js
Created September 5, 2022 21:42
A painless localStorage manager in JS ES6, with support for partitioning keys so that different parts of a project don't step on each other's toes
/*
If you're viewing this on GitHub Gist, see a full guide, including React Router examples at:
https://antrikshy.com/code/painless-partitioned-localstorage-with-namespaces-react-router
*/
export default class PersistenceHandler {
constructor(prefix="Project-Name") {
this.prefix = prefix;
}
@Antrikshy
Antrikshy / bmw_drive_recorder_extract.py
Last active May 12, 2024 22:05
Extract and rename BMW Drive Recorder video clips
"""
Script to extract video files written by the BMW Drive Recorder in my 2024 model
and rename them using the date and time in the directory names that it writes
into USB storage.
This is free and unencumbered software released into the public domain and comes
with no warranties.
Requirements: