Thanks to visit codestin.com
Credit goes to gist.github.com

Skip to content

Instantly share code, notes, and snippets.

https://chatgpt.com/share/6a13f2c7-ca34-83eb-83b9-f171f0d54e44
{
"name": "Cmder (inside WT)",
"guid": "{b9b4c6b1-7f2b-4f9a-9f5a-cccc11112222}",
"commandline": "cmd.exe /k \"%CMDER_ROOT%\\vendor\\init.bat\"",
"startingDirectory": "%USERPROFILE%",
"icon": "C:\\tools\\Cmder\\icons\\cmder.ico",
"hidden": false,
"env": {
"CMDER_ROOT": "C:\\tools\\Cmder"
},
// GlobalRetryOnFailureAttribute.cs
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
using NUnit.Framework.Internal.Commands;
using System;
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public sealed class GlobalRetryOnFailureAttribute : NUnitAttribute, IWrapTestMethod
{
-- Requires VIEW SERVER STATE
SELECT
wt.session_id,
wt.blocking_session_id,
wt.wait_duration_ms,
COALESCE(r_req.request_id, r_blk.request_id) AS request_id,
COALESCE(r_req.sql_handle, r_blk.sql_handle) AS sql_handle,
COALESCE(st_req.text, st_blk.text) AS batch_text,
-- extract currently executing statement using offsets (bytes -> chars)
CASE
$cluster = "my-cluster"
# 1) Get all service ARNs
$services = aws ecs list-services --cluster $cluster --query 'serviceArns' | ConvertFrom-Json
# 2) Describe services in batches of 10 to get task definition ARNs
$taskDefs = New-Object System.Collections.Generic.List[string]
for ($i = 0; $i -lt $services.Count; $i += 10) {
$end = [Math]::Min($i + 9, $services.Count - 1)
$batch = $services[$i..$end]
SELECT dtl.request_session_id AS WaitingSessionID,
der.blocking_session_id AS BlockingSessionID,
dowt.resource_description,
der.wait_type,
dowt.wait_duration_ms,
DB_NAME(dtl.resource_database_id) AS DatabaseName,
dtl.resource_associated_entity_id AS WaitingAssociatedEntity,
dtl.resource_type AS WaitingResourceType,
dtl.request_type AS WaitingRequestType,
dest.[text] AS WaitingTSql,
DECLARE @schema sysname = N'dbo', @table sysname = N'TableName';
SELECT
s.name AS stat_name,
CASE WHEN s.auto_created = 1 THEN 'auto'
WHEN s.user_created = 1 THEN 'user'
ELSE 'index' END AS kind,
i.name AS index_name, -- NULL = column stat
sp.last_updated,
sp.rows, -- table (or partition) rows when stat was last updated
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
@alexgit
alexgit / gist:2738a5110b40615adbaa6b7080ac63b9
Created February 18, 2025 16:40
find decimals with more than 5 digits after the decimal point
DECLARE @Tables TABLE (TableName NVARCHAR(128));
INSERT INTO @Tables (TableName)
VALUES ('YourTable1'), ('YourTable2'); -- Add your table names here
DECLARE @SQL NVARCHAR(MAX) = N'';
SELECT @SQL = @SQL +
'SELECT ''' + t.TABLE_NAME + ''' AS TableName, ''' + c.COLUMN_NAME + ''' AS ColumnName, ' +
' [' + c.COLUMN_NAME + '] AS Value ' +
'FROM [' + t.TABLE_NAME + '] ' +
SELECT
r.session_id,
r.status,
r.start_time,
r.command,
r.percent_complete,
r.estimated_completion_time,
r.cpu_time,
r.total_elapsed_time,
r.logical_reads,