This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * * * * * /home/azureuser/start.sh >> /var/log/cronlogs/sample.log 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ps -aux | grep -v grep | grep app.py > /dev/null | |
| if [ $? -eq 0 ]; then | |
| echo "$(date +'%Y-%m-%d') $(date +'%T') 200,Success,Process is Running" | |
| else | |
| echo "$(date +'%Y-%m-%d') $(date +'%T') 500,Error,Process is not Running" | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def hello(): | |
| return "Hello World!" | |
| if __name__ == '__main__': | |
| app.run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import base64 | |
| data = open("script.sh", "rb").read() | |
| encoded = base64.b64encode(data) | |
| print(encoded) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | |
| sudo apt update | |
| sudo apt install cifs-utils | |
| mkdir data | |
| az login | |
| resourceGroupName="<your-resource-group>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # Setup a work space called `work` with two windows | |
| # first window has 3 panes. | |
| # The first pane set at 65%, split horizontally, set to api root and running vim | |
| # pane 2 is split at 25% and running redis-server | |
| # pane 3 is set to api root and bash prompt. | |
| # note: `api` aliased to `cd ~/path/to/work` | |
| # | |
| session="work" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import subprocess | |
| from random import randrange | |
| print('\tLethargic Panda\t') | |
| print('Lethargic Panda is not working and now your instance is deprecated and will not work ....') | |
| process = subprocess.Popen("aws ec2 describe-instances --filters 'Name=tag:Name,Values=AutoScaling' --query Reservations[*].Instances[*].[InstanceId] --output text", shell=True, stdout=subprocess.PIPE) | |
| output, error = process.communicate() | |
| instance_lists = list(output.decode("utf-8").split("\n"))[0:-1] | |
| lethargic_panda = randrange(2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "ec2:DescribeAddresses", | |
| "ec2:AllocateAddress", | |
| "ec2:DescribeInstances", | |
| "ec2:AssociateAddress", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| sudo yum update -y | |
| sudo yum install ruby -y | |
| sudo yum install wget -y | |
| cd /home/ec2-user | |
| wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install | |
| chmod +x ./install | |
| sudo ./install auto | |
| sudo service codedeploy-agent start | |
| aws ec2 disassociate-address --public-ip <Your Allocated IPv4 Address> --region us-east-1 |
NewerOlder