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
import java.nio.ByteBuffer; | |
import java.util.UUID; | |
public class UuidAdapter { | |
public static byte[] getBytesFromUUID(UUID uuid) { | |
ByteBuffer bb = ByteBuffer.wrap(new byte[16]); | |
bb.putLong(uuid.getMostSignificantBits()); | |
bb.putLong(uuid.getLeastSignificantBits()); | |
return bb.array(); |
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
SELECT | |
a.io_stall, -- Total time, in milliseconds, that users waited for I/O to be completed on the file. | |
a.io_stall_read_ms, -- Total time, in milliseconds, that the users waited for reads issued on the file. | |
a.io_stall_write_ms, -- Total time, in milliseconds, that users waited for writes to be completed on the file. | |
a.num_of_reads, -- Number of reads issued on the file. | |
a.num_of_writes, -- Number of writes made on this file. | |
--a.sample_ms, a.num_of_bytes_read, a.num_of_bytes_written, a.io_stall_write_ms, | |
( ( a.size_on_disk_bytes / 1024 ) / 1024.0 ) AS size_on_disk_mb, | |
db_name(a.database_id) AS dbname, | |
b.name, |
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
# I'm in a situation where I have multiple JDKs installed for various projects. While I'm sure there are a million was to handle this | |
# issue (a number of sites recommended jenv), I just wanted a quick & easy way to switch between JDKs that are installed on my machine. | |
# I took the following steps: | |
# | |
# 1. Add the functions below to your ~/.bash_profile | |
# 2. Source your ~/.bash_profile (command is . ~/.bash_profile) or exit and reload your terminal window | |
# | |
# These functions came from here: https://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/, so all credit goes to the author of that article | |
function setjdk() { | |
if [ $# -ne 0 ]; then |
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
#!/usr/bin/perl -w | |
#----------------------------------------------------------------------------------------------------------------------------------------- | |
# File: aws-email-sender.pl | |
# | |
# Desc: Send an email via Amazon SES. | |
# | |
# Code for this gist came from this article: https://blog.vpetkov.net/2015/11/29/sending-html-emails-with-perl-to-a-remote-smtp-with-tls/ | |
# To install the packages/libraries required to support this script, the following commands were used: | |
# | |
# cpan Email::Sender |
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
SELECT DISTINCT TABLE_NAME, TABLE_SCHEMA | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE COLUMN_NAME IN (/* list of column names go here */) | |
AND TABLE_SCHEMA IN (/* list of schemas go here */); |
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
SELECT UNHEX(REPLACE(UUID(),'-','')) |
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
SELECT * | |
FROM information_schema.KEY_COLUMN_USAGE | |
WHERE table_schema = /* the schema you're interested in */ | |
AND referenced_table_name = /* name of the table that is referenced by other tables via foreign key */; |
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
GREEN='\[\033[0;32m\]' | |
YELLOW='\[\033[0;33m\]' | |
NC='\[\033[0m\]' # No Color | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*" | |
} | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return |
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
/* | |
* From here: http://mysql.rjweb.org/doc.php/uuid | |
*/ | |
-- Convert a formatted UUID to a BINARY(16) | |
CREATE FUNCTION UuidToBin(_uuid CHAR(36)) | |
RETURNS BINARY(16) | |
LANGUAGE SQL DETERMINISTIC CONTAINS SQL SQL SECURITY INVOKER | |
RETURN | |
UNHEX(CONCAT( | |
SUBSTR(_uuid, 15, 4), |
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
# Install the Spring Boot CLI via homebrew (https://brew.sh/) | |
brew update | |
brew tap pivotal/tap | |
brew install springboot | |
# Download the Java 8 JCE from here: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html | |
# Extract the .zip file somewhere. There should be three files: | |
# | |
# local_policy.jar | |
# README.txt |