I hereby claim:
- I am pathikrit on github.
- I am pathikrit (https://keybase.io/pathikrit) on keybase.
- I have a public key whose fingerprint is 32D0 C3DF 1F9B ABA2 E61A C553 8F5B 9198 DEFF 220E
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
When I ask for driving directions to somewhere it should suggest "Shall I direct you to the nearest parking spot from your destination"?
When I drive somewhere, I should have advanced options to say that I need to fill gas within the next x miles on the way to my destination.
They should have OBD plugins like automatic.com to do this automatically for most cars.
Sometimes I arrive at my destination but I miss it and direction exits saying that I arrived but I am lost now since I drove passed the address. It should detect that if I drove past my destination and start auto-rerouting.
If I entered a business or restaurant address, it should auto warn if it is closed or closes soon by the time I reach it.
val weekdays = IndexedSeq("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat") | |
def solve(idx: Int*) = (idx foldLeft Seq.empty[(Int, Int)]) { | |
case (ts :+ ((start, end)), x) if x == end + 1 => ts :+ (start, x) | |
case (t, x) => t :+ (x, x) | |
} map { | |
case (start, end) if start == end => weekdays(start) | |
case (start, end) => s"${weekdays(start)}-${weekdays(end)}" | |
} | |
import scala.compat.Platform.{currentTime => now} | |
import scala.concurrent.duration.FiniteDuration | |
import java.util.concurrent.atomic.AtomicBoolean | |
/** | |
* Debounce a function i.e. it can only be invoked iff it is not already running | |
* and atleast wait duration has passed since it last stopped running | |
* Usage: | |
* def test(i: Int) = println(i) |
import java.util.BitSet; | |
import java.util.NavigableSet; | |
import java.util.NoSuchElementException; | |
import java.util.concurrent.ConcurrentSkipListSet; | |
/** | |
* A concurrent sorted set with a fixed bound | |
*/ | |
public class BoundedConcurrentSortedSet { |
import ants.Action; | |
import ants.Ant; | |
import ants.Direction; | |
import ants.Surroundings; | |
import ants.Tile; | |
import java.awt.Point; | |
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.ObjectInputStream; |
var config = require('./config'), request = require('request'), fs = require('fs'), Zip = require('adm-zip'), path = require('path'); | |
var tmpDir = 'tmp'; | |
fs.mkdir(tmpDir); | |
request.post(config.bloomberg.bsym_url, function (err, res, body) { | |
if(err) throw err; | |
var record = eval('(' + body.substring(body.indexOf('{data'), body.lastIndexOf(';'))); | |
record.data.forEach(function(data) { | |
var url = data.uri, name = path.join(tmpDir, url.substring(url.lastIndexOf('/') + 1)); |
import collection.mutable | |
import collection.JavaConversions._ | |
import org.mapdb.DBMaker // Great disk based map - https://github.com/jankotek/MapDB | |
/** | |
* My attempt at http://www.azspcs.net/Contest/Factorials/ | |
* Brief explanation: | |
* Brute force BFS (ignoring non-positive numbers and duplicates) upto length `fbf` | |
* Higher the `fbf`, the better quality result. I managed to get to `fbf`=8 before running out of memory | |
* Beyond `fbf`, try to multiply your way to n! Since the last few steps involve only multiplication, |
/* | |
* Works from dates after Sep 14, 1752 (New System of Gregorian Calendar (UK adoption)) | |
* May crash or return junk value for negative or other invalid inputs. | |
*/ | |
public static String calendar(int d, int m, int y) {return "Sun Mon Tues Wednes Thurs Fri Satur ".substring(d=((6-2*(y/100%4)+(m<3&&y%4==0&&(y%100!=0||y%400==0)?-1:0)+(y%=100)/12+5*(y%12)/4+"xbeehcfhdgbeg".charAt(m)+d)%7)*7,d+7).trim()+"day";} |
import java.util.*; | |
public class Trick { | |
public static void main(String args[]) { | |
System.out.println("/////////////////////////////////////////////////"); | |
HashSet<Long> h = new HashSet(); | |
Long l = (long)4; | |
h.add(l); | |
System.out.println(h.contains(4)); |