Skip to content

Instantly share code, notes, and snippets.

@tcely
tcely / install_asset.py
Last active January 21, 2026 18:06
Asset fetcher script
# Standard library imports
import hashlib
import platform
import re
import shutil
import sys
import tempfile
import time
from datetime import datetime
from email.utils import parsedate_to_datetime
@tcely
tcely / pull_digests.ts
Last active January 21, 2026 08:45
Gathering sha256 checksums for `deno`
// pull_digests.ts
/*
* $ version='2.6.5'
* $ deno run \
* --allow-net=api.github.com,github.com,release-assets.githubusercontent.com \
* --allow-write=release_digests.sha256 \
* pull_digests.ts "v${version}"
* $ file="$(deno eval 'console.log("deno-" + Deno.build.target + ".zip")')"
* $ checksum="$(grep -e "${file}" release_digests.sha256 | awk '1 == NR {print $NF; exit;}')"
* $ deno upgrade --checksum="${checksum}" "${version}"
@tcely
tcely / README.md
Last active January 17, 2026 15:30
An improvement of the functions shown in: https://youtu.be/DsmKmmKbz_4
@tcely
tcely / try-jsr.md
Created January 8, 2026 13:06
Trying different things with `zx` so I put together an easy way to run it.
~/.cache $ DEBUG_ZX_SH=true zx_run 'jsr:@webpod/zx' <<<'console.log( await $({ verbose: true })`echo Hello world! | xargs -t -n 1 echo` )'
+ install -d -m 00775 /data/data/com.termux/files/../cache/zx
+ cd /data/data/com.termux/files/../cache/zx
+ zx=jsr:@webpod/zx
+ shift
+ exec deno run --no-config --allow-read=/data/data/com.termux/files/usr/bin/bash --allow-read=/data/data/com.termux/files/files/home --allow-read=/data/data/com.termux/files/../cache --ignore-read --allow-write=/data/data/com.termux/files/../cache/zx --allow-env --allow-run --allow-sys=homedir,uid,gid,cpus -- jsr:@webpod/zx
@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):