Skip to content

Instantly share code, notes, and snippets.

View pwhe23's full-sized avatar

Paul Wheeler pwhe23

View GitHub Profile
@pwhe23
pwhe23 / AnalyzeNumbers.fsx
Last active December 21, 2015 01:19
FSharp Machine Learning Dojo from the Alt.net Clt meeting
// F# machine learning algorithm to analyze hand-written numbers.
// Instructions slideshow:
// * http://www.slideshare.net/mathias-brandewinder/fsharp-and-machine-learning-dojo
// Dojo code gist:
// * https://gist.github.com/mathias-brandewinder/5558573
// Training set of 5,000 examples:
// * http://brandewinder.blob.core.windows.net/public/trainingsample.csv
// Validation set of 500 examples, to test your model:
// * http://brandewinder.blob.core.windows.net/public/validationsample.csv
@pwhe23
pwhe23 / GenerateProcCalls.tt
Last active May 13, 2021 09:57
Generate Proc calls from Database
<#@ Template Debug="true" HostSpecific="true" #>
<#@ Output Extension=".cs" #>
<#@ Assembly Name="Microsoft.CSharp" #>
<#@ Assembly Name="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" #>
<#@ Assembly Name="System.Core" #>
<#@ Assembly Name="System.Data" #>
<#@ Import Namespace="System" #>
<#@ Import Namespace="System.Collections" #>
<#@ Import Namespace="System.Collections.Generic" #>
<#@ Import Namespace="System.Configuration" #>
@pwhe23
pwhe23 / Sync.cs
Created July 9, 2014 15:27
Sync FtpClient
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
namespace System.Net.FtpClient
{
public class Sync
## Automate FTP uploads
## Go to destination
cd C:\Test
$location = Get-Location
"We are here: $location"
## Get files
$files = Get-ChildItem -recurse
## Get ftp object
$ftp_client = New-Object System.Net.WebClient
$ftp_address = "ftp://user:pass@adress:/home/chardcastle/test"
@pwhe23
pwhe23 / Random.ps1
Last active August 29, 2015 14:06
Random.ps1
Add-Type -AssemblyName 'System.Windows.Forms'
Add-Type -AssemblyName 'Microsoft.VisualBasic'
$maximum = [int][Microsoft.VisualBasic.Interaction]::InputBox("Enter Maximum (inclusive)", "Max", "5")
$popup = $true
function Main() {
if ($Host.Name -eq "Windows Powershell ISE Host") {
Clear-Host
}

Keybase proof

I hereby claim:

  • I am pwhe23 on github.
  • I am paulwheeler (https://keybase.io/paulwheeler) on keybase.
  • I have a public key whose fingerprint is FAAF A0C9 F0CD 5655 9A40 F7C8 9313 BA6E 7AF9 CEC8

To claim this, I am signing this object:

@pwhe23
pwhe23 / Main.cs
Last active May 9, 2020 23:16
System.CommandLine ConfigureFromClass example
//Nuget: System.CommandLine
//Nuget: System.ComponentModel.Annotations
using System;
using System.CommandLine;
using System.CommandLine.Binding;
using System.CommandLine.Invocation;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@pwhe23
pwhe23 / ConfigureFromClass.csx
Created May 9, 2020 15:32
System.CommandLine ConfigureFromClass example
#r "nuget: System.CommandLine, 2.0.0-beta1.20253.1"
//https://discoverdot.net/projects/dotnet-script
using System;
using System.CommandLine;
using System.CommandLine.Binding;
using System.CommandLine.Invocation;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@pwhe23
pwhe23 / ExecuteCsx.cs
Last active September 11, 2020 13:50
ExecuteCSX
using Dotnet.Script.Core;
using Dotnet.Script.DependencyModel.Context;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
public static T ExecuteCsx<T>(string scriptPath, params string[] args)
{
using var scriptStream = File.OpenRead(scriptPath);
var compiler = new ScriptCompiler(LogFactory, true);
var runner = new ScriptRunner(compiler, LogFactory, ScriptConsole.Default);
@pwhe23
pwhe23 / JsonTempDataSerializer.cs
Created October 12, 2020 18:22
JsonTempDataSerializer
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.AspNetCore.Mvc.ViewFeatures.Infrastructure;
using Newtonsoft.Json;
using Newtonsoft.Json.Bson;
public class JsonTempDataSerializer : TempDataSerializer
{
private readonly JsonSerializer _jsonSerializer = JsonSerializer.CreateDefault(new JsonSerializerSettings