Skip to content

Instantly share code, notes, and snippets.

View LightningStalker's full-sized avatar

aka. N[]NE in gaming communities LightningStalker

View GitHub Profile
@LightningStalker
LightningStalker / tankfreq.cpp
Created November 7, 2024 05:36
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 / 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 / lineskip.sh
Last active June 13, 2024 10:59
conversion script for AT7456 / MAX7456 character sets from Maxim .MCM binary format to charset.h for reloading default character set, etc.
#!/bin/bash
# conversion script for AT7456 / MAX7456 character sets
# from Maxim .MCM binary format to charset.h
# for reloading default character set, etc.
# Project Crew 2024
exec<$1
value=1
echo "const char charset[] PROGMEM = {" > charset.h
read
#!/bin/bash
# script that reads a YAML (.yml) file and verifies a local file against its sha512 hash
# extraction of multiple digest entries not supported
# these .yml are rumored to be spawn of electron-builder or ...
hash=$(sed -n 's/^sha512: //p' $1 | base64 -d | xxd -p -c64)
fname=$(sed -n 's/path: //p' $1)
echo -n $hash' '$fname | sha512sum -c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <xdo.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
if (argc<2)
{
puts("Specify rep rate in milliseconds");
return 0;
/* Compile with gcc -Wall -o pinh pinh.c -lm
The formulator of the pinhole camera
microscopic probgramme by The Lightning Stalker ©April 11, 2022
It's basically in case I can't remember the formula.'*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@LightningStalker
LightningStalker / MPX_Stereo_Modulator.ino
Last active July 17, 2022 04:29
Digispark MPX Stereo Modulator
/* Digispark MPX Stereo Modulator
Based on a design found at
"http://cappels.org/dproj/FM_MPX_STEREO/
SIMPLE FM STEREO MULTIPLEX ENOCDER CIRCUIT.html"
Be sure to use adequate low paths pants filtering and stay FCC
part 15 compliant.
ATTinyCore board library v1.5.2
7/9/2022 ©The Lightning Stalker
*/
@LightningStalker
LightningStalker / concat.c
Created March 31, 2018 18:04
Concatenate and convert multiple videos into a single H.265 video
# 29.97fps `-r 30000/1001`
# Double speed `-filter:v "setpts=0.5*PTS"`
# 1.25 speed `-filter:v "setpts=0.75*PTS"`
ffmpeg -threads 11 -f concat -safe 0 -i files.txt -c:v hevc_nvenc -preset slow -profile:v main10 -tier high -rc vbr_hq -rc-lookahead 40 -no-scenecut 1 -init_qpP 23 -init_qpB 25 -init_qpI 21 -weighted_pred 1 output.mp4
@LightningStalker
LightningStalker / gov.c
Created August 27, 2017 03:49
Sets the frequency governor for all CPUs on the system
/*Compile with gcc -Wall -s gov.c -o gov
gov by The Lightning Stalker 8/26/2017
pops open cpufreq-set for each CPU and sets governor*/
#include <stdio.h>
#include <string.h>
#define NUMCPUS 12 // number of CPUs on the system ($ lscpu)
int main(int argc, char *argv[])
@LightningStalker
LightningStalker / valfind.c
Created August 25, 2017 22:38
Find resistor values for LM317
/*
* Find resistor values for LM317 using various criteria
* The Lightning Stalker 2014
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv)