Skip to content

Instantly share code, notes, and snippets.

@hanayashiki
hanayashiki / socks5ping.py
Last active June 25, 2019 06:12
Ping a website with your sock5 proxy. Test your connectivity and speed.
# Usage:
#
# $socks5ping.py www.baidu.com
# Connected to www.baidu.com[:80]: seq=1 time=1.47s
# Connected to www.baidu.com[:80]: seq=2 time=1.27s
# Connected to www.baidu.com[:80]: seq=3 time=1.18s
# Connected to www.baidu.com[:80]: seq=4 time=1.15s
#
# $socks5ping.py -h
# usage: socks5ping.py [-h] [-s SOCKS5HOST] [-o SOCKS5PORT] [-p PORT]
import re
def normalize_text(t: str):
"""
:param t: English text
:return: Normalized text according to below:
# language-dependent part (assuming Western languages):
$norm_text = " $norm_text ";
$norm_text =~ tr/[A-Z]/[a-z]/ unless $preserve_case;