Skip to content

Instantly share code, notes, and snippets.

View brianspiering's full-sized avatar

Brian Spiering brianspiering

  • San Francisco, CA, USA
View GitHub Profile
{"('of', 'the')": 6650, "('in', 'the')": 5090, "('that', 'the')": 3013, "('to', 'the')": 2793, "('on', 'the')": 2636, "('and', 'the')": 2277, "('the', 'nyt')": 2150, "('with', 'the')": 1807, "('the', 'wp')": 1719, "('for', 'the')": 1693, "('to', 'be')": 1539, "('at', 'the')": 1512, "('the', 'lat')": 1425, "('of', 'a')": 1407, "('new', 'york')": 1374, "('the', 'new')": 1341, "('by', 'the')": 1314, "('in', 'a')": 1204, "('the', 'paper')": 1030, "('as', 'a')": 998, "('about', 'the')": 972, "('reports', 'that')": 954, "('from', 'the')": 936, "('is', 'a')": 917, "('is', 'the')": 902, "('the', 'post')": 884, "('york', 'times')": 871, "('with', 'a')": 848, "('los', 'angeles')": 779, "('the', 'times')": 761, "('washington', 'post')": 760, "('says', 'the')": 755, "('the', 'story')": 751, "('the', 'papers')": 734, "('is', 'that')": 722, "('the', 'us')": 715, "('the', 'washington')": 706, "('angeles', 'times')": 683, "('to', 'a')": 677, "('have', 'been')": 675, "('it', 'was')": 675, "('but', 'the')": 675, "('leads', 'wi
@brianspiering
brianspiering / git_github_activities.md
Last active October 5, 2020 21:27
git & GitHub Activities

Git & GitHub Activities

In the breakout rooms, each person should individually complete following tasks. The goal is muddle your way through - git can be difficult. Let's practice in low stakes environment. When get stuck ask someone else in the breakout rooms to help you.

Learning Outcomes

By the end of this session, you should be able to:

@brianspiering
brianspiering / make_folders.py
Last active October 23, 2020 17:49
Make folders based items in a file.
"Make folders based items in a file."
from pathlib import Path
names = Path("names.txt").read_text().split("\n")
for name in names:
p = Path("/output/") / name
p.mkdir(exist_ok=True)
@brianspiering
brianspiering / career_advice_heuristics.md
Created November 2, 2020 17:38
Career Advice Heuristics

Career Advice Heuristics

  • Time-travel - What opportunity would I be happy having completed 1 or 5 years from now?

  • Largest hill to succesful climb - Most careers are a series of increasing larger hills to climb. Thus, which opportunity allows me to finish the biggest project possible?

@brianspiering
brianspiering / homeward_bound_robot_problem.md
Last active December 15, 2021 12:21
Homeward Bound Robot Problem

Problem Statement

A robot starts at position (0, 0). Given a sequence of its moves, judge if this robot makes a complete trip. A complete trip means the robot ends back at the original location.

The valid robot moves are "R" (Right), "L" (Left), "U" (Up) and "D" (down). For example, a sequence of moves could be "RRLUUD". The robot would move:

  • Move 1 unit to the right
  • Move another 1 unit to the right
  • Move 1 unit to the left
@brianspiering
brianspiering / homeward_bound_robot_solution.py
Last active December 15, 2021 12:21
Homeward Bound Robot Solution
# Solution for Homeward Bound Robot Problem
def test_is_back_at_start(is_back_at_start_func):
# Complete trips
assert is_back_at_start_func("UD") # Simple example
assert is_back_at_start_func("ULDRLRDU") # A more complex example
# Incomplete trips
assert not is_back_at_start_func("LL") # Simple example
assert not is_back_at_start_func("RRLUULRLRL") # A more complex
@brianspiering
brianspiering / is_substring_problem.md
Last active December 15, 2021 12:17
Is Substring Problem

Is Substring Problem

Problem Statement

Given a short string and long string, find if the shorter string is a substring of the longer string.

Common Questions

@brianspiering
brianspiering / is_substring_solution.py
Last active December 15, 2021 12:17
Is Substring Solution
# Solution for Is A Substring Problem
def is_substring(short:str, long:str) -> bool:
for i, c in enumerate(long):
if c == short[0]:
if long[i:i+len(short)] == short:
return True
else:
return False
@brianspiering
brianspiering / data_science_workflow.md
Last active November 17, 2020 16:19
Data Science Workflow

Data Science Workflow

Step 1 - Ask

Based on domain experience, ask specific and meaningful questions.

Define all terms precisely within the context.

@brianspiering
brianspiering / Email_Breakout_Room_Activity.md
Last active November 19, 2020 20:41
Email Breakout Room Activity

Prompt:

It is the beginning of practicum, your industry mentor asks your practicum group to write an email to the entire the company introducing yourselves. For the sake of the activity, the organization is a hot, new start-up called Meow-Meet - Tinder for cat-lovers. Your practicum is on the Experimentation Team.

This is based on a real story. A couple of years ago, I was an industry mentor working with MSDS students. The students would not write this email. I had to ask several times and got really annoying. Let's practice now.

Steps:

  1. Work together in Riseup Pad.
  2. Write the subject line.