Skip to content

Instantly share code, notes, and snippets.

@fireattack
fireattack / DumpAZW6_py3.py
Last active April 3, 2024 08:01
Py3 version
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
import sys
import os, getopt, struct
import imghdr
def get_image_type(imgname, imgdata=None):
imgtype = imghdr.what(imgname, imgdata)
import colorsys
import csv
from datetime import datetime
from pathlib import Path
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import markers
from matplotlib.path import Path as pPath
{
"1": {
"id": 1,
"name": "はじまりの朝 天海春香",
"img": "http://m.ip.bn765.com/11006f0a05d58d133f",
"rarity": "HR",
"region": "Vo",
"ap": 3600,
"dp": 3600,
"skillName": "日々前進!",
@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;
Google Inc.
Copyright 2018 Google Inc. All rights reserved.
Google Chrome 71.0.3578.80 (Official Build) (64-bit) (cohort: 71_Win_80)
Revision 2ac50e7249fbd55e6f517a28131605c9fb9fe897-refs/branch-heads/3578@{#860}
OS Windows
JavaScript V8 7.1.302.28
Flash 32.0.0.101 C:\Windows\system32\Macromed\Flash\pepflashplayer64_32_0_0_101.dll
User Agent Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36
Command Line "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --flag-switches-begin --disable-accelerated-video-decode --load-media-router-component-extension=0 --disable-smooth-scrolling --flag-switches-end
Google Inc.
Copyright 2018 Google Inc. All rights reserved.
Google Chrome 71.0.3578.80 (Official Build) beta (64-bit) (cohort: Beta)
Revision 2ac50e7249fbd55e6f517a28131605c9fb9fe897-refs/branch-heads/3578@{#860}
OS Windows
JavaScript V8 7.1.302.28
Flash 32.0.0.101 C:\Windows\system32\Macromed\Flash\pepflashplayer64_32_0_0_101.dll
User Agent Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36
Command Line "C:\Program Files (x86)\Google\Chrome Beta\Application\chrome.exe" --flag-switches-begin --disable-accelerated-video-decode --load-media-router-component-extension=0 --disable-smooth-scrolling --flag-switches-end
@fireattack
fireattack / vtt_to_srt.py
Last active August 14, 2018 07:56
Py3 requirement: chardet
import argparse
import datetime
import re
from os.path import exists, splitext, join
from os import walk
import chardet
def main():
parser = argparse.ArgumentParser()
@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')
<?xml version="1.0"?>
<Chapters>
<EditionEntry>
<ChapterAtom>
<ChapterTimeStart>00:0:00.000000000</ChapterTimeStart>
<ChapterDisplay>
<ChapterString>Opening</ChapterString>
<ChapterLanguage>jpn</ChapterLanguage>
</ChapterDisplay>
</ChapterAtom>
iter = 50000;
gold_result = zeros(1, iter);
gold_odd = 0.1;
initial_dust = 2000;
for method = 1:2
for i = 1:iter
bag = 0;
gold = 0;