Created
November 5, 2020 20:00
-
-
Save LittleKross/100526026159e38bf0a0a56a91f7cb03 to your computer and use it in GitHub Desktop.
My PowerShell Core profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Imports | |
Import-Module posh-git | |
Import-Module oh-my-posh | |
#PowerLine Theme | |
Set-Theme Paradox | |
#Aliases | |
Set-Alias code code-insiders | |
Set-Alias vi vim | |
Set-Alias touch New-Item | |
#Variables | |
$vimrc = '~/.vimrc' | |
#Functions | |
Function prj() { | |
Param( | |
[Parameter(Mandatory=$true,Position=0)] | |
[string]$command, | |
[Parameter(Mandatory=$true,Position=1,ParameterSetName='new')] | |
[string]$projectName, | |
[Parameter(ParameterSetName='new')] | |
[string]$path, | |
[Parameter(ParameterSetName='new')] | |
[switch]$private | |
) | |
if($command -eq "generate"){ | |
Write-Host 'Creating' $projectName '...' -ForegroundColor green | |
if($path -ne ('')){ | |
Write-Host $path | |
Set-Location $path | |
} | |
else{ | |
Set-Location '~/Sync/Git' | |
} | |
if($private){ | |
gh repo create $projectName -y --private | |
} | |
else{ | |
gh repo create $projectName -y --public | |
} | |
Set-Location $projectName | |
New-Item README.md | |
git add . | |
git commit -m "initial commit" | |
git push --set-upstream origin master | |
} | |
else{get-command prj -get-syntax} | |
} | |
Function email() { | |
Param( | |
[Parameter(Mandatory=$true,Position=0)] | |
[string]$From, | |
[Parameter(Position=1)] | |
[string]$To, | |
[Parameter(Position=2)] | |
[string]$Header, | |
[Parameter(Position=3)] | |
[switch]$Body | |
) | |
$c = Get-Credential -UserName $account | |
Write-Host $c.GetNetworkCredential().Password | |
$SMTPClient = New-Object Net.Mail.SmtpClient('smtp.gmail.com',465) | |
$SMTPClient.EnableSsl = $true | |
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($account,$c.GetNetworkCredential().Password); | |
$SMTPClient.Send($account,'littlekross47@gmail.com','test','test') | |
} | |
#For PowerShell v3 | |
Function gig { | |
param( | |
[Parameter(Mandatory=$true)] | |
[string[]]$list | |
) | |
$params = ($list | ForEach-Object { [uri]::EscapeDataString($_) }) -join "," | |
Invoke-WebRequest -Uri "https://www.toptal.com/developers/gitignore/api/$params" | select -ExpandProperty content | Out-File -FilePath $(Join-Path -path $pwd -ChildPath ".gitignore") -Encoding ascii | |
} | |
#End | |
Clear-Host | |
#If (Test-Path "C:\Program Files\openssh-win64\Set-SSHDefaultShell.ps1") * | |
#* {& "C:\Program Files\openssh-win64\Set-SSHDefaultShell.ps1" [PARAMETERS]} * | |
#* Learn more with this: * | |
#* Get-Help "C:\Program Files\openssh-win64\Set-SSHDefaultShell.ps1" * | |
#* Or here: * | |
#* https://github.com/DarwinJS/ChocoPackages/blob/master/openssh/readme.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment