Skip to content

Instantly share code, notes, and snippets.

ngbrown / appveyor.yml
Last active Aug 29, 2015
AppVeyor for rabbitmq-dotnet-client
View appveyor.yml
version: 3.4.5.{build}
configuration: Release
platform: Any CPU
RABBITMQ_RABBITMQCTL_PATH: C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.4.1\sbin\rabbitmqctl.bat
- ps: >-
choco install rabbitmq -Version
Set-Item -Path Env:\ERLANG_HOME -Value ([Environment]::GetEnvironmentVariables("Machine")["ERLANG_HOME"])
#! /usr/bin/python
# logging to DbgView with OutputDebugString
# from and
import logging
import ctypes
# output "logging" messages to DbgView via OutputDebugString (Windows only!)
OutputDebugStringW = ctypes.windll.kernel32.OutputDebugStringW
OutputDebugStringW.argtypes = [ctypes.c_wchar_p]
ngbrown / gist:953502517ccabd5bd264
Last active Aug 29, 2015
Determine lines of code
View gist:953502517ccabd5bd264
Function IIf($If, $IfTrue, $IfFalse) {
If ($If -IsNot "Boolean") {$_ = $If}
If ($If) {If ($IfTrue -is "ScriptBlock") {&$IfTrue} Else {$IfTrue}}
Else {If ($IfFalse -is "ScriptBlock") {&$IfFalse} Else {$IfFalse}}
Get-ChildItem -include *.js -exclude *.min.js -recurse | ?{$_.fullname -notmatch "\\node_modules\\?"}
Get-ChildItem -include *.js -recurse | select-string . | Group-Object Path -NoElement | ForEach-Object {IIf($_.Count -le 50) "a. <=50" {IIf($_.Count -le 100) "b. <=100" {IIf($_.Count -le 200) "c. <=200" {IIf($_.Count -le 500) "d. <=500" "e. >500"}}}} | Group-Object -NoElement | Sort-Object Name
ngbrown / ScanSum.cs
Created Jun 19, 2010
Examples of using TextScanner
View ScanSum.cs
namespace ScanSum
using System;
using System.Globalization;
using System.IO;
using TextScanner;
internal class ScanSum
ngbrown / WideCharToMultiByteTest.c
Created Apr 23, 2012
Demonstrates Windows reading past the source string when using WideCharToMultiByte.
View WideCharToMultiByteTest.c
// WideCharToMultiByteTest.c : Demonstrates Windows reading past the source string
// when using WideCharToMultiByte.
// The source problem uses UNICODE_STRING, so it may not be null terminated.
#define _WIN32_WINNT 0x400
#include <WinSDKVer.h>
#include <stdio.h>
#include <tchar.h>
ngbrown / strstartswith.h
Created Jul 3, 2012
string starts with
View strstartswith.h
// From
#ifndef __GNUC__
template <typename T, size_t N>
char ( &_ArraySizeHelper( T (&array)[N] ))[N];
#define countof(array) (sizeof(_ArraySizeHelper(array)))
ngbrown / WhenGivenAttribute.cs
Created Nov 9, 2012
It would be nice if SpecFlow accepted custom attributes based off of StepDefinitionBaseAttribute
View WhenGivenAttribute.cs
namespace StepDefinitions
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Assist;
ngbrown / database_spaceused.sql
Created Nov 3, 2015
Determine table row count and sizes of full database
View database_spaceused.sql
-- Determine table row count and sizes of full database
-- Inspired from
DECLARE @TableInfo TABLE (tablename varchar(128), [rows] int, reserved varchar(18), [data] varchar(18), index_size varchar(18), unused varchar(18))
DECLARE @cmd1 varchar(200)
SET @cmd1 = 'exec sp_spaceused ''?'''
INSERT INTO @TableInfo (tablename,[rows],reserved,[data],index_size,unused)
EXEC sp_msforeachtable @command1=@cmd1
ngbrown / TileCanvas.cs
Last active Dec 19, 2015 — forked from robfe/TileCanvas.cs
TileCanvas updated to be more efficient with adding and removing tiled images.
View TileCanvas.cs
public class TileCanvas : Canvas
public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register(
new PropertyMetadata(null, ImageSourceChanged));
private Size lastActualSize;
View BindableBase.cs
public abstract class BindableBase : INotifyPropertyChanged
/// <summary>
/// Multicast event for property change notifications.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Checks if a property already matches a desired value. Sets the property and
/// notifies listeners only when necessary.