Skip to content

Instantly share code, notes, and snippets.

View chaudharisuresh997's full-sized avatar
🤓

Suresh Chaudhari chaudharisuresh997

🤓
View GitHub Profile
version: "3.0"
services:
elasticsearch:
container_name: es-container
image: docker.elastic.co/elasticsearch/elasticsearch:6.7.1
#6.4.3
#8.3.2
#7.3.0
#6.4.3
environment:
@chaudharisuresh997
chaudharisuresh997 / docker-compose.yml
Created May 2, 2022 06:48
Kafka and zookeeper YAML
version: "3"
services:
zookeeper:
image: 'bitnami/zookeeper:latest'
ports:
- '2181:2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
@chaudharisuresh997
chaudharisuresh997 / python json to object and object to json.py
Created April 10, 2021 05:58
python json to object and object to json
#https://pynative.com/python-convert-json-data-into-custom-python-object/#:~:text=To%20convert%20JSON%20into%20a,into%20a%20custom%20Python%20type.
#https://www.geeksforgeeks.org/encoding-and-decoding-custom-objects-in-python-json/
import json
from json import JSONEncoder
from collections import namedtuple
class Student:
def __init__(self, name, roll_no, address):
self.name = name
self.roll_no = roll_no
self.address = address
@chaudharisuresh997
chaudharisuresh997 / pythoncheat.py
Created January 14, 2021 10:27
Python3 cheatsheet
#Sort by the fields comparator
student_tuples = [
('john', 'A', 15),
('jane', 'B', 12),
('dave', 'B', 10),
]
sorted(student_tuples, key=lambda student: student[2]) # sort by age
[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
#Connect to pod
kubectl exec --stdin --tty shell-demo-pod -- /bin/bash
#for alpine image
kubectl exec --stdin --tty shell-demo-pod -- /bin/sh
#PING the kubernetes service
>nslookup "endpoint service ip"
#MOngo commands
#switch to collection
@chaudharisuresh997
chaudharisuresh997 / Useful patterns and solutions for every topic in DS
Created June 6, 2020 03:51
Important and Useful links from all over the Leetcode
Important and Useful links from all over the Leetcode
Link:https://leetcode.com/discuss/general-discussion/665604/important-and-useful-links-from-all-over-the-leetcode
By deepika135
Most of the time I want to comeback to a particular post on Leetcode and so I have to bookmark different posts a lot of times. This has led to an increase to the number of my bookmarks a lot. Since there is no option to bookmark your favourite articles on Leetcode, I have been trying to compile a list of all Leetcode's important and useful links. Here is the list I have made till now. Posting it here so as to help the LC community as well. Do let me know the useful and important articles that I have missed. Will add them to this list. This way we all won't have to bookmark many posts on Leetcode and instead just bookmark this post alone.
Hope this helps -
I am trying to compile all the good posts on Leetcode. Comment down whichever I am missing and I will add all of them here -
DP for beginners by @wh0ami - https://leetcode.co
/*
take 1 2 3 4------1thousand two hundread thitry four
limit 10 lakh
*/
public class NumberToWord{
public String numLetters(char ch){
if(ch=='1'){
return "one";
//https://www.interviewbit.com/problems/combination-sum/
public class Solution {
public ArrayList<ArrayList<Integer>> combinationSum(ArrayList<Integer> A, int B) {
ArrayList<ArrayList<Integer>> big=new ArrayList<ArrayList<Integer>>();
if(A.size()==0){
return big;
}
Collections.sort(A);
combination(big,0,A,B,new ArrayList<Integer>(),B);
Collections.sort(big,new Comparator<ArrayList<Integer>>(){
@chaudharisuresh997
chaudharisuresh997 / gocodecoverage.sh
Last active March 18, 2020 11:44
Go Code coverge
gocov test ./... | gocov-xml > coverage.xml
https://github.com/AlekSi/gocov-xml
go get github.com/axw/gocov/gocov
go test workspace/... --coverprofile=coverage.txt
gocov convert coverage.txt > coverage.json
gocov-xml < coverage.json > coverage.xml 
#Go coverage
https://github.com/ory/go-acc
@chaudharisuresh997
chaudharisuresh997 / nestedmap.go
Created February 17, 2020 08:44
Nested Map golang tutorial
package main
import (
"fmt"
"encoding/json"
)
type ProjectAttributes struct{
ProjectId string
Attributes map[string]interface{}
}