ls-s3.sh:
#!/bin/bash
DATE=$1 || $(date +%Y-%m-%d)
echo "List records for date $DATE"
aws s3 ls s3://bucket-name/directory/ | grep ${DATE}| #!/bin/bash | |
| S3_BUCKET_NAME=$1 | |
| CF_ID=$2 | |
| # Sync all files except for service-worker and index | |
| echo "Uploading files to $S3_BUCKET_NAME..." | |
| aws s3 sync build s3://$S3_BUCKET_NAME/ \ | |
| --acl public-read \ | |
| --exclude service-worker.js \ |
| version: '3.1' | |
| services: | |
| reverse-proxy: | |
| image: traefik # The official Traefik docker image | |
| command: --api --docker # Enables the web UI and tells Traefik to listen to docker | |
| ports: | |
| - "80:80" # The HTTP port | |
| - "8080:8080" # The Web UI (enabled by --api) | |
| volumes: | |
| - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events |
| require('dotenv').config() | |
| const cors = require('cors') | |
| const bodyParser = require('body-parser') | |
| const express = require('express') | |
| const expressJwt = require('express-jwt') | |
| const cookieSession = require('cookie-session') | |
| const jwt = require('jsonwebtoken') | |
| const passport = require('passport') | |
| const GoogleStrategy = require('passport-google-oauth20').Strategy | |
| const jwtSecret = Buffer.from('Zn8Q5tyZ/G1MHltc4F/gTkVJMlrbKiZt', 'base64') |
| class Forbidden extends Error { | |
| constructor(message, status = 403) { | |
| super(message); | |
| this.status = status; | |
| } | |
| getStatus() { | |
| return Number.parseInt(this.status); | |
| } |
import rootReducer from '../my-rootreducer-dir';
function renderWithRedux(ui, { initialState, store = createStore(rootReducer, initialState) } = {}, renderFn = render) {
const obj = {
...renderFn(<Provider store={store}>{ui}</Provider>),
store,
};
obj.rerenderWithRedux = (el, nextState) => {| aws sts get-caller-identity |
Some things that are "better" with this BetterPromise implementation:
BetterPromise # then(..) accepts a BetterPromise (or Promise) instance passed directly, instead of requiring a function to return it, so that the promise is linked into the chain.
var p = BetterPromise.resolve(42);
var q = Promise.resolve(10);
p.then(console.log).then(q).then(console.log);| CREATE EXTENSION IF NOT EXISTS "unaccent"; | |
| CREATE OR REPLACE FUNCTION slugify("value" TEXT) | |
| RETURNS TEXT AS $$ | |
| -- removes accents (diacritic signs) from a given string -- | |
| WITH "unaccented" AS ( | |
| SELECT unaccent("value") AS "value" | |
| ), | |
| -- lowercases the string | |
| "lowercase" AS ( |