Skip to content

Instantly share code, notes, and snippets.

View CitizenInsane's full-sized avatar

Citizen Insane CitizenInsane

View GitHub Profile
@CitizenInsane
CitizenInsane / DotNetMarshalling.py
Last active September 23, 2021 12:39
Marshalling of numpy.ndarray (Python world) with System.Array (.NET world)
"""
Helper module for marshalling Python types with .NET types
"""
import numpy
import ctypes
import clr, System
clr.AddReference("System.Runtime")
clr.AddReference("System.Runtime.Numerics")
## Marshalling NumPy <==> .NET
; DEMO innosetup script to let user select macros to install
#define MyAppName "Choose custom files for install"
#define MyAppVersion "1.0"
#define MyAppPublisher "CitizenInsane"
#define MyAppURL "https://stackoverflow.com/questions/58840411/innosetup-choose-custom-files-to-install"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
@CitizenInsane
CitizenInsane / csharp.xslt
Created September 19, 2012 09:44
Replacer for `csharp.xslt` in 'protobuf-net-VS10.msi' to workaround some code generation issues
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="xsl msxsl"
>
<xsl:import href="common.xslt"/>
<xsl:param name="help"/>
<xsl:param name="xml"/>
<xsl:param name="datacontract"/>
<xsl:param name="binary"/>
@CitizenInsane
CitizenInsane / TestNaNGenerics.cs
Created August 24, 2012 12:18
How to test for NaN with generics (or why NaN.Equals(NaN) == true) ?
namespace TestForNaNWithGenerics
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
[TestFixture]
class TestForNaN
@CitizenInsane
CitizenInsane / EmphaseSelectedRegion.m
Created July 20, 2012 13:15
Failing to emphase some region using transparency on a spherical surface
%% Main function
function [] = EmphaseSelectedRegion()
%[
% Create data
[X, Y, Z, Data] = createTestData();
% Select max - xxdB region
maxData = max(max(Data));
W = ones(size(Data));
W(Data < (maxData/1.2)) = 0;
@CitizenInsane
CitizenInsane / testincremental.proj
Created March 17, 2012 00:33
Trying to figure out why incremental build is not working
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Trying to figure out why incremental build is not working for larger
msbuild project but with similar structure as this one.
Here with targets defined as imported targets + separating as scrs/includes
and repeating scrs in includes + splitting the test target in BeforeTest,
@CitizenInsane
CitizenInsane / Program.cs
Created February 4, 2012 17:38
Simple WMI wrapper
namespace Wmi
{
using System;
class Program
{
static void Main()
{
try
{