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]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnhw
johnhw / umap_sparse.py
Last active November 15, 2024 23:31
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@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 / 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 / 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.

A complete list of books, articles, blog posts, videos and neat pages that support Data Fundamentals (H), organised by Unit.

Formatting

If the resource is available online (legally) I have included a link to it. Each entry has symbols following it.

  • ⨕⨕⨕ indicates difficulty/depth, from ⨕ (easy to pick up intro, no background required) through ⨕⨕⨕⨕⨕ (graduate level textbook, maths heavy, expect equations)
  • ⭐ indicates a particularly recommended resource; 🌟 is a very strongly recommended resource and you should look at it.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.