Skip to content

Instantly share code, notes, and snippets.

View netstart's full-sized avatar

Clayton K. N. Passos netstart

View GitHub Profile
@netstart
netstart / set-app-parameters.sh
Created December 14, 2021 02:49
"AWS Systems Manager Parameter Store" example
#!/bin/bash
#
# Script to set the parameters for the cafe application in the Parameter Store.
#
#
# Get the region where the instance is running, and set as it the default AWS region.
# This ensures that we are using the Parameter Store in the region where the instance is running.
#
echo
echo "Setting the default AWS region..."
@netstart
netstart / docker-compose.yml
Last active September 13, 2021 15:08
Docker compose with mysql, rabbitmq, redis and keycloak
version: '3'
services:
mysql:
image: mysql:5.7
container_name: mysql
hostname: mysql
restart: always
environment:
MYSQL_DATABASE: 'dispute'
MYSQL_USER: 'spi'
@netstart
netstart / OracleLiquibase2Test.java
Last active July 23, 2021 17:39
OracleTestContainer
package matera.spi.qr;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.OracleContainer;
@netstart
netstart / docker-compose.yml
Created June 18, 2021 02:49
dynamodb local
version: '3.3'
services:
dynamodb:
image: amazon/dynamodb-local
ports:
- "8000:8000"
awscliv1:
image: normandesjr/awscliv1
package matera.spi.messaging;
import org.mockito.Mockito;
import java.lang.reflect.Field;
/**
Example to use:
<PRE>
@netstart
netstart / gist:427c71bf6ef62532f01ca073b66f7d83
Created May 11, 2020 18:51 — forked from lfryc/gist:aae879ceb5534292e150
Switch WildFly to debug mode in Runtime using jboss-cli
# switch the log level to DEBUG on console
{wildfly}/bin/jboss-cli.sh --connect
[standalone@localhost:9990 /] /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=DEBUG)
[standalone@localhost:9990 /] /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=DEBUG)
# switch it back to whatever it was initial configuration (here it is INFO)
[standalone@localhost:9990 /] /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=INFO)
[standalone@localhost:9990 /] /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=INFO)
@netstart
netstart / keycloak.sh
Created April 29, 2020 18:50 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@netstart
netstart / Password.java
Created March 9, 2020 13:00
Password.java
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
public class Password {
public User changePassword(String newClearPassword) {
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
if (!passwordEncoder.matches(newClearPassword, this.getPassword())) {
throw new InvalidPasswordException();
}
@netstart
netstart / .vimrc
Created October 27, 2019 18:07
.vimrc
# tab with 2 spaces
autocmd FileType yaml setlocal ai ts=2 sw=2 et
@netstart
netstart / date.extensions.ts
Last active October 15, 2019 17:33
prototype extention objects
/**
* Import on top of app.module.ts to use across the application
*
* import './shared/utils/date.prototype.extendions';
*/
declare global {
interface Date {
addDays(days: number, useThis?: boolean): Date;
addSeconds(seconds: number): Date;