text:
# Calendars

## Calendar Object

Calendar is used to define working-timing of resources. An Administrator user can define multiple calendars using eRS Cloud application. Each calendar may have different timings defined. Timings allow breaks and multiple timing blocks. In addition to timings, user can apply holidays and exceptions (working or non-working) on calendars. A particular calendar can be applied on a set of resources and a resource can also have multiple calendars on different time periods. eRS Cloud API allows getting details of calendars.

> Example Response

```json
{
    "id": 2,
    "name": "New York Calendar",
    "description": null,
    "is_default": false,
    "timings": [{
        "day_num": 1,
        "start_time": 540,
        "end_time": 1020
    }, {
        "day_num": 2,
        "start_time": 540,
        "end_time": 1020
    }, {
        "day_num": 3,
        "start_time": 540,
        "end_time": 1020
    }, {
        "day_num": 4,
        "start_time": 540,
        "end_time": 1020
    }, {
        "day_num": 5,
        "start_time": 540,
        "end_time": 1020
    }],
    "holidays": [{
        "id": 1,
        "name": "Christmas Day",
        "description": null,
        "date": "2018-12-25",
        "tags": []
    }],
    "exceptions": [{
        "id": 1,
        "name": "Over Time",
        "description": null,
        "date": "2018-12-20",
        "is_working_exception": true,
        "tags": [],
        "timings": [{
            "start_time": 540,
            "end_time": 1140
        }]
    }],
    "created_on": "2018-08-21T10:03:08.650207+00:00",
    "modified_on": "2018-12-03T15:09:34.697541+00:00",
    "created_by": {
        "id": 118,
        "name": "John Doe"
    },
    "modified_by": {
        "id": 118,
        "name": "John doe"
    }
}
```

ATTRIBUTES

Name | Description
---------: | :-----------
**id**
`integer` |  Unique identifier for the object.
**name**
`string` |  A meaningful name to identify this calendar object.
**description**
`string` |  Description for calendar object.
**is_default**
 `boolean`| Indicates whether this calendar object is used as a default calendar or not. There can only be one (which can be changed from Administrator calendar settings) default calendar at a time. Default calendar gets applied as working calendar, if calendar is not specified while creating a resource.
**timings**
 `array of objects` | List of timing objects applicable for this calendar object. Timing objects (or `timing_blocks`) are used to define working capacity for each day of week.
**timings.day_num**
 `integer` | Represents day of week, starting from 0 (for Sunday) to 6 (for Saturday).
**timings.start_time**
 `integer` | Represents start time for this timing block in minutes (since 12 AM) i.e. for 6:00 AM, value would be 6 * 60 = 360 and for 9:00 AM it would be 9 * 60 = 540.
**timings.end_time**
 `integer` | Represents end time for this timing block in minutes (since 12 AM) i.e. for 5:00 PM, value would be (12+5) * 60 = 1020.
**holidays**
`array of objects` | List of holiday objects applied for this calendar. There can be multiple holidays applied on calendar.
**holidays.id**
`integer` | Unique identifier for holiday object.
**holidays.name**
`string` | Name of holiday.
**holidays.description**
`string` | Description for this holiday object.
**holidays.date**
`string`| Represents date on which holiday occurs. This is a string value in ISO 8601 extended Date format i.e. yyyy-mm-dd.
**holidays.tags**
`array of string` | Tags are the list of strings (labels) attached to this holiday object which could be used for the purpose of identification or other information.
**exceptions**
`array of objects`| List of exception objects that are applied on calendar object. Exceptions are used to override working timing of calendar for a specified day.
**exceptions.id**
`integer` | Unique identifier for exception object.
**exceptions.name**
`string` | Name of exception object (which is to be displayed wherever referred).
**exceptions.description**
`string` | Description for exception object.
**exceptions.date**
`string` | Represents date on which exception is to be applied. This is a string value in ISO 8601 extended Date format i.e. yyyy-mm-dd.
**exceptions.is_working_exception**
`boolean` | Indicates whether this exception is working exception or non-working. A working exception is used to override timings of a working day and if applied on a non-working day, it turns it into working day. A non-working exception turns any working day into non-working.
**exceptions.timings**
`array of objects` | List of timing objects (or `timing_blocks`) for this exception. This defines working timings for this exception day. There are no timings if exception is a non-working exception.
**exceptions.timings.start_time**
 `integer` | Represents start time for this timing block in minutes (since 12 AM) i.e. for 6:00 AM, value would be 6 * 60 = 360 and for 9:00 AM it would be 9 * 60 = 540.
**exceptions.timings.end_time**
 `integer` | Represents end time for this timing block in minutes (since 12 AM) i.e. for 5:00 PM, value would be (12+5) * 60 = 1020.
**exceptions.tags**
`array of string` | Tags are the list of strings (labels) attached to this exception object which could be used for the purpose of identification or other information.
**created_on**
`string`  | Timestamp at which calendar object was created.
**modified_on**
`string` | Describes the latest modification timestamp.
**created_by**
 `object` | Describes by whom calendar object was created.|
**modified_by**
`object` | This field describes by whom last modification was done.

## List Calendars

Retrieves all available list of calendars.

> **`GET /v1/calendars`**

> Example Request

```shell
curl -v \
"https://app.eresourcescheduler.cloud/rest/v1/calendars" \
-H "Authorization: Bearer B8x5Vj1O65r6wnoV"
```

> Example Response

```json
{
  "total_count": 4,
  "data": [{
      "id": 2,
      "name": "New York Calendar",
      "description": null,
      "is_default": false,
      "timings": [{
        "day_num": 1,
        "start_time": 540,
        "end_time": 1020
      }, {
        "day_num": 2,
        "start_time": 540,
        "end_time": 1020
      }, {
        "day_num": 3,
        "start_time": 540,
        "end_time": 1020
      }, {
        "day_num": 4,
        "start_time": 540,
        "end_time": 1020
      }, {
        "day_num": 5,
        "start_time": 540,
        "end_time": 1020
      }],
      "created_on": "2018-08-21T10:03:08.650207+00:00",
      "modified_on": "2018-12-03T15:09:34.697541+00:00",
      "created_by": {
        "id": 118,
        "name": "John Doe"
      },
      "modified_by": {
        "id": 118,
        "name": "John doe"
      }
    },
    { ... },
    { ... },
    { ... }
  ]
}
```

### Returns

| Code      | Description |
| ---:        |    :----   |
| **200**
 `OK`      |  Indicates that the operation was successful and list of calendars has been returned successfully. |

## Retrieve a Calendar

Retrieves the specified calendar along with exceptions and holidays applied on it.

> **`GET /v1/calendars/{ID}`**

> Example Request

```shell
curl -v \
"https://app.eresourcescheduler.cloud/rest/v1/calendars/1" \
-H "Authorization: Bearer B8x5Vj1O65r6wnoV"
```

> Example Response

```json
{
    "id": 1,
    "name": "New York Calendar",
    "description": null,
    "is_default": false,
    "timings": [{
        "day_num": 1,
        "start_time": 540,
        "end_time": 1020
    }, {
        "day_num": 2,
        "start_time": 540,
        "end_time": 1020
    }, {
        "day_num": 3,
        "start_time": 540,
        "end_time": 1020
    }, {
        "day_num": 4,
        "start_time": 540,
        "end_time": 1020
    }, {
        "day_num": 5,
        "start_time": 540,
        "end_time": 1020
    }],
    "holidays": [{
        "id": 1,
        "name": "Christmas Day",
        "description": null,
        "date": "2018-12-25",
        "tags": []
    }],
    "exceptions": [{
        "id": 1,
        "name": "Over Time",
        "description": null,
        "date": "2018-12-20",
        "is_working_exception": true,
        "tags": [],
        "timings": [{
            "start_time": 540,
            "end_time": 1140
        }]
    }],
    "created_on": "2018-08-21T10:03:08.650207+00:00",
    "modified_on": "2018-12-03T15:09:34.697541+00:00",
    "created_by": {
        "id": 118,
        "name": "John Doe"
    },
    "modified_by": {
        "id": 118,
        "name": "John doe"
    }
}
```

### Returns

| Code      | Description |
| ---:        |    :----   |
| **200**
 `OK`     | Indicates that the operation was successful and requested calendar has been returned successfully.
|  **404**
`Not Found` | indicates that calendar object with specified calendar ID does not exist or has been deleted already.

repository: enbraun/slate

gha_language: SCSS

repo_name: enbraun/slate


text:
---
title: "Introduction"
meta_title: "Introduction to Ghost - Core Concepts"
meta_description: "Ghost is an open source, professional publishing platform built on a modern Node.js technology stack — designed for teams who need power, flexibility and performance."
keywords:
    - concepts
    - ghost
    - publishing
    - platform
sidebar: "concepts"
---

Ghost is an open source, professional publishing platform built on a modern Node.js technology stack — designed for teams who need power, flexibility and performance.

Hitting the right balance of needs has led Ghost to be used in production by organisations including Apple, Sky News, DuckDuckGo, Mozilla, OpenAI, Square, CloudFlare, Tinder, the Bitcoin Foundation and [many more](https://ghost.org/customers/).

Every day Ghost powers some of the most-read stories on the internet, serving hundreds of millions of requests across tens of thousands of sites.

## How is Ghost different?

The first question most people have is, of course, how is Ghost different from everything else out there? Here's a table to give you a quick summary:

            Ghost
(That's us!)
            Open platforms
(eg. WordPress)
            Closed platforms
(eg.  Ghost provides the best of both worlds, and more.

Still after a more detailed comparison? We've got some in-depth articles comparing Ghost to [WordPress](https://ghost.org/vs/wordpress/), [Medium](https://ghost.org/vs/medium/) and [Tumblr](https://ghost.org/vs/tumblr/).

## Background

Ghost was created by [John O'Nolan](https://twitter.com/johnonolan) and [Hannah Wolfe](https://twitter.com/erisds) in 2013 following a runaway Kickstarter campaign to create a new, modern publishing platform to serve professional publishers.

Previously, John was a core contributor of WordPress and watched as the platform grew more complicated and less focused over time. Ghost started out as a little idea to be the antidote to that pain, and quickly grew in popularity as the demand for a modern open source solution became evident.

Today, Ghost is one of the most popular open source projects in the world - the **#1** CMS [on GitHub](https://github.com/tryghost/ghost) - and is used in production by millions of people.

More than anything, we approach building Ghost to create the product we've always wanted to use, the company we've always wanted to do business with, and the environment we've always wanted to work in.

So, we do things a little differently to most others:

#### Independent structure
Ghost is structured as a [non-profit organisation](https://ghost.org/about) to ensure it can legally never be sold and will always remain independent, building products based on the needs of its users - _not_ the whims of investors looking for 💰 returns.

#### Sustainable business

While the software we release is free, we also sell [premium managed hosting](https://ghost.org/pricing/) for it, which gives the non-profit organisation a sustainable business model and allows it to be 100% self-funded.

#### Distributed team

Having a sustainable business allows us to hire open source contributors to work on Ghost full-time, and we do this [entirely remotely](https://ghost.org/about/#careers). The core Ghost team is fully distributed and live wherever they choose.

#### Transparent by default

We share [our revenue](https://ghost.org/about) transparently and [our code](https://github.com/tryghost) openly so anyone can verify what we do and how we do it. No cloaks or daggers.

#### Unconditional open source

All our projects are released under the permissive open source [MIT licence](https://en.wikipedia.org/wiki/MIT_License), so that even if the company were to fail, our code could still be picked up and carried on by anyone in the world without restriction.

license: MIT

repository: jolylai/docs

branch_name: refs/heads/master

extension: md

gha_language: JavaScript

gha_license_id: MIT

license_type: permissive

repo_name: jolylai/docs


text:
---
layout: post
title: "Clean aged artifacts from Artifactory"
date: 2013-03-22 23:21
comments: true
tags:
- Maven
- SoftwareDev
---
[Artifactory](http://www.jfrog.com/home/v_artifactory_opensource_overview) has no feature to automatically remove old artifacts from local repository. Once the disk is full, manually remove unused artifacts is painful. Moveover, you're not sure which artifacts are unused and can be safely deleted.

Artifactory has a set of [REST API](http://wiki.jfrog.org/confluence/display/RTF/Artifactory's+REST+API). One of the API is to search artifacts not downloaded since a specified date. In our projects, there are CI jobs which keep building the software for each branch. If a SNAPSHOT artifact hasn't been downloaded for a time, we can make sure that this artifact is no use any more, a newer version should be existing.

I made a Ruby script to do the clean up job automatically. It searches artifacts which weren't downloaded in specific days and deletes them. It can be invoked in a CI job to run periodically.

{% gist https://gist.github.com/aleung/5203736 %}

The script can also be used to clean unused release (non-SNAPSHOT) artifacts. However a good practice is to keep releases forever.

repository: aleung/octopress-blog

extension: markdown

repo_name: aleung/octopress-blog


text:
---
name: Feature
about: Feature template for 307 project.
title: ''
labels: feature
assignees: ''

---

## User Story
As a <type of user>, I want <some goal> so that <some reason>.

## Which biz goal are you targeting and why?
The business goal is <goal> because

## Use Case

**Name**
""

**Description**

**Precondition**

**Happy Path or Course of Action**
-

**Postcondition**

**Alternative Paths**
1.

2.

3.

repository: rupaltotale/Favor-Webapp

gha_language: Python

repo_name: rupaltotale/Favor-Webapp


text:
# Clock

The whole CPU will use a single master clock. Most instructions will take a single cycle,
except of those that have immediate value, which take two.
To ensure correct start, some kind of power-on reset
is required to ignore first cycle or two.

During rising clock edge, every temporary signal will be latched to appropriate registers,
the rest of the clock cycle is used to propagate new values of registers to calculate
new temporary values. The only time that clock value matters other than its rising edge,
is when storing data to RAM. Since most of RAM chips are level-triggered, if we were to
output the Write Enable signal as soon as we decode the instruction, we would risk
not having address ready yet and thus writing in bogus location. For that reason,
Write Enable may be AND-ed with inverted clock (i.e. write happens in second half of the cycle,
when address and data should be long since calculated). This may however cause hold
time violation for that chip (we're releasing WE line at about the same time as invalidating
address and data buses). For that reason we may consider making 2-bit Gray code counter and
using one of the outputs as clock as always, and using the other output as RAM access
clock (or even certain combination of them, to use just 3rd 25% of clock time as WE):

```
With Gray code:

Q0   '''''''''|_________|'''''''''|_________|'''''''''|_________
Q1   ''''|_________|'''''''''|_________|'''''''''|_________|''''
rising edge        x                   x                   x
WE   WWWWWWWWW           WWWWWWWWW           WWWWWWWWW

Old way:

clk  ''''|_________|'''''''''|_________|'''''''''|_________|''''
rising edge        x                   x                   x
WE        WWWWWWWWW           WWWWWWWWW           WWWWWWWWW
```

This would allow
at least half clock period of both setup and hold. Disadvantage is that in manual clock mode
user will have to press button twice for proper cycle; and that clock will have to double
its speed in general. The Gray code generator will have to be very reliable too, even
at high speed, and have steep slopes.

The clock will be generated using astable oscillator, at frequency adjustable in some narrow
range (less than a factor of five or so) by potentiometer. There will be a long chain of
prescaler units, each dividing frequency by two. The actual number of prescalers used will be
decided by DIP switches or similar method. There should be also possibility of using external clock, or even
manual button pressing (filtered to avoid glitches) as clock. The latter two have potential
to have rather slow rise time - so the clock signal will be passed through 4 inverters,
similarly to Darlington pair, in order to discretize the clock as much as possible:

![clock](images/clock_inv.png?raw=true)

The measured rise time is about a nanosecond or two, which should be enough.
(update: actually, two inverters is enough too, with R_base = 100, R_pullup = 270).

The oscillator frequency should be something very large, 10MHz perhaps. The last stage of
prescalers should go down to maybe 0.5Hz, to see the updates in real time. This totals
in about 24 T flip-flops.

[This](http://ch00ftech.com/2012/07/10/transistor-clock-part-2-prescaler/)
design of prescaler seems to be commonly used, and is relatively low on components
(one alternative is using D-flip-flop, which has 6 NANDs):

![prescaler](images/clock_div.png?raw=true)

After checking it, it seems to be very sensitive on input clock frequency though - for some capacitor
and resistor values, it works at 1MHz, for others - 100kHz etc. Otherwise there are either
extra unwanted oscillations, or the output stays constant the whole time. In the end, I'll
probably stick with ordinary D flip-flops, regardless of their size, since they work more reliably.

## New clock design

The above design for clock is fine if we do one instruction byte per two-clock cycle. Since then
I noticed we may squeeze in fetching immediate value too, as long as we make sure some of the phases
are more non-overlapping than above, in order to keep hold and setup constraints for SRAM, Flash and
our registers. We again make two non-overlapping write phases, with two other signals enveloping them:

```
W0   ''''|________________|''''|________________|''''|_______________
W1   __________|''''|________________|''''|________________|''''|____
G0   ''''''|____________|''''''''|____________|''''''''|_____________
G1   ________|''''''''|____________|''''''''|____________|''''''''|__
```

Here, G0 and G1 mean: generate correct inputs to latches from phase 0/1, and W0/W1 mean: enable
latches from phase 0/1. Whenever Wx is high (latches), so is Gx, with appropriate safety margin.
For SRAM, address is calculated during G1 and must be done before W1 goes high. For this reason
we skew the G0/G1 to the  left (to give more time for setup and less for hold).

Generating W0 and W1 is simple enough, and done using two edge-triggered flip-flops counting
in Grey code, as shown above. Creating G0 and G1 is harder, since they are out of phase. For
that reason we artificially delay some signals using capacitor to ground with pullup resistor.
The resistor is actually a potentiometer, to allow to tweak the waveform.

![clock](images/clock_dual.png?raw=true)


text:
  Please Note:

  This repository is no longer maintained and much of the APIs used have been changed or updated

![logo](Screenshots/GCF-Stripe.png)

### Containerize and flatten your payment processing server into microservices using GCF.

[![License](https://img.shields.io/cocoapods/l/Neon.svg)](http://doge.mit-license.org)
[![codebeat badge](https://codebeat.co/badges/7bb36358-6412-4f20-9833-5e29f4bc9fd7)](https://codebeat.co/projects/github-com-rldaulton-gcf-stripe-master)

`GCF-Stripe`is a serverless implementation of basic Stripe requests using Google Cloud Functions as containerized microservices. This repo is designed to help those just beginning with Google's Cloud Platform to get some basic services up and running on the Cloud Function product.

Check out the folders in the `master` branch where you'll find different requests ready to be dropped into your Google Cloud Functions - all packaged as `index.js` files, and ready to go.

### Getting Started

1.) Visit the [Google Cloud Functions](https://cloud.google.com/functions/) welcome page, and sign up for a free trial, or sign in to your Google Cloud account.

2.) Once logged in to your Cloud Platform Console, select the hamburger menu on the left, and enter the "Cloud Functions" management section.

![gcf-menu](Screenshots/gcf-menu.png)

3.) From here, you will create a new cloud function, ensuring to select `HTTP Trigger` as the Trigger option.

Deploying...

4.) Select `Inline Editor` under the Source code option, or upload your own version, using the code supplied in this repo.

5.) Ensure that you have replaced the pieces of code, where necessary, with your Stripe information - most importantly your [Stripe Keys](https://github.com/rldaulton/GCF-Stripe/blob/36f0bef34cfd0d37676208cdec7119c3bdca244a/Charge%20Customer/index.js#L4), which you can find in your Stripe Dashboard under `Dashboard > API`.

6.) Once deployed, use your client to call the endpoint for your function & supply the correct [parameters encoded](https://github.com/rldaulton/GCF-Stripe/blob/96fc38fc0220aee9a0ecaee718a8b0edf1db18d8/Charge%20Customer/index.js#L12) in the `URL` to interact with the Stripe API.

Happy serverless computing!

### Support
- For support and help getting your Google Cloud Functions up an running, take a look at their [Quickstart](https://cloud.google.com/functions/docs/quickstart) page.
- For help specifically with `HTTP Triggers` on your functions, check out the [HTTP Tutorial](https://cloud.google.com/functions/docs/tutorials/http).
- Be sure to check out the [writing HTTP cloud functions](https://cloud.google.com/functions/docs/writing/http) section for help and formatting, should you have any trouble.
- Looking for more serverless repos? Check out [awesome-serverless](https://github.com/anaibol/awesome-serverless).

For specific support regarding the Stripe functionality of the repo, see the respective sections below for Stripe's `Node JS` [API Docs](https://stripe.com/docs/api):

[
Creating a Customer
](https://stripe.com/docs/api/node#create_customer)

[
Initiating a Charge
](https://stripe.com/docs/api/node#create_charge)

[
Subscribe Customer to Payment Plan
](https://stripe.com/docs/api/node#create_subscription)

[
UNsubscribe Customer from Payment Plan
](https://stripe.com/docs/api/node#cancel_subscription)

[
Adding a Source
](https://stripe.com/docs/api/node#create_source)

[
Delete a Source
](https://stripe.com/docs/api/node#delete_card)

#### Author
[@rldaulton](https://ryandaulton.com)

#### License
MIT. See the [LICENSE](https://github.com/rldaulton/GCF-Stripe/blob/master/LICENSE) file for more information.

repository: rldaulton/GCF-Stripe

repo_name: rldaulton/GCF-Stripe


text:
# Autonomous navigation of a drone in indoor environments

This work is a research and development project on autonomous navigation algorithms for a small programmable drone in indoor environments free of dynamic obstacles. The hypothesis that the drone has access to a simple representation of its environment, in order to plan paths and analyze them, was posed.

## Context

Master's thesis carried out to obtain the degree of Master of Science in Computer Science Engineering ([University of Liège](https://uliege.be/), [Faculty of Applied Science](https://facsa.uliege.be/), academic year 2020-2021).

## Main objective

The main objective of this work was to explore and test modern techniques allowing the autonomous navigation of a drone in an indoor environment.

The main techniques explored are:

* the calculation of vanishing point to adjust the drone;
* the use of neural networks for various tasks (associating an action to an image, computing vanishing point, depth estimation);
* the use of markers (ArUco, QR code) to guide the drone.

Tests were first performed on a simulator ([Unreal Engine 4](https://www.unrealengine.com/) with the [AirSim](https://microsoft.github.io/AirSim/) plugin) and then in the corridors of a building with a [DJI Tello EDU](https://www.ryzerobotics.com/tello-edu).

## Resources

### Data

The configuration of the AirSim plugin as well as the simulated environments created on Unreal Engine 4 are described and available [here](resources/simulator/README.md).

The data sets constituted on each of the simulated environments are described and available [here](resources/data/README.md).

Examples of environment representations, used by the algorithms, are available [here](resources/environments/).

### Code

The [`bash/`](bash/) folder contains miscellaneous scripts used mainly to process images.

The main implementation of the algorithms is located in the [`python/`](python/) folder. More precisely,

* [`airsim/`](python/airsim/) is the AirSim Python package;
* [`analysis/`](python/analysis/) is a module containing implementation of marker detection and decoding algorithms and vanishing point detection algorithms;
* [`learning/`](python/learning/) is a module containing implementation of all elements related to Deep Learning (data sets, models, training and testing procedures);
* [`misc/`](python/misc/) contains miscellaneous scripts, mainly tests used to display and evaluate intermediate results;
* [`plots/`](python/plots/) is a module containing settings to create LaTeX plots with `matplotlib` package;
* [`uav/`](python/uav/) is the main module that contains implementation of the controllers, environnement representation and all navigation modules and algorithms.

Files [`learn.py`](python/learn.py) and [`navigate.py`](python/navigate.py) are main files used to, respectively, train and evaluate a neural network and navigate the drone.

## Results

All results obtained are explicited in my [thesis report](latex/main.pdf).

Important results are illustrated by videos available on [this YouTube playlist](https://youtube.com/playlist?list=PLJEcTQrQgiVdacuc2HymqLV9RqjaRMNYt).

## Try it yourself

First, make sure to create and activate the Anaconda environment using

```bash
conda env create -f environment.yml
conda activate autonomous-drone
```

Then, you can simply run the [`navigate.py`](python/navigate.py) script using, for example,

```bash
python navigate.py --environment my_env.txt --controller airsim --algorithm vision --show
```

Help with arguments can be obtained via

```bash
python navigate.py --help
```

### Custom environment

If you want to work with your (simulated or real) environment, make sure to create a representation as described in the `Environment` class of the [`environment.py`](python/uav/environment.py) file. Examples can be found [here](resources/environments/).

### Deep Learning

If you want to use navigation algorithms that use neural network(s), make sure to train model(s) using the [`learn.py`](python/learn.py) script.

Help with arguments can be obtained via

```bash
python learn.py --help
```

Exemples of ready-to-use data sets are available [here](resources/data/README.md).

## References

All references used are listed in my [thesis report](latex/main.pdf).

repository: meurissemax/autonomous-drone

branch_name: refs/heads/main

repo_name: meurissemax/autonomous-drone


text:
# Gtest support in Arcadia

Gtest wrapper that reports results exactly how Arcadia CI wants it.

How to use:

- use `GTEST` in your `ya.make`;
- include `gtest.h` from this library. Don't include `<gtest/gtest.h>` and `<gmock/gmock.h>` directly because then you'll not get our extensions, including pretty printers for util types;
- write tests and enjoy.

repository: catboost/catboost

repo_name: catboost/catboost


text:
# loggerine
🖋 A simple, reliable and easy to use logger

> Warning! Loggerine is on an early stage, it may have some bugs

## Features
- 📦 Lightweight. Just 2Kb bundled
- 🧂 Simple. The package is just a single class with a few functions
- 🔌 Fast. It's simple, it's fast
- 📚 Documented. It's simple, it's almost self-documenting, although there are docs
- 🗽 Open Source. MIT License, as simple as the library

## Getting started
Install the library with
```
npm install @techiepi/loggerine
```
You're done! Now you can use the library like in the example below
```js
const logger = new Loggerine({
    module: "Example",
    debugLevel: 3,
    useVanillaFunctions: true
});

logger.debug("This is a test debug"); // Shouldn't do anything because the debug level is < 4
logger.info("This is a test info"); // Should print it because the debug level is >= 3
logger.warn("This is a test warn"); // Should print it because the debug level is >= 3
logger.error("This is a test error"); // Should print it because the debug level is >= 3
```
![Result of the code above](docs/example.gif)

## Build
You can run
```
npm run build
```
to build the library

## License
This project is licensed under the [MIT license](LICENSE)

repository: Techie-Pi/loggerine

repo_name: Techie-Pi/loggerine


text:
# GoogleDocSeed

Pulls a Google Spreadsheet into a CSV string.

## Installation

Add this line to your application's Gemfile:

    gem 'google_doc_seed'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install google_doc_seed

## Usage

Get a [[Google OAuth2 token]](https://developers.google.com/oauthplayground)
with the spreadsheet scope.

Or check out `examples/full.rb` for help generating one more easily.

Then do this:

```ruby
require 'google_doc_seed'

seeder = GoogleDocSeed.new('your-oauth-token')
IO.write('doc.csv', seeder.to_csv_string('0Aut3k...', 'My Worksheet'))
```

## To Do

- Token retrieval
- Token renewal
- Work with the CSV rather than just a string?

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
# Code With Mosh: The Ultimate Docker Course 🐳

## Before we start ❗

### Developer information 🙋🏼♂

Developed by Magnus Rødseth, spring 2021.

### Description ❓

Docker is a platform for building, running, and shipping applications with ease. That's why most companies use it and are looking for software or DevOps engineers with Docker skills.

**But what is this course?** A clear, concise, comprehensive, and highly practical course that prepares you for the job. You'll learn everything about Docker from the absolute basics to more advanced concepts in under 5 hours. By the end of this course, you'll have a live full-stack application with a database and automated tests in the cloud.

### Goals 🏁

By the end of this course, you'll be able to…

✅ Confidently build and ship applications with Docker
✅ Work in development teams using Docker
✅ Troubleshoot issues like a pro

## So let's get started ⏩

### Introduction to Docker 🐳

#### What is Docker?

Docker is a platform for building, running and shipping applications in a consistent manner. In practice, this means that if the application runs on your development machine, you're sure it can run on test and production machines.

Additionally, if a new developer needs to spin up your application, he simply needs to tell Docker to start the application, without the need for much configuration.

#### Virtual Machines versus Containers

A **virtual machine**, or VMs for short, is an absatraction of a machine or physical hardware. Using VMs, we can _run apps in isolated environments_. However, each VM _needs a full OS to function_. This causes it to be _slow to start_ and quite _resource intensive_.

A **container** is an isolated environment for running an application. As with VMs, containers also allow us to _run multiple apps in isolation_. Additionally, they are _lightweight_ and _use the OS of the host_. Because the OS already runs on the host, a container can _start relatively quickly_. Containers also require _less hardware resources_. In theory, using containers, we can run thousands of containers side by side on one host.

#### Docker Architecture

Docker uses a client-server architecture using a REST API. All containers running on a host share the operating system kernel.

**What's a kernel?** A kernel is the core of an operating system, which manages applications and hardware resources. Different operating systems have different kernel with different APIs. Thus, we cannot run a Windows application on Linux, because the Windows application needs to talk to the uncompatible Linux kernel under the hood.

**On Linux OS**, we can only run Linux containers, because the containers need to run on Linux.

**On Windows OS**, we can run both Windows and Linux containers, because Windows 10 ships with both a Windows kernel and a Linux kernel.

**Docker on Mac OS** uses a lightweight Linux virtual machine to run Linux containers using the Linux kernel.

#### Development Workflow

Let's say you have a full-stack web application that you want to dockerize. Now, you add a Dockerfile.

A **Dockerfile** is a plaintext file that includes instructions that Docker uses to package the application into an image.

A **Docker Image** has a cut-down OS, a runtime environment, application files, third-party libraries, environment variables, etc...

Once we have built the image, we can tell Docker to create a container from that image.

Once we have a complete Docker image, we can push it to **Docker Hub**. Docker Hub to Docker is like GitHub to Git; it's a storage for Docker Images that anyone can pull down a specific version of our application and use it.

#### Docker in action

Let's say you have a JavaScript application called `app.js` with 1 line: `console.log("Hello, Docker!);`. If you want to ship this application to other machines, you must meet the following requirements:

- Start with an OS
- Install a runtime environment, for example Node
- Copy all app files
- Run `node app.js`

Docker solves this problem by defining a **Dockerfile**.

**`Dockerfile`**

```Dockerfile
# Pull official Node image from Docker Hub, using the Alpine distribution
FROM node:alpine

# Copy all application files
COPY . /app

# Set the working directory to the /app directory in the Node image
WORKDIR /app

# Run the application
CMD node app.js
```

Now, we enter the following in the working directory in the terminal: `docker build -t hello-docker .`. `-t` tells Docker to add a tag with the build. We build from the current working directory using `.`.

To run the application, we enter `docker run hello-docker` in the terminal. We can see that the output is: "Hello, Docker!".

### The Linux Command Line ⚙

#### Running Linux

In the terminal, run `docker run ubuntu`. In a way, this is a shortcut for pulling and running Docker images. After running the command, the Docker image process is terminated. Validate this by running `docker ps -a`, showing all running and stopped Docker containers.

Enter `docker run -it ubuntu` ,to run the Ubuntu container in interactive mode. In the terminal, you can see something like this: `root@db07914dac5c:/#`. `root` is the logged in user. `db07914dac5c` is the machine that Ubuntu is running on. `/` represents the root directory, and this is the current working directory. The `#` informs us that the current user (the `root` user) has the highest privileges. Non-root users should have a `$` instead of the `#`.

Typing `echo $0` displays the location of this shell program. This outputs `/bin/bash`.

**Important to note!** Linux is a case-sensitive operating system; `echo` is not the same as `Echo`. Additionally, we use `/` and not `\` in Linux, when navigating directories.

#### Managing Packages

In Linux, the package manager is called `apt`. Let's say we want to install the text editor Nano in Ubuntu.

**`Terminal`**

```shell
# Update the package database
apt update

# Install Nano using apt
apt install nano

# Remove Nano using apt
apt remove nano
```

#### Searching for text

`grep`, short for "Global Regular Expression Print", is an insanely useful command line tool.

**`Terminal`**

```shell
# Case sensitive search for "hello" in file1.txt
grep hello file1.txt

# Case insensitive search for "hello" in file1.txt
grep -i hello file1.txt

# Case insensitive search for "hello" in multiple files
grep -i hello file1.txt file2.txt

# Case insensitive search for "hello" in all files that start with "file"
grep -i hello file*

# Case insensitive search for "hello" in current working directory
grep -i -r hello .

# Same as above, but Linux allows for combined options
grep -ir hello .
```

#### Chaining Commands

Linux allows us to chain commands. This is very useful when defining workflows using Docker.

**`Terminal`**

```shell
# Create new dir, cd into it and output "Done"
mkdir test ; cd test ; echo Done
```

#### Environment Variables

**`Terminal`**

```shell
# Prints all environment variables on the machine
printenv

# Prints the value of PATH env variable
printenv PATH

# Set env variable in the current terminal session
export DB_USER=john

# Prints "john"
echo $DB_USER

# Append env variable to .bashrc
echo DB_USER=john >> .bashrc
```

#### Managing Users

**`Terminal`**

```shell
# Add new user. Set home directory using -m.
useradd -m john

# Last line of this print shows the new added user
cat /etc/passwd

# Modify user record. Set shell of user john using -s.
usermod -s /bin/bash john

# Prints credentials in encrypted format. Only accessible to root user.
cat /etc/shadow

# Starts an interactive bash session with user john, using a given Docker container ID
docker exec -it -u john 2f759e6996e9 bash

# Delete user
userdel john

# Executes useradd under the hood for a more interactive way of creating new users
adduser adam
```

### Building Images 🖼

#### Images and Containers

**An image** includes everything an application needs to run:

- A cut-down OS
- Third-party libraries
- Application files
- Environment variables
- etc...

**A container** provides an isolated environment. Containers can be started, stopped and restarted. Technically, a container is just a process; that is, a running instance of an application.

#### Dockerfile Instructions

When defining the base image, always use a specific version. If you're using Node as base image, don't use `node:latest` in the `Dockerfile`. This may cause unpredictable releases in the future. **Always specify the version of images you use.**

**`Dockerfile`**

```Dockerfile
# Using base image with specific version
FROM node:14.16.0-alpine3.13
```

#### Copying files and directories

**`Dockerfile`**

```Dockerfile
# Set working dir to absolute path from root
WORKDIR /app

# Copy entire dir into working directory
COPY . .
```

**`Terminal`**

```shell
# Build Docker image
docker build -t react-app .

# Run Docker container in interactive mode with shell script
docker run -it react-app sh

# Output dir structure.
# This will output this docker-course repository dir structure,
# because we copied its contents to the container.
ls
```

#### Excluding files and directories

We can exclude files and directories using a `.dockerignore` file.

You can inspect the `.dockerignore` file [here](/frontend/.dockerignore).

Note that when running `docker build -t react-app .`, our build context is significantly smaller after ignoring `node_modules`. Additionally, note that the `node_modules` folder is not copied over to the container machine. Thus, we need to run `npm install` to get the dependencies.

#### Running Commands

We use the `RUN` command in the `Dockerfile` to run available commands.

**`Dockerfile`**

```Dockerfile
# Use Node Package Manager to install dependencies
RUN npm install
```

#### Setting environment variables

We can set environment variables in the `Dockerfile`.

**`Dockerfile`**

```Dockerfile
# Sets env variable on machine
ENV API_URL=http://api.test-app.com/
```

#### Exposing Ports

Running `npm start`, the frontend application spins up on `localhost:3000`.

**`Dockerfile`**

```Dockerfile
# Does not automatically publish the port on the host.
# Is only a form of documentation,
# to tell us that the container will listen on port 3000.
EXPOSE 3000
```

#### Setting the user

By default, Docker run the application using the root user. This may cause security issues. Hence, we should take precautions to prevent this.

**`Terminal`**

```Dockerfile
# Run alpine Linux in interactive mode
docker run -it alpine

# Add new group
addgroup app

# Add new system user in the app group with the username app.
# This is common best practice.
adduser -S -G app app

# Outputs the groups the the user "app" belongs to
groups app
```

**`Dockerfile`**

```Dockerfile
# Run all of the steps above in one line
RUN addgroup app && adduser -S -G app app

# Set the user on the machine
USER app
```

#### Defining Entrypoints

We want to use `ENTRYPOINT` when we know for sure that a given command should be executed when spinning up a container - there should be no exception.

**`Dockerfile`**

```Dockerfile
# Define the entrypoint to be run as an executable
ENTRYPOINT [ "npm", "start" ]
```

#### Speeding Up Builds

In order to understand how we can speed up builds in Docker, we must first understand layers in Docker. An image is a collection of layers. A layer can be thought of as the files modified after a given Docker instruction. As an example, running `FROM node:14.16.0-alpine3.13` adds certain files to the image, and that is one layer. Next, `RUN addgroup app && adduser -S -G app app` adds and edits new files, which are on another layer. This repeats for all instructions in the `Dockerfile`.

Layers of a Docker image can be inspected in the terminal.

**`Terminal`**

```shell
# Inspect history of this docker image
docker history react-app

...

=> RUN /bin/sh -c npm install # buildkit           175MB

=> RUN /bin/sh -c addgroup app && adduser -S -G…   4.84kB

...
```

As seen above, we can inspect what command added how much data to our machine.

Docker caches wherever possible. When a layer isn't changed between builds, Docker reuses the layer when building the image.

In order to run `npm install`, we only need `package-lock.json` and `package.json`. Thus, we can edit the `COPY` line in the `Dockerfile` as such:

**`Dockerfile`**

```Dockerfile
# Only copy package files
COPY package*.json .

# Install dependencies
RUN npm install

# Copy rest of files
COPY . .

...

# Result in terminal
=> CACHED [2/6] RUN addgroup app && adduser -S -G app app   0.0s
=> CACHED [3/6] WORKDIR /app                                0.0s
=> CACHED [4/6] COPY package*.json .                        0.0s
=> CACHED [5/6] RUN npm install                             0.0s
=> CACHED [6/6] COPY . .                                    0.0s

...
```

#### Removing images

**`Terminal`**

```shell
# Remove dangling images
docker image prune

# Remove stopped containers
docker container prune

# Remove image with image id.
# Can also use the name of the image.
# Can also add more IDs after the initial IMAGE_ID
# to remove several images.
docker image IMAGE_ID
```

#### Tagging images

**`Terminal`**

```shell
# Replace TAG with the desired tag
# May be version number or codenames
docker build -t react-app:TAG .

# Remove image with given tag
docker image remove react-app:TAG

# Give existing image a new tag
docker image tag IMAGE_ID react-app:TAG
```

#### Sharing Images

1. **Login** to [Docker Hub](https://hub.docker.com/)
2. Navigate to **Repositories**
3. Click **Create Repository**
4. Set **desired name, description and other settings**
5. Optionally, you can link Docker Hub to GitHub to **automatically build**
6. When you are happy with the settings, click **Create**
7. **Create** Docker image, **login** using terminal and **push** to Docker Hub using commands below

**`Terminal`**

```shell
# Create Docker image to be uploaded with
# given tag to Docker Hub
docker image tag IMAGE_ID magnusrodseth/react-app:TAG

# You have to provide username and password
docker login

# Push image with tag to Docker Hub
docker push magnusrodseth/react-app:TAG
```

Your image should now be available to pull on Docker Hub.

#### Saving and Loading Images

Let's say you have a Docker image that you want on another machine without going via Docker Hub.

**`Terminal`**

```shell
# Compress and zipped Docker image with specific tag
docker image save -o react-app.tar react-app:TAG

# Load Docker image from zipped file
docker image load -i react-app.tar
```

### Working with Containers 📦

#### Starting Containers

**`Terminal`**

```shell
# Run container in detached state
docker run -d react-app

# Run container in detached state with
# a custom, easy-to-read name
docker run -d --name custom-name-here react-app
```

#### Vieweing the Logs

**`Terminal`**

```shell
# Continuously output the log from the container
docker logs -f CONTAINER_ID

# Output the log from the container with timestamp
docker logs -t CONTAINER_ID
```

#### Publishing Ports

**`Terminal`**

```shell
# Run in detached state
# Publish on port 80 on the host (value before colon [:])
# from port 3000 on the container (value after colon [:])
# Set name "c1"
docker run -d -p 80:3000 --name c1 react-app

# Get overview of processes / running containers
docker ps

...

<IP_ADDRESS>:80 -> 3000/tcp

...
```

As seen in the output, the `localhost:80` is mapped to the container's port `3000`.

#### Executing Commands in Running Containers

Using `docker run`, we start a new container and run a command.

Using `docker exec`, we execute a command in a running container.

**`Terminal`**

```shell
# Assumes that c1 is a running container
# Outputs the files in current directory
docker exec c1 ls
```

#### Stopping and starting Containers

**`Terminal`**

```shell
# Stops the running container c1
docker stop c1

# Starts an existing container c1
docker start c1
```

Using `docker run`, we start a new container and run a command.

Using `docker start`, start an existing and previously stopped container.

#### Removing Containers

**`Terminal`**

```shell
# Removes an existing and stopped container
docker rm c1

# Forces container to stop and then removes it
docker rm -f c1

# Linux only
# Filters all Docker containers on the name provided
docker ps -a | grep c1

# Removes all stopped containers at once
docker container prune
```

#### Persisting Data using Volumes

A volume is a storage outside of containers. As an example, it can be located on the host or the cloud.

**`Dockerfile`**

```Dockerfile
# Create folder data using custom user
# This way, we ensure we have permission
RUN mkdir data
```

**`Terminal`**

```shell
# Creates new volume
docker volume create app-data

# Inspect an existing volume
docker volume inspect app-data

# Run in detatched
# Map ports
# Map app-data volume to a directory in the file system of the container
docker run -d -p 4000:3000 -v app-data:/app/data react-app
```

Volumes are the correct way to persist data in dockerized applications. Additionally, we can share volumes across containers.

#### Copying files between the Host and Containers

**`Terminal`**

```shell
# Copies an existing file from a container
# to the current working directory on the host
docker cp CONTAINER_ID:ABS_PATH_TO_FILE .

# Copies a local file on host machine to
# an absolute path in the container
docker cp secret.txt CONTAINER_ID:ABS_PATH
```

#### Sharing the Source Code with a Container

**`Terminal`**

```shell
# Start a container in detatched state
# Map ports
# Map the volume from current working directory to app
docker run -d -p 5001:3000 -v $(pwd):/app react-app
```

In practice, this lets you edit code base and see real-time changes in your Docker container.

### Running Multi-container Applications 🤝

#### What is Docker Compose?

Docker Compose is a tool built on top of the Docker engine. It makes it a lot easier to run multi-container applications.

Follow [this guide](https://docs.docker.com/compose/install/) to install Docker Compose.

To verify that you have Dcoker Compose installed, type `docker-compose --version` in your Terminal.

#### Cleaning up our Workspace

**`Terminal`**

```shell
# Outputs the image IDs of existing Docker images
docker image ls -q

# Force remove all the images outputted above
docker image rm -f $(docker image ls -q)

# Outputs the container IDs of existing Docker containers
docker container ls -a -q

# Force remove all the containers outputted above
docker container rm -f $(docker container ls -a -q)
```

Alternatively, you can use the following steps:

1. Click on the **Docker Desktop icon**
2. Go to **Preferences**
3. Click on the **Troubleshoot** button that looks like a bug
4. Click **Clean / Purge data**. Note that this will restart Docker engine.

#### Creating a Compose File

A Docker Compose file must be named `docker-compose.yml`. You can see a list of valid properties in Docker Compose [here](https://docs.docker.com/compose/compose-file/compose-file-v3/).

**`docker-compose.yml`**

```yaml
# Set the version of Docker Compose
version: "3.8"

services:
  frontend:
    # Tell Docker to look for Dockerfile in frontend
    # directory in current working directory
    build: ./frontend

    # Port mapping.
    # Because we can have multiple port mappings,
    # we use the list syntax in .yml
    ports:
      - 3000:3000
  backend:
    # Tell Docker to look for Dockerfile in backend
    # directory in current working directory
    build: ./backend

    ports:
      - 3001:3001

    # Set env variables
    environment:
      DB_URL: MONGO_DB_CONNECTION_STRING
  database:
    # Pull an existing Docker image
    image: mongo:4.0-xenial

    ports:
      - 27017:27017

    # Map custom volume VOLUME to a directory
    # /data/db is MongoDB's default storage folder
    volumes:
      - VOLUME:/data/db

# Define the custom volumes to be mapped later
# Note that this volume name corresponds with
# volumes in the database service
volumes:
  VOLUME:
```

#### Starting and stopping the Application

**`Terminal`**

```shell
# Start containers
docker-compose up

# Start containers in detached state
docker-compose up -d

# Outputs all running containers relevant to current app
docker-compose ps

# Stops and removes containers
# Images are still present
docker-compose down
```

#### Docker Networking

When we run our application with `docker-compose`, Docker Compose will automatically add a network, and then add our container to that network. This allows containers to talk to eachother.

**`Terminal`**

```shell
# Run containers in detached state
docker-compose up -d

# Outputs an overview of running Docker Networks
docker network ls
```

#### Viewing Logs

**`Terminal`**

```shell
# Outputs logs across all containers in aoo
docker-compose logs

# Outputs running containers
docker ps

# Follow the output of a given container
docker logs CONTAINER_ID -f
```

#### Migrating the Database

Oftentimes, we want our database to have a certain shape in a given release. This is called database migration.

This repository uses the `migrate-mongo` package for database migration.

**`backend/package.json`**

```json
 "scripts": {
    "db:up": "migrate-mongo up",
    "start": "nodemon --ignore './tests' index.js",
    "test": "jest --watchAll --colors"
  }
```

Thus, run `npm run db:up` to migrate database.

Because we need to wait for the database to be up and running in order to migrate it, we use a tool recommended by Docker called [`wait-for-it`](https://docs.docker.com/compose/startup-order/).

#### Running Tests

**`docker-compose.yml`**

```yaml
# Frontend tests in Dcoker
frontend-tests:
  # Use the newly built frontend image
  image: docker-course_frontend

  volumes:
    - ./frontend:/app

  # Override default command, and rather
  # run test
  command: npm test
```

### Deploying Applications ☁

#### Deployment Options

When deploying a dockerized application, we can either use single host deployment or cluster deployment.

**Single Host Deployment** is suitable for many cases, but may be lackluster in large-scale applications. Hence, Single Host Deployment will be used in this course.

**Cluster deployment** allow for high availability and scalability. There are different cluster solutions, where **Kubernetes** is the most popular solution.

#### Getting a Virtual Private Server

Some of the most popular VPS options include:

- DigitalOcean
- Google Cloud Platform (GCP)
- Microsoft Azure
- Amazon Web Services (AWS)

DigitalOcean is the simplest VPS. The further down the list we get, the more complex the VPS solution gets. **DigitalOcean** is the VPS solution used in this course.

#### Installing a Docker Machine

Follow [this](https://github.com/docker/machine/releases) **Installation Guide** on GitHub.

Verify that `docker-machine` is installed on your computer. by typing `docker-machine --version` in your terminal.

#### Provisioning a Host

Inspect available drivers using [this link](https://docs.docker.com/machine/drivers/). In this course, we will use [DigitalOcean](https://docs.docker.com/machine/drivers/digital-ocean/). Use the provided link to inspect commands options when creating the Docker Machine using the steps in the Terminal below.

Now, go to DigitalOcean Control Panel to acquire an access token, so that Docker Machine can talk to DigitalOcean. [Follow this documentation for DigitalCoean](https://docs.digitalocean.com/reference/api/create-personal-access-token/).

Execute the following in the Terminal.

**`Terminal`**

```shell
# Get DIGITAL_OCEAN_ACCESS_TOKEN from DigitalOcean cloud portal

# Install specific Docker version, because of
# unresolved problem with Docker Machine,
# as of December 2020: --engine-install-url

# DOCKER_MACHINE_NAME can be repository name
docker-machine create \
    --driver digitalocean \
    --digitalocean-access-token DIGITAL_OCEAN_ACCESS_TOKEN \
    --engine-install-url "https://releases.rancher.com/install-docker/19.03.9.sh" \
    DOCKER_MACHINE_NAME
```

By default the Docker Machine provisions with Ubuntu. Then, Docker is installed on the Docker Machine. You should now be able to see a new _Droplet_ on DigitalOcean cloud. A _Droplet_ is a fancy word for a server on DigitalOcean.

#### Connecting to the Host

To connect to the Docker Machine, we will use SSH in the Terminal. **The beauty of Docker Machine** is that it abstracts away the complexity of SSH from us, allowing for a swift a pain-free connection experience.

**`Terminal`**

```shell
# Outputs all existing Docker Machines
docker-machine ls

# Connects to given docker machine using its name
docker-machine ssh DOCKER_MACHINE_NAME
```

#### Defining the Production Configuration

We don't neccessarily want the exact same Compose file for development and production. Thus, we create `docker-compose.prod.yml` to define the Compose file used in production. `prod` can be interchanged with anything, be the following example follows convention.

**`docker-compose.prod.yml`**

```yaml
version: "3.8"

services:
  frontend:
    build: ./frontend

    # Map port 80 of the host to
    # port 3000 on the container
    ports:
      - 80:3000

    # Restarts container only if we manually # stop it
    restart: unless-stopped

    # Notice how there's no need for volumes in production

  backend:
    build: ./backend
    ports:
      - 3001:3001
    environment:
      DB_URL: mongodb://db/vidly
    command: ./docker-entrypoint.sh
    restart: unless-stopped

  db:
    image: mongo:4.0-xenial
    ports:
      - 27017:27017
    # vidly is the application name
    volumes:
      - vidly:/data/db
    restart: unless-stopped

volumes:
  # vidly is the application name
  vidly:
```

Read more about restart policy in Compose files [here](https://docs.docker.com/compose/compose-file/compose-file-v3/#restart).

#### Reducing Docker Image Size

Docker images can get unbelievably large, which is not suitable for production.

Running `npm run build` in `/frontend` creates optimized assets for production. All these assets are stored in the `/frontend/build` folder.

Now, we can make a separate `Dockerfile` suitable for production, because all we need to do is copy files in `/frontend/build`.

So, we create a `Dockerfile.prod` in `/frontend`.

**`Dockerfile.prod`**

```Dockerfile
# Step 1: Build stage
FROM node:14.16.0-alpine3.13 AS build-stage

WORKDIR /app
COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

# Step 2: Production stage
FROM nginx:1.12-alpine

RUN addgroup app && adduser -S -G app app

USER app

# Copy all files from build-stage to be use din production
COPY  --from=build-stage /app/build /usr/share/nginx/html

# Expose default port for web traffic
EXPOSE 80

ENTRYPOINT [ "nginx", "-g", "daemon off;" ]
```

Now, we can build an image for `/frontend` that is optimized for web using the terminal.

**`Terminal`**

```shell
# docker-course_web_opt describes how this images is
# optimized for web
docker build -t docker-course_web_opt -f Dockerfile.prod .

...

docker-course_web_opt   16.2MB
docker-course_frontend  300MB
docker-course_backend   184MB

...
```

Notice how the image built for web is only 16.2MB large.

In `docker-compose.prod.yml`, we need to change a few properties to fit our new `frontend/Dockerfile.prod`.

**`docker-compose.prod.yml`**

```yaml
---
frontend:
  # Set context to frontend directory
  # Specify Dockerfile
  build:
    context: ./frontend
    dockerfile: Dockerfile.prod

  # Map host port 80 to container port 80
  ports:
    - 80:80
  restart: unless-stopped
```

Now, we can run `docker-compose -f docker-compose.prod.yml build` in `/` directory.

#### Deploying the Application

**`Terminal`**

```shell
# Outputs overview of existing Docker Machines
docker-machine ls

# Outputs env variables for given Docker Machine
docker-machine env MACHINE_NAME

# Run this command to configure your shell:
eval $(docker-machine env MACHINE_NAME)

# The line above results in the following:
#   - Any commands typed in the terminal will be sent
#   to the MACHINE_NAME Docker Machine
#
#   - Thus, the Docker client in your terminal
#   will be talking to the Docker Machine on DigitalOcean

# Output overview of existing images on the remote Docker Machine
docker images

# Compose production build
docker-compose -f docker-compose.prod.yml up -d
```

If you encounter a **Permission denied** error when running `docker-compose -f docker-compose.prod.yml up -d` that looks a bit like the following:

**`Terminal Troubleshooting`**

```shell
npm WARN checkPermissions Missing write access to /app
npm WARN<EMAIL_ADDRESS>No description
npm WARN<EMAIL_ADDRESS>No repository field.

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /app
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/app'
npm ERR!  [Error: EACCES: permission denied, access '/app'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/app'
npm ERR! }
```

This may be because the `Dockerfile` does not respect the `app` user when executing `WORKDIR /app`. This issue should be resolved in the latest version of Docker, as long as Docker uses build-kit. _If the output from Docker commands is colorized, this should not be a problem_. However, we are currently using an older version of Docker on this particular VPS (DigitalOcean).

To fix this issue, we edit the `backend/Dockerfile` as follows:

**`backend/Dockerfile`**

```Dockerfile
FROM node:14.16.0-alpine3.13

RUN addgroup app && adduser -S -G app app

# Create /app directory
# Set the current owner of this dir
# to be the app user
RUN mkdir /app && chown app:app /app

USER app

WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .

EXPOSE 3000

CMD ["npm", "start"]
```

repository: magnusrodseth/docker-course

repo_name: magnusrodseth/docker-course


text:
# Lunch and learn slides and content

### Presentations with markup
- Presentations with [marp](https://htmlpreview.github.io/?https://github.com/vinay-koho/lunch-n-learn/blob/master/1-presentations-with-markups/marp.html)
- Presentations with [hovercraft](https://htmlpreview.github.io/?https://github.com/vinay-koho/lunch-n-learn/blob/master/1-presentations-with-markups/demo/index.html)

### Go concurrency
- Part 1: [Go Routines and channels](https://htmlpreview.github.io/?https://github.com/vinay-koho/lunch-n-learn/blob/master/2-go-concurrency-1/concurrency-part-1.html)
- Part 2: [Channels](https://htmlpreview.github.io/?https://github.com/vinay-koho/lunch-n-learn/blob/master/3-go-concurrency-2/demo/index.html)

repository: vinay-koho/lunch-n-learn

repo_name: vinay-koho/lunch-n-learn


text:
# Bijection #

### 0.8.0
* add twitter util Buf <-> Array[Byte] bijection https://github.com/twitter/bijection/pull/208
* upgrade testing libraries https://github.com/twitter/bijection/pull/207
* Add implicit conversion for GZippedBase64String to String https://github.com/twitter/bijection/pull/203
* Make property tests work again https://github.com/twitter/bijection/pull/198
* Add a module for finagle-mysql bijections. https://github.com/twitter/bijection/pull/197
* Build bijection-scrooge for scala 2.11 https://github.com/twitter/bijection/pull/196

### 0.7.2
* FIX: gzip Bijection resource leak. https://github.com/twitter/bijection/pull/193
* Use new Travis CI infrastructure https://github.com/twitter/bijection/pull/191

### 0.7.1
* Remove some package privacy so these things can be used in scalding and ...: https://github.com/twitter/bijection/pull/190
* Add macros to create Trys: https://github.com/twitter/bijection/pull/187
* Refactor macros: https://github.com/twitter/bijection/pull/186
* Add TypeclassBijection: https://github.com/twitter/bijection/pull/183
* Generate some useful case class conversions with macros: https://github.com/twitter/bijection/pull/179

### 0.7.0
* Added thrift json injections: https://github.com/twitter/bijection/pull/172
* Make almost all the case classes extend AnyVal: https://github.com/twitter/bijection/pull/178
* Fix ImplicitBijection issue: https://github.com/twitter/bijection/pull/177
* Update jackson-mapper-asl to version 1.9.2: https://github.com/twitter/bijection/pull/155
* Moves to 2.10.x as the default and to scalatest: https://github.com/twitter/bijection/pull/176
* Fix some bugs in ModDivInjections: https://github.com/twitter/bijection/pull/175
* Add compression support to bijection-avro: https://github.com/twitter/bijection/pull/174
* Injections from jodatime LocalDate / LocalTime / YearMonth / MonthDay to String: https://github.com/twitter/bijection/pull/171

### 0.6.3
* Sbt => 0.13, use scalariform: https://github.com/twitter/bijection/pull/170
* Backtick Array[Byte] in README: https://github.com/twitter/bijection/pull/168
* Update README to include bijection-avro: https://github.com/twitter/bijection/pull/167
* Update build publishTo to be consistent with scalding: https://github.com/twitter/bijection/pull/165
* Pin bijection-guava to jsr305 1.3.9.: https://github.com/twitter/bijection/pull/164

### 0.6.2
* Added json4s to project aggregate: https://github.com/twitter/bijection/pull/161

### 0.6.1
* Add the sbt version helper script: https://github.com/twitter/bijection/pull/160
* Added Json4s Injections: https://github.com/twitter/bijection/pull/157
* Added url encoded String Inection: https://github.com/twitter/bijection/pull/156
* Added bytes2bytesWritable bijection: https://github.com/twitter/bijection/pull/154
* Update README.md: https://github.com/twitter/bijection/pull/153

### 0.6.0
* Update Avro: https://github.com/twitter/bijection/pull/147/files
* Fix a thread-safety bug with collection Bufferables: https://github.com/twitter/bijection/pull/150
* Add Boolean support for Bufferable: https://github.com/twitter/bijection/pull/151

### 0.5.4

* Fix Scrooge Import for Scala 2.10: https://github.com/twitter/bijection/pull/145
* Add Community Section to README: https://github.com/twitter/bijection/pull/143
* Added Hbase Injections: https://github.com/twitter/bijection/pull/144

### 0.5.3

* SBT CodeGen: https://github.com/twitter/bijection/pull/128
* Remove redundant Attempt (in favor of scala.util.Try) https://github.com/twitter/bijection/pull/133
* Adds bijection-avro: https://github.com/twitter/bijection/pull/129
* Adds bijection-hbase: https://github.com/twitter/bijection/pull/135
* Injection from Bijection with Rep tag: https://github.com/twitter/bijection/pull/138
* Move bijection-algebird to algebird: https://github.com/twitter/bijection/pull/139
* Adds bijection-jodatime: https://github.com/twitter/bijection/pull/136
* Replace scrooge-runtime with scrooge-serializer: https://github.com/twitter/bijection/pull/141

### 0.5.2

* Remove withSources

### 0.5.1

* Lets bijection-util be distributed
* Correct README

### 0.5.0

* Make Bijection/Injection not extend Function
* Add support for scala Futures & Try
* Either injections
* Add java Base64 from Apache commons

### 0.4.1

* Added `Codec[T]` alias for serialization injections.

### 0.4.0

* `bijection-netty` for async functionality. These help with Finagle stores.
* JavaSerializationInjection
* ModDivInjection
* fix CastInjection
* JsonInjection

### 0.3.0

* Added `Injection` typeclass
* Autogenerated Tuple* -> List injections
* Removed all unsafe Bijections

### 0.2.1

* `bijection-guava` for Guava interop.
* `bijection-algebird` for bijections on classes in twitter's [Algebird](https://github.com/twitter/algebird).
* `bijection-guava` for Guava interop, with
  * Function1 <-> Guava Function
  * () => T <-> Supplier[T]
  * Function[T, Boolean] <-> Predicate[T]
  * Optional[T] <-> Option[T]
* `bijection-util` with bijections on [twitter-util](https://github.com/twitter/util)'s "Try" and "Future".

### 0.2.0

* `bijection-scrooge` for scrooge generated scala thrift code
* Add tagged types, resolved Bijection debate
* Implicit bijection between `List[T]`, `List[U]`
* Implicit bijection between `Vector[T]`, `Vector[U]`
* Implicit bijection between `Set[T]`, `Set[U]`
* Implicit bijection between `Map[K1, V1]`, `Map[K2, V2]`

### 0.1.3

* remove `Bijection.build` uses, as these screw up serialization via Kryo.

### 0.1.2

* Removes simple-json
* Adds more sophisticated JSON codecs
* Removes `withSources()` from dependencies

### 0.1.1

* `bijection-json`
* `bijection-protobuf`
* `TEnumCodec` for conversion of `TEnum` -> `Int`
* Change `biject` method in `Bijection` object to `asMethod` for clarity
* Adds default `unwrap` bijections to value case classes
* Adds `Bijection.getOrElse` for conversions between `Option[A]` and `A`
* Fix bug in `toContainer`, add tests
* `Bufferable`
* `StringBijection.viaContainer`

### 0.1.0

* Adds Bijection trait with implicits between:
  * all numeric types <-> their boxed java counterparts
  * all numeric types <-> big-endian `Array[Byte]` encodings
  * all numeric types <-> String
  * Bijections for all `asScala`, `asJava` pairs provided by    [scala.collection.JavaConverters](http://www.scala-lang.org/api/current/scala/collection/JavaConverters$.html)
  * String <-> utf8 encoded bytes
  * `Array[Byte]` <-> `GZippedBytes`
  * `Array[Byte]` <-> `Base64String`
  * `Array[Byte]` <-> `GZippedBase64String`
  * `Array[Byte]` <-> `java.nio.ByteBuffer`
  * `Class[T]` <-> String
  * `A => B` <-> `C => D` (function conversion)
  * Bijection builders for all tuples. (`(String,Int)` <-> `(Array[Byte], java.lang.Integer)` is built automatically, for example.)
* Value classes for `Base64String`, `GZippedBase64String`, and `GZippedBytes`
* `as` casting conversion.
* `Pivot` trait for packing schemes
* `BijectionImpl` for easy java implementation
* Adds ThriftCodecs and `bijection-thrift`

repository: kyleprier/bijection

branch_name: refs/heads/develop

gha_language: Scala

repo_name: kyleprier/bijection


text:
---
layout: post
title:  "ES6 Generators in Express"
date:   2015-01-19 11:14:35
categories: javascript node.js
---

There has been a lot of news about Javascript lately. The release of [iojs][iojs] `1.0.1`
and new ES6 features popping in the latest version of Chrome, its a very exciting time
to be a Javascript developer. However the feature I am most interested in would be ES6 [Generator Functions][generators].

[Generator functions][generators] have the ability pause execution of the function using the `yield` statement.
That on its own might not seem very useful, but when combined with [Promises][promise] and a library like [co][co].
We can write asynchronous code that looks and somewhat behaves synchronous:

{% highlight javascript %}
app.get('/', function* (req, res) {
  var file = yield readFile('./file.txt');
  var file2 = yield readFile('./file2.txt');

  res.send([file, file2]);
});
{% endhighlight %}

Now this example above is actually an [express][express] `route` using a generator function
to handle the request. This feature is not available in [express][express] `4.11.0`, but I added support
for generator functions to a [fork][fork] of the project with this [commit][commit]. That said, [koa][koa] is a web framework built
from the ground up using generator functions but there a lot of existing projects using express
and rewritten them in [koa][koa] just to use generators is too much.

Let me briefly explain the example, `readFile` is going to take the path to a file and return a promise.
That promise will resolve or reject when the file has been read from disk. While we wait on the promise
the execution of the function will pause, not the event loop. When the promise is resolved the content
of the file will be stored in the `file` variable and `readFile` will be called again this time for `file2.txt`.
After `file2.txt`'s promise is resolved, `res.send` will complete the request send an array of file contents. For
more information on how this works visit [here][promise-gen].

I dont know about you, but that is very cool. No [callback hell][cb-hell] just clean code thats very easy to reason about.

The code for `readFile` looks like this:

{% highlight javascript %}
function readFile(path) {
  return new Promise(function(resolve, reject) {
    fs.readFile(path, function (err, data) {
      if (err) reject(err);
      else resolve(data.toString());
    });
  });
}
{% endhighlight %}

Just so you can appreciate how much nicer using generator functions and promises are, this is what the code
would look like without them:

{% highlight javascript %}
app.get('/', function (req, res) {
  fs.readFile('./file.txt', function (err, file1) {
    fs.readFile('./file2.txt', function (err, file2) {
      res.send([file.toString(), file2.toString()]);
    });
  });
});
{% endhighlight %}

It might not look so bad now, but just imagine if there were another 2 files. Yikes!

##Conclusion

I'm very excited about ES6 in general and glad [iojs][iojs] is allowing developers to use these features today.
Also if you like to see Generator Functions support baked into express, they have started a [release `5.0`][release]
pull request so you can politely ask.

[iojs]:        https://iojs.org/
[express]:     http://expressjs.com/
[koa]:         http://koajs.com/
[generators]:  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
[co]:          https://github.com/tj/co
[fork]:        https://github.com/kenrick/express
[commit]:      https://github.com/kenrick/express/commit/8dac72bc9b11a71ed52a54bf35768d2ead912238
[promise]:     https://www.promisejs.org
[promise-gen]: https://www.promisejs.org/generators/
[cb-hell]:     http://callbackhell.com/
[release]:     https://github.com/strongloop/express/pull/2237


text:
---
title: "[Software, c++] Separate compilation of templates: Template separation and export"
date: "2005-05-08"
---

A recent cause of inexplicable flummoxing and gnashing of teeth was a piece of code like the one below. Look at 1.cpp - pretty straightforward. An instance 'i1' is instantiated. A function 'myfunc' is called, which returns a pointer to an object. 'SSS1' and 'dummy' are declared in 11.h. Now the templatized function is declared in '13.h' and defined in '13.cpp'. Pretty simple, huh? I agree, there is no problem when compiling this piece of code like this:

> g++ 1.cpp 13.cpp -I.

But now consider what would happen if I compile them as:

> g++ -c 1.cpp -I. g++ -c 13.cpp -I. g++ 1.o 13.o

In this case, the linker, cribs about not finding dummy\* myfunc(SSS1<dummy>& a); This happens because (as I found out recently) a [long standing argument](http://www.corfield.org/index.cfm?event=cplusplus.section&section=ptexp) in the c++ community on how to separate template definition and declaration. Currently, only one compiler - Comeau C++- provides some sort of proprietary support for separation (via the 'export' keyword). As of GCC-3.4.2, this is not implemented. The problem occurs because, the compiler/linker uses some sort of optimisation techniques to remove multiple includes of templates and template definition code. when 13.cpp was compiled separately, it threw out basically the whole code, because those templates were not being used. Therefore, at link time, the linker is unable to instantiate the templates used in the function "myfunc" . The hack (sic) that is appearing to be working is to define the usage in 13.cpp itself.

> //dummy\* myfunc(SSS1<dummy>& a);
> //template <> dummy\* myfunc(SSS1<dummy>& a);
> template dummy\* myfunc(SSS1<dummy>& a);

Notice the addition of the "template" keyword before the definition (the commented line is what did'nt work). Somehow it is important to provide that keyword. Even "template <> " doesn't work. 1.cpp

#include <iostream>
#include "11.h"
#include "13.h"

main(){
  SSS1<dummy> i1;
  dummy\* d=myfunc(i1);
}

11.h

template <class T>
class SSS1{
 private:
 public:
   T\* member;
     SSS1(){
     member \= new T;
     };
};

class dummy{
};

13.h

template<class T>
T\* myfunc(SSS1<T>& obj);
/\*{
  return obj.member;
}\*/

13.cpp

#include "11.h"
#include "12.h"
#include "13.h"
template<class T>
T\* myfunc(SSS1<T>& obj)
{
  return obj.member;
}

del.icio.us Tags: [c++](http://del.icio.us/sss8ue/c++) [g++](http://del.icio.us/sss8ue/g++) [compiler](http://del.icio.us/sss8ue/compiler)

repository: SyedMuhammedBilal/Gatsby-Blog-WebApp

repo_name: SyedMuhammedBilal/Gatsby-Blog-WebApp


text:
# response-time
![Github Action Status](https://github.com/JohannLai/response-time/workflows/build/badge.svg)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![GitHub license](https://img.shields.io/github/license/JohannLai/response-time)](https://github.com/JohannLai/response-time/blob/master/LICENSE)
[![tag](https://img.shields.io/badge/deno->=1.1.3-green.svg)](https://github.com/denoland/deno)
[![tag](https://img.shields.io/badge/std-0.59.0-green.svg)](https://github.com/denoland/deno)

`x-response-time` for deno middleware framework serve.

## Usage

Basic usage

```ts
import { App } from "https://deno.land/x/doa/mod.ts";
import { responseTime } from "https://deno.land/x/response-time/mod.ts";

app.use(responseTime());
app.use(async ctx => {
  ctx.status = 200;
  ctx.body = "Hello World";
});

app.listen({ port: 8000 });
```

If you need response high resolution in nano time, set `hrtime` option to true, but you `must` set `--allow-hrtime` flag when you run your deno app:
```ts
app.use(responseTime({ hrtime: true }));
```

Sample response header with `hrtime = false (default)`:
```
x-response-Time: 2ms
```

Sample response header with hrtime = true:

```
x-response-time: 2.0621600000004037ms
```
## Note

Best to `.use()` at the top before any other middleware, to wrap all subsequent middleware.

## License

[MIT](https://github.com/JohannLai/response-time/blob/master/LICENSE)

repository: JohannLai/response-time

gha_language: TypeScript

repo_name: JohannLai/response-time


text:
# geemap-apps

## Introduction

This repo demostrates how to build a multi-page [Earth Engine](https://earthengine.google.com) App using [streamlit](https://streamlit.io) and [geemap](https://geemap.org). You can deploy the app on various cloud platforms, such as [share.streamlit.io](https://share.streamlit.io) or [Heroku](https://heroku.com). Make sure you set `EARTHENGINE_TOKEN='your-token'` as an environment variable (secret) on the cloud platform.

- **Web App:** <https://gishub.org/geemap-apps>
- **Github:** <https://github.com/giswqs/geemap-apps>

### Where to find your Earth Engine token?

- **Windows:** `C:/Users/USERNAME/.config/earthengine/credentials`
- **Linux:** `/home/USERNAME/.config/earthengine/credentials`
- **macOS:** `/Users/USERNAME/.config/earthengine/credentials`

## Credits

This app is created using the template from [upraneelnihar/streamlit-multiapps](https://github.com/upraneelnihar/streamlit-multiapps).

repository: nadia-el/geemap-apps

repo_name: nadia-el/geemap-apps


text:
# Configuration

Change **BASE** constant from *php/classes/constants.php* or *ruby/lib/constants.rb* to fit your files location.

**NOTE**: if using Ruby on Rails, BASE is set to RAILS_ROOT

You have to change *config/tpv.yml* with your basic configuration.

##Available options

*config/tpv.yml* file accepts the following options:

**NOTE**: options on tpv.yml accepts language and currency constants(ex: currency: 'CURRENCY_USD')

###Mandatory

* merchant_code
* key

###Optional

* *Property*       -> *Default value*
* currency         ->  CURRENCY_EUR
* terminal         ->  1
* transaction_type ->  0(Authorization)
* language         ->  LANG_CATALAN
* notification_url ->  ''
* KO_url           ->  ''
* OK_url           ->  ''
* merchant_name    ->  ''

###Available constants

####Currency constants

* CURRENCY_EUR -> Euro
* CURRENCY_USD -> Dolar US
* CURRENCY_GBP -> British Pound
* CURRENCY_YEN -> Japanese Yen

####Language constants

* LANG_CASTILIAN
* LANG_ENGLISH
* LANG_CATALAN
* LANG_FRENCH
* LANG_GERMAN
* LANG_DUTCH
* LANG_ITALIAN
* LANG_SWEDISH
* LANG_PORTUGUESE
* LANG_POLISH
* LANG_GALICIAN
* LANG_BASQUE

#Using notification_url

To use this option you must activate **HTTP Form** notification on your sermepa control panel.

Add **notification_url** to *config/tpv.yml*

#PHP
    development:
      ...
      notification_url: 'http://mywebsite.com/payment_notification.php'

    production:
      ...
      notification_url: 'http://mywebsite.com/payment_notification.php'

*payment_notification.php* file has only few lines on how to implement it and what functions might be useful.

#Ruby sinatra

    development:
      ...
      notification_url: 'http://elmeullocweb.com/response'

    production:
      ...
      notification_url: 'http://elmeullocweb.com/response'

Just like php example, but in sample.rb on the "post '/response' do" there's an explanation on how to implement automatic payment verification.

#Setting your TPV to production mode

##PHP

If you want to set your tpv app to production uncomment **define('MODE','production');** at the beginning of *prova.php* and *payment_notification.php*.
    <?
    //define('MODE','production');
    include('classes/payment.php');
    ...
    ?>

##Ruby

When running in Rails it will take RAILS_ENV constant. Otherwise TPV_MODE = 'production' must be set before loading *payment.rb*.

# Executing tests

##PHP
*Simpletest* library 1.0.1 is needed for php version. It can be downloaded from [SimpleTest Website](http://simpletest.org)

Unpack simpletest into **/tests** folder and then execute */tests/payment_test.php* from your webbrowser

##Ruby

Just run payment_test.rb from textmate(**cmd+R**) or run manually "**ruby payment_test.rb**"


text:
## Before you open an issue:

**Please check if a similar issue already exists or has been closed before.**

### When reporting a bug, please be sure to include the following:

- A descriptive title
- An isolated way to reproduce the behavior (example: GitHub repository with code isolated to the issue that anyone can clone to observe the problem)
- What version of this software you're using, and the platform(s) you're running it on
- The behavior you expect to see, and the actual behavior

### When requesting a new feature, please add as much detail as possible:

- A descriptive title
- A description of the problem you're trying to solve, including why you think this is a problem
- An overview of the suggested solution
- If the feature changes current behavior, reasons why your solution is better
- If applicable, a possible implementation path

repository: programadorthi/magic-modules

repo_name: programadorthi/magic-modules


text:
![MongoDB](../images/header.png "MongoDB")
# Getting MEAN
## An Introduction to API-Centered Application Development with Node.js and MongoDB
## Quest 8: Mongoose - Object Data Modeling

Great work getting here!  And Leafie can access and add to his NYC deli database.
That's super exciting!

Let's take our API even further. With the basic knowledge of routes and how to connect to MongoDB in Node.js, we'll look
a bit at setting up an application following the Model-View-Controller (MVC) design pattern. Well, we don't have much a
*view* necessarily, but let's tackle models and controllers. Let's start a new project in a `mongoose_app` directory.

Recall that starting a new Node.js project can be done with:

```
npm init
```
We can copy the dependencies from the `package.json` in our original project into this one to save some time.
Another extremely common tool when working with a Node.js, Express, and MongoDB project is to use
the Mongoose ORM package.

```
npm install --save mongoose
```

Let's start with our model inside a `models` subfolder. Mongoose allows us to define a schema to follow.

```javascript {.line-numbers}
const mongoose = require('mongoose');

const deliSchema = mongoose.Schema({
    name: String,
    rest_id: Number,
    street: String,
    district: String,
    city: String,
    state: String,
    postal_code: Number,
    specialty: String

}, {collection: 'delis'});

module.exports = mongoose.model('Deli', deliSchema);
```

## Weapons, Tools and Resources

[Mongoose](http://mongoosejs.com/) ORM

## Concepts

## Helpful Hints

## You are Here - Quests
|  | Quest | Description |
|--|-------|-------------|
|  |[Quest Zero](./quest0.md) | First quest to read.  Provides some overview information and background. |
|  |[Quest 1](./quest1.md) | Initialize your project and install some of the required software. |
|  |[Quest 2 ](./quest2.md) | creating a quick test JavaScript. |
|  |[Quest 3 ](./quest3.md) | Crafting your own tools: Building a server process using `httpd` and `express` |
|  |[Quest 4 ](./quest4.md) | Building Your App |
|  |[Quest 5](./quest5.md) | Defining the data for our application |
|  |[Quest 6](./quest6.md) | Enter MongoDB - Native JavaScript  |
|  |[Quest 7](./quest7.md) | Creating and Reading data using the Native MongoDB Driver |
| > | Quest 8 | Mongoose - Object Data Modeling |
| | [Quest 9](./quest9.md) | Creating and Reading data using Mongoose  |

## Next Quest

Next quest: [Quest 9 - Creating and Reading data using Mongoose](./quest9.md)

license: ISC


text:
---
date: "2012-02-15 14:40:00 UTC"
published: true
title: "Forcing Facebook to Update Your Site's Metadata"
authors:
  - "Alan Thomas"
tags:
  - Innovation

---

Recently we launched a new site for one of our customers:

http://www.thiswaytoamazing.com/

Up until the launch date we had been re-directing the URL to a different site. The only problem was that the page had a 'like' button on it, and when people clicked 'like' on the newly launched site, the post came up in Facebook with the correct URL but all the wrong metadata - i.e. the metadata there was from the site we had redirected to. This had happened as Facebook had scraped the site and stored the metadata it had found when the redirect was in place and Facebook only checks back periodically to see if the metadata has changed.

The customer was obviously complaining that their Facebook posts were wrong!

What do we do? Shrug our shoulders and say it's a Facebook thing? Ignore the customer's calls until Facebook bothers to scrape the site, crossing our fingers that it won't be long?

No, here's the solution: you can use the Facebook Linter to force the page to be scraped again, by cURLing it:

curl https://developers.facebook.com/tools/lint/?url={YOUR_URL}&format=json

Give Facebook a couple of minutes to do it's stuff and bingo, happy customer, problem solved.

Could be quite handy if you ever come across this situation or refresh a site in any way that will change the metadata.

branch_name: refs/heads/production

gha_language: HTML


text:
# blockchain.rb

a simple introduction to Blockchain algorithm.

## usage

```ruby
blockchain = Blockchain::Chain.new

blockchain.transaction(Blockchain::Transaction.new "ruby", "php", 10)
blockchain.transaction(Blockchain::Transaction.new "crystal", "ruby", 20)

new_block = blockchain.mine "new_miner_address"

puts new_block
puts new_block.transactions
puts blockchain
puts blockchain.blocks
```

## Contributing

1. Fork it (<https://github.com/izniburak/blockchain.rb/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## Contributors

- [izniburak](https://github.com/izniburak) İzni Burak Demirtaş - creator, maintainer


text:
# WeatherApp

Weather App is a platform where user can know the weather of any certain location just a search away.
This is a test app which i created during learning.

## Installation

Use the package manager [npm](https://www.npmjs.com/) to install foobar.

```bash
npm install
```

## Usage

```node
npm run start
```

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

repository: ghost-tt/weatherApp

repo_name: ghost-tt/weatherApp


text:
---
name: 🔣 Icon
about: Issues for filing a new Icon
labels: 'comp: icons'
---

<!--
Before filling this bug, have you used the issue search functionality?
Please provide a clear and concise description of what the issue is.
-->

## Link the LEXI Jira Issue.

## Attach the SVG.

repository: liferay/clay

gha_license_id: NOASSERTION

repo_name: liferay/clay


text:
# Open source public api for email verification

[![license](https://img.shields.io/github/license/technikhil314/verify-email)](https://github.com/technikhil314/verify-email/blob/main/LICENSE)

[![stargazers](https://img.shields.io/github/stars/technikhil314/verify-email?style=social)](https://github.com/technikhil314/verify-email/stargazers)
[![number of forks](https://img.shields.io/github/forks/technikhil314/verify-email?style=social)](https://github.com/technikhil314/verify-email/fork)
[![Follow technikhil314 on twitter](https://img.shields.io/twitter/follow/technikhil314?label=Follow)](https://www.twitter.com/technikhil314)

###### 👏 & ❤ to [auto badger](https://github.com/technikhil314/auto-badger) for making badging simple

## An open rest api to verify an emaiid

Email verification generally constitutes of three parts and api should tell if the emailid is provided by any

1. disposable email service like mailinator.com etc
2. public email service like gmail.com,yahoo.co.in,outlook.com etc
3. private organization like microsoft.com,google.com

## How to use this api

### Call the api with emailid

```bash
curl<EMAIL_ADDRESS>```

### Sample response

```json
{
  "disposable": false,
  "public": true,
  "private": false
}
```

## LICENSE

MIT


text:
## Introduction

zmp3 is a CLI tool helps you download highest quality of music and video on https://mp3.zing.vn for free

Tutorial for development this CLI at: https://medium.com/@ducmeit/make-a-great-downloader-cli-by-cobra-viper-promptui-at-golang-f6408434cafa

## Usages

- Installing: `go install github.com/ducmeit1/zmp3`
- Downloading at: `https://github.com/ducmeit1/zmp3/releases`

## Pictures

- Progress bar when downloading

- Result after downloaded complete


text:
# My Portfolio 2.0

My updated portfolio showcasing the skills that I've acquired thus far in my education.

# Screenshots

 ![](./assets/images/portfolio2.png)
 ![](./assets/images/portfolio3.png)

# Deployed Application

* [Portfolio](https://ricapi96.github.io/portfolio-updated/)

# Resources and Contributers

## License
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

                                        💙 Made by Erica Roquemore 💙


text:
# KeyVault

Creates a key vault with App Service access

## Paramaters

keyVaultName: (required) string

Name of key vault. Will be created in the same resource group as the script is run and in the default location for resource group.

repository: rivoric/armtemplates

repo_name: rivoric/armtemplates


text:
# ReactNative (expo) Android Window10
This is a simple project to test reactnative on your android mobile with windows 10.

### Configure your phone
First download `Expo, Expo Project` on Google Play Store.
Then set developper mode on your phone:
`Settings -> System -> About Phone -> Clic several times on "Build Number"`
Then Enable these options:
`Settings -> System -> Developper Options -> Enable USB Debogage and, if you can, enable ADB Charger Mode Only`

### Install adb to show the result on your Android Phone
We need to install adb, configure our phone and run adb.
Full installation tutorial :
`https://www.xda-developers.com/install-adb-windows-macos-linux/`
Dowload adb link :
`https://dl.google.com/android/repository/platform-tools-latest-darwin.zip`

To run adb with cmd:
```sh
cd C:\adb\platform-tools
adb.exe
```
Then you can start or kill the server:
```sh
adb start-server
```
```sh
adb kill-server
```
You can also verify that your phone is correctly recognised  with:
```sh
adb devices
```
When you `adb start-server` or `adb devices`, your phone may prompt you to authorize some stuff, clic Yes.
### To create the same project...
Download and install Node.js : `https://nodejs.org/`.
We need expo-cli to create a boilerplate, build your app and show the result on your android phone:
```sh
npm install -g expo-cli
```
To create a boilerplate project:
```sh
expo init ProjectName
```

### To run this project...
```sh
cd ProjectName
npm i
expo start
```
or
```sh
cd ProjectName
npm i
npm start
```

A webpage will open...
On the left pannel, choose `Local` connection and clic on `Run on Android device/emulator`.
The app `Expo` on your phone should open itself.
To show the result on your phone simply modify the App.js file.

Author: Marc Leonetti aka Bligoubloups & Sven Mathieu aka Daplex.
Date: 05/04/2019
License: MIT


text:
## Applying for PhD for the fall 2021.
## [Curriculum Vitae](assets/pdfs/Vineetha_phd_resume.pdf)
## [Research Statement](assets/pdfs/Vineetha_Sop.pdf)

## Research Summary

I am broadly interested in working on research problems in hardware/software interface, operating systems and programming languages. My current research focuses on building power and performance effecient datacenter infrastructure.Listed below are some of the projects I undertook while at Pennsylvania State University.

*   **ConfigNVPSim** is a cycle-accurate multicore simulator-based out of gem5 simulation framework. ConfigNVPSim
simulates a non-volatile processor environment powered by a renewable source of energy. The progress of the application running on ConfigNVPSim is throttled by the energy level harnessed by the system.

*   **PowerPrep** analyses the CPU behaviour of latency-critical datacenter workloads when deep sleep states are enabled.PowerPrep evaluates different scenarios under which enabling a deep sleep state violates SLO and proposes how emerging technologies  can be leveraged to achieve energy proportionality in datacenter.

*   **Fluid** computing framework utilizes language and runtime extensions that allow expressions
    in source codes within which dataflow dependencies can be relaxed. Identified the set of workloads which are amenable for approximation and has an improved execution time when running on the framework.

---

## Brief Bio

I am a Masters Student of Computer Science and Engineering Department at the Pennsylvania State University.
I am fortunate to be co-advised by Prof. Vijaykrishnan Narayanan,
Prof. Mahmut Kandameir and
Prof. Jack Sampson. Prior to that I was working as a senior hardware engineer at Samsung Semiconductors India as a part of the Non Volatile Memory express(NVMe) design and verification team from 2016-2018.I had a brief tenure at Freescale Semiconductors India from 2015-2016 where I worked as a SoC verification engineer. I obtained my undergraduate degree from National Institute of Technology Trichy, India, wwith a major in Electronics and Communication Engineering.

## Publications
### (Under Submission)

1.  PowerPrep: A power management proposal for user-facing datacenter workloads

 **Vineetha Govindaraj**, Sumitha George, Mahmut Taylan Kandemir,
    Jack Sampson, Vijaykrishnan Narayanan

    _(Emailed upon request)_
2.  Fluid: A Framework for Approximate Concurrency via Controlled Dependency Relaxation

Huaipan Jiang, Haibo Zhang, Xulong Tang, **Vineetha Govindaraj**, Jack Sampson, Mahmut Taylan Kandemir, Danfeng Zhang

    _(Emailed upon request)_

### (White Papers)

3.  ConfigNVPSim: GEM5 Based Configurable NVP [[pdf]](assets/pdfs/nvpSim.pdf)

    Gulsum Gudukbay, Sethu Jose, **Vineetha Govindaraj**
    _(Equal Contribution)_

## References
#### _on Request_

1.  [Dr. Vijaykrishnan Narayanan](https://vijay565.wixsite.com/vijay)

Distinguished Professor

Computer Science and Engineering

vxn9 [at] psu [dot] edu

(814) 863-0392

2.  [Dr. Mahmut Taylan Kandemir](http://www.cse.psu.edu/hpcl/kandemir/)

Professor

Computer Science and Engineering

mtk2 [at] psu [dot] edu

(814) 863-4888

3. [Dr. John (Jack) Sampson](http://www.cse.psu.edu/~jms1257/)

Assistant Professor

Computer Science and Engineering

sampson [at] cse [dot] psu [dot] edu

(814) 865-7496

4. [Dr. Kaushik Vaithiyanathan](https://www.linkedin.com/in/kaushik-vaidyanathan-25925624/)

Hardware Engineer

Google

knv [at] google [dot] com

5. [Dr. Lavanya Subramanian](https://www.linkedin.com/in/lavanya-subramanian-0098338/`)

Silicon Performance Architect

Facebook

lavanyas [at] fb [dot] com


text:
[![Bluelake](/data/bl2.png)](https://github.com/lancelee82/bluelake)

# Bluelake: Pygame Based Framework and Games.

## Starfish: Bluelake's pygame engine.

See pygmtmp.py to begin a new game.

## Games

## With OpenAI Gym

In order to work with OpenAI Gym to learn Deep Reinforcement Learning,
you should also look at [bluegym](https://github.com/lancelee82/bluegym), it contains some wrappers,
and i just want to keep Bluelake clean.

repository: zhuchiheng/rockrose

repo_name: zhuchiheng/rockrose


text:
+++
# Display name
name = "敖小剑"

# Is this the primary user of the site?
superuser = true

# Role/position
role = "中年码农"

# Organizations/Affiliations
#   Separate multiple entries with a comma, using the form: `[ {name="Org1", url=""}, {name="Org2", url=""} ]`.
organizations = [ { name = "Dreamfly.io", url = "https://dreamfly.io" } ]

# Short bio (displayed in user profile at end of posts)
bio = "我目前研究的方向主要在Microservice、Servicemesh、Serverless等和Cloud Native相关的领域，欢迎交流和指导"

# Enter email to display Gravatar (if Gravatar enabled in Config)
email =<EMAIL_ADDRESS>
# List (academic) interests or hobbies
interests = [
    "微服务/Micro Service",
    "服务网格/Service Mesh",
    "无服务器架构/Serverless",
    "云原生/Cloud Native"
]

# List qualifications (such as academic degrees)
#[[education.courses]]
#  course = "机械设计及其自动化"
#  institution = "大连理工大学"
#  year = 2002

# Social/Academic Networking
# For available icons, see: https://sourcethemes.com/academic/docs/widgets/#icons
#   For an email link, use "fas" icon pack, "envelope" icon, and a link in the
#   form<EMAIL_ADDRESS>or "#contact" for contact widget.

[[social]]
  icon = "envelope"
  icon_pack = "fas"
  link =<EMAIL_ADDRESS># For a direct email link, use<EMAIL_ADDRESS>
[[social]]
  icon = "twitter"
  icon_pack = "fab"
  link = "https://twitter.com/SkyAoXiaojian"

[[social]]
  icon = "github"
  icon_pack = "fab"
  link = "https://github.com/skyao"

[[social]]
  icon = "git"
  icon_pack = "fab"
  link = "//legacy.gitbook.com/@skyao"

[[social]]
  icon = "weibo"
  icon_pack = "fab"
  link = "//weibo.com/aoxiaojian"

[[social]]
  icon = "youtube"
  icon_pack = "fab"
  link = "//www.youtube.com/channel/UCKeIYzzIeOtVR1iSfAdRBqQ"

# Link to a PDF of your resume/CV from the About widget.
# To enable, copy your resume/CV to `static/files/cv.pdf` and uncomment the lines below.
# [[social]]
#   icon = "cv"
#   icon_pack = "ai"
#   link = "files/cv.pdf"

+++

敖小剑，资深码农，十八年软件开发经验，微服务专家，Service Mesh布道师，Servicemesher社区联合创始人。专注于基础架构，Cloud Native 拥护者，敏捷实践者，坚守开发一线打磨匠艺的架构师。曾在亚信、爱立信、唯品会等任职，对基础架构和微服务有过深入研究和实践。

目前就职蚂蚁金服，在可信原生部（原中间件团队+系统部）从事Service Mesh、Serverless等云原生产品设计和开发。

（欢迎使用 [RSS订阅](/index.xml) 本站内容更新）