Skip to content

Instantly share code, notes, and snippets.

@chenset
chenset / hash_timer.php
Created July 30, 2017 02:27
各种hash摘要算法的性能比较
<?php
foreach (hash_algos() as $algo) {
$st = microtime();
for ($i = 0; $i < 100000; $i++) {
hash($algo, microtime() . $i);
}
$et = microtime();
list($ss, $si) = explode(' ', $st);
list($es, $ei) = explode(' ', $et);
$time[$algo] = $ei + $es - $si - $ss;
@chenset
chenset / LocationGenerator.php
Created July 15, 2017 06:17
生成有关联关系的地址信息
<?php
/**
* 地址信息来源 https://github.com/mumuy/data_location
* Class LocationGenerator
* @package App\Http\Controllers
*/
class LocationGenerator
{
public function run()
@chenset
chenset / go-http-request-with-socket5proxy.go
Last active December 20, 2018 07:50
go http request with socket5proxy
// Modify From https://play.golang.org/p/l0iLtkD1DV
package main
import (
"context"
"fmt"
"golang.org/x/net/proxy"
"io/ioutil"
"net"
"net/http"
@chenset
chenset / cancel_follow_all_for_weibo.js
Last active January 6, 2017 02:00
批量删除微博关注. 进入微博关注管理页, 在控制台执行该代码.
// location.href="http://weibo.com/p/1005051305971862/myfollow?ignoreg=1#place";
setInterval(function(){
document.querySelectorAll('a.btn_link')[0].click();
for (var docs = document.querySelectorAll('.member_li'), len = docs.length, i = 0; i < len; i++) {
docs[i].click();
}
setTimeout(function(){
try{
@chenset
chenset / sort.py
Last active September 5, 2015 09:06
python - 根据数组二维元素的指定值排序
arr = [
{'add_time':1},
{'add_time':2},
{'add_time':3},
{'add_time':4},
]
arr.sort(key=lambda x: x['add_time'])
print arr