Skip to content

Instantly share code, notes, and snippets.

View perplexes's full-sized avatar

Colin Curtin perplexes

View GitHub Profile

Keybase proof

I hereby claim:

  • I am perplexes on github.
  • I am perplexes (https://keybase.io/perplexes) on keybase.
  • I have a public key ASBHMwgldVX7we8SdIJIpJFUZRHxqp60XQbMIxHdMfS2JAo

To claim this, I am signing this object:

# Given a weight, break down into buildup to work weight
# 45, 50, 65, 70, 75-80, 90, 100
#
# weight sizes: 2.5, 5, 10, 15, 25, 35, 45
# bar weight: 45
#
# example: final weight 155
#
# 45%: 69.75 - 45 = 24.75 / 2 = 12.375. we can choose 15 (for 75lbs or 48%), or 10 + 2.5 for something close but more weights
# TODO: choose less weights
@perplexes
perplexes / gist:e994b788d61b92124921
Created January 14, 2016 20:16
Get current elasticache servers from elasticache config server
$ echo "config get cluster" | nc -i1 name.sha.cfg.use1.cache.amazonaws.com 11211 | sed '3q;d' | tr ' ' '\n' | awk -F'|' '{print $1":"$3}'
verba.pysff9.0001.use1.cache.amazonaws.com:11211
verba.pysff9.0002.use1.cache.amazonaws.com:11211
@perplexes
perplexes / Chromebits.MD
Last active January 13, 2016 19:19
Chromebits & Librato
@perplexes
perplexes / gradient.scss
Last active December 11, 2015 22:54
Parsing bug linear-gradient
.test{ background-image: -ms-linear-gradient(top left, #4D303B48 0%, #4D2C3642 100%);}
$ ~/src/reference/sassc/bin/sassc test_chosen.scss
Error: expected a variable name (e.g. $x) or ')' for the parameter list for -owg-url
on line 4 of test_chosen.scss
>> background: -owg-url(//assets0staging.verbacompete.com/assets/chosen-sprit
------------------------^
$ ~/src/reference/sassc/bin/sassc --version
sassc: 3.3.0
libsass: 3.3.2-32-gb2a3
sass2scss: 1.0.5
$ sassc test.scss
.fun-exists1 {
exists: false;
compact: true; }
.fun-exists2 {
exists: false;
compact: compact(true); }
# Based on http://rosettacode.org/wiki/Knapsack_problem/Bounded#Dynamic_programming_solution
# https://en.wikipedia.org/wiki/Knapsack_problem#0.2F1_knapsack_problem
class KnapsackSolver
attr_reader :table, :items, :limit
# items: [{weight: <whole integer weight>, value: <any numeric value to maximize>}]
# limit: <whole integer weight limit>
#
# For money, you can * 100 to optimize to the cent
# but then the runtime increases by x100
# You can also re-normalize based on the bounds/resolution,
Verifying that +perplexes is my blockchain ID. https://onename.com/perplexes
@perplexes
perplexes / tag_aws_chef.sh
Created October 8, 2015 17:13
Copy AWS tags to Chef
#!/bin/bash
# brew install awscli
# brew install jq
# brew install parallel
aws ec2 describe-tags |\
jq -r '.Tags[] | select(.ResourceType == "instance") | select(.Key != "Name") | "knife tag create \(.ResourceId) \(.Key)=\(.Value)"' |\
parallel "sh -c {}"