This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| go func() { | |
| // in for-select using ok to exit goroutine | |
| for { | |
| select { | |
| case x, ok := <-in1: | |
| if !ok { | |
| in1 = nil | |
| } | |
| // Process | |
| case y, ok := <-in2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func ip2int(ip net.IP) uint32 { | |
| if len(ip) == 16 { | |
| panic("no sane way to convert ipv6 into uint32") | |
| } | |
| return binary.BigEndian.Uint32(ip) | |
| } | |
| func int2ip(nn uint32) net.IP { | |
| ip := make(net.IP, 4) | |
| binary.BigEndian.PutUint32(ip, nn) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import threading | |
| import time | |
| import multiprocessing | |
| lock = threading.Lock() | |
| def thread_target(): | |
| lock.acquire() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| . | |
| ├── deploy.py | |
| ├── project | |
| │ ├── application.py | |
| │ ├── apps | |
| │ │ ├── articles | |
| │ │ │ ├── forms.py | |
| │ │ │ ├── __init__.py | |
| │ │ │ ├── models.py | |
| │ │ │ └── views.py |