Recent Pads - Page 30

Total pad count: 627
created 5 years, 323 days ago
pymongo-is-so-simple

import pymongo
db = pymongo.Connection( 'mongodb://localhost/' )[ 'linkpeek' ]
print sum( [ user['rcount'] for user in db.user.find() ] )
... view all 4 lines

created 5 years, 326 days ago
messing-with-python-callbacks

>>> from time import sleep
>>> def call_me_maybe( target, callback ):
...     print target
...     sleep( 5 )
...     callback( target.upper() )
... 
>>> def test_call_me_maybe( target ):
... view all 17 lines

created 5 years, 329 days ago
python-multi-arm-bandit

from random import random, choice

def choose_lever( levers ):
    """Accept a dict of levers, return tuple ( key, levers )"""
    if random() < 0.1:
        # exploration! choose random lever 10% of time
        explored_key = choice( levers.keys() )
... view all 45 lines

created 5 years, 329 days ago
test_hyphen_filenames

    def test_hyphen_filenames(self):
        info = DummyRendererInfo({
            'name':'app:moon-and-world.mak',
            'package':None,
            'registry':self.config.registry,
            'settings':{},
            'type': ''
... view all 11 lines

created 5 years, 329 days ago
5d498f88-5e8c-4f08-b73a-27d50a56ac11

@view_config( route_name="template")
def template(request):
    # check if template exists before rendering
    from pkg_resources import resource_exists
    from pyramid.renderers import render_to_response

... view all 17 lines

created 5 years, 329 days ago
3165a602-db16-417d-8c03-e1bcff0ab644

(virtpy)[fox@blanka linkpeek]$ pserve development.ini --reload
Starting subprocess with file monitor
Starting server in PID 4365.
serving on 0.0.0.0:9001 view at http://127.0.0.1:9001
2012-09-22 01:19:26,731 ERROR [pyramid_debugtoolbar][worker 0] Exception at http://127.0.0.1:9001/how-much-does-linkpeek-cost
traceback url: http://127.0.0.1:9001/_debug_toolbar/exception?token=15fac23dae77dfb5b654&tb=54746512
Traceback (most recent call last):
... view all 35 lines

created 5 years, 332 days ago
2652d76d-e09c-4ac0-af9f-0e973e715e40

    if page['state'] != 'serving': # if the page is not serving
        waited = 0
        while page['state'] != 'serving':
            sleep( 1 )
            waited += 1
            page = request.db.api.find_one( { 'uri': uri } )
            if waited >= 30 or not page:
... view all 13 lines

created 5 years, 333 days ago
049bf5e1-1c89-4fa8-825b-94737ef8d93a

/api/v1?uri=http://davematthewsbandspotify.com/&apikey=e0a8tumxz&token=8ca9b4af907c59d90820198cf93effff&size=560x280

/api/v2/e0a8tumxz/8ca9b4af907c59d90820198cf93effff?uri=http://davematthewsbandspotify.com/&size=560x280
... view all 3 lines

created 5 years, 333 days ago
fb0f5474-c229-4b2c-8505-5fb54c8f5005

/api/v1?uri=http://davematthewsbandspotify.com/&apikey=e0a8tumxz&token=8ca9b4af907c59d90820198cf93effff&size=560x280

/api/v2/e0a8tumxz/8ca9b4af907c59d90820198cf93effff?target=http://davematthewsbandspotify.com/&size=560x280
... view all 3 lines

created 5 years, 335 days ago
pyramid-inject-renderer-globals-title-and-analytics

def inject_renderer_globals( event ):
    """Inject some renderer globals before passing to template"""

    request = event['request']

    # Build ${title} from the current request.path  
    event['title'] =  ' - '.join( request.path.replace( '-', ' ' ).split( '/' )[1:] ).title()
... view all 11 lines

created 5 years, 336 days ago
65cc6c6f-10ab-44dd-b5e0-ef024b7364ff

what pad is this 
looks fast
... view all 3 lines

created 5 years, 339 days ago
a213fc26-5b26-45b6-a861-4fe755a72835

Delivered-To: northwindmanagement@gmail.com
Received: by 10.50.104.197 with SMTP id gg5csp61720igb;
        Wed, 12 Sep 2012 00:06:42 -0700 (PDT)
Received: by 10.182.193.7 with SMTP id hk7mr20884301obc.30.1347433600985;
        Wed, 12 Sep 2012 00:06:40 -0700 (PDT)
Return-Path: <Nick.Raymonde@sonymusic.com>
Received: from va3outboundpool.messaging.microsoft.com (va3ehsobe002.messaging.microsoft.com. [216.32.180.12])
... view all 66 lines

created 5 years, 343 days ago
e9f48aa9-27b7-4b60-bbca-4e8dde419ec2

Plan: good, Percentage: 66
Plan: better, Percentage: 0
Plan: best, Percentage: 8
Plan: super, Percentage: 16
... view all 5 lines

created 5 years, 344 days ago
yqbgsdqajfryrs

service zenoss start
Zenoss not initialized.  Performing first-boot initialization...
Fresh install pre steps
Checking RRDtool version >= 1.4.7: [ OK ] 1.4.7
Adding RabbitMQ user:
Error: {user_already_exists,<<>>}
Adding RabbitMQ vhost:
... view all 13 lines

created 5 years, 348 days ago
dcbf5ace-9989-4a4f-98ed-5fe173dc450b

22/tcp   open     ssh
80/tcp   open     http
389/tcp  filtered ldap
443/tcp  open     https
514/tcp  filtered shell
646/tcp  filtered ldp
1718/tcp filtered unknown
... view all 14 lines

created 5 years, 348 days ago
8291a4b5-193b-4b8b-be93-f5f74eaa3b2a

Not shown: 991 closed ports
PORT     STATE    SERVICE
22/tcp   open     ssh
80/tcp   open     http
135/tcp  filtered msrpc
139/tcp  filtered netbios-ssn
443/tcp  open     https
... view all 11 lines

created 5 years, 355 days ago
2d09df13-c11f-4da7-8330-0f83efae45b8

what
who
now?
... view all 3 lines

created 5 years, 364 days ago
fcb818ee-19be-46d3-a9d4-221c3a109d86

from random import shuffle, randrange
from collections import defaultdict

print "init..."

max = 10000001

... view all 20 lines

created 6 years, 2 days ago
python-twitter-friend-vs-follower

from time import sleep
import json
import requests
# easy_install requests or pip install requests

APIURI = "https://api.twitter.com/1"

... view all 82 lines

created 6 years, 2 days ago
build-cve-report-from-redhat

import sys
from subprocess import call
from BeautifulSoup import BeautifulSoup
from os import remove

def print_report( cvelist ):

... view all 69 lines

pages 1 .. 28 29 30 31 32