Skip to content

Instantly share code, notes, and snippets.

View jforge's full-sized avatar

jforge

  • Germany, Bargteheide
  • 15:09 (UTC +02:00)
View GitHub Profile
// Use this code snippet in your app.
// If you need more information about configurations or implementing the sample code, visit the AWS docs:
// https://aws.amazon.com/developers/getting-started/nodejs/
// Load the AWS SDK
var AWS = require('aws-sdk'),
region = "eu-central-1",
secretName = "amplify-console-app/githubAaccessToken",
secret,
decodedBinarySecret;
@jforge
jforge / extract-jsii.sh
Created December 16, 2019 06:31 — forked from eladb/extract-jsii.sh
Reflecting on the AWS CDK Type System using jsii-reflect
#!/bin/bash
set -euo pipefail
# given an aws-cdk bundle archive (the one published to github releases), extract
# all .jsii manifests and places them under "jsii/*.jsii"
# now they can be used with jsii-reflect
zip=${1:-}
if [ -z "${zip}" ]; then
echo "Usage: $(basename $0) <cdk-bundle-zip>"
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /usr/local/bin/docker:/usr/bin/docker --group-add root -it --rm jenkins bash
then docker ps
# missing group-add directive and the wrong group causes Permission Denied on the docker.sock file
# on an MacOs Mojave and docker desktop 2.1.0.5 with docker engine 19.03.5
# the --group-add root setting was neccessary at the time of writing.
#
# earlier solutions on that issue point to groups docker, jenkins, 100, or other groups
# the group-add directive as is seems to be common sense ;-)
@jforge
jforge / index.ts
Created November 6, 2019 10:36 — forked from mipearson/index.ts
Demonstration of using AWS CDK
/*
I was curious as to whether it was possible to make resources
created using CDK constructs work with raw CloudFormation
resources and vice versa.
This aws-cdk app demonstrates a VPC and an ELB that belongs to it
in different, dependant stacks, leveraging CFN outputs / imports,
and leveraging CDK's method of passing information from one
stack to another.
*/
@jforge
jforge / docker-build-publish.yaml
Created October 30, 2019 11:05 — forked from jonico/docker-build-publish.yaml
Build docker image and push to GPR with GitHub Actions
name: Build and publish Jekyll Docker image for Octocat Generator
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: clean up, docker login && docker build && docker push
console.log('Loading function');
const doc = require('dynamodb-doc');
const dynamo = new doc.DynamoDB();
/**
* Demonstrates a simple HTTP endpoint using API Gateway. You have full
* access to the request and response payload, including headers and
* status code.
# cloning only a specific branch
git clone --depth 1 -b <branch-name> <git-repo-url>
# ... into a separate directory
BRANCH_NAME="<branch-name>";git clone --depth 1 -b $BRANCH_NAME <git-repo-url> $BRANCH_NAME
# list remote branches
git ls-remote --heads <git-repo-url>
# ... or use --all
git branch --all
'use strict';
const zlib = require('zlib');
const content = `
<\!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Simple Lambda@Edge Static Content Response</title>
@jforge
jforge / lambda-basic-auth.js
Created October 1, 2019 08:13 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@jforge
jforge / rpi3_iot_server.md
Created September 11, 2019 15:11 — forked from xoseperez/rpi3_iot_server.md
Raspberry Pi 3 with Mosquitto, Node-RED, InfluxDB, Grafana and Nginx (as a reverse proxy)