Skip to content

Instantly share code, notes, and snippets.

View cnlohr's full-sized avatar

CNLohr cnlohr

View GitHub Profile
@cnlohr
cnlohr / gist:1979b6d1b52d3724ef64d6e706420b8a
Last active November 13, 2020 16:22
Issue with rendering order in HTML
@cnlohr
cnlohr / .txt
Created October 19, 2020 06:29
How to dynamically test hdmi_timings with Raspberry Pi
Having a hard time getting the timings you want working? Try this.
config.txt:
Then execute this command (or put it in rc.local)
vcgencmd hdmi_timings 2880 0 55 10 55 1600 0 30 6 570 0 0 0 90 0 593000000 3 && tvservice -e "DMT 87" && tvservice -s
@cnlohr
cnlohr / forgot_to_check_out_with_recurse_submodules.md
Last active April 22, 2024 12:13
Git forgot to clone recursively (forgot to check out with recurse submodules)
@cnlohr
cnlohr / tensigral_lamp touch.c
Last active March 13, 2020 18:47
Example of using software-defined touch buttons on the STM32F042.
#include "touch.h"
#include "systems.h"
uint8_t touch_calib[3];
uint8_t done_startup;
//DO_PD means we use the internal pull-down resistors to measure the capacitance
//if we define this to be 0, then it will use the internal pull-up resistors.
//I am still experimenting with both options to see which is better overall and
//in a lot of situations.
@cnlohr
cnlohr / OpenVR Frame of reference change with cnovr
Created October 28, 2019 20:19
For converting from raw_and_uncalibrated to standing.
printf( "Conv: \n" );
struct HmdMatrix34_t mzerotoabs = cnovrstate->oSystem->GetRawZeroPoseToStandingAbsoluteTrackingPose();
printf( "%f %f %f %f\n", PFFOUR( mzerotoabs.m[0] ) );
printf( "%f %f %f %f\n", PFFOUR( mzerotoabs.m[1] ) );
printf( "%f %f %f %f\n", PFFOUR( mzerotoabs.m[2] ) );
cnovr_pose pstanding;
matrix44_to_pose( &pstanding, &mzerotoabs.m[0][0] );
printf( "%f %f %f %f %f %f %f %f\n", PFTHREE( pstanding.Pos ), PFFOUR( pstanding.Rot ), pstanding.Scale );
@cnlohr
cnlohr / esp32_aes_example.c
Created November 7, 2018 19:50
Example of using hardware AES 256 Crypto in CBC mode on the ESP32 using ESP-IDF
#include <string.h>
#include <stdio.h>
#include <hwcrypto/aes.h>
/*
For Encryption time: 1802.40us (9.09 MB/s) at 16kB blocks.
*/
static inline int32_t _getCycleCount(void) {
int32_t ccount;
@cnlohr
cnlohr / triangle_modified.c
Created June 16, 2018 16:58
Modified triangle.c from raspberry pi, showing significant slowdown with draw calls.
/*
Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
/dts-v1/; /plugin/;
/ {
// compatible = "allwinner,sun50i-h5-mali",
// "arm,mali-450";// "allwinner,sun50i-h5";
fragment@0 {
target-path = "/";
__overlay__ {
@cnlohr
cnlohr / HMD_config.json
Created March 26, 2018 20:28
Charles' Vive HMD config json
{
"acc_bias": [
0.1137,
-0.075,
-0.4349
],
"acc_scale": [
1.001,
0.9997,
0.9995
@cnlohr
cnlohr / Kyocera-EP-C170N-KPDL.ppd
Created January 25, 2018 05:27
PPD File for CUPS Linux and OSX Printing for Kyocera EP C170N Printer
*PPD-Adobe: "4.3"
*%=============================================================================
*%
*% PPD file for Kyocera EP C170N (English)
*% Linux Version
*%
*% Copyright (C) 2000 KYOCERA CORPORATION.
*% Copyright (C) 2007 Revised Edition KYOCERA MITA CORPORATION.
*%
*% Permission is granted for redistribution of this file as long as this