Skip to content

Instantly share code, notes, and snippets.

View omkar-tenkale's full-sized avatar
☸️
Planning

Omkar Tenkale omkar-tenkale

☸️
Planning
View GitHub Profile
@granoeste
granoeste / EachDirectoryPath.md
Last active April 4, 2024 22:32
[Android] How to get the each directory path.

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

// Random terminal tip #1
//You'll see this message if you git commit without a message (-m)
// You can get out of it with two steps:
// 1.a. Type a multi-line message to move foward with the commit.
// 1.b. Leave blank to abort the commit.
// 2. Hit "esc" then type ":wq" and hit enter to save your choice. Viola!
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
@noln
noln / gist:4853bfe0908f87dee41f
Last active June 16, 2020 11:01
A basic anonymous AsyncTask with void return and no pre/post method.
new AsyncTask<Integer, Void, Void>(){
@Override
protected Void doInBackground(Integer... params) {
// main logic
return null;
}
}.execute(0);
@anubhavshrimal
anubhavshrimal / CountryCodes.json
Last active April 26, 2024 05:10 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
// UPDATE: Everyone finding this gist via Google!
// Modern kotlinx.coroutines has out-of-the-box support for asyncLazy with the following expression:
// val myLazyValue = async(start = CoroutineStart.LAZY) { ... }
// Use myLazyValue.await() when you need it
// ---------------- public api ----------------
public interface AsyncLazy<out T> {
public suspend fun value(): T
public fun isInitialized(): Boolean
@yanngx
yanngx / FragmentArgumentDelegate.kt
Last active January 19, 2023 09:26
Fragment arguments without hassle !
package be.brol
import android.os.Binder
import android.os.Bundle
import android.support.v4.app.BundleCompat
import android.support.v4.app.Fragment
/**
* Eases the Fragment.newInstance ceremony by marking the fragment's args with this delegate
* Just write the property in newInstance and read it like any other property after the fragment has been created
@rnagarajanmca
rnagarajanmca / apk install from windows context menu.md
Last active October 24, 2023 18:07
Register windows context menu entry to install apk with adb
package com.github.irshulx.glitchtext;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
@sidneys
sidneys / youtube_format_code_itag_list.md
Created January 20, 2018 11:12
YouTube video stream format codes itags

YouTube video stream format codes

Comprehensive list of YouTube format code itags

itag Code Container Content Resolution Bitrate Range VR / 3D
5 flv audio/video 240p - - -
6 flv audio/video 270p - - -
17 3gp audio/video 144p - - -
18 mp4 audio/video 360p - - -
22 mp4 audio/video 720p - - -
@IARI
IARI / AudioUtils.kt
Created March 15, 2019 23:32
get the length of a vorbis/ogg file
//4 bytes for "OggS", 2 unused bytes, 8 bytes for length
private const val OGG_OFFSET = 8 + 2 + 4
private val OGGS_BYTES = "OggS".map(Char::toByte).toByteArray()
private val VORBIS_BYTES = "vorbis".map(Char::toByte).toByteArray()
fun ByteArray.slice(start: Int, len: Int) = copyOfRange(start, start + len)
@Throws(IOException::class)
fun calculateOggDuration(oggFile: File): Pair<Int, Int> {
var rate = -1
var length = -1