This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import serial | |
# configure the serial connections (the parameters differs on the device you are connecting to) | |
ser = serial.Serial( | |
port='/dev/tty.usbserial-AD0JM61U', | |
baudrate=115200, | |
parity=serial.PARITY_NONE, | |
stopbits=serial.STOPBITS_ONE, | |
bytesize=serial.EIGHTBITS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from CoefficientCalculator import Term, MultiTerm, Expression, Scalar | |
# Some brief terminology (no pun intended) | |
# A term is something like x, x^2, x^3, etc. | |
# 1 can also be a term | |
# A multiterm is the product of several terms. Something like x * y or x * z^2 is fine | |
# Multiterms also have constants, so 5 * x * y^3 is also a valid multiterm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fib = new Array(10); | |
for(var i = 0; i < fib.length; i++)//strangely enough, setting the values of `a` with array functions is incredibly difficult, so we'll use this instead | |
fib[i] = 1; | |
/*^^Given Code^^*/ | |
/*alternately, you could fill an array using the folloring code | |
var fib = Array.apply(null, new Array(10)).map(Number.prototype.valueOf,10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias roulette='[ $[ $RANDOM % 6 ] == 0 ] && rm -f $(shuf -n1 -e *) && echo "BOOM" || echo *Click*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = ""; | |
for(var i = 0; i < 10; i++){//this is to give default values to the data set, to emulate what it would look like | |
data+=i + ", "; | |
} | |
data = data.replace(/\, $/g,"");//take out trailing comma | |
data = data.replace(/,([^,]*)$/, ", and$1");//adds a pretty "and" to the end | |
console.log(data); |