Skip to content

Instantly share code, notes, and snippets.

View pldmgg's full-sized avatar

Paul DiMaggio pldmgg

View GitHub Profile
@pldmgg
pldmgg / Windows2016-2012R2-sshd_config
Last active July 4, 2017 13:11
Windows2016-2012R2-sshd_config
# $OpenBSD: sshd_config,v 1.84 2011/05/23 03:30:07 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@pldmgg
pldmgg / Debian8Jessie_sshd_config
Created July 4, 2017 13:12
Debian8Jessie_sshd_config
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2

Keybase proof

I hereby claim:

  • I am pldmgg on github.
  • I am pldmgg (https://keybase.io/pldmgg) on keybase.
  • I have a public key ASDmu4uzG37pxXSrRmECMOym9suGg8AFCX8QdKhu9s_1IQo

To claim this, I am signing this object:

@pldmgg
pldmgg / LoadingCSharpInPowerShell.ps1
Last active July 20, 2017 15:17
LoadingCSharpInPowerShell
# Collect Locations of New Assmblies
[System.Collections.Arraylist]$NewAssembliesToInstallToGAC = @()
# Download Newtonsoft.Json
$NewNewtonSoftDir = "$HOME\Downloads\NewtonSoft-JSON"
$NewtonSoftJsonAssemblyDllPath = "$NewNewtonSoftDir\Newtonsoft.Json.dll"
if (!$(Test-Path $NewNewtonSoftDir)) {
New-Item -ItemType Directory -Path $NewNewtonSoftDir
Invoke-WebRequest -Uri "https://www.nuget.org/api/v2/package/Newtonsoft.Json/10.0.3" -OutFile "$NewNewtonSoftDir\newtonsoft.json.10.0.3.zip"
Unzip-File -PathToZip "$NewNewtonSoftDir\newtonsoft.json.10.0.3.zip" -TargetDir $NewNewtonSoftDir -SpecificItem "lib\netstandard1.3\Newtonsoft.Json.dll"
@pldmgg
pldmgg / AddTypeErrors
Created July 20, 2017 15:24
AddTypeErrors
Add-Type : (0) : Warning as Error: Assuming assembly reference 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' matches
'System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a', you may need to supply runtime policy
(1) : using System;
At V:\powershell\PowerShellDrafts\LocalOnly\Get-RelationshipQualityC.ps1:500 char:5
+ Add-Type -ReferencedAssemblies $Assem -TypeDefinition $Source -La ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Users\testadmin\AppData\Local\Temp\2\gdkpzhzg.0.cs(23) : The type or namespace name 'dynamic' could not be found (are you missing a using
@pldmgg
pldmgg / CSVManipulation
Last active August 9, 2017 17:35
CSVManipulation
public class Manipulation
{
private static void ValidateSource(string source)
{
// Validate path...
bool sourceexists = File.Exists(source);
if (!sourceexists)
{
Console.WriteLine("Unable to find " + source + "!");
@pldmgg
pldmgg / Get-NuGetDLL.ps1
Last active August 18, 2017 17:20
Inspect a downloaded .nupkg and find the "best" .dll version to use. Also output list of compatible platforms.
function Get-NuGetDLL {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[string]$PathToZip = $(Read-Host -Prompt "Please enter the full path to a .nupkg or .zip file")
)
<#
# Reference: https://docs.microsoft.com/en-us/dotnet/standard/net-standard
@pldmgg
pldmgg / OpenScrapingTest.csproj
Created August 30, 2017 10:54
OpenScrapingTest.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0</RuntimeFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent></PreBuildEvent>
</PropertyGroup>
@pldmgg
pldmgg / project.json
Created August 30, 2017 10:55
OpenScrapingProject project.json
{
"version": 3,
"frameworks": {
"netcoreapp2.0": {
"dependencies": {
"OpenScraping": "1.0.1",
"Newtonsoft.Json": "10.0.3",
"System.Runtime": "4.3.0"
}
}
@pldmgg
pldmgg / OpenScrapingTest_For_dotnet-script_cli.csx
Created August 30, 2017 10:57
OpenScrapingTest_For_dotnet-script_cli.csx
#r "nuget:Newtonsoft.Json,10.0.3"
#r "nuget:OpenScraping,1.0.1"
#r "nuget:System.Runtime,4.3.0"
using System;
using Newtonsoft.Json;
using OpenScraping;
using OpenScraping.Config;
var configJson = @"