Skip to content

Instantly share code, notes, and snippets.

View m0un10's full-sized avatar

Craig Barr m0un10

View GitHub Profile
@m0un10
m0un10 / latest-git-on-earlier-redhat.md
Last active September 5, 2023 13:42
Installing latest Git on older RedHat Linux derivatives
View latest-git-on-earlier-redhat.md

The default Git that ships with older versions of RedHat-derivates such as (Centos 6, Oracle Linux 6 and of course RedHat 6 itself) may be quite old. If it is a version such as 1.7.1 or earlier, you won't be able to use git with other tools that requirer newer versions such as Jenkins. Below are the steps to install (or upgrade to) a newer version of git. Thanks to Tim for the original article here.

The following should be performed as a root user or with sudo.

If an older Git is already installed, run this to remove it:

yum remove git -y

Install the prerequisite packages and remove the any current Git installation.

View stripe-mock-on-k8s.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: stripe-mock
spec:
selector:
matchLabels:
app: stripe-mock
replicas: 2 # tells deployment to run 2 pods matching the template
View Learning Node JS.md

NodeJS

Basics

Useful default objects in different runtimes:

  • Chrome runtime on V8
    • window
    • document
  • fetch() for calling APIs
@m0un10
m0un10 / data.yml
Last active October 13, 2020 09:44
YTT with overlay for single item from array
View data.yml
#@data/values
---
resources:
- uri: /service-A/v1
name: this-is-a-test
- uri: /service-A/v2
name: this-is-also-a-test
View GCR get image metadata.md
BEARER=$(curl -u _token:$(gcloud auth print-access-token) https://gcr.io/v2/token?scope=repository:$NAME:pull | cut -d'"' -f 10)
RESPONSE=`curl -H "Authorization: Bearer $BEARER" https://gcr.io/v2/$NAME/manifests/$TAG`
DIGEST=`echo $RESPONSE | jq -r '.config.digest'`
curl -L -H "Authorization: Bearer $BEARER" https://gcr.io/v2/$NAME/blobs/$DIGEST | jq
View GCP cached permissions issue.md

GCP cached permissions issue

GCP has an issue which surfaces when service accounts are recreated with the same name but without the old policies being removed. It is confusing because the GUI and CLI will show that permissions are there and it will even let you re-add them BUT, anytime you try to do something that requires the permissions it won't work. For example, if you try to push an image it may say that you don't have storage.buckets.get even thought everything shows that you are part of storage.admin.

Reproducing the issue

Set the values to match your environment

export ACCOUNT=<service-account>
View serverless-stack.com with SAM.md

serverless-stack.com with SAM

...as an alternative to the Serverless Framework.

Key Differences

  • SAM templates result in Cloudformation stacks. This has a benefit of ensuring all the resoures are defined together and allows the management from a GUI.
  • SAM requires that IAM policies to be defined at the function level rather than globally as per the Serverless Framework. According to the SAM docs, this was a design decision to reduce the risk of functions being granted more permissions than they need.
  • Enabling CORS in SAM requires the specific allowed methods and headers to be provided. This is as opposed to Serverless Framework where it is just an on/off flag.
  • SAM supports parameters to be passed to the template at deploy/test-time. Serverless Framework achieves this with environment variables.
View Troubleshooting.md
View Mulesoft Notes.md
  • API-lead connectivity: A methodical way to connect applications, data, and devices through reusable and purposeful APIs; the opposite of point-to-point integration.
  • Application Network: A network of applications, data, and devices connected by reusable APIs, each built with the principles of API-led connectivity.
  • Anypoint Platform: MuleSoft's platform that provides many tools to design, build, deploy, and operate the application network.

  • System APIs: unlock data from systems
  • Process APIs: compose data into processes
  • Experience APIs: deliver an experience