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
| def _key_fn(x): | |
| return x.first() | |
| def main2(): | |
| names = golf_name_list(argv[1]) | |
| sorted_names = sorted(names, key = _key_fn) | |
| for n in sorted_names: | |
| print n.first(), n.last() |
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
| def austin_name_list(file_name): | |
| with open(file_name) as f: | |
| names = [] | |
| for line in f.readlines(): | |
| first, last = line.split(" ") | |
| names.append(Name(first, last)) | |
| return names | |
| def golf_name_list(file_name): |
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
| def search_list(ls, target): | |
| found_target = False | |
| for i in range(0, len(ls)): | |
| if ls[i] == target: | |
| found_target = True | |
| return found_target |
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
| def find_min_and_max(values): | |
| max_val = 0 | |
| min_val = 0 | |
| i = 0 | |
| while i < len(values): | |
| c = values[i] | |
| if c == '-': | |
| val = int(values[i:i+2]) | |
| i += 2 |
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
| typedef unsigned __int128 TaggedPointer; | |
| #define TP_GET_PTR(ptr) ((Node *)((ptr) >> 64)) | |
| #define TP_GET_VERSION(ptr) ((uint64_t)(ptr)) | |
| TaggedPointer pack_tagged_pointer(void *ptr, uint64_t version) { | |
| printf("args of %p, %lu\n", ptr, version); | |
| unsigned __int128 result = (intptr_t)ptr; | |
| result = result << 64; |
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
| # server | |
| import zmq | |
| zmq_context = zmq.Context() | |
| pub_socket = zmq_context.socket(zmq.PUB) | |
| pub_socket.connect(subpub.SUB_ADDR) | |
| while True: | |
| pub_socket.send_multipart((str(topic), str(flask.request.data))) |
NewerOlder