Skip to content

Instantly share code, notes, and snippets.

@b14ck0ps
Last active February 1, 2023 17:41
Show Gist options
  • Save b14ck0ps/c2ec43b0075069b73e14c2cbde900d14 to your computer and use it in GitHub Desktop.
Save b14ck0ps/c2ec43b0075069b73e14c2cbde900d14 to your computer and use it in GitHub Desktop.
Power shell profile.. Location " C:\Users\Azran\Documents\PowerShell "
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost') {
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
# Import-Module oh-my-posh
# set-alias desktop "Desktop.ps1"
#Set-Theme ParadoxGlucose
#Set-PoshPrompt -theme "D:\Dropbox\poshv3.json"
# Set-PoshPrompt craver
# Set-PoshPrompt avit
# oh-my-posh --init --shell pwsh --config C:\Users\Azran\Dropbox\poshtheme\10k.json | Invoke-Expression
Invoke-Expression (&starship init powershell)
#--------------------------------> Auto complete <--------------------------------
Set-PSReadLineOption -PredictionSource History
# Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
# This is an example of a macro that you might use to execute a command.
# This will add the command to history.
Set-PSReadLineKeyHandler -Key Ctrl+Shift+b `
-BriefDescription BuildCurrentDirectory `
-LongDescription "Build the current directory" `
-ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("dotnet build")
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
}
Set-PSReadLineKeyHandler -Key Ctrl+Shift+t `
-BriefDescription BuildCurrentDirectory `
-LongDescription "Build the current directory" `
-ScriptBlock {
[Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
[Microsoft.PowerShell.PSConsoleReadLine]::Insert("dotnet test")
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
}
function touch {
Param(
[Parameter(Mandatory = $true)]
[string]$Path
)
if (Test-Path -LiteralPath $Path) {
(Get-Item -Path $Path).LastWriteTime = Get-Date
}
else {
New-Item -Type File -Path $Path
}
}
# set local to dev folser
function dev {
Set-Location 'D:\dev\'
}
# valorant server ping
# function valorant {
# echo 'Valorant Singapore Server Ping'
# echo 'Server 1 ->' ;
# ping 13.248.193.101 |Select-String -Pattern 'Lost' -CaseSensitive -SimpleMatch;
# echo 'Server 2 ->' ;
# ping 75.2.69.178|Select-String -Pattern 'Lost' -CaseSensitive -SimpleMatch;
# echo 'Server 3 ->' ;
# ping 76.223.1.250|Select-String -Pattern 'Lost' -CaseSensitive -SimpleMatch;
# echo 'Server 4 ->' ;
# ping 99.83.157.116|Select-String -Pattern 'Lost' -CaseSensitive -SimpleMatch;
# }
# valorant server ping
function valorant {
echo 'Valorant Singapore Server Ping'
echo '<--------------------------------------- Server 1 --------------------------------------->' ;
ping 13.248.193.101;
echo '<--------------------------------------- Server 2 --------------------------------------->' ;
ping 75.2.69.178;
echo '<--------------------------------------- Server 3 --------------------------------------->' ;
ping 76.223.1.250;
echo '<--------------------------------------- Server 4 --------------------------------------->' ;
ping 99.83.157.116;
}
# for git clone
function gic {
param(
[parameter(Mandatory = $true)]
[Alias("Server")]
[string]$link
)
git clone $link
}
# php artisan
function art {
param(
[parameter(Mandatory = $true)]
[Alias("Server")]
[string]$pram
)
php artisan $pram
}
# alias
New-Alias -name love -value wsl
New-Alias -name np -value notepad++
# Import the Chocolatey Profile that contains the necessary code to enable
# tab-completions to function for `choco`.
# Be aware that if you are missing these lines from your profile, tab completion
# for `choco` will not function.
# See https://ch0.co/tab-completion for details.
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
#emu8086 auto file open like code .
function asm (
[parameter(Mandatory = $false)]
[string]$file
){
$root = pwd
$fullPath = Join-Path $root $file
emu8086 $fullPath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment