Skip to content

Instantly share code, notes, and snippets.

@anandsunderraman
anandsunderraman / kibanaWatcherWithSlack.json
Created March 17, 2020 17:21
Kibana watcher with slack action
{
"trigger": {
"schedule": {
"interval": "1m" //how frequently you want the alert to run
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
@anandsunderraman
anandsunderraman / logback.xml
Last active February 2, 2024 02:21
logback configuration for structured logging
<?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 / troubleshootingSSLTrustStoreCommands.txt
Last active October 9, 2019 20:39
Troubleshooting trust store issues and ssl
#inspects what is present in the truststore
keytool -list -v -keystore <truststorefile>
#gets certificate of a host via command line
openssl s_client -connect <host>:<port> | tee <cert-contents>
#import certificate into trust store
keytool -import -alias <alias> -file <cert-to-import> -storetype JKS -keystore <truststorefile>
@anandsunderraman
anandsunderraman / arrayToCSV.js
Created September 23, 2019 20:16
Robo 3T array to csv
//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 / mapping.txt
Created April 19, 2019 11:55
Request Body Mapping for AWS API Gateway for form url encoded
#set($inputRoot = $input.path('$'))
#set($tokens = $inputRoot.split('&'))
client_secret=SECRET&$tokens[0]&$tokens[1]&$tokens[2]&$tokens[3]
@anandsunderraman
anandsunderraman / Readme.md
Created December 11, 2018 18:18
Apache Active MQ Local Setup

Apache ActiveMQ Local Setup for MaC

Installation

brew install apache-activemq

Setup

Modify the the activemq.xml located at /usr/local/Cellar/activemq/5.15.8/libexec/conf (general installation location) to have the following xml snippet

This will enable us to access the activemq use the JMXToolBox

@anandsunderraman
anandsunderraman / mongoQuery.js
Last active November 19, 2018 20:42
Mongo db multiple groupBy
//given a set of documents
var db = [
{
"store": {
"storeId": "1",
"storeName: "A"
},
"audit": {
"createdBy": "ME"
}
@anandsunderraman
anandsunderraman / introrx.md
Created June 6, 2018 17:26 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@anandsunderraman
anandsunderraman / curl.md
Created March 2, 2018 05:13 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@anandsunderraman
anandsunderraman / promisedRequest.js
Last active October 19, 2016 14:03
Node.js request with Q promises
//import the http library
var http = require('http'),
//npm install q before requiring it
Q = require('q');
//a js object with options
var googleNewsOptions = {
hostname: 'ajax.googleapis.com',
path: '/ajax/services/search/news?v=1.0&q=nodejs',
method: 'GET'