Skip to content

Instantly share code, notes, and snippets.

View magical's full-sized avatar
🙀
🐛

Andrew Ekstedt magical

🙀
🐛
View GitHub Profile
Item Stats Structure
0x00 uint16 Purchase Price (in units of $10)
0x02 uint8 Held effect?
0x03 uint8 Effect argument
0x04 uint8 Natural Gift effect
0x05 uint8 Fling effect
0x06 uint8 Fling power
0x07 uint8 Natural Gift power
0x08 uint16 Bits 0-4: Natural Gift type (31=n/a)
Flags?
@magical
magical / latency.markdown
Created October 9, 2016 07:17 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@magical
magical / readersource.go
Created August 10, 2016 00:40
An implementation of rand.Source which reads from an io.Reader
package main
import (
"fmt"
"io"
"math/rand"
"strings"
)
type ReaderSource struct {
@magical
magical / gist:920e05b1ed769c35e5928cf638b9e6fa
Last active May 28, 2016 22:57
XYZZY awards transcript
ifMUD
An interactive conversation
Copyright 1997-2007 by Loungent Technologies, a wholly owned subsidiary of
rec.[arts|games].int-fiction; All rights reserved.
Release 4 / Serial number 990908 / perlMUD v2.1z
"The characters were mostly of the cardboard cutout variety.
I wanted to punch everyone except the one Scottish guy."
--Jearl
@magical
magical / gist:d65a4487ae1814c9ab87c5cca3c48663
Created April 14, 2016 06:44
Reverse engineering tools
- objdump (from binutils)
- ndisasm (from nasm)
- file
- xxd
- vbindiff
- strace
Utilities
---------
htop
tree
atool
the_silver_searcher (silversearcher-ag)
whois
mtr
mosh
vim
@magical
magical / dumpcc2.py
Last active October 12, 2015 02:13
in-progress CC2 level dumper
import binascii
import struct
import sys
import traceback
u16 = struct.Struct('<H')
u32 = struct.Struct('<L')
def read16(f):
b = f.read(2)
@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
// 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

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: