Skip to content

Instantly share code, notes, and snippets.

View PoeBlu's full-sized avatar

Phillip Bristow PoeBlu

  • Eli Lilly
View GitHub Profile
@PoeBlu
PoeBlu / CloudCustodianSNStoDynamoDBTable.py
Created May 10, 2020 02:42 — forked from jtroberts83/CloudCustodianSNStoDynamoDBTable.py
AWS Lambda function code (python 3.6) which reads in a Cloud Custodian message, parses the fields and sends to a DynamoDB table
import json
import boto3
import random
def lambda_handler(event, context):
dynamodb = boto3.client('dynamodb')
Records = event['Records']
print(json.dumps(event))
for Record in Records:
@PoeBlu
PoeBlu / pre-push.sh
Created March 19, 2020 12:30 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@PoeBlu
PoeBlu / README.md
Created January 12, 2020 02:41 — forked from nitrocode/README.md
Cloud custodian iam policy in terraform

CloudCustodian IAM Policy

Extracts perms from cloud-custodian repo, sanitizes extracted data, and transforms into terraform

Dependency is ripgrep and git which can be installed using brew

brew install rg git

The code will

@PoeBlu
PoeBlu / bobp-python.md
Created December 19, 2019 16:50 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
import itertools
import os
import adaptive
import holoviews.plotting.mpl
import matplotlib
import matplotlib.cm
import matplotlib.tri as mtri
import numpy as np
from matplotlib import animation
# from includes.movie import convert
import os
import random
import traceback
from io import BytesIO
import torch
from flask import Flask, send_file
from pytorch_pretrained_biggan import (BigGAN, one_hot_from_names, truncated_noise_sample, convert_to_images)
import numpy as np
@PoeBlu
PoeBlu / proxy_for_terminal.md
Created October 18, 2019 15:33 — forked from fearblackcat/proxy_for_terminal.md
Set proxy for terminal on mac

Shadowsocks Proxy

apt-get install python-pip
pip install shadowsocks

sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start
@PoeBlu
PoeBlu / resource-visualisation-cartography.md
Created September 26, 2019 14:26 — forked from dmc-at-work/resource-visualisation-cartography.md
Resource Visualisation - Cartography

Resource Visualisation - Cartography

Via VM, Local Machine or Vagrant

Prerequisites

Operating System: Ubuntu 18.04

Prepare the following information

AWS Region (e.g. ap-southeast-1)
@PoeBlu
PoeBlu / simple_python_datasource.py
Created September 5, 2019 13:16 — forked from linar-jether/simple_python_datasource.py
Grafana python datasource - using pandas for timeseries and table data. inspired by and compatible with the simple json datasource
from flask import Flask, request, jsonify, json, abort
from flask_cors import CORS, cross_origin
import pandas as pd
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
@PoeBlu
PoeBlu / vault_logrotate
Created July 3, 2019 19:55 — forked from soloradish/vault_logrotate
logrotate setting file for HashiCorp's Vault audit file
# Change the path below to your own audit log path.
/var/log/vault/audit.log {
rotate 30
daily
# Do not execute rotate if the log file is empty.
notifempty
missingok
compress
# Set compress on next rotate cycl to prevent entry loss when performing compression.
delaycompress