Skip to content

Instantly share code, notes, and snippets.

View yai333's full-sized avatar

Yi Ai yai333

  • Melbourne
View GitHub Profile
@yai333
yai333 / config.yml
Last active January 15, 2019 15:47
config.yml
defaults: &defaults
docker:
- image: circleci/node:8
version: 2
jobs:
pre-build:
working_directory: ~/gatsbyBlog
<<: *defaults
steps:
@yai333
yai333 / Dockerfile
Last active April 16, 2019 00:21
Node Python Nginx Selenium Chrome Pytest all in one
FROM ubuntu
USER root
ENV BUNDLE_SILENCE_ROOT_WARNING=1
RUN apt-get update && apt-get -y install curl gnupg unzip wget
# Install Nginx.
RUN set -ex && \
apt-get install -y software-properties-common && \
import pytest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def pytest_addoption(parser):
parser.addoption("--url", action="store", default="http://localhost", help="url")
@pytest.fixture(scope="module", autouse=True)
def browser():
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
@pytest.fixture(scope="module")
def open_url(browser,url):
browser.get(url)
browser.find_element(By.TAG_NAME, "form")
assert browser.title == "React App"
@yai333
yai333 / app.js
Last active February 4, 2019 05:38
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from "react";
import {
service: simple-data-pipline # NOTE: update this with your service name
provider:
name: aws
runtime: python3.6
region: ap-southeast-2
stage: ${opt:stage, 'dev'}
timeout: 300
iamRoleStatements:
import boto3
import os
import pandas as pd
import logging
db_client = boto3.client('dynamodb')
s3 = boto3.client('s3')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
service: serverless-chat
provider:
name: aws
runtime: nodejs8.10
stackName: ${self:service}-${self:provider.stage}
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'ap-southeast-2'}
iamRoleStatements:
- Effect: Allow
"use strict";
const AWS = require("aws-sdk");
const Bluebird = require("bluebird");
AWS.config.update({ region: process.env.AWS_REGION });
const DDB = new AWS.DynamoDB({ apiVersion: "2012-10-08" });
AWS.config.setPromisesDependency(Bluebird);
require("aws-sdk/clients/apigatewaymanagementapi");
const successfullResponse = {
Resources:
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: ${self:custom.poolName}
Schema:
- Name: email
Required: true
Mutable: true
AdminCreateUserConfig: