View p.rb
#!/usr/bin/env ruby
# Modifying Float and Integer for fun.
class Float
def whole?
n = self
!!( n % 1 == 0 )
end
end
class Integer
View main.go
package main
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
)
View restart.rb
fake_rand = `hostname`.hash % 6
if config["STUNNEL_AUTORESTART"]
cron "stunnel-restart cron job" do
command "/sbin/restart stunnel-mod-gearman-worker-ssl"
minute [0, 15, 30, 45].map { |i| fake_rand + i }.join(", ")
mailto "srtools@heroku.com"
user "root"
action :create
end
else
View date_time_fmt.js
var DotW = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Satruday' ];
var MotY = [ 'January', 'Feburary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
var dig2 = function(n) {
if (n > 9) return n.toString();
return "0" + n;
};
var formatDateUtc = function(date) {
var dddd = DotW[date.getUTCDay()];
var MMMM = MotY[date.getUTCMonth()];
View cool.rb
scope :find_by_eamil, ->(email) do
# Search team.
teams = joins(:team).where(teams: { email: email })
return teams unless teams.empty?
# Search user.
joins(:user).where(users: { email: email })
end
View database_url.rb
unless ENV['DATABASE_URL'].present?
# convert current config/database.yml to ENV['DATABASE_URL'] format
c = ActiveRecord::Base.configurations[Rails.env]
database = c["database"]
username = c["username"]
password = c["password"]
adapter = c["adapter"] || "postgres"
hostname = c["host"] || "localhost"
View prun.sh
# run Procfiles without fore{man,go}
function _procline {
local line=""
if test -z "$1"; then
line=`cat Procfile | head -n1 | awk -F': ' '{ print $2 }'`
else
line=`cat Procfile | grep $1 | awk -F': ' '{ print $2 }'`
fi
echo $line
View sri.go
package sri
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"io/ioutil"
)
func Generate256(file string) (string, error) {
View maxdd.js
#!/usr/bin/env node
/*
* MaxCDN 2 DataDog
*
* Usage:
*
* $ npm install async moment maxcdn dogapi
* $ MAXCDN_ALIAS=<maxcdn_alais> \
* MAXCDN_KEY=<maxcdn_key> \
* MAXCDN_SECRET=<maxcdn_secret> \
View status-platform.md

Status: New

Notes on building out a new instance of stats.heroku.com on the platform.

heroku create --space sre-oregon --org heroku-sre --region oregon status-integration

# addons
heroku addons:create memcachier:100 -a status-integration
heroku addons:create pusher:startup -a status-integration