Skip to content

Instantly share code, notes, and snippets.

Avatar

Mat Leonard mcleonard

View GitHub Profile
@mcleonard
mcleonard / react-markdown-mathjax.js
Last active Aug 27, 2020
Render math expressions in Markdown with Mathjax as a React component
View react-markdown-mathjax.js
import ReactMarkdown from 'react-markdown';
import MathJax from 'react-mathjax';
import RemarkMathPlugin from 'remark-math';
function MarkdownRender(props) {
const newProps = {
...props,
plugins: [
RemarkMathPlugin,
],
@mcleonard
mcleonard / batch_examples
Created Sep 13, 2017
RNN batch examples
View batch_examples
seq = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
###
## For get_batches(seq, 2, 2)
# batch 1
x = array([[1, 2],
[7, 8]]),
y = array([[2, 3],
[8, 9]]))
@mcleonard
mcleonard / process_notebook.sh
Created Feb 1, 2016
A shell script for processing a Jupyter notebook Markdown file for use with Pelican
View process_notebook.sh
#!/bin/bash
FILE=$1
FILENAME="${FILE%%.*}"
FILE_DIR="${FILENAME}_files"
if [ -d $FILE_DIR ]; then
# When converting a notebook to markdown, all the images in the markdown file link to the files
# folder created when converting. We need to replace the file folder with
# the static images folder used by Pelican.
@mcleonard
mcleonard / pip_update_all
Last active Jul 14, 2017
Update all Python packages
View pip_update_all
pip list --outdated | grep -Eo '^[^ ]+' | xargs pip install -U
@mcleonard
mcleonard / vector.py
Last active Oct 12, 2020
A vector class in pure python.
View vector.py
"""
The MIT License (MIT)
Copyright (c) 2015 Mat Leonard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
You can’t perform that action at this time.