Skip to content

Instantly share code, notes, and snippets.

View tecteun's full-sized avatar
💭
🤠

tecteun

💭
🤠
View GitHub Profile
@tecteun
tecteun / timtamlottery.js
Last active March 4, 2016 09:37 — forked from thepauljones/timtamlottery.js
Open sourced code to determine who in the team gets the overige tim tams after everyone has had one
var totalTimTamsinPack = 8; //For the Hellema brand
var people = ["fardau", "wilfred", "jeroen", "teun", "arjan", "erik", "paul"];
var usecrypto = true;
var timtamsleftAfterEveryoneGetsOne = totalTimTamsinPack - people.length;
var array = new Uint32Array(1);
while(timtamsleftAfterEveryoneGetsOne-- > 0){
var winer = null;
if(usecrypto){
window.crypto.getRandomValues(array);
@tecteun
tecteun / qifei.lua
Created May 12, 2016 20:54
Qifei 4-bit LED Digital Tube Module, NodeMCU ESP8266
--Cheap tube module, code for ESP8266 NodeMCU
--depends on ntp.lua
--https://gist.github.com/lucsmall/66d9b6539df7a0daa569
--http://www.esp8266.com/viewtopic.php?p=12733
--http://forum.43oh.com/topic/8596-4-digit-display-from-qifei/
--Qifei 4-bit LED Digital Tube Module, aka 74HC595
--
--D7 -> DIO
--D5 -> sclk
--D4 -> rclk
@tecteun
tecteun / arduino.service
Last active June 2, 2018 22:19
Arduino IDE remote upload configuration, network tcp upload bridge to leonardo connected to rpi
<!-- file: /etc/avahi/services/arduino.service -->
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">'%h' arduino bridge</name>
<service>
<type>_arduino._tcp</type>
<!-- port value not actually used when ssh_upload=yes -->
<port>22</port>
<txt-record>board=leonardo</txt-record>
@tecteun
tecteun / buildJson_Macro.hx
Last active January 31, 2019 23:17
buildJson macro, dynamically builds type from json in package config.*, autocomplete your json son!
import haxe.macro.Context;
import haxe.macro.Expr;
class Macro {
macro public static function buildJson(config_path:String, ?name:String = "JsonConfig"):Array<Field>{
var config_field_name = "data";
var config = null;
var traverse:Dynamic->?Null<Array<haxe.macro.Field>>->ComplexType = null;
@tecteun
tecteun / fix_throttling_when_idle.md
Last active December 28, 2020 11:06
Ubuntu studio / realtime audio processing (Intel(R) Core(TM) i7 CPU 870)

Gist:

throttling does not go well with realtime audio processing (resulting in a popcorn audio stream)

Having audio issues? Double check if u r throttling!!

see real live cpu frequency

watch grep \"cpu MHz\" /proc/cpuinfo
@tecteun
tecteun / run_firefox_debug.sh
Created April 14, 2020 07:32
Firefox MediaSource debugging
NSPR_LOG_MODULES=MediaSource:5,MediaSourceSamples:5,MediaFormatReader:5 /Applications/Firefox.app/Contents/MacOS/firefox
@tecteun
tecteun / levenshtein.js
Created October 23, 2020 11:53
levenshtein distance
// https://en.wikipedia.org/wiki/Levenshtein_distance
function lv(A, B) {
// create two work vectors of integer distances
let v0 = new Array(A.length);
let v1 = new Array(B.length);
// initialize v0 (the previous row of distances)
// this row is A[0][i]: edit distance for an empty s
// the distance is just the number of characters to delete from t
for(let i = 0; i <= B.length + 1; i++){
v0[i] = i;
@tecteun
tecteun / steam.sh
Last active December 26, 2020 19:15
steam proton config stash
# Improving proton performance:
# https://www.protondb.com/help/improving-performance
# Feral Gamemode:
# https://launchpad.net/~samoilov-lex/+archive/ubuntu/gamemode
ENABLE_VK_LAYER_VALVE_steam_fossilize_1=1 DXVK_STATE_CACHE=0 PROTON_NO_GLSL=0 PROTON_USE_D9VK=1 PROTON_NO_ESYNC=0 DXVK_ASYNC=1 %command% --waitforpreload --noasync --nodx9ex --gc2 --nologo
@tecteun
tecteun / unosyncer.ino
Created February 1, 2021 23:07
DIY Arduino Eurorack clock divider / multiplier using interrupt
// Timer library, https://github.com/dniklaus/wiring-timer,
// add it by using the Arduino IDE Library Manager (search for wiring-timer)
#include <Timer.h>
// LcdKeypad, https://github.com/dniklaus/arduino-display-lcdkeypad,
// add it by using the Arduino IDE Library Manager (search for arduino-display-lcdkeypad)
#include <LcdKeypad.h>
@tecteun
tecteun / main.dart
Last active May 3, 2022 13:16
big scroll test
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(
MyApp(
items: List<String>.generate(130, (i) => 'Item $i'),
),
);
}