Skip to content

Instantly share code, notes, and snippets.

@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.*
@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 January 14, 2024 11:53
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
@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
Created May 4, 2020 20:46
Java 7 NIO2 Download ZIP from URL and Unzip on the fly with Channels
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 July 10, 2024 11:54
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
@calexandre
calexandre / merge-zsh-history.sh
Last active September 12, 2024 00:51
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@SergejIsbrecht
SergejIsbrecht / enumset
Last active September 6, 2020 22:18
EnumSet
sergej@sergej-P50:~/Development/IdeaProjects/playground$ /home/sergej/.sdkman/candidates/java/13.0.1.hs-adpt/bin/java -version
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.1+9, mixed mode, sharing)
sergej@sergej-P50:~/Development/IdeaProjects/playground$ uname -a
Linux sergej-P50 4.18.0-25-generic #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
jol >> java.util.RegularEnumSet, size=1584
jol >> org.eclipse.collections.impl.set.mutable.UnifiedSet, size=976
@devops-school
devops-school / maven-proxy-internet1
Created February 18, 2020 14:04
Working with Internet Proxy for Maven
$ $ mvn archetype:generate -DgroupId=com.benz.software -DartifactId=chat -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -DproxySet=true -DproxyHost=53.244.194.32 -DproxyPort=3128 -DproxyUsername=<USER> -DproxyPassword=<PASSWOR
$ mvn clean package -DproxySet=true -DproxyHost=53.244.194.32 -DproxyPort=3128 -DproxyUsername=<USER> -DproxyPassword=<PASSWORD>
$ mvn [COMMAND] -Dhttp.proxyHost=[PROXY_SERVER] -Dhttp.proxyPort=[PROXY_PORT] -Dhttp.nonProxyHosts=[PROXY_BYPASS_IP]
$ mvn install -Dhttp.proxyHost=10.10.0.100 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1
# You can create alias for convenient uses:
$ alias proxy-mvn=”mvn -Dhttp.proxyHost=SERVER -Dhttp.proxyPort=PORT -Dhttp.nonProxyHosts=BYPASS_PROXY_IPS