Skip to content

Instantly share code, notes, and snippets.

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
@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 |
#
# 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",
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;
/// <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
public class ValidatePackageReferences : Task
{
// Methods
public override bool Execute()
{
if (string.IsNullOrEmpty(this.ReferencingProjectPackagesConfig) && string.IsNullOrEmpty(this.ReferencingProject))
{
this.LogWarning("BCLBUILD1001", Resources.Warning_AllProjectsMissingPackageReference, new object[] { Path.GetFileName(this.ReferencedProject) });
return true;
}
using System;
using System.Diagnostics.Contracts;
using System.Linq;
namespace Merkator.Tools
{
public class ArrayHelpers
{
public static T[] ConcatArrays<T>(params T[][] arrays)
{