I hereby claim:
- I am vpatov on github.
- I am vpatov (https://keybase.io/vpatov) on keybase.
- I have a public key ASBtAzLjj7dqiI5vudKuVQJQUIHPbAuHDGOMme-e2E3bSwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| import threading | |
| def accept_connections: | |
| while(True): | |
| connection = server_socket.accept()[0].makefile('wb') | |
| camera.start_recording(connection, format='h264', splitter_port=2, | |
| resize=(640,360)) | |
| try: | |
| camera.wait_recording(7*60*60) #assuming this records for 7 hours? | |
| except: | 
| grids = [] | |
| with open('input_7.txt','r') as f: | |
| while(True): | |
| grid = [] | |
| line = f.readline() | |
| if (len(line) < 1): | |
| break | |
| width,height = (int(i) for i in line.split()) | |
| for row in range(height): | |
| line = f.readline().strip() | 
| with open('input_6.txt','r') as f: | |
| documents = f.read().split('-----') | |
| documents = [doc.split() for doc in documents] | |
| print(documents) | 
| import json | |
| with open('input_4.json','r') as f: | |
| tree = json.load(f) | |
| print(tree) | 
| """ | |
| If you want to use a dictionary | |
| """ | |
| galaxies = {} | |
| with open('input_3.txt','r') as f: | |
| for line in f: | |
| parts = map(str.strip,line.split(',')) | |
| name,x,y,benefit = parts | |
| galaxies[name] = {"x":int(x), "y":int(y), "benefit": int(benefit)} | |
| with open('input_1.txt','r') as f: | |
| data = f.read() | |
| print(data) | 
| """ | |
| If you want to use a dictionary | |
| """ | |
| galaxies = {} | |
| for line in open('problem1_input.txt','r'): | |
| parts = map(str.strip,line.split(',')) | |
| name,x,y,benefit = parts | |
| galaxies[name] = {"x":int(x), "y":int(y), "benefit": int(benefit)} | |
| """ | 
| """ | |
| Each grid is a 2d-matrix. | |
| Each cell is either '-' or '#'. | |
| """ | |
| grids = [] | |
| f = open('problem3_input.txt','r') | |
| while(True): | |
| grid = [] | |
| line = f.readline() | |
| if (len(line) < 1): | 
| connections = { | |
| 'r1':['h1','r2','r3'], | |
| 'r4':['h2','r2','r3'] | |
| } | |
| for name_a in names: | |
| if name_a in connections: | |
| for name_b in connections[name_a]: | |
| self.addLink(quaggaContainers[name_a],quaggaContainers[name_b]) |