Skip to content

Instantly share code, notes, and snippets.

View abhilashshettigar's full-sized avatar
🎮
Game on

Abhilash Shettigar abhilashshettigar

🎮
Game on
View GitHub Profile
@abhilashshettigar
abhilashshettigar / autostart-container.sh
Created March 27, 2023 05:51
This is a simple script to AutoStart the docker container if the docker restart policy is not working properly
#!/bin/bash
CONTAINER_NAME="your-container-name"
if [ ! "$(docker ps -q -f name=$CONTAINER_NAME)" ]; then
if [ "$(docker ps -aq -f status=exited -f name=$CONTAINER_NAME)" ]; then
# Start the container if it is stopped
docker start $CONTAINER_NAME
fi
fi

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

@abhilashshettigar
abhilashshettigar / userdata.sh
Created June 24, 2022 06:44
UserData for Ubuntu 20
#!/bin/bash
# Install docker
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
@abhilashshettigar
abhilashshettigar / nginx-ssl-config
Created March 17, 2020 06:16 — forked from apollolm/nginx-ssl-config
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@abhilashshettigar
abhilashshettigar / ec2-startup.sh
Created March 4, 2020 10:23 — forked from ReedD/ec2-startup.sh
User data for EC2 to set up Docker and Compose (Fig) for ec2-user
#!/bin/sh
export PATH=/usr/local/bin:$PATH;
yum update
yum install docker -y
service docker start
# Docker login notes:
# - For no email, just put one blank space.
# - Also the private repo protocol and version are needed for docker
# to properly setup the .dockercfg file to work with compose
@abhilashshettigar
abhilashshettigar / user-data.sh
Created February 20, 2020 09:36 — forked from abhilash1in/user-data.sh
Install nvm and NodeJS using AWS EC2 user data script
#!/bin/bash
apt-get -y update
cat > /tmp/subscript.sh << EOF
# START UBUNTU USERSPACE
echo "Setting up NodeJS Environment"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash
echo 'export NVM_DIR="/home/ubuntu/.nvm"' >> /home/ubuntu/.bashrc
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> /home/ubuntu/.bashrc
# Dot source the files to ensure that variables are available within the current shell
. /home/ubuntu/.nvm/nvm.sh
@abhilashshettigar
abhilashshettigar / command.js
Created December 3, 2018 12:40
Sample code for login via Custom command
Cypress.Commands.add("Login", () => { //Making A custom command for loggin in to the application
cy.request({
method: 'POST',
url: '/users/authenticate', // Base URL will be prepended which is decalred in cypress.json
body: { //Passing Email and Password for log in
"email": "{email}",
"password": "{pass}"
}
}).then(($body) => { //Assertion for Response status should be 200
if (expect($body.status).to.eq(200)) {
@abhilashshettigar
abhilashshettigar / loginWithoutUI.spec.js
Last active December 3, 2018 12:52
Sample Code in Cypress for calling custom custom
describe('Make Custom Command and Using in regular test script', () => {
before('Calling Custom command before making any User actions', () => {
cy.Login()
})
it('Test Script',() => {
//Test Script starts
cy.visit('http://localhost:8080')
})
})
@abhilashshettigar
abhilashshettigar / login.spec.js
Last active December 4, 2018 13:07
Sample code for Cypress with Page object pattern
import {
Login
} from '../../support/login-po.js';
var login = new Login();
describe('Sanity E2E Test suite for Login page ', () => {
before('Visit Login page', () => {
cy.visit('/login') //Visiting login page before a test run
})
it('Verify if User can login', () => {
@abhilashshettigar
abhilashshettigar / login-po.js
Last active December 4, 2018 13:30
Sample Code for Cypress with Page object method
export class Login {
getUsername(){
return cy
.get(':nth-child(1) > .form-control')
}
getPassword(){
return cy
.get(':nth-child(2) > .form-control')
}
getSignupBtn(){