Skip to content

Instantly share code, notes, and snippets.

View malston's full-sized avatar

Mark Alston malston

View GitHub Profile
➜ bosh-lite git:(master) CF_HOME=/tmp/cf2 cf login -a https://api.10.244.0.34.xip.io -u admin -p admin --skip-ssl-validation
API endpoint: https://api.10.244.0.34.xip.io
Authenticating...
OK
Targeted org jdk-org
Targeted space jdk-space
@malston
malston / git-serve.md
Last active August 29, 2015 14:23 — forked from datagrok/git-serve.md

Launch a one-off git server from any local repository.

I [tweeted this already][1] but I thought it could use some expansion:

Enable decentralized git workflow: git config alias.serve "daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/"

Say you use a git workflow that involves working with a core "official" repository that you pull and push your changes from and into. I'm sure many companies do this, as do many users of git hosting services like Github.

Say that server, or Github, goes down for a bit.

go get github.com/concourse/autopilot
cf install-plugin $GOPATH/bin/autopilot
cf login -a ${CF_URL_US_SOUTH} -u ${CF_USERNAME} -p ${CF_PASSWORD} -o ${CF_ORG} -s ${CF_SPACE}
cf zero-downtime-push myapp -f manifest.yml
@malston
malston / update_opsmanager_hostname.sh
Created May 11, 2016 21:01 — forked from mandarjog/update_opsmanager_hostname.sh
After a 1.7+ opsmanager restarts with a new ip address, this script will update it in the database
#!/bin/bash
# After a 1.7+ opsmanager restarts with a new ip address
# ssh into the opsmanager as 'ubuntu' and
# Run this file from the opsmanager as follows
# sudo su -l postgres < thisfile.sh >
# Get the current public ip or hostname from aws metadata
HN=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
@malston
malston / upload_pivnet_product
Last active May 31, 2016 16:40
upload_pivnet_product
upload_product() {
PRODUCT_FILE=$1
OPSMGR_HOST=$2
OPSMGR_USER=$3
OPSMGR_PASSWORD=$4
OPSMGR_IP=$5
LOG_FILE=upload.txt
if [ -z $OPSMGR_IP ]; then
curl -k -XPOST -H "Application/json" -H "Host: $OPSMGR_HOST" -u "opsman:" \
--data "username=$OPSMGR_USER&password=$OPSMGR_PASSWORD&client_id=opsman&grant_type=password&response_type=token" \
@malston
malston / downloadJarFromNexus
Last active October 26, 2022 13:02
A bash script to download any jar from nexus
#!/bin/bash
# Argument = -h -v -i groupId:artifactId:version -c classifier -p packaging -r repository
#shopt -o -s xtrace
# Define Nexus Configuration
NEXUS_BASE=${NEXUS_BASE-:http://repository.example.com:8081/nexus}
REST_PATH=/service/local
ART_REDIR=/artifact/maven/redirect
@malston
malston / gist:f2f63451b5bb363fc95e2c5f36dc14e6
Created March 18, 2018 17:03 — forked from chrissimpkins/gist:5bf5686bae86b8129bee
Atom Editor Cheat Sheet (Sweetmeat)

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@malston
malston / ca.md
Created July 2, 2018 22:42 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@malston
malston / create-nsx-certs.sh
Created December 20, 2018 22:46
Generate an ssl certificate for nsx edge
#!/bin/bash -e
NSX_MANAGER=nsxmgr-01.cf.markalston.net
NSX_USER=admin
if [ -z "$NSX_PASSWORD" ]; then
echo "NSX_PASSWORD must be set"
return 1
fi