Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View CristianMG's full-sized avatar
🎯
Focusing

Cristian CristianMG

🎯
Focusing
View GitHub Profile
@CristianMG
CristianMG / .kt
Created July 20, 2023 06:22
Bluetooth write
suspend fun Peripheral.write(
characteristic: Characteristic,
data: ByteArray,
mtuSize: Int
): ByteArray =
observe(characteristic) {
if (data.size > (mtuSize - 3) ) {
Napier.d("data size is bigger than mtu, chunk it and write it")
data.chunkAndEach(mtuSize - 3) {
if(it.size == (mtuSize - 3)) {
@CristianMG
CristianMG / import.py
Created July 18, 2023 06:55
Import artifacts to Github registry
import os
# Función para recorrer las carpetas y buscar archivos pom.xml
def buscar_pom_xml(directorio):
for root, dirs, files in os.walk(directorio):
print(f"Exploring dirs: {root}")
for file in files:
if file.endswith(".pom"):
print(f"Founded file pom.xml: {file}")
ruta_archivo_pom = os.path.join(root, file)
@CristianMG
CristianMG / .rb
Created December 9, 2022 12:01
Fastlane Example
default_platform(:android)
config_json = read_json(
json_path: "./buildsystem/config.json"
)
platform :android do
desc "Building generic by json configuration"
lane :generic do |values|
flavor_parameter = values[:id]
@CristianMG
CristianMG / .json
Created December 9, 2022 11:46
Example configuration
{
//ID to identiy compilation by id
"id": "develop",
//Flavor name
"flavor_name": "develop",
// Sign cong
"sign_conf": "release",
// App center api-key
"appcenter_api_key" : "X",
// App center user
java.lang.ArrayIndexOutOfBoundsException: length=10; index=-1
at java.util.ArrayList.set(ArrayList.java:455)
at com.beemdevelopment.aegis.ui.views.EntryAdapter.replaceEntry(EntryAdapter.java:193)
at com.beemdevelopment.aegis.ui.views.EntryListView.replaceEntry(EntryListView.java:379)
at com.beemdevelopment.aegis.ui.MainActivity.onEditEntryResult(MainActivity.java:321)
at com.beemdevelopment.aegis.ui.MainActivity.lambda$new$2$com-beemdevelopment-aegis-ui-MainActivity(MainActivity.java:106)
at com.beemdevelopment.aegis.ui.MainActivity$$ExternalSyntheticLambda7.onActivityResult(Unknown Source:4)
at androidx.activity.result.ActivityResultRegistry$1.onStateChanged(ActivityResultRegistry.java:149)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:360)
at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:271)
FROM ubuntu
# Set Workdir
RUN mkdir /home/haveno
WORKDIR /home/haveno
# Copy all context required
RUN mkdir scripts
# Copy usefull scripts to current work directory
COPY ./scripts/install_java.sh scripts/
@CristianMG
CristianMG / FarmRepository.kt
Created April 10, 2020 22:29
FarmRepository
/*
*
* * Copyright 2020 Cristian Menárguez González
* *
* * 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
* *
package com.cristianmg.newplayerivoox.player.engine.exoplayer
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.os.Build
import android.os.Handler
import com.cristianmg.newplayerivoox.R
import com.cristianmg.newplayerivoox.player.Track
package com.cristianmg.newplayerivoox.player.ads
import android.net.Uri
import android.os.Looper
import com.cristianmg.newplayerivoox.player.Track
import com.google.android.exoplayer2.C
import com.google.android.exoplayer2.C.TIME_END_OF_SOURCE
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.source.ads.AdPlaybackState
import com.google.android.exoplayer2.source.ads.AdsLoader
@CristianMG
CristianMG / .kt
Created September 4, 2019 07:30
Loaders
inner class FromResource private constructor() {
constructor(init: FromResource.() -> Unit) : this() {
init()
}
@DrawableRes
var resource: Int? = null
fun resource(init: () -> Int) {