Skip to content

Instantly share code, notes, and snippets.

@zblesk
zblesk / MatrixChatroomWatcher.cs
Last active November 19, 2022 16:11
The simplest class to consume messages from a Matrix room. Related blogpost: https://zblesk.net/blog/the-simplest-matrix-chatbot-base-in-csharp/
using Flurl;
using Flurl.Http;
using Markdig;
namespace zblesk
{
public class MatrixChatroomWatcher : IDisposable
{
private readonly string _homeserverUrl;
private readonly string _username;
-- You can also create your DB schema, if needed
-- SSIS needs CLR enabled:
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO

Keybase proof

I hereby claim:

  • I am zblesk on github.
  • I am zblesk (https://keybase.io/zblesk) on keybase.
  • I have a public key ASD5LC7NuuYBJcQRvBgo3NknVJOitOR7-hlu5K93BxqRUAo

To claim this, I am signing this object:

@zblesk
zblesk / self-elevating-script.ps1
Last active April 15, 2019 09:24
A self-elevating powershell script. Makes sure current script is running as admin.
if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Set-Location $PSScriptRoot
"Running as admin in $PSScriptRoot"
}
else
{
"NOT running as an admin!"
Start-Process powershell -WorkingDirectory $PSScriptRoot -Verb runAs -ArgumentList "-noprofile -noexit -file $PSCommandPath"
return "Script re-started with admin privileges in another shell. This one will now exit."