Skip to content

Instantly share code, notes, and snippets.

@iamgreaser
iamgreaser / gist:998717
Created May 30, 2011 10:52
code idea thing
bridge controller:
open
self lock.
self getBridgeParts do: [ :part |
part move: 1@0.
self wait: 1.
].
self getUpperDoor move: -2@0 steps: 2.
self getLowerDoor move: 2@0 steps: 2.
@iamgreaser
iamgreaser / gist:1015952
Created June 9, 2011 02:48
from the no frills lua 5.1 vm guide thing
>local a,b,c; c = a and b
; function [0] definition (level 1)
; 0 upvalues, 0 params, 3 stacks
.function 0 0 2 3
.local "a" ; 0
.local "b" ; 1
.local "c" ; 2
[1] testset 2 0 0 ; to [3] if true
[2] jmp 1 ; to [4]
[3] move 2 1
ben@95lx:~$ cat .Xmodmap
remove Lock = Caps_Lock
clear Lock
keycode 66 = Multi_key
keycode 173 = Caps_Lock
add Lock = Caps_Lock
ben@95lx:~$
SampleOffset
MOVEQ #0,D0
MOVE.B n_cmdlo(A6),D0
BEQ sononew
MOVE.B D0,n_sampleoffset(A6)
sononew MOVE.B n_sampleoffset(A6),D0
LSL.W #7,D0
CMP.W n_length(A6),D0
BGE sofskip
SUB.W D0,n_length(A6)
@iamgreaser
iamgreaser / gist:1062911
Created July 4, 2011 04:25
dungen.py 128x128
################################################################################################################################
################################################################################################################################
################################################################################################ ######### #########
################################################################################################ ######### #########
################################################# ############################# ######### #########
################################ ####### ############################# ######### #########
################################ ####### ############################# ######### #########
################################ ####### ############################# ######### ##
@iamgreaser
iamgreaser / gist:1066394
Created July 6, 2011 02:21
mmpunk.py dump
ben@95lx:~/Desktop/appage/py$ python mmpunk.py Creagaia.it
unknown 1: 000E
unknown 2: 130F
blocks: 0011
unpacked size: 00047329
unknown 3: 0018
unknown 4: 0000
unknown 5: 0200
block at 0000005C
unpacked size: 00000030
@iamgreaser
iamgreaser / gist:1070851
Created July 8, 2011 00:20
freebasic port of cb plasma thing
function Distance(x1 as double,y1 as double,x2 as double,y2 as double) as double
Distance = sqr((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
end function
function Max(a as double,b as double) as double
if a > b then
Max = a
else
Max = b
@iamgreaser
iamgreaser / gist:1074401
Created July 10, 2011 09:17
semi deobfuscated donut
k;
double sin(),cos();
main()
{
float A=0,B=0,i,j,z[1760];
char b[1760];
printf("\x1b[2J");
for(;;)
{
@iamgreaser
iamgreaser / gist:1103707
Created July 25, 2011 07:33
mafia idea with decorators
# Filter base stuff
def recv_identity(f, game, mtype, src, dest, **kwargs):
f(game, mtype, src, dest, **kwargs)
def send_identity(f, game, mtype, src, dests, **kwargs):
for dest in dests:
game.enqueue(f, mtype, src, dest, **kwargs)
class ClassFilter:
@iamgreaser
iamgreaser / gist:1115030
Created July 30, 2011 00:36
making games with "yield" - an idea [rev 3]
import pygame
pygame.init()
def gen_timer(delay):
t_target = pygame.time.get_ticks()
while True:
t_current = pygame.time.get_ticks()
if t_current > t_target:
yield False