Skip to content

Instantly share code, notes, and snippets.

/*
Blogger Template Style
Name: TicTac (Blueberry)
Author: Dan Cederholm
URL: www.simplebits.com
Date: 1 March 2004
*/
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
版权:www.lalfa.com ealpha@gmail.com
转载请不要删除
todo :设置一个字段表示,是否成功更新,一旦成功则记录ID,系统运行结束,进行update。否则发送短信。保证只发送一次
"""
import os,urllib2,re,MySQLdb,datetime,time,smtplib
from BeautifulSoup import BeautifulSoup
//pac for ssh
function FindProxyForURL(url, host) {
return "SOCKS 127.0.0.1:7777";
var l = ['*.mediafire.com/*',
'*.wikipedia.org/*',
'*.live.com/*',
'*.tumblr.com/*',
/*
广告
出现在页顶,
点击关闭就关闭
*/
//http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js
jk.use('jquery').jQuery(function($){
var con = '<div style="width:800px;margin:0 auto;height:70px;background:red;position:relative;"><a style="position:absolute;right:0;top:0;" class="btn_close" href="#">关闭</a>文字</div>';
con = $(con).prependTo(document.body);
#http://mac.6.cn/topic/view/4818/1.html
# 原始写法
RedirectMatch 301 ^/==/b\.com/(.*)$ http://www.b.com/$1
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /==/b\.com$1 [L]
//模板解析
//http://kingcms.googlecode.com/svn/trunk/upload/system/lib/template.class.php
var s = /\{((\w+):([\w\.]+))([^}]*)\/\}|\{((\w+):([\w\.]+))([^}]*)\}(?:.|\n)*\{\/\5\}/g;
var st = '<p>\n来源:\n{king:_source}\n<a href="{king:val.2/}" target="_blank">{king:val.1/}</a>\n{/king:_source}\n\n<!--- 插入正常PHP代码,echo输出 ---->\n<?php\nif(\'{king:title/}\'){\n echo "<p>有标题</p>";\n}else{\n echo "<p>标题呢?<p>";\n}\n?>\n\n</p>';
st.match(s);
/*
#!/usr/bin/env python
#web 资源、模板管理
schema = [
# user
Table('user', key=('id', 'username'))[
Column('id', auto_increment=True),
Column('username', type='varchar', size='50'),
Column('time', type='int'),
#!/bin/bash
# any2mp3.sh, :)
# http://ch-linghu.3322.org/temp/any2mp3.sh.txt
if [ $# == 0 ]; then
echo "USAGE: any2mp3 input [output]"
echo "if output is ignore, input name plus mp3 postfix will be used"
exit
fi
if [ $# == 1 ]; then
# python/os.walk
def walk(top, topdown=True, onerror=None):
from os.path import join, isdir, islink
# We may not have read permission for top, in which case we can't
# get a list of the files the directory contains. os.path.walk
# always suppressed the exception then, rather than blow up for a
# minor reason when (say) a thousand readable directories are still
# jquery/selector/dir
# 这样的东西很有智慧,跟 python/os.walk 一样
function dir( elem, dir ) {
var matched = [],
cur = elem[dir];
while ( cur && cur != document ) {
if ( cur.nodeType == 1 )
matched.push( cur );
cur = cur[dir];