Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Wesley Egberto wesleyegberto

🎯
Focusing
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
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 }
View vim_cheatsheet.md

Introduction

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

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@wesleyegberto
wesleyegberto / vim-cheatsheet.md
Created Sep 2, 2019 — forked from 0xadada/vim-cheatsheet.md
VIM movement, keyboard commands and shortcuts
View vim-cheatsheet.md
View api-blueprint-cheat-sheet
## Apiary
# API Blueprint Cheat Sheet
[API Blueprint](http://apiblueprint.org)(.apib) - API description format, plain text, Markdown-like.
## API Blueprint Document Structure
![](./api-blueprint-cheatsheet-image.png)
@wesleyegberto
wesleyegberto / web.xml
Created Mar 7, 2017
web.xml for Servlet 3.1
View web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>
View Kubernetes Utils
## Cluster
### Cluster info
kubectl cluster-info
kubectl get nodes
kubectl describe node
### Listar os eventos
kubectl get events
@wesleyegberto
wesleyegberto / jwt-expiration.md
Created May 29, 2019 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?
View jwt-expiration.md

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
wesleyegberto / RequestReplyFixed.java
Created May 29, 2019
Spring Boot - RabbitMQ - Request-Reply Pattern
View RequestReplyFixed.java
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;
View np.java
import java.util.Arrays;
import java.util.Random;
/**
*
* @author Deus Jeraldy
* @Email: deusjeraldy@gmail.com
*/
public class np {
View ExportJsonFile.java
private ObjectMapper jsonMapper = new ObjectMapper();
private ExecutorService executorService = Executors.newFixedThreadPool(5);
@Async
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.