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
#! /usr/bin/python | |
""" | |
Script to encrypt environment variables to their encrypted version. | |
aws_key_arn - Resource ID # for aws encryption key. | |
format: 'arn:aws:kms:us-east-1:123456789:key/711d0e6d-620c-47da-a2f6-7141eb8cbde4' | |
""" | |
import os | |
import boto3 | |
from base64 import b64encode |
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
# For https://support.wharton.upenn.edu/help/glue-debugging | |
import uuid | |
from pyspark.sql.functions import * | |
from pyspark.sql.types import StringType, IntegerType, StructField, StructType | |
from awsglue.context import GlueContext | |
from awsglue.job import Job | |
from awsglue.utils import getResolvedOptions | |
import sys | |
from pyspark.context import SparkContext | |
import datetime |
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 pandas as pd | |
import random | |
def avg(a, b): | |
return (a+b)/2 | |
def diff(a, b): | |
return abs(a-b) | |
def get_stats(a, b): |
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 | |
from collections import Counter | |
def main(): | |
next_location = 0 | |
history = Counter() | |
for i in range(1, 100): | |
print(next_location) | |
next_location = racaman(next_location, i, history) |
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
#! /usr/bin/env bash | |
# gather_hdd_stats.sh $(date +%F).log | |
# Every 5 seconds on the mod 5 pipe formatted iostat data to <file> | |
if [ $# -lt 1 ] ; then | |
echo "usage: $0 <file>" | |
exit -1 | |
fi | |
outputfile="$1" |
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
#!/usr/bin/env awk | |
# iostat -t -d -H -g hdds sda sdb | |
{OFS="\t"} | |
NR==3 { runtime=$1;} | |
NR==5 { print runtime, $1, $2, $3, $4, $5, $6} |
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
--- | |
- hosts: redhat_aws | |
vars: | |
remote_user: ec2-user | |
target_user: myUserName | |
tasks: | |
- name: 1.Check if EPEL repo is already configured. | |
stat: path=/etc/yum.repos.d/epel.repo | |
register: epel_repofile_result |
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/sh | |
# Syncs files from directory A to B. With the 'chown' this will need to be run as root. | |
# Drop that to run as unprivileged user. | |
if [ $# -lt 2 ] ; then | |
echo "usage: $0 <dir to watch> <sync to>" | |
fi | |
source="$1" | |
destination="$2" |
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-ChildItem -Recurse | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-14) } |
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
# Script for testing file existence in two places | |
# PS C:\> . .\removeOldBackups.ps1 | |
# PS C:\> existsInBoth -DestRoot 'C:\Program Files\' -SourceRoot 'C:\Program Files (x86)\' -CommonPath "Common Files" | |
# True | |
# PS C:\> existsInBoth -DestRoot 'C:\Program Files\' -SourceRoot 'C:\Program Files (x86)\' -CommonPath "UnmatchedFile" | |
# False | |
function existsInBoth{ | |
param ( [string] $SourceRoot, | |
[string] $DestRoot, |
NewerOlder