As per RFC 7231 §7.1.1.1: A recipient that parses a timestamp value in an HTTP header field MUST accept all three HTTP-date formats. These formats are then described as (with the first being the only preferred format; the latter 2 are designated as "obsolete"), converted for this post into strftime(3) syntax: %a, %d %b %Y…
one-off informations
Python: Using "with" with sqlite3 cursor
If you like the assurance that Python's with statement provides, but can't figure out how to properly apply it to individual cursor objects, here's how to do that: import sqlite3 from contextlib import closing con = sqlite3.connect('example.db') with con, closing(con.cursor()) as cur: cur.execute(…)
Basic JS Async Cookbook
// aXMLHttpRequest: an asynchronous XHR function function aXMLHttpRequest(method, location, responseType="", body=undefined) { // somewhat basic; improvements welcome return new Promise( (resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open(method, location); xhr.responseType = responseType; xhr.onload = resolve; xhr.onerror = reject; xhr.send(body); return xhr; }); } // asleep: an asynchronous sleep function asleep = (delay =>…
Minecraft: switching from Forge to Fabric
The only amenities I needed were increased FPS, NBT Tooltips, Fancy-leaves-on-Fast-graphics, Zoom, and Saturation Display. These are provided on Fabric, respectively, by: Sodium NBT Tooltip Also Sodium (once they fix #233) Cull Leaves, for now WI Zoom AppleSkin I will update this post as I use more stuff. I will cross out, but not delete,…
Quick setup: Fail2ban on CentOS 8
Instant, easy setup. Just 3 commands, and your server will be protected: dnf install fail2ban nano /etc/fail2ban/jail.local Paste this: [sshd] enabled = true systemctl restart fail2ban
Minecraft: Opening a Java sever to console and mobile clients
Due to the work of some brilliant people, it’s now possible to open a Minecraft Java Edition server to Bedrock Edition clients; and, due to another brilliant dude, it’s possible to connect even the nerfed console ports up to an arbitrary server. This means you can have simultaneous crossplay among the whole cornucopia of PC,…
Python: "with epoll"
If you're using Python 3.4+, select.epoll
already supports context — you're clear to just write with epoll() as E: …
and everything will be OK. If not, here's how to shim it:
JS: Tail-call optimized recursive setTimeout
If you're writing some code on a time-delayed-loop in JavaScript, there are 2 main options: setInterval setTimeout, recursively However, each has a potential downside: setInterval schedules the code to run at the given interval, regardless of whether the last invocation has completed. This means that, if the function takes longer than the delay to execute,…
[DRAFT] Pleroma on Docker Compose
This testing was done with Pleroma 2.2.0, in environment CentOS 8 (Before starting, be sure docker and docker-compose are installed, as well as git, and NGINX.) Fetch and prepare the source code: git clone -b stable –depth=1 "https://git.pleroma.social/pleroma/pleroma.git" && cd pleroma git fetch –depth=2 "https://git.lain.church/squeegily/pleroma.git" "features/docker-compose":"features/docker-compose" && git -c "user.name=Anonymous" merge –no-commit "features/docker-compose" sudo chown…
Docker: remove all containers and images
docker rm -f `docker container ls -a -q` && docker rmi -f `docker image ls -a -q`