Skip to content

Instantly share code, notes, and snippets.

View jmbataller's full-sized avatar

Jose Miguel Bataller jmbataller

View GitHub Profile
@jmbataller
jmbataller / gist:7d36f0050a7bc928d0ab04dd86a950ba
Created November 10, 2021 12:23
delete recursively files and versions from s3 bucket
import boto3
bucket = '<bucket name>'
s3_client = boto3.client('s3')
object_response_paginator = s3_client.get_paginator('list_object_versions')
delete_marker_list = []
version_list = []
for object_response_itr in object_response_paginator.paginate(Bucket=bucket):
Use `--compatibility` to convert the docker compose file to v2 api as the resource limitation are not in the v3 API of docker compose:
> docker-compose --compatibility up
```
version: "3.4"
services:
redis:
@jmbataller
jmbataller / gist:7c67214e59c0db585f3508d515664635
Created August 4, 2020 08:39
Generate a dummy CSV file with python
```
import os
import random
import uuid
from datetime import datetime
import string
with open("test.csv", "w") as file:
for x in range(0,10000):
file.write(
@jmbataller
jmbataller / gist:cd912ac94512150ebe38dd7ad1c90595
Created April 2, 2020 13:50
Java File Source Code Shebang
#!$JAVA_HOME/bin/java --source 11
public class Factorial {
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
...
System.out.println(n);
}
}
@jmbataller
jmbataller / Dockerfile with aws-cli
Created February 10, 2020 11:48
Dockerfile with aws client and health endpoint (used for testing in k8s)
FROM python:alpine
ARG CLI_VERSION=1.16.86
RUN apk -uv add --no-cache groff jq less && \
pip install --no-cache-dir awscli==$CLI_VERSION
WORKDIR /aws
CMD python3 -m http.server 8000
@jmbataller
jmbataller / gist:f00ffbe718456a90a94ca447d0052c94
Created September 19, 2019 14:14
drain producer records in kafka streams topology test driver
private <K, V> List<ProducerRecord<K, V>> drainProducerRecords(final TopologyTestDriver driver,
final String topic,
final Deserializer<K> keyDeserializer,
final Deserializer<V> valueDeserializer) {
final List<ProducerRecord<K, V>> result = new LinkedList<>();
for (ProducerRecord<K, V> next = driver.readOutput(topic, keyDeserializer, valueDeserializer);
next != null;
next = driver.readOutput(topic, keyDeserializer, valueDeserializer)) {
result.add(next);
}
Checkstyle rules (xml files):
https://github.com/checkstyle/checkstyle/tree/master/src/main/resources
Google Java style guide:
https://checkstyle.sourceforge.io/styleguides/google-java-style-20180523/javaguide.html
Maven plugin:
## Effective Java, 2nd Edition
by Joshua Bloch
*I, [Michael Parker](http://omgitsmgp.com/), own this book and took these notes to further my own learning. If you enjoy these notes, please [purchase the book](http://www.amazon.com/Effective-Java-Edition-Joshua-Bloch/dp/0321356683)!*
### Chapter 2: Creating and Destroying Objects
#### Item 1: Consider static factories instead of constructors
* An instance-controlled class is one that uses static factories to strictly control what instances exist at any time.
@jmbataller
jmbataller / gist:c8075f8d40157935e7eaec40a4e43984
Created August 29, 2018 09:04 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites