Skip to content

Instantly share code, notes, and snippets.

@samunders-core
samunders-core / LabelInterrupts.java
Created October 8, 2020 21:31
Ghidra SW interrupt labeling script
// prepend comment to each INT
//@author sam_
//@category DOS
//@keybinding
//@menupath
//@toolbar
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
@samunders-core
samunders-core / crontab
Last active November 21, 2020 11:52
Self-contained OpenWRT crontab for IP camera records management
# #ffmpeg
# SECONDS=900
# DURATION=$(($(date "+$SECONDS-(%M%%15)*60-%S")))
## tcp transport ensures bottom half of frame is not pixelated
# PRE_IN="-t $DURATION -rtsp_transport tcp"
# LOGIN=
# PASSWORD=
# IP=
# IN=rtsp://$LOGIN${PASSWORD:+:$PASSWORD}@$IP:554/mpeg4
# START="$(date '+%Y%m%d_%H%M%S')"
@samunders-core
samunders-core / SharedLibrariesMemoryMap.java
Created January 4, 2021 22:20
Ghidra script - add .so files to memory of main executable based on /proc/self/maps offsets. Assumes .so files are already in Ghidra project
//setup memory map from /proc/self/maps
//@author sam_
//@category
//@keybinding
//@menupath
//@toolbar
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@samunders-core
samunders-core / uloztoAria2bridge.js
Last active August 7, 2022 14:10
This GreaseMonkey / TamperMonkey / ViolentMonkey user script redirects downloads from https://uloz.to to speciffied Aria2 instance
// ==UserScript==
// @name uloz.to Aria2 bridge
// @namespace Violentmonkey Scripts
// @match https://uloz.to/*
// @run-at document-start
// @grant GM.xmlHttpRequest
// @version 1.0
// @author sam_
// @description Redirects downloads from uloz.to to speciffied Aria2 instance
// ==/UserScript==
@samunders-core
samunders-core / lookup.roundup.sh
Created December 15, 2024 12:44
multi-expression grep
lookup() { # [awk_options] regex [regex ...]; like grep, but prints all first matches on success, everything when failed
! set +"${-//[^x]/}" > /dev/null 2> /dev/null || RESTORE_TRACING="set -x"
CMDS='
BEGIN { delete PATT[0] }
BEGINFILE { if (FILENAME != "" && FILENAME != "-") { PATT[length(PATT)] = FILENAME; nextfile } }
function matchesAny(text) { for (i in PATT) if (text ~ PATT[i]) { delete PATT[i]; return 1 } }
{ allLines = allLines "" RS "" $0 }
matchesAny($0) { matched = matched "" RS "" $0 }
0 == length(PATT) { exit }
END { system(length(PATT) ? "date >&2" : "true"); printf(length(PATT) ? "Seen " NR " lines since " START "\n" : "") > "/dev/stderr"; print(length(PATT) ? allLines : matched); exit(length(PATT)) }