Skip to content

Instantly share code, notes, and snippets.

View Arachnid's full-sized avatar

Nick Johnson Arachnid

View GitHub Profile
include $(GOROOT)/src/Make.$(GOARCH)
TARG=kademlia
GOFILES=\
nodeid.go\
routingtable.go\
contact.go\
kademlia.go
include $(GOROOT)/src/Make.pkg
package main
import "fmt"
type state struct {
board [7][6]int;
heights [7]int;
}
type move struct {
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Links from appengine.reddit.com" height="300">
<Require feature="dynamic-height"/>
</ModulePrefs>
<Content type="html"><![CDATA[
<style type="text/css">
.rembeddit {
margin-bottom: 10px;
}
"""Implements a distributed transaction for transfers of funds.
Invariant: The sum of all accounts, plus all partially applied transfers, is 0.
Steps:
1) In a transaction, an Account is debited, and a Transaction object is created, with the
appropriate amount and target, but no other transaction.
2) In a transaction, the target Account is credited, and a Transaction object is created with
a predefined key name, and the other transaction referencing the one created in step 1.
3) The original Transaction object created in step 1 is updated to reference the transaction
A unit test helper library for App Engine.
Note that this is currently COMPLETELY UNTESTED. Consider it demo code only.
This library aims to make it easier to unit-test app engine apps and libraries
by handling the creation and registration of service stubs and so forth for you.
It also provides a custom implementation of the Capability service that allows
you to specify what capabilities you want it to report as disabled, and it wraps
all stubs in a wrapper that will throw a CapabilityDisabledError if you attempt
to use a disabled service or method.
@Arachnid
Arachnid / eepy.c
Created August 3, 2009 20:26
Simple fiber library. Compile with: gcc -o eepy.o -g -c eepy.c; gcc -o test -lpthread -g test.c eepy.o
#include <assert.h>
#include <pthread.h>
#include <setjmp.h>
#include <signal.h>
#include <stdlib.h>
#include "eepy.h"
// Information about an active eepy process
typedef struct eepy_process {
jmp_buf context;
import logging
from google.appengine.ext import db
class KindIterator(object):
def __init__(self, kind, filters=None, batch_size=100):
self.kind = kind
if filters:
self.filters = filters
else:
self.filters = []
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Members"
description="Awaken your community with the members gadget which lets visitors join your site, sign in, and invite their friends. They can even explore the profiles of other members and make new friends."
author="Google"
author_email="[email protected]"
thumbnail="http://www.google.com/friendconnect/static/images/thumb/members.png"
screenshot="http://www.google.com/friendconnect/static/images/thumb/members.png"
>
<Require feature="dynamic-height"/>
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Members"
description="Awaken your community with the members gadget which lets visitors join your site, sign in, and invite their friends. They can even explore the profiles of other members and make new friends."
author="Google"
author_email="[email protected]"
thumbnail="http://www.google.com/friendconnect/static/images/thumb/members.png"
screenshot="http://www.google.com/friendconnect/static/images/thumb/members.png"
>
<Require feature="dynamic-height"/>
import logging
import os
import StringIO
from google.appengine.ext import db
BLOCK_NAME_FMT = '#%.8X'
class Inode(db.Model):
DEFAULT_BLOCK_SIZE = 524288