Skip to content

Instantly share code, notes, and snippets.

@brycefisher
brycefisher / keybase.md
Created December 9, 2017 03:47
keybase.md

Keybase proof

I hereby claim:

  • I am brycefisher on github.
  • I am bff (https://keybase.io/bff) on keybase.
  • I have a public key ASBZB5Tjeib9trqDLSZppdt5o1m8d8wAylr_Jmdkl3fMJgo

To claim this, I am signing this object:

@brycefisher
brycefisher / math.py
Last active May 12, 2017 00:26
Estimate Costs for Burst Mode
#!/usr/bin/env python3
# TODO -- Debug this logic. It doesn't quite seem to give the expected results.
import csv
filename = 'pre-failover.csv'
HOUR = 60
max_wait = 1
TASKS_PER_INSTANCE = 6
@brycefisher
brycefisher / restore-fo-api.sh
Created October 4, 2016 16:15
Mongorestore fulfillment options
#!/bin/bash
mongorestore --drop -d fulfillment_options_development $HOME/.goodeggs-data-dumps/fulfillment-options/
<!DOCTYPE html>
<html>
<head>
<title>Play Time</title>
</head>
<body>
<form>
<input type="file" id="file-chooser" />
<button id="upload-button">Upload to S3</button>
<div id="results"></div>
// Implements the signing example w/out AWS SDK in nodejs. See:
// http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html
const crypto = require('crypto');
function signingKey(secretAccessKey, region, service, datetime) {
var date = datetime.substr(0, 8);
var kDate = crypto.createHmac('sha256', 'AWS4' + secretAccessKey).update(date).digest();
var kRegion = crypto.createHmac('sha256', kDate).update(region).digest();
var kService = crypto.createHmac('sha256', kRegion).update(service).digest();
return crypto.createHmac('sha256', kService).update('aws4_request').digest('hex');
set autochdir
set nobackup
set nowritebackup
set noswapfile
set list listchars=tab:→\ ,trail:·
set tabstop=4
set smartindent
set fo=tcrq
use image::{GenericImage, ImageBuffer};
extern crate image;
pub fn sobel(input: GenericImage) -> Option<ImageBuffer> {
let (width, height) = input.dimensions();
let raw_input = input.grayscale().raw_pixels();
let mut raw_output = vec![0u8; width*height];
let kernel_x = &[
@brycefisher
brycefisher / gist:a152f084c8d7dee5612d
Created February 16, 2015 19:52
docker push failed to upload metadata EOF
user@local:~$ docker push localhost:5000/bryce/my_image
The push refers to a repository [localhost:5000/bryce/my_image] (len: 1)
Sending image list
Pushing repository localhost:5000/bryce/my_imagee (1 tags)
511136ea3c5a: Image successfully pushed
b18d0a2076a1: Pushing
FATA[0009] Failed to upload metadata: Put http://localhost:5000/v1/images/b18d0a2076a121ed25bee8188661264efb4703910ab84c67b1b1ebe12144c15b/json: EOF

General

  • Are all vars used somewhere?
  • Do the vars have properly cased, and meaningful names?
  • Style looks appropriate
  • No unnecessarily duplicated logic
  • Code intent is clear upon initial reading
  • Any code that isn't clear, but is needed, has an effective comment
  • Are method calls or attribute lookups every called on entities that could be undefined/null?
  • The functions can appropriately handle unexpected inputs.
  • Commented code has been removed (comments themselves are fine).
@brycefisher
brycefisher / enums.rs
Created November 30, 2014 19:26
Namespaced Enums
// Enum syntax has changed.
// Given this enum:
enum Shapes {
Circle,
Square
}
// WORKS
let drawing = Shapes::Circle;