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))) |
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
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
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 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 _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
/** | |
* This file provided by Facebook is for non-commercial testing and evaluation purposes only. | |
* Facebook reserves all rights not expressly granted. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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 requests | |
import shutil | |
def main(): | |
url_base = "http://wow.zamimg.com/images/hearthstone/cards/enus/animated/{}_premium.gif" | |
card_id = "EX1_067" | |
file_name = "data/card_images/{}.gif".format(card_id) | |
res = requests.get(url_base.format(card_id), stream=True) |
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
[Power] GameState.DebugPrintPower() - ACTION_START Entity=[id=55 cardId= type=INVALID zone=HAND zonePos=1 player=2] SubType=PLAY Index=0 Target=0 | |
[Power] GameState.DebugPrintPower() - TAG_CHANGE Entity=Ryan Higdon tag=TEMP_RESOURCES value=0 | |
[Power] GameState.DebugPrintPower() - TAG_CHANGE Entity=Ryan Higdon tag=RESOURCES_USED value=1 | |
[Power] GameState.DebugPrintPower() - TAG_CHANGE Entity=Ryan Higdon tag=NUM_CARDS_PLAYED_THIS_TURN value=2 | |
[Power] GameState.DebugPrintPower() - TAG_CHANGE Entity=[id=51 cardId= type=INVALID zone=HAND zonePos=5 player=2] tag=ZONE_POSITION value=4 | |
[Power] GameState.DebugPrintPower() - TAG_CHANGE Entity=[id=63 cardId= type=INVALID zone=HAND zonePos=4 player=2] tag=ZONE_POSITION value=3 | |
[Power] GameState.DebugPrintPower() - TAG_CHANGE Entity=[id=53 cardId= type=INVALID zone=HAND zonePos=3 player=2] tag=ZONE_POSITION value=2 | |
[Power] GameState.DebugPrintPower() - TAG_CHANGE Entity=[id=43 cardId= type=INVALID zone=HAND zonePos=2 player=2] tag=ZONE_POSITION v |
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 params_to_dict(param_str): | |
splits = param_str.split(" ") | |
data = {} | |
prev_key = None | |
prev_val = None | |
for s in splits: | |
if "=" in s: | |
key, val = s.split("=") | |
if prev_key: |
OlderNewer