Skip to content

Instantly share code, notes, and snippets.

View jasonacox's full-sized avatar

Jason Cox jasonacox

View GitHub Profile
@jasonacox
jasonacox / pi.py
Created March 12, 2024 06:04
Calculate Pi to a defined number of decimal places using Archimedes method.
from decimal import Decimal, getcontext
def pi_archimedes(n):
"""
Calculate Pi using Archimedes method with n iterations to estimate Pi.
This method approximates Pi by calculating the perimeter of a polygon inscribed
within a unit circle.
Polygon edge lengths are computed using the Pythagorean theorem and the geometry of the polygons.
The number of sides of the polygon is also doubled in each iteration, as each side of the
@jasonacox
jasonacox / Container Architectures.md
Created February 24, 2024 05:52
Container Architectures

Container Architectures

List of docker / containerd architectures

Architecture Description Notes
linux/amd64 64-bit x86 architecture AMD and intel CPUs
linux/arm64 64-bit ARM architecture ARM CPUs like Apple Silicon
linux/arm/v7 32-bit ARM architecture Raspberry Pi 3/4 32-bit
linux/ppc64le 64-bit PowerPC architecture
@jasonacox
jasonacox / resize-image.py
Created July 31, 2021 04:36
Python script to resize all images in a directory
# Resize Images in Directory
#
# Provided target frame size (TARGETX, TARGETY) this script will scan current
# directory and scale up an image (keeping same ratio) to best fit. I used
# this to fix images for a photo frame that would only scale down images but
# would not scale up.
#
# Jason A Cox - github.com/jasonacox
# 2021 July 30
#
@jasonacox
jasonacox / travis-ci-xcode-s3.md
Last active August 17, 2020 07:06
Travis-CI for Xcode Mac, iOS and tvOS Development using AWS S3 for Build Storage

Travis-CI for Xcode with S3

This gist explains to set up your repo to have Travis CI build your Xcode projects for Mac, iOS and tvOS development. The binaries built from one stage will not persist between stages so you will need to store any build artifacts in S3 and import them between stages.

Setup

There are a few things that you will need to do in order to use S3 with a Mac build node:

Create S3 Bucket

  • Create a IAM user with permission to access S3 bucket - example:

Keybase proof

I hereby claim:

  • I am jasonacox on github.
  • I am jasonacox (https://keybase.io/jasonacox) on keybase.
  • I have a public key ASA2YKK3bHIo1ZDKge3O4uxU3aNF2DDABEGovM3lFUPfQgo

To claim this, I am signing this object: