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
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 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 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 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 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 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
/* Run this query against any database on a SQL Server instance to get version details*/ | |
SELECT | |
SERVERPROPERTY('productversion') AS ProductVersion, | |
SERVERPROPERTY('productlevel') AS ProductLevel, | |
SERVERPROPERTY('edition') AS Edition, | |
@@VERSION AS VerboseVersion; |
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
Thumbs.db | |
*.obj | |
*.exe | |
*.pdb | |
*.user | |
*.aps | |
*.pch | |
*.vspscc | |
*_i.c | |
*_p.c |
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
## I just ran into this after initializing a Visual Studio project _before_ adding a .gitignore file (like an idiot). | |
## I felt real dumb commiting a bunch of files I didn't need to, so the commands below should do the trick. The first two commands | |
## came from the second answer on this post: http://stackoverflow.com/questions/7527982/applying-gitignore-to-committed-files | |
# See the unwanted files: | |
git ls-files -ci --exclude-standard | |
# Remove the unwanted files: | |
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached |
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
DECLARE @RandomDate datetime | |
SELECT @RandomDate = | |
DATEADD(day, ROUND(DATEDIFF(day, '2015-01-01', '2015-12-31') * RAND(CHECKSUM(NEWID())), 0), | |
DATEADD(second, CHECKSUM(NEWID()) % 48000, '2015-01-01')) | |
/* Verify */ | |
SELECT RandomDate = @RandomDate |
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 existing indexes */ | |
SELECT | |
@@SERVERNAME AS [ServerName] | |
, DB_NAME() AS [DatabaseName] | |
, [SchemaName] | |
, [ObjectName] | |
, [ObjectType] | |
, [IndexID] | |
, [IndexName] | |
, [IndexType] |