moved language stuff and docker stuff to host/all

trantor
David Kebler 2020-11-20 15:48:57 -08:00
parent cb952b26b2
commit 693983249a
9 changed files with 201 additions and 0 deletions

54
all/lang/node Normal file
View File

@ -0,0 +1,54 @@
#!/bin/bash
if command -v node >/dev/null 2>&1; then
# echo addding node langauge stuff
# gives access to packages with bin in a project
path_append ./node_modules/.bin
path_append /opt/node-global-apps/bin
export NPM_REGISTRY=https://npm.kebler.net
alias nr="npm run"
alias nrs="npm -s run"
alias nt="npm -s test"
alias ntw="npm -s run testw"
alias npms="npm start"
alias npmlag="npm la --silent --depth=0 --global"
alias npmla="npm la --silent --depth=0"
alias npmlaf="npm la --silent | grep"
alias npmlsg="npm ls --silent --depth=0 --global"
alias npmlsf="npm ls --silent grep"
alias npmlsa="npm ls --silent"
alias npmls="npm ls --silent --depth=0"
# just npm install for install without saving into package.json
alias npmi="npm install --save"
alias npmr="npm uninstall --save"
alias npmio="npm install --save-optional"
alias npmro="npm uninstall --save-optional"
alias npmidv="npm install --save-dev"
alias npmidvnd="npm install --save-dev --package-lock-only --no-package-lock"
alias npmrdv="npm uninstall --save-dev"
alias npmig="npm install -g"
alias snpmig="sudo npm install -g"
alias npmrg="npm uninstall -g"
alias snpmrg="npm uninstall -g"
alias npmunpm="echo npm installed version && npm --version && echo npm latest version available && npm view npm@latest version && echo any key to continue npm upgrade or break && read && npm install -g npm@latest"
alias npmua="npm --depth=9999 update"
alias npmug="npm-check -g -u"
alias npmu="npm-check -u"
alias npmcc="ncu -p -a -u"
alias npmcdvc="ncu -d -a -u"
alias npmc="ncu -p"
alias npma="npm-add-dependencies"
# will publish to whichever is the default registry - confusing so commented out
# alias npmpub="npm publish --access public"
alias npmlrepub="npm publish --registry http://localhost:4873 --force --access restricted"
alias npmlpub="npm publish --registry http://localhost:4873 --access restricted"
alias npmnrepub="npm publish --registry https://npm.kebler.net --force --access restricted"
alias npmnpub="npm publish --registry https://npm.kebler.net --access restricted"
alias npmjspub="npm publish --registry https://registry.npmjs.org --access public"
alias yalcpush="nodemon -x 'yalc push'"
# else
# echo "node not installed, npm aliases not loaded"
fi

9
all/lang/pm2 Normal file
View File

@ -0,0 +1,9 @@
alias pmi="sudo pm2 install"
alias pms="sudo pm2 start"
alias pmstp="sudo pm2 stop"
alias pmr="sudo pm2 delete"
alias pmra="sudo pm2 delete all"
alias pmstpa="sudo pm2 stop all"
alias pmv="sudo pm2 save"
alias pml="sudo pm2 list"
alias pmm="sudo pm2 monit"

12
all/lang/python Normal file
View File

@ -0,0 +1,12 @@
alias python3="python3.8"
alias spip="sudo -H python3.8 -m pip"
alias spipi="sudo -H python3.8 -m pip install"
alias spipiu="sudo -H python3.8 -m pip install -U"
alias spipl="sudo -H python3.8 -m pip list"
alias spiplo="sudo -H python3.8 -m pip list --outdated"
alias pipu="pipx upgrade"
alias pipua="pipx upgrade-all"
alias pipupip="pipx upgrade pipx"
alias pipi="pipx install"
alias pipl="pipx list"
alias piplv="pipx list --verbose"

19
all/lang/yarn Normal file
View File

@ -0,0 +1,19 @@
alias ycc="yarn cache clean"
alias yr="yarn run"
alias ys="yarn run start"
alias ya="yarn add"
# alias yu="yarn upgrade"
alias yrm="yarn remove"
alias yao="yarn add --optional"
alias yad="yarn add --dev"
alias yl="yarn list --depth=0"
alias ylp="yarn list --depth=0 --pattern"
alias yu="yarn upgrade-interactive"
alias ylg="yarn global list --depth=0"
alias ylgp="yarn global list --depth=0 --pattern"
alias yag="yarn global add"
alias yrg="yarn global remove"
alias yug="yarn global upgrade-interactive"
alias ypub="yarn publish --access public"

View File

@ -0,0 +1,2 @@
#!/bin/bash
export DOCKER_COMPOSE_ROOT=/opt/containers

View File

@ -0,0 +1,4 @@
#!/bin/bash
docker_terminal () {
docker exec -it $1 /bin/sh
}

View File

@ -0,0 +1,30 @@
#!/bin/bash
# only source if docker and docker_compose are installed
command -v docker >/dev/null 2>&1 || return
command -v docker-compose >/dev/null 2>&1 || return
function dkcmp () {
DIR=/opt/containers/$1
cd $DIR || return
case $2 in
start )
docker-compose up -d
;;
stop )
docker-compose down
;;
remove )
docker volume ls | grep $1
docker-compose rm -s -v
;;
restart )
docker-compose down
docker-compose up -d
;;
make )
docker-compose up -d --force-recreate
;;
esac
cd - >/dev/null 2>&1 || return
}

View File

@ -0,0 +1,31 @@
#!/bin/bash
command -v docker >/dev/null 2>&1 || return
#docker - add users to docker group to avoid needing sudo
# run a command on a container
# if [ $(which docker)]; then
alias dkcr="docker run"
# start a container
alias dkcs="docker start"
# restart all running containers
alias dkcrr="docker restart $(docker ps -q)"
# start all exited containers
alias dkcsu="docker start $(docker ps --filter "status=exited")"
# ls stopped, la all, l running
alias dkcls="docker ps --filter "status=exited""
alias dkcla="docker ps -a "
alias dkcl="docker ps "
alias dkil="docker images --digests=true"
alias dkir="docker rmi $(docker images -q)"
alias dks="sudo service docker"
alias dkcstpa="docker stop $(docker ps -a -q)"
# remove unrunning containers
alias dkcrm="docker rm $(docker ps -a -q)"
# stop and remove
alias dkcsrm="docker rm -f $(docker ps -a -q)"
# cleans out unused/dangling aufs volumes - run this occasionally
alias dkclean="docker volume ls -qf dangling=true | xargs -r docker volume rm"
alias dkde="gksudo gedit /etc/default/docker"
alias dkterm="docker_terminal"

40
all/modules/machine.sh Normal file
View File

@ -0,0 +1,40 @@
#!/bin/bash
function get_platform () {
local OS
local ARCH
local PLATFORM
OS="$(uname -s)"
ARCH="$(uname -m)"
case $OS in
"Linux")
case $ARCH in
"x86_64")
ARCH=amd64
;;
"aarch64")
ARCH=arm64
;;
"armv6")
ARCH=armv6l
;;
"armv8")
ARCH=arm64
;;
.*386.*)
ARCH=386
;;
esac
PLATFORM="linux-$ARCH"
;;
"Darwin")
PLATFORM="darwin-amd64"
;;
esac
echo $PLATFORM
}