Skip to content

Instantly share code, notes, and snippets.

View jongalloway's full-sized avatar

Jon Galloway jongalloway

View GitHub Profile
@jongalloway
jongalloway / streamlabs-chat.css
Created April 24, 2020 05:26
Streamlabs Chat CSS tweak so message goes below name. Good for tall, thin layout.
@import url(https://fonts.googleapis.com/css?family=Roboto:700);
* {
box-sizing: border-box;
}
html, body {
height: 100%;
overflow: hidden;
}
@jongalloway
jongalloway / trigger-based-auditing.sql
Created November 28, 2011 20:50
Trigger based auditing for SQL Server - http://bit.ly/sql-auditing
USE MYAWESOMEDATABASE
GO
IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 'Audit')
CREATE TABLE Audit
(
AuditID [int]IDENTITY(1,1) NOT NULL,
Type char(1),
TableName varchar(128),
PrimaryKeyField varchar(1000),
@jongalloway
jongalloway / Program.cs
Created October 12, 2023 19:53
Simple AI Chat
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.AI.ChatCompletion;
using Microsoft.SemanticKernel.Memory;
using System.Text;
string aoaiEndpoint = Environment.GetEnvironmentVariable("AZUREOPENAI_ENDPOINT")!;
string aoaiApiKey = Environment.GetEnvironmentVariable("AZUREOPENAI_API_KEY")!;
string gptModelDeploymentName = Environment.GetEnvironmentVariable("AZUREOPENAI_GPT_NAME")!;
string adaTextDeploymentName = Environment.GetEnvironmentVariable("AZUREOPENAI_TEXT_EMBEDDING_NAME")!;
@jongalloway
jongalloway / PcRepave.cmd
Last active February 23, 2023 18:02
Chocolatey list generated using: choco list --localonly --idonly
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco feature enable -n allowGlobalConfirmation
choco install 7zip /y
choco install 7zip.install /y
choco install ARMClient /y
choco install audacity /y
choco install audacity-lame /y
choco install autohotkey /y
choco install autohotkey.install /y
# --- settings ---
$feedUrlBase = "http://go.microsoft.com/fwlink/?LinkID=206669"
# the rest will be params when converting to funclet
$latest = $true
$overwrite = $false
$top = 500 #use $top = $null to grab all
$destinationDirectory = join-path ([Environment]::GetFolderPath("MyDocuments")) "NuGetLocal"
# --- locals ---
$webClient = New-Object System.Net.WebClient
@jongalloway
jongalloway / starcounter.js
Last active January 11, 2023 20:15 — forked from yyx990803/starcounter.js
Count your total stars!
var https = require('https'),
user = process.argv[2],
opts = parseOpts(process.argv.slice(3))
request('/users/' + user, function (res) {
if (!res.public_repos) {
console.log(res.message)
return
}
var pages = Math.ceil(res.public_repos / 100),
@jongalloway
jongalloway / Channel9Downloader.ps1
Last active September 14, 2022 12:50 — forked from DerAlbertCom/Channel9Downloader.ps1
PowerShell Scripts for Downloading Channel 9 Videos
<#PSScriptInfo
.VERSION 1.3
.AUTHOR jongalloway@gmail.com
.GUID da220b4e-e889-42dc-85cd-91e0f91a965e
.PROJECTURI https://gist.github.com/jongalloway/935780
.RELEASENOTES
1.2 adds regular expression title match (thanks, @meavk)
1.3 adds check for / at end of RSS URL
#>
@jongalloway
jongalloway / aspnetcore-one-hour-makeover.md
Last active April 30, 2022 08:24
ASP.NET Core One Hour Makeover
@jongalloway
jongalloway / RecursiveReplace.ps
Created December 29, 2011 07:56
Recursive replace in files (PowerShell)
$find = 'jquery-1\.4\.4'
$replace = 'jquery-1\.5\.1'
$match = '*.cshtml' , '*.vbhtml'
$preview = $true
foreach ($sc in dir -recurse -include $match | where { test-path $_.fullname -pathtype leaf} ) {
select-string -path $sc -pattern $find
if (!$preview) {
(get-content $sc) | foreach-object { $_ -replace $find, $replace } | set-content $sc
}
@jongalloway
jongalloway / markdown-image-with-link.md
Last active March 26, 2021 02:55
Markdown image with link sample