Skip to content

Instantly share code, notes, and snippets.

View sean-gilliam's full-sized avatar

Sean Gilliam sean-gilliam

View GitHub Profile
@sean-gilliam
sean-gilliam / FluentTypeSwitch.cs
Created November 6, 2014 15:50
Fluent Type Switch
namespace Utilities
{
using System;
using System.Collections.Generic;
using System.Linq;
public class Switch
{
private readonly ICollection<Func<object, Action>> _cases;
private bool _defaultUsed;
@sean-gilliam
sean-gilliam / Pipes.cs
Created November 20, 2014 20:04
Named Pipes Example
namespace Pipes
{
using System;
using System.Linq;
using System.IO;
using System.IO.Pipes;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Text;
using System.Threading;
$search_term = "Typo"
$ignore = @("github", "tcp", "udp", "guid")
$lines = (gc export.txt) -notmatch [String]::Join('|',$ignore)| ?{$_.Contains($search_term)}
$lines|%{$_}
@sean-gilliam
sean-gilliam / Import existing repo.md
Created December 20, 2018 22:48
Import an existing repo into a fresh repo

git original repo c:\src\repos\<old_repo_name>

  • go up one directory cd ..

  • clone new repo into sibling directory - git clone <url> <new_repo_name>

  • cd to new directory - cd <new_repo_name>

  • add new git remote - git remote add old ..\<old_repo_name>

@sean-gilliam
sean-gilliam / LambdaEqualityComparer.cs
Created January 13, 2019 22:42
Lambda based IEqualityComparer
void Main()
{
List<Person> persons = new List<Person>
{
new Person { Id = 1, Name = "Bob", Location = "AFB" },
new Person { Id = 2, Name = "Alice", Location = "AFB" },
new Person { Id = 3, Name = "Jill", Location = "AFB" },
new Person { Id = 4, Name = "Frank", Location = "AFB" },
new Person { Id = 1, Name = "Mark", Location = "AFB" }
};
see https://github.com/microsoft/vscode-cpptools/issues/1041#issuecomment-330885162
Add the include paths from the command `gcc -v -E -x c++ -`
to includePaths C/C++ settings
@sean-gilliam
sean-gilliam / task.json
Created November 18, 2019 21:43
riftshadow vscode task settings
{
"version": "2.0.0",
"tasks": [
{
"label": "compile tests",
"command": "make -C ${workspaceRoot}/tests/",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
@sean-gilliam
sean-gilliam / launch.json
Created November 18, 2019 22:56
riftshadow vscode launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/code/rift",
"args": [],
"stopAtEntry": false,
@sean-gilliam
sean-gilliam / settings.json
Last active December 2, 2019 21:33
riftshadow vscode settings.json
{
"files.associations": {
"*.h": "cpp",
"*.c": "cpp"
},
"catch2TestExplorer.executables": {
"name": "${filename}",
"pattern": "tests/*{_tests}*"
},
"C_Cpp.intelliSenseEngine": "Tag Parser"
@sean-gilliam
sean-gilliam / exclude.ps1
Created March 9, 2020 22:06
Powershell exclusion list
$folderExclusionList = @("bin", "obj" ,"packages")
...
Where-Object {
$dir = $_.DirectoryName
# return all directories that don't have part of the exclusion list in the name
$null -eq ($folderExclusionList | Where-Object { $dir -match $_ })
}
...