Skip to content

Instantly share code, notes, and snippets.

# 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 November 12, 2017 13:04
k3 lede config, diff 用
#
# 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 February 9, 2017 08:09
百度网盘转存. 每次选中50个文件,自动手动点保存后再运行选择下50个文件.
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 August 8, 2017 17:32
检查有效的联通缓存服务器ip
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
require 'net/http'
require 'json'
# 此类只是检测 token 是否有效
# 如果前端有传 user_id 和 email 过来,其值还需与接口返回的值对比
class AuthTokenUtil
class << self
=begin
@mangege
mangege / pdfkey.ahk
Last active December 5, 2015 12:06
windows 平板点击按屏翻页小工具,需要安装autohotkey(或自己编译成exe运行),阅读软件必须是 Adobe reader 桌面版.
EnableMap := false
#IfWinActive ahk_class AcrobatSDIWindow
$LButton::
if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 200)
{
if (EnableMap){
EnableMap := false
ToolTip Disable success
} else {