Skip to content

Instantly share code, notes, and snippets.

View jhoneill's full-sized avatar

James O'Neill jhoneill

View GitHub Profile
@jhoneill
jhoneill / Profile-cd.ps1
Last active October 6, 2023 20:05
PowerShell to make a nicer CD.. Just add to profile.
#Profile addition to redefine cd as a proxy for push location (and cd- for Pop).
# cd ... is transformed into into cd ..\.. (extra dot is an extra level),
# cd ^ is transformed into cd <<script i.e. profile>> directory
# cd \*doc is transformed into cd \*\Doc*\
# cd = is transformed into an item from the stack. = is the first each extra = goes one deeper in the stack
# cd - will not tab expand but will pop an item from the location stack. 3 or more - will do an extra pop.
# -- means "all the rest are a strings", so two levels needs -- --
# cd ~ Now supports tab expansion
# cd ~~ Tab completes "Special" folders (e.g. MyDocuments, Desktop, ProgramFiles)
# cd ~~Name\ Transorms to or tab completes the special folder
@jhoneill
jhoneill / Where-object.ps1
Created November 24, 2019 17:09
Where-object with no parameter support
Function where-object {
[CmdletBinding(DefaultParameterSetName='None', HelpUri='https://go.microsoft.com/fwlink/?LinkID=113423', RemotingCapability='None')]
param(
[Parameter(ValueFromPipeline=$true)]
[psobject]
${InputObject},
[Parameter(ParameterSetName='ScriptBlockSet', Mandatory=$true, Position=0)]
[scriptblock]
${FilterScript},
@jhoneill
jhoneill / Copy-Spotlight.ps1
Last active November 20, 2020 22:05
This script copies files downloaded by windows spotlight. For years I have had Windows background drawn from users\public\pictures\sample pictures, so this adds the spotlight ones to that location by default.
<#
.Synopsis
Copies images downloaded by Windows Spotlight
#>
[cmdletbinding()]
param (
#Where to send JPEGS which are Landscape format e.g ~\AppData\Roaming\Microsoft\Teams\Backgrounds\Uploads
$LandScapeDestination = "C:\users\Public\Pictures\Sample Pictures",
#Where to send JPEGS which are portrait format
$PortraitDestination = "C:\Users\Public\Pictures\Portrait Samples"
@jhoneill
jhoneill / lightroom.ps1
Created April 18, 2020 11:54
PowerShell Script to explore Adobe Lightroom catalogs
##########################################################
# #
# Tools for getting information from the Lightroom DB #
# To use this script you need to download the SQL Lite #
# ODBC driver from http://www.ch-werner.de/sqliteodbc/ #
# #
# and set your default catlog path #
# #
##########################################################
@jhoneill
jhoneill / Chrome Databases.ipynb
Last active March 10, 2024 21:12
Exploring data saved by Chrome/Edge/Any Chromium (passwords done in another Gist)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhoneill
jhoneill / GetSql.ipynb
Created November 20, 2020 18:20
Accessing data with the GetSQL module
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhoneill
jhoneill / PowerShellNotebookModule.ipynb
Last active November 23, 2020 18:06
Changes I made to the module
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhoneill
jhoneill / localhost.ipynb
Last active November 23, 2020 12:12
Demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhoneill
jhoneill / Show-help.ps1
Created February 4, 2021 17:48
A PowerShell Productivity hack - put help in it's own window
function Show-Help {
<#
.Synopsis
Open help in "Show window" mode
#>
param (
[parameter(ValueFromPipeline=$true)]
[ArgumentCompleter({
param($commandName, $parameterName,$wordToComplete,$commandAst,$fakeBoundParameter)
[System.Management.Automation.CompletionCompleters]::CompleteCommand($wordToComplete)
#I created this to show how much there is on the MS Graph API.
#I pulled down the openapi (nee swagger) files for Users, users.actions, Users,functions and groups
#And using my https://github.com/jhoneill/PSGraph - my version of Kevin Marquette's graphViz Module
#this litte bit of script produced a graphical version
$paths = @()
$ParentHash = @{}
function hasParent {
# .synopsis if the parent isn't in the call recursively with the parent. Add item and its parent to the hash
param($path)