Skip to content

Instantly share code, notes, and snippets.

View wesleyegberto's full-sized avatar
🎯
Exploring

Wesley Egberto wesleyegberto

🎯
Exploring
View GitHub Profile
@wesleyegberto
wesleyegberto / java_makefile
Created June 16, 2022 16:40
Java Makefile
run: build
java -cp .:dist Main
build: src/Main.java
javac -d dist src/Main.java
clean:
rm -rf dist
mkdir dist
@wesleyegberto
wesleyegberto / json_to_dataframe_csv_exporter.py
Last active May 28, 2022 05:55
Simple class to exporter a JSON file to DataFrame and CSV
# This was created to export any JSON format to CSV.
# I've created to help extract MongoDb collection to one or more CSV, [hopefully] in a normalized tables.
import pandas as pd
class JsonToDataFrameCsvExporter(object):
""" Simple exporter to help transform a JSON into a DataFrame CSV file.
The main purpose of this exporter is to export a JSON as a collection of normalized
table in CSV file.
@wesleyegberto
wesleyegberto / TestThreadStackSize.java
Created May 15, 2022 18:22 — forked from rednaxelafx/TestThreadStackSize.java
Inconsistency of -Xss and -XX:ThreadStackSize in the java launcher
import java.lang.reflect.Field;
import sun.misc.Unsafe;
public class TestThreadStackSize {
private static void crashVM() {
try {
makeSegfault(getUnsafe());
} catch (Exception e) {
// swallow
}

I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

@wesleyegberto
wesleyegberto / JavaJacksonGenericTypeJsonTest.java
Created April 7, 2022 20:22
Snippet to parse string JSON to a generic class using Jackson lib for Java
class Event<T> {
T payload;
}
public <T> T parseJsonToClass(String json, Class<T> targetClass) throw JsonProcessingException {
var targetType = objectMapper
.getTypeFactory()
.constructParametricType(Event.class, targetClass);
return objectMapper.readValue(json, targetType);
@wesleyegberto
wesleyegberto / tailwind-css-cheatsheet.css
Last active November 15, 2023 15:15
Tailwind CSS Cheatsheet
/* *******************************************************************************************
* TAILWIND.CSS
* DOCUMENTATION: https://tailwindcss.com/
*
* Original file can be seen here: https://github.com/LeCoupa/awesome-cheatsheets/blob/master/frontend/tailwind.css
* ******************************************************************************************* */
/*
* Available breakpoints
* --------------------
@wesleyegberto
wesleyegberto / angular-cheatsheet.ts
Last active June 15, 2021 14:15
Angular Cheatsheet
/* *******************************************************************************************
* ANGULAR (2+) CHEATSHEET
* BASED ON https://angular.io/guide/cheatsheet
* DOCUMENTATION: https://angular.io/docs
* STYLE GUIDE: https://angular.io/guide/styleguide
* ******************************************************************************************* */
Original file can be seen [here](https://github.com/LeCoupa/awesome-cheatsheets/blob/master/frontend/angular.js)
```
@wesleyegberto
wesleyegberto / api-design-cheat-sheet.md
Created June 15, 2021 14:08
API Design Cheat Sheet

This is a copy, original file can be seen here

See also: Platform Building Cheat Sheet

API Design Cheat Sheet

  1. Build the API with consumers in mind--as a product in its own right.
    • Not for a specific UI.
    • Embrace flexibility / tunability of each endpoint (see #5, 6 & 7).
  • Eat your own dogfood, even if you have to mockup an example UI.
@wesleyegberto
wesleyegberto / java_testing_deps.md
Last active August 20, 2022 22:06
Dependencies to Java Testing: unit and mutation tests; controller tests; architecture tests; testcontainer for IT and Jacoco for coverage report.

Dependencies to Java Testing with:

  • JUnit 5
  • API tests
  • Architecture tests
  • TestContainer for IT
  • Jacoco for coverage report
  • Pitest for mutation test

To run:

@wesleyegberto
wesleyegberto / JavaMultiStage.Dockerfile
Last active April 10, 2022 15:46
Multistage Dockerfile to build and run a Java project
FROM maven:3.6-jdk-11 as builder
WORKDIR /app
COPY pom.xml .
# download dependencies as specified in pom.xml
# building dependency layer early will speed up compile time when pom is unchanged
RUN mvn verify --fail-never
COPY src ./src