Skip to content

Instantly share code, notes, and snippets.

View jevinskie's full-sized avatar

Jevin Sweval jevinskie

View GitHub Profile
@jevinskie
jevinskie / tclsh.tcl
Last active May 1, 2024 18:53
~.tclsh/~.wishsh to source files from ~/.tcl/rcfiles
namespace eval TclshLoader {
set tcl_rcFileDir [file join $env(HOME) .tcl rcfiles]
if {[expr {[file exists $tcl_rcFileDir] && [file isdirectory $tcl_rcFileDir]}]} {
set tcl_rcFiles [glob -type {f r} -directory $tcl_rcFileDir -- *.tcl]
# put tclreadline.tcl last since it enters a loop and prevents further execution of .tclsh/.wishsh
set tcl_rcFiles_tclreadlineIdx [lsearch -glob $tcl_rcFiles */tclreadline.tcl]
if {[expr {($tcl_rcFiles_tclreadlineIdx != -1) && ([llength $tcl_rcFiles] > 1)}]} {
set tcl_rcFiles_tclreadlinePath [lindex $tcl_rcFiles $tcl_rcFiles_tclreadlineIdx]
set tcl_rcFiles [lreplace $tcl_rcFiles $tcl_rcFiles_tclreadlineIdx $tcl_rcFiles_tclreadlineIdx]
lappend tcl_rcFiles $tcl_rcFiles_tclreadlinePath
@jevinskie
jevinskie / output-root.log
Last active April 26, 2024 16:47
Run lsmp on *something*, *anything* without root privileges. How? A wrapper program that gets its own PID then exec's into lsmp with that PID as the process to inspect.
-> % sudo ./self-lsmp
Password:
argv[0] = '/usr/bin/lsmp'
argv[1] = '-v'
argv[2] = '-p'
argv[3] = '33302'
self task regular: 0x00000203 aka 515
self task read: 0x00000b03 aka 2819
@jevinskie
jevinskie / byte_histogram.py
Created April 12, 2024 03:53
Python pretty byte histogram rendering for TUI
#!/usr/bin/env python3
# -> % ./byte_histogram.py -i ./byte_histogram.py
# 20 ' ' [ 1426]: ██████████████████████████████████████████████████████████████████████████████████████████████
# e2 [ 427]: ████████████████████████████▏
# 96 [ 427]: ████████████████████████████▏
# 88 [ 337]: ██████████████████████▏
# 0a ' ' [ 183]: ████████████
# 27 ''' [ 171]: ███████████▎
# 65 'e' [ 144]: █████████▍
@jevinskie
jevinskie / asr.md
Created March 18, 2024 04:16
asr (8) man page version 615 macOS 14.3.1 23D60

ASR(8) - System Manager's Manual

NAME

asr - Apple Software Restore; copy volumes (e.g. from disk images)

SYNOPSIS

asr verb

Size benchmarks of git clone --mirror archival methods

Tested with QEMU at db596ae19040574e41d086e78469014191d7d7fc.

$ git clone --mirror https://gitlab.com/qemu-project/qemu.git
$ ditto qemu.git qemu-nocomp.git
$ gtar -c qemu.git > qemu.git.tar
$ pushd qemu-nocomp.git
$ # We're going to repack the git repo into a single pack file with no zlib compression
$ # so later compression can compress the uncompressed pack file better.
jevin@ptblazer [02:38:19 AM] [~]
-> 🌩 % ./llvmlite-test.py | tee foo.ll
; ModuleID = "llvmlite-test.ll"
target triple = "x86_64-pc-linux-gnu"
target datalayout = ""
@"gvar" = constant i64* inttoptr (i64 4919 to i64*)
@"printf_fmt_buf" = constant [54 x i8] [i8 104, i8 101, i8 108, i8 108, i8 111, i8 32, i8 119, i8 111, i8 114, i8 108, i8 100, i8 32, i8 105, i8 39, i8 109, i8 32, i8 103, i8 114, i8 111, i8 117, i8 99, i8 104, i8 121, i8 32, i8 103, i8 118, i8 97, i8 114, i8 58, i8 32, i8 37, i8 112, i8 32, i8 109, i8 97, i8 116, i8 101, i8 114, i8 105, i8 97, i8 108, i8 105, i8 122, i8 101, i8 100, i8 32, i8 52, i8 50, i8 58, i8 32, i8 37, i8 100, i8 10, i8 0]
declare i64 @"printf"(i8* %".1", ...)
@jevinskie
jevinskie / Sample of UVFSService
Last active February 16, 2024 06:10
Apple LiveFS/UserFS - sampling while true; do touch .; done on a FAT32 USB partition
Analysis of sampling UVFSService (pid 28689) every 1 millisecond
Process: UVFSService [28689]
Path: /System/Library/PrivateFrameworks/UVFSXPCService.framework/Versions/A/XPCServices/UVFSService.xpc/Contents/MacOS/UVFSService
Load Address: 0x102bc4000
Identifier: UVFSService
Version: ???
Code Type: ARM64E
Platform: macOS
Parent Process: launchd [1]
@jevinskie
jevinskie / memfd_create_2_florida_man.md
Last active December 8, 2023 12:34
Florida Manpage for memfd_create(2)

memfd_create(2) - Hold on to your alligator hats!

What the Heck is This?

  • memfd_create, baby! It's like conjuring a file out of the swampy ether!

Tools in My Shed

  • Standard C library (libc, -lc), the backbone of this whole shebang!
@jevinskie
jevinskie / pyenv-shim-hyperfine.html
Created November 30, 2023 17:09
pyenv shim benchmark
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>terminal-to-html Preview</title>
<style>.term-container {
background: #171717;
border-radius: 5px;
color: white;
@jevinskie
jevinskie / patriot-missile-computer-wcc.md
Last active November 7, 2023 03:37
MIM-104C PAC-2 WCC (Weapons Control Computer) brought to you by Raytheon

FIELD MANUAL NO. 44-85 - PATRIOT BATTALION AND BATTERY OPERATIONS

The Computer

The computer within the Patriot system (see Figure B-6, next page) is a 24-bit parallel militarized computer with fixed and floating point capability. The WCC is organized in a multi-processor configuration which operates at a maximum clock rate of 6 megahertz.

Weapons control computer

The WCC provides the necessary data processing for the Patriot FU, including capability for communications with other FUs or battalions through a routing logic radio interface unit (RLRIU). The major subsystems within the computer system are the: Central processing unit (CPU). Input/output control unit (IOCU). Monolithic memory unit (MMU). Peripheral control unit (PCU).