#参考资料
###下载单个文件,默认将输出打印到标准输出中(STDOUT)中
curl http://www.centos.org
func generateToken() string { | |
var length int = 25 | |
var seed []string = strings.Split("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "") | |
var token string = "" | |
for i := 0; i < length; i++ { | |
rand.Seed(time.Now().UTC().UnixNano()) | |
index := rand.Intn(length - 1 + 10) | |
token = token + seed[index] | |
} | |
return token |
# python2 | |
import os | |
import string | |
charset = string.ascii_uppercase + string.digits | |
random_bytes = os.urandom(25) | |
len_charset = len(charset) | |
indices = [int(len_charset * (ord(byte) / 256.0)) for byte in random_bytes] | |
defaultToken = "".join([charset[index] for index in indices]) |
// go to page below and run code | |
// https://www.zhihu.com/question/following | |
function unfollow_all(){ | |
var remaining = $(".zg-unfollow").length; | |
if (remaining > 0) { | |
$(".zg-unfollow").first().trigger('click'); | |
window.scrollBy(0,100); | |
setTimeout(unfollow_all, Math.random(0, 1).toFixed(2)*1000 + 500); | |
} | |
} |
#!/usr/bin/python | |
import requests | |
from bs4 import BeautifulSoup | |
url = 'http://jandan.net/ooxx/page-' | |
page = 1963 | |
for i in range(30): | |
res = requests.get(url + str(page)) | |
html = BeautifulSoup(res.text, 'lxml') | |
for index, each in enumerate(html.select('#comments img')): |
# -*- coding: utf-8 -*- | |
list = [{ | |
'name': 'a', | |
'id': 1, | |
'pid': 0 | |
}, { | |
'name': 'b', | |
'id': 2, | |
'pid': 1 |
# -*- coding: utf-8 -*- | |
import time | |
import random | |
list1 = [3, 7, 8, 9, 12, 111] | |
list2 = [5, 6, 10, 13, 25, 30] | |
list3 = range(10000) | |
random.shuffle(list3) |
function autoTextarea (elem, extra, maxHeight) { | |
extra = extra || 0 | |
var addEvent = function (type, callback) { | |
elem.addEventListener ? elem.addEventListener(type, callback, false) : elem.attachEvent('on' + type, callback) | |
} | |
var getStyle = elem.currentStyle ? function (name) { | |
var val = elem.currentStyle[name] | |
if (name === 'height' && val.search(/px/i) !== 1) { | |
var rect = elem.getBoundingClientRect() | |
return rect.bottom - rect.top - parseFloat(getStyle('paddingTop')) - parseFloat(getStyle('paddingBottom')) + 'px' |
function toChineseNum (index) { | |
let str = '' + index | |
if (index > 99) return '一百' | |
if (index < 10) { | |
return str.replace(/1/g, '一') | |
.replace(/2/g, '二') | |
.replace(/3/g, '三') | |
.replace(/4/g, '四') | |
.replace(/5/g, '五') | |
.replace(/6/g, '六') |
# This configuration file binds many vi- and vim-like bindings to the | |
# appropriate tmux key bindings. Note that for many key bindings there is no | |
# tmux analogue. This is intended for tmux 1.3, which handles pane selection | |
# differently from the previous versions | |
# split windows like vim | |
# vim's definition of a horizontal/vertical split is reversed from tmux's | |
bind s split-window -v | |
bind v split-window -h |
#参考资料
###下载单个文件,默认将输出打印到标准输出中(STDOUT)中
curl http://www.centos.org