Skip to content

Instantly share code, notes, and snippets.

#!python2
#quizknock kawamura number system: https://youtu.be/xROMDZE4U7U
add='-a-'
subtract='sk'
levels=['','raf','bxogg']
digits_lowerhalf=['xzea','dhea','ija']
digits_upperhalf=[(levels[1]+subtract+_) for _ in digits_lowerhalf[::-1]]
digits=['']+digits_lowerhalf+digits_upperhalf
#!python2
from fractions import Fraction as F
def prime_factors(n):
#adapted from https://stackoverflow.com/a/16996439/5090149
result=[]
#special case: 2
while n%2==0:
result.append(2)
n//=2
#!python2
#n=denominator
#b=base
#pfn=prime_factors_of(n)
#pfb=prime_factors_of(b)
pfn=[2,5,2,5,3,5]
pfb=[2,5]
#!python2
#coding:utf8
#Usage:
#Install Python 2.7
#Execute `pip install requests lxml` in Powershell/cmd/Terminal
#Supply your own Sega ID & password in `username_password.txt`
#Run the script
#If errors occur, just re-run the script
@jack980517
jack980517 / nds_patch_rom_region.py
Created July 11, 2018 16:16
Patch NDS rom region
import os,struct
CRC16Table=[
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
@jack980517
jack980517 / getflashplayer.py
Last active October 5, 2018 03:56
Get offline installers of Flash Player plugins for all available platforms.
import json,urllib,sys,os,glob
from distutils.version import LooseVersion as lv
dl=urllib.urlretrieve
api_url='https://get.adobe.com/flashplayer/webservices/json/?platform_type=%s&platform_dist=%s&platform_arch=%s&platform_misc=&exclude_version=&browser_arch=&browser_type=&browser_vers=&browser_dist=&eventname=flashplayerotherversions'
configs={
'win8':('Windows','Windows%208',''), # Windows 10/Windows 8
'winxp':('Windows','XP','x86-32'), # Windows 7/Vista/XP
'mac':('Macintosh','','x86-64'), # Mac OS X 10.6 - 10.13
'linux64':('Linux','','x86-64'), # Linux (64-bit)
@jack980517
jack980517 / whatcontains.py
Created July 5, 2017 21:09
Search for a specific string in all files, not just text
import os,sys
def usage():
print 'Usage: whatcontains [-case] [-hex] stringToSearchFor [folderToSearchIn]'
exit()
if not 1<len(sys.argv)<6: usage()
case=False
hex=False
if '-case' in sys.argv:
case=True
sys.argv.remove('-case')
QMA 4 GEM 2007/01/11
IIDX GOLD GLD 2007/02/21
pop'n 15 G15 2007/04/25
Otomedius GGG 2007/11/02
DJ Troopers HDD 2007/12/19
QMA 5 HAL 2008/01/12
pop'n 16 H16 2008/03/24
Horseriders G23 2008/04/09
GFDM V5 H32/H33 2008/06/18
MFC 7 HK9
@jack980517
jack980517 / lz4.py
Created January 18, 2017 14:47 — forked from weigon/lz4.py
LZ4 uncompress in pure python
from io import BytesIO
from six.moves import xrange # pylint: disable=redefined-builtin
from six import byte2int
class CorruptError(Exception):
pass
def uncompress(src):