Skip to content

Instantly share code, notes, and snippets.

@chanan
chanan / auth.server.js
Created Dec 21, 2021
Cognito authentication method for Remix
View auth.server.js
import { redirect, createCookie } from "remix";
const sessionSecret = process.env.SESSION_SECRET;
const cognitoDomain = process.env.COGNITO_DOMAIN;
const clientId = process.env.CLIENT_ID;
if (!sessionSecret) {
throw new Error("SESSION_SECRET must be set");
}
if (!cognitoDomain) {
throw new Error("COGNITO_DOMAIN must be set");
@archisgore
archisgore / aws-cdk-s3-notification-from-existing-bucket.ts
Last active Jun 17, 2021
AWS CDK add notification from existing S3 bucket to SQS queue
View aws-cdk-s3-notification-from-existing-bucket.ts
import * as cr from '@aws-cdk/custom-resources';
import * as logs from '@aws-cdk/aws-logs';
import * as s3 from '@aws-cdk/aws-s3';
import * as sqs from '@aws-cdk/aws-sqs';
import * as iam from '@aws-cdk/aws-iam';
import {Construct} from '@aws-cdk/core';
// You can drop this construct anywhere, and in your stack, invoke it like this:
// const s3ToSQSNotification = new S3NotificationToSQSCustomResource(this, 's3ToSQSNotification', existingBucket, queue);
@bcnzer
bcnzer / cloudflareworker-verifyjwt.js
Last active Sep 23, 2022
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
View cloudflareworker-verifyjwt.js
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/
@johanneswuerbach
johanneswuerbach / rails-vagrant-provision.sh
Last active Jun 29, 2020
Provision a vagrant box with ruby stable (using rvm), postgres, redis and node (using nvm)
View rails-vagrant-provision.sh
#!/usr/bin/env bash
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8
sudo apt-get update
sudo apt-get install -y build-essential git curl libxslt1-dev libxml2-dev libssl-dev
# postgres
@dstroot
dstroot / install_postgresql.sh
Created Jun 13, 2012
Install PostgreSQL on Amazon AMI
View install_postgresql.sh
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"