Skip to content

Instantly share code, notes, and snippets.

View timrijckaert's full-sized avatar

Tim Rijckaert timrijckaert

View GitHub Profile
@timrijckaert
timrijckaert / README.md
Last active April 12, 2023 20:27
Download a signed APK from Google Play with Python's Android Publisher.

What

Download a signed APK from Google Play with Python's Android Publisher.
This can be helpful when you upload an app bundle that is signed by Google

How to run?

Download your apps service-account.json to the same directory as the Python script.

Download the dependencies

package com.bnppf.easybanking
import arrow.fx.coroutines.Schedule
import io.kotest.core.spec.style.StringSpec
import kotlin.time.Duration.Companion.seconds
import kotlin.time.ExperimentalTime
import kotlin.time.TimeMark
import kotlin.time.TimeSource
@OptIn(ExperimentalTime::class)
@timrijckaert
timrijckaert / commands-dump-place.md
Last active November 3, 2022 08:26
Some commands useful for debugging deeplinking

Check signature of an APK

keytool -printcert -jarfile file.apk

The SHA256 is the interesting one and need for the assetlink.json

Reverify assetlink

@timrijckaert
timrijckaert / Cell.kt
Last active October 22, 2021 13:19
Similar to how Jetpack Compose's Modifier works, but for Cell NEBA
package com.bnpp.easybanking.zeplin.molecule
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextDecoration
import com.bnpp.easybanking.zeplin.molecule.CellData.Companion.DefaultMaxLines
import com.bnpp.easybanking.zeplin.molecule.CellData.Companion.DefaultTextDecoration
import com.bnpp.easybanking.zeplin.molecule.CellData.Companion.DefaultTextModifier
@timrijckaert
timrijckaert / FlowPlaygroundTest.kt
Last active July 6, 2021 14:04
Use cases with Flow
interface FlowProvider {
fun returnsAColdFlow(): Flow<Int> = flow {
repeat(5) {
emit(it)
delay(100)
}
}
}
object DefaultFlowProvider : FlowProvider
package com.example.sample
import arrow.core.Either
import arrow.core.NonEmptyList
import arrow.core.computations.either
import arrow.core.flatMap
import arrow.core.nonEmptyListOf
import arrow.core.right
import arrow.core.traverseEither
import arrow.core.zip
@timrijckaert
timrijckaert / either.kt
Created February 18, 2021 17:27
Shameless copied from Arrow Core. However this is ideal to introduce your team to Either without making a big fuzz about adding a new lib with new paradigms.
//https://arrow-kt.io/docs/apidocs/arrow-core-data/arrow.core/-either/
sealed class Either<out A, out B> {
internal abstract val isRight: Boolean
internal abstract val isLeft: Boolean
fun isLeft(): Boolean = isLeft
@timrijckaert
timrijckaert / CreditCardFormattingTextWatcher.kt
Created January 23, 2021 17:59
Inserts spaces after every block of 4 digits
class CreditCardTextWatcher(private val maxLength: Int) : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable) {
val textLength = s.length
// first remove any previous span
val spans = s.getSpans(0, s.length, SpaceSpan::class.java)
for (i in spans.indices) {
@timrijckaert
timrijckaert / README.md
Last active September 14, 2023 08:43
Fetch Firebase tokens for topic

Firebase Topic Counter

This little script will output the amount of tokens subscribed to a topic.
You will need to replace the variables with your personal ones in order for it to work.

We used this function in a Lambda which sends the results to a monitoring dashboard.

How to get the variables

Screenshots in the comments.

private fun createNotification(channelId: String, text: String, title: String, id: String, url: String, bigImage: Bitmap, pillImage: Bitmap): Notification {
return NotificationCompat.Builder(context, channelId)
.setContentTitle(title)
.setContentText(text)
.setSmallIcon(R.drawable.ic_notification)
.setContentIntent(createPendingIntent(id, url))
.setAutoCancel(true)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setSound(soundHelper.vrtNwsNotificationSound)
.setDefaults(NotificationCompat.DEFAULT_VIBRATE)