Skip to content

Instantly share code, notes, and snippets.

View DavideGalilei's full-sized avatar
🐝

Davide Galilei DavideGalilei

🐝
View GitHub Profile
@DavideGalilei
DavideGalilei / request_peer_reply_keyboard.py
Created June 30, 2024 13:43
Send a requestPeer button with pyrogram excerpt
import traceback
from collections import defaultdict
from dataclasses import dataclass
from enum import Enum, auto
from hydrogram import Client, filters, raw
from hydrogram.raw.base import RequestPeerType, Update
from hydrogram.raw.types import (
KeyboardButtonRequestPeer,
MessageService,
@DavideGalilei
DavideGalilei / ripple.html
Created December 16, 2023 17:48
Lite Ripple.js Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ripple</title>
</head>
<body>
<style>
button {
@DavideGalilei
DavideGalilei / README.md
Created November 18, 2023 20:15
Dictiofuzzy - recursive words meaning stats
@DavideGalilei
DavideGalilei / pyrogram_on_album_handler_example.py
Last active June 11, 2024 16:20
Album / Media Group handler for Pyrogram Telegram bot
import asyncio
import traceback
from dataclasses import dataclass
from collections import defaultdict
from typing import Coroutine, TypeVar
from pyrogram import Client, filters
from pyrogram.types import Message
@DavideGalilei
DavideGalilei / README.md
Created March 9, 2023 12:44
Physics simulation test in C + SDL2
@DavideGalilei
DavideGalilei / sqlcipher_dump.js
Created December 8, 2022 11:12
Dump sqlcipher me.lam.calculatorvault sqlite database using Frida [ROOT]
// Thanks to https://ackcent.com/recovering-sqlcipher-encrypted-data-with-frida/
// frida -U -l sqlcipher_dump.js -f me.lam.calculatorvault
Java.perform(function() {
function dumpDb(File, db, path) {
var file = File.$new(path + ".plaintext");
file.delete();
db.rawExecSQL("ATTACH DATABASE '" + path + ".plaintext' AS plaintext KEY '';SELECT sqlcipher_export('plaintext');DETACH DATABASE plaintext;");
console.warn("\t[+] Dumped plaintext database at " + path + ".plaintext");
}
@DavideGalilei
DavideGalilei / convert.py
Last active November 21, 2022 17:53
Python script to convert a LINE sticker pack to Telegram 100x100 px webm emojis (APNG -> GIF -> WEBM)
import json
import shutil
import zipfile
import traceback
import ffmpeg
import requests
from typing import List
from pathlib import Path
from apnggif import apnggif
@DavideGalilei
DavideGalilei / Makefile
Last active June 16, 2022 14:04
Mini XML parser in C (EOF are not handled correctly)
debug:
gcc -o main --std=c99 -Wall -Wextra -Werror -pedantic -g main.c && gdb ./main
run:
gcc -o main --std=c99 -Wall -Wextra -Werror -pedantic main.c && ./main
@DavideGalilei
DavideGalilei / speed.py
Created June 14, 2022 11:30
Speed up Telegram .tgs stickers, using a lottie precomposition layer
import sys
import gzip
import json
if len(sys.argv) < 3:
print("Wrong args. Usage: python speed.py file.tgs 150%")
sticker = json.load(gzip.open(sys.argv[1]))
stretch = 100 / float(sys.argv[2].strip(" %"))
@DavideGalilei
DavideGalilei / sequence.c
Last active March 9, 2023 12:52
C type safe sequence
#define SEQ_H_IMPLEMENTATION
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Seq(T) \
struct { \
T *data; \
T temp; \
size_t size; \