Merge branch 'master' of github.com:vishap/scripts
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DATE=/bin/date
|
DATE=/bin/date
|
||||||
RSYNC=/usr/bin/rsync
|
RSYNC=/usr/bin/rsync
|
||||||
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
|
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
|
||||||
|
|
||||||
LOGFILE=/mnt/hdd/backup/backup.mybook.public.$TIMESTAMP.log
|
LOGFILE=/mnt/hdd/backup/log/backup.mybook.public.$TIMESTAMP.log
|
||||||
LOG="/usr/bin/tee -a $LOGFILE"
|
LOG="/usr/bin/tee -a $LOGFILE"
|
||||||
|
|
||||||
function term() {
|
function term() {
|
||||||
@@ -17,17 +17,16 @@ function backup() {
|
|||||||
ORIG_DIR=$1
|
ORIG_DIR=$1
|
||||||
MIRROR_DIR=$2
|
MIRROR_DIR=$2
|
||||||
echo "Sync $ORIG_DIR to $MIRROR_DIR"
|
echo "Sync $ORIG_DIR to $MIRROR_DIR"
|
||||||
$RSYNC -aAXv --delete --force --progress $ORIG_DIR $MIRROR_DIR | $LOG
|
$RSYNC -aXv --delete --force $ORIG_DIR $MIRROR_DIR | $LOG
|
||||||
}
|
}
|
||||||
|
|
||||||
function backuphdd() {
|
function backupwd() {
|
||||||
HDD_ORIG=/mnt/hdd
|
ORIG_DIR=$1
|
||||||
HDD_MIRROR=/mnt/hdd2
|
MIRROR_DIR=192.168.0.6:/DataVolume/$2
|
||||||
ORIG_DIR=$HDD_ORIG/$1
|
|
||||||
MIRROR_DIR=$HDD_MIRROR/$(dirname $1)
|
|
||||||
backup $ORIG_DIR $MIRROR_DIR
|
backup $ORIG_DIR $MIRROR_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Log Header
|
# Log Header
|
||||||
#
|
#
|
||||||
@@ -36,13 +35,17 @@ echo start `$DATE` | $LOG
|
|||||||
#
|
#
|
||||||
# Sync folders
|
# Sync folders
|
||||||
#
|
#
|
||||||
backuphdd "public/_captured_MY_VIDEO"
|
backupwd "/srv/gitlab/" "backup/gitlab"
|
||||||
backuphdd "public/pix"
|
backupwd "/srv/nextcloud/" "backup/nextcloud"
|
||||||
backuphdd "public/music"
|
backupwd "/mnt/hdd/public/_captured_MY_VIDEO/" "public/_captured_MY_VIDEO"
|
||||||
backuphdd "public/books"
|
backupwd "/mnt/hdd/public/pix/" "public/pix"
|
||||||
backuphdd "vahagn"
|
backupwd "/mnt/hdd/public/music/" "public/music"
|
||||||
|
backupwd "/mnt/hdd/public/books/" "public/books"
|
||||||
|
backupwd "/mnt/hdd/vahagn/" "backup/vahagn"
|
||||||
|
|
||||||
|
backup "/srv/gitlab" "/mnt/hdd/backup/gitlab"
|
||||||
|
backup "/srv/nextcloud" "/mnt/hdd/backup/nextcloud"
|
||||||
#
|
#
|
||||||
# Log Footer
|
# Log Footer
|
||||||
#
|
#
|
||||||
echo end `$DATE` | $LOG
|
echo end `$DATE` | $LOG
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,10 @@
|
|||||||
/usr/bin/rsync -av --inplace --append-verify -e "ssh -p 8080" /mnt/ssd/deluge/done lusntag.vostan.org:/mnt/home/vahagn/tmp/tmp
|
set -x
|
||||||
|
if [ ! -z "$*" ]; then
|
||||||
|
for i in "$@"; do
|
||||||
|
/usr/bin/rsync -av --inplace --progress --append-verify "/mnt/ssd/deluge/done/$i" "hrat:tmp/tmp/done/"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
/usr/bin/rsync -av --inplace --append-verify /mnt/ssd/deluge/done hrat:tmp/tmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,8 @@ if [ -n "$PS1" ]; then
|
|||||||
#
|
#
|
||||||
if [ $c_num -ge 256 ]; then
|
if [ $c_num -ge 256 ]; then
|
||||||
c_reset="$(tput sgr0)"
|
c_reset="$(tput sgr0)"
|
||||||
c_user="$(tput setaf 112)" #Green
|
c_user="$(tput setaf 203)" #Some bright color
|
||||||
|
c_host="$(tput setaf 112)" #Green
|
||||||
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)"
|
||||||
@@ -124,7 +125,8 @@ if [ -n "$PS1" ]; then
|
|||||||
c_jobs="$(tput setaf 220)" #Yellow
|
c_jobs="$(tput setaf 220)" #Yellow
|
||||||
else
|
else
|
||||||
c_reset="$(tput sgr0)"
|
c_reset="$(tput sgr0)"
|
||||||
c_user="$(tput setaf 2)" #Green
|
c_user="$(tput setaf 1)" #
|
||||||
|
c_host="$(tput setaf 2)" #Green
|
||||||
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
|
||||||
@@ -144,7 +146,12 @@ if [ -n "$PS1" ]; then
|
|||||||
#
|
#
|
||||||
local exit_code="$?"
|
local exit_code="$?"
|
||||||
prompt_extra=""
|
prompt_extra=""
|
||||||
PS1="\[$c_user\]\u@\h:" # username@host:
|
if [ "$USER" != "vkhachatrya5" -a "$USER" != "vahagn" ]; then
|
||||||
|
PS1="\[$c_user\]\u@" # username@
|
||||||
|
else
|
||||||
|
PS1=""
|
||||||
|
fi
|
||||||
|
PS1+="\[$c_host\]\h:" # hostname
|
||||||
PS1+="\[$c_time\]\t" # time
|
PS1+="\[$c_time\]\t" # time
|
||||||
PS1+=" \[$c_cwd\]\w" # working_dir
|
PS1+=" \[$c_cwd\]\w" # working_dir
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -13,7 +13,12 @@
|
|||||||
br = branch
|
br = branch
|
||||||
co = checkout
|
co = checkout
|
||||||
ci = commit
|
ci = commit
|
||||||
svnsync = "!f(){ git co master && git pull && ssh devgit svnsync $(git config --get remote.origin.url | cut -d : -f 2 );}; f"
|
upload = "!f(){ git push $@ origin $(git rev-parse --abbrev-ref HEAD); }; f"
|
||||||
|
faxm = "!f(){ git fetch upstream master && git checkout -b ENG1FAXM-$1 upstream/master; }; f"
|
||||||
|
drqs = "!f(){ git fetch upstream master && git checkout -b DRQS-$1 upstream/master; }; f"
|
||||||
|
install-hooks = "!f(){ GIT_HOOKS=\"$(git rev-parse --git-dir)/hooks/\"; GOLDEN_HOOKS=\"$HOME/devel/scripts/git/hooks\"; [ -d \"$GIT_HOOKS\" ] && [ -d \"$GOLDEN_HOOKS\" ] && cp -rf \"$GOLDEN_HOOKS/.\" \"$GIT_HOOKS\"; }; f"
|
||||||
|
refresh-master = "!f(){ git fetch upstream master; git checkout upstream/master; git branch -D master; git checkout -b master; }; f"
|
||||||
|
setup-upstream = "!source $HOME/devel/scripts/git/setup-upstream.sh"
|
||||||
[merge]
|
[merge]
|
||||||
tool = vimdiff
|
tool = vimdiff
|
||||||
conflictstyle = diff3
|
conflictstyle = diff3
|
||||||
|
|||||||
13
docker/nextcloud/docker-compose.yml
Normal file
13
docker/nextcloud/docker-compose.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
nextcloud:
|
||||||
|
image: nextcloud:18
|
||||||
|
ports:
|
||||||
|
- 8090:80
|
||||||
|
volumes:
|
||||||
|
- /srv/nextcloud:/var/www/html
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
nextcloud:
|
||||||
5
git/.aspell.en_US.per
Normal file
5
git/.aspell.en_US.per
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
personal_ws-1.1 en 0
|
||||||
|
FAXM
|
||||||
|
BLOT
|
||||||
|
Lakos
|
||||||
|
Vundle
|
||||||
44
git/hooks/commit-msg
Executable file
44
git/hooks/commit-msg
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to check the commit log message.
|
||||||
|
# Called by "git commit" with one argument, the name of the file
|
||||||
|
# that has the commit message. The hook should exit with non-zero
|
||||||
|
# status after issuing an appropriate message if it wants to stop the
|
||||||
|
# commit. The hook is allowed to edit the commit message file.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "commit-msg".
|
||||||
|
|
||||||
|
# Uncomment the below to add a Signed-off-by line to the message.
|
||||||
|
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
||||||
|
# hook is more suited to it.
|
||||||
|
#
|
||||||
|
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||||
|
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
||||||
|
|
||||||
|
# This example catches duplicate Signed-off-by lines.
|
||||||
|
|
||||||
|
#test "" = "$(grep '^Signed-off-by: ' "$1" |
|
||||||
|
# sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
||||||
|
# echo >&2 Duplicate Signed-off-by lines.
|
||||||
|
# exit 1
|
||||||
|
#}
|
||||||
|
|
||||||
|
#
|
||||||
|
# SPELL CHECK
|
||||||
|
#
|
||||||
|
# 1. Install hunspell
|
||||||
|
# 2. Download a dictionary
|
||||||
|
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
|
||||||
|
# 3. Move this file into your repository
|
||||||
|
# $ mv commit-msg /path/to/repo/.git/hooks
|
||||||
|
# $ chmod +x /path/to/repo/.git/hooks/commit-msg
|
||||||
|
CHECK=$(cat $1 | aspell --lang=en_US list --add-extra-dicts=$HOME/.aspell.en_US.per)
|
||||||
|
#CHECK=$(cat $1 | hunspell -s -d en_US,${HOME}/devel/scripts/git/my_dictionary -l)
|
||||||
|
if [ "${CHECK}" != "" ]; then
|
||||||
|
echo "Spell Check Error:"
|
||||||
|
#cat $1 | hunspell -a -d en_US,${HOME}/devel/scripts/git/my_dictionary -l
|
||||||
|
cat $1 | aspell -a --lang=en_US list --add-extra-dicts=$HOME/.aspell.en_US.per
|
||||||
|
echo "Use --no-verify if you want to commit."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
44
git/hooks/prepare-commit-msg
Executable file
44
git/hooks/prepare-commit-msg
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to prepare the commit log message.
|
||||||
|
# Called by "git commit" with the name of the file that has the
|
||||||
|
# commit message, followed by the description of the commit
|
||||||
|
# message's source. The hook's purpose is to edit the commit
|
||||||
|
# message file. If the hook fails with a non-zero status,
|
||||||
|
# the commit is aborted.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "prepare-commit-msg".
|
||||||
|
|
||||||
|
#
|
||||||
|
# Extract ticket id from the branch name and Append to commit message.
|
||||||
|
# Pattern NAME-NUMBER. e.g. ERROR-234
|
||||||
|
#
|
||||||
|
COMMIT_MSG_FILE=$1
|
||||||
|
COMMIT_SOURCE=$2
|
||||||
|
SHA1=$3
|
||||||
|
|
||||||
|
MESSAGE=$(cat $COMMIT_MSG_FILE)
|
||||||
|
TICKET=$(git rev-parse --abbrev-ref HEAD | grep -Eo '^(\w+/)?(\w+[-_])[0-9]+' | grep -Eo '(\w+[-])[0-9]+' | tr "[:lower:]" "[:upper:]"):
|
||||||
|
|
||||||
|
if [[ $TICKET == ":" || "$MESSAGE" == "$TICKET"* ]];then
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$TICKET $MESSAGE" > $COMMIT_MSG_FILE
|
||||||
|
|
||||||
|
#/opt/bb/bin/perl5.16 -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
|
||||||
|
|
||||||
|
# case "$COMMIT_SOURCE,$SHA1" in
|
||||||
|
# ,|template,)
|
||||||
|
# /opt/bb/bin/perl5.16 -i.bak -pe '
|
||||||
|
# print "\n" . `git diff --cached --name-status -r`
|
||||||
|
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
|
||||||
|
# *) ;;
|
||||||
|
# esac
|
||||||
|
|
||||||
|
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||||
|
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
|
||||||
|
# if test -z "$COMMIT_SOURCE"
|
||||||
|
# then
|
||||||
|
# /opt/bb/bin/perl5.16 -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
|
||||||
|
# fi
|
||||||
51
git/setup-upstream.sh
Executable file
51
git/setup-upstream.sh
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
git-setup-upstream(){
|
||||||
|
|
||||||
|
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-setup-upstream
|
||||||
|
|
||||||
|
|
||||||
24
local/yerevak/.ssh/config
Normal file
24
local/yerevak/.ssh/config
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Note that value for 'User' must be 'git'.
|
||||||
|
|
||||||
|
Host lusntag
|
||||||
|
HostName lusntag.vostan.org
|
||||||
|
Port 8080
|
||||||
|
PreferredAuthentications publickey
|
||||||
|
IdentityFile ~/.ssh/id_rsa
|
||||||
|
User vahagn
|
||||||
|
|
||||||
|
Host yerevak
|
||||||
|
HostName yerevak.vostan.org
|
||||||
|
Port 24
|
||||||
|
PreferredAuthentications publickey
|
||||||
|
IdentityFile ~/.ssh/id_rsa
|
||||||
|
User vahagn
|
||||||
|
|
||||||
|
|
||||||
|
Host hrat
|
||||||
|
HostName 192.168.0.4
|
||||||
|
PreferredAuthentications publickey
|
||||||
|
IdentityFile ~/.ssh/id_rsa
|
||||||
|
User vahagn
|
||||||
|
ProxyCommand=ssh -W %h:%p lusntag
|
||||||
|
|
||||||
Submodule vim/bundle/Vundle.vim updated: b255382d62...9a38216a1c
Reference in New Issue
Block a user