Skip to content

Instantly share code, notes, and snippets.

@ae-s
ae-s / hexdump.c
Last active February 11, 2023 01:55
Hexdump suitable for debugging
#include <ctype.h>
#include <stdio.h>
void hexdump(void *ptr, int buflen) {
unsigned char *buf = (unsigned char*)ptr;
int i, j;
for (i=0; i<buflen; i+=16) {
printf("%06x: ", i);
for (j=0; j<16; j++)
if (i+j < buflen)
@ae-s
ae-s / ingest.sh
Last active February 11, 2023 01:55
Receipt ingestion machine
#!/bin/bash
display -sample 600 $1 2>&1 >/dev/null &
viewer_pid=$!
sleep 0.5
echo '===='
echo 'What is the date shown? YYYY-MM-DD'
read -p 'date> ' -e -i "$date" date
@ae-s
ae-s / switch-foo.c
Last active February 11, 2023 01:56
Fun with C: Braces Optional
$ gcc switch-foo.c -o switch-foo
$ ./switch-foo
Got 1 for 1
$