Skip to content

Instantly share code, notes, and snippets.

View Asutosh11's full-sized avatar
🏠
Working from home

Asutosh Panda Asutosh11

🏠
Working from home
  • Lowe's India
  • Bengaluru, Karnataka, India
View GitHub Profile
fun main(args: Array<String>) {
val k = 3
// k smallest element
// by default a PriorityQueue makes a min heap
val priorityQueue: PriorityQueue<Int> = PriorityQueue<Int>()
priorityQueue.add(20)
@Asutosh11
Asutosh11 / gradle.groovy
Created July 5, 2021 08:34
some custom settings for generating APKs
buildTypes {
release {
// this is for standard android release APK, the one we can upload to Play Store and Airwatch
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
// This is for generating an Unsigned APK for Intune and also compile APK on device
@Asutosh11
Asutosh11 / CustomTabHelper.kt
Last active March 10, 2021 08:55
Android: Open a web page in chrome custom tabs and also show a custom native view on top of it
package com.asutosh.trials
import `in`.novopay.los.ui.offlinekyc.WebViewActivity
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.text.TextUtils
import android.widget.RemoteViews
@Asutosh11
Asutosh11 / ml.txt
Last active May 23, 2019 03:18
Machine Learning concepts
1. Learning Rate - https://www.youtube.com/watch?time_continue=179&v=lif_qPmXvWA
2. Perceptron - The model of neural network that we have having neurons connected to each other with input and output
3. Why do we need bias in deep learning -
Bias is like the intercept added in a linear equation. It is an additional parameter in the Neural Network which is used to adjust the output along with the weighted sum of the inputs to the neuron. Therefore Bias is a constant which helps the model in a way that it can fit best for the given data.
y = wx + b
@Asutosh11
Asutosh11 / algo.java
Created May 29, 2018 07:00
Algorithms in Java
// 1. BINARY SEARCH
public class BinarySearch {
int number_to_find;
public BinarySearch(Integer[] arr, int number_to_find){
this.number_to_find = number_to_find;
int start_pos = 0;
int last_pos = arr.length-1;
BinarySearch(arr, start_pos, last_pos);
@Asutosh11
Asutosh11 / ExifUtil.java
Last active May 30, 2018 04:29 — forked from 9re/ExifUtil.java
For photos taken from camera - fix flipped / rotated image by getting EXIF orientation for Bitmaps.
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.os.Build;
@Asutosh11
Asutosh11 / DummyViewModel.kt & MainActivity.kt
Last active May 28, 2018 04:04
Simplest ViewModel & LiveData usage on Android
class DummyViewModel : ViewModel() {
var data : MutableLiveData<String> = MutableLiveData()
internal fun setData(some_value : String){
data.value = some_value
}
}
------------------------------------------------------------------------------------------------------------------------
@Asutosh11
Asutosh11 / KotlinNotes.kt
Last active June 19, 2018 10:52
Kotlin notes: new things in kotlin and common Android codes in Kotlin
1. Coroutines in Kotlin -
/* Coroutines in Kotlin is the simplest way to do asynchronous tasks which we do in asynctask or using multiple threads
in RxJava.
*/
2(a). Calling a method of Activity inside Fragment -
// i. define mContext like this -
@Asutosh11
Asutosh11 / FbLoginWithCustomButtonOnAndroid.txt
Last active September 6, 2017 07:21
Android Facebook login with custom Login button
build.gradle (Module: app)
==========================
// 1.
buildscript {
repositories {
mavenCentral()
}
}
@Asutosh11
Asutosh11 / RuntimePermissions.java & SplashActivity.kt
Last active December 18, 2019 06:45
Android Runtime permissions helper class
/**
The Runtime permissions helper class
**/
public class RuntimePermissions {
private Context mContext;
private String[] permissions;
public RuntimePermissions(String[] permissions, Context context){