Skip to content

Instantly share code, notes, and snippets.

convert file with lines ```eks_commission_enable: true``` into env var lines ```METRICS_ENABLE=true```
sed -e 's/\(.*\): /\U\1=/' local-dev.env1
@asavt92
asavt92 / md
Created May 29, 2020 17:01
JAVA jar editing
(IntellijIdea)
we have EsServer.jar archive and we plan to change EsServer.class file and rebuild jar.
1. Unzip JAR
unzip EsServer.jar -d ./out/
# or `jar xf ./EsServer.jar` to unzip to current dir
2. Decompile in IntellijIdea or by https://www.mikeleitz.com/blog/2018/8/9/decompile-java-classes-on-command-line `EsServer.class`
@asavt92
asavt92 / md
Created May 29, 2020 17:01
JAVA jar editing
(IntellijIdea)
we have EsServer.jar archive and we plan to change EsServer.class file and rebuild jar.
1. Unzip JAR
unzip EsServer.jar -d ./out/
# or `jar xf ./EsServer.jar` to unzip to current dir
2. Decompile in IntellijIdea or by https://www.mikeleitz.com/blog/2018/8/9/decompile-java-classes-on-command-line `EsServer.class`
@asavt92
asavt92 / JAVA jar editing
Last active May 29, 2020 18:34
JAVA jar editing
(IntellijIdea)
we have EsServer.jar archive and we plan to change EsServer.class file and rebuild jar.
1. Unzip JAR
unzip EsServer.jar -d ./out/
# or `jar xf ./EsServer.jar` to unzip to current dir
2. Decompile in IntellijIdea or by https://www.mikeleitz.com/blog/2018/8/9/decompile-java-classes-on-command-line `EsServer.class`
@asavt92
asavt92 / Asset.java
Created June 3, 2020 22:42 — forked from sscovil/Asset.java
This is the correct implementation of @JsonTypeInfo and related annotations when performing polymorphic JSON deserialization on an embedded interface property. It also illustrates the use of an Enum as a type name. See StackOverflow question: http://stackoverflow.com/questions/21485923/java-jackson-polymorphic-json-deserialization-of-an-object-w…
public class Asset {
private AssetType type;
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXTERNAL_PROPERTY,
property = "type"
)
@JsonSubTypes({
@JsonSubTypes.Type(value = ImageAssetProperties.class, name = "image"),
@asavt92
asavt92 / gist:e76a3a3ed5c97fdb0ad2eb5bb890e109
Created June 5, 2020 19:26
Cisco Anyconnect Установка и Настройка сертификата
Тестировалось на fedora
1. устанавливаем https://computingforgeeks.com/install-cisco-anyconnect-on-ubuntu-debian-fedora/
2. Настройка сертификата
Имеется клиенский серт с ключом client.pfx
openssl pkcs12 -in client.pfx -out certificate.pem -nokeys
openssl pkcs12 -in client.pfx -out certificate.key -nocerts
@asavt92
asavt92 / gist:07d0fdebb0a50040d0d64e946d2b5a92
Created June 25, 2020 07:04
org.elasticsearch.common.xcontent deserialize json string example
1. SearchResponse ee = SearchResponse
.fromXContent(
new JsonXContentParser(
NamedXContentRegistry.EMPTY,
new JsonFactory().createParser(content)));
@asavt92
asavt92 / Raspberry pi 3
Last active July 5, 2020 21:23
Raspberry pi 3
Enable ssh https://linuxize.com/post/how-to-enable-ssh-on-raspberry-pi/
To enable SSH on your Raspberry Pi perform the following steps:
Power off your Raspberry Pi and remove the SD card.
Insert the SD card into your computer’s card reader. The SD card will mount automatically.
Navigate to the SD card boot directory using your OS file manager. Linux and macOS users can also do this from the command line.
Create a new empty file named ssh, without any extension, inside the boot directory.
Remove the SD card from your computer and put it in your Raspberry Pi.
Power on your Pi board. On boot Pi will check whether this file exists and if it does, SSH will be enabled and the file is removed.
@asavt92
asavt92 / tomcat in docker \ deploy war
Last active September 23, 2020 20:39
tomcat in docker \ deploy war
1. use this tutorial
https://spring.io/guides/gs/convert-jar-to-war/ or https://spring-projects.ru/guides/convert-jar-to-war-maven/
2. use tomcat docker image
https://github.com/bitnami/bitnami-docker-tomcat
3. create dockerfile
```
FROM bitnami/tomcat:9.0
COPY target/*.war /opt/bitnami/tomcat/webapps_default/hello.war