Skip to content

Instantly share code, notes, and snippets.

View nieldeokar's full-sized avatar

Nilesh Deokar nieldeokar

View GitHub Profile
@nieldeokar
nieldeokar / Boilerplate.md
Last active October 29, 2023 01:47
Boilerplate code snippets.

Boilerplate

contains common code snippets.

Android Libraries

coroutines:

implementation 'androidx.fragment:fragment:1.4.1'
implementation 'androidx.fragment:fragment-ktx:1.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0-rc01'
@nieldeokar
nieldeokar / SimpleVibrateDemoActivity.java
Last active September 1, 2023 11:04
Android Vibrate & VibrationEffect class demo Usage
package com.example.nileshdeokar.simplevibratedemo;
import android.os.Build;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
/*
@nieldeokar
nieldeokar / AudioRecordThread.java
Last active April 23, 2023 02:25
Recording an Audio with .aac extension using AudioRecord android.
package com.nieldeokar.whatsappaudiorecorder.recorder;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.media.MediaRecorder;
import android.os.Build;
import android.util.Log;
@nieldeokar
nieldeokar / copyandroiddbfile.py
Last active September 17, 2022 16:22
Python script for copying database file from android devices. Works only with debuggable apps since no other process has permission to access files stored in private storage of an app.
import sys
import subprocess
import re
#/
# Created by @nieldeokar on 25/05/2018.
#/
# 1. Python script which will copy database file of debuggable apps from the android device to your computer using ADB.
@nieldeokar
nieldeokar / Apache_Server.c
Last active August 13, 2021 03:22
Simple Apache server to identify difference between socket and port
/*
* @author : Nilesh Deokar/ @nieldeokar
* instructions :
* 1. compile using 'gcc -Wall -o apache Apache_Server.c'
* 2. run ./apache
*/
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
@nieldeokar
nieldeokar / GetAlbumListFromContentProvider.kt
Created March 6, 2019 17:23
Fetches list of image and video Albums using content provider along with path to thumbnail of an album.
package droidninja.filepicker
import android.content.ContentResolver
import android.provider.MediaStore
import android.util.Log
/*
~ Nilesh Deokar @nieldeokar on 03/06/19 9:57 AM
*/
@nieldeokar
nieldeokar / data.json
Last active July 22, 2020 23:33
Take Home Projects - Show National Contiguity with a Force Directed Graph
{
"nodes": [
{ "country": "East Timor", "code": "tl" },
{ "country": "Canada", "code": "ca" },
{ "country": "Turkmenistan", "code": "tm" },
{ "country": "United States of America", "code": "us" },
{ "country": "Lithuania", "code": "lt" },
{ "country": "Cambodia", "code": "kh" },
{ "country": "Ethiopia", "code": "et" },
{ "country": "Swaziland", "code": "sz" },
@nieldeokar
nieldeokar / ContinueVideoRecorder.java
Last active December 9, 2019 05:41
Android has default filesize limit of 4GB while recording video. To overcome it use this build method.
/*
* Created by Nilesh Deokar<nieldeokar@gmail.com> on 18/4/19 2:43 PM
*/
package me.umoove.busCounterApp.models;
import android.media.MediaRecorder;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
python -m SimpleHTTPServer 8080
@nieldeokar
nieldeokar / SetBitPosition.java
Last active June 2, 2018 06:53
Demonstration of how to set specific bit to 1
int myOriginalValue = 0b0010;
// STEP 1 : 0b0001 << 3 = 0b1000;
// STEP 2 : OR 0b0010; originalValue
// --------------
// RESULT : 0b1010; // 3rd bit is set to true
// Formula for setting a bit :
// myOriginalValue = myOriginalValue | (1 << position);