Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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 / Proxy image with nginx
Last active August 14, 2022 05:24
Proxy image with nginx
server {
listen 80;
server_name domain.com;
merge_slashes off;
location ~ /(?<r>http://.*) {
resolver 8.8.4.4 8.8.8.8 4.2.2.2 valid=3600s ipv6=off;
proxy_set_header Referer "";
proxy_pass $r;
@chenset
chenset / ledsoff.sh
Created February 13, 2019 13:52
Stealth Mode (disable all LEDs)
#!/bin/sh
nvram set led_disable=1
nvram commit
service restart_leds
# Source https://www.linksysinfo.org/index.php?threads/stealth-mode-timer-function-rt-n66.54449/
@chenset
chenset / redis memory usage per key.sh
Last active March 27, 2019 03:37
redis memory usage per key
#!/usr/bin/env bash
redis_cmd='redis-cli -n 1'
# size of db
ssss=0
# get keys and sizes
for k in `$redis_cmd keys "*"`; do
key_size_bytes=`$redis_cmd memory usage $k`;
//socks5
//设置
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
//取消
git config --global --unset http.proxy socks5://127.0.0.1:1080
git config --global --unset https.proxy socks5://127.0.0.1:1080
我本想享受生活,结果发现活下来都很困难。
你的计划,就像零食,吃到肚子里之后就是个屁。
我已经不是那个花五十块钱,也要考虑很久的小孩了,现在五块钱都要深思熟虑。
今天天气很好,在房间里宅久了,准备去客厅散散心。
春节你要小心了,毕竟过年,都是要杀猪的。
经过多年的打拼,虽然没有什么收获,但你有债呀!
人为什么叫人类,因为人活着就是累。
说错话不要紧,你还会继续说错的。
你倒下了,能顶替你的人千千万
你获得了很多金钱,但同时也失去了很多东西,比如烦恼。