Skip to content

Instantly share code, notes, and snippets.

@danielesegato
danielesegato / ChannelSharedFlow.kt
Last active April 30, 2024 18:59
Coroutine: Channel Shared Flow
/*
* Copyright 2022 Daniele Segato
*
* 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
@gmk57
gmk57 / Sending events to UI.kt
Last active February 13, 2024 15:17
Sending events to UI with Channel/Flow + custom collector (see my first comment for reasons behind it)
/**
* Starts collecting a flow when the lifecycle is started, and **cancels** the collection on stop.
* This is different from `lifecycleScope.launchWhenStarted { flow.collect{...} }`, in which case
* the coroutine is just suspended on stop.
*/
inline fun <reified T> Flow<T>.collectWhileStarted(
lifecycleOwner: LifecycleOwner,
noinline action: suspend (T) -> Unit
) {
object : DefaultLifecycleObserver {
@colemickens
colemickens / amiibo-emulation-with-linux-vm.md
Last active March 23, 2024 03:37
amiibo-emulation-with-linux-vm.md

Easy Amiibo Emulation - https://bit.ly/2z0m09k

(^ that's a short-link to this page, so you can open it in Linux)

Some users are discussing this guide in #hacking on the JoyConDroid Discord: https://discord.gg/SQNEx9v.

DO NOT ask for, or share links to, Amiibo bins in the comments! They will be removed. Thank you for understanding.

(Windows|Linux PC) + JoyControl + Bluetooth = AMIIBO EMULATION

@vgaidarji
vgaidarji / AndroidStudio as git difftool, mergetool
Last active March 13, 2020 09:23
Use AndroidStudio as git difftool/mergetool on MacOS (place this inside your ~/.gitconfig).
[merge]
tool = studio
[mergetool "studio"]
prompt = false
cmd = /Applications/Android\\ Studio.app/Contents/MacOS/studio merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[diff]
tool = studio
[difftool "studio"]
prompt = false
@donnfelker
donnfelker / circle.yml
Created December 13, 2016 13:05
Updated circle.yml file for Caster.IO
#
# Build configuration for Circle CI
#
# See this thread for speeding up and caching directories:
# https://discuss.circleci.com/t/installing-android-build-tools-23-0-2/924
#
general:
artifacts:
- /home/ubuntu/AndroidCI/app/build/outputs/apk/
@ultraon
ultraon / build.gradle
Last active August 19, 2020 18:10
Good example of the merged Jacoco code covarage Gradle configuration
apply plugin: 'com.android.application'
apply from: "$rootDir/coverage.gradle"
//...
android {
//...
buildTypes {
//...
debug {
@gschlabitz
gschlabitz / dedsec.sh
Last active March 27, 2022 16:28
Echo dedsec skull and change prompt to make your shell totally haxx0r
#!/bin/bash
echo "
pN▒g▒p▒g▒▒g▒ge
▒▒▒▒▒▒▒░░▒░▒░▒
_0▒░▒░▒░░▒▒▒▒▒▒▒!
4▒▒▒▒▒░░░▒░░▒▒▒▒▒Y
│\` \~~#00░░0 MMM\"M│
\`gM░M7
│ 00q0 │
@mugifly
mugifly / circle.yml
Last active March 25, 2021 13:48
Faster test & Build of Android Studio Project (Gradle Project) on Circle-CI.
machine:
java:
version: oraclejdk8
environment:
# Java options
JAVA_OPTS: "-Xms512m -Xmx2048m"
# ADB options
ADB_INSTALL_TIMEOUT: 5000
dependencies:
@h0lyalg0rithm
h0lyalg0rithm / circle.yml
Created January 10, 2016 20:44
Android CircleCI Build config
#Install android build tools, platforms
#Supported versions here https://circleci.com/docs/android
dependencies:
override:
- echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-23.0.1,android-23,extra-google-m2repository,extra-google-google_play_services,extra-android-support
- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies
#Pull any submodules
checkout:
post:
@jgilfelt
jgilfelt / CurlLoggingInterceptor.java
Created January 9, 2016 15:34
An OkHttp interceptor that logs requests as curl shell commands
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* 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