Skip to content
<ns0:entry xmlns:ns0="" xmlns:ns1="" xmlns:ns2="">
<ns0:rights>Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.</ns0:rights>
<ns0:content type="text/xml">
def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False,
subprocess=False, sys=False, aggressive=True, Event=False):
"""Do all of the default monkey patching (calls every other function in this module."""
# order is important
if os:
if time:
if thread:
"detail_output": {
"content.article-lease": {
"lease_type": 2,
"node_identifier": {
"node_name": "content.article-lease"
"timestamp": 1422677331539
"content.article.shingles-lease": {
from string import Formatter
import sys
def keywords_to_questionmarks(format_string, *args, **kwargs):
'''Convert a format string keyword formatted query to a ? wildcarded prepared statement
that is pyodbc compatible, along with the args tuple to pass to it.
* format_string: Python format compatible representation of a query
* args: positional args for the format string
* kwargs: keyword args for the format string
#How to manipulate the path in an intelligent fashion with bash. Note: this doesn't work with Bourne shell.
function idempotent_path_add {
if [[ ! "$PATH" =~ (^|:)"$DIR"(:|$) ]]
if [ $PREPEND ]
public class Copy {
public static void main(String[] args) throws Throwable {
int next;
while ((next = != -1) {
// -*- compile-command: "clang++ -ggdb -std=c++11 -stdlib=libc++ -Wall -Werror tad_test.cpp -o tad_test" -*-
#include <iostream>
using namespace std;
template <typename T, typename U>
struct Foo {
T v;
U w;
#!/usr/bin/env python
import sqlite3
from_location_group = {
'OBD1': 'Online',
'OBD2': 'Online',
'CB07': 'Retail',
'CB08': 'Retail',
'CB09': 'Retail',
import random
import itertools
def sample(population, k):
"How random.sample should really be defined."
if callable(getattr(population, '__len__', None)) and callable(getattr(population, '__getitem__', None)):
return random.sample(population, min(k, len(population)))
p = iter(population)
// -*- compile-command: "g++ -O3 -march=native -std=c++11 -Wall -Werror endian.cpp -o endian" -*-
#include <fstream>
#include <ostream>
#include <istream>
#include <cstdint>
#include <algorithm>
#include <cassert>
#include <string>
#include <vector>
#include <limits>
Something went wrong with that request. Please try again.