Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import json
- import requests
- morse = {
- '..-.': 'F', '-..-': 'X', '.--.': 'P', '-': 'T', '..---': '2',
- '....-': '4', '-----': '0', '--...': '7', '...-': 'V', '-.-.': 'C',
- '.': 'E', '.---': 'J', '---': 'O', '-.-': 'K', '----.': '9', '..': 'I',
- '.-..': 'L', '.....': '5', '...--': '3', '-.--': 'Y', '-....': '6',
- '.--': 'W', '....': 'H', '-.': 'N', '.-.': 'R', '-...': 'B', '---..': '8',
- '--..': 'Z', '-..': 'D', '--.-': 'Q', '--.': 'G', '--': 'M', '..-': 'U',
- '.-': 'A', '...': 'S', '.----': '1'
- }
- fname = 'd1_uniq_ip4.json'
- try:
- j = json.loads(open(fname).read())
- except:
- j = requests.get('https://usher2.club/'+fname).json()
- json.dump(j, open(fname, 'w'))
- s, b, t0 = '', False, 0
- for pt in j:
- t, h = pt['x'], pt['y']
- a = h > 50000
- if b != a:
- dt = t - t0
- t0 = t
- if not b and dt > 1300 and s:
- s += ' '
- elif b and dt > 1300:
- s += '-'
- elif b and dt > 300:
- s += '.'
- b = a
- print(s)
- print(''.join([morse.get(str(x), ' ') for x in s.split(' ')]))
- # -.. .. --. .. - .- .-.. .-. . ... .. ... - .- -. -.-. .
- # DIGITALRESISTANCE
- # d1_uniq_ip4.json: https://pastebin.com/3MBSRsxq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement