Skip to content

Instantly share code, notes, and snippets.

View jbaiter's full-sized avatar

Johannes Baiter jbaiter

View GitHub Profile
@jbaiter
jbaiter / gist:1072084
Created July 8, 2011 15:28
ff4 dte routine
arch snes.cpu; lorom // Load settings for SNES/WDC65816 in LoROM mode
.org $00b4a2
jsl check_codes_cont
fill 3,$ff
.org $01ecb0
check_codes_cont
cmp #$c3
bne +
@jbaiter
jbaiter / SPC Upload
Created August 8, 2011 23:46
SPC Upload routine that doesn't crash, but whose data doesn't appear in the SMP RAM and which doesn't execute the desired offset according to the trace...
namespace spc
define spcaddr #$0100
define spcexec #$0100
// DESIGN:
// Base address for spc data is fixed
// Specific offset is handed via X register (16bit)
// First 2 bytes of spc data is length
// -> ACL to 8bit, LDA spc_length -> TAY
namespace mute
// FLG register
flag:
dw $000f // length of the code
lda #$6c
sta $f2
lda #$20 // unmute, disable_echo
sta $f3
cmp $f3, #$20
bne flag
@jbaiter
jbaiter / gist:1176293
Created August 28, 2011 05:58
Simple Wizard
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Wizard</class>
<widget class="QWizard" name="Wizard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
-- xmonad config used by Vic Fryzel
-- Author: Vic Fryzel
-- http://github.com/vicfryzel/xmonad-config
import System.IO
import System.Exit
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
@jbaiter
jbaiter / gist:2789684
Created May 25, 2012 18:27
Missing files
system/lib/bluez-plugin/audio.so
system/lib/bluez-plugin/input.so
system/lib/bluez-plugin/network.so
system/lib/egl/libGLES_android.so
system/lib/libEGL.so
system/lib/libETC1.so
system/lib/libFFTEm.so
system/lib/libGLESv1_CM.so
system/lib/libGLESv2.so
system/lib/libRS.so
@jbaiter
jbaiter / ex17.c
Created May 25, 2012 18:50
Segfaults when run normally, runs fine in Valgrind
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
char *names_addr = 0;
char *mails_addr = 0;
struct Address {
@jbaiter
jbaiter / sigil.sh
Last active May 16, 2018 20:54
Wrapper script around Sigil to support version control workflows. Change $SIGIL to match your system's settings.
#!/bin/bash
# USAGE
# =====
# $ sigil.sh <directory>
# Change this to match your system
SIGIL="/usr/local/bin/sigil"
# --------------------------------
@jbaiter
jbaiter / gist:5815446
Last active December 18, 2015 16:59
Generic function that applies `func` (which doesn't have to be imported in the module!) for every set of arguments in `args` and `kwargs` concurrently.
def run_multicore(func, m_args, m_kwargs, num_procs=None):
""" Run `func` once for each set of arguments in `m_args` and `m_kwargs`, using
either `num_procs` worker processes or as many as CPU cores are
available.
"""
class Worker(Process):
def __init__(self, func, queue):
super(Worker, self).__init__()
self.func = func
self.queue = queue
@jbaiter
jbaiter / example.html
Last active December 20, 2015 03:08
<html>
<head>
<title>bookreader example</title>
<link rel="stylesheet" type="text/css" href="BookReader/BookReader.css"/>
<script type="text/javascript" src="http://www.archive.org/includes/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="BookReader/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" src="BookReader/dragscrollable.js"></script>
<script type="text/javascript" src="BookReader/jquery.colorbox-min.js"></script>