Skip to content

Instantly share code, notes, and snippets.

@hiupo
hiupo / bankList.php
Created January 24, 2016 14:03
根据卡号知道银行卡基本信息。
<?php
$bankList = [
'621098' => '邮储银行-绿卡通-借记卡',
'622150' => '邮储银行-绿卡银联标准卡-借记卡',
'622151' => '邮储银行-绿卡银联标准卡-借记卡',
'622181' => '邮储银行-绿卡专用卡-借记卡',
'622188' => '邮储银行-绿卡银联标准卡-借记卡',
'955100' => '邮储银行-绿卡(银联卡)-借记卡',
'621095' => '邮储银行-绿卡VIP卡-借记卡',
'620062' => '邮储银行-银联标准卡-借记卡',
#
## aria2 config
#
# man page = http://aria2.sourceforge.net/manual/en/html/aria2c.html
# file path = $HOME/.aria2/aria2.conf
# Download Directory: specify the directory all files will be downloaded to.
# When this directive is commented out, aria2 will download the files to the
# current directory where you execute the aria2 binary.
#dir=/some/download/
@evantoli
evantoli / GitConfigHttpProxy.md
Last active May 6, 2025 06:33
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@jtbandes
jtbandes / decode-dyn-uti.swift
Last active March 11, 2025 10:13
Dynamic UTI decoding
/// Decodes a dynamically-generated Uniform Type Identifier for inspection purposes. (**NOT FOR PRODUCTION USE!**)
/// Many, many thanks to http://alastairs-place.net/blog/2012/06/06/utis-are-better-than-you-think-and-heres-why/
///
/// <https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-BCGCDHIJ>
func decodeDynUTI(_ uti: String) -> String?
{
let vec = Array("abcdefghkmnpqrstuvwxyz0123456789")
let encoded = Array(uti).suffix(from: 5)
var result: [UInt8] = []
@gaoyifan
gaoyifan / google-fonts-proxy
Last active January 9, 2025 12:20
google-fonts-proxy
server {
listen 80;
listen 443;
listen [::]:80;
listen [::]:443;
server_name fonts.lug.ustc.edu.cn;
access_log /var/log/nginx/revproxy_access.log;
error_log /var/log/nginx/revproxy_error.log;
#!/usr/bin/sudo sh
## ruby_revealer.sh -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+.
## From `strings ruby_concealer.so`:
##
## > This obfuscation is intended to discourage GitHub Enterprise customers
## > from making modifications to the VM.
##
## Well, good, as long as its not intended to discourage *me* from doing this!
// g++ aa.cpp -o aa.exe -std=c++14
#include <cstdio>
#include <functional>
#include <tuple>
using namespace std;
template<int n, class Iso, class TRet, class... TArgs>
struct _bindArgs;
@fasterthanlime
fasterthanlime / trace.js
Created December 23, 2014 14:57
Pretty stack trace support for Duktape/ooc with TypeScript & sourcemaps
function lpad(input, len) {
var s = "" + input;
while (s.length < len) {
s = " " + s;
}
return s;
}
function rpad(input, len) {
@klzgrad
klzgrad / Naive-VPN.md
Created November 17, 2014 00:43
朴素VPN:一个纯内核级静态隧道

朴素VPN:一个纯内核级静态隧道

由于路由管控系统的建立,实时动态黑洞路由已成为最有效的封锁手段,TCP连接重置和DNS污染成为次要手段,利用漏洞的穿墙方法已不再具有普遍意义。对此应对方法是多样化协议的VPN来抵抗识别。这里介绍一种太简单、有时很朴素的“穷人VPN”。

朴素VPN只需要一次内核配置(Linux内核),即可永久稳定运行,不需要任何用户态守护进程。所有流量转换和加密全部由内核完成,原生性能,开销几乎没有。静态配置,避免动态握手和参数协商产生指纹特征导致被识别。并且支持NAT,移动的内网用户可以使用此方法。支持广泛,基于L2TPv3标准,Linux内核3.2+都有支持,其他操作系统原则上也能支持。但有两个局限:需要root权限;一个隧道只支持一个用户。

朴素VPN利用UDP封装的静态L2TP隧道实现VPN,内核XFRM实现静态IPsec。实际上IP-in-IP隧道即可实现VPN,但是这种协议无法穿越NAT,因此必须利用UDP封装。内核3.18将支持Foo-over-UDP,在UDP里面直接封装IP,与静态的L2TP-over-UDP很类似。

创建一个朴素VPN