Skip to content

Instantly share code, notes, and snippets.

View adrianoluis's full-sized avatar
👇
adrianoluis.net

Adriano Rocha adrianoluis

👇
adrianoluis.net
View GitHub Profile
@adrianoluis
adrianoluis / gradle.properties
Created November 29, 2023 16:17
Gradle User gradle.properties
# When set to true, Gradle will reuse task outputs from any previous build when possible, resulting in much faster builds.
#
# Default is false# the build cache is not enabled.
#org.gradle.caching=false
# When set to true, individual input property hashes and the build cache key for each task are logged on the console.
#
# Default is false.
#org.gradle.caching.debug=false
@adrianoluis
adrianoluis / settings.xml
Last active November 29, 2023 16:19
Maven User settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
| This is the configuration file for Maven. It can be specified at two levels:
|
| 1. User Level. This settings.xml file provides configuration for a single
| user, and is normally provided in
| ${user.home}/.m2/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
@adrianoluis
adrianoluis / voron_24_printed_parts.md
Created August 7, 2023 03:23 — forked from cmidgley/voron_24_printed_parts.md
Printed parts list for the Voron 2.4 organized by assembly order

Voron 2.4 Printed Parts List

List of parts to print for Voron 2.4 organized by the Assembly Manuals order of assembly, allowing for just-in-time printing of parts while building the printer. Configuration is standard Voron 2.4 (Afterburner Direct Feed, DIN rail mounts) with choices for E3D, Dragon or Mosquito hot ends on a 250mm, 300mm or 350mm frame. No parts for the drag chain are included, as often these are purchased parts rather than printed.

Names of the sections (such as Gantry/X_Axis/XY Joints) match the name of the STL directory that contains the prints. Note that Voron Design uses filenames starting with [a]_ at the start of a filename to indicate parts that can be printed in an accent color.

_Credit to krobertson for maki

@adrianoluis
adrianoluis / git-refresh.sh
Last active June 13, 2024 01:51
Update master in all git repo under the provided directory or if missing uses running directory.
#!/bin/sh
GITROOT="${1:-.}"
find $GITROOT -name .git -type d | cat -n | while read n f
do
cd "$(dirname "$f")"
GITDEFBR="$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
GITPROJ="$(pwd -P)"
echo "\033[32m>>> \033[1m$GITPROJ\033[0m"
GITBRANCH=$(git rev-parse --abbrev-ref HEAD)
git add .
@adrianoluis
adrianoluis / basic-pom.xml
Last active December 4, 2021 04:25
Basic pom.xml file with JUnit 4.13.2.
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
@adrianoluis
adrianoluis / BarcodeUtilsTest.java
Created November 18, 2018 20:06
Testcase for BarcodeUtils.java
import org.junit.Test;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import static junit.framework.TestCase.*;
public class BarcodeUtilsTest {
@adrianoluis
adrianoluis / BarcodeUtils.java
Created September 4, 2017 02:04
This class validate a barcode and convert it to "Linha Digitável".
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* This class validate a barcode and convert it to "Linha Digitável".
*
* @author adriano
* @since Set 25, 2014
@adrianoluis
adrianoluis / StringUtil.kt
Created August 10, 2017 19:33
Simple class to slugify text in Kotlin.
import java.text.Normalizer
object StringUtil {
fun slugify(word: String, replacement: String = "-") = Normalizer
.normalize(word, Normalizer.Form.NFD)
.replace("[^\\p{ASCII}]".toRegex(), "")
.replace("[^a-zA-Z0-9\\s]+".toRegex(), "").trim()
.replace("\\s+".toRegex(), replacement)
.toLowerCase()
@adrianoluis
adrianoluis / QRCodeUtil.java
Created February 8, 2017 02:51
Simple utility class to create QR Code as Bitmap on Android using ZXing library
import android.graphics.Bitmap;
import android.graphics.Color;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
public class QRCodeUtil {
@adrianoluis
adrianoluis / DocumentUtil.java
Last active May 4, 2024 16:12
Utility class to validate CPF and CNPJ document types. For CPF use isValidSsn and for CNPJ use isValidTfn. Added to repo https://github.com/adrianoluis/misc-tools
public class DocumentUtil {
// CPF
private static final int[] WEIGHT_SSN = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
// CNPJ
private static final int[] WEIGHT_TFN = {6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2};
private static int sum(int[] weight, char[] numbers, int length) {
if (length <= 0) return 0;