Skip to content

Instantly share code, notes, and snippets.

View chadbrewbaker's full-sized avatar

Chad Brewbaker chadbrewbaker

View GitHub Profile
@chadbrewbaker
chadbrewbaker / LAMS.py
Created December 2, 2023 03:08
Labeled Acyclic Mexican Standoffs
import itertools
# 1, 3, 25, 443, 13956
def generate_graphs(n):
""" Generate all directed graphs for n vertices """
all_possible_edges = [(i, j) for i in range(n) for j in range(n) if i != j]
for edges in itertools.product([False, True], repeat=len(all_possible_edges)):
graph = {i: [] for i in range(n)}
for edge, edge_exists in zip(all_possible_edges, edges):
if edge_exists:
@chadbrewbaker
chadbrewbaker / injections.txt
Created November 27, 2023 20:41
Apple Messages Injection surface
SHANA - trnscript cells %@ - index path %@
sms://open?groupid=%@
Still presenting %@
Search "%@" number of results
After clearing "%@" should have no results
%@ -- %@
%@Units
Failed to enter conversation with chat identifier %@
Failed to find chat: %@
%@-%@
@chadbrewbaker
chadbrewbaker / Makefile
Created November 16, 2023 20:41
ChadCloudForm
.PHONY: create-keypair launch-instance connect-instance shutdown-instance clean log-details
# Variables
KEY_NAME = MyKeyPair
INSTANCE_TYPE = t2.micro
AMI_ID = ami-12345678
SECURITY_GROUP_ID = sg-12345678
SUBNET_ID = subnet-12345678
KEY_FILE = $(KEY_NAME).pem
INSTANCE_IP = # Put your instance's public IP or DNS here
@chadbrewbaker
chadbrewbaker / llmCodeParsing.md
Created September 23, 2023 20:58
LLM Code Parsing
@chadbrewbaker
chadbrewbaker / bcctools.yaml
Created March 14, 2021 19:43
Example for eBPF profiling on Github Actions
name: CICD
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ${{ matrix.job.os }}
strategy:
@chadbrewbaker
chadbrewbaker / aks.py
Created May 3, 2023 02:06
AKS Primality Test
# ChatGPT4 spit it out with some coaxing - looks legit, haven't tested.
import math
def is_prime(n):
def is_power(a, b):
if a == 1:
return b != 1
power = 1
while power < b:
@chadbrewbaker
chadbrewbaker / Roman.rb
Created January 15, 2013 23:05
Iowa Ruby Brigade kata showing Roman numeral computation is a monoid.
# Roman Numeral Evaluation is a Monoid
# Chad Brewbaker | Software Engineer | Telligen.org
# crb002@gmail.com
# Initial release January 15, 2013
class RomanMonoid
attr_accessor :prefix, :prefix_size, :suffix, :suffix_size, :suffix_credit, :sum, :homo
def initialize(val)

ChatGPT prompt: How would you write an LLVM optimization pass to lint for register spilling?

An LLVM optimization pass is a way to analyze or transform LLVM Intermediate Representation (IR) code. To write an LLVM optimization pass that lints for register spilling, you would need to analyze the register allocation process and identify cases where register spilling occurs. Here's a high-level outline of the steps you'd need to take:

Set up an LLVM pass: First, you need to set up a new LLVM pass. To do this, create a new class that inherits from llvm::FunctionPass. In this class, you'll implement the runOnFunction method, which will be called for each function in the module you're analyzing.

#include "llvm/Pass.h"
#include "llvm/IR/Function.h"
@chadbrewbaker
chadbrewbaker / dulien.md
Last active October 13, 2022 03:48
EasyPerf 1 August 2021 Twitter Space