Adding new stuff

This commit is contained in:
Viktor Barzin 2017-10-09 00:00:02 +01:00
parent a410da0e04
commit 4eca0b2c77
2 changed files with 42 additions and 5 deletions

View file

@ -40,11 +40,6 @@ function download_github_folder() {
alias sizeof="du -sh $1"
alias mkdir="mkdir -pv"
# Send ssh key to server
send_key() {
cat ~/.ssh/id_rsa.pub | ssh $1 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
}
# function ls(){
# if [[ $2 == "-l" ]]; then
# if [[ $3 != "" ]]; then
@ -108,3 +103,41 @@ function in(){
docker exec -it $container_name /bin/bash
fi
}
function stest(){
: snapshot_name="rootsnap"
mount_point="$2"
if [ $# -ne 2 ];then
echo "Usage:"
echo "$0 <snapshot size> <mount point> "
echo
return
fi
if [ ${mount_point:0:1} != '/' ]; then
echo "Mount point must be absolute path"
return
fi
if [[ $(sudo lvs | grep $snapshot_name) ]]; then
echo "$snapshot_name already exists!"
# read -e -p "Do you want to discard it and create a new one?(y/N)" -i n should_discard
echo "Do you want to discard it and create a new one?(y/N)"
read should_discard
should_discard=${should_discard:-"n"}
# if [ ${(L)should_discard} = 'y' ]; then
if [ $(echo $should_discard | awk '{print tolower($0)}') = 'y' ]; then
sudo umount $mount_point
sudo lvremove /dev/kubuntu-vg/$snapshot_name -y
else
echo "Leaving old snapshot intact"
return
fi
fi
sudo lvcreate -s -n $snapshot_name /dev/kubuntu-vg/root -L $1
sudo mount /dev/kubuntu-vg/$snapshot_name $mount_point
sudo chroot $mount_point /bin/zsh
}

4
.vimrc
View file

@ -468,6 +468,10 @@ let b:lion_squeeze_spaces = 1
set showmatch
set matchtime=3
" Fold functions in bash
let g:sh_fold_enabled=3
" Recompute syntax highlighting
nnoremap <silent> <F4> :syntax sync fromstart<CR>