Skip to content

Instantly share code, notes, and snippets.

View M4GNV5's full-sized avatar

Jakob Löw M4GNV5

View GitHub Profile
@M4GNV5
M4GNV5 / node-red-node.js
Created June 9, 2024 21:58
smart home energy management
// output nodes: [miner on/off, ventilation target, temperature target, user message]
const enabled = global.get("enablePvHeating");
const minerEnabled = global.get("enablePvMining");
const roomTempLow = parseFloat(global.get("minTemperature"));
const pvPower = parseFloat(flow.get("pvPower"));
const temp = parseFloat(flow.get("insideTemperature"));
const tempToHouse = parseFloat(flow.get("toHouseTemperature"));
const ventTarget = parseFloat(flow.get("ventilationTarget"));
const minerStatus = flow.get("minerStatus");
@M4GNV5
M4GNV5 / disassemble.py
Created October 4, 2023 08:56
TeamItaly CTF 2023 disassembler for challenge secure comparator
syscall_table = {
128: "getc",
127: "putc",
42: "sleepOrHalt",
}
# from checker.bin call table
call_table = {
0: 0x90,
1: 0x400,
#!/bin/bash
function analyzeFileForDay
{
local dateStr=$(date '+%d/%b' --date="$1 day ago")
local count=$(grep "$dateStr" /mnt/docker-apps/traefik/logs/access.log* \
| grep '"proxy@docker"' \
| awk '{ print $1; }' \
| sort \
| uniq -c \
@M4GNV5
M4GNV5 / generate-lunch-slack-poll.py
Last active March 21, 2022 10:24
Generates a Message to ask where we take lunch today at THI. Uses Neuland App APIs
import requests
from datetime import datetime
def generate_meals_list(url):
data = requests.get(url).json()
today = datetime.now().strftime('%Y-%m-%d')
entries = [x for x in data if x["timestamp"] == today]
if len(entries) == 0:
return "keine Einträge :("
@M4GNV5
M4GNV5 / luca-sms-bypass.js
Last active April 11, 2023 22:01
Bypass luca-app sms verify allowing users to test the app without a real phone number. Use responsibly
// Paste this into the js console of your browser whilst viewing the Luca webapp
(function() {
var originalFetch = fetch;
window.fetch = (url, options) => {
if(url === '/api//v3/sms/request') {
console.log('hooked fetch', url, options);
return Promise.resolve({
json: () => Promise.resolve({
challengeId: '00000000-0000-0000-0000-000000000000',
})
function optimized func(i1 : int) : int
incoming_reg(i1, rdi)
.L:
i3 = 42
l5 = retrieve_frame_pointer
outgoing_reg(i3, rsi)
outgoing_reg(l5, rdi)
call child
.L:
return_reg(i8, rax)
import Data.Ord
import Data.List
import Data.Function
dice n = [1..n]
combinations xs ys = concat $ map (\y -> map (\x -> x : y) xs) ys
diceCombinations n k = foldr (combinations) (map return diceN) (replicate (k - 1) diceN)
@M4GNV5
M4GNV5 / gdblog.txt
Created July 1, 2018 21:33
Mongoose MQTT Crash
Remote debugging using /dev/ttyUSB0
0x40094624 in invoke_abort () at /home/jakob/git/Open-Vehicle-Monitoring-System-3/env/esp-idf/components/esp32/panic.c:139
139 *((int *) 0) = 0;
(gdb) back
#0 0x40094624 in invoke_abort () at /home/jakob/git/Open-Vehicle-Monitoring-System-3/env/esp-idf/components/esp32/panic.c:139
#1 0x400947ee in abort () at /home/jakob/git/Open-Vehicle-Monitoring-System-3/env/esp-idf/components/esp32/panic.c:148
#2 0x4010504e in __assert_func (
file=0x3f412e80 "/home/jakob/git/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/mongoose/mongoose/mongoose.c",
line=10700, func=<optimized out>, failedexpr=0x3f41308c "nc->send_mbuf.len >= len")
at ../../../.././newlib/libc/stdlib/assert.c:63
#!/bin/bash
printf "#include <stdio.h>\n" > /tmp/cppmacro.c
while [ $# -gt 1 ]; do
printf "#include <$1.h>\n" >> /tmp/cppmacro.c
shift
done
printf "int main()\n{\n\tprintf(\"%%d\\\\n\", $1);\n\treturn 0;\n}" >> /tmp/cppmacro.c
gcc -D_GNU_SOURCE /tmp/cppmacro.c -o /tmp/cppmacro