summaryrefslogtreecommitdiffstats
path: root/root/.profile
blob: 9f756d3002d9ba498ea6937cc309df7835e62911 (plain) (blame)
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
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=100000000
HISTFILESIZE=1000000000
shopt -s checkwinsize
function upload () {
	chmod 0644 "$1"
	sftp -b- upload@upload <<< "put '$1' www/`[ '$2'x = x ] && echo $1 || echo $2`"
}
function mcd () {
	mkdir -p $@ && cd $@
}
function ocd () {
	cd $OLDPWD
}
function atoi () {
	# Returns the integer representation of an IP arg, passed in ascii dotted-decimal notation (x.x.x.x)
	IP=$1
	IPNUM=0
	for (( i=0 ; i<4 ; ++i )); do
		((IPNUM+=${IP%%.*}*$((256**$((3-${i}))))))
		IP=${IP#*.}
	done
	echo $IPNUM
}
function itoa () {
	# returns the dotted-decimal ascii form of an IP arg passed in integer format
	echo -n $(($(($(($((${1}/256))/256))/256))%256)).
	echo -n $(($(($((${1}/256))/256))%256)).
	echo -n $(($((${1}/256))%256)).
	echo $((${1}%256))
}
export QT_QPA_PLATFORMTHEME=qt5ct
alias gdb="gdb -q"
alias x11vnc="x11vnc -repeat -multiptr"
alias digs="dig +nocomments +noquestion +nostats +norrcomments +nocmd"
alias nc="nc -v"
alias m=make
alias torbrowser="while read a; do export $a; done < /etc/env.d/99torbrowser && torbrowser"
alias n="git --git-dir=$HOME/projects/n --work-tree=/"
case "$TERM" in
	xterm-color|*-256color) color_prompt=yes;;
esac
color_prompt=yes
if [ "$color_prompt" = yes ]; then
	PS1='\[\033[00;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[35m\][\[\033[33m\]$?\[\033[35m\]]\[\033[31m\]\$\[\033[00m\] '
else
	PS1='\h:\w[$?]\$ '
fi
unset color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
	xterm*|rxvt*)
		PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
		;;
	*)
		;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias l='ls -lah --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
[ -f ~/.bash_aliases ] && . ~/.bash_aliases
[ -f ~/.private_source ] && . ~/.private_source
: