summaryrefslogtreecommitdiffstats
path: root/root/.bash_aliases
blob: 5b74f6a3eee0035840c7f49d0e39382a63ad57de (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
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
function fancyindex_files () {
	for i in `curl -k $1 | grep link | grep -v '<td class="size">-</td>' | cut -d\" -f 4 `
	do
		echo $2$i
	done
}
function fancyindex_play () {
	mpv `fancyindex_files $1 $1/`
}
export CT_ALLOW_BUILD_AS_ROOT_SURE=1
function register () {
	n=`curl -s https://www.register.si | grep nonce | head -n 1 | cut -d\" -f8`
	curl -s https://www.register.si/wp-admin/admin-ajax.php -X POST --data-raw "_ajax_nonce=$n&action=get_whois_data&domain=`sed s/.si\$//g <<<$1`.si" | grep "<td>" | sed "s/^\s*//g" | cut -d\< -f2 | cut -d\> -f2 | grep "[[:print:]]"
}
function eurid () {
	domain=`sed 's/\.eu$//' <<<$1`
	json=`curl -s https://eurid.eu/en/das/?domain=$domain`
	status=`jq --raw-output .status <<<$json`
	if [ $status = NOT_AVAILABLE ]
	then
		return 0
	fi
	if [ $status = AVAILABLE ]
	then
		return 1
	fi
	echo $json
	return 2

}
alias r=R
alias R="R --quiet"
alias jupyter-server="jupyter-server --allow-root"
alias jupyter-notebook="jupyter-notebook --allow-root"
function kladivo () {
	iptables -A INPUT -s $1 -j DROP
}
function c () {
	fn=$@
	for arg in $@
	do
		grep ^- <<<$arg > /dev/null && fn=$arg
	done
	pedantic=-Wpedantic
	[ x$NO_PEDANTIC = x ] && pedantic=
	gcc -g -Wall -Wextra $pedantic -Wformat -Wformat-security -o`rev <<<$arg | cut -d. -f2- | rev` $@ -lm
}
alias pmbootstrap="pmbootstrap --as-root"
HISTCONTORL=ignoreboth
shopt -s histappend
HISTSIZE=100000000
HISTFILESIZE=1000000000
function upload () {
	# chmod 0644 "$1"
	d=`[ "$2"x = x ] && echo $1 || echo $2`
	sftp -b- upload@upload.sijanec.eu <<EOF
		progress
		put '$1' www/$d
EOF
	grep '/$' <<<$d && d=$d`rev <<<$1 | cut -d/ -f1 | rev`
	ssh upload@upload.sijanec.eu chmod 0644 "www/$d"
	echo https://upload.sijanec.eu./$d | xclip
}
function pfl () {
	curl -s https://portagefilelist.de/index.php?fs=$1 | grep -E "(<td>.*</td>)|package" | php -r "echo strip_tags(file_get_contents('php://stdin'));" | sed 's/^[	 ]*//g' | grep -v Packages | grep -v Search | grep -v Unique | grep / | tr $'\n' , | sed -e "s/\([^,]*\),\([^,]*\),/$(color green)\2$(color off)	\1,/g" | tr , $'\n' | grep `sed -e 's/\*//g' <<<$1`
}
function mcd () {
	mkdir -p $@ && cd $@
}
function ocd () {
	cd $OLDPWD
}
alias gdb="gdb -q"
alias x11vnc="x11vnc -repeat -multiptr"
alias digs="dig +nocomments +noquestion +nostats +norrcomments +nocmd"
alias nc="nc -v"
alias m=make
export EDITOR=/usr/bin/vim
ulimit -c unlimited # core dumps
alias pi="python3 -m pip install --user --break-system-packages"
alias pu="python3 -m pip uninstall --break-system-packages"
if [ `id -u` -eq 0 ]
then
	alias binwalk="binwalk --run-as=root"
fi
PATH=$PATH:~/.local/bin
function d () {
	w=`xwininfo | grep "Window id" | sed -e 's/.*"\(.*\)"/\1/'`
	r=`cut -d\  -f1 <<<$w | sed s/://`
	if [ `whoami`@`hostname` = $r ]
	then
		cd `cut -d\  -f2 <<<$w | sed s,~,$HOME,`
	else
		ssh -t $r "cd `cut -d\  -f2 <<<$w`; exec bash -i"
	fi
}
alias de='docker exec -it `docker ps | tail -n1 | cut -d\  -f1` /bin/bash'
[ -d ~/projects/r/skripti ] && PATH=$PATH:~/projects/r/skripti
export XMLLINT_INDENT=$'\t'
function j () {
	javac `sed 's/\.$/.java/' <<<$1` && java `sed -e s/.java// -e 's/\.$//' <<<$1`
}
alias gl="git log --graph"
export MPLBACKEND=gtk4agg
alias dc="rlwrap dc"
alias vscodium="vscodium --no-sandbox --user-data-dir .local/state/vscodium"
function changedetection_diff_html() {
	for i in `unzip -p $1 url-watches.json | jq --raw-output '.watching[] | (.url + "@" + .uuid)'`
	do
		url=`cut -d@ -f1 <<<$i`
		uuid=`cut -d@ -f2 <<<$i`
		echo "<li> <a href=http://b.šijanec.eu.:25788/diff/$uuid#text>$url</a>"
	done
}