Skip to content

Instantly share code, notes, and snippets.

using Test;
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddHostedService<Worker>();
})
.Build();
var config = host.Services.GetRequiredService<IConfiguration>();
@jcotton42
jcotton42 / setup.sh
Last active April 29, 2021 17:11
MacBook setup
#!/bin/bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
// slightly modified to reduce bindgen vomit
/****************************************************************************\
DismApi.H
Copyright (c) Microsoft Corporation.
All rights reserved.
\****************************************************************************/
function Get-AllExceptions {
param(
[Exception] $E
)
while($E -ne $null) {
$E
$E = $E.InnerException
}
}
void Main() {
var s = new S();
foreach (var x in s) {}
}
struct S {
public SpanSplitEnumerator GetEnumerator() => new SpanSplitEnumerator();
}
ref struct SpanSplitEnumerator {
<Page
x:Class="UWPTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UWPTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Orientation="Vertical">
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ReactiveIRC {
public struct IRCMessage {
private const int MaxParams = 15;
@jcotton42
jcotton42 / a.cs
Last active January 5, 2018 05:48
void Main() {
var a = new[]{1,2,3};
ref int q = ref a[0];
A(ref q);
a.Dump();
}
// Define other methods and classes here
void A(ref int x) {
x = 2;
var tc = new TcpClient();
tc.Connect("irc.freenode.net", 6697);
var ssl = new SslStream(tc.GetStream());
ssl.AuthenticateAsClient("irc.freenode.net");
var reader = new StreamReader(ssl, Encoding.UTF8);
var writer = new StreamWriter(ssl, Encoding.UTF8);
writer.WriteLine("CAP LS 302");
var sockets = new[] { tc.Client };
while (true) {
@jcotton42
jcotton42 / autocorrect.ahk
Created August 15, 2017 19:30
Somethig shared to me in #irc-bridge
:*:cooperat::coöperat
::(c)::©
::(r)::®
::(tm)::™
::ackward::awkward