Skip to content

Instantly share code, notes, and snippets.

View OrganizationUsername's full-sized avatar

OrganizationUsername OrganizationUsername

  • Organization
  • Houston, Texas
View GitHub Profile
# collection of C# macro functions.
# credits: boostyourbim, archilizer, archsmarter, don rudden
# ADN-DevTech/RevitTrainingMaterial
#LINQPad optimize+
//https://blog.marcgravell.com/2018/01/sorting-myself-out-extreme-edition.html
//https://stackoverflow.com/questions/66631585/efficient-comparison-of-2-integers-against-another-2
//https://github.com/Treit/MiscBenchmarks/blob/main/MinMaxNumericValues/Benchmark.cs
//https://medium.com/@norm.bryar/faster-use-of-bool-f541d349fce4
//https://www.extremeoptimization.com/Documentation/Vector-and-Matrix/Vectors/Accessing-vector-elements.aspx
//https://github.com/dotnet/fsharp/issues/13098
//https://github.com/CBGonzalez/SIMDIntro
//https://github.com/dotnet/fsharp/issues/13098
#LINQPad optimize+
//https://blog.marcgravell.com/2018/01/sorting-myself-out-extreme-edition.html
//https://stackoverflow.com/questions/66631585/efficient-comparison-of-2-integers-against-another-2
//https://github.com/Treit/MiscBenchmarks/blob/main/MinMaxNumericValues/Benchmark.cs
//https://medium.com/@norm.bryar/faster-use-of-bool-f541d349fce4
//https://www.extremeoptimization.com/Documentation/Vector-and-Matrix/Vectors/Accessing-vector-elements.aspx
//SmallTest st = new SmallTest();
//st.GlobalSetup();
//st.OrdinaryMax().Dump();
using ILGPU;
using ILGPU.Runtime;
using ILGPU.Runtime.CPU;
using ILGPU.Runtime.Cuda;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using System.Diagnostics;
namespace ColorCounter
{
//(int)('s'-'a')= 18
//sizeof(uint) ==4
uint[] a = new[] { 623462994u/*5*/, 18u/*1*/, 576u/*1*/, 594u /*2*/, 14u /*0*/ }; //Number denotes number of S's
var charCount = new[] { (uint)0b0011_10010/*, (uint)0b01_10010, (uint)0b01_10010, (uint)0b01_10010*/ }; //This can hold the minimum and maximum occurrences of the letter overall.
//0b0011_10010, at least 0 's', no more than 3 's'.
var result = WordCheck(a, charCount);
a.Dump("Final Answer");
unsafe uint WordCheck(uint[] left, uint[] right)
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace MonoTest
{
//This is an example of how to scrape the web using PhantomJS and jQuery:
//source: http://snippets.aktagon.com/snippets/534-How-to-scrape-web-pages-with-PhantomJS-and-jQuery
//http://phantomjs.org/
var page = new WebPage(),
url = 'http://localhost/a-search-form',
stepIndex = 0;
/**
* From PhantomJS documentation: