Skip to content

Instantly share code, notes, and snippets.

View gauravkhare's full-sized avatar
🏠
Working from home

Gaurav Khare gauravkhare

🏠
Working from home
  • Bangalore, IND
View GitHub Profile
import java.util.SortedMap;
import java.util.TreeMap;
public class ConsistentHashing {
// Consistent Hashing with Ring having 50 buckets.
final static int LIMIT = 50;
// Sorted Map.
final static SortedMap<Integer, String> bucketIdToServer = new TreeMap<>();
public class ThreeSmallestElement {
public static void leastThreeElements(int [] arrA){
if(arrA.length<3){
System.out.println("Invalid Input, array size is less than 3");
}
int first=Integer.MAX_VALUE;
int second=Integer.MAX_VALUE;
int third = Integer.MAX_VALUE;
@iwangu
iwangu / no-coding-assigment.md
Last active September 27, 2021 01:30 — forked from fasiha/no-hackerrank.md
A prospective employer invited me to do a HackerRank test. Here's my proposed alternative.

Hi there! Thanks for offering me a coding assigment test. I see that this can be a useful method to compare different candidates applying for the XYZ-Role. I would like to kindly ask if you have some leeway in finding an alternative way to evaluate my coding skills? I have written a number of open-source projects/spoke at conferences/worked as a coding-teacher/did XYZ and I would love to showcase this to your engineers:

LIST STUFF YOU DID

These are just some projects I picked that demonstrate not just skill in programming but also in math, design and XYZ.

Please can I kindly ask you to check with your engineers and/or the hiring manager to perhaps have a look/conduct a code review and/or ask me to add a feature or resolve a bug?

I checked that ABC is doing a lot of XYZ and I opened a Github issue extra for ABC (LINK TO GITHUB ISSUE). I can program this feature/fix that bug within a given timeframe and then discuss the written code with one of your engineers?

@terabyte
terabyte / amazon.md
Created December 6, 2017 02:27
Amazon's Build System

Prologue

I wrote this answer on stackexchange, here: https://stackoverflow.com/posts/12597919/

It was wrongly deleted for containing "proprietary information" years later. I think that's bullshit so I am posting it here. Come at me.

The Question

Amazon is a SOA system with 100s of services (or so says Amazon Chief Technology Officer Werner Vogels). How do they handle build and release?

@Pulimet
Pulimet / AdbCommands
Last active April 11, 2025 22:56
Adb useful commands list
Hi All!
I've recently launched a tool that wraps many of the commands here with a user interface. This desktop application is currently available for macOS. There's a roadmap outlining planned features for the near future.
Feel free to request any features you'd like to see, and I'll prioritize them accordingly.
One of the most important aspects of this application is that every command executed behind the scenes is displayed in a special log section. This allows you to see exactly what’s happening and learn from it.
Here's the link to the repository: https://github.com/Pulimet/ADBugger
App Description:
ADBugger is a desktop tool designed for debugging and QA of Android devices and emulators. It simplifies testing, debugging, and performance analysis by offering device management, automated testing, log analysis, and remote control capabilities. This ensures smooth app performance across various setups.
@andrewmarmion
andrewmarmion / Parcelable.java
Created March 21, 2017 20:08
An example of a class that implements Parcelable
import android.os.Parcel;
import android.os.Parcelable;
public class Person implements Parcelable {
private String name;
private int age;
private String email;
private boolean hasPhone;
// Constuctor
@yaravind
yaravind / spark-rest-submit.sh
Last active October 30, 2020 02:43
Submit apps (SparkPi as e.g.) to spark cluster using rest api
curl -X POST -d http://master-host:6066/v1/submissions/create --header "Content-Type:application/json" --data '{
"action": "CreateSubmissionRequest",
"appResource": "hdfs://localhost:9000/user/spark-examples_2.11-2.0.0.jar",
"clientSparkVersion": "2.0.0",
"appArgs": [ "10" ],
"environmentVariables" : {
"SPARK_ENV_LOADED" : "1"
},
"mainClass": "org.apache.spark.examples.SparkPi",
"sparkProperties": {
@eamelink
eamelink / recursion-and-trampolines-in-scala.md
Last active March 30, 2025 07:12
Recursion and Trampolines in Scala

Recursion and Trampolines in Scala

Recursion is beautiful. As an example, let's consider this perfectly acceptable example of defining the functions even and odd in Scala, whose semantics you can guess:

def even(i: Int): Boolean = i match {
  case 0 => true
  case _ => odd(i - 1)
}

def odd(i: Int): Boolean = i match {

@Frozenfire92
Frozenfire92 / gist:3627e38dc47ca581d6d024c14c1cf4a9
Last active December 15, 2024 08:15
Install Scala and SBT using apt-get on Ubuntu 16.04 or any Debian derivative using apt-get
## Java
sudo apt-get update
sudo apt-get install default-jdk
## Scala
sudo apt-get remove scala-library scala
sudo wget http://scala-lang.org/files/archive/scala-2.12.1.deb
sudo dpkg -i scala-2.12.1.deb
sudo apt-get update
sudo apt-get install scala