Skip to content

Instantly share code, notes, and snippets.

@aquacash5
Last active August 19, 2024 10:51
Show Gist options
  • Save aquacash5/582bb0869e029f3ab6a972982c260f9a to your computer and use it in GitHub Desktop.
Save aquacash5/582bb0869e029f3ab6a972982c260f9a to your computer and use it in GitHub Desktop.
Shell defaults and aliases
# Bash aliases for Linux
alias prp='pipenv run python'
alias ytdl='youtube-dl'
alias ytmp3='youtube-dl --extract-audio --audio-format mp3 --output "%(title)s.%(ext)s"'
alias ..='cd ..'
# Profile addition for WSL
# Create Symlink between Windows home directory and Linux home directory
ln -s /mnt/c/Users/kbloom ~/win
alias ll="ls -laG"
git-branch-cleanup() {
git branch | awk '{$1=$1};1' | grep -v '^\*\|main|master\|dev' | xargs git branch -D
}
# Powershell Profile
######################
# Location: $PROFILE.CurrentUserAllHosts
# Permission: Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
# Aliases
Set-Alias touch Touch-File
Set-Alias ytdl youtube-dl
Set-Alias zip Compress-Archive
Set-Alias unzip Expand-Archive
# Alias Fuctions
Function ll { Get-ChildItem -Force }
Function which($name) { Get-Command $name | Select-Object -ExpandProperty Definition }
Function prp { pipenv run python $args }
Function .. { cd .. }
Function em { elm-make $args }
Function ytmp3 { youtube-dl --extract-audio --audio-format mp3 --output "%(title)s.%(ext)s" $args }
Function git-branch-cleanup { git branch | %{ $_.Trim() } | ?{ $_ -notmatch '(^\*|main|master|dev)' } | %{ git branch -D $_ } }
# Functions
Function Touch-File
{
$file = $args[0]
if($file -eq $null) {
throw "No filename supplied"
}
if(Test-Path $file) {
(Get-ChildItem $file).LastWriteTime = Get-Date
} else {
New-Item -ItemType File -Force -Path $file
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment