Skip to content

Instantly share code, notes, and snippets.

View scooter-dangle's full-sized avatar
🆗
高兴

Scott Steele scooter-dangle

🆗
高兴
View GitHub Profile
@scooter-dangle
scooter-dangle / essay.markdown
Created January 10, 2012 04:29
tiny essay on valuing human lives

Valuing a human life

Federal agencies are required to perform detailed economic analyses when a proposed course of action exceeds a particular dollar threshold (historically set at $100M). Part of quantifying anticipated consequences requires that they put a monetary value on everything, including human life.

One way they accomplish that is by looking at how much more employers have to pay employees in risky work environments. For instance, if workers generally demand $10,000 more to drive machinery that increases the probability of death by 1 in 500, then you have an example of a market where life is valued at $5.0M.

It's not a cheery topic, but it's important to reach an acceptable dollar value: If we just say that a human life is priceless, we'd logically have to expend all of our resources (if necessary) the first chance we get to save a life. But then we won't have anything at our disposal the next day when, perhaps, we might have been able to save multiple lives with the same a

@scooter-dangle
scooter-dangle / gist:11181924
Last active August 29, 2015 14:00
rbenv install 1.8.7-p375—failed during rubygems install on Ubuntu 13.10

Command

~/e/jarvis (master|✚2…)> rbenv install 1.8.7-p375

Console output

Checking out http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7...
Installing ruby-1.8.7-p375...

Keybase proof

I hereby claim:

  • I am scooter-dangle on github.
  • I am scottlsteele (https://keybase.io/scottlsteele) on keybase.
  • I have a public key whose fingerprint is D0B8 B301 5EA6 B2BA B2E8 C064 AEC3 67AF C5DA D548

To claim this, I am signing this object:

@scooter-dangle
scooter-dangle / alias_tables_issue.rb
Last active August 29, 2015 14:14
Illustration of error in AliasTable initialization
#!/usr/bin/env ruby
#
# To be run from inside the AliasTables directory
#
require './lib/alias'
normalize = -> ary do
sum = ary.inject(0.0, :+)
ary.map { |elmt| elmt.to_f / sum }
@scooter-dangle
scooter-dangle / expressable_demo.rb
Last active August 29, 2015 14:27
Demo of emulating template capture/block expression outside of ActionView / Rails environment
require 'erb'
require 'active_support/concern'
module Expressable
def with_tmp_buffer(&block)
tmp_buffer, @output_buffer = @output_buffer, ""
block.yield
@output_buffer
ensure
tmp_buffer, @output_buffer = @output_buffer, tmp_buffer
@scooter-dangle
scooter-dangle / CollectionsDemo.clj
Last active September 3, 2015 00:50 — forked from neilchaudhuri/CollectionsDemo.clj
Clojure code to perform operations on collections.
(->> (data)
(filter even?)
(map #(* 3 %))
(reduce +))
@scooter-dangle
scooter-dangle / main-1.rs
Last active November 10, 2017 03:43
Rust Talk Pretty One Day—BigRational to_rational
extern crate num;
use num::rational::{Ratio,Rational,BigRational};
use num::traits::ToPrimitive;
fn to_rational(number: BigRational) -> Option<Rational> {
let denom = number.denom().to_isize();
if denom == None {
return None
}
@scooter-dangle
scooter-dangle / lib.rs
Created July 1, 2016 21:50
Subvector matching performance experimentation
// Winner! The others are about 45% slower on the contrived example
fn is_substring(needle: &[u8], haystack: &[u8]) -> bool {
if needle.is_empty() { return true }
// if haystack.len() < needle.len() { return false }
// if haystack.is_empty() { return false }
haystack.windows(needle.len()).any(|subvec| subvec == needle)
}
@scooter-dangle
scooter-dangle / __fish_aws_creds_prompt.fish
Created January 23, 2020 04:28
Lightweight AWS env loader for fish
# AWS_ENV var is meant to be combined with the following
# function in the shell prompt
function __fish_aws_creds_prompt
if set --query AWS_ENV
if string match --ignore-case --quiet --regex 'pro?d' "$AWS_ENV"
set aws_name_color brred
else
set aws_name_color bryellow
end
@scooter-dangle
scooter-dangle / main.rs
Created July 21, 2021 00:29
Playing around at the July 20 Rust DC meetup
use std::sync::Arc;
// #[derive(Debug)]
// struct Database(Vec<User>);
// #[derive(Debug, Default)]
// struct User {
// id: usize,
// login: UserLogin,
// password: String,