Skip to content

Instantly share code, notes, and snippets.

View jdavis's full-sized avatar
💾

Josh Davis jdavis

💾
View GitHub Profile
@jdavis
jdavis / open_port.py
Created November 8, 2012 17:26
Find an open port in Python.
import socket
def find_open_port():
"""
Use socket's built in ability to find an open port.
"""
sock = socket.socket()
sock.bind(('', 0))
@jdavis
jdavis / solution.pdf
Last active December 14, 2015 21:49
Homework #4 for Computer Science 331 - Theory of Computing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdavis
jdavis / ternary.c
Created April 11, 2013 05:18
Code sample showing the wonkiness of the precedence of the ternary statement in C.
#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", '}', '}');
@jdavis
jdavis / adapter.py
Created April 17, 2013 12:03
Example of the Adapter Design Pattern in glorious Python code.
"""
Example of the Adapter Design Pattern
"""
class RocketShip(object):
def turnOn(self):
raise NotImplementedError()
@jdavis
jdavis / Project2Tests.sh
Last active December 16, 2015 11:29
Set of simple tests for the second project of Computer Science 352 at Iowa State University.
#!/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:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdavis
jdavis / AREADME.md
Last active December 28, 2015 17:59

CS311 Homework 6 Tests

Downloading

To use these tests, just use Git and clone them into the directory you have your project.

You can do this using:

@jdavis
jdavis / terrariad
Created December 28, 2013 21:23
Simple init.d Service script to start a tshock Terraria Server
#!/bin/sh
#
# Terraria Config
#
# Tmux session ID
SESSION=terraria
# Username to run as
@jdavis
jdavis / keybase.md
Last active August 29, 2015 14:01
Keybase.io Verification

Keybase proof

I hereby claim:

  • I am jdavis on github.
  • I am davis (https://keybase.io/davis) on keybase.
  • I have a public key whose fingerprint is 2FCA 80FF 5F48 C64E E32D 1180 E3BE E893 B4C2 E990

To claim this, I am signing this object:

@jdavis
jdavis / neovim-june-06
Last active August 29, 2015 14:02
Statistics of Neovim Git repo using gitinspector on June 06
The following historical commit information, by author, was found in the
repository:
Author Commits Insertions Deletions % of changes
Alexander Bolodurin 2 0 144 0.02
Cameron Eagans 2 16 0 0.00
Chris Watkins 6 221 605 0.13
Christian Wellenbroc 1 10 10 0.00
Dane Summers 1 7 5 0.00
David Z. Chen 3 10592 4159 2.24