➜ ~ virsh list --all
Id Name State
----------------------------------------------------
15 compute.local running
16 storage.local running
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
# The following gist uses python opencv2 (http://opencv.org) to take a pic | |
import cv2 | |
def capture_image(image_file): | |
video = cv2.VideoCapture() | |
video.open(0) | |
_, image = video.retrieve() | |
video.release() | |
cv2.imwrite(image_file, image) |
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
# install dependencies | |
sudo apt-get update | |
sudo apt-get install -y build-essential | |
sudo apt-get install -y cmake | |
sudo apt-get install -y libgtk2.0-dev | |
sudo apt-get install -y pkg-config | |
sudo apt-get install -y python-numpy python-dev | |
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev | |
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev | |
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
ubuntu@etl:/etc/cron.daily$ cat delete-etl-dss-data-job.py | |
#!/usr/bin/env python | |
import datetime | |
import glob | |
import logging | |
import logging.handlers | |
import shutil | |
import subprocess | |
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
""" | |
Generate a server.key and server.cert. | |
>> mike:tmp$ openssl req -nodes -new -x509 -keyout server.key -out server.cert | |
Combine the generated keys. | |
>> mike:tmp$ cat server.key server.cert > server.pem | |
Now run the script |
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 ssh-config | |
Host webserver1 | |
HostName 127.0.0.1 | |
User vagrant | |
Port 2222 | |
UserKnownHostsFile /dev/null | |
StrictHostKeyChecking no | |
PasswordAuthentication no | |
IdentityFile /Users/Mike/projects/sandbox/haproxylab/.vagrant/machines/webserver1/virtualbox/private_key | |
IdentitiesOnly yes |
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
# Based on http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/ | |
import six | |
from sqlalchemy.dialects import postgresql | |
from sqlalchemy.types import SchemaType, TypeDecorator, Enum | |
from sqlalchemy import __version__, text, cast | |
import re | |
if __version__ < '0.6.5': | |
raise NotImplementedError("Version 0.6.5 or higher of SQLAlchemy is required.") |
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 logging | |
import json | |
from flask import Flask, current_app, jsonify | |
from flask import request | |
logging.basicConfig(level=logging.DEBUG) | |
app = Flask(__name__) |
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
#!/root/env/bin/python | |
import argparse | |
import iptc | |
import logging | |
import time | |
from bash import bash | |
from ipwhois import IPWhois | |
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
#!/opt/venv/ipblock/env/bin/python | |
__author__ = 'Mike Manuthu <muragumichael@gmail.com>' | |
""" | |
A simple script to disable the number of connections to the server. | |
Uses IPTables to block the IPS with more than the threshold connections. | |
Uses Fail2Ban as the default IP Blocker. | |
usage: IP Blocker :: [-h] [-i IP] [-I IPRANGE] [-c CONNECTIONS] [-B] | |
[-f FREQUENCY] |
OlderNewer