Skip to content

Instantly share code, notes, and snippets.

View autumnjolitz's full-sized avatar

Autumn Jolitz autumnjolitz

View GitHub Profile
@autumnjolitz
autumnjolitz / multicast.py
Last active April 7, 2024 22:53
Subscribe sockets to multicast groups, allow send/recv
#!/usr/bin/env python3
"""
multicast - subscribe/send/recv for IPv4/IPv6 multicast groups with UDP.
:author: Autumn Jolitz
:date: 2024-04-06
:license: BSD-2-Clause
:tags: networking, multicast, sockets, udp
Copyright (c) 2024, Autumn Jolitz
@autumnjolitz
autumnjolitz / monkeypatch_request_session.py
Last active October 23, 2023 21:15
Monkey patch a specific module in a way that is isolated to the owning scope
"""
Allow patching a requests.Session(...) at a specific module path with a certificate store,
handling the issues of OpenSSL requiring certificates to be at a subject name hash as well
as multiple certificates inside a provided X509 certificate file (like a chain of certificates).
This allows one to target a specific place, like ``snowflake.connector.network`` and replace it's
``requests``-module with our proxied one without affecting other users of ``requests.Session``.
"""
import collections
@autumnjolitz
autumnjolitz / packer.log
Created March 6, 2023 01:41
packer log
(cpython37) InvincibleReason:~/software/cerberus_gateway [main]$ PACKER_LOG=1 packer build -force cerberus-dragonfly.pkr.hcl
2023/03/05 17:36:08 [INFO] Packer version: 1.8.6 [go1.19.6 darwin amd64]
2023/03/05 17:36:08 [TRACE] discovering plugins in /usr/local/Cellar/packer/1.8.6/libexec/bin
2023/03/05 17:36:08 [TRACE] discovering plugins in /Users/autumn/.config/packer/plugins
2023/03/05 17:36:08 [TRACE] discovering plugins in .
2023/03/05 17:36:08 [TRACE] discovering plugins in
2023/03/05 17:36:08 [TRACE] discovering plugins in /usr/local/bin
2023/03/05 17:36:08 [DEBUG] Discovered plugin: virtualbox = /usr/local/bin/github.com/hashicorp/virtualbox/packer-plugin-virtualbox_v1.0.0_x5.0_darwin_amd64
2023/03/05 17:36:08 [DEBUG] Discovered plugin: sshkey = /usr/local/bin/github.com/ivoronin/sshkey/packer-plugin-sshkey_v0.1.0_x5.0_darwin_amd64
2023/03/05 17:36:08 [INFO] found external [iso ovf vm] builders from virtualbox plugin
@autumnjolitz
autumnjolitz / test_yaml.py
Created January 7, 2023 02:23
generic tagged yaml loader that can also do tuples ;) no wrapt garbage required :D
import io
from typing import Any, NamedTuple
import yaml
import yaml.nodes
class Tagged(NamedTuple):
tag: str
tag_type: str
value: Any
@autumnjolitz
autumnjolitz / scram_sha512.py
Last active October 24, 2023 06:32
implementation of scram-sha512 using wikipedia as the only source of information. Does not care about GS2 header nonsense. `python -m pip install argon2-cffi pytest` please. Done now in a functional style!
import base64
import hashlib
import hmac
import uuid
from typing import NamedTuple, Union, Tuple, Optional
import argon2 # type: ignore
import pytest
0034:fixme:winemenubuilderˇˇˇˇ:WinMain stub!(000000000031FD70 0000000000000000): stub
002c:fixme:ver:GetCurrentPackageId (000000000031FD70 0000000000000000): stub
00bc:fixme:shcore:SetCurrentProcessExplicitAppUserModelID L"Valve.Steam.Client": stub
00c4:fixme:imm:ImeSetActiveContext (0x982f0, 0): stub
00c4:fixme:imm:ImmReleaseContext (0000000000010022, 00000000000982F0): stub
00bc:fixme:imm:ImeSetActiveContext (0x1e3a88, 1): stub
00bc:fixme:imm:ImmReleaseContext (00010050, 001E3A88): stub
[2022-08-28 19:52:13] Startup - updater built Mar 15 2022 17:15:38
[2022-08-28 19:52:13] Failed to load cached hosts file (File 'update_hosts_cached.vdf' not found), using defaults
[2022-08-28 19:52:13] Using the following download hosts for Public, Realm steamglobal
@autumnjolitz
autumnjolitz / bin|cef|cef.winxp|steamwebhelper.exe
Last active August 29, 2022 00:19
extracted via strings and sanitized for probable/sane arguments that can be passed via a CLI
-no-cef-sandbox
-cef-disable-sandbox
-cef-disable-seccomp-sandbox
-cef-force-sandbox
-cef-verbose-logging
-cef-disable-js-logging
-cef-verbose-js-logging
-cef-single-process
-cef-in-process-gpu
-cef-disable-d3d11
0034:fixme:winemenubuilderˇˇˇˇ:WinMain stub!(000000000031FD70 0000000000000000): stub
002c:fixme:ver:GetCurrentPackageId (000000000031FD70 0000000000000000): stub
00bc:fixme:shcore:SetCurrentProcessExplicitAppUserModelID L"Valve.Steam.Client": stub
00bc:fixme:process:SetProcessShutdownParameters (00000100, 00000000): partial stub.
00bc:fixme:shcore:SetCurrentProcessExplicitAppUserModelID L"Valve.Steam.Client": stub
00bc:fixme:service:I_ScRegisterDeviceNotification Notification filters are not yet implemented.
00bc:fixme:service:I_ScRegisterDeviceNotification Notification filters are not yet implemented.
00bc:fixme:imm:ImmGetOpenStatus (018311D8): semi-stub
00bc:fixme:seh:get_thread_times not implemented on this platform
00bc:fixme:file:GetLongPathNameW UNC pathname L"\\\\?\\C:\\Program Files (x86)\\Steam\\bin\\cef\\cef.win7x64\\steamwebhelper.exe"
from typing import Dict, Any
SAMPLE_TREE = {
"type": "DIVISION",
"left": {
"type": "PAREN",
"expression": {
"type": "ADDITION",
"left": {"type": "VARIABLE", "name": "$b"},
export const FormulaVisualizer = (props) => {
return <div>{renderNode(props.formulaSyntaxTree)}</div>;
}
const ExpressionNode = (props) => {
return <div className="expressionNode">{props.children}</div>;
}
const renderNode = (node) => {
switch (node.type) {