Skip to content

Instantly share code, notes, and snippets.

View aaronjeline's full-sized avatar

Aaron Eline aaronjeline

  • AWS
  • Baltimore
View GitHub Profile
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
#Run in sageMath https://sagecell.sagemath.org/
import numpy as np
from math import sqrt
#Return the dot product of v & w
def dotProduct(v,w):
return sum(map(lambda x, y: x*y, v, w))
#Return the norm of vector v
def norm(v):
@aaronjeline
aaronjeline / huffman.rkt
Created March 20, 2018 16:13
Huffman Coding implementation in Racket. Thanks Tom Scott
#lang racket
;; Author: Aaron Eline
;; A simple Huffman Coding implementation.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Main Functions
;; Nice struct for compressed data
(struct zip (tree stream))
@aaronjeline
aaronjeline / church.hs
Last active August 14, 2018 13:40
Church Numerals in Haskell
data N = Z | S N
-- Naturals are equitable
instance Eq N where
(==) Z Z = True
(==) (S a) (S b) = a == b
(==) (S n) _ = False
(==) _ (S n) = False
-- Naturals are ordered
@aaronjeline
aaronjeline / findvar.c
Last active August 19, 2018 04:35
Find env variables
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
char *ptr;
if(argc < 3) {
printf("Usage: %s <environment var> <target program name>\n", argv[0]);
exit(0);
}
@aaronjeline
aaronjeline / ppt
Created October 25, 2018 19:56
ppt
https://docs.google.com/presentation/d/1gFg88mh2toqs_vzi7PKu8DEfIf_ZIhQa_Fa1AvLnCBM/edit?usp=sharing
open Core_kernel.Std
open Bap.Std
open Graphlib.Std
open Format
include Self()
module CG = Graphs.Callgraph
@aaronjeline
aaronjeline / solve_lockpicksim.py
Created April 5, 2019 13:19
Angr Script for solving LockPickSim
import angr
import sys
def main(argv):
path_to_binary = argv[1]
project = angr.Project(path_to_binary)
initial_state = project.factory.entry_state()
simulation = project.factory.simgr(initial_state)
@aaronjeline
aaronjeline / approxpi.rs
Created April 24, 2019 16:24
Approximate pi
use rand::prelude::*;
fn main() {
println!("pi = {}", approx(1000000));
}
fn approx(count: u64) -> f64 {
let mut rng = rand::thread_rng();
let mut circle = 0;
for _ in 0..count {