Skip to content

Instantly share code, notes, and snippets.

@fireattack
fireattack / ti_age.py
Last active July 7, 2018 20:52
Grab DOB of TI8 players from Liquipedia
import re
import requests
from bs4 import BeautifulSoup
url = 'https://liquipedia.net/dota2/The_International/2018'
html = requests.get(url)
html.encoding = 'utf-8'
soup = BeautifulSoup(html.text, "lxml")
divs = soup.find_all('div', class_='teamcard')
@fireattack
fireattack / rename_gamecg_pack.py
Created June 26, 2017 02:36
Batch rename CG pack
import re
from os import listdir, rename, makedirs
from os.path import join, splitext, basename, exists
from urllib.parse import quote
from bs4 import BeautifulSoup as bs
from requests import get # to make GET request
def advrename(original_full_path, new_filename, c):
new_full_path = join(pathforrenamed, new_filename)
@fireattack
fireattack / image_match.m
Last active January 1, 2019 14:44
Match image color based on a reference, and save the transformation for more images.
color_mode = 'ycbcr'; %rgb, ycbcr, hsv
work_patch = 'E:\!Scan\image match\';
ref = imread([work_patch,'ref.bmp']); % Your reference image
A = imread([work_patch,'img.bmp']); % Your scan that needs to be calibrated
numColorChan = size(ref,3);
isColor = numColorChan > 1;