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
# NOTE: These steps assume the following: | |
# * The heroku toolbelt is installed: https://toolbelt.heroku.com/ | |
# * A postgres server is installed and running: http://www.enterprisedb.com/products-services-training/pgdownload#osx | |
# STEP 1: Login to herku: | |
heroku login | |
# provide credentials | |
# STEP 2: Create database backup | |
heroku pg:backups public-url b001 --app <the name of your heroku application> |
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
sp_configure 'show advanced options', 1 | |
reconfigure; | |
-- show advanced options | |
-- backup compression default -- always compress backups. | |
-- blocked process threshold (s) -- only capture blocking scenarios that block this threshold. | |
-- clr enabled -- allows CLR user-defined stored procedures and functions. | |
-- Database Mail XPs | |
-- fill factor (%) -- useful for reducing fragmentation (for frequently updated tables). Reduces page-splitting when a record has be inserted in the middle of the page | |
-- max degree of parallelism -- set the max number of CPUs that are available for a single query. Can be overridden by MAX DOP setting on a query | |
-- remote access -- grant/revoke ability to allow remote users to access the SQL Server from external connections |
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 | |
OBJECT_NAME(f.parent_object_id) TableName, | |
COL_NAME(fc.parent_object_id,fc.parent_column_id) ColName | |
FROM | |
sys.foreign_keys AS f | |
INNER JOIN | |
sys.foreign_key_columns AS fc | |
ON f.OBJECT_ID = fc.constraint_object_id | |
INNER JOIN | |
sys.tables t |
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
[program:your_program_name_here] | |
command=;command to start your program | |
user=;user that your program should run as | |
autostart=true | |
autorestart=true | |
startsecs=10 | |
startretries=3 | |
stdout_logfile=;path to log file, e.g. /var/log/your_program_name_here-stdout.log | |
stdout_logfile_maxbytes=128MB | |
stdout_logfile_backups=32 |
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 OBJECT_NAME(object_id) as table_name, name, type_desc, is_primary_key, fill_factor FROM sys.indexes; | |
USE [whatever database] | |
GO | |
ALTER INDEX PK_GeoRoot ON GeoRoot | |
REBUILD WITH (FILLFACTOR = 80); |
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 existing indexes */ | |
SELECT | |
@@SERVERNAME AS [ServerName] | |
, DB_NAME() AS [DatabaseName] | |
, [SchemaName] | |
, [ObjectName] | |
, [ObjectType] | |
, [IndexID] | |
, [IndexName] | |
, [IndexType] |
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
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 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 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 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
Thumbs.db | |
*.obj | |
*.exe | |
*.pdb | |
*.user | |
*.aps | |
*.pch | |
*.vspscc | |
*_i.c | |
*_p.c |
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
/* 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; |