Skip to content

Instantly share code, notes, and snippets.

View tuokri's full-sized avatar

Tuomo tuokri

  • Finland
  • 04:14 (UTC +03:00)
View GitHub Profile
@tuokri
tuokri / protos.py
Last active May 16, 2023 16:56
Compile Valve/Steam protobufs with betterproto
#!/usr/bin/env python
# MIT License
#
# Copyright (c) 2023 tuokri
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
import os
from pathlib import Path
from PIL import Image
from PIL.ImageColor import getcolor
from PIL.ImageColor import getrgb
from PIL.ImageOps import grayscale
def image_tint(src_path, tint="#ffffff"):
@tuokri
tuokri / parse.py
Created February 11, 2020 14:51
UDK (RS2: Vietnam) Config Parser
import configparser
import os
class MultiValueConfigDict(dict):
def __setitem__(self, key, value):
if key in self and isinstance(value, list):
self[key].extend(value)
else:
\((\d{4}/\d{2}/\d{2}\s-\s\d{2}:\d{2}:\d{2})\)\s'(.*?)'\s\[(0x\d*?)\]\s.*?\s'(.*?)'\s\[(0x\d*?)\]\s.*?\s<(.*?)>
@tuokri
tuokri / autowvdial
Last active November 29, 2018 03:11
wvdial automation script
#!/usr/bin/env python3
import argparse
import configparser
import logging
import os
import serial
import signal
import sys
import subprocess as sp
@tuokri
tuokri / raw_meme_data.txt
Last active January 22, 2024 16:40
Raw meme data in text format. Generated with https://github.com/tuokri/dankparser
UNROLL THE TADPOLE OSfrog UNCLOG THE FROG OSfrog UNLOAD THE TOAD OSfrog UNINHIBIT THE RIBBIT OSfrog UNSTICK THE LICK OSfrog UNIMPRISON THE AMPHIBIAN OSfrog UNMUTE THE NEWT OSfrog UNBENCH THE KENCH OSfrog PERMIT THE KERMIT OSfrog DEFOG THE POLLIWOG OSfrog.
O-oooooooooo AAAAE-A-A-I-A-U- JO-oooooooooooo AAE-O-A-A-U-U-A- E-eee-ee-eee AAAAE-A-E-I-E-A-JO-ooo-oo-oo-oo EEEEO-A-AAA-AAAA.
╠═══╣Lets build a ladder╠═══╣.
( ͡° ͜◯ ͡°) CLOWN FIESTA ( ͡° ͜◯ ͡°).
Sodium, atomic number 11, was first isolated by Humphry Davy in 1807. A chemical component of salt, he named it Na in honor of the saltiest region on earth, North America..
EleGiggle MY BELLY IS HUGE EleGiggle MY BRAIN HAS DELAY EleGiggle YOU GUESSED IT RIGHT EleGiggle I'M FROM NA. EleGiggle.
PogChamp PogChamp HOLD CTRL AND TYPE "WTF" FOR ℱ𝓪𝓷𝓬𝔂 𝓦𝓣ℱ PogChamp PogChamp.
MingLee I MingLee KNOW MingLee WHEN MingLee THAT MingLee HOTLINE MingLee MING MingLee THAT MingLee CAN MingLee ONLY MingLee MING MingLee ONE MingLee LEE MingLee YOU MingLee USED MingLee TO MingLee MingL
@tuokri
tuokri / fizzbuzz.py
Created June 7, 2016 20:39
fizzbuzz
import numpy as np
import tensorflow as tf
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])
def fizz_buzz_encode(i):
if i % 15 == 0: return np.array([0, 0, 0, 1])
elif i % 5 == 0: return np.array([0, 0, 1, 0])
elif i % 3 == 0: return np.array([0, 1, 0, 0])