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 characters
#include <stdio.h> | |
void presto_changeo(char *msg, int *x) { | |
msg[0] = 'B'; | |
*x += 1; | |
} | |
int main() { | |
int x = 0; | |
char msg[] = "Test message"; |
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 characters
from copy import copy | |
import time | |
def find_list(in_list: list) -> type(None): | |
global good_lists | |
in_list = sorted(in_list) | |
if valid_list(in_list) and tuple(in_list) not in good_lists: | |
good_lists.add(tuple(in_list)) | |
if len(good_lists) % 100 == 0: |
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 characters
from itertools import combinations, permutations | |
import sys | |
import time | |
def validate_xmas(validate_list: list, preamble_len: int = 5) -> int: | |
""" | |
takes list, returns the first item that doesn't fit, otherwise returns -1 for a valid list | |
:param validate_list: | |
:param preamble_len: |
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 characters
from itertools import combinations | |
def validate_xmas(validate_list: list, preamble_len: int = 5) -> int: | |
""" | |
takes list, returns the first item that doesn't fit, otherwise returns -1 for a valid list | |
:param validate_list: | |
:param preamble_len: | |
:return: | |
""" |
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 characters
def run_instruction(line: str, score: int) -> tuple[int, int]: | |
global next_instruction | |
""" | |
reads instruction, returns tuple of score and next instruction relative to where it was. | |
:param line: | |
:return: | |
""" | |
inst, number = line.split() | |
number = int(number) | |
if inst == 'acc': |
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 characters
from collections import defaultdict | |
def group_score(group: str) -> int: | |
""" | |
return number of unique yes answers for a single group | |
:param group: | |
:return: | |
""" | |
answer_set = set() |
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 characters
import numpy as np | |
from typing import Tuple | |
def basic_decode(row_seat: str) -> Tuple[int, int]: | |
row = '0b' + row_seat[:7] | |
row = row.replace('F', '0').replace('B', '1') | |
row = int(row, 2) | |
seat = '0b' + row_seat[7:] | |
seat = seat.replace('L', '0').replace('R', '1') |
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 characters
from typing import Tuple | |
def check_collisions(r_move: int, d_move: int, hill: list[str], start: Tuple[int, int] = (0, 0)) -> int: | |
d_dist = len(hill) | |
r_dist = len(hill[0]) | |
d_pos, r_pos = start | |
trees_hit = 0 | |
while d_pos < d_dist: | |
if hill[d_pos][r_pos] == '#': |
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 characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: generic-prog | |
# Required-Start: $local_fs $remote_fs $network | |
# Required-Stop: $local_fs $remote_fs $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Generic Program | |
# Description: Generic Program is a generic program to do generic things with | |
### END INIT INFO |
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 characters
<?xml version="1.0"?> | |
<scenario name="aaron1"> | |
<pause milliseconds="1000"/> | |
<send retrans="500"> | |
<![CDATA[ | |
INVITE sip:[field0]@[remote_ip]:[remote_port] SIP/2.0 | |
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] | |
From: "sipp" <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] | |
To: <sip:[service]@[remote_ip]:[remote_port]> | |
Call-ID: [call_id] |