Skip to content

Instantly share code, notes, and snippets.

View lifning's full-sized avatar
💜

liffy lifning

💜
View GitHub Profile
@lifning
lifning / AFS_Unpk.c
Last active April 23, 2022 09:49
an ancient (ca. 2005) sega dreamcast AFS archive unpacker written by a high schooler who still commented every line of their programs
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
struct afsHeader // Header of the file
{
char magic[4]; // Magic word "AFS"
uint32_t count; // Number of .ADX files in the archive
};
@lifning
lifning / mkvoidchroot.sh
Created July 29, 2021 05:30
quickly make a void chroot in a foreign architecture for testing things in a binfmt-misc context
#!/bin/bash
set -exo noclobber
ARCH="${1:?}"
ROOT="/var/chroot/void-$ARCH"
REPO=https://alpha.us.repo.voidlinux.org/current
if [[ "$ARCH" =~ ^ppc ]] ; then
case "$ARCH" in
ppc) REPO=https://repo.voidlinux-ppc.org/current/ppc ;;
ppc-musl) REPO=https://repo.voidlinux-ppc.org/current/ppc/musl ;;
@lifning
lifning / frick.diff
Created June 19, 2017 08:33
update newlib url in gendev
diff --git a/Makefile b/Makefile
index 5fa8fc2..0f3c687 100644
--- a/Makefile
+++ b/Makefile
@@ -114,7 +114,7 @@ work/binutils-$(BINUTILS_VERSION).tar.bz2:
NEWLIB_PKG=work/newlib-$(NEWLIB_VERSION).tar.gz
work/newlib-$(NEWLIB_VERSION).tar.gz:
- cd work && $(MGET) ftp://sources.redhat.com/pub/newlib/newlib-$(NEWLIB_VERSION).tar.gz
+ cd work && $(MGET) ftp://sourceware.org/pub/newlib/newlib-$(NEWLIB_VERSION).tar.gz
@lifning
lifning / _io.S
Last active June 21, 2017 07:42
building gambit for m68k-elf
This file has been truncated, but you can view the full file.
#NO_APP
.file "_io.c"
.text
.align 2
.type ___setup_mod, @function
___setup_mod:
move.l %a5,-(%sp)
lea (%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %a5
move.l ___lp@GOT(%a5),%a0
move.l (%a0),%d0
@lifning
lifning / Makefile
Last active August 29, 2015 13:56
Messing with nuances of stdin/stdout timing in C
CFLAGS = -Wall -pedantic
all: print-time delayed-receiver
./print-time | ./delayed-receiver
clean:
$(RM) print-time delayed-receiver *.o
print-time: print-time.o
@lifning
lifning / ec2-backup.sh
Created February 15, 2013 19:48
A backup script I wrote as a system administration course assignment in 2011.
#!/bin/bash
set -e
# print usage information if -h flag is passed
usage()
{
cat 1>&2 <<EOF
usage: $0 [-hv] [-i instance] [-m method] [-t tag] -d dir
-h Print a usage statement and exit.
-v Be verbose.
@lifning
lifning / jtv-glc.sh
Created November 25, 2012 10:11
Scripts for streaming to twitch.tv on Linux.
#!/bin/bash
JTV_STREAM_KEY=$(cat ~/Dropbox/jtv-key)
JTV_STREAM_URL=rtmp://live.justin.tv/app/${JTV_STREAM_KEY}
exec glc-capture --disable-audio -f 30 -z none -o /dev/stdout -s "${@}" \
| glc-play /dev/stdin -y 1 -o /dev/stdout \
| ffmpeg \
-f yuv4mpegpipe -i /dev/stdin \
-f pulse -itsoffset 0.2 -sample_rate 22050 -i default \
-f flv -vcodec libx264 -vf "scale=-1:360" -r 30 \
@lifning
lifning / get-checksums.sh
Created October 9, 2012 02:50
Quick and dirty script to get multiple types of checksum for a file.
#!/bin/bash
dir=$(mktemp -d)
cmd="cat \"${1}\" | tee"
shift
sums="md5 sha1"
if [ ! -z "${*}" ] ; then
sums="${@}"
@lifning
lifning / glc-stream-and-record.sh
Created June 16, 2012 07:32
An attempt at a streaming-and-recording GLC script that doesn't work.
#!/bin/bash
mkfifo fifo.{glc,yuv,wav} fifosound.glc
glc-capture -o - -s $* | tee -a fifosound.glc > fifo.glc &
ffmpeg -i fifo.yuv -i fifo.wav -o recording.mkv &
glc-play fifosound.glc -a 1 -t -o fifo.wav &
glc-play fifo.glc -y 1 -t -o - | tee -a fifo.yuv | yuv4mpeg_to_v4l2 /dev/video1
@lifning
lifning / glc-stream.sh
Created June 16, 2012 01:42
Used in conjunction with glc and v4l2loopback, this can stream games.
#!/bin/bash
mkfifo fifo.glc
glc-capture -o fifo.glc -s "${@}" &
glc-play fifo.glc -y 1 -t -o - | yuv4mpeg_to_v4l2 /dev/video1
rm -f fifo.glc