Skip to content

Instantly share code, notes, and snippets.

View hocyadav's full-sized avatar
😌
Working from home

Hariom Yadav hocyadav

😌
Working from home
View GitHub Profile
/* Deleting a node from Binary search tree */
#include<iostream>
using namespace std;
struct Node {
int data;
struct Node *left;
struct Node *right;
};
//Function to find minimum in a tree.
Node* FindMin(Node* root)
@DevoKun
DevoKun / kafka.md
Created July 13, 2018 02:52
How to operate Kafka, mostly using Docker

Kafka Distributed Streaming Platform

Publish and Subscribe / Process / Store

Start Kafka

  • Kafka uses ZooKeeper as a distributed backend.

Start Zookeeper

public class AutoSuggestion {
private static final int TEN_THOUSAND_REQUESTS = 10000;
private static final int START = 0;
private static final String SEPARATOR = "--------------------------------------------------------------------" +
"---------------------------------------------------------------";
public static void main(String[] args) {
/*
@zulhfreelancer
zulhfreelancer / zsh-timestamp.md
Last active February 12, 2024 14:52
How to add timestamp on right hand side of ZSH / iTerm2 terminal prompt?

Add the following snippet at the bottom of ~/.zshrc file.

Option 1 - Just time

RPROMPT='[%D{%L:%M:%S}] '$RPROMPT
@hocyadav
hocyadav / console.sql
Last active March 13, 2021 02:50
important sql query
select * from movies;
-- create table + insert data + drop delete table
create table emp(
id int primary key auto_increment,
depid int default 1,
salary float default 0,
name varchar(5) not null
);
insert into emp(depid, salary, name)
@zulhfreelancer
zulhfreelancer / delete-all-evicted-pods.sh
Last active July 4, 2024 10:05
How to delete all evicted pods from all namespaces?
#!/bin/bash
# This script is for Mac OSX users. If you are on Linux, replace 'gxargs' with 'xargs'.
# To install 'gxargs' command using Homebrew, run 'brew install findutils' first.
# Without parallel (ideal for small number of pods)
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | gxargs -n 1 -d '\n' bash -c 'kubectl delete pod $0 $1 --force --wait=false'
# With parallel (ideal for big number of pods)
# To install 'parallel' command using Homebrew, run 'brew install parallel' first.