Skip to content

Instantly share code, notes, and snippets.

View Sanqui's full-sized avatar
🦉

Sanqui Sanqui

🦉
View GitHub Profile
@Sanqui
Sanqui / gist:2318290
Created April 6, 2012 09:00
GBZ80 emulator concept in DCPU (0x10^c)
; Option A: Using DCPU registers for storing 16-bit Z80 registers
; x, y, z, i = FA, BC, DE, HL
; reading B: ; cycles
; set a, y ; 1
; shr a, 8 ; 2
; reading C:
; set a, y ; 1
; and a, 0x00ff ; 2
; reading BC:
; set a, bc ; 1
@Sanqui
Sanqui / helper.py
Created September 22, 2012 08:49 — forked from mitsuhiko/helper.py
url_for_here()
from flask import request, url_for
# Supports multiple query args with the same key.
def url_for_here(**changed_args):
args = request.args.to_dict(flat=False)
args.update(request.view_args)
args.update(changed_args)
return url_for(request.endpoint, **args)
app.jinja_env.globals['url_for_here'] = url_for_here
@Sanqui
Sanqui / gist:3798944
Created September 28, 2012 09:55
minpowerlevel() decorator
from flask import abort
# Callable decorator
def minpowerlevel(powerlevel):
def decorator(function):
@wraps(function)
def f(*args, **kvargs):
if g.user.powerlevel >= powerlevel:
return function(*args, **kvargs)
else:
@Sanqui
Sanqui / game.yaml
Created October 27, 2012 20:36
yarpge source concept stub
game:
tilesets:
- tileset: &tileset0
name: Overworld
file: overworld.png
colisions:
[1, 0]
maps:
- map: &map0
__module_name__ = "beep"
__module_version__ = "0.1.1"
__module_description__ = "Beeps for channel messages"
import xchat
import os
print "Beep loaded!"
# http://www.phy.mtu.edu/~suits/notefreqs.html
@Sanqui
Sanqui / diary.py
Created December 16, 2012 22:50
Diarykeeping for the truly lazy. (A Python module for ZNC, an IRC bouncer.)
import znc
import datetime
DAY_BEGIN_HOUR = 4
DIARY_DIR = ".diary/"
class diary(znc.Module):
description = "Diarykeeping for the truly lazy."
def OnModCommand(self, message):
@Sanqui
Sanqui / cake.py
Created January 4, 2013 10:15 — forked from kanzure/cake.py
Now supports Python 3
lines = {
11: " / ; ,-, \\_> <<_' ____________;_)",
7: " | | .--| |,~~~~~| |~~~,,,,'-| |",
3: " ( Y Y ( )",
9: " .| |~ // ___ '-',,'.",
15: " | '-._ ~~,,, ,,,~~ __.-'~ | |",
13: " | ; '-'\_\/> '-._ |",
20: " \ `'==========='` .'",
2: " ( ) ( ) (",
8: " | |-,,~~'-'___ '-' ~~| |._",
@Sanqui
Sanqui / gbz80asm.lang.xml
Last active June 7, 2019 19:29
GTK language description for RGBDS-compatible GBZ80 assembly syntax. Save as /usr/share/gtksourceview-3.0/language-specs/gbz80asm.lang
<?xml version="1.0" encoding="UTF-8"?>
<!--
Author: Sanky
License: Public domain
-->
<language id="gbz80asm" _name="gbz80asm" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">text/x-z80asm</property>
@Sanqui
Sanqui / conv_cp895.py
Created March 30, 2013 16:20
Converts file from Kamenický encoding/KEYBCS2/CP895, a legacy Czechoslovak encoding, to system Unicode. Not even iconv supports this!
#!/bin/python3
from sys import argv
highchars = 'üéďäĎŤčěĚĹÍľĺÄÁÉžŽôöÓůÚýÖÜŠĽÝŘťáíóúňŇŮÔšřŕŔ¼§«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■'
out = ""
with open(argv[1], 'rb') as f:
for byte in f.read():
@Sanqui
Sanqui / boom-plus-plus.lua
Last active February 16, 2019 19:38
A Lua script for corrupting Gameboy and Gameboy Advance games live. Supply to VBA-RR. Consult your doctor before use.
--
-- ░█▀▄░█▀█░█▀█░█▄█░░░░█░░░█░█░█▀█
-- ░█▀▄░█░█░█░█░█░█░░░░█░░░█░█░█▀█
-- ░▀▀░░▀▀▀░▀▀▀░▀░▀░▀░░▀▀▀░▀▀▀░▀░▀
--
--
-- Fair warning: this code is about as bad as the things it does to games.
-- GBA support experimental and frankly quite boring.