Skip to content

Instantly share code, notes, and snippets.

View deric4's full-sized avatar
🌮
DevSecOpsLeanSREAgileWTFBBQ

deric4 deric4

🌮
DevSecOpsLeanSREAgileWTFBBQ
  • The Hood Canal
View GitHub Profile
@deric4
deric4 / python-pre-commit-hook-environment-prob.md
Created July 1, 2022 04:53
python pre-commit-hook environment

Problem:

possible for incorrect selection of cached python hook environments across projects (~/.cache/pre-commit/abcdCachedHookDir) that use different python versions

Scenario:

suppose you have 2 projects, project-a and project-b, configured for python3.7 and python3.10 respecitvely.

Each project has been configured with an identical .pre-commit-config.yaml file:

@deric4
deric4 / Dockerfile.base
Last active October 5, 2021 17:40
determining awcli installed
FROM ubuntu:18.04
RUN : \
&& set -eu \
&& apt-get -qq update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends \
build-essential \
curl \
unzip \
groff \
@deric4
deric4 / better-PR.md
Created September 30, 2021 01:20
expand PR comments

load more

javascript:Array.from(document.getElementsByClassName("ajax-pagination-btn")).forEach(l => l.click());

show hidden/resolved

javascript:Array.from(document.getElementsByClassName("Details-content--closed")).forEach(l => l.click());
@deric4
deric4 / CreateVssSnapshotAdvancedScript.ps1
Last active October 1, 2021 10:36
Script reference in CreatVSSSnapshot
# [AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/application-consistent-snapshots-creating-commands.html#application-cosistent-snapshots-cli)
#https://docs.aws.amazon.com/systems-manager/latest/userguide/samples/CreateVssSnapshotAdvancedScript.zip
function Freeze-Instance {
param(
[string]$InstanceId,
[string[]]$Devices,
[string[]]$Volumes
)
$DevicesString = $Devices -join ','
$VolumesString = $Volumes -join ','
@deric4
deric4 / input.json
Last active April 13, 2023 17:41
AWS Step Functions StateMachine Language JSONPath Gotchas
{
"a": {
"v": 1
},
"b": {
"v": 2
},
"c": {
"v": 3
}
@deric4
deric4 / example.pkr.hcl
Last active January 8, 2021 00:56
anthonywritescode #199 json -> hcl example
# variables.pkr.hcl
variable ami_name {
type = string
default = "my-ami"
}
variable ami_owner {
type = list(string)
default = [
@deric4
deric4 / crash.log
Last active March 24, 2020 06:17
packer build w/ hcl2 crash log
2020/03/23 22:42:49 [INFO] Packer version: 1.5.4 [go1.13.8 darwin amd64]
2020/03/23 22:42:49 Checking 'PACKER_CONFIG' for a config file path
2020/03/23 22:42:49 'PACKER_CONFIG' not set; checking the default config file path
2020/03/23 22:42:49 Attempting to open config file: /Users/<my user>/.packerconfig
2020/03/23 22:42:49 [WARN] Config file doesn't exist: /Users/<my user>/.packerconfig
2020/03/23 22:42:49 Setting cache directory: /Users/<my user>/projects/common-libs/packer-lw-ubuntu1604/packer_cache
2020/03/23 22:42:49 Creating plugin client for path: /usr/local/bin/packer
2020/03/23 22:42:49 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-amazon-ebs"}
2020/03/23 22:42:49 Waiting for RPC address for: /usr/local/bin/packer
2020/03/23 22:42:49 packer-builder-amazon-ebs plugin: [INFO] Packer version: 1.5.4 [go1.13.8 darwin amd64]
@deric4
deric4 / Dockerfile
Last active September 4, 2020 00:29
docker sam-cli min size
FROM python:3.8-alpine AS builder
WORKDIR /app
ARG BUILD_DEPS="build-base gcc libffi-dev openssl-dev"
RUN apk add --no-cache ${BUILD_DEPS} \
&& python -m venv .venv \
&& .venv/bin/pip install --no-cache-dir -U pip setuptools
RUN .venv/bin/pip install --no-cache-dir aws-sam-cli \
@deric4
deric4 / debugging-steps.md
Last active February 10, 2020 23:54
pdx-python-pirates:contextmanager:new_log_file()

Initial program

from contextlib import contextmanager
from shutil import copy
from os import getcwd
@contextmanager
def new_log_file(name):
    try:
        logname = name
        f = open(logname, "w")
cat python dog cat python python
dog fish lizard bird cat
python cats fish
python dogs