Skip to content

Instantly share code, notes, and snippets.

View schittli's full-sized avatar

Tom-- schittli

  • Biel / Bienne, Switzerland
  • 14:16 (UTC +02:00)
View GitHub Profile
@SqlWaldorf
SqlWaldorf / u2u_student_laptop_boxstarter.txt
Last active September 1, 2022 20:59
BoxStarter list of packages to install on a new windows machine
choco feature enable -n allowGlobalConfirmation
cinst Chocolatey
cinst azcopy
cinst azure-cli
cinst azurepowershell
cinst sql-server-express
cinst sql-server-management-studio
cinst powerbi
cinst sqlsentryplanexplorer
cinst curl
@pirate
pirate / docker-compose-backup.sh
Last active January 26, 2025 23:38
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
Class AdvancedPing
{
hidden [string]$_packets
hidden [string]$_duration
hidden [string]$_hostName
hidden [string]$_ip
hidden [int]$_bytes = 64
hidden [int]$_ttl = 57
hidden [int]$_timeout = 120
hidden [int]$_interval = 1000
powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int PostMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::PostMessage(-1,0x0112,0xF170,2)
<#
.SYNOPSIS
Uses Win32_Fan class to return information about fans in a system.
.DESCRIPTION
This script first defines some functions to decode various
WMI attributed from binary to text. Then the script calls
Get-WmiObject to retrieve fan details, then formats that
information (using the functions defined at the top of the script.
.NOTES
<#
.SYNOPSIS
Retries a powershell command n-times.
.DESCRIPTION
The cmdlet is capable of retrying a PowerShell command passed as a [ScriptBlock] according to the user defined number of retries and timeout (In Seconds)
.PARAMETER TimeoutInSecs
Timeout in secods for each retry.
@jdhitsolutions
jdhitsolutions / Send-ToPSGridview.ps1
Created January 15, 2019 18:02
A PowerShell Core function designed to send output to an instance of Out-Gridview in Windows PowerShell. This requires you to be running a full graphical desktop like Windows 10.
#requires -version 6.1
Function Send-ToPSGridView {
<#
.SYNOPSIS
Send objects to Out-Gridview in Windows PowerShell
.DESCRIPTION
This command is intended as a workaround for PowerShell Core running on a Windows platform, presumably Windows 10. PowerShell Core does not support all of the .NET Framework which means some commands like Out-Gridview are not supported. However, on a Windows desktop you are most likely running Windows PowerShell side by side with PowerShell Core. This command is designed to take objects from a PowerShell expression and send it to an instance of Windows PowerShell running Out-Gridview. You can specify a title and pass objects back to your PowerShell Core session. Note that passed objects will be deserialized versions of the original objects.
.PARAMETER Title
@jdhitsolutions
jdhitsolutions / TelemetryPrompt.ps1
Last active March 10, 2019 18:33
A PowerShell prompt function to display telemetry-like information for a few remote servers.
#requires -version 5.1
#this requires a windows platform
Function prompt {
$charHash = @{
Up = 0x25b2 -as [char]
Down = 0x25bc -as [char]
}
@jdhitsolutions
jdhitsolutions / MemUsagePrompt.ps1
Created December 13, 2018 15:37
A PowerShell Prompt function to display free memory percentage from a list of remote servers.
function prompt {
Try {
Get-Variable -Name rsHash -Scope global -ErrorAction Stop | Out-Null
}
Catch {
#create the runspace and synchronized hashtable
$global:rsHash = [hashtable]::Synchronized(@{Computername = $env:computername; results = ""; date = (Get-Date)})
$newRunspace = [runspacefactory]::CreateRunspace()
#set apartment state if available
@jdhitsolutions
jdhitsolutions / SpacePrompt.ps1
Created December 13, 2018 15:19
A PowerShell prompt function to display free disk space from a list of remote servers.
function prompt {
Try {
Get-Variable -Name rsHash -Scope global -ErrorAction Stop | Out-Null
}
Catch {
#create the runspace and synchronized hashtable
$global:rsHash = [hashtable]::Synchronized(@{Computername = $env:computername; results = ""; date = (Get-Date)})
$newRunspace = [runspacefactory]::CreateRunspace()
#set apartment state if available