Skip to content

Instantly share code, notes, and snippets.

View cbschuld's full-sized avatar

Chris Schuld cbschuld

View GitHub Profile
@cbschuld
cbschuld / gist:0ff036198de8456e86d7091aaa2231a7
Last active June 2, 2023 18:16
Installing Docker and docker-compose on AWS EC2 Amazon Linux 2

Installing Docker and docker-compose on AWS EC2 Amazon Linux 2

sudo yum update
sudo yum install docker
wget https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)
sudo mv docker-compose-$(uname -s)-$(uname -m) /usr/local/bin/docker-compose
sudo chmod -v +x /usr/local/bin/docker-compose
sudo systemctl enable docker.service
sudo systemctl start docker.service
@cbschuld
cbschuld / every-single-update.sh
Created April 25, 2021 22:09
Remove and Re-install Command Line Tools MacOS / OSX
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
@cbschuld
cbschuld / reset-password.md
Created September 15, 2020 15:39
Cognito: Reset User Password (admin) via command line

Reset a user's password on cognito via command line (admin)

This example uses named profiles for authentication and uses the aws command line (aws cli)

example:

read "?Region: " REGION && \
read "?Profile Name: " PROFILE && \
read "?Pool ID: " POOL && \
@cbschuld
cbschuld / update-all.md
Last active November 18, 2020 15:30
Update all of the packages in node without installing (via npx)

Node/Typescript/JS -- update all of the installed packages

npx -p npm-check-updates ncu -u
@cbschuld
cbschuld / remove-node_modules.md
Created September 1, 2020 04:22
Remove all of the node_modules directories

remove node_modules

Removes all of the node_modules directories in a single command from the CWD

find . -name "node_modules" -type d -exec rm -rvf '{}' +
@cbschuld
cbschuld / serverless-typescript-command.md
Created August 31, 2020 18:17
Create Serverless.com Project in TypeScript

serverless.com project with typescript

Creates a serverless.com project in TypeScript using keyboard input for the project name.

read "?Project Name: " PROJECT && PROJECT_NAME="$( echo -e "$PROJECT" | tr '.' '-' )" && serverless create --template aws-nodejs-typescript --path $PROJECT --name $PROJECT_NAME && cd $PROJECT && npm install
@cbschuld
cbschuld / homeassistant-check-configuration.md
Last active August 16, 2020 21:49
Check Home Assistant Configuration

Checking Home Assistant Configuration Files

My HA is hosted/enabled via Docker thus I need to get enter the docker directly OR call the configuration check directly.

Enter the Docker Container and Check

Move into the docker instance

docker exec -it homeassistant /bin/bash
@cbschuld
cbschuld / parameterStore.ts
Last active May 2, 2024 19:32
Obtain values from the AWS Parameter store with Typescript/node
import { SSM } from "aws-sdk";
const getParameterWorker = async (name:string, decrypt:boolean) : Promise<string> => {
const ssm = new SSM();
const result = await ssm
.getParameter({ Name: name, WithDecryption: decrypt })
.promise();
return result.Parameter.Value;
}
@cbschuld
cbschuld / upload-presignedurl-aws.md
Created September 13, 2019 21:51
Uploading Files to S3 using a PreSignedURL (using curl as well)

Uploading to a pre-signed URL in AWS

A few things you need to make sure you have done:

  • Need to make sure the user creating the presigned key has the ability to call PutObject on the target bucket
  • Need to make sure the bucket as the correct CORS on it

Bucket IAM Roles

In my use case I am using "serverless.com" - in serverless, it would look like this

@cbschuld
cbschuld / immer-patterns.md
Created August 3, 2019 21:50
Mutations Patterns for Immer in React JS

Object Mutations

import produce from "immer";

const todosObj = {
  id0: { done: true,  body: 'forget immer patterns' },
  id1: { done: false, body: 'remember the immer patterns' }
  id2: { done: false, body: 'finish project' }
};