forked from akhilnarang/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartupstuff.sh
More file actions
executable file
·164 lines (142 loc) · 4.27 KB
/
startupstuff.sh
File metadata and controls
executable file
·164 lines (142 loc) · 4.27 KB
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
#!/usr/bin/env bash
if [[ "$(command -v hub)" ]]; then
alias git='hub';
fi
# Some git aliases
alias gs='git status';
alias gpul='git pull';
alias gf='git fetch';
alias grem='git remote';
alias gremv='git remote -v';
alias gpu='git push';
alias gpf='gpu -f'
alias gpfu='gpu -fu';
alias grev='git revert';
alias gcp='git cherry-pick';
alias gcpc='gcp --continue';
alias gcpa='gcp --abort';
alias gr='git reset';
alias grh='gr --hard';
alias grs='gr --soft';
alias grb='git rebase';
alias grbi='grb --interactive';
alias grbc='grb --continue';
alias grbs='grb --skip';
alias grba='grb --abort';
alias gb='git bisect';
alias gd='git diff';
alias gc='git commit';
# SSH aliases
alias rr='ssh akhil@rr.akhilnarang.me';
alias aosip='ssh akhil@aosiprom.com';
alias kronic='ssh kronic@aosiprom.com';
alias jenkins='ssh root@jenkins.akhilnarang.me';
alias setperf='echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor';
alias setsave='echo "powersave" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor';
alias path='echo ${PATH}';
# https://github.com/AdrianDC/android_development_shell_tools
# Has some useful stuff :)
ADCSCRIPT="${HOME}/android_development_shell_tools";
if [[ -f "${ADCSCRIPT}/android_development_shell_tools.rc" ]]; then
source "${ADCSCRIPT}/android_development_shell_tools.rc";
fi
if [[ -z "${BASEDIR}" ]]; then
BASEDIR="${HOME}";
fi
# Kernel Directory
export KERNELDIR="${BASEDIR}/kernel";
# Use ccache
export USE_CCACHE=1;
export CCACHE_ROOT="${BASEDIR}";
export CCACHE_DIR="${BASEDIR}/.ccache";
# Extend the default PATH a bit
export PATH=${BASEDIR}/bin:${BASEDIR}/android-studio/bin:${BASEDIR}/pidcat:${BASEDIR}/caddy:${BASEDIR}/Android/Sdk/platform-tools:${BASEDIR}/adb-sync:$PATH;
# Set a custom path for the Android SDK
export ANDROID_HOME=${BASEDIR}/Android/Sdk;
# Set default editor to nano
export EDITOR="nano";
# Set timezone
export TZ="Asia/Kolkata";
# Colors
black='\e[0;30m';
blue='\e[0;34m';
green='\e[0;32m';
cyan='\e[0;36m';
red='\e[0;31m';
purple='\e[0;35m';
brown='\e[0;33m';
lightgray='\e[0;37m';
darkgray='\e[1;30m';
lightblue='\e[1;34m';
lightgreen='\e[1;32m';
lightcyan='\e[1;36m';
lightred='\e[1;31m';
lightpurple='\e[1;35m';
yellow='\e[1;33m';
white='\e[1;37m';
nc='\e[0m';
function run_virtualenv()
{
PYV=$(python -c "import sys;t='{v[0]}'.format(v=list(sys.version_info[:1]));sys.stdout.write(t)");
if [[ "${PYV}" == "3" ]]; then
if [[ "$(command -v 'virtualenv2')" ]]; then
if [[ ! -d "${BASEDIR}/virtualenv" ]]; then
virtualenv2 "${BASEDIR}/virtualenv";
fi
source "${BASEDIR}/virtualenv/bin/activate";
else
echo "Please install 'virtualenv2', or make 'python' point to python2";
fi
fi
$@;
if [[ -d "${BASEDIR}/virtualenv" ]]; then
echo -e "virtualenv detected, deactivating!";
deactivate;
fi
}
function syncc()
{
time run_virtualenv repo sync --force-broken --force-sync --detach --no-clone-bundle --quiet --current-branch --no-tags $@;
}
function transfer()
{
zipname="$(echo $1 | awk -F '/' '{print $NF}')";
url="$(curl -# -T $1 https://transfer.sh)";
printf '\n';
echo -e "Download $zipname at $url";
}
function haste()
{
a=$(cat);
curl -X POST -s -d "$a" http://haste.akhilnarang.me/documents | awk -F '"' '{print "http://haste.akhilnarang.me/"$4}';
}
function upinfo() #Not sure where this one is kanged from lol
{
echo -ne "${green}$(hostname) ${red}uptime is ${cyan} \t ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10,$11}';
}
function onLogin()
{
export GIT_PS1_SHOWDIRTYSTATE=1;
export GIT_PS1_SHOWSTASHSTATE=1;
export GIT_PS1_SHOWUNTRACKEDFILES=1;
export GIT_PS1_SHOWUPSTREAM=auto;
export GIT_PS1_SHOWCOLORHINTS=1;
unset PS1;
#PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ';
if [[ -f "${HOME}/git-prompt.sh" ]]; then
source ~/git-prompt.sh
PS1='| \h (\w)$(__git_ps1 " {%s}") |-> ';
else
PS1='| \h (\w) |-> ';
fi
clear;
echo -e "${LIGHTGRAY}";figlet -c "$(hostname)";
echo ""
echo -ne "${red}Today is:\t\t${cyan}" `date`; echo ""
echo -e "${red}Kernel Information: \t${cyan}" `uname -smr`
echo -ne "${cyan}";
upinfo;
echo "";
echo -e "Welcome to $(hostname), $(whoami)!\n";
fortune;
}