Skip to content

Instantly share code, notes, and snippets.

Avatar
🙀
🐛

Andrew Ekstedt magical

🙀
🐛
View GitHub Profile
View xorfiles_test.go
package main
import (
"fmt"
"io"
"os"
)
func main() {
if len(os.Args) != 4 {
View euler16.c
// Project euler #16
#include <stdio.h>
int digits[1000] = {1};
int len = 1;
void fold() {
int i, carry = 0;
for (i = 0; i < len; i++) {
View jpw-capture-take-ii.dis
; arguments
; ???
; ???
; target pokemon
; ball
; shakes (out param)
; crit (out param)
; output
; returns whether capture succeeded
; [r4] number of shakes
@magical
magical / xy-capture.txt
Last active Aug 29, 2015
Pokémon X capture routine analysis
View xy-capture.txt
; Pokemon X capture routine
; DllBattle.cro .text+0x2ee40
; tl;dr everything is pretty much the same
; but with more floating point.
; there are four shake checks again instead of three
; and the fourth root is now a 16/3 root.
; looks like we're going to use a truly staggering number of registers
2ee40: e92d4fff push {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
View gist:115cd29b51c29ae05c01
>>> f = open("X/exefs/code.bin", 'rb')
>>> data = []
>>> for i in range(1, 65):
... _ = f.seek(0x4467d8 + i*22)
... data.append(f.read(22))
...
>>> text = [line.strip() for line in open("xy/rips/text/en/141")]
>>> for d in data: text[d[12]], struct.unpack("<H", d[18:20])[0]
...
('Hatching Power Lv. 1', 125)
View gist:b89789fe20d36885b646
Pichu: pokeathlon
Unown: pokeathlon
Castform: pokeathlon, type, moves (level-up)
Deoxys: effort, pokeathlon, stats, moves (level-up, tutor)
Burmy: pokeathlon
Wormadam: effort, pokeathlon, stats, type, moves (level-up, machine, tutor)
Cherrim: pokeathlon
Shellos:
Gastrodon:
Rotom: exp, pokeathlon, stats, type, moves (form-change)
View gist:2b7bc306369b81f033ed
import re
import time
quotefix_re = re.compile(
r'''
^(
(?:
(?:
(?:[^\n\\"]|(?:\\{2})*\\"|\\[^\n"])*
(?:\\{2})*
View gist:12ec5f92439639d1cadb
# NOT A TUPLE
1 # NOT A TUPLE
1, 2 # a 2-tuple
1, 2, 3 # a 3-tuple
, # SYNTAX ERROR
1, # a 1-tuple
1, 2, # a 2-tuple
1, 2, 3, # a 3-tuple
@magical
magical / add.c
Created May 11, 2015
gcc and -Wconversion
View add.c
// gcc 4.9.2
// gcc -Wconversion -c add.c
unsigned char x;
void foo(unsigned char y) {
x += y; // warning: conversion to ‘unsigned char’ from ‘int’ may alter its value
}
View keybase.md

Keybase proof

I hereby claim:

  • I am magical on github.
  • I am magical (https://keybase.io/magical) on keybase.
  • I have a public key whose fingerprint is 63F7 C160 A01D F8D0 00CF 58E2 C0C0 B6A4 6234 3062

To claim this, I am signing this object: