Skip to content

Instantly share code, notes, and snippets.

View mmastoras's full-sized avatar

Mark Mastoras mmastoras

  • Foghorn Consulting
  • San Bruno, California
View GitHub Profile
@mmastoras
mmastoras / gist:2038948
Created March 14, 2012 19:44
promote local topic branch to remote tracking branch of same name
#!/bin/sh
#
# Promotes a local topic branch to a remote tracking branch of the same name,
# by pushing and then setting up the git config
#
# Thanks to ENTP:
# http://hoth.entp.com/2008/11/10/improving-my-git-workflow
curr_branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
@mmastoras
mmastoras / gist:2039097
Last active June 11, 2021 18:59
some helpful git commands
setup local branch tracking a remote feature branch
====================================================
git checkout -b <feature branch name> origin/<feature_branch_name>
create new feature branch
=========================
git checkout master
git checkout -b <feature branch name>
create a new local branch tracking a remote branch
@mmastoras
mmastoras / gist:8323716
Created January 8, 2014 20:11
spongelytics deploy
st deploy -a spongelytics -e staging -r production -g jump
reading private key from ~/.ssh/id_rsa
loading dna from ~/.spongetool/environments.yml
servers => ["spongelytics-staging-jump1.spongecell.net", "spongelytics-staging-jump2.spongecell.net"] : ["spongelytics-staging-jump1.spongecell.net", "spongelytics-staging-jump2.spongecell.net"]
["spongelytics-staging-jump1.spongecell.net", "spongelytics-staging-jump2.spongecell.net"]
*** RUNNING ON spongelytics-staging-jump1.spongecell.net
~/ops/scripts/chef_run.sh production
*** spongelytics-staging-jump1.spongecell.net :: Already on 'production'
*** spongelytics-staging-jump1.spongecell.net :: Already up-to-date.
*** spongelytics-staging-jump1.spongecell.net :: Submodule 'apache2' () registered for path 'apache2'
@mmastoras
mmastoras / override_java_version
Last active January 3, 2016 03:59
override java version
hadoop:
chefrun_node:
java:
install_flavor: "oracle"
oracle:
accept_oracle_download_terms: true
@mmastoras
mmastoras / gist:8450683
Created January 16, 2014 06:33
create custom AMI of latest dynode release in region other than US-EAST-1
sudo su - admin
export set EC2_REGION='us-west-1'
export set EC2_HOME=/home/admin/ec2-api-tools-1.6.12.0
/home/admin/ec2-ami-tools-1.4.0.9/bin/ec2-bundle-vol -k /tmp/cert/spongecell_x509.pem -c /tmp/cert/spongecell_x509_cert.pem -u 7915-7448-1547 -e /tmp/cert -i /home/admin/.ssh/authorized_keys,/home/admin/.ssh/id_rsa,/etc/apt/trusted.gpg,/etc/apt/trustdb.gpg -e /home/admin/ec2-ami-tools-1.4.0.9
/home/admin/ec2-ami-tools-1.4.0.9/bin/ec2-upload-bundle -b spongecell-amis-us-weset/dynode-instance-store/ -m /tmp/image.manifest.xml -a AKIAJBHCQSDFDAYVMRKA -s e+NcYgKbxCnvgN0HvgxXo1ySQDxClekc1E4F+H8M --location us-west-1
~/ec2-api-tools-1.6.12.0/bin/ec2-register spongecell-amis-us-weset/dynode-instance-store/image.manifest.xml -n dynode-instance-store -O AKIAJBHCQSDFDAYVMRKA -W e+NcYgKbxCnvgN0HvgxXo1ySQDxClekc1E4F+H8M --region us-west-1
!#/usr/bin/env ruby
# run the rysnc and log the results to current/log/rysnc.log
system(“rsync -rave 'ssh -i /srv/www/test_node_app/current/keys/admin_sever.pem' unbuntu@<admin_server_ip>:/home/unbuntu/nodejs/Test/data/ /srv/www/test_node_app/current/views/components/ > /srv/www/test_node_app/current/log/rsync.log”)
packer build..... 2>&1 | tee packer.log
@mmastoras
mmastoras / gist:c0324be6d316ea2ff116ce1165a94ce4
Last active August 7, 2017 19:15
sed replace string with contents of file
sed -i "s/HIPCHAT_AUTH_TOKEN/$(sed 's:/:\\/:g' hipchat_token)/" hipchat_creds.xml
sed -i "s/HIPCHAT_UUID/{{ salt['pillar.get']('hipchat:credential_id') }}/" /tmp/hipchat_default_creds.xml:
cmd.run:
- runas: jenkins
PolicyDocument" : {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:AttachVolume",
"ec2:CreateVolume",
"ec2:DeleteVolume",
"ec2:CreateKeypair",
@mmastoras
mmastoras / gist:98aa650daaf136556c8e04536c896e25
Created May 8, 2017 03:26
salt-call to get local pillar values
sudo salt-call --local pillar.get jenkins:master:plugin_list