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
| +44 20 7123 4567 |
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 subprocess | |
| from decimal import Decimal | |
| class DockerStatsParser(): | |
| def __init__(self): | |
| self.max_memory = 0 |
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 os | |
| import time | |
| def get_total_bytes(interfaces): | |
| rx_bytes = 0 | |
| tx_bytes = 0 | |
| for interface in interfaces: | |
| with open('/sys/class/net/{}/statistics/rx_bytes'.format(interface)) as f: | |
| rx_bytes += int(f.read()) |
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 os | |
| import time | |
| def get_total_bytes(interfaces): | |
| rx_bytes = 0 | |
| tx_bytes = 0 | |
| for interface in interfaces: | |
| with open('/sys/class/net/{}/statistics/rx_bytes'.format(interface)) as f: | |
| rx_bytes += int(f.read()) |
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
| version: "3.3" | |
| services: | |
| mm: | |
| image: misi/mm:v3.2 | |
| working_dir: /opt/multiparty-meeting/server | |
| entrypoint: ./mm_entrypoint.sh | |
| restart: unless-stopped | |
| image: misi/mm:latest | |
| environment: |
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
| for noun in range(99): | |
| for verb in range(99): | |
| with open('2_input.txt', 'r') as f: | |
| input_program = [int(x) for x in f.read().strip().split(',')] | |
| input_program[1] = noun | |
| input_program[2] = verb | |
| def execute_intcode(input_program): | |
| program_counter = 0 | |
| while program_counter < len(input_program) and input_program[program_counter] != 99: | |
| #print(program_counter, input_program[program_counter]) |
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
| with open('2_input.txt', 'r') as f: | |
| input_program = [int(x) for x in f.read().strip().split(',')] | |
| input_program[1] = 12 | |
| input_program[2] = 2 | |
| def execute_intcode(input_program): | |
| program_counter = 0 | |
| while program_counter < len(input_program) and input_program[program_counter] != 99: | |
| #print(program_counter, input_program[program_counter]) | |
| opcode = input_program[program_counter] | |
| input1_address = input_program[program_counter + 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
| with open('1_input.txt', 'r') as f: | |
| input_data = f.readlines() | |
| def fuel_requirement(mass): | |
| fuel_needed = (mass / 3) - 2 | |
| if fuel_needed > 0: | |
| return fuel_needed + fuel_requirement(fuel_needed) | |
| else: | |
| return 0 | |
| print(fuel_requirement(14)) | |
| print(fuel_requirement(1969)) |
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
| with open('1_input.txt', 'r') as f: | |
| input_data = f.readlines() | |
| def fuel_requirement(mass): | |
| fuel_needed = (mass / 3) - 2 | |
| while fuel_needed > 0: | |
| fuel_needed += (fuel_needed / 3) - 2 | |
| print(fuel_requirement(14)) | |
| print(fuel_requirement(1969)) | |
| print(fuel_requirement(100756)) | |
| fuel_sum = 0 |
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
| [Interface] | |
| Address = 10.8.0.1/24 | |
| PrivateKey = XXXXXXXXXX | |
| PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | |
| PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE | |
| ListenPort = 51821 | |
| [Peer] | |
| PublicKey = XXXXXXXXXX | |
| AllowedIPs = 10.8.0.2/24 |
NewerOlder