Skip to content

Instantly share code, notes, and snippets.

View gkumarau's full-sized avatar

Gourav Narang gkumarau

View GitHub Profile
@gkumarau
gkumarau / json_comment_example.json
Created September 24, 2018 02:27
This is a bad way of putting comments in a json file.
{
"data": "value",
"_comment": "comment for above line"
}
@gkumarau
gkumarau / duplicate_values_sample.json
Created September 24, 2018 02:36
This is an example of JSON based environment configuration file where IP address is duplicated multiple times.
{
"environment_config": {
"app": {
"name": "Sample App",
"url": "http://10.0.0.120:8080/app/",
},
"database": {
"name": "mysql database",
"host": "10.0.0.120",
"port": 3128,
@gkumarau
gkumarau / monitoring_sample_config.json
Last active October 1, 2018 01:22
This file list some sample services in three different environments to monitor.
{
"environments": [{
"name": "prod",
"services": [
"https://service1.prod.example.com",
"https://service2.prod.example.com",
"https://service3.prod.example.com",
"https://service4.prod.example.com"
]
},
@gkumarau
gkumarau / jsonnet_comment_example.jsonnet
Created October 1, 2018 00:01
Jsonnet Comment example
{
"data": "value"
// This is a comment.
/* Another comment. C-style */
# One more comment. Python-style
}
@gkumarau
gkumarau / jsonnet_local_variables_example.jsonnet
Last active January 18, 2019 01:28
A simple example to demonstrate use of local variables in Jsonnet.
local host = '10.0.0.120'; // Standard local variable ends with semicolon(;).
local http_port = 8080;
{
local db_port = 3128, // A local variable next to JSON fields ends with comma(,).
app_protocol:: 'http', // A special hidden variable next to fields use (::) instead of (=) or (:).
environment_config: {
app: {
name: 'Sample app',
url: $.app_protocol + '://' + host + ':' + http_port + 'app/'
@gkumarau
gkumarau / monitoring_sample_config.jsonnet
Created October 1, 2018 01:36
This file demonstrates the use of variables and loops for object and arrays in the JSON configuration using Jsonnet.
local environments = [ 'prod', 'test', 'dev' ];
local services = [ 'service1', 'service2', 'service3', 'service4' ];
{
environments: [
{
name: env,
services: [
'https://%s.%s.example.com' % [service, env]
for service in services

Keybase proof

I hereby claim:

  • I am gkexpert on github.
  • I am gourav (https://keybase.io/gourav) on keybase.
  • I have a public key ASBZUGcuoHO2mD5Oh7Or_SNO2Q8rcLtd0Z2tqQtyI-JR7wo

To claim this, I am signing this object:

{
"title": "Stories by Gourav Kumar on Medium",
"home_page_url": "https://medium.com/@gkumarau",
"stories": [
{
"guid": "https://medium.com/p/77d90374fdae",
"url": "https://blog.usejournal.com/3-practical-ways-to-grow-your-money-revealed-by-a-software-engineer-77d90374fdae?source=gouravkumar.dev",
"title": "3 Practical Ways to Grow your Money: Revealed by a Software Engineer.",
"image": "https://cdn-images-1.medium.com/max/2600/1*LmBUQtv7TiLyQPtOW6_7uQ.jpeg",
"summary": "In this post, I'll present real actions that I've taken to grow my money and give insights about what worked and what didn't work for me.",