This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // output: | |
| // | |
| // -2: Result='-2 is even' was found using Rule='Even' because 'We found an even number'. | |
| // -1: Result='default value' was found using Rule='OrElse' because 'No rule matched'. | |
| // 0: Result='0 is even' was found using Rule='Even' because 'We found an even number'. | |
| // 1: Result='3,141592653589793' was found using Rule='Divide' because 'Division rule applied'. | |
| // 2: Result='2 too high' was found using Rule='Limit' because 'The limiter was applied'. | |
| var ruleChain = | |
| new Limit( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Extensions.Logging; | |
| using Microsoft.Extensions.Logging.Abstractions; | |
| using System.IO.Compression; | |
| using System.IO.Pipelines; | |
| public static class StreamAdapters | |
| { | |
| /// <summary> | |
| /// Creates a readable stream that generates a ZIP archive on the fly from a list of source streams, | |
| /// without buffering the entire archive. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nc -z www.msftncsi.com 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Fira code font in ADO | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2025-01-29 | |
| // @description From Consolas to Fira with liga | |
| // @author @klinkby | |
| // @match *://dev.azure.com/* | |
| // @exclude *://amcdn.msftauth.net/* | |
| // @exclude *://*.vsassets.io/* | |
| // @exclude *://login.microsoftonline.com/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Gemini f# off | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2025-01-18 | |
| // @description Get rid of that sparkling personal assistant in gmail. | |
| // @author @klinkby | |
| // @match *://mail.google.com/* | |
| // @exclude *://accounts.google.com/* | |
| // @exclude *://chat.google.com/* | |
| // @exclude *://contacts.google.com/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-ChildItem -LiteralPath 'd:\' -Recurse -Directory |? { $_.Name -match '^(bin|obj|test-results|TestResults|Publish|dist|node_modules)$' } | Remove-Item -Recurse -Force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.Text; | |
| using System.Text.RegularExpressions; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using System.Xml; | |
| using System.Diagnostics.CodeAnalysis; | |
| /// <summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd ~ && chmod 600 ~/.ssh/* && chmod 700 ~/.ssh && chmod 644 ~/.ssh/*.pub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static async Task<Encoding> GetEncodingFromStream(Stream s, int bufferSize, CancellationToken ct) | |
| { | |
| if (!s.CanSeek || !s.CanRead) | |
| { | |
| // can't touch this | |
| return Encoding.Default; | |
| } | |
| byte[] buffer = new byte[bufferSize]; | |
| int bytesRead = await s.ReadAsync(buffer, 0, buffer.Length, ct); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let securityHeaders = { | |
| "Content-Security-Policy": "default-src 'self' 'unsafe-inline'", | |
| "X-Xss-Protection": "1; mode=block", | |
| "X-Frame-Options": "DENY", | |
| "Referrer-Policy": "strict-origin-when-cross-origin", | |
| "Permissions-Policy": "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()" | |
| }; | |
| addEventListener('fetch', event => { | |
| event.respondWith(addHeaders(event.request)); |
NewerOlder