Skip to content

Instantly share code, notes, and snippets.

View endes0's full-sized avatar
💻
Working 8 to 5

endes0

💻
Working 8 to 5
View GitHub Profile
import os
rom_file = open("rom.bin", "rb")
rom_data = rom_file.read()
rom_file.close()
n_of_files = rom_data[0x04:0x07]
n_of_files = int.from_bytes(n_of_files, byteorder='little')
print(f"Number of files: {n_of_files}")
for i in range(n_of_files):
@endes0
endes0 / treadmill.ino
Last active December 20, 2024 17:07
See https://dev.to/endes/analyzing-the-communication-protocol-of-the-decathlon-walk-by-domyos-3a36. Uses MCUFRIEND_kbv 3.0.0, based on the button_simple example.
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
#include <TouchScreen.h>
#define MINPRESSURE 200
#define MAXPRESSURE 1000
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
AW_READ_MFI 80, 65, 8, 0, 2
OTA_CMD_IOCTL-Flash_Get_CRC16 80, 65, 6, 0, 13, 0, 37, 204, 250, 0, 0
OTA_CMD_IOCTL-Flash_Get_CRC32 80, 65, 6, 0, 13, 0, 37, 207, 250, 0, 0
LQ_DFU_BT_INQUIRY_SCAN 80, 65, 14, 0, 0, 240
TX_DG_CREATE_CONNECT_EX 80, 65, 14, 0, 0, 229
REMOTE_CREATE_CONNET 80, 65, 14, 0, 0, 226
LQ_DFU_REMOTE_DISCONNECT 80, 65, 14, 0, 0, 228
TX_DG_DISCONNECT_EX 80, 65, 14, 0, 0, 231
REMOTE_SET_MODE 80, 65, 14, 0, 0, 225
TX_DG_GET_CONNECT_STATUS_EX 80, 65, 14, 0, 0, 230
import hid
d = hid.Device(0x046d, 0x0acb)
# Enter bootloader
d.send_feature_report(bytes([6,1,3,0,0,0,0,0,0]))
assert d.read(8) == bytes([6,90,0,0,0,0,0,0,0]) # check ack
# Start scanning
d.send_feature_report(bytes([6,4,3,7,80,65,14,4,2,240,1]))
@endes0
endes0 / dump_analog.py
Created May 29, 2024 11:32
Logitech CU0019 (aka PID C542) memory dumpers
import os
from hidtools.hidraw import HidrawDevice
# dump the "analog" memory space
file = open("/dev/hidraw6")
d = HidrawDevice(file)
fields = d.report_descriptor.feature_reports[5].fields
#!/usr/bin/env python3
# Download your data dump and place this file in the messages folder of your data dump.
# Then run it!
from datetime import datetime, timedelta, timezone
import dateutil.parser
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.dates as mdates
import csv
BooSt for SoC09S 1.0.3 (2008/08/01)
Start ARM1136JF-S ... RTOS
Start ARM926EJ-S ... Linux
MiLL for Soc09S 2.0.0 (2011/09/15)
Uncomp.done
Linux version 2.6.35.8-arm1 (gcc version 4.5.1 (epson-20130312) ) #1 Wed Aug 2 16:05:55 JST 2017
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: ARM-EPSON09
@endes0
endes0 / Decrypt_db.py
Created April 21, 2023 13:00
Decrypt ChipGenius Chips.wdb file database
key = [0x19, 0x86, 0x10, 0x18]
with open('Chips.wdb', 'rb') as f:
f.seek(0x2)
date = f.readline()
f.seek(0xE)
magic = f.read(2)
print("DB date: " + date.decode('utf-8'))
print("DB magic: " + magic.decode('utf-8'))
print("OK" if magic == b'WR' else "Invalid magic")
from TTS.api import TTS
import PyPDF2
import subprocess
import os
import torch
import re
import argparse
# helpers
@endes0
endes0 / README.md
Last active January 6, 2025 07:18
PDF File to audiobook using facebook fairseq TTS.

This script will create an audio file for each page of a PDF, reading it trought Fastspeech2 using fairseq framework. Perfect for creating audiobooks. It also reads the PDF table of contents and groups the files by the top level charapters. Finally it creates a playlist.

Tested on Ubuntu 22.04.1 and Python 3.10.6

Usage

$ pdfToAudio.py --pdf <your pdf file here>

Requeriments

You should have the conmand pdftotext from poppler-utils installed: