Skip to content

Instantly share code, notes, and snippets.

View kibotu's full-sized avatar
🎯
Focusing

Jan Rabe kibotu

🎯
Focusing
View GitHub Profile
@kibotu
kibotu / cleanup.sh
Created October 2, 2024 11:19
Cleanup caches for Android & iOS development.
#!/bin/bash
# droid
rm -rf ~/.gradle
rm -rf ~/.m2
rm -rf ~/.android/cache
# ios
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/org.swift.swiftpm
@kibotu
kibotu / script.groovy
Created October 1, 2024 06:49
Jenkins print credential store in script console.
import com.cloudbees.plugins.credentials.Credentials
Set<Credentials> allCredentials = new HashSet<Credentials>();
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.Credentials.class
);
@kibotu
kibotu / Jenkinsfile
Created July 29, 2024 15:19
Jenkins CI user that triggered build
// This script should be placed inside your pipeline script
def getTriggeringUser() {
def user = 'UNKNOWN' // Default value if user cannot be determined
// Check each cause for the build to find a user cause
currentBuild.rawBuild.getCauses().each { cause ->
if (cause instanceof hudson.model.Cause$UserIdCause) {
user = cause.getUserId()
} else if (cause instanceof org.jenkinsci.plugins.workflow.support.steps.build.BuildUpstreamCause) {
// If the build was triggered upstream, recursively check upstream builds
@kibotu
kibotu / WaitForLifecycleEvent.kt
Created June 25, 2024 06:48
WaitForLifecycleEvent
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import de.check24.profis.partner.shared.logger.ProfiLogger
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.suspendCancellableCoroutine
@OptIn(ExperimentalCoroutinesApi::class)
suspend fun Lifecycle.waitForLifecycleEvent(event: Lifecycle.Event) = suspendCancellableCoroutine { continuation ->
@kibotu
kibotu / Thread+Extensions.swift
Created June 11, 2024 10:55
Thread.printStackTrace & Thread.callStack for iOS Swift. Demangled / better Thread.callStackSymbols.
import Foundation
public extension Thread {
public static var callStack : [String] {
Thread
.callStackSymbols // drop Thread.callStack
.dropFirst(
).map { line in
let parts = line.split(separator:" ")
@kibotu
kibotu / SSH_README.md
Created June 4, 2024 08:56
SSH Config to support multiple ssh keys

Add ed25519 ssh key to keychain with passphrase

ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Modify ~/.ssh/config

Host *
@kibotu
kibotu / Playground.swift
Created April 8, 2024 07:49
testing iOS concurrency speed
import Foundation
class Queue {
private var counter = 0.0
private let queue = DispatchQueue(label: "counter")
func increment() {
queue.sync {
counter += 1.2
@kibotu
kibotu / CircularReveal.kt
Last active December 22, 2023 13:21 — forked from darvld/CircularReveal.kt
A circular reveal effect modifier for Jetpack Compose.
/**
* A modifier that clips the composable content using a circular reveal animation. The circle will
* expand or shrink whenever [isVisible] changes.
*
* For more control over the transition, consider using this method's variant which allows passing
* a [State] object to control the progress of the reveal animation.
*
* By default, the circle is centered in the content. However, custom positions can be specified using
@kibotu
kibotu / build-ios-project-set-marketing-version.sh
Created July 3, 2023 07:24
Build iOS Project on command line. Set MARKETING_VERSION and CURRENT_PROJECT_VERSION.
#!/bin/bash
# https://stackoverflow.com/a/76070326/1006741
# Set the version and build numbers
VERSION_NUMBER="2.1.0"
BUILD_NUMBER="29"
APP_NAME="MyApp"
TEAM_ID="ABCDEFGH"
@kibotu
kibotu / .bash_profile
Created June 16, 2023 17:43 — forked from hakusaro/.bash_profile
My Raspberry Pi's .bash_profile. Differences from original are purely aesthetic - no need for weather, and I like things to be lined up nicely when I ssh into my RPi.
#!/bin/bash
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
# get the load averages
read one five fifteen rest < /proc/loadavg