- Use terraform, or other declarative infrastructure
- Use Organizations for billing. Set up an Org account, with an Infra account for build artifacts/login, and development, staging, and prod accounts with appropriate permissions.
- Developers should all have admin permissions in dev, and only necessary permissions in staging and prod. Staging should be exactly like prod except that customers aren't using it. Dev should be as close as possible, with any changes being backed out and repeated in staging before they make it to staging.
#!/bin/bash | |
# Script to | |
# Relies on non-standard programs - ts(moreutils) | |
set -eux -o pipefail | |
labels="${1:-}" | |
if [[ $labels = "-h" ]] || [[ $labels = "--help" ]] | |
then |
kubectl --context CLUSTER run --image ubuntu pgtool -- /bin/bash -c "apt-get update; apt-get install -y postgresql-client; sleep 86400" | |
kubectl --context gke_lido-staging_us-east1_lido-staging-us-east1 run --image redis redis -- /bin/bash -c "sleep 86400" |
This is way more complicated than it should be. The following conditions need to be met :
- need to be able to track and merge in upstream changes
- don't want remote commit messages in master
- only interested in sub-directory of another repo
- needs to go in a subdirectory in my repo.
In this particular case, I'm interested in bringing in the 'default' template of jsdoc as a sub-directory in my project so I could potentially make changes to the markup it genereates while also being able to update from upstream if there are changes. Ideally their template should be a separate repo added to jsdoc via a submodule -- this way I could fork it and things would be much easier.... but, it is what it is.
After much struggling with git, subtree and git-subtree, I ended up finding this http://archive.h2ik.co/2011/03/having-fun-with-git-subtree/ -- it basically sets up separate branches from tracking remote, the particular sub-directory, and uses git subtree contrib module to pull it all togther. Following are
func openbrowser(url string) { | |
var err error | |
switch runtime.GOOS { | |
case "linux": | |
err = exec.Command("xdg-open", url).Start() | |
case "windows": | |
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start() | |
case "darwin": | |
err = exec.Command("open", url).Start() |
#See: http://daringfireball.net/2010/07/improved_regex_for_matching_urls | |
import re, urllib | |
GRUBER_URLINTEXT_PAT = re.compile(ur'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))') | |
for line in urllib.urlopen("http://daringfireball.net/misc/2010/07/url-matching-regex-test-data.text"): | |
print [ mgroups[0] for mgroups in GRUBER_URLINTEXT_PAT.findall(line) ] | |