class: center middle
class: center middle
#-*- coding: utf-8 -*- | |
import urllib, re, os, argparse | |
RE_NEXT_URL = ur'<a href=\"(?!javascript\:)([^\"]*?)">下一页<\/a>' | |
RE_PICTURE = ur'<p\s+(?:align=\"center\")>\s*<img.*?src=\"(.*?)\".*?\/?>' | |
RE_ARCTITLE = ur'var arctitle=\'(.*?)\';' | |
def get_html(url): | |
try: | |
return urllib.urlopen(url).read().decode('gbk') |
<?xml version="1.0" encoding="UTF-8" ?> | |
<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009"> | |
<!-- Support info to show in the marketplace & control panel --> | |
<Support> | |
<!-- URL for application setup as an optional redirect during the install --> | |
<Link rel="setup" href="http://_example.com_/google/setup.php?domain=${DOMAIN_NAME}" /> | |
<!-- URL for application configuration, accessed from the app settings | |
page in the control panel --> |
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
from sqlalchemy import create_engine, Column, Integer, String, func | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import sessionmaker | |
Base = declarative_base() | |
class StudentInfo(Base): |
(function(){ | |
var gist_id = document.location.pathname.replace(/.*\//g, ''); | |
window.open('http://remarks.sinaapp.com/s/' + gist_id, '_blank', 'width=600,height=400'); | |
})() |
/* | |
gfw_whitelist.pac | |
GFW Whitelist | |
- inspired by autoproxy and chnroutes | |
- https://gist.github.com/greatghoul/5283630/raw/subway-whitelist.pac | |
v1.2 | |
Author: [email protected] | |
License: MIT License |
# -*- coding: utf-8 -*- | |
from BeautifulSoup import BeautifulSoup | |
import re | |
def get_timestamp(html): | |
soup = BeautifulSoup(html) | |
authi_elems = soup.findAll('div', { 'class': 'authi' }) | |
for authi_elem in authi_elems: | |
date_elem = authi_elem.find('span', title=re.compile(r'20\d{2}-\d+-\d+\s\d{2}:\d{2}:\d{2}')) | |
print date_elem.get('title') |
// 格式化字符串 | |
// | |
// 用法: | |
// | |
// var s1 = '%{1} and %{2}!'; | |
// console.log('source: ' + s1); | |
// console.log('target: ' + fmt(s1, 'ask', 'learn')); | |
// | |
// var s2 = "%{name} is %{age} years old, his son's name is %{sons[0].name}"; | |
// console.log('source: ' + s2); |
chrome.webRequest.onBeforeSendHeaders.addListener( | |
function(details) { | |
if (details.type === 'xmlhttprequest') { | |
var exists = false; | |
for (var i = 0; i < details.requestHeaders.length; ++i) { | |
if (details.requestHeaders[i].name === 'Referer') { | |
exists = true; | |
details.requestHeaders[i].value = 'http://www.baidu.com'; | |
break; | |
} |