Skip to content

Instantly share code, notes, and snippets.

View sam-lb's full-sized avatar
🎯
Focusing

Sam Brunacini sam-lb

🎯
Focusing
View GitHub Profile
# plot of u/ShinyGrezz's thing on r/math
# http://sambrunacini.com
import pyperclip
import numpy as np
import matplotlib.pyplot as plt
from desmos_list_convert import to_desmos_table
# desmos_list_convert is at
# convert python data to desmos tables/lists
# http://sambrunacini.com
def to_desmos_list(iterable):
""" convert a python list of numbers or points into a string that can be pasted into desmos """
iterable = list(iterable)
string = ",".join([r"("+fix_point(element)+r")" for element in iterable])
return r"\left[" + string.replace(r"(",r"\left(").replace(r")",r"\right)") + r"\right]"
@sam-lb
sam-lb / desmos_color_modifier.js
Last active May 15, 2020 22:54
This script modifies the colors available to the in-browser Desmos graphing calculator.
(function() {
// Calc will be defined when on desmos.
let expressions = Calc.getExpressions();
if (expressions.length == 1 && expressions[0].latex == "") {
Calc.removeExpressions(expressions); // this deletes the first expression, because it will already be loaded with the old colors
}
Calc.updateSettings({"colors": {
"RED": "#ff0000",
"GREEN": "#00ff00",
# I am ashamed for writing this.
import inspect;
class Cin:
""" time to whip out some python magic """
def __rshift__(self, other):
# I don't want to require that "other" is declared global.
cin = input();
@sam-lb
sam-lb / FluidFlow.py
Created November 10, 2019 18:32
Python program that visualizes fluid flow through vector fields
"""
Fluid particles travelling through a vector field
By Sam Brunacini
Posts at http://sambrunacini.com/blog/
"""
import pygame;
import math;
from math import hypot, atan2, sin, cos, pi;