Skip to content

Instantly share code, notes, and snippets.

Avatar
🌏
Code • Jam • Shoot | Repeat

AndroCurious RahulSDeshpande

🌏
Code • Jam • Shoot | Repeat
View GitHub Profile
@RahulSDeshpande
RahulSDeshpande / mysql-calculate-db-sizes.sql
Created Jul 19, 2021
MySQL query to calculate sizes of all the DBs
View mysql-calculate-db-sizes.sql
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
View keybase.md

Keybase proof

I hereby claim:

  • I am RahulSDeshpande on github.
  • I am rhld (https://keybase.io/rhld) on keybase.
  • I have a public key whose fingerprint is E635 1D59 19C1 7641 7A47 CE8C 9DA8 4D29 D71E 0F45

To claim this, I am signing this object:

@RahulSDeshpande
RahulSDeshpande / MaterialAlertDialogExt.kt
Last active Jul 11, 2021
Kotlin Extension for the MaterialAlertDialog!
View MaterialAlertDialogExt.kt
// Kotlin extension
fun Context.alert(
@StyleRes style: Int = 0,
dialogBuilder: MaterialAlertDialogBuilder.() -> Unit
) {
MaterialAlertDialogBuilder(this, style)
.apply {
setCancelable(false)
dialogBuilder()
create()
@RahulSDeshpande
RahulSDeshpande / SharedPrefs.kt
Last active Feb 17, 2022
'SharedPrefs' utility class written Kotlin, for storing and retrieving data from SharedPreference in Android.
View SharedPrefs.kt
import android.content.Context
import android.preference.PreferenceManager
import android.util.Log
import java.lang.ref.WeakReference
/**
* Created by rahuldeshpande on 02/06/19.
*/
object SharedPrefs {
View Executing SQLite queries in background (example for article)
public class MyAsyncTask extends AsyncTask<Void, Void, Cursor> {
@Override
protected Cursor doInBackground(Void... params) {
DatabaseHelper helper = new DatabaseHelper(MainActivity.this);
return helper.getReadableDatabase().rawQuery("SELECT * FROM myTable", null);
}
@Override
View Executing SQLite queries in background (example for article)
public class MyAsyncTask extends AsyncTask<Void, Void, Cursor> {
@Override
protected Cursor doInBackground(Void... params) {
DatabaseHelper helper = new DatabaseHelper(MainActivity.this);
return helper.getReadableDatabase().rawQuery("SELECT * FROM myTable", null);
}
@Override
View RoundedAvatarDrawable.java
/*
* Copyright 2013 Evelio Tarazona Cáceres <evelio@evelio.info>
*
* 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
View db_getter.sh
#!/bin/bash
# Android 4.3+ changes app's internal directory permissions and you can not just pull your
# databases to your computer, so I did this as a workaround to extract my databases.
# I only use it for debug, use it under your responsability.
package=$1
db_name=$2
path="/data/data/$package/"
View png2svg.sh
#!/bin/bash
if [ "$1" == "" ]; then
echo Usage: $0 pngfile
exit 0;
fi
FILE=`basename $1 .png`
if [ ! -e $FILE.png ]; then
View png2svg.sh
#!/bin/bash
if [ "$1" == "" ]; then
echo Usage: $0 pngfile
exit 0;
fi
FILE=`basename $1 .png`
if [ ! -e $FILE.png ]; then