Skip to content

Instantly share code, notes, and snippets.

View schittli's full-sized avatar

Tom-- schittli

  • Biel / Bienne, Switzerland
  • 03:06 (UTC +02:00)
View GitHub Profile
Function Hplus {
h|ogv -Title "Select the command(s) & hit 'OK' to run" -PassThru|%{iex $_.commandline}
}
@qwerty12
qwerty12 / enable-all-advanced-power-settings.ps1
Last active November 2, 2021 09:07 — forked from raspi/enable-all-advanced-power-settings.ps1
Enable all advanced power settings in Windows.
# List all possible power config GUIDs in Windows
# Run: this-script.ps1 | Out-File powercfg.ps1
# Then edit and run powercfg.ps1
# (c) Pekka "raspi" Järvinen 2017
# https://stackoverflow.com/a/22156833
if (-not ([System.Management.Automation.PSTypeName]'PowrProf').Type)
{
Add-Type -TypeDefinition @"
using System;
$url = "https://octopus.jaykul.com"
# Create our App registration
$Application = @{
DisplayName = $DisplayName
IdentifierUris = $Url
Homepage = "$url/app"
ReplyUrls = "$url", "$url/app/users/authenticatedToken/AzureAD"
LogoutUrl = "$url/app#/users/sign-out"
AppRoles = @(
@Jaykul
Jaykul / OctopusDeploy.psm1
Created May 11, 2017 18:43
I needed to do some octopus stuff, and didn't like any of the code I found ...
$OctopusInstallPath = "C:\Program Files\Octopus Deploy\Octopus";
Add-Type -Path "$OctopusInstallPath\Octopus.Client.dll"
function Set-OctopusEndpoint {
<#
.Synopsis
Sets the connection endpoint for an Octopus deploy instance
.DESCRIPTION
Registers the octopus endpoint with the given information.
# 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
{
[cmdletbinding()]
Param
(
[Parameter(Position=0)] $Source = $(Hostname),
[Parameter(Mandatory=$true,Position=1)] $Destination,
Test-Port -Source '127.0.0.1' -Destination '10.196.11.206','10.196.11.206','10.196.11.206','123.234.234.3' `
-Port 3389,20, 21 -Verbose | ft -AutoSize
#-Iterate | Export-Csv portstatus.csv -NoTypeInformation
#Test-PortConnectivity '127.0.0.1' '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 '127.0.0.1' -Port 135 -Iterate -protocol TCP
Function Test-Port
@Jaykul
Jaykul / ErrorHandlingFunction.ps1
Last active March 7, 2018 19:18
Minimal effort at error logging
function Verb-Noun {
[CmdletBinding()]
param()
Push-Location -Stack Verb-Noun
# BOILER PLATE ERROR HANDLING
trap { # Standard practice in every script
$ex = $_
do {
$Stack = if($ex.ScriptStackTrace) { $ex.ScriptStackTrace } else { $ex.StackTrace }
$PSCmdlet.WriteInformation(@(
@Jaykul
Jaykul / ErrorHandlingExample.ps1
Last active March 7, 2018 19:19
Try this example, then try changing line 14 to catch [exception]
using namespace System.Management.Automation
& {
[CmdletBinding()]param()
$ErrorActionPreference = "Stop"
try { # Standard practice in every script
Get-Item NoSuchFile
} catch [ItemNotFoundException] {
Write-Warning "File not found, using workaround ... "
@jchandra74
jchandra74 / PowerShell Customization.md
Last active January 8, 2025 09:35
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@Visionary1
Visionary1 / Class Dock.ahk
Last active November 10, 2024 23:33
Docks a window to another
/*
Class Dock
Attach a window to another
Author
Soft (visionary1 예지력)
version
0.1 (2017.04.20)
0.2 (2017.05.06)