Skip to content

Instantly share code, notes, and snippets.

@jtpaasch
jtpaasch / demo-01.dl
Created March 27, 2024 21:11
Cousot's prefix trace semantics in (Souffle) datalog. Run the demos: `souffle -D- demo-01.dl` etc.
#include "library.dl"
// =========================================================
// EXAMPLE
// =========================================================
/*
------------------------------------------------------------
THE PROGRAM
@jtpaasch
jtpaasch / Makefile
Created April 6, 2022 18:21
An example of subcommands with OCaml's Cmdliner
TOOL := main.exe
#####################################################
# DEFAULT
#####################################################
.DEFAULT_GOAL := all
all: clean run
@jtpaasch
jtpaasch / memory.dl
Last active March 15, 2024 13:55
Simulating memory with Datalog (big/little endian reads/writes of bytes)
// Here's one way to use Souffle datalog to simulate
// reading bytes from memory and assembling a value
// out of them (big/little endian-wise).
// Working with string representations of binary numbers
// in Souffle is somewhat tedious, so I'm going to do
// this by storing bytes as numbers. Then, when I pull
// out the bytes and assemble them into a value, I just
// need to calculate the number from that sequence of
// integer byte values.
@jtpaasch
jtpaasch / CPP_BNF_Quickstart.md
Created March 3, 2024 18:37
C++ BNF Grammar quickstart

C++ BNF Grammar

The C++ grammar is convoluted. These notes offer a quickstart/bird's eye view into it.

BNF grammars

Here are some versions of the grammar (or C-variants):

@jtpaasch
jtpaasch / amazonctl.py
Created October 26, 2015 12:47
A collection of functions commonly used to do AWS stuff.
# -*- coding: utf-8 -*-
"""A simple tool to document how to control AWS resources.
AWS AUTHENTICATION
-------------------
In order to run any of the code below, you need a profile with AWS credentials
set up on your computer. It's very easy to do this. Google how to configure
your profile with boto3, or visit the docs:
@jtpaasch
jtpaasch / Clang_AST_Parsing.md
Created February 16, 2024 19:13
Parsing C++ ASTs with Clang
@jtpaasch
jtpaasch / Qemu-quickstart.md
Last active January 29, 2024 23:18
A quick cheatsheet/tutorial for using QEMU (on macOS, but should work on Linux too).
@jtpaasch
jtpaasch / Ghidra-Info.md
Last active January 23, 2024 15:26
Ghidra info
@jtpaasch
jtpaasch / 01-aexpr.dl
Last active January 3, 2024 14:44
The reaching definitions analysis (done in Souffle datalog), from Principles of Program Analysis, ch. 2.
/*
=======================================================
01 - Arithmetic expressions
=======================================================
Encoding arithmetic expressions and simple assignments with datalog.
The language is a subset of the one in PPA, pp. 3-4.
*/