Skip to content

Instantly share code, notes, and snippets.

View MuxinLee's full-sized avatar
🎯
Focusing

Patrick MuxinLee

🎯
Focusing
  • Chengdu
View GitHub Profile
@MuxinLee
MuxinLee / SurfboardProxy.conf
Last active May 25, 2020 07:19
Surge2 Proxy for Android
[General]
loglevel = notify
interface = 127.0.0.1
skip-proxy = localhost, *.local, 0.0.0.0/8, 10.0.0.0/8, 17.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.168.0.0/16, 192.88.99.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 224.0.0.0/4, 240.0.0.0/4, 255.255.255.255/32
ipv6 = false
dns-server = 1.2.4.8, 114.114.114.114, 223.5.5.5, 8.8.8.8, system
exclude-simple-hostnames = true
enhanced-mode-by-rule = true
# Surfboard 的服务器和策略组配置方式与 Surge 类似, 可以参考 Surge 的规则配置手册: https://manual.nssurge.com/
@MuxinLee
MuxinLee / ShadowPro.conf
Last active June 18, 2024 14:12
Shadowrocket 🚀小火箭配置文件更新
[General]
# ShadowRocket 现已支持 DoH / DoT
# 您可以根据需求自行决定选用 DNS 服务器的种类和组合方式,例如:混用服务器来实现最佳解析速度;单独 DoH 使用来达到最佳安全性和最低污染度。
dns-server = https://doh.pub/dns-query, https://dns.alidns.com/dns-query
bypass-tun = 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.168.0.0/16, 192.88.99.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 224.0.0.0/4, 255.255.255.255/32, 0.0.0.0/31, ::ffff:0.0.0.0/31
skip-proxy = localhost, *.local, injections.adguard.org, local.adguard.org, captive.apple.com, guzzoni.apple.com, 0.0.0.0/8, 10.0.0.0/8, 17.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.168.0.0/16, 192.88.99.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 224.0.0.0/4, 240.0.0.0/4, 255.255.255.255/32
bypass-system = true
ipv6 = true
update-url = https://git.io/JfV0x
[Rule]
@MuxinLee
MuxinLee / responsive-pure-css-masonry-layout-column-count.html
Last active April 14, 2020 14:26
Responsive Pure CSS Masonry Layout - Column Count
<div class="masonry">
<div class="item">
<div class="item__content">
</div>
</div>
<div class="item">
<div class="item__content item__content--small">
</div>
</div>
<div class="item">
@MuxinLee
MuxinLee / Simple canvas-based color converter.md
Last active February 2, 2023 02:07
Simple canvas-based color converter

Simple canvas-based color converter

To answer this StackOverflow question I wrote this — a small solution based on a never-rendered element. It fills a 1-pixel canvas with the provided fill-style, and then reads the RGBA values of that pixel. It will work with any CSS color -- name, rgba(), hex, or even something more exotic like a gradient or pattern. Invalid colors are always returned as transparent black. Transparent colors are treated as painted on a newly-cleared canvas.

It's been tested in modern-ish versions of IE, Chrome, Safari, and Firefox. The API is:

color_convert.to_hex(color)   # Converts color to a hex-based RGB triple; to_hex('red') returns '#ff0000'
color_convert.to_rgba(color)  # Converts color to an rgba() string; to_rgba('red') returns 'rgba(255,0,0,1)'
And you'll probably never want it, but you can also