Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
StartDir=$(pwd)
ScriptName=$(realpath "$0")
ScriptDir=$(dirname "$ScriptName")
if ! [ -d "$ScriptDir/youtube-dl" ] ; then
echo "Downloading youtube-dl to $ScriptDir"
cd "$ScriptDir"
if ! git clone https://github.com/ytdl-org/youtube-dl.git ; then
@laerreal
laerreal / sak.py
Created October 26, 2021 16:19
They Are Billions Send Alt Key
from six.moves.tkinter import (
Tk,
Checkbutton,
BooleanVar,
)
from time import (
sleep,
)
from win32api import (
PostMessage,
@laerreal
laerreal / TkSHA1.sh
Last active May 14, 2019 10:58
Tcl/Tk GUI for sha1sum
#!/bin/sh
#\
exec wish "$0" "$@"
wm title . "sha1sum front-end"
for {set i 0} {$i < $argc} {incr i} {
set file [lindex $argv $i]
# label ".lab$i" -text "Computing SHA1 of $file..."
global "var$i"
@laerreal
laerreal / localscatcher.py
Last active May 2, 2019 17:21
Python context manager. Catches local names defined during `with` statement and assigns them to `self`.
__all__ = [
"LocalsCatcher"
]
from sys import (
_getframe
)
class LocalsCatcher(object):
from random import choice
# https://www.youtube.com/watch?v=HzbObZRCy9U
cards = [(True, True), (False, False), (True, False)]
N = 100000
matches = 0
for _ in range(N):
def cast(v):
if isinstance(v, bitmap):
return v.i
else:
return v
class bitmap(object):
__slots__ = ("i",)
def __init__(self, i = 0):