Skip to content

Instantly share code, notes, and snippets.


Ehsan Kia EhsanKia

View GitHub Profile
EhsanKia /
Created Mar 21, 2022
Unpacks Game Pass SAVEDATA for Tunic into individual Steam format
import re
with open('5E113D5F383749AEB72703486DD8247B', 'rb') as fp:
data =
filenames = re.findall(rb'\d+\.txt', data)
contents = re.findall(rb'(true\|1[^\0]+)', data, re.DOTALL)
for name, content in zip(filenames, contents):
with open(name.replace(b'.txt', b'.tunic'), 'wb') as fp:
EhsanKia / indigo_sieve.json
Created May 13, 2021
Imagus Sieve for Indigo Canada
View indigo_sieve.json
"indigo": {
"img": "^(dynamic\\.indigoimages\\.ca/gifts/\\d+\\.jpg).+",
"to": "$1?maxwidth=1000"
EhsanKia /
Created Feb 22, 2021
Simple and minimal Discord bot made using for assigning a specific role when a user reacts to a given message.
import discord
BOT_TOKEN = '(bot token here)'
EMOJI_NAME = 'emojiName'
ROLE_ID = 4321
class ReactionRole(discord.Client):
EhsanKia / .tmux.conf
Last active May 26, 2020
UNIX configs
View .tmux.conf
# Bind r to reload config
bind r source-file ~/.tmux.conf
# Remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
EhsanKia /
Last active Oct 13, 2018
Simple function to smartly resize an image with PIL.
# There are four ways a resize can go:
# 1. You only specify a width -> image is resized to have that width while conserving aspect ratio
# 2. You only specify a height -> image is resized to have that height while conserving aspect ratio
# 3. You specify width and height with crop off -> Image is resized to fit inside the dimensions while conserving aspect ratio
# 4. You specify width and height with crop on -> Image is cropped and resized to the new dimensions, centered.
# NOTE: This function can potentially scale up your image.
# You can avoid that if that's important for your use case by checking
# width and height against old values before resizing at the end.
EhsanKia /
Created Jan 7, 2018
Keybase verification

Keybase proof

I hereby claim:

  • I am ehsankia on github.
  • I am ehsankia ( on keybase.
  • I have a public key whose fingerprint is 4FCC DA95 C5D0 DF8F 5A10 619A 5D50 ED63 7B07 456F

To claim this, I am signing this object:

EhsanKia /
Created Mar 14, 2017
Generate Pi from checking if two random numbers are coprime.
from math import sqrt
from random import randint
from math import gcd
from fractions import gcd
ITERATIONS = 1000000
MAX_INT = 1000000000
EhsanKia / commerical_obs.html
Created Feb 14, 2017
Plays commercials and music in CLR browser
View commerical_obs.html
<!DOCTYPE html>
<meta charset="utf-8">
<style type="text/css">
#commercial {
width: 100%;
height: 100%;
opacity: 0;
EhsanKia / launchy.ini
Created Sep 27, 2016
Keypirinha Plugin to replicate Launchy's database format
View launchy.ini
# Launchy Package configuration file
# Plugin's main configuration section.
# (Nothing here for now)
EhsanKia / better_rabbit.js
Last active Feb 12, 2017 Twitch emotes
View better_rabbit.js
var twitchEmotes = {};
var bttvEmotes = {};
$.getJSON('', function(data) {
$.each(data.emotes, function(key, val) {
twitchEmotes[key] = val.image_id;
$.getJSON('', function(data) {