Skip to content

Instantly share code, notes, and snippets.

@TalalMash
TalalMash / gist:2538ed7371b35cb3f9e50188729f6acb
Last active March 28, 2022 20:11
[Tasmota] SR-04 Ultrasonic Tank Level measurement rules
Rule1 ON sr04#distance>0 DO Backlog var1=((((%value%*)-20)-(EM-20))/(EM-20))*-100; var2=(var1*0.01)*LT; event sendval ENDON
Rule1 + ON event#sendval DO publish tele/watertank/LEVEL %var1% ENDON ON event#sendval DO publish tele/watertank/VOLUME %var2% ENDON
Rule1 1
Replace:
-LT with the number of liters
-EM with the distance when the tank is empty.
You will get percentage (level) and number of liters, accurate starting from 60cm deep tanks.
SR-04 (water proof) is recommended for use.
@TalalMash
TalalMash / adsl.sh
Last active April 29, 2022 09:30
[OpenWRT] Auto-reboot bad ISP modems on PPP down (Broadcom)
#!/bin/sh
#Add this file to /root
#For interactive adjustments and keyboard input, install screen "opkg update && opkg install screen"
#and add to rc.local before exit 0: "screen -d -m sh -c "sh /root/adsl.sh" &"
#Enable telnet/port-23 in modem settings, usually open by most bad ISPs
#Replace <> fields with your settings
while :
@TalalMash
TalalMash / gist:caaae617e288e8a1c4a75a7a3b328556
Last active May 22, 2024 20:42
[OpenWRT 21] MPTCP over Wireguard with XRAY (TCP only for now)

TODO:

  • Provide pre-compiled MPTCP 5.4 kernel
  • Add service for xray
  • Add Ubond for non-TCP aggregation (link quality monitor WIP)

Notes:

  • Direct MPTCP is not reliable even if the path is not filtered over the Internet
  • Using firewall markings to tunnel each Wireguard to it's respective WAN
  • ~700Mbit MPTCP aggregation (direct) tested on Pi 4 stock frequency with local 2 links
@TalalMash
TalalMash / [OpenWRT] UBOND Example
Last active April 25, 2023 10:08
[OpenWRT] UBOND Example
Download binaries: https://github.com/TalalMash/ubond/releases/tag/v0.1.1
Disable encryption for 400Mbit+ , force DNS over HTTPS if needed.
Temporarily running as root. (tun bugfix TODO)
----------------------
VPS/crontab -e:
@reboot screen -d -m sh -c "/root/startubond.sh"
----------------------
/root/startubond.sh
----------------------
#!/bin/sh
@TalalMash
TalalMash / Migrate iGPU.md
Last active July 11, 2022 20:34
[Optimus] Move dGPU apps to iGPU gracefully for power saving

In a bat file, replace with Device Instance Path from Device Manager dGPU properties

pnputil /disable-device "PCI\VEN_10DE&DEV_25E0&SUBSYS_3AAC17AA&REV_A1\4&1D71CFEE&0&0009"
pnputil /enable-device "PCI\VEN_10DE&DEV_25E0&SUBSYS_3AAC17AA&REV_A1\4&1D71CFEE&0&0009"

Create shortcut to the bat file

image image

@TalalMash
TalalMash / armv7-no-neon.sh
Last active September 16, 2023 03:10
[OpenWRT] EasyTether on ARMv7 without NEON CPUs
#!/bin/sh
###INSTRUCTIONS###
#SSH to router & download this script (copy RAW button) and easytether (openwrt19 zip file) in the same directory using command wget <link>
#run: sh armv7-no-neon.sh
#Script will autoinstall, the package in the same directory: easytether-without-neon.ipk can be used for other deployments
#Tested: Slate AX
rm -r build-xiej43 download-s39c
mkdir build-xiej43 download-s39c
@TalalMash
TalalMash / Fast-ABS (Use this!).csv
Last active January 13, 2023 21:13
Pegasus 12-inch Klipper/Mainsail - SKR Mini E3 v3.0 - 42BHH48-150K-24 Steppers - Cura - Original Titan E3Dv6-lite - 0.4mm brass nozzle
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Section;Extruder;Key;Type;Value
general;0;Date;str;14/01/2023 00:11:36
general;0;Os;str;Windows 10.0.22621
general;0;Cura_Version;str;5.2.1
general;0;Profile;str;Fast-ABS (Use this!)
general;0;Quality;str;Fast
general;0;Extruder_Count;int;1
resolution;1;layer_height;float;0.2
resolution;1;layer_height_0;float;0.2
resolution;1;line_width;float;0.3
@TalalMash
TalalMash / SuperSlicer (3GB RAM) or Cura (5GB RAM) on Android (64 bit)
Last active April 17, 2024 19:08
SuperSlicer (3GB RAM) or Cura (5GB RAM) on Android (64 bit)
ETA setup: ~1 hour.
1. Install termux and follow https://ivonblog.com/en-us/posts/termux-compile-mesa-driver/
2. Add startx file in home directory with the following content:
#!/bin/sh
termux-x11 &
udroid -l xfce4
3. Add startx file inside Ubuntu home directory with the following content:
@TalalMash
TalalMash / [Prusa style] Auto align dual Z-motor Y-axis on first home only once after power up.md
Last active November 22, 2022 19:42
[Prusa style] Auto align dual Z-motor Y-axis on first home only once after power up

demo

Requirements:

  • Rigid couplers (use ball bearing for flexible)
  • Add extra 20mm in your Z limit configuration to allow stepper stalling
  • Physical limiter (e.g a screw in the extrusion on both sides with equal distances)
  • (optional) Software current control for low noise on stalls; using TMC in this example

Functions:

  • Aligns the two leadscrew-driven motors only once after powerup on the first G28 command until next power cycle.
@TalalMash
TalalMash / Rclone GUI service.vbs
Created March 19, 2023 22:24
[Windows] Rclone GUI Service in background
Set oShell = CreateObject ("Wscript.Shell")
Dim cmdStrs : cmdStrs = Array( _
"D:\Downloads\rclone-v1.62.2-windows-amd64\rclone-v1.62.2-windows-amd64\rclone.exe rcd --rc-web-gui" _
)
For Each cmdStr In cmdStrs
oShell.Run cmdStr, 0, false
Next