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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Snake Game</title> | |
<script src="https://code.jquery.com/jquery-1.11.3.js"></script> | |
<style> | |
html, body { | |
height: 100%; | |
margin: 0; | |
} |
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 numpy as np | |
from numpy.typing import NDArray | |
class RunningMean: | |
"""Like numpy.mean but aggregates data in chunks at a time.""" | |
def __init__(self, axis=None, keepdims=False): | |
"""For axis and keepdims, see the documentation of these arg names in numpy.mean""" | |
self.axis=axis | |
self.keepdims=keepdims |
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
# some annoying document formatting requirements made me to this in tex: | |
# \setmathfont{Cambria Math} | |
# \setmainfont{Times New Roman} | |
# and of course these microsoft fonts are not found when compiling with xelatex on ubuntu | |
# this gist helps set up the texlive environment in ubuntu to find the fonts | |
# thanks to maxwelleite: https://gist.github.com/maxwelleite/10774746 | |
# their script is way better and more automated, but I didn't want to sudo an entire script, | |
# so below I have extracted the commands I want and made it clear where sudo is needed | |
# I recommend running the below one by one to check that each step works |
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
# To try this example, save this to a file slicer_plot_data.py, then execute Slicer from the command line | |
# with the arguments `--python-script slicer_plot_data.py`. | |
import slicer, qt, vtk | |
PLOT_TYPES = { | |
"line" : slicer.vtkMRMLPlotSeriesNode.PlotTypeLine, | |
"bar" : slicer.vtkMRMLPlotSeriesNode.PlotTypeBar, | |
"scatter" : slicer.vtkMRMLPlotSeriesNode.PlotTypeScatter, | |
"scatterbar" : slicer.vtkMRMLPlotSeriesNode.PlotTypeScatterBar, |