Skip to content

Instantly share code, notes, and snippets.

View muscar's full-sized avatar

Alex Muscar muscar

View GitHub Profile
//
// main.cpp
// wirth
//
// Created by Alex Muscar on 6/20/13.
// Copyright (c) 2013 Alex Muscar. All rights reserved.
//
#include <iostream>
#include <vector>
//
// Program.cs
//
// Author:
// Alex Muscar <muscar@gmail.com>
//
// Copyright (c) 2013 Alex Muscar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
class ExpEndpoint<T>
{
private Queue<T> inputQueue;
private Queue<T> outputQueue;
private Object stateLock = new Object();
private TaskCompletionSource<T> reader;
public ExpEndpoint(Queue<T> inputQueue, Queue<T> outputQueue)
{
this.inputQueue = inputQueue;
@muscar
muscar / serv.py
Created October 21, 2012 06:21
Dumb static file server in Python
import mimetypes as mime
import os
import socket
import sys
WWW_ROOT = 'www_root'
STATUS_MESSAGES = { 200: 'OK',
404: 'Not Found',
500: 'Internal Server Error' }
@muscar
muscar / markov.py
Created October 13, 2012 09:01
Markov chain text generator
import sys
import random
# Read
def read_file(path):
f = open(path)
text = f.read()
f.close()
return text.split()