Skip to content

Instantly share code, notes, and snippets.

View LightningStalker's full-sized avatar

LightningStalker

View GitHub Profile
@LightningStalker
LightningStalker / Makefile
Created August 16, 2025 08:48
Build all programs in the current directory
# It builds all programs in the current directory.
SUFFIX := cpp
BASENAME := basename
ECHO := /bin/echo
RM := rm
TEST := /bin/test
XARGS := xargs
@LightningStalker
LightningStalker / neoblink.ino
Created August 2, 2025 04:27
Neopixel blink sketch example
@LightningStalker
LightningStalker / wind_chill.cpp
Created August 1, 2025 07:27
Find the wind chill
/* Compile with $ g++ -Wall -o wind_chill wind_chill.cpp
*
* ported from meteocalc by Project Crew™ on 8/1/2025
* see https://web.archive.org/web/20110918010232/http://www.weather.gov/os/windchill/index.shtml
* https://en.wikipedia.org/wiki/Wind_chill
*/
#include <iostream>
#include <cmath>
#include <string>
@LightningStalker
LightningStalker / heat_index.cpp
Last active August 1, 2025 07:29
Find the heat index
/* compile with $ g++ -Wall -Os -o heat_index heat_index.cpp
*
* ported to C++ from meteocalc by Project Crew™ 7/28/2025
* tested against "Heat index calculator" of Calculator.net
* see https://en.wikipedia.org/wiki/Heat_index
* http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml
*/
#include <iostream>
#include <iomanip>
@LightningStalker
LightningStalker / dewpoint.cpp
Last active July 27, 2025 21:36
Dew point calc
/* Compile with $ g++ -Wall -o dewpoint dewpoint.cpp
*
* ported from meteocalc by Project Crew™ on 7/26/2025
*/
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <filesystem>
@LightningStalker
LightningStalker / cvtojoule.cpp
Last active September 4, 2025 04:56
Joules caclulater for capactor of size C being charged to Voltage V
/* Capacitance + Voltage² -> joules calc
* Project Crew™ 6/28/2025
*/
#include <iostream>
#include <cmath>
#include <exception>
using namespace std;
int
@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 - |
@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 / 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 / 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