Skip to content

Instantly share code, notes, and snippets.

View brandonwillard's full-sized avatar

Brandon T. Willard brandonwillard

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brandonwillard
brandonwillard / distribution_shape.py
Last active January 5, 2017 02:35
Logic and Tests for Automatic Distribution Shape Determination.
import collections
from itertools import cycle
import numpy as np
import theano.tensor as tt
import warnings
from theano.tensor.raw_random import _infer_ndim_bcast
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brandonwillard
brandonwillard / nvim-terminal-edit.py
Last active October 6, 2017 21:35 — forked from bfredl/nvim-terminal-edit.py
Edit file in host Neovim instance from a :terminal buffer
#!/home/bwillard/apps/anaconda3/envs/neovim3/bin/python
"""Edit a file in the host nvim instance."""
from __future__ import print_function
import os
import sys
from neovim import attach
args = sys.argv[1:]
@brandonwillard
brandonwillard / assign_caching.py
Created April 14, 2018 17:31
Python AST-based Caching
import inspect
import shelve
import ast
from itertools import cycle
class AssignCachingVisitor(ast.NodeVisitor):
"""Slightly less naive src block caching.
@brandonwillard
brandonwillard / org-ref-use-options.el
Last active May 8, 2018 21:02
Make org-ref use org-mode options instead of links
(defun btw//org-ref-find-bibliography ()
"Find the bibliography files in the current buffer.
This function sets and returns `org-ref-bibliography-files' obtained from
#+BIBLIOGRAPHY options."
(prog1
;; When called from within a bibtex file, assume we want it; otherwise,
;; check the current file for a bibliography source.
(setq org-ref-bibliography-files (or (and (f-ext? buffer-file-name "bib")
(list buffer-file-name))
@brandonwillard
brandonwillard / Dockerfile
Created August 16, 2018 21:51
Dockerfile for Python 2.7 Tests of Hy
# -*- mode: Dockerfile -*-
#
# To build the image, in the Hy project root with this file present (and possibly renamed), run the following:
# docker build --rm -t hy-test-py27 -f Dockerfile .
#
# To launch a container, for the example image built above, and start an interactive session:
# docker run -ti --rm hy-test-py27:latest /bin/bash
#
# and to mount/expose a directory (`pwd` in this example) from the host at
# `/opt/hylang/hy` in the container: