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 os | |
| port = input('port: ') | |
| s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| s.connect(("8.8.8.8", 80)) | |
| ip = s.getsockname()[0] | |
| s.close() | |
| print(ip+':'+port) | |
| os.system('python -m http.server --bind '+ip+' '+port) |
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
| # Look at end for details | |
| class Tree: | |
| def __init__(self,data,left,right): | |
| self.data = data | |
| self.left = left | |
| self.right = right | |
| def traverse1(self,*f): #In Order | |
| out = [] | |
| #out = '' | |
| if self.left != -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
| """ | |
| https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm | |
| USAGE: | |
| use this file like a module (aka. create an init.py file at the directory you want to use it at and "import Dijkstra" in your code) | |
| to create a node/ or a point: | |
| variable = Dijkstra.Node('variableName', {'otherVariableName': distance,...} | |
| and to create a graph/ table of nodes/ points: | |
| tableOfPoints = Dijkstra.Graph([variable1, variable2, variable3, variable4]) |