Skip to content

Instantly share code, notes, and snippets.

Avatar
🎣
fishing

Yingyu Cheng winguse

🎣
fishing
View GitHub Profile
View mac-vpn-routing.md

check current routing map

netstat -nr -f inet

find the route to target ip

route get HOSTNAME_OR_IP
View find_prime_phone_number.js
const isPrime = {};
const mark = (e, isPrime) => {
if (isPrime) {
e.style.textShadow = 'yellow 0px 0px 3px';
} else {
e.style.opacity = 0;
}
};
let queue = Promise.resolve();
const find = () => document.querySelectorAll('span,a,p').forEach(e => {
View long press on vscode.md

see: VSCodeVim/Vim#729

defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false

View add-click-to-show-in-wechat-article.js
const getMaskHtml = height =>
`<svg width="100%" height="${height}" xmlns="http://www.w3.org/2000/svg">
<rect width="100%" height="${height}" style="fill: rgb(254, 254, 254);">
<animate attributeName="opacity" begin="click" dur="6s" from="1" to="0" fill="freeze"></animate>
</rect>
</svg>`;
const setMask = content => {
if (content.indexOf('</svg>') > 0) {
View icloud_terms.txt
欢迎使用 iCloud(由云上贵州运营)
您在使用ICLOUD产品、软件、服务和网站(合称“本服务”)时受到您与云上贵州大数据产业发展有限公司(“云上贵州”)之间的本法律协议的管辖。APPLE DISTRIBUTION INTERNATIONAL或APPLE DISTRIBUTION INTERNATIONAL的继承人或受让人(“苹果公司”),可在云上贵州提供本服务时不时对云上贵州提供服务。在这种情况下,(I)苹果公司具有等同本协议附加一方的法定地位,惟须受本协议内所有条款和条件约束; 和(II)凡提及云上贵州之处,在苹果公司提供支持的范围内,应视为提及云上贵州和苹果公司,包括保修免责声明和责任限制。请您务必阅读并理解以下条款。点击“同意”即表示您同意:如果您选择访问或使用本服务,则将适用这些条款。
云上贵州是中国大陆境内本服务的提供商,通过本服务您可以使用某些互联网服务(包括将您的个人内容(如联系人、日历、照片、笔记、提醒、文件、应用程序数据和iCloud 电子邮件)存放在您的兼容装置和电脑上并供访问)和某些位置服务,但仅可按照本协议中所载的条款和条件使用。当您在装置上运行iOS 9或更高版本并在设置装置时以您的Apple ID登录,iCloud会自动启用,除非您正在升级装置并在先前选择不启用iCloud。您可以在设置(Settings) 禁用iCloud。iCloud一旦启用,您的内容将被自动发送给云上贵州并由云上贵州存储,之后您就可访问该等内容或以无线方式将内容推送至您的其他启用iCloud功能的装置或电脑。
I. 使用本服务的要求
A. 年龄。本服务仅供年满13岁(或相关司法管辖区的同等最低年龄限制)或以上之人士使用,若您未满13岁但您的Apple ID是经由批准的教育机构申请或作为父母或监护人设立家人共享(Family Sharing)功能其中一个部分而获得的,则您不受此限制。未经取得可以核证的父母同意,我们不会在知情的情况下,收集、使用或披露获取自13岁以下或相关司法管辖区的同等最低年龄限制的人士之个人资料。父母和监护人也应提醒未成年人在互联网上与陌生人交谈可能产生危险,并采取适当的预防措施保护儿童,包括监督其对本服务的使用。
如欲使用本服务,您不能是被中华人民共和国法律禁止取得本服务的人。接受本协议即表示您声明您理解并同意上述规定。
View decode_base64_in_html.js
function b64DecodeUnicode(str) {
return decodeURIComponent(Array.prototype.map.call(atob(str), function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
}).join(''))
}
var reg = /([A-Za-z0-9+\/=]{10,})/g;
document.querySelectorAll('p,span').forEach(e => {
var txt = e.innerHTML;
if (txt.indexOf('<') >= 0) return;
@winguse
winguse / anti_dns_spoofing.sh
Last active Apr 1, 2018
This is a script helps you anti dns spoofing in China. Currently GFW will return two wrong DNS packages in advance of correct one for blocked domain. And They don't share the same TTL in IP header which we can drop it base on this feature. This can also solve the problem when query the DNS via TCP (you will drop the RST from GFW but it looks the…
View anti_dns_spoofing.sh
#!/bin/sh
# This is a script helps you anti dns spoofing in China.
# Currently GFW will return two wrong DNS packages in advance of correct one for blocked domain.
# And They don't share the same TTL in IP header which we can drop it base on this feature.
# This can also adjust the problem when query the DNS via TCP:
# You will drop the RST from GFW but it looks the remote DNS will also receive RST,
# so there will be 50% chance still get blocked.
dns=$1
View auto_detect_blocked_websites.sh
#!/bin/bash
# opkg install bash conntrack curl ca-bundle
# conntrack -E -p tcp --dport 443 | ./this-script
SECONDS=0
declare -A last
declare -A current
View call_stack_nasting.js
function route(req, res) {
// ...
do_work(ctx)
// ...
}
function do_work(ctx) {
// ...
nested_call(ctx)
// ...
View monkey_patch_http_server.js
/* ------------ monkey patching ------------ */
const http = require('http')
const originalServerEmit = http.Server.prototype.emit;
http.Server.prototype.emit = function (event) {
if (event === 'request') {
// setup the context here as the root of the execution tree
setContext();
}
return originalServerEmit.apply(this, arguments)