Skip to content

Instantly share code, notes, and snippets.

View jfogarty's full-sized avatar
🕷️
Annoying

John Fogarty jfogarty

🕷️
Annoying
View GitHub Profile
@jfogarty
jfogarty / tsprintf.h
Created July 21, 2023 18:09
C++ templates based safe sprintf
using CString = const char*;
using String = std::string;
//-----------------------------------------------------------------------------
// Template based sprintf replacement
//-----------------------------------------------------------------------------
class TSException : public std::runtime_error {
public:
TSException() : std::runtime_error("Typed String format exception") { }
TSException(CString what) : std::runtime_error(what) { }
@jfogarty
jfogarty / get_AID_OPC.sh
Created October 2, 2019 16:10
Recover a file from extended RAM under a hypervisor guest OS
function chr() {
printf \\$(printf '%03o' $((16#$1)) )
}
addr=$((16#302100000))
cx=$(devmem $addr w)
c=$((16#${cx:2}))
echo "- The file size is $c bytes."
a=$((addr + 4))
for (( i=0; i<$c; i++)) ; do