Skip to content

Instantly share code, notes, and snippets.

@Seikilos
Seikilos / macro_dbg.h
Last active August 29, 2015 14:17
Macro Debugging macro to display macros, displays if macro is undefined. This is not meant to be executed in anyway, just visual comparison
#define COMBINE1(X,Y) X##_##Y
#define COMBINE(X,Y) COMBINE1(X,Y)
#define QUOTE_EX(p, dummy) #p
#define QUOTE(p) QUOTE_EX(p, dummy)
#define DefMacro(p) \
class COMBINE(Dummy_##p, __COUNTER__){\
void info(){\
auto undefinedWhenTrue = #p == QUOTE(p); \
auto value = QUOTE(p);\
@Seikilos
Seikilos / newestfiles.msbuild.xml
Last active August 29, 2015 14:04
MSBuild Inline Task to get n newest files from given directory
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="GetNewestFiles" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Path ParameterType="System.String" Required="true" />
<FileFilter ParameterType="System.String" Required="true" />
<HowManyFiles ParameterType="System.Int32" Required="true" />
<FilesToCopy ParameterType="System.String[]" Output="true" />
</ParameterGroup>
<Task>
@Seikilos
Seikilos / ilmerge.msbuild.xml
Created August 1, 2014 09:35
Small msbuild target to merge assemblies (without requiring the ILMerge.Task)
<?xml version="1.0" encoding="utf-8"?>
<!--
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe ilmerge.msbuild.xml /p:out=Dependencies.dll /p:dir=dir_with_assemblies_to_merge
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ILPath>packages\ilmerge.2.13.0307\ILMerge.exe</ILPath>
@Seikilos
Seikilos / gist:8c353252a3ec03c89cdc
Last active August 29, 2015 14:04
Find all references to a hard drive
First check registry: https://gist.github.com/Seikilos/ab23cf6b85e1d65936a5
Then to locate symlinks and junctions:
dir /AL /S c:\ > symlinks.txt 2>&1
or use
http://www.nirsoft.net/utils/ntfs_links_view.html
THIS DOES NOT LOCATE SIMPLE LINKS!
Use lnk parser: https://code.google.com/p/lnk-parser/downloads/list
@Seikilos
Seikilos / reg_search.bat
Created July 25, 2014 09:38
Registry Search, Call with 2>&1
@echo off
IF "%1"=="" GOTO ERROR
echo Searching for %1
REG Query HKLM /F "%1" /S
REG Query HKCU /F "%1" /S
REG Query HKCR /F "%1" /S
REG Query HKU /F "%1" /S
@Seikilos
Seikilos / 0_Pipeline.hpp
Last active August 29, 2015 14:02
Pipeline class utilizing C++11 Features, handles Visual Studio 2012 incompleteness of C++11 standard. Now with conditional items utilizing predicates
#pragma once
#include <string>
#include <functional>
#include <vector>
#include <utility>
/**
* Pipeline class.
@Seikilos
Seikilos / XElementUtils.cs
Created June 4, 2014 08:58
XElement extension for proper retrieval of elements and attributes including better exception handling
using System;
using System.Globalization;
using System.Xml.Linq;
namespace YourNS
{
public static class Utils
{
#region Attribute Helper
@Seikilos
Seikilos / Stepper.hpp
Last active August 29, 2015 14:00
Generic Stepper Class (requires C++11 features, >=VS2013)
#pragma once
#include <functional>
#include <assert.h>
namespace Utils
{
/**
* Provides arbitrary stepping functionality with a custom property type
*/
template<typename TFunc>
// Replace LISMemoryComparer.MemoryComparerManager.SplitMemoryDumpLine(string DumpLine) with:
private static string[] SplitMemoryDumpLine(string DumpLine)
{
// Split by whitespace, skip whitespace
var lines = DumpLine.Trim().Split(' ');
var Result = new List<string>();
foreach (var line in lines)
@Seikilos
Seikilos / AutoFixture_ObservableCollection
Created October 11, 2013 06:51
AutoFixture hint by moodmosaic on how to add ObservableCollection support (From AutoFixture issue https://github.com/AutoFixture/AutoFixture/issues/191#issuecomment-26084930)
fixture.Customizations.Add(
new FilteringSpecimenBuilder(
new MethodInvoker(
new EnumerableFavoringConstructorQuery()),
new ObservableCollectionSpecification()));
internal class ObservableCollectionSpecification : IRequestSpecification
{
public bool IsSatisfiedBy(object request)
{