Skip to content

Instantly share code, notes, and snippets.

View tawateer's full-sized avatar
Focusing

wateer tawateer

Focusing
  • Tencent
  • Beijing
View GitHub Profile
@tawateer
tawateer / ip.py
Last active February 19, 2019 07:30
根据网段和掩码查询起始和结束 IP
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from IPy import IP
file_path = "/Users/wateer/Downloads/1"
"""
file content like this:
183.232.67.128 255.255.255.240
183.232.76.98 255.255.255.248
@tawateer
tawateer / ip_laiyuan.py
Created March 21, 2019 11:02
写 excel 相关操作
#!/bin/env python
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from IPy import IP
import xlwt
@tawateer
tawateer / README.md
Last active March 26, 2019 04:24
根据网段和掩码计算起始 IP 和终止 IP

下载 ip.py 到本机, 执行 python ip.py 网段 掩码

> python ip.py 111.10.40.128 255.255.255.192

 111.10.40.128 111.10.40.191

输出即是起始和终止 IP。

@tawateer
tawateer / publisher.go
Created August 11, 2019 08:17
simple pubsub code
package pubsub // import "github.com/docker/docker/pkg/pubsub"
import (
"sync"
"time"
)
var wgPool = sync.Pool{New: func() interface{} { return new(sync.WaitGroup) }}
// NewPublisher creates a new pub/sub publisher to broadcast messages.
@tawateer
tawateer / multi_thread.py
Last active September 23, 2019 10:57
python multi thread example
#!/bin/env python
# -*- coding:utf-8 -*-
import threading
sem = threading.Semaphore(10)
result = []