Skip to content

Instantly share code, notes, and snippets.

View wuyanxin's full-sized avatar
🎯
Focusing

吴彦欣 wuyanxin

🎯
Focusing
View GitHub Profile
@wuyanxin
wuyanxin / ipmatcher.go
Created July 8, 2021 09:10
ip match in golang
type IPMatcher struct {
IP net.IP
SubNet *net.IPNet
}
type IPMatchers []*IPMatcher
func NewIPMatcher(ipStr string) (*IPMatcher, error) {
ip, subNet, err := net.ParseCIDR(ipStr)
if err != nil {
@wuyanxin
wuyanxin / color-conversion-algorithms.js
Created October 22, 2018 07:35 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@wuyanxin
wuyanxin / app.js
Last active December 4, 2016 06:23
A mini http-like server
const Server = require('./ihttp').Server;
const app = new Server().listen(3000);