Skip to content

Instantly share code, notes, and snippets.

View MichaelScript's full-sized avatar
🏠
Working from home

Michael Green MichaelScript

🏠
Working from home
  • San Diego, California
View GitHub Profile
import site
import os
import pathlib
# Big thanks to Match on StackOverflow for helping me with this
# see https://stackoverflow.com/a/48713998/5614280
# This is some cool hackery to overwrite the default functionality of
# the builtin print function within you're entire python environment
# to display the file name and the line number as well as always flush
# the output. It works by creating a custom user script and placing it
# Running this on https://google.com returns expected behavior:
# Chrome prompts you to save your credentials
# This also works if you spin up an http server i.e: `python -m SimpleHTTPServer`
# and run it in your console.
# However running on https://localhost results in a silent failure
# where the success function fires but you are not prompted.
# Easy way to spin up a simple https server is: https://gist.github.com/dergachev/7028596
# Python Script I wrote to perform the gram schmidt process on a set of vectors
import numpy as np
def get_inverse_mag_prod(v):
return v * (1 / (sum(list(map(lambda a: a ** 2,v))) ** 0.5))
def rounder(v):
return list(map(lambda a: round(a,6),v))