Skip to content

Instantly share code, notes, and snippets.

@alterakey
alterakey / dumper.c
Created April 6, 2014 14:51
An Rudimental ELF Dumper (for my own learning)
/* dumper.c: An rudimental memory dumper for hunting some executable ELF images targetting Linux 2.4 and later on x86, for my own learning project.
* Copyright (C) 2014 Takahiro Yoshimura <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@alterakey
alterakey / ThrowableCursorLoader.java
Last active August 29, 2015 13:57
A CursorLoader implmentation that enable it to delay handling of the exceptions in loading cursors
/**
* ThrowableCursorLoader: CursorLoader for CPs that tend to throw.
*
* Copyright 2014 Takahiro Yoshimura
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@alterakey
alterakey / MainActivity.java
Created February 13, 2014 15:10
ArrayAdapter Illustration
package com.gmail.altakey.count;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
@alterakey
alterakey / build.gradle
Created January 24, 2014 17:36
Experimental Launcher for Android Gradle Plugin
// Patch in
task launchDebug(dependsOn: 'installDebug') << {
final String cmdline = "bash ${projectDir}/../gradle/start-intent.sh android.intent.action.MAIN ${project.tasks.generateDebugBuildConfig.appPackageName} .activity.MainActivity"
final Process p = cmdline.execute()
p.in.eachLine { l -> println l }
final int code = p.waitFor()
if (code != 0) {
throw new RuntimeException("Task exited with code " + code + ": " + cmdline)
}
}
@alterakey
alterakey / solve-imports.py
Last active January 1, 2016 07:39
Crude Java import solver
Moved to https://github.com/taky/jane
@alterakey
alterakey / com.google.code.dbskkd-cdb.plist
Last active December 29, 2015 07:19
launchd (10.9) plist for dbskkd-cdb
<?xml version="1.0"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.google.code.dbskkd-cdb</string>
<key>UserName</key>
<string>nobody</string>
<key>GroupName</key>
<string>nobody</string>
@alterakey
alterakey / gist:7498030
Last active December 28, 2015 12:08
Experimental solver for that challenge
# Experimental solver for that challenge
import sys
import re
import itertools
numbers = [1,1,5,8]
operators = ['+', '-', '*', '//']
class InversePolandEquationSolver(object):
def __init__(self, eq):
@alterakey
alterakey / killer.c
Created November 3, 2013 16:22
DEFCON21 Final Application Firewall Implementation
/* compile with: gcc -shared -fPIC -o hook.so hook.c -ldl */
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
#include <dlfcn.h>
#include <memory.h>
static void *libc = NULL;
@alterakey
alterakey / binaryoracle.py
Last active December 26, 2015 06:59
Oracle generator for binary searching
#!/usr/bin/env python
import math
class BinaryOracle(object):
def __init__(self, min_, max_, is_int):
self.min_ = min_
self.max_ = max_
self.is_int = is_int
def get(self):
@alterakey
alterakey / solve.py
Last active December 26, 2015 01:29
Solver for that riddle...
import itertools
everybody = ['akira', 'shinya', 'hiroshi', 'chiaki', 'saki', 'yuri', 'mika', 'reina']
akira, shinya, hiroshi, chiaki, saki, yuri, mika, reina = everybody
def conds(p):
return (
# no self cites
p[0] not in (shinya, reina, hiroshi, yuri)
and p[1] not in (mika, chiaki)