Skip to main content

Posts

Showing posts from 2017

How to use Portainer in Docker?

Portainer is a lightweight management UI which allows you to easily manage your Docker host or Swarm cluster. Setup Portainer in Docker Double click on Docker app-icon to start Docker engine Open Terminal on MacOS or Command-line on Windows after Docker is running Type docker and press enter  If docker comands gets listed then it is runnning properly, otherwise read logs to debug further Now type this command to create a container named portainer and run it docker run --name portainer -d -p 9000:9000 --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /Users/abhishekkumar/Documents/Programs /portainer:/data portainer/portainer Here, /Users/abhishekkumar/Documents/Programs can be replaced with your custom path Open web-browser and go to localhost:9000 A Portainer GUI would open, if everything works fine Fill up the form by setting admin password Click on Local Connection tab to connect with locally running portainer webapp Further explore the app

Bash: Using websocketd as web-terminal

Recently, I have got a work that requires a control over remote machine along with few challenges like that machine can be accessed via Remote Desktop via VPN that goes via corporate Firewall. Now that made it very slow because each incoming or outgoing message packet have to cover the circumference of Earth to reach my system. So I tried lot many tools out there that could solve my problem. I want to eradicate the use of Remote Desktop to expedite the communication. Since the remote system is a Windows machine, so I tried using SSH via freesshd  and found it pretty good. But I want something that could run over browser as web-app. Finally I found this great tool that is available for converting any command-line program into web-application using WebSocket. The tool is websocketd , a WebSocket daemon that takes care of handling the WebSocket connections, launching your programs to handle the WebSockets, and passing messages between programs and web-browser. There are lot man

Bash: Running local web-server on your system

To run a local web-server at a directory, you can use either python , ruby , node.js or php . You can choose your suitable way out of the below provided options. Using python To run the server, go to the directory & execute this command with  Python 2 python -m SimpleHTTPServer 8000 or with  Python 3 python -m http.server 8000 Using ruby First, install the ruby gem named 'serve' sudo gem install serve To run the server, go to the directory & execute this command serve 8000 Using node.js First, install the app named 'http-server' npm install http-server -g To run the server, go to the directory & execute this command http-server ./ -p 8000 You can use any other node based servers as well like  puer Using php To run the server, go to the directory & execute this command php -S 0.0.0.0:8000 Note : Press Ctrl-C to quit any of the above listed server

Bash: Automating the cloning of repository

Create this bash file to clone your repository excluding .git, etc. directory or files. #!/usr/bin/bash ROOT_DIR="/Users/username/Documents/" rsync -avzh --delete $ROOT_DIR"/project1/" $ROOT_DIR"/project2" --exclude '.git' --exclude 'README.md' --exclude 'LICENSE' --exclude '.gitignore' echo "Done!"

How to setup Robot Framework on development machine?

Here, I have shared the steps to setup the  Robot Framework  on a development machine  preferrably  on  MacOSX .   Steps to setup Download and install  Python  from  here   Windows  users should target  Python v2.7  due to  Selenium  compatibility while  MacOS  users can target  v2.7  as well as  v3.0  or above   After installation, add it's path in  Environment Variables   Verify it on terminal  $ python -V   Install  Robot Framework  as instructed  here   Use  pip install  robotframework  as preferred installer on terminal   Verify it on terminal  $ robot --version   Install  Selenium2Library  as instructed  here   Use  pip install robotframework-selenium2library  as preferred installer on terminal   No dependency related error should remain on terminal while installing this   Download  Geckodriver  from  here ,   Unzip the package   Put the executable file at suitable path   Add that path in  Environment Variables  

How to generate git diff patch?

To understand the process involved in it, we need to first understand the terminologies that is being used in the git. Suppose you have committed your code in Git repository. Now when you select the particular commit, then you will see something like this TK-34164 e2e test cases added Commit: 96f17e85e5b76cff8a6a0332c4f22d10aca3aec6 [96f17e8] Parents: 56a575c5b8 Author: Abhishek Kumar Date: 3 January 2017 at 18:52:06 IST Labels: HEAD -> feature/TK-34164-configure-robot-framework-into Here at line  #1  is custom message for the commit, after that at line  #2  you see a commit-id which is 40 characters long hexadecimal string (SHA-1) and it's short version in square bracket which is 7 characters long.  SHA-1  (Secure Hash Algorithm 1) produces a 160-bit (20-byte) hash value known as a message digest. A SHA-1 hash value is typically rendered as a hexadecimal number, 40 digits long. This  commit-id  is 160-bit SHA-1 hash, uniquely represents the new, post-commit state