Skip to content

Instantly share code, notes, and snippets.

View magical's full-sized avatar
🙀
🐛

Andrew Ekstedt magical

🙀
🐛
View GitHub Profile
#!/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',
// https://blog.quickmediasolutions.com/2015/09/13/non-blocking-channels-in-go.html
// ...without using reflect
package util
import (
"container/list"
)
// Channel that does not block when items are sent. To use the struct, simply
#!/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
@magical
magical / 4lw
Created November 28, 2010 03:25
#!/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",
---
# 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
#!/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"
#!/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 / gist:ae51f97677632e694c4c
Last active October 5, 2015 05:23 — forked from anonymous/-
hypothetical design for a daily todo list app
hypothetical design for a daily todo list app
sits in the tray
click the tray icon to toggle the main window
has space for 10 (7? 12?) todo items
an item is a status icon and a short bit of text
status can be · or ✔ or ✘
click on an item to edit its text
click on a blank item to add a new item
click on the status to cycle through
@magical
magical / math.asm
Created May 31, 2012 01:55
multiplication and division in x86 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 June 7, 2012 07:37
gcd and lcm tools
gcd(1)
======
:doctype: manpage
:man source: gcd
:man version: 0.1
NAME
----
gcd, lcm - compute greatest common divisor and least common multiple