Skip to content

Instantly share code, notes, and snippets.

View nikhilsuvarna's full-sized avatar

Nikhil Suvarna nikhilsuvarna

  • Pivotal Software
  • San Francisco, CA
View GitHub Profile

Intro to JSON?

  • A JSON string contains either an array of values, or an object (an associative array of name/value pairs).

  • An array is surrounded by square brackets, [ and ], and contains a comma-separated list of values.

  • An object is surrounded by curly brackets, { and }, and contains a comma-separated list of name/value pairs.

  • A name/value pair consists of a field name (in double quotes), followed by a colon (:), followed by the field value.

  • A value in an array or object can be:

    • A number (integer or floating point)
@nikhilsuvarna
nikhilsuvarna / app_instance_identity_intro_to_envoy.md
Last active August 22, 2023 14:43
Application Instance Identity and Intro to Envoy in PCF
  1. Establish the process-guid for the app :
 cf curl /v2/apps/$(cf app <app_name> --guid)| jq -r '.metadata.guid + "-" + .entity.version'
b06b2901-2093-4be4-9f37-f7788d04ce8c-ff93f0e2-285f-4f18-a6fc-806802f3dde9
  1. Find the hosts where the app instances are running
cf curl v2/apps/$(cf app healthwatch-api --guid)/stats | grep host
@nikhilsuvarna
nikhilsuvarna / generate_csr_mac.md
Last active June 11, 2018 21:54
Generate CSR for wildcard SAN certificate to be used in Cloud Foundry using openssl on OSX

Copy /System/Library/OpenSSL/openssl.cnf to a new file.

Add the following at the end:

[ req ]
req_extensions = v3_req

[ v3_req ]
# Extensions to add to a certificate request
@nikhilsuvarna
nikhilsuvarna / manage_git.md
Last active July 7, 2018 09:07
managing multiple git accounts
  1. Generate keys for your github user email id :
ssh-keygen -t rsa -b 4096 -C "nsuvarna@pivotal.io"
  1. When prompted for the file to save the key, create a new file, in this case id_rsa_pivotal
Enter file in which to save the key (/Users/nsuvarna/.ssh/id_rsa):
@nikhilsuvarna
nikhilsuvarna / extract_consul_agent_log.sh
Created October 11, 2017 23:49
extract a file from multiple tar bundles that have the same file name
for i in `ls -1 logs`
do
# for j in `$i | awk -F "." '{print $1"."$2}'`
# do
tar --strip-components=2 -xvf logs/$i consul_agent/consul_agent.stdout.log
mv consul_agent.stdout.log consul_agent_`echo $i | awk -F "." '{print $1"."$2}'`
#echo $i |awk -F "." '{print $1"."$2}'
done
@nikhilsuvarna
nikhilsuvarna / notes.md
Last active June 25, 2017 02:42
lemur release notes
lemur-release/jobs
lemur-release/config
lemur-release/config/final.yml
lemur-release/config/blobs.yml
lemur-release/src
lemur-release/packages
@nikhilsuvarna
nikhilsuvarna / bosh2.md
Last active September 29, 2017 06:03
bosh2 stuff

v1 vs v2 https://bosh.io/docs/cli-v2-diff.html

bosh2 is strict about SSL certs. If a director has been initialized using bosh1 cli, connecting to the director via bosh2 cli will throw the folowing error :

ubuntu@bosh-stemcell:~$ bosh2 alias-env dev -e 10.193.72.9 
Fetching info:
  Performing request GET 'https://10.193.72.9:25555/info':
    Performing GET request:
@nikhilsuvarna
nikhilsuvarna / get-instance-guid
Created December 27, 2016 15:25
proper way of getting instance guid from diego
get the app guid, query CC to construct the process guid from app-guid+app-version
[11:22]
query the BBS API for the actual lrps for that process guid (and index, if you care)
[11:22]
which will get you the cell id and instance guid for each actual lrp
[11:23]
and then go to that cell and get into the container for that instance guid
@nikhilsuvarna
nikhilsuvarna / rep-output-when-pushing-app.txt
Created December 23, 2016 10:55
rep-output-when-pushing-app
{"timestamp":"1482488862.619482040","source":"rep","message":"rep.request.auction-fetch-state.auction-state.providing","log_level":1,"data":{"method":"GET","request":"/state","session":"151.1.1"}}
{"timestamp":"1482488862.619518518","source":"rep","message":"rep.request.auction-fetch-state.auction-state.containerstore-list.starting","log_level":1,"data":{"method":"GET","request":"/state","session":"151.1.1.1"}}
{"timestamp":"1482488862.619594812","source":"rep","message":"rep.request.auction-fetch-state.auction-state.containerstore-list.complete","log_level":1,"data":{"method":"GET","request":"/state","session":"151.1.1.1"}}
{"timestamp":"1482488862.619611740","source":"rep","message":"rep.request.auction-fetch-state.auction-state.volume-drivers.list-drivers.start","log_level":1,"data":{"method":"GET","request":"/state","session":"151.1.1.3.1"}}
{"timestamp":"1482488862.619623423","source":"rep","message":"rep.request.auction-fetch-state.auction-state.volume-drivers.list-drivers.end","log_level":1,"data":{"me