Skip to content

Instantly share code, notes, and snippets.

View update_nginx_conf.sh
# https://gist.github.com/mangege/15a461896df109d16f12d2a815507061
curl https://www.cloudflare.com/ips-v4 | awk '{print "allow " $1 ";"}' > /tmp/a.txt
curl https://www.cloudflare.com/ips-v6 | awk '{print "allow " $1 ";"}' >> /tmp/a.txt
cp /tmp/a.txt /etc/nginx/cloudflare-allow.conf
cat /etc/nginx/cloudflare-allow.conf
@mangege
mangege / k3.config
Created Nov 12, 2017
k3 lede config, diff 用
View k3.config
#
# Automatically generated file; DO NOT EDIT.
# LEDE Configuration
#
CONFIG_MODULES=y
CONFIG_HAVE_DOT_CONFIG=y
# CONFIG_TARGET_arm64 is not set
# CONFIG_TARGET_sunxi is not set
# CONFIG_TARGET_apm821xx is not set
# CONFIG_TARGET_ath25 is not set
@mangege
mangege / bs.js
Created Feb 9, 2017
百度网盘转存. 每次选中50个文件,自动手动点保存后再运行选择下50个文件.
View bs.js
var chkLen = jQuery('.module-list .list-view-item.item-active').length;
var startPosition = -1;
if (chkLen > -1) {
startPosition = Number(jQuery('.module-list .list-view-item.item-active:last').attr('_position'));
}
jQuery('.module-list .list-view-item.item-active .checkbox').click()
@mangege
mangege / check_unicom_cache.rb
Last active Aug 8, 2017
检查有效的联通缓存服务器ip
View check_unicom_cache.rb
require 'uri'
require 'net/http'
require 'timeout'
def check_server(ip)
uri = URI('http://ip.mangege.com/')
Timeout::timeout(3) do
Net::HTTP.start(ip, 80) do |http|
request = Net::HTTP::Get.new uri
View auth_token_util.rb
require 'net/http'
require 'json'
# 此类只是检测 token 是否有效
# 如果前端有传 user_id 和 email 过来,其值还需与接口返回的值对比
class AuthTokenUtil
class << self
=begin
@mangege
mangege / pdfkey.ahk
Last active Dec 5, 2015
windows 平板点击按屏翻页小工具,需要安装autohotkey(或自己编译成exe运行),阅读软件必须是 Adobe reader 桌面版.
View pdfkey.ahk
EnableMap := false
#IfWinActive ahk_class AcrobatSDIWindow
$LButton::
if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 200)
{
if (EnableMap){
EnableMap := false
ToolTip Disable success
} else {
You can’t perform that action at this time.