- Avoid eating at convenience stores as much as possible. The food is good, but you can get similarly priced food that is much better at any restaurant you might walk into.
- Bring cash. Credit cards only became a thing about 6 years ago.
- Police officers have very little to do, so if you're lost, use them for directions.
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 hashlib | |
import json | |
from typing import Dict, Any | |
def hash_dict(data: Dict[str, Any]): | |
data_str = json.dumps(data, sort_keys=True, default=str) | |
md5 = hashlib.md5() | |
md5.update(data_str.encode("utf-8")) | |
hash_value = md5.hexdigest() | |
return hash_value |
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
# Instructions for setting up a virtualenv venv | |
######### | |
# SETUP # | |
######### | |
## Make sure you have python3 | |
python3 --version |
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
Host target-repo-name.github.com | |
HostName github.com | |
User git | |
IdentityFile /home/ec2-user/.ssh/target-repo-name | |
IdentitiesOnly yes |
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
# Setup Classes for the Example | |
class Shifter: | |
def __init__(self, label): | |
self.label = label | |
def __str__(self): | |
return str(self.label) | |
def __rshift__(self, other): | |
print("#%s.__rshift__(%s)" % (self, other)) |
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 get_calling_file_name(): | |
# If this function is embedded in another function, offset the stack appropriately | |
import inspect | |
stack_offset = 1 | |
stack = inspect.stack() | |
calling_file = stack[stack_offset][1] | |
return calling_file |
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 IPython.lib.display import Audio | |
import numpy as np | |
framerate = 4410 | |
play_time_seconds = 3 | |
t = np.linspace(0, play_time_seconds, framerate*play_time_seconds) | |
audio_data = np.sin(2*np.pi*300*t) + np.sin(2*np.pi*240*t) | |
Audio(audio_data, rate=framerate, autoplay=True) |
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 re | |
import io | |
import os | |
import csv | |
from glob import glob | |
DEFAULT_OUTPUT_NAME = 'word-counts.csv' | |
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 __future__ import print | |
# Adopted from | |
# https://web.archive.org/web/20111010015624/http://blogmag.net/blog/read/38/Print_human_readable_file_size | |
# https://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size | |
def sizeof_fmt(num, suffix='B'): | |
for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']: | |
if abs(num) < 1024.0: | |
return "%3.1f%s%s" % (num, unit, suffix) |