To use these tests, just use Git and clone them into the directory you have your project.
You can do this using:
import socket | |
def find_open_port(): | |
""" | |
Use socket's built in ability to find an open port. | |
""" | |
sock = socket.socket() | |
sock.bind(('', 0)) |
#!/bin/sh | |
# | |
# Terraria Config | |
# | |
# Tmux session ID | |
SESSION=terraria | |
# Username to run as |
# Rename a file and keep it in the same location | |
rename() { | |
if [ "$#" -ne 2 ]; then | |
echo "usage: $0 path/to/file/old_name new_name" | |
return | |
fi | |
mv $1 `dirname $1`/$2 | |
} |
#!/usr/bin/env sh | |
# | |
# Project 2 Tests | |
# Josh Davis | |
# | |
# Overview: | |
# A few quick and crude tests for project 2. | |
# | |
# Running: | |
# To run it, make sure it has the right permissions: |
""" | |
Example of the Adapter Design Pattern | |
""" | |
class RocketShip(object): | |
def turnOn(self): | |
raise NotImplementedError() |
#include <stdio.h> | |
char identity(char x); | |
int main(int argc, const char *argv[]) { | |
int compound; | |
printf("For reference:\n"); | |
printf(" the ASCII value of %c is %d\n", ';', ';'); | |
printf(" the ASCII value of %c is %d\n", '}', '}'); |
def cons(x, y): | |
return lambda f: f(x, y) | |
def car(x): | |
# Fill out this function | |
pass | |
if car(cons(1, 5)) == 1: | |
print 'Solved!' | |
else: |