Skip to content

Instantly share code, notes, and snippets.

View udf's full-sized avatar

Samara Jinnah udf

  • South Africa
View GitHub Profile
@udf
udf / ColourTile.au3
Created October 10, 2015 22:49
Lego colour thing
#include <GDIPlus.au3>
#include <Color.au3>
_GDIPlus_Startup()
Global $hBaseTile = _GDIPlus_ImageLoadFromFile("t.png")
Global Const $TILE_SIZE = _GDIPlus_ImageGetWidth($hBaseTile)
Global $hInput = _GDIPlus_ImageLoadFromFile("in.png")
@udf
udf / midi_flip.py
Last active February 5, 2017 19:00
Code to "flip" a midi file as in this video: https://www.youtube.com/watch?v=4IAZY7JdSHU
# midi library is from here: https://github.com/vishnubob/python-midi
import midi
import sys
import os
if len(sys.argv) != 2:
print "Usage: {0} <midifile>".format(sys.argv[0])
sys.exit(2)
midifile = sys.argv[1]
@udf
udf / gen.py
Created September 14, 2017 09:52
WIP prime image generator
from multiprocessing import Pool
import random
import re
from collections import defaultdict
primes = set()
best_prime = None
best_score = None
template = (
"BBBBBBABBBBBB"
@udf
udf / theme_conv.py
Last active July 10, 2019 01:57
stupid script to convert telegram android themes to a human readable format and back
# usage python theme_conv.py file.[atthex|attheme]
import sys
from os import path
import re
RE_LINE = re.compile(r'^(\w+)=(.+)$')
@udf
udf / ass.py
Created April 13, 2018 13:47
Generates fancy colours by abusing the order(lessness) of a set; it's called ass because i didn't expect it to work so well (or at all)
from PIL import Image
import random
def thing(val):
val += (-4, -3, -2, -1, 1, 2, 3, 4)[random.getrandbits(3)]
if val < 0: return 0
if val > 255: return 255
return val
@udf
udf / sticker_downloader.py
Last active August 13, 2022 17:27
Telegram Sticker Pack Downloader Script
import asyncio
import logging
import os
from collections import defaultdict
from telethon.errors import MessageNotModifiedError
from telethon import TelegramClient
from telethon import events
from telethon.tl.types import DocumentAttributeSticker, DocumentAttributeFilename
from telethon.tl.functions.messages import GetStickerSetRequest
@udf
udf / telethon_ratelimiter.py
Created November 23, 2018 15:19
Decorator that lets you apply per chat rate limits to telethon handlers
import asyncio
import logging
import time
from collections import defaultdict
from telethon import TelegramClient
from telethon import events
logging.basicConfig(level=logging.INFO)
@udf
udf / float_graph.py
Created February 14, 2019 11:19
Graphs the distribution of floating point numbers by generating bytes and interpreting them as floats
from ctypes import c_float
from os import urandom
import seaborn as sns
import matplotlib.pyplot as plt
from math import isfinite
def gen_floats(N):
out = []
while len(out) < N:
b = bytearray(urandom(4096))
@udf
udf / get_data.py
Last active June 17, 2019 23:42
Script to find your most used short messages on Telegram (can be used as a base to do more useful analysis)
import json
import asyncio
import logging
from collections import defaultdict
from telethon import TelegramClient, utils
logging.basicConfig(level=logging.INFO)
@udf
udf / Ensure_Lineage_Loader.tsk.xml
Last active July 15, 2023 11:58
[Tasker] Switching LineageOS profiles (and possibly more) using reflection in Java (https://redd.it/f4v0l0)
<TaskerData sr="" dvi="1" tv="5.9.2">
<Task sr="task5">
<cdate>1581857845453</cdate>
<edate>1581877298764</edate>
<id>5</id>
<nme>Ensure Lineage Loader</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>664</code>
<Str sr="arg0" ve="3">%test</Str>