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 | |
client = boto3.client( | |
'emr', | |
region_name='eu-west-1' | |
) | |
cmd = "hadoop jar /usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar wordcount file:///etc/services /output" | |
emrcluster = client.run_job_flow( |
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
# centos: libxslt-devel python-devel | |
# debian: | |
import re | |
import time | |
import requests | |
from bs4 import BeautifulSoup | |
from elasticsearch import Elasticsearch | |
es_client = Elasticsearch(['http://10.0.1.11:9200']) |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
My Docker Notes. I will post more in future on details about Docker, Docker Compose, Docker Swarm on my blog under: | |
https://sysadmins.co.za/tag/docker | |
Get Docker: | |
# curl -sSL https://get.docker.io | bash | |
Docker Hub: | |
Search: | |
# docker search ubuntu |
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 time | |
import requests | |
from bs4 import BeautifulSoup | |
from elasticsearch import Elasticsearch | |
es_client = Elasticsearch(['http://search-domain:9200']) | |
drop_index = es_client.indices.create(index='myindex', ignore=400) | |
create_index = es_client.indices.delete(index='myindex', ignore=[400, 404]) |
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 | |
SERVER_NAME="" | |
echo | openssl s_client -servername $SERVER_NAME -connect $SERVER_NAME:443 2>/dev/null | openssl x509 -noout -dates |
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
# requirement: python-mysqldb | |
import MySQLdb as dbapi | |
import sys | |
import csv | |
QUERY='SELECT * FROM mydb.people;' | |
db=dbapi.connect(host='localhost',user='root',passwd='password') | |
cur=db.cursor() |
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 | |
# my testing was done with LXD/LXC so I had to set this on my hypervisor | |
# sysctl -w vm.max_map_count=262144 | |
# set elasticsearch cluster name: | |
ES_CLUSTER_NAME="myescluster" | |
# set elasticsearch nodes ip/dns that will be part of the elasticsearch cluster | |
ES_NODES='["10.0.0.2", "10.0.0.3"]' |
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 flask import Flask, request, jsonify | |
app = Flask(__name__) | |
@app.route('/ip', methods=['GET']) | |
def name(): | |
return request.environ.get('HTTP_X_REAL_IP', request.remote_addr) | |
#return jsonify({'ip': request.remote_addr}), 200 | |
#return jsonify({'ip': request.environ['REMOTE_ADDR']}), 200 |
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 flask import Flask | |
from flask_restful import Resource, Api | |
app = Flask(__name__) | |
api = Api(app) | |
class Colors(Resource): | |
def get(self): | |
return { | |
'colors': [ |