Skip to content

Instantly share code, notes, and snippets.

View aarondandy's full-sized avatar
🐦
:parrotwave1::parrotwave2::parrotwave3::parrotwave4::parrotwave5::parrotwave6:

Aaron Dandy aarondandy

🐦
:parrotwave1::parrotwave2::parrotwave3::parrotwave4::parrotwave5::parrotwave6:
View GitHub Profile
@aarondandy
aarondandy / line direction N CW
Last active October 12, 2021 18:10
Calculates the north relative clockwise orientation of a line.
/*
The MIT License
Copyright (c) 2010 Aaron Dandy (aaron.dandy@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@aarondandy
aarondandy / gist:6821660
Created October 4, 2013 06:12
so much error...
struct Junk<T> { a: T }
impl<T:Mul<T,T>> Mul<T,Junk<T>> for Junk<T> {
fn mul(&self, rhs: &T) -> Junk<T> {
Junk{
a: self.a.mul(rhs)
}
}
}
@aarondandy
aarondandy / gist:6859164
Created October 6, 2013 21:10
multiple impls
struct Junk { a: f64 }
impl Mul<Junk,Junk> for Junk {
fn mul(&self, rhs:&Junk) -> Junk {Junk{a: &self.a * rhs.a}}
}
impl Mul<f64,Junk> for Junk {
fn mul(&self, rhs:&f64) -> Junk {Junk{a: &self.a * rhs}}
}
fn main(){
println((Junk{a:2_f64} * Junk{a:3_f64}).a.to_str());
@aarondandy
aarondandy / PointProgram.cs
Created January 18, 2014 19:40
Simple point performance test.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace PointBandwidthTest
{
class Program
{
@aarondandy
aarondandy / Encrypt.cs
Last active August 1, 2016 16:12
Bad encryption
using System;
using System.Security.Cryptography;
using System.Text;
namespace EncryptPassword
{
class Program
{
static void Main(string[] args)
{
@aarondandy
aarondandy / minecraft-map-gen.ahk
Last active January 27, 2017 18:55
Twirling!
^!g::
CenterX:=616
CenterZ:=764
RadiusMin:=940
RadiusMax:=15000
RadiusStep:=64
CircumStep:=64
FlyHeight:=220
Delay:=8000
@aarondandy
aarondandy / words.cs
Created March 6, 2017 06:06
Make words
using System.Collections.Generic;
using System.Linq;
using Hunspell;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
@aarondandy
aarondandy / text-reverse-speeds
Last active September 14, 2018 15:38
Just messing around, seeing how to reverse strings faster. Add benchmarkdotnet. Use C# 7.3, Core2.1+. Build Release.
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
// reference SqlStreamStore.Postgres, Newtonsoft.Json
// use C# 7.3+
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SqlStreamStore;
using SqlStreamStore.Streams;
@aarondandy
aarondandy / ChannelSample.cs
Created January 1, 2019 23:16
Simple Sample for System.Threading.Channels
// Install System.Threading.Channels
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;