text:
# AwsBackupVaultLock

```text
aws-q2-2023/Resource/Storage/AwsBackupVaultLock
```

```text
include('aws-q2-2023/Resource/Storage/AwsBackupVaultLock')
```

| Illustration | AwsBackupVaultLock | AwsBackupVaultLockCard | AwsBackupVaultLockGroup |
| :---: | :---: | :---: | :---: |
| ![illustration for Illustration](../../../aws-q2-2023/Resource/Storage/AwsBackupVaultLock.png) | ![illustration for AwsBackupVaultLock](../../../aws-q2-2023/Resource/Storage/AwsBackupVaultLock.Local.png) | ![illustration for AwsBackupVaultLockCard](../../../aws-q2-2023/Resource/Storage/AwsBackupVaultLockCard.Local.png) | ![illustration for AwsBackupVaultLockGroup](../../../aws-q2-2023/Resource/Storage/AwsBackupVaultLockGroup.Local.png) |

## Sprites
The item provides the following sriptes:

- `<$AwsBackupVaultLockXs>`
- `<$AwsBackupVaultLockSm>`
- `<$AwsBackupVaultLockMd>`
- `<$AwsBackupVaultLockLg>`

## AwsBackupVaultLock

### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution"

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('aws-q2-2023/bootstrap')

' loads the Item which embeds the element AwsBackupVaultLock
include('aws-q2-2023/Resource/Storage/AwsBackupVaultLock')

' renders the element
AwsBackupVaultLock('AwsBackupVaultLock', 'Aws Backup Vault Lock', 'an optional tech label', 'an optional description')
@enduml
```

### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../../.."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('aws-q2-2023/bootstrap')

' loads the Item which embeds the element AwsBackupVaultLock
include('aws-q2-2023/Resource/Storage/AwsBackupVaultLock')

' renders the element
AwsBackupVaultLock('AwsBackupVaultLock', 'Aws Backup Vault Lock', 'an optional tech label', 'an optional description')
@enduml
```

## AwsBackupVaultLockCard

### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution"

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('aws-q2-2023/bootstrap')

' loads the Item which embeds the element AwsBackupVaultLockCard
include('aws-q2-2023/Resource/Storage/AwsBackupVaultLock')

' renders the element
AwsBackupVaultLockCard('AwsBackupVaultLockCard', 'Aws Backup Vault Lock Card', 'an optional description')
@enduml
```

### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../../.."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('aws-q2-2023/bootstrap')

' loads the Item which embeds the element AwsBackupVaultLockCard
include('aws-q2-2023/Resource/Storage/AwsBackupVaultLock')

' renders the element
AwsBackupVaultLockCard('AwsBackupVaultLockCard', 'Aws Backup Vault Lock Card', 'an optional description')
@enduml
```

## AwsBackupVaultLockGroup

### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution"

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('aws-q2-2023/bootstrap')

' loads the Item which embeds the element AwsBackupVaultLockGroup
include('aws-q2-2023/Resource/Storage/AwsBackupVaultLock')

' renders the element
AwsBackupVaultLockGroup('AwsBackupVaultLockGroup', 'Aws Backup Vault Lock Group', 'an optional tech label') {
    note as note
        the content of the group
    end note
}
@enduml
```

### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../../.."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('aws-q2-2023/bootstrap')

' loads the Item which embeds the element AwsBackupVaultLockGroup
include('aws-q2-2023/Resource/Storage/AwsBackupVaultLock')

' renders the element
AwsBackupVaultLockGroup('AwsBackupVaultLockGroup', 'Aws Backup Vault Lock Group', 'an optional tech label') {
    note as note
        the content of the group
    end note
}
@enduml
```

repository: tmorin/plantuml-libs

repo_name: tmorin/plantuml-libs


text:
# Find All Duplicates in an Array

Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.

Find all the elements that appear twice in this array.

Could you do it without extra space and in O(n) runtime?

Example:
Input:
[4,3,2,7,8,2,3,1]

Output:
[2,3]

#### 很简单，一个集合，一个列表。。

```python
class Solution(object):
    def findDuplicates(self, nums):
        """
        :type nums: List[int]
        :rtype: List[int]
        """
        s = set()
        res = list()
        for i in nums:
            if i in s:
                res.append(i)
            else:
                s.add(i)
        return res

```

license: MIT

repository: hanleilei/leetcode

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: hanleilei/leetcode


text:
# Roblox Steam Launcher

This allows one to have the Steam overlay and Steam Input in Roblox. It functions
by replacing `RobloxPlayerLauncher.exe` with a custom launcher that launches the
real `RobloxPlayerLauncher` through Steam.

## [Newest Release](https://github.com/Corecii/roblox_steam_launcher/releases)

## Installation and Uninstallation

1. Grab the [Latest Release](https://github.com/Corecii/roblox_steam_launcher/releases)
2. Unzip
3. Run `roblox_steam_launcher_installer.exe`.
4. If you have installed Roblox Steam Launcher previously, `Uninstall` first, then run the installer again and choose `Install`

## Building

Building requires a Windows computer with an
installation of [Rust](https://www.rust-lang.org/en-US/install.html),
[Python 2.7](https://www.python.org/downloads/release/python-2713/), and [PyInstaller](http://www.pyinstaller.org/).
The two build scripts (`build.bat` and `build_release.bat`) will run `cargo build` and `pyinstaller -F -y`
in the proper places and copy the executables to `build` or `build_release`.

## Issues

* Python is used for calculating the game id of a game because I could not figure out how
to set up the crc32 calculation properly in Rust, and I did not want to spend time
writing my own. It was fastest to bundle a python executable.
* The Roblox website will suggest that one downloads Roblox, as if it is not already installed.
Roblox still runs fine. This is probably an issue with the launcher taking too long, and it
sometimes happens even without the launcher installed.
* Errors in one half of the launching process are not handled well, and won't give any indication
if things break.

## Screenshots

![Steam Notification](http://i.imgur.com/E1eb1eh.png "Steam Notification")
![Steam Overlay](http://i.imgur.com/JURyXFe.png "Steam Overlay")
![Steam Controller Support](http://i.imgur.com/dOHbnDm.png "Steam Controller Support")
![Steam Keyboard Support](http://i.imgur.com/J9IDFMe.jpg "Steam Keyboard Support")


text:
# ForgeOps for IoT

This directory contains resources for deploying Things with the ForgeRock Identity Platform to Kubernetes using ForgeOps.

### Get Started

#### Deploy using Google Kubernetes Engine

Follow the ForgeOps documentation to install the
[third party software](https://backstage.forgerock.com/docs/forgeops/7.1/cdk/cloud/setup/gke/sw.html) and
[obtain the cluster details](https://backstage.forgerock.com/docs/forgeops/7.1/cdk/cloud/setup/gke/clusterinfo.html).

Set the following environment variables:
```
export PROJECT=<The name of the Google Cloud project that contains the cluster>
export CLUSTER=<The cluster name>
export ZONE=<The Google Cloud zone in which the cluster resides>
export NAMESPACE=<The namespace to use in your cluster>
export FQDN=<The fully qualified domain name of your deployment>
export CONTAINER_REGISTRY=<The default container registry>
```

After installing the Google Cloud SDK, authenticate the SDK:
```
gcloud auth login
```

Deploy the Things CDK to GKE:
```
./deploy.sh
```

When the script is complete it will print out the connection details for the platform.

### Using the Platform for Things
Once the platform is running we can register and authenticate a thing via the `authenticate` endpoint and perform
actions like authorization and retrieving attributes via the `things` endpoint. This can either be done with the IoT
SDK or by using the endpoints directly. The `things` endpoint in AM provides IoT-specific functionality. For example,
a thing can request an OAuth 2.0 access token without having to know the credentials of the OAuth 2.0 client acting on its behalf.

Before a thing can use the `things` endpoint, it must be registered with the platform and have a valid session token.
A thing identity can be registered via the platform UI:

1. Open the [Thing List](https://iot.iam.example.com/platform/?realm=root#/managed-identities/managed/thing).
1. Click the `New Thing` button.
1. Enter the following values in the pop up window:
    * ID: `thingymabot`
    * Type: `device`
1. Click `Save` to create the thing identity.
1. An entry for `thingymabot` will appear in the `Thing List`, click on the entry.
1. Click the `Reset Password` button.
1. Enter the password `5tr0ngG3n3r@ted` in the pop up window and click the `Reset Password` button.

Now that `thingymabot` exists in the platform, it can authenticate using its own credentials:
```
curl --request POST 'https://iot.iam.example.com/am/json/realms/root/authenticate?realm=/' \
    --header 'Content-Type: application/json' \
    --header 'X-OpenAM-Username: thingymabot' \
    --header 'X-OpenAM-Password: 5tr0ngG3n3r@ted' \
    --header 'Accept-API-Version: resource=2.0, protocol=1.0'
```

Save the `tokenId` received from this request to a variable:
```
export thingTokenId=FJo9Rl....AAIwMQ..*
```

With this session token, `thingymabot` can request an OAuth 2.0 access token from the `things` endpoint:
```
curl --request POST 'https://iot.iam.example.com/am/json/things/*?_action=get_access_token' \
    --header 'Accept-API-Version: protocol=2.0,resource=1.0' \
    --header 'Content-Type: application/json' \
    --header "Cookie: iPlanetDirectoryPro=${thingTokenId}" \
    --data-raw '{
        "scope":["publish"]
    }'
```

If the request is valid and authorised, then the platform will respond with the standard OAuth 2.0 Access Token Response. For example:
```
{
    "access_token":"1b7JX5BYt7OkBIxEBy0gavzX7aA",
    "refresh_token":"5rI_8TxznBppLWBkCOsboUNBW08",
    "scope":"publish",
    "token_type":"Bearer",
    "expires_in":3599
}
```

### Run Functional Tests

The functional test framework, Anvil, can be run against the ForgeOps IoT Platform to verify that all the IoT SDK and
IoT Gateway features work correctly.

#### On GKE

Start the platform before running the tests:
```
./deploy.sh $(PWD)/../../tests/iotsdk/testdata/forgeops 6KZjOxJU1xHGWHI0hrQT24Fn
```

Run the functional tests:
```
cd ../../
./run.sh anvil -deployment=platform -url=https://$FQDN/am -password=6KZjOxJU1xHGWHI0hrQT24Fn
```

repository: JacoJooste/iot-edge

branch_name: refs/heads/main

gha_language: Go

repo_name: JacoJooste/iot-edge


text:
# rn3app: Bare React-Native Project Demo with PyTorch to TensorFlow.js converted model on Fashion MNIST Dataset

Build another app with less effort:

## Steps:
### Step 1. Create your react native app.

You can use the React Native CLI or Expo.
This time command for creating the app:

    `npx create-react-native-app` instead of `npx react-native init`.
This command automatically configures four files mentioned in installing the react-native-unimodules step.
On macOS (to develop iOS applications) You will also need to use CocoaPods to install these dependencies.

### Step 2: Install dependencies

#### Install and configure `react-native-unimodules` (can be skipped if in an expo app)
No need to configure manually this time. Just install unimodules with: `yarn add react-native-unimodules`
#### Install jpeg-js
#### Install and configure expo-gl-cpp and expo-gl
#### Install and configure expo-camera
Requires configuring android/build.gradle file like previous. The lines to add:

    allprojects {
        repositories {

            // * Your other repositories here *

            // * Add a new maven block after other repositories / blocks *
            maven {
                // expo-camera bundles a custom com.google.android:cameraview
                url "$rootDir/../node_modules/expo-camera/android/maven"
            }
        }
    }

#### Install and configure async-storage
           It creates an issue: Doc says to install `@react-native-async-storage/async-storage`, but the project requires `@react-native-                     community/async-storage`. May be caused by expo libraries.
#### Install and configure react-native-fs
It requires modifying three files:

    1. android/settings.gradle
    2. android/app/build.gradle
    3. MainApplication.java ----> Just import  com.rnfs.RNFSPackage will do the work!

#### Install @tensorflow/tfjs - npm install @tensorflow/tfjs
#### Install @tensorflow/tfjs-react-native - npm install @tensorflow/tfjs-react-native
#### Install expo-permissions, expo-file-system, expo-image-picker
No need to install expo-constants. It is already there!
### Just add these lines in <application></application>  in AndroidManifest.xml:
    <activity
      android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
<EMAIL_ADDRESS>    </activity>
Paste the code from previously written app in App.js. Don't use the sample from tfjs-react-native docs, they don't work for some reason.
Now just host the model with `http-server -c1 --cors` and enjoy!

repository: Sabit-Ahmed/React-Native-Projects

gha_language: TypeScript

repo_name: Sabit-Ahmed/React-Native-Projects


text:
# Contributing to React Virtuoso

Want to contribute to React Virtuoso? You will encounter a state management you are not familiar with - it's implemented using [URX](https://urx.virtuoso.dev).
Check the examples and the conceptual docs to get the gist of it.

### How to add fixes and new features

Virtuoso has an extensive unit/e2e test suite. To run the unit tests, use `pnpm run test`. An end-to-end browser-based test suite is runnable with `pnpm run e2e`.

A convenient way to debug something is to preview the test cases in the browser.
To do that, run `pnpm run dev` - it will open a simple UI that lets you browse the components in the `examples` folder.

### How to add to the docs

The documentation site is built with docusaurus and the content is available in the `site/docs` directory.
The API reference is generated from the doc comments in `src/components.tsx`.

repository: petyosi/react-virtuoso

repo_name: petyosi/react-virtuoso


text:
# Version [2.12.0] (https://github.com/GeekyAnts/NativeBase/releases/tag/v2.12.0)

### General Features

*   **Installation:** Changed `CRNA` to `Expo` in installation instructions. PR [#2584](https://github.com/GeekyAnts/NativeBase/pull/2584).
*   **Vulnerability Issue:** Upgraded loadsh to fix vulnerability issue. Commit [10d381a](https://github.com/GeekyAnts/NativeBase/commit/10d381a81ca0df072bfcf9d55622f80bf8ab8a8c), [e6e7946](https://github.com/GeekyAnts/NativeBase/commit/e6e794630ca6db29e1d072c02798fc1f4cb7f744), closes [#2602](https://github.com/GeekyAnts/NativeBase/issues/2602)

### Upgraded Features

*   **Accordion:** Added Test case for Accordion. PR[#2578](https://github.com/GeekyAnts/NativeBase/pull/2578), closes [#2546](https://github.com/GeekyAnts/NativeBase/issues/2546)
*   **FAB:** Disable FABs android ripple effect and ripple effect wrt borderRadius. Commit[56597c4](https://github.com/GeekyAnts/NativeBase/commit/56597c45df1b75e1658b1e049d38e08dbc954e3e), closes [#2313](https://github.com/GeekyAnts/NativeBase/issues/2313)
*   **Item:** Added Item Event Handler. PR [#2552](https://github.com/GeekyAnts/NativeBase/pull/2552), closes [#2525](https://github.com/GeekyAnts/NativeBase/issues/2525).
*   **Tabs:** Tabs width update. PR [#2572](https://github.com/GeekyAnts/NativeBase/pull/2572), closes [#2558](https://github.com/GeekyAnts/NativeBase/issues/2558)
*   **Theme:**
   - iPhoneX feature flag modification from specified theme. PR[#2514](https://github.com/GeekyAnts/NativeBase/pull/2514), closes [#2382](https://github.com/GeekyAnts/NativeBase/issues/2382)
   - Updated theme variable value for ListItem. PR[#2569](https://github.com/GeekyAnts/NativeBase/pull/2569), closes [#2513](https://github.com/GeekyAnts/NativeBase/issues/2513)
*   **Typescript:**
   - Added Button `hasText` to Typescript. PR[#2526](https://github.com/GeekyAnts/NativeBase/pull/2526).
   - Added hide() function to Toast typing. PR[#2521](https://github.com/GeekyAnts/NativeBase/pull/2521).
   - Added `prerenderingSiblingsNumber` to Tabs. PR [#2531](https://github.com/GeekyAnts/NativeBase/pull/2531), closes [#1620](https://github.com/GeekyAnts/NativeBase/issues/1620)
   - Updated Type definitions. PR [#2210](https://github.com/GeekyAnts/NativeBase/pull/2210).

### Bug Fixes

*   **ActionSheet:** Fixed height issue. PR [#2553](https://github.com/GeekyAnts/NativeBase/pull/2553), closes [#2545](https://github.com/GeekyAnts/NativeBase/issues/2545)
*   **Button:** Fixed nested array style. PR [#2511](https://github.com/GeekyAnts/NativeBase/pull/2511), closes [#2419](https://github.com/GeekyAnts/NativeBase/issues/2419)
*   **DatePicker:** Date Picker disabled prop fix. PR [#2510](https://github.com/GeekyAnts/NativeBase/pull/2510), closes [#2509](https://github.com/GeekyAnts/NativeBase/issues/2509)
*   **Fab:** Fixed Fab syntax bugs. PR [#2577](https://github.com/GeekyAnts/NativeBase/pull/2577)
*   **Picker:** Picker text ellipsize for iOS. Commit [460eddc](https://github.com/GeekyAnts/NativeBase/commit/460eddcc843662061bc1de11650585360d72321f), closes [#2431](https://github.com/GeekyAnts/NativeBase/issues/2431)
*   **Theme:**
    - Fixed Header height issue for iPhoneX with material theme combination. Commit [4c8a68b](https://github.com/GeekyAnts/NativeBase/commit/4c8a68b1886bfd1eca8d976d72726ffe6062bc94), closes [#2581](https://github.com/GeekyAnts/NativeBase/issues/2581)
*   **Typescript:** Fixed React Native style types refs. PR [#2562](https://github.com/GeekyAnts/NativeBase/pull/2562), closes [#2123](https://github.com/GeekyAnts/NativeBase/issues/2123)


text:
# Retina

Retina is a regex-based recreational programming language. It's main feature is taking some text via standard input and repeatedly applying regex operations to it (e.g. matching, splitting, and most of all replacing). Under the hood, it uses .NET's regex engine, which means that both the .NET flavour and the ECMAScript flavour are available.

Retina was mainly developed for [Code golf](https://en.wikipedia.org/wiki/Code_golf) which may explain its very terse configuration syntax and some weird design decisions.

## Running Retina

There is an up-to-date .NET binary of Retina in the root directory of the repository. Alternatively, you can build it yourself from the C# sources. The code requires .NET 4.5. I do not regularly test Retina with Mono, but previous versions have worked without problems.

Source files can simply be passed as command-line arguments. For details of ways to invoke Retina [see the docs](https://github.com/mbuettner/retina/wiki/The-Language#basics).

## How does it work?

Full documentation of the language **[can be found in the Wiki](https://github.com/mbuettner/retina/wiki/The-Language)**. It might also be worth having a look at the **[changelog](https://github.com/mbuettner/retina/blob/master/CHANGELOG.md)**.

repository: vendethiel/retina

repo_name: vendethiel/retina


text:
# Anastasia's Kaleido App

## Usage

Install [nodemon](https://github.com/remy/nodemon) globally

```
npm i nodemon -g

```

Install server and client dependencies

```
yarn
cd client
yarn
```

To start the server and client at the same time

```
cd ..
npm run dev
```

Running the production build on localhost. This will create a production build, then Node will serve the app on http://localhost:3000

repository: lanasta/kaleido-app

repo_name: lanasta/kaleido-app


text:
# Interactive CLI for Node.js

The Interactive CLI is a library that makes it easy to create interactive command line scripts in Node.js by utilizing promises.

[![npm version](https://img.shields.io/npm/v/interactive-cli.svg?style=flat-square)](https://www.npmjs.com/package/interactive-cli)

## Installation

Using npm:

```shell
npm i --save interactive-cli
```

## Example interaction:

```shell
$ node examples/basic-usage.js --example

Would you like to
a) Create a new user
b) Delete a user
q) Quit
?:  a

Enter user's email
email<EMAIL_ADDRESS>
What's the name for the user
firstname:  Leonardo
lastname:  DiCaprio
User Leonardo DiCaprio was created successfully!

All DONE!

Would you like to
a) Create a new user
b) Delete a user
q) Quit
?:  b

Which user would you like to delete?
a) Leonardo DiCaprio
b) Jennifer Lopez
q) Quit
?:  b

Are you absolutely sure?
continue? (y/n):  y
User Jennifer Lopez was successfully deleted!

All DONE!

Would you like to
a) Create a new user
b) Delete a user
q) Quit
?:  q
```

## The Gist

```js
const { promptFields, promptToContinue, promptOptions, startWith, onFinalError, exit, DontContinue } = require('../')

new Promise((resolve, reject) => {
  // Do some preparation, such as getting
  // a reference to a database or authenticating
  resolve({
    createUser: () => Promise.resolve(),
    listUsers: () =>
      Promise.resolve({
        '31725276-73a9-4830-aa77-a86fce4dd7f8': 'Leonardo DiCaprio',
        '53bd3330-4bd7-47c5-a685-f1039e043eae': 'Jennifer Lopez',
      }),
    deleteUser: () => Promise.resolve(),
  })
})
  .then((api) => {
    const initialOptions = {
      createUser: 'Create a new user',
      deleteUser: 'Delete a user',
    }
    const handler = (selection) => {
      switch (selection) {
        case 'createUser':
          return createUser(api)

        case 'deleteUser':
          return deleteUser(api)

        default: {
          throw new ExitScript(`Unknown selection "${selection}"`)
        }
      }
    }

    return startWith('Would you like to', initialOptions, handler)
  })
  .catch(onFinalError)
  .then(exit)

function createUser(api) {
  const user = {}
  return promptFields("Enter user's email", 'email')
    .then((email) => {
      user.email = email
    })

    .then(() => promptFields("What's the name for the user", ['firstname', 'lastname']))
    .then((res) => {
      user.firstname = res.firstname
      user.lastname = res.lastname
    })

    .then(() => {
      return api.createUser(user).catch((err) => {
        throw DontContinue('User could not be created because of error: ' + err.message)
      })
    })

    .then(() => {
      console.log(`User ${user.firstname} ${user.lastname} was created successfully!`)
    })
}

function deleteUser(api) {
  const data = {}
  return api
    .listUsers()
    .then((users) => {
      data.users = users
      return users
    })
    .then((users) => promptOptions('Which user would you like to delete?', users))
    .then((selection) => {
      data.selection = selection
      return selection
    })
    .then((selection) => {
      console.log('\n' + 'Are you absolutely sure?')
      return promptToContinue(selection)
    })
    .then((selection) => {
      api.deleteUser(selection)
    })
    .then(() => {
      console.log(`User ${data.users[data.selection]} was successfully deleted!`)
    })
}
```

### License

MIT

repository: alizbazar/interactive-cli

gha_language: JavaScript

repo_name: alizbazar/interactive-cli


text:
---
title: "Bedrock on Product Hunt"
date: "2018-05-20"
author: Wolfr_
---

Bedrock was submitted to [Product Hunt](https://www.producthunt.com/posts/bedrock-2) on Saturday Morning and even though it is weekend we have amassed a whopping 150+ upvotes. Yay! I am just posting this here for posterity.

We have big plans for Bedrock the next months. If you want be the first to know about new things, follow [@usebedrock](https://twitter.com/usebedrock) on Twitter or subscribe to the [RSS feed](https://bedrock.mono.company/feed/).


text:
# Deprecated

!!! Use https://github.com/appuio/postgres-backup-cronjob instead!!!

# postgresql-backup-container
Container to do full backups of PostgreSQL databases running on OpenShift. The backup is done by the `pg_basebackup` tool.

Simpler backups using `pg_dump` are available in the [postgresql-simple-backup-container](https://github.com/appuio/postgresql-simple-backup-container) repository.

## Intention
Provide a container that does periodical backups of a PostgreSQL database.

## WIP
The backup container is not finished jet: work in progress.

This repo ist inspired by the MySQL backup container: https://github.com/appuio/mysql-simple-backup-container

## Prerequisites

### PostgreSQL Database
* The database has to be set up with a master user and it's password.
* The database has to be configured to allow remote access from other hosts.
* The database user for the backup has to have superuser or replication role.
* The database has to be set up to allow remote backup connections.
 * For this, add following configuration to the PostgreSQL configuration file `/etc/postgresql/X.X/main/postgresql.conf`
 * Use your database version for 'X.X'. As example: '9.5'

    max_wal_senders = 5

    wal_level = hot_standby

    archive_mode = on

    archive_command = '/bin/true'

## OpenShift
Usage on OpenShift.

### PostgreSQL Database
How to create and run the PostgreSQL database.

#### Install by Docker Image
Create the container with the `oc tool` from Docker Image:

    oc new-app \
      -e POSTGRES_PASSWORD=mysecretpassword \
      -e POSTGRESQL_USER=postgresuser \
      -e POSTGRESQL_PASSWORD=mysecretpassword \
      -e POSTGRESQL_DATABASE=postgresdb \
      -e POSTGRESQL_ADMIN_PASSWORD=mysecretpassword2 \
      -l app=postgresdb \
      centos/postgresql-95-centos7

#### Install by provided template
Create the container with the `oc tool` from installed template:

    oc new-app --template=postgresql-ephemeral \
      --param=POSTGRESQL_USER=postgresuser \
      --param=POSTGRESQL_PASSWORD=mysecretpassword \
      --param=POSTGRESQL_DATABASE=postgresdb \
      --param=DATABASE_SERVICE_NAME=postgresqldb \
      -l app=postgresdb

Edit the deployment configuration and add the master password as env variable.

    env:
      -
        name: POSTGRESQL_ADMIN_PASSWORD
        value: mysecretpassword2

#### Install by local template file
Create the container with the `oc tool` from local template:

    oc process -f postgresql-ephemeral-template.json \
      -v \
      POSTGRES_PASSWORD=mysecretpassword \
      POSTGRESQL_USER=postgresuser \
      POSTGRESQL_PASSWORD=mysecretpassword \
      POSTGRESQL_DATABASE=postgresdb \
      POSTGRESQL_ADMIN_PASSWORD=mysecretpassword2 \
      DATABASE_SERVICE_NAME=postgresqldb \
    | oc create -f -

#### Install by Dockerfile
Create the container with the `oc tool` from the local db Dockerfile.

The PostgreSQL database container on [github](https://github.com/sclorg/postgresql-container).

#### Container deletion
Delete all resources owned by the database container.

    oc delete all -l app=postgresdb

### Database Backup Container
Create and run PostgreSQL backukp Container on OpenShift.

    oc new-app \
      -e BACKUP_USER=postgres \
      -e BACKUP_PASS=mysecretpassword2 \
      -e BACKUP_PORT=5432 \
      -l app=backup \
      https://github.com/appuio/postgresql-backup-container

Delete all resources owned by the backup container.

    oc delete all -l app=backup

### Next steps

Create and provide OpenShift templates for backup container and combined with the database.

### Build Backup image

    docker build -t pg_backup .

repository: appuio/postgresql-backup-container

gha_language: Dockerfile

repo_name: appuio/postgresql-backup-container


text:
# telegram-query-bot

Telegram bot automating Kyber queries. Uses the [Telegraf](https://github.com/telegraf/telegraf) Telegram bot framework.

Bots are special [Telegram](https://telegram.org) accounts designed to handle messages automatically.
Users can interact with bots by sending them command messages in private or group chats.

### Installation

```
$ npm install
```

### Setup

1) Create an .env file in the root directory, containing your Infura and / or Alchemy API keys and Telegram bot token. Note: Omit the bot prefix in the Telegram token.

e.g.
```
ALCHEMY_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
INFURA_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TELEGRAM_TOKEN=xxxxxxxxx:xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxx
```

### Running

To run in development mode (restarts at every file change)
```
npm run dev
```

To run in production mode
```
npm run start
```

repository: KyberNetwork/telegram-query-bot

repo_name: KyberNetwork/telegram-query-bot


text:
Convert all declarations to be anonymous external modules.

Write a build script for declarations that allows outputting multiple versions:
- one for typings
- one for DT

---

Publish my big changes to the **bluebird** declaration.

---

Publish these declarations:

* is-my-json-valid
* color

---

Check typings that I may have modified.

If modifications are useful, contribute back to DefinitelyTyped and/or post them here.

* mocha
* lodash
* sinon
* sinon-chai
* mocha
* chai
* chai-as-promised

---

Merge my declarations with others for the same lib:

* knex
* bookshelf

---


text:
Ash
---
Ash is the "Aura Shell", the window manager and system UI for Chrome OS.
Ash uses the views UI toolkit (e.g. views::View, views::Widget, etc.) backed
by the aura native widget and layer implementations.

Ash sits below chrome in the dependency graph (i.e. it cannot depend on code
in //chrome). It has a few dependencies on //content, but these are isolated
in their own module in //ash/content. This allows targets like ash_unittests
to build more quickly.

Tests
-----
Most tests should be added to the ash_unittests target. Tests that rely on
//content should be added to ash_content_unittests, but these should be rare.

Tests can bring up most of the ash UI and simulate a login session by deriving
from AshTestBase. This is often needed to test code that depends on ash::Shell
and the controllers it owns.

Mus+ash
----------
Ash is transitioning to use the mus window server and gpu process, found in
//services/ui. Ash continues to use aura, but aura is backed by mus. Code to
support mus is found in //ash/mus. There should be relatively few differences
between the pure aura and the aura-mus versions of ash. Ash can by run in mus
mode by passing the --mus command line flag.

Ash is also transitioning to run as a mojo service in its own process. This
means that code in chrome cannot call into ash directly, but must use the mojo
interfaces in //ash/public/interfaces.

Out-of-process Ash is referred to as "mash" (mojo ash). In-process ash is
referred to as "classic ash". Ash can run in either mode depending on the
--mash command line flag.

Historical notes
----------------
Ash shipped on Windows for a couple years to support Windows 8 Metro mode.
Windows support was removed in 2016.

repository: massbrowser/android

repo_name: massbrowser/android


text:
# Clipboard-to-qr-code
Generates QR codes in a window from clipboard contents.

Can be toggled to be always on top and to generate QRCode from current clipboard content when window is focused.

[zip download](http://durhur.fi/~peri/ClipboardToQR/ClipboardToQR.zip)

Uses .net 4.5.2 and QRCoder1.2.5
https://www.nuget.org/packages/QRCoder/

repository: jboeke/Clipboard-to-qr-code

repo_name: jboeke/Clipboard-to-qr-code


text:
hue(1)
======

A command line interface to [philips hue](http://meethue.com)

**NOTE:** A more complete and updated implementation of a Hue Management CLI
can be found here https://github.com/bahamas10/hueadm

Installation
------------

First, install [Node.js](http://nodejs.org), then:

    npm install -g hue-cli

...and the executable will be installed globally as `hue`

Usage
-----

    Usage: hue [-c config] [-H host] [--json] [command]

    control philips hue over the command line

    examples
      hue config                  # view the hue config
      hue lights                  # get a list of lights
      hue lights 5                # get information about light 5
      hue lights 5,6,7 on         # turn lights 5 6 and 7 on
      hue lights on               # turn all lights on
      hue lights 1 ff0000         # turn light 1 red
      hue lights 1 red            # same as above
      hue lights 1 +10            # increase the brightness by 10 (out of 254)
      hue lights 1 -10            # decrease the brightness by 10 (out of 254)
      hue lights 1 =100           # set the brightness to 100 (out of 254)
      hue lights 1 +10%           # increase the brightness by 10%
      hue lights 1 -10%           # decrease the brightness by 10%
      hue lights 1 =100%          # set the brightness to 100%
      hue lights 4,5 colorloop    # enable the colorloop effect on lights 4 and 5
      hue lights 4,5 alert        # blink lights 4 and 5 for 30 seconds
      hue lights 4,5 clear        # clear any effects on lights 4 and 5
      hue lights 1 state          # set the state on light 1 as passed in as JSON over stdin
      hue rename 1 light-name     # set light 1's name to the given string
      hue lights reset            # reset all lamps to default (on, as if the bulb was just flipped on)
      hue lights 1,2 reset        # reset just bulbs 1 and 2
      hue help                    # this message
      hue register                # register this app to hue
      hue search                  # search for hue base stations

    commands
      config, lights, help, register, search

    options
      -c, --config <file>    config file, defaults to ~/.hue.json
      -h, --help             print this message and exit
      -H, --host             the hostname or ip of the bridge to control
      -j, --json             force output to be in json
      -u, --updates          check for available updates
      -v, --version          print the version number and exit

Example
-------

### starting off

First, let's search for nearby base stations

    $ hue search
    1 stations found

    1: <IP_ADDRESS>

Pass in `-j` for json if you'd like

    $ hue -j search
    [
      "<IP_ADDRESS>"
    ]

Next, let's try to list the lights on that base station

    $ hue -H <IP_ADDRESS> lights
    error: application not registered, run `hue register` first

This app isn't registered yet, let's go ahead and do that

    $ hue -H <IP_ADDRESS> register
    please go and press the link button on your base station
    Hue Base Station paired!

### listing lights

All you had to do was press the button on your base station to register, cool
right?  Let's re-run the lights command

    $ hue -H <IP_ADDRESS> lights
       1 Mike 1
       2 Mike 2
       3 Dave closet
       4 Hallway 2
       5 Hallway 1
       6 Front hallway
       7 Dave Ledge Left
       8 Dave Ledge Right
       9 Dave's Piano
      10 Dave's Lamp
      11 Balcony Mike
      12 Balcony Dave
      13 Balcony Living Room
      14 Mike 3
      15 Living room 3
      16 Living room 1

Again, `-j` if you'd like json output.

Running with the command `lights` will give us a list of all the lights
connected to the base station.

From here, we can get information about a single light like:

    $ hue lights 1
       1 on    141    Mike 1

141 in the above example is the brightness.

And `-j` for json

    $ hue -j lights 1
    {
      "state": {
        "on": true,
        "bri": 141,
        "hue": 13122,
        "sat": 211,
        "xy": [
          0.5119,
          0.4147
        ],
        "ct": 467,
        "alert": "none",
        "effect": "none",
        "colormode": "ct",
        "reachable": true
      },
      "type": "Extended color light",
      ...
    }

### controlling the lights

Let's actually mess with the lights now.  Let's turn on the light in my closet.

    $ hue lights 3 on
    light 3 success

What about both lights in the hallway?

    $ hue lights 4,5 on
    light 4 success
    light 5 success

What if we try to turn on a non-existent light?

    $ hue lights 99 on
    light 99 failed: resource, /lights/99/state, not available

Cool, errors handled properly.  Let's see some more examples

    $ hue lights off
    light 1 success
    light 2 success
    light 3 success
    ...

This is shorthand for

    $ hue lights all off

Where `all` is a recognized keyword for all lights in the system.  You can also:

    $ hue lights off

To quickly turn off all lights on the system

### controlling colors

> We can turn the lights on and off, that's great... what about colors?

How about hex

    $ hue lights 4 ffffff
    light 4 success

We just set the light in the hallway to pure white, hex `ffffff`.  Let's go crazy
and turn all of the lights in the house red (this is where we need the `all` keyword)

    $ hue lights all ff0000
    light 1 success
    light 2 success
    ...

It's worth noting here that, because this tool is written in Node, all requests to the
lights are done concurrently.  This means we don't have to wait for light 1 to finish
before we instruct light 2 to change, nor wait for light 2 to finish before we instruct
light 3 to change, and so on.

Shorthand hex is also supported

    $ hue lights 3,4 0f0
    light 3 success
    light 4 success

Now lights 3 and 4 are green

Last but not least, any CSS name is supported for colors

    $ hue lights 1 yellow
    light 1 success

Light 1 is now yellow. The full list of colors is available here
http://xahlee.info/js/css_color_names.html

### brightness

Brightness can also be changed using the `=`, `+` and `-` operators

    $ hue lights 1 +20
    light 1 brightness 200 -> 220
    $ hue lights 1 -30
    light 1 brightness 220 -> 190
    $ hue lights 1 =150
    light 1 brightness 150

### effects

You can enable the colorloop effect on lamps by running

    $ hue lights 4,5,6 colorloop
    light 4 success
    light 5 success
    light 6 success

and clear all effects with

    $ hue lights 4,5,6 clear
    light 4 success
    light 5 success
    light 6 success

### debugging

Last but not least, you can pass the state as JSON over stdin.  The possible
values are found at [http://developers.meethue.com/1_lightsapi.html](http://developers.meethue.com/1_lightsapi.html)
in section 1.6.

    $ echo '{"bri": 240, "hue": 25500}' | hue lights 7 state

The `state` keyword tells `hue` to read from stdin

Config
------

A config file will be created at `~/.hue.json` upon registration that looks like...

``` json
{
  "host": "<IP_ADDRESS>",
  "colors": {
    "myred": "fe0000",
    "myblue": "0000fe"
  }
}
```

* `host`: the host to connect to (normally passed in as `-H`)
* `colors`: a key-value pair of color aliases to their hex mapping, you can use these
when changing the colors of a light

Credits
-------

* [Philips hue](http://meethue.com): I assume you know what this is by now
* [hue.js](https://github.com/thatguydan/hue.js): Node.js hue client
* [css-color-names](https://github.com/bahamas10/css-color-names): color aliases provided by this module

License
-------

MIT


text:
# Data-Science-Module---Mini-Project
You are a Controller of Examination (COE) in an Examination body which regularly organises an online examination. As a part of your reasonability you need to generate various reports from the database. Your task is to automate the entire process using pandas. Details of database are as follows:

Application_ID : ID of applicant
D_O_B : Date of Birth
Sex : Gender of Candidate
H_Qual : Highest qualification of the candidate
TH_CENT_CH : First choice of examination city
SEC_TH_CEN : Second Choice of Examination City
CATEGORY : Category of student
Rollno : Roll Number of the candidate (To be filled by CEO)
cent_allot : Examination centre district (To be filled by CEO)
cent_add : Examination Centre Address (To be filled by CEO)
examDate : Examination Date (To be filled by CEO)
batch : Allotted batch on examination Date (To be filled by CEO)
rep_time : Reporting time for examination (To be filled by CEO)

# Stage One: Finalization of Candidate Count

1. Calculate Candidate count in each district based on the first choice of examination city.

2. Assume that as per policy district having more than 25 students should have examination centre. District in which students are less than 25, adjust those students to other districts based on their second choices and find the final candidate count of each district.

3. Find out the number of General, SC, ST & OBC candidates and visualize the distribution using a suitable plot identifying ratio of women candidates in each of these categories.

# Stage Two: Preparation of Database

In each examination centre, exam is to be organised in two shifts batch I & batch II(reporting time 9:00 AM & 2 PM). Exam can be conducted any number of days in a city during December 1-30, 2020 depending upon the number of candidate in a city. Note in each city only one examination centre is possible and in one shift maximum 20 students can appear.

4. Based on the information mentioned above complete the examination database by allocating:
# Rollno:
Roll number of the candidate will start from NL2000001 onwards(eg: NL2000001,NL2000002,NL2000003……)
# cent_allot :
allocate centre by putting examination city code o cent_add: put NIELIT <District Name> as center address in each location (for eg if district name is ADI then centre add is NIELIT ADI)
# examDate:
Allocate any exam date between December 1,2020 to December 30, 2020 keeping minimum no of examination days and not violating any conditions mentioned above
# batch:
allocate batch I or II ensuring all the conditions mentioned above
# rep_time:
for batch I reporting time is 9 AM and for batch II reporting time is 2 PM.


text:
ASP.NET Core + Let's Encrypt
============================

HTTPS made easy.

---------------------------

[![Build Status][azdo-badge]][azdo-url] [![Nuget][nuget-badge]][nuget-url]

[azdo-badge]: https://dev.azure.com/natemcmaster/github/_apis/build/status/LetsEncrypt?branchName=master
[azdo-url]: https://dev.azure.com/natemcmaster/github/_build/latest?definitionId=10&branchName=master
[nuget-badge]: https://img.shields.io/nuget/v/McMaster.AspNetCore.LetsEncrypt?color=blue
[nuget-url]: https://nuget.org/packages/McMaster.AspNetCore.LetsEncrypt

[Let's Encrypt](https://letsencrypt.org/) is a free, automated, and open Certificate Authority.
This project provides API for ASP.NET Core projects to use Let's Encrypt.

When enabled, your web server will use the Let's Encrypt certificate authority
and **automatically** generate an HTTPS certificate when the server starts up. It then configures Kestrel to use this certificate for all HTTPs traffic.

> :warning: This only works with [Kestrel](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel), which is the default server configuration for ASP.NET Core projects. Other servers, such as IIS and nginx, are not supported.

> :cloud: Azure App Services (aka WebApps) are not supported with this package. **You can still get free Let's Encrypt certificates**, but it requires a different configuration method. See ["Securing An Azure App Service with Let's Encrypt"](https://www.hanselman.com/blog/SecuringAnAzureAppServiceWebsiteUnderSSLInMinutesWithLetsEncrypt.aspx) by Scott Hanselman for more details.

## Usage

Install this package into your project using NuGet ([see details here][nuget-url]).

The primary API usage is to call `IServiceCollection.AddLetsEncrypt` in the `Startup` class `ConfigureServices` method.

```csharp
using Microsoft.Extensions.DependencyInjection;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddLetsEncrypt();
    }
}
```

A few required options should be set, typically via the appsettings.json file.

```jsonc
// appsettings.json
{
    "LetsEncrypt": {
        // Set this to automatically accept Let's Encrypt's terms of service.
        // If you don't set this in config, you will need to press "y" whenever the application starts
        "AcceptTermsOfService": true,

        // You must at least one domain name
        "DomainNames": [ "example.com", "www.example.com" ],

        // You must specify an email address to register with letsencrypt.org
        "EmailAddress"<EMAIL_ADDRESS>    }
}
```

## Testing in development

See the [developer docs](./CONTRIBUTING.md) for details on how to test Let's Encrypt in a non-production environment.

repository: brockallen/LetsEncrypt

repo_name: brockallen/LetsEncrypt


text:
## Development Guide

Quick installation on ubuntu:

```bash
sudo apt-get install -qqy postgresql-9.4 postgresql-contrib-9.4 curl python
sudo su postgres -c 'createuser -s <you-local-user>'
export PGUSER=<you-local-user>
export DB=test

git clone https://github.com/fhirbase/fhirbase
cd fhirbase
./runme integrate
```

### Project structure

* docs/   - all documentation goes here
* fhir/   - core profiles from FHIR distrib
* perf/   - benchmarks stuf
* schema/ - schema migrations
* src/    - functions source code
* test/   - tests
* ql/     - runme & preprocessor code written in python
* runme*  - utils to work with fhirbase

Code is split into two categories -
schema changing code (migrations in `schema/` directory) and reloadable functions (in `src/`).

To reduce sql boilerplate and modularize application
we use simple SQL preprocessor written in python (in `ql/` directory).

### runme

All tasks for fhirbase could be done using `runme` script in form
```bash
env DB=test ./runme <command> <args>
```

Here is the list of subcomands:

* migrate - migrate DB to latest schema version
* test - run tests on DB
* integrate - drop & create DB, migrate and reload code, then run tests
* load <files-glob> - load module into database if changed
* reload <files-glob> - force load module into database
* compile <file-glob> - preprocess file and send it to STDOUT
* build - integrate database and create dump for distribution

### Pre-processor & Dependency management

PostgreSQL has one-level namespaces - [schemas](http://www.postgresql.org/docs/9.4/static/ddl-schemas.html).
We use schemas to implement code modules, this allow create and reload modules as a whole.
Every file in `src/` is mapped to schema with same name as file.
For example functions defined in `src/fhir.sql` will be in *fhir* schema.

Having modules allows us introduce dependencies between modules.
They implemented as magic comments in source files and using loader (./runme).

For example you have created module a.sql with function `util`. Then you want to
create module b.sql, which depends on module `a`:

```sql
-- file src/b.sql
-- #import ./a.sql

...
  b.util()
...

```

Then you can load module b into databse:

```bash
./runme load src/a.sql
```

Loader read `#import` instructions and resolve dependencies recursively,
then load all modules in right order and write module status into special table `modules`.
Loader also calculate sha1 of module file
content and reload module only if hash changed (caching).
If you run `load` command again without changes in files - it will do nothing.

To reduce sql boilerplate you can use some macro expansions in source files.

#### func and func!

you can write sql functions in python style,
ie body of function should be idented:

```sql
-- FILE: src/coll.sql
func _butlast(_ar_ anyarray) returns anyarray
  SELECT _ar_[array_lower(_ar_,1) : array_upper(_ar_,1) - 1]
```

Preprocessor will produce:

```sql
-- FILE: src/coll.sql
drop schema if exists coll cascade;
create schema coll;
CREATE OR REPLACE
function coll._butlast(_ar_ anyarray) RETURNS anyarray
LANGUAGE sql AS $$
  SELECT _ar_[array_lower(_ar_,1) : array_upper(_ar_,1) - 1] -- coll:3
$$ IMMUTABLE;

```

You can always inspect result of preprocessor by running `./runme compile src/file.sql`.

Here is list of macro expansions:

* func(args) returns type => sql IMMUTABLE function
* func!(args) returns type => sql function
* proc(args) returns type => pg/plsql IMMUTABLE function
* proc!(args) returns type => pg/plsql function
* this => replaced with name of current schema name

### Migrations

To allow update existing fhirbase installation to next version, we track schema changes
using migrations approach - all schema changes are in `schema/` directory and enumerated using
timestamps. When you run `/.runme migrate` all pending migrations will be applied.

### Tests

There are some preprocessor sugar for tests:

```sql
-- one-line test
select 1 => 1

---will be compiled into:

SELECT tests.expect('', 'test/<file>.sql:<line-number>',(select 1),(1));
```

Here is also multiline form (body should be idented):

```sql
expect "Comment"
  select 1
=> 1

-- compiled

SELECT tests.expect('Comment', 'test/<file>.sql:<line-number>',(select 1),(1));
```

To test for exeptions there is special syntax:

```sql
expect_raise 'does not exist'
  SELECT crud.delete('{}'::jsonb, 'Patient', 'nonexisting')

--- compiled

SELECT tests.expect_raise('does not exist', 'test/fhir_crud_spec.sql:151',
($SQL$
  SELECT crud.delete('{}'::jsonb, 'Patient', 'nonexisting') -- fhir_crud_spec:151
$SQL$));
```

Source code of expect functions is in src/tests.sql.

repository: wanghaisheng/fhirbase

gha_language: PLpgSQL

repo_name: wanghaisheng/fhirbase


text:
//[leakcanary-android-core](../../../index.md)/[leakcanary](../index.md)/[BackgroundThreadHeapAnalyzer](index.md)

# BackgroundThreadHeapAnalyzer

[androidJvm]\
object [BackgroundThreadHeapAnalyzer](index.md) : [EventListener](../-event-listener/index.md)

Starts heap analysis on a background [HandlerThread](https://developer.android.com/reference/kotlin/android/os/HandlerThread.html) when receiving a [HeapDump](../-event-listener/-event/-heap-dump/index.md) event.

## Functions

| Name | Summary |
|---|---|
| [onEvent](on-event.md) | [androidJvm]
open override fun [onEvent](on-event.md)(event: [EventListener.Event](../-event-listener/-event/index.md))
[onEvent](on-event.md) is always called from the thread the events are emitted from, which is documented for each event. This enables you to potentially block a chain of events, waiting for some pre work to be done. |

repository: pushpalroy/leakcanary

repo_name: pushpalroy/leakcanary


text:
# Change Log

## 6.3.1

- added install count badges to README

## 6.3.0

- added `vimspired.insertCursorStyle` and `vimspired.normalCursorStyle` settings
- changed insert cursor style to `line` by default

## 6.2.0

- added support for `{command: string, args: {}}`

## 6.1.7

- added my config to README.md

## 6.1.6

- remove undocumented `vimspired.moveDown` and `vimspired.moveUp`

## 5.0.4

- don't upload build files on publish
- https://code.visualstudio.com/api/working-with-extensions/bundling-extension

## 5.0.3

- updated build to webpack

## 5.0.2

- fixed an issue causing cursor to display as underline after opening a
  vertical split

## 5.0.0

- added support for leader key. Example:

```json
{
  "g": { "q": "rewrap.rewrapComment" }
}
```

Pressing `g q` will run the command `rewrap.rewrapComment`.

## 1.0.0

Released on github.

license: Unlicense

repository: onelivesleft/vscode-vimspired

repo_name: onelivesleft/vscode-vimspired


text:
# πεζός, ή, όν.

<!-- Status: S2=NeedsReview -->
<!-- Lexica used for edits: BDAG, LN, FFM, A-S -->

## Word data

* Strongs: G39790.

* Alternate spellings:

* Principle Parts:

* Part of speech:

[Adverb](http://ugg.readthedocs.io/en/latest/adverb.html).

* Instances in the New Testament: 2.

* All Scriptures cited: Yes

## Etymology:

[πούς]()),

* LXX/Hebrew glosses:

* Time Period/Ancient Authors:

* Related words:

* Antonyms for all senses

* Synonyms for all senses:

## Senses:

### Sense  1.0:

#### Definition:

(going) on foot, by land (only adverbial in the New Testament, πεζῇ)

#### Glosses:

on foot, by land

#### Explanation:

only used as an adverb in the New Testament, πεζῇ

#### Citations:

on foot: [Mt 14:13](Mat 14:13) (WH, mg., R, txt.). Opp. to going by sea, by land: [[Mt 14:13](Mat 14:13)](Mat 14:13) (WH, mg., R, mg.). As adv., [πεζῇ]() (sc. [ὁδῷ]()), on foot or by land: [[[Mt 14:13](Mat 14:13)](Mat 14:13)](Mat 14:13) (WH, txt.), [Mk 6:33](Mrk 6:33).†

repository: mandolyte/uw-obsidian

repo_name: mandolyte/uw-obsidian


text:
### What We'll Need

There are just a few things we'll need before we continue.

- a working application
- a build environment - this can be our dev environment
- a hosting environment - this can be our build environment for testing/experimentation

We need to be sure that the architectures for both our build and hosting environments are the same, e.g. 64-bit Linux -> 64-bit Linux. If the architectures don't match, our application might not run when deployed. Using a virtual machine that mirrors our hosting environment as our build environment is an easy way to avoid that problem.

### Goals

Our main goal for this guide is to generate a release, using the [Elixir Release Manager](https://github.com/bitwalker/exrm) (exrm), and deploy it to our hosting environment. Once we have our application running, we will discuss steps needed to make it publicly visible.

## Tasks

Let's separate our release process into a few tasks so we can keep track of where we are.

- Add exrm as a dependency
- Generate a release
- Test it
- Deploy it
- Make it public

## Add exrm as a Dependency

To get started, we'll need to add `{:exrm, "~> 0.14.16"}` into the list of dependencies in our `mix.exs` file.

```elixir
  defp deps do
    [{:phoenix, "~> 0.13"},
     {:phoenix_ecto, "~> 0.4"},
     {:postgrex, ">= 0.0.0"},
     {:phoenix_html, "~> 1.0"},
     {:phoenix_live_reload, "~> 0.4", only: :dev},
     {:cowboy, "~> 1.0"},
     {:exrm, "~> 0.14.16"}]
  end
```
With that taken care of, a simple `mix do deps.get, compile` will pull down exrm and its dependencies, along with the rest of our application's dependencies. It also ensures that everything compiles properly. If all goes well, exrm's mix tasks will be available.

```console
$ mix help
. . .
mix release           # Build a release for the current mix application.
mix release.clean     # Clean up any release-related files.
mix release.plugins   # View information about active release plugins
. . .
```

### Configure Our Applications

Now we need to update our `mix.exs` file to have all production dependencies listed in the `applications` list in the `application/0` function.

```elixir
  def application do
    [mod: {HelloPhoenix, []},
      applications: [:phoenix, :cowboy, :logger, :postgrex, :phoenix_ecto, :phoenix_html]]
  end
```
Doing this helps us overcome one of [exrm's common issues](https://github.com/bitwalker/exrm#common-issues) by helping exrm know about all our dependencies so that it can properly bundle them into our release. Without this, our application will probably alert us about missing modules or a failure to start a child application when we go to run our release.

Even if we list all of our dependencies, our application may still fail. Typically, this happens because one of our dependencies does not properly list its own dependencies. A quick fix for this is to include the missing dependency or dependencies in our list of applications. If this happens to you, and you feel like helping the community, you can create an issue or a pull request to that project's repo.

In versions of Phoenix previous to 0.8.0, we needed to take an extra step of starting our Endpoint (or router for older versions) inside our application's `start/2` function. This is no longer necessary as our Endpoint is registered as a worker which will be started by the Supervisor. We can see this in our `lib/hello_phoenix.ex` file.

```elixir
defmodule HelloPhoenix do
  use Application

  # See http://elixir-lang.org/docs/stable/elixir/Application.html
  # for more information on OTP Applications
  def start(_type, _args) do
    import Supervisor.Spec, warn: false

    children = [
      # Start the endpoint when the application starts
      worker(HelloPhoenix.Endpoint, []),

      # Here you could define other workers and supervisors as children
      # worker(HelloPhoenix.Worker, [arg1, arg2, arg3]),
    ]

    # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
    # for other strategies and supported options
    opts = [strategy: :one_for_one, name: HelloPhoenix.Supervisor]
    Supervisor.start_link(children, opts)
  end

  # Tell Phoenix to update the endpoint configuration
  # whenever the application is updated.
  def config_change(changed, _new, removed) do
    HelloPhoenix.Endpoint.config_change(changed, removed)
    :ok
  end
end
```
Note: Just to be extra clear, this file is named after our application. If we had called it `MyApp`, this file would be `lib/my_app.ex`.

There's one last thing we need to do before we create our release. We need to configure our Endpoint to act as a server in `config.exs`.

```elixir
# Configures the endpoint
config :hello_phoenix, HelloPhoenix.Endpoint,
url: [host: "localhost"],
secret_key_base: "OOmSQ22Liduec/twplfKrEseNL2m7ivMK32ywKECyhckgQVLtBCxS3cMusKD2v8f",
debug_errors: false,
server: true
```
When we run `$ mix phoenix.server` to start our application, that mix task automatically sets the server parameter to true. When we're creating a release, however, we need to make sure that we have this manually configured. If you get through this release guide, and you aren't seeing any pages coming from your server, this is a likely culprit.

### Generating the Release

Now that we've configured our application, let's build our release by running `mix release` at the root of our application.

```console
$ mix release
==> Building release with MIX_ENV=dev.
==> Generating relx configuration...
==> Generating sys.config...
==> Generating boot script...
==> Performing protocol consolidation...
==> Conform: Loading schema...
==> Conform: No schema found, conform will not be packaged in this release!
==> Generating release...
==> Generating nodetool...
==> Packaging release...
==> The release for hello_phoenix-0.0.1 is ready!
```
There are a couple of interesting things to note here.
- Since we didn't specify a `MIX_ENV` value, we got `dev` by default. Right now, we're experimenting. If we were doing a real release, we would want to specify `MIX_ENV=prod` when we run `mix release`.

- We see our application's version number - `0.0.1`. This value comes from the application's `mix.exs` file. It is mapped to the `:version` key inside the `project/0` function.

- Exrm has created a `rel` directory at the root of our application where it has written everything related to this release.

Exrm uses a set of default configuration options when building our release that will work for most applications. If we need more advanced configuration options, we can checkout [exrm's configuration section](https://github.com/bitwalker/exrm#configuration) for more detailed information.

If we make a mistake, or if something doesn't go quite right, we can run `mix release.clean`, which will delete the release for the current application version number. If we add the `--implode` flag, expm will remove _all_ releases for all versions of our application. These will be permanently removed unless they are under version control. Obviously, this is a destructive operation, and expm will prompt us to make sure we want to continue.

#### Contents of a Release

Exrm has created our release, and put it somewhere in the `rel` directory, but where exactly did all the pieces end up?

Everything related to our releases is in the `rel/hello_phoenix` directory. Let's see what's in it.

```console
$ ls -la rel/hello_phoenix/
total 21064
drwxr-xr-x   7 lance  staff       238 Jan  4 14:16 .
drwxr-xr-x   3 lance  staff       102 Jan  4 14:16 ..
drwxr-xr-x   6 lance  staff       204 Jan  4 14:16 bin
drwxr-xr-x   6 lance  staff       204 Jan  4 14:16 erts-6.3
-rw-r--r--   1 lance  staff  10784459 Jan  4 14:16 hello_phoenix-0.0.1.tar.gz
drwxr-xr-x  19 lance  staff       646 Jan  4 14:16 lib
drwxr-xr-x   5 lance  staff       170 Jan  4 14:16 releases
```

The `bin` directory contains the generated executables for running our application. The `bin/hello_phoenix` executable is what we will use to issue commands to our application.

```console
$ ls -la rel/hello_phoenix/bin
total 80
drwxr-xr-x  6 lance  staff    204 Jan  4 14:16 .
drwxr-xr-x  7 lance  staff    238 Jan  4 14:16 ..
-rwxr-xr-x  1 lance  staff  13499 Jan  4 14:16 hello_phoenix
-rw-r--r--  1 lance  staff   4400 Jan  4 14:16 install_upgrade.escript
-rwxr-xr-x  1 lance  staff   5373 Jan  4 14:16 nodetool
-r--r--r--  1 lance  admin   5283 Dec 12 07:45 start_clean.boot
```

The `erts-6.3` directory contains all necessary files for the Erlang run-time system, pulled from our build environment.

```console
$ ls -la rel/hello_phoenix/erts-6.3/
total 0
drwxr-xr-x   6 lance  staff  204 Jan  4 14:16 .
drwxr-xr-x   7 lance  staff  238 Jan  4 14:16 ..
drwxr-xr-x  24 lance  staff  816 Jan  4 14:16 bin
drwxr-xr-x  12 lance  staff  408 Jan  4 14:16 include
drwxr-xr-x   5 lance  staff  170 Jan  4 14:16 lib
drwxr-xr-x   3 lance  staff  102 Jan  4 14:16 src
```

The `lib` directory contains the compiled BEAM files for our application and all of our dependencies. This is where all of our work goes.

```console
$ ls -la rel/hello_phoenix/lib/
total 0
drwxr-xr-x  19 lance  staff  646 Jan 16 16:03 .
drwxr-xr-x   7 lance  staff  238 Jan 16 16:04 ..
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 compiler-5.0
drwxr-xr-x  13 lance  staff  442 Jan 16 16:03 consolidated
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 cowboy-1.0.0
drwxr-xr-x   4 lance  staff  136 Jan 16 16:03 cowlib-1.0.1
drwxr-xr-x   4 lance  staff  136 Jan 16 16:03 crypto-3.3
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 elixir-1.0.2
drwxr-xr-x   4 lance  staff  136 Jan 16 16:03 hello_phoenix-0.0.1
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 iex-1.0.2
drwxr-xr-x   4 lance  staff  136 Jan 16 16:03 kernel-3.0
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 logger-1.0.2
drwxr-xr-x   4 lance  staff  136 Jan 16 16:03 phoenix-0.10.0
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 plug-0.11.1
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 poison-1.3.0
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 ranch-1.0.0
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 sasl-2.4
drwxr-xr-x   4 lance  staff  136 Jan 16 16:03 stdlib-2.0
drwxr-xr-x   3 lance  staff  102 Jan 16 16:03 syntax_tools-1.6.14
```

The `releases` directory is the home for our releases - any release-dependent configurations and scripts that exrm finds necessary for running our application. If we have multiple versions of our application, and if we have created releases for them, we will have multiple releases in the `releases` directory.

```console
$ ls -la rel/hello_phoenix/releases/
total 16
drwxr-xr-x  5 lance  staff  170 Jan  4 14:16 .
drwxr-xr-x  7 lance  staff  238 Jan  4 14:16 ..
drwxr-xr-x  8 lance  staff  272 Jan  4 14:16 0.0.1
-rw-r--r--  1 lance  staff  875 Jan  4 14:16 RELEASES
-rw-r--r--  1 lance  staff    9 Jan  4 14:16 start_erl.data
```

The `hello_phoenix-0.0.1.tar.gz` tarball is our release in archive form, ready to be shipped off to our hosting environment.

### Testing Our Release

Before deploying our release, we should make sure that it runs in our build environment. To do that, we will issue the `console` command to our executable, essentially running our application via `iex`.

```console
$ rel/hello_phoenix/bin/hello_phoenix console
Exec: /Users/lance/work/hello_phoenix/rel/hello_phoenix/erts-6.0/bin/erlexec -boot /Users/lance/work/hello_phoenix/rel/hello_phoenix/releases/0.0.1/hello_phoenix -boot_var ERTS_LIB_DIR /Users/lance/work/hello_phoenix/rel/hello_phoenix/erts-6.0/../lib -env ERL_LIBS /Users/lance/work/hello_phoenix/rel/hello_phoenix/lib -config /Users/lance/work/hello_phoenix/rel/hello_phoenix/releases/0.0.1/sys.config -pa /Users/lance/work/hello_phoenix/rel/hello_phoenix/lib/consolidated -args_file /Users/lance/work/hello_phoenix/rel/hello_phoenix/releases/0.0.1/vm.args -user Elixir.IEx.CLI -extra --no-halt +iex -- console
Root: /Users/lance/work/hello_phoenix/rel/hello_phoenix
/Users/lance/work/hello_phoenix/rel/hello_phoenix
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

[debug] Running HelloPhoenix.Endpoint with Cowboy on port 4000 (http)
Interactive Elixir (1.0.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(hello_phoenix@<IP_ADDRESS>)1>

```
This is the point where our application will crash if it fails to start a child application. If all goes well, however, we should end up at an `iex` prompt. We should also see our app running at [http://localhost:4000/](http://localhost:4000/).

Let's hit `ctrl-c` twice to get out of iex so that we can explore a couple of different ways to interact with our release.

One thing we can do is start the release without a console session. Let's try running the `start` command.

```console
$ rel/hello_phoenix/bin/hello_phoenix start
```
And we see . . . nothing except that our prompt comes right back. This is ok!

We can check to make sure that it is really ok by pinging the release.

```console
$ rel/hello_phoenix/bin/hello_phoenix ping
pong
```
Great, it's responding.

Now let's try connecting a console to the running release with the `remote_console` command.

```console
$ rel/hello_phoenix/bin/hello_phoenix remote_console
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Interactive Elixir (1.0.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(hello_phoenix@<IP_ADDRESS>)1>
```
That worked. At this point, we can run any commands we might normally run in a console session.

Ok, let's get out of this session by hitting `ctrl-c` twice again. What happens if we ping the release again?

```console
$ rel/hello_phoenix/bin/hello_phoenix ping
pong
```
It's still alive and responding. This is a feature! If the server were to go down every time we stopped a remote console, that would be a problem. Note that this situation is different from when we ran the `console` command above. The `remote_console` command is not intended to start a release locally, but rather to connect to one which has already started.

So how _do_ we stop the server, then? There are two ways.

One way is to simply issue the `stop` command.

```console
$ rel/hello_phoenix/bin/hello_phoenix stop
ok
```
That looks promising. What happens if we ping the server again?

```console
$ rel/hello_phoenix/bin/hello_phoenix ping
Node<EMAIL_ADDRESS>not responding to pings.
```
Success.

Ok, let's re-start our release and establish a remote console to try the other way of stopping it.

```console
$ rel/hello_phoenix/bin/hello_phoenix start
$ rel/hello_phoenix/bin/hello_phoenix remote_console
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Interactive Elixir (1.0.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(hello_phoenix@<IP_ADDRESS>)1>
```
Great. Now at the prompt, let's issue this command `:init.stop`.

```console
iex(hello_phoenix@<IP_ADDRESS>)1> :init.stop
:ok
```
Then let's hit `ctrl-c` twice again to exit our iex session and ping the server to see if it responds.

```console
$ rel/hello_phoenix/bin/hello_phoenix ping
Node<EMAIL_ADDRESS>not responding to pings.
```
As we expected, the server is now down.

Congratulations! Now that we've interacted a bit with our release locally, we're ready to deploy our application!

## Deploying Our Release

There are many ways for us to get our tarballed release to our hosting environment. In our example, we'll use SCP to upload to a remote server.

```console
$ scp -i ~/.ssh/id_rsa.pub rel/hello_phoenix-0.0.1.tar.gz ubuntu@hostname.com:/home/ubuntu
hello_phoenix-0.0.1.tar.gz                100%   18MB  80.0KB/s   03:48
```
Let's SSH into that environment to set our application up.

```console
$ ssh -i ~/.ssh/id_rsa.pub<EMAIL_ADDRESS>$ sudo mkdir -p /app
$ sudo chown ubuntu:ubuntu /app
$ cd /app
$ tar xfz /home/ubuntu/hello_phoenix-0.0.1.tar.gz
```

## Making Our Application Public

We're getting close.

### Setting Up Our Init System

First step in exposing our application to the world is ensuring that our application will start running in case of a system restart - expected or unexpected. To do this, we will need to create an init script for our hosting environment's init system, be it `systemd`, `upstart`, or whatever.

Let's use `upstart` as an example. We'll edit our init script with `sudo vi /etc/init/my_app.conf` (this is on Ubuntu Linux).

```text
description "hello_phoenix"

## Uncomment the following two lines to run the
## application as www-data:www-data
#setuid www-data
#setgid www-data

start on runlevel [2345]
stop on runlevel [016]

expect stop
respawn

env MIX_ENV=prod
env PORT=8888
export MIX_ENV
export PORT

pre-start exec /bin/sh /app/bin/hello_phoenix start

post-stop exec /bin/sh /app/bin/hello_phoenix stop
```

Here, we've told `upstart` a few basic things about how we want it to handle our application. If you need to know how to do something in particular, take a look at the [`upstart` cookbook](http://upstart.ubuntu.com/cookbook/) for loads of information on it. We'll kick off the first start of our application with `sudo start hello_phoenix`.

One key point to notice is that we're instructing `upstart` to run our release's `bin/hello_phoenix start` command, which boostraps our application and runs it as a daemon.

### Setting Up Our Web Server

In a lot of cases, we're going to have more than one application running in our hosting environment, all of which might need to be accessible on port 80. Since only one application can listen on a single port at a time, we need to use something to proxy our application. Typically, Apache (with `mod_proxy` enabled) or nginx is used for this, and we'll be setting up nginx in this case.

Let's create our config file for our application. By default, everything in `/etc/nginx/sites-enabled` is included into the main `/etc/nginx/nginx.conf` file that is used to configure nginx's runtime environment. Standard practice is to create our file in `/etc/nginx/sites-available` and make a symbolic link to it in `/etc/nginx/sites-enabled`.

Note: These points hold true for Apache as well, but the steps to accomplish them are slightly different.

```console
$ sudo touch /etc/nginx/sites-available/hello_phoenix
$ sudo ln -s /etc/nginx/sites-available/hello_phoenix /etc/nginx/sites-enabled
$ sudo vi /etc/nginx/sites-available/hello_phoenix
```

These are the contents of our `/etc/nginx/sites-available/hello_phoenix` file.

```nginx
upstream hello_phoenix {
    server <IP_ADDRESS>:8888;
}
server{
    listen 80;
    server_name .hostname.com;

    location / {
        try_files $uri @proxy;
    }

    location @proxy {
        include proxy_params;
        proxy_redirect off;
        proxy_pass http://hello_phoenix;
    }
}
```

Like our `upstart` script, this nginx config is basic. Look to the [nginx wiki](http://wiki.nginx.org/Main) for steps to configure any more involved features. Restart nginx with `sudo service nginx restart` to load our new config.

At this point, we should be able to see our application if we visit `http://hostname.com/` if everything has been successful up to this point.

gha_language: CSS


text:
# Angular 2 Browserify Starter

An Angular 2 starter application using Browserify for bundling

## Installation

  Clone this repo

  Install the dependencies

  	npm install

  Build the app

  	npm start

  Navigate to http://localhost:8080 in your browser


text:
# ## Description

This test cleans up pods via a label assignment named `cleanup.kyverno.io/ttl: 10s`.

## Expected Behavior

The pod `test-pod` is cleaned up successfully after 10s.

## Reference Issue(s)

repository: kyverno/kyverno

repo_name: kyverno/kyverno


text:
---
layout: post
title: "Counting in ElasticSearch"
date: 2013-09-11 15:48
comments: true
author: mbazydlo
categories: [ElasticSearch, Count, Search, PlainElastic.Net]
---

> Counting is the religion of this generation it is its hope and its salvation.
> Gertrude Stein

In our NeverEnding quest to provide better experience to the users we utilise user behaviour logs to influence future results. One particular case is restaurant popularity, which is indicated by many factors, for example how often it is searched and viewed.

In this blog post we will look into multiple ways of counting documents in Elastic Search which is crucial for this kind of activity. All examples here are provided using Elastic Search HTTP interface and code examples implemented with [PlainElastic.NET](https://github.com/Yegoroff/PlainElastic.Net) are [available here](https://gist.github.com/gondar/6320578)

Before we make a deep dive into Elastic Search Counting options let's define our expectations:
```
So that I can order restaurants by those that are most searched
As a potential diner
I want the most searched statistics from the logs to be part of the search database
```
Okay, that's not exactly how our story was defined but as we don't want to discuss the whole search infrastructure here, let's assume this is sufficient.

Because we are eager engineers, we will quickly build some mock data against which to test our assumptions. Our restaurant name search logs look something like this:
```
{
	"RestaurantId" : 2,
	"RestaurantName" : "Restaurant Brian",
	"DateTime" : "2013-08-16T15:13:47.4833748+01:00"
}
```
So we will populate our mock database with appropriate commands and check that all is in place:
```
curl http://localhost:9200/store/item/ -XPOST -d '{"RestaurantId":2,"RestaurantName":"Restaurant Brian","DateTime":"2013-08-16T15:13:47.4833748+01:00"}'
curl http://localhost:9200/store/item/ -XPOST -d '{"RestaurantId":1,"RestaurantName":"Restaurant Cecil","DateTime":"2013-08-16T15:13:47.4833748+01:00"}'
curl http://localhost:9200/store/item/ -XPOST -d '{"RestaurantId":1,"RestaurantName":"Restaurant Cecil","DateTime":"2013-08-16T15:13:47.4833748+01:00"}'
curl http://localhost:9200/store/item/_search?q=*\&pretty
```
Our expected output is a count of documents for each restaurant. For example:
```
{
	"Restaurant Brian" : 1
	"Restaurant Cecil" : 2
}
```
There are three ways this can be achieved in Elastic Search; using count API (which seems like the most obvious way), a search with type set to count, or using facets to generate counts of all objects grouped by given property. Let's compare them:
### Count API ###
([See documentation here](http://www.elasticsearch.org/guide/reference/api/count/))
```
curl -XPOST http://localhost:9200/store/item/_count -d '{
	"field": {
		"RestaurantName": {
			"query": "Restaurant Cecil",
			"default_operator": "AND"
		}
	}
}'
{
	"count":2,
	"_shards":{"total":5,"successful":5,"failed":0}
}
```
Count is nice little feature which solves our problem. However, if we need count for multiple restaurants we need to execute similar queries multiple times, which may hugely influence both performance of our query and usage of our ElasticSeach cluster.
### Search ###
([See documentation here](http://www.elasticsearch.org/guide/reference/api/search/search-type/))
```
curl -XPOST http://localhost:9200/store/item/_search?search_type=count -d ' {
	"query": {
		"field": {
			"RestaurantName": {
				"query": "Restaurant Cecil",
				"default_operator": "AND"
			}
		}
	}
}'
{
	"took":5,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},
	"hits": {
		"total": 2,
		"max_score": 0.0,
		"hits":[]
	}
}
```
Using search type set to count is the same as executing a search request with size set to zero, but it's internally optimised for performance. The nice thing about search is that we can use multi_search interface to execute many count queries at once.

On the other hand, the query still will be executed multiple times, so it is only feasible if we want to get popularity for a small subset of all the restaurants we have.

Comparing two previous requests highlights that the query language is slightly different. The DSL for _count API_ is basically the same as for the _search API_, but you are immediately inside the 'query' part. That inconsistency on the ElasticSearch side is only a minor inconvenience.
### Facets ###
([See documentation here](http://www.elasticsearch.org/guide/reference/api/search/facets/))

```
curl -XPOST http://localhost:9200/store/item/_search?search_type=count -d '
{
	"query": {
		"match_all": {

		}
	},
	"facets": {
		"ItemsPerCategoryCount": {
			"terms": {
				"field": "RestaurantId",
				"size": 100
			}
		}
	}
}'
{
	"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":132,"max_score":0.0,"hits":[]},
	"facets": {
		"ItemsPerCategoryCount": {
			"_type": "terms",
			"missing":0,
			"total":3,
			"other":0,
			"terms": [
				{"term": 2, "count": 1},
				{"term": 1, "count":2}
			]
		}
	}
}
```

Facets is a means to obtain grouping by a given field together with count in a group. It is designed to ease creation of filters which are often naturally part of search results interface.

This is nice feature which grabs for us all counts grouped by given field. That's more then we need if we only care for a count of single type, but it's invaluable if you want to have counts for all terms in a field. Also note that we are using search type count again, but facets work equally well for all types of searches including those which actually return results.

In the example above we used 'RestaurantId' field instead of restaurant name, as this field is not analysed. If we used restaurant name it would give us facets for each term e.g. [{"term": "Restaurant", "count": 3}, {"term":"Cecil", "count":2},{"term":"Brian", "count":1}], which is not what we exactly want.

### Conclusion ###
It's hard to discuss which one is better. Count API is slightly faster then Search of type count. On the other hand search is more flexible, and its queries are consistent with normal search queries. Facets is a different beast altogether as it always grabs all the results. Still, it's fun that ElasticSearch is elastic in this aspect giving us variety of approaches.

We are really curious about your experiences in ElasticSearch. If you have any questions, proposals or comments feel free to [email me](mailto:mbazydlo@opentable.com).

### Acknowledgement ###
This blog post benefited thanks to invaluable comments from my team (Andrew Metcalfe, Michael Wallett and Tom Harvey), [PlainElastic.Net](https://github.com/Yegoroff/PlainElastic.Net) author (Yegoroff) and [my brother](https://github.com/pbazydlo).

repository: opentable/octopress

extension: markdown

gha_language: HTML

repo_name: opentable/octopress


text:
## v2.0.2 Bugfix release (2017-09-25)
### Bugfixes
* Fixed faulty functional test configuration
* Removed dev branch request for FluidTYPO3 extensions
* Fixed faulty database initialization

## v2.0.1 Maintenance release (2017-01-05)
### Enhancements
* Added fragments directory to provider extension

### Bugfixes
* Exported lib directory

## v2.0.0 TYPO3 8 / New toolchain
* Complete toolchain refactoring
* Switch to Gulp, PostCSS, extension based development
* [Fractal](https://github.com/tollwerk/fractal-typo3) support (component library)
* [shortbread](https://github.com/jkphl/shortbread)

## v1.0.0 TYPO3 7 / Symlink installation release
* Last / only release for symlink installations (tested with TYPO3 7 only)

repository: tollwerk/generator-tollwerk

repo_name: tollwerk/generator-tollwerk