Skip to content

Instantly share code, notes, and snippets.

@AlexV525
AlexV525 / init.gradle.kts
Last active August 19, 2024 07:22
Mirroring Gradle repositories
// Thanks to: https://gist.github.com/bennyhuo/af7c43cc4831661193605e124f539942
val urlMappings = mapOf(
"https://dl.google.com/dl/android/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://repo.maven.apache.org/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://plugins.gradle.org/m2" to "https://mirrors.tencent.com/nexus/repository/gradle-plugins/"
)
fun RepositoryHandler.mirroring() {
all {
@devrath
devrath / RetryInterceptor.java
Created May 6, 2021 13:00
Retry mechanism for OKHTTP
package com.mpl.network.modules.interceptors;
import android.os.Handler;
import android.util.Log;
import java.io.IOException;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
@mattiaferigutti
mattiaferigutti / MainActivity.kt
Last active July 31, 2021 08:05
Get a file from assets ExoPlayer 2
package com.studio.mattiaferigutti.exoplayertest
import android.annotation.SuppressLint
import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.google.android.exoplayer2.*
import com.google.android.exoplayer2.source.ProgressiveMediaSource
@shaobin0604
shaobin0604 / buildRawMediaSource.java
Last active April 16, 2020 17:05
exoplayer play video files in resource/raw
private MediaSource buildRawMediaSource() throws RawResourceDataSource.RawResourceDataSourceException {
RawResourceDataSource rawDataSource = new RawResourceDataSource(this);
// open the /raw resource file
rawDataSource.open(new DataSpec(RawResourceDataSource.buildRawResourceUri(R.raw.test11_rotate_270)));
return new ProgressiveMediaSource.Factory(new DefaultDataSourceFactory(this, "ExoTest")).createMediaSource(rawDataSource.getUri());
}
@gabrielemariotti
gabrielemariotti / README.MD
Last active September 24, 2024 09:22
How to use the ShapeableImageView.

The Material Components Library introduced with the 1.2.0-alpha03 the new ShapeableImageView.

In your layout you can use:

 <com.google.android.material.imageview.ShapeableImageView
      android:id="@+id/image_view"
      app:srcCompat="@drawable/..." />

Then in your code apply the ShapeAppearanceModel to define your custom corners:

@LukasKnuth
LukasKnuth / Readme.md
Created December 6, 2019 21:47
ffmpeg Merge two Audio Streams into one

This script takes a single input file and

  1. Reduces the volume of the third audio-track in the file by half
  2. Writes the reduced volume track into l
  3. Mixes both the second audio-track and the lowered l-track together and stores them into a
  4. Maps the original video to be the first track
  5. Adds the newly mixed audio-track a as the sole audio track
  6. Enables pass-through for the video-track
  7. Configures the mixed audio-track to be AAC at 192kbit/s
@ragnraok
ragnraok / iframe-probe.py
Created September 9, 2019 07:24 — forked from alastairmccormack/iframe-probe.py
Shows GOP structure for video file using ffmpeg --show-frames output
#!/usr/bin/env python
#
# Shows GOP structure of video file. Useful for checking suitability for HLS and DASH packaging.
# Example:
#
# $ iframe-probe.py myvideo.mp4
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
# GOP: IPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 60 CLOSED
@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"
@hajoscher
hajoscher / rotate_mp4.py
Created March 21, 2019 20:38
rotate mp4 files by changing rotation metadata
#! /usr/bin/env python3
import sys
import mmap
if len(sys.argv) < 2 :
print("""
change rotation metadata in mp4 files
see: https://superuser.com/a/1307206/1010278
usage: %s file.mp4 0-3
/*
* Copyright (C) 2014 Square, Inc.
*
* 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