-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
165 lines (137 loc) · 5.54 KB
/
.bashrc
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#
# ~/.bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
export EDITOR="$(command -v vim)"
export VISUAL="$EDITOR"
export SUDO_EDITOR="$EDITOR"
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# TMUX
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (tmux attach || tmux new-session -s bash)
fi
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
# Disable completion when the input buffer is empty. i.e. Hitting tab
# and waiting a long time for bash to expand all of $PATH.
shopt -s no_empty_cmd_completion
# Enable history appending instead of overwriting when exiting. #139609
shopt -s histappend
# Save each command to the history file as it's executed. #517342
# This does mean sessions get interleaved when reading later on, but this
# way the history is always up to date. History is not synced across live
# sessions though; that is what `history -n` does.
# Disabled by default due to concerns related to system recovery when $HOME
# is under duress, or lives somewhere flaky (like NFS). Constantly syncing
# the history will halt the shell prompt until it's finished.
#PROMPT_COMMAND='history -a'
PATH=$PATH:/home/ghost/scripts
source /usr/share/doc/pkgfile/command-not-found.bash
source /usr/share/bash-completion/bash_completion
# Get color support for 'less'
export LESS="--RAW-CONTROL-CHARS"
# Use colors for less, man, etc.
[[ -f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP
###########
# Functions
###########
aurremove() {
repo-remove /var/cache/pacman/myrepo/myrepo.db.tar "$@"
}
mm() {
mpv --no-video --ytdl-format=bestaudio ytdl://ytsearch:"$@"
}
# fh - repeat history
fh() {
eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
}
md() { pandoc "$1" | lynx -stdin; }
mdp() { pandoc -t plain "$1" | less; }
transfer() {
if [ $# -eq 0 ]; then
echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md";
return 1;
fi
tmpfile=$( mktemp -t transferXXX );
if tty -s; then
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ;
fi;
cat $tmpfile;
rm -f $tmpfile;
}
wp() {
if [ -f /home/ghost/Pictures/BingWallpapers/$(date +%Y%m%d).jpg ]; then
echo -e "Already got it Bro!";
else
bingme && ngme;
fi
}
#######
# Hints
#######
#foo 2>&1 | curl -F 'f:1=<-' ix.io #pastebin from commandline
#foo | curl -F c=@- https://ptpb.pw
#curl -F'[email protected]' https://0x0.st #upload image from commandline
#expac -S '%r/%n: %D' foo #find package dependencies
#mount -o remount,size=6G,noatime /tmp #resize tmp
#diff <(pactree -sd1 ffmpeg) <(pactree -d1 ffmpeg) #compare diff output of two commands
#for i in {1..13}; do history -d 4360; done #delete history starting a line 4360 and deleting 13 lines from that start
#zgrep CONFIG_KVM /proc/config.gz #search config current kernel CONFIG
#grep -a, --text Process a binary file as if it were text;
#########
# History
#########
HISTIGNOR="ls:exit:reset:clear:cd*:c:tmux:history*:man*:sudo pacman*:aur sync:sudo pacsync"
HISTCONTROL=ignoreboth:erasedups
# After each comman, save and reload history
#export PROMPT_COMMAND="history -a; history -c; history -r;$PROMPT_COMMAND"
#export PROMPT_COMMAND="history -n; history -w; history -c; history -r;$PROMPT_COMMAND"
# After each command, append to the history file and reread it
#export PROMPT_COMMAND=”${PROMPT_COMMAND:+$PROMPT_COMMAND;’\n’}history -a; history -c; history -r”
HISTSIZE=19000
HISTFILESIZE=20000
# include date and timestamp with history
HISTTIMEFORMAT='%F %T '
#########
# Aliases
#########
alias pacnew='find /etc -regextype posix-extended -regex ".+\.pac(new|save)" 2>/dev/null'
alias ip='ip --color'
alias p='pacman'
alias grep='grep --color=auto'
alias ls='ls --color=auto'
alias c=clear
alias wifiscan='sudo iw dev wifi0 scan | grep -e SSID -e signal:'
alias reauth='sudo systemctl reload-or-restart [email protected]'
alias reflectme="sudo reflector --country 'United States' --latest 1000 --protocol https -f 15 --save /etc/pacman.d/mirrorlist"
alias d="kitty +kitten diff"
alias st='st -f "FantasqueSansMono Nerd Font Mono:size=12" -g 140x40 -e tmux a'
alias wo='pacman -Qo "$1"'
#alias ptpb='curl -F c=@- https://ptpb.pw'
#alias wp='bingme && ngme'
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME --no-pager'
alias graph='git log --all --decorate --oneline --graph'
alias dotfilesgraph='dotfiles log --all --decorate --oneline --graph'
alias sprunge='curl -F '\''sprunge=<-'\'' http://sprunge.us'
alias 0x0='curl -F'file=@-' http://0x0.st'
PS1='[\u@\h \W]\$ '
export PYTHONPATH=/usr/lib/python3.7/site-packages/powerline/bindings/bash
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /usr/lib/python3.7/site-packages/powerline/bindings/bash/powerline.sh