Skip to content

Instantly share code, notes, and snippets.

define armex
printf "EXEC_RETURN (LR):\n",
info registers $lr
if $lr & 0x4 == 0x4
printf "Uses MSP 0x%x return.\n", $msp
set $armex_base = (char *) $msp
else
printf "Uses PSP 0x%x return.\n", $psp
set $armex_base = (char *) $psp
end
// A _ B, where _ = +, -, *, /, AND, OR, =, ...
class Binop {
public:
enum Operation {
ADD = 0,
SUBTRACT = 1,
MUL = 2,
DIV = 3,
AND = 4,
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char *argv[])
{
srand(time(0));
// successes is the number of times the "smart"
@jsharf
jsharf / bijection.cpp
Created September 9, 2012 17:27
testing program for bijection problem
#include <iostream>
#include <string>
using namespace std;
string translate(string input, string translation)
{
string output = "ABCDEF0123456789";
for(int i=0; i<input.length(); i++)
{
if(input[i] > '9')
@jsharf
jsharf / wikivoice.py
Created August 1, 2012 10:35
Beta wikipedia voice browser for android sl4a. Say a topic or "more" to hear more about previous topic
import urllib
import android
import string
from HTMLParser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
@jsharf
jsharf / gcd.h
Created July 13, 2012 19:23
Greatest Common Divisor function (one-line recursive implementation)
int gcd(int a, int b)
{
return (a%b==0)?b:gcd(b,a%b); //Jacob
}