Skip to content

Instantly share code, notes, and snippets.

View alexaugustobr's full-sized avatar
🤔
0x141A140E6

Alex alexaugustobr

🤔
0x141A140E6
View GitHub Profile
import java.util.Objects;
public enum StateType {
CREATED {
@Override
public StateType next(StateType nextState) {
if (Objects.isNull(nextState) || this.equals(nextState)) {
throw new RuntimeException("state %s not allowed for actual state: %s".formatted(nextState, this));
}
@edurbs
edurbs / DomainEntity.java
Last active January 13, 2024 22:56
Validação de números telefone fixo ou móvel (celular) do Brasil
public interface DomainEntity {
public default void validate() {
new EntityValidatorService().validate(this);
}
}
@Mishco
Mishco / content.md
Last active October 24, 2025 08:11
Setup HashiCorp Vault on docker

Setup HashiCorp Vault on docker

Vault secures, stores, and tightly controls access to tokens, passwords, certificates, API keys, and other secrets in modern computing. Vault is primarily used in production environments to manage secrets. Vault is a complex system that has many different pieces. There is a clear separation of components that are inside or outside of the security barrier. Only the storage backend and the HTTP API are outside, all other components are inside the barrier.

Vault_architecture

Figure 1: Architecture of Vault and Spring App (Click to enlarge)

The storage backend is untrusted and is used to durably store encrypted data. When the Vault server is started, it must be provided with a storage backend so that data is available across restarts. The HTTP API similarly must be started by the Vault server on start so that clients can interact with it.

@up1
up1 / BaseTests.java
Last active September 1, 2023 20:16
Spring Cloud Contract
@SpringBootTest (classes = ProviderApplication.class)
class BaseTests {
@Autowired
private CustomerRestController customerRestController;
@MockBean
private CustomerRepository customerRepository;
@BeforeEach
@sjohnr
sjohnr / Client.java
Last active October 15, 2022 19:05
JpaRegisteredClientRepository
/*
* Copyright 2020-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@DavidCabral
DavidCabral / PixPayload.java
Last active March 18, 2022 19:23
Java PIX estático, geração do QRCODE
/**
* Fonte = https://youtu.be/eO11iFgrdCA
*/
import java.text.DecimalFormat;
public class PixPayload {
private static final String ID_PAYLOAD_FORMAT_INDICATOR = "00";
private static final String ID_POINT_OF_INITIATION_METHOD = "01";
private static final String ID_MERCHANT_ACCOUNT_INFORMATION = "26";
@ramsunvtech
ramsunvtech / nginx-micro-frontend-config.conf
Created January 10, 2021 10:49
Nginx Microfrontend Configuration
server {
ssi on;
proxy_intercept_errors on;
location /product-list {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
@rponte
rponte / using-uuid-as-pk.md
Last active October 14, 2025 19:17
Não use UUID como PK nas tabelas do seu banco de dados

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

@ourownstory
ourownstory / encrypted_dual_boot_xps_17.md
Last active June 1, 2025 21:35
Encrypted dual boot setup for Pop!_OS and Windows 10 using LUKS and Bitlocker on Dell XPS 17 9700

Encrypted dual boot setup with Pop!_OS and Windows 10

How to guide, using LUKS and Bitlocker on Dell XPS 17 9700

This guide is for those who want to use their XPS 17 in dual boot with their (preinstalled) Windows 10 and a new Pop!_OS installation, without giving up Bitlocker Encryption in Windows nor LUKS encryption in Linux.

The only guides that I could find were for Ubuntu, which it should be identical to, but I found the ommission of a few steps to resolve issues that I encountered in my first install attempt. Hoping to save you some trouble, I am sharing the steps that worked for me, linking the original guides that I found useful.

1. Preparation

  • 1.1 Of course: Backup all your data! You always do this when people tell you to, right? Maybe this time better be safe than sorry.
  • 1.2 Safely note your Bitlocker recovery key somewhere off your XPS. Where to find it
@luispabon
luispabon / xps_15_9560__dualboot_with_encryption__notes.md
Last active November 3, 2025 00:37 — forked from mdziekon/xps_15_9570__dualboot_with_encryption__notes.md
Ubuntu + Windows 10 dualboot with LUKS encryption
  • Based on https://gist.github.com/mdziekon/221bdb597cf32b46c50ffab96dbec08a
  • Installation date: 16-08-2019
  • Additional notes based on my own experience
  • EFI boot
  • Ubuntu 19.04 -> 21.04
  • This should work on any computer. Only the RAID > AHCI change described below and the device name for the nvme ssd drive are specific to this laptop.
  • The process describes a completely fresh installation with complete repartitioning, however it should work fine when Windows is already installed (eg. brand new machine with Windows preinstalled) as long as Windows already boots with EFI.
  • The process was conducted on Dell's XPS 15 9560 (2017) with specs:
  • CPU: i7-7700HQ