Skip to content

Instantly share code, notes, and snippets.

View rafaelchagasb's full-sized avatar

Rafael Chagas rafaelchagasb

View GitHub Profile
@rponte
rponte / 1-CustomerCreatedEventSqsConsumer.java
Last active April 25, 2024 17:16
Spring Boot: Testing a @SqsListener with TestContainers and LocalStack
package br.com.zup.edu.app2.xxx.samples.aws.sqs;
import br.com.zup.edu.app2.xxx.samples.aws.sqs.model.Customer;
import br.com.zup.edu.app2.xxx.samples.aws.sqs.model.CustomerRepository;
import io.awspring.cloud.messaging.listener.SqsMessageDeletionPolicy;
import io.awspring.cloud.messaging.listener.annotation.SqsListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.messaging.handler.annotation.Header;
@rponte
rponte / HowToUseIt.java
Last active December 30, 2023 14:37
THEORY: Example of a simple Single Thread Pool implementation in Java
public class HowToUseIt {
/**
* Usually we'll have a single instance per client
*/
private static final SingleThreadPool THREAD_POOL = new SingleThreadPool();
public void executeAsync() {
try {
@yreynhout
yreynhout / EventStoreCollection.cs
Last active May 9, 2020 20:45
Recipe for an EventStoreFixture using Docker.DotNet
using Xunit;
namespace TheDukesOfDocker
{
[CollectionDefinition(nameof(EventStoreCollection))]
public class EventStoreCollection : ICollectionFixture<EventStoreFixture>
{
}
}
@nihonzaru
nihonzaru / Redash-v2.md
Last active May 11, 2020 20:20
Setup Redash v2.x for Oracle

Usage

Refs

https://redash.io/

Download Redash

$ curl -L -O https://github.com/getredash/redash/archive/v2.0.0.zip
@smj10j
smj10j / downloadAirbnbListingImages.sh
Created June 1, 2014 14:04
Download all images of an Airbnb listing
#!/bin/bash
PROJECT_DIR=~/httrack/airbnb
LISTING_URL='https://www.airbnb.com/rooms/1300067?s=9Xmw'
brew install httrack
echo "Using httrack to download all images"
echo "Update cookies.txt within $PROJECT_DIR if login needed"
echo ""
@rponte
rponte / GenerateSimplePdfReportWithJasperReports.java
Last active May 7, 2022 10:25
Example on how to generate a simple pdf report with JasperReports
package rponte.report;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;