This file contains 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 | |
# This script is written to make your EC2 Linux machine Router | |
# With this you can setup your linux machine as gateway. | |
#################################################################################### | |
####### Dont forget to disable source/destination checks on the NAT instance ####### | |
#################################################################################### | |
# Deleting all the iptables rules | |
iptables --flush |
This file contains 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
--- | |
- hosts: all | |
tasks: | |
- name: Download MS product repository | |
get_url: | |
url: https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb | |
dest: /tmp/packages-microsoft-prod.deb | |
- name: Install MS product repository | |
apt: deb=/tmp/packages-microsoft-prod.deb | |
become: true |
This file contains 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
# Hosts/domain names that are valid for this site; required if DEBUG is False | |
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts | |
ALLOWED_HOSTS = [ | |
'yourdomain.tld', | |
'.compute-1.amazonaws.com', # allows viewing of instances directly | |
] | |
import requests | |
EC2_PRIVATE_IP = None | |
try: |
This file contains 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 ansible.utils as utils | |
# | |
# Put this file in lookup_plugins/ alongside your playbooks. | |
# | |
# Lookup plugins can be called two ways: via with_ as a task loop | |
# construct, or via lookup('name'). | |
# | |
# You can find the code for the basic lookup plugins here: | |
# v1: https://github.com/ansible/ansible/tree/devel/v1/ansible/runner/lookup_plugins | |
# v2: https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/lookup |
This file contains 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
# best practice: linux | |
nano ~/.pgpass | |
*:5432:*:username:password | |
chmod 0600 ~/.pgpass | |
# best practice: windows | |
edit %APPDATA%\postgresql\pgpass.conf | |
*:5432:*:username:password | |
# linux |
This file contains 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
Vagrant.configure('2') do |config| | |
ENV['HOST'] ||= '_ sys._' | |
config.vm.box = 'debian/contrib-buster64' | |
config.vm.hostname = File.basename(Dir.pwd) + '.test' | |
config.vm.network 'private_network', type: 'dhcp' | |
config.trigger.after :reload, :resume, :up do |trig| | |
trig.info = 'Updating sytstem hosts...' | |
trig.ruby do |env, vm| |
This file contains 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 collections import defaultdict | |
import boto3 | |
""" | |
A tool for retrieving basic information from the running EC2 instances. | |
""" | |
# Connect to EC2 | |
ec2 = boto3.resource('ec2') |
This file contains 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
aws s3 ls s3://my-prod/directory --recursive --human-readable --summarize --profile aws-profile | |
aws s3 ls --summarize --human-readable --recursive s3://my-prod/* --profile aws-profile | |
aws s3 ls s3://my-prod --recursive --human-readable --summarize --profile aws-profile | |
aws s3 ls --profile aws-profile s3://my-prod --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024" MB"}' |
This file contains 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
openssl req -x509 -out localhost.crt -keyout localhost.key \ | |
-newkey rsa:2048 -nodes -sha256 -days 1024 \ | |
-subj '/CN=localhost' -extensions EXT -config <( \ | |
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") |
This file contains 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
#Get the list of all the queues | |
rabbitmqadmin -f tsv --vhost=/ --username=RABBITMQ_USER --password=RABBITMQ_PASSWORD -q list queues name > file.txt | |
#Remove all the queues | |
while read -r name; do rabbitmqadmin --vhost=/ --username=RABBITMQ_USER --password=RABBITMQ_PASSWORD -q delete queue name="${name}"; done < file.txt |
NewerOlder