Skip to content

Instantly share code, notes, and snippets.

View alexaugustobr's full-sized avatar
🤔
0x141A140E6

Alex Alves alexaugustobr

🤔
0x141A140E6
View GitHub Profile
@alexaugustobr
alexaugustobr / app.py
Created May 2, 2018 00:13 — forked from seanbehan/app.py
Flask with Django ORM
'''
Run the following commands (bc. gists don't allow directories)
pip install flask django dj-database-url psycopg2
mkdir -p app/migrations
touch app/__init__.py app/migrations/__init__.py
mv models.py app/
python manage.py makemigrations
python manage.py migrate
@alexaugustobr
alexaugustobr / auth0.kt
Created October 14, 2018 15:51 — forked from bastman/auth0.kt
kotlin-spring-security-auth0-api-utils: extensions for auth0 (e.g. handle custom claims)
package com.example.auth0utils
import com.auth0.jwk.JwkProviderBuilder
import com.auth0.jwt.JWT
import com.auth0.jwt.JWTVerifier
import com.auth0.jwt.exceptions.JWTDecodeException
import com.auth0.jwt.exceptions.JWTVerificationException
import com.auth0.jwt.interfaces.DecodedJWT
import com.auth0.spring.security.api.JwtAuthenticationEntryPoint
import com.auth0.spring.security.api.JwtAuthenticationProvider
@alexaugustobr
alexaugustobr / github.css
Created October 28, 2018 00:05 — forked from tuzz/github.css
Github Markdown Stylesheet
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@alexaugustobr
alexaugustobr / simple-pagination.js
Created October 26, 2019 22:57 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
@alexaugustobr
alexaugustobr / Dockerfile
Created December 16, 2020 12:00 — forked from Wildcarde/Dockerfile
Jedi Knight: Jedi Academy Dockerized Server
## Docker file to build a jedi academy server and mount the apk files from a source folder
FROM centos
MAINTAINER Garrett McGrath <gmcgrath815 at gmail.com>
RUN yum install -y wget unzip
RUN wget https://www.dropbox.com/s/mbdmpim04krl1o2/jalinuxded_1.011.zip?dl=0 -O /tmp/temp.zip; unzip /tmp/temp.zip -d /opt/jaserv; \
wget https://www.dropbox.com/s/ig82qlsohlbwzye/dedicated_ja_server_unofficialpatch.zip?dl=0 -O /tmp/patch.zip; unzip /tmp/patch.zip -d /tmp/patch; \
cp /tmp/patch/DEDICATED_JA_server_UnofficialPATCH/linuxjampded /opt/jaserv/linuxjampded; \
rm /tmp/temp.zip /tmp/patch.zip; rm -fr /tmp/patch; \
@alexaugustobr
alexaugustobr / react-moderno.md
Created October 25, 2021 20:12 — forked from danielbonifacio/react-moderno.md
React moderno: O que você precisa saber para começar com React em 2020

React moderno: O que você precisa saber para começar com React em 2020

Não é de hoje que o React.js é o queridinho das empresas de desenvolvimento de software quando se fala em mobile e front-end web, e isso fez com que surgissem inúmeras vagas relacionadas à tecnologia.

Mas nem todo profissional ou iniciante da área de desenvolvimento tem domínio da linguagem de programação JavaScript (que é a base do React.js), e acabam com medo de iniciar com a tecnologia.

Se você é um deles, seus problemas acabaram agora. Neste artigo vamos abordar tudo que você precisa saber sobre React, sem a necessidade de muito conhecimento em JavaScript.

Índice

Configurando dois dataSources com Spring Boot e Spring Data JPA

Primeiro é necessário preencher as configurações dos DataSources no arquivo de configuração. No nosso caso utilizamos no formato YML (application.yml), para criar dois DataSources, um para o banco de dados chamado "usuarios" e outro para "mensagens":

spring:
  datasource.mensagens:
    username: root
    url: jdbc:mysql://localhost:3306/awmensagens?createDatabaseIfNotExist=true&serverTimezone=UTC
@alexaugustobr
alexaugustobr / AuthorizationConsent.java
Created May 10, 2022 22:25 — forked from sjohnr/AuthorizationConsent.java
JpaOAuth2AuthorizationConsentService
/*
* 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
@alexaugustobr
alexaugustobr / Authorization.java
Created May 10, 2022 22:25
JpaOAuth2AuthorizationService for Spring Authorization Server
/*
* 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
@alexaugustobr
alexaugustobr / Client.java
Created May 10, 2022 22:25 — forked from sjohnr/Client.java
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