Skip to content

Instantly share code, notes, and snippets.

View avipars's full-sized avatar
🎯
Focusing

Avi avipars

🎯
Focusing
View GitHub Profile
@avipars
avipars / PermissionsHelper.java
Created October 25, 2015 17:05 — forked from odedhb/PermissionsHelper.java
A simple class for Android Marshmallow. Showing a list of permissions, and allowing the user to change them. This was created to be implemented in http://wheredatapp.com, android's greatest search engine.
package com.nextstagesearch;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
@avipars
avipars / activity_main.xml
Last active February 2, 2017 16:51
Material Help
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.aviparshan.idfinfo.MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
package com.aviparshan.flashlight;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AppCompatActivity;
import com.afollestad.materialdialogs.MaterialDialog;
@avipars
avipars / LocaleUtils.java
Created March 4, 2017 21:10 — forked from GigigoGreenLabs/LocaleUtils.java
Change the locale language inside the app
import android.app.Application;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.view.ContextThemeWrapper;
import java.util.Locale;
public class LocaleUtils {
@avipars
avipars / DeCryptor.java
Created March 18, 2017 21:29 — forked from JosiasSena/DeCryptor.java
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@avipars
avipars / User.java
Created April 25, 2017 10:01
JSON Parser POJO Issue
package com.snapr.app.opencv_test.Models;
import org.json.JSONException;
import org.json.JSONObject;
public class User {
//public ArrayList
<Item>
stl = new ArrayList
<Item>
();
@avipars
avipars / Dijkstra.java
Created May 11, 2017 17:47 — forked from gennad/Dijkstra.java
Dijkstra algorithm java implementation
import java.util.*;
public class Dijkstra {
// assumes Nodes are numbered 0, 1, ... n and that the source Node is 0
ArrayList<Node> findShortestPath(Node[] nodes, Edge[] edges, Node target) {
int[][] Weight = initializeWeight(nodes, edges);
int[] D = new int[nodes.length];
Node[] P = new Node[nodes.length];
ArrayList<Node> C = new ArrayList<Node>();
@avipars
avipars / Image_Android
Created July 17, 2017 14:56
Help with getting crop to work
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
assert cursor != null;
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
@avipars
avipars / scrapeImages.py
Created November 21, 2017 04:23 — forked from genekogan/scrapeImages.py
scraping full size images from Google Images
from bs4 import BeautifulSoup
import requests
import re
import urllib2
import os
import argparse
import sys
import json
# adapted from http://stackoverflow.com/questions/20716842/python-download-images-from-google-image-search