Skip to content

Instantly share code, notes, and snippets.

@bodqhrohro
bodqhrohro / tgprplauthdump.py
Last active February 10, 2024 19:59
Read data from legacy telegram-purple auth files
#!/usr/bin/python3
import os, struct
DIR = os.path.join(os.environ['HOME'], ".purple/telegram-purple")
def cprint(color, s):
print("\x1b[" + str(color) + "m" + s + "\x1b[0m", end="")
def pkeyvalue(key, value):
cprint(33, key)
@bodqhrohro
bodqhrohro / gist:5a65deeb59491112d1757a9c7bd60d46
Created December 8, 2023 14:47
Cancel last apt installation
apt remove $(cat /var/log/apt/history.log |grep '^Install'|tail -n 1|sed 's/([^)]\+),\?//g'|sed 's/^Install://')
@bodqhrohro
bodqhrohro / colordetecttest.py
Created November 3, 2023 03:39
Encode and decode low-bandwidth colour information in grayscale images
#!/usr/bin/python
import sys
import random
from PIL import Image, ImageDraw
img = Image.open(sys.argv[1])
img = img.convert(mode='YCbCr')
width = img.width
data = img.getdata()
@bodqhrohro
bodqhrohro / lctraf.rb
Created August 15, 2023 21:24
Lifecell balance checker
#!/usr/bin/ruby
require 'lifecell_api'
# require 'pp'
begin
life = Lifecell::API.new(msisdn: '380x3xxxxxxx', password: 'xxxxxx')
life.sign_in
# PP.pp life.balances
balance = life.balances['balance']
@bodqhrohro
bodqhrohro / puzzle.sh
Created July 23, 2023 11:38
Puzzle generator
#!/bin/sh
resolution=$(identify -format "%wx%h" "$1[0]")
IFS=x read -r -a resolution_array <<< $resolution
width=${resolution_array[0]}
height=${resolution_array[1]}
WIDTH_FACTOR=15
HEIGHT_FACTOR=15
@bodqhrohro
bodqhrohro / analprobe.service
Created April 22, 2023 07:32
Simple anal probe
[Unit]
Description=Spies on me
[Service]
ExecStart=/data/progs/shell/analprobe.sh
@bodqhrohro
bodqhrohro / vidqgif.sh
Created February 22, 2020 20:22
Compress a video to a tiny GIF with a very strong quantization and no dithering
#!/bin/sh
# parameters: input, output
# make a 256-colors palette first
palettefull=$( mktemp --suffix=.png )
ffmpeg -i "$1" -vf 'palettegen' -y "$palettefull"
# quantize the palette (palettegen's builting limiter
# tries to preserve too much similar shades)
palettequant=$( mktemp --suffix=.png )
@bodqhrohro
bodqhrohro / maildir_decode.py
Last active June 14, 2019 09:52
Decode the filenames of attachments exported with munpack
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from email.header import decode_header, HeaderParseError
import os
import re
import itertools
from pprint import pprint
encodings = ( 'UTF-8', 'utf-8', 'koi8-r', 'KOI8-R' )
@bodqhrohro
bodqhrohro / smartlighten
Created April 12, 2019 14:48
Preset for Compiz Color Filter
!!ARBfp1.0
TEMP output;
TEMP input;
TEMP bright;
TEMP dark;
TEX input, fragment.texcoord[0], texture[0], RECT;
MUL dark.rgb, input, 5;
MUL bright.rgb, input, 0.55;
@bodqhrohro
bodqhrohro / apt-size-change
Last active March 3, 2019 16:04
Verbose log of upgradeable packages
# ported to Python, thanks to KillTheCat
import subprocess
def get_installed_size(block: str) -> int:
def size_in_byte(data: list) -> int:
if len(data) != 2:
return 0
inc = 1