Skip to content

Instantly share code, notes, and snippets.

View jevinskie's full-sized avatar

Jevin Sweval jevinskie

View GitHub Profile
#!/usr/bin/python3
# SPDX-FileCopyrightText: 2025 Alexis Engelke
# SPDX-License-Identifier: Apache-2.0
from bisect import bisect_right
from dataclasses import dataclass, replace, field
from typing import NamedTuple
import sys
from elftools.elf.elffile import ELFFile
from elftools.dwarf.callframe import FDE
import HDL
import MM4
import MolecularRenderer
import OpenMM
import QuaternionModule
import Foundation
import func QuartzCore.CACurrentMediaTime // profiling on macOS
// MARK: - Compile Structure
@hoyhoy
hoyhoy / llvm_two_stage_build.sh
Last active November 28, 2025 02:51
LLVM 21.1.6 Two Stage Build Script for MacOS 15.7
#!/usr/bin/env bash
# Bash script to complile LLVM
# @hoyhoy
# 11/18/2025
# Installs to /opt/llvm-${LLVM_VERSION} i.e. /opt/llvm-21.1.6
# and then symbolically link /opt/llvm-latest to /opt/llvm-21.1.6
#!/bin/bash
# MacBook Lid Angle Sensor Diagnostic Script
# This script helps identify the lid angle sensor on different MacBook models
echo "=============================================="
echo "MacBook Lid Angle Sensor Diagnostic Tool"
echo "=============================================="
echo ""
@CharlieQiu2017
CharlieQiu2017 / libgcc.md
Last active October 10, 2025 04:22
A Deep Dive into libgcc And libsupc++

A Deep Dive into libgcc And libsupc++

According to the specifications of the C and the C++ programming languages, implementations of C and C++ can be classified into hosted ones and freestanding ones, depending on whether the implementation has access to functionalities that require operating system (OS) support, such as memory allocation and multi-threading. A hosted implementation has full access to these functionalities, and can provide the full range of features required by the language. A freestanding implementation, on the other hand, does not have access to any functionality that requires support from the execution environment. Such implementations are only required to provide a subset of the language features. Freestanding implementations are important when developing operating systems, the standard C library,

@MaskRay
MaskRay / bench.rb
Last active September 17, 2025 17:14
https://maskray.me/blog/2025-08-31-benchmarking-compression-programs program, distributed under the terms of both the MIT license and the Apache License (Version 2.0)
#!/usr/bin/env ruby
# This program downloads and builds several compression utilities, benchmarks their compression and decompression
# performance on a specific input file including memory consumption, and finally generates HTML charts.
require 'benchmark'
require 'digest'
require 'etc'
require 'fileutils'
require 'json'
require 'net/http'
require 'optparse'
@Keksgesicht
Keksgesicht / simple-ISel.c
Created August 27, 2025 22:31
LLVM patching approach
// RUN: %llvmbuildpath/bin/clang --sysroot=%libcpath --target="riscv32-none-elf" -menable-experimental-extensions -mabi="ilp32" -march="rv32imxsimple0p1" -O3 -S -o - %s | FileCheck %s
// CHECK: main:
// CHECK-DAG: SIMPLE.mac [[RD1:[as][0-9]+]], [[RS1:[as][0-9]+]], [[RS2:[as][0-9]+]]
// CHECK: call printf
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
@nicolas17
nicolas17 / arc.md
Last active November 8, 2025 06:53
ARC autorelease return value optimization

Original source code, compiled with ARC:

-(NSString*)name {
    return self->name;
}
-(void)caller {
    self->thingName = [self->thing name];
}
@izabera
izabera / magic_namerefs.md
Last active July 8, 2025 15:10
magic namerefs

namerefs (introduced in bash 4.0) act as aliases for other variables

var=meow
declare -n ref=var

echo $ref  # prints meow

ref=moo
echo $var  # prints moo
@whitequark
whitequark / meow.md
Last active October 29, 2025 16:59
reverse engineering tools

"%" means not tested by me personally.

Reference material

Disassemblers and decompilers

  • Binary Ninja: interactive native code disassembler, decompiler, and debugger
  • when building, replace the BN SDK it downloads with a path to BN API library