Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am heatherm on github.
  • I am heathrmoor (https://keybase.io/heathrmoor) on keybase.
  • I have a public key ASBq3Me_0r6ANRF4B2UOJpxnraVmRtwNYQrSNxAD3WOOzwo

To claim this, I am signing this object:

"""
This security layer inadequately handles A/B storage for files in RepyV2.
Note:
This security layer uses encasementlib.r2py, restrictions.default, repy.py and Python
Also you need to give it an application to run.
python repy.py restrictions.default encasementlib.r2py [security_layer].r2py [attack_program].r2py
@heatherm
heatherm / heroku_backups.txt
Last active November 24, 2015 20:30
Heroku PG Backups - Restore to Staging or Local
heroku pg:backups capture --app production
heroku pg:backups --app production
*note the code for the latest backup* (ex: b017)
PROD -> STAGING
heroku pg:backups restore `heroku pg:backups public-url b017 --app production` DATABASE --app staging
PROD -> LOCAL
curl -o latest.dump `heroku pg:backups public-url b017 --app production`
@heatherm
heatherm / gist:13d2107101f2d2f25c69
Created July 11, 2014 17:38
Android Finance App Rating Scraper
require 'nokogiri'
require "net/http"
require "uri"
require 'statistics2'
def ci_lower_bound pos, n, confidence
return 0 if n == 0
z = Statistics2.pnormaldist(1-(1-confidence)/2)
phat = 1.0*pos/n
(phat + z*z/(2*n) - z * Math.sqrt((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n)
@heatherm
heatherm / gist:7178194
Created October 27, 2013 05:10
matrix multiplication by columns
def multiply left_matrix, right_matrix
right_matrix_transposed = transpose right_matrix
result = left_matrix.each.map { [] }
right_matrix_transposed.each do |column|
left_matrix.each_with_index do |row, row_index|
sum = 0
row.each_with_index do |row_value, position_index|
sum += row_value*column[position_index]
end
@heatherm
heatherm / gist:4033326
Created November 7, 2012 18:12
clean remote branches that have been merged
git branch -r --merged develop | sed 's/ *origin\///' | grep -v 'master$' | xargs -n 1 printf "git push origin :%s\n" | bash
@heatherm
heatherm / article.rhtml
Created March 18, 2012 17:35
toto with github highlights and disqus
<article class="post">
<header>
<h1><%= title %></h1>
<span class="date"><%= date %></span>
</header>
<section class="content">
<%= body %>
</section>