Skip to content

Instantly share code, notes, and snippets.

@chibatching
chibatching / FlowThrottleDebounce.kt
Last active November 8, 2024 00:44
Throttle and Debounce on Flow Kotlin Coroutines
fun <T> Flow<T>.throttle(waitMillis: Int) = flow {
coroutineScope {
val context = coroutineContext
var nextMillis = 0L
var delayPost: Deferred<Unit>? = null
collect {
val current = SystemClock.uptimeMillis()
if (nextMillis < current) {
nextMillis = current + waitMillis
@jpmcosta
jpmcosta / adb_wifi.bat
Created September 2, 2020 13:12
ADB over WiFi Batch Script
@echo off
setlocal
rem Change to suit your configuration.
set netmask=192.168
rem Set adb.
if [%1] == [] (
set adb=%ANDROID_HOME%\platform-tools\adb.exe
) else (
@danvy
danvy / WSL2-Net-Fix.ps1
Created September 5, 2020 21:04
Reset your WSL network connection trying to fix WSL2 media disconnected error
# Check these threads before proceeding:
# https://github.com/microsoft/WSL/discussions/5857
# https://github.com/microsoft/WSL/issues/5821
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
$CmdLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CmdLine
Exit
}
# Restart the Host Network Service
Restart-Service -Force -Name hns
@viktoriia-io
viktoriia-io / maven_publish.gradle
Last active November 7, 2023 08:47
Maven publishing script for customising pom file generation
apply plugin: 'maven-publish'
afterEvaluate {
publishing {
publications {
maven(MavenPublication) {
groupId project.ext.pomGroupID
artifactId project.name
version project.ext.pomVersion
@hackermondev
hackermondev / ClydeAI-Jailbreak.md
Last active July 9, 2025 22:40
Discord ClydeAI jailbreak
@ardakazanci
ardakazanci / HeartLove.kt
Created June 2, 2025 06:54
Press L for Love Jetpack Compose
@Composable
fun FloatingHeartsAnimation() {
var showHearts by remember { mutableStateOf(false) }
val heartList = remember { mutableStateListOf<Int>() }
var sliderValue by remember { mutableFloatStateOf(0.5f) }
val scale = remember { Animatable(1f) }
val scope = rememberCoroutineScope()
val config = HeartConfig(
radiusMultiplier = lerp(0.5f, 2f, sliderValue),