Skip to content

Instantly share code, notes, and snippets.

@lf94
lf94 / atom.js
Created November 6, 2016 15:38
A view of Atom's text insertion routine
# Applies a change to the buffer based on its old range and new text.
applyChange: (change) ->
{newStart, oldExtent, newExtent, oldText, newText, normalizeLineEndings} = change
start = Point.fromObject(newStart)
oldRange = Range(start, start.traverse(oldExtent))
newRange = Range(start, start.traverse(newExtent))
oldRange.freeze()
newRange.freeze()
@cachedText = null
;; Calculate the location of Sprite 1
ld hl, wOAMAddr
ld de, wOAM
ld [hl], d
inc hl
ld [hl], e
mUpdateSprite 80, 40, $59, 0, 2, 3
@lf94
lf94 / partial.asm
Created October 5, 2016 16:05
Beautiful macro
loop:
call WaitVBlank
mUpdateSprite 0, 100, 80, $59, 0, 2, 3
call _HRAM
jp loop
@lf94
lf94 / boot.asm
Created October 2, 2016 22:21
Check to see if OAM DMA doesn't write unused bits
INCLUDE "Global.inc"
; Cartridge header
SECTION "Org $00",ROM0[$00]
RST_00:
jp $100
SECTION "Org $08",ROM0[$08]
RST_08:
@lf94
lf94 / boot.asm
Created September 29, 2016 13:34
Trying to come up with a de-facto way of booting.
INCLUDE "Global.inc"
; Cartridge header
SECTION "Org $00",HOME[$00]
RST_00:
jp $100
SECTION "Org $08",HOME[$08]
RST_08:
@lf94
lf94 / vtwm.txt
Created September 16, 2016 17:15
vtwm
Hey, this is a long shot, but here goes.
I have this defined in my .vtwmrc configuration file:
Function "map-show" { f.showdesktopdisplay f.warpto "VTWM Desktop" }
Function "iconmgr-show" { f.showiconmgr f.warpto "VTWM Icon Manager" }
called with:
"Space" = control : all : f.function "map-show"
"Space" = shift : all : f.function "iconmgr-show"
@lf94
lf94 / change_intro.py
Created January 16, 2016 17:30
Change Oot:DBG intro
#!/usr/bin/python3
import sys
import os
from struct import *
import mmap
def changeIntroLogo():
emptySpaceAddress = 0x01AA1000 # 0x035CF000
@lf94
lf94 / HaskMapImproved.hs
Created November 8, 2015 15:30
A naive implementation of a hash map in Haskell - for educational purposes.
{-
A textbook implementation of a hash map using chaining for collisions and
resizing by creating a new map.
-}
import Data.Char
import Data.Hashable
-- | Keep track of how many buckets are filled, and the buckets themselves.
data HashMap a b = MkHashMap Int (ThinHashMap a b)
-- | Remove any information from the HashMap.
@lf94
lf94 / anonymous-gist.
Created October 1, 2015 10:20
Emacs configuration file
(require 'package)
(push '("melpa" . "http://melpa.milkbox.net/packages/")
package-archives)
(package-initialize)
(add-to-list 'load-path "~/.emacs.d/vendor/yagist.el")
(require 'yagist)
(setq circe-use-cycle-completion t)
@lf94
lf94 / anonymous-gist.
Created September 22, 2015 10:49
python what are you doing
>>> dir(1)
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordi
v__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__int__', '__invert__', '__le__', '__lshift__', '__l
t__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__rep
r__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '
__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'im
ag', 'numerator', 'real', 'to_bytes']