Skip to content

Instantly share code, notes, and snippets.


Chris F Carroll chrisfcarroll

Block or report user

Report or block chrisfcarroll

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:4596103
~/Software/Clojure/pallet-crate-tomcat7-demo]lein run
16:35:14.723 [main] DEBUG pallet.compute.jclouds - extensions (:slf4j :sshj)
16:35:14.734 [main] DEBUG pallet.compute.jclouds - options []
16:35:17.279 [main] DEBUG pallet.core - pallet version: 0.7.2
16:35:17.290 [main] INFO pallet.core - retrieving nodes
16:35:23.639 [main] INFO pallet.core - lift-nodes phases [:destroy-server], groups []
Exception in thread "main" java.lang.NumberFormatException: Invalid number: 09
at clojure.lang.LispReader.readNumber(
at clojure.lang.RT.readString(
chrisfcarroll / gist:28fc739fb63d19f242d1
Created Feb 5, 2016
Stub or Mock, as far as possible, the Asp.Net MVC controller HttpContext and also System.Web.HttpContext.Current
View gist:28fc739fb63d19f242d1
public partial class HttpRequestOverridableWrapper : HttpRequestWrapper
readonly string appVirtualDir;
public HttpRequestOverridableWrapper(HttpRequest httpRequest, string appVirtualDir)
: base(httpRequest)
this.appVirtualDir = appVirtualDir;
public override string ApplicationPath { get { return appVirtualDir; } }
chrisfcarroll / QUnitTestIf.cshtml
Last active Feb 14, 2016
An Asp.Net MVC PartialView for in-browser page testing. Makes it possible to test complex UIs and widgets 'in situ' but with zero client-side pageweight in production.
View QUnitTestIf.cshtml
@model IEnumerable<string>
@if (Request.IsLocal
&& ( Request.QueryString["test"]!=null
<div id="unit-tests">
<script src='~/scripts/qunit-1.20.0.js'></script>
chrisfcarroll / Cacher.cs
Last active Feb 19, 2016
A simple memoizer backed by System.Runtime.Caching.MemoryCache.Default
View Cacher.cs
using System;
using System.Reflection;
using System.Runtime.Caching;
/// <summary>Memoize the results of method calls.</summary>
class Cacher
public readonly string UniqueName;
public readonly int CacheTimeSeconds;
View Minimal html5 doc
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>title</title></head><body>Here</body></html>
View WrappingAsyncInAsyncAwaitIsRedundant.cs
// Example 1) async await is redundant when calling a method that doesn't block anyway
void Main()
var filename = Path.Combine(Path.GetTempPath(), "ExampleAsyncAwaitIsRedundant.txt");
using (var fstream= new FileStream(filename,FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 4096,FileOptions.Asynchronous))
fstream.Seek(0, SeekOrigin.Begin);
chrisfcarroll / youtube-dl-prompt.ps1
Created Jul 8, 2017
Youtube Downloader Prompting Wrapper : wraps youtube-dl.exe for a start-menu icon that prompts for the url to download.
View youtube-dl-prompt.ps1
param( [Parameter(Mandatory=$true)][string]$UrlToDownload )
cd $downloadDirectory
write-host ""
write-host ""
write-host "Downloading $urlToDownload to $downloadDirectory ..."
write-host ""
write-host ""
youtube-dl.exe $urlToDownload
chrisfcarroll / Curl.ps1
Last active Sep 12, 2017
PowerShell wrapper for Invoke-WebRequest with Proxy
View Curl.ps1
$env:Proxy="http://YOUR-CORPORATE-PROXY-HERE" ;
Add-Type -AssemblyName 'Microsoft.PowerShell.Commands.Utility, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
function curl
chrisfcarroll / karabiner.json
Last active Sep 21, 2017
Windows on Mac : Just the main Windows Ctrl-keystroke -> Cmd-keystroke mappings. Using Karabiner.
View karabiner.json
"profiles": [
"complex_modifications": {
"parameters": { /* ... etc ... */ },
"README": "********************************************************************************************************",
"README": "*" COPY JUST THE ELEMENTS OF THIS "rules" array into your profiles.complex_modifications.rules array. "*",
"README": "********************************************************************************************************",
"rules": [
chrisfcarroll / SerilogStringListSink.cs
Last active Sep 21, 2017
A StringList Sink for Serilog. Typical usage:
View SerilogStringListSink.cs
using System;
using System.Collections.Generic;
using System.IO;
using Serilog;
using Serilog.Configuration;
using Serilog.Core;
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Formatting.Display;
You can’t perform that action at this time.