- Setup aws profile for both source and destination
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
function es_proxy () { | |
if [ ! -z $1 ] | |
then | |
profile="-e AWS_PROFILE=$1" | |
echo $1 profile will be used | |
fi | |
if [ -z $REGION ] | |
then | |
REGION="us-west-2" | |
echo $REGION region is used |
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
class DictAsObject: | |
def __init__(self, dic): | |
self._dict = dic | |
def __getattr__(self, name): | |
if name == "value": | |
return self._dict | |
v = self._dict[name] | |
return DictAsObject(v) |
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 re | |
list_one = ["apple", "orange", "banana", "pineapple", "watermelon"] | |
list_two = ["apple", "water"] | |
filter_func = lambda x, lst: all(i not in x for i in lst) | |
select_func = lambda x, lst: any(i in x for i in lst) | |
def intercept(list_one, list_two, select=True): | |
func = select_func if select else filter_func | |
return filter(lambda x: func(x, list_two), list_one) |
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 argparse | |
import logging | |
import os | |
import sys | |
parser = argparse.ArgumentParser(description='Read a teflon event file') | |
parser.add_argument("--log", choices=["NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], default="INFO", | |
help="Log level") | |
args = parser.parse_args() |
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
FROM ruby:2.7.1-alpine3.12 | |
RUN apk add --no-cache build-base nodejs nodejs-npm yarn sqlite-dev tzdata && \ | |
gem install nokogiri && \ | |
gem install rails | |
WORKDIR /app | |
COPY Gemfile /app |
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
# Ref: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-access-tokens.html | |
cat <<EOT >> creds.json | |
{ | |
"username": "perryism", | |
"token": "my_access_token", | |
"serverType": "GITHUB", | |
"authType": "OAUTH", | |
"shouldOverwrite": true | |
}EOT |
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
apiVersion: v1 | |
kind: Endpoints | |
metadata: | |
name: gpu-metrics | |
namespace: monitoring | |
labels: | |
app: gpu-metrics | |
release: prometheus | |
subsets: | |
- addresses: |
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
name: Deployment | |
on: [push] | |
jobs: | |
Build-App: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: |
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
from random import randrange | |
from datetime import datetime, timedelta | |
def random_date_between(start_date, end_date): | |
time_between_dates = end_date - start_date | |
days_between_dates = time_between_dates.days | |
random_number_of_days = randrange(days_between_dates) | |
return start_date + timedelta(days=random_number_of_days) | |
def random_date_from(start_date, time_between_dates): |