Skip to content

Instantly share code, notes, and snippets.

View jevinskie's full-sized avatar

Jevin Sweval jevinskie

View GitHub Profile
@jevinskie
jevinskie / GetMetadataForFile.m
Created April 16, 2025 20:58
Spotlight Importer.xctemplate
//
// ___FILENAME___
// ___PACKAGENAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//
#include <CoreFoundation/CoreFoundation.h>
#import <CoreData/CoreData.h>
@jevinskie
jevinskie / stringlist.py
Created April 9, 2025 19:31
Python StringList for @= line concatenation
from collections.abc import Sequence
from typing import cast, Self
import attrs
@attrs.define
class StringList:
_lines: list[str] = attrs.Factory(list)
@property
@jevinskie
jevinskie / tclshrc.tcl
Last active March 20, 2025 17:23
.tclshrc
# if [[ -d ~/.tcl/brew-tcl-8-6-16 ]]; then
# export MY_TCL_ROOT=~/.tcl/brew-tcl-8-6-16
# export TCLLIBPATH=$MY_TCL_ROOT/lib
# export TCL_EXEC_PREFIX=$MY_TCL_ROOT
# export PATH=$MY_TCL_ROOT/bin:$PATH
# fi
namespace eval TclshLoader {
set tcl_rcFileDir [file join $::env(HOME) .tcl rcfiles]
if {[expr {[file exists $tcl_rcFileDir] && [file isdirectory $tcl_rcFileDir]}]} {
@jevinskie
jevinskie / xnu-image-activation-stack-layout.md
Created March 14, 2025 21:28
XNU image activation stack layout

exec_copyout_strings

In kern_exec.c

Copy out the strings segment to user space. The strings segment is put on a preinitialized stack frame.

Note

The strings segment layout is backward, from the beginning of the top of the stack to consume the minimal amount of space possible;

@jevinskie
jevinskie / z3-symbol-literals.ql
Last active February 17, 2025 19:25
z3-symbol-literals.ql codeql
import cpp
// void params::set_sym(symbol const & k, symbol const & v);
// void params::set_sym(char const * k, symbol const & v);
// void params_ref::set_sym(symbol const & k, symbol const & v);
// void params_ref::set_sym(char const * k, symbol const & v);
// solver_p.set_sym("gc", symbol("dyn_psm"));
class SymbolCstrConstructor extends Constructor {
SymbolCstrConstructor() {
@jevinskie
jevinskie / opensearch-github-jevinskie-stars.xml
Created January 12, 2025 20:35
GitHub star opensearch h4x
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>ghs</ShortName>
<Description>Search jevinskie's GitHub Stars</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">https://github.com/favicon.ico</Image>
<Url type="text/html" method="get" template="https://github.com/jevinskie?submit=Search&amp;q={searchTerms}&amp;tab=stars"/>
<moz:SearchForm>https://github.com/jevinskie?submit=Search&amp;q=sportsball&amp;tab=stars</moz:SearchForm>
</OpenSearchDescription>
@jevinskie
jevinskie / terminfo.src
Created January 1, 2025 18:04
ncurses terminfo.src from 2024/12/28
This file has been truncated, but you can view the full file.
# https://invisible-island.net/ncurses/terminfo.src.html
######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE
#
# This version of terminfo.src is distributed with ncurses and is maintained
# by Thomas E. Dickey (TD).
#
# Report bugs and new terminal descriptions to
# [email protected]
#
# $Revision: 1.1160 $
@jevinskie
jevinskie / terminfo.src
Last active January 1, 2025 18:07
ncurses terminfo.src for iTerm2, etc from 2024/12/28
######## APPLE
#### Terminal.app
# nsterm*|Apple_Terminal - AppKit Terminal.app
#
# Terminal.app is a Terminal emulator bundled with NeXT's NeXTSTEP and
# OPENSTEP/Mach operating systems, and with Apple's Rhapsody, Mac OS X
# Server and Mac OS X operating systems. There is also a
# "terminal.app" in GNUstep, but I believe it to be an unrelated
@jevinskie
jevinskie / aarch64-simd-sha1-digest-to-ascii-hex.asm
Created December 12, 2024 15:46
AArch64 Advanced SIMD SHA1 digest to ASCII hex string
digest_to_hex:
ldr q0, [x0]
ushr.16b v1, v0, #4
movi.16b v2, #15
and.16b v0, v0, v2
; nibble_hex_lut = { '0', ... '9', 'a' ... 'f' }
adrp x8, nibble_hex_lut@PAGE
ldr q2, [x8, nibble_hex_lut@PAGEOFF]
tbl.16b v1, { v2 }, v1
tbl.16b v0, { v2 }, v0
@jevinskie
jevinskie / utils.cpp
Last active October 15, 2024 03:57
C++23 checked libc function wrappers
// clang-format: off
#include "common_internal.hpp"
// clang-format: on
#include "gsnr/utils.hpp"
#include <sys/mman.h>
#include <unistd.h>
namespace gsnr {