Skip to content

Instantly share code, notes, and snippets.

View LightningStalker's full-sized avatar

LightningStalker

View GitHub Profile
/* 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)
@LightningStalker
LightningStalker / tankfreq.c
Created August 25, 2017 22:36
LC Tank resonance frequency calculator
/* Compile with gcc -Wall -o tankfreq tankfreq.c -lm */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv)
{
if (argc == 3)
{
@LightningStalker
LightningStalker / skipstrip.c
Created August 25, 2017 22:35
Display every 4th character of input string
/*
* Copies every 4th chararacter out of the input string
* Created to deal with MS Hotmail's problems
* 2015 The Lightning Stalker
*/
#include <stdio.h>
#include <string.h>
int main (int argc, char **argv)
@LightningStalker
LightningStalker / seriesw.c
Created August 25, 2017 22:35
Find wattage dissipated by potentiometer and series resistor
/* compile with "gcc -Wall -oseriesw seriesw.c -lm"
*
* Steps through possible pot settings and finds the wattage dissipated
* by the pot and a series resistor.
* - by The Lightning Stalker 2014
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@LightningStalker
LightningStalker / rpms.c
Last active July 8, 2024 09:21
Calculates RPMs based on input from the keyboard
/*
* RPM calculator
* Takes input from the keyboard
* Uses the ncurses library
* by The Lightning Stalker
*
* needs a rewrite to use clock_gettime(CLOCK_TAI, ...)
*
* Compile with gcc -Wall -o rpms rpms.c -lcurses
*/
@LightningStalker
LightningStalker / resetusb.c
Created August 25, 2017 22:32
Resets the USB busses, makes devices reattach without unplugging and plugging back in
#include <stdio.h> // requires usblib
#include <usb.h> // compile with #gcc -Wall -o resetusb resetusb.c -lusb
int main(void)
{
struct usb_bus *busses;
usb_init();
usb_find_busses();
usb_find_devices();
busses = usb_get_busses();