Skip to content

Instantly share code, notes, and snippets.

View indramahkota's full-sized avatar
:electron:
Learning

Indra Mahkota indramahkota

:electron:
Learning
View GitHub Profile
@Zhuinden
Zhuinden / BasicTextFieldWithCursorAtEnd.kt
Last active May 3, 2024 16:50
A Compose TextField that initializes the cursor position at the end of the text, rather than the start, when focused without tapping the TextField manually.
/*
* Copyright 2020 The Android Open Source Project
*
* 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
@colinrtwhite
colinrtwhite / complex_forwarding_painter.kt
Last active November 13, 2023 13:41
A painter that wraps another painter to overwrite its color filter, alpha, and/or onDraw.
/**
* Create and return a new [Painter] that wraps [painter] with its [alpha], [colorFilter], or [onDraw] overwritten.
*/
fun forwardingPainter(
painter: Painter,
alpha: Float = DefaultAlpha,
colorFilter: ColorFilter? = null,
onDraw: DrawScope.(ForwardingDrawInfo) -> Unit = DefaultOnDraw,
): Painter = ForwardingPainter(painter, alpha, colorFilter, onDraw)
@adierebel
adierebel / build.gradle.kts
Last active March 9, 2024 05:25
Proguard + Shadow JAR for non Android Project (Java 11 Swing)
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import proguard.gradle.ProGuardTask
plugins {
id("application")
id("org.jetbrains.kotlin.jvm") version "1.6.0"
id("com.github.johnrengelman.shadow") version "7.1.0"
}
@okutkan
okutkan / .go-my-posh1.json
Last active August 5, 2022 14:43
Oh my Posh 3 pwsh and wsl2 install
{
"final_space": true,
"console_title": false,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
"segments": [
@ychescale9
ychescale9 / build.gradle.kts
Last active September 18, 2023 11:52
Customizing APK file name with new AGP variant APIs
android {
onVariantProperties {
val mainOutput = outputs.single { it.outputType == VariantOutputConfiguration.OutputType.SINGLE }
tasks.register<CreateRenamedApk>("createRenamedApkFor${name}") {
this.originalApkFolder.set(artifacts.get(ArtifactType.APK))
this.builtArtifactsLoader.set(artifacts.getBuiltArtifactsLoader())
this.newApkFolder.set(layout.buildDirectory.dir("outputs/renamed_apk/${this@onVariantProperties.name}"))
this.versionCode.set(mainOutput.versionCode)
this.versionName.set(mainOutput.versionName)
}
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active May 3, 2024 12:19
Building a react native app in WSL2
@Beneboe
Beneboe / how-to-setup-verified-commits.md
Last active March 20, 2024 18:20
How to Setup Verified Commits on Github

How to use github as a maven repository

In this how-to it is being explained how to create a maven repository on github and how to use an existing one.

Creating a repository

  1. Clone your original project to a new local repository (change GROUP-NAME and PROJECT-NAME) git clone https://github.com/GROUP-NAME/PROJECT-NAME.git PROJECT-NAME-maven2

  2. Go to the clonned repository (use your PROJECT-NAME-maven2) cd PROJECT-NAME-maven2

@ankurk91
ankurk91 / github_gpg_key.md
Last active April 9, 2024 16:34
Signing git commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
@rohitshampur
rohitshampur / crypto.py
Last active December 19, 2021 12:51
Mimic Java's PBEWithMD5AndDES algorithm to produce a DES key
from Crypto.Hash import MD5
from Crypto.Cipher import DES
import re
import base64
_password = '111' #use your own pass key
_salt = '\xA9\x9B\xC8\x32\x56\x35\xE3\x03' #use your salt here
_iterations = 19 #change iterations here