Skip to content

Instantly share code, notes, and snippets.

View cnlohr's full-sized avatar

CNLohr cnlohr

View GitHub Profile
@cnlohr
cnlohr / test.json
Last active August 19, 2023 19:31
test
{"schemaVersion":1,"label":"Exe Size","message":"21672\nminiosctest","color":"orange"}
@cnlohr
cnlohr / goertzels_dft_comparison.c
Created January 14, 2023 19:29
Comparison of Goertzel's and DFT algorithms.
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define CNFG_IMPLEMENTATION
#include "rawdraw_sf.h"
void HandleKey( int keycode, int bDown ) { }
void HandleButton( int x, int y, int button, int bDown ) { }
@cnlohr
cnlohr / nreal notes.txt
Last active December 13, 2022 14:20
Nreal:AIR custom EDIDs (96 Hz,etc.) EDID custom mode timings
sudo xrandr --output DP-2 --newmode BB44 44 1920 1952 1968 2000 280 289 294 350 +hsync -vsync
It's wacky, but does work. Repeats screens
You can de/increase Y safely.
sudo xrandr --output DP-2 --newmode CC44 44 1920 1952 1968 2000 1080 1089 1094 1110 +hsync -vsync
Rate works at 44 and 66+
@cnlohr
cnlohr / xorg.conf
Last active October 22, 2022 10:40
Gettning NVIDIA to allow you to set arbitrary modes in xrandr
# Hacky, only works with startx, tested, october 2022 with 470.57.01
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
@cnlohr
cnlohr / SDL_add_logging.c
Created August 11, 2022 00:28
Make SDL Apps Emit Verbose Logging for Debugging Purposes
void SDL_LogVerbose()
{
// You can C&P theis code into yours before main.
SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_DEBUG);
}
@cnlohr
cnlohr / sandbox_esp32_s2_frequency_and_pro_alone_gpio.c
Created July 17, 2022 11:14
ESP32-S2 Experiments with pro alone GPIO + Overclocking.
#include <stdio.h>
#include "esp_system.h"
#include "swadgeMode.h"
#include "hdw-led/led_util.h"
#include "hal/gpio_types.h"
#include "soc/system_reg.h"
#include "soc/dport_access.h"
#include "soc/dedic_gpio_reg.h"
#include "soc/rtc_cntl_reg.h"
#include "esp_log.h"
@cnlohr
cnlohr / graph.c
Created July 14, 2022 04:40
Example command-line graphing tool for rawdraw.
#define CNFG_IMPLEMENTATION
#include "rawdraw_sf.h"
void HandleKey( int keycode, int bDown ) { }
void HandleButton( int x, int y, int button, int bDown ) { }
void HandleMotion( int x, int y, int mask ) { }
void HandleDestroy() { }
#include <pthread.h>
@cnlohr
cnlohr / libnl_example_basic_wifi.c
Created May 27, 2022 22:27
Really basic libnl test for getting wifi properties.
// Based on (but modified from)
/*************************************************************
* Description: We get some wifi info using nl80211 *
* Licence : Public Domain. *
* Author : Antonios Tsolis (2016) *
*************************************************************/
//
// Modifications by C. Lohr (still under public domain)
#include <stdio.h>
@cnlohr
cnlohr / esppgmmode.c
Last active February 4, 2022 00:36
Setting RTS/DTR on serial port from C in Linux for ESP8266 and ESP32 manual booting
#include <stdio.h>
#include <sys/ioctl.h> //ioctl() call defenitions
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
/* ESP8266 / ESP32 Dual-Transistor Boot Bridge:
DTR RTS RST GP0