Skip to content

Instantly share code, notes, and snippets.

Dan Birken danbirken

Block or report user

Report or block danbirken

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View trigger.py
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import datetime
Base = declarative_base()
engine = create_engine('postgresql://postgres:@localhost/testing')
View script.py
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import datetime
Base = declarative_base()
engine = create_engine('postgresql://postgres:@localhost/testing')
View sqlalchemy-query-stats.py
from sqlalchemy import engine
from sqlalchemy import event
class DbStats():
def __init__(self):
self.clear()
def clear(self):
self.total_queries = 0
self.total_time = 0
View keybase.md

Keybase proof

I hereby claim:

  • I am danbirken on github.
  • I am birken (https://keybase.io/birken) on keybase.
  • I have the public key with fingerprint FBB6 9FA4 5DB1 16AB 558A  DACC C0D1 A700 1DA4 F3A7

To claim this, I am signing this object:

View output
Timing to_datetime():
Datetime format: %m-%d-%Y
---------------
Without infer_format: cad7e6333f1cd2ebe272d7fc7553cd27 - 3.082s
With infer_format: cad7e6333f1cd2ebe272d7fc7553cd27 - 0.268s (11.51x baseline)
Passing the format: cad7e6333f1cd2ebe272d7fc7553cd27 - 0.267s (11.54x baseline)
Datetime format: %m/%d/%Y %H:%M:%S.%f
---------------
Without infer_format: ec2ef27adb2e95e2c5386d8d5d8513a1 - 5.162s
View apache_crawler_parse.py
import collections
import csv
import re
import subprocess
import sys
USER_AGENT_RE = re.compile(
'^([0-9\.]+) .* (206|301|304|200|404|416|500) '
'([0-9\-]+) \".*\" \"(.*)\"$'
)
View Example 1.html
<html>
<head>
<title>Example page</title>
</head>
<body>
<div class="main"><div style="float:left;" class="left"><h1>This is a contrived example</h1>
</div>
<div style="float:left;" class="right">
<h2>Toolbar</h2><ul><li><a href="/option-1">Option 1</a></li><li><a href="/option-2">Option 2</a></li></ul>
</div>
@danbirken
danbirken / gist:2006956
Created Mar 9, 2012
Sample connect 4 board
View gist:2006956
[
[".", ".", ".", ".", ".", ".", "."],
[".", ".", ".", ".", ".", ".", "."],
[".", ".", "O", ".", ".", ".", "."],
[".", ".", "X", "O", "X", "X", "."],
[".", ".", "X", "X", "O", "O", "X"],
[".", ".", "O", "X", "X", "O", "X"]
]
You can’t perform that action at this time.