svdu

Snippets

CLI

Remove AUTO_INCREMENT altering with atlas schema diff

atlas schema diff --to "<TARGET_SCHEMA>" --from "<ORIGINAL_SCHEMA>" --format "{{ sql . \"  \"}}" | sed 's|AUTO_INCREMENT \+[0-9]\+,\?||g'

Java

Automatically set current UTC date time with Hibernate/JPA in Spring Boot

  1. Make sure the field is Instant type.

    @Entity
    @Table(name = "table")
    class T {
     @Column(name = "created_at", nullable = false)
     @CreationTimestamp
     private Instant createdAt;
    }
  2. Forcedly setup hibernate works in UTC time zone:

    #application.properties
    spring.jpa.properties.hibernate.jdbc.timezone=UTC
  3. Set JDBC connection with UTC time zone:

    spring.datasource.url=jdbc:mysql://localhost:3306/db?connectionTimeZone=UTC

Linux

ssh_dispatch_run_fatal: Connection to ****: error in libcrypto on Fedora

REFERENCE: https://discussion.fedoraproject.org/t/fedora-41-ssh-to-rhel6-error-in-libcrypto/135999

(sudo echo "__openssl_block_sha1_signatures = 0" > /etc/crypto-policies/policies/modules/SHA1-SSL-SIG.pmod") && sudo update-crypto-policies --set DEFAULT:SHA1-SSL-SIG

Unable to negotiate with ****: no matching host key type found. Their offer: ssh-rsa

ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa $USER@$HOST