Skip to content

Instantly share code, notes, and snippets.

@Balder1840
Balder1840 / wsl2_love_openwrt.md
Last active June 30, 2025 23:18
Run OpenWrt as a custom distro in WSL2 (WSL2下直接运行openwrt)

Here is an instruction to start openwrt as a custom WSL2 distro.
I didn't start it as a gateway in my local because I don't have windows 11 installed, and you know the poor network mode in windows 10 and wsl2.

Found a way to set WSL's network mode to bridged here and have successfully configured it as a gateway in my local.

But anyway, I think it should work under windows 11 and wsl2, since you can config it as bridged mode.
Have fun!

1. Prerequisites

1.1. Import openwrt's rootfs.tar.gz as a custom WSL2 distro

you can download from the official site

@dzonesasaki
dzonesasaki / xiao_sleepRtc.ino
Created May 19, 2021 07:02
sample of sleep and wakeup on RTC using seeeduino xiao and Arduino-IDE
// sleep and wake test using RTC
// for seeeduino xiao
#include "RTC_SAMD21.h" //install seeed_arduino_RTC : https://github.com/Seeed-Studio/Seeed_Arduino_RTC
#include "DateTime.h"
#include <EnergySaving.h>
EnergySaving myPowSave;
RTC_SAMD21 myRtc;
#define PIN_LED 13
@robidev
robidev / smv_subscriber.ino
Created February 11, 2021 20:56
IEC 61850 SMV 9-2LE subscriber - this code uses the whiznet w5100 with interrupt-pin to accurately timestamp the moment a packet arrives, and allows to measure latency
/*
SMV receive
This sketch receives sampled values, and timestamps them
This code is in the public domain.
*/
#include <Ethernet.h>
#include <utility/w5100.h>
@robidev
robidev / smv_publisher.ino
Last active August 5, 2025 00:56
An IEC 61850 sampled value publisher using an arduino mega and ehternet shield 2 for testing purposes. Period=250us, standard deviation is 3us max=10us
/*
SMV transmit:
This sketch sends sampled values
This code is in the public domain.
*/
#include <Ethernet.h>
#include <utility/w5100.h>
@radames
radames / README.md
Last active March 4, 2024 06:44
How to connect to your Google Colab Notebook via SSH!

Connect to your Google Colab Notebook via SSH

Using this amazing project tmate.io you can SSH tunnel to your colab notebook machine. You can with few lines of code download the binary, run an instance in the background and output the generated SSH address.

!wget -nc https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-i386.tar.xz &> /dev/null
!tar --skip-old-files -xvf tmate-2.4.0-static-linux-i386.tar.xz &> /dev/null
!rm -f nohup.out; bash -ic 'nohup ./tmate-2.4.0-static-linux-i386/tmate -S /tmp/tmate.sock new-session -d & disown -a' >/dev/null 2>&1
!./tmate-2.4.0-static-linux-i386/tmate -S /tmp/tmate.sock wait tmate-ready
//==============================================================================
// ModbusRTU.cpp
//==============================================================================
/*-------------------------------------------------------------------------------
MODBUS RTU COMMUNICATION
Description:
Partial implementation of the Modbus RTU communication protocol.
@lucabuka
lucabuka / gist:4601e0fa137f7b6873c47d220f82b23f
Created January 14, 2018 18:56
Test program to check WIFI CLOSE + RECONNECT on DOIT ESP32 DEVKIT V1
/**
* @file esp32_reconnect_demo.ino
* @brief Test program to check WIFI CLOSE + RECONNECT on DOIT ESP32 DEVKIT V1
*
* The program connect to the WiFI network and than to a NTP server
* It prints in the loop "getEpochTime()" response from NTP server.
* If the WiFI connection is lost, it reconnects.
* After printing 15 times "getEpochTime()", it DESCONNECT WiFi
* to test reconnect capabilities.
*
@nobodyguy
nobodyguy / tracker.ino
Last active September 21, 2022 03:13
GpsLoRaWANTracker using Arduino, RN2483 and L86/neo-m8n GPS module
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <avr/sleep.h>
#include <avr/power.h>
// ----------------------------------------------
// DEFINES
// ----------------------------------------------
#define rxGpsPin 10
#define txGpsPin 11
@aeroaks
aeroaks / sudoSample.py
Last active April 8, 2025 05:56
Run Sudo command using Python
import subprocess
# run command using Popen and provide password using communicate.
# password requires byte format.
# sudo -S brings password request to PIPE
proc = subprocess.Popen(['sudo', '-S', 'nano', 'test.txt'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate(input=b'password\n')
# Print output and errors
print(proc)
@betrcode
betrcode / README.md
Created June 24, 2014 06:36
Using Python to check if remote port is open and accessible.