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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ | |
public static class Program | |
{ |
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 @UName varchar(50) | |
DECLARE @PW varchar(50) | |
DECLARE @SQL varchar(400) | |
SET @UName='connection-string-user' | |
SET @PW='password' | |
SET @SQL='DROP USER IF EXISTS ['+@UName+'];'+ | |
' CREATE USER ['+@UName+'] WITH PASSWORD = '''+@PW+''', DEFAULT_SCHEMA = dbo;'+ | |
' GRANT VIEW DEFINITION TO ['+@UName+'];'+ | |
' EXEC sp_addrolemember ''db_owner'', '''+@UName+''';'+ | |
' ALTER ROLE db_owner ADD MEMBER ['+@UName+'];' |
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
<rewrite> | |
<rules> | |
<rule name="RedirectWwwToNonWww" stopProcessing="false"> | |
<match url="(.*)" /> | |
<conditions logicalGrouping="MatchAll" trackAllCaptures="false"> | |
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" /> | |
</conditions> | |
<action type="Redirect" url="https://{C:2}{REQUEST_URI}" redirectType="Permanent" /> | |
</rule> | |
<rule name="Remove trailing slash" stopProcessing="true"> |
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
[user] | |
email = your_email | |
name = your_username | |
[alias] | |
# view your global git config Aliases from CLI | |
aliases = config --get-regexp '^alias\\.' | |
# git clone | |
cl = !git clone | |
# Git shallow clone for large repos | |
clq= !git clone --depth=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
WITH cteHead (session_id,request_id,wait_type,wait_resource,last_wait_type, | |
is_user_process,request_cpu_time,request_logical_reads,request_reads, | |
request_writes,wait_time,blocking_session_id,memory_usage, | |
session_cpu_time,session_reads, session_writes,session_logical_reads, | |
percent_complete,est_completion_time,request_start_time,request_status, | |
command,plan_handle,sql_handle, statement_start_offset,statement_end_offset, | |
most_recent_sql_handle,session_status,group_id, query_hash,query_plan_hash) | |
AS | |
(SELECT sess.session_id, req.request_id, | |
LEFT (ISNULL (req.wait_type, ''), 50) AS 'wait_type', |
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
-- Note: replace UserPrivilegeLevel = 3 with UserIsGlobalAdministrator = 1 for K9 and lower. | |
-- Sanitize Settings | |
UPDATE CMS_SettingsKey SET KeyValue = NULL WHERE KeyName in ( | |
'CMSAdminEmailAddress', -- Clear the Administrator email | |
'CMSUsePasswordPolicy', -- Clear the password policy | |
'CMSUseSSLForAdministrationInterface', -- Clear 'SSL for administration interface' | |
'CMSScreenLockEnabled', -- Clear screen lock feature | |
'CMSSMTPServer', -- Clear sending e-mails | |
'CMSDisableDebug' -- Clear 'Disable debugging' |
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
SET NOCOUNT ON; | |
-- Declare local variables | |
DECLARE @NumberOfLoops AS int = (select count(*)/50000 from [Staging_Task]); | |
DECLARE @CurrentLoop AS int = 0 | |
WHILE @CurrentLoop < @NumberOfLoops | |
BEGIN |
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
# Push to multiple remotes | |
# To do this, choose a remote ID which will refer to all the remotes. | |
# I usually call it all, but there are developers who prefer origin. | |
# The idea is to add all the remote repo URLs as “push URLs” to this remote. | |
# Here’s what you do: | |
# Create a new remote called "all" with the URL of the primary repo. | |
git remote add all git@github.com:jknopp/toggl2redmine.git | |
# Re-register the remote as a push URL. | |
git remote set-url --add --push all git@github.com:jknopp/toggl2redmine.git | |
# Add a push URL to a remote. This means that "git push" will also push to this git URL. |
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
--query store status | |
SELECT actual_state_desc, desired_state_desc, current_storage_size_mb, | |
max_storage_size_mb, readonly_reason | |
FROM sys.database_query_store_options; | |
--top 10 bad runners. This gives you the query ID to search for the query in SSMS->Query Store->Tracked Queries. Type in the ID, get details on the query. | |
SELECT TOP 10 | |
qt.query_text_id, | |
q.query_id, | |
p.plan_id, |
NewerOlder