Skip to content

Instantly share code, notes, and snippets.

@aragaer
aragaer / sptest.cpp
Created May 7, 2010 14:35
smart pointers
#include "sptest.h"
#include <stdio.h>
class test {
public:
test() {
printf("Test constructor\n");
field = new char[20];
is_deleted = false;
}
@aragaer
aragaer / eve-central.js
Created May 11, 2010 13:58
eve-central component
const Cc = Components.classes;
const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var gOS;
const Query = {
getPrice: "select price from simple_prices where typeID=:tid " +
"and date('now') < date(exp_date);",
setPrice: "replace into simple_prices values(:tid, :price, " +
@aragaer
aragaer / gist:454839
Created June 27, 2010 11:36
Simple pseudo-terminal app
#include <stdio.h>
#include <stdlib.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
char *path = "/home/aragaer/pts";
char linkname[80] = "";
@aragaer
aragaer / gist:473063
Created July 12, 2010 21:11
Python and EVE
#!/usr/bin/python
import urllib
import urllib2
from xml.dom.minidom import parse
user_id = 2373898
api_key = "<snip>"
char_id = 1580122797
uri_base = 'http://api.eve-online.com'
# set this to your eve path
EVEROOT = "/home/aragaer/.wine/drive_c/Program Files/CCP/EVE"
# start ooocalc like this:
# oocalc -accept="socket,host=localhost,port=2002;urp;"
# then run this script and type a character id anywhere
import uno
import android
import time
from math import sqrt
droid = android.Android()
droid.wakeLockAcquirePartial()
def main():
while True:
total = 0
#define HOOK_CALL(lib, name, size) \
static void (*_ ## name ## _hook)(void); \
void name (void) { \
void *args = __builtin_apply_args(); \
DBG("Calling %s", #name); \
if (!_ ## name ## _hook) { \
void *orig_p, *orig; \
void *hook = get_lib_hook(lib); \
orig = dlsym(RTLD_NEXT, #name); \
if (!orig) { \
@aragaer
aragaer / gist:1124829
Created August 4, 2011 09:27
item equip subroutine
def equip(name):
name = ' '.join(name)
item = get_inv_item(name, False)
if item.equipped:
print "%s is already equipped", name
return
if item.slot is None:
print "You equip %s" % name
power += item.bonus
@aragaer
aragaer / crypt32.diff
Created September 11, 2011 13:30
Fixes in crypt32
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 75b0e12..8571c83 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -317,25 +317,28 @@ static BOOL CertContext_GetProperty(void *context, DWORD dwPropId,
break;
case CERT_KEY_IDENTIFIER_PROP_ID:
{
+ CRYPT_DATA_BLOB value;
+ DWORD size = sizeof(value);
int cnt = 0;
while (getenv("LD_PRELOAD")) {
fprintf(stderr, "l");
unsetenv("LD_PRELOAD");
if (cnt++ > 10)
break;
}