This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package your.package.name; | |
| import java.nio.charset.StandardCharsets; | |
| import java.security.MessageDigest; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.util.UUID; | |
| /** | |
| * A UUID generator that creates hash-based or name-based UUIDs (MD5 and SHA-1). | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package your.package.name; | |
| import java.security.SecureRandom; | |
| import java.util.Random; | |
| import java.util.UUID; | |
| /** | |
| * A UUID generator that creates random-based UUIDs (UUIDv4) | |
| * | |
| * RFC-4122 compliant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package your.package.name; | |
| import java.security.SecureRandom; | |
| import java.util.Random; | |
| import java.util.UUID; | |
| /** | |
| * A UUID generator that creates COMB UUIDs. | |
| * | |
| * The COMB UUIDs combine the creation time and random bytes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package your.package.name; | |
| /** | |
| * Utility class that replaces chars of a String, aka, transliterate. | |
| * | |
| * It's equivalent to bash 'tr' and perl 'tr///'. | |
| * | |
| * @author: Fabio Lima 2020 | |
| */ | |
| public class ReplaceChars { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package your.package.name; | |
| /** | |
| * Utility class that removes chars from a String. | |
| * | |
| * @author: Fabio Lima 2020 | |
| */ | |
| public class RemoveChars { | |
| public static String remove(String string, String remove) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example; | |
| /** | |
| * Utility class for left pad, right pad, center pad and zero fill. | |
| * | |
| * @author Fabio Lima 2020-2021 | |
| */ | |
| public final class StringPadding { | |
| public static String left(String string, int length, char fill) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Calculate uniqueness of hostname hashes using SHA256 algorithm | |
| # | |
| # hostname-0001, hostname-0002, hostname-0003... | |
| HOSTNAME_BASE="hostname"; | |
| # % of unique hashes for 256 host names: 0.65625000000000000000 | |
| USED_NODES=256; # used nodes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Fix Wifi of Intel Z83 mini PC on Ubuntu 20.04 | |
| # | |
| # Download these files in the same folder: | |
| # - brcmfmac43455-sdio.txt | |
| # - brcmfmac43455-sdio.clm_blob.base64 | |
| # | |
| # Source: | |
| # https://github.com/Linwood-F/MusicalPi/wiki/Intel-Z83-mini-PC-setup-(still-MusicalPi) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package your.package.name; | |
| import java.security.SecureRandom; | |
| import java.util.HashSet; | |
| import java.util.Random; | |
| import java.util.Set; | |
| import java.util.UUID; | |
| /** | |
| * A UUID generator that creates time-based and time-ordered UUIDs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Check file encoding | |
| file -i INPUT_FILE.TXT | |
| INPUT_FILE.TXT: text/plain; charset=utf-8 | |
| # Convert from UTF-8 to ISO-8859-1 with transliteration and ignoring invalid characters | |
| iconv -f utf-8 -t iso-8859-1//TRANSLIT -c -o OUTPUT_FILE.TXT INPUT_FILE.TXT |