Skip to content

Instantly share code, notes, and snippets.

@Ynn
Ynn / main.cpp
Created February 14, 2018 15:56
esp8266 : sniff, send in udp, then sniff another channel
#include <Arduino.h>
#ifdef ESP8266
extern "C" {
#include "user_interface.h" //to gain access to promiscuous mode
}
#endif
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
@reaper7
reaper7 / apps.ino
Last active March 24, 2018 06:00
M5StackSAM MAX17043 1-Cell Fuel Gauge App
// MAX17043 1-Cell Fuel Gauge
// APP for https://github.com/tomsuch/M5StackSAM
void appAccuMeter(){
MyMenu.drawAppMenu(F("ACCU METER"),F(""),F("ESC"),F(""));
const int MAX17043ADDR=0x36;
const int MAX17043CMDADDR=0xFE;
const int MAX17043SOCADDR=0x04;
const int MAX17043VCELLADDR=0x02;
time_t tmp_tmr;
double soc, volt;
@tomtor
tomtor / ESP32-ULP-Blink-DHT22.ino
Last active August 19, 2020 08:53
ESP32: ULP LED Hart beat and read DHT22 sensor
@jcberthon
jcberthon / networkmanager-wifi-powersave.md
Last active June 21, 2024 06:28
NetworkManager Wi-Fi powersaving configuration

NetworkManager WiFi Power Saving

NetworkManager supports WiFi powersaving but the function is rather undocumented.

From the source code: wifi.powersave can have the following value:

  • NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0): use the default value
  • NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1): don't touch existing setting
  • NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2): disable powersave
@castaneai
castaneai / hexs-bin-convert.js
Last active September 3, 2019 16:58
converting HexString <-> Uint8Array with javascript
/**
* "1A 2B 3C" のような16進数表記文字列をバイト配列に変換する
*/
$scope.hexs2bytes = function(hexs) {
return hexs.split(' ').map(function(h) { return parseInt(h, 16) });
};
/**
* バイト配列を"1A 2B 3C"のような16進数表記文字列に変換する
*/
@cannin
cannin / installPackages.R
Last active February 29, 2024 19:02
Install/update necessary packages from CRAN, Bioconductor, GitHub, or local source given a vector of strings with names of packages or DCF-based parameter file
#' Install/update necessary packages from CRAN, Bioconductor, GitHub, or local sources
#'
#' @param file a file with packages; overrides packages parameter
#' @param packages a vector of strings with names of packages from CRAN, Bioconductor, GitHub
#' @param updatePackages whether to update existing packages (Default: FALSE)
#' @param dryRun whether to test for missing packages (Default: FALSE)
#'
#' @example
#' \dontrun {
#' source("https://gist.githubusercontent.com/cannin/6b8c68e7db19c4902459/raw/installPackages.R")