Skip to content

Instantly share code, notes, and snippets.

View zaphodikus's full-sized avatar

Conrad Braam zaphodikus

View GitHub Profile
@zaphodikus
zaphodikus / load_1bpp_bmp.h
Last active February 11, 2026 10:32
Load a 1bpp image
// https://en.wikipedia.org/wiki/BMP_file_format#cite_ref-bmp_2-2
//
#ifndef WIN32
// defined in wingdi.h
constexpr uint32_t BI_RGB = 0;
constexpr uint32_t BI_RLE8 = 1;
constexpr uint32_t BI_RLE4 = 2;
constexpr uint32_t BI_BITFIELDS = 3;
constexpr uint32_t BI_JPEG = 4;
constexpr uint32_t BI_PNG = 5;
@zaphodikus
zaphodikus / ProgressBar.h
Created February 8, 2026 17:49
Console Progress bar
// ProgressBar.h
#pragma once
#include <iostream>
#include <fstream>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <chrono>
#include <thread>
@zaphodikus
zaphodikus / jsoncpp_objectducktype.cpp
Last active January 27, 2026 11:09
use jsoncpp to load /de-serialise a class'es data so we can duck-type it's values not rely on hard-coded keys from the json
// Load a Json/Yaml file into a duck-typable object not relying on typed in
// dictionary/map keys
//
#include <iostream>
// unused #include <vector>
#include <map>
// unused #include <sstream>
// note add json_reader.cpp, json_value.cpp, jon_write.cpp to your project
#include <json/json.h>
@zaphodikus
zaphodikus / main.py
Created January 17, 2021 17:27
Steam screenshot scrollable page with all images python
"""
This script uses a simplified version of the one here:
https://snipt.net/restrada/python-selenium-workaround-for-full-page-screenshot-using-chromedriver-2x/
It contains the *crucial* correction added in the comments by Jason Coutu.
"""
# system modules
import sys
from selenium import webdriver
from selenium.webdriver.common.by import By
@zaphodikus
zaphodikus / esp8266_hotspot
Created January 21, 2020 21:38
a make tutorial code dump
// https://www.instructables.com/id/Programming-a-HTTP-Server-on-ESP-8266-12E/
#include <ESP8266WiFi.h>
const short int BUILTIN_LED1 = 2; //GPIO2
const short int BUILTIN_LED2 = 16;//GPIO16
#define LED_PIN BUILTIN_LED2
WiFiServer server(80); //Initialize the server on Port 80
void setup() {