Skip to content

Instantly share code, notes, and snippets.

View SubhrajyotiSen's full-sized avatar

Subhrajyoti Sen SubhrajyotiSen

View GitHub Profile
@KlassenKonstantin
KlassenKonstantin / RubberBandSlider.kt
Created January 15, 2024 17:16
Rubber Band Slider Compose
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
RubberBandSliderTheme {
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
Box(contentAlignment = Alignment.Center) {
RubberBandSlider(modifier = Modifier
.height(200.dp)
import android.graphics.Matrix
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
@MeNiks
MeNiks / RealPathUtil.kt
Last active April 29, 2024 22:08
Kotlin code to get real path / sd card path from intent data while browsing file.
import android.annotation.SuppressLint
import android.content.ContentUris
import android.content.Context
import android.content.CursorLoader
import android.database.Cursor
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.provider.DocumentsContract
import android.provider.MediaStore
@ValCanBuild
ValCanBuild / BottomNavigationBehavior.kt
Last active December 18, 2023 00:04
Full code of a BottomNavigationBehavior which hides itself on scroll and handles Snackbars, FAB and snapping. https://medium.com/@ValCanBuild/scroll-your-bottom-navigation-view-away-with-10-lines-of-code-346f1ed40e9e
/**
MIT License
Copyright (c) 2018 Valentin Hinov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@florina-muntenescu
florina-muntenescu / BaseDao.kt
Last active July 4, 2024 13:42
Use Dao inheritance to reduce the amount of boilerplate code - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Atlas7
Atlas7 / entropy-cost.md
Last active October 5, 2022 05:31
Deep Neural Network - cross entropy cost - np.sum vs np.dot styles

Cross Entropy Cost and Numpy Implementation

Given the Cross Entroy Cost Formula:

cross-entroy-cost-function.png

where:

  • J is the averaged cross entropy cost
  • m is the number of samples
  • super script [L] corresponds to output layer
@msfjarvis
msfjarvis / sepolicy.md
Last active December 16, 2023 20:50
How to write sepolicy to fix a denial
@RealDeanZhao
RealDeanZhao / parse-inputstream-to-jsonobject.md
Created April 10, 2017 06:00
Parse InputStream to JsonObject
JsonObject json;
  try {
    JsonElement element = new JsonParser().parse(
    new InputStreamReader(responseEntity.getBody().getInputStream())
  );
  json = element.getAsJsonObject();
} catch (IOException e) {
  throw new RuntimeException(e.getLocalizedMessage());
}
@varhub
varhub / Android - Enable ADB from recovery.md
Created December 23, 2016 17:54
Android - Enable ADB from recovery

Android - Enable ADB from recovery

Credits to @TheOnlyAnil-@Firelord[^stackoverflow]

  • Requirements: a) stock recovery + rooted phone b) custom recovery

  • Files changed:

public String getTimestamp() {
DateTime post = new DateTime(1468973396572);
DateTime now = new DateTime();
Period period = new Period(post, now);
PeriodFormatter formatter;
if(period.getYears() != 0){
formatter = new PeriodFormatterBuilder().appendYears().appendSuffix("Y").printZeroNever().toFormatter();
}else if(period.getMonths() !=0){