Skip to content

Instantly share code, notes, and snippets.

View jevinskie's full-sized avatar

Jevin Sweval jevinskie

View GitHub Profile
#!/usr/bin/env python3
"""
Device Tree Overlay Generator - Generates DTS overlays with fragments.
Creates overlay files that can be dynamically loaded to modify existing device trees
"""
import argparse
import sys
import os
import json
#!/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
@MaskRay
MaskRay / be_prefix_varint.c
Last active February 3, 2026 19:16
variants of Little Endian Base 128 where the length information is in the first byte
#include <assert.h>
#include <inttypes.h>
#include <stdbit.h>
#include <stdio.h>
#include <string.h>
/*
Big-endian prefix varint encoding for 64-bit integers.
The first byte determines the total length using most significant bits.
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 December 21, 2025 19:38
LLVM 21.1.8 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];
}