Skip to content

Instantly share code, notes, and snippets.

View zhaomengit's full-sized avatar

Roronoa Zoro zhaomengit

View GitHub Profile
// makeThumbnails6 makes thumbnails for each file received from the channel.
// It returns the number of bytes occupied by the files it creates.
func makeThumbnails6(filenames <-chan string) int64 {
sizes := make(chan int64)
var wg sync.WaitGroup // number of working goroutines
for f := range filenames {
wg.Add(1)
// worker
go func(f string) {
defer wg.Done()
@zhaomengit
zhaomengit / PNPoly.py
Created April 2, 2020 17:09
PNPoly算法
def point_in_polygon(x, y, verts):
"""
- PNPoly算法
- xyverts [(x1, y1), (x2, y2), (x3, y3), ...]
"""
try:
x, y = float(x), float(y)
except:
return False
vertx = [xyvert[0] for xyvert in verts]