Skip to content

Instantly share code, notes, and snippets.

@tcely
tcely / Win10_22H2_English_x32.iso.sums
Last active August 1, 2025 17:12
Windows ISO verification
MD5 (Win10_22H2_English_x32.iso) = 0d2602fe97ee8bb6812e1e6e7732e7b5
SHA1 (Win10_22H2_English_x32.iso) = 3704f52690e6f84d010f9a10faf598348ff11081
SHA256 (Win10_22H2_English_x32.iso) = 7cb5e0e18b0066396a48235d6e56d48475225e027c17c0702ea53e05b7409807
SHA512 (Win10_22H2_English_x32.iso) = d3c2f7d7188ece1bed197581f495071646411522560a9459789efd2afd0d7bc88d940b6150c7cb09aad737b45f33ef622c806892c9aa7174e000b8ae51e11dc4
@tcely
tcely / fib_queue.py
Last active May 24, 2025 16:57
Fibonacci functions
#!/usr/bin/env python3
from collections import deque as queue
def fib_q(n):
if n < 2:
return n
memo = queue((0, 1,), maxlen=2)
for i in range(1, n):
im2 = memo.popleft()
@tcely
tcely / newtons_sqrt.py
Last active May 3, 2025 04:24
Python square root functions
def newtons_sqrt(i, /, *, precision=1e-10):
loops = 0
x = (1+i) // 2
d = i
n_x = 0
print(f'{precision=}', flush=True)
while loops < x and abs(d) > precision:
loops += 1
print(f'{loops=} abs(d) = {abs(d)}: {d=}', flush=True)
n_x = x - (x*x - i)/(2*x)
@tcely
tcely / last_boot.py
Last active April 19, 2025 02:10
Getting Windows Last Boot Time in Python
#!/usr/bin/env python3
import datetime
import os
# import wmi
# https://github.com/tjguk/wmi
# https://github.com/tcely/wmi
class LastBoot:
@tcely
tcely / links.md
Last active April 4, 2025 13:46
Various links
@tcely
tcely / sum_files.py
Created April 2, 2025 09:50
Creating a sums file from the GitHub workflow
#!/usr/bin/env python3
import hashlib
import io
import os
import pathlib
import sys
def sum_file(hasher, file_path):
@tcely
tcely / README.md
Last active February 14, 2025 09:12
Useful GPG commands for GitHub

Using GitHub & GPG together

Fetching GPG keys

Any GitHub user account can contain GPG keys used for signed commits. To verify these signatures, your local gpg.program needs the public key.

To fetch them, just use a URL such as this: https://github.com/<ACCOUNT>.gpg

@tcely
tcely / url_decode.inc.sh
Last active December 17, 2024 01:48
sh url_decode
url_decode() {
local arg ;
if [ $# -gt 0 ]; then
for arg; do
printf -- '%s\n' "${arg}" ;
done | url_decode ;
else
check_printf ;
printf -- '%b\n' "$(sed -E -e 's/\+/ /g' -e 's/%([0-9a-fA-F]{2})/\\x\1/g')" ;
fi ;
@tcely
tcely / config
Created September 8, 2023 14:28
Turn on ssh-rsa for only the hosts that require that option
# Add this to the ~/.ssh/config file
#
Match Exec "ssh-rsa-needed.sh '%n' '%C' '%l' '%h' '%p' '%r'"
PubkeyAcceptedKeyTypes +ssh-rsa
@tcely
tcely / history.inc.sh
Last active August 24, 2023 20:33
Bash History Configuration
if [ "${BASH_VERSION-}" ]; then
# Local variables the functions depend upon
_bash_history_prefix=~/.local/history/bash
# {{{ Begining of the temporary functions block
_bash_history_get_today() {
date '+%Y/0%m/%d'
}