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
# Pull latest on all repos | |
for d in */; do | |
cd "$d" && echo "*********** $d ***********" && | |
if [ -d .git ]; then | |
git pull | |
else | |
echo "Not a git repository, skipping."; | |
fi | |
cd .. && echo | |
done |
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
aws ec2 describe-network-interfaces --filters "Name=subnet-id,Values=[subnet-id]" --query "NetworkInterfaces[*].[PrivateIpAddress,Description]" |
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
Find-Package -AllVersions -AllowPrereleaseVersions -Source "<Source URL>" | Install-Package -Destination "C:\tmp" -SkipDependencies |
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
# Iterate through folders of git repos and show merged branches older than 3 months | |
for d in */; do | |
cd "$d" && echo "*********** $d ***********" && | |
if [ -d .git ]; then | |
git fetch --prune --quiet origin && | |
for k in $(git branch -r --merged | egrep -v 'HEAD|main|master'); do | |
if [ -z "$(git log -1 --since='3 months ago' -s $k)" ]; then | |
echo -e `git show --format="%ci %cr %an" $k | head -n 1` \\t$k; | |
fi | |
done | sort -r |
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 name | |
from sysobjects o | |
inner join syscomments c on o.id = c.id | |
where text like '%search%' |
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
Get-ChildItem -File | Where-Object { $_.Name.Contains("-") } | Rename-Item -NewName { $_.Name -replace "-","." } |
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
robocopy . . /S /MOVE |
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
LogParser.exe -i:IISW3C -o:csv file:C:\Path\To\File.sql -stats:off > C:\Path\To\results.csv |
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
-- Define the variables | |
declare @databases table (rowid int identity primary key, dbname varchar(500)) | |
declare @rowid int, @dbname varchar(500), @sql varchar(2000) | |
-- Get the database names from the system function | |
insert into @databases (dbname) | |
select db_name | |
from msdb.smart_admin.fn_backup_db_config (null) | |
where is_managed_backup_enabled = 0 | |
and is_dropped = 0 |
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 r.session_id as SPID, r.command, r.[status], | |
FORMAT(r.percent_complete, 'n0') + '%' as percent_complete, | |
FORMAT(r.start_time, 'MM/dd/yyyy hh:mm:ss tt') as start_time, | |
FORMAT(r.total_elapsed_time / 3600000 % 60, '00') + ':' + FORMAT(r.total_elapsed_time / 60000 % 60, '00') + ':' + FORMAT(r.total_elapsed_time / 1000 % 60, '00') as elapsed_time, | |
FORMAT(DATEADD(MILLISECOND, r.estimated_completion_time, GETDATE()), 'MM/dd/yyyy hh:mm:ss tt') as estimated_completion_time, | |
FORMAT(r.estimated_completion_time / 3600000 % 60, '00') + ':' + FORMAT(r.estimated_completion_time / 60000 % 60, '00') + ':' + FORMAT(r.estimated_completion_time / 1000 % 60, '00') as estimated_time_remaining, | |
FORMAT((r.total_elapsed_time + r.estimated_completion_time) / 3600000 % 60, '00') + ':' + FORMAT((r.total_elapsed_time + r.estimated_completion_time) / 60000 % 60, '00') + ':' + FORMAT((r.total_elapsed_time + r.estimated_completion_time) / 1000 % 60, '00') as estimated_total_time | |
from sys.dm |
NewerOlder