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 / 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 / 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 / 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 / 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>
  • 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 / 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'
@sayham-sjb
sayham-sjb / DbRestoreHistory.sql
Created April 9, 2019 16:29
DbRestoreHistory #sql
USE master
SELECT * FROM msdb.dbo.restorehistory WHERE destination_database_name LIKE '%DBNm%' ORDER BY restore_date DESC
@sayham-sjb
sayham-sjb / GetIP.txt
Last active April 17, 2019 03:46
Get your IP Address #txt
echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`
@sayham-sjb
sayham-sjb / BackupDB.sql
Created April 17, 2019 16:49
BackupDB #sql
PRINT 'Backing Up DBName'
BACKUP DATABASE {DBName} TO DISK = 'D:\BackupFolder\DBName_Restore.bak';
@sayham-sjb
sayham-sjb / StopReplication.sql
Last active September 9, 2019 19:24
StopReplication #sql
EXEC master.dbo.sp_replicationdboption @dbname = {DBName}, @optname = N'publish', @value = N'false'