Snippets: yaml/json

Natarajan Santhosh
1 min readApr 1, 2020

--

helm yaml conditional if variable dockerconfigjson is present/defined

values.yaml

dockerconfigjson: foo==

kubeTemplate

{{- if .Values.dockerconfigjson }}
apiVersion: v1
data:
.dockerconfigjson: {{ .Values.dockerconfigjson }}
kind: Secret
metadata:
creationTimestamp: null
name: docker-creds
namespace: {{ .Values.namespace }}
type: kubernetes.io/dockerconfigjson
---
{{ end }}
https://stackoverflow.com/questions/62835605/if-clause-in-helm-chart

cat t.json|jq -r .[].sis_user_id

to extract json array id’s

git add .gitpod.ymlgit commit -m ‘gitpod initial commit’git commit --amend --no-editgit push --force-with-lease origin new_pod

[{
“id”: “1”,
“name”: “Abe Keefe”,
“created_at”: “2020–04–01T09:39:20–06:00”,
“sortable_name”: “Abe, Keefe”,
“short_name”: “Abe, Keefe”,
“sis_user_id”: “U-1000008M”,
“integration_id”: null,
“login_id”: “U-1000008M”,

}]

AWS Workspace

to ssh/scp

ssh -v ‘corp\username’@18.200.50.210

scp login_*_110k.csv ‘corp\username’@18.200.50.210:~/

Random array to json in jmeter

def start_point=Math.abs(new Random().nextInt() % (all_teachers.size()-31) + 1)

def ran_list=all_teachers[start_point..start_point+30]

import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
def json_str= new JsonBuilder(ran_list);

select count(*),to_char(created_at,'mm') as mon,extract(year from created_at) as yyyy from cluster1_shard1.enrollments group by 2,3 order by 3 desc,2 desc;

extract csrf token from request header

Set-Cookie:\s*_csrf_token=(.+?);

to use csrf for subsequent requests, decode

vars.putObject(“csrf2”, “${__urldecode(${csrf2})}”)

regex to extract ; seperated values

X-Canvas-Meta:.*;i\=(\d+);

--

--

No responses yet