This file contains 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
16:24 $ bundle exec rails g scaffold foo | |
invoke active_record | |
create db/migrate/20150305003051_create_foos.rb | |
create app/models/foo.rb | |
invoke rspec | |
create spec/models/foo_spec.rb | |
invoke factory_girl | |
create spec/factories/foos.rb | |
invoke resource_route | |
route resources :foos |
This file contains 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
STDOUT.write "remote: " | |
remote = gets.chomp | |
def run(str) | |
puts str | |
puts `#{str}` | |
end | |
`git branch -r --merged`.gsub(" ", "").split("\n").select{ |a| a =~ /^#{remote}/ }.each{ |branch| | |
run "git push #{remote} --delete #{branch.gsub("#{remote}/", "")}" | |
} |
This file contains 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
str = "[ASDF ASDF]" | |
from, to = [/\[([A-Z][ A-Z_0-9]*)\]/, proc{|s| "\"#{$1.downcase}\""}] | |
def doit(str, from, to) | |
str.gsub(from, &to) | |
end | |
doit(str, from, to) | |
def doit2(str, from, to) | |
to = proc{|s| "\"#{$1.downcase}\""} | |
str.gsub(from, &to) |
This file contains 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 python | |
import sys | |
import os | |
import pathlib | |
from subprocess import call | |
ENV_DIR = ".env" | |
ENV = os.environ.get('ENV') | |
SERVICE = os.environ.get('SERVICE') |
This file contains 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 python | |
import base64 | |
import os | |
import json | |
import sys | |
import re | |
environment = sys.argv[1] | |
environment = environment.upper() |
This file contains 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
... | |
k8s_name (){ | |
echo $1 | sed 's/[\/_]/-/g' | |
} | |
if [ "$NAMESPACE" != "default" ]; then | |
envsubst < ${INFRA_DIR}/namespace.json > ${OUT_DIR}/namespace.json | |
./kubectl apply -f ${OUT_DIR}/namespace.json | |
fi |
This file contains 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
def convert(self): | |
with Image(filename='glyph.pdf') as img: | |
img.format = 'jpeg' | |
img.background_color = Color('white') | |
img.alpha_channel = 'remove' |
This file contains 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
#!/bin/bash | |
set -e | |
echo $GCLOUD_SERVICE_KEY > $HOME/gcloud-service-key.json | |
gcloud auth activate-service-account --key-file=$HOME/gcloud-service-key.json | |
gcloud --quiet config set project ${GOOGLE_PROJECT_ID} | |
gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE} | |
gcloud --quiet container clusters get-credentials ${GOOGLE_CLUSTER_NAME} |
This file contains 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
kubectl port-forward "$DATABASE_DEPLOYMENT" $DATABASE_FORWARD_PORT:$DATABASE_PORT -n default |
This file contains 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
init-db: | |
machine: true | |
environment: | |
- DATABASE_USER: "deployer" | |
- RAILS_ENV: "staging" | |
- DATABASE_DEPLOYMENT: "deployment/my-postgresql" | |
- DATABASE_FORWARD_PORT: 5432 | |
- DATABASE_PORT: 5432 | |
- DATABASE_HOST: "postgres_db" | |
- GOOGLE_PROJECT_ID: "my_proj" |
OlderNewer