This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from types import FunctionType | |
class cell: | |
def __init__(self, *args): | |
self.i_depend_on = [] | |
self.depends_on_me = [] | |
self.set(*args) | |
def get(self): | |
return self.value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <semaphore.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "channel.h" | |
struct channel_s { | |
sem_t empty_semaphore; | |
sem_t fill_semaphore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example of a C program embedding ECL with callbacks to C functions. | |
Compiled via: gcc ecldemo.c -lecl | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "ecl/ecl.h" | |
#define DEFUN(name,fun,args) \ | |
cl_def_c_function(c_string_to_object(name), \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <semaphore.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "channel.h" | |
struct channel_s { | |
sem_t empty_semaphore; | |
sem_t fill_semaphore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Short indexer and search engine, 2011 Vaughn Wood | |
# Written in python 3 | |
# Assumes the collection is a newline separated file called index on the current path | |
# Only uses TF (so perform queries accordingly) | |
from functools import * | |
def dict_join_add_values(d, e): | |
"""Given two dictionaries, add the items in the second to the first. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.* ; | |
import java.io.* ; | |
import java.util.* ; | |
public class Server { | |
public static void main( String[] args) { | |
try { | |
ServerSocket sock = new ServerSocket(4712,100) ; | |
while(true) new Handler(sock.accept()).start() ;} | |
catch(IOException e) { | |
System.err.println(e) ;};}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "disjoint_set.h" | |
void disjoint_set_new(disjoint_set_t *set) { | |
set->parent = set; | |
set->rank = 0; | |
} | |
disjoint_set_t *disjoint_set_find(disjoint_set_t *set) { | |
disjoint_set_t *root = set->parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import Tkinter as Tk | |
import random | |
class Schelling(): | |
"""A Schelling model. | |
This is a model of a city undergoing dynamic racial segregation.""" | |
race_colors = ["#F9C", "#000", "#FF0", "#F00", "#533"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Willpower trainer | |
# | |
# It's a really bad, ad hoc state machine | |
# | |
import random | |
import pygame |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import random | |
import time | |
import string | |
import Queue | |
import threading | |
from urllib2 import Request, urlopen, URLError, HTTPError | |
import hashlib |
OlderNewer