Skip to content

Instantly share code, notes, and snippets.

View MoudryDaniel's full-sized avatar

Daniel Moudrý MoudryDaniel

View GitHub Profile
@MoudryDaniel
MoudryDaniel / suspend.ps1
Created February 25, 2022 13:49
Puts a computer to sleep mode.
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::SetSuspendState([System.Windows.Forms.Powerstate]::Suspend, $false, $false) | Out-Null
@MoudryDaniel
MoudryDaniel / quicknote.ps1
Created February 15, 2022 20:31
Creates a txt file with given name and content (text) on the desktop.
param(
[string]$name,
[string]$text,
[switch]$h
)
if ($h) {
Write-Host "Usage:"
Write-Host " quicknote <NAME> <TEXT> ==> positional parameters"
Write-Host " or"
@MoudryDaniel
MoudryDaniel / touch.ps1
Created February 15, 2022 20:29
Creates a file with specified name and extension.
param(
[Parameter(Mandatory)]$filename
)
if ([string]::IsNullOrEmpty($filename)) {
Write-Error "No filename specified"
return
}
@MoudryDaniel
MoudryDaniel / obsidian.ps1
Last active February 14, 2022 18:01
Script for loading/saving Obsidian notes from/to a repository or simply opening Obsidian
[CmdletBinding(PositionalBinding=$false)]
param (
[switch]$load,
[switch]$save,
[switch]$h
)
if ($h) {
Write-Host "Usage:"
Write-Host " obsidian ==> opens Obsidian"
@MoudryDaniel
MoudryDaniel / vs.ps1
Last active February 14, 2022 15:31
Open first Visual Studio solution in a directory structure
# Prerequisites: PS-Menu module
function Install-Menu {
$choice = Read-Host "PS-Menu module is needed. Do you want to install it? [Y] Yes, [N] No"
$choice = $choice.ToLower()
if ($choice -eq "y" -or $choice -eq "yes") {
Install-Module -Name PS-Menu
Write-Host "Instalation completed successfully."
}
elseif ($choice -eq "n" -or $choice -eq "no") {
@MoudryDaniel
MoudryDaniel / goto.ps1
Last active November 25, 2021 16:15
Script for changing directory to predetermined directories
param (
[string]$path,
[switch]$h
)
if ($h) {
Write-Host "Options:"
Write-Host " + proj (Projects)"
Write-Host " + dwn (Downloads)"
Write-Host " + scr (Scripts)"
@MoudryDaniel
MoudryDaniel / Microsoft.PowerShell_profile.ps1
Created November 24, 2021 17:59
Powershell profile with custom prompt
# Terminal Icons (Nerd Font needed for this to work)
Import-Module -Name Terminal-Icons
# PSReadline
Import-Module -Name PSReadline
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
# Custom Prompt