Skip to content

Instantly share code, notes, and snippets.

View pldmgg's full-sized avatar

Paul DiMaggio pldmgg

View GitHub Profile
@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 = @"
@pldmgg
pldmgg / OpenScrapingTest_For_scriptcs_cli.csx
Created August 30, 2017 11:02
OpenScrapingTest_For_scriptcs_cli.csx
#r "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll"
#r "System"
#r "System.Core"
#r ".\scriptcs_packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll"
#r ".\scriptcs_packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll"
#r "System.Collections"
#r ".\scriptcs_packages\Newtonsoft.Json.10.0.3\lib\netstandard1.3\Newtonsoft.Json.dll"
#r ".\scriptcs_packages\OpenScraping.1.0.1\lib\netcoreapp2.0\OpenScraping.dll"
#r ".\scriptcs_packages\HtmlAgilityPack.1.5.1\lib\netstandard1.6\HtmlAgilityPack.dll"
@pldmgg
pldmgg / launch.json
Last active August 30, 2017 11:04
OpenScrapingProject .vscode launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Script Debug",
"type": "coreclr",
"request": "launch",
"program": "${env:ProgramFiles}\\dotnet\\dotnet.exe",
"args": [
"exec",
@pldmgg
pldmgg / VSCodeOmniSharp.md
Last active August 30, 2017 16:18
VSCodeOmniSharpImage

For context, please screenshot here: https://gist.githubusercontent.com/pldmgg/b87938d21ab9a0b0ab959d6ec12a967c/raw/b8e29882b6f0c0f4819dfd1bcb30f535297fd9e7/VSCodeOmniSharpIssue.png

When I hover over StructuredDataConfig.ParseJsonString in the below screeenshot below, I get a pop-up that says...

Assembly 'OpenScraping' with identity 'OpenScraping, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [OpenScrapingTest_For_dotnet-script_cli.csx]

Also, as you can see in the PowerShell terminal in the screenshot, when I run dotnet script, I get the following... (see project branch I'm using here: https://github.com/filipw/dotnet-script/tree/feature/netcore20) (and also OpenScraping here: https://github.com/Microsoft/openscraping-lib-csharp)

@pldmgg
pldmgg / NoClutter-NetworkMonitor.png
Last active September 4, 2017 20:51
NoClutter-NetworkMonitor Screenshot
NoClutter-NetworkMonitor.png
@pldmgg
pldmgg / Sanitized-UpdatePackageManagement.ps1
Last active January 24, 2019 02:30
Update-PackageManagement_PowerShellCore_Errors
function Check-Elevation {
if ($PSVersionTable.PSEdition -eq "Desktop" -or $PSVersionTable.Platform -eq "Win32NT") {
[System.Security.Principal.WindowsPrincipal]$currentPrincipal = New-Object System.Security.Principal.WindowsPrincipal(
[System.Security.Principal.WindowsIdentity]::GetCurrent()
)
[System.Security.Principal.WindowsBuiltInRole]$administratorsRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator
if($currentPrincipal.IsInRole($administratorsRole)) {
return $true
@pldmgg
pldmgg / Win16Chef_WinRMConfig.ps1
Created December 2, 2017 15:18
Win16Chef_WinRMConfig
WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Service
Type Name SourceOfValue Value
---- ---- ------------- -----
System.String RootSDDL O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
System.String MaxConcurrentOperations 4294967295
System.String MaxConcurrentOperationsPerUser 1500
System.String EnumerationTimeoutms 240000
System.String MaxConnections 300
System.String MaxPacketRetrievalTimeSeconds 120
@pldmgg
pldmgg / HyperV_Networking.txt
Created February 1, 2018 14:13
HyperV_Networking
PS C:\Users\zeroadmin> Get-VMSwitch -Name ToInternal | fl *
Name : ToInternal
Id : 2302da2b-bf3c-42eb-93f7-4e37fa7da892
Notes :
Extensions : {Microsoft Windows Filtering Platform, Microsoft Azure VFP Switch Extension, Microsoft NDIS Capture}
BandwidthReservationMode : Absolute
PacketDirectEnabled : False
EmbeddedTeamingEnabled : False
IovEnabled : False
@pldmgg
pldmgg / Error-HandlingTest.ps1
Created February 14, 2018 16:10
PowerShell Error Handling Output Testing
function Test-Func {
try {
$NewVagrantBoxResult = New-VagrantBox -VagrantBox "centos/7" -ErrorVariable NVBErr -ErrorAction SilentlyContinue
if (!$NewVagrantBoxResult) {throw "The New-VagrantBox function failed!"}
$NewVagrantBoxResult
}
catch {
Write-Error $_
Write-Error $($NVBErr | Out-String)
@pldmgg
pldmgg / dhcpd.conf
Created March 8, 2018 16:28
Centos7 dhcpd.conf
# dhcpd.conf
# option definitions common to all supported networks...
option domain-name "random.lab";
option domain-name-servers 8.8.8.8;
option option-128 code 128 = string;
option option-129 code 129 = text;
default-lease-time 600;
max-lease-time 7200;