Skip to content

Instantly share code, notes, and snippets.

View whaley's full-sized avatar

Jason Whaley whaley

  • Asheville, NC
View GitHub Profile
<properties>
<hadoop.directory>your/path/here</hadoop.directory>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-main</artifactId>
<version>9.9.9</version>
public class Main {
interface Foo {
public String x();
public String y();
}
interface Bar {
public Integer w();
╭─whaley at perfectdrug in ~
╰─○ cat .ackrc
-type-set=puppet=.pp
>>> import boto
>>> s3 = boto.connect_s3()
>>> bucket = s3.get_bucket("basementcoders.logging")
>>> result = bucket.delete_keys([key.name for key in bucket if key.name[-1] == '6'])
>>> result.deleted
[<Deleted: basementcoders.downloads2011-01-30-21-37-29-09929716CC5526B6>, <Deleted: basementcoders.downloads2011-01-16-17-19-55-
E50B56C60B99F316>]
@whaley
whaley / gist:1502028
Created December 20, 2011 15:49
ec2_hole_poker.py usage
> python ec2_hole_poker.py -g jasonwhaley.com -p 22 -p 33333
Port 46667 opened for 99.98.113.100 in group jasonwhaley.com
Port 22 opened for 99.98.113.100 in group jasonwhaley.com
def start() {
val finalBoard = processMoves(new TicTacToeBoard())
outputState(finalBoard)
}
private def processMoves (board : TicTacToeBoard) : TicTacToeBoard = {
outputState(board)
val updatedBoard = board.updated(getSelectionFromUser(board), board.gameState.nextTurn)
if (!updatedBoard.gameState.isGameFinished) processMoves(updatedBoard) else updatedBoard
}
var board: TicTacToeBoard = new TicTacToeBoard
def start() {
var gameState: GameState = new XMovesNext
outputState(gameState)
while (!gameState.isGameFinished) {
val position: Int = getSelectionFromUser
board = board.updated(position, gameState.nextTurn)
gameState = getGameState(board)
outputState(gameState)
}
def updated(position: Int, entity: TicTacToeSpace) : TicTacToeBoard = {
def updatedGrid(row: Int, column: Int, entity : TicTacToeSpace) {
grid.updated(row, grid(row).updated(column,entity))
}
position match {
case 1 => new TicTacToeBoard updatedGrid(0,0,entity)
case 2 => new TicTacToeBoard updatedGrid(0,1,entity)
case 3 => new TicTacToeBoard updatedGrid(0,2,entity)
case 4 => new TicTacToeBoard updatedGrid(1,0,entity)
case 5 => new TicTacToeBoard updatedGrid(1,1,entity)
def update(position: Int, entity: TicTacToeSpace): Unit = {
position match {
case 1 => grid(0)(0) = entity
case 2 => grid(0)(1) = entity
case 3 => grid(0)(2) = entity
case 4 => grid(1)(0) = entity
case 5 => grid(1)(1) = entity
case 6 => grid(1)(2) = entity
case 7 => grid(2)(0) = entity
case 8 => grid(2)(1) = entity
val spacesUsed = grid flatten filterNot { space => space == new Empty()} size