Skip to content

Instantly share code, notes, and snippets.

Avatar

Blake Smith blakesmith

View GitHub Profile
View nextpnr_on_ubuntu20.04
With Ubuntu 20.04 installed, nextpnr was having trouble finding Python during the build.
After installing libboost-python-dev and python3-dev, I had to configure cmake with (ECP5 arch):
cmake -DARCH=ecp5 -DPYTHONLIBS_VERSION_STRING=3.8 -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 -DTRELLIS_INSTALL_PREFIX=/usr .
make -j4
sudo make install
View motor_plate.scad
$fn = 100;
motor_diameter = 107;
crank_shaft_length = 29;
total_length = 125;
motor_diameter_tolerance = 1;
motor_diameter_with_tolerance = motor_diameter + motor_diameter_tolerance;
plate_diameter = motor_diameter_with_tolerance * 1.35;
View display_holder.scad
$fn = 100;
actual_bar_diamater = 22;
bar_diameter = actual_bar_diamater - 1;
holder_thickness = 5;
holder_outer_diameter = bar_diameter + holder_thickness;
holder_width = 25;
display_hole_diameter = 10;
tension_hole_diamater = 10;
@blakesmith
blakesmith / blakesmith_terraform.tf
Created Apr 2, 2016
Terraform setup for running blakesmith.me
View blakesmith_terraform.tf
provider "aws" {
alias = "prod"
region = "us-east-1"
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
}
resource "aws_s3_bucket" "origin_blakesmith_me" {
provider = "aws.prod"
@blakesmith
blakesmith / 0_reuse_code.js
Created Nov 18, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@blakesmith
blakesmith / code_review_essentials.md
Last active Aug 29, 2015
Code Review Essentials for Software Teams
View code_review_essentials.md

Code Review Essentials for Software Teams

Code Review is an essential part of any collaborative software project. Large software systems are usually written by more than one person, and so a highly functioning software team needs a robust process to keep its members, as well as the code base itself moving in the right direction.

Code Review is a powerful tool that:

@blakesmith
blakesmith / Makefile
Last active Jan 3, 2016
nginx log merger. Useful if you have logs distributed on many app nodes that you'd like unified into one big log file.
View Makefile
CC=gcc
CFLAGS=-Wall -pendatic -03 -std=c99
PROG=nginx_log_merger
all: nginx_log_merger.o
nginx_log_merger.o:
$(CC) $(CFLAGS) nginx_log_merger.c -o $(PROG)
clean:
View SoundcloudProvider.scala
def getMediaURI(userId: String, id: String): Future[MediaURI] =
for {
authed <- authorizedClient(userId, client)
track <- authed.getTrack(id)
url <- authed.resolveStreamLocation(track.streamUrl)
} yield MediaURI(url, Map())
View QuickCheck.scala
property("sorted delete") = forAll { (h: H) =>
def getSeq(l: List[A], heap: H): List[A] = isEmpty(heap) match {
case true => l.reverse
case false => getSeq(findMin(heap) :: l, deleteMin(heap))
}
val deleted = getSeq(List(), h)
deleted == deleted.sorted
}
View QuickCheck.scala
property("meld two heaps with mins") = forAll { (h1: H, h2: H) =>
def getSeq(l: List[A], heap: H): List[A] = isEmpty(heap) match {
case true => l.reverse
case false => getSeq(findMin(heap) :: l, deleteMin(heap))
}
if (isEmpty(h1) || isEmpty(h2)) true
else {
val melded = getSeq(List(), meld(h1, h2))
val melded2 = getSeq(List(), meld(deleteMin(h1), insert(findMin(h1), h2)))