My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
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
## Resources: | |
# https://pypi.python.org/pypi/coinmarketcap/ | |
# https://coinmarketcap.com/api/ | |
import json | |
import requests | |
from coinmarketcap import Market | |
c = Market() |
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 alpine:3.6 | |
MAINTAINER Ruan Bekker | |
RUN apk update && \ | |
apk add \ | |
dumb-init \ | |
musl \ | |
linux-headers \ | |
build-base \ |
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 sys | |
import smtplib | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEText import MIMEText | |
name = "Ruan" | |
from_address = "[email protected]" | |
to_address = "[email protected]" | |
subject = "Test" |
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 boto3 | |
# setting region, profile from credential provider | |
session = boto3.Session( | |
region_name='eu-west-1', | |
profile_name='myprofile' | |
) | |
# declare ec2 | |
ec2 = session.client('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
import boto3 | |
GROUPS_ALLUSERS = 'http://acs.amazonaws.com/groups/global/AllUsers' | |
GLOBAL_AUTHUSERS = 'http://acs.amazonaws.com/groups/global/AuthenticatedUsers' | |
s3 = boto3.client('s3') | |
list_buckets = s3.list_buckets()['Buckets'] | |
available_buckets = [] |
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 requests | |
import json | |
uri = 'https://domain.com/hooks/1234AbcD' | |
data={} | |
data = { | |
"username": "Python Bot", | |
"icon_emoji": ":whale:", | |
"attachments": [ | |
{ |
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 csv from: | |
# https://resources.console.aws.amazon.com/r/tags | |
import csv | |
from collections import Counter | |
with open('resources.csv', 'rb') as csvfile: | |
print("Missing Tags Per Service:") | |
print("=========================") | |
reader = csv.DictReader(csvfile) |
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 boto3 | |
# setting region, profile from credential provider | |
session = boto3.Session( | |
region_name='eu-west-1', | |
profile_name='aws' | |
) | |
# declare ec2 | |
ec2 = session.client('ec2') |