Skip to content

Instantly share code, notes, and snippets.

function ToFileIO {
<#
function tofileio {
[ -f "$1" ] && {
local filename="$1" Uri='https://file.io/';
curl -sL -F file=@"$filename" -H accept: application/json "$Uri" | { jq -r .link 2>/dev/null || cat; }
}
}
#>
if (Test-Path $args[0] -type Leaf) {
<#
.SYNOPSIS
Copies Windows Spotlight images from ContentDeliverManager cache folder to "Pictures" folder.
.DESCRIPTION
Copies all images larger than 50KB from Windows Spotlight cache folder to \Pictures\Backgrounds\Spotlight,
creating destination directory if it does not exist.
.NOTES
Requires Lock Screen Background set to "Windows Spotlight" (Start-Process ms-settings:lockscreen).
Spotlight cache folder will populate over time, with new images usually added several times per week.
Caveat: Windows Store also stores images in the same dir, some may be mistaken as a spotlight images.
if ((! ${+precmd_functions[(r)__vte_osc7|title_precmd]}${+preexec_functions[(r)title_preexec]}))
then
function title {
[[ ( ! -o interactive || $- != *i* ) || $EMACS == *t* ]] && return
emulate -L zsh -o promptsubst -o extendedglob
: ${2=$1}
case ${TERM} in
[aEkx]term*|(#i)rxvt*|(#i)vte*|(#i)cygwin*|(#i)[pk][ui]tty*)
print -Pn "\e]2;$2:q\a"; print -Pn "\e]1;$1:q\a" ;;
## Get-PECharacteristics.ps1
<#
.SYNOPSIS
Get the file characteristics of a PE Executable.
.EXAMPLE
PS > Get-PECharacteristics $env:WINDIR\notepad.exe
IMAGE_FILE_LOCAL_SYMS_STRIPPED
IMAGE_FILE_RELOCS_STRIPPED
IMAGE_FILE_EXECUTABLE_IMAGE
IMAGE_FILE_32BIT_MACHINE
## File: Get-FileAttributesEx.ps1
<#
.SYNOPSIS
Lists NTFS file or folder attributes and flags.
.DESCRIPTION
Lists many undocumented or otherwise inaccessible file attributes, flags, and ACL properties.
.PARAMETER Path
Path to file(s)/folder(s) to list properties. Wildcards and hidden or system files are supported.
.INPUTS System.Management.Automation.PathInfo, System.String
You can pipe PathInfo objects or strings that contain paths to this cmdlet.
if [ -n "${BASH-}${ZSH_NAME-}" ]; then
lsw () {
[ -n "$1" ] && command -v which >/dev/null 2>&1 && (
for f in $(command -p which -a "$@" 2>/dev/null); do {
[ -n "$f" ] && {
command -p ls -alhFNT0 --color "$f" | gawk '{
k = 0;
for (i = 0; i <= 8; i++)
k += ((substr($1, i + 2, 1) ~ /[rwx]/) *2^ (8 - i));
if (k)
Get-CimInstance -Namespace root/cimv2 -ClassName Win32_QuickFixEngineering |
Sort-Object -Property InstalledOn -Descending |
Select-Object -Property Description, HotFixID, InstalledOn
<#
.SYNOPSIS
Starts Google Chrome apps
.DESCRIPTION
Provides a PowerShell function to start Google Chrome apps by AppId string
.PARAMETER AppId
The App ID to start
.EXAMPLE
Start-ChromeApp -AppId dfdfomllemfemmfjeichdkogfmfmbebh
.EXAMPLE
which2() {
[ -t 1 ] && {
case "${BASH##*/}${ZSH_NAME}" in
(bash) {
{ [ "`builtin type -t $1 2>/dev/null`" = "builtin" ] >&/dev/null; } && \
{ printf '%s is a shell builtin\n' "$1"; return; }
}
{
{ (alias;typeset -f) | \which --tty-only --read-alias --read-functions --show-tilde "$@" >&/dev/null; } && \
{ (alias;typeset -f) | \which --tty-only --read-alias --read-functions --show-tilde "$@" && return $?; }
function which2 {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
$Name
)
$ErrorActionPreference = 'Stop'
try {
[object]$getCommand = Get-Command $Name