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
@brianspiering
brianspiering / jn.md
Created November 24, 2021 04:31
Jupyter Notebook extensions
pip install jupyter_contrib_nbextensions
pip install jupyter_nbextensions_configurator
jupyter contrib nbextension install --user 
jupyter nbextensions_configurator enable --user
@brianspiering
brianspiering / install_tensorflow_on_apple_m1.md
Last active April 14, 2022 17:15
Installing TensorFlow/Keras on Apple's M1

Instructions

  1. Download the wheel called tensorflow-2.4.1-py3-none-any.whl located at this public google drive link:
    drive.google.com/drive/folders/1oSipZLnoeQB0Awz8U68KYeCPsULy_dQ7

  2. Assuming you downloaded the wheel to your Downloads folder, install it with pip:
    $ pip install ~/Downloads/tensorflow-2.4.1-py3-none-any.whl --user

  3. Test that it works with ipython at the command line:

@brianspiering
brianspiering / pip_install.py
Last active December 16, 2021 18:05
Install packages with pip inside a Python .py file
"""Check for 3rd party package, if not present, pip install it.
This is potentially dangerous code. It should only be used for educational purposes.
Defining a requirements.txt is one of the much better options.
"""
from importlib import import_module
module_name = 'pytest'
@brianspiering
brianspiering / clean_test.md
Last active November 6, 2021 13:54
Quick start to cleaning text data

Quick start to cleaning text data

What How
Fix Unicode encoding errors import ftfy
ftfy.fix_text('✔ No problems')
Remove specific words s = s.replace("foo", "")
Remove punctuation import string
s = s.translate(str.maketrans('', '', string.punctuation))
Remove hyperlinks import re s = re.sub(r"https?://\S+", "", s)
@brianspiering
brianspiering / machine_learing_datasets.md
Created November 2, 2021 22:01
A collection of machine learning datasets (aka, your time is too valuable to web scrape)
@brianspiering
brianspiering / zvex_fuzz_factory_guitar_pedal_settings.md
Last active February 20, 2025 12:42
ZVex Fat Fuzz Factory Vexter guitar pedal settings

Stock Sounds

"It's a little stock"
— Lars Ulrich

Nickname Gate Comp Drive Stab Personal Comments
Mellow Mud 2:30 7:00 7:00 9:00 Wall of fuzz with a little bite.
Tone Bender Fuzz 2:00 8:30 9:00+ 9:15 Cleans up with guitar volume.
@brianspiering
brianspiering / variable_naming_solutions.py
Created October 2, 2021 13:06
Explore variable naming in Python solutions
# Solutions
sumTotal = 42 # Valid
# sum-total = 42 # Invalid. Dashes are a no-no.
sum_total = 42
# sum total = 42 # Invalid. Spaces are a no-no. White space is often meaningful in Python.
sum_total = 42
@brianspiering
brianspiering / variable_naming_prompts.md
Last active October 2, 2021 13:06
Explore variable naming in Python prompts

Find out if each of the following is either an acceptable or not acceptable Python identifier.

Do this by trying to assign them as an identifier for a variable. If you get a SyntaxError: can't assign to operator, fix the error by changing the identifier.

- sumTotal 
- sumtotal
- sum-total 
- sum total

Techniques to improve as a programmer

Do not be the person who has practiced 10,000 things once, but be the person who has practiced one thing 10,000 times.
— Intentionally misquoting Bruce Lee

  1. Write a lot of code. Physically type code and run it (if either part is missing, it is not quality code practice).
  2. Think of coding practice as a portfolio. It should be a mix:
    • 40-60% Easy-for-you fundamentals. Practicing Pythonic idioms to solve common atomic problems. This develops fluency to solve novel challenges and build up to more advanced coding.
  • 20-30% Difficult-but-possible problems. LeetCode and similar is good for this level.