This file contains hidden or 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 re | |
import json | |
import argparse | |
import mechanize | |
from lxml import html | |
def run(username, password): |
This file contains hidden or 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
def compress(input): | |
if len(input) == 0: | |
return "" | |
output = [] | |
count = 1 | |
prev = input[0] | |
for c in input[1:-1]: | |
if c == prev: | |
count += 1 | |
else: |
This file contains hidden or 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/bash | |
#Naive calculation of QPS from Apache Log | |
#Usage: qps.sh /path/to/logfile | |
LOG=$1 | |
START=$(head -n 1 $LOG | cut -d ' ' -f 4 | tr -d [) | |
END=$(tail -n 1 $LOG | cut -d ' ' -f 4 | tr -d [) |
This file contains hidden or 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 sys | |
import math | |
def average(li): | |
return sum(li) * 1.0 / len(li) | |
def stddev(numbers): | |
avg = average(numbers) |
This file contains hidden or 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
data:text/html;charset=utf-8, <title>PyChrome</title> <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/twilight");e.getSession().setMode("ace/mode/python");</script> |
This file contains hidden or 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
set number | |
set shiftwidth=4 softtabstop=4 | |
set ai " auto indenting | |
set history=100 " keep 100 lines of history | |
set ruler " show the cursor position | |
syntax on " syntax highlighting | |
set hlsearch " highlight the last searched term | |
filetype plugin on " use the file type plugins | |
" When editing a file, always jump to the last cursor position |
This file contains hidden or 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 re import compile, search | |
from sys import exit | |
from time import strptime | |
from datetime import datetime, timedelta, tzinfo | |
#change this variable to point to the location of the apache access log file | |
LOG_FILE_LOCATION = '/var/log/httpd/access_log' | |
LINES_PROCESSED = 0 |
This file contains hidden or 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
+-----+-------------------------------+----------------------------------------------------------------------------------------+-----------+ | |
| id | name | url | source_id | | |
+-----+-------------------------------+----------------------------------------------------------------------------------------+-----------+ | |
| 685 | PBS Arts & Society | http://newscred:[email protected]/rss/v2/532-pbs-arts-society.rss | 6068 | | |
| 672 | Xinhua Environment | http://newscred:[email protected]/rss/v2/517-xinhua-environment.rss | 6067 | | |
| 673 | Xinhua Arts & Entertainment | http://newscred:[email protected]/rss/v2/518-xinhua-arts-entertainment.rss | 6067 | | |
| 674 | Xinhua Travel | http://newscred:[email protected]/rss/v2/519-xinhua-travel.rss | 6067 | | |
| 675 | Xinhua Sports |