This file contains 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
/** | |
* Returns the password MD5. | |
* | |
* @param p_password the password string | |
* @param p_salt the salt string | |
* @param p_encode the output encoding: 'base64', 'hex', 'escape'. | |
*/ | |
CREATE FUNCTION fn_password_md5(p_password VARCHAR, p_salt VARCHAR, p_encode VARCHAR) RETURNS VARCHAR AS $$ | |
DECLARE | |
v_salt_hash BYTEA := NULL; |
This file contains 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
-- Find table | |
SELECT table_schema, table_name | |
FROM information_schema.tables | |
WHERE table_type='BASE TABLE' | |
AND table_name ILIKE '%tablename%'; | |
This file contains 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 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 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 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 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 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 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.time.Instant; | |
import java.util.UUID; | |
/** | |
* A UUID generator that creates a COMB GUID with nanoseconds resolution. | |
* | |
* It borrows the main idea from ULID and COMB generators: a concatenation of |
This file contains 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 |
OlderNewer