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
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
@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:

View np.java
import java.util.Arrays;
import java.util.Random;
/**
*
* @author Deus Jeraldy
* @Email: deusjeraldy@gmail.com
*/
public class np {
@wesleyegberto
wesleyegberto / git.md
Created Dec 28, 2018 — forked from leocomelli/git.md
Lista de comandos úteis do GIT
View git.md

#GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

View progressiveImageLoader.directive.ts
import {
AfterContentInit, Directive, ElementRef, EventEmitter, Inject, Input, OnDestroy, Output, PLATFORM_ID,
Renderer2
} from "@angular/core";
import {isPlatformBrowser} from "@angular/common";
@Directive({
selector: '[image-loader]'
})
export class ProgressiveImageLoaderDirective implements AfterContentInit, OnDestroy {
@wesleyegberto
wesleyegberto / Controller.java
Created Sep 18, 2018 — forked from bmchild/Controller.java
Example of how to wire up a chunked response and how to consume it via angular.
View Controller.java
@RequestMapping(value = "/runJobAndGetLogs", method = RequestMethod.GET)
public ResponseEntity<StreamingResponseBody> runJobAndGetLogs() throws IOException {
final InputStream inputStream = someService.runJobAndGetReportProgress();
StreamingResponseBody body = StreamingResponseBody body = (outputStream) -> {
try (BufferedInputStream br = new BufferedInputStream(inputStream)) {
// just copying to the outputstream
byte[] contents = new byte[1024];
int bytesRead = 0;
while ((bytesRead = br.read(contents)) != -1) {
@wesleyegberto
wesleyegberto / static_server.js
Created Aug 5, 2016 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
View static_server.js
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
You can’t perform that action at this time.