Skip to content

Instantly share code, notes, and snippets.

View RohitRox's full-sized avatar
🎯
Focusing

Rohit Joshi RohitRox

🎯
Focusing
View GitHub Profile
@RohitRox
RohitRox / docker-compose.yml
Created December 9, 2022 14:41
Kafka Docker compose setup
version: '3.1'
services:
zookeeper:
image: confluentinc/cp-zookeeper:5.3.1
ports:
- '2181:2181'
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
@RohitRox
RohitRox / axiosErrorDecorator.ts
Created November 29, 2021 16:36
Axios Error Decorator
import { AxiosError } from "axios";
/**
* Decorator for service instance methods that does ajax calls
* @param {string} message - ajax operation name
* @param {any=} defaultData - optional default data to return if ajax call fails
*/
export function axiosError(message: string, defaultData?: any) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
const originalMethod = descriptor.value;
@RohitRox
RohitRox / echo.proto
Created May 8, 2021 13:17
A gRPC example in Golang
syntax = "proto3";
option go_package = "protos/";
message Msg {
string Text = 1;
}
service Echo {
rpc Hello(Msg) returns(Msg);
@RohitRox
RohitRox / jaeger_sample.go
Created January 18, 2021 15:15
Golang Jaeger Integration
package main
import (
"context"
"fmt"
"github.com/opentracing/opentracing-go"
"github.com/uber/jaeger-client-go"
"github.com/uber/jaeger-client-go/config"
)
@RohitRox
RohitRox / dep.js
Created June 30, 2020 16:32
Find installed version of package dependencies
// $ 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 April 24, 2020 21:50
ElasticSearchStuff

list indices

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

create index

PUT indexName
@RohitRox
RohitRox / Readme.md
Last active December 9, 2022 14:42 — forked from pdincau/readme.md
Study Path on microservices
@RohitRox
RohitRox / ES-User-Search.md
Last active May 30, 2019 08:01
ES-User-Search

ES Document Struct

{
  "_index": "users_index",
  "_type": "_doc",
  "_id": "iam-id-uuid",
  "_score": 1,
  "_source": {
@RohitRox
RohitRox / remove_ds_store_files.sh
Created March 25, 2019 13:58 — forked from jls/remove_ds_store_files.sh
Remove all of the .DS_Store files in the current directory and all sub directories.
find ./ -type f | grep .DS_Store | xargs rm
@RohitRox
RohitRox / js-error-handling.js
Last active March 7, 2022 06:30
Beautiful Errors in Javascript
// 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))