Skip to content

Instantly share code, notes, and snippets.

View blaZ3's full-sized avatar
:octocat:
WFH

vivek blaZ3

:octocat:
WFH
View GitHub Profile
@blaZ3
blaZ3 / android_dev_commands.txt
Created November 20, 2022 13:51
Useful android dev commands
Run the emulator without Audio
$ emulator -avd Pixel_2_API_27 -qemu -no-audio
@blaZ3
blaZ3 / android_device_animations.sh
Last active November 8, 2021 12:00
Enable and disable Android animations
echo "================================================="
echo "Enable and disable Android animations"
echo "Usage"
echo "Enable animations: ./android_animations.sh 1"
echo "Disable animations: ./android_animations.sh 0"
echo "Value can also be decimals in the range of 0 - 1"
echo "================================================="
adb shell settings put global window_animation_scale $1
adb shell settings put global transition_animation_scale $1
@blaZ3
blaZ3 / ManagedCoroutineScope.kt
Created June 14, 2021 13:45
ManagedCoroutineScope
import androidx.lifecycle.LifecycleCoroutineScope
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlin.coroutines.CoroutineContext
internal interface ManagedCoroutineScope : CoroutineScope {
fun launch(block: suspend CoroutineScope.() -> Unit): Job
}
internal class LifecycleManagedCoroutineScope(
@blaZ3
blaZ3 / Result.kt
Created May 23, 2021 16:51
Result class for network results.
sealed class Result<T> {
data class Success<T>(val data: T) : Result<T>()
data class NetworkError<T>(val code: Int, val t: Throwable? = null) : Result<T>()
data class NetworkFailure<T>(val t: Throwable) : Result<T>()
}
@blaZ3
blaZ3 / BaseService.kt
Created May 23, 2021 16:49
BaseService for network calls
abstract class BaseService {
suspend fun <T : Any> apiCall(call: suspend () -> Response<T>): Result<T> {
val response: Response<T>?
try {
response = call.invoke()
} catch (ex: Exception) {
return NetworkFailure(ex)
}
if (response.isSuccessful) {
response.body()?.let { return Success(it) } ?: return NetworkFailure(
@blaZ3
blaZ3 / fiatcurrencies.json
Created March 12, 2021 08:20
List of fiat currencies
{
"info": {
"version": 5
},
"data": [
{
"symbol": "ZWR",
"name": "Zimbabwe Dollar",
"id": 935
},
@blaZ3
blaZ3 / cryptocurrencies.json
Last active March 12, 2021 08:20
list of cryptocurrencies
{
"42": "42 Coin",
"300": "300 token",
"365": "365Coin",
"404": "404Coin",
"433": "433 Token",
"611": "SixEleven",
"808": "808",
"888": "Octocoin",
"1337": "EliteCoin",
@blaZ3
blaZ3 / YUV_formats.md
Created November 5, 2020 16:58 — forked from Jim-Bar/YUV_formats.md
About YUV formats

About YUV formats

First of all: YUV pixel formats and Recommended 8-Bit YUV Formats for Video Rendering. Chromium's source code contains good documentation about those formats too: chromium/src/media/base/video_types.h and chromium/src/media/base/video_frame.cc (search for RequiresEvenSizeAllocation(), NumPlanes() and those kinds of functions).

YUV?

You can think of an image as a superposition of several planes (or layers in a more natural language). YUV formats have three planes: Y, U, and V.

Y is the luma plane, and can be seen as the image as grayscale. U and V are reffered to as the chroma planes, which are basically the colours. All the YUV formats have these three planes, and differ by the different orderings of them.

@blaZ3
blaZ3 / react-ssr.txt
Created July 31, 2020 19:24
SSR setup for react app
Deps
## yarn add express
## yarn add @babel/preset-env @babel/preset-react @babel/register ignore-styles
## Build react app
## yarn build
## Add file
## server/server.js