Reorganise gists folder

This commit is contained in:
TKE
2022-05-13 12:49:21 +02:00
parent 7e58a88410
commit da8d015af0
98 changed files with 63 additions and 20 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
import re
import sys
from urllib.parse import urlparse
pattern=re.compile(r'\d+\.\d+\.\d+\.\d+')
for line in sys.stdin:
line=line.strip()
if not line.lower().startswith('http'):
line="http://"+line
try:
p=urlparse(line)
if not pattern.search(p.netloc):
if ":" in p.netloc:
print(p.netloc.split(":")[0])
else:
print(p.netloc)
except Exception as e:
print(e)
pass