This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simply ensure repo and return url | |
aws ecr create-repository --repository-name $1 2>/dev/null || true | |
echo "$(aws ecr describe-repositories --repository-name $1 | jq '.repositories[0].repositoryUri')" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Modifying Float and Integer for fun. | |
class Float | |
def whole? | |
n = self | |
!!( n % 1 == 0 ) | |
end | |
end | |
class Integer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"errors" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "[email protected]" | |
user "root" | |
action :create | |
end | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sri | |
import ( | |
"crypto/sha256" | |
"encoding/base64" | |
"fmt" | |
"io/ioutil" | |
) | |
func Generate256(file string) (string, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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> \ |