Skip to content

Instantly share code, notes, and snippets.

@johnhw
johnhw / stitches.py
Created July 8, 2018 19:50
stitches.py
import matplotlib.pyplot as plt
import numpy as np
import fractions
def lcm(a,b):
return abs(a * b) / fractions.gcd(a,b) if a and b else 0
def hex_rgb_to_float(hex):
r = int(hex[0:2],16)/255.0
p |link_ptr|name_ptr|class_ptr|doc_ptr|data_words...
execute:
mov x1, x0+D_DATA
ldr x0, [x0+D_CLASS]
b x0
bytecode:
mov x0, [IP]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnhw
johnhw / presenter_r700.lua
Created October 1, 2018 13:38
Lua script for LuaMacros to configure Logitech R700 for presentation in Jupyter
-- assign logical name to macro keyboard
lmc_assign_keyboard('MACROS');
view_mode = false
-- define callback for whole device
lmc_set_handler('MACROS',function(button, direction)
print(button)
if (direction == 1) then return end -- ignore down
if (button == 33) then lmc_send_keys("{ESC}{UP}")
@johnhw
johnhw / custom.css
Last active October 3, 2018 07:19
CSS for jupyter cell highlight
div.cell.text_cell.rendered.selected
{
border: 4px solid orange;
}
div.cell.code_cell.rendered.selected
{
border: 4px solid orange;
}
@johnhw
johnhw / lecture_tex_header.tex
Created October 7, 2018 09:35
Preamble for formatting math in lecture notes
$$\newcommand{\vec}[1]{{\bf #1} }
\newenvironment{examinable}{\hspace{16em}}{{\hspace{16em}\LARGE[\spadesuit]}}
\newcommand{\real}{\mathbb{R}}
\newcommand{\expect}[1]{\mathbb{E}[#1]}
\DeclareMathOperator*{\argmin}{arg\,min}
\begin{examinable}
\vec{x}
\real
\end{examinable}
$$
# BSD 3-Clause License
# Copyright (c) 2018, John H. Williamson
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# This implements the ideas in the paper "Neural Ordinary Differential Equations"
# in as simple a form as possible, using only autograd. It is not efficient.
# It is not useful for any practical purpose.
# Use [torchdiffeq](https://github.com/rtqichen/torchdiffeq) for any real use.
#
# > [1] Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, David Duvenaud.
# "Neural Ordinary Differential Equations." *Advances in Neural Processing Information Systems.* 2018.
# [[arxiv]](https://arxiv.org/abs/1806.07366)
#
# The implementation is based on the
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.