I hereby claim:
- I am sangupta on github.
- I am sangupta (https://keybase.io/sangupta) on keybase.
- I have a public key whose fingerprint is 9127 C67F 5CEE 90F2 EC65 83D1 CE65 932B DD59 F1A9
To claim this, I am signing this object:
/** | |
Add the following lines to the original class: | |
org.eclipse.egit.github.core.RepositoryCommit.java | |
*/ | |
private Stats stats; | |
private List<CommitFile> files; | |
public Stats getStats() { |
/** | |
Problem: Given a set of data ranges (i.e. 2-7, 5-9, 10-20), write a function to determine if there is any overlap within the set. | |
Write test cases. Which data structure would be best to represent the intervals. | |
Solution: I would prefer to use an array of size 2N and then iterate over it. Another | |
way is to work up using interval tree's but I think that may be an overkill considering | |
it used to check overlaps in multiple ranges and points. | |
*/ |
I hereby claim:
To claim this, I am signing this object:
import org.slf4j.LoggerFactory; | |
import ch.qos.logback.classic.Level; | |
import ch.qos.logback.classic.Logger; | |
import ch.qos.logback.classic.LoggerContext; | |
import ch.qos.logback.classic.encoder.PatternLayoutEncoder; | |
import ch.qos.logback.classic.spi.ILoggingEvent; | |
import ch.qos.logback.core.FileAppender; | |
public class LogbackConfigureExample { |
This is a simple script to run a Java program from Linux shell in the background - so that the process does not terminates when you log out of the shell.
Usage is simple:
$ ./java-app-run.sh start
var webpage = require('webpage'); | |
var page = webpage.create(); | |
page.viewportSize = { width: 1600, height: 900 }; | |
page.open('http://sangupta.com/poetry/best-of-luck.html', function() { | |
// execute the selector | |
var ev = page.evaluate(function(sel) { | |
var ele = document.querySelector(sel); | |
if(ele) { | |
ele.style.border = "2px solid red"; |
package com.sangupta.jerry.ds.bitarray; | |
import java.io.IOException; | |
import com.sangupta.jerry.util.BitUtils; | |
import com.sangupta.jerry.util.ByteArrayUtils; | |
import net.jcip.annotations.NotThreadSafe; | |
@NotThreadSafe |
The way Internet works is that we first type a domain name in browser: say google.com. The browser then hits the DNS servers for resolution of IP address, so that the browser know which machine to send the request to. The DNS servers return an IP (v4 or v6) against google.com and that IP is then used for all requests going forth. There is a TTL (time to live) associated with every DNS resolution after which the browser is required to re-ask the DNS servers for the new IP again (in case it has changed - this is meant to make sure that in case the machines fail or IPs change - the website can again be reached after the TTL is expired.
Now there are multiple types of DNS records:
Called as Address mapping records - these are used to map a domain/subdomain to a given IP - say,
#!/usr/bin/env python | |
import http.server | |
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): | |
def end_headers(self): | |
self.send_my_headers() | |
http.server.SimpleHTTPRequestHandler.end_headers(self) | |
def send_my_headers(self): | |
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate") |
public class StringJoinBenchmark { | |
public static void main(String[] args) { | |
final int MAX_ITER = 1000 * 1000; | |
final int RUNS = 1; | |
long delta = 0; | |
long delta2 = 0; | |
for(int run = 0; run < RUNS; run++) { |