Vasos Koupparis

Vasos Koupparis

Full Stack Web Developer – Devops Engineer

How to share a git stash with another developer or yourself to another machine

Creating the stash as a patch

The following git command will create a patch file that contains all the differences represented by the set of changes in the stash.

$ git stash show "stash@{0}" -p > changes.patch

The “stash@{0}” is the ref of the stash.

If you want a different one just use $ git stash list to see your list of stashes and select which one you want to patch.

Applying the patch

Transfer/Send the patch file generated from one machine to the other and drop it into the root of your project directory.

Then the following command will do all the magic!!! KEEP ON HACKING!

$ git apply changes.patch

Reversing the patch

$ git apply changes.patch --reverse

AWS CLI – Getting Started – Install AWS Command Line Interface on Windows, Linux and Mac OS

Step-by-step tutorial of how to download and install AWS CLI on Windows, Linux and Mac OS.

 

The AWS CLI is an open source tool built on top of the AWS SDK for Python that provides commands for interacting with AWS services.

It provides direct access to AWS services’ public APIs enabling us to develop shell scripts to manage our resources(EC2, S3 etc)

Check out the releases CHANGELOG for more information on the latest release and choose the version that is required for your Operating System and your project. If you just getting started with AWS CLI , I suggest you to get the latest stable release.

Prerequisites

  • Applicable for Linux, macOS
  • Python 2 version 2.6.5+ or Python 3 version 3.3+

Check your Python installation:

$ python --version

If you do not have Python already installed, or you would like to install a different version of Python, do it before you continue.

Install AWS CLI – Windows

You can install the AWS CLI on Windows with a standalone installer and is supported on Windows XP or later.

NOTE
Repeat the installation process to get the latest version of the AWS CLI.
  1. Download awscli for windows 
  2. Run the downloaded setup file
  3. NOTE
    The CLI installs to C:\Program Files\Amazon\AWSCLI (64-bit) or C:\Program Files (x86)\Amazon\AWSCLI (32-bit) by default.

Install AWS CLI – Linux

We will use the default package managers to install since is available on most Linux distributions and the installation is straight forward.

$ sudo apt-get -y update
$ sudo apt-get -y upgrade
$ sudo apt-get -y install awscli

Install AWS CLI – Mac OS

The easiest and quickest way to install awscli is using Homebrew.

$ brew install awscli

Verify Install

When you’re done, you should be able to run the aws –version command and get the version information:

$ aws --version
aws-cli/1.15.66 Python/2.7.10 Darwin/17.7.0 botocore/1.10.65

 

Terraform – Getting Started – Install Terraform on Windows, Linux and Mac OS

Step-by-step tutorial of how to download and install Terraform on Windows, Linux and Mac OS.

 

Terraform is distributed as a binary package for all supported platforms and architectures and must first be installed on your machine.

Check out the releases CHANGELOG for more information on the latest release and choose the version that is required for your Operating System and your project. If you just getting started with Terraform , I suggest you to get the latest release.

Download Terraform

You can  download a version of Terraform from the releases service.

Install Terraform – Windows

  1. Download terraform for windows 
    • Note: Terraform is packaged as a zip archive, so after downloading Terraform, unzip the package. Terraform runs as a single binary named terraform. Any other files in the package can be safely removed and Terraform will still function
  2. Copy files from the zip to “c:\terraform” for example. That’s our terraform PATH.
  3. The final step is to make sure that the terraform binary is available on the PATH.

General Information

  • The PATH is the system variable that your operating system uses to locate needed executables from the command line or Terminal window.
  • The PATH system variable can be set using System Utility in control panel on Windows, or in your shell’s startup file on Linux.

Windows 10 and Windows 8

  • In Search, search for and then select: System (Control Panel)

  • Click the Advanced system settings link.

  • Click Environment Variables.

  • In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.

  • In the Edit System Variable (or New System Variable) window, append at the end of the PATH environment variable the value of terraform path ex.”c:\terraform;” .

  • Click OK. Close all remaining windows by clicking OK.
  • Reopen Command prompt window, and run terraform.

Windows 7

  1. From the desktop, right click the Computer icon.
  2. Choose Properties from the context menu.
  3. Click the Advanced system settings link.
  4. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  5. In the Edit System Variable (or New System Variable) window, append at the end of the PATH environment variable the value of terraform path ex.”c:\terraform;” . Click OK. Close all remaining windows by clicking OK.
  6. Reopen Command prompt window, and run terraform.

Windows XP

  1. Select Start, select Control Panel. double click System, and select the Advanced tab.
  2. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  3. In the Edit System Variable (or New System Variable) window, append at the end of the PATH environment variable the value of terraform path ex.”c:\terraform;” . Click OK. Close all remaining windows by clicking OK.
  4. Reopen Command prompt window, and run terraform.

Install Terraform – Linux

  1. Download terraform for linux 

    • Note: Terraform is packaged as a zip archive, so after downloading Terraform, unzip the package. Terraform runs as a single binary named terraform. Any other files in the package can be safely removed and Terraform will still function
  2. Install unzip
  3. Unzip and set path.

Install Terraform – Mac OS

The easiest and quickest way to install Terraform is using Homebrew.

Or Manually if the latest version is not ideal for your needs.

  1. Download terraform for macos
    • Note: Terraform is packaged as a zip archive, so after downloading Terraform, unzip the package. Terraform runs as a single binary named terraform. Any other files in the package can be safely removed and Terraform will still function
  2. Extract files from the zip to “$HOME/Downloads/terraform” for example.
  3. The final step is to make sure that the terraform binary is available on the PATH.
  4. Copy binary to a place in the path such as /usr/local/bin/terraform

Verify Install

When you’re done, you should be able to run the terraform command and get the usage information: