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
Option Explicit | |
'建筑资料栋号递增批量打印PDF输出 | |
Sub replace() | |
Const F1 As String = "工程名称" '要修改单元格左边相邻单元格包含的内容 | |
Dim k As Integer | |
Dim sh As Worksheet | |
Dim myStr As String | |
Dim myStr2 As String | |
Dim myStr3 As String |
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 -*- | |
import requests | |
import hashlib | |
import re | |
username = '' ###账号### | |
password = ''###密码### | |
UA = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) \ | |
Chrome/27.0.1453.116 Safari/537.36" | |
headers = { |
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
#https://gist.github.com/gregburek/1441055 | |
#限制单位时间内函数执行次数 | |
import time | |
from collections import deque | |
def RateLimited(minutes=1, limitNum=3): | |
status = deque([0] * limitNum, maxlen=limitNum) | |
def decorate(func): | |
def wrap(*args, **kwargs): |
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 argparse | |
foo1 = sum | |
foo2 = max | |
def main(test=None): | |
parser = argparse.ArgumentParser(description="http://www.v2ex.com/t/173206") | |
group = parser.add_mutually_exclusive_group() | |
group.add_argument("-foo1", action="append", type=int, default=[2]) | |
group.add_argument("-foo2", nargs="+", type=int) | |
return foo2(parser.parse_args(test).foo2) if parser.parse_args(test).foo2 else foo1(parser.parse_args(test).foo1) |
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
// ==UserScript== | |
// @id remove-google-redirection | |
// @name Remove Google Redirection | |
// @namespace http://kodango.com | |
// @description Prohibit click-tracking, and prevent url redirection when clicks on the result links in Google search page. | |
// @author tuantuan <dangoakachan@gmail.com> | |
// @homepage http://kodango.com | |
// @version 1.1.0 | |
// @include http*://www.google.*/ | |
// @include http*://www.google.*/#hl=* |
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
wget "https://bootstrap.pypa.io/get-pip.py" | |
python get-pip.py | |
sudo apt-get build-dep -y python-lxml (#该步骤会下载一百多M的依赖包安装) | |
pip install pyquery | |
亦或者直接安装python-lxml包 | |
如果你不需要将pyquery安装到虚拟环境中,那么直接安装python-pyquery包是最简单的~~~ | |
用上面的办法实在是因为各种测试网上类似的 | |
sudo apt-get install libxml2-dev libxslt1-dev python-dev zlib1g-dev #诸如此类不给力才有此下策 |
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 | |
# coding:utf-8 | |
import logging | |
import requests | |
import json | |
_session = requests.Session() | |
# APT KEY |
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 functools import partial | |
import math | |
remove = lambda x, comp: not (x > comp and not x % comp) | |
def primerlist(n): | |
assert isinstance(n, int) | |
assert n >= 4 | |
arr = range(2, n + 1) |
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 | |
# -*- coding: utf-8 -*- | |
# Author: Ficapy | |
# Create: '15/5/7' | |
#没人比我更蛋疼了吧 | |
a = [1,2,3,2] | |
from itertools import permutations | |
llist = len(a) | |
x = [((n+1)/(llist-1) if not (n+1)%(llist-1) else (n+1)/(llist-1)+1,n+1) for n,i in enumerate(permutations(a,2)) if i[0]==i[1]] |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer