Skip to content

Instantly share code, notes, and snippets.

View enaeseth's full-sized avatar

Eric Naeseth enaeseth

View GitHub Profile
<?php
track_http_event('request/view', array(
'request' => array(
'id' => $request->id,
'owning_user_id' => $request->owner()->id
)
));
_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
@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>
@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 / 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)"
[
["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", ".", ".", ".", ".", "."]
[
[".", ".", ".", ".", ".", ".", "."],
[".", ".", ".", ".", ".", ".", "."],
[".", ".", "O", ".", ".", ".", "."],
[".", ".", "X", "O", "X", "X", "."],
[".", ".", "X", "X", "O", "O", "X"],
[".", ".", "O", "X", "X", "O", "X"]
]
# This code is horrible but you wanted the computation to be done in a single
# generator expression. Cheers!
import json
import sys
def resize(grid):
for line in grid:
line.extend(['.'] * 3)
header = [['.'] * 10] * 3
#!/usr/bin/env python
from itertools import product, repeat
import json
import sys
PLAYERS = ['X', 'O']
RUN_LENGTH = 4
def value_at(board, coordinate):
import json
import re # Now I have two problems!
def munge(board):
num_rows = len(board)
rows = [''.join(row) for row in board]
cols = [''.join(col) for col in zip(*board)]
diag1 = [''.join(diag) for diag in
zip(*[' ' * offset + ''.join(row) for row, offset in
zip(board, range(num_rows))])]