Skip to content

Instantly share code, notes, and snippets.

View enaeseth's full-sized avatar

Eric Naeseth enaeseth

View GitHub Profile
#!/usr/bin/env python
from itertools import product, repeat
import json
import sys
PLAYERS = ['X', 'O']
RUN_LENGTH = 4
def value_at(board, coordinate):
[
[".", ".", ".", ".", ".", ".", "."],
[".", ".", ".", ".", ".", ".", "."],
[".", ".", "O", ".", ".", ".", "."],
[".", ".", "X", "O", "X", "X", "."],
[".", ".", "X", "X", "O", "O", "X"],
[".", ".", "O", "X", "X", "O", "X"]
]
[
["X", "O", ".", ".", ".", ".", ".", "O", "X"],
["X", "O", ".", ".", ".", ".", ".", "O", "X"],
["O", ".", ".", ".", ".", ".", ".", "O", "X"],
[".", ".", ".", ".", "X", "X", ".", "X", "O"],
[".", ".", ".", "X", "O", "O", "X", ".", "."],
[".", ".", ".", ".", "X", "O", "X", ".", "."],
[".", "O", "X", ".", ".", ".", ".", ".", "."],
["O", "X", "O", ".", ".", ".", ".", ".", "."],
[".", "O", "X", "X", ".", ".", ".", ".", "."]
@enaeseth
enaeseth / access_excerpt.log
Created October 6, 2011 00:02
Googlebot AJAX posts
66.249.71.47 - - [04/Sep/2011:04:53:52 +0000] "POST /act/site/clienterror HTTP/1.1" 200 36 "http://www.thumbtack.com/ma/malden/dog-walking/dog-walking-and-pet-care-services" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
66.249.72.198 - - [25/Sep/2011:04:27:50 +0000] "POST /act/site/clienterror HTTP/1.1" 200 36 "http://www.thumbtack.com/ca/solana-beach/wedding-photographers/photography-cary-pennington-photography" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
66.249.72.207 - - [04/Oct/2011:09:53:08 +0000] "POST /act/site/clienterror HTTP/1.1" 200 36 "http://www.thumbtack.com/tx/san-antonio/painting/residential-commercial-construction-services" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
@enaeseth
enaeseth / gist:1266109
Created October 6, 2011 00:01
Verifying Googlebot IP
$ dig -x 66.249.71.47 +short
crawl-66-249-71-47.googlebot.com.
$ dig crawl-66-249-71-47.googlebot.com. +short
66.249.71.47
@enaeseth
enaeseth / gist:957977
Created May 5, 2011 21:19
Fugitive and syntastic
eric ~/.vim $ pwd
/Users/eric/.vim
eric ~/.vim $ ls bundle
syntastic vim-fugitive
eric ~/.vim $ mvim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 15 2010 22:03:01)
MacOS X (unix) version
Compiled by Bjorn Winckler <bjorn.winckler@gmail.com>
_id: 4db78bfe40d675666e120000
type: 'request/view'
time: 2011-04-27T03:22:38Z
http: # Information about the HTTP request:
method: 'GET'
ip: '50.23.214.120'
url: '/request/N6coXG' # The actual URL that was requested
endpoint: '/request' # The request handler that got the request
referrer: null
<?php
track_http_event('request/view', array(
'request' => array(
'id' => $request->id,
'owning_user_id' => $request->owner()->id
)
));
_id: 4db8bc0940d6754d71220000 # A database-assigned unique ID
type: 'email/send' # The type of event that occurred
time: 2011-04-27T02:43:15Z # When the event happened
email: # Information about the email:
id: 'r1nyJw' # A unique identifier for the message
message: 'new request' # The type of email that was sent
receiving_user:
id: 'fLHPtl' # The ID of the user who got the message
email: 'eric@thumbtack.com' # The email address the message was sent to
@enaeseth
enaeseth / gist:917100
Created April 13, 2011 07:00
Minutes since the UNIX epoch
>>> from datetime import datetime
>>> int32_max = (2 ** 31) - 1
>>> # year 2038 problem:
... datetime.utcfromtimestamp(int32_max)
datetime.datetime(2038, 1, 19, 3, 14, 7)
>>> # but minute resolution gets us much further:
... datetime.utcfromtimestamp(int32_max * 60)
datetime.datetime(6053, 1, 23, 2, 7)