Skip to content

Instantly share code, notes, and snippets.

@anandsunderraman
anandsunderraman / logback.xml
Last active February 2, 2024 02:21
logback configuration for structured logging
View logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender class="ch.qos.logback.core.ConsoleAppender" name="stdout">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %5p [appName:%thread:%X{X-B3-TraceId}:%X{X-B3-SpanId}] %logger{40} - %msg%n
</pattern>
</encoder>
</appender>
<appender class="ch.qos.logback.core.ConsoleAppender" name="jsonstdout">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
@anandsunderraman
anandsunderraman / gist:568f55e2201d51a4bd2af1b2e4aafb6a
Created October 5, 2023 19:24 — forked from speric/gist:6096965
vimtutor Lesson Summaries
View gist:568f55e2201d51a4bd2af1b2e4aafb6a
Lesson 1 SUMMARY
1. The cursor is moved using either the arrow keys or the hjkl keys.
h (left) j (down) k (up) l (right)
2. To start Vim from the shell prompt type: vim FILENAME <ENTER>
3. To exit Vim type: <ESC> :q! <ENTER> to trash all changes.
OR type: <ESC> :wq <ENTER> to save the changes.
@anandsunderraman
anandsunderraman / setChromeOptions.js
Last active February 21, 2023 01:07
Selenium Web Driver Set Chrome Options
View setChromeOptions.js
//import the selenium web driver
var webdriver = require('selenium-webdriver');
var chromeCapabilities = webdriver.Capabilities.chrome();
//setting chrome options to start the browser fully maximized
var chromeOptions = {
'args': ['--test-type', '--start-maximized']
};
chromeCapabilities.set('chromeOptions', chromeOptions);
var driver = new webdriver.Builder().withCapabilities(chromeCapabilities).build();
@anandsunderraman
anandsunderraman / GNU-Make.md
Created November 6, 2022 09:53 — forked from rueycheng/GNU-Make.md
GNU Make cheatsheet
View GNU-Make.md
@anandsunderraman
anandsunderraman / mapofmapofstringtostring.json
Created August 24, 2022 13:32
JSON Schema for a map of map of string and string
View mapofmapofstringtostring.json
{
"$defs":
{
"MapStringToString":
{
"type": "object",
"additionalProperties":
{
"type": "string"
}
@anandsunderraman
anandsunderraman / cheatsheet.md
Created May 10, 2022 15:46 — forked from domanchi/cheatsheet.md
[splunk cheatsheet] Splunk snippets, because their syntax is so confusing. #splunk
View cheatsheet.md

Splunk Queries

I really don't like Splunk documentation. Why is it so hard to find out how to do a certain action? So this is a cheatsheet that I constructed to help me quickly gain knowledge that I need.

Analysis

Events over time

index="my_log"
@anandsunderraman
anandsunderraman / arrayToCSV.js
Created September 23, 2019 20:16
Robo 3T array to csv
View arrayToCSV.js
//function to print CSV from an array for robomongo
//place this in .robomongorc.js which should be present in your home directory
//inspired by https://github.com/Studio3T/robomongo/wiki/How-to-export-to-CSV
function toCSV(array) {
let deliminator = ',';
let textQualifier = '\"';
let headers = [];
var data = {};
var count = -1;
@anandsunderraman
anandsunderraman / grpcurlLibrary.go
Created February 4, 2021 14:32
Using grpcurl as a library
View grpcurlLibrary.go
package main
import (
"bytes"
"fmt"
"github.com/fullstorydev/grpcurl"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
@anandsunderraman
anandsunderraman / terminal-git-branch-name.md
Created January 8, 2021 14:56 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Linux/Mac)
View terminal-git-branch-name.md

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@anandsunderraman
anandsunderraman / gist:5852834
Created June 24, 2013 19:34
Regular Expression to Format Currency In Javascript
View gist:5852834
function formatCurrency(amount)
{
//truncate the amount to 0 decimals
//for every digit that is followed by 3 digits and a word boundary
//add a comma
amount = amount.toFixed(0).replace(/(\d)(?=(\d{3})+\b)/g, "$1,");
return amount;
}