Skip to content

Instantly share code, notes, and snippets.

Avatar
🙀
🐛

Andrew Ekstedt magical

🙀
🐛
View GitHub Profile
View dump-egg-moves.py
#!/usr/bin/env python3.1
movenames = [None,
'Pound', 'Karate Chop', 'DoubleSlap', 'Comet Punch', 'Mega Punch', 'Pay Day', 'Fire Punch', 'Ice Punch', 'ThunderPunch', 'Scratch',
'ViceGrip', 'Guillotine', 'Razor Wind', 'Swords Dance', 'Cut', 'Gust', 'Wing Attack', 'Whirlwind', 'Fly', 'Bind',
'Slam', 'Vine Whip', 'Stomp', 'Double Kick', 'Mega Kick', 'Jump Kick', 'Rolling Kick', 'Sand-Attack', 'Headbutt', 'Horn Attack',
'Fury Attack', 'Horn Drill', 'Tackle', 'Body Slam', 'Wrap', 'Take Down', 'Thrash', 'Double-Edge', 'Tail Whip', 'Poison Sting',
'Twineedle', 'Pin Missile', 'Leer', 'Bite', 'Growl', 'Roar', 'Sing', 'Supersonic', 'SonicBoom', 'Disable',
'Acid', 'Ember', 'Flamethrower', 'Mist', 'Water Gun', 'Hydro Pump', 'Surf', 'Ice Beam', 'Blizzard', 'Psybeam',
'BubbleBeam', 'Aurora Beam', 'Hyper Beam', 'Peck', 'Drill Peck', 'Submission', 'Low Kick', 'Counter', 'Seismic Toss', 'Strength',
View ndsicon.py
#!/usr/bin/env python3
from struct import pack, unpack
import sys
def main(args):
if not args:
print("Usage: python3 ndsicon.py file.nds | pnmtopng > icon.png")
print("Extract the game icon from a ROM dump.")
return 1
View 4lw
#!/usr/bin/env python
# written by magical
# based on http://blog.rabidgremlin.com.nyud.net/2010/11/28/4-little-words/
# licensed under WTFPL
# works with python2 and python3
WORDS = [ "A", "AID", "ANA", "ARC", "AT", "AWN", "BAR", "BET", "BOG", "BUG", "CAB", "COD", "COY", "DAD",
"DES", "DOE", "DUE", "EGO", "ETC", "FAT", "FIR", "FUM", "GAP", "GIL", "GUY", "HAP", "HER", "HIT", "HOW", "ICY", "ION",
"IVY", "JET", "JOY", "KIM", "LAM", "LEN", "LIT", "LOW", "MAN", "MEL", "MOD", "MUG", "NAY", "NIP", "NOV", "OAR", "OIL",
View special-encounters.yml
---
# pokemon: a pokemon (name or identifier)
# form: the pokemon's form (identifier)
# version: a space-separated list of version identifiers
# level: the pokemon's level
# type: one of...
# - overworld: a one-shot wild pokemon (default)
# - roaming: a pokemon that moves from route to route
# - starter: given by the professor at the beginning of the game
View vimeo.py
#!/usr/bin/env python3
from sys import argv, stdout
from urllib.request import urlopen as _urlopen, Request
from urllib.parse import urlunsplit
import json
import re
USER_AGENT = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.815.0 Safari/535.1"
View html2data.py
#!/usr/bin/env python3
"""Download an HTML page, translating <img> tags to data: URIs"""
import sys
import lxml.html as etree
from urllib.request import urlopen
from base64 import b64encode
@magical
magical / math.asm
Created May 31, 2012
multiplication and division in x86 asm
View math.asm
global Mul
global Div
; input: [esp+4] m
; [esp+8] n
; return: eax low word of product
; edx high word of product
Mul:
push esi
push edi
@magical
magical / gcd.1.txt
Created Jun 7, 2012
gcd and lcm tools
View gcd.1.txt
gcd(1)
======
:doctype: manpage
:man source: gcd
:man version: 0.1
NAME
----
gcd, lcm - compute greatest common divisor and least common multiple
@magical
magical / bw2-baseexp.py
Created Oct 13, 2012
Pokémon B/W base experience
View bw2-baseexp.py
#!/usr/bin/env python3
import sys
import narc
from namedstruct import namedstruct
from itertools import islice
BaseStats = namedstruct('BaseStats',
"stat_hp:B stat_atk:B stat_def:B"
View gist:4481926
-- even and odd as mutually recursive infinite lists
import Prelude hiding (even, odd)
module Main where
even = 0:(map (1+) odd)
odd = map (1+) even
main = putStr $ show $ even