Skip to content

Instantly share code, notes, and snippets.

@gangstanthony
gangstanthony / rpi-hdmi.sh
Created February 12, 2021 19:17 — forked from AGWA/rpi-hdmi.sh
Enable and disable the HDMI port on the Raspberry Pi: `rpi-hdmi on` to turn on, `rpi-hdmi off` to turn off. X is properly reinitialized when re-enabling.
#!/bin/sh
# Enable and disable HDMI output on the Raspberry Pi
is_off ()
{
tvservice -s | grep "TV is off" >/dev/null
}
case $1 in
# [Start of entries generated by MVPS HOSTS]
#
# [Misc A - Z]
0.0.0.0 fr.a2dfp.net
0.0.0.0 m.fr.a2dfp.net
0.0.0.0 mfr.a2dfp.net
0.0.0.0 ad.a8.net
0.0.0.0 asy.a8ww.net
0.0.0.0 static.a-ads.com
0.0.0.0 abcstats.com
# https://www.reddit.com/r/PowerShell/comments/4dn1yd/problems_with_global_variables/
# input: guid
# output: returncode
function UninstallMQ ($umqGUID) {
# $rc = (Start-Process -FilePath "msiexec.exe" -ArgumentList "/X{$umqGUID} /qn /l*V c:\logs\MQClient_$Version`_Uninstall.log" -Wait -Passthru).ExitCode
Write-Host "Start msiexec and uninstall GUID: $umqGUID"
$rc = 0
if ( $rc -ne 0 ) {
return 3
# https://www.reddit.com/r/PowerShell/comments/4cz7fd/how_have_you_used_powershell_in_your_personal/
# http://blog.koenvermoesen.be/2011/09/17/using-powershell-for-organizing-your-photo-library/
# should fix this when done with rename pictures script
# ==============================================================================================
#
# Microsoft PowerShell Source File -- Created with SAPIEN Technologies PrimalScript 4.1
#
# NAME: OrgPhotos.ps1
#https://www.reddit.com/r/PowerShell/comments/4cz7fd/how_have_you_used_powershell_in_your_personal/
# SIMILAR UTILITY
# http://www.sentex.net/~mwandel/jhead/
$dir = Read-Host 'Drag and drop the folder you wish to process.'
$dir = $dir -replace '"' # sometimes drag-n-drop inclues quotes in the string
if (!$dir) { Throw 'No path specified' }
$recurse = Read-Host 'Check subfolders? y/[N]'
# https://community.spiceworks.com/topic/1529112-path-too-long-error
# This script requires the Get-Files function below
# https://github.com/gangstanthony/PowerShell/blob/master/Get-Files.ps1
$files = Get-Files \\Fileserver\E$ -Recurse -NameOnly
# get available drives in case dealing with long file names
# we can map a drive to a long file path so it is short enough for powershell to handle
$drives = [io.driveinfo]::getdrives() | % {$_.name[0]}