Merge branch 'master' of github.com:vishap/scripts

This commit is contained in:
2020-12-28 01:51:59 +04:00
3 changed files with 117 additions and 74 deletions

View File

@@ -121,8 +121,8 @@ if [ -n "$PS1" ]; then
c_cwd="$(tput setaf 99)" c_cwd="$(tput setaf 99)"
c_time="$(tput setaf 33)" #Light blue c_time="$(tput setaf 33)" #Light blue
c_branch="$(tput setaf 138)" c_branch="$(tput setaf 138)"
c_exit="$(tput setaf 203)" #Red c_error="$(tput setaf 203)" #Red
c_jobs="$(tput setaf 220)" #Yellow c_info="$(tput setaf 220)" #Yellow
else else
c_reset="$(tput sgr0)" c_reset="$(tput sgr0)"
c_user="$(tput setaf 1)" # c_user="$(tput setaf 1)" #
@@ -130,8 +130,8 @@ if [ -n "$PS1" ]; then
c_cwd="$(tput setaf 7)" #White c_cwd="$(tput setaf 7)" #White
c_time="$(tput setaf 6)" #Cyan c_time="$(tput setaf 6)" #Cyan
c_branch="$(tput setaf 6)" #Cyan c_branch="$(tput setaf 6)" #Cyan
c_exit="$(tput setaf 1)" #Red c_error="$(tput setaf 1)" #Red
c_jobs="$(tput setaf 3)" #Yellow c_info="$(tput setaf 3)" #Yellow
fi fi
[ -n "$(which svn)" ] && prompt_check_svn=true [ -n "$(which svn)" ] && prompt_check_svn=true
@@ -177,21 +177,29 @@ if [ -n "$PS1" ]; then
# exit code if not zero # exit code if not zero
# #
if [ "$exit_code" -ne "0" ]; then if [ "$exit_code" -ne "0" ]; then
PS1+=",\[$c_exit\]rc=$exit_code" PS1+=",\[$c_error\]rc=$exit_code"
fi
#
# Python venv.
#
local jobs_bg=$(jobs -r | wc -l | tr -d ' ')
if [ -n "$VIRTUAL_ENV" ]; then
# PS1+=",\[$c_info\]$(realpath --relative-to=$PWD $VIRTUAL_ENV)"
PS1+=",\[$c_info\]$(basename $VIRTUAL_ENV)"
fi fi
# #
# Info about jobs. # Info about jobs.
# #
local jobs_bg=$(jobs -r | wc -l | tr -d ' ') local jobs_bg=$(jobs -r | wc -l | tr -d ' ')
if [ $jobs_bg -gt 0 ]; then if [ $jobs_bg -gt 0 ]; then
PS1+=",\[$c_jobs\]bg=$jobs_bg" PS1+=",\[$c_info\]bg=$jobs_bg"
fi fi
# #
# Info about jobs. # Info about jobs.
# #
local jobs_stopped=$(jobs -s | wc -l | tr -d ' ') local jobs_stopped=$(jobs -s | wc -l | tr -d ' ')
if [ $jobs_stopped -gt 0 ]; then if [ $jobs_stopped -gt 0 ]; then
PS1+=",\[$c_jobs\]stp=$jobs_stopped" PS1+=",\[$c_info\]stp=$jobs_stopped"
fi fi

View File

@@ -17,7 +17,7 @@ export DEV_CPPINC=-I.
export DEV_FINC=-I. export DEV_FINC=-I.
#I need this to run distributor locally. #I need this to run distributor locally.
export PGPASSFILE=$HOME/.fit_pgpass export PGPASSFILE=$HOME/.pgpass
export PGSERVICEFILE=$HOME/.fit_pg_service.conf export PGSERVICEFILE=$HOME/.fit_pg_service.conf
export SRC_DIR=$HOME/devel/src export SRC_DIR=$HOME/devel/src
@@ -25,6 +25,7 @@ export BOOST_DIR=$SRC_DIR/boost
#export TBB_DIR=$SRC_DIR/tbb #export TBB_DIR=$SRC_DIR/tbb
#export TBB_LIB=$TBB_DIR/build/linux_intel64_gcc_cc4.8.2_libc2.12_kernel2.6.32_release/ #export TBB_LIB=$TBB_DIR/build/linux_intel64_gcc_cc4.8.2_libc2.12_kernel2.6.32_release/
#export TBB_LIB_DEBUG=$TBB_DIR/build/linux_intel64_gcc_cc4.8.2_libc2.12_kernel2.6.32_debug/ #export TBB_LIB_DEBUG=$TBB_DIR/build/linux_intel64_gcc_cc4.8.2_libc2.12_kernel2.6.32_debug/
export PIP_INDEX_URL=https://artprod.dev.bloomberg.com/artifactory/api/pypi/bloomberg-pypi/simple
alias bb='cd $HOME/devel/bb >/dev/null' alias bb='cd $HOME/devel/bb >/dev/null'
#complete -f -X '!*.mk' plink #complete -f -X '!*.mk' plink
@@ -48,7 +49,7 @@ if [[ "$os" == "GNU/Linux" ]]; then
else else
BBBITS=32 BBBITS=32
fi fi
export BBTAG=$(/opt/bb/bin/robolibs-current-build --tag local --bits $BBBITS) export BBTAG=$(/opt/bb/bin/robolibs-current-build --tag trunk --bits $BBBITS)
getop() { # BOX getop() { # BOX
if [[ $# -ne 1 ]]; then if [[ $# -ne 1 ]]; then
@@ -73,73 +74,14 @@ run() {
fi fi
} }
sun() { # CMD use-blot-meta(){
if [[ $# -ne 1 ]]; then export DPKG_ARCH=$(/opt/bb/bin/dpkg-architecture -qDEB_BUILD_ARCH)
echo "Usage: sun <command>" export DPKG_DISTRO_DIR=$HOME/bb/blot-meta/cmake-distro-dev/${DPKG_ARCH}
else
run njtsdev3 $@
fi
} }
ibm() { # CMD use-local-distro(){
if [[ $# -ne 1 ]]; then unset DPKG_ARCH
echo "Usage: ibm <command>" unset DPKG_DISTRO_DIR
else
run ibm3 $@
fi
}
git-repo-setup(){
if [[ $# -ne 0 ]]; then
echo "Usage: just run inside a bbgithub repo."
return
fi
st=$(git status)
if [[ $? -ne 0 ]]; then
echo "Looks this is not a git repo."
return
fi
us=$(git remote get-url upstream 2> /dev/null)
if [[ $? -eq 0 ]]; then
echo "Upstream already exist as $us."
return
fi
url=$(git remote get-url origin)
if [[ $? -ne 0 ]]; then
echo "Origin URL is unknown."
return
fi
re="^(.*)[/:]([^/:]*)/(.*)$"
if [[ $url =~ $re ]]; then
prefix=${BASH_REMATCH[1]}
org=${BASH_REMATCH[2]}
repo=${BASH_REMATCH[3]}
else
echo "Failed to pars the repo URL."
return
fi
upstream_repo=bbgithub:$org/$repo
origin_repo=bbgithub:vkhachatrya5/$repo
git remote rm origin
echo "Setting origin=$origin_repo"
git remote add origin $origin_repo
echo "Setting upstream=$upstream_repo"
git remote add upstream $upstream_repo
git remote -v
}
git-master-refresh(){
git fetch upstream master
git co upstream/master
git br -D master
git co -b master
} }
# #

View File

@@ -0,0 +1,93 @@
#!/bin/bash
#wget
#export http_proxy=devproxy.bloomberg.com:82
#export https_proxy=devproxy.bloomberg.com:82
export DOCKER_HOST=tcp://0.0.0.0:2375
if [[ "$(hostname)" == "lnxmqts01" ]]; then
export SKELETON_DEPLOY=$HOME/devel/bb/skeleton_internals
fi
#export DEV_CINC=-I.
#export DEV_CPPINC=-I.
#export DEV_FINC=-I.
#I need this to run distributor locally.
#export PGPASSFILE=$HOME/.fit_pgpass
#export PGSERVICEFILE=$HOME/.fit_pg_service.conf
export IS_64BIT=yes
BBBITS=64
#PATH=/bb/build/Linux-x86_64-64/release/robolibs/stage/opt/bb/libexec/build-base/:$PATH
#export BBTAG=$(/opt/bb/bin/robolibs-current-build --tag local --bits $BBBITS) #Doesn't work on bbvpn
export ARCHCODE=amd64
export DPKG_DISTRO=unstable
export DPKG_DISTRO_DIR=$HOME/cmake-distro-dev
#export DPKG_SNAPSHOT=$(/opt/bb/bin/dpkg-distro-current-snapshot $DPKG_DISTRO) #This is slow.
export PATH=/opt/bb/bin:$PATH
getop() { # BOX
if [[ $# -ne 1 ]]; then
echo "Usage: getop <machine>"
else
local BOX="$1"
local BIN="/bb/bin/getprdwin"
$BIN -u op1 -i -s $BOX -d "op1 for $USER on $BOX"
fi
}
git-repo-setup(){
if [[ $# -ne 0 ]]; then
echo "Usage: just run inside a bbgithub repo."
return
fi
st=$(git status)
if [[ $? -ne 0 ]]; then
echo "Looks this is not a git repo."
return
fi
us=$(git remote get-url upstream 2> /dev/null)
if [[ $? -eq 0 ]]; then
echo "Upstream already exist as $us."
return
fi
url=$(git remote get-url origin)
if [[ $? -ne 0 ]]; then
echo "Origin URL is unknown."
return
fi
re="^(.*)[/:]([^/:]*)/(.*)$"
if [[ $url =~ $re ]]; then
prefix=${BASH_REMATCH[1]}
org=${BASH_REMATCH[2]}
repo=${BASH_REMATCH[3]}
else
echo "Failed to pars the repo URL."
return
fi
upstream_repo=bbgithub:$org/$repo
origin_repo=bbgithub:vkhachatrya5/$repo
git remote rm origin
echo "Setting origin=$origin_repo"
git remote add origin $origin_repo
echo "Setting upstream=$upstream_repo"
git remote add upstream $upstream_repo
git remote -v
}
git-master-refresh(){
git fetch upstream master
git co upstream/master
git br -D master
git co -b master
}