Skip to content

Instantly share code, notes, and snippets.

View devbis's full-sized avatar
:octocat:
Working

Ivan Belokobylskiy devbis

:octocat:
Working
View GitHub Profile
#!/bin/bash
# set -x
set -e
rm -rf /tmp/cookie.txt
get_token() {
curl -q 'http://192.168.1.1/asp/GetRandCount.asp' \
-X POST \
@devbis
devbis / README.md
Created April 27, 2025 13:07 — forked from mildsunrise/README.md
Documentation of Tuya's weird compression scheme for IR codes

[Tuya][]'s IR blasters, like the [ZS08][], have the ability to both learn and blast generic IR codes. These IR codes are given to the user as an opaque string, like this:

A/IEiwFAAwbJAfIE8gSLIAUBiwFAC+ADAwuLAfIE8gSLAckBRx9AB0ADBskB8gTyBIsgBQGLAUALA4sB8gRAB8ADBfIEiwHJAeARLwHJAeAFAwHyBOC5LwGLAeA97wOLAfIE4RcfBYsB8gTyBEAFAYsB4AcrCYsB8gTyBIsByQHgPY8DyQHyBOAHAwHyBEAX4BVfBIsB8gTJoAMF8gSLAckB4BUvAckB4AEDBfIEiwHJAQ==

Not much is known about the format of these IR code strings, which makes it difficult to use codes obtained through other means (such as a

#!/usr/bin/python3
import argparse
import os.path
import struct
import sys
# typedef struct _IMAGE_DOS_HEADER {
# uint16_t e_magic; /* 00: MZ Header signature */
# uint16_t e_cblp; /* 02: Bytes on last page of file */
@devbis
devbis / merge.py
Last active August 23, 2024 09:53
#!/usr/bin/env python3
import argparse
import os
import shutil
'''
https://unix.stackexchange.com/questions/127712/merging-folders-with-mv/510724#510724
https://stackoverflow.com/questions/22588225/how-do-you-merge-two-directories-or-move-with-replace-from-the-windows-command
'''
diff --git a/homed.cpp b/homed.cpp
--- homed.cpp
+++ homed.cpp
@@ -9,8 +9,13 @@
QDate date = QDate::currentDate();
QString instance;
m_config = new QSettings(configFile.isEmpty() ? QString("/etc/homed/%1.conf").arg(QCoreApplication::applicationName()) : configFile, QSettings::IniFormat, this);
+
+ if (!QLockFile(getLockFile()).tryLock(1000))) {
@devbis
devbis / 0001-MI-router-3-support.patch
Created July 2, 2024 15:04 — forked from Kexogg/0001-MI-router-3-support.patch
openwrt 22.03 Mi router 3 support
From 321e123f260522551a5654eb47603667cb06caea Mon Sep 17 00:00:00 2001
From: kexogg <kexogg@gmail.com>
Date: Sat, 25 Feb 2023 14:59:00 +0500
Subject: [PATCH] MI router 3 support
---
package/base-files/files/lib/upgrade/nand.sh | 3 +
package/boot/uboot-envtools/files/ramips | 1 +
.../ramips/dts/mt7620a_xiaomi_miwifi-r3.dts | 167 ++
target/linux/ramips/image/mt7620.mk | 21 +
const {
batteryPercentage,
temperature,
humidity,
enumLookup,
binary,
numeric,
quirkAddEndpointCluster,
} = require('zigbee-herdsman-converters/lib/modernExtend');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
@devbis
devbis / roidmi.cleaner.v382.js
Created January 17, 2024 13:40
roidmi.cleaner.v382.js
This file has been truncated, but you can view the full file.
(function (global) {
"use strict";
var __MIOTPACK__ = true;
global.require = metroRequire;
global.__r = metroRequire;
global.__d = define;
global.__c = clear;
global.__registerSegment = registerSegment;
var modules = clear();
@devbis
devbis / georgian-banks.yaml
Created April 12, 2023 08:27
Home Assistant sensors for USD-GEL rates in banks
scrape:
- resource: https://credobank.ge/en/
sensor:
- name: USD/GEL rate Credo
select: "body > div.wrap.container > div.content > main > div.news-section.full-width-padding-lr.flex-wrap.space-between > div.news-container.right > div > div.js-currency-box.currency-box.active > div > div:nth-child(2) > div.currency.second-column"
value_template: '{{ value | float }}'
unit_of_measurement: GEL
sensor:
- platform: rest
@devbis
devbis / dgnwg05lm-19-to-21.sh
Last active August 7, 2024 14:03
Upgrade to 21
#!/bin/sh
set -e
echo "Updating OpenWRT from version 19.07 to 21.02.5"
wget https://openlumi.github.io/archive/21.02.5/targets/imx6/generic/u-boot-xiaomi_dgnwg05lm/u-boot.imx -O /tmp/u-boot.imx
wget https://openlumi.github.io/archive/21.02.5/targets/imx6/generic/openlumi-21.02.5-imx6-imx6ull-xiaomi-dgnwg05lm.dtb -O /tmp/openwrt-imx6-imx6ull-xiaomi-dgnwg05lm.dtb
wget https://openlumi.github.io/archive/21.02.5/targets/imx6/generic/openlumi-21.02.5-imx6-xiaomi_dgnwg05lm-squashfs-sysupgrade.bin -O /tmp/openwrt-imx6-xiaomi_dgnwg05lm-squashfs-sysupgrade.bin
echo "The files are downloaded to the /tmp folder."