This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A working version of remotecommand | |
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"os" | |
"strings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install git, vim | |
# instance => e2-standard-4 (4 vCPU, 16GB Memory) | |
# Copy all jdks into a folder | |
gcloud compute copy-files ./* els:/home/touchps/softwares/jdk --zone "us-central1-a" | |
# add git prompt from following | |
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh | |
# Increase the inotify limit | |
# cat /proc/sys/fs/inotify/max_user_watches |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adding coordinates <longitude, latitude> | |
# Longtude Degree horizontal (east) | |
# Latitide Degree vertical (North) | |
GEOADD gpo 77.5839739 12.910647 "Home" | |
GEOADD gpo 77.6965459 12.939111 "SLV Residency" | |
GEOADD gpo 77.6102169 12.935152 "Forum Mall" | |
GEOADD gpo 77.5964085 12.91486 "Freshco Supermarket" | |
GEOADD gpo 77.64062 12.892286 "Myntra Designs Pvt Ltd" | |
# Stored as sorted set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET _search | |
{ | |
"query": { | |
"match_all": {} | |
} | |
} | |
GET prodbuilds/_search { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Client } = require('@elastic/elasticsearch'); | |
const { URL } = require('url'); | |
let nodes = [{url: new URL("http://<server:port>")}, {url: new URL("<server:port>")},{url: new URL("<server:port>")}]; | |
const client = new Client({ | |
node: nodes, | |
maxRetries: 5, | |
requestTimeout: 60000, | |
sniffOnStart: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this fails as json parsing happens 3 times, docker input itself, then json, then decode_json_fields | |
filebeat.inputs: | |
- type: docker | |
combine_partial: true | |
containers: | |
path: '/var/lib/docker/containers' | |
stream: 'all' | |
ids: | |
- "0db62a3d99474712c297e6f517c89b0a6f5bdf77648fbb5d03fa93d17c58d0ab" | |
json.message_key: log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is not a group, all subscriber receives the message | |
*/ | |
package main | |
import ( | |
nats "github.com/nats-io/go-nats" | |
"fmt" | |
"sync" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MongoClient = require('mongodb').MongoClient; | |
const assert = require('assert'); | |
// Connection URL | |
const user = encodeURIComponent('username'); | |
const password = '************'; | |
const url = `mongodb://${user}:${password}@d7mongo41.company.com:27017,d7mongo41.company.com:27018,d7mongo41.company.com:27019/?authSource=dome&replicaSet=rs0`; | |
//const url = `mongodb://${user}:${password}@d7mongo41.company.com:27017?authSource=admin`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"flag" | |
"path/filepath" | |
"k8s.io/client-go/kubernetes" | |
"k8s.io/client-go/util/homedir" | |
"k8s.io/client-go/tools/clientcmd" | |
corev1 "k8s.io/api/core/v1" | |
batchv1 "k8s.io/api/batch/v1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loc, _ := time.LoadLocation("Asia/Kolkata") | |
format := "Jan _2 2006 3:04:05 PM" | |
fp1_time_string := "Mar 15 2019 06:30:00 AM" | |
fp2_time_string := "Mar 15 2019 10:30:00 AM" | |
fp1_time, _ := time.ParseInLocation(format, fp1_time_string, loc) | |
fp2_time, _ := time.ParseInLocation(format, fp2_time_string, loc) |
NewerOlder