Skip to content

Instantly share code, notes, and snippets.

View chaudharisuresh997's full-sized avatar
🤓

Suresh Chaudhari chaudharisuresh997

🤓
View GitHub Profile
@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)]
@rmoff
rmoff / docker-compose.yml
Last active June 2, 2024 17:14
Docker-Compose for Kafka and Zookeeper with internal and external listeners
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
@asoorm
asoorm / docker-compose-mongo-replicaset.yml
Created September 14, 2018 19:00
Mongo Replica Set docker compose
version: "3"
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
expose:
- 27017
ports:
- 27011:27017
package main
import (
"encoding/json"
"fmt"
)
func main() {
b := []byte(`{"key":"value"}`)
@przbadu
przbadu / react-on-docker.md
Last active May 12, 2024 15:34
Setup Docker for React development

STEP 2: setup docker to run react app (dev and production) configuration: https://gist.github.com/przbadu/929fc2b0d5d4cd78a5efe76d37f891b6

Setup Docker for React development

Because we are using Docker, we are not going to install node, npm, create-react-app in our development machine, not even for generating create-react-app scaffold.

For this purpose I am using 2-step docker configuration:

  • In first step, we will create a simple docker container, that does only one thing, install create-react-app
@jprante
jprante / hyphen-tokenizer.sh
Last active April 13, 2023 06:55
Hyphen Tokenizer Demo
DELETE /test
PUT /test
{
"index" : {
"analysis" : {
"analyzer" : {
"default" : {
"type" : "custom",
"tokenizer" : "hyphen",
"filter" : [
@pmn
pmn / recordize.go
Last active August 7, 2021 19:12
Convert an interface{} containing a slice of structs to [][]string (used in CSV serialization) [golang reflection example] Runnable example here: http://play.golang.org/p/ZSJRxkpFs9
// Convert an interface{} containing a slice of structs into [][]string.
func recordize(input interface{}) [][]string {
var records [][]string
var header []string // The first record in records will contain the names of the fields
object := reflect.ValueOf(input)
// The first record in the records slice should contain headers / field names
if object.Len() > 0 {
first := object.Index(0)
typ := first.Type()
@patrickmn
patrickmn / observer.go
Created January 2, 2012 09:12
Go observer pattern example
package main
import (
"fmt"
"sync"
"time"
)
var wg *sync.WaitGroup
@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork [email protected]