Skip to content

Instantly share code, notes, and snippets.

View deepakps22's full-sized avatar

Deepak PS deepakps22

View GitHub Profile
<style id="jsbin-css">
.row {
clear: both; }
.cell {
float: left;
border: 1px solid;
width: 30px;
height: 30px;
}
.food {
@deepakps22
deepakps22 / Apache-StringUtils.java
Last active February 4, 2019 08:16
Apache Commons String Utility File Source Code
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@deepakps22
deepakps22 / Spring - StringUtils.java
Created February 4, 2019 08:16
Spring framework String Utility file for my reference
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software

My 2Do tasks

This is just contents of my never ending lists of tasks I tagged in 2Do with read, watch and check tags.

All lists are sorted by priority. I hope to bring all these lists closer to 0 when I get time. But until then, perhaps you will find something interesting in them.

Here are the lists I share so far.

@deepakps22
deepakps22 / Gojek.md
Created October 22, 2019 01:30
Gojek Code Challenge

GopherCon - Code Challenge

Terms and Conditions

  • The Challenge will start on Feb 24 2017 at 11AM and ends on Feb 25 2017 at 11AM
  • Complete the solution. Push the code to your github account and tweet us the link to the repository mentioning @gojektech Twitter handle with Hashtag #GopherConIndia #GCI17
  • Winners will be announced on Feb 25 2017 before 5PM
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<>();
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
public class RequestEntry {
private LocalDateTime localDateTime;
public RequestEntry(final LocalDateTime localDateTime) {
localDateTime.toEpochSecond(OffsetDateTime.now().getOffset());
this.localDateTime = localDateTime;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class LeakyBucket {
public static final int API_REQUEST_LIMIT_OF_THE_SERVER = 5;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadLocalRandom;
public class TokenBucket {
public static final ConcurrentHashMap<String, TokenEntry> userTokenCount = new ConcurrentHashMap<>();
public final static int API_LIMIT_FOR_EACH_USER = 5;