Skip to content

Instantly share code, notes, and snippets.

View fearthecowboy's full-sized avatar
🏠
Happily Working from home

Garrett Serack fearthecowboy

🏠
Happily Working from home
View GitHub Profile
@fearthecowboy
fearthecowboy / BufferedMessagePackEncoder.d.ts
Created August 28, 2015 16:55
Internal module confusion...
/// <reference path="../node/node.d.ts" />
// bug: shouldn't I be able to reference stream.Writable?
// adding the import line here makes it so that the consumer can't see this class.
// import * as stream from "stream"
declare class BufferedMessagePackEncoder {
private tail;
private encoder;
private stream;
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
@fearthecowboy
fearthecowboy / taskbar.cs
Last active August 29, 2015 13:57
Pin or unpin items from the taskbar programatically
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
### Keybase proof
I hereby claim:
* I am fearthecowboy on github.
* I am fearthecowboy (https://keybase.io/fearthecowboy) on keybase.
* I have a public key whose fingerprint is 2B7D DF27 186D C48E 17DC 1667 5DF6 9654 20E7 F0F7
To claim this, I am signing this object:
@fearthecowboy
fearthecowboy / TestPackageProvider.psm1
Created June 3, 2014 21:17
Test Package Provider For OneGet in PowerShell
<#
#>
function Add-PackageSource {
param(
[string] $name,
[string] $location,
[bool] $trusted
)
@fearthecowboy
fearthecowboy / TestPackageProvider.ps1
Created June 5, 2014 22:40
Test PackageProvider for OneGet
###
# ==++==
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@fearthecowboy
fearthecowboy / extensions.cs
Created June 16, 2014 15:24
Handy IEnumerator<T> extension methods
public static IEnumerable<T> ToIEnumerable<T>(this IEnumerator<T> enumerator) {
if (enumerator != null) {
while (enumerator.MoveNext()) {
yield return enumerator.Current;
}
}
}
public static T[] ToArray<T>(this IEnumerator<T> enumerator) {
return ToIEnumerable<T>(enumerator).ToArray();
nuget {
nuspec {
id = ROOT;
version = 5.34.18.0001;
title = ROOT;
authors = {CERN};
owners = {G. Watts};
licenseUrl: "http://root.cern.ch/drupal/content/license";
projectUrl: "http://root.cern.ch";
iconUrl: "http://root.cern.ch/drupal/sites/default/files/rootdrawing-logo.png";
<?xml version="1.0" encoding="utf-8"?>
<SoftwareIdentity xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="Microsoft.Common.Runtime.Identities"
tagVersion="1" uniqueId="Microsft.Common.Runtime.Identity.1"
version="1.0" versionScheme="multipartnumeric" >
<Meta
os="windows"
version="6.0"
name="Windows Vista (either server-2008 or vista)"
@fearthecowboy
fearthecowboy / sample.cs
Created August 19, 2014 18:17
Dynamic PowerShell from C# using my DynamicPowerShell class
dynamic ps = new DynamicPowershell();
DynamicPowershellResult result = ps.Dir(@"c:\") ;
DynamicPowershellResult result2 = ps.TestPath(result);
foreach (var r in result2) {
Console.WriteLine(r); // prints true for each item!
}