Skip to content

Instantly share code, notes, and snippets.


Wesley Egberto wesleyegberto

Block or report user

Report or block wesleyegberto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
wesleyegberto / simple-control-value-acessor.ts
Created Sep 9, 2019
Base class to create Angular components
View simple-control-value-acessor.ts
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { forwardRef, Type } from '@angular/core';
* Function to create the basic provider to components which use `ngModel` as required by Angular.
* @param type component type which extends `SimpleControlValueAcessor`
export function createProviders(type: Type<SimpleControlValueAcessor>) {
return [
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => type), multi: true }


  • C-a == Ctrl-a
  • M-a == Alt-a


:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
wesleyegberto /
Created Sep 2, 2019 — forked from 0xadada/
VIM movement, keyboard commands and shortcuts
View api-blueprint-cheat-sheet
## Apiary
# API Blueprint Cheat Sheet
[API Blueprint]( - API description format, plain text, Markdown-like.
## API Blueprint Document Structure
wesleyegberto / web.xml
Created Mar 7, 2017
web.xml for Servlet 3.1
View web.xml
<web-app xmlns=""
View Kubernetes Utils
## Cluster
### Cluster info
kubectl cluster-info
kubectl get nodes
kubectl describe node
### Listar os eventos
kubectl get events
wesleyegberto /
Created May 29, 2019 — forked from soulmachine/
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

wesleyegberto /
Created May 29, 2019
Spring Boot - RabbitMQ - Request-Reply Pattern
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.Arrays;
import java.util.Random;
* @author Deus Jeraldy
* @Email:
public class np {
private ObjectMapper jsonMapper = new ObjectMapper();
private ExecutorService executorService = Executors.newFixedThreadPool(5);
public ListenableFuture<Boolean> export(UUID customerId) {
try (PipedInputStream in = new PipedInputStream();
PipedOutputStream pipedOut = new PipedOutputStream(in);
GZIPOutputStream out = new GZIPOutputStream(pipedOut)) {
Stopwatch stopwatch = Stopwatch.createStarted();
You can’t perform that action at this time.