mirror of
https://codeberg.org/vlw/dotfiles.git
synced 2025-09-13 19:03:40 +02:00
Compare commits
No commits in common. "2f189c3cc03d47d2c71cbc10b9e31d0564ebb779" and "7c9edd63347e104ac281b0ac5ea29e97f2200798" have entirely different histories.
2f189c3cc0
...
7c9edd6334
1 changed files with 20 additions and 64 deletions
|
@ -1,11 +1,7 @@
|
|||
# Change PHP CLI binary
|
||||
alias phpa="sudo update-alternatives --config php"
|
||||
# Kill all code-server processes. Sometimes it hangs on startup
|
||||
alias kvscode="ps uxa | grep .vscode-server | awk '{print $2}' | xargs kill -9"
|
||||
|
||||
# +-------------------+
|
||||
# | Directory & Files |
|
||||
# +-------------------+
|
||||
# Make dir and cd into it
|
||||
mkcdir () {
|
||||
mkdir -p -- "$1" && cd -P -- "$1"
|
||||
}
|
||||
|
||||
# Preview contents of a file or list the contents of a directory
|
||||
l () {
|
||||
|
@ -49,62 +45,22 @@ cdll () {
|
|||
cp -P -- "$1" && ll
|
||||
}
|
||||
|
||||
# Make a new directory and cd into it
|
||||
mkcdir () {
|
||||
mkdir -p -- "$1" && cd -P -- "$1"
|
||||
}
|
||||
# Create standard git WIP commit with timestamps
|
||||
alias gitw="git commit -m \"wip: $(date +%Y-%m-%dT%H:%M:%S%z) ($(date +%s))\""
|
||||
# Create a git WIP tag with the current timestamp. Prompt user for tag comment.
|
||||
alias gitt="git tag -a 'wip-$(date +%s)'"
|
||||
# Remove dropped upstream git branches from remote
|
||||
alias gitc="git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D"
|
||||
# Shorthand git pull origin
|
||||
alias gitp="git pull origin"
|
||||
# Shorthand git status"
|
||||
alias gits="git status"
|
||||
|
||||
# +-----+
|
||||
# | Git |
|
||||
# +-----+
|
||||
# Generate random 16byte HEX
|
||||
alias rng16="head -c 16 /dev/random | xxd -p"
|
||||
|
||||
# Short-hands for various git functions
|
||||
gitf () {
|
||||
case "$1" in
|
||||
# Stage all changes and fall through to WIP commit
|
||||
"aw")
|
||||
git add .
|
||||
gitf w
|
||||
;;
|
||||
# Kill VSCode processes
|
||||
alias killvscode="ps uxa | grep .vscode-server | awk '{print $2}' | xargs kill -9"
|
||||
|
||||
# Clear local branches that have no upstream on remote (cleanup)
|
||||
"c")
|
||||
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
|
||||
;;
|
||||
|
||||
# Pull current branch from a remote (defaults to "origin"). "d" for download.
|
||||
"d")
|
||||
local remote="${2:-origin}"
|
||||
|
||||
git pull "$remote" $(git rev-parse --abbrev-ref HEAD)
|
||||
;;
|
||||
|
||||
# Push commited changes (current branch) to a remote (defaults to "origin"). "u" for upload.
|
||||
"u")
|
||||
local remote="${2:-origin}"
|
||||
|
||||
git push --set-upstream "$remote" $(git rev-parse --abbrev-ref HEAD)
|
||||
;;
|
||||
|
||||
# Create a git "Work in Progress" commit with timestamps
|
||||
"w")
|
||||
git commit -m "wip: $(date +%Y-%m-%dT%H:%M:%S%z) ($(date +%s))"
|
||||
;;
|
||||
|
||||
*)
|
||||
git status
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# +-----+
|
||||
# | SSH |
|
||||
# +-----+
|
||||
|
||||
# SSH to machine in debug mode at local.vlw.se
|
||||
sshl () {
|
||||
# Set login name from first argument or default to current user
|
||||
local user="${1:-$(whoami)}"
|
||||
|
||||
ssh -p 2222 "$user"@local.vlw.se
|
||||
}
|
||||
# Change PHP CLI binary
|
||||
alias chphp="sudo update-alternatives --config php"
|
||||
|
|
Loading…
Add table
Reference in a new issue