Skip to content

Instantly share code, notes, and snippets.

View dnmiller's full-sized avatar

Dan Miller dnmiller

View GitHub Profile
@dnmiller
dnmiller / .zshrc
Created October 2, 2012 04:59
zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Pre-loaded theme
ZSH_THEME="agnoster"
# (Will change per machine)
DEFAULT_USER="danmiller"
# Dots are pretty.
" .---.
" / . \
" |\_/| |
" | | /|
" .----------------------------------------------------------------' |
" / .-. |
" | / \ |
" | |\_. | |
" |\| | /| MY .vimrc - Last updated whenever |
" | `---' | |
@dnmiller
dnmiller / note_template.tex
Created October 16, 2012 06:31
LaTeX Template for Math Notes
\documentclass{tufte-handout}
\usepackage{amsmath}
% Set up the images/graphics package
\usepackage{graphicx}
\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
\graphicspath{{figures/}}
\title{TITLE}
\author{AUTHOR}
@dnmiller
dnmiller / ltitr_test.jl
Created October 27, 2012 04:25
Matlab's ltitr vs. Julia
# Test for ltitr implemented in Julia. I get about 45 ms.
function ltitr(A, B, U)
N = size(U, 2)
X = zeros(size(A, 1), N)
for i = 2:N
X[:, i] = A*X[:, i-1] + B*U[:, i-1]
end
return X
end
@dnmiller
dnmiller / nfl.py
Last active December 10, 2015 14:29
import csv
from collections import namedtuple
from datetime import timedelta
team = lambda *x: dict(zip(('City', 'Mascot', 'Division'), x))
teams = {
'BUF': team('Buffalo', 'Bills', 'AFC East'),
'MIA': team('Miami', 'Dolphins', 'AFC East'),
'NE': team('New England', 'Patriots', 'AFC East'),
'NYJ': team('New York', 'Jets', 'AFC East'),
# Apt-install various things necessary for Ruby, guest additions,
# etc., and remove optional things to trim down the machine.
apt-get -y update
apt-get -y remove apparmor
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev libssl-dev openssl libreadline5-dev
apt-get clean
# Remove this file to avoid dhclient issues with networking
rm -f /etc/udev/rules.d/70-persistent-net.rules
@dnmiller
dnmiller / gist:5543623
Created May 8, 2013 21:01
Installation instructions for Panda3D on OS X that has newish XCode (in progress)
Building Panda3D from source on newish OS X.
1. Install the following homebrew formlae:
- python
- nspr
- vrpn (optional, for joysticks/etc.)
- libjpeg, libtiff
- fftw
@dnmiller
dnmiller / GoogleTest.cmake
Last active April 21, 2019 10:08
CMake custom target for adding Python tests and GoogleTest unit tests to compiled libraries. Tests are run via nose.
# Custom cmake target for creating a target using gtest for unit testing.
function(add_gtest_target TARGET_NAME TARGET_LIB)
set(TEST_EXEC _${TARGET_LIB}_test)
# Build the test executable.
add_executable(${TEST_EXEC} ${ARGN})
target_link_libraries(${TEST_EXEC} ${TARGET_LIB})
# gtest was not found with a find_package command and must be linked to
@dnmiller
dnmiller / gist:8019009
Last active December 31, 2015 17:19
Todo for a fresh Xubuntu install
Fundamentals:
sudo apt-get install \
curl \
wget \
vim-gtk \
build-essential \
libatlas-base-dev \
gfortran \
python-dev \
@dnmiller
dnmiller / pidift.m
Created April 7, 2015 21:04
Iterative Feedback Tuning
function K = pidift(K, yd, y, u, gamma, lambda, beta)
% K = pidift - Calculate new PID gains from existing gains of a discrete
% PID controller
%
% K = pidift(K, yd, y, u)
%
% Calculate the new PID gains that will move the current system
% response closer to the desired system response. K is a vector of
% the current PID gains, [Kp, Ki, Kd], where the controller structure
% is of the following form: