Skip to content

Instantly share code, notes, and snippets.

View soberich's full-sized avatar

soberich

  • Amsterdam, The Netherlands
View GitHub Profile
@Gowsky
Gowsky / Border.kt
Last active June 1, 2023 06:35
Corrected Modifier.border for Jetpack Compose. It adjusts inner rounded corner rectangle instead of using the same radius as outer rounded corner rectangle.
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Divider
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.drawWithCache
import androidx.compose.ui.geometry.*

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@applch
applch / macOS 11.1
Last active July 24, 2025 00:08
macOS 11 Big Sur installer xml
<?xml version="1.0" encoding="utf-8"?>
<installer-gui-script minSpecVersion="2">
<pkg-ref id="InstallAssistant" packageIdentifier="com.apple.pkg.InstallAssistant.macOSBigSur"/>
<pkg-ref id="MajorOSInfo" packageIdentifier="com.apple.pkg.MajorOSInfo"/>
<pkg-ref id="Info.plist" packageIdentifier="com.apple.plist.Info"/>
<pkg-ref id="InstallInfo.plist" packageIdentifier="com.apple.plist.InstallInfo"/>
<pkg-ref id="UpdateBrain.zip" packageIdentifier="com.apple.zip.UpdateBrain"/>
<pkg-ref id="BuildManifest.plist" packageIdentifier="com.apple.plist.BuildManifest"/>
<title>macOS Big Sur</title>
<product-generator name="IASUProductGenerator" version="16"/>
@goofwear
goofwear / AdbCommands
Created October 15, 2020 04:16 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@vganin
vganin / ComposeNumberPicker.kt
Last active September 5, 2025 14:20
Jetpack Compose simple number picker
@Composable
fun NumberPicker(
state: MutableState<Int>,
modifier: Modifier = Modifier,
range: IntRange? = null,
textStyle: TextStyle = LocalTextStyle.current,
onStateChanged: (Int) -> Unit = {},
) {
val coroutineScope = rememberCoroutineScope()
val numbersColumnHeight = 36.dp
@vishiy
vishiy / AzureMonitorContainers-Metrics-Loganalytics.csv
Last active July 3, 2024 22:49
Gist for metrics collected by Azure monitor for containers
MetricCategory MetricName MetricDimensions MetricType MetricTable MetricNamespace MetricOrigin Comments
Node-CPU cpuAllocatableNanoCores Objectname='K8SNode', Instancename=<nodename> Gauge Perf Amount of cpu that is allocatable by Kubernetes to run pods, expressed in nanocores/nanocpu unit
Node-CPU cpuCapacityNanocores Objectname='K8SNode', Instancename=<nodename> Gauge Perf Total CPU capacity of the node in nanocore/nanocpu unit
Node-CPU cpuUsageNanocores Objectname='K8SNode', Instancename=<nodename> Gauge Perf CPU used by node in nanocore/nanocpu unit
Node-Memory memoryAllocatableBytes Objectname='K8SNode', Instancename=<nodename> Gauge Perf Amount of memory in bytes that is allocatable by kubernetes to run pods
Node-Memory memoryCapacityBytes Objectname='K8SNode', Instancename=<nodename> Gauge Perf Total memory capacity of the node in bytes
Node-Memory memoryRssBytes Objectname='K8SNode', Instancename=<nodename> Gauge Perf Rss memory used by the node in bytes. Collected only for L

Maven Archetypes

Choose archetype:
1: remote -> am.ik.archetype:elm-spring-boot-blank-archetype (Blank multi project for Spring Boot + Elm)
2: remote -> am.ik.archetype:graalvm-blank-archetype (Blank project for GraalVM)
3: remote -> am.ik.archetype:graalvm-springmvc-blank-archetype (Blank project for GraalVM + Spring MVC)
4: remote -> am.ik.archetype:graalvm-springwebflux-blank-archetype (Blank project for GraalVM + Spring MVC)
5: remote -> am.ik.archetype:maven-reactjs-blank-archetype (Blank Project for React.js)
6: remote -> am.ik.archetype:msgpack-rpc-jersey-blank-archetype (Blank Project for Spring Boot + Jersey)
@gatanaso
gatanaso / http-client.jsh
Created May 13, 2020 07:59
JShell http client example
import java.net.http.*;
var client = HttpClient.newHttpClient();
var uri = new URI("https://riimusolutions.com");
var request = HttpRequest.newBuilder().uri(uri).build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
/exit
@soberich
soberich / ZipUtils.java
Last active April 17, 2025 17:16
Java 7 NIO2 Download ZIP from URL and Unzip, select/filter entries [and decrypt! if needed] **on the fly** with Channels (WITHOUT CREATING INTIMIDATE COPY OF DATA BYTES)
package com.example;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.zip.ZipEntry;
@guycalledseven
guycalledseven / manual-uninstall-parallels.sh
Last active August 14, 2025 05:42
Manually remove Parallels Desktop v15 leftovers MacOS
# used different forum posts/guides to figure this out like:
# The uninstall script is located at /Library/Parallels/Parallels Service.app/Contents/Resources
# https://github.com/danijeljw/remparallels/blob/master/remprls.sh
# https://kb.parallels.com/122461
# sudo find / -iname "*parallels*"
# sudo find / -iname "*prl*"
#before uninstalling deactivate your licencse - this won't be possible after uninstall
prlsrvctl deactivate-license