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
@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 March 14, 2024 14:17
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
@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
@mjameswh
mjameswh / rename_es_index.sh
Last active August 18, 2023 20:59
Demonstration of how to rename an ElasticSearch index using the Index Clone API, introduced in ES 7.4. This is the cUrl based version. See here for details: https://stackoverflow.com/a/59397746/2887657 .
source_index=source_index
target_index=target_index
elastic_search_server=elasticsearch:9200
# Make sure the source index is actually open
curl -X POST "${elastic_search_server}/${source_index}/_open"
# Put the source index in read-only mode
curl -X PUT "${elastic_search_server}/${source_index}/_settings" \
@paulscott
paulscott / git-lfs-candidates
Created December 6, 2019 23:05
A script to find files that aren't under git-lfs, but should be
#!/bin/bash
if [ "$#" != "1" ]; then
echo "$0 requires a size argument. ex: 100k."
exit 1
fi
sizeParam="+${1}"
filesOverSize=$( find . -size ${sizeParam} | grep -v /.git | sed 's/^.\///g' )