Skip to content

Instantly share code, notes, and snippets.

@esnho
esnho / lsm303agr-compas.ino
Created June 24, 2024 06:51 — forked from CalebFenton/lsm303agr-compas.ino
LSM303AGR Compass Example with calibration and z-axis
/*
* LSM303AGR Compass Example
*
* From what I can gather, this shows the proper way to get a compas heading from the LSM303.
* It solves two problems which aren't addressed in the Adafruit example code:
* 1.) Show how to incorporate min and max values from calibration. Makes a HUGE difference in my testing.
* 2.) Take the z-axis into account.
*
* Based heavily off Adafruit example code and https://github.com/pololu/lsm303-arduino.
*/
#remember that rsync will create a target folder with the last folder in your source path
rsync -vhrtu --progress --exclude=node_modules [source/folder/foo/bar] [target/folder/foo]
@esnho
esnho / configure_raspberry_pi_to_loop_a_video.sh
Created August 4, 2023 13:47
Configure Raspberry PI to loop a video
# Raspberry PI 3B
# OS Version: Debian Buster (Raspberry PI OS Legacy)
# Configure your PI then open a terminal
# here you should set your preferences, I usually start HDMI in safe mode
sudo nano /boot/config.txt
# paste below script in videoloop file, source: https://community.spiceworks.com/how_to/135908-loop-a-single-video-on-a-raspberry-pi
sudo nano /etc/init.d/videoloop
@esnho
esnho / print-element.js
Created December 17, 2022 16:46
Print an element of the page using a new window, useful to save page snippet from the developers console
PrintElem = (elem) =>
{
var mywindow = window.open('', 'PRINT', 'height=400,width=600');
mywindow.document.write('<html><head><title>' + document.title + '</title>');
mywindow.document.write('</head><body >');
mywindow.document.write('<h1>' + document.title + '</h1>');
mywindow.document.write(elem.innerHTML);
mywindow.document.write('</body></html>');
@esnho
esnho / attestation
Last active January 22, 2022 13:23
I am attesting that this GitHub handle esnho is linked to the Tezos account tz1Xye21UorssHqTHEyMQso5EG95sssea9vN for tzprofiles
sig:edsigtmv5TvDgLH2H9u3k3abmRsD41gxALvrYELtKLF1n1Y7HbbjRRHMN2kxoawaQm52XRZGCaroKXi3MPuMbrGYvRNSe8EHCKd
@esnho
esnho / fxhashFeatures-helper.js
Created November 20, 2021 11:35
fxhashFeatures-helper
const called = [];
// get a feature from defined
export function getHash(hash) {
if (window.$fxhashFeatures[hash] === undefined) {
const msg = `missing feature ${hash}`;
window.alert(msg);
throw new Error(msg);
}
called.push(hash);
@esnho
esnho / rarity.js
Created November 15, 2021 21:17
rarity hypothesis
let editionCount;
// count the editions
editionCount = window.localStorage.getItem('editionCount');
editionCount = editionCount ? Number(editionCount) + 1 : 1;
window.localStorage.setItem('editionCount', editionCount);
// create inspector
const inspector = document.createElement('div');
@esnho
esnho / swing.glsl
Created September 24, 2021 17:07
Swinging geometry shader for structure
attribute vec4 vertex;
attribute vec4 normal;
attribute vec2 textureCoord;
varying vec4 ncoord;
varying vec4 vcoord;
varying vec2 tcoord; //
uniform sampler2D tex; // texture one
uniform sampler2D tex2; // texture two
uniform vec2 tres; // size of texture (screen)
@esnho
esnho / skew-in
Last active September 19, 2021 20:45
skew-in for erogenous tone structure, doesn't work!
precision mediump float;
// template : glsl.ergonenous-tones.com
varying vec2 tcoord; // location
uniform sampler2D tex; // texture one
uniform sampler2D tex2; // texture two
uniform vec2 tres; // size of texture (screen)
uniform vec4 fparams; // 4 floats coming in
uniform ivec4 iparams; // 4 ints coming in
uniform float ftime; // 0.0 to 1.0
@esnho
esnho / appunti
Last active January 28, 2021 08:06
# ffmpeg interpolation from
## https://www.hellocatfood.com/misusing-ffmpegs-motion-interpolation-options/
ffmpeg -i lnm_faces_original.mp4 -filter:v "setpts=40*PTS,minterpolate='fps=24:scd=none:me_mode=bidir:vsbmc=1:search_param=400'" -y output.mp4
mv output.mp4 deer.head-5fps-to-25fps-30pts-search_param-400.mp4
ffmpeg -i deer.head-5fps.mp4 -filter:v "setpts=1*PTS,minterpolate='fps=24:scd=none:me_mode=bidir:vsbmc=1:search_param=400'" -y deer.head-24fps-1pts.mp4