Skip to content

Instantly share code, notes, and snippets.

View ufosaga's full-sized avatar

Thomas Wang ufosaga

  • Shanghai, China
View GitHub Profile
@ufosaga
ufosaga / ss-redir 透明代理.md
Created March 20, 2020 08:55 — forked from wen-long/ss-redir 透明代理.md
ss-redir 透明代理.md

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* Answer to http://codereview.stackexchange.com/questions/67804
*
* Builds all combinations of the given elements.
*/
@ufosaga
ufosaga / gist:4957fa7d64bc116119961950d4c8d380
Created September 14, 2021 09:26 — forked from nickrussler/gist:7527851
Convert Date String to/from ISO 8601 respecting UTC in Java
public static String toISO8601UTC(Date date) {
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
df.setTimeZone(tz);
return df.format(date);
}
public static Date fromISO8601UTC(String dateStr) {
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");