This file contains hidden or 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 | |
NO_OP = True | |
REGION_NAME = 'us-west-2' | |
ec2r = boto3.resource('ec2', region_name=REGION_NAME) | |
ec2c = boto3.client('ec2', region_name=REGION_NAME) | |
vols = ec2r.volumes.filter(Filters=[{'Name': 'status', 'Values': ['available']}]) |
This file contains hidden or 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 Cocoa | |
import CoreFoundation | |
from LaunchServices import LSSharedFileListCreate, kLSSharedFileListSessionLoginItems, LSSharedFileListCopySnapshot, kLSSharedFileListItemBeforeFirst, LSSharedFileListItemCopyDisplayName, LSSharedFileListInsertItemURL | |
TO_ADD_NAME = "YourAppName" | |
TO_ADD_PATH = "/Applications/YourAppname.app/" | |
items = LSSharedFileListCreate(CoreFoundation.kCFAllocatorDefault, kLSSharedFileListSessionLoginItems, None) | |
snapshot = LSSharedFileListCopySnapshot(items, None) |
This file contains hidden or 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
Apache Puppet Module using Puppet's best practice standards and architecture. |
This file contains hidden or 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
""" | |
Assortment of functions for selecting weighted random elements from a dictionary of 'element: weight' pairs. | |
""" | |
import random | |
def getRand(items): | |
""" | |
Selects random element from items and returns. |
This file contains hidden or 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
""" | |
Re-implementation of os.walk as a recursive generator. | |
Yields full paths of files encountered along the walk of the parent directory. | |
""" | |
import os | |
def walkDir(parent): | |
""" |
This file contains hidden or 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
""" | |
Simple Reverse Polish notation calculator. | |
Uses a deque as a queue to push and pop operands from and eval to perform operations. | |
""" | |
from collections import deque | |
def isNumber(val): | |
""" |
This file contains hidden or 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
""" | |
Concurrently parse Apache logs and generate dictionary containing aggregate of 'ip / hostname: frequency' pairs. | |
""" | |
from multiprocessing import Pool | |
from collections import Counter | |
def readLog(path): | |
""" |