Skip to content

Instantly share code, notes, and snippets.

View chinchalinchin's full-sized avatar

Grant Moore chinchalinchin

View GitHub Profile
@chinchalinchin
chinchalinchin / metric_code.py
Created April 12, 2025 03:38
The Invocation of Metric Code
"""
The Invocation of Metric Code
=============================
A Pythonic poem in (mostly) metric form.
Hacks until the devs publish a fix:
- "()", "[]", ".", ":", "_", "=" and "==" don't contribute!
- Comments are part of the poem! Except the first one!
terraform init
2024-09-05T16:16:13.333-0400 [INFO] Terraform version: 1.8.5
2024-09-05T16:16:13.333-0400 [DEBUG] using github.com/hashicorp/go-tfe v1.51.0
2024-09-05T16:16:13.333-0400 [DEBUG] using github.com/hashicorp/hcl/v2 v2.20.0
2024-09-05T16:16:13.333-0400 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-09-05T16:16:13.333-0400 [DEBUG] using github.com/zclconf/go-cty v1.14.3
2024-09-05T16:16:13.333-0400 [INFO] Go runtime version: go1.22.1
2024-09-05T16:16:13.333-0400 [INFO] CLI args: []string{"terraform", "init"}
2024-09-05T16:16:13.333-0400 [TRACE] Stdout is a terminal of width 192
2024-09-05T16:16:13.333-0400 [TRACE] Stderr is a terminal of width 192
@chinchalinchin
chinchalinchin / prime.py
Last active May 17, 2024 20:27
Sieve of Erastothenes Algorithm for Finding Prime Numbers
def _squares(n):
"""
Arguments:
n (int): arbitray integer
Returns:
a list of squares up to the value of ``n``.
"""
return [
@chinchalinchin
chinchalinchin / ci-template.yaml
Last active January 22, 2023 15:06
AWS Native Continuous Integration Example
AWSTemplateFormatVersion: '2010-09-09'
Description: "Resources for hooking continuous integration into a version control repository"
Parameters:
applicationName:
Type: String
Description: Name of the application
Default: demo
@chinchalinchin
chinchalinchin / optionBreakevenAnalysis.js
Last active January 23, 2023 16:49
Calculate breakeven point of an arbitrary portfolio of options
// single option strategy test
const legsTest = [
{
StrikePrice: 97,
Type: "put",
TransType: "buy",
Quantity: 100,
Ask: 1.55,
Bid: 1.53
}
@chinchalinchin
chinchalinchin / lambda-update-action.yml
Last active February 2, 2024 20:43
Lambda Update with ECR Image Github Action
name: lambda function update with ecr image github action
# see: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview
on:
workflow_call:
inputs:
# Non-defaultable inputs, must be passed in from the caller workflow.
# see: https://docs.github.com/en/actions/using-workflows/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow
FUNCTION_NAME:
description: Name of the function to deploy
@chinchalinchin
chinchalinchin / ecr-push-action.yml
Last active January 22, 2023 15:06
ECR Build and Push Github Action Workflow
name: ecr image build and push
# see: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview
on:
workflow_call:
inputs:
# Non-defaultable inputs, must be passed in from the caller workflow.
# see: https://docs.github.com/en/actions/using-workflows/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow
IMAGE_NAME:
description: Name of the image to build
@chinchalinchin
chinchalinchin / sphinx-docs-action.yml
Last active January 22, 2023 15:07
Sphinx GH Pages Github Action
# ensure `gh-pages` branch is initialized before executing this workflow
# assumes sphinx files reside in /docs/ folder, with a `requirements.txt` file inside of that directory, with the following:
# sphinx>=4.3.0
# sphinx-material>=0.0.35
# myst-parser>=0.15.2
# note: sphinx-material is not required, but myst-parser is required for MD parsing.
name: sphinx gh-pages action workflow
@chinchalinchin
chinchalinchin / blame-praise.py
Created September 16, 2022 18:09 — forked from amarao/blame-praise.py
Example of argparse with subparsers for python
#!/usr/bin/env python
import argparse
def main(command_line=None):
parser = argparse.ArgumentParser('Blame Praise app')
parser.add_argument(
'--debug',
action='store_true',
help='Print debug info'
@chinchalinchin
chinchalinchin / variance.py
Last active December 15, 2022 19:00
Young and Cramer's Recursive Variance Algorithm in Python
from typing import List, Union
import random
def recursive_sum_of_squares(
x: List[Union[float,int]],
checked: bool = False
) -> float:
n = len(x)