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 | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |
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
(define (f n k) | |
(define (f-iter result counter) | |
(if (> counter n) | |
result | |
(f-iter (add1 (modulo (+ result k -1) counter)) | |
(add1 counter)))) | |
(f-iter 1 2)) | |
(define (advanced-f prisoners k) | |
(define (new-list lst p) |
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
#lang racket | |
(require 2htdp/image) | |
(require (except-in racket/gui/base make-pen make-color)) | |
(require (only-in mrlib/image-core render-image)) | |
(define SCORE 0) | |
(define GAMEOVER #f) | |
(define TIMER-INTERVAL 50) |
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.lang.Thread; | |
import java.util.concurrent.atomic.AtomicInteger; | |
public class TestSynchronization { | |
public static void main(String[] args) { | |
Task task = new Task(); | |
for (int i = 0; i < 100; i++) { | |
new Thread(task).start(); | |
} |
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 <stdio.h> | |
#include <stdlib.h> | |
typedef enum { | |
OBJ_INT, | |
OBJ_PAIR | |
} ObjectType; | |
typedef struct sObject { | |
ObjectType type; |