text:
# Aurora Serverless Flyway DB

Aurora Serverless Flyway DB is a template project that is used to setup an [Amazon Aurora Serverless Database](https://aws.amazon.com/rds/aurora/serverless/) that is integrated with [Flyway](https://flywaydb.org/) to manage database migrations. This integration is accomplished through the use of an [AWS ECS Fargate](https://aws.amazon.com/fargate) task along with the help of [GitHub Actions](https://github.com/features/actions).

## Contents
- [Overview](#overview)
  - [AWS](#aws)
  - [Terraform](#terraform)
  - [Flyway](#flyway)
  - [GitHub Actions](#github-actions)
- [Getting Started](#getting-started)
  - [Repository Setup](#repository-setup)
  - [Secrets Manager Setup](#secrets-manager-setup)
    - [Adding New Database Users](#adding-new-database-users)
  - [Terraform Infrastructure Setup](#terraform-infrastructure-setup)
    - [Aurora-DB](#aurora-db)
    - [ECS-Cluster](#ecs-cluster)
    - [Fargate-IAM](#fargate-iam)
    - [Flyway-Fargate-Task](#flyway-fargate-task)
    - [Bastion](#bastion)
  - [GitHub Actions Config Setup](#github-actions-config-setup)
    - [Infrastructure Config Object](#infrastructure-config-object)
    - [Infrastructure Region Config Object](#infrastructure-region-config-object)
    - [Aurora DB Config Object](#aurora-db-config-object)
    - [Flyway Task Config Object](#flyway-task-config-object)
    - [Bastion Config Object](#bastion-config-object)
  - [Deploy Infrastructure](#deploy-infrastructure)
    - [Destroy Infrastructure](#destroy-infrastructure)
  - [Build Flyway Docker Image](#build-flyway-docker-image)
  - [Run Flyway Migration](#run-flyway-migration)
  - [Generate Markdown](#generate-markdown)
  - [Create Snapshot](#create-snapshot)
  - [Restore Snapshot](#restore-snapshot)
- [Local Database](#local-database)
- [Connecting to the Database](#connecting-to-the-database)
  - [PGAdmin](#pgadmin)
  - [PSQL](#psql)
- [Database Documentation](#database-documentation)

## Overview

This section will give an overview of some of the technologies used for this project.

![aurora-flyway-infrastructure](assets/aurora-flyway-infrastructure.png)

### AWS

#### Amazon Aurora Serverless

[Amazon Aurora Serverless](https://aws.amazon.com/rds/aurora/serverless/) is a database solution that is able to automatically start, stop, and scale capacity up and down based on usage making it a very cost-effective and easy to manage option for running a database.

#### AWS Fargate

[AWS Fargate](https://aws.amazon.com/fargate/) is a serverless compute engine for containers. With Fargate we are able to run a docker container with flyway from the same VPC that the Amazon Aurora Serverless Database Cluster is in.

#### AWS Secrets Manager

[AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) is a solution to store and protect applications secrets. It is used in this project to store user credentials for the database, a private key to an SSH key pair with the public key set as a Deploy Key on this repository, and the credentials for a Docker Registry. If using GitHub Packages to store the Flyway Docker image generated by the `flyway-build-docker-image-workflow`, the credentials will be from a Personal Access Token to this repo with `repo`, `write:packages`, and `read:packages` permissions.

**Note**: If using GitHub Packages, you will need to use the Container Registry and not the Docker Registry. Click [here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry) for details on migrating to the Container Registry from the Docker Registry. You will need to enable improved container support for your user or organization account to use the Container Registry. The steps to do so can be found [here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/enabling-improved-container-support-with-the-container-registry).

#### AWS EC2

In order to limit access to this database, an [Amazon EC2](https://aws.amazon.com/ec2) is used as a [bastion host](https://aws.amazon.com/quickstart/architecture/linux-bastion/) or gateway in the same subnet as the Aurora Serverless Database. By establishing an SSH connection to the bastion host, we are then able to connect to the RDS database through localhost port 5432.

### Terraform

[Terraform](https://www.terraform.io/) is an infrastructure as code solution used to provision and manage all of the AWS infrastructure used in this project, other than S3 and Secrets Manager resources. The Terraform files are located in the `infrastructure/` folder by each main component in a subfolder. Available variables and default values can be found in the `variables.tf` files of each subfolder. They can be configured using `<region>.tfvars` files in the `var-files/` folder.

![terraform-folder-structure](assets/terraform-folder-structure.png)

### Flyway

[Flyway](https://flywaydb.org/) is an open source tool for managing database migrations. Flyway will search through all files in the `sql/` folder finding any file that matches `V<version>__<Version_Description>.sql` for versioned migrations or `R__<Procedure_name>.sql` for repeatable migrations. Flyway is only concerned with the names of the individual files and does not actually care about the structure. The structure is just for developers to better organize their code.

Versioned migrations are migrations that are executed in order according to their version. This is important to keep in mind when creating a migration that could depend on another migration (ex: Table A column references Table B so the Table A migration would need to have a lower version and be applied first). Flyway keeps track of the current database version using the `flyway_schema_history` table.

Repeatable migrations are migrations that are reapplied every time their checksum changes (every time the file is modified). These are good for database objects that can be maintained in a single file in version control, such as stored procedures and bulk inserts. Repeatable migrations are always applied after versioned migrations.

![flyway-folder-structure](assets/flyway-folder-structure.png)

### GitHub Actions

[GitHub Actions](https://github.com/features/actions) is a CI/CD solution through GitHub that allows for the creation of workflows for this project. These workflows are used to manage infrastructure using terraform, manage the aurora serverless database through the creation and restoration of database snapshots, trigger a standalone ECS task to run flyway migrations on the database, build the docker image for this repo configured to run flyway from the ECS task, and even generate the database schema as markdown and append it to this `README.md` file.

## Getting Started

This section will go over the steps to setup this project and get a database up and running.

### Repository Setup

1. Above this repository's file list, click the **Use this template** button.
2. Follow the prompts to set the repository owner, name, and visibility and to optionally include all branches if desired.
3. In the new repository, navigate to **Actions** from the top menu bar and click **Enable Actions on this repository**.
4. Navigate to **Settings -> Secrets** and click **New secret**
5. Add a secret for `AWS_ACCESS_KEY_ID` for the AWS account credentials.*
6. Repeat step 4 and add a secret for `AWS_SECRET_ACCESS_KEY` for the AWS account credentials.
7. Navigate to **Settings -> Deploy Keys** and click **Add deploy key**. **
8. In a terminal, run `ssh-keygen -m PEM -t rsa -b 4096 -C "<repository_name> read-repository" -f <file_path>`
   - Example: `ssh-keygen -m PEM -t rsa -b 4096 -C "aurora-serverless-flyway-db read-repository" -f ~/.ssh/aurora-serverless-flyway-db`
9.  Back in GitHub, copy the contents of the public key file generated from the `ssh-keygen` command into the **Key** section. The public key file will be in the format of `<file_path>.pub`.
10. Add a title and click **Add key**. Write access is not needed for this deploy key.
11. Click the profile picture in the top right corner and click **Settings**
12. Click **Developer settings** in the settings menu.
13. Select **Personal access tokens** and click **Generate new token**. ***
14. Select `repo` and `read:packages` scope and click **Generate token**.
15. Copy the generated token and store it in a secure location.
  - This token will be used by the Flyway task to pull the docker image. It can also be used to trigger GitHub actions by creating `repository_dispatch` events.

*Click [here](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html) for help with AWS credentials.

** Click [here](https://docs.github.com/en/developers/overview/managing-deploy-keys) for help with GitHub Deploy Keys.

*** Click [here](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) for help with GitHub Personal Access Tokens.

### Secrets Manager Setup

1. Login to the AWS console.
2. Navigate to **Services -> Secrets Manager**.
3. Click **Store a new secret**.
4. Select **Other type of secrets**.
5. Under **Specify the key/value pairs to be stored in this secret**, select **Plaintext** and copy the contents of the private key for the deploy key generated in step 8 of [Repository Setup](#repository-setup).
6. Select an encryption key or use the `DefaultEncryptionKey` and click **Next**.
7. Specify a **Secret name** and **Description** for the secret and click **Next**.
     Ex: `github@<repo_owner>@<repo_path>@repository-deploy-key`.
8. Select **Disable automatic rotation** and click **Next**.
9. Click **Store**.
10. Repeat steps 3-9 to store the personal access token from step 15 of [Repository Setup](#repository-setup). Instead of storing the value as plaintext, store it as **Secret key/value**. The pairs are:
    - key: `username`, value: the username used to create the personal access token
    - key: `password`, value: the personal access token from the generate token step
      - Example secret name: `github@<github_user>@registry_token`
11. Repeat steps 3-9 to store a username and secure password key value pair for the master credentials of the database.
    - Example secret name: `<db_engine>@<dbname>@<db_table>@<db_user_name>`
      -  Ex: `postgresql@auroradb@master@sqladmin`
12. Repeat steps 3-9 to store username and secure password key value pairs for any additional database users. This process will also be used to add new users during development.
    - The additional users used in the sample sql code are:
      - `postgresql@auroradb@master@read_only`
      - `postgresql@auroradb@sample@sample_application`

#### Adding New Database Users

As mentioned above, Secrets Manager can be used to store credentials for new users during development. This is done by creating a versioned migration that will use [Flyway Placeholders](https://flywaydb.org/documentation/configuration/placeholder) for the password value. Mock values can be used for the local setup which is gone over in more detail in the [Local Database](#local-database) section. To create a placeholder in the SQL code, use a key name surround by `${}` in your sql file. Then, supply the placeholder a value in the flyway options `-placeholders.<key>=<value>`. See the [read-only user creation](./sql/v1.0/V1.0.0__CreateReadOnlyUser.sql) and [docker-compose.yml](./docker-compose.yml) for an example of how to create and supply values to a placeholder.

Once the secret has been created and stored in Secrets Manager in the same way as above and the placeholder has been added to the SQL code, the following files need to be updated to retrieve or supply values for the placeholder:

These steps will assume a placholder of `TEMP_USER_PASSWORD` and a secret named `postgresql@auroradb@sample@temp_user`

- [docker-compose.yml](./docker-compose.yml)
  - Add the placeholder and a mock value to the list of command arguments send to the `flyway` image. This password is only used on the Local Database.
    - ```yml
      flyway:
        ...
        command: [
            ...
            "-placeholders.TEMP_USER_PASSWORD=password",
            "migrate"
        ]
      ```
- [docker/scripts/flyway-rds-migration.sh](./docker/scripts/flyway-rds-migration.sh)
  - Add the Secrets Manager call to retrieve the password in the `# Get DB user Passwords` section and add the result to the `FLYWAY_OPTIONS` array as a placeholder value.
    - ```sh

      ...

      # Get DB user Passwords
      ...
      TEMP_USER_PASSWORD=$(aws secretsmanager get-secret-value --secret-id postgresql@auroradb@sample@temp_user --region "${REGION}" --query SecretString --output text | jq -r '.password')

      ...

      FLYWAY_OPTIONS=(
          ...
          "-placeholders.TEMP_USER_PASSWORD=${TEMP_USER_PASSWORD}"
      )
      ...
      ```
- [.github/actions/generate-markdown-action/entrypoint.sh](./.github/actions/generate-markdown-action/entrypoint.sh)
  - Add a mock value to the placeholder value in the `FLYWAY_OPTIONS` array. This action uses an empty database to just generate the schema on a docker image before destroying it so the value is not important
    - ```sh
      ...
      FLYWAY_OPTIONS=(
          ...
          -placeholders.TEMP_USER_PASSWORD=password
      )

      ...
      ```

*Hint*: A random password can be generated using

```sh
openssl rand -base64 29 | tr -d "=+/" | cut -c1-25
```

### Terraform Infrastructure Setup

The Terraform infrastructure is split into the the following sections:

- [Aurora-DB](#aurora-db)
- [ECS-Cluster](#ecs-cluster)
- [Fargate-IAM](#fargate-iam)
- [Flyway-Fargate-Task](#flyway-fargate-task)
- [Bastion](#bastion)

Each section has a `variables.tf` file describing the variables that can be provided for the infrastructure and any default values if there are any. These variables are provided via `var-files/<region>.tfvars` files (Ex: `var-files/us-west-2.tfvars`). Default values can be overridden by providing a new value in the variable file. Variables that do not have a default definied in `variables.tf` are required and must be set in the region's `.tfvars` file.

An S3 Bucket to store Terraform state files is required.

#### **Aurora-DB**

The infrastructure files to create the Aurora DB Cluster. The following resources are created as a part of this infrastructure section.

- AWS DB Subnet Group
- AWS RDS Cluster
- AWS Security Group

The Security Group created allows ingress on port 5432 from the same subnet as the database as well as any other resource that is assigned the created security group.

The available variables and default values are as follows:

| name | type | description | default |
| ---- | ---- | ----------- | ------- |
| `region` | string | The AWS region | `N/A` |
| `vpc_name` | string | The name of the VPC to create DB in | `N/A` |
| `subnet_names` | list(string) | A list of subnets for the DB subnet group | `N/A` |
| `availability_zones` | list(string) | A list of availability zone the DB can be in | `N/A` |
| `security_group_names` | list(string) | An optional list of additional security groups to assign to the DB instance | `[]` |
| `master_credentials_secret` | string | The name of the secret containing the credentials for the DB master user | `N/A` |
| `db_sg_name` | The name of the DB Security Group that will be created | `auroradb-sg` |
| `db_subnet_group_name` | string | The name of the DB Subnet Group that will be created | `auroradb-subnet-group` |
| `db_cluster_name` | string | The name of the AWS RDS Database Cluster | `auroradb-cluster` |
| `db_name` | string | The name for the database on the Aurora DB Cluster | `auroradb` |

Example config for us-west-2 is provided in `var-files/us-west-2.tfvars`.

```
region = "us-west-2"

vpc_name = "default-us-west-2"

subnet_names = ["default-us-west-2a", "default-us-west-2b", "default-us-west-2c"]

availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]

master_credentials_secret = "postgresql@auroradb@master@sqladmin"
```

#### **ECS-Cluster**

The infrastructure files to create an ECS Cluster and Cloudwatch Log Group. An existing ECS Cluster may be used if the name is provided in the `config.json` file as specified in the [Flyway Task Config Object](#flyway-task-config-object) subsection of the [GitHub Actions Config Setup](#github-actions-config-setup) section.

The available variables and default values are as follows:

| name | type | description | default |
| ---- | ---- | ----------- | ------- |
| `region` | string | The AWS region | `N/A` |
| `cluster_name` | string | The name of the ECS Cluster | `ecs-cluster` |
| `ecs_log_group_name` | string | The name of the cloudwatch log group to create for the ECS Cluster | `/ecs_logs` |

Example config for us-west-2 is provided in `var-files/us-west-2.tfvars`.

```
region = "us-west-2"
```

#### **Fargate-IAM**

The infrastructure files to create an IAM role. This role can be assumed by an ECS Task and has the permissions for KMS Decryption, Cloudwatch Create Log Stream and Put Log Events, and Secrets Manager Get Secret Value. An existing IAM role may be used so long as it is provided to the [Flyway Fargate Task](#flyway-fargate-task) `task_iam_role` variable.

The available variables and default values are as follows:

| name | type | description | default |
| ---- | ---- | ----------- | ------- |
| `region` | string | The AWS region | `N/A` |
| `flyway_migration_role_name` | string | The AWS IAM Role name for the Flyway Migration ECS Task | `flyway-migration-role` |
| `flyway_migration_policy_name` | string | The AWS IAM Policy for the Flyway Migration IAM Role | `flyway-migration-policy` |

Example config for us-west-2 is provided in `var-files/us-west-2.tfvars`.

```
region = "us-west-2"
```

#### **Flyway-Fargate-Task**

The infrastructure files to create the Flyway Fargate Task to run migrations on the [Aurora-DB](#aurora-db) cluster. This creates a Task Definition and a Security Group with all outbound access allowed. This is required for the Fargate Task to have access to the internet to pull SQL code from this project.

The available variables and default values are as follows:

| name | type | description | default |
| ---- | ---- | ----------- | ------- |
| `region` | string | The AWS region | `N/A` |
| `vpc_name` | string | The name of the AWS VPC to create the Flyway Fargate Security Group in | `N/A` |
| `registry_token` | string | The name of the Secrets Manager secret containing the docker image for the Flyway Fargate Task | `N/A` |
| `auroradb_cluster_name` | string | The name for the auroradb cluster | `N/A` |
| `task_name` | string | The name of the fargate task | `flyway-migration` |
| `task_family_name` | string | The name of the fargate task family | `flyway-migration-family` |
| `task_iam_role` | string | The IAM role for the flyway fargate task. Req: `kms:Decrypt`, `secretsmanager:GetSecretValue` | `N/A` |
| `task_sg_name` | string | The name for the Flyway Fargate Security Group that will be created | `flyway-fargate-sg` |
| `app_image` | string | The docker image for the fargate task | `N/A` |
| `app_version` | string | The version of the docker image to use for the fargate task | `N/A` (will be auto-updated by the `build-flyway-docker-image-workflow.yml` GitHub workflow) |
| `repository_deploy_key_secret` | string | The name of the AWS Secrets Manager secret holding the GitHub Deploy Key (SSH Key) | `N/A` |
| `repository_owner` | string | The owner of the git repository. Ex: `sharebuilder-401k` for the repo `https://github.com/sharebuilder-401k/aurora-serverless-flyway-db` | `N/A` |
| `repository_path` | string | The path for the git repository. EX: `aurora-serverless-flyway-db` for `https://github.com/sharebuilder-401k/aurora-serverless-flyway-db` | `N/A` |
| `cloudwatch_log_group` | string | The name of the cloudwatch log group to send the ECS logs to | `N/A` |

Example config for us-west-2 is provided in `var-files/us-west-2.tfvars`. This example assumes values specific to this repository and should be changed to match the repository created from this template.

```
region = "us-west-2"

vpc_name = "default-us-west-2"

registry_token = "github@mreed19@registry_token" # CHANGE ME

auroradb_cluster_name = "auroradb-cluster"

task_iam_role = "flyway-migration-role"

repository_deploy_key_secret = "github@Sharebuilder-401k@aurora-serverless-flyway-db@repository-deploy-key" # CHANGE ME

repository_owner = "sharebuilder-401k" # CHANGE ME

repository_path = "aurora-serverless-flyway-db" # CHANGE ME

app_image = "ghcr.io/sharebuilder-401k/aurora-serverless-flyway-db/flyway" # CHANGE ME

app_version = "0.0.0"

cloudwatch_log_group = "/ecs_logs"
```

#### **Bastion**

The infrastructure files to create a Bastion Host EC2 Instance. This instance will be used to establish an SSH Tunnel into the same VPC as the Aurora DB instance so a connection can be established from a local system. An `sshtunnel.sh` script has been provided if this method is used to establish a connection.

An AWS Security Group is created allowing SSH ingress to the host from a provided list of CIDR ranges (IP Addresses). While the SSH key helps to secure the instance, it is always a good idea to limit access to only the CIDR ranges that will be accessing the instance.

An SSH key pair is required to connect to the Bastion Host Instance. This key pair can be generated using the same command as step 8 in [Repository Setup](#repository-setup).

`ssh-keygen -m PEM -t rsa -b 4096 -C "<description>" -f <file_path>`

The public key (.pub file) generated by the above command needs to be stored in S3 to be used for this setup.

The available variables and default values are as follows:

| name | type | description | default |
| ---- | ---- | ----------- | ------- |
| `region` | string | The AWS region | `N/A` |
| `vpc_name` | string | The name of the VPC to deploy the bastion host in | `N/A` |
| `subnet_names` | list(string) | The list of subnet names to deploy the bastion host in | `N/A` |
| `bastion_sg_name` | string | The name of the bastion security group to be created | `bastion-sg` |
| `ingress_cidrs` | list(string) | The list of cidr ranges allowed to connect to the bastion host | `N/A` |
| `bastion_key_name` | string | The name of the Key pair used to connect to the bastion host | `bastion-key-pair` |
| `public_key_bucket` | string | The S3 bucket that the public key file for the bastion key pair is stored in | `N/A` |
| `public_key_path` | string | The S3 path to the public key file for the bastion key pair | `N/A` |
| `bastion_host_name` | string | The name of the bastion host | `bastion-host` |

Example config for us-west-2 is provided in `var-files/us-west-2.tfvars`. The `public_key_bucket`, `public_key_path` and `ingress_cidrs` should be changed to point to the location of your public key in S3 and the `ingress_cidrs` should be changed to the CIDR ranges you would like to allow access to.

```
region = "us-west-2"

vpc_name = "default-us-west-2"

subnet_names = ["default-us-west-2a", "default-us-west-2b", "default-us-west-2c"]

public_key_bucket = "sharebuilder401k-ssh-keys-us-west-2" # CHANGE ME

public_key_path = "public/bastion-host-key.pub" # CHANGE ME

ingress_cidrs = ["<IP_ADDRESS>/0"] # CHANGE ME
```

### GitHub Actions Config Setup

This project uses a `config.json` file to configure values for the GitHub Actions Workflow. Since GitHub Actions does not currently support manually invoking workflows from the GitHub actions console, `trigger_workflow.sh`, a script to invoke workflows through the use of [`repository_dispatch`](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#repository_dispatch) events, has been included with the project. This script will parse `config.json` to retrieve values to build the HTTP request and payload to generate the `repository_dispatch` event.

The `config.json` values are as follows:

| property | description | required | default |
| -------- | ----------- | -------- | ------- |
| `flywayVersion` | The version of the docker image generated by the `build-flyway-docker-image-workflow` to be used by the ECS Fargate Task | true | `"0.0.0"` |
| `githubOwner` | The owner of the GitHub repository. Could be a user or organization. | true | `"CHANGE ME"` |
| `githubRepo` | The path of the GitHub repository. Does not include owner. | true | `"CHANGE ME"` |
| `gitbotEmail` | The email used to make automated commits to this repo (Updating `app_version` in `infrastructure/flyway-fargate-task/var-files/*.tfvars` on new flyway image build, updating metadata reference on new RDS snapshot creation, or updating `README.md` with the database schema from running flyway on `sql/`) | false |<EMAIL_ADDRESS>|
| `gitbotName` | The name used to make automated commits to this repo | false | `"aurora-gitbot"` |
| `githubTokenName` | The environment variable name storing a GitHub Personal Access Token with `repo` scope to invoke GitHub actions using the `trigger_workflow.sh` script. | true | `"GITHUB_AURORA_ACTIONS_TOKEN"` |
| `dockerRegistry` | The host name of the docker registry where the image for this repository to run flyway from ECS will be stored. | true | `"ghcr.io"` |
| `dockerOwner` | The owner or organization where the docker image will be stored in the docker registry | true | `"CHANGE ME"` |
| `dockerRepo` | The repo path where the docker image will be stored in the docker registry (does not include owner) | true | `"CHANGE ME"` |
| `infrastructure` | An [Infrastructure Config Object](#infrastructure-config-object) | true | An object configured with default values from the [Infrastructure Config Object](#infrastructure-config-object) section |

#### **Infrastructure Config Object**

An object with properties for each region to configure values to be used by GitHub actions. These values should match what is configured in the terrafrom files in the `infrastructure` folder. Multiple regions may be present.

| property | description | required | default |
| -------- | ----------- | -------- | ------- |
| `"<region>"` | An [Infrastructure Region Config Object](#infrastructure-region-config-object) | true | us-west-2 is configured by default with default values from the [Infrastructure Region Config Object](#infrastructure-region-config-object) section |

#### **Infrastructure Region Config Object**

An object containing infrastructure configuration for the AWS resources generated by the Terrafom in the repo.

| property | description | required | default |
| -------- | ----------- | -------- | ------- |
| `"terraformBucket"` | The S3 bucket used to store terraform state files for the AWS infrastructure. | true | `"CHANGE ME"` |
| `"auroraDB"` | An [Aurora DB Config Object](#aurora-db-config-object) | true | An object with values specified in the [Aurora DB Config Object](#aurora-db-config-object) section |
| `"flywayTask"` | A [Flyway Task Config Object](#flyway-task-config-object) | true | An object with values specifed in the [Flyway Task Config Object](#flyway-task-config-object) section. |
| `"bastion"` | A [Bastion Config Object](#bastion-config-object) | false | An object with default values specified in the [Bastion Config Object](#bastion-config-object) section. |

#### **Aurora DB Config Object**

An object with properties for the Aurora DB infrastructure generated by terraform.

| property | description | required | default |
| -------- | ----------- | -------- | ------- |
| `"dbClusterName"` | The name of the Aurora DB cluster | true | `"auroradb-cluster"` |
| `"dbSubnetGroup"` | The name of the DB subnet group used by the Aurora DB cluster | true | `"auroradb-subnet-group"` |
| `"vpcSecurityGroups"` | A comma separated list of VPC security groups assigned to the Aurora DB cluster. | true | `"auroradb-sg"` |

#### **Flyway Task Config Object**

An object with properties for the Flyway Fargate Task infrastructure generated by terraform.

| property | description | required | default |
| -------- | ----------- | -------- | ------- |
| `"taskDefinitionFamily"` | The name of the flyway Fargate Task Definition Family | true | `"flyway-migration-family"` |
| `"taskLaunchType"` | The launch type for the flyway Task Definition. This project is configured for FARGATE but can be modified for use with EC2 Launch Type. | true | `"FARGATE"` |
| `"taskCluster"` | The name of the ECS Cluster to launch the flyway task in. | true | `"ecs-cluster"` |
| `"taskSubnets"` | A comma separated list of subnets in which the flyway task can be launched. | true | `"default-us-west-2a,default-us-west-2b,default-us-west-2c"` |
| `"taskSecurityGroups"` | A comma separated list of security groups to assign to the flyway task | true | `"flyway-fargate-sg,auroradb-sg"` |
| `"isPublicSubnet"` | Are the subnets in which the flyway task is being launched public? (Does a Public IP address need to be assigned?) | true | `true` |

#### **Bastion Config Object**

An object with properties for the bastion host EC2 instance generated by terraform. This object is only required if the bastion host is setup and the `sshtunel.sh` is used.

| property | description | required | default |
| -------- | ----------- | -------- | ------- |
| `"bastionHostName"` | The name of the bastion host EC2 instance | false | `"bastion-host"` |
| `"privateKeyBucket"` | The name of the S3 bucket where the private SSH key for the bastion host EC2 instance is stored. | false | `"CHANGE ME"` |
| `"privateKeyPath"` | The path in the S3 bucket to the private SSH key for the bastion host EC2 instance | false | `"private/bastion-host-key"` |

### Deploy Infrastructure

Infrastructure can be deployed through GitHub Actions by using the `trigger_workflow.sh` script. This workflow is configured in the `.github/workflows/deploy-infrastructure-workflow.yml` file. To initiate the `deploy_infrastructure` workflows, do the following:

1. Create an environment variable to store a Personal Access Token with `repo` scope (such as the one created in steps 11-15 of [Repository Setup](#repository-setup)). The variable name should match the value of the `githubTokenName` property in config.json.
    - Ex: `export GITHUB_AURORA_ACTIONS_TOKEN="<token_value>"`
2. Run `./trigger_workflow.sh`
    - ![trigger-workflow-menu](assets/trigger-workflow-menu.png)
3. Enter `2` for `deploy_infrastructure`.
4. Select the region you would like to deploy to. (Menu options are created based on [Infrastructure Obect Config](#infrastructure-config-object) property keys)
    - ![deploy-infrastructure-region-menu](assets/deploy-infrastructure-region-menu.png)
5. Select the infrastructure to be deployed.
    - ![deploy-infrastructure-selection-menu](assets/deploy-infrastructure-selection-menu.png)
6. A success message should be displayed with a link to GitHub actions for the project
    - ![deploy-infrastructure-invocation](assets/deploy-infrastructure-invocation.png)
7. Navigate to the GitHub actions link and select the running `deploy_infrastructure` workflow to monitor its progress.
    - ![github-actions-deploy-infrastructure-all-workflows](assets/github-actions-deploy-infrastructure-all-workflows.png)
8. Select the running `deploy` job on the left hand side to view the job logs
    - ![github-actions-deploy-infrastructure-running-workflow](assets/github-actions-deploy-infrastructure-running-workflow.png)

If deploying all of the infrastructure, they should be deployed in the following order:
  1. aurora-db
  2. bastion (optional)
  3. ecs-cluster
  4. fargate-iam
  5. flyway-fargate-task

#### **Destroy Infrastructure**

Destroying infrastructure follows the same steps as deploying infrastructure. Just select the `trigger_workflow.sh` menu option for `destroy_infrastructure` instead and follow the prompts.

### Build Flyway Docker Image

This workflow runs the [`scripts/build_flyway_docker_image.sh`](scripts/build_flyway_docker_image.sh) script to build the docker image.

This workflow is configured by the [`.github/workflows/build-flyway-docker-image.yml`](.github/workflows/build-flyway-docker-image-workflow.yml) file. This workflow can be triggered by selecting the `build_flyway` option of the `./trigger_workflow.sh` script. It is also triggered automatically on github pushes when there are any changes to the files used to generate this image in the `/docker` folder.

The files for building this image are a `Dockerfile` with build instructions and a `/scripts` folder for scripts to be executed by the docker image. In the `/scripts` folder, a `flyway-rds-migration.sh` file is provided to accept a github branch as an argument, pull the github repository deploy key for this project, get the SQL code from the given banch, fetch SQL credentials, and run the flyway migration on the Aurora DB Cluster.

A [Deploy Infrastructure](#deploy-infrastructure) workflow must be run for `flyway-fargate-task` to update the deployed Task Definition to use a newly created image.

To trigger this workflow do the following:

1.  Create an environment variable to store a Personal Access Token with `repo` scope (such as the one created in steps 11-15 of [Repository Setup](#repository-setup)). The variable name should match the value of the `githubTokenName` property in config.json.
    - Ex: `export GITHUB_AURORA_ACTIONS_TOKEN="<token_value>"`
2. Run `./trigger_workflow.sh`
    - ![trigger-workflow-menu](assets/trigger-workflow-menu.png)
3. Enter `7` for `build_flyway`.
4. Follow steps 6-8 of the [Deploy Infrastructure](#deploy-infrastructure) section to view the job logs for the `build_flyway` workflow and `build-flyway` job.

### Run Flyway Migration

This workflow is configured by the [`.github/workflows/run-flyway-migration-workflow.yml`](.github/workflows/run-flyway-migration-workflow.yml) file. It runs the GitHub Run ECS Task Action that can be found in the [`.github/actions/run-ecs-task-action/`](.github/actions/run-ecs-task-action/) folder.

This action runs a standalone ECS Fargate task using the task definition created by the [Flyway-Fargate-Task](#flyway-fargate-task) infrastructure section. This task uses the image created by the [Build Flyway Docker Image](#build-flyway-docker-image) section to run a flyway migration on the [Aurora-DB](#aurora-db) Cluster.

To trigger this workflow do the following:

1.  Create an environment variable to store a Personal Access Token with `repo` scope (such as the one created in steps 11-15 of [Repository Setup](#repository-setup)). The variable name should match the value of the `githubTokenName` property in config.json.
    - Ex: `export GITHUB_AURORA_ACTIONS_TOKEN="<token_value>"`
2. Run `./trigger_workflow.sh`
    - ![trigger-workflow-menu](assets/trigger-workflow-menu.png)
3. Enter `6` for `run_migration`.
4. Select the region to deploy to.
    - ![run-migration-region-selection-menu](assets/run-migration-region-selection-menu.png)
5. Select the branch to run the migration from.
    - *Note*: This will only select the branch to pull the SQL code from. All `repository_dispatch` events are run on the master branch.
    - ![run-migration-branch-selection-menu](assets/run-migration-branch-selection-menu.png)
6. Follow steps 6-8 of the [Deploy Infrastructure](#deploy-infrastructure) section to view the job logs for the `run_migration` workflow and `run_migration` job.

### Generate Markdown

This workflow is configured by the [`.github/workflows/generate-markdown-workflow.yml`](.github/workflows/generate-markdown-workflow.yml) file. It runs the GitHub Run Generate Markdown Action that can be found in the [`.github/actions/generate-markdown-action/`](.github/actions/generate-markdown-action/) folder.

This workflow can be triggered by selecting the `generate_markdown` option in the `./trigger_workflow.sh` menu. It is also triggered automatically on github pushes when there are any changes to the files in the `/sql` folder.

The Generate Markdown workflow runs a new PosgreSQL Database an run a flyway migration on it using the migration files in the `/sql` folder. Then it runs the [Postgres Markdown](https://www.npmjs.com/package/postgres-markdown) NPM package. This generates markdown for the database schema created by the SQL code. It appends the markdown to this README under the [Database Documentation](#database-documentation) section.

To manually trigger this workflow do the following:

1.  Create an environment variable to store a Personal Access Token with `repo` scope (such as the one created in steps 11-15 of [Repository Setup](#repository-setup)). The variable name should match the value of the `githubTokenName` property in config.json.
    - Ex: `export GITHUB_AURORA_ACTIONS_TOKEN="<token_value>"`
2. Run `./trigger_workflow.sh`
    - ![trigger-workflow-menu](assets/trigger-workflow-menu.png)
3. Enter `1` for `generate_markdown`.
4. Follow steps 6-8 of the [Deploy Infrastructure](#deploy-infrastructure) section to view the job logs for the `generate_markdown` workflow and `generate-markdown` job.

### Create Snapshot

This workflow is configured by the [`.github/workflows/create-snapshot-workflow.yml`](.github/workflows/create-snapshot-workflow.yml) file. It runs the GitHub Create Snaphsot Action that can be found in the [`.github/actions/create-snapshot-action/`](.github/actions/create-snapshot-action/) folder.

This workflow creates a snapshot of the Aurora DB Cluster. The snapshot is created as `<db_cluster_name>-snapshot-<timestamp>`. The latest snapshot name is saved in the `metadata.json` folder and is used by the [Restore Snapshot](#restore-snapshot) workflow.

To manually trigger this workflow do the following:

1.  Create an environment variable to store a Personal Access Token with `repo` scope (such as the one created in steps 11-15 of [Repository Setup](#repository-setup)). The variable name should match the value of the `githubTokenName` property in config.json.
    - Ex: `export GITHUB_AURORA_ACTIONS_TOKEN="<token_value>"`
2. Run `./trigger_workflow.sh`
    - ![trigger-workflow-menu](assets/trigger-workflow-menu.png)
3. Enter `4` for `create_snapshot`.
4. Select the region for the cluster to take the snapshot from
5. Follow steps 6-8 of the [Deploy Infrastructure](#deploy-infrastructure) section to view the job logs for the `create_snapshot` workflow and `create-snapshot` job.

### Restore Snapshot

This workflow is configured by the [`.github/workflows/restore-snapshot-workflow.yml`](.github/workflows/restore-snapshot-workflow.yml) file. It runs the GitHub Restore Snapshot Action that can be found in the [`.github/actions/restore-snapshot-action/`](.github/actions/restore-snapshot-action/) folder.

This workflow restores a snapshot of the Aurora DB Cluster. If a cluster with the same name already exists, it will rename the existing cluster with a `-temp` appended to it. On a successful restore it will delete the renamed cluster. The snapshot name used for this workflow is found in the `metadata.json` file and is set by the [Create Snapshot](#create-snapshot) workflow.

To manually trigger this workflow do the following:

1.  Create an environment variable to store a Personal Access Token with `repo` scope (such as the one created in steps 11-15 of [Repository Setup](#repository-setup)). The variable name should match the value of the `githubTokenName` property in config.json.
    - Ex: `export GITHUB_AURORA_ACTIONS_TOKEN="<token_value>"`
2. Run `./trigger_workflow.sh`
    - ![trigger-workflow-menu](assets/trigger-workflow-menu.png)
3. Enter `5` for `restore_snapshot`.
4. Select the region for the cluster to restore the snapshot in.
5. Follow steps 6-8 of the [Deploy Infrastructure](#deploy-infrastructure) section to view the job logs for the `restore_snapshot` workflow and `restore-snapshot` job.

## Local Database

Using Docker Compose, a PostgreSQL server can be started and flyway can be run to migrate the SQL code in the `sql/` folder. This can allow for migrations to be previewed and tested before deploying them to AWS where undoing them is a little more involved.

The local database for Docker Compose is configured with the `docker-compose.yml` file.

To run a local database, run the following command:

```docker
docker-compose up
```

Alternatively, a PostgreSQL container can be run on its own using:

```docker
docker run --rm -d --name postgres -v $PWD/data:/var/lib/postgresql/data -p 5432:5432 postgres
```

The following commands can be used to run flyway on the PostgreSQL containers. Options are in the format `-url=jdbc:postgresql://<host>:<port>/<db_name> -user=<user> -password=<password> -locations=filesystem:<path_to_sql_files> -placeholders.ENV=<env_value> ...`. Placeholders are values in the sql code that will be replaced with supplied values. The placeholder key matches a string of the format `${key}` in the sql files. Ex: `GRANT CONNECT ON DATABASE auroradb_${ENV}_${REGION} TO read_only;`

```docker
docker run --rm -v $PWD/<sql migration folder>:/flyway/sql flyway/flyway [options] command
```

**Note:** Using either method to run a PostgreSQL server will store the database files in the `data` directory.

## Connecting to the Database

A connection to the Database can be established using any PostgreSQL-approved editor, or using psql, Postgresql's command-line tool. First, download postgresql via the interactive installer using this link to get both psql and PG Admin, their approved editor, on your machine: [Download PostgreSQL](https://www.postgresql.org/download/macosx/).

The breakdown of connection steps is below for each.

### PGAdmin

PG Admin is the most commonly used Postgresql editor. The link above should download a copy of PG Admin, but an individual copy can be found here: [Download PGAdmin 4](https://www.pgadmin.org/download/)

This method allows for connection settings to be saved.

Alternatively, pgadmin4 can be run using a docker container.

```docker
docker run -d --name pgadmin4 -e<EMAIL_ADDRESS>-e PGADMIN_DEFAULT_PASSWORD=password -p 8080:80 dpage/pgadmin4
```

### PSQL

PSQL can be used to interact with the Database using the command line. First, install postgresql using the general download link above. Once psql is installed on a machine and added to your path, the following command can be run to connect to the Database.

```bash
psql -U [USERNAME] -h [HOST] -p [PORT] [DB_NAME]
```

**Note:** If connecting to a local database from a local PGAdmin4 installation or PSQL use `localhost`. If connecting through PGAdmin4 running in docker use `host.docker.internal`. If connecting to an AWS deployed Database instance from a local system that is not in the same VPC as the database, deploy the [Bastion](#bastion) infrastructure, run the [`sshtunnel.sh`](sshtunnel.sh) script, and use `localhost` as the hostname to connect to.

# Database Documentation

Created at: 2020-10-13T04:37:02.336Z
Server version: PostgreSQL 12.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.3.0) 9.3.0, 64-bit
## Schema: public

### Tables

#### public.flyway_schema_history

column | comment | type | length | default | constraints | values
--- | --- | --- | --- | --- | --- | ---
**installed_rank** _(pk)_ |  | integer |  |  | NOT NULL |
version |  | character varying | 50 |  |  |
description |  | character varying | 200 |  | NOT NULL |
type |  | character varying | 20 |  | NOT NULL |
script |  | character varying | 1000 |  | NOT NULL |
checksum |  | integer |  |  |  |
installed_by |  | character varying | 100 |  | NOT NULL |
installed_on |  | timestamp without time zone |  | now() | NOT NULL |
execution_time |  | integer |  |  | NOT NULL |
success |  | boolean |  |  | NOT NULL |

#### public.sample

column | comment | type | length | default | constraints | values
--- | --- | --- | --- | --- | --- | ---
**id** _(pk)_ |  | integer |  | nextval('sample_id_seq'::regclass) | NOT NULL |
message |  | character varying | 255 |  |  |

gha_language: Shell


text:
# E-Commerce Back-End Application

  [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)

  ## Description

  This is a back-end application for maintaining e-commerce data. The application allows you to create, update, delete, and view records such as products, categories, and tags. Sequelize, Express JS, and MySQL are utilized by the application.

  ## Table of Contents

  * [Installation](##-installation)
  * [Usage](##-usage)
  * [License](##-license)
  * [Questions](##-questions)
  * [Video Walkthrough](##-video-walkthrough)

  ## Installation

  To install the necessary dependencies, run the following command:
  ```
  npm i
  ```

  ## Usage

  This application may be useful for maintaining a database for e-commerce data.

  ## License

  This projects is licensed under the ISC license.

  ## Questions

  If you have any questions about the repo, open an issue or contact me directly at [aisthorpe@gmail.com](mailto:aisthorpe@gmail.com). You can find more of my work at [naisthorpe](https://www.github.com/naisthorpe).

 ## Video Walkthrough
https://youtu.be/ItL0-I3YSzQ

license: ISC

repository: naisthorpe/e-commerce

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: naisthorpe/e-commerce


text:
# System Heat

A mod for Kerbal Space Program, intended to provide a better experience for heat management, particularly geared towards resource extraction, high energy engines, and nuclear reactors.

* [Features](#features)
* [Dependencies](#dependencies)
* [Installation](#installation)
* [Contributing](#contributing)
* [License](#licensing)

## Features

In a nutshell, this mod has as goals.
* Create a coherent vision for the system-level heat mechanics in KSP
* Design a fairly simple but deep system built around designing ships to manage heat
* Provide better tools and visualizations to help players with those designs

### Gameplay Concept

Besides building a system that is stable and extensible without the show-stopping bugs of Core Heat, I want to represent a couple of design challenges that come up in spacecraft design. Spacecraft usually have to deal with a number of different thermal systems for different purposes, due to the varying heat generation requirements of various things on them. Humans make heat, electricity makes heat, nuclear engines make heat... and they tend to do so at different rates and in different ways.

The SystemHeat concept will basically take this and run with it. Allocating your heat producing parts correctly between your radiators will be important, as well as making sure you don't do stuff like pipe your reactor exhaust into your life support system. Fun times!

### Heat Loops

In this mod, all parts that interact with the system are part of an abstract Heat Loop. This represents the flow of coolant through a set of systems that produce heat and consume heat. Producers might include reactors, life support processors, ISRUs, drills and that kind of thing. Radiators would be consumers (effectively the only one at this point).

Each part that produces heat does so with an Output Temperature and an Output Flux. The Output Temperature this is the temperature of the insides of the part (say, a nuclear reactor core) - any coolant coming out of the part will be at that temperature. The Output Flux is the rate heat is produced by the part. Parts have different temperatures and fluxes depending on their nature - a nuclear reactor has a pretty high Output Temperature and a high Output Flux, a drill might have a lower Output Flux and a lower Output Temperature.

Similarly, parts that consume heat have special properties. They specifically consume heat with an Input Flux - a bigger, better radiator is likely able to handle a higher input flux.

When parts are connected into a Heat Loop , the members of the loop contribute their Input/Output Flux and Output Temperature into it. If all the fluxes going into the loop are positive, it heats up and increases its Loop Temperature. If the flux is negative, it cools down. If the Loop Temperature gets too high, systems in the loop will be negatively affected, in proportion to how different the Loop Temperature is to their Output Temperature.

Your job, as the spacecraft engineer, is to construct Heat Loops such that they are well-balanced and basically don't heat up and . There can be several different Heat Loops on a vessel with different parts assigned to them (though a part can currently only belong to one loop at a time).

## Installation

To install, place the GameData folder inside your Kerbal Space Program folder. If asked to overwrite files, please do so.

NOTE: Do NOT rename or move folders within the GameData folder - this mod uses absolute paths to assets and will break if this happens.

## Optional Patches

Some extra patches are bundled that you can use to tweak your installation. To install them, drop the correct folder from the **Extras** folder into your KSP GameData Folder.

Please note that these extras may break your ships in flight as they will make existing parts run on the SystemHeat system

* **SystemHeatHarvesters**: Converts harvesters to use SystemHeat
* **SystemHeatConverters**: Converts converters to use SystemHeat
* **SystemHeatFissionReactors**: Converts nuclear reactors to use SystemHeat
* **SystemHeatFissionEngines**: When installed, nuclear engines will have integrated reactors

## Contributing

I certainly accept pull requests. Please target all such things to the `dev` branch though!

## Licensing

MIT license:

Copyright (c) 2019 Chris Adderley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

license: MIT

repository: Mecripp/SystemHeat

branch_name: refs/heads/master

repo_name: Mecripp/SystemHeat


text:
Most [suckless.org](https://suckless.org) software comes with basic functionality which can be _extended_ by applying code _patches_. This typically involves a fair deal of tinkering on behalf of the end user especially when applying more than one patch.

The _flexipatch_ builds have a different take on patching where preprocessor directives are used to decide whether or not to include a patch during build time. This means, for better or worse, that the code contains both the patched and the original code. The aim being that you can pick and mix your patches from a configuration file and just compile.

The _flexipatch-finalizer_ is a custom pre-processor that uses the same configuration file and strips a flexipatch build of any unused code, leaving a build of the software with the selected patches applied.

Example flexipatch builds this finalizer can be used with:

   - [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch)
   - [dmenu-flexipatch](https://github.com/bakkeby/dmenu-flexipatch)
   - [st-flexipatch](https://github.com/bakkeby/st-flexipatch)
   - [slock-flexipatch](https://github.com/bakkeby/slock-flexipatch)

:warning: Do make sure that you make a backup of your flexipatch build and your `patches.h` configuration file before running this script.

:warning: This script alters and removes files within the given source directory.

:warning: This process is irreversible.

Example usage:

```
$ ./flexipatch-finalizer.sh
Usage: flexipatch-finalizer.sh [OPTION?]

This is a custom pre-processor designed to remove unused flexipatch patches and create a final build.

  -r, --run                      include this flag to confirm that you really do want to run this script

  -d, --directory <dir>          the flexipatch directory to process (defaults to current directory)
  -o, --output <dir>             the output directory to store the processed files
  -h, --help                     display this help section
  -k, --keep                     keep temporary files and do not replace the original ones
  -e, --echo                     echo commands that will be run rather than running them
      --debug                    prints additional debug information to stderr

Warning! This script alters and removes files within the source directory.
Warning! This process is irreversible! Use with care. Do make a backup before running this.

$ ./flexipatch-finalizer.sh -r -d /path/to/dwm-flexipatch
$
```

Example end diff having VERTCENTER_PATCH enabled for st.

```diff
...
/* Purely graphic info */                                       /* Purely graphic info */
typedef struct {                                                typedef struct {
        int tw, th; /* tty width and height */                          int tw, th; /* tty width and height */
        int w, h; /* window width and height */                         int w, h; /* window width and height */
        #if ANYSIZE_PATCH                                     <
        int hborderpx, vborderpx;                             <
        #endif // ANYSIZE_PATCH                               <
        int ch; /* char height */                                       int ch; /* char height */
        int cw; /* char width  */                                       int cw; /* char width  */
        #if VERTCENTER_PATCH                                  <
        int cyo; /* char y offset */                                    int cyo; /* char y offset */
        #endif // VERTCENTER_PATCH                            <
        int mode; /* window state/mode flags */                         int mode; /* window state/mode flags */
        int cursor; /* cursor style */                                  int cursor; /* cursor style */
        #if VISUALBELL_2_PATCH || VISUALBELL_3_PATCH          <
        int vbellset; /* 1 during visual bell, 0 otherwise */ <
        struct timespec lastvbell;                            <
        #endif // VISUALBELL_2_PATCH                          <
} TermWindow;                                                   } TermWindow;
...
```


text:
Covid Daliy Status

A mobile app tha informs you the current situation about the Covid-19 pandemic

“Data is a precious thing and will last longer than the systems themselves.” – Tim Berners-Lee

  Why •
  Install instructions •
  Tech Stack •
  Contributing •
  License •

## :blush: **Why?**

Covid Daily Status is a mobile app that shows the statistics about the world's current pandemic situation.

Covid Daily Status's purpose is to take truthful and centralizated information for people about the Covid-19 pandemic in a single application.

## :computer: **Install instructions**

### Getting Started

#### 1) Clone & Install Dependencies on Linux/MacOS/Windows

- 1.1) `git clone https://github.com/LuizFelipe-5/desafio_covid.git`
- 1.2) `cd desafio_covid` - cd into your newly created project directory.
- 1.3) Get Flutter dependencies with `flutter pub get`

#### 2) Start your app

- 3.1) **[iOS]** Build and run the iOS app, run `flutter run`. The first build will take some time.
- 3.2) **[Android]** If you haven't already got an android device attached/emulator running then you'll need to get one running (make sure the emulator is with Google Play / APIs). When ready run `flutter run` from the root of your project.

## :zap: **Tech Stack**

-   [API](https://disease.sh/docs/)

## :handshake: **Contributing**

This project is for study purposes too, so send me an <a<EMAIL_ADDRESS>telling me what you are doing and why you are doing it, teach me what you know

All kinds of contributions are very welcome and appreciated!

-   ⭐ Star the project
-   🐛 Find and report issues
-   📥 Submit PRs to help solve issues or add features
-   ✋ Influence the future of Covid Daily Status with feature requests

gha_language: Dart


text:
# AudioPlaybackConnector
**English** | [简体中文](https://github.com/ysc3839/AudioPlaybackConnector/blob/master/README.zh_CN.md)

Bluetooth audio playback (A2DP Sink) connector for Windows 10 2004+.

Microsoft added Bluetooth A2DP Sink to Windows 10 2004. However, a third-party app is required to manage connection.\
There is already an app can do this job. However it can't hide to notification area and it's not open-source.\
So I write this app, provide a simple, modern and open-source alternative.

# Preview
<EMAIL_ADDRESS>
# Usage
* Download and run AudioPlaybackConnector from [releases](https://github.com/ysc3839/AudioPlaybackConnector/releases).
* Add a bluetooth device in system bluetooth settings. You can right click AudioPlaybackConnector icon in notification area and select "Bluetooth Settings".
* Click AudioPlaybackConnector icon and select the device you want to connect.
* Enjoy!


text:
Vendor: Forcepoint
==================
Product: Forcepoint
-------------------

### Use Cases

_The following Use Cases can be operationalized using log data from this data source_

* [Data Loss Prevention](../UseCases/usecase_data_loss_prevention.md)
* [Executives](../UseCases/usecase_executives.md)
* [Network](../UseCases/usecase_network.md)
* [Web Activity](../UseCases/usecase_web_activity.md)

### Event Types

_The following list of Event Types can be generated by Data Source Forcepoint_Forcepoint, and power the use cases above:_

- network-connection-failed
- network-connection-successful
- web-activity-allowed

### Parsers

_The following Parsers can be operationalized using log data from this data source_

* [forcepoint-network-connection-failed](../Parsers/parserContent_forcepoint-network-connection-failed.md)
* [forcepoint-network-connection-successful](../Parsers/parserContent_forcepoint-network-connection-successful.md)
* [forcepoint-web-activity](../Parsers/parserContent_forcepoint-web-activity.md)

repository: gt-kabir/Content-Doc

repo_name: gt-kabir/Content-Doc


text:
# MORS
Android Open Source Old School RuneScape Helper

This is not a client, it draws on top of the original OSRS client.

Only works for Android

Your device needs to be rooted to use this application.

The reason it must be rooted is because we are using Frida.js to instrument the client. Therefore you will need to download the [frida-inject 14.0.8](https://github.com/frida/frida/releases/tag/14.0.8) application's and put it under /data/local/tmp/ on your phone filesystem

# Whats working?
* At the moment only idle notifier: Shows a draggable colored circle overlay on top of the game. Green when performing an animation, red when idle

![alt text](../images/idlenotifier.jpg)

# Whats new?
* The Client has been de-obfuscated and mapped to an API in the JavaScript language recognized by Frida.js. These APIs can be used to develop new plugins and simplify communication with the Client. For de-obfuscation, the desktop client code was mapped to the mobile client code and this raised some problems:
  * Not all classes and methods have been mapped.
  * The identifiers for the animations (and possibly others as well) are different than in the desktop version and must be remapped.
  * If you want to use the API you need to compile the scripts with [frida-compile](https://github.com/frida/frida/releases/tag/14.0.8)

# How to use
* [Complete the first time setup]
    * [Root phone](https://www.xda-developers.com/root/).
    > PLEASE NOTE: Rooting a device may void the warranty on the device. It may also make the device unstable or if not done properly, may completely brick the device. Some methods may install additional apps/software on your device. Developers or the author does not take any responsibility for your device. Root at your own risk and only if you understand what you are doing!
    * Add frida-server:
        * Download the [frida-server](https://github.com/frida/frida/releases/tag/14.0.8) 14.0.8
        * Download the [frida-inject](https://github.com/frida/frida/releases/tag/14.0.8) 14.0.8
        * [Download and install [Android Debug Bridge (adb)](https://developer.android.com/studio/command-line/adb)]
        * Move both frida-server and frida-inject in /etc/local/tmp/ on your phone filesystem
            * if you downloaded adb open a terminal on your computer and write:
                * `adb push frida-server /etc/local/tmp/` press enter
                * `adb push frida-inject /etc/local/tmp/` press enter
            * Otherwise download frida-server and frida-inject on your device as well as a terminal emulator app (for example [termux](https://play.google.com/store/apps/details?id=com.termux))
                * Open the downloaded terminal app and write
                    * `cp /download/directory/.../frida-server /etc/local/tmp/` press enter
                    * `cp /download/directory/.../frida-inject /etc/local/tmp/` press enter
        * [If you want to edit the app to add plugins you may want to download also [Android Studio](https://developer.android.com/studio) and [frida-compile](https://github.com/frida/frida-compile)]
* Download and install [mors.apk](mors.apk)
    * If you dont want to develop, just download the apk file in this repository and install it. Warning: this is an unsigned debug apk, it may asks you to [acquire developer role](https://www.howtogeek.com/129728/how-to-access-the-developer-options-menu-and-enable-usb-debugging-on-android-4.2/). Install at your own risk.
        * If you installed adb open a terminal on your computer and write: adb install mors.apk
        * Otherwise download the apk directly to your phone and install it from there.
    * On android studio simply run the application to any connected device
* Open client and log in
    * The client must be already open when you start any plugin
* Open the app.
* All the plugins are in javascript (you can test idlenotifier_compiled.js)
    * Hold the plugin name to start the script
* Once a plugin is running you can switch back to client and play.

# TO-DOs
* Map AnimationID
* Check if other IDs changed
* The client application should be futher de-obfuscated
* Add both deobfuscator and javascript injector to this repository
* API Documentation
* Other plugins

# Contributing
* Make a fork
* Test all changes before submitting
* Submit a pull request with details on the changes and why it should be submitted.
* By submitting you are agreeing that you are legally allowed to contribute the code provided and are not under any arbitration agreements.

All images used are copyright of their respective owners.
Runescape related images are copyright of Jagex Ltd.

repository: morscape/mors-desktop

repo_name: morscape/mors-desktop


text:
---
layout: post
title: Hypothesis of the Cosmic Egg
---

Welcome to my blog!  I hope you enjoy yourself while reading and watching about all the
things I find interesting!

This blog is mainly geared towards software development (testing, deploying, writing), book
reviews (tech, sci-fi, soft skills), and the exploration of different software tools and
libraries.

I will also try my best to reference other blogs and talks that I enjoy.

Enjoy!

[Hypothesis of the Cosmic Egg](https://en.wikipedia.org/wiki/Georges_Lemaître)


text:
# moon-rs

[![crates.io:badge]][crates.io]
[![docs.rs:badge]][docs.rs]
[![license:mit:badge]](./LICENSE)

[crates.io:badge]: https://img.shields.io/crates/v/moon
[crates.io]: https://crates.io/crates/moon
[docs.rs:badge]: https://docs.rs/moon/badge.svg
[docs.rs]: https://docs.rs/moon
[license:mit:badge]: https://img.shields.io/badge/license-MIT-blue

**WIP**: Safe bindings to Lua 5.1 and LuaJIT 2.0

# License
Licensed under the [MIT License](./LICENSE).

repository: HellButcher/moon-rs

repo_name: HellButcher/moon-rs


text:
# tpl-php

[![CircleCI](https://circleci.com/gh/wellcometrust/tpl-php.svg?style=svg)](https://circleci.com/gh/wellcometrust/tpl-php)

Renderer for Drupal 7 `.tpl.php` files for use with pattern libraries.

### Installation

`npm install tpl-php`

#### Dependencies

+ Node 7+
+ PHP 5+

### Usage

Your template:

```php
<h1>Good morning, <?php print $variables['name']; ?></h1>
```

In node:

```js
const tpl = require('tpl-php');

tpl('my-template.tpl.php', { name: 'Alasdair' })
.then(rendered => console.log(rendered)); // <h1>Good morning, Alasdair</h1>

// if the template executes with errors, you can toggle whether they're shown in the output or not
tpl('my-template.tpl.php', { name: 'Alasdair' }, { showErrors: true });
```

### Development

+ run tests with `npm test`
+ tests are located in the `spec` directory, and are based on `jasmine`.

repository: wellcometrust/tpl-php

gha_language: JavaScript

repo_name: wellcometrust/tpl-php


text:
---
layout: page
html-title: Artist Resume
permalink: resume/
body-class: 'page resume'
---

# Resume

## Education

1953–58 B.A. and M.A. University of Missouri, Columbia, Missouri

## Field
Painting / Drawing / Printmaking

## Further Studies

+ _1994:_ Italy: Sabbatical, Giocalto, Bibbiana
+ _1988:_ Italy: Watercolor monoprint
+ _1981:_ Visiting Artist in Etching: Santa Reparata Stamperia per Grafica, October and November
+ _1978:_ Mezzotint Workshop: Experimental Etching, Boston, Massachusetts
+ _1973:_ Visiting Artist in Etching: Santa Reparata Stamperia per Grafica, Florence, Italy
+ _1963:_ Workshop in Etching: Professor Mauricio Lasansky, Printmaker, University of Missouri at Springfield
+ _1962:_ Workshop in Painting: Professor Fred Conway, Painter, Washington University, St. Louis, Missouri
{: .list-unstyled  .list-with-years }

## Exhibitions
_*Solo, **Juried, ***Group_

+ _2017:_ Chazan Gallery, Providence, Rhode Island
+ _2015:_ Faculty Show, Rhode Island College, Providence, Rhode Island
+ _2014:_ Newport Annual Juried Show, Newport, Rhode Island ***
+ _2014:_ Shelby Gallery, Ringling School of Art, Sarasota, Florida
+ _2006:_ Keller Library Gallery, Dexter, Montana
+ _2005:_ Newport Art Museum, Newport, Rhode Island (50 new works) *
+ _2003:_ Recent Work, Wheeler Gallery, Providence, Rhode Island
+ _2002:_ Art Center, Sarasota, Small Painting ***
+ _2001:_ Bromfield Gallery, Boston, Massachusetts *
+ _2000:_ Full Circle Gallery, Providence, Rhode Island
+ _2000:_ Group Invitational: Attleboro, Massachusetts
+ _1996:_ Sabbatical/Retrospective, Bannister Gallery, Rhode Island College, Providence, Rhode Island *
+ _1992:_ Recent Work, Wheeler Gallery, Providence, Rhode Island *
+ _1990:_ Outstanding Alumni, Group Show, Bingham Gallery, University of Missouri, Columbia, Missouri ***
+ _1989:_ Sabbatical Show, Bannister Gallery, Rhode Island College, Providence, Rhode Island *
+ _1988:_ Invitational Landscape: 6 Paintings, Duxbury Museum of Art, Duxbury, Massachusetts ***
+ _1988:_ 3 Person: Gallery 401, Jewish Community Center, Providence, Rhode Island***
+ _1987:_ Wheeler Gallery Open: Painting **
+ _1986:_ Cranston Public Gallery, Group Show, Cranston, Rhode Island
+ _1984:_ Bristol Art Museum, Bristol, Rhode Island**
+ _1983:_ Lily Iselin Gallery, Group Show, Providence, Rhode Island
+ _1982:_ Gallery 401, Lowell State University, Lowell, Massachusetts **
+ _1982:_ Bannister Gallery, Rhode Island Gallery, Sabbatical Show *
+ _1981:_ Rhode Island Painter’s Annual, Rhode Island School of Design Museum, Providence, Rhode Island **
+ _1979:_ Lowell State University, Group Show, Lowell, Massachusetts *
+ _1976:_ Alan Stone Gallery, Drawing, New York, New York
+ _1976:_ Boston Printmakers Annual, Boston, Massachusetts (traveling exhibition) **
+ _1975:_ Davidson National Print and Drawing Competition, Davidson College, Davidson, North Carolina **
+ _1975:_ Boston Printmakers Annual, Boston, Massachusetts **
+ _1974:_ Providence Art Club, (numerous times: painting, drawing, prints) most recently, Print Annual, Providence, Rhode Island **
+ _1973:_ Sabbatical Show, Rhode Island College, Providence, Rhode Island *
+ _1971:_ Wheelock College, Boston, Massachusetts *
+ _1969:_ Rhode Island College, Providence, Rhode Island *
+ _1969:_ Tonoff Gallery, Drawing Group Show
+ _1967:_ Rhode Island Arts Annual **
+ _1967:_ Casdin Gallery, Worcester, Massachusetts, 3 Person
+ _1965:_ Trinity Theatre, Providence, Rhode Island *
+ _1965:_ Rhode Island Arts Annual **
+ _1964:_ University Alumni Invitational, Columbia, Missouri
+ _1963:_ Northwest Missouri State University, Maryville, Missouri *
+ _1963:_ Southwest Missouri State University, Springfield, Missouri *
+ _1963:_ Southwest Missouri Annual, Museum of Art, Springfield, Missouri **
+ _1960:_ Missouri Show, City Art Museum of St. Louis, St. Louis, Missouri **
+ _1958:_ Missouri Show, City Art Museum of St. Louis, St. Louis, Missouri **
+ _1957:_ Group Show, Stephens College, Columbia, Missouri
+ _1957:_ Big Eight Invitational, University of Kansas, Lawrence, Kansas
{: .list-unstyled .list-with-years }

## Awards

+ _1956:_ Delta Phi Delta National Honorary Art Award

## Public & Private Collections

+ Rhode Island School of Design, Providence, Rhode Island
+ Rhode Island College, Providence, Rhode Island (6 paintings)
+ Daniel Dietrich, III, Philadelphia, Pennsylvania
+ Professor Enrico Pinardi, Hyde Park, Massachusetts
+ Newport Museum of Art, Newport, Rhode Island (1 watercolor)
+ Bank RI, Providence, Rhode Island
+ ABC (American Broadcasting Company), New York City, New York
+ Spiva Art Center, Joplin, Missouri
+ Santa Reparata, Stamperia per Grafica, Florence, Italy
+ Alan Stone Gallery, New York City, New York
+ George A. Colom, MD, Kansas City, Missouri
+ Mr. William Folkes, Kansas City, Missouri
{: .list-unstyled }

license: Unlicense

repository: highchair/donsmithpainter-com

gha_language: SCSS

gha_license_id: Unlicense

repo_name: highchair/donsmithpainter-com


text:
# Kafka-Channel Controller

The Controller component implements the KafkaChannel CRD (api, client,
reconciler, etc.) based on the latest knative-eventing SharedMain reconciler
framework and utilities.

The controller is based against the KafkaChannel CRD and reconciles all such
instances in the K8S Cluster, watching `KafkaChannel` resources and performing
the following functions:

- Provision the Kafka Topic
- Create the single Receiver (Kafka Producer) Deployment and Service, if it does
  not already exist
- Create a uniquely-named (per KafkaChannel) Dispatcher (Kafka Consumer)
  Deployment and Service

**Note** - Deleting a KafkaChannel CRD instance is destructive in that it will
Remove the Kafka Topic resulting in the loss of all events therein. While the
Dispatcher and Receiver will perform semi-graceful shutdown there is no attempt
to "drain" the topic or complete incoming CloudEvents.

## Kafka AdminClient

The current implementation supports the following mechanisms for handling Topic
creation / deletion as specified by the kafka.adminType field in the
[ConfigMap](../../../../config/channel/distributed/300-eventing-kafka-configmap.yaml)

- **"kafka"** - The default value if not specified is to use the standard Sarama
  Kafka ClusterAdmin implementation.
- **"azure"** - If you wish to use the implementation with Azure EventHubs you
  will need to specify this as a custom client/api must be used for such.
- **"custom"** - If you need to implement your own custom AdminClient you will
  use this value (see the [common/kafka/README.md](../common/kafka/README.md)).

repository: psschwei/eventing-kafka

repo_name: psschwei/eventing-kafka


text:
<img<EMAIL_ADDRESS>alt="Vasern Logo" width="300">

[![npm](https://img.shields.io/npm/v/vasern.svg)](https://npmjs.com/package/vasern)
[![Travis (.org)](https://img.shields.io/travis/vasern/vasern.svg)](https://github.com/vasern/vasern)
[![GitHub issues](https://img.shields.io/github/issues/vasern/vasern.svg)](https://github.com/vasern/vasern/issues)
![](https://img.shields.io/badge/React%20Native-iOS%20%2B%20Android-brightgreen.svg)

Vasern is a fast and open source data storage for React Native.
[Subscribe for updates](https://form.jotform.co/82917565387876) (+ 2 optional survey question)

- [What is Vasern?](#what-is-vasern)
- [Getting Started](#getting-started)
- [Examples](#examples)
- [Help and Feedback](#help-and-feedback)
- [Contribute to Vasern](#contribute-to-vasern)

## What is Vasern?

Vasern is a data storage for React Native that underneath is linked-consistent key-value stores. Its data engine is built natively to achieve native performance. Our goal is to develop an open source, developer friendly end-to-end database solution. Sync server - [vasern-server](https://github.com/vasern/vasern-server) is under development.

#### A snipped code shows how Vasern works

```javascript
import Vasern from 'vasern';

// Define Todos application schema
const VasernDB = new Vasern({
  schemas: [{
    name: "Users",
    props: {
      fname: "string",
      lname: "string"
    }
  },{
    name: "Todos",
    props: {
      name: "string",
      completed: "boolean",
      assignTo: "#Users"
    }
  }]
});

// Add listener whenever Todos has a change (loaded/insert/update/delete)
VasernDB.Todos.onChange(() => {

  // Get all todo items with "completed" is "false"
  const todoList = VasernDB.Todos.filter({ completed: false });

  // Update state
  this.setState({ data: todoList.data() });
})
```

## Status
Vasern (alpha) is **available on iOS and Android**, which expects breaking changes and improvements.

[Join us on Slack](https://join.slack.com/t/vasern/shared_invite/enQtNDU4NTk2MDI5OTcyLTRiYzRjZDI5YTAyMjlhYzg1YTdhNjFjZGNkODI1OTQwYzExZjA3NWRkYTY1MGE2ZjU0YzU3NzE2NzUwZmEwMjM) for any quick update and discusion.

## Documentation

A detailed user documentation available at https://vasern.com/docs/overview

## Getting Started

- [Install Vasern](https://vasern.com/docs/install-vasern)
- [Supported Data Types](https://vasern.com/docs/supported-data-types)
- [Write Schema, Setup Vasern](https://vasern.com/docs/write-schema-setup-vasern)
- [Basic CRUD operations](https://vasern.com/docs/basic-crud-operation)
- [Queries](https://vasern.com/docs/queries)

## Examples

- [Vasern Todo](https://vasern.com/docs/todo-example) - Simple todo app

## Help and Feedback

- For quick questions, chat and discussion, [join us on Slack](https://join.slack.com/t/vasern/shared_invite/enQtNDU4NTk2MDI5OTcyLTRiYzRjZDI5YTAyMjlhYzg1YTdhNjFjZGNkODI1OTQwYzExZjA3NWRkYTY1MGE2ZjU0YzU3NzE2NzUwZmEwMjM).
- For bugs, suggest improvements, or feature requests, feel free to [file an issue](https://github.com/vasern/vasern/issues).

The more concise and informative, the better it helps us to understand your concern.

## Contribute to Vasern

Your contributions are welcome and highly appreciated. At the moment, you can [create an issue](https://github.com/vasern/vasern/issues) with (1) Goal and (2) Details of your code.

repository: ptzagk/vasern

repo_name: ptzagk/vasern


text:
# Cordova Globalization Plugin #
by IBM

## Adding the Plugin to your project ##

Using this plugin requires [Cordova BlackBerry-WebWorks](http://www.github.com/apache/incubator-cordova-blackberry-webworks).

1. To install the plugin, copy globalization.js to your project and include a reference to it in your html file after cordova.js.

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script><br/>
    <script type="text/javascript" charset="utf-8" src="globalization.js"></script>

2. Copy the resourceBundles folder and all of its contents to your projects resources folder.  The resourceBundles folder contains additional localization information that is not available from the BlackBerry operating system. If you do not need to support all the locales you may selectively remove them so they are not included in your application.

3. Add the plugin source to your cordova.jar in your projects ext folder.  The cordova.jar file is a jar of source code.  Open cordova.jar with your favorite archive manager or use the jar command to create a directory called "org/apache/cordova/plugins/globalization" and copy Globalization.java, GlobalizationError.java, Resources.java and Util.java into it.

4. In your projects plugins.xml file add the following line:

    <plugin name="Globalization" value="org.apache.cordova.plugins.globalization.Globalization"/>

## RELEASE NOTES ##

### 20110915 ###
* Initial release
* See the .js file for API docs
* A globalization.tests.js file is provide to run with qunit as part of Mobile-Spec [Github](http://www.github.com/apache/incubator-cordova-mobile-spec)

## BUGS AND CONTRIBUTIONS ##

Patches welcome! Send a pull request.  Requires a [CLA](https://files.pbworks.com/download/qH1OfztZ1d/phonegap/31724031/NitobiPhoneGapCLA.pdf).

Post issues in the [PhoneGap Google Groups](http://groups.google.com/group/phonegap), include in the subject heading - "GlobalizationPlugin" or on [Github](http://github.com/phonegap/phonegap-plugins/issues)
(preferred)

## LICENSE ##

The MIT License

Copyright (c) 2011 IBM

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

repository: pmuellr/phonegap-plugins

repo_name: pmuellr/phonegap-plugins


text:
# graphical

Graphical is a very lightweight framework used to dynamically draw graphics  from NodeJS straight to the browser. Graphical is great for visualizing server-side data such as X, Y coordinates and accelerometer output in real-time.

No more having to deal with console.log spamming, make your debugging graphical!

![alt steam controller example](https://qwook.github.io/graphical/controller.gif "Steam controller example")

Example visualizing the steam controller [(Source code)](https://github.com/qwook/graphical-steam-controller)

## Getting started

### First steps

Install graphical through NPM:

`npm install --save-dev graphical`

```javascript
var { graphical } = require('graphical');

graphical(8111); // listen on port 8111

```

Graphical should now be accessible on http://localhost:8111/

### Drawing Shapes

```javascript
var { Rectangle, graphical } = require('graphical');

graphical(8111);

var rectangle = new Rectangle();
rectangle.setPos(0, 0);
rectangle.setColor('blue');
rectangle.setSize(20, 20);

```

Check out `./test.js` for more examples.

## API

### `graphical( [port, sendRate] )`
`sendRate` is how frequently graphical should send state changes. Default is every 10 milliseconds.

### `new Drawable()`
Base class for all graphical objects.

* `.destroy()` Removes the Drawable.
* `.setColor( color: String )` Sets the fill-color of the drawable. `color ` could be any variation of a CSS-style color: "red", "#ff0000", "rgb(255, 0, 0)".
* `.setPos( x: Number, y: Number )`
* `.setZ( zIndex: int = 0 )` Changes drawing order. Set z-index to a *negative* number to draw behind every Drawable.  If two objects have the same z-index, then they are drawn based on creation time.

### `new Circle()`
extends from `Drawable`

* `.setRadius( radius: Number )`
* `.setOutlineWidth( width: Number = 0 )` Thickness of the circle's outline, in pixels.
* `.setOutlineColor( color: String )`

### `new Rectangle()`
extends from `Drawable`

* `.setSize( width: Number, height: Number )`
* `.setWidth( width: Number )`
* `.setHeight( height: Number )`
* `.setOutlineWidth( width: Number = 0 )` Thickness of the rectangle's outline, in pixels.
* `.setOutlineColor( color: String )`

### `new Line()`
extends from `Drawable`

* `.setPos2( x: Number, y: Number )` Sets the position for the line's second end-point. (To be used in-conjunction with `setPos`)
* `.setWidth( width: Number )` Thickness of the line, in pixels.

### `new Text()`
extends from `Drawable`

* `.setFont( font: String ) ` CSS-style description of font and font size. Ex: "12pt Times New Roman", "bold 12px Arial", "italic bold 16px Arial".
* `.setText( text: String )`
* `.setLineHeight( lineHeight: number = 0 )` How tall each line should be (in pixels) when breaking up multi-line text. If set to `0`, don't break up multiline text.
* `.setOutlineWidth( width: Number = 0 )` Thickness of the text's outline, in pixels.
* `.setOutlineColor( color: String )`

repository: athiwatp/graphical

repo_name: athiwatp/graphical


text:
---
layout: single
title:  "Tutorials and scripts for several computational chemistry tools"
date:   2017-09-05
categories: research
author_profile: true
header:
  teaser: /assets/img/posts/chem-tools-teaser.png
---
I have created a [GitHub repository (and page)](https://kbsezginel.github.io/chem-tools-tutorials/)
to host tutorials, tips and scripts for several computational chemistry tools that I use.
These include scientific software for running chemistry calculations as well as tools for data and molecular visualization.

I am hoping other people in WilmerLab (and maybe other labs) will join me in this effort
to put together this open source tutorial page that will ease transition of new graduate
students and help people from other instutions.


text:
# Oh My Product Hunt
This is an open-source effort to build an [Android app](https://play.google.com/store/apps/details?id=com.hhua.android.producthunt) for [Product Hunt](https://www.producthunt.com/).

![Screenshots](https://github.com/hhua/product-hunt-android/blob/master/public/img/screenshots_mixed.png?raw=true)

## Download

Download me on [Google Play](https://play.google.com/store/apps/details?id=com.hhua.android.producthunt)

## Why am I building this?

1. [Product Hunt](https://www.producthunt.com/) does not have an official app for Android.
2. I am a [Product Hunt](https://www.producthunt.com/) fan.
3. I was going through the mobile training track from [Groupon](https://www.groupon.com/) and looking for something as capstone project.

## Why am I open-sourcing it?

1. I got help all around from open-source community, and it is time for me to help back.
2. The rate limit on [Product Hunt API](https://api.producthunt.com/v1/docs) makes it impossible for this app to scale to a big crowd of users. Opensourcing the app could allow any hobbyist to use their own API keys to build the app.
3. A big problem of hobby projects is they lack continuity. I believe open sourcing the app could allow this app to be kept improving.
4. Another problem of third-party apps is about privacy and transparency. Since this is an app for the [Product Hunt](https://www.producthunt.com/) community, I believe it is better supervised by the community.

## Notable Issues

1. You cannot vote/comment on a post yet. Updated: The app cannot get the write access. :-< Really sorry guys!

More problems are tracked [here](https://github.com/hhua/product-hunt-android/issues)

## How to Contribute

All bugs and ideas are more than welcome to be added [here](https://github.com/hhua/product-hunt-android/issues)

Check out [how to contribute to "Oh My Product Hunt"](https://github.com/hhua/product-hunt-android/tree/master/CONTRIBUTE.md)

## Related Blog Posts

**Coming Soon**

## Thanks
1. Thanks [Groupon](https://www.groupon.com/) for providing the mobile training program! We are hiring. Shoot me an<EMAIL_ADDRESS>about what you want to [apply](https://jobs.groupon.com/).
2. [Codepath](https://codepath.com/) partnered with [Groupon](https://www.groupon.com/) to provide the mobile training program. Really appreciate courses and help from all the mentors.
3. Product Hunt Team helped me all along the project. They are very responsive whenever I shoot them a message.

###Things that helped me

1. [CodePath libraries](https://github.com/hhua/product-hunt-android/tree/master/app/libs): They helped me build the wrapper for OAuth and using [Scribejava](https://github.com/scribejava/scribejava)
2. [Picasso](http://square.github.io/picasso/): A libray that helps image downloading and caching
3. [Android Asynchronous Http Client](http://loopj.com/android-async-http/): A Callback-Based Http Client Library for Android
4. [RoundedImageView](https://github.com/vinc3m1/RoundedImageView): A fast ImageView that supports rounded corners, ovals, and circles.
5. [PagerSlidingTabStrip](https://github.com/astuetz/PagerSlidingTabStrip): An interactive indicator to navigate between the different pages of a ViewPager
6. [Parse Libraries](https://www.parse.com/docs): Parse helps me to track crash analytics and reports.
7. [Activeandroid](http://www.activeandroid.com/): ActiveAndroid is an active record style ORM

gha_license_id: MIT


text:
---
layout: post
title: (OWASP) A7-Missing Function Level Access Control
categories:
  - Web-Pentesting
---

Anyone with network access can send your application a request. Could anonymous users access private functionality or regular users a privileged function?
Attacker, who is an authorized system user, simply changes the URL or a parameter to a privileged function. Is access granted? Anonymous users could access private functions that aren’t protected.

Applications do not always protect application functions properly. Sometimes, function level protection is managed via configuration, and the system is misconfigured. Sometimes, developers must include the proper code checks, and they forget.
Detecting such flaws is easy. The hardest part is identifying which pages (URLs) or functions exist to attack.

  Question 1 – What is Missing function level access Control?

**Ans**:-

*	Can a user directly browse to a resource?
*	Does the UI expose an unauthorized resource?
*	Server should not solely rely on user supplied input.

  Question 2 – How to prevent yourself from this Vulnerability?

**Ans**:-

*	Deny access to functionality by default.
*	Use Access control lists & role based authentication mechanism.
*	Don’t just hide functions.

  DEMO - Comming Soon!

  ~ Hack the World and Stay Noob

[Twitter](https://twitter.com/Teck__K2) / [Hack The Box](https://www.hackthebox.eu/profile/966) / [CTF Team](https://ctftime.org/team/20102) /
[Teck_N00bs Community Telegram](https://t.me/Teck_N00bs)

url: https://raw.githubusercontent.com/Teckk2/teckk2.github.io/6aac0e2a65b64076e8925e941df7c7ef0d50e16d/_posts/2018-01-30-A7-Missing Function Level Access Control.md

gha_language: CSS

gha_license_id: NOASSERTION


text:
# <img src="images/icon.svg" alt="drawing" width="25"/> Ulauncher/Albert File Search Extension

File and Directory search using Cache. Use a custom **`gitignore`** file (.albertignore2/.ulauncherignore) to ignore files and directories from cache, Use Unix style matching (wildcards) to search.

## Albert Demo

![](images/demo-albert.gif)

## Ulauncher Demo

![](images/demo-ulauncher.gif)

## Features
- Specify directories to search
    - Specify max depth if you want
- Specify directories and files to skip `gitignore` style
    - Works almost like `gitignore`
    - Nested `gitignores` override parrent if possible (see `tests/template_structure` and the `.albertignore2` files in there).
        - e.g Ignore all hidden files in parent directory, unignore a hidden directory in a child ignore file.
- Search files really fast (unless scan index your whole system)
    - Search is scored based on
        - Unix style matching (preferred over the next one)
        - Word matching
        - File/Directory depth
- Tweak almost every setting
    - Icon Themes
    - Scan interval
    - Search threshold
    - Search character threshold
    - Max results returned

## Contents

- [Install for Ulauncher](#install-for-ulauncher)
- [Install for Albert](#install-for-albert)
- [How to setup](#how-to-setup)
- [Examples](#examples)
- [Tests](#tests)

## Install for Ulauncher

Thus extension depends on [pathspec](https://github.com/cpburnz/python-path-specification).

Install it with:
```bash
pip install pathspec
```

Open `Ulauncher` go to `Extensions` > `Add extension` and paste https://github.com/tchar/ulauncher-albert-files

## Install for Albert

Similarly to `Ulauncher` the same dependencies are are required.

To install the extension for Albert run
```bash
pip install pathspec
mkdir -p ~/.local/share/albert/org.albert.extension.python/modules/
git clone https://github.com/tchar/ulauncher-albert-files ~/.local/share/albert/org.albert.extension.python/modules/
```

Open albert, enable `Python` extensions and then enable the `Files` extension.

You can double click it to open module's location and edit `__init__.py` to edit your trigger by editing the `__trigger__` variable.

The other settings can be editted in the settings.ini

## How to Setup

### Albert

If you ar using Albert open the extension location normally at `~/.local/share/albert/org.albert.extension.python/modules/ulauncher-albert-files/__init__.py` and edit the trigger named `__triggers__` to change the keyword

The file `~/.local/share/albert/org.albert.extension.python/modules/ulauncher-albert-files/settings.ini` contains the settings

The extension can work in albert without keywords if you comment out the `__triggers__` option, however if another extension has the keyword you type, `Files won't trigger` (see [relevant issue](https://github.com/albertlauncher/albert/issues/978))

### Ulauncher

If you are using Ulauncher use the extension preferences.

### Options

- Main Options
    - `albert`: Under `[DEFAULT]`
    - Scan Every Minutes: Interval to scan directories specified (default 2 minutes)
        - `ulauncher`: `Scan interval in minutes`
        - `albert`: `SCAN_EVERY_MINUTES`
    - Ignore filename: The filename to use as ignore
        - `ulauncher`: `Name of ignore file`
        - `albert`: `IGNORE_FILENAME` (default .albertignore2)
    - Search after Characters: Number of characters to skip before run searching (default 2, if set to 0 searches from first character, excluding keyword)
        - `ulauncher`: `Characters to start searching after`
        - `albert`: `SEARCH_AFTER_CHARACTERS`
    - Search Max Results: Maximum number of results to return (default 5)
        - `ulauncher`: `Maximum Search Results`
        - `albert`: `SEARCH_MAX_RESULTS`
    - Search theshold: Threshold value to keep or drop result (default 0.5, between 0.0 and 1.0)
        - `ulauncher`: `Threshold to limit searches`
        - `albert`: `SEARCH_THRESHOLD`
    - Icon Theme: The icon theme to use. Can be a path of a folder which contains images of icons named with the extension`[.svg|.png|or any other image]`. Built in icon themes are: `square-o`, `classic`, `high-contrast`, `vivid`. Default `square-o`
        - `ulauncher`: `Name or Path of icon theme`
        - `albert`: `ICON_THEME`
    - Use built in folder theme: If set to `No/False` it will try to fetch folder icons based on your gtk icon theme. If set to `Yes/True` it will use the built-in folder icons (default `No/False`)
        - `ulauncher`: `Use built in folder theme`
        - `albert`: `USE_BUILT_IN_FOLDER_THEME`
- Path options:
    - `ulauncher`: `Directories to scan, as well as depth`: Set a directory to scan in each line of the text area as follows:
        - Specify directory e.g (`~/`)
        - Optionally specify max depth (5 for example) to scan as (`~/=5`)
    - `albert`: You can view the `settings_example.ini` for another example. Specify as many `[DIRECTORY]` sections you want each starting with prefix `DIRECTORY` and some number or other character
    examples: `[DIRECTORY1]`, `[DIRECTORY2]`, `[DIRECTORY_A]`, `[DIRECTORY_B]` etc. Each `DIRECTORY` section should have:
        - `PATH=/some/path`: An path in your system. You can use tilde (`~`) for your `home`
        - `DEPTH=`: Optionally a depth to scan the aforementioned directory up to. If not set or set to `0` it will scan

## Examples

Use your keyword (default `?`) and type something to search.

You can use normal matching: `? Downloads` or `? A_file`

You can use wildcard matching: `? *.png` or `? some_file*.pdf`
The results are usually fast if you don't scan your whole filesystem

## Tests

To run tests you need pytest
```
pip install pytest
pytest
```

The test runs against a template structured located in `tests/template_structure`. You can follow the `.albertignore2` file along the `template_structure` to check what is ignored and what not.

repository: tchar/ulauncher-albert-files

repo_name: tchar/ulauncher-albert-files


text:
# REDCapPlainTextReport

This REDCap plugin allows you to export data from an event for a particular record as plain text. (For concise printing, formatting and other purposes.)

## Installation
Put the REDCapPlainTextReport.php file in plugings directory (usually /var/www/html/redcap/plugins or /var/www/redcap/plugins). Create a bookmark ("Project Setup" -> "Add or edit bookmarks") to link "https://yoursite/plugins/REDCapPlainTextReport.php. Check "Append record info to URL" and "Append project info ID to URL".

## Usage
Open a data entry page for a subject, then click on the plugin link. Select event and text report appears. Useful for Copy&Paste.

repository: PavelDusek/REDCapPlainTextReport

repo_name: PavelDusek/REDCapPlainTextReport


text:
## Installation & pre-requisites

In this section we will:
- Create a KinD Kubernetes Cluster
- Install Crossplane core components
- Install Crossplane Helm and Kubernetes providers
- Install Dapr

Let's create a KinD Cluster:

```
kind create cluster
```

Let's install [Crossplane](https://crossplane.io) into its own namespace using Helm:

```

helm repo add crossplane-stable https://charts.crossplane.io/stable
helm repo update

helm install crossplane --namespace crossplane-system --create-namespace crossplane-stable/crossplane --wait
```

Install the `kubectl crossplane` plugin:

```
curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh
sudo mv kubectl-crossplane /usr/local/bin
```

Then install the Crossplane Helm provider:
```
kubectl crossplane install provider crossplane/provider-helm:v0.10.0
```

We need to get the correct ServiceAccount to create a new ClusterRoleBinding so the Helm Provider can install Charts on our behalf.

```
SA=$(kubectl -n crossplane-system get sa -o name | grep provider-helm | sed -e 's|serviceaccount\/|crossplane-system:|g')
kubectl create clusterrolebinding provider-helm-admin-binding --clusterrole cluster-admin --serviceaccount="${SA}"
```

```
kubectl apply -f config/helm-provider-config.yaml
```

We also need to install the Crossplane Kubernetes Provider if we want to install custom resources.

```
kubectl crossplane install provider crossplane/provider-kubernetes:main
```

Getting providers credentials
```
SA=$(kubectl -n crossplane-system get sa -o name | grep provider-kubernetes | sed -e 's|serviceaccount\/|crossplane-system:|g')
kubectl create clusterrolebinding provider-kubernetes-admin-binding --clusterrole cluster-admin --serviceaccount="${SA}"
```

And then configure it (this is only necessary if we are planning to install a kubernetes resource in the cluster where crossplane is installed):

```
kubectl apply -f config/kubernetes-provider-config.yaml
```

After a few seconds if you check the configured providers you should see both Helm and Kubernetes `INSTALLED` and `HEALTHY`:

```
kubectl get providers.pkg.crossplane.io
NAME                             INSTALLED   HEALTHY   PACKAGE                               AGE
crossplane-provider-helm         True        True      crossplane/provider-helm:v0.10.0      49s
crossplane-provider-kubernetes   True        True      crossplane/provider-kubernetes:main   19s
```

Let's install Dapr next:

```
helm repo add dapr https://dapr.github.io/helm-charts/
helm repo update
helm upgrade --install dapr dapr/dapr \
--version=1.10.2 \
--namespace dapr-system \
--create-namespace \
--wait
```

Now we are ready to install our Databases Crossplane composition so we can provision all the components that our application needs to work.

## Working with Cloud Providers (example GCP)

If you want to extend the demo and create Cloud Resources in a Cloud Provider you need to install the corresponding Crossplane Provider, along side with the specific rights to create the resources that you are planning to provision using Crossplane resources.

We will use the Getting Started for GCP package that includes the GCP provider:

```
kubectl crossplane install configuration registry.upbound.io/xp/getting-started-with-gcp:v1.10.2
```

Then we need to enable the services and create the roles needed for the provider to create specific cloud resources:

```
# replace this with your own gcp project id and the name of the service account
# that will be created.
PROJECT_ID=my-project
NEW_SA_NAME=test-service-account-name

# create service account
<EMAIL_ADDRESS>gcloud iam service-accounts create $NEW_SA_NAME --project $PROJECT_ID

# enable cloud SQL API
SERVICE="sqladmin.googleapis.com"
gcloud services enable $SERVICE --project $PROJECT_ID

# grant access to cloud SQL API
ROLE="roles/cloudsql.admin"
gcloud projects add-iam-policy-binding --role="$ROLE" $PROJECT_ID --member "serviceAccount:$SA"

# enable cloud InMemoryStore API
SERVICE="redis.googleapis.com"
gcloud services enable $SERVICE --project $PROJECT_ID

# grant access to cloud InMemoryStore API
ROLE="roles/redis.admin"
gcloud projects add-iam-policy-binding --role="$ROLE" $PROJECT_ID --member "serviceAccount:$SA"

# create service account keyfile
gcloud iam service-accounts keys create creds.json --project $PROJECT_ID --iam-account $SA

```

Once we enabled the services and created the roles, we need to create a new Kubernetes Secret so the Crossplane Provider can access it:

```
kubectl create secret generic gcp-creds -n crossplane-system --from-file=creds=./creds.json

```

Finally, we glue all the configurations together by creating a new `ProviderConfig` resource:

```
PROJECT_ID=my-project
echo "apiVersion: gcp.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
  name: default
spec:
  projectID: ${PROJECT_ID}
  credentials:
    source: Secret
    secretRef:
      namespace: crossplane-system
      name: gcp-creds
      key: creds" | kubectl apply -f -
```

Once you have the GCP provider configured you can deploy the compositions that create GKE resources, and use the `gke` level for matching selectors.

```
kubectl apply -f app-database-redis-gke.yaml
kubectl apply -f app-database-redis-gke-dapr.yaml
```

gha_language: HTML