Skip to content

Instantly share code, notes, and snippets.

@gpeal
gpeal / ContributesApiCodeGenerator.kt
Last active February 12, 2024 20:10
Anvil Code Generator
package com.tonal.trainer.anvilcompilers
import com.google.auto.service.AutoService
import com.squareup.anvil.annotations.ContributesTo
import com.squareup.anvil.compiler.api.AnvilContext
import com.squareup.anvil.compiler.api.CodeGenerator
import com.squareup.anvil.compiler.api.GeneratedFile
import com.squareup.anvil.compiler.api.createGeneratedFile
import com.squareup.anvil.compiler.internal.asClassName
import com.squareup.anvil.compiler.internal.buildFile
@CyrilFind
CyrilFind / main.kt
Last active May 12, 2021 16:06
Compose Navigation + Paging + ViewModel + Flow
const val LIST = "list"
const val OTHER = "other"
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
val navController = rememberNavController()
ComposeSampleTheme {
Scaffold(
@rahulsainani
rahulsainani / App.kt
Last active November 3, 2020 15:01
Clean Cache Worker
import android.app.Application
import androidx.work.Constraints
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import java.util.concurrent.TimeUnit
class App: Application(){
override fun onCreate() {
@ArsalRaza
ArsalRaza / VideoUtils.java
Last active January 25, 2024 11:39
Extract Audio from Video, Mute Video, Crop Video from start, Crop Video from end Android MediaMuxer - JAVA
import android.annotation.SuppressLint;
import android.media.MediaCodec;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.MediaMetadataRetriever;
import android.media.MediaMuxer;
import android.util.Log;
import java.io.IOException;
import java.nio.ByteBuffer;
@stephanetimmermans
stephanetimmermans / ubuntu-maven-3
Last active November 16, 2020 09:04
Install Maven3 on Unbuntu 14.04
#sudo apt-get remove maven2
sudo add-apt-repository "deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main"
sudo apt-get update
sudo apt-get install maven3
#If you encounter this:
#The program 'mvn' can be found in the following packages:
# * maven
# * maven2
1. The texture target needs to be GLES20.GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D, e.g. in the glBindTexture calls and glTexParameteri calls.
2. In the fragment shader define a requirement to use the extension:
#extension GL_OES_EGL_image_external : require
3. For the texture sampler used in the fragment shader, use samplerExternalOES instead of sampler2D.
Everything below here is all in the C code, no more Java.
4. In the C code, use glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, eglImage) to specify where the data is, instead of using glTexImage2D family of functions.
@jayrambhia
jayrambhia / Makefile
Created May 30, 2013 12:53
Using Kinect with Freenect and OpenCV (C++ version)
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 `pkg-config opencv --cflags ` -I /usr/include/libusb-1.0
OBJS = freenectopencvmat.o
LIBS = `pkg-config opencv --libs` -lfreenect
TARGET = kinectopencv
$(TARGET):$(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LIBS)
all:$(TARGET)
clean:
rm -f $(OBJS) $(TARGET)