Skip to content

Instantly share code, notes, and snippets.

View ArthurKun21's full-sized avatar
Focusing

ArthurKun ArthurKun21

Focusing
View GitHub Profile
@ArthurKun21
ArthurKun21 / build.gradle.kts
Last active March 23, 2026 19:14
git commit gradle configuration cache
androidComponents {
onVariants(selector().all()) { variant ->
val variantName = variant.name.replaceFirstChar { it.uppercase() }
val generateConstantsTaskName = "generateBuildConstants$variantName"
val generateConstantsTaskDescription = "Generates BuildConstants.kt with commit count and SHA for $variantName"
val buildConstantTasks = tasks.register<GenerateBuildConstantsTask>(generateConstantsTaskName) {
group = "build"
description = generateConstantsTaskDescription
outputDir.set(layout.buildDirectory.dir("generated/source/buildConstants/kotlin"))
@ArthurKun21
ArthurKun21 / ComposeString.kt
Created January 19, 2026 13:32
Compose Component Resources String helper to make it easier to reuse the string resource for both composable and non-composable environments
import androidx.compose.runtime.Composable
import org.jetbrains.compose.resources.PluralStringResource
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.getPluralString
import org.jetbrains.compose.resources.getString
import org.jetbrains.compose.resources.pluralStringResource
import org.jetbrains.compose.resources.stringResource
/**
* A sealed interface that abstracts compose component string resources, allowing them to be passed
@ArthurKun21
ArthurKun21 / MaterialWindow.kt
Created July 27, 2025 19:51
Wraps the WindowSizeClass into CompositionLocalProvider
import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass
import androidx.compose.material3.windowsizeclass.WindowSizeClass
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ProvidableCompositionLocal
import androidx.compose.runtime.compositionLocalOf
/**
@ArthurKun21
ArthurKun21 / pre-commit.yml
Created April 9, 2025 01:09
Update the pre-commit hook
name: Pre-commit Auto-Update
on:
schedule:
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC
workflow_dispatch: # Manual trigger
jobs:
autoupdate:
runs-on: ubuntu-latest
// ==UserScript==
// @name Always On Focus
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Prevent websites from detecting when you switch tabs or unfocus the window
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
@ArthurKun21
ArthurKun21 / readme.md
Created September 10, 2023 07:32
Wireless ADB for Android 10 and lower

Documentation

Stackoverflow

Connect android phone and then check if it is connected with the USB debugging

adb devices

Set the TCPIP

@ArthurKun21
ArthurKun21 / readme.md
Created September 10, 2023 06:21
Change poetry cache directory on windows

Poetry config Link

List down the config list

poetry config --list

Change the config

poetry config cache-dir 
// ==UserScript==
// @name Reddit Redirect
// @namespace https://www.reddit.com/
// @version 1.0
// @description Redirects old.reddit.com to old.reddit.com/hot
// @include https://old.reddit.com/*
// @grant none
// ==/UserScript==
(function() {
// ==UserScript==
// @name Hacker News Open Links in New Tab
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Open links on Hacker News in a new tab
// @license GPL v3.0
// @author xdpirate
// @match https://news.ycombinator.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=ycombinator.com
// @grant none
@ArthurKun21
ArthurKun21 / install.txt
Created January 24, 2023 12:55
Install python 3.9 on ubuntu 22.04
apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev \
libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev -y
wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz
tar -xvf Python-3.9.7.tgz
cd Python-3.9.7/
./configure --enable-optimizations