Skip to content

Instantly share code, notes, and snippets.

View MHenderson's full-sized avatar

Matthew Henderson MHenderson

View GitHub Profile
@MHenderson
MHenderson / moore
Created August 23, 2014 10:25
Filter Moore graphs from an input string of whitespace-delimited graphs in graph6 format.
#!/bin/bash
# Usage:
# echo `geng -qc 5` | moore.sh
#
# Note: Do not use for values greater than 6.
read g6raw
g6proc=$(echo $g6raw |
awk '{ print "\"" $1 "\"" "," }' RS=' ' ORS=' ' |
@MHenderson
MHenderson / index.html
Last active November 4, 2021 09:57
Minimal example of vis.js (visjs.org).
<!doctype html>
<html>
<head>
<title>vis.js Graph demo</title>
<script src="http://visjs.org/dist/vis.js"></script>
<link href="http://visjs.org/dist/vis.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="graph"></div>
@MHenderson
MHenderson / git-pushing-multiple.rst
Created September 10, 2021 15:27 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@MHenderson
MHenderson / pytorch_1.ipynb
Last active November 21, 2019 15:15
PyTorch tutorial
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MHenderson
MHenderson / chromatic.sh
Last active July 2, 2019 21:24
A script to compute the chromatic number of graphs in Graphviz DOT format.
#!/bin/bash
file_gv=$1
n_edges_re='s/\([0-9]*\) %.*/\1/p'
n_edges=`gc -e $file_gv\
| sed -n "${n_edges_re}"\
| tr -d ' '`
@MHenderson
MHenderson / clock-state-and-lifecycle.markdown
Created July 2, 2019 15:02
Clock (State and Lifecycle)
@MHenderson
MHenderson / index.html
Last active July 2, 2019 12:18
Tic Tac Toe
<div id="errors" style="
background: #c00;
color: #fff;
display: none;
margin: -20px -20px 20px;
padding: 20px;
white-space: pre-wrap;
"></div>
<div id="root"></div>
<script>
@MHenderson
MHenderson / index.html
Last active July 2, 2019 08:36
react-hello-world
<div id="timer-example"></div>
my_stars %>% filter(!is.na(language)) %>% count(language) %>% ggplot(aes(reorder(language, n), n)) + geom_col(width = 0.5, fill = scales::alpha("blue", 0.6)) + coord_flip() + hrbrthemes::theme_ipsum_rc() + labs(x = "Language", y = "Number of stars", title = "Languages in MHenderson's Github stars", subtitle = "https://github.com/ropenscilabs/stellar")
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## font family not found in Windows font database
@MHenderson
MHenderson / probability-notebook.ipynb
Last active September 5, 2017 10:59
Notes and solutions to exercises from "Introduction to Probability" by Grinstead and Snell.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.