Skip to content

Instantly share code, notes, and snippets.

View pictolearn's full-sized avatar

Pictolearn pictolearn

  • Coimbatore, IN
View GitHub Profile
@pictolearn
pictolearn / error.html
Created June 7, 2019 13:26
error.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
@pictolearn
pictolearn / index.html
Created June 7, 2019 13:24
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
@pictolearn
pictolearn / CORS_CONFIGURATION_S3
Created June 4, 2019 13:01
CORS_CONFIGURATION_S3
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>http://testmy.cloud</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
# Create a new SSH Key
# -t stands for ‘type’ and rsa is type of encryption
# -C is for comment
ssh-keygen -t rsa -C “your-email-address”
# The above command shows rs key pair
# Enter file in which to save the key (/c/Users/your_username/.ssh/id_rsa) ~/.ssh/id_rsa_<your-file-name>
# make sure you have the file
ls -al ~/.ssh
{
"Version": "2012-10-17",
"Id": "Policy1559630929660",
"Statement": [
{
"Sid": "Stmt1559630927924",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
@pictolearn
pictolearn / start_stop_ec2.py
Created May 31, 2019 14:25
python code to launch,list and terminate EC2 instances
import boto3 # a development kit package in AWS
import os # package which runs shell commands
import time # package which handles date and time
def get_ec2_con_for_give_region(my_region): # function definition to get region
ec2_con_re=boto3.resource('ec2',region_name=my_region)
return ec2_con_re
def list_instances_on_my_region(ec2_con_re): # function definition to get instance in that respective region
for each in ec2_con_re.instances.all():
print(each.id)
def get_instant_state(ec2_con_re,in_id): # function definition to get the state of instances in that respective region
@pictolearn
pictolearn / Launch,list and terminate_EC2_instances_using_amzon_command_line_interface.txt
Last active June 21, 2019 08:06
Launch,list and terminate_EC2_instances_using_amzon_command_line_interface
# Launches an instance
# aws ec2 run-instances \
# --image-id <ami-xxxxx> \
# --count 1 \
# --instance-type t2.micro \
# --key-name <your KeyPair> \
# --security-group-ids <group_id> \
# --subnet-id <your subnet id>
aws ec2 run-instances --image-id ami-0cc96feef8c6bbff3 --count 1 --instance-type t2.micro --key-name pictolearn-ec2 --security-group-ids sg-0bc5999645783c843 --subnet-id subnet-76f2c879
@pictolearn
pictolearn / CHANGE_EC2_USER_DATA
Created May 17, 2019 08:15
Change_EC2_USER_DATA
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
@pictolearn
pictolearn / CHANGE_EC2_USER_DATA
Created May 17, 2019 08:15
Change_EC2_USER_DATA
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
@pictolearn
pictolearn / NGINX_Commands
Created May 17, 2019 06:54
Nginx Commands
# STOP NGINX
sudo systemctl stop nginx
#START NGINX
sudo systemctl start nginx
#To stop and then start the service again, type:
sudo systemctl restart nginx
# If you are simply making configuration changes, Nginx can often reload without dropping connections.