Skip to content

Instantly share code, notes, and snippets.

View sayham-sjb's full-sized avatar
🌐
^-^

Sayham Chowdhury sayham-sjb

🌐
^-^
View GitHub Profile
@sayham-sjb
sayham-sjb / DropTransactionalPublication.sql
Created April 9, 2019 16:10
DropTransactionalPublication #sql
USE {PublicationDatabaseName}
GO
EXEC sp_droppublication @publication = N'<Publication name>'
USE master
GO
EXEC sp_replicationdboption @dbname = N'<Publication database name>', @optname = N'publish', @value = N'false'
  • List all modified file names

    • git whatchanged --since '12/01/2016' --oneline --name-only --pretty=format: | sort | uniq
    • git log --since="4 day ago" --name-only --pretty=format: | sort -u
    • git whatchanged --since '12/01/2016' --until '12/06/2016' --oneline --name-only --pretty=format: | sort | uniq
  • Stash

    • git stash
    • git stash list (Get all stash(s))
    • git stash pop (Reapply stash and remove)
  • git stash apply (Reapply stash and keep copy)

@sayham-sjb
sayham-sjb / TwitterFollowButton.html
Created July 31, 2018 15:25
TwitterFollowButton #html #VS
<center><div style="padding-right: 74px;">
<a href="https://twitter.com/sayham28" class="twitter-follow-button" data-size="large" data-show-count="false">Follow @sayham28</a><script async charset="utf-8"></script></div></center>
@sayham-sjb
sayham-sjb / CountPublisherOnDB.sql
Created July 10, 2018 18:38
CountPublisherOnDB #sql
SELECT publisher_db, COUNT(1) FROM distribution.dbo.MSarticles
GROUP BY publisher_db
ORDER BY COUNT(1), publisher_db
@sayham-sjb
sayham-sjb / DogYearCalculator.js
Last active June 28, 2018 03:48
DogYearCalculator #js #VS
function HumanDogYears(form) {
var HumanYears = form.inYears.value;
if (HumanYears >= 21) {
dy = (HumanYears - 21) / 4 + 2;
} else {
dy = HumanYears / 10.5;
}
var hdy = 0;
if (HumanYears >= 2) {
hdy = 21 + ((HumanYears - 2) * 4);
@sayham-sjb
sayham-sjb / CheckReplication.sql
Last active June 6, 2018 19:36
CheckReplication #sql
--Check for Replication EXECUTE sys.sp_helpreplicationdb @dbname = {DBName}, -- sysname @type = pub -- sysname
@sayham-sjb
sayham-sjb / RemoveSingleUserMode.sql
Created May 8, 2018 15:25
Remove Single User Mode #sql
USE master
GO
DECLARE @kill varchar(max) = '';
SELECT @kill = @kill + 'KILL ' + CONVERT(varchar(10), spid) + '; '
FROM master..sysprocesses
WHERE spid > 50 AND dbid = DB_ID('DATABASENAME')
EXEC(@kill);
GO
SET DEADLOCK_PRIORITY HIGH
@sayham-sjb
sayham-sjb / RollbackDatabaseFromInUseState.sql
Last active September 13, 2019 18:59
Error Database already in use when trying to restore backup #sql
--Set offline and rollback
ALTER DATABASE {DBName} SET OFFLINE WITH ROLLBACK IMMEDIATE
--Then SET it online
ALTER DATABASE {DBName} SET ONLINE
@sayham-sjb
sayham-sjb / CharacterCounter.js
Created April 8, 2018 07:13
CharacterCounter #VS #js
function chrCntMtd(what) {
var FormCntChrWrd = what.form.chrCntTxt.value;
what.form.disChrCnt.value = FormCntChrWrd.length;
}
@sayham-sjb
sayham-sjb / jQueryJavaScriptLibraryv1.4.2.min.js
Last active March 29, 2018 19:56
jQuery JavaScript Library v1.4.2 #VS
/*!
* jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/