Skip to content

Instantly share code, notes, and snippets.

@boblefrag
boblefrag / bench.py
Created November 11, 2016 15:05
list comprehension vs for loop python
import time
import pprint
phrase = """ Britney Jean Spears (born December 2, 1981) is an American singer, dancer and actress. Born in
McComb, Mississippi, and raised in Kentwood, Louisiana, she performed acting roles in stage
productions and television shows as a child before signing with Jive Records in 1997. Spears's first
and second studio albums, ...Baby One More Time (1999) and Oops!... I Did It Again (2000), became
international successes, with the former becoming the best-selling album by a teenage solo
artist.[1] Title tracks "...Baby One More Time" and "Oops!... I Did It Again" broke international
sales records. In 2001, Spears released her self-titled third studio album, Britney, and played the
Verifying that +boblefrag is my blockchain ID. https://onename.com/boblefrag
import importlib
import select
import json
import logging
from django.db import connection
from django.conf import settings
from django.core.management.base import BaseCommand
logger = logging.getLogger(__name__)
@boblefrag
boblefrag / nosetest_time_execution
Created January 5, 2016 15:44
get the test ordered by time execution for NoseTest
from lxml import etree
tree = etree.parse("<path to nosetests.xml>")
results = []
for t in tree.xpath("/testsuite/testcase"):
result = {"class": t.get('classname'),
"name": t.get('name'),
"time": t.get('time')}
import setup
import os
import imp
file_path = os.path.join(
os.path.dirname(os.path.abspath(setup.__file__)),
"branch_settings.py")
if os.path.exists(file_path):