Skip to content

Instantly share code, notes, and snippets.

View desurus's full-sized avatar

Oleksandr Kryshchenko desurus

  • DESURUS LLC
  • Los Angeles, CA
View GitHub Profile
@desurus
desurus / cloudtrailparquet.py
Last active May 24, 2018 20:36
AWS Glue ETL job to Parquetize CloudTrail log files
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
import boto3
import time
## @params: [JOB_NAME]
@desurus
desurus / no_owner_ec2.py
Last active May 24, 2018 20:37
Shows a list of ami that have no 'Owner' tag
#!/usr/bin/python
import sys
import boto3
import json
filename = 'no_owner_instances.txt'
email_recipients = ['okryshchenko@gmail.com']
@desurus
desurus / check_response_time.py
Created February 24, 2017 00:16
Simple Nagios plugin to monitor transaction response time for the unicorn web server
#!/usr/bin/python
import os
import re
import sys
import time
import datetime
import argparse
@desurus
desurus / check_transaction_files.sh
Created February 24, 2017 00:15
Simple Nagios plugin to check number of transaction files open by unicorn web server
#!/bin/bash
# Setting default values
help_text="Usage: `basename $0` options (-w warning value) (-c critical value) -h for help";
if ( ! getopts ":w:c:" opt ); then
echo $help_text;
exit 1;
fi
@desurus
desurus / parse_folder.py
Created August 16, 2016 01:46
Parses folders and creates csv file
#!/usr/bin/python
import argparse
import os
import sys
import re
import csv
import time
@desurus
desurus / interface_example.md
Last active July 19, 2016 20:16
Solving complex problem in OOP fashion

Interfaces in PHP and how they can be used

The problem

Lets consider a scenario. We are building a micro services web application in PHP. Our application is heavily using geotagging and we will use a 3rd party API for this, for example GoogleMaps and OpenStreetMap. We will write something like this:

/**
 * Contains functionality of the GoogleMaps services.
 *
 * @package mygreatapp
#!/bin/bash
HELP_MESSAGE=$'
Manage BIND 1.0, install BIND and populate dummy A records.
Usage: ./manage-bind.sh [OPTION]
Only short options are supported at the moment.
-i install BIND, setup dummy zone test.com and populate
1000 dummy A records r1.test.com .. r1000.test.com
@desurus
desurus / hbpython.py
Created April 21, 2016 21:11
Simple python script to send alerts to Honeybadger.io monitoring service.
# -*- coding: utf-8 -*-
"""
Simple python script to send alerts to Honeybadger.io monitoring service.
Maintainer: Oleksandr Kryshchenko <oleksnadr.kryshchenko@avant.com>
Influenced by: https://github.com/honeybadger-io/honeybadger-python
Example:
> from hbpython import HBPython
> HB_API_KEY = os.getenv("HB_API_KEY")
@desurus
desurus / worker.py
Created February 5, 2016 03:05
Simple script that consumes the Amazon's SQS service, performs operation and sends results back to the client queue.
#!/usr/local/bin/python2.7
import sys
import boto3
class SimpleSQSWorker:
"""
Very simple worker class for processing simple math asynchronously using Amazon's SQS service.
"""
@desurus
desurus / client.py
Created February 5, 2016 03:04
Simple script that generates tasks for the Amazon's SQS service to be consumed by the worker and then the result can be obtained.
#!/usr/local/bin/python2.7
import sys
import boto3
import time
class SimpleSQSClient:
"""
Very simple client class for processing simple math asynchronously using Amazon's SQS service.