Skip to content

Instantly share code, notes, and snippets.

View indramahkota's full-sized avatar
🎯
Focusing

Indra Mahkota indramahkota

🎯
Focusing
View GitHub Profile
@indramahkota
indramahkota / README.md
Created August 11, 2025 13:52 — forked from pdanford/README.md
Launching iTerm2 from macOS Finder

Launching iTerm2 from macOS Finder

(Based on info from Peter Downs' gitub but with modified behavior to open a new terminal window for each invocation instead of reusing an already open window.)

The following three ways to launch an iTerm2 window from Finder have been tested on iTerm2 version 3+ running on macOS Mojave+.

pdanford - April 2020


@indramahkota
indramahkota / .Unlocking the Power of CameraX in Jetpack Compose.md Code snippets for Medium blog post "Unlocking the Power of CameraX in Jetpack Compose"

Code snippets used in the blog post series "Unlocking the Power of CameraX in Jetpack Compose". I will add snippets as blog posts are released!

Each file can be copied as-is to the MainActivity.kt of a new project. However, it doesn't include any library dependencies or adaptations to AndroidManifest.xml, so make sure to follow the steps in the blog posts themselves to get a working sample.

import kotlinx.cinterop.memScoped
import kotlinx.cinterop.allocArrayOf
import kotlinx.cinterop.addressOf
import kotlinx.cinterop.usePinned
import platform.Foundation.NSData
import platform.Foundation.create
import platform.posix.memcpy
public fun ByteArray.toData(): NSData = memScoped {
NSData.create(bytes = allocArrayOf(this@toData),

Docker on Lima (lima-vm/lima) Setup Guide

In recent months, Lima has become de facto standard software as a free and open source alternative to Docker Desktop for Mac. Several projects (such as Colima, Rancher Desktop, or Finch) for similar purpose also uses Lima as their backend. These projects will make it easier to set up Lima. But some people may not want to introduce extra components other than Lima. This guide will show you how to set up Lima to be alternative to Docker Desktop for Mac, while using Lima only.

🪣 Note. It is a good practice to uninstall Docker Desktop for Mac before proceeding with the following steps.

1. Install Lima and Docker CLI

@indramahkota
indramahkota / arch_cheatsheet.txt
Created July 17, 2024 16:34 — forked from yufengwng/arch_cheatsheet.txt
Arch Linux Commands Cheatsheet
pacman
======
view logs: /var/log/pacman.log
update system
# pacman -Syu
list installed packages
# pacman -Q
@indramahkota
indramahkota / build.gradle.kts
Created March 9, 2024 05:25 — forked from adierebel/build.gradle.kts
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"
}
@indramahkota
indramahkota / complex_forwarding_painter.kt
Created November 13, 2023 13:41 — forked from colinrtwhite/complex_forwarding_painter.kt
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)
@indramahkota
indramahkota / delete_git_submodule.md
Created October 14, 2023 16:14 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@indramahkota
indramahkota / github_gpg_key.md
Created September 17, 2023 15:50 — forked from ankurk91/github_gpg_key.md
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/
@indramahkota
indramahkota / BasicTextFieldWithCursorAtEnd.kt
Created September 14, 2023 17:37 — forked from Zhuinden/BasicTextFieldWithCursorAtEnd.kt
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