text:
---
layout: post
title:  "Deep learning notes 05: Unsupervised vision with DINO"
date:   2021-05-11 21:50:44 +0200
author: Petr Houška
categories: papers
#truncate: 3600
---

> This post if from a series of quick notes written primarily for personal usage while reading random ML/SWE/CS papers. As such they might be incomprehensible and/or flat out wrong.

### [DINO: Emerging Properties in Self-Supervised Vision Transformers](https://www.youtube.com/watch?v=h3ij3F3cPIk)
- Unsupervised learning regime for vision (self attention, 8x8 patches) transformers
  - Intermediate representation clusters pictures of similar labels together (without seeing labels)
  - Capable of object detection and masking (attention mask segments objects very well)
  - Capable of classification (output KNN to known labeled examples)
  - Copy detection, image retrieval, … -> good similarity measure
- Attention masks for CLS token: the token that contains final representation (doesn't have image patch on input, to not bias)
- Self-supervised learning: self-distillation without labels
- Negative samples learning:
  - Take anchor patch and patch A from one image, and patch B from second image
  - Give all three patches to the model, tell it which is anchor patch
  - Ask whether A or B is from the same as anchor
- Self-supervised without negative samples learning
  - Use only one image, augment in multiple ways (BYOL) -> produce two versions for teacher and student
    - Global crops: > 50 % of the image
    - Local crops: < 50 % of the image
    - Rotations, color-jitters, ...
  - Pass each one version through teacher, one through student
    - Note: Actually pass both through both, loss is combination of cross-difference
  - Loss is the difference between end image representations (CLS output)
    - Same image, only differently augmented -> should have similar representation
    - To mitigate collapse to single repre. -> different models for teacher and student
  - Only train (backprop) student, build teacher as exponential average of students
- Teacher only uses global cropping
  - If student has local crop -> student learns that its patch should match the whole with more context
  - -> forces the model to learn part-whole relationship & representing the whole image
- Teacher maintains running average of all representations it sees -> subtracts it from its representation
  - ~normalization, helps against collapse
- Representation has softmax with temperature at the end
  - Dimensionality of softmax is arbitrary: don't have explicit labels (unsupervised) -> who knows how many
  - Teacher has sharpening -> more peaked distribution -> forcer larger differences between diff. outputs
  - Softmax is not common in unsupervised -> forces model to come up with "its own classes"
- Versus supervised learning
  - Supervised has way more noisy / overfitted attention mask -> hyper optimization on the task at hand
- Why does it work?
  - Augmentations: in computer vision they're super important ~ that's where the human prior is
    - What's augmented away doesn't matter
- Dataset: there's always an explicit object of interest -> how we take pictures brings prior

repository: petrroll/devblog

gha_language: SCSS

repo_name: petrroll/devblog


text:
# A guide

[![Latest Release](https://img.shields.io/github/v/tag/jameswoolfenden/terraform-guidelines.svg)](https://github.com/jameswoolfenden/terraform-guidelines)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)

By [James Woolfenden](https://www.linkedin.com/in/jameswoolfenden/)

## A style guide for writing Terraform

This is a guide to writing Terraform, it follows the Hashicorp guide to creating modules for the [Terraform Registry](https://www.terraform.io/docs/registry/modules/publish.html) and their [standard structure](https://www.terraform.io/docs/modules/index.html#standard-module-structure).

There are many successful ways of writing your tf, this one is tried and field tested.

## Naming

Use Lower-case names for resources.
Use "\_" as a separator for resource names.
Names must be self explanatory containing several lower-case words if needed separated by "\_".

Use descriptive and non environment specific names to identify resources.

Avoid Tautologies:

``` terraform
resource "aws_iam_policy" "ec2_policy"{
  ...
}
```

## Hard-coding

Don't hard-code values in resources. Add variables and set defaults.

You can avoid limiting yourself with policies and resources by making resources optional or over-ridable.

```Terraform
resource "aws_iam_role" "codebuild" {
  name  = "codebuildrole-${var.name}"
  count = "${var.role == "" ? 1 : 0}"

  assume_role_policy = <<HERE
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "codebuild.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
HERE

  tags = var.common_tags
}
```

And avoid HEREDOCS like the one above, and use **data.aws_iam_policy_documents** objects, as practical.

## Templates

This is the Terraform code that is environment specific.  If your Templates are application specific the code should live with the code that requires it, create a folder in the root of the repository and call it **IAC**, similar to this for the repository aws-lexbot-handlers:

```bash
23043-5510:/mnt/c/aws-lexbot-handler# ls -l
total 64
-rwxrwxrwx    1 jimw     jimw          1719 Mar  7 11:02 README.MD
-rwxrwxrwx    1 jimw     jimw           411 Mar  7 11:02 buildno.sh
-rwxrwxrwx    1 jimw     jimw          1136 Mar 18 15:43 buildspec.yml
-rwxrwxrwx    1 jimw     jimw           489 Mar 18 15:40 getlatest.ps1
-rwxrwxrwx    1 jimw     jimw           479 Mar  7 11:02 getlatest.sh
drwxrwxrwx    1 jimw     jimw           512 Feb 26 16:22 iac
drwxrwxrwx    1 1000     1000           512 Mar 18 15:41 node_modules
-rwxrwxrwx    1 jimw     jimw         49979 Mar 18 15:41 package-lock.json
-rwxrwxrwx    1 jimw     jimw          1579 Mar 18 15:41 package.json
drwxrwxrwx    1 jimw     jimw           512 Feb  5 11:51 powershell
-rwxrwxrwx    1 jimw     jimw           147 Mar  7 11:02 setlatest.sh
```

Inside the **iac** I breakdown the **templates** used:

```bash
total 0
drwxrwxrwx    1 jimw     jimw           512 May 28 11:22 codebuild
drwxrwxrwx    1 jimw     jimw           512 Apr  2 11:00 repository
```

This example  has an AWS CodeCommit repository (self describing) and an AWS Codebuild, that has multiple environments:

```bash
total 0
drwxrwxrwx    1 jimw     jimw           512 Apr 24 23:28 dev
drwxrwxrwx    1 jimw     jimw           512 Apr 24 23:29 prod
```

Inside each of these folder is an environmental specific template:

```bash
total 19
-rwxrwxrwx    1 jimw     jimw           800 May 28 11:21 Makefile
-rwxrwxrwx    1 jimw     jimw          1324 Mar  7 11:02 README.md
-rwxrwxrwx    1 jimw     jimw           709 Mar  7 11:02 aws_iam_policy.additionalneeds.tf
-rwxrwxrwx    1 jimw     jimw            40 Mar  7 11:02 data.aws_current.region.current.tf
-rwxrwxrwx    1 jimw     jimw           579 May 28 11:23 module.codebuild.tf
-rwxrwxrwx    1 jimw     jimw           239 Mar  7 11:02 outputs.tf
-rwxrwxrwx    1 jimw     jimw           208 Apr 24 23:30 provider.tf
-rwxrwxrwx    1 jimw     jimw           349 Mar  7 11:02 remote_state.tf
-rwxrwxrwx    1 jimw     jimw          1531 May 28 11:25 terraform.tfvars
-rwxrwxrwx    1 jimw     jimw           618 May 28 11:20 variables.tf
```

There's a lot of files here and some repetition - that violates DRY principles, but with IAC, favour on being explicit.
Each template is directly runnable, using the Terraform CLI with no wrapper script required.
Use a generator like [tf-scaffold](https://github.com/JamesWoolfenden/tf-scaffold) to automate template creation.

Tf-Scaffold creates:

### .gitignore

Has good defaults for working with Terraform.

```yaml
terraform.tfplan
terraform.tfstate
.terraform/
./*.tfstate
*.backup
*.DS_Store
*.log
*.bak
*~
.*.swp
.project

```

### .github/workflow/main.yml

If your using Github you can add a basic CI workflow:

This is a sample workflow, for the minimum validation of a module **main.yml**:

```yml
---
name: Verify and Bump
on:
  push:
    branches:
      - master
jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.7]

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v1
        with:
          python-version: ${{ matrix.python-version }}
      - name: "Terraform Init"
        uses: hashicorp/terraform-github-actions@master
        with:
          tf_actions_version: 0.12.28
          tf_actions_subcommand: "init"
          tf_actions_working_dir: "example/examplea"
      - name: "Terraform Validate"
        uses: hashicorp/terraform-github-actions@master
        with:
          tf_actions_version: 0.12.28
          tf_actions_subcommand: "validate"
          tf_actions_working_dir: "example/examplea"
      - name: Test with Checkov
        run: |
          pip install checkov
          checkov -d .
  version:
    name: versioning
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Bump version and push tag
        uses: anothrNick/github-tag-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DEFAULT_BUMP: patch
          WITH_V: "true"
    needs: build

```

### .terraformignore

If using Terraform cloud, the files not to upload to their cloud.

```ini
.terraform/
*.exe
*.tfstate
*.backup
*.bak
*.info

```

### .pre-commit-config.yaml

Has a standard set of pre-commit hooks for working with Terraform and AWS. You'll need to install the pre-commit framework https://pre-commit.com/#install.
You can modify the default behaviour of Git on a workstation to always implement hooks:

On Windows (Pwsh)

```powershell
pre-commit init-templatedir $HOME\.git-template
git config --global init.templateDir $HOME\.git-template
```

On Nix

```bash
git config --global init.templateDir ~/.git-template
pre-commit init-templatedir ~/.git-template
```

When you clone a file with hooks they are now installed.

And after that you need to add this file (or a similar one) to any new repository **pre-commit-config.yaml**, in the root:

```yaml
---
# yamllint disable rule:line-length
default_language_version:
  python: python3
repos:
  - repo: git://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
      - id: check-json
      - id: check-merge-conflict
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files
      - id: pretty-format-json
        args:
          - --autofix
      - id: detect-aws-credentials
      - id: detect-private-key
  - repo: git://github.com/Lucas-C/pre-commit-hooks
    rev: v1.1.9
    hooks:
      - id: forbid-tabs
        exclude_types:
          - python
          - javascript
          - dtd
          - markdown
          - makefile
          - xml
        exclude: binary|\.bin$
  - repo: git://github.com/jameswoolfenden/pre-commit-shell
    rev: 0.0.2
    hooks:
      - id: shell-lint
  - repo: git://github.com/igorshubovych/markdownlint-cli
    rev: v0.23.2
    hooks:
      - id: markdownlint
  - repo: git://github.com/adrienverge/yamllint
    rev: v1.24.2
    hooks:
      - id: yamllint
        name: yamllint
        description: This hook runs yamllint.
        entry: yamllint
        language: python
        types: [file, yaml]
  - repo: git://github.com/jameswoolfenden/pre-commit
    rev: v0.1.33
    hooks:
      - id: terraform-fmt
      - id: checkov-scan
        language_version: python3.7
      - id: tf2docs
        language_version: python3.7
```

Use hooks that don't clash and ensure they are cross platform compatible.

``` bash
pre-commit install
```

Hooks choices are a matter for each project, but if your are using Terraform or AWS the credentials and private key hooks or equivalent are required.

### main.tf

This is an expected file for Terraform modules. Remove it if this a template and add a **module.tf**.

### Makefile

A helper file. This is just to make like easier for you. Problematic if you are cross platform as make isn't very good/awful at that. If you use Windows update the PowerShell profile with equivalent helper functions instead.

```makefile
#Makefile
ifdef OS
   BLAT = $(powershell  -noprofile rm .\.terraform\ -force -recurse)
else
   ifeq ($(shell uname), Linux)
      RM  = rm .terraform/modules/ -fr
      BLAT= rm .terraform/ -fr
   endif
endif

.PHONY: all

all: init plan build

init:
   $(RM)
   terraform init -reconfigure

plan:
   terraform plan -refresh=true

p:
   terraform plan -refresh=true

apply: build

build:
   terraform apply -auto-approve

check: init
   terraform plan -detailed-exitcode

destroy: init
   terraform destroy -force

docs:
   terraform-docs md . > README.md

valid:
   terraform fmt -check=true -diff=true
   checkov -d . --external-checks-dir ../../checkov

target:
   @read -p "Enter Module to target:" MODULE;
   terraform apply -target $$MODULE

purge:
   $(BLAT)
   terraform init -reconfigure
```

### outputs.tf

A standard place to return values, either to the screen or to pass back from a module. Use descriptions.

### provider.aws.tf

Or Whatever you provider is or are.
Required. You are always going to be using these, included is this, the most basic provider for AWS.

### README.md

Where all the information goes.

### example.auto.tfvars

Files ending .auto.tfvars get picked by Terraform locally and in Terraform cloud.
This is the standard file for setting your variables in, and is automatically picked up by Terraform.

### variables.tf

For defining your variables and setting default values. Each variable should define its type and have an adequate description.
Also contains a map variable common_tags, which should be extended and used on every taggable object.  Use descriptions.

As of Terraform 0.13 Custom Input validation for variables has arrived.

Ok so? This means we finally has some control for Testing and Validation.

You can now automatically add tests so that your input values are set correctly, for your templates and modules, it a basic boundary check.

The minimal basics are explained here: https://www.terraform.io/docs/configuration/variables.html this is a very basic explanation.. sigh.

To see what really possible you need to combine these conditions with the functions that are already available in Terraform:

#### Check to see value is not null

```terraform
variable "config_file" {
  type        = string
  description = ""
  validation {
    condition     = length(var.config_file) > 0
    error_message = "This value cannot be an empty string."
  }
}
```

#### Check to see item is set to valid options only

```terraform
variable "log_level" {
  type        = string
  description = "The Log level value must be one of 'DEBUG', 'INFO','WARNING', 'ERROR','CRITICAL'."

  validation {
    condition     = can(regex("DEBUG|INFO|WARNING|ERROR|CRITICAL", var.log_level))
    error_message = "The Value must be one of 'DEBUG', 'INFO','WARNING', 'ERROR','CRITICAL'."
  }
}
```

or

```terraform
variable "tracing_mode" {
  type        = string
  description = "x-rays settings"
  default     = "Active"

  validation {
    condition     = contains(["PassThrough","Active"], var.tracing_mode)
    error_message = "Tracing mode can only be PassThrough or Active."
  }
}
```

#### Check to see variable is formatted correctly

```terraform
variable "runtime" {
  type        = string
  description = "The lambda runtime"
  default     = "python2.7"
  validation {
    condition     = length(var.runtime) > 5 && substr(var.runtime, 0, 6) == "python"
    error_message = "This uses python so its value need to start with \"python\"."
  }
}
```

### .dependsabot/config.yml

Sets the repository to be automatically dependency scanned in Github.

## Modules

You've written some TF and your about to duplicate its' functionality, it's time to abstract to a module. A module should be more than just one resource, it should add something.
Modules should be treated like applications services with a separate code repository for each module.

Each module should have a least one example included that demonstrates its usage. This example can be used as a test for that module, here its called **examplea**.

```bash
examples/examplea
```

This is an example for using AWS codecommit that conforms <https://github.com/JamesWoolfenden/terraform-aws-codecommit>

Use lowercase for all folder namesm, avoid spaces.

## Files

### Name your files after their contents

For a security group called "elastic", the resource is then aws_security_group.elastic, so the file is **aws_security_group.elastic.tf**. Be explicit.
It will save you time.

### Comments

Use Markdown for this, as many fmt and parsers break when you add comments into your TF with hashes and slash star comments. Some say it helps. Make sure to add descriptions to your variables and outputs.

### One resource per file

**Exception**: By all means group resources - where its really makes logical sense, security_group with rules, routes with route tables.

The style suggestion follows the standard practice in most development languages, it helps you navigate your code in your editor. Editing the same file in multiple locations is unhelpful.

## Be Specific

You have 2 choices with dependencies. Live on the bleeding edge, or fix your versions. I recommend being in control [That's fixing the version].

### Fix the version of Terraform you use

The whole team needs to use the same version of the tool until you decide as a team to update.
Create a file called **terraform.tf** in your template:

```terraform
terraform {
    required_version="~> 0.13.0"
}
```

You will need to do do a coordinated update of provider versions and tools versions at regular intervals e.g. ~3 months.

### Fix the version of the modules you consume

In your **module.tf** file, set the version of the module. If you author modules, make sure you tag successful module builds.
If your module comes from a registry, specify using the version property, if its only standard git source reference use a tag reference in your source statement.

If it's using modules from the registry like **modules.codebuild.tf**:

```terraform
module codebuild {
  source                 = "jameswoolfenden/codebuild/aws"
  version                = "0.1.41"
  root                   = var.root
  description            = var.description
}
```

### Fix the version of the providers you use

Using shiny things is great, what's not great is code that worked yesterday breaking because a plugin/provider changed. Specify the version in your **provider.tf** file.

```terraform
provider "aws" {
  region  = "eu-west-1"
  version = "3.00.0"
}
```

## State

By default, Terraform stores the state locally in a file named `terraform.tfstate`; a local state means that any changes applied to the infrastructure will only be aligned with the developer's machine.

For a complete beginner that could be a solution when trying out Terraform for the first time, but it certainly doesn't scale: if someone else wants to contribute to the code, things get misaligned very quickly, and what if the state file automagically disappears from the hard drive? You'll either destroy unexpectedly or lose control of your infrastructure.

Adding the state file to the SCM might seem to solve some of these problems, but it is never recommended: secret values and passwords might be stored in the state file, and those should never be commited to version control. That approach also relies on having commited and pulled the very latest version, which in practice is next to impossible.

The correct way is to use [remote states](https://www.terraform.io/docs/state/remote.html): in this case, the _state_ data is written to a remote data store and shared with all the team members and/or automation tools.

Another important feature is [state locking](https://www.terraform.io/docs/state/locking.html): it stops the state file being corrupted by multiple writes, and it also indicates to users if they are attempting to update the same code.

Furthermore, the concept of versioning comes handy: it allows to recover from file corruption and accidental upgrades, as well as giving traceable record of past configuration.

There are many options for implementing remote state, popular choices include:

- [S3 state bucket](https://www.terraform.io/docs/backends/types/s3.html) with Bucket Versioning and DynamoDB locking

  Quite common when using the AWS provider; a good template can be found [here](https://registry.terraform.io/modules/JamesWoolfenden/statebucket/aws/0.0.15)

- [GCS state bucket](https://www.terraform.io/docs/backends/types/gcs.html) with Object Versioning

  Used mainly when creating the infrastructure for the Google Cloud Platform

- [Azure state blob](https://www.terraform.io/docs/backends/types/azurerm.html)

  Stores the state using Azure Blob Storage, which supports locking and consistency checking

- [Terraform Cloud/Enterprise](https://www.terraform.io/docs/backends/types/remote.html#basic-configuration)

  A good option for provider-agnostic storage of the state; requires configuring the [access credentials](https://www.terraform.io/docs/commands/cli-config.html#credentials) (token) via a `terraform.rc` file

- ... even more [here](https://www.terraform.io/docs/backends/types/index.html)

A good choice for multi-provider code is Terraform Cloud: one key element to keep in mind is that the sensitive data part of the state will be stored on HashiCorp's servers.

For Terraform code that uses (primarily) one provider, a good option is to use the service-specific storage and locking method.

## Layout

Mandate the use of the standard pre-commits, this enforces the use of the command **Terraform fmt** on every Git commit. End of problem.

## Protecting Secrets

Protect your secrets by installing using the pre-commit file and the hooks from the standard set:

```hooks
- id: detect-aws-credentials
- id: detect-private-key
```

Other options include using git-secrets, Husky or using Talisman.  Use and mandate use of one, by all.

## Configuration

Convention over configuration is preferred.
Use a data source over adding a configuration value.
Set default values for your modules variables.
Make resources optional with the count syntax.

## Unit Testing

As yet to find a really satisfactory test approach or tool for testing Terraform other than:

- Include a test implementation with your modules - from your examples root folder.
- Run it for every change.
- Tag the successful outcomes.
- Destroy created resources

Use Checkov, Consider using the Open Policy Agent.

## Tagging

Implement a tagging scheme from the start, and use a map type for extensibility.

In **variables.tf**:

```terraform
variable "common_tags" {
  type       = "map"
  description= "Implements the common_tags scheme"
}
```

And in your **example.auto.tfvars**

```terraform
  common_tags={
    name      = "sap-proxy-layer"
    owner     = "James Woolfenden"
    costcentre= "development"
  }
```

and then have the common_tags used in your resources file:

```terraform
resource "aws_codebuild_project" "project" {
  name          = "${replace(var.name,".","-")}"
  description   = var.description
  service_role  = "${var.role == "" ? element(concat(aws_iam_role.codebuild.*.arn, list("")), 0) : element(concat(data.aws_iam_role.existing.*.arn, list("")), 0) }"
  build_timeout = "var.build_timeout

  artifacts {
    type                = var.type
    location            = local.bucketname
    name                = var.name
    namespace_type      = var.namespace_type
    packaging           = var.packaging
    encryption_disabled = var.encryption_disabled
  }

  environment = var.environment
  source      = var.sourcecode
  tags        = var.common_tags
}
```

So, use Readable Key value pairs.
You don't have to name your like your still on premise.
So naming a security group

DEV_TEAM_WILBUR4873_APP_SG

is not necessarily helpful but

```HCL
tags={
TEAM="Wilbur"
Purpose="App"
CostCode="4873"}
```

Is better. Names you can't update, tags you can. The longer you make the resource names the more bugs you will find/make.
Ok I get it some resources don't have tag attributes or you have some "Security" policy or other that mean you must have a naming regime.

If so I'd either use or copy the naming module from the Cloud Posse
[https://github.com/cloudposse/terraform-null-label](https://github.com/cloudposse/terraform-null-label).

## Workspaces

Confusingly this means 2 things in the Terraform world.

### Old workspaces

When should I use these workspaces, here is the hashicorp guidance:

<https://www.terraform.io/docs/state/workspaces.html#when-to-use-multiple-workspaces>

Clearly a reduced use case of just using for branch based changes, but i think even that case is weak:
Workspace interpolation pretty much makes me want to say no to using. Workspaces aren't for separate environments and you have to code you vars and values special for using them.

How not to use this:

```cli
bucket = "${terraform.workspace == "preprod" ? var.bucket_demo_preprod : var.bucket_demo}"
```

Not simple.

<https://medium.com/@milescollier/handling-environmental-variables-in-terraform-workspaces-27d0278423df>

I'm sure you could make this work.

### New workspaces

These workspaces are concerned with Terraform Cloud:
<https://www.terraform.io/docs/cloud/guides/recommended-practices/part1.html>

Obvious.

## Recommended Tools

[Terraform-docs](https://github.com/segmentio/terraform-docs)

Run to help make your readmes.

The [Pre-commit](https://pre-commit.com/) framework

So many different uses from linting to security, every git repo should have one.

[Beyond-Compare](https://www.scootersoftware.com/) or equivalent

A preference, for a comparison tool. This one is cross platform compatible.

The Cli

Be it AWS, or whatever provider your using.

[VSCode](https://code.visualstudio.com/) and Extensions

Free and really quite good editor, with awesome extensions. Use the Extensions sync extension to maintain your [environment](https://gist.github.com/JamesWoolfenden/1a1ce363e6e6e5d2bcf321ca12ec3de2).

[SAML2AWS](https://github.com/Versent/saml2aws)

Generates temporary AWS credentials for AWS cmdline. Essential for running in Federated AD environment.

[Checkov](https://checkov.io)

Checks your Terraform for security flaws. This should be part of basic toolset.

[Travis](https://travis-ci.com/) - or free for [open source projects](https://travis-ci.org/getting_started).

[Circle](https://circleci.com/) a Leading CICD SAS tool that integrates with your codebase.

There are many other good SAS CI/CD tools including Circle, GitLab and a few shockers.

[AzureDevOps](https://azure.microsoft.com/en-gb/services/devops/)

It maybe born/spawn of TFS but this tool has improved so much (I KNOW) to make it a viable option even for non Azure projects.

[Hub](https://github.com/github/hub)

Makes working with Github at the cli easy.

[LocalStack](https://localstack.cloud/)

This tool allows you to mock your AWS set-up, works with Terraform and the awscli - and use the awslocal wrapper.

[mingrammer/diagrams](https://diagrams.mingrammer.com/)

Use this tool to visualise your designs as code.

![stateful architecture](https://diagrams.mingrammer.com/img/stateful_architecture_diagram.png)

See the repo <https://github.com/mingrammer/diagrams>.

## Caches

Set a [plugin cache](https://www.terraform.io/docs/commands/cli-config.html).  It will save you time and stress.

### Contributors

[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]

[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150

repository: JamesWoolfenden/terraform-guidelines

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: JamesWoolfenden/terraform-guidelines


text:
# ProjectFour_TeamX

How to run

## Clone project from git

```bash
$> git clone https://github.com/SER516/ProjectFour_TeamX
$> cd ProjectFour_TeamX
```

Run the following commands in separate terminals

## Start the main.server

Open a terminal and run the following command:

```bash
$> java -jar bin/ProjectFour_TeamX-server.jar
```

## Launch a first main.client

Open a second terminal and run the following command:

```bash
$> java -jar bin/ProjectFour_TeamX-client.jar
```

license: MIT


text:
---
layout: default
---

# 1994-06-18 - Re: Perry vs. the Math Teacher

## Header Data

From: Bradley C Wallet<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: ce4ef2b646fbd1895a71d93efebe859432a6ceacd9ce209503825c70da813227

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1994-06-18 02:04:27 UTC

Raw Date: Fri, 17 Jun 94 19:04:27 PDT

## Raw message

```
{% raw  %}From: Bradley C Wallet<EMAIL_ADDRESS>Date: Fri, 17 Jun 94 19:04:27 PDT
To<EMAIL_ADDRESS>Subject: Re: Perry vs. the Math Teacher
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

>      Go figger. It's become a haven of learning, where the more learned
> teach those willing to learn, instead of the self-congratulatory elitist
> squad I was told it once was. That's why *I'm* here, to learn from those
> who know more than I do. I am VERY willing to learn what others have to
> teach. They know more than I do, and there's some very knowledgeable
> people here.
>
>      I've recieved some very nice replies to my earlier question about
> what O(f(x)) meant, including one from you, Mike McNally, Bill O'Hanlon,
> and Douglas Sinclair (thanx guys!! If anyone else sent anything, I haven't
> recieved it yet, but you do have my thanx, in advance!). This only proves
> that there are people who are only too willing to teach if someone shows
> they are willing to listen, and learn.

but, there is a basic level of competancy that must b assumed...the big O
is a basic undergrad concept...same for the MOD function...if u hope to
ever study a specialty field such as cryptology, u have 2 know the basics...

u should already know undergrad math if u r gonna look at crypto
algorithms...

brad

{% endraw %}
```

## Thread

+ Return to [June 1994](/archive/1994/06)

+ Return to "[Bradley C Wallet <bwallet@mason1.gmu.edu>](/authors/bradley_c_wallet_bwallet_at_mason1_gmu_edu_)"
+ Return to "[Jeff Gostin <jgostin@eternal.pha.pa.us>](/authors/jeff_gostin_jgostin_at_eternal_pha_pa_us_)"
+ Return to "["Perry E. Metzger" <perry@imsi.com>](/authors/perry_e_metzger_perry_at_imsi_com_)"
+ Return to "[SINCLAIR  DOUGLAS N <sinclai@ecf.toronto.edu>](/authors/sinclair_douglas_n_sinclai_at_ecf_toronto_edu_)"
+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_netcom_com_timothy_c_may_)"

+ 1994-06-17 (Fri, 17 Jun 94 16:50:27 PDT) - [Re: Perry vs. the Math Teacher](/archive/1994/06/6e516e9ad721efeab300453923e0345fd1742c6bd7e8947469a31ae246d04da2) - _Jeff Gostin<EMAIL_ADDRESS>  + 1994-06-18 (Fri, 17 Jun 94 19:04:27 PDT) - Re: Perry vs. the Math Teacher - _Bradley C Wallet<EMAIL_ADDRESS>    + 1994-06-18 (Fri, 17 Jun 94 19:26:12 PDT) - [Re: Perry vs. the Math Teacher](/archive/1994/06/6ed1e425dbbf835f72333cd841b429f117351695c17b0e197bcac104484a916b) - _SINCLAIR  DOUGLAS N<EMAIL_ADDRESS>      + 1994-06-18 (Fri, 17 Jun 94 21:10:57 PDT) - [Re: Perry vs. the Math Teacher](/archive/1994/06/6ce12b373c0fbf1ea6693b67e5f7e36820b6f5e149bf83713c20bc9c3cda1df3) -<EMAIL_ADDRESS>(Timothy C. May)_
  + 1994-06-20 (Mon, 20 Jun 94 04:59:55 PDT) - [Re: Perry vs. the Math Teacher](/archive/1994/06/39808ae8286abbbfa5e14edb51d1905833fd2290a484a034720144830ae54e36) - _"Perry E. Metzger"<EMAIL_ADDRESS>

gha_license_id: MIT


text:
# KPDropMenu
KPDropMenu is an Objective-C port of [HADropDown](https://github.com/Hassan-Aftab/HADropDown). It expands and collapses in two directions (up & down). It allows the user to select only one item at a time. One can customize font, color, item height, alignment, etc in code (as well as Interface Builder).

### Screenshot
![](https://github.com/KrishnaPatell/KPDropMenu/blob/master/KPDropMenu/demo.gif)

### Installation
Simply include KPDropMenu.h and KPDropMenu.m file into your project directory.

### Usage

#### 1. Through interface builder :
* Add UIView in interface builder and change its class from UIView to KPDropMenu

![](https://github.com/KrishnaPatell/KPDropMenu/blob/master/KPDropMenu/img_IdentityInspector.png)

* Customize Properties with the help of attribute inspector

![](https://github.com/KrishnaPatell/KPDropMenu/blob/master/KPDropMenu/img_AttributeInspector.png)

#### 2. Via code

```sh
KPDropMenu *dropNew = [[KPDropMenu alloc] initWithFrame:CGRectMake(8, 250, 150, 50)];
dropNew.delegate = self;
dropNew.items = @[@"Apple", @"Grapes", @"Cherry", @"Pineapple", @"Mango", @"Orange"];
dropNew.title = @"Select Again";
dropNew.itemsFont = [UIFont fontWithName:@"Helvetica-Regular" size:12.0];
dropNew.titleTextAlignment = NSTextAlignmentCenter;
dropNew.DirectionDown = NO;
[self.view addSubview:dropNew];
```

#### Delegate Methods
To Use delegate methods, implement `KPDropMenuDelegate` protocol. All these 3 methods are `optional`.

```sh
-(void)didSelectItem : (KPDropMenu *) dropMenu atIndex : (int) atIntedex;
-(void)didShow : (KPDropMenu *)dropMenu;
-(void)didHide : (KPDropMenu *)dropMenu;
```

## Requirements
iOS 7.0 and later

## License
MIT License


text:
# BOSH-Chef

This is a [BOSH](https://github.com/cloudfoundry/bosh) release of [Chef](http://www.opscode.com/chef/) to enable easy creation of client-server Chef clusters of arbitrary sizes on arbitrary infrastructures.

## Walkthrough

### 1. Set up BOSH

Target your BOSH server - ideally your BOSH-Lite server. Follow the README for [bosh-lite](https://github.com/cloudfoundry/bosh-lite) to set this up, and [upload the warden stemcell](https://github.com/cloudfoundry/bosh-lite#upload-warden-stemcell). There is no need to deploy Cloud Foundry, we're using BOSH to deploy Chef.

```
$ bosh status
Config
             /home/hato/.bosh_config

Director
  Name       Bosh Lite Director
...
```

### 2. Tailor the sample manifest to your BOSH director

Copy the manifest (manifests/chef-manifest.yml) to your own deployments directory, and customise to your BOSH environment. For example:-
```
~/bosh-chef $ cp manifests/chef-manifest.yml ~
$ sed -i "s/d235f4e9-fc81-4924-b331-3712f16611ec/`bosh status | grep UUID | awk '{print $2}'`/g" ~/chef-manifest.yml
```
Ensure you have connectivity to the assigned networks.
```
~/bosh-lite $ scripts/add-route
```
The routing table can get flushed when starting/stopping virtual machines with some virtualisation technologies so check your routing table if you lose connectivity; you may need to re-run this script.

### 3. Deploy

Upload a version of the release
```
bosh-chef $ bosh upload release releases/chef-1.yml
```
Deploy the cluster
```
$ bosh deployment ~/chef-manifest.yml
$ bosh deploy

```

### 4. Log in and create an admin user

- Log in to your new Chef server; for the BOSH-Lite manifest default this will be on [https://<IP_ADDRESS>.xip.io/](https://<IP_ADDRESS>.xip.io/).
- Accept the SSL error if one appears once you've understood it
- Use the default password
- Set a new password and generate a new private key; save this admin key for later use
- Browse to the [nodes page](https://<IP_ADDRESS>.xip.io/nodes) to view your lovely Chef clients

### 5. Configure client and upload cookbook

- Install the [Chef Client](http://www.opscode.com/chef/install/) on your machine.
- Write the admin key you saved earlier to ~/admin.pem
- Write the validation key from the manifest's properties section to ~/validator.pem . You may need to remove the leading whitespace from the key.
- Configure your client - the output will differ by username

```
~ $ knife configure -i
WARNING: No knife configuration file found
Where should I put the config file? [/home/vagrant/.chef/knife.rb]
Please enter the chef server URL: [https://precise64:443] https://<IP_ADDRESS>.xip.io/
Please enter a name for the new user: [vagrant]
Please enter the existing admin name: [admin]
Please enter the location of the existing admin's private key: [/etc/chef-server/admin.pem] ./admin.pem
Please enter the validation clientname: [chef-validator]
Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] ./validator.pem
Please enter the path to a chef repository (or leave blank): ./chef-repo
Creating initial API user...
Please enter a password for the new user:
Created user[vagrant]
Configuration file written to /home/vagrant/.chef/knife.rb
```
- Create and upload a cookbook

```
$ mkdir ~/chef-repo

$ knife cookbook create apache

$ cat <<EOF >~/chef-repo/cookbooks/apache/recipes/default.rb
package "apache2"
EOF

$ knife cookbook upload apache -V
```

### 6. Apply cookbook to node(s)

- Log back in to the [nodes page](https://<IP_ADDRESS>.xip.io/nodes)
- Select the first node - usually [node 0](https://<IP_ADDRESS>.xip.io/nodes/0.chef-client.chef1.chef-warden.bosh).
- Edit the node and add the apache recipe from the cookbook you uploaded to the run list. Save the node.

### 7. Wait for convergence and bask in the glow of your own brilliance

If you've used BOSH-Lite and have the routes in place you should be able to [view a default apache page on the node you edited](http://<IP_ADDRESS>/) once the node has converged (up to three minutes). Doing something useful with the cluster is left as an exercise for the reader.

### 8. Scale the cluster up

- Edit the manifest to increase the instances of the chef_client job.
- Redeploy
```
$ bosh deploy
```

# DO NOT USE THIS IN PRODUCTION OR TO STORE ANY DATA!

repository: duncwinn/bosh-chef

repo_name: duncwinn/bosh-chef


text:
  Rams0n1t0 is a piece of software designed to encrypt our files and protect them from prying eyes. Be careful, some files may be unrecoverable

  TLDR
     |
  Installation
     |
  Usage

## TLDR
**Rams0n1t0** analyzes the entire file tree starting with the folder that we specify and is only capable of performing actions forward, never backwards of the specified folder.

We use an **AES-256-CTR encryption**, an extremely strong algorithm, today it is practically **impossible to break** the algorithm.

The author of this project is not responsible for the misuse / lost files in the use of the software

## Installation

**NOTE**: NodeJS 10.13.0 or higher is required.

```bash
# clone the repo
$ git clone https://github.com/EsteveSegura/rams0n1t0.git

# change the working directory to insta-growth
$ cd rams0n1t0

# install NodeJS if is not installed

# this will show up the help message
$ cd src && node index -h
```

## Usage
The software has two main actions: **Encryption** and **decryption**, both actions must be done from the terminal.

**Encryption**
``` bash
# Encrypt the testArea folder included
$ node index --encrypt ../testArea
```

This process will **encrypt the entire tree of files from the folder specified in --encrypt** and also create a file "**decrypt.key**" in the folder where the program is being called, **this file is the most important when it comes to recovering our files**.

**Decryption**
``` bash
# Encrypt the testArea folder included
$ node index --decrypt ../testArea --key ./decrypt.key
```

**In the decryption process we will have to enter the correct .key file, if this does not happen, the program corrupts all our files becoming unrecoverable for ALWAYS.** This happens for security reasons and to avoid brute force attacks.

## License
MIT © Rams0n1t0


text:
# Sanja Stanišić - Portfolio

## Welcome to my Github page!

Here you will find samples of my work.

### Articles

- Filipović Vladimir, Zagarčanin Mladen, Tošić Dušan and Stanišić Sanja, **Digitalization in the Bar County Museum – Pilot Project**, _Review of the National Center for Digitization, Vol. 23, pp. 57-66, 2013_.
[[journal web page]](http://elib.mi.sanu.ac.rs/pages/browse_issue.php?db=ncd&rbr=23){:target="_blank"};
[[article]](./offline-items/ncd23057.pdf){:target="_blank"}

### Public Talks

Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for

```markdown
Syntax highlighted code block

# Header 1
## Header 2
### Header 3

- Bulleted
- List

1. Numbered
2. List

**Bold** and _Italic_ and `Code` text

[Link](url) and ![Image](src)
```

For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/).

### Jekyll Themes

Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/sanjastanisic/sanjastanisic.github.io/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file.

### Support or Contact

Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out.

gha_language: CSS


text:
FORMAT: 1A
HOST: https://api.usaspending.gov

# Recipient List [/api/v2/award_spending/recipient/{?awarding_agency_id,fiscal_year,limit,page}]

This endpoint lists all all award spending for a given fiscal year and agency id

## GET

This endpoint returns a list of recipients and their amounts.
+ Request (application/json)
    + Schema

            {
                "$schema": "http://json-schema.org/draft-04/schema#",
                "type": "string"
            }

    + Parameters
        + `awarding_agency_id`: 183 (required, number)
            Internal award id of the recipient you are looking for
        + `fiscal_year`: 2017 (required, number)
            Fiscal Year
        + `limit` (optional, number)
            The maximum number of results to return in the response.
        + `page` (optional, number)
            The response page to return (the record offset is (`page` - 1) * `limit`).

+ Response 200 (application/json)
    + Attributes
        + `page_metadata` (PageMetadataObject)
        + `results` (array[RecipientListing], fixed-type)

# Data Structures

## PageMetadataObject (object)
+ `count`: 100 (required, number)
+ `page`: 1 (required, number)
+ `has_next_page`: true (required, boolean)
+ `has_previous_page`: false (required, boolean)
+ `next` (required, string, nullable)
+ `current` (required, string, nullable)
+ `previous` (required, string, nullable)

## RecipientListing (object)
+ `award_category`: `contracts` (required, string, nullable)
+ `obligated_amount`: 1000000.01 (required, string)
+ `recipient` (RecipientObject)

## RecipientObject (object)
+ `recipient_name`: `Company Inc.` (required, string)

repository: fedspendingtransparency/usaspending-api

gha_language: Python

repo_name: fedspendingtransparency/usaspending-api


text:
# Catacomb

Very much alpha/experimental library, not test in prod. Still WIP. Might never finish.

Features:
- the crypt can encrypt only matching keys
- the crypt can encrypt keys regardless of nesting level, if a key is nested in an array in another hash
  the library should still recurse all the way down
- the crypt can be wrapped with a serializer so it can be used in rails for example to store in the
  database
- the crypt process is logically separate and usable from the serializing, who knows if and how
  people want to serialize
- each blob is encrypted with a different iv
- metadata is stored at top level, e.g. algorithm, and key version
- the encrypted values are optionally marshalled so that rich objects can be stored
  - marshal: false -> can be used with other languages
  - marshal: true -> probably not usable in other languages, but more flexible for ruby
- save whether or not anything is encrypted into metadata so things like key rotation can skip rows
- stop marshaling a hash of cipher & iv, just separate with like ':' or something

TODO: Features
- allow user to define key lookup
- allow user to store extra data in metadata, like key version for example
- allow all options to be passed through serializer, or better yet, inject the crypt into serializer
  and create a builder to generate the the serializer with a crypt

## Usage

There is a Crypt class and a Serializer class. The crypt handles all encryption and decryption, and
the serializers for example handles writing to and reading from a database.

### Rails

See rails_example/app/models/person.rb for a working example

```ruby
class Person < ApplicationRecord
  serialize :info, Catacomb::Serializer.new(
    format: :noop, # because rails can handle a hash for json columns
    encrypt_keys: ['ssn'],
    encryption_key: Base64.decode64('5vq+0+mDL+ks8DISlL+y54suJhQgo42Zsm3Z+WEgNuM=')
  )
end
```

### Standalone crypt

We set `keys: [:ssn]`, and catacomb encrypts the values of those keys:

```ruby
[1] pry(main)> catacomb = Catacomb::Crypt.new(encryption_key: Base64.decode64("5vq+0+mDL+ks8DISlL+y54suJhQgo42Zsm3Z+WEgNuM="), keys: [:ssn])
=> #<Catacomb::Crypt:0x00007ff87199f900 @cipher=#<OpenSSL::Cipher:0x00007ff87199f888>, @encryption_key="\xE6\xFA\xBE\xD3\xE9\x83/\xE9,\xF02\x12\x94\xBF\xB2\xE7\x8B.&\x14 \xA3\x8D\x99\xB2m\xD9\xF9a 6\xE3", @keys=["ssn"], @marshal=true, @waterfall=true>
[2] pry(main)> cipherhash, anything_encrypted = catacomb.encrypt({ taco: 'bell', ssn: '111223333' })
=> [{:taco=>"bell", :ssn=>"v0:Zbna2a/8kNu0ievO:YxY9xRKtTJexPsKWhM/xwEKvNjzL3Vfl5Vs+kqRJr9wQ8Uw="}, true]
[3] pry(main)> catacomb.decrypt(cipherhash)
=> {:taco=>"bell", :ssn=>"111223333"}
```

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'catacomb'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install catacomb

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/taylorzr/catacomb.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

repository: taylorzr/catacomb

gha_language: Ruby

repo_name: taylorzr/catacomb


text:
## Description

Want to view the settings available in an ADMX file without importing it into the local or central store and open *'Group Policy Management Console'* or *'gpdit.msc'*, then this PSGUI could come in handy.

Or if you want to know the specific registry values that each setting applies this simplifies the view of that setting....

## Configure file association

Added possibility to open an ADMX file directly by association, use below registry setting to achieve this:

HKEY_CURRENT_USER\Software\Classes\.admx_auto_file\shell\open\command

(Default)

powershell.exe -file "[PATH TO FILE]\ADMXViewer.ps1" "%1"

(if you open an ADMX file with many settings it might take a while to open, no progress bar at this point showing anything until the window pops up)

## Example
![An example of how msedgeupdate.admx would look like while opened with this tool](images/ExampleView.jpg)

repository: froxxon/Powershell

repo_name: froxxon/Powershell


text:
Feedback and suggestions are always welcome & appreciated.

Check out the common typedefs, would love to know if these structures are helpful to others.

Currently only the Maybe monad is implemented so there isn't much to add here, in progress!

Utils section is not stable (or particularly useful) yet.
Playing with some ideas on String utilities using SIMD...

There are usage examples in the test folder for sections that are fleshed out more.

** Maybe **

* Instance *

- bind(Creator1<Maybe, dynamic> creator)
- map(Func1<T, dynamic> mapper)
- Operator: >>			:: (Creator1<Maybe, dynamic> creator) [aka bind]
- Operator: <<			:: (dynamic def) [aka fromMaybe]
- Operator: |			:: (Func1<T, dynamic> mapper) [aka map]

* Static *

- Maybe.from 			:: (dynamic value) -> Maybe
- Maybe.nothing 		:: () -> Maybe
- Maybe.just			:: (value) -> Maybe
- Maybe.isJust			:: (Maybe target) -> bool
- Maybe.isNothing		:: (Maybe target) -> bool
- Maybe.fromJust		:: (Maybe target) -> dynamic
- Maybe.fromMaybe		:: (dynamic def) ->(Maybe target) -> dynamic
- Maybe.maybe			:: (dynamic def) -> (Func1<dynamic, dynamic> map) -> (Maybe target) -> dynamic
- Maybe.listToMaybe		:: (Iterable source) -> Maybe
- Maybe.maybeToList		:: (Maybe target) -> [dynamic]
- Maybe.catMaybes		:: (Iterable<Maybe> source) -> [dynamic]
- Maybe.mapMaybe		:: (Maybe target) -> (Func1<dynamic, dynamic> mapper) -> Maybe
- Maybe.mapReduceMaybe	:: (Creator1<Maybe, dynamic> creator) -> (Iterable<dynamic> source) -> Iterable<dynamic>
- Maybe.bindMaybe		:: (Maybe target) -> (Creator1<Maybe, dynamic> creator) -> Maybe

repository: perry-birch/dfunct

repo_name: perry-birch/dfunct


text:
# AWESOME AWS Cost Management <!-- omit in toc -->

Awesome resources for managing AWS cost.

## Content <!-- omit in toc -->
- [Github tools](#github-tools)
- [AWS solutions](#aws-solutions)
- [Paid solutions](#paid-solutions)
- [Copyright and license](#copyright-and-license)

## Github tools
- https://cloudcustodian.io/
- https://github.com/mlabouardy/komiser
- https://github.com/gbolo/aws-power-toggle
- https://github.com/aramalipoor/aws-cost-saver
- https://github.com/localstack/localstack
- https://github.com/trackit/trackit

## AWS solutions
- [Calculator](https://calculator.aws/)
- https://aws.amazon.com/solutions/implementations/instance-scheduler/

## Paid solutions
- [Cloudability](https://www.cloudability.com/)
- [Cloudhealth](https://www.cloudhealthtech.com/products/aws-management)
- [Mission Cloud](https://www.missioncloud.com/)

## Copyright and license
Release under [CC0-1.0 License](blob/master/LICENSE)

repository: lcenchew/awesome-aws-cost-management

repo_name: lcenchew/awesome-aws-cost-management


text:
# Post It

### Team POST
- **Miriam Silva**
- **Joshua Haddock**
- **Anthony Johnson**
- **Patrick Laurion**

### Version: 0.0.0

## Overview

This app allows the user to search a potential city they want to travel to and date(s) they will be there . Upon searching they will be shown events collected from various APIs about shows, meetups etc.

## Getting Started

## Architecture
Site was desiged using React and React-Bootstrap on the frontend as well as node , express on the server side. The site is divided into various components and modules per standard industry practices.

## Credit and Collaborations

## Collaborative Agreement

**Logistical**

### Cooperative

### Conflict Resolution

repository: Team-Post-It-Note/postIt-api

branch_name: refs/heads/staging

gha_language: JavaScript

repo_name: Team-Post-It-Note/postIt-api


text:
# Release Notes

We generally release a new version of Hummingbot every 4 weeks, along with periodic intermittent releases.

The latest stable release is **[0.30.0](/release-notes/0.30.0)**, released on August 11, 2020.

repository: besk-official/hummingbot

repo_name: besk-official/hummingbot


text:
# Overview

This distribution consists of two programs that reproduce the results of the
paper titled "A Peek into the Swarm: Analysis of the Gravitational Search
Algorithm and Recommendations for Parameter Selection".

These programs are

* simulation
* swarmpositions

simulation reproduces the results in tables 1 through 3, writing them into
subdirectories under output/simulation. swarmpositions runs single simulations
with the parameters used to render figures 1 through 4 and prints the particle
positions after each iteration into files in a subdirectory under
output/swarmpositions.

Note that due to the stochastic nature of GSA, the results will vary slightly,
although the patterns described in the paper persist.

There are python scripts in output/swarmpositions that produce images like
figures 1 through 3. Figure 4 was rendered with gnuplot.

# Building

The build system is autoconf/automake, so the code can be built with

   ./configure
   make

The code depends on [Eigen3](http://eigen.tuxfamily.org/index.php?title=Main_Page).

# Running

After `make`,

   ./simulation

or

   ./swarmposition

# Rendering images

There are three scripts:

1. `plot_clouds.py` renders the full swarm into a contour plot for every step of
   optimization, as in figures 1 and 3.
2. `plot_step.py` renders sample particle trajectories during a single step as
   in figure 2 (center)
3. `plot_path.py` renders a sample trajectory over several steps as in figure 2
   (right)

These are invoked as

   ./plot_clouds.py <directory>          # e.g. ./plot_clouds.py rastrigin_20_20
   ./plot_step.py <directory>            # e.g. ./plot_step.py rastrigin_20_20
   ./plot_path.py <directory> <particle> # e.g. ./plot_path.py rastrigin_20_20 37

Files produced are

* `plot_clouds.py`: in `<directory>/gsa` files `positions.###.png`
* `plot_step.py`: in `<directory>/gsa` file `step20.png`
* `plot_path.py`: in `<directory>/gsa` file `path<particle>.png`

# Source code organization

The code falls, roughly speaking, into these subsets:

* src/gsa contains the implementation of GSA.
* src/random contains the implementation of random search used for comparison
  in figure 4.
* src/common contains utility classes that GSA shares with other optimization
  algorithms (that are not included here).
* src/testfunc.* and src/gsapaper.cc contain test functions.
* src/simulation.cc and src/indicators.hh for the simulation program
* src/swarmpositions.cc for the swarmpositions program

The implementation of GSA is structured as follows:

* search_parameters describes the selected parameter set, dimensionality of the problem,
  schedules for G and K as well as some features used in experiments unrelated to the paper
  (e.g. the disruptor class and pbest memory mechanic)
* snapshot is a tuple combining position and fitness value, used because those are always
  replaced in lockstep
* agent is a swarm particle
* stepper describes the swarm at a given time
* technique is a swarm factory

The simulation procedure is:

* A technique object describing the simulation is created
* In a loop (101/1001 times), a swarm stepper is created
* Each stepper is stepped T times, and every step relevant results are logged

repository: fknauf/gsa-a-peek-into-the-swarm

repo_name: fknauf/gsa-a-peek-into-the-swarm


text:
If you prefer to use the YUM repository and install via YUM, paste the following in your shell -

```bash
sudo curl https://download.gocd.org/gocd.repo -o /etc/yum.repos.d/gocd.repo
sudo yum install -y java-1.8.0-openjdk #atleast Java 8 is required, you may use other jre/jdk if you prefer
```


text:
# NightView

[![Build Status](https://travis-ci.org/Boris-Em/NightView.svg?branch=master)](https://travis-ci.org/Boris-Em/NightView)
[![Version](https://img.shields.io/cocoapods/v/NightView.svg?style=flat)](http://cocoadocs.org/docsets/NightView)
[![License](https://img.shields.io/cocoapods/l/NightView.svg?style=flat)](http://cocoadocs.org/docsets/NightView)
[![Platform](https://img.shields.io/cocoapods/p/NightView.svg?style=flat)](http://cocoadocs.org/docsets/NightView)

**NightView** is an open source library that generates beautiful, random, starry skies on iOS.

## Table of Contents

* [**Project Details**](#project-details)
  * [Requirements](#requirements)
  * [License](#license)
  * [Support](#support)
  * [Sample App](#sample-app)
* [**Getting Started**](#getting-started)
  * [Installation](#installation)
  * [Setup](#setup)
* [**Documentation**](#documentation)

  ## Project Details
Learn more about the **NightView** project, licensing, support etc.

### Requirements
 - Requires iOS 7 or later. The sample project is optimized for iOS 9.
 - Requires Automatic Reference Counting (ARC).
 - Optimized for ARM64 Architecture.

### License
See the [License](https://github.com/Boris-Em/NightView/blob/master/LICENSE). You are free to make changes and use this in either personal or commercial projects. Attribution is not required, but highly appreciated. A little "Thanks!" (or something to that affect) is always welcome. If you use **NightView** in your app, please let us know!

### Support
[![https://gitter.im/Boris-Em/NightView](https://badges.gitter.im/Boris-Em/NightView.svg)](https://gitter.im/Boris-Em/NightView?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Join us on gitter if you have any question!

### Sample App
The iOS Sample App included with this project demonstrates one way to correctly setup and use **NightView**. It also offers the possibility to customize the view within the app.

## Getting Started
It only takes a few simple steps to install and setup **NightView** to your project.

###Installation
The easiest way to install **NightView** is to use CocoaPods. To do so, simply add the following line to your `Podfile`:

pod 'NightView'

The other way to install **NightView**, is to drag and drop the *NightView* folder into your Xcode project. When you do so, make sure to check the "*Copy items into destination group's folder*" box.

### Setup
**NightView** is a simple UIView subclass. It can be initialized with Interface Builder, or programatically.

 **Interface Builder Initialization**
 1 - Drag a `UIView` to your `UIViewController`.
 2 - Change the class of the new `UIView` to `NightView`.
 3 - Select the `NightView` and open the Attributes Inspector. Most of the customizable properties can easily be set from the Attributes Inspector. The Sample App demonstrates this capability.

 **Programmatical Initialization**
 Here is an example illustrating how to initialize a NightView instance programmatically:

 ```swift
 let nightView = NightView(frame: CGRectMake(0.0, 0.0, 200.0, 200.0))
 view.addSubview(nightView)
 ```

## Documentation
All of the methods and properties available for **NightView** are documented below.

##### `numberOfPointsForStar`
The number of points for each star. For example, setting this property to 1, means that there will be 1 star for every point in the view. A greater number means less stars within the view. *Defaults to 10000.0.*

##### `starSize`
The size of the stars in points. Note that setting `starSizeMinRandomizer` and `starSizeMaxRandomizer` will also influence the size of stars. *Defaults to 5.0.*

##### `starColor`
The color of the stars. *Defaults to white.*

##### `starSizeMinRandomizer`
The size of the stars is randomized within the `starSize` value. This property sets the minimum percent by which the stars' size could be changed. For example, a value of 50.0 means that the minimum size of a star will be 50% of the `starSize` property. *Defaults to 50.0.*

##### `starSizeMaxRandomizer`
The size of the stars is randomized within the `starSize` value. This property sets the maximum percent by which the stars' size could be changed. For example, a value of 150.0 means that the maximum size of a star will be 150% of the `starSize` property. *Defaults to 150.0.*

##### `minStarOpacity`
The stars are drawn with a smaller opacity at the bottom of the view than at the top. This property sets the minimum opacity for the lower stars. Note that the stars at the top of the view will always have an opacity of 1.0. *Defaults to 0.5.*

##### `glowingIntensity`
The intensity of the glowing of the stars, from 0 to 1. If set to 0, the stars will not glow. *Defaults to 0.5.*

##### `glowingDuration`
The duration in seconds at which the stars glow. *Defaults to 2.0.*

##### `starType`
The type of stars to be drawn. *Defaults to `.Round`.*

##### `reload()`
Reloads the **NightView** instance, redrawing all of the stars.

repository: Boris-Em/NightView

gha_language: Swift

repo_name: Boris-Em/NightView


text:
# About Vue.js

[Vue.js ](https://vuejs.org/) is an open-source JavaScript framework for building user interfaces and single-page applications. It was created by Evan You, and is maintained by him and the rest of the active core team members coming from various companies such as Netlify and Netguru.

## Sample Dockerfile

```Dockerfile
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
```

repository: dockerfile-app/dockerfile-templates

branch_name: refs/heads/main

repo_name: dockerfile-app/dockerfile-templates


text:
# Change log

## [2.2.0](https://github.com/WeAreAthlon/frontend-webpack-boilerplate/releases/tag/v2.2.0)
#### 02/01/2019

### Added

* _Minify_ and _Uglify_ js `webpack` plugin - [uglifyjs-webpack-plugin](https://www.npmjs.com/package/uglifyjs-webpack-plugin) due to not consistent behavuour of the built-in webpack
js minimization features

### Updated

* `autoprefixer` package

#### Removed

* `uglify-es` package

## [2.1.0](https://github.com/WeAreAthlon/frontend-webpack-boilerplate/releases/tag/v2.1.0)
#### 31/12/2018

### Added

* [MIT](https://github.com/WeAreAthlon/frontend-webpack-boilerplate/blob/master/LICENSE) License

### Updated
* [README](https://github.com/WeAreAthlon/frontend-webpack-boilerplate/blob/master/README.md) - more detailed setup and usage instructions
* Webpack `4.28.3`
* NPM Audit fixed packages, after running `npm audit fix`

> fixed 35 of 35 vulnerabilities in 9452 scanned packages

## [2.0.0](https://github.com/WeAreAthlon/frontend-webpack-boilerplate/releases/tag/v2.0.0)
#### 14/12/2018

### Added

* Support for HTML template loading
  * Default template included that illustrates custom font and image loaders

### Updated

* Support for `Webpack 4`
* Support for `Babel 7`
  * Added `.babelrc` file for preset definitions
* Cleanup of dist directory upon build

#### Removed

* `jQuery` - it can be added per project basis if needed;

## [1.2.0](https://github.com/WeAreAthlon/frontend-webpack-boilerplate/releases/tag/v1.2.0)
#### 14/12/2018

### Updated

* Package dependencies
* _README_ file with information how to run js/css code linters
* Code style changes
* Package dependencies divided to dev and non-dev packages
* Default package name

## [1.1.0](https://github.com/WeAreAthlon/frontend-webpack-boilerplate/releases/tag/v1.1.0)
#### 10/07/2017

### Added

* Support for jQuery

## [1.0.0](https://github.com/WeAreAthlon/frontend-webpack-boilerplate/releases/tag/v1.0.0)
#### 03/07/2017

* Initial Release

repository: Satira/frontend-webpack-boilerplate

repo_name: Satira/frontend-webpack-boilerplate


text:
---
layout: post
title: "Favorite books of 2020"
date:  2021-01-28 21:00:00 -05:00
categories: books
---

[50 books](https://www.goodreads.com/user_challenges/20388805).
15,000+ pages.
2020 was an awful year,
but it's given me a lot of time to read.

When going through the list of books I read this year,
I found an interesting pattern.
Before the lockdowns began,
only one of the books I read was fiction.
After, fiction made up the majority.
I guess that's my way
of coping with a pandemic.

### Non fiction

**Sapiens (Yuval Noah Hararis)**

A fascinating book about
the history of humans,
starting from the times
when we co-existed with other human subspecies,
all the way to modern times.
It’s in a similar vein to
_The Ascent of Man_,
which was on my 2017 favorites list.

**Born A Crime (Trevor Noah)**

A collection of 18 essays
about being a mixed race child
in South Africa during the apartheid regime.
His very existence was a crime
and he had to be hidden from the authorities
during his early childhood.
With his trademark charm and humor,
Noah writes a heartwarming tale
about growing up in those times.

**A Mind for Numbers (Barbara Oakley)**

I started reading this alongside Oakley’s Coursera course,
[Learning How to Learn](https://www.coursera.org/learn/learning-how-to-learn),
and found it a superb book about learning.
This had a lot of overlap with _Make It Stick_,
which is another great book on the subject.

**Midnight in Chernobyl (Adam Higginbotham)**

If you liked HBO’s outstanding Chernobyl miniseries,
and wanted to read more about those events,
this is the book to read.
Higginbotham manages to find the right balance
between describing the events,
while also explaining the science
and the political background.

**44 Years With the Same Bird (Brian Reade)**

The author is a sports journalist
who has supported Liverpool FC from the 60s.
The book follows his journey as a fan
from the highs of the Shankly years
all the way to the Premier League era.
Highly recommended if you support Liverpool,
but interesting for anyone following football.

**Doing Good Better (William MacAskill)**

Fantastic book about effective altruism.
If you want your charitable donations
to have the most impact,
this book has a lot of great ideas.
Provides a great framework to think about
which charities to prioritize,
and shows how some charities
can be orders of magnitude
more effective than others.

**Refactoring: Ruby Edition (Jay Fields, Shane Harvey, Kent Beck)**

Read this for a book club
with my team at work.
The first 5 chapters,
which introduce refactoring,
form about a third of the book
and are a nice read.
The rest is a catalog of refactoring techniques
which I'd usually treat as a reference
and not read through.
But as part of a book club with coworkers,
it was more interesting
because we were able to discuss actual code examples.

Set in America,
wildfires destroyed civilization years ago.
The few survivors
now resort to cannibalism
and robbing anyone they can to survive.
The narration of the audiobook
by Tom Stechschulte
was also top notch.

**The Handmaid's Tale (Margaret Atwood)**

What if America were taken over
by a theocratic dictatorship?
One in which women are treated as nothing more
than vessels for procreation.
Where some are denied
even the right to have a name.
This was a terrifying story about
oppression and power structures.
About how fragile rights are,
especially women’s rights.

**The Fifth Season (N K Jemisin)**

This is one of the freshest takes on fantasy
I’ve seen recently.
The world, characters, the societal structure,
magical system and narration -
everything feels different from anything else I’ve read.
The people who have magical abilities
are the ones that are oppressed in this world.
Set on a geologically unstable planet,
extreme events like volcanoes
frequently cause civilization to collapse.

**The Whisper Man (Alex North)**

North does a brilliant job
building up the suspense
in this serial killer story.
Imagine a cross between
Silence of the Lambs and Stephen King,
with a dash of True Detective,
and you have this intensely horrifying novel.

The story follows a female pilot/mathematician,
who dreams of being an astronaut
in a male dominated NASA in the 1950s,
and the challenges she faces.
The sequel,
_The Fated Sky_,
was equally good.

**The Left Hand of Darkness (Ursula K Le Guin)**

Le Guin's Hugo and Nebula winning novel
that examines the role of gender in society
by setting the story in a planet
inhabited by people without a fixed gender.
It's a slow but though-provoking read.

**Imperium (Robert Harris)**

This book follows the career of Roman statesman Cicero,
told through the eyes of his slave, Tiro.
This is a really nice glimpse into the political life in Rome
just before Caesar took over.
(Caesar is actually a minor character here,
and looks like he will play a greater role in the sequels.)
Highly recommended for fans of history.

**Leviathan Wakes (James S A Corey)**

A space opera set a few centuries from now.
There's a cold war between
the powerful governments
of Earth and Mars,
with the Belt caught in between.
There are two strands to this story -
one follows a detective
looking for a missing woman on Ceres,
while another follows
the survivors of a spaceship
after their ship is destroyed by unknown attackers.

**I'm Thinking of Ending Things (Iain Reid)**

This short novel was hard to put down.
It starts off as a road trip
where the narrator and her boyfriend
are driving to meet his parents,
even as she is thinking of
"ending things" with him.
From there,
it takes a turn towards horror,
and Reid expertly builds the tension
towards a disturbing twist at the end.

### On audiobooks

Audiobooks made up a third
of the books I consumed this year.
I've only listened to 3-4 books in the past,
but this year I've almost entirely given up
listening to podcasts
and instead got a subscription for
[Scribd](https://www.scribd.com/g/87qzar),
so I can spend that time on audiobooks.
Over the course of a year,
that added up to 17 books!

I'm often picky with books,
so this let me try out books
that I wouldn't normally have picked up.
This way I came across some enjoyable books,
like Cormack McCarthy's _The Road_
(mentioned above),
and Anna Wiener's _Uncanny Valley_.

### 2021

I've already finished my first book of 2021 -
Arkady Martine's _A Memory Called Empire_,
and started Le Guin's
_The Dispossessed_.
Next up is the 1200 page _Rhythm of War_,
which will take up a significant amount of time
over the next month.
Quite a few of my favorite
scifi/fantasy novels of the year
were Hugo and Nebula winners,
so I'll be picking more books
from those lists this year.

I didn't read many technical books this year,
and hope to read more of those.
My team at work is doing a programming book club,
so I'll at least finish the book we've picked up,
_Growing Object Oriented Software, Guided by Tests_.

As for number of books,
I'd love to reach 50 again this year.
But I've found that
consistently reading
a few pages every day
is more effective
than setting a target like this.
If you're planning to read more this year,
I recommend starting with the article
[Just Twenty-Five Pages a Day](https://www.farnamstreetblog.com/2015/12/twenty-five-pages-a-day/).

### Links

- Previous lists:
  [2019](/posts/books-2019/),
  [2018](/posts/books-2018/),
  [2017](/posts/favorite-books-2017/),
  [2016](/posts/favorite-books-2016/),
  [2015](/posts/favorite-books-2015/),
  [2014](/posts/favorite-books-2014/),
  [2013](/posts/favorite-books-2013/)

gha_language: HTML


text:
# wiremock-extensions

Contains the extension for bodyFileName templating.

eg:
{
    "request": {
        "method": "GET",
        "urlPattern": "/some/thing\\?test=.*"
    },
    "response": {
        "status": 200,
        "bodyFileName": "{{request.path.[0]}}_{{request.requestLine.query.test}}.json",
        "headers": {
            "Content-Type": "text/plain"
        },
        "transformers": ["response-template","response-body-filename-template"]
    }
}

In this case if http://localhost:8181/some/thing?test=query is hit, content of file from ./__files/some_query.json
is returned

If the content is again templated, Values will be replaced in that also.


text:
# <img src="https://raw.githubusercontent.com/InsanityRadio/OnAirController/master/doc/headphones_dark.png" align="left" height=48 /> react-native-audio-streamer

A react-native audio streaming module which works on both iOS & Android, designed for live radio playback.

The module supports DASH and HLS natively on Android, and HLS natively on iOS. It also supports more traditional Icecast streams on all platforms.

iOS streaming is based on [FRadioPlayer](https://github.com/fethica/FRadioPlayer)

Android streaming is based on [ExoPlayer](https://github.com/google/ExoPlayer)

### Why?

This custom version of react-native-audio-streamer was built for Insanity Radio's open source radio player. We needed support for adaptive streaming to provide resilience to weird network conditions.

The original code was taken from indiecastfm's [module of the same name](https://github.com/indiecastfm/react-native-audio-streamer), and from sveint's fork [react-native-music-streamer](https://github.com/sveint/react-native-music-streamer], to give us the "best of both worlds".

This module makes no effort to support metadata. We're loading now playing information over WebSocket so this is irrelevant for us.

## Installation

`npm install https://github.com/InsanityRadio/react-native-audio-streamer --save`

Then run the following command to link to iOS & Android project

`react-native link react-native-audio-streamer`

### Android Steps

You need to register the module's service. Edit your `android/app/src/main/AndroidManifest.xml` file and add the following:

      <service
        android:name="com.insanityradio.rnaudiostreamer.MusicStreamerService"
        android:label="@string/app_name">
      </service>

## Usage

### Basic

```javascript
import RNAudioStreamer from 'react-native-audio-streamer';

RNAudioStreamer.setUrl('https://scdnc.insanityradio.com/dash/hls/insanity/index.m3u8')
RNAudioStreamer.play()
RNAudioStreamer.pause()

// Player Status:
// - PLAYING
// - PAUSED
// - STOPPED
// - FINISHED
// - BUFFERING
// - ERROR
RNAudioStreamer.status((err, status)=>{
 if(!err) console.log(status)
})

```

### Status Change Observer

```javascript
const {
  DeviceEventEmitter
} = 'react-native'

// Status change observer
componentDidMount() {
    this.subscription = DeviceEventEmitter.addListener('RNAudioStreamerStatusChanged',this._statusChanged.bind(this))
}

// Player Status:
// - PLAYING
// - PAUSED
// - STOPPED
// - FINISHED
// - BUFFERING
// - ERROR
_statusChanged(status) {
  // Your logic
}
```

### Development

Feel free to make use of this project in your own software. If you're developing 'native' iOS and Android apps, see the associated projects on both Android and iOS platforms, as this is where the core logic lies. The 'bridge' code should provide a rough interim guide as to how to implement the player, whilst we work on documentation and refactoring the code & structure.

### Credits

https://github.com/indiecastfm/react-native-audio-streamer
https://github.com/sveint/react-native-music-streamer

gha_language: Objective-C


text:
Backbone.Service
================
[![build status](https://secure.travis-ci.org/mkuklis/backbone.service.png)](http://travis-ci.org/mkuklis/backbone.service)

Backbone.Service aims to help with the cases when restul API is not an option.

## Install

````javascript
<script src="backbone.service.js"></script>
````

## Usage

You can use backbone.service as a standalone object or extend backbone model or collection.

````javascript

// define server targets / endpoints
var targets = {
  login: ["/login", "post"],
  signup: ["/signup", "post"],
  logout: ["/logout", "get"],
  search: "/search" // defaults to get
  resetPassword: ["/resetpassword", "post"],
  updateSettings: ["/updateSettings", "post"]
};

// standalone service
var service = new Backbone.Service({ url: "http://localhost:5000", targets: targets });

// extend backbone model
var User = Backbone.Model.extend(service);

````

Each target passed to Backbone.Service becomes a method on the model or collection.

User model has now access to new methods: `login`, `signup`, `logout`, `search`, `resetPassword`, `updateSettings`.
Each new method takes two arguments: `data` and `options`.

You can use it like this:

````javascript

var user = new User();
user.login({ username: 'bob', password: 'secret' });

````

## Promises / Callbacks

Backbone.service comes with a simple implementation of promises. You can use them like this:

````javascript

user.updateSettings(settings).then(function (res) {
  // do something after successful update
}, function (err, res) {
  // do something in case of an error
});

````

Callbacks are still supported. You can pass them as a second argument in your calls:

````javascript
user.updateSettings(settings, {
  success: function (res) {
    // do something after successful update
  },
  error: function (err, res) {
    // do something in case of an error
  }
});

````

##Contributors

* [@mkuklis](http://github.com/mkuklis)
* [@scttnlsn](http://github.com/scttnlsn)

##License:
<pre>
(The MIT License)

Copyright (c) 2012 Michal Kuklis

</pre>


text:
# phpMVCsimple v1.1
#

by Aysad Kozanoglu | email<EMAIL_ADDRESS>| web: http://onweb.pe.hu

this MVC i created to start to develope a HLSPanel for ffmpeg with nginx

### MVC Overview ###
```
class
 |- dbconn.php
controllers
 |- pages_controller.php
views
 | - pages
 |   |- error.php
 |   |- home.php
 |-layout.php
index.php
config.php
routes.php
```

## index.php ##
```
<?php
  require_once('errorhandling.php');
  require_once('config.php');
  require_once('class/dbconn.php');

$DB = new DBPDO();

  if (isset($_GET['controller']) && isset($_GET['action'])) {
    $controller = $_GET['controller'];
    $action     = $_GET['action'];
  } else {
    $controller = 'pages';
    $action     = 'home';
  }

  require_once('views/layout.php');
?>
```
## routes.php ##
```
<?php
  function call($controller, $action) {
    require_once('controllers/' . $controller . '_controller.php');
    switch($controller) {
      case 'pages':
        $controller = new PagesController();
      break;
    }

    $controller->{ $action }();
  }

  $controllers = array('pages' => ['home', 'error']);

  if (array_key_exists($controller, $controllers)) {
    if (in_array($action, $controllers[$controller])) {
      call($controller, $action);
    } else {
      call('pages', 'error');
    }
  } else {
    call('pages', 'error');
  }
?>
```
## layout.php ##
html base skelett and require routes.php on body

## example controller ##
```
<?php
  class PagesController {
    public function home() {
      $first_name = 'Aysad';
      $last_name  = 'Kozanoglu';
      require_once('views/pages/home.php');
    }
    public function error() {
      require_once('views/pages/error.php');
    }
  }
?>
```

## DB Connection ##
Örnekler:
```
$DB = new DBPDO();

$DB->execute("UPDATE customers SET email =<EMAIL_ADDRESS>WHERE username = 'xyz123'");

$DB->execute("UPDATE customers SET email = ? WHERE username = ?"<EMAIL_ADDRESS>'xyz123'));

$user = $DB->fetch("SELECT * FROM users WHERE id = ?", $id); // $id=1234567890

$users = $DB->fetchAll("SELECT * FROM users");

    output:
    --------
      [0] => Array
    (
        [id] => 1
        [name] => hasan
    )

    [1] => Array
    (
        [id] => 2
        [name] => tasan
    )

    [2] => Array
    (
        [id] => 3
        [name] => basan
    )

$users = $DB->fetchAll("SELECT * FROM users", null, 'name');

    output:
    -------
    [hasan] => Array
    (
        [id] => 1
        [name] => hasan
    )

    [tasan] => Array
    (
        [id] => 2
        [name] => tasan
    )

    [basan] => Array
    (
        [id] => 3
        [name] => basan
    )
// use raw data with if
if( isset ( $users[$raw_data['user_name']] ) ) { //Do something }

// last added id

$DB->lastInsertId();
```
#The MIT License (MIT)#

Copyright (c) <2016> <copyright Aysad Kozanoglu>

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: AysadKozanoglu/phpMVCsimple

repo_name: AysadKozanoglu/phpMVCsimple


text:
# RailsMatchingGem

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3baa719452574539b3a6f12577dfa8c0)](https://www.codacy.com/app/jonas_9/rails_matching?utm_source=github.com&utm_medium=referral&utm_content=matilhaestudio/rails_matching&utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/3baa719452574539b3a6f12577dfa8c0)](https://www.codacy.com/app/jonas_9/rails_matching?utm_source=github.com&utm_medium=referral&utm_content=matilhaestudio/rails_matching&utm_campaign=Badge_Coverage)
[![wercker status](https://app.wercker.com/status/13359bdddaaf91f92aba9833759a86ed/s/master "wercker status")](https://app.wercker.com/project/byKey/13359bdddaaf91f92aba9833759a86ed)

Use this gem to match attributes between your object instances.
It basically returns the percentage of attributes matched between two instances.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rails_matching'
```

And then execute:

    $ bundle install

## Usage Examples:

```ruby
	# Matches all instances from a model with same model
	# Returns object id, object id that id matched against, and percentage of match
	RailsMatching.against_itself(User.all)
	# [ [1, 2, 33.0 ]
	#   [1, 3, 0.0 ]
	#   [1, 4, 88.0 ] ]
```

```ruby
	# Matches one instance from a model with all instances from same model
	# Returns object id, object id that id matched against, and percentage of match
	instance = User.create(name: "Test", age: 22, job_title: "writer")
	RailsMatching.instance_against_all(instance, User.all)
	# You can also exclude attributes from match
	RailsMatching.instance_against_all(instance, User.all, exclude_attrs: ["name"])
```

## Development

### To Do

- [ ] Use of required fields
- [ ] Finish parametrization method
- [ ] Instance against instance method
- [ ] Specs
- [ ] Use of SQL queries for large data sets
- [ ] Add order method
- [ ] Add max filter to return a max number of instances

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

gem build rails_matching.gemspec
gem install rails_matching-0.1.0.gem

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jonaslsl/rails_matching. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
# README

## Introduction
This repo is to extract the computational aesthetic features introduced from the paper - ["The Pictures we Like are our Image: Continuous Mapping of Favorite Pictures into Self-Assessed and Attributed Personality Traits"](https://ieeexplore.ieee.org/document/7378902). Some of the features had been removed and readapted. See the table below.

## Feature Synopis
| Category            | Name                                                                                | dimension                                       |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| Color               | HSV statics
 Emotion-based
 Color diversity
 Color name                                                    | 5
 3
 1
 11                      |
| Composition         | Edge pixels
 Level of detial
 Average region size
 Low depth of ﬁeld (DOF)
 Rule of thirds Image size | 1
 1
 1
 3
 2
 1
 |
| Textural Properties | Gray distribution entropy
 Wavelet based textures
 Tamura
 GLCM - features                                 | 1
 12
 3
 3                      |

> The description column is omitted. To see what each feature does, please refer to the Paper. Additionally, there are some changes being made.
> 1. The **Faces features** was removed.
> 2. The realization of **color diversity** is different from the paper.
> 3. The **GIST descriptors** was removed.
> 4. The **GLCM - features** used only gray image and left only 4 features.

## How to use ?

### Install requirements
```
$ pip install git+https://github.com/Justin900429/computational-aesthetics
```

### Import file
```python
from CA import CA
...
# Create objects
img_path = "..."
ca = CA(img_path)
res = ca.compute_ca()
...
# update image path
new_path = "..."
ca.update(new_path)
new_res = ca.compute_ca()
...
```

See [example](https://github.com/Justin900429/computational-aesthetics/blob/main/example.py) for more details

## Citation
> Apology for not including all the citations. Below section only lists the paper mentioned in the introduction section. All the reference are included in the below paper.

```bibtex
@ARTICLE{
  7378902,
  author={Segalin, Crisitina and Perina, Alessandro and Cristani, Marco and Vinciarelli, Alessandro},
  journal={IEEE Transactions on Affective Computing},
  title={The Pictures We Like Are Our Image: Continuous Mapping of Favorite Pictures into Self-Assessed and Attributed Personality Traits},
  year={2017},
  volume={8},
  number={2},
  pages={268-285},
  doi={10.1109/TAFFC.2016.2516994}
}
```


text:
# Baggage Problem

This problem statement was by BaggageAI to segment the threat objects and paste it on background images.

# Input images-

Threat objects => /threat_png/

Background images =>  /background_images/

# Outputs Images from Program -

1)Final Outputs => /Assignement_Outputs/  ; 25 outputs images with each background with each threat objects has been placed.

2)Images after GrabCut & Cropping operations=> /grab_resized_images/ ; Grabcut and Cropping operation has done on all threat objects.

# To Run program-

Step 1 => Clone the project.

Step 2 => open terminal and run python main.py

Step 3 => After each image has been shown press ‘q’ for moving and seeing next images.

# Description of each python file -

1) select_threat_object.py -> This file work as follows :-

    a)Reading Threat object .

    b)Using Mouse event from openCV  , we draw a rectangular box and passing to the Grabcut segmentation process.

    c)Grabcut function takes above rectangular co-ordinates and segment given image with the help of masking process.

    d)After Segmentation images having a black background , we resize images and save them into / grab_resized_images/

2) training.py-> This file work as follows :-

    a) main function is called from main.py where it will read background image and also a threat object from /grab_resized_images/

    b) now correction function is performed that is the black pixels which are observing are not absolute zero it is tending to zero. Therefore, this function makes all pixels 0 who has pixels size less than 10.

    c) Then in placing_threat_object( ) function we are just adding that segmented image of threat to the background image where condtion is that pixels are only added which are not 0 that means only colored object is added to background.

3) main.py => This file just take care that every background image runs on every threat object image. So, 25 images will be generated.

# Project Done by -
Rohit Pawar (Computer Vision Engineer)


text:
::: note Network Firewall
If you are behind a firewall, this feature may require [whitelisting of the appropriate Auth0 IP addresses](/guides/ip-whitelist) to work properly.
:::


text:
# EasyRecyclerView

A wrapper library for the RecyclerView widget to simplify instantiation.

# Preview

## Benefits

Hides the implementation of the RecyclerView Adapter and simplifies the initialisation process.

## Usage

EasyViewPager can be defined in an XML layout file such as:

```XML
<net.scarlettsystems.android.widget.EasyRecyclerView
		android:id="@+id/recycler"
		android:layout_width="match_parent"
		android:layout_height="match_parent"/>
```

EasyRecyclerView should be configured by passing in a LayoutManager, a view for the items (cards), and a listener to bind the data items with the views.

```Java
EasyRecyclerView recycler = findViewById(R.id.recycler);
RecyclerView.LayoutManager lm = new LinearLayoutManager(this);
recycler.setLayoutManager(lm)
```

The view of the item can be set by either setting a layout resource, or dynamically returning a View through the OnCreateItemViewListener.
A routine to bind the item's data to the created view must also be set.
When binding data to the view, child view references should be obtained from the supplied `SparseArray` of view references, rather than calling
`findViewById(int)` on the view. This is because accessing the cache is much faster than the latter method, and improves performance.

```Java
easyRecyclerView.addOnCreateItemViewListener(ITEM_TYPE,
        new EasyRecyclerView.OnCreateItemViewListener()
{
    @Override
    public View OnCreateItemView()
    {
        View view = new View(getContext());
        return view;
    }

    @Override
    public void OnBindItemView(View view, SparseArray<View> viewCache, Object item)
    {
        //TODO: Do something to view.
    }
});
```

OR

```Java
easyRecyclerView.addOnBindItemViewListener(ITEM_TYPE,
        R.layout.my_layout,
        new EasyRecyclerView.OnBindItemViewListener()
{
    @Override
    public void OnBindItemView(View view, SparseArray<View> viewCache, Object item)
    {
        //Find Views
        TextView titleView = viewCache.get(R.id.title);
        TextView messageView = viewCache.get(R.id.message);

        //Get Data from Item
        String message = ((MyItem)item).getMessage();

        //Set Data to Views
        titleView.setText("Hello!");
        messageView.setText(message);
    }
});
```

More than one type of item can be specified this way, through custom defined `ITEM_TYPE` codes. Different view layouts and binding routines can be specified for objects of the same type, depending on how they are required to be displayed in the list.
For example, you may want items to be shown one way, but in-line advertisements to have a different set of data and appearance in the list.

Click actions on the items can be obtained through the click listener interface:
```Java
recycler.setOnItemClickListener(new EasyRecyclerView.OnItemClickListener()
{
	@Override
	public void OnItemClick(View v, Object object)
	{
		//TODO: Do something with object and view.
	}
});
```

repository: shanescarlett/Android-Widgets

repo_name: shanescarlett/Android-Widgets


text:
Create a front-end application allowing a user to paste a JSON formatted in a specific way (see Input) and display the cleaned version (see Ouput).

Keep track of the amount of hours you spend on each part of this project and send them with your submission to<EMAIL_ADDRESS>
# Step 1

The first step focuses only on the front-end side.

- Create a JavaScript application using React (and any other library/tool you want/need).
- The application must have an editable field where the user can paste a formatted JSON (Input).
- The application must show a non-editable field displaying the updated JSON (Output).
- The application must have automated tests.
- [Here's an example of the UI](https://docs.google.com/drawings/d/15kQtFSQjNA8LVpWf1r7t9m7RPaa7G9bp0G7ZT_6VMco/edit?usp=sharing) (feel free to ignore it and do your own if you can do something better, this is just to give you a better idea of what's expected).

# Step 2

This second step focuses on communication with an external API.

- Use the [GitHub API](https://developer.github.com/v3/repos/#list-all-public-repositories) to list all public repositories.
- Show 10 repositories in a table with all the information that you judge necessary.
- Add pagination to allow the user to navigate the repositories, 10 by 10.
- Please use Redux or MobX as state management

# Guidelines

- Write clean, readable and well-structured code.
- Version-control with Git and write good commit messages.
- Write concise and well-targeted tests.

# Data

## Input

```
{"0":
  [{"id": 10,
    "title": "House",
    "level": 0,
    "children": [],
    "parent_id": null}],
 "1":
  [{"id": 12,
    "title": "Red Roof",
    "level": 1,
    "children": [],
    "parent_id": 10},
   {"id": 18,
    "title": "Blue Roof",
    "level": 1,
    "children": [],
    "parent_id": 10},
   {"id": 13,
    "title": "Wall",
    "level": 1,
    "children": [],
    "parent_id": 10}],
 "2":
  [{"id": 17,
    "title": "Blue Window",
    "level": 2,
    "children": [],
    "parent_id": 12},
   {"id": 16,
    "title": "Door",
    "level": 2,
    "children": [],
    "parent_id": 13},
   {"id": 15,
    "title": "Red Window",
    "level": 2,
    "children": [],
    "parent_id": 12}]}
```

## Output

```
[{"id": 10,
  "title": "House",
  "level": 0,
  "children":
   [{"id": 12,
     "title": "Red Roof",
     "level": 1,
     "children":
      [{"id": 17,
        "title": "Blue Window",
        "level": 2,
        "children": [],
        "parent_id": 12},
       {"id": 15,
        "title": "Red Window",
        "level": 2,
        "children": [],
        "parent_id": 12}],
     "parent_id": 10},
    {"id": 18,
     "title": "Blue Roof",
     "level": 1,
     "children": [],
     "parent_id": 10},
    {"id": 13,
     "title": "Wall",
     "level": 1,
     "children":
      [{"id": 16,
        "title": "Door",
        "level": 2,
        "children": [],
        "parent_id": 13}],
     "parent_id": 10}],
  "parent_id": null}]
```

repository: metromerce/frontend-challenge

repo_name: metromerce/frontend-challenge


text:
# JavaScript Mapping Environment

This project has been developed for the University of Leeds GEOG5012M course. The application is [hosted on GitHub Pages](https://anth-dj.github.io/geog5012m_project/) and the source code is [hosted on GitHub](https://github.com/anth-dj/geog5012m_project), including this [README](https://github.com/anth-dj/geog5012m_project/blob/main/README.md).

## Overview

The JavaScript Mapping Environment project leverages open source libraries and the web browser's JavaScript interpreter to create a basic scripting environment for geographic data. The page is divided in half, with an interactive map view on one side and scripting components on the other.

The primary purpose of this application is to allow quick iteration in the processing and exploration of geographic data, while providing immediate visual feedback on the map.

![alt text](screenshot.jpg "Screenshot of example data exploration")

The application consists of four main components:
* **Map** - displays geographic information on an interactive map
* **Input Layers** - allows loading of GeoJSON data from a URL link and lists the input layers currently visible on the map
* **Script** - a text area to write JavaScript code that analyzes or transforms the input layer data
* **Console Output** - displays the browser JavaScript console output

## Usage Instructions

To add an input layer, enter a URL to a GeoJSON source in the text field and click Add. This will add a GeoJSON layer to the map view with an assigned colour and identifier. The identifier can then be referenced as a global variable in the embedded JavaScript text area.

Any valid JavaScript code can be entered in the text area and executed by clicking Run. Each layer identifier is available as a global variable and a special `inputLayers` variable references a list of all added input layers. If a GeoJSON object is returned at the end of the script it will be displayed on the map as a temporary `scratch` layer, which will itself be available as a global variable in the next script run.

## Future Work

Because this project has been developed to satisfy the GEOG5012M final project requirements in a limited amount of time, some useful features are incomplete or missing. Additional work may include:

* incorporation of a code editing component with syntax highlighting
* filesystem data import/export
* integration of open source spatial analysis JavaScript libraries

## References

This application was developed using reference material from the following sources:

* University of Leeds GEOG5012M course material
* Mozilla and individual contributors. 2020. MDN Web Docs. [Online]. [Accessed 30 November 2020]. Available from: https://developer.mozilla.org/

Map data is provided by:
* OpenStreetMap contributors. 2020. OpenStreetMap tiles. OpenStreetMap Foundation. [Online]. [Accessed 30 November 2020]. Available from: https://www.openstreetmap.org/
* Earth Science Data Systems Program and NASA Earth Observatory. 2020. Earth Observatory Natural Events Tracker (3.0). [Software]. [Accessed 30 November 2020].

Source code dependencies include:
* Agafonkin, V. 2020. Leaflet (1.7.1). [Software]. [Accessed 30 November 2020]
* The jQuery Foundation. 2020. jQuery (1.7.2). [Software]. [Accessed 30 November 2020].

## License

This project is made publicly available under the MIT license (see the [LICENSE](./LICENSE) file).


text:
# timetravel
software for tracking personal timedilation for androidOS
© 2015-2017
David Jonas and Daniel Buzzo

http://timetravel-app.com
<EMAIL_ADDRESS>http://buzzo.com

Software associated with the academic paper
'Designing for the Impossible: Creating a
mobile application to track time dilation' Published, British Computer Society, Electronic Visualisation in the Arts, Conference, London June 2015.
http://ewic.bcs.org/upload/pdf/ewic_eva15_visual_paper3.pdf
http://dx.doi.org/10.14236/ewic/eva2015.12

and the associated photo essay 'TIME TRAVEL'
Daniel Buzz0 2014, ISBN-13:<PHONE_NUMBER>477

https://www.amazon.com/TIME-TRAVEL-Daniel-Buzzo/dp/1320051472/ref=sr_1_1/145-0057020-2007857?ie=UTF8&qid=1491373154&sr=8-1&keywords=9781320051477

repository: danbz/timetravel

repo_name: danbz/timetravel