This file contains hidden or 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 characters
| import socket | |
| import fcntl | |
| import struct | |
| def getHwAddr(ifname): | |
| s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15])) | |
| return ''.join(['%02x:' % ord(char) for char in info[18:24]])[:-1] |
This file contains hidden or 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 characters
| #!/usr/bin/python | |
| # sudo lpadmin -p printer-name-here -E -v socket://localhost:12000 -m raw | |
| import socket | |
| fpsock = socket.socket() | |
| fpsock.bind(('127.0.0.1', 12000)) | |
| fpsock.listen(5) |
This file contains hidden or 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 characters
| #!/usr/bin/env python | |
| """ | |
| Very simple HTTP server in python (Updated for Python 3.7) | |
| Usage: | |
| ./dummy-web-server.py -h | |
| ./dummy-web-server.py -l localhost -p 8000 | |
| Send a GET request: |
NewerOlder