Skip to content

Instantly share code, notes, and snippets.

View airbreather's full-sized avatar
💭
Wondering why there's a "Set status" button.

Joe Amenta airbreather

💭
Wondering why there's a "Set status" button.
  • Urban Science Applications, Inc.
  • Sterling Heights, Michigan, USA
View GitHub Profile
@airbreather
airbreather / Program.cs
Last active February 28, 2017 12:46
volatile doesn't help you here
using System;
using System.Threading;
namespace ConsoleApp
{
internal static class Program
{
internal static readonly object lockObject = new object();
internal static volatile object obj;
@airbreather
airbreather / MemoryMappedFileEx.cs
Created January 29, 2017 12:54
Basic adapter for System.IO.MemoryMappedFiles
using System;
using System.Buffers;
using System.IO;
using System.IO.MemoryMappedFiles;
namespace AirBreather.IO
{
public static class MemoryMappedFileEx
{
public static unsafe OwnedMemory<byte> CreateFromFile(string filePath, FileMode mode, string mapName, long offset, long totalCapacity, MemoryMappedFileAccess access)
using System.Collections.Concurrent;
using System.IO.MemoryMappedFiles;
using BlockingCollection<string> coll = new();
var threads = new Thread[100];
foreach (ref var thread in threads.AsSpan())
{
thread = new Thread(RunThread) { IsBackground = true };
thread.Start(coll);
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1
{
internal static class Program
{
private static void Main()
{
using CommandLine;
using CommandLine.Text;
namespace StepperUpper
{
internal sealed class Options
{
// input file
[Option('p', "packDefinitionFile", Required = true, HelpText = "The .xml file that defines a pack.")]
public string PackDefinitionFilePath { get; set; }
<?xml version="1.0" encoding="utf-8"?>
<Modpack Name="STEP" Variant="Core" Version="2.2.9.2">
<Files>
<!-- TODO: Cleaned MD5s are outdated. Check this against a re-run of the cleaning process:
http://afkmods.iguanadons.net/index.php?/topic/4110-manual-cleaning-skyrim-master-files
and update accordingly if it's correct. -->
<Group Name="1.C. Install Utilities">
<File Name="Mod Organizer 1.3.1.1"
CanonicalFileName="Mod Organizer v1_3_11-1334-1-3-11.7z"
MD5Checksum="215ccbbca78af9cd3f833dd2efb81759"
@airbreather
airbreather / 32025538-measure.cs
Last active February 28, 2016 20:20
Measurements for SO answer with ID 32025538
// comment this out to see how comparatively expensive it is if all you have are properties.
#define FIELDS
using System;
using System.Diagnostics;
namespace ConsoleApplication1
{
struct Point
{
//******************************
// Written by Peter Golde
// Copyright (c) 2004-2005, Wintellect
//
// Use and restribution of this code is subject to the license agreement
// contained in the file "License.txt" accompanying this file.
//******************************
#region Using directives
@airbreather
airbreather / SuperCoordSeq.cs
Created January 16, 2016 15:14
My coord sequence... uses stuff from https://github.com/airbreather/AirBreather.Common and I don't feel like taking it out for this
using System;
using AirBreather.Common.Utilities;
using GeoAPI.Geometries;
namespace TestingGround
{
internal struct CoordVal : IEquatable<CoordVal>
{
internal double X;
internal double Y;
@airbreather
airbreather / TestingGround.cs
Created January 16, 2016 15:12
Testing ground for union optimization.
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using GeoAPI.Geometries;
using NetTopologySuite;
using NetTopologySuite.IO;
using NetTopologySuite.Operation.Union;
namespace TestingGround