Skip to content

Instantly share code, notes, and snippets.

View justbuchanan's full-sized avatar

Justin Buchanan justbuchanan

View GitHub Profile
@justbuchanan
justbuchanan / tree.py
Created November 14, 2020 09:59
recursive tree-building in python
# Creates a binary tree of depth `d`. Each node is represented as a python `dict`,
# with the value of the key "leaf" as a boolean indicating whether or not the node is a leaf node.
def make_tree(d):
assert d > 0
if d == 1: return {"leaf": True}
else: return {"leaf": False, "left": make_tree(d-1), "right": make_tree(d-1)}
make_tree(1)
# {'leaf': True}
@justbuchanan
justbuchanan / .bazelrc
Last active October 13, 2020 19:23
Use github.com/kythe/kythe as a bazel dependency
# Ensure clang is used, by default, over any other C++ installation (e.g. gcc).
build --client_env=CC=clang
# We require C++17, but bazel defaults to C++0x (pre-C++11).
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --client_env=BAZEL_CXXOPTS=-std=c++17
@justbuchanan
justbuchanan / .gitignore
Last active December 4, 2018 04:26
Example of bazel analysis failure related to kythe's llvm setup
/bazel-*
@justbuchanan
justbuchanan / BUILD
Last active November 9, 2018 20:35
Example of bug with rules_go + cgo + bazel aspects. https://github.com/bazelbuild/rules_go/issues/1821
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
go_binary(
name = "main",
srcs = ["main.go"],
cgo = True,
)
action_listener(
name = "my_action_listener",
@justbuchanan
justbuchanan / trump_tax.py
Created November 10, 2017 17:33
How does your income tax compare now vs with the new GOP/Trump tax brackets?
#!/usr/bin/env python3
# data from: https://smartasset.com/taxes/heres-how-the-trump-tax-plan-could-affect-you
# note: this applies to single filers only
import matplotlib.pyplot as plt
import numpy as np
brackets_old = [
(9325.0, .1),
# Maintainer: Maarten de Vries <maarten@de-vri.es>
# Contributor: Nathan Ringo <tikiking1@gmail.com>
pkgname=libfreenect2
pkgver=0.2.0
pkgrel=3
pkgdesc="Open source drivers for the Kinect for Windows v2"
arch=(i686 x86_64)
url="http://openkinect.org"
license=(Apache GPL)
# Script generated with import_catkin_packages.py
# For more information: https://github.com/bchretien/arch-ros-stacks
pkgdesc="ROS - Libraries and examples for ROSserial usage on Arduino/AVR Platforms."
url='http://ros.org/wiki/rosserial_arduino'
pkgname='ros-jade-rosserial-arduino'
pkgver='0.7.5'
_pkgver_patch=0
arch=('any')
pkgrel=0
# Script generated with import_catkin_packages.py
# For more information: https://github.com/bchretien/arch-ros-stacks
pkgdesc="ROS - Generalized client side source for rosserial."
url='http://ros.org/wiki/rosserial_client'
pkgname='ros-jade-rosserial-client'
pkgver='0.7.5'
_pkgver_patch=0
arch=('any')
pkgrel=1
# Script generated with import_catkin_packages.py
# For more information: https://github.com/bchretien/arch-ros-stacks
pkgdesc="ROS - Messages for automatic topic configuration using rosserial."
url='http://ros.org/wiki/rosserial_msgs'
pkgname='ros-jade-rosserial-msgs'
pkgver='0.7.5'
_pkgver_patch=0
arch=('any')
pkgrel=0
# Script generated with import_catkin_packages.py
# For more information: https://github.com/bchretien/arch-ros-stacks
pkgdesc="ROS - ROS console output library."
url='http://www.ros.org/wiki/rosconsole'
pkgname='ros-jade-rosconsole'
pkgver='1.12.6'
_pkgver_patch=0
arch=('any')
pkgrel=1