diff --git a/scripting/CyanLightSparkling.py b/scripting/CyanLightSparkling.py new file mode 100755 index 0000000000000000000000000000000000000000..8e5687099bcd572d59b8de28cc429490f09edb45 --- /dev/null +++ b/scripting/CyanLightSparkling.py @@ -0,0 +1,44 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python -p python3 --pure + +import sys +import time +import random +from socket import * + + +if len(sys.argv) > 1: + hosts = sys.argv[1:] +else: + hosts = ['ringclockDOTmake', 'ringclockDOThack', 'ringclockDOTelab'] + +port = 4213 + +pixels = 24 + + +s = socket(AF_INET, SOCK_DGRAM) + + +def cyan(): + r = random.randint(0, 32) + g = random.randint(64, 255) + + return [r, g, int(g/6), 0] + + +while True: + + data = [1] + + for _ in range(pixels): + data += cyan() + + data = bytearray(b'fxbuffer') + bytearray(data) + for host in hosts: + try: + s.sendto(data, (host, port)) + except: + pass + time.sleep(0.1) +