Skip to content

Instantly share code, notes, and snippets.

View mikejwhitty's full-sized avatar

Mike Whitty mikejwhitty

View GitHub Profile
@mikejwhitty
mikejwhitty / is-net-48-installed.ps1
Last active January 29, 2024 09:52
powershell one-liner to determine if .net framework 4.8 is installed
(Get-ItemPropertyValue -LiteralPath 'HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release) -ge 528040
## more magic values listed at: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#minimum-version
@mikejwhitty
mikejwhitty / currently-running-requests.sql
Created January 27, 2020 13:26
list currently running requests on ms-sql server, for help identifying long-running or probematic queries
USE [master];
SELECT r.session_id,
ms_running = DATEDIFF(ms, r.start_time, GETDATE()),
db = db_name(r.database_id), --schema = object_schema_name(t.objectid, r.database_id),
command_name = object_name(t.objectid, r.database_id), s.host_name,
r.status, r.command,
currently_running_statement = SUBSTRING(t.text,
r.statement_start_offset/2 + 1,
((CASE WHEN r.statement_end_offset = -1
import requests
api_key = '!!!' # Put your key in here, obviously
channel_id = 'UCH2s99kNN5m3_wXQ245OqsA'
url = 'https://www.googleapis.com/youtube/v3/channels?part=statistics&id=%s&key=%s' % (channel_id, api_key)
r = requests.get(url)
print r.json()['items'][0]['statistics']['subscriberCount']