Last active
November 2, 2020 22:05
Revisions
-
3v1n0 revised this gist
Feb 11, 2015 . 1 changed file with 35 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ #!/usr/bin/env python import socket import struct GOPRO_IP = '10.5.5.9' GOPRO_MAC = 'd4d9xxxxxxxx' # Your GoPro MAC address def wake_on_lan(macaddress): """ Switches on remote computers using WOL. """ # Check macaddress format and try to compensate. if len(macaddress) == 12: pass elif len(macaddress) == 12 + 5: sep = macaddress[2] macaddress = macaddress.replace(sep, '') else: raise ValueError('Incorrect MAC address format') # Pad the synchronization stream. data = ''.join(['FFFFFFFFFFFF', macaddress * 20]) send_data = '' # Split up the hex values and pack. for i in range(0, len(data), 2): send_data = ''.join([send_data, struct.pack('B', int(data[i: i + 2], 16))]) # Broadcast it to the LAN. sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) sock.sendto(send_data, (GOPRO_IP, 9)) if __name__ == '__main__': wake_on_lan(GOPRO_MAC) -
3v1n0 revised this gist
Feb 11, 2015 . 1 changed file with 24 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import socket import sys from time import sleep def get_command_msg(id): return "_GPHD_:%u:%u:%d:%1lf\n" % (0, 0, 2, 0) UDP_IP = "10.5.5.9" UDP_PORT = 8554 KEEP_ALIVE_PERIOD = 2500 KEEP_ALIVE_CMD = 2 MESSAGE = get_command_msg(KEEP_ALIVE_CMD) print("UDP target IP:", UDP_IP) print("UDP target port:", UDP_PORT) print("message:", MESSAGE) if sys.version_info.major >= 3: MESSAGE = bytes(MESSAGE, "utf-8") while True: sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.sendto(MESSAGE, (UDP_IP, UDP_PORT)) sleep(KEEP_ALIVE_PERIOD/1000) -
3v1n0 revised this gist
Feb 11, 2015 . 1 changed file with 5126 additions and 0 deletions.There are no files selected for viewing
-
3v1n0 created this gist
Feb 10, 2015 .There are no files selected for viewing