Skip to content

Instantly share code, notes, and snippets.

View LightningStalker's full-sized avatar

LightningStalker

View GitHub Profile
@LightningStalker
LightningStalker / floperation.c
Last active August 13, 2024 13:39
Examine binary representations of floating point numbers on your machine
/* Compile with gcc -Wall -o floperation floperation.c -lquadmath*/
/* Examine binary representations of floating point numbers
on your machine
Project Crew 8/10/2024 */
//#include <immintrin.h>
#include <quadmath.h>
#include <stdint.h>
#include <stdio.h>
@LightningStalker
LightningStalker / tankfreq.cpp
Last active June 29, 2025 02:24
C++ version of tankfreq
/* compile with $ g++ -Wall -Os -o tankfreq tankfreq.cpp
*/
#include <iostream>
#include <iomanip>
#include <cmath>
#include <exception>
#include <locale> // std::locale, std::numpunct, std::use_facet
using namespace std;
@LightningStalker
LightningStalker / rngesus.cpp
Created November 21, 2024 10:48
Generates a random number between 1 and argv[1]
/* rngesus Generates random numbers >= 1 <= argv[1]
*
* Project Crew 11/21/2024
*/
#include <iostream>
#include <exception>
#include <random>
using namespace std;
@LightningStalker
LightningStalker / hellos.asm
Last active November 29, 2024 00:27
DOS assembly program that has a hidden string
.MODEL TINY
.STACK 100h
.DATA
;msg DB 'hello, world',13,10,'$'
msg DB 0d6h,0dbh,0d2h,0d2h,0d1h,092h,09eh,0c9h,0d1h,0cch,0d2h,0dah,0b3h,0b4h,09ah
.CODE
start:
@LightningStalker
LightningStalker / S.ASM
Last active April 6, 2026 13:55
DOS Screen Saver - blanks the sreen and waits for keypress
name cs
title CS.COM--blank the Screen (CGA version)
;--- assemble: uasm -bin -Fo CS.COM CS.ASM
;
; Project Crew™ 12/6/2024
.model tiny
modsel equ 3d8h ; CGA Mode-Select Register
@LightningStalker
LightningStalker / dskimg.asm
Last active April 6, 2026 14:38
DOS - Save image of disk A: in current directory to file DSK.IMG
name dskimg
page 55,132
title DSKIMG.COM--save a disk image
; Project Crew™ 1/18/2025
.MODEL tiny ; Create DSKIMG.COM
bytes equ 64 * 512 ; number of bytes in buffer
exit equ 4c00h ; exit back to DOS
@LightningStalker
LightningStalker / cpdump.c
Last active January 20, 2025 10:45
Dump DOS codepage to stdout
/* cpdump.c
* ugly little DOS program to dump ASCII codepage to stdout
* quick way to find character
* might look beter with a case
* - Project Crew Jan 2025
*/
#include <stdio.h>
int
@LightningStalker
LightningStalker / pingstamp.sh
Created March 7, 2025 15:32
ping with sound and timestamps
#!/bin/bash
# ping with timestamps and sound Only successful pings are printed
ping ${1} | \
xargs -I {} date +'[%c] {}' | \
grep --line-buffered bytes | \
while read line
do
echo "$line" && aplay -q ~/Sound/DING.WAV
done
@LightningStalker
LightningStalker / pi.cpp
Last active March 23, 2025 22:35
Calculates pi and gives some realtime statistics
#include <iostream>
#include <iomanip>
#include <cmath>
#include <limits>
#include <quadmath.h>
#include <exception>
//#include <boost/multiprecision/cpp_bin_float.hpp>
using namespace std;
/*
@LightningStalker
LightningStalker / mvshot.sh
Created April 10, 2025 23:28
Shell script that renames some numbered files
#!/bin/bash
ls mpv-shot*.jpg > b
YEAR=$(date +%Y)
COUNT=$(wc -l < b)
FIRST=$((`ls Pictures/$YEAR/mpv-shot*.jpg | wc -l` + 1))
LAST=$(($FIRST + $COUNT - 1))
seq -f %04.0f $FIRST $LAST |
paste b - |