#GIT
- Modificado (modified);
- Preparado (staged/index)
- Consolidado (comitted);
@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) { |
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 { |
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(); |
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; |
First of all, please note that token expiration and revoking are two different things.
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:
## 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) |
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
def csv_download_link(df, csv_file_name, delete_prompt=True): | |
"""Display a download link to load a data frame as csv from within a Jupyter notebook""" | |
df.to_csv(csv_file_name, index=False) | |
from IPython.display import FileLink | |
display(FileLink(csv_file_name)) | |
if delete_prompt: | |
a = input('Press enter to delete the file after you have downloaded it.') | |
import os | |
os.remove(csv_file_name) |
" Source: https://stackoverflow.com/questions/12213597/how-to-see-which-plugins-are-making-vim-slow | |
:profile start profile.log | |
:profile func * | |
:profile file * | |
" At this point do slow actions | |
:profile pause | |
:noautocmd qall! |