Skip to content

Instantly share code, notes, and snippets.

View ob1-sc's full-sized avatar

Simon O'Brien ob1-sc

  • VMware
  • United Kingdom
View GitHub Profile
@ob1-sc
ob1-sc / bosh-cheat-sheet
Last active March 1, 2018 14:28
BOSH - Cheat Sheet
# Configure local alias
bosh alias-env <bosh alias name> -e <bosh director ip> --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca)
# Log in to the Director
export BOSH_CLIENT=admin
export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password`
# Query the Director for more info
bosh -e <bosh alias name> env
@ob1-sc
ob1-sc / concourse-cheat-sheet
Last active March 1, 2018 14:28
Concourse - Cheat Sheet
cat <yaml to patch> | yaml-patch -o <yaml patch file> > <patched yaml>
@ob1-sc
ob1-sc / ssh-key
Created March 1, 2018 14:28
Generate SSH Key
# generate ssh private/public key
ssh-keygen -t rsa -b 4096 -C "[email protected]"
# start ssh agent in background
eval "$(ssh-agent -s)"
# add ssh private key to agent
ssh-add ~/.ssh/id_rsa
# copy to clipboard (xclip needs to be installed)
@ob1-sc
ob1-sc / disable-dell-nipple
Last active May 6, 2018 19:53
Disable Dell Nipple :)
Add the following script to /etc/profile.d
#!/bin/bash
xinput -set-prop "DualPoint Stick" "Device Enabled" 0
@ob1-sc
ob1-sc / masked-input-bat-script
Created May 9, 2018 18:12
Accept masked input from bat script
@echo off
set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -AsSecureString ; ^
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set password=%%p
echo %password%
@ob1-sc
ob1-sc / git-execute-perm
Created June 18, 2018 11:55
Add execute permission in git
git update-index --chmod=+x <file>
@ob1-sc
ob1-sc / tile_plan_extraction
Created July 17, 2018 15:12
Extract named plan from tile properties
PLANS_PROPERTY=".properties.rds_postgres_plans"
PLAN_NAME=".properties.rds_postgres_plans"
jq --arg plans_property "$PLANS_PROPERTY" --arg plan_name "$PLAN_NAME" '.properties | to_entries[] | select(.key == $plans_property) | .value.value[] | select(.name.value == $plan_name)'
@ob1-sc
ob1-sc / flatten_tile_plan_properties
Created July 17, 2018 15:14
Flatten tile plan properties
[to_entries[] | {(.key) : .value.value}] | reduce .[] as $item ({}; . + $item)
@ob1-sc
ob1-sc / sudo-sshpass-remote
Created September 4, 2018 10:53
Run script on remote server as sudo
#!/bin/bash
SUDO_PWD=superSecurePassword
ROOT_USER=root
SERVER=10.0.0.097879879
SCRIPT_TO_RUN=script_to_run.sh
SUDO_ECHO_SCRIPT=sudo_echo.sh
# generate script to run on remote server
@ob1-sc
ob1-sc / gorouter-routes
Created September 5, 2018 09:45
List gorouter routes
# 1) ssh into gorouter
# 2) get router_status credentials from /var/vcap/jobs/gorouter/config/gorouter.yml or from bosh manifest router job
# 3) get routes
curl "http://router_status:<router_status password>@127.0.0.1:8080/routes" | python -m json.tool