This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
def get_player_profiles(player_list): | |
# Returns a dict of player profile URLs to be used in the next step | |
# Dict will hold player profile pages indexed by player name | |
player_profile_urls=dict.fromkeys(player_list) | |
for n in player_list: | |
names=n.split(' ') | |
# Search for the player names at NFL.com to get their individual player profiles, which contain the | |
# data we ultimately want. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.enterprise import adbapi | |
from twisted.python import log | |
import MySQLdb | |
class ReconnectingConnectionPool(adbapi.ConnectionPool): | |
"""Reconnecting adbapi connection pool for MySQL. | |
This class improves on the solution posted at | |
http://www.gelens.org/2008/09/12/reinitializing-twisted-connectionpool/ | |
by checking exceptions by error code and only disconnecting the current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: supervisord | |
# Required-Start: $remote_fs | |
# Required-Stop: $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Example initscript | |
# Description: This file should be used to construct scripts to be | |
# placed in /etc/init.d. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Usage: ./check_feedburner.py MyFeedName | |
import re, sys, urllib, fileinput | |
from xml.dom import minidom | |
AWARENESS_API_URL = 'https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=%s' | |
# If you want to replace the feedburner count in a given file, define it here | |
FEED_COUNT_FILE = '/path/to/your/file.php' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import httplib | |
import tornado.web | |
class ErrorHandler(tornado.web.RequestHandler): | |
"""Generates an error response with status_code for all requests.""" | |
def __init__(self, application, request, status_code): | |
tornado.web.RequestHandler.__init__(self, application, request) | |
self.set_status(status_code) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | |
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# how to unfollow everyone who isn't following you | |
# By Jamieson Becker (Public Domain/no copyright, do what you will) | |
# Easy instructions, even if you don't know Python | |
# | |
# 1. Install pip (apt-get install python-pip) and then | |
# pip install tweepy, which is the python twitter client | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# switch to the jenkins user | |
[root@li220-252:~] su jenkins | |
jenkins@li220-252:/root$ | |
# Move into the jenkins directory | |
jenkins@li220-252:~$ cd /var/lib/jenkins/ | |
# Intialize a git repository | |
jenkins@li220-252:~$ git init | |
Initialized empty Git repository in /var/lib/jenkins/.git/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from gevent import monkey; monkey.patch_all() | |
import gevent | |
from gevent_zeromq import zmq | |
class WebSocketHandler(object): | |
def __init__(self, _id, in_queue, socket): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<title> | |
SQLite Example | |
</title> | |
<body> | |
<FORM ACTION="/create" METHOD=POST> | |
Name: <input type="text" name="name"> | |
Marks: <input type="text" name="marks"> |
OlderNewer