Skip to content

Instantly share code, notes, and snippets.

@aglove2189
aglove2189 / The Technical Interview Cheat Sheet.md
Last active August 25, 2015 21:55 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
'''
Command line tool that takes a csv as input and exports
a statistical summary of the data points in html format.
'''
import pandas as pd
import pandas_profiling
import argparse
import os
@aglove2189
aglove2189 / git.py
Created November 1, 2018 16:16
Bulk clone and/or pull a list of repos
# -*- coding: utf-8 -*-
import os
import re
pat = '\w*(?=\.git$)'
with open('git.sh', mode='w') as f:
f.write('#!/usr/bin/env bash\n')
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install chrome
choco install git
choco install cmder
choco install vscode
choco install anaconda3
conda config --add channels conda-forge
conda install black hyperopt lightgbm loguru mlxtend pandas-profiling pyarrow shap tokei
Start-Process "chrome.exe" "https://www.lfd.uci.edu/~gohlke/pythonlibs/#xgboost"

Keybase proof

I hereby claim:

  • I am aglove2189 on github.
  • I am aglove2189 (https://keybase.io/aglove2189) on keybase.
  • I have a public key ASATX83xHP59rWWRENkl2UKrcDjWeViiLIqlqPQM3QLuugo

To claim this, I am signing this object:

@aglove2189
aglove2189 / sql_cache.py
Last active April 16, 2021 14:48
pd.read_sql but with a time to live (ttl) cache.
# -*- coding: utf-8 -*-
import os
import hashlib
import pandas as pd
def read_sql_cache(sql, con, ttl=None, dirname="_cache", **kwargs):
"""
pd.read_sql but with a time to live (ttl) cache.
@aglove2189
aglove2189 / leetcode.py
Created April 17, 2022 22:13
leetcode solutions
import string
import collections
from typing import List
# https://leetcode.com/problems/rotate-array/
def rotate(nums: List[int], k: int) -> None:
k = k % len(nums)
nums[:] = nums[-k:] + nums[:-k]
return nums
@aglove2189
aglove2189 / requirements.txt
Last active January 30, 2023 14:51
minimal python packages
# data / ml
numpy
pandas
scikit-learn
shap
sqlalchemy
lightgbm
# inspection
tqdm
@aglove2189
aglove2189 / numerize.py
Last active April 25, 2023 15:51
numerize - shorthand format of numbers for humans
import math
def numerize(num, precision=1):
if num == 0:
return "0"
num = float(f"{num:.3g}")
m = int(math.log10(abs(num)) // 3)
numf = f"{num / 1000.0**m:.{precision}f}".rstrip("0").rstrip(".")
return f"{numf}{['', 'K', 'M', 'B', 'T', 'G'][m]}"
@aglove2189
aglove2189 / BuildingDataProducts.md
Last active November 3, 2023 16:24
How to Build Resilient Data Products

How to Build Resilient Data Products

Every aspect of your product should contribute to one of these 5 principles:

  1. Small
  2. Fast
  3. Reproducible
  4. Transparent
  5. Frictionless