Skip to content

Instantly share code, notes, and snippets.

@eanurag
eanurag / GCD.java
Last active Jun 23, 2018
Linear Diophantine Equations - Solve for ax+by = c to find all possible combinations of x and y. Then maximize the total score using x and y.
View GCD.java
package com.eanurag;
public class GCD {
/**
* Euclid's algorithm
*
* @param a
* @param b
@eanurag
eanurag / Crawl.java
Created Apr 28, 2017
Solution for HackerRank - Capture the flag contest. Question number 3: https://www.hackerrank.com/contests/capture-the-flag/challenges/infinite-links
View Crawl.java
package com.eanurag.crawly.singlethread;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
View Original mail with headers
Original Message
Message ID <a0a10befd9ef4ab985a3d005c7776176@fanshaweonline.ca>
Created at: Mon, Mar 20, 2017 at 11:21 PM (Delivered after 6 seconds)
From: postmaster@fanshaweonline.ca
To: Gill58288@techylab.com
Subject: Undeliverable: You can make 10x on your money by next week if you buy this stock now.
SPF: NEUTRAL with IP 209.85.128.181 Learn more
@eanurag
eanurag / Error log
Last active Jan 31, 2017
Retina Macbook Pro early 2015 CPU Panic
View Error log
Anonymous UUID: 37E9F215-ABD5-1725-2E57-043C3C3EA357
Tue Jan 31 07:50:12 2017
*** Panic Report ***
panic(cpu 0 caller 0xffffff80011bfc80): "MCHECK: m_type=1 m=0xffffff810405fe00"@/Library/Caches/com.apple.xbs/Sources/xnu/xnu-3789.31.2/bsd/kern/uipc_mbuf.c:3410
Backtrace (CPU 0), Frame : Return Address
0xffffff9134d53570 : 0xffffff8000cf211c
0xffffff9134d535f0 : 0xffffff80011bfc80
0xffffff9134d53630 : 0xffffff80011c2d9f
View gist:0ade55d38e4f985ef08e
import java.util.Scanner;
public class SodaBottleProblem {
private int totalSodaBottle = 0;
private int freeSodaBottle = 0;
private int remainingBottle = 0;
public int numberOfBottles(int originalNumberOfBottles) {
freeSodaBottle = originalNumberOfBottles;
View gist:5295092
<?php
$p = $_GET['u'];
$the_query = new WP_Query("showposts=1&p=" . $p);
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
<!DOCTYPE html>
<html>
<head>
<!--