Skip to content

Instantly share code, notes, and snippets.


John Donnelly johndonnelly

View GitHub Profile
johndonnelly /
Created Jan 21, 2021 — forked from job9931/
Common interface for parsing txt, docx, pdf, html and pptx
import os
import io
from docx import Document
from pdfminer3.layout import LAParams, LTTextBox
from pdfminer3.pdfpage import PDFPage
from pdfminer3.pdfinterp import PDFResourceManager
from pdfminer3.pdfinterp import PDFPageInterpreter
from pdfminer3.converter import PDFPageAggregator
from pdfminer3.converter import TextConverter
johndonnelly / DownloadImages_fromURL.ps1
Created May 6, 2019 — forked from PrateekKumarSingh/DownloadImages_fromURL.ps1
Extracting Images from a URL and saving it in a desired directory
View DownloadImages_fromURL.ps1
(Invoke-WebRequest -Uri $url).images.src | ?{$_ -like "*Geekeefy.files*"} -PipelineVariable pv `
| %{$fn = ($pv.split("/")[-1]).split('?')[0];iwr $pv -OutFile "D:\scraping\$fn"}
View WolphramAlpha.ps1
Function Invoke-WolframAlphaAPI($Query)
Return (Invoke-RestMethod -Uri "$($Query.Replace(' ','%20'))").queryresult
View PSTelnet.ps1
Test-Port -Source '' -Destination '','','','' `
-Port 3389,20, 21 -Verbose | ft -AutoSize
#-Iterate | Export-Csv portstatus.csv -NoTypeInformation
#Test-PortConnectivity '' 'dc1' 57766 -Protocol UDP -Iterate
#Test-PortConnectivity 'localhost' 'dc2' 51753 -Protocol UDP
#Test-PortConnectivity -Source $EUCAS -Destination $EUMBX -Port 135 -Iterate
#Test-PortConnectivity -Source 'localhost' -Destination '' -Port 135 -Iterate -protocol TCP
Function Test-Port
View PSTelnetV2.ps1
# Function to enable telnet-ing from [Local/Remote] Source location, which requires credentials for remote source machine
# This Function is a wrapper around Function PSTelnet to add remote source telnet-ing feature
Function Test-Port
[Parameter(Position=0)] $Source = $(Hostname),
[Parameter(Mandatory=$true,Position=1)] $Destination,
View AutomatedLogin.ps1
# Create an Internet Explorer object
$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible= $true # Make it visible
# Open all websites
# Navigate2() function to open in new tab in the same IE window
View Sets.ps1
# define a set
$x = [System.Collections.Generic.HashSet[string]]::new()
$y = [System.Collections.Generic.HashSet[string]]::new()
$x.ExceptWith($y) # All the elements in x but not in y
# union
$x.UnionWith($y) # Unique elements in x or y or both
View WebScrape_Blogs.ps1
$data = Invoke-WebRequest
$data.Links.Where({ $_.href -like "*http*" -and
$_.href -notlike "*twitter*" -and
$_.href -notlike "*sql*" -and
$_.href -notlike "*creativecomm*" -and
$_.href -notlike "*microsoft*"
}) | Select-Object href -Unique -ExpandProperty href
View encodedecodeURL.ps1
# encoding the URL
# decoding the URL
View Debug-Error.ps1
function Debug-Error {
$action = {
if ($_ -and ($stacktrace -notmatch '^\s*at System\.Management\.Automation\.ExceptionHandlingOps\.CheckActionPreference') -and ($stacktrace -notmatch '^\s*at System\.Management\.Automation\.MshCommandRuntime\.ThrowTerminatingError\(ErrorRecord errorRecord\)\s*$')) {