Skip to content

Instantly share code, notes, and snippets.

View acaly's full-sized avatar
📚
Learning

Zhenwei Wu acaly

📚
Learning
  • Toronto, Canada
View GitHub Profile
@jstangroome
jstangroome / install.ps1
Created August 14, 2011 03:40
Example Nuget package install script in C#
param ($InstallPath, $ToolsPath, $Package, $Project)
Add-Type -Language CSharpVersion3 -TypeDefinition @'
public class MyPackage {
public static void Execute(string installPath, string toolsPath, object package, object Project) {
// implement Nuget init, install, uninstall script as C#
System.Console.WriteLine(installPath);
}
}
'@
int64_t ipow(int64_t base, uint8_t exp) {
static const uint8_t highest_bit_set[] = {
0, 1, 2, 2, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 255, // anything past 63 is a guaranteed overflow with base > 1
@dfaivre
dfaivre / PolyLabel.cs
Last active February 27, 2024 16:18
PolyLabel (pole of inaccessibility of a polygon) - C#/NTS
using System;
using System.Collections.Generic;
using System.Linq;
using GeoAPI.Geometries;
using NetTopologySuite.Geometries;
namespace Foo
{
/// <summary>
/// Finds the largest area inside a polygon (ie, for a label)