Skip to content

Instantly share code, notes, and snippets.

@blakesmith
blakesmith / blakesmith_terraform.tf
Created April 2, 2016 17:33
Terraform setup for running blakesmith.me
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 / gist:3051547
Created July 5, 2012 05:27
Go Tour: Exercise: Exercise: Slices - My solution
package main
import "code.google.com/p/go-tour/pic"
func imageFun(x, y int) uint8 {
return uint8(x) ^ uint8(y)
}
func Pic(dx, dy int) [][]uint8 {
image := make([][]uint8, dx)
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
# An example Jekyll Liquid tag. Utilizes the new plugin system.
#
# 1. Make a _plugins directory in your jekyll site, and put this class in a file there.
# 2. In anyone of your pages, you can use the 'render_time' liquid tag like so:
# {% render_time Page generated at: %}
module Jekyll
class RenderTimeTag < Liquid::Tag
def initialize(tag_name, text, tokens)
$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;
$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 / gist:1587593
Created January 10, 2012 07:08
Simple pallet script
(ns pallet-test.core
(:use
[clojure.contrib.command-line])
(:require
[pallet.core :as core]
[pallet.compute :as compute]
[pallet.phase :as phase]
[pallet.crate.java :as java]
[pallet.crate.automated-admin-user :as automated-admin-user]))
@blakesmith
blakesmith / gist:3051584
Created July 5, 2012 05:44
Go Tour: Exercise: Exercise: Fibonacci closure - My solution
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
a := 0
b := 1
f := func() int {
# An example Jekyll generator. Utilizes the new plugin system.
#
# 1. Make a _plugins directory in your jekyll site, and put this class in a file there.
# 2. Upon site generation, version.html will be created in your root destination with
# # the version of Jekyll that generated it
module Jekyll
class VersionReporter < Generator
safe true
# An example Jekyll converter. Utilizes the new plugin system.
#
#
# 1. Make a _plugins directory in your jekyll site, and put this class in a file there.
# 2. Any file in the _posts directory ending in .upcase will be processed using this converter.
module Jekyll
class UpcaseConverter < Converter
safe true