Skip to content

Instantly share code, notes, and snippets.

View lojikil's full-sized avatar
🌊
cantankerous and querulous, he was as the sea to the shore

Logyi, hajnalvédő lojikil

🌊
cantankerous and querulous, he was as the sea to the shore
View GitHub Profile
@lojikil
lojikil / analysis.draft.md
Created April 15, 2021 16:49 — forked from MattPD/analysis.draft.md
Program Analysis Resources (WIP draft)
@lojikil
lojikil / datasploit-etl.c
Last active August 25, 2018 12:48
converts datasploit text dumps to CSV, consumable by other tools
/* @(#) converts datasploit text dumps to CSV, consumable by other tools
* @(#) copyright 2018 Stefan Edwards, released under ISC license
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <regex.h>
int etlfile(FILE *, regex_t *, regex_t *);
package main
import (
"fmt"
"os"
"bufio"
"strings"
)
func main() {
@lojikil
lojikil / brewinst.sh
Created July 31, 2016 13:10
backup copy of a single-user `brew` installation
# change to whatever location to where homebrew is installed
if [ -z "$HOMEBREW_HOME" ]; then
export HOMEBREW_HOME=$HOME/homebrew
echo "HOMEBREW_HOME=$HOME/homebrew" >> ~/.profile
fi
# install homebrew for single user
if [ ! -d "$HOMEBREW_HOME" ]; then
mkdir -p $HOMEBREW_HOME && curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C $HOMEBREW_HOME
fi
@lojikil
lojikil / cvss2markdown.py
Last active October 28, 2021 07:54
Filthy hack to convert CVSS 3.0 base to Markdown tables in multiple styles.
import sys
defaults = {
'PR': {'H': 'High (H)', 'L': 'Low (L)', 'N': 'None (N)'},
'A': {'H': 'High (H)', 'L': 'Low (L)', 'N': 'None (N)'},
'C': {'H': 'High (H)', 'L': 'Low (L)', 'N': 'None (N)'},
'I': {'H': 'High (H)', 'L': 'Low (L)', 'N': 'None (N)'},
'AC': {'H': 'High (H)', 'L': 'Low (L)'},
'S': {'C': 'Changed (C)', 'U': 'Unchanged (U)'},
'UI': {'R': 'Required (R)', 'N': 'None (N)'},
#include <stdio.h>
int
main(void) {
int i = 0, j = 5;
printf("%d, %d, %d\n", i, -~i, ~-i); // 0, 1, -1
printf("%d, %d, %d\n", j, -~j, ~-j); // 5, 6, 4
return 0;
@lojikil
lojikil / fnv.c
Created March 23, 2013 14:58
Fowler-Nolls-Vo hash implementations
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
uint64_t
fnv(char *key, uint32_t len)
{
uint64_t hash = 14695981039346656037;
uint32_t idx = 0;
for(; idx < len; idx++)
$ time ./run_hydra.ss hydra_s1.ss
55
6765
832040
2178309
real 0m0.830s
user 0m0.655s
sys 0m0.046s
@lojikil
lojikil / load.ss
Created March 12, 2012 16:26
Hydra's load procedure
(define (hydra@load src-file)
"an implementation of the primitive procedure load"
(with f (open src-file :read)
(with-exception-handler
(fn (x) (display (format "An error occured while loading ~S: ~a\n" src-file x)) (close f))
(fn ()
(letrec ((loop (fn (expr)
(if (eq? expr #e)
#v
(begin
procedure TClipper.IntersectEdges(e1,e2: PEdge;
const pt: TIntPoint; protects: TIntersectProtects = []);
procedure DoEdge1;
begin
AddOutPt(e1, e2, pt);
SwapSides(e1, e2);
SwapPolyIndexes(e1, e2);
end;
//----------------------------------------------------------------------