Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Rohit Joshi RohitRox

🎯
Focusing
View GitHub Profile
@RohitRox
RohitRox / dep.js
Created Jun 30, 2020
Find installed version of package dependencies
View dep.js
// $ node dep.js
var fs = require("fs");
function main() {
var packageJsonFile = "package.json";
var packageData = JSON.parse(fs.readFileSync(packageJsonFile));
console.log("devDependencies:");
@RohitRox
RohitRox / ElasticSearchStuff.md
Last active Apr 24, 2020
ElasticSearchStuff
View ElasticSearchStuff.md

list indices

http://localhost:9200/_cat/indices?v

create index

PUT indexName
@RohitRox
RohitRox / readme.md
Created Oct 27, 2019 — forked from pdincau/readme.md
Study Path on microservices
View readme.md
View ES-User-Search.md

ES Document Struct

{
  "_index": "users_index",
  "_type": "_doc",
  "_id": "iam-id-uuid",
  "_score": 1,
  "_source": {
@RohitRox
RohitRox / remove_ds_store_files.sh
Created Mar 25, 2019 — forked from jls/remove_ds_store_files.sh
Remove all of the .DS_Store files in the current directory and all sub directories.
View remove_ds_store_files.sh
find ./ -type f | grep .DS_Store | xargs rm
@RohitRox
RohitRox / js-error-handling.js
Last active Mar 10, 2019
Beautiful Errors in Javascript
View js-error-handling.js
// Try/Catch Basics
try {
//something that causes an error
} catch (err){
// error data
console.log(err.name)
console.log(err.message)
// checking for specific type
console.log(err instanceof(ReferenceError))
@RohitRox
RohitRox / find-ecr-image.sh
Created Feb 19, 2019 — forked from outofcoffee/find-ecr-image.sh
Check if Docker image exists with tag in AWS ECR
View find-ecr-image.sh
#!/usr/bin/env bash
# Example:
# ./find-ecr-image.sh foo/bar mytag
if [[ $# -lt 2 ]]; then
echo "Usage: $( basename $0 ) <repository-name> <image-tag>"
exit 1
fi
IMAGE_META="$( aws ecr describe-images --repository-name=$1 --image-ids=imageTag=$2 2> /dev/null )"
@RohitRox
RohitRox / withRegex.go
Last active Jan 18, 2019
Golang Templating
View withRegex.go
package main
import (
"encoding/json"
"fmt"
"regexp"
"strconv"
)
func main() {
@RohitRox
RohitRox / new-relic-go.go
Last active Dec 20, 2018
New Relic Go Sample
View new-relic-go.go
package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
@RohitRox
RohitRox / clean-docker.sh
Created Nov 25, 2018 — forked from apmiller108/clean-docker.sh
Bash script to clean up docker
View clean-docker.sh
#!/bin/bash
GREEN='\x1B[32m'
RED='\x1B[31m'
NOCOL='\x1B[39m'
echo "${GREEN}Removing exited containers${NOCOL}"
docker rm -v $(docker ps --filter status=dead --filter status=exited -aq)
echo "${GREEN}Removing dangling images${NOCOL}"
docker rmi $(docker images -f "dangling=true" -q)
You can’t perform that action at this time.