Skip to content

Instantly share code, notes, and snippets.

View response.json
{
"keywords": [
[
"boarding pass qr code spoofing software",
26.10909090909091
],
[
"improved boarding pass authentication systems",
22.90909090909091
],
View sanitize_the_number.py
import datetime
def convert_from_string(number):
nums = number.split(".")
real_num = 0
count = len(nums)
for idx, num in enumerate(nums):
if idx < count - 1:
real_num += int(num) * (1000**(count - idx - 1))
View UserBasedRecommendation
package com.company;
import lombok.extern.slf4j.Slf4j;
import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.impl.common.LongPrimitiveIterator;
import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood;
import org.apache.mahout.cf.taste.impl.neighborhood.ThresholdUserNeighborhood;
import org.apache.mahout.cf.taste.impl.recommender.CachingRecommender;
import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender;
View MapUtil.java
/**
* An utility to encode the point in GoogleMap API
* Reference see this {@link https://developers.google.com/maps/documentation/utilities/polylinealgorithm?csw=1}
* @author SRIN
*
*/
public class MapUtil {
/**
* Step 1 : Take the decimal value and multiply it by 1e5, rounding the
View gist:4f3069210c74a3bbfd90
public double findSuitableDensity(int[] v, int[] w) {
int s=v.length;
double[] d= new double[s];
for(int i=0; i<s; i++){
d[i]=(double)w[i]/(double)v[i];
}
double minDS=0.0;
boolean first=true;
for(int ii=0; ii<s; ii++){
View gist:11286094
Problem Statement
    
Cat Taro has N cards. Exactly two integers are written on each card. You are given two int[]s first and second, each with N elements. For each i, the element first[i] represents the first integer on the i-th card, and the element second[i] represents the second integer on the i-th card.
It is known that for each x from 1 to N, inclusive, there is exactly one card with the first integer equal to x. In other words, all elements of first represent a permutation of integers from 1 to N, inclusive. On the other hand, second may contain duplicates, but all elements of second are only between 1 and 10, inclusive.
You are also given an int K. Taro wants to choose some subset of the cards (possibly none or all of them) in such a way that the total number of different integers written on the cards is less than or equal to K. Return the total number of ways to do that.
Definition
    
View gist:9776475
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" xmlns:app="http://schemas.android.com/apk/res/com.srin.flores">
<android.support.v4.view.ViewPager
android:id="@+id/pagerContent"
android:layout_width="match_parent"
View gist:9762847
/*
Combine tab into actionbar,
i'm using pager sliding tab strinb (https://github.com/astuetz/PagerSlidingTabStrip)
*/
package com.srin.flores;
import android.app.ActionBar;
import android.content.Context;
import android.os.Bundle;