This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Timers; | |
using FubuCore; | |
using NLog; | |
using NLog.Layouts; | |
using NLog.Targets; | |
using Topshelf; | |
using Topshelf.Runtime; | |
namespace Dragon.WindowsService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hide Episode Descriptions | |
// @namespace https://gist.github.com/davidalpert/a103c10889b74f9e5ef0 | |
// @version 0.1 | |
// @description hides (and then optionally toggles) the descriptions of episode listings on Wikipedia | |
// @author David Alpert | |
// @match https://en.wikipedia.org/wiki/*episodes* | |
// @match http://en.wikipedia.org/wiki/*episodes* | |
// @match https://en.wikipedia.org/wiki/*(TV_series) | |
// @match http://en.wikipedia.org/wiki/*(TV_series) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TestHelpers | |
open System | |
open System.IO | |
type RedirectedConsole() = | |
let outBefore = Console.Out | |
let errorBefore = Console.Error | |
let console = new StringWriter() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RedirectedConsole : IDisposable | |
{ | |
readonly TextWriter outBefore; | |
readonly TextWriter errBefore; | |
readonly StringWriter console; | |
public RedirectedConsole() | |
{ | |
console = new StringWriter(); | |
outBefore = Console.Out; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lg = log --graph --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %-n%Cgreen(%ci)%Creset%-n' --date=relative | |
lg2 = "!git lg -2" | |
drop = "!sh -c 'git merge drop$1 && git ci --allow-empty --amend && git lg2' -" | |
patch = "!sh -c 'git merge patch$1 && git ci --allow-empty --amend && git lg2' -" | |
cd = "!git diff-index --cached --quiet HEAD --ignore-submodules -- && GIT_COMMITTER_DATE=\"$1\" git commit --allow-empty --amend -C HEAD --date \"$1\"" || echo >&2 "error: date change failed: index not clean!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let private getFromResource resourceName = | |
let assem = System.Reflection.Assembly.GetExecutingAssembly() | |
try | |
use stream = assem.GetManifestResourceStream(resourceName) | |
use reader = new System.IO.StreamReader(stream) | |
reader.ReadToEnd(); | |
with | |
| ex -> | |
let errorMessageBase = sprintf "%s not found; available resources include:" resourceName | |
let errorMessage = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS C:\Users\dalpert> cinst virtualbox -source "https://chocolatey.org/api/v2/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS C:\Users\dalpert> cinst virtualbox | |
Chocolatey (v0.9.8.23) is installing ‘virtualbox’ and dependencies. By installing you accept the license for ‘virtualbox’ and each dependency you are installing. Unable to connect to the remote server | |
Command ‘install’ failed (sometimes this indicates a partial failure). Additional info/packages: virtualbox Reading environment variables from registry. Please wait… Done. | |
PS C:\Users\dalpert> cinst virtualbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Digital Storage units --------------------------- | |
[<Measure>] type GB = | |
static member perMB = 0.000976562<GB> | |
static member perKB = 9.5367e-7<GB> | |
static member perByte = 9.3132e-10<GB> | |
[<Measure>] type MB = | |
static member perGB = 1024.0<MB> | |
static member perKB = 0.000976563<MB> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using System.Reflection; | |
namespace %%YOUR_NAMESPACE%% | |
{ | |
public static class ManifestResourceHelper | |
{ | |
public static string[] GetManifestResourceNames(Assembly asm = null) | |
{ |