Skip to content

Instantly share code, notes, and snippets.

View ThanosFisherman's full-sized avatar

Thanos Psaridis ThanosFisherman

View GitHub Profile
@binrebin
binrebin / MarkdownPreview.kt
Last active October 24, 2025 07:26
Simplest markdown parser for android jetpack compose.
@Composable
fun MarkdownPreview(text: String) {
val context = LocalContext.current
val annotatedString = parseMarkdownToAnnotatedString(text)
var textLayoutResult by remember { mutableStateOf<TextLayoutResult?>(null) }
Text(
text = annotatedString,
modifier = Modifier
@AdnanHabibMirza
AdnanHabibMirza / NetworkMonitor.kt
Last active July 22, 2024 13:45
Monitor network connectivity in android using callbackFlow.
interface NetworkMonitor {
val isOnline: Flow<Boolean>
}
class NetworkMonitorImpl @Inject constructor(
@ApplicationContext private val context: Context,
@Dispatcher(IO) private val ioDispatcher: CoroutineDispatcher,
) : NetworkMonitor {
override val isOnline: Flow<Boolean>
get() = callbackFlow {
@notnotrobby
notnotrobby / cgp.md
Last active January 3, 2026 21:35
List of free resources to study computer graphics programming.
@mmolosay
mmolosay / LoadingButton.kt
Last active November 12, 2025 10:31
Animated button with loading indicator in Jetpack Compose
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.Transition
import androidx.compose.animation.core.VisibilityThreshold
import androidx.compose.animation.core.animateDp
import androidx.compose.animation.core.spring
import androidx.compose.animation.core.updateTransition
import androidx.compose.animation.expandHorizontally
import androidx.compose.animation.fadeIn
@stevdza-san
stevdza-san / HyperlinkText.kt
Last active October 25, 2025 12:56
Embedd a Hyperlink within a Text using Jetpack Compose.
import androidx.compose.foundation.text.ClickableText
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.TextUnit
@mcroteau
mcroteau / build.gradle.kts
Created February 21, 2022 21:43
Example Kotlin DSL for publishing to Maven Central with Dokka and Sources
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.dokka") version "1.6.10"
id("maven-publish")
id("java-library")
id("signing")
id("jacoco")
application
kotlin("jvm") version "1.6.10"
@tatumroaquin
tatumroaquin / archlinux-qemu-kvm.md
Last active January 5, 2026 04:28
QEMU-KVM Installation for Arch Linux

QEMU-KVM in Arch Linux

Check Virtualization Support

lscpu | grep -i Virtualization
  • VT-x for Intel
  • AMD-Vi for AMD

Ensure that your kernel includes KVM modules

@the-spyke
the-spyke / pipewire.md
Last active November 30, 2025 03:52
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

const recorder = new Tone.Recorder();
const synth = new Tone.Synth().connect(recorder);
// start recording
recorder.start();
// generate a few notes
synth.triggerAttackRelease("C3", 0.5);
synth.triggerAttackRelease("C4", 0.5, "+1");
@LeviSnoot
LeviSnoot / discord-timestamps.md
Last active December 18, 2025 07:39
Discord Timestamp Syntax

Discord Timestamps

Discord timestamps can be useful for specifying a date/time across multiple users time zones. They work with the Unix Timestamp format and can be posted by regular users as well as bots and applications.

The Epoch Unix Time Stamp Converter is a good way to quickly generate a timestamp. For the examples below I will be using the Time Stamp of 1543392060, which represents November 28th, 2018 at 09:01:00 hours for my local time zone (GMT+0100 Central European Standard Time).

Formatting

Style Input Output (12-hour clock) Output (24-hour clock)
Default <t:1543392060> November 28, 2018 9:01 AM 28 November 2018 09:01