Skip to content

Instantly share code, notes, and snippets.

@wilson0x4d
wilson0x4d / audioop.py
Created August 28, 2024 08:57
drop-in module to make `discord.py` work on Python 3.13+
# SPDX-FileCopyrightText: © 2024 Shaun Wilson
# SPDX-License-Identifier: MIT
# SPDX-License-Identifier: PSF-2.0
#
# audioop.py
#
# Copyright (C) Shaun Wilson, all rights reserved.
# This code is dual-licensed under MIT License and
# Python Software Foundation License 2.0
#
#
# assigns $env:BUILD_VERSION as the `AssemblyVersion` and
# `AssemblyFileVersion` values for all "AssemblyInfo.cs"
# files under current directory.
#
Get-ChildItem -R AssemblyInfo.cs | %{ $_.FullName } | %{
cp $_ $('$_.tmp');
(Get-Content -Raw $('$_.tmp')) -replace '(AssemblyFileVersion|AssemblyVersion)\(\"[^\"]*',$('$1("' + $env:BUILD_VERSION) > $_;
}
@wilson0x4d
wilson0x4d / syntax.s
Created October 25, 2019 09:54 — forked from mishurov/syntax.s
AT&T assembly syntax and IA-32 instructions
# --------
# Hardware
# --------
# Opcode - operational code
# Assebly mnemonic - abbreviation for an operation
# Instruction Code Format (IA-32)
# - Optional instruction prefix
# - Operational code
@wilson0x4d
wilson0x4d / style.less
Created December 3, 2018 09:55
A set of "Markdown Preview Enhanced" styles to provide a softer "Dark Theme" in "Visual Studio Code".
/* Please visit the URL below for more information: */
/* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
.markdown-preview.markdown-preview {
background-color: #111;
color: #777;
> h1, h2, h3, h4, h5, h6,
b, em, i, strong {
color: #aaa;
}
> a {
# Downloads Nintendo Power editions 1988 through 1999 from "annarchive.com"
mkdir NintendoPower_88to99
cd .\NintendoPower_88to99\
$uris = @(
"http://annarchive.com/files/Nintendo%20Power%20Issue%20001%20July-August%201988.cbr",
"http://annarchive.com/files/Nintendo%20Power%20Issue%20002%20September-October%201988.cbr",
"http://annarchive.com/files/Nintendo%20Power%20Issue%20003%20November-December%201988.cbr",
"http://annarchive.com/files/Nintendo%20Power%20Issue%20004%20January-February%201989.cbr",
/// <summary>
/// This is about indentation/formatting practices in the wild,
/// don't overanalyze the content.
/// <para>See Also: http://bit.ly/CSharpFormattingPoll </para>
/// </summary>
class Foo
{
/// <summary>
/// Basis; seasoned C# programmers get cringy when
/// they see code that trails off to the Nth column
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography;
using System.Text;
@wilson0x4d
wilson0x4d / Benchmark.txt
Last active April 8, 2021 14:53
Benchmark of `StackTrace`, `StackFrame` and `CallerMemberNameAttribute`.
BenchmarkDotNet=v0.10.13, OS=Windows 10 Redstone 3 [1709, Fall Creators Update] (10.0.16299.248)
Intel Core i7-7700K CPU 4.20GHz (Kaby Lake), 1 CPU, 8 logical cores and 4 physical cores
.NET Core SDK=2.1.4
[Host] : .NET Core 2.0.5 (CoreCLR 4.6.26020.03, CoreFX 4.6.26018.01), 64bit RyuJIT
DefaultJob : .NET Core 2.0.5 (CoreCLR 4.6.26020.03, CoreFX 4.6.26018.01), 64bit RyuJIT
Method | Mean | Error | StdDev | Median |
---------------------------- |---------:|----------:|----------:|---------:|
Diagnostics_StackTrace_Cost | 34.34 us | 0.2898 us | 0.2711 us | 34.26 us |
for idx = 1, 5 do repeat
print(1)
print(2)
print(3)
do break end -- goes to next iteration of for
print(4)
print(5)
until true end
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.FSharp.Core;
namespace CanUseFsharpOptionFromCsharp
{
[TestClass]
public class CanUseFsharpOptionFromCsharp
{
[TestMethod]