Skip to content

Instantly share code, notes, and snippets.

View RahulSDeshpande's full-sized avatar
☑️
Code • Jam • Shoot | Repeat

Rahul RahulSDeshpande

☑️
Code • Jam • Shoot | Repeat
View GitHub Profile
@debarko
debarko / cowin_schedule_district_wise.js
Last active June 3, 2021 08:07
Get an update on console as soon as a slot opens up in https://selfregistration.cowin.gov.in/ . Login to the website and then run this script on Console.
// This script will alert you whenever some slot opens up on the given date within the given District IDs
// Change the districts to your needs as per your city
// Change the dateArr to add your convinent set of dates
// For further update do checkout http://twitter.com/debarko/
// How To setup Video -> https://www.youtube.com/watch?v=3_N5FFegtI4
// Steps to use
// 1. Update Config
@RahulSDeshpande
RahulSDeshpande / MaterialAlertDialogExt.kt
Last active July 11, 2021 22:11
Kotlin Extension for the MaterialAlertDialog!
// Kotlin extension
fun Context.alert(
@StyleRes style: Int = 0,
dialogBuilder: MaterialAlertDialogBuilder.() -> Unit
) {
MaterialAlertDialogBuilder(this, style)
.apply {
setCancelable(false)
dialogBuilder()
create()
@marz-hunter
marz-hunter / target BB
Last active December 25, 2023 01:53
Large target BugBounty
[
{
"program_name": "(ISC)²",
"policy_url": "https://bugcrowd.com/isc2",
"submission_url": "https://bugcrowd.com/isc2/report",
"launch_date": "",
"bug_bounty": false,
"swag": false,
"hall_of_fame": true,
"safe_harbor": "partial"
object MyReachability {
private fun hasNetworkAvailable(context: Context): Boolean {
val service = Context.CONNECTIVITY_SERVICE
val manager = context.getSystemService(service) as ConnectivityManager?
val network = manager?.activeNetworkInfo
Log.d(classTag, "hasNetworkAvailable: ${(network != null)}")
return (network?.isConnected) ?: false
}
@nishantkp
nishantkp / Network.java
Last active October 24, 2023 16:27
Find out application is connected to WIFI or cellular
/**
* Get reference to the connectivity manager
*/
ConnectivityManager connectivityManager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
/**
* Find out whether device is connected to wifi or cellular at the moment
*/
public NetworkType getNetworkType() {
@PasanBhanu
PasanBhanu / CheckNetwork.java
Last active July 25, 2023 13:28
Check Internet Connection in Android (API Level 29) Using Network Callback
/*
You need to call the below method once. It register the callback and fire it when there is a change in network state.
Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application.
*/
// You need to pass the context when creating the class
public CheckNetwork(Context context) {
this.context = context;
}
@saikiran91
saikiran91 / BaseUpdateCheckActivity.kt
Last active May 12, 2022 17:13
Android officially announced the in-app updates. https://developer.android.com/guide/app-bundle/in-app-updates. This is the code sample for handling both IMMEDIATE and FLEXIBLE updates in a single activity; Kotlin way.
import android.app.Activity
import android.content.Intent
import android.content.IntentSender
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.google.android.material.snackbar.Snackbar
import com.google.android.play.core.appupdate.AppUpdateManager
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
@mileskrell
mileskrell / build.gradle.kts
Created April 19, 2019 04:26
Example of declaring Android signing configs using Gradle Kotlin DSL
android {
signingConfigs {
getByName("debug") {
keyAlias = "debug"
keyPassword = "my debug key password"
storeFile = file("/home/miles/keystore.jks")
storePassword = "my keystore password"
}
create("release") {
keyAlias = "release"
@naturalwarren
naturalwarren / AccessTokenAuthenticator.kt
Last active October 30, 2023 15:14
An OkHttp Authenticator that performs token refreshes.
/**
* Authenticator that attempts to refresh the client's access token.
* In the event that a refresh fails and a new token can't be issued an error
* is delivered to the caller. This authenticator blocks all requests while a token
* refresh is being performed. In-flight requests that fail with a 401 are
* automatically retried.
*/
class AccessTokenAuthenticator(
private val tokenProvider: AccessTokenProvider
) : Authenticator {
@ch8n
ch8n / AlertDialogAndroidkotlinExtension.kt
Last active October 3, 2023 12:18
Android alert dialog kotlin Extension
//Utils - Declaration
object PromptUtils {
fun alertDialog(context: Context, @StyleRes style: Int, dialogBuilder: AlertDialog.Builder.() -> Unit): Dialog {
val builder = AlertDialog.Builder(context, style).also {
it.setCancelable(false)
it.dialogBuilder()
}
return builder.create()
}