Skip to content

Instantly share code, notes, and snippets.

View d-a-v's full-sized avatar

david gauchard d-a-v

  • Toulouse, France
View GitHub Profile
@d-a-v
d-a-v / tcpCleanup-snippet.ino
Last active January 1, 2024 09:22
portable way to clear tcp pcb in time-wait (esp8266/Arduino) - tcpCleanup() fix for lwip2
// https://github.com/esp8266/Arduino/issues/1923
// https://github.com/esp8266/Arduino/issues/4213
// compatible with lwip-v1 and -v2
// no need for #include
struct tcp_pcb;
extern struct tcp_pcb* tcp_tw_pcbs;
extern "C" void tcp_abort (struct tcp_pcb* pcb);
void tcpCleanup ()
@d-a-v
d-a-v / local.eagle.app.v6.common.ld
Created January 15, 2019 21:36
esp8266 arduino 2.5.0 ld script
/* This linker script generated from xt-genldscripts.tpp for LSP . */
/* Linker Script for ld -N */
PHDRS
{
dport0_0_phdr PT_LOAD;
dram0_0_phdr PT_LOAD;
dram0_0_bss_phdr PT_LOAD;
iram1_0_phdr PT_LOAD;
irom0_0_phdr PT_LOAD;
}
#
# -- Arduino boards.txt parser for FQBN details --
#
# random example:
# esp8266com:esp8266:d1:xtal=80,vt=flash,exception=disabled,eesz=4M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=460800
#
# description of possible values in configurable menu entries:
# (run with '--machine' for machine version)
#
#
@d-a-v
d-a-v / PR
Created September 7, 2019 16:26
Try a github Pull-Request
#!/bin/sh
test -z "$2" && { echo "syntax: $0 <PR-number> <temporary-name>"; exit 1; }
set -ex
git checkout master
git branch -D pr-$1-$2
git fetch origin pull/$1/head:pr-$1-$2
git checkout pr-$1-$2
set +x
echo "### Pull request #$1 should be here in current branch 'pr-$1-$2':"
git branch | grep pr-$1-$2
@d-a-v
d-a-v / testmap.cc
Created July 19, 2023 21:24
arduino map() tests
// g++ -Ofast -march=native -Wall -Wextra testmap.cc -o testmap && time ./testmap
#include <iostream>
#include <cmath>
#include <sys/time.h>
long map_test(long x, long in_min, long in_max, long out_min, long out_max) {
long in_length = in_max - in_min;
long out_length = out_max - out_min;