Skip to content

Instantly share code, notes, and snippets.

View cbschuld's full-sized avatar

Chris Schuld cbschuld

View GitHub Profile
@cbschuld
cbschuld / gist:cdcaf062da5b34eede37
Last active August 29, 2015 14:05
install haproxy 1.5.6 on ec2 amazon ami - updated 2014-10-28
#!/bin/sh
yum update -y
yum install -y wget git
wget "http://www.haproxy.org/download/1.5/src/haproxy-1.5.6.tar.gz"
yum groupinstall -y 'Development Tools'
yum install -y openssl-devel
yum install -y rpmdevtools pcre-devel
rpmdev-setuptree
mv haproxy-1.5.6.tar.gz ~/rpmbuild/SOURCES/
@cbschuld
cbschuld / install_bash4.md
Created July 10, 2018 22:17
Update MacOS / OSX to latest Bash from Brew (installing Bash 4 to MacOS)

First, install the latest bash using brew:

brew install bash

Next, add the local bash installation to the list of available shells by adding /usr/local/bin/bash to /etc/shells

sudo sh -c 'echo /usr/local/bin/bash >> /etc/shells'
@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' }
};
@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 / 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 / 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 / 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 / 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 / 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 / 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 &amp;&amp; \