-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bash_aliases
79 lines (75 loc) · 2.79 KB
/
.bash_aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
alias ls='ls -FN --color=auto'
alias pgrep='pgrep -af'
alias git=hub
alias testing-repo-list='pacman --color=always -Sl {,community-}testing|grep -F "[installed]"'
alias git-pr-setup="git config --local --add remote.origin.fetch '+refs/pull/*/head:refs/pull/*'"
# Check for updates to git packages
alias gitpkgs-refresh='(cd ~/git/pkgbuilds; for i in *-git/; do if [[ $i =~ (calibre|qbittorrent)-.* ]]; then true; else (cd $i && makepkg); fi; done)'
alias gitpkgs-refresh-aur='(cd /var/aur/; for i in *-git/; do if [[ $i =~ (excludes)-.* ]]; then true; else (cd $i && makepkg); fi; done)'
# info sucks, use less instead
info() {
command info "$@" | less
}
# Make diff like git-diff
alias diff='git diff --no-index'
# Super-simple AUR wrapper
aurgen() {
git clone aur:${1}
}
# View raw asp(1) package contents with pure git
alias wasp='git -C "${ASPROOT:-/var/cache/asp}"'
# Test local dev changes
makepkg-wrapper() {
if alias makepkg > /dev/null 2>&1; then
unalias makepkg
else
alias makepkg=~/git/archlinux/pacman/scripts/makepkg-wrapper
fi
}
# Erroring on stupid errors is stupid. Also make FS#xxxxx work with Arch bugs.
html2text()
{
local args=("$@")
args=("${args[@]/FS\#/https://bugs.archlinux.org/task/}")
/usr/bin/html2text --decode-errors=ignore "${args[@]}"
}
# Simple command-line remote image viewer
xloadimage()
{
local file
if [[ -f "$1" ]]; then
file="$1"
else
file="/tmp/${1##*/}"
wget -O "$file" "$1"
fi
/usr/bin/xloadimage "$file"
}
# Python virtualenv wrapper as a subshell
vactivate() {
local path=~/.venv/$1
if [[ ! -d $path ]]; then
python -m venv "$path" --prompt "venv: $1"
fi
source "$path"/bin/activate; bash; deactivate
}
# alyptik function to ptpb with original command prepended
# See http://pb.gehidore.net/B0AG/sh
cptpb ()
{
local pchar;
[[ "$EUID" -eq 0 ]] && pchar='# ' || pchar='$ ';
if [[ -n "$ZSH_NAME" ]]; then
cat <(printf "%s\n" "${pchar}${history[$HISTCMD]}" | sed "s/ *| *cptpb.*//") - <(echo) | tee /dev/stderr | curl -F"c=@-" https://pb.gehidore.net 2> /dev/null | tee >(awk '/https/ {sub("url: ",""); print}' | awk 'NR>1{print PREV} {PREV=$0} END{printf("%s",$0)}' | xsel -ib);
else
if [[ -n "$BASH" ]]; then
cat <(printf "%s\n" "${pchar}$(history 1 | sed "s/^ *[0-9]* *\(.*[^ ]\) *| *cptpb.*/\1/")") - <(echo) | tee /dev/stderr | curl -F"c=@-" https://pb.gehidore.net 2> /dev/null | tee >(awk '/https/ {sub("url: ",""); print}' | awk 'NR>1{print PREV} {PREV=$0} END{printf("%s",$0)}' | xsel -ib);
else
printf "$(tput setaf 9)$(tput bold)%s$(tput sgr0)\n" 'Error: bash/zsh not found!';
return 1;
fi;
fi
}
aurdupes() {
comm -12 <(pacman -Sql core extra community multilib| sort) <(aurgrep '' | sort )
}