Run bash terminal inside VIM with Conque-Shell

This is one of the coolest trick I’ve ever seen when working with VIM. This plugin allows you to run the bash terminal inside the VIM. And you can actually make it a spitted pane within your VIM work space.

Check out this plugin:

How to install conque-shell:

Open vim config:

vim ~/.vimrc
call plug#begin('~/.vim/plugged')
Plug 'lrvick/Conque-Shell'
call plug#end()

Close the ~/.vimrc file, and open vim again, and Install the plugin with this syntax:

:PlugInstall

Let’s understand Git Submodule

What is git submodule?

It is another git project inside your git repository. If you working on multiple git projects but need them in one repository instead. You will be happy to setup git submodule.

So here I have two git repositories for example:

https://github.com/muffat/repo-a
https://github.com/muffat/repo-b

And since I’m updating the repo-b frequently, I want my repo-b to be inside the repo-a so it helps me to work with multiple repos as possible and easy to maintain codes across the repo and be able to work more faster and efficiently.

Setup git submodule

Add git submodule in your current repo

$ git clone git@github.com:muffat/repo-a.git
$ cd repo-a/
/repo-a$
/repo-a$ git submodule add git@github.com:muffat/repo-b.git

Commit and push your submodule

/repo-a$ git add .
/repo-a$ git commit -m "Add submodule repo-b"
/repo-a$ git push origin master

Note that, git submodule doesn’t automatically get pulled after you clone your repository (repo-a). You need to do manual initialize and pull your submodule. So after you clone your repository, you will find out that your submodule directory (repo-b) is empty.

$ git clone git@github.com:muffat/repo-a.git
$ cd repo-a/
/repo-a$ cd repo-b/
/repo-a/repo-b/$ ls
/repo-a/repo-b/$

go to submodule directory, and do this:

/repo-a$ cd repo-b/
/repo-a/repo-b/$ git submodule init
/repo-a/repo-b/$ git submodule update

How to git clone including submodules

$ git clone --recursive git@github.com:muffat/repo-a.git

Some problem occurred whenever I tried to clone with recursive. It failed to fetch the submodule repository because of the permission. Although my submodule is a public repository, yet still failed.

Then I changed the url of submodule from git to be https.

$ cat .gitmodules
[submodule "repo-b"]
path = repo-b
url = https://github.com/muffat/repo-b.git
branch = master

After that, the git recursive cloning was working.

Nginx: set the server_name as wildcard without hostname

Simple trick to run the nginx with no server_name.

server {
  listen 80 default_server;
  server_name _;
  location / {
    root /path/to/app;
    index index.php;
    try_files $uri $uri/ /index.php?q=$uri&$args;
    location ~* \.php {
      try_files $uri =404;
      include fastcgi_params;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_pass 127.0.0.1:9000;
    }
  }
}

Setup plugin manager for vim on fedora 28

Vim is one of the tool that must have in any unix like system. One of the reason for using vim is the customization and the plugins that can be used depending on the needs. To install plugins on vim, I’m using vim-plugin from junegunn/vim-plug.

Check vim version

In fedora vim already installed, but you might want to check the version just in case yours behind of the newest version.

$ vim --version

Update vim

Update vim to the newest, for better experience

$ sudo dnf update vim

Setup plugin manager for vim

Setting up vim-plug, this will be downloaded the plugin and put it inside ~/.vim/ autoload directory:

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Open ~/.vimrc, and put these lines at the bottom of the file. Between the lines of call plug#begin(‘~/.vim/plugged’) and call plug#end(), are the plugins that you want to install.

...
...
call plug#begin('~/.vim/plugged')
Plug 'junegunn/vim-easy-align'
Plug 'itchyny/lightline.vim'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'Valloric/MatchTagAlways'
call plug#end()

Save, and restart vim config without restart:

:w
:so ~/.vimrc

Update plugin

After the vim-plug has been setup, now we can easily install these plugin that has been listed inside ~/.vimrc by this command:

:PlugInstall

Finally, let vim-plug installing these plugins

All set!

 

 

Install TeamViewer On Fedora 28, Easy setup

Installing rpm package can be tricky, sometimes dependecies that required are not met.

I’ve experienced this when installing TeamViewer for fedora 28. Here’s just another snippet to installing the TeamViewer on fedora 28 with nice and easy.

Download teamviewer from the source:

$ wget https://download.teamviewer.com/download/linux/teamviewer.x86_64.rpm

Install the dependencies and the rpm target:

$ sudo dnf install qt5-qtwebkit qt5-qtquickcontrols -y
$ sudo rpm -i teamviewer.x86_64.rpm

How to delete stucked Route53 zone created by ECS service discovery

It happens when I tried to delete the NS that created by ECS service directory, then this error shows up:

The resource hostedzone/Z1OWcan only be managed through servicediscovery.amazonaws.com (arn:aws:servicediscovery:us-east-1:561660628307:namespace/ns-c6lvlchj2gbcsobc)

If there are services hanging around the in the NS you can’t delete then you could try:

$ aws servicediscovery list-services
$ aws servicediscovery delete-service --id=
$ aws servicediscovery delete-namespace --id=