text:
# jibrel-contracts-jsapi

web3 wrapper for jibrel-contracts

[Exhaustive API description](https://jibrelnetwork.github.io/jibrel-contracts-jsapi/)

  * [jibrel-contracts-jsapi](#jibrel-contracts-jsapi)
    * [About](#about)
    * [Get Started](#get-started)
      * [Available npm scripts](#available-npm-scripts)
    * [Public API definitions](#public-api-definitions)
      * [ETH](#eth-api)
      * [ERC20](#erc20-api)
      * [ERC20Mintable](#erc20mintable-api)
      * [ERC20Named](#erc20named-api)
      * [Controller](#controller-api)
      * [getAddressFromPrivateKey](#getaddressfromprivatekeyprivatekey)
    * [Testing](#testing)
      * [Steps to launch tests from jibrel-contracts](#steps-to-launch-tests-from-jibrel-contracts)

## About

jibrel-contracts-jsapi is a set of stateless methods that make easier work with Ethereum blockchain, ERC20 Tokens and Jibrel Network contracts.

## Get Started

```
npm install @jibrelnetwork/contracts-jsapi
```

```javascript
const jibrelContractsJsapi = require('@jibrelnetwork/contracts-jsapi')
```

### Available npm scripts:

  * `compile:standalone`: build:standalone & minify
  * `compile`: lint & build
  * `clean`: cleans `./lib` dir
  * `build`: cleans & compiles library
  * `build:standalone`: builds standalone webpack bundle to test library in browser without including it somewhere
  * `lint`: check code-style errors
  * `minify`: minifies webpack standalone bundle
  * `test`: runs mocha tests
  * `docs`: compile jsdocs
  * `docs:open`: open docs index.html

## Public API definitions

See [mocha tests](https://github.com/jibrelnetwork/jibrel-contracts-jsapi/tree/master/test) for examples of usage

### `ETH` API

web3.eth functions wrapper

#### eth.sendTransaction(props)

Sends transaction. Returns Promise that will be resolved with the hash of created transaction.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * privateKey: Private key (64 hex symbols, without '0x' prefix)
  * to: Address of the transaction receiver
  * value: Transaction value
  * gasLimit: (optional) Gas limit for the transaction
  * gasPrice: (optional) Gas price for the transaction
  * nonce: (optional) Nonce for the transaction
  * data: (optional) Transaction data
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getBalance(props)

Returns Promise that will be resolved with balance of the provided address.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * address: Address to check balance
  * defaultBlock: (optional) Redefines of web3.eth.defaultBlock
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getBlockNumber(props)

Returns Promise that will be resolved with current block number.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getBlock(props)

Returns Promise that will be resolved with block data.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * blockId: (optional) Block number or hash. Or the string "earliest"/"latest"/"pending"
  * returnTransactionObjects: (optional) Return all transactions as objects if true
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getTransaction(props)

Returns Promise that will be resolved with transaction data.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * transactionHash: Transaction hash
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getTransactionReceipt(props)

Returns Promise that will be resolved with transaction receipt.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * transactionHash: Transaction hash
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getLogsFilter(props)

Returns Promise that will be resolved with filter object, that can be used for getting of past logs or watching of new.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * options: (optional) Event options
    * fromBlock: (optional) The number of the earliest block
    * toBlock: (optional) The number of the latest block
    * address: (optional) An address(es) to get logs from
    * topics: (optional) Allows to manually set the topics for the event filter
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getPastLogs(props)

Returns Promise that will be resolved with past logs.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * options: (optional) Event options
    * fromBlock: (optional) The number of the earliest block
    * toBlock: (optional) The number of the latest block
    * address: (optional) An address(es) to get logs from
    * topics: (optional) Allows to manually set the topics for the event filter
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.estimateGas(props)

Returns Promise that will be resolved with estimate gas value.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * to: Address of the transaction receiver
  * value: Transaction value
  * data: (optional) Transaction data
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getGasPrice(props)

Returns Promise that will be resolved with current gas price value.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * ssl: (optional) Defines using of ssl for connection or not

#### eth.getNonce(props)

Returns Promise that will be resolved with current transaction count value for address specified

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * ssl: (optional) Defines using of ssl for connection or not
  * address: Address to get transaction count
  * defaultBlock: (optional) Redefines of web3.eth.defaultBlock

### `ERC20` API

#### contracts.erc20.totalSupply(props)

Returns Promise that will be resolved with the total supply of tokens.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * ssl: (optional) Defines using of ssl for connection or not

#### contracts.erc20.balanceOf(props)

Returns Promise that will be resolved with the balance of owner address

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * owner: Address to check balance
  * ssl: (optional) Defines using of ssl for connection or not

#### contracts.erc20.transfer(props)

Transfers tokens. Returns Promise that will be resolved with the hash of created contract transaction

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * privateKey: Private key (64 hex symbols, without '0x' prefix)
  * to: Address of the transaction receiver
  * value: Transaction value
  * gasLimit: (optional) Gas limit for the transaction
  * gasPrice: (optional) Gas price for the transaction
  * nonce: (optional) Nonce for the transaction
  * ssl: (optional) Defines using of ssl for connection or not

#### contracts.erc20.allEvents(props)

Subscribes to all contract events. Returns Promise that will be resolved with the event emitter.

The event emitter has the following events:
  * `data`: Fires on each incoming event with the event object as argument
  * `error`: Fires when an error in the subscription occours

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * options: (optional) Event options
    * filter: (optional) Filter options by indexed event parameters
    * fromBlock: (optional) The number of the earliest block
    * toBlock: (optional) The number of the latest block
    * address: (optional) An address(es) to get logs from
    * topics: (optional) Allows to manually set the topics for the event filter
  * callback: (optional) Callback which fired for each event or error
  * ssl: (optional) Defines using of ssl for connection or not

#### contracts.erc20.Transfer(props)

Subscribes to Transfer event. Returns Promise that will be resolved with the event emitter (the same as for [allEvents](#contractserc20alleventsprops)).

##### props

The same as for [allEvents](#props-6)

#### contracts.erc20.getPastEvents(props)

Returns Promise that will be resolved with the past event logs.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * event: optional Event name
  * options: (optional) The same options as for [allEvents](#props-6)
  * ssl: (optional) Defines using of ssl for connection or not

#### contracts.erc20.estimateGas(props)

Returns Promise that will be resolved with estimate gas value.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * from: Transaction sender address
  * method: Method name
  * args: Method arguments
  * ssl: (optional) Defines using of ssl for connection or not

### `ERC20Mintable` API

#### contracts.erc20Mintable.allEvents(props)

See [contracts.erc20.allEvents](#contractserc20alleventsprops)

#### contracts.erc20Mintable.MintEvent(props)

Subscribes to MintEvent event. Returns Promise that will be resolved with the event emitter (the same as for [allEvents](#contractserc20mintablealleventsprops)).

#### contracts.erc20Mintable.BurnEvent(props)

Subscribes to BurnEvent event. Returns Promise that will be resolved with the event emitter (the same as for [allEvents](#contractserc20mintablealleventsprops)).

#### contracts.erc20Mintable.getPastEvents(props)

See [contracts.erc20.getPastEvents](#contractserc20getpasteventsprops)

### `ERC20Named` API

#### contracts.erc20Named.name(props)

Returns Promise that will be resolved with the token name.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * ssl: (optional) Defines using of ssl for connection or not

#### contracts.erc20Named.symbol(props)

Returns Promise that will be resolved with the token symbol.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * ssl: (optional) Defines using of ssl for connection or not

#### contracts.erc20Named.decimals(props)

Returns Promise that will be resolved with token decimals.

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * ssl: (optional) Defines using of ssl for connection or not

### `Controller` API

#### contracts.controller.mint(props)

Mint tokens. Returns Promise that will be resolved with the hash of created contract transaction

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * privateKey: Private key (64 hex symbols, without '0x' prefix)
  * account: Address of account to mint tokens to
  * value: Transaction value
  * gasLimit: (optional) Gas limit for the transaction
  * gasPrice: (optional) Gas price for the transaction
  * nonce: (optional) Nonce for the transaction
  * ssl: (optional) Defines using of ssl for connection or not

#### contracts.controller.burn(props)

Burn tokens. Returns Promise that will be resolved with the hash of created contract transaction

##### props

  * rpcaddr: RPC address of Ethereum node to connect on
  * rpcport: RPC port of Ethereum node to connect on
  * contractAddress: Contract address
  * privateKey: Private key (64 hex symbols, without '0x' prefix)
  * account: Address of account to burn tokens from
  * value: Transaction value
  * gasLimit: (optional) Gas limit for the transaction
  * gasPrice: (optional) Gas price for the transaction
  * nonce: (optional) Nonce for the transaction
  * ssl: (optional) Defines using of ssl for connection or not

### getAddressFromPrivateKey(privateKey)

Gets account's address from its private key.

  * privateKey: Private key (64 hex symbols, without '0x' prefix)

## Testing

Testrpc should be launched before tests.
Also `JSON_PATH` env variable should exists. `JSON_PATH` stores path to .json file, that contains:

  * account addresses
  * private keys
  * contract addresses

The simplest way to `test` - is launch jibrel-contracts tests. During tests execution it will check that jibrel-contracts-jsapi project is in the same dir, and will agregate all need information and write it to .json file.

repository: jibrelnetwork/jibrel-contracts-jsapi

repo_name: jibrelnetwork/jibrel-contracts-jsapi


text:
# Image Processing Pipeline - GKE

In this sample, we'll build an image processing pipeline to connect Google Cloud
Storage events to various services with **Events with Cloud Run on GKE**.

![Image Processing Pipeline](./images/image-processing-pipeline-gke.png)

1. An image is saved to an input Cloud Storage bucket.
2. Cloud Storage update event is read into Cloud Run via `CloudStorageSource`.
3. Filter service receives the Cloud Storage event. It uses Vision API to
   determine if the image is safe. If so, it creates a custom `CloudEvent` of
   type `dev.knative.samples.fileuploaded` and passes it onwards.
4. Resizer service receives the `fileuploaded` event, resizes the image using
   [ImageSharp](https://github.com/SixLabors/ImageSharp) library, saves to the
   resized image to the output bucket, creates a custom `CloudEvent` of type
   `dev.knative.samples.fileresized` and passes the event onwards.
5. Watermark service receives the `fileresized` event, adds a watermark to the
   image using [ImageSharp](https://github.com/SixLabors/ImageSharp) library and
   saves the image to the output bucket.
6. Labeler receives the `fileuploaded` event, extracts labels of the image with
   Vision API and saves the labels to the output bucket.

## Prerequisites

Events for Cloud Run is currently private alpha. We're assuming that you already
have your project white listed
[here](https://sites.google.com/corp/view/eventsforcloudrun), read the [Complete
User
Guide](https://docs.google.com/document/d/16UHFfDQJlpFb1WsrPZ-DYEP8_HcLbbRPK1ScACXct6U/edit)
for `Events for Cloud Run - GKE` and setup a GKE cluster with Cloud Run Events
installed as described in the guide.

If everything is setup correctly, you should see pods running in
`cloud-run-events` and `knative-eventing` namespaces and a `Broker` in the
default namespace:

```bash
kubectl get pods -n cloud-run-events
kubectl get pods -n knative-eventing
kubectl get broker
```

You should also set some variables to hold your cluster name and zone. For
example:

```bash
export CLUSTER_NAME=events-cluster
export CLUSTER_ZONE=europe-west1-b

gcloud config set run/cluster ${CLUSTER_NAME}
gcloud config set run/cluster_location ${CLUSTER_ZONE}
gcloud config set run/platform gke
```

## Create storage buckets

Create 2 unique storage buckets to save pre and post processed images:

```bash
export BUCKET1="$(gcloud config get-value core/project)-images-input"
export BUCKET2="$(gcloud config get-value core/project)-images-output"
gsutil mb -p $(gcloud config get-value project) \
   -l $(gcloud config get-value run/region) \
   gs://${BUCKET1}
gsutil mb -p $(gcloud config get-value project) \
   -l $(gcloud config get-value run/region) \
   gs://${BUCKET2}
```

## Enable Vision API

Some services use Vision API. Make sure the Vision API is enabled:

```bash
gcloud services enable vision.googleapis.com
```

## Filter

This service receives Cloud Storage events for saved images. It uses Vision API
to determine if the image is safe. If so, it passes a custom event onwards.

### Service

The code of the service is in
[filter](https://github.com/meteatamel/knative-tutorial/tree/master/eventing/processing-pipelines/image/filter)
folder.

Inside the top level
[processing-pipelines](https://github.com/meteatamel/knative-tutorial/tree/master/eventing/processing-pipelines)
folder, build and push the container image:

```bash
export SERVICE_NAME=filter
docker build -t gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1 -f image/${SERVICE_NAME}/csharp/Dockerfile .
docker push gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1
```

Deploy the service:

```bash
gcloud run deploy ${SERVICE_NAME} \
  --image gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1 \
  --update-env-vars BUCKET=${BUCKET1}
```

### Trigger

The trigger of the service filters on Cloud Storage finalize events:
`com.google.cloud.storage.object.finalize`.

Create the trigger:

```bash
gcloud alpha events triggers create trigger-${SERVICE_NAME} \
--target-service=${SERVICE_NAME} \
--type=com.google.cloud.storage.object.finalize \
--parameters bucket=${BUCKET1}
```

## Resizer

This service receives the custom event, resizes the image using
[ImageSharp](https://github.com/SixLabors/ImageSharp) library and passes the
event onwards.

### Service

The code of the service is in [resizer](https://github.com/meteatamel/knative-tutorial/tree/master/eventing/processing-pipelines/image/resizer)
folder.

Inside the top level
[processing-pipelines](.https://github.com/meteatamel/knative-tutorial/tree/master/eventing/processing-pipelines)
folder, build and push the container image:

```bash
export SERVICE_NAME=resizer
docker build -t gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1 -f image/${SERVICE_NAME}/csharp/Dockerfile .
docker push gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1
```

Deploy the service:

```bash
gcloud run deploy ${SERVICE_NAME} \
  --image gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1 \
  --update-env-vars BUCKET=${BUCKET2}
```

### Trigger

The trigger of the service filters on `dev.knative.samples.fileuploaded` event
types which is the custom event type emitted by the filter service.

Create the trigger:

```bash
gcloud alpha events triggers create trigger-${SERVICE_NAME} \
--target-service ${SERVICE_NAME} \
--type=dev.knative.samples.fileuploaded \
--custom-type
```

## Watermark

This service receives the event, adds the watermark to the image using
[ImageSharp](https://github.com/SixLabors/ImageSharp) library and saves the
image to the output bucket.

### Service

The code of the service is in [watermarker](https://github.com/meteatamel/knative-tutorial/tree/master/eventing/processing-pipelines/image/watermarker)
folder.

Inside the top level
[processing-pipelines](.https://github.com/meteatamel/knative-tutorial/tree/master/eventing/processing-pipelines)
folder, build and push the container image:

```bash
export SERVICE_NAME=watermarker
docker build -t gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1 -f image/${SERVICE_NAME}/csharp/Dockerfile .
docker push gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1
```

Deploy the service:

```bash
gcloud run deploy ${SERVICE_NAME} \
  --image gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1 \
  --update-env-vars BUCKET=${BUCKET2}
```

### Trigger

The trigger of the service filters on `dev.knative.samples.fileresized` event
types which is the custom event type emitted by the resizer service.

Create the trigger:

```bash
gcloud alpha events triggers create trigger-${SERVICE_NAME} \
--target-service=${SERVICE_NAME} \
--type=dev.knative.samples.fileresized \
--custom-type
```

## Labeler

Labeler receives the event, extracts labels of the image with Vision API and
saves the labels to the output bucket.

### Service

The code of the service is in [labeler](https://github.com/meteatamel/knative-tutorial/tree/master/eventing/processing-pipelines/image/labeler)
folder.

Inside the top level
[processing-pipelines](.https://github.com/meteatamel/knative-tutorial/tree/master/eventing/processing-pipelines)
folder, build and push the container image:

```bash
export SERVICE_NAME=labeler
docker build -t gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1 -f image/${SERVICE_NAME}/csharp/Dockerfile .
docker push gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1
```

Deploy the service:

```bash
gcloud run deploy ${SERVICE_NAME} \
  --image gcr.io/$(gcloud config get-value project)/${SERVICE_NAME}:v1 \
  --update-env-vars BUCKET=${BUCKET2}
```

### Trigger

The trigger of the service filters on `dev.knative.samples.fileuploaded` event
types which is the custom event type emitted by the filter service.

Create the trigger:

```bash
gcloud alpha events triggers create trigger-${SERVICE_NAME} \
--target-service ${SERVICE_NAME} \
--type=dev.knative.samples.fileuploaded \
--custom-type
```

## Test the pipeline

Before testing the pipeline, make sure all the triggers are ready:

```bash
gcloud alpha events triggers list

   TRIGGER              EVENT TYPE                                TARGET
✔  trigger-filter       com.google.cloud.storage.object.finalize  filter
✔  trigger-labeler      dev.knative.samples.fileuploaded          labeler
✔  trigger-resizer      dev.knative.samples.fileuploaded          resizer
✔  trigger-watermarker  dev.knative.samples.fileresized           watermarker
```

You can upload an image to the input storage bucket:

```bash
gsutil cp ../pictures/beach.jpg gs://${BUCKET1}
```

After a minute or so, you should see resized, watermarked and labelled image in
the output bucket:

```bash
gsutil ls gs://${BUCKET2}

gs://events-atamel-images-output/beach-400x400-watermark.jpeg
gs://events-atamel-images-output/beach-400x400.png
gs://events-atamel-images-output/beach-labels.txt
```

repository: usernum-gcp/cloudrun-tutorial

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: usernum-gcp/cloudrun-tutorial


text:
# The OGU analysis

The notion of "**OGU**" (**operational genomic unit**) is the minimal unit for community ecology studies based on shotgun metagenome or other forms of whole-genome microbiome data. OGUs are simply the reference genomes to which input sequences are aligned. There is no need to assign taxonomy to them. This is in contrast to conventional practices, in which analyses are based on taxonomic units such as genera or species. In this sense, OGU is analogous to ASV in 16S rRNA studies.

The advantages of using OGUs include:

1. Highest-possible resolution.
2. Independent from taxonomy, which is coarse and can be error-prone as a classification system.
3. Allowing for phylogeny-aware analyses such as Faith's PD and UniFrac. This is enhanced by our "Web of Life" ([WoL](https://biocore.github.io/wol/)) reference phylogeny, or any similar works.

The OGU analysis was explained, benchmarked and discussed in:

- Zhu Q, Huang S, Gonzalez A, McGrath I, McDonald M, Haiminen N, Armstrong G, et al. [Phylogeny-aware analysis of metagenome community ecology based on matched reference genomes while bypassing taxonomy.](https://journals.asm.org/doi/10.1128/msystems.00167-22) _mSystems_. 2022. e00167-22.

## Contents

- [OGU table generation](#ogu-table-generation)
- [OGU analysis using QIIME 2](#ogu-analysis-using-qiime-2)
- [Alignment ambiguity](#alignment-ambiguity)
- [Custom alignment](#custom-alignment)

## OGU table generation

To generate an OGU table, one needs a multiplexed alignment file, or a directory of per-sample alignment files. These files can be generated by aligning sequencing data against a reference genome database. For example:

```bash
while read $id; do
  bowtie2 --very-sensitive -p 8 -x $db -1 $id.R1.fq -2 $id.R2.fq -S bt2out/$id.sam
done < sample.list
```

Here are details about using our [WoL database](wol.md) and using [Bowtie2](align.md#alignment-with-bowtie2) for alignment.

Then one can run Woltka to convert the alignment file(s) into an OGU table:

```bash
woltka classify -i bt2out -o table.biom
```

The output file `table.biom` is a BIOM table with rows as genome IDs (OGUs), columns as sample IDs, and cell values as counts of OGUs in individual samples.

If needed, you may convert a BIOM table into a tab-delimited file:

```bash
biom convert --to-tsv -i table.biom -o table.tsv
```

Note: [**Qiita**](https://qiita.ucsd.edu/) implements the WoL database and a Woltka workflow, which performs sequence alignment using the [SHOGUN protocol](align.md#the-shogun-protocol). If you are a Qiita user, the alignment file as well as the OGU table (called a "per-genome" table) can be automatically generated and downloaded from the Qiita interface. See [details](qiita.md).

## OGU analysis using QIIME 2

The generated BIOM table can be imported into a QIIME artifact:

```bash
qiime tools import --type FeatureTable[Frequency] --input-path table.biom --output-path table.qza
```

These intermediate steps are automated if you use the [QIIME 2 plugin of Woltka](woltka/q2).

One can then investigate the microbiome by applying classical QIIME analyses on the OGU table. For example, with the [WoL reference phylogeny](https://biocore.github.io/wol/) (direct download link: [tree.qza](https://biocore.github.io/wol/data/trees/tree.qza)), one can do:

```bash
qiime diversity core-metrics-phylogenetic \
  --i-phylogeny tree.qza \
  --i-table table.qza \
  --p-sampling-depth 10000 \
  --m-metadata-file metadata.tsv \
  --output-dir .
```

Most (if not all) QIIME 2 analyses designed for 16S rRNA data (ASV or OTU) also apply to OGUs. Please refer to the [QIIME 2 documentation](https://docs.qiime2.org/) for tutorials and references.

## Alignment ambiguity

It is quite common that one query sequence can be aligned to multiple reference genomes. Bowtie2 by default reports one hit per query. The [SHOGUN protocol](align.md#the-shogun-protocol) reports up to 16 hits. Other programs and protocols have their own ways of dealing with multiple hits.

In such cases, Woltka by default counts each OGU as 1 / _k_, where _k_ is the total number of matching genomes.

Alternatively, one may choose to discard all non-unique matches, by adding a flag:

```bash
woltka classify --uniq -i input_dir -o output.biom
```

## Custom alignment

Technically, one can use any sequence aligners and reference genome databases to generate alignment files, which can then be converted into an OGU table. We cannot validate the goodness of outcome, but understand that you may have this intention considering the consistency with existing parts of your analytical pipeline. For examples:

```bash
bwa mem refseq.fna input.R1.fq input.R2.fq > output.sam
```

```bash
blastn -db refseq_genomes -query input.fa -max_target_seqs 16 -outfmt 6 -out output.txt
```

In multiple reference genome databases, subject sequences are individual nucleotide sequences (e.g., chromosomes or scaffolds) instead of whole genomes. In order to produce OGUs, one needs to supply Woltka with a sequence-to-genome mapping file (`nucl2g.txt`, example provided under [`taxonomy/nucl`](woltka/tests/data/taxonomy/nucl)):

```bash
woltka classify -m nucl2g.txt -i input_dir -o output.biom
```

## OGUs from ORFs

In some scenarios you may have a profile of genes, or ORFs (open reading frames), denoted as e.g. "G000123456_789" (meaning the 789th ORF of genome G000123456). This can be generated using Woltka's "coord-match" functional classification (see [details](ordinal.md)), or through sequence alignment against genes (instead of genomes) (see [details](align.md)). You can extract genome IDs (i.e., OGUs) from ORF IDs using the [`collapse`](collapse.md) command:

```bash
woltka collapse -i orf.biom -e -f 1 -o ogu.biom
```

- In this command, `-e` means that feature IDs are nested (such as the current case); `-f 1` extracts the first field in the feature IDs.

Note however, that the resulting OGU table _is not identical to_ that generated from the [standard method](#ogu-table-generation). This is because gene-based methods automatically miss out [intergenic regions](https://en.wikipedia.org/wiki/Intergenic_region), which are usually insignificant in microbial genomes, but can still make a difference.

When should you use this approach? For certain data types, such as [metatranscriptomic data](https://en.wikipedia.org/wiki/Metatranscriptomics), which are naturally mRNA-derived, the gene-based approach may be more justified (although you still miss out unannotated genes and [non-coding transcripts](https://en.wikipedia.org/wiki/Non-coding_RNA)). You will need to decide based on the study goals.

Another more common scenario is when you want to perform a structural/functional stratification analysis. You start with ORFs, and care what these genes do and which source organisms they are from. See [details](stratify.md) about stratification.

repository: qiyunzhu/woltka

gha_language: Python

repo_name: qiyunzhu/woltka


text:
# Tutorial 10: How to use FastEstimator Command Line Interface (CLI)

## Overview
FastEstimator comes with a set of CLI commands that can help users train and test their models quickly. In this tutorial, we will go through the CLI usage and the arguments these CLI commands take. This tutorial is divided into the following sections:

* [How Does the CLI Work](#t10intro)
* [CLI Usage](#t10usage)
* [Sending Input Args to `get_estimator`](#t10args)
  * [Using --arg](#t10arg)
  * [Using a JSON file](#t10json)
  * [System argument](#t10system)

## How Does the CLI Work
* `fastestimator train`: the command will look for a `get_estimator` function, invoke it, and then call the `fit()` method on the returned estimator instance to start the training.
* `fastestimator test`: the command will look for a `get_estimator` function, invoke it, and then call the `test()` method on the returned estimator instance to run testing.
* `fastestimator run`: the command will look for a `fastestimator_run` function and invoke it. If `fastestimator_run` is not available, it will instead look for `get_estimator`, invoke it, and then call `fit()` and/ or `test` depending on what data is available within the estimator's Pipeline.

###

## CLI Usage
In this section we will show the actual commands that we can use to train and test our models. We will use [mnist_tf.py](https://github.com/fastestimator/fastestimator/blob/master/apphub/image_classification/mnist/mnist_tf.py) for illustration.

To call `estimator.fit()` and start the training on terminal:

``` bash
$ fastestimator train mnist_tf.py
```

To call `estimator.test()` and start testing on terminal:

``` bash
$ fastestimator test mnist_tf.py
```

To first call `estimator.fit()` then `estimator.test()`, you can use:
``` bash
$ fastestimator run mnist_tf.py
```

## Sending Input Args to `get_estimator` or `fastestimator_run`
We can also pass arguments to the `get_estimator` or `fastestimator_run` functions from the CLI. The following code snippet shows the `get_estimator` method for our MNIST example:
```python
def get_estimator(epochs=2, batch_size=32, ...):
    ...
```

Next, we try to change these arguments in two ways:

### Using --arg
To pass the arguments directly from the CLI we can use the `--arg` format. The following shows an example of how we can set the number of epochs to 3 and batch_size to 64:

``` bash
$ fastestimator train mnist_tf.py --epochs 3 --batch_size 64
```

### Using a JSON file
The other way we can send arguments is by using the `--hyperparameters` argument and passing it a json file containing all the training hyperparameters like epochs, batch_size, optimizer, etc. This option is really useful when you want to repeat the training job more than once and/or the list of the hyperparameter is getting really long. The following shows an example JSON file and how it could be used for our MNIST example:
``` json
{
    "epochs": 1,
    "batch_size": 64
}
```
``` bash
$ fastestimator train mnist_tf.py --hyperparameters hp.json
```

### System argument
There are some default system arguments in the `fastestimator train`, `fastestimator test`, and `fastestimator run` commands. Here are a list of them:

* __warmup__:   Available in `train` and `run`, it controls whether to perform warmup checking before the actual training starts. Default is True. Users can disable warmup by `--warmup False`. Disabling it can reduce the initialization time needed to start the training.
* __eager__: Available in `train`, `test`, and `run`. This argument is only relevant if using tensorflow backend. Enabling eager execution will allow user to access the value of the tf tensor at run time. The default is False, user can enable it by `--eager True`. The eager mode is useful in tensorflow debugging workflows. However, there are several downsides of eager execution such as less speed and more memory usage.
* __summary__: Available in `train`, `test`, and `run`. This is the same `summary` argument used in `estimator.fit(summary=...)` or `estimator.test(summary=...)`. It allows users to specify experiment name when generating reports. For example, Users can set experiment name by `--summary exp_name`.

repository: fastestimator/fastestimator

gha_language: Jupyter Notebook

repo_name: fastestimator/fastestimator


text:
### [CVE-2017-14723](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14723)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

Before version 4.8.2, WordPress mishandled % characters and additional placeholder values in $wpdb->prepare, and thus did not properly address the possibility of plugins and themes enabling SQL injection attacks.

### POC

#### Reference
- https://medium.com/websec/wordpress-sqli-poc-f1827c20bf8e

#### Github
- https://github.com/ARPSyndicate/cvemon
- https://github.com/Afetter618/WordPress-PenTest
- https://github.com/Byebyesky/IT-Security-Projekt
- https://github.com/CeCe2018/Codepath
- https://github.com/CeCe2018/Codepath-Week-7-Alternative-Assignment-Essay
- https://github.com/Tanvi20/Week-7-Alternative-Assignment-wp-cve

license: MIT

repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

gha_license_id: MIT

repo_name: trickest/cve


text:
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.0] - 2019-09-06
### Added
- Newsletter subscribe/unsubscribe (client) Routing
- Image attach to products

### Fixed
- Image-upload multiple/resized

## [0.4.0] - 2019-09-05
### Added
- EJS/CRUD/DB for designers
- EJS/CSS/Route for product single-view
- EJS/CSS/Routing contact-form
- Admin EJS/CSS/Routing contact-form

## [0.3.0] - 2019-09-04
### Added
- CSS header/nav/main/aside/footer
- EJS searchoptions on products

### Fixed
- Admin/products EJS/Controller to furnitures specifications

## [0.2.0] - 2019-09-03
### Added
- Routes for admin/articles create/list/edit
- Views for admin/articles create/list/edit
- Controllers for admin/articles CRUD
- CSS mobile
- Added aside.ejs + main-header.ejs

### Fixed
- Products - view

## [0.1.0] - 2019-09-02
### Added
- Codebase
- Articles/opening hours - SQL
- Changelog/README

### Fixed
- Products - SQL

repository: lillelarsen/cmk-furnitures

repo_name: lillelarsen/cmk-furnitures


text:
# Jbuilder

Jbuilder is a simple command-line utility which just runs
any Jenkins job, view will be like this:

![terminal demo](assets/demo.gif)

## Installation

```
    brew tap gocruncher/tap
    brew install jb
```

## Quick start

### Configure Access to Multiple Jenkins.

No authorization:
```
    jb set dev_jenkins --url "https://myjenkins.com" --login admin --token 11aa0926784999dab5
```

With authorization:
```
    jb set dev_jenkins --url "https://myjenkins.com" --login admin --token 11aa0926784999dab5
```

where the token is available in your personal configuration page of the Jenkins. Click your name on the top right corner on every page, then click "Configure" to see your API token. (The URL $root/me/configure is a good shortcut.) You can also change your API token from here.

### Enabling shell autocompletion

you can enable shell autocompletion for convenient work. To do this, run following:
```
   # for zsh completion:
   echo 'source <(jb completion zsh)' >>~/.zshrc

   # for bash completion:
   echo 'source <(jb completion bash)' >>~/.bashrc
```
if this does not work for some reason, try following command that might help you to figure out what is wrong
```
    jb completion check
```

### Usage
```
    jb run backend-app #run backend-app job in the current Jenkis

    jb -n PROD #run frontent #run frontend job in the PROD Jenkins

    jb use PROD #makes a specific Jenkins name by default
```

## Futures
- cancellation job (^C key)
- resize of the output (just press enter key)
- output of child jobs

## Useful packages
- [cobra](https://github.com/spf13/cobra) - library for creating powerful modern CLI
- [chalk](https://github.com/chalk/chalk) – Terminal string styling done right
- [bar](https://github.com/superhawk610/bar) - Flexible ascii progress bar.

## Todos
- add authorization by login/pass and through the RSA key
- support of a terminal window resizing

repository: alekseymerzlyakov/jbuilder

repo_name: alekseymerzlyakov/jbuilder


text:
# Possible

Because anything is possible.... A monad-like object that may possibly have a value, or possibly some sort or error.

## NOTE

Under development... not ready for prime time.

## Example

to be written...

## Installation

```
npm install possible
```

## Release History
  * 2014-11-22			v0.1.0			Initial release.

repository: Zhami/possible

repo_name: Zhami/possible


text:
# Map-first preprocessing

DITA-OT 3.0 provides a map-first preprocessing option as an alternative to the default `preprocess` operation. The method, which was introduced in DITA-OT 2.5 as an experimental feature, has been improved and is ready for use in many production scenarios. Map-first-preprocessing provides the same functionality as the default `preprocess`, but takes a different approach.

Whereas the default preprocessing routine handles both maps and topics at the same time, often switching back and forth between map operations and topic operations, the map-first approach only begins processing topics after nearly all map processing is complete. This simplifies the processing logic and creates cleaner module responsibilities, which makes it easier to process only those topics that are actually referenced after filtering, for example, or to only process the map to validate the map structure.

The current preprocessing architecture was established during the DITA 1.0 era when there were fewer DITA features that operated on the map level. Initially, the difference between processing modes was not that great. DITA 1.2 and 1.3 introduced many more map-level features, such as keys and key scopes, that make it difficult to reliably work with topics before all map features have been resolved.

The original preprocessing operation already handles many map operations first, but this was not the original design and requires regular refactoring to handle edge cases. The new map-first preprocessing is designed with this model in mind, improving the overall processing flow and making it more formal about the map-first model. The new model also takes advantage of hashed topic file names in the temporary directory, which simplifies many processing steps, and is better able to handle topics referenced outside of the map directory \(that case has resulted in a variety of issues with the original model\).

**Note:** The map-first preprocessing option is enabled by default in DITA-OT 3.0 for PDF and HTML Help. These formats were chosen because they generate a compiled result file, so temporarily hashed file names should all be invisible to the build. After further testing and feedback, the new option will most likely become the default for other output formats in future versions. Because the DITA-OT development team cannot have access to all varieties of DITA, all edge cases, or even all the ways DITA-OT itself is extended, the switch to default map-first preprocessing for other output formats will be smoother for everyone if more people can test and provide feedback.

## How to use map-first preprocessing

To use \(or test\) map-first preprocessing, call the `preprocess2` Ant target in your custom transformation types instead of using the default `preprocess` target.

For example, if you have a custom HTML5 transformation type named "myhtml", then you may have a plug-in extension that looks this:

```language-xml
<!-- Simple variant: set properties and call default HTML5 -->
<target name="dita2myhtml" depends="myhtml.init,dita2html5"/>

```

This type of extension is quite common, and is used to set default properties for your environment followed by a normal build to use those properties. In this case, you'll need to replace `dita2html5` with the normal HTML5 steps, swapping out `preprocess` for `preprocess2`:

```
<!-- Simple variant: set properties and call default HTML5 -->
<target name="dita2myhtml"
        depends="myhtml.init,
                 html5.init,
                 build-init,
                 **preprocess2,**
                 html5.topic,
                 html5.map,
                 html5.css"/>
```

**Note:** If you use this simple method for customized PDF or HTML Help builds, you will automatically be using `preprocess2`.

Some custom transformation types already require you to repeat the default dependencies, in which case you should already call `preprocess` directly, as in the following:

```
<!-- More complex variant: add processing steps to default HTML5 -->
<target name="dita2myhtml"
        depends="myhtml.init,
                 build-init,
                 preprocess,
                 local-extensions-after-preprocess,
                 html5.topic,
                 html5.map,
                 html5.css"/>
```

In such cases, the modification is much easier – simply add a `2` to the existing `preprocess` target.

## How to test in a production environment

In some cases, you may be responsible for maintaining transformation types that are actually run by many people on your team or around a company. In this case, you likely need to maintain your existing transformation types based on the backwards-compatible `preprocess` modules, but also want to provide your colleagues with a way to test their own documents using `preprocess2`.

There are several ways to do this. One fairly straightforward approach would be to create a new custom transformation type that is exactly the same, except for preprocessing. For example, if you have a local HTML variant called `myhtml` as above, instead of modifying that transformation directly, you could create a second transformation type called `myhtml-beta` that provides exactly the same support, but with the new map-first preprocessing:

```
*<!-- Original "myhtml" is not modified, used for production -->*
<target name="dita2myhtml5" depends="myhtml.init,dita2html5"/>

*<!-- "myhtml-beta" used to test and provide feedback on preprocess2 -->*
<target name="dita2myhtml-beta"
        depends="myhtml.init,
                 html5.init,
                 build-init,
                 **preprocess2,**
                 html5.topic,
                 html5.map,
                 html5.css"/>
```

## Known limitations

The `preprocess2` implementation details are subject to change; dependencies within `preprocess2` may be renamed or removed based on feedback.

The internal extension points that run before or after individual steps in the original `preprocess` pipeline \(`preprocess.*.pre/preprocess.*.post`\) are not available in the newer map-first preprocessing pipeline \(`preprocess2`\), which is used in the PDF and HTML Help transformations as of DITA-OT 3.0.

**Related information**

[We shall call it preprocess2](https://www.oxygenxml.com/events/2017/dita-ot_day.html#preprocess_2)

repository: infotexture/ot-docs-mdbook

repo_name: infotexture/ot-docs-mdbook


text:
# Semantic Types

This is the demo code from my presentation *Typing from back to front* on the [Hamburg .NET Usergroup on the 2. March 2016](http://www.meetup.com/Hamburg-C-Net-Meetup/events/227288536/). We have been 41 people in total and it was a great night! Thanks everyone for coming!

## About

Semantic types are value types which are given a semantic meaning.

Let's take this simply method for example:

```csharp
public Passenger GetPax(int paxId) {..}
```

This seems pretty clear and straightforward, but it has slight issues. Mainly: What prevents us from providing a wrong id? For example somewhere else we have a `int orderId`, which we now pass to the method.

*What? We're allowed to do this? THIS IS MADNESS! In what world is an order Id a passenger id?*

This of course is slightly exaggerated, but it has a valid point: Why are we allowed to do this? Why doesn't the compiler stop us? Because for the compiler there is no difference, both are integers. Nothing more. But of course we know this already.

We can solve this issue by creating a wrapper type, which wraps an integer.

## How to create a semantic type

Let's take the example from before and create a `PaxId` wrapper type, which wraps the `int` value.

```csharp
public struct PaxId
{
    // Mutable?!
    public int Value { get; set; }
}
```

This is the very first primitive approach, but it has a heavy drawback: The `int` was an immutable type, whereas this code is mutable. So let's adjust this drawback:

```csharp
public struct PaxId
{
    // Constructor that accepts the value.
    public PaxId(int value)
    {
        _value = value;
    }

    // Returns the internally stored value.
    public int Value { get { return _value; } }

    // Readonly, so it won't be changed!
    private readonly int _value;
}
```

By providing a constructor and storing the value in a readonly field we made this value immutable. We have the rule that passenger numbers are always equal or larger than 0. We can even inforce this step in the constructor now!

```csharp
    // Constructor that verifies the value is valid.
    public PaxId(int value)
    {
        if (value < 0)
            throw new ArgumentException("The value must be larger or equal than 0!", nameof(value));

        _value = value;
    }
```

Next step is comparison: Usually we want to compare the types, so we need to override a method and introduce a few more methods.

```csharp
public struct PaxId
{
    public PaxId(int value)
    {
        if (value < 0)
            throw new ArgumentException("The value must be larger or equal than 0!", nameof(value));

        _value = value;
    }

    public int Value { get { return _value; } }

    private readonly int _value;

    // Provide a equals method that operates on the type we introduce.
    // No need to check for null as this is a struct that can't be null.
    public bool Equals(PaxId other) => _value == other._value;

    // Define the comparison operators.
    public static bool operator==(PaxId first, PaxId second) => first.Equals(second);
    public static bool operator!=(PaxId first, PaxId second) => !(first == second);

    // Override the equals method of the base class (object).
    public override bool Equals(object obj)
    {
        if (obj == null || obj.GetType() != typeof(PaxId))
            return false;

        var otherPaxId = (PaxId)obj;
        return Equals(otherPaxId);
    }
}
```

Wow, this gets qite big already. A lot of boilerplate code - but let's not focus on this for now.

Very often we have the need to have an "undefined" or "not-set" state of the field. With `int` we'd usually make it *nullable* and just use `int?`. Of course we could do this too with semantic types, but there's a better option: Use a *nullable* backing field, and use a default value for comparison:

```csharp
public struct PaxId
{
    public PaxId(int value)
    {
        if (value < 0)
            throw new ArgumentException("The value must be larger or equal than 0!", nameof(value));

        _value = value;
    }

    // Since the backing field is now nullable,
    // we return an "invalid" value when the backing field is null.
    // The invalid value is -1, since this can't be passed to the constructor.
    public int Value { get { return _value ?? -1; } }

    // Make the backing field nullable.
    private readonly int? _value;

    public bool Equals(PaxId other) => _value == other._value;
    public static bool operator==(PaxId first, PaxId second) => first.Equals(second);
    public static bool operator!=(PaxId first, PaxId second) => !(first == second);

    public override bool Equals(object obj)
    {
        if (obj == null || obj.GetType() != typeof(PaxId))
            return false;

        var otherPaxId = (PaxId)obj;
        return Equals(otherPaxId);
    }

    // Define a default value for comparisons.
    // Always equals default(PaxId), the uninitialized state.
    public static readonly PaxId Default = default(PaxId);
}
```

Now we can have simply compare the value and see if it was defined (the constructor was used with a correct value), or if it was uninitialized:

```csharp
new PaxId(1) == new PaxId(1)    // true
new PaxId(0) == new PaxId(0)    // true
new PaxId() == PaxId.Default    // true
default(PaxId) == PaxId.Default // true
new PaxId(1) == new PaxId(0)    // false
new PaxId(1) == new PaxId()     // false
new PaxId(1) == default(PaxId)  // false
new PaxId(1) == PaxId.Default   // false
```

Lastly, because we want to print the value type as a regular `int` and use it in dictionaries, we also should override `GetHashCode` and `ToString`:

```csharp
public struct PaxId
{
    public PaxId(int value)
    {
        if (value < 0)
            throw new ArgumentException("The value must be larger or equal than 0!", nameof(value));

        _value = value;
    }

    public int Value { get { return _value ?? -1; } }

    private readonly int? _value;

    public bool Equals(PaxId other) => _value == other._value;
    public static bool operator==(PaxId first, PaxId second) => first.Equals(second);
    public static bool operator!=(PaxId first, PaxId second) => !(first == second);

    public override bool Equals(object obj)
    {
        if (obj == null || obj.GetType() != typeof(PaxId))
            return false;

        var otherPaxId = (PaxId)obj;
        return Equals(otherPaxId);
    }

    public static readonly PaxId Default = default(PaxId);

    // If no value is set, use 0 instead.
    public override int GetHashCode() => _value?.GetHashCode() ?? 0;

    // Just print the value. The check for the null value is done in the property.
    public override string ToString() => Value.ToString();
}
```

## Advantages

That is **a lot** of code! What do we gain from this?

### Not mixable types

We have an explicit difference between a `OrderId` and a `PaxId`. Methods accepting a `PaxId` can't accidentally receive a `OrderId` as an argument.

### More expressive code
Our code is a lot more expressive. At work I had a case where we had a `SsrCode`, and a `SsrGroupCode`. Both values are 4 letter upper-case strings, sometimes even the same value. It was very easy to mix those two. In one case we needed to map the `SsrCode` to it's matching `SsrGroupCode`, for which we created a dictionary:

```csharp
var ssrGroupCodeToSsrGroupCodeMapping = new Dictionary<string, string>();
...
// ssrGroupCodeToSsrGroupCodeMapping[ <accepts a string> ]
```

That's... not nice to read. By introducing a `SsrCode` and `SsrGroupCode` semantic type we could improve the readability a lot:

```csharp
var mapping = new Dictionary<SsrCode, SsrGroupCode>();
...
// mapping[ <accepts a SsrCode> ]
```

### Backing field defined in one place

Let's assume we later switch, for whatever reasons, the value of the `PaxId` from `int` to `string`. If we use value types we only have to change the type in one place. Neat-o!

## Boilerplate vs magic

The introduction of semantic types takes a lot of boiler plate code, that is given. The code above is completely undocumented and it already takes plenty of lines. But we can easily make this nicer to read by using the magic that snippets are, functionality of most editors like Visual Studio.

![Snippet demonstration](doc/snippet-demo.gif)

## Updated C# 7.3 version

Here is an updated version of the code utilizing C# 7.3 features.

```csharp
public readonly struct PaxId : IEquatable<PaxId>
{
    public PaxId(int value)
    {
        if (value < 0)
            throw new ArgumentException("The value must be larger or equal than 0!", nameof(value));

        _value = value;
    }

    public static readonly PaxId Default = default(PaxId);

    public int Value => _value ?? -1;

    private readonly int? _value;

    public override bool Equals(object obj) => obj is PaxId && Equals((PaxId)obj);
    public bool Equals(PaxId other) => _value == other._value;
    public static bool operator ==(PaxId first, PaxId second) => first.Equals(second);
    public static bool operator !=(PaxId first, PaxId second) => !(first == second);

    public override int GetHashCode() => _value?.GetHashCode() ?? 0;
    public override string ToString() => Value.ToString();
}
```

## Questions

Got any question? Feel free to send me a message anywhere. I'm happy to help and answer any question.

repository: MartinJohns/SemanticTypes

repo_name: MartinJohns/SemanticTypes


text:
Yii 2 - AMQP Queue
==================

Brought to you by [dmftaras](http://dmftaras.com).

## Installation

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist dmftaras/amqp-queue "*"
```

or add the following line to the require section of your `composer.json` file:

```
"dmftaras/amqp-queue": "*"
```

## Requirements

Yii 2 and above.
PHP AMQPlib

## Usage

Once the extension is installed, set your configuration in common config file:

```php
    'components' => [
        'master_queue' => [
            'class' => \dmftaras\amqp_queue\Queue::class,
            'exchange_name' => 'master.tasks',
            'queue_name' => 'master.tasks',
            'routing_key' => 'master.tasks'
        ],
    ],
```

Add component to bootstrap section:

```php
    'bootstrap' => [
        'master_queue'
    ],
```

Add job to the queue

```php
\Yii::$app->test_queue->push(new TestJob([
    'property' => 'value'
]));
```

To consume queue
```
php yii test-queue/listen
```

## License

Code released under [MIT License](LICENSE).


text:
![Build](https://github.com/palkan/influxer/workflows/Build/badge.svg)

# Influxer

Influxer provides an ActiveRecord-style way to work with [InfluxDB](https://influxdb.com/) with many useful features, such as:

## Installation

Adding to a gem:

```ruby
# my-cool-gem.gemspec
Gem::Specification.new do |spec|
  # ...
  spec.add_dependency "influxer", ">= 1.2.0"
  # ...
end
```

Or adding to your project:

```ruby
# Gemfile
gem "influxer", "~> 1.2"
```

## Usage

### Metrics classes

To query InfluxDB or write to it, you should define a metrics class first. Each metrics class represents a measurement/series (or multiple related measurements):

```ruby
class VisitsMetrics < Influxer::Metrics
  # Define tags...
  tags :account_id, :page_id
  # ...and attributes
  attributes :user_id, :browser
end
```

### Querying

Now you can use your metrics classes in a similar way to Active Record models to build queries. For example:

```ruby
VisitsMetrics.select(:account_id, :user_id).where(page_id: /^home\/.*/)
```

Influxer provides special query methods for dealing with time series:

- Group by time: `Metrics.time(:hour) => # select * ... group by time(1h)`.
- Select only points for the last hour/minute/whatever: `Metrics.past(:day) => # select * ... where time > now() - 1d`.
- Select only points since the specified time: `Metrics.since(Time.utc(2014,12,31)) => # select * ... where time ><PHONE_NUMBER>s`.
- and more.

See [our Wiki](https://github.com/palkan/influxer/wiki/Query-methods) for more.

### Scopes support

You can define scopes to re-use query conditions:

```ruby
class Metrics < Influxer::Metrics
  tags :account_id
  attributes :value

  default_scope -> { time(:hour).limit(1000) }

  scope :unlimited, -> { limit(nil) }
  scope :by_account, ->(id) { where(account_id: id) if id.present? }
end

Metrics.by_account(1)
# => select * from "metrics" group by time(1h) where account_id=1 limit 1000

Metrics.unlimited.by_account(1).time(:week)
# => select * from "metrics" group by time(1w) where account_id=1
```

### Active Record integration

You can association metrics with Active Record models:

```ruby
class UserVisits < Influxer::Metrics
end

class User < ActiveRecord::Base
  has_metrics :visits
end

user = User.find(1)
user.visits.write(page_id: "home")
#=> < creates point {user_id: 1, page_id: 'home'} in 'user_visits' series >

user.visits.where(page_id: "home")
#=> select * from user_visits where page_id='home'
```

Find more on [Wiki](https://github.com/palkan/influxer/wiki/ActiveRecord-integration).

## Contributing

Bug reports and pull requests are welcome on GitHub at [https://github.com/palkan/influxer](https://github.com/palkan/influxer).

## License

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

repository: palkan/influxer

gha_language: Ruby

repo_name: palkan/influxer


text:
# Installing AndroidAPS

## Install git (if you don't have it)
* Any git version should work. For example https://git-scm.com/download/win
* Let Studio know where is git.exe located: File - Settings - Version Control - Git
![](images/git.png)

## Update your local copy
* Click: VCS->Git->Fetch

## Selecting branch
* If you want to change branch select another branch from tray: master (latest release) or dev (developement version)

![](images/branchintray.png)

and then checkout

![](images/checkout.png)

## Updating branch from Github
* Press Ctrl+T, select Merge method and press OK

![](images/merge.png)

On the tray you'll see green message about updated project

## Upload to phone
* Connect phone now
* Press "Play" button on top toolbar

![](images/play.png)

* Select connected phone and press OK

![](images/connectedphone.png)

repository: roppenheimer/AndroidAPSdocs

repo_name: roppenheimer/AndroidAPSdocs


text:
# Swift Windows Switcher

## Catalina Users

Make sure that Alfred is added to "Security & Privacy -> Screen Recording".
The context on why that is needed is [here](https://github.com/mandrigin/AlfredSwitchWindows/issues/31).

![](/catalina.png)

## * * *

My little "weekend" project.
Alfred workflow to switch between open windows in the system and Safari tabs.

![](/demo_concise.gif)

## Features
- Switch between the open windows using Alfred
- Switch between the Safari tabs using Alfred
- Very quick comparing to the alternative implementations because of the native search implementation.

## Releases

You can download the ready-to-use `.workflow` files from [the releases page](https://github.com/mandrigin/AlfredSwitchWindows/releases).

## Source code

You can start exploring the source code at [main.swift](EnumWindows/main.swift)

### `ScriptingBridge` in Swift

It turns out, that `ScriptingBridge` implementation is not fully compatible with Swift.

(Classes like `SafariApplication` are not imported, so we can't use them).

One of the possible solutions to this issue is demonstrated in [BrowserApplication.swift](EnumWindows/BrowserApplication.swift)
(used for both Safari and Chrome automation)

**UPD:** There is a better solution using `optional` protocol methods:
```swift
@objc fileprivate enum PlayerState: NSInteger {
    case stopped = 0x6b505353
    case playing = 0x6b505350
    case paused = 0x6b505370
    case fastForwarding = 0x6b505346
    case rewinding = 0x6b505352
};

@objc fileprivate protocol iTunesBridge {
    @objc optional var isRunning: Bool { get }
    @objc optional var playerState: PlayerState { get }
    @objc optional func pause() -> Void
}

extension SBApplication: iTunesBridge{}

guard let app = SBApplication(bundleIdentifier: "com.apple.iTunes") as? iTunesBridge else {
   return
}

let isPlaying = app.playerState == .playing

NSLog("isPlaying: \(isPlaying)")
```

## License

Copyright 2017 © Igor Mandrigin

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

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

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

repository: mandrigin/AlfredSwitchWindows

gha_language: Swift

repo_name: mandrigin/AlfredSwitchWindows


text:
---
template: SinglePost
title: What It's like being with an ISTJ as an ENTP
status: Published
date: '2018-11-04'
featuredImage: /images/sddefault-1.jpg
categories:
  - category: Video Notes
  - category: ENTP
  - category: ISTJ

excerpt: >-
  This video is about What It's like being with an ISTJ as an ENTP. Alll the frustrations, the good points, and how you can make it work.
meta:
  description: >-
    This video is about What It's like being with an ISTJ as an ENTP. Alll the frustrations, the good points, and how you can make it work.
  title: ISTJ and ENTP

---

<iframe width="560" height="315"
src="https://www.youtube.com/embed/t-qLuF_qs-c" frameborder="0"
allow="autoplay; encrypted-media" allowfullscreen></iframe>.

In this post I want to talk about what it's been like for both me and my partner in our relationship, the positives, the negatives, and the frustrations.

My partner Felipe (ISTJ) was instantly drawn to me due to my NeTi. He thought I was extremely rare and was lit up by what I liked to think and talk about. Even though, I warned him before getting into a relationship with me, he jumped in eagerly.

Some of my concerns for our partnership at the beginning where very clear to me, and I laid them out:

- I told him I had trouble committing as I often didn't really know what I wanted and always changed my mind

- I mentioned that I really like things to go my own way and can be quite selfish

- I often change moods, personalities, jobs, and interests, and this has really frustrated more 'structured' 'finisher' types in my life, like I could clearly see that he was

However he decided to jump in, fresh in love with his rose coloured glasses on, not really seeing how any of that would be a problem.

Here are some of the problems we face:
- he is concrete I am abstract
- He is rational I am logical
- He likes to work hard, I like to go with the flow
- He likes security and to prepare for the future, I like to constantly spend my time starting new projects rather than focusing on one and developing it to bring me more money, or work all the time to 'secure my future', as I don't feel I could be really happy if I knew I worked my life away without exploring my own things	- I am messy and disorganised, he is clean and usually finds himself picking up after me (growth)
- He is strict and has some hard and fast beliefs about the world, and I am more open refusing to believe in things
- He likes things to be right or wrong, I like to argue against his version of right and wrong
- I like to debate, he hates arguing with me
- He thinks I am stupid (sometimes), and I don't respect his way of thinking, personally my way of thinking to me is more open to truth and therefore the one I want to keep
- We both want to receive experience with SI, but me having SI inferior (which is a negative function slot, my anxiety revolves around receiving a good experience so I am more strong about getting what I want)
- We have to avoid lots of topics and 'agree to disagree', but not just that, not even able to bring some things up as with his Te, he can be quite fixed and end up feeling so justified and 'right' and therefore ends up trying to sway me to his side.

The positives
- We balance eachother
- I try to take up more creative and interesting tasks for us like cooking new recipes and he likes to try and help me with the mundane tasks that bore me such as cleaning and organising
- He has taught me a lot about money
- He has helped me secure a new job that I love so I find it easier to work
- I teach him how to relax and have helped him realise he has anxious tendencies and a negative viewpoint on the world
- I help him go with the flow and become more positive
- We are very kind and affectionate towards eachother when it works
- He does really want me to be happy, enjoy freedom to do what I want and have financial freedom, the problem is sometimes he can force his 'hard working' ethic onto me, which I don't feel I need to really get by and would prefer to manifest something that is easier and takes me more with the flow

It's been an uphill battle for sure, but one thing we know is that we really love each other and want to try and make it work. We really know now that we have to underst each other and not just 'agreeing to disagree'. At least 'respecting' how the other see's life is the answer. If I was with another intuitive, I wouldn't necessarily have to always battle and try to explain myself. Knowing about this science is what has saved us, and is what will probably allow us to stay together despite the fact we both aren't patient. We both are happy on our own and ready to move on at any time, so without this science and me explaining how different we are, we probably would have called it off by now. But I believe that if we can truly understand and respect each other that we can make it work, but that is going to take being kind to each other, respecting, and hopefully appreciating one another's way of thinking in the end.

I hope this helps. Don't forget to leave a like and subscribe to my channel to help me evolve the content and the message.

Francesca x


text:
# TapRoom

#### _By Kaila Goff & Maggie Summers_

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.5.

## Description

_A fictional Tap Room where a user can view a list of kegs and pints available. An employee is able to edit and delete the keg. They are also able to subtract a pint from the keg whenever a pint is sold._

## Development server
Type `npm install` from the terminal to install Webpack and its dependencies.
Run `ng serve` for a dev server.
Navigate to `http://localhost:4200/`.
The app will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

## Known Bugs

  * _No known bugs at this time._

## Support and contact details

  _To suggest changes, submit a pull request in the GitHub repository._

## Technologies Used

  * HTML
  * JavaScript
  * NPM
  * Angular

### License

  *MIT License*

Copyright (c) 2018 **Kaila Goff, Maggie Summers**

repository: kailagoff/tap-room

repo_name: kailagoff/tap-room


text:
---
layout: post
title: "TMLab SRPOL at SemEval-2019 Task 8: Fact Checking in Community Question Answering Forums"
date: 2019-05-29 09:31:26
categories: arXiv_CL
tags: arXiv_CL Embedding
author: Piotr Niewinski, Aleksander Wawer, Maria Pszona, Maria Janicka
mathjax: true
---

* content
{:toc}

##### Abstract
The article describes our submission to SemEval 2019 Task 8 on Fact-Checking in Community Forums. The systems under discussion participated in Subtask A: decide whether a question asks for factual information, opinion/advice or is just socializing. Our primary submission was ranked as the second one among all participants in the official evaluation phase. The article presents our primary solution: Deeply Regularized Residual Neural Network (DRR NN) with Universal Sentence Encoder embeddings. This is followed by a description of two contrastive solutions based on ensemble methods.

##### Abstract (translated by Google)

##### URL
[http://arxiv.org/abs/1906.01515](http://arxiv.org/abs/1906.01515)

##### PDF
[http://arxiv.org/pdf/1906.01515](http://arxiv.org/pdf/1906.01515)


text:
---

name: Charlotte McDonald

categories:
  - menswear

items:
-
  type: image
  src: /student_assets/CharlotteM_1.jpg
-
  type: image
  src: /student_assets/CharlotteM_2.jpg
-
  type: image
  src: /student_assets/CharlotteM_3.jpg
-
  type: image
  src: /student_assets/CharlotteM_4.jpg
-
  type: image
  src: /student_assets/CharlotteM_5.jpg
-
  type: image
  src: /student_assets/CharlotteM_6.jpg
-
  type: image
  src: /student_assets/CharlotteM_Film1.jpg
  link: https://player.vimeo.com/video/220001523

---

* [@charlotte.m.mcdonald/](https://www.instagram.com/charlotte.m.mcdonald/)
* [cmmstudio.co.uk](http://www.cmmstudio.co.uk)
*<EMAIL_ADDRESS>{: .social-links}

**Describe your influences**
My younger brother is in the military and I also have other close family members who have chosen this route. This has grounded me in many ways to understand and research into the role of masculinity today through various outlets and forms of communication. I am very alive to my surroundings - my experiences and those of others have definitely helped shape and influence my design process. My body of work is a result of codes, symbols, very much focusing on a restrictive uniform and of identity. Boy and Man. Single and within a group. My work is corporeal, human. A documentation of my personal perspicacity through curation of video, sound, garments, which accumulatively bring the hazed and complexities of life to a still precious juncture. A common thread running and racing through our bodies like a live wire, igniting with every person we meet and everything we touch.

**What does the future of fashion look like?**
Innovative construction methods. Using new materials and not being restricted by processes we have known for so long. It’s really about pushing Fashion forward in every sense. Communities. In a post truth era it is really imperative we use the resources around us and acknowledge the people who bring us up. This year throughout my collection, I investigated radio frequency welding. The electromagnetic current permanently bonds the fabric layers together using no heat, glue or stitch. This so far has only been used to construct details and is often hidden. In my work I have exposed this process through my garments, and after much sampling and problem solving!

**Best moment of the MA?**
Not so much a ’moment’ - but the experience of being able to really have the liberty and resources to build a strong and rigorous language. Each of us on the MA is so individual in our approach that it means our worlds become very powerful entities in their own right. The fact that it allows us to do this is the best ‘experience’ I could ask for.

**What's next?**
I work very instinctively and I’m very thorough - I will also continue my own practice when finishing at the RCA, no matter what happens! I want to work at an exciting design house with a history and an archive - within a team that really challenges what Menswear is. My work translates across lots of different platforms and crosses into areas outside of the classic fashion system so I am open to opportunities that might arise.

repository: benfoxall/rca-fashion

repo_name: benfoxall/rca-fashion


text:
using extent

 * Extent computes the min and max (because this is frequently needed);
 * See [d3.extent documentation](https://github.com/mbostock/d3/wiki/Arrays#d3_extent)
 * Extent computed using D3 [min](https://github.com/mbostock/d3/wiki/Arrays#d3_min) and [max](https://github.com/mbostock/d3/wiki/Arrays#d3_max)

repository: nicnash/screencasts

branch_name: refs/heads/gh-pages

repo_name: nicnash/screencasts


text:
# DevSecOps

## Build

### Release Packaging

#### Description

#### Inputs

#### Outputs

#### Tool Dependencies

Release
packaging
Package binary artifacts,
container or VM images,
infrastructure
configuration scripts,
proper test scripts,
documentation,
checksum, digital
signatures, and release
notes as a package.
Binary artifacts;
Scripts;
Documentation;
Release notes
Released
package with
checksum and
digital
signature
Release packaging tool

repository: rogelioii/devsecops

repo_name: rogelioii/devsecops


text:
# run_analysis.R

This is the course project submission for:
Coursera Course: Getting and Cleaning Data (getdata-013)

## Purpose
This script will read in the data set from the "Human Activity Recognition
Using Smartphone" Data Set and produce a file containing the merged test and
training data sets. The data will summarize all of the mean and
standard deviation data point. The summarized data points will be the average
as grouped by activity and subject.

## Aquiring the data set
The data set can be aquired from here:
https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip

The description of the data is available here:
http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones

## Running the script
1. Before running the script ensure that the data set has been downloaded and unzipped in the
same directory as the **run_analysis.R** script
2. Start and **R** console or **rstudio**
3. **source ("run_analysis.R")**
4. The tidied data will be in same directory in a file named **./tidyData.txt**

### Assumptions
* The script expects the data to be downloaded and un-zipped into the same directory
as the run_analysis.R script
* The script expects the data to be in the same hierarchy as when you unzip the file

### File locations and variables

The following variables can be modified to change the location
of the files for data processing.

| Variable | Description | Script Default |
|:---------|:------------|:---------------|
|fileActivities    |  Activities file             | "./UCI HAR Dataset/activity_labels.txt" |
|fileFeatures      |  Feature file                | "./UCI HAR Dataset/features.txt" |
|fileTesting       |  Test group data             | "./UCI HAR Dataset/test/X_test.txt" |
|fileTraining      |  Training group data         | "./UCI HAR Dataset/train/X_train.txt" |
|fileTestSubjects  |  Test group subject data     | "./UCI HAR Dataset/test/subject_test.txt" |
|fileTrainSubjects |  Training group subject data | "./UCI HAR Dataset/train/subject_train.txt" |
|fileDataSummarized|  Output of tidy data         | "./tidyData.txt" |

Other Variables:

| Variable | Description | Script Default|
|:---------|:------------|:--------------|
|nrowsToImport| Number of rows to import (-1 = all) | -1 |

### Dependencies
The script requires the **dplyr** library to function

license: Unlicense

repository: pengler/DataScience

repo_name: pengler/DataScience


text:
---
title: 'What I’m Learning From TutsPlus.com’s jQuery In 30 Days E-mails (Free)'
author: LP
layout: post
permalink: /day-2-of-tutsplus-coms-free-jquery-in-30-days-course/
wiziapp_processed:
  - 1
dsq_thread_id:
  - 692725267
---

  I started receiving Nettuts+’s 10-minute-ish video tutorials in jQuery a couple of days ago. Ran through the first lesson last week, but didn’t get a chance to open up the next one until today. (I have a pile in my inbox, now.)

  So far I like it! The videos are good refreshers for what I’ve read in textbooks so far, and they’re short and easy to understand (which is a huge plus, since they’re targeted at the absolute beginner.)

  Key takeaways from Day 2’s video:

      $(document.ready(function() {

      });

    .. .can be written as:

      $(function () {

      });

    Also, the document-ready function is written so that the rest of the code on the page can load before the jQuery.


text:
##LJ Code 201 Day 6
###More Awesome Things I Learned
- traversing/manipulating the DOM
- nodelists
- domain modeling
- more about CSS floats and absolute positioning

Today was another learning day full of new concepts and challenging lab work. What I liked most about today was being able to utilize my general knowledge of a problem domain for the lab assignment. Although answers didn't come immediately, I was able to work out the problem and code a solution. I'm still working on domain modeling in the sense that I'm still learning how to create a conceptual model for a specfic problem. Figuring out a plan and how to execute it is something that I will continue to work on and get better at.


text:
# Tours and Travel Simple PHP Page
Tours and Travel Simple PHP page with MySQL database

This project was introduced and created in Third year B.E-Computer Engg as one of my first PHP project. It is meant for absolute beginners who are new to PHP and MySQL. I've intentionally kept it the most minimal possible while introducing some separation of concerns.

## Features

* PHP variables
* PHP arrays
* PHP functions
* Database
* Mobile friendly
* Pretty links (/about) with fallback to query string (?page=about)
* Basic example of separation of concerns (functionality, content, template)

## Installation

Make sure you have [Xampp](https://www.apachefriends.org/download.html) installed on your machine.

1. Clone or Download the repository
```shell
git clone https://github.com/amitbauriya/tours-and-travel.git
cd tours-and-travel
```
2. Setup database connectivity edit function.php ([See Setup credentials](https://github.com/amitbauriya/tours-and-travel#Setup))

3. Run Xampp Control Panel and start the following (Apache and MySQL)

Your application will be running at ```http://localhost/tours-and-travel/```

### Setup

```
	$cn=mysqli_connect("localhost","database_user","database_pwd","database_name");
```
## Database

Go to PHPMyadmin ```http://localhost/phpmyadmin/```

1. Create a new database name "tourstravel"

2. Now import the database files located at database/travelblog.sql

You are free to change any modification in template or upgrade it ;-)

## Screenshots

![Screenshot](https://raw.githubusercontent.com/amitbauriya/tours-and-travel/master/images/screenshot.jpg)

repository: pacholicek/tours-and-travel

repo_name: pacholicek/tours-and-travel


text:
# Dotfiles

## Installation
```bash
git clone https://github.com/tohalla/dotfiles && cd dotfiles && source bootstrap.sh
```

To update, `cd` into your local `dotfiles` repository and then:

```bash
source bootstrap.sh
```

### Sensible macOS defaults

When setting up a new Mac, you may want to set some sensible macOS defaults:

```bash
./.macos
```

### Install Homebrew formulae

When setting up a new Mac, you may want to install some common [Homebrew](https://brew.sh/) formulae (after installing Homebrew, of course):

```bash
./brew.sh
```

Some of the functionality of these dotfiles depends on formulae installed by `brew.sh`. If you don’t plan to run `brew.sh`, you should look carefully through the script and manually install any particularly important ones. A good example is Bash/Git completion: the dotfiles use a special version from Homebrew.

repository: tohalla/dotfiles

repo_name: tohalla/dotfiles


text:
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "redshift_user Resource - terraform-provider-redshift"
subcategory: ""
description: |-
  Amazon Redshift user accounts can only be created and dropped by a database superuser. Users are authenticated when they login to Amazon Redshift. They can own databases and database objects (for example, tables) and can grant privileges on those objects to users, groups, and schemas to control who has access to which object. Users with CREATE DATABASE rights can create databases and grant privileges to those databases. Superusers have database ownership privileges for all databases.
---

# redshift_user (Resource)

Amazon Redshift user accounts can only be created and dropped by a database superuser. Users are authenticated when they login to Amazon Redshift. They can own databases and database objects (for example, tables) and can grant privileges on those objects to users, groups, and schemas to control who has access to which object. Users with CREATE DATABASE rights can create databases and grant privileges to those databases. Superusers have database ownership privileges for all databases.

## Example Usage

```terraform
resource "redshift_user" "user" {
  name      = "UserName"
  password  = "secret password"
  superuser = true
}

resource "redshift_user" "user_with_unrestricted_syslog" {
  name          = "user_syslog"
  syslog_access = "UNRESTRICTED"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **name** (String) The name of the user account to create. The user name can't be `PUBLIC`.

### Optional

- **connection_limit** (Number) The maximum number of database connections the user is permitted to have open concurrently. The limit isn't enforced for superusers.
- **create_database** (Boolean) Allows the user to create new databases. By default user can't create new databases.
- **id** (String) The ID of this resource.
- **password** (String, Sensitive) Sets the user's password. Users can change their own passwords, unless the password is disabled. To disable password, omit this parameter or set it to `null`.
- **superuser** (Boolean) Determine whether the user is a superuser with all database privileges.
- **syslog_access** (String) A clause that specifies the level of access that the user has to the Amazon Redshift system tables and views. If `RESTRICTED` (default) is specified, the user can see only the rows generated by that user in user-visible system tables and views. If `UNRESTRICTED` is specified, the user can see all rows in user-visible system tables and views, including rows generated by another user. `UNRESTRICTED` doesn't give a regular user access to superuser-visible tables. Only superusers can see superuser-visible tables.
- **valid_until** (String) Sets a date and time after which the user's password is no longer valid. By default the password has no time limit.


text:
# Google_Books_Search

# Desription
Google Books Search is an app that displays books based on the user's input.  Upon searching, users can view the results and more information about chosen book.  There information also provides a link directly to the selected book for further review.

# Technologies Used
* HTML
* CSS
* Javascript
* React
* Express
* Node
* MongoDB
* Mongoose

![img](google-books/assets/screenshot.png "Google Books Search Screenshot")

# Links
* Heroku Git URL: https://google-search-booker.herokuapp.com/
* GitHub Repo: https://github.com/latuanja/Google_Books_Search

# MIT License

Copyright (c) 2021 Latuanja Carson

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

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

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


text:
[![](https://vsmarketplacebadge.apphb.com/version/bierner.markdown-preview-github-styles.svg)](https://marketplace.visualstudio.com/items?itemName=bierner.markdown-preview-github-styles)

Changes VS Code's built-in markdown preview to match GitHub's styling.

![](https://github.com/mjbvz/vscode-github-markdown-preview-style/raw/master/docs/example.png)

Includes support for both light and dark GitHub themes. By default, the theme type (light vs dark) is selected based on your VS Code theme.

> **❗ Important**: This extension only styles the Markdown preview. Use [this extension pack](https://marketplace.visualstudio.com/items?itemName=bierner.github-markdown-preview) to add support for other GitHub markdown features like `:emoji:` and `- [ ] tasklists`.

# Features

- Preview what your markdown will look like rendered on GitHub.
- Extends VS Code's built-in markdown preview.
- Includes both light or dark Github themes.
- Customize styling using your own [`markdown.styles`](https://code.visualstudio.com/Docs/languages/markdown#_using-your-own-css) css

# Usage

Please see the [VSCode Markdown Preview documentation](https://code.visualstudio.com/Docs/languages/markdown#_markdown-preview)
for instructions on how to use this extension.

# Configuration

This theme is configurable in a similar manner to GitHub's appearance settings.

- `markdown-preview-github-styles.colorTheme`
   Sets the GitHub color theme for the Markdown preview. Default: `auto`.
   - `auto`: Automatically match the editor color theme.
   - `system`: Sync to the system/OS color theme.
   - `light`: Always use the GitHub site's light theme.
   - `dark`: Always use the GitHub site's dark theme.

repository: trusktr/dotfiles

repo_name: trusktr/dotfiles


text:
# Node.js-LAN-File-Sharing
A small Node.js app designed for sharing files while on the same network. Especially useful when you are trying to get a file from a friend and their device has a single broken USB port.

## Features
- Easy to use Drag and Drop file upload.
- Faster than uploading to a server then downloading since you are the server.
- Works with large files (tested with >2gb).
- Fast loading and opening due to light weight (no library) Javascript and customized bootstrap.

## How to use
0. Clone (or download as zip) this project from github
0. Open terminal (or command line) in project's folder.
0. First run ```npm install``` then ```node main.js```.
0. Project will display your LAN ip and port (8080 by default) in terminal once running.
0. On another device in the LAN, go to the url:port.
0. Drag & Drop any file in browser to transfer.

Project saves sent files in "files" folder. Also files in "files" folder can be downloaded from the browser.

PORT enviroment varible is used to change the port. e.g. ```export PORT=3030; node main.js```

repository: sohqureshi/File-Sharing-Web-Application

repo_name: sohqureshi/File-Sharing-Web-Application


text:
### Compound formula for calculating next rate after supplying `x` amount (with their fee) - used for all assets excepet DAI
We started from Compound and looked through their contracts (https://etherscan.io/address/0xf5dce57282a584d2746faf1593d3121fcac444dc for cSAI)

```
exchangeRate = E = (getCash() + totalBorrows() - totalReserves()) / totalSupply()
           = (S + B - Res) / T
underlying = totalSupply * exchangeRate
           = T * E = T * (S + B - Res) / T
           = S + B - Res
borrowsPer = totalBorrows / underlying
           = B / (S + B - Res)
utilizationRate = totalBorrows / (totalBorrows + getCash)
           = B / (B + S)
borrowRate = baseRate + utilizationRate * multiplier
           = baseRate + multiplier * B / (B + S)
supplyRate = borrowRate * (1-reserveFactor) * borrowsPer
           = borrowRate * (1-reserveFactor) * B / (S + B - Res)
           = (baseRate + multiplier * B / (B + S)) * (1-reserveFactor) * B / (S + B - Res)
```
when supplying a new SAI amount `x` we have

```
targetSupplyRate = (baseRate + multiplier * B / (B + S + x)) * (1-reserveFactor) * B / (S + x + B - Res)
```

Here I just rewrote the shorter version of the formula with some substitution outlined below:
```
q = (a + (b*c)/(b + s + x)) * (1-reserveFactor) * b / (s + x + b - d)
```
we use `e = (1-reserveFactor)`
we should also scale the result with a couple of constants (see contract)
so we end up having
```
a = baseRate
b = totalBorrows
c = multiplier
d = totalReserves
e = 1 - reserveFactor
s = getCash
x = maxSAIAmount
q = targetSupplyRate
k = 2102400; // blocksPerYear
j = 1e18; // oneEth
f = 100;

q = ((((a + (b*c)/(b + s + x)) / k) * e * b / (s + x + b - d))) / j -> rate per block
q = ((((a + (b*c)/(b + s + x)) / k) * e * b / (s + x + b - d)) / j) * k * f -> rate per year
```
which is the target supply rate of Compound when supplying `x` SAI.

This has been manually tested using a buidler task
```
npx buidler cDAI:nextRateDataWithAmount --amount xxx
```
where `xxx` is the amount to supply in SAI.

repository: andrecronje/idle-contracts

gha_license_id: NOASSERTION

repo_name: andrecronje/idle-contracts


text:
# birsync
Bash Inotify Rsync = birsync!

`birsync` uses Linux's inotify facility to detect file and folder changes in a watched directory. When a change is detected, birsync spawns an rsync process to sync those changes to a desired server, respecting your bandwidth, and never running more than one instance of rsync at a time.

`birsync` should run on most Linux platforms, including embedded devices. As long as you can get `inotifywait` (part of inotify-tools) on your platform (ie. ipkg, optware), it should work.

Tested on QNAP NAS to sync an FTP root securely to a cloud server, since FTP on the open Internet is bad.

## Features
* watches for changes in files and directories
* recursively adds directories created in watched directories
* ensures only one rsync runs at a time
* bandwidth limiting (an rsync feature)

## Goals
 - Embedded device compatibility
 - Bash 3/4 compatible
 - minimal subshells spawned (this is costly)
 - logfile management

## Usage
1. change variables in script according to your needs, particularly `watcheddir=` and `rsyncdest=`.
1. Set up SSH pubkey auth (passwordless) between your client and the destination
1. run it!

    $ ./birsync

## Troubleshooting
1. check `birsync-error.log`, `birsync-sync.log` and `birsync-changes.log` for clues
1. make sure `lockfile` is baleeted if `rsync` really is not running

repository: johnsonhit/birsync

repo_name: johnsonhit/birsync


text:
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/

title: "Mr. Murakami presented his research at IEICE Technical Committee on Internet Architecture (IA)"
subtitle: ""
summary: ""
authors: ["kyoya-murakami"]
tags: ["Kubernetes", "Edge Computing"]
categories: []
date: 2023-03-17T16:05:10+09:00
lastmod: 2023-03-17T16:05:10+09:00
featured: false
draft: false

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
  caption: ""
  focal_point: ""
  preview_only: false

# Projects (optional).
#   Associate this post with one or more of your projects.
#   Simply enter your project's folder or file name without extension.
#   E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
#   Otherwise, set `projects = []`.
projects: []
---

Kyoya Murakami, a second-year master's student in our laboratory, presented his research at [IEICE Technical Committee on Internet Architecture (IA)](https://ken.ieice.org/ken/program/index.php?tgs_regid=4c4585ce7890559d709b0336010193f3fb3b287a5d87e17088da1225d91b4e66&tgid=IEICE-IA).

He introduced his research titled "Evaluation of a load balancing method considering inter-site latency", which evaluated a load balancing method for Kubernetes in edge computing environments, and received a Student Research Award.

repository: sdlab-naist/website

repo_name: sdlab-naist/website


text:
---
name: Bug report
about: Create a report to help us improve
title: "[Bug] "
labels: 'bug, Area: ProToCol'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Azure Cli Version:
Use az --version
Look for something like-
azure-cli (2.0.70)

Azure-Devops extension version:
Use az --version
Look for something like-
Extensions:
azure-devops (0.13.0)

Steps to reproduce the behavior:
1. login using az login
2. setup defaults..
3. Run command....
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Debug logs**
Add the output of the command running it with debug mode (--debug)

**Additional context**
Add any other context about the problem here.

repository: satarii/azure-cli

repo_name: satarii/azure-cli


text:
# Tale Tree
**A Tale Framework Component**

# What is Tale Tree?

# Installation

Install via Composer

```bash
composer require "talesoft/tale-tree:*"
composer install
```

# Usage

```php

```

repository: Talesoft/tale-tree

repo_name: Talesoft/tale-tree


text:
# Tic Tac Toe Game
Written as a Web Service using Play Framework

The solution is an attempt to solve the problem statement

## Problem Statement URL
<http://www.venturesity.com/challenge/id/107>

##Problem Statement
The game of n by n Tic-Tac-Toe

### Create an API

### A. The Game

There is a board game played between two players. The board is an n by n grid where 3<= n <= 8. Each player takes turns in marking spaces on the grid. The first player marks each space with X while the second player marks each space with O. The first player to get k of their marks in a row, column or diagonal where 3<=k<=n wins the game (user defined); otherwise the game is a draw if all squares are filled with no player winning.

#### B. What You Need to Do

Write a bot that can play the game on your behalf. Expose the bot as a webservice. Run the webservice on port 8080. Expose the following three APIs:

| URL   | Type      | Parameter    | Sample Response	Purpose |
| ----- | ------    | -----------  | -------------------------- |
| /ping |	GET	    | {ok:true}	   | To let us know your bot is alive |
| /start | GET p, q | {ok:true}    | For you to initialize the round. p indicates size of the grid and q indicates the number of marks in a row that you need to do to win. |
| /move  | GET      | m {m:"1\|2"}  | m: the last square marked by your opponent. Your response will convey your next play (or any error e.g. spot is filled etc.) |

Note: All positions are represented as x|y where x and y are respective coordinates on the board. The bottom left corner is 1|1.


text:
    cursors

---

## what is this ?
 - new Tab extension which shows up when you open new tab on chrome
 - and can select few backgrounds of our choice!
 ---
## How to run
> Clone the repo

> and run `npm install`

> and run `npm run build`

> open chrome and make sure developer mode turned on and hit `load unpacked extension` and select `/dist` dir generated by above command.

---
**feel free to clone this and make changes and publish by yourself**  - varaprasadh, myself


text:
# Changelog

## v1.3.0

- Added `queryBaseStatement()` to allow for REPLACE INTO and SELECT DISTINCT queries
- Added `flag()` function for additional query metadata.

## v1.2.0

- Added `dialect()` function to allow getting / setting of dialects after construction.

## v1.1.0

- Added `allTablesReferenced()` function to all queries

## v1.0.0

- Initial Version

repository: koreanbbque/sql

repo_name: koreanbbque/sql


text:
---
layout: post
title: Learning Resources
---

Reading up on [Idiomatic Python].

In addition, the following book was recommended on Idiomatic Django, "Idiomatic Django."

[Idiomatic Python]:http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html


text:
scala.annotation
# class constructorOnly

class constructorOnly extends Annotation with StaticAnnotation

An annotation that goes on parameters of classes or traits. It asserts
that the parameter is used only for initialization and is not kept in
the class as a field. Violations of this assertion are flagged as
compile errors. The annotation is particularly useful for implicit
parameters since for these a textual scan is not sufficient to know
where they are used.

## Annotations:
@param

repository: BryanAbate/dotty

gha_language: Scala

repo_name: BryanAbate/dotty