text:
---
layout: post
published: true
draft: false
tags: R, cookbook, GenomicAlignments
status: publish
title: "How to slice a genome"
author: "Charles Joly Beauparlant"
output: html_document
---

# Introduction

In this document, we will see how to slice a genome. More specifically, we will extract all the aligned regions with a coverage greater than 0. This can be useful if we want to focus with genomic regions where some reads were aligned and to discard all the empty regions.

# Dataset presentation

We will work with the packages [`pasillaBamSubset`](http://bioconductor.org/packages/release/data/experiment/html/pasillaBamSubset.html) that has reads only on chr4.

{% highlight r %}
suppressMessages(library(pasillaBamSubset))
bam_file <- untreated1_chr4()
bam_file
{% endhighlight %}

{% highlight text %}
## [1] "/Library/Frameworks/R.framework/Versions/3.2/Resources/library/pasillaBamSubset/extdata/untreated1_chr4.bam"
{% endhighlight %}

Most of the time, for this kind of analysis, we don't want to work with the whole genome at once. It's generally best to work with only one subset of the genome at a time to reduce memory usage. An easy way to get the chromosome size is to work with the `Seqinfo` function (if the genome of interest is supported):

{% highlight r %}
suppressMessages(library(GenomicAlignments))
current_chr <- "chr4"
dm3 <- Seqinfo(genome = "dm3")
chr4_size <- seqlengths(dm3)[seqnames(dm3) == current_chr]
{% endhighlight %}

# Extracting the coverage

The extraction of the coverage from a bam file is done in 2 steps:

1. Extraction of the aligned read with the `readGAlignments` function.
2. Conversion in coverage with the `coverage` function.

Since we want to extract only the reads aligned on the chromosome 4, we need to create a `ScanBamParam` to filter accordingly with the `readGAlignments` function:

{% highlight r %}
which = GRanges(seqnames = current_chr, IRanges(1, chr4_size), seqinfo = dm3)
param <- ScanBamParam(which = which)
alignments <- readGAlignments(bam_file, param = param)
alignments
{% endhighlight %}

{% highlight text %}
## GAlignments object with 204355 alignments and 0 metadata columns:
##            seqnames strand       cigar    qwidth     start       end
##               <Rle>  <Rle> <character> <integer> <integer> <integer>
##        [1]     chr4      -         75M        75       892       966
##        [2]     chr4      -         75M        75       919       993
##        [3]     chr4      +         75M        75       924       998
##        [4]     chr4      +         75M        75       936      1010
##        [5]     chr4      +         75M        75       949      1023
##        ...      ...    ...         ...       ...       ...       ...
##   [204351]     chr4      +         75M        75   1348268   1348342
##   [204352]     chr4      +         75M        75   1348268   1348342
##   [204353]     chr4      +         75M        75   1348268   1348342
##   [204354]     chr4      -         75M        75   1348449   1348523
##   [204355]     chr4      -         75M        75   1350124   1350198
##                width     njunc
##            <integer> <integer>
##        [1]        75         0
##        [2]        75         0
##        [3]        75         0
##        [4]        75         0
##        [5]        75         0
##        ...       ...       ...
##   [204351]        75         0
##   [204352]        75         0
##   [204353]        75         0
##   [204354]        75         0
##   [204355]        75         0
##   -------
##   seqinfo: 8 sequences from an unspecified genome
{% endhighlight %}

It's extremely easy to convert a `GAlignments` object in a coverage (`SimpleRleList`) object:

{% highlight r %}
coverage <- coverage(alignments)
coverage
{% endhighlight %}

{% highlight text %}
## RleList of length 8
## $chr2L
## integer-Rle of length 23011544 with 1 run
##   Lengths: 23011544
##   Values :        0
##
## $chr2R
## integer-Rle of length 21146708 with 1 run
##   Lengths: 21146708
##   Values :        0
##
## $chr3L
## integer-Rle of length 24543557 with 1 run
##   Lengths: 24543557
##   Values :        0
##
## $chr3R
## integer-Rle of length 27905053 with 1 run
##   Lengths: 27905053
##   Values :        0
##
## $chr4
## integer-Rle of length 1351857 with 122061 runs
##   Lengths:  891   27    5   12   13   45 ...    3  106   75 1600   75 1659
##   Values :    0    1    2    3    4    5 ...    6    0    1    0    1    0
##
## ...
## <3 more elements>
{% endhighlight %}

The coverage is a `SimpleRleList` with one element for each `seqlevels` in the `seqlevels`.

# Slice the chromosome

We can use the `slice` function to extract the regions with at least a coverage of 1.

##    [6]    4922    5640   719 [ 2  3  3  4  4  4  4  4  4  5  5  5  8 ...]
##    [7]    5670    6090   421 [1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 ...]


text:
# Agenda

* Meet with community collaborators.
* Follow-up internal discussion on items from previous meeting.
* Push 2.0.0 release.

This was our first Relay "OSS Day", where the core team devoted most of the day to catching up on OSS including meeting with several outside contributors to discuss our roadmap and important issues for the community as well as triaging issues/PRs and cutting a release. Notes are high-level and include points from both the broader discussion and internal follow-up discussions.

## Attendees

Core team:

* Jan Kassens
* Andrey Lunyov
* Gerald Monaco
* Joe Savona
* Juan Tejada
* Yuzhi Zheng

Community members:
* Sibelius Seraphini (@sibelius)
* Rob Richard (@robrichard)
* Justin (Artsy)

# 2019 H1 Roadmap

First we reviewed the roadmap discussed in https://github.com/facebook/relay/issues/2554#issuecomment-447957728 with the attendees. The main note here is that the new React Suspense-compatible APIs will be moved back to OSS as soon as possible.

## Community Issue Triage

Next we reviewed issues/PRs that are impacting OSS Relay users and discussed possible next steps.

## Support more flexible object identity

* Justin: Ideally applications would be able to use Relay even if they don't conform to Relay's object identity spec.
* Background: Relay expects objects to use the `Node`  interface and `id` field as a way to uniquely identify entities. There are two main cases we would also like to support:
  * Applications that do use globally unique object identifiers but on a different field (ie not `id`).
  * Applications that don't use globally unique identifiers at all (they may have type-specific primary keys instead).
  * A proposed solution to the first case is implemented in https://github.com/facebook/relay/pull/2249, which proposed inferring the name of the global "id" field from the schema's `Node` interface. E.g. if the schema's `Node` interface calls the id field `__id`, Relay would use the `__id` field as the identifier.
* Discussion:
  * The core team's main hesitation with this PR (and issue generally) is that it can introduce runtime overhead for those applications that *do* conform to the spec. It's more efficient to use a fixed name for the identifier field than to do an extra lookup or call a function.
  * But that means Artsy has to main a fork of Relay that changes from looking up `id` => looking up `__id`. More generally, we would ideally like to support applications that don't conform to the identity spec.
  * Another use-case is that even in applications that *mostly* conform to the spec, there may be occasional types that do not (for example if some types have non-globally unique 'id' fields).
* Some options:
  * Fork (via module shimming, custom build, etc) the identity resolution logic for Facebook and OSS. The OSS version would call user-provided function to resolve object identity (with a default that matches the current behavior). OSS users are often more tolerant of small performance tradeoffs in exchange for flexibility, so this could be reasonable.
  * Add a variant of `LinkedField` that either specifies the name of the id field or indicates that a function should be called at runtime. Types that conform to the Relay object identity spec would use the standard `LinkedField` with lower overhead, and only the types that need customization would incur the overhead. This is a more flexible option as it preserves performance of existing cases while also enabling more flexibility.
* Next Steps:
  * @josephsavona to follow-up on the PR

## Server-side rendering

* Rob Richard: Implemented server-side rendering with Relay but there are a few issues.
* Discussion:
  * Found it more flexible to avoid QueryRenderer; manually fetch data, set context, and render, then serialize data to the client to seed the environment, and then similarly manually set context and render.
  * Limitation is that it nested QueryRenderers aren't prefetched on the server, but in general fragment composition means nested renderers aren't typically necessary on initial load.
  * Relay uses inline requires which is slow on Node.js; as of writing this is now changed so that the OSS build disables inline requires.
  * Relay was using an unstable API to read React context that didn't work, that's fixed to use a different unstable API that works for now. Relay team will update again once there's a final API to use.
  * Built-in support for defer would address the nested query renderer case.
  * Rob is using Apollo server's experimental `@defer` with a custom network layer to patch incremental payloads.
  * There's also a related issue with QueryRenderer's shared requestCache.
  * Upcoming new APIs / changes will make it easier to use QueryRenderer to synchronously render from data in the cache, and to manually set context if necessary.
* Next steps:
  * @jstejada to look at the requestCache bug.

## Mutation overlap

* Rob Richard: The results of different mutations can overlap in the store. The recommended workaround is to use include a value for caching-breaking purposes in the mutation variables, for example a `clientMutationId` argument set to an auto-incrementing value.
* PR to address this in https://github.com/facebook/relay/pull/2349, which sets a new unique root id for each mutation.
* Discussion:
  * The core team is supportive of this direction.
* Next Steps:
  * @josephsavona to follow-up on the PR

## Making Relay easier to use

* Sibelius: Frequently hears that Relay feels harder to use than Apollo.
* What's actually harder?
  * Both Apollo and Relay support similar patterns (ie, declare a single query with all fields inlined vs colocated fragments w components). But somehow people don't realize they can just use a query with Relay, and add colocated fragments over time as their app grows.
  * People often don't understand the value of colocation and data-masking; it isn't a problem when you're just getting started, but it matters as an app scales.
  * Docs and examples could help to clarify that fragments/colocation/masking are advanced concepts you don't have to use at first.
* What else is hard?
  * The compiler requires setup: PR to make it configurable discussed later.
  * Better docs: planned on the roadmap.
  * Examples? Community help appreciated.
  * Can we use babel-macros for the compiler? This is how create-react-app supports Relay.
  * If you're a React dev not already using GraphQL, there is a lot to set up already (schema, server library, client library, etc).
* Next Steps:
  * Relay team to think about how to make the value proposition (and intended audience) more clear on the website/docs.

## Local State

* Sibelius: What are we thinking re local state?
* The core team is exploring this in collaboration with the React team and other folks. Nothing concrete yet, but we are thinking about how complex local state should work in the presence of React Suspense and Concurrent mode.

## Relay Compiler Options

* https://github.com/facebook/relay/issues/2518 proposes an idea for how to configure the compiler via a config file similar to Babel, Metro, other JS utilities.
* Discussion: Relay team in support, cosmiconfig library looks good, detailed writeup from the community would be appreciated per comments on the issue.

## Frozen JSON scalars

* Rob: https://github.com/facebook/relay/pull/2193 is open, this is an issue for some OSS users who use complex scalars (eg the JSON scalar).
* Discussion:
  * The fix is to stop modifying frozen objects in DEV in recycleNodesInto.
  * It's technically an observable behavior change between DEV and production modes, which we historically have tried to avoid.
  * But this only occurs for custom scalar data - not standard Relay data.
  * Decided to move forward to unblock the community because complex scalars are already opt-in. Object identity for complex scalars is not guaranteed to be stable if you use this complex scalars. PR landed.

license: MIT

repository: facebook/relay

branch_name: refs/heads/main

extension: md

gha_language: Rust

gha_license_id: MIT

license_type: permissive

repo_name: facebook/relay


text:
# verification-bot (for /r/sysadmin)
Verifies users who don't have a phone number/don't want to share their phone number with Discord

## Features
Auto-verifies users over a specified account age.

Users with a minimum account age can send it the message "verify" and it will verify them.

Informs users below the specified minimum account age to message Moderator Mail to get verified if they attempt to verify with the bot.

Pinging a role destined for emergencies only with a certain amount of reactions needed from people with a top role above "verified"

PM people who boost the server with a thank you message

### Potential future features

See Projects tab for more info

### Installation

See Wiki tab

repository: coolboiii/verification-bot

branch_name: refs/heads/master

repo_name: coolboiii/verification-bot


text:
## Naming Components

When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!

Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the Ionic generated web components use the prefix `ion`. As part of this component library, we will be using `wc` abbreviation for web components.

**Example**:

```jsx
<wc-link href="https://github.com/pagesource/atomic-react-components">click here</wc-link>
```


text:
# SimQColours
Web app to analyze an image's perceived colour.

The purpose of this web app is to validate the qualitative colour descriptions defined in the paper: Falomir, Z., Museros, L., & Gonzalez-Abril, L. A "Model for Cognitive Colour Description and Comparison using Conceptual Neighbourhood Diagrams."

It has been developed as part of the course SIU019 Cognitive Processes (MA Intelligent Systems, Jaume I University). It is designed to act as a standalone app. All information is stored in the user's browser.

Demo: http://esroyo.github.io/simqcolours

repository: esroyo/simqcolours

repo_name: esroyo/simqcolours


text:
# PyCon 2014 Scikit-learn Tutorial

*Instructor: Peter Prettenhofer*

- email<EMAIL_ADDRESS>- twitter: [@pprett](https://twitter.com/pprett)
- github: [pprett](http://github.com/pprett)

This respository contains files associated with my Pycon Ukraine 2014
scikit-learn tutorial that is a slightly modified version of Jake VanderPlas's
PyCon 2014 tutorial: https://github.com/jakevdp/sklearn_pycon2014 .

For more information on Jake see:

- twitter: [@jakevdp](https://twitter.com/jakevdp)
- github: [jakevdp](http://github.com/jakevdp)

## Installation Notes
This tutorial will require recent installations of *numpy*, *scipy*,
*matplotlib*, *scikit-learn*, and *ipython* with ipython notebook.
The last one is important: you should be able to type

    ipython notebook

in your terminal window and see the notebook panel load in your web browser.
Because Python 3 compatibility is still being ironed-out for these packages
(we're getting close, I promise!) participants should plan to use Python 2.6
or 2.7 for this tutorial.

For users who do not yet have these  packages installed, a relatively
painless way to install all the requirements is to use a package such as
[Anaconda](http://www.continuum.io/downloads "Anaconda"), which can be
downloaded and installed for free.

## Downloading the Tutorial Materials
I would highly recommend using git, not only for this tutorial, but for the
general betterment of your life.  Once git is installed, you can clone the
material in this tutorial by using the git address shown above:

    git clone git@github.com:pprett/sklearn_pycon2014.git

If you can't or don't want to install git, there is a link above to download
the contents of this repository as a zip file.  I may make minor changes to
the repository in the days before the tutorial, however, so cloning the
repository is a much better option.

## Notebook Listing
These notebooks in this repository can be statically viewed using the
excellent [nbviewer](http://nbviewer.ipython.org) site.  They will not
be able to be modified within nbviewer.  To modify them, first download
the tutorial repository, change to the notebooks directory, and type
``ipython notebook``.  You should see the list in the ipython notebook
launch page in your web browser.

- [00_Preliminaries.ipynb](http://nbviewer.ipython.org/urls/raw.github.com/pprett/sklearn_pycon2014/master/notebooks/00_Preliminaries.ipynb)
- [01_basics.ipynb](http://nbviewer.ipython.org/urls/raw.github.com/pprett/sklearn_pycon2014/master/notebooks/01_basics.ipynb)
- [02_data_representation.ipynb](http://nbviewer.ipython.org/urls/raw.github.com/pprett/sklearn_pycon2014/master/notebooks/02_data_representation.ipynb)
- [03_basic_principles.ipynb](http://nbviewer.ipython.org/urls/raw.github.com/pprett/sklearn_pycon2014/master/notebooks/03_basic_principles.ipynb)
- [04_supervised_in_depth.ipynb](http://nbviewer.ipython.org/urls/raw.github.com/pprett/sklearn_pycon2014/master/notebooks/04_supervised_in_depth.ipynb)
- [05_unsupervised_in_depth.ipynb](http://nbviewer.ipython.org/urls/raw.github.com/pprett/sklearn_pycon2014/master/notebooks/05_unsupervised_in_depth.ipynb)
- [06_validation.ipynb](http://nbviewer.ipython.org/urls/raw.github.com/pprett/sklearn_pycon2014/master/notebooks/06_validation.ipynb)

Note that some of the code in these notebooks will not work outside the
directory structure of this tutorial, so it is important to clone the full
repository if possible.


text:
# Paw-ApiAuthDynamicValue

A Paw extension for calculating the Authorization header value for the Ruby
[ApiAuth gem][1].

You might also want to install the [Paw-ContentMD5DynamicValue][2] extension if
you want to include the Content-MD5 header as part of the signature.

## Install

Download from the releases page, unzip, and copy the
`com.dteoh.PawExtensions.ApiAuthDynamicValue` directory into your Paw
extensions directory.

## Development

### Prerequisites

```
yarn install
```

### Build

```
yarn run build
```

## License

MIT

[1]: https://github.com/mgomes/api_auth
[2]: https://github.com/dteoh/Paw-ContentMD5DynamicValue

repository: dteoh/Paw-ApiAuthDynamicValue

repo_name: dteoh/Paw-ApiAuthDynamicValue


text:
# Learning Angular

## Install
```
cd client/
npm install
ng build --prod

cd ..
docker-compose build --no-cache
docker-compose run app npm install
docker-compose down
```

## Use

**Docker**
```
docker-compose up
```

**App**
```
Goto url: http://localhost:8100/
```

**App Api**
```
Goto url:
- http://localhost:8100/api/users
- http://localhost:8100/api/roles
- http://localhost:8100/api/events
- http://localhost:8100/api/purchases
- http://localhost:8100/api/session/login
- http://localhost:8100/api/session/logout
- http://localhost:8100/api/session/profile
```

**Adminer**
```
host: http://localhost:8101
server: db
user: root
password: root
db: database_development
```

**Mysql**
```
host: localhost
port: 8102
user: root
password: root
```

**Demo DB**
```
Use Adminer for restore demo data (demo.sql)
```

repository: dnechaev/learning-angular

gha_language: JavaScript

repo_name: dnechaev/learning-angular


text:
# EasyTests
A very basic testing implementation.
_______
## basics

example:

    int main() {

        /// Setting up tests
        TestContainer testContainer({

        TEST(TestName1, testContainer) {	// will succeed without errors
            ASSERT(true, "true1");
            ASSERT(true, "true2");

        };  // ';' is necessary

        TEST(TestName2, testContainer) {	// will report first assertion
            ASSERT(false, "false");
            ASSERT(true, "true");

        };

        ///....

        testContainer.runAllTests();

    }

### Testing

Currently implemented are:
- ASSERT(bool, char*);          // Check if a condition is true, test fails if not.
- REQUIRE(bool, char*);         // Check if a condition is true, sends exception if not. Can be used to force quit function calls.
- EXPECTCRASH(function, char*); // Check if a function "crashes" with the given input. Additional info follows.
- EXPECTSAFE(function char*);   // Check if a function doesn't "crash" with the given input. Test fails if it does

### Using REQUIRE:

Let's say you want to check at the beginning of your function if the parameters are valid.
You can use the REQUIRE "function" for that.

Example:

	int f(int a){
    	REQUIRE(a != 0, "Require failed fTest()");
		return 1/a;
	};

This can then be checked for during tests like this:

	EXPECTCRASH(fTest(0), "CrashTest1");
	EXPECTSAFE(fTest(5), "CrashTest2");

Be sure to pay attention to your REQUIRE() statements.
If you call the previouse function example outside of your tests, your program will most likely fail due to an ignored exception.
You can try and catch it just like normal exceptions, so if you want to prevent crashes,
try that,
or just always comply with your REQUIRE statements.

Note: Due to the fact that REQUIRE throws an exception, multipple failing REQUIRE statements will only show the top one failing.

Example:

    REQUIRE(false, "checked");
    REQUIRE(false, "not checkes");

Only the first one will be checked. It then throws an excpetion causing the program to exit function calls until it finds a try - catch.
(That's about as far as my knowledge of exceptions goes.)

__________________________

Note: This is mainly usefull for small projects that need fast and easy (maybe a bit dirty) testing.
    If your project ends up being reasonably big, consider using Gtest or some other, maybe a bit more stable, testing library.

repository: OlivierVanHoutte/EasyTests

repo_name: OlivierVanHoutte/EasyTests


text:
# What is ApsaraVideo Live? {#concept_rmb_kh3_bfb .concept}

ApsaraVideo Live is an audio-video platform based on the latest accessible content, widely distributed network and largely distributed real-time transcoding technology. It offers high-definition, live audio-video feed services that are fluent and easily accessible with low latency rate and are high in concurrency.

You can use the [ApsaraVideo Live console](https://partners-intl.aliyun.com/login-required#/live), API and SDK to use and manage live video services and integrate them with your own apps and services.

url: https://raw.githubusercontent.com/youngguang/live/c6bf123f1274d7d6de93c4b8bc8b8098d2950746/intl.en-US/Product Introduction/What is ApsaraVideo Live?.md

repository: youngguang/live

filename: What is ApsaraVideo Live?.md

repo_name: youngguang/live


text:
# LoomisWood
Loomis-Wood Add-In for Igor Pro

The Loomis-Wood Add-In is a package for [Igor Pro](http://wavemetrics.com) that allows the creation of interactive Loomis-Wood plots for the analysis of high resolution molecular spectra.

## Installation

The Loomis-Wood Add-In is installed by copying or creating a shortcut/alias to the source folder in the User Procedures Folder which is located in the Igor Pro User Files folder.

The default location of the Igor Pro User Files folder is:

  Macintosh:
    /Users/*user*/Documents/WaveMetrics/Igor Pro 7 User Files

  Windows:
    C:\Users\\*user*\Documents\WaveMetrics\Igor Pro 7 User Files

repository: cfneese/LoomisWood

repo_name: cfneese/LoomisWood


text:
# ros-github-scripts
Utility scripts to ease management of GitHub projects for ROS / ROS 2

## Installation

This is a `setuptools`-based python package. To install it and all its dependencies:

```
# Note that this is by _path_, it's not the name of a package on PyPI - so substitute as appropriate for your working directory
pip3 install ./ros-github-scripts
```

## ros-ci-for-pr

Creates a github gist containing a modified ros2.repos, with the source branches from one or more PRs.
Optionally, runs ci.ros2.org jobs and comments the status badges on the PRs in question - if the user has build access to ci.ros2.org.

See `ros-ci-for-pr --help` for full usage.

Example average case:

```
export GITHUB_ACCESS_TOKEN=$GITHUB_TOKEN
ros-ci-for-pr \
  --pulls ros2/rosbag2#654 \
  --packages rosbag2_cpp rosbag2_tests \
  --build \
  --comment
```

## ros-github-contribution-report

Generates a report of merged PRs on GitHub from a set of authors, optionally filtered by time and destination, and rendered to a variety of formats.

See `ros-github-contribution-report --help` for full usage.

Example average case:

```
ros-github-contribution-report \
  --since 2021-01-01 \
  --token $GITHUB_ACCESS_TOKEN \
  --authors emersonknapp \
  --orgs ros2 ros-tooling \
  --format table \
  --render > my_contributions_this_year.html
```

## Developing

Run tests by invoking `tox` in the repository directory.

repository: Arslan-Z/ros-github-scripts

repo_name: Arslan-Z/ros-github-scripts


text:
# aria2c-for-wget-curl
Stubs of wget and curl for aria2c to download large files using Debian alternatives subsystem instead of changing the shell scripts.

## Instructions for setup
### Wget
* Rename original wget to wget-orig
```console
$ sudo cp /usr/bin/wget /usr/bin/wget-orig
```
* Copy the downloaded wget as wget-stub
```console
$ sudo cp ~/path/to/wget-stub /usr/bin/wget-stub
```
* Use update-alternatives to set default binary
 ```console
$ sudo update-alternatives --install /usr/bin/wget wget /usr/bin/wget-orig 30
update-alternatives: using /usr/bin/wget-orig to provide /usr/bin/wget (wget) in auto mode
$ sudo update-alternatives --install /usr/bin/wget wget /usr/bin/wget-stub 40
update-alternatives: using /usr/bin/wget-stub to provide /usr/bin/wget (wget) in auto mode
```
* Verify that wget-stub is default
 ```console
$ sudo update-alternatives --config wget
There are 2 choices for the alternative wget (providing /usr/bin/wget).

    Selection Path Priority Status

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

  * 0 /usr/bin/wget-stub 40 auto mode

    1 /usr/bin/wget-orig 30 manual mode

    2 /usr/bin/wget-stub 40 manual mode
Press <enter> to keep the current choice[*], or type selection number:
```

* The setup is ready, try using wget now.

## Note
* If command cannot be translated to aria2c equivalent, then falls back the the corresponding program.
* Use --orig flag to use the original program.
* curl-stub is WIP.
* .curlrc is not supported as of now

### Curl
* only files are supported for --cookie flag

## Screenshots
![wget-aria2c](https://raw.githubusercontent.com/SaiHarshaK/aria2c-for-wget-curl/master/wget/screenshots/wget-aria.png)
![wget-orig](https://raw.githubusercontent.com/SaiHarshaK/aria2c-for-wget-curl/master/wget/screenshots/wget-orig.png)


text:
# understanding-flexbox
A guide to understanding flexbox in depth with practical examples

[Visual Guide](http://understanding-flexbox.surge.sh)

### Table of Contents
---
+ [Flexbox](https://github.com/npranto/understanding-flexbox#flexbox)
+ [Breaking Down Flexbox Model](https://github.com/npranto/understanding-flexbox#breaking-down-flexbox-model)
+ [Flex Container Properties](https://github.com/npranto/understanding-flexbox#flex-container-properties)
+ [Flex Item Properties](https://github.com/npranto/understanding-flexbox#flex-item-properties)
+ _Demos_
    + [navbar](https://github.com/npranto/understanding-flexbox/tree/master/demos/navbar)
    + [mobile-content-order](https://github.com/npranto/understanding-flexbox/tree/master/demos/mobile-content-reorder)

### Flexbox
+ a recently new CSS standard that simplifies adding desired layouts to page content
+ provides [an efficient way to layout, align, and distributed spacing among elements in the DOM](https://goo.gl/XiuagG)

### Breaking Down Flexbox Model
+ **_Flex Container:_** The parent container to which you set flexible display to.
+ **_Flex Item(s):_** The child elements that are residing inside the parent flexible container.

### Flex Container Properties
#### flex-direction
+ controls the direction of flex container items
+ `flex-direction` property values:
    + [row](http://understanding-flexbox.surge.sh/#flex-direction-row)
    + [column](http://understanding-flexbox.surge.sh/#flex-direction-column)
    + [row-reverse](http://understanding-flexbox.surge.sh/#flex-direction-row-reverse)
    + [column-reverse](http://understanding-flexbox.surge.sh/#flex-direction-column-reverse)

#### flex-wrap
+ controls the flow of flex items and whether or not they should be forced into a single line or wrapped in multiple lines (despite the number of flex items)
+ `flex-wrap` property values:
    + [wrap](http://understanding-flexbox.surge.sh/#flex-wrap-wrap)
    + [no-wrap](http://understanding-flexbox.surge.sh/#flex-wrap-no-wrap)
    + [wrap-reverse](http://understanding-flexbox.surge.sh/#flex-wrap-wrap-reverse)

#### flex-flow
+ a shortcut to using both flex-direction and flex-wrap values together(i.e., `flex-flow: row wrap`)
+ `flex-flow` property values:
    + [row nowrap](http://understanding-flexbox.surge.sh/#flex-flow-row-nowrap)
    + [column wrap](http://understanding-flexbox.surge.sh/#flex-flow-column-wrap)
    + [column nowrap](http://understanding-flexbox.surge.sh/#flex-flow-column-nowrap)

#### justify-content
+ a more enhanced version of text-align for all DOM elements to align elements in the main axis(horizontally)
+ `justify-content` property values:
    + [flex-start](http://understanding-flexbox.surge.sh/#justify-content-flex-start)
    + [flex-end](http://understanding-flexbox.surge.sh/#justify-content-flex-end)
    + [center](http://understanding-flexbox.surge.sh/#justify-content-center)
    + [space-between](http://understanding-flexbox.surge.sh/#justify-content-space-between)
    + [space-around](http://understanding-flexbox.surge.sh/#justify-content-space-around)

#### align-items
+ a more enhanced version of text-align for all DOM elements to align elements in the cross axis(vertically)
+ `align-items` property values:
    + [flex-start](http://understanding-flexbox.surge.sh/#align-items-flex-start)
    + [flex-end](http://understanding-flexbox.surge.sh/#align-items-flex-end)
    + [center](http://understanding-flexbox.surge.sh/#align-items-center)
    + [stretch](http://understanding-flexbox.surge.sh/#align-items-stretch)
    + [baseline](http://understanding-flexbox.surge.sh/#align-items-baseline)

#### align-content
+ controls how flex items are aligned in multi line flex containers
+ `align-content` property values:
    + [flex-start](http://understanding-flexbox.surge.sh/#align-content-flex-start)
    + [flex-end](http://understanding-flexbox.surge.sh/#align-content-flex-end)
    + [center](http://understanding-flexbox.surge.sh/#align-content-center)
    + [stretch](http://understanding-flexbox.surge.sh/#align-content-stretch)

### Flex Item Properties
#### order
+ controls the order of flex items to be displayed
+ default value is 0, but can take in both positive and negative integer values
+ works similar to z-index, order of content goes from lowest order integer to highest
+ `order` property values:
    + [order: 0](http://understanding-flexbox.surge.sh/#order-0)
    + [order: -1](http://understanding-flexbox.surge.sh/#order--1)
    + [order: 1](http://understanding-flexbox.surge.sh/#order-1)

#### flex-grow AND flex-shrink
+ controls the amount of space a flex item can take in, squeeze in based on available space
+ flex grow expands content to full extent of parent element horizontally
+ flex shrink shrinks content to its default size if there is available space or if there is no space, it shrinks content to fit within parent element
+ default value is 0, but it can also be any positive integer
+ `flex-grow` and `flex-shrink` property values:
    + [flex-shrink: 0](http://understanding-flexbox.surge.sh/#flex-shrink-0)
    + [flex-shrink: 1](http://understanding-flexbox.surge.sh/#flex-shrink-1)
    + [flex-grow: 0](http://understanding-flexbox.surge.sh/#flex-grow-0)
    + [flex-grow: 1](http://understanding-flexbox.surge.sh/#flex-grow-1)

#### flex-basis
+ specifies an initial size of flex items, but it can altered with flex-grow and flex-shrink
+ default value is 'auto,' but it can also be any size attribute(px, em, % etc.)
+ `flex-basis` property values:
    + [flex-basis: auto](http://understanding-flexbox.surge.sh/#flex-basis-auto)
    + [flex-basis: 50%](http://understanding-flexbox.surge.sh/#flex-basis-50-percentage)
    + [flex-basis: 100px](http://understanding-flexbox.surge.sh/#flex-basis-100-pixels)

#### flex
+ a shorthand for flex-shrink, flex-grow and flex-basis all together
+ an simple example could be `flex: 0 1 auto`, 0 is flex-grow, 1 is flex-shrink, and auto is flex-basis
+ `flex`property values:
    + [flex: 0 1 150px](http://understanding-flexbox.surge.sh/#flex)

#### align-self
+ helps to align specific flex items to align differently compared to its siblings
+ `align-self` property values:
    + [flex-start](http://understanding-flexbox.surge.sh/#align-self-flex-start)
    + [flex-end](http://understanding-flexbox.surge.sh/#align-self-flex-end)
    + [center](http://understanding-flexbox.surge.sh/#align-self-center)
    + [baseline](http://understanding-flexbox.surge.sh/#align-self-baseline)
    + [stretch](http://understanding-flexbox.surge.sh/#align-self-stretch)
    + [auto](http://understanding-flexbox.surge.sh/#align-self-auto)

#### auto-margin-alignment
+ helps with auto margin behavior for flex items
    + [default margin](http://understanding-flexbox.surge.sh/#auto-margin-alignment)
    + [margin-right: auto](http://understanding-flexbox.surge.sh/#auto-margin-alignment-margin-right-auto)
    + [margin-left: auto](http://understanding-flexbox.surge.sh/#auto-margin-alignment-margin-left-auto)
    + [margin-left: auto & margin-right: auto](http://understanding-flexbox.surge.sh/#auto-margin-alignment-margin-left-and-right-auto )

repository: npranto/understanding-flexbox

gha_language: HTML

repo_name: npranto/understanding-flexbox


text:
---
title: "acetylsalicylic acid - Pain"
sidebar: mydoc_sidebar
permalink: acetylsalicylicacidpain.html
toc: false
---

{% include image.html file="acetylsalicylicacidpain.png" alt="acetylsalicylicacidpain" %}

## Concepts

|------------|------|---------|
| Identifier | Name | Type    |
|------------|------|---------|
| MESH:D001241 | acetylsalicylic acid | Drug |
| UniProt:P23219 | Cox-1 | Protein |
| UniProt:P35354 | Cox-2 | Protein |
| MESH:D011453 | Prostaglandins | ChemicalSubstance |
| MESH:D010146 | Pain | Disease |
|------------|------|---------|

## Relationships

|---------|-----------|---------|
| Subject | Predicate | Object  |
|---------|-----------|---------|
| Acetylsalicylic Acid | DECREASES ACTIVITY OF | Cox-1 |
| Acetylsalicylic Acid | DECREASES ACTIVITY OF | Cox-2 |
| Cox-1 | INCREASES ABUNDANCE OF | Prostaglandins |
| Cox-2 | INCREASES ABUNDANCE OF | Prostaglandins |
| Prostaglandins | CAUSES | Pain |
|---------|-----------|---------|

Reference: [https://go.drugbank.com/drugs/DB00945#mechanism-of-action](https://go.drugbank.com/drugs/DB00945#mechanism-of-action){:target="_blank"}

repository: patrickrewers/DrugMechDB

repo_name: patrickrewers/DrugMechDB


text:
# Mars Clock as Serverless API

We use zeit now as our serverless platform.

### Endpoints

1. `/`: meta data of the api including descriptions of endpoints
2. `/now`: get the martian time for now
3. `/epoch/(epoch_time)`: calculate martian time based on the unix eopch time input

Examples:

1. `https://marsapi.interimm.org/now`
2. `https://marsapi.interimm.org/epoch/1562018066`

## Development

1. Write your function and add routes to `now.json`.
2. Deplow with `now`.

## References

1. [Barebone Serverless Python JSON API on Zeit Now](https://camillovisini.com/barebone-serverless-python-json-api-on-zeit-now/)
2. [visini/barebone-serverless-api-zeit-now](https://github.com/visini/barebone-serverless-api-zeit-now)

repository: InterImm/marsapi-serverless

gha_language: Python

repo_name: InterImm/marsapi-serverless


text:
# Dotfiles

Yet another dotfiles repo... but these ones are mine.

## Installation
```
mkdir dotfiles
cd dotfiles
git clone https://github.com/ollien/dotfiles
./install.sh
```

repository: ollien/dotfiles

repo_name: ollien/dotfiles


text:
Indices
-------

Nodes namespace contains methods for operations made on indices or information about them. Available for  Manticore Search 3.4 or above.

Create
======
Create a new index.

`index` is mandatory.
`body` can contain:

* `columns` - definition of fields for indexes with data
* `settings` - various index settings
* `silent` -  optional, if set to true, the create will not fail with error if there is already an index with the designated name

`body` require presence of `columns`  array for RT and PQ indexes where keys are the field names.

Each field is an array that must contain `type` defined.
`text` type also support `options`, current possible values are `indexed` and `stored`.

Index settings can be set in `settings` parameter.

By default, the index type is Real-Time. For PQ or distributed indexes, the options must contain a `type` property.

        $params = [
            'index' => 'testrt',
            'body' => [
                'columns' => [
                    'title' => [
                        'type' => 'text',
                        'options' => ['indexed', 'stored']
                    ],
                    'gid' => [
                        'type' => 'integer'
                    ]
                ],
                'settings' => [
                    'rt_mem_limit' => '256M',
                    'min_infix_len' => '3'
                ]
            ]
        ];
        $response = $client->indices()->create($params);

For distributed indexes, the body must have only the `options` array, since they don't have any data (so no `columns`).

        $params = [
            'index' => 'mydistributed',
            'body' => [
                'options' => [
                    'type' => 'distributed',
                    'local' => 'index1'
                    'local' => 'index2`
                ]
            ]
        ];
        $response = $client->indices()->create($params);

Drop
===
Drop an existing index. `index` is mandatory.

`body` can contain optional parameter `silent` - for not failing with error in case the index doesn't exist.

        $params = [
            'index' => 'testrt',
            ['body' => ['silent'=>true ]]
         ];
        $response = $client->indices()->drop($params);

Alter
====
Alter perform changes on indexes. Currently supported only add/drop columns.
Note that `text` type cannot be used in this call.

Expects `index` name.

`body` parameters:

* `operation` -  mandatory, possible values: add,drop
* `column` -  for add,drop operations the column is an array of
    * `name` -  column name
    * `type` - data type

        $params = [
            'index' => 'testrt',
            'body' => [
                'operation' => 'add',
                'column' => [
                    'name' => 'tag',
                    'type'=> 'string'
                ]

            ]
        ];
        $response = $client->indices()->alter($params);

        $params = [
            'index' => 'testrt',
            'body' => [
                'operation' => 'drop',
                'column' => [
                    'name' => 'tag'
                ]

            ]
        ];
        $response = $client->indices()->alter($params);

Describe
========
Returns structure of an index.

Expects `index` name.

`body` is optional. It support `pattern` as a column name for filtering the structure result.

        $params = [
            'index' => 'testrt',
            'body' => [
                'pattern' => 'columnname'
            ]
        ];
        $response = $client->indices()->describe($params);

FlushRamchunk
=============
Flushed RAM chunk for a RT index.

Expects `index` name.

        $params = [
            'index' => 'testrt',
         ];
        $response = $client->indices()->flushramchunk($params);

FlushRtindex
============
Flushed the RT index to disk.
Expects only `index` name.

        $params = [
            'index' => 'testrt',
         ];
        $response = $client->indices()->flushrtindex($params);

Optimize
========

Launch optimization on RT index. The command doesn't wait by default for the optimize operation to finish.

Expects `index` name.

`body` is optional. Supports `sync` parameter - if set, the command waits for the optimize to finish.

        $params = [
            'index' => 'testrt',
            'body' => [ 'sync'=>true]
         ];
        $response = $client->indices()->optimize($params);

Status
======
Return statistics about index: documents, size, chunks, as well as query statistics.

Expects `index` name.

`body` is optional. It support `pattern` as a property/performance metric to filter upon.

        $params = [
            'index' => 'testrt',
            'body' => [
                'pattern' => 'propertyname'
            ]
        ];
        $response = $client->indices()->status($params);

Settings
========
Return a report with index's current settings.

Expects `index` name.

        $params = [
            'index' => 'testrt',
        ];
        $response = $client->indices()->status($params);

Truncate
========
Truncates an index.

Expects `index` name.

        $params = [
            'index' => 'testrt'
         ];
        $response = $client->indices()->truncate($params);

repository: adriannuta/manticoresearch-php

repo_name: adriannuta/manticoresearch-php


text:
iRobot is a company (started by MIT alumni and faculty) that sells the Roomba vacuuming robot (watch one of the product videos to see these robots in action). Roomba robots move around the floor, cleaning the area they pass over.

In this problem set, you will code a simulation to compare how much time a group of Roomba-like robots will take to clean the floor of a room using two different strategies.

The following simplified model of a single robot moving in a square 5x5 room should give you some intuition about the system we are simulating.

The robot starts out at some random position in the room, and with a random direction of motion. The illustrations below show the robot's position (indicated by a black dot) as well as its direction (indicated by the direction of the red arrowhead).

**Time t = 0**
The robot starts at the position (2.1, 2.2) with an angle of 205 degrees (measured clockwise from "north"). The tile that it is on is now clean.

**t = 1**
The robot has moved 1 unit in the direction it was facing, to the position (1.7, 1.3), cleaning another tile.

**t = 2**
The robot has moved 1 unit in the same direction (205 degrees from north), to the position (1.2, 0.4), cleaning another tile.

**t = 3**
The robot could not have moved another unit in the same direction without hitting the wall, so instead it turns to face in a new, random direction, 287 degrees.

**t = 4**
The robot moves along its new direction to the position (0.3, 0.7), cleaning another tile.

####SIMULATION DETAILS

Here are additional details about the simulation model. Read these carefully.

* Multiple robots
In general, there are N > 0 robots in the room, where N is given. For simplicity, assume that robots are points and can pass through each other or occupy the same point without interfering.

* The room
The room is rectangular with some integer width w and height h, which are given. Initially the entire floor is dirty. A robot cannot pass through the walls of the room. A robot may not move to a point outside the room.

* Tiles
You will need to keep track of which parts of the floor have been cleaned by the robot(s). We will divide the area of the room into 1x1 tiles (there will be w * h such tiles). When a robot's location is anywhere in a tile, we will consider the entire tile to be cleaned (as in the pictures above). By convention, we will refer to the tiles using ordered pairs of integers: (0, 0), (0, 1), ..., (0, h-1), (1, 0), (1, 1), ..., (w-1, h-1).

* Robot motion rules
  * Each robot has a position inside the room. We'll represent the position using coordinates (x, y) which are floats satisfying 0 ≤ x < w and 0 ≤ y < h. In our program we'll use instances of the Position class to store these coordinates.

  * A robot has a direction of motion. We'll represent the direction using an integer d satisfying 0 ≤ d < 360, which gives an angle in degrees.

  * All robots move at the same speed s, a float, which is given and is constant throughout the simulation. Every time-step, a robot moves in its direction of motion by s units.

  * If a robot detects that it will hit the wall within the time-step, that time step is instead spent picking a new direction at random. The robot will attempt to move in that direction on the next time step, until it reaches another wall.

* Termination
The simulation ends when a specified fraction of the tiles in the room have been cleaned.

path: /Set-2/Simulation Overview.md

filename: Simulation Overview.md


text:
---
title: ConEmu | FAQ - Part 6

description: Frequenly asked user questions about ConEmu usage

breadcrumbs:
 - url: TableOfContents.html#conemu
   title: ConEmu

otherlang:
   en: /en/FAQ-6.html
   ru: /ru/FAQ-6.html
---

# Configuration  {#q-6-settings}

{% include faq_disclaimer_en.md %}

* [Q. How run cmd file to initialize the environment (cmd prompt)?](#q-6-12)
* [Q. How to let Shift-Home select prompt text to the start of command?](#q-6-13)
* [Q. Is it possible to set up ConEmu to open multiple tabs on startup (e.g. Far, CMD, PowerShell)?](#q-6-1)
* [Q. Duplicate Far Manager windows](#q-6-2)
* [Q. How to configure a bitmap font?](#q-6-3)
* [Q. Why are horizontal lines (drawn using box drawing characters) discontinuous?](#q-6-4)
* [Q. How to start several consoles in 2x2 grid](#q-6-5)
* [Q. How do you configure ConEmu to run cmd.exe as an Administrator from an Explorer integration?](#q-6-6)
* [Q. How do I give each tab opened by a {Task} a custom name?](#q-6-7)
* [Q. How to set up Git Bash Here in ConEmu ?](#q-6-8)
* [Q. How to export ConEmu settings?](#q-6-9)
* [Q. How to attach a running console application to a new ConEmu instance?](#q-6-10)
* [Q. How to delete items from the ‘Create new console’ dropdown?](#q-6-11)

#### Q. How run cmd file to initialize the environment (cmd prompt)?   {#q-6-12}

**A.** There are examples in [Tasks](Tasks.html): ‘Shells::cmd’,
‘SDK::VS 15.0 x64 tools prompt’, and so on. They set up prompt and environment
variables.

**TL;DR.** Use `/k` switch: `cmd.exe /k ...`! Without it you would
get the message ‘Root process was alive less than 10 sec’. And it's true.
Without `/k` switch you ask ConEmu (actually cmd) to ‘execute this batch and exit’.

Does not matter how do you [run you cmd (batch) script](LaunchNewTab.html),
the rules are the same for ‘cmd.exe’. [Tasks](Tasks.html), [New console dialog](LaunchNewTab.html),
command prompt, Windows' `Win+R` dialog, whatever...

Run `cmd /?` to understand switches and capabilities.
And **take care** about **double quotes**.

Desktop shortcut example. It runs *new* ConEmu window with cmd.exe
initialized via file `C:\Your tools\YourScript.cmd`.

~~~
ConEmu64.exe -nosingle -run cmd.exe /k "C:\Your tools\YourScript.cmd".
~~~

#### Q. How to let Shift-Home select prompt text to the start of command?   {#q-6-13}

Some essential information cannot be obtained by ConEmu automatically in some shells.
Obviously, if ConEmu doesn't know where prompt input was started, it cannot select
command text without prompt label.

~~~
Max@PC /mnt/c/Sources $ git clone ssh://...
<---- prompt label ----><command..........>
~~~

Use [ANSI](AnsiEscapeCodes.html#ConEmu_specific_OSC) to notify ConEmu where command input starts.
The solution depends on your [shell](TerminalVsShell.html), check examples for
[PowerShell](PowershellPrompt.html#prompt) and [bash](ShellWorkDir.html#connector-ps1).

#### Q. Is it possible to set up ConEmu to open multiple tabs on startup (e.g. Far, CMD, PowerShell)?   {#q-6-1}

**A.** Yes. Use a startup command file. Example - create **startup.txt** with the contents:

~~~
>E:\Source\FARUnicode\trunk\unicode_far\Debug.32.vc\far.exe
*/BufferHeight 400 cmd
/BufferHeight 1000 powershell
~~~

and run ConEmu like this:

~~~
conemu.exe /cmd @startfile.txt
~~~

Each line in the file corresponds to a launched command. You may specify the console buffer height using the /BufferHeight parameter. If the line starts with "`>`", this tab will be active on startup. If the line starts with "`*`", this command will be ran with administrator privileges.

#### Q. Duplicate Far Manager windows   {#q-6-2}

**A.** The real console was not hidden. Check the 'Visible' flag on the 'Features' tab in the 'Settings' dialog, or this registry value:

~~~
[HKEY_CURRENT_USER\Software\ConEmu\.Vanilla]
"ConVisible"=hex:00
~~~

#### Q. How to configure a bitmap font?   {#q-6-3}

**A.** The bitmap fonts selectable in the standard console's properties are actually the Terminal font. For example, the bitmap '8 x 12' font is 'Terminal 12 x 8' in ConEmu, '12 x 16' -> 'Terminal 16 x 12', etc.

> Take note: The 'Charset' field must be set to 'OEM'.
> Personally, I prefer 'Fixedsys 16 x 8', which is absent in the standard console.

**A.** In the font list you may directly select e.g. `[Raster Fonts 8x12]`.

#### Q. Why are horizontal lines (drawn using box drawing characters) discontinuous?   {#q-6-4}

**A.** In some fonts, the width of the corresponding box drawing characters is shorter than the font's declared average character width, which ConEmu uses to determine the size of box drawing characters. To get rid of the artifacts, enable the checkbox ‘Fix Far borders’ and increase the width of the "frames" font. The corresponding settings are on the 'Main' tab in the 'Settings' dialog.

#### Q. How to start several consoles in 2x2 grid   {#q-6-5}

**A.** The question from [superuser.com](http://superuser.com/q/473807/139371). ConEmu (build 120909 or higher recommended) provides [SplitScreen](SplitScreen.html) feature. You may set up named task to open several consoles on startup in the grid. Here the example for 2x2 grid.

~~~
>cmd -cur_console:n
cmd -cur_console:s1TVn
cmd -cur_console:s1THn
cmd -cur_console:s2THn
~~~

#### Q. How do you configure ConEmu to run cmd.exe as an Administrator from an Explorer integration?   {#q-6-6}

**A.** Read the answer on [superuser.com](http://superuser.com/q/470408/139371).

#### Q. How do I give each tab opened by a {Task} a custom name?   {#q-6-7}

**A.** Read the answer on [superuser.com](http://superuser.com/q/459154/139371).

#### Q. How to set up Git Bash Here in ConEmu?   {#q-6-8}

**A.** Read the answer on [superuser.com](http://superuser.com/q/454380/139371).

#### Q. How to export ConEmu settings?   {#q-6-9}

**A.** Read the answer on [superuser.com](http://superuser.com/q/450144/139371).

#### Q. How to attach a running console application to a new ConEmu instance?   {#q-6-10}

**A.** Read the answer on [superuser.com](http://superuser.com/q/445394/139371).

#### Q. How to delete items from the ‘Create new console’ dropdown?   {#q-6-11}

**A.** Read the answer on [superuser.com](http://superuser.com/a/436273/139371).


text:
# vid2frame
vid2frame is built on top of opencv-python. It converts video into frames

## Python version
Python 3.6.4

## Dependencies
  1. opencv-python
  2. numpy

## How to install
vid2frame has been published on Python Package Index (PyPi). vid2frame can be installed using the following command.
```
pip install vid2frame
```

## How to use
```
from vid2frame import vid2frame

vid2frame.convert('test.mp4', 'target_folder')
```
The convert function will read `test.mp4` and store the frames to `target_folder`


text:
# Customizing Lock

- [Full Tutorial](https://auth0.com/docs/quickstart/native/android/10-customizing-lock)

This demo project contains a basic structure that includes a customized lock activity.

### Important Snippets

How to create a theme:

```java
Theme customizedLockTheme = Theme.newBuilder()
	.withHeaderTitle(R.string.app_name)
	.build();
```

How can you add it to the lock activity:

```java
this.lock = Lock.newBuilder(auth0, callback)
	.withTheme(customizedLockTheme)
	.build();
```


text:
---
title: "Email for custom domain"
date: 2020-09-02T22:24:20+03:00
toc: false
tags: ["cloudflare", "email", "protonmail"]
---

## Domain

1. Create an account in Cloudflare
2. Come up with a new domain name
3. Register and buy it using credit card (about 10$)

## Email

1. Create an account in Protonmail
2. Buy paid subscription (about 5$)
3. Setup custom domain for Protonmail
4. Go to Protonmail setup custom domain wizard:
{{< img "wizard.png" "Protonmail custom domain wizard" >}}
5. Go to Cloudflare and create DNS records:
{{< img "dns.png" "Cloudflare DNS settings" >}}
6. Add some email adresses:
{{< img "emails.png" "Protonmail custom emails" >}}
7. Now you can use Protonmail to send and receive emails using your email

repository: aleksandr-kiriushin/everalerta

repo_name: aleksandr-kiriushin/everalerta


text:
Work in progress
============
This libary is a work in progress with limited testing.

Introduction
============

This is a port of the Adafruit_CircuitPython_RFM69 library of which this repo is forked from and found here:
https://github.com/adafruit/Adafruit_CircuitPython_RFM69

I would like to thank jerryn/jerryneedell for his assistance in getting me to this point.<br/>
https://forums.adafruit.com/viewtopic.php?f=60&t=168167&start=15

MicroPython RFM69 packet radio module.  This supports basic RadioHead-compatible sending and
receiving of packets with RFM69 series radios (433/915Mhz).

.. warning:: This is NOT for LoRa radios!

.. note:: This is a 'best effort' at receiving data using pure Python code--there is not interrupt
    support so you might lose packets if they're sent too quickly for the board to process them.
    You will have the most luck using this in simple low bandwidth scenarios like sending and
    receiving a 60 byte packet at a time--don't try to receive many kilobytes of data at a time!

This has been tested on various ESP32 and ESP8266 dev boards.  For detailed information on experiments with these devices, please visit the repository below:

https://github.com/nohcpy/LoPPyIOT

Usage Example
=============
See rfm69_simpletest.py for a simple demo of the usage.

.. code-block:: python

    # Initialze RFM radio
    rfm69 = RFM69(spi, CS, RESET, RADIO_FREQ_MHZ)


text:
# Ubuntu Secure
TODO: harden, harden, harden

# Ubuntu Remove Telemetry
Removes Telemetry and does basic system more secure and protected

## This script does:
* System update and software upgrade
* Amazon & advert web apps removing
* AptUrl Removing ( tool, which gives possibilities to start installation by clicking on url, can be executed with js, which is not secure)
* Guest session disable for LightDM
* Remote login disable for LightDm
* DNS encryption (dnscrypt-proxy)
* FireWall (UFW)
* Antivirus (ClamAV)
* Brute Force protection (Fail2Ban)
* Basic Telemetry Removing (ZeitGeist) and unsecure libs and pre-installed software with high and potentional risks

## How to use:
1. Download all files
2. Make ubuntu-secure.sh executable with *sudo chmod +x ubuntu-secure.sh* command.
3. **Read all code in the file and uncomment some commands**, if you need them, save the changes.
4. Execute the script from terminal: *sudo ./ubuntu-secure.sh*

### Thank you!

Thank you for your interest to the script. Any issues, advices and pull requests are welcome.

#### Inspired by [@serghei](https://github.com/butteff)


text:
# M62419FP Monitor

![Photo](https://user-images.githubusercontent.com/52712/38273422-bed866be-3740-11e8-880b-c5b14daa2f4f.png)

## Overview

This is an ATmega1284 project that passively monitors SPI commands sent to a Mitsubishi [M62419FP](https://web.archive.org/web/20180405163918/https://www.renesas.com/en-us/doc/products/assp/rej03f0207_m62419fpds.pdf) sound controller, which is used in the Premium 4 radio.  As SPI commands are sent to the M62419FP, the AVR receives them and tracks what should be the state of the M62419FP internal registers.  It then sends that data out its UART to a host computer.  Software runs on the host computer that continuously displays the current state of the M62419FP.

## Features

 - Clips onto the M62419FP with two wires (SPI clock and data)
 - Interprets all documented SPI commands
 - Tracks attenuation, balance, fade, bass, treble, and input selection
 - Sends all its state out its UART after any SPI command is received

## Usage

The firmware is written completely in AVR assembly.  It is assembled with ASAVR, part of the [ASxxxx](https://shop-pdp.net/ashtml/) package, and flashed with [AVRDUDE](https://github.com/avrdudes/avrdude).  See the [`Makefile`](./firmware/Makefile) for the required commands.

Build the hardware as described in [`hardware/`](./hardware/) and flash the firmware.
Connect the two clips to the SPI lines of the M62419FP.  Reset the board first and then the radio.  As soon as the board receives an SPI command, it will interpret the command and send the current state of the M62419FP out its UART using a binary protocol.

Run the host software:

```
$ python3 host/monitor.py

CH0/R=0 dB (L=0,I=FM)  CH1/L=0 dB (L=0,I=FM)  FADER=0 dB (F)  BASS=0 dB  TREB=0 dB
```

Make a sound adjustment on the radio such as turning the volume knob.  The radio will send an SPI command to the M62419FP, the board will capture it and send data to the host, then status line on the host will update.

## Notes

- The M62419FP doesn't have a chip select or reset line that could be used for synchronization.  It only has SPI clock and data lines.  If the board is disconnected from the M62419FP while the target is running, the board and
the target need to be reset or else sync will be lost and SPI commands will not be received correctly.

- The Premium 4 radio uses the M62419FP for attenuation, fade, balance, and input selection.  It doesn't use the bass or treble registers of the M62419FP.  Those registers are tracked but they will always show as 0.

- The board has only been tested with the Premium 4 radio.  It can likely be used to monitor other devices that use an M62419FP as well, if the SPI clock rate is slow enough.  SPI receive is done in software ("bit banging") because the ATmega1284 hardware SPI is not capable of receiving the M62419FP's 14-bit commands.

repository: mnaberez/vwradio

repo_name: mnaberez/vwradio


text:
## SQLite databases with Python Programming

### **About**

1) Using SQLite in your python programs is very easy and convenient.
2) As per official document of Python3 "https://docs.python.org/3/library/sqlite3.html"
SQLite is basically a C library which provides a lightweight disk-based database. It doesn’t require a separate server process like the old traditional database.
It also allows accessing the database using a nonstandard variant of the SQL query language.
Some applications can use SQLite for internal data storage. It’s also possible to prototype an application using SQLite and then port the code to a larger database such as PostgreSQL or Oracle.

path: /SQLite with Python/SQLite_Basics.md


text:
NPM scripts could be run with command:
```
npm run <script name>
```

# build

Build production package in `lib` folder.

# doc

Build documentation in `docs` folder.

# open-doc

Build documentation with `npm run doc` and open the documentation in default browser.

# eslint

Use eslint to check the code.

# test

Run unit tests.


text:
# from-and-to-json package

Atom package to convert selected JSON to Javascript object and vice versa.

## Install

    apm install from-and-to-json

## How to use

- Select text to convert
- Right click > To JSON
- Right click > To JS

repository: ckirk/atom-settings

repo_name: ckirk/atom-settings


text:
# ![Sabaki: An elegant Go/Baduk/Weiqi board and SGF editor for a more civilized age.](./banner.png)

[![Download the latest release](https://img.shields.io/github/downloads/SabakiHQ/Sabaki/latest/total?label=download)](https://github.com/SabakiHQ/Sabaki/releases)
[![CI](https://github.com/SabakiHQ/Sabaki/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/SabakiHQ/Sabaki/actions)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://www.paypal.me/yishn/5)

## Features

- Fuzzy stone placement
- Read and save SGF games and collections, open wBaduk NGF and Tygem GIB files
- Display formatted SGF comments using a
  [subset of Markdown](https://github.com/SabakiHQ/Sabaki/blob/master/docs/guides/markdown.md)
  and annotate board positions & moves
- Personalize board appearance with
  [textures & themes](https://github.com/SabakiHQ/Sabaki/blob/master/docs/guides/theme-directory.md)
- SGF editing tools, including lines & arrows board markup
- Copy & paste variations
- Powerful undo/redo
- Fast game tree
- Score estimator & scoring tool
- Find move by move position and comment text
- [GTP engines](https://github.com/SabakiHQ/Sabaki/blob/master/docs/guides/engines.md)
  support with
  [board analysis for supported engines](https://github.com/SabakiHQ/Sabaki/blob/master/docs/guides/engine-analysis-integration.md)
- Guess mode
- Autoplay games

![Screenshot](screenshot.png)

## Documentation

For more information visit the
[documentation](https://github.com/SabakiHQ/Sabaki/blob/master/docs/README.md).
You're welcome to
[contribute](https://github.com/SabakiHQ/Sabaki/blob/master/CONTRIBUTING.md) to
this project.

## Building & Tests

See
[Building & Tests](https://github.com/SabakiHQ/Sabaki/blob/master/docs/guides/building-tests.md)
in the documentation.

## License

This project is licensed under the
[MIT license](https://github.com/SabakiHQ/Sabaki/blob/master/LICENSE.md).

## Donators

A big thank you to these lovely people:

- Eric Wainwright
- Michael Noll
- John Hager
- Azim Palmer
- Nicolas Puyaubreau
- Hans Christian Poerschke
- David Göbel
- Dominik Olszewski
- Brian Weaver
- Philippe Fanaro
- James Tudor
- Frank Orben
- Dekun Song
- Dimitri Rusin
- Andrew Thieman
- Adrian Petrescu
- Karlheinz Agsteiner
- Petr Růžička
- Sergio Villegas
- Jake Pivnik

## Related

- [Shudan](https://github.com/SabakiHQ/Shudan) - A highly customizable,
  low-level Preact Goban component.
- [boardmatcher](https://github.com/SabakiHQ/boardmatcher) - Finds patterns &
  shapes in Go board arrangements and names moves.
- [deadstones](https://github.com/SabakiHQ/deadstones) - Simple Monte Carlo
  functions to determine dead stones.
- [go-board](https://github.com/SabakiHQ/go-board) - A Go board data type.
- [gtp](https://github.com/SabakiHQ/gtp) - A Node.js module for handling GTP
  engines.
- [immutable-gametree](https://github.com/SabakiHQ/immutable-gametree) - An
  immutable game tree data type.
- [influence](https://github.com/SabakiHQ/influence) - Simple heuristics for
  estimating influence maps on Go positions.
- [sgf](https://github.com/SabakiHQ/sgf) - A library for parsing and creating
  SGF files.

repository: SabakiHQ/Sabaki

repo_name: SabakiHQ/Sabaki


text:
---
templateKey: blog-post
title: Clean up unused git branches
path: blog-post
date: 2017-02-22T03:39:00.000Z
description: If you’re using git and creating branches, then making pull
  requests, and ultimately merging them back into your main/master branch, you
  may end up with unused branches cluttering your repository.
featuredpost: false
featuredimage: /img/git-logo.svg_.png
tags:
  - git
  - GitHub
  - tip
category:
  - Software Development
comments: true
share: true
---
If you’re using git and creating branches, then making pull requests, and ultimately merging them back into your main/master branch, you may end up with unused branches cluttering your repository. They don’t really hurt anything, but they can add some clutter and make it more difficult to find the branches that are actually in use. Wouldn’t it be nice if you could easily identify which ones were active and which had already been merged in? Fortunately, there is!

## Find all remote git branches

I’ll assume you can manage your local branches easily enough; it’s the remote ones that everybody on the team shares that are more important to keep under control. If you want to get a list of them from the command line, you should first run

`git fetch -p`

which will fetch tags and branches from your remote repo, and will remove remote-tracking branches from your local repo that are no longer on the remote. This will cut down on false positives for the next command:

`git branch -a`

This command will list all of the branches, both locally and on the remote (use -r for just remote). Here’s an example of the output:

![](/img/gitbrancha.png)

Now, what would be really nice would be to **see a list of branches that were already merged**. Fortunately, git doesn’t disappoint:

`git branch -a --merged`\
``\
Here’s the output for the same repo shown above, with this command:

![](/img/gitbrancha-merged.png)

With that, you should easily be able to identify your long-running branches and branches that you can probably remove (e.g. remove-wrench and tdykstra-patch-1 in the above list). To actually delete remote branches, you can use:

`git push origin --delete <branch_name>`

What if you want to [prune every time you do a pull or fetch](https://stackoverflow.com/a/18718936)? No problem. Just set your configuration to remote.origin.prune to true:

`git config remote.origin.prune true`

## List Branches On GitHub

If your repository is hosted on GitHub, you can also view remote branches on GitHub.com. Just click on the “N branches” link on the repository home page:

![](/img/github-branches-link.png)

From there you will see branches, organized by default to show which ones GitHub considers to be active or stale, and which are yours. You can also view all branches.

![](/img/github-branches.png)

From here, you should be able to easily identify any branches that can be deleted, which you can then do by clicking the trashcan icon. Branches that have already been merged can typically be safely deleted, and in any case remember that a branch is just a pointer to a difference set. Deleting the branch doesn’t delete the commit it’s referencing.

**Tip**: You can also use this page to find a branch for which you’re looking to create a pull request!

*Want a new tip like this every Wednesday?* Sign up for my [Weekly Dev Tips](https://ardalis.com/tips).

repository: ShadyNagy/ardalis-com-gatsby

repo_name: ShadyNagy/ardalis-com-gatsby


text:
调整RGB图像的饱和度。

**别名** : [ `tf.compat.v1.image.adjust_saturation` ](/api_docs/python/tf/image/adjust_saturation), [ `tf.compat.v2.image.adjust_saturation` ](/api_docs/python/tf/image/adjust_saturation)

```
 tf.image.adjust_saturation(
    image,
    saturation_factor,
    name=None
)

```

This is a convenience method that converts RGB images to floatrepresentation, converts them to HSV, add an offset to the saturation channel,converts back to RGB and then back to the original data type. If severaladjustments are chained it is advisable to minimize the number of redundantconversions.

 `image`  is an RGB image or images.  The image saturation is adjusted byconverting the images to HSV and multiplying the saturation (S) channel by `saturation_factor`  and clipping. The images are then converted back to RGB.

#### 参数：
- **`image`** : RGB image or images. Size of the last dimension must be 3.
- **`saturation_factor`** : float. Factor to multiply the saturation by.
- **`name`** : A name for this operation (optional).

#### 返回：
Adjusted image(s), same shape and DType as  `image` .

#### 用法示例：

```
 >> import tensorflow as tf
>> x = tf.random.normal(shape=(256, 256, 3))
>> tf.image.adjust_saturation(x, 0.5)

```

#### 加薪：
- **`InvalidArgumentError`** : input must have 3 channels

repository: veaba/tensorflow-docs

repo_name: veaba/tensorflow-docs


text:
## BIFT

BIFT is stand for BlankOn Installer Functional Testing.  A tool for testing the functionality of BlankOn Installer through some installation scenarios.

#### Requirements

- An ISO image file of `http://cdimage.blankonlinux.or.id/blankon/livedvd-harian/current/`. Put it in the `bift` direcotry.
- Python module `pyftpdlib`
- NodeJS
- Qemu

#### Run

- Install the node dependencies, `npm install`
- Run the test, `npm run test`

#### How it works

The current BlankOn Installer (`blankon-installer` and `blankon-installer-ui`) code base was included a pre script that fetch a scenario from `ftp://<IP_ADDRESS>:2121/scenario` (the default IP assigned to qemu host) and passing it to `blankon-instaler-ui`. The instaler will run with `DEBUG`, `AUTOFILL`, and `SCENARIO` environment variables that automate the installation process.

A scenario string consists of three or more underscore separated word. The first word represent wether the system is a legacy BIOS or UEFI. The second string is the partition table type. The rest are the scenario detail. Example :

`LEGACY_MBR_CLEANINSTALL`

Once the each installation complete, the post script will upload the installation logs to qemu host and BIFT will check at them.

#### License

MIT

repository: herpiko/bift

repo_name: herpiko/bift


text:
---
title: "Apache Camel 3 is only 2 months away"
date: 2019-10-02
authors: [davsclaus]
categories: ["Roadmap"]
preview: Status update on Camel 3 only 2 months away
---

The Camel team is busy working on the last set of work for Apache Camel 3. Today the 2nd release candidate was built and published on a staging repository for [early adopters to give it a try](https://mail-archives.apache.org/mod_mbox/camel-dev/201910.mbox/%3CCADL1oAqjZVvbJ1cnxqzdcUk%2BkuyCMdyc7w8agZuoN6SYZjPDnA%40mail.gmail.com%3E).

As I am busy myself then I just wanted to write a short blog post to keep the community posted that Apache Camel 3 is on the way, and that we expect it to be released by end of this year (sometime in November or December).

The latest deadline is to release Camel 3.0 before December 19th, 2019 as it was exactly on that day 1 year ago, we switched the master branch to become the work branch for Apache Camel 3. That means the total development time for Camel 3 would be 1 year.

Here is an illustration that highlights the timeline of Camel 3:

{{< image "camel3-progress.png" "Camel 3 timeline" >}}

That is not all Apache Camel, is now a family of 3 projects (at this moment). So working on Camel 3 is not all we do. [Camel K](https://github.com/apache/camel-k/) and [Camel Quarkus](https://github.com/apache/camel-quarkus) are very promising for cloud-native integration (microservices and serverless).

{{< image "camel3-projects.png" "Camel 3 projects" >}}

These projects have their own lifecycle. Will will post more details about these projects, and what’s new in Camel 3 in the following months leading up to the final release of Camel 3. So stay tuned.

PS: If you are migrating Camel 2.x applications to Camel 3, then read the [migration guide](/manual/camel-3-migration-guide.html).

repository: apache/camel-website

gha_language: CSS

repo_name: apache/camel-website


text:
# Player Workflows
This document outlines many considerations for using Video.js for advanced player workflows. Be sure to read [the setup guide](setup.md) first!

## Removing Players
No matter the term used for it, web applications are becoming common. Not everything is a static, load-once-and-done web page anymore! This means that developers need to be able to manage the full lifecycle of a video player - from creation to destruction. Video.js supports player removal through the `dispose()` method.

### [`dispose()`](http://docs.videojs.com/docs/api/player.html#Methodsdispose)
This method is available on all Video.js players and [components](http://docs.videojs.com/docs/api/component.html#Methodsdispose). It is _the only_ supported method of removing a Video.js player from both the DOM and memory. For example, the following code sets up a player and then disposes it when media playback is complete:

```js
var player = videojs('my-player');

player.on('ended', function() {
  this.dispose();
});
```

Calling `dispose()` will have a few effects:

1. Trigger a `"dispose"` event on the player, allowing for any custom cleanup tasks that need to be run by your integration.
1. Remove all event listeners from the player.
1. Remove the player's DOM element(s).

Additionally, these actions are recursively applied to _all_ the player's child components.

> **Note**: Do _not_ remove players via standard DOM removal methods: this will leave listeners and other objects in memory that you might not be able to clean up!

### Signs of an Undisposed Player
Seeing an error such as:

```
TypeError: this.el_.vjs_getProperty is not a function
```

or

```
TypeError: Cannot read property 'vdata1234567890' of null
```

Suggests that a player or component was removed from the DOM without using `dispose()`. It usually means something tried to trigger an event on it or call a method on it.

## Showing and Hiding a Player

It is not recommended that you attempt to toggle the visibility or display of a Video.js player. Doing so can be particularly problematic when it comes to the Flash tech. Instead, players should be created and [disposed](#removing-players) as needed.

This is relevant to use cases such as displaying a player in a modal/overlay. Rather than keeping a hidden Video.js player in a DOM element, it's recommended that you create the player when the modal opens and dispose it when the modal closes.

This is particularly relevant where memory/resource usage is concerned (e.g. mobile devices).

Depending on the libraries/frameworks in use, an implementation might look something like this:

```js
modal.on('show', function() {
  var videoEl = modal.findEl('video');
  modal.player = videojs(videoEl);
});

modal.on('hide', function() {
  modal.player.dispose();
});
```

## Using Video.js with...
Coming soon...

### jQuery
### React
### Ember
### Angular


text:
[![Amplience Dynamic Content](media/header.png)](https://amplience.com/dynamic-content)

# dc-sample-blog-nextjs

![License - Apache 2](https://img.shields.io/badge/license-Apache%202-blue.svg)
![](https://img.shields.io/badge/node-v10%2B-blue.svg)
![](https://img.shields.io/badge/nextjs-v9%2B-blue.svg)
![](https://img.shields.io/badge/amplience%20delivery%20sdk-v0.3.0%2B-blue.svg)
![https://travis-ci.org/amplience/dc-static-blog-nextjs](https://travis-ci.org/amplience/dc-static-blog-nextjs.svg?branch=master)

This is an application built using the Amplience Dynamic Content Service and the NextJS framework that generates a static blog website.

To see this in action go to [amplience-sample-blog-nextjs.netlify.app](https://amplience-sample-blog-nextjs.netlify.app).

# How To Use

To use this application you will need to install the content schemas (see ./schema/\*.json) and setup the search indexes in Dynamic Content and have some way of running the application, either on your local machine or hosted via a static site platform (for this guide we have used [Netlify](https://www.netlify.com) but you can use [Zeit](https://zeit.co/) if you wish).

Once you have everything installed you can then create new blog posts and publish them to your blog.

![Scheduling a Blog List update in Dynamic Content](./media/publish-blog-list-via-edition.gif)

# Installation

## Content Type Schemas

| Filename       | Schema ID                                                                                | Schema Type  | Visualization Supported |
| -------------- | ----------------------------------------------------------------------------------------------- | ------------ | ----------------------- |
| author.json    | https://raw.githubusercontent.com/amplience/dc-sample-blog-nextjs/master/schemas/author.json    | Content Type | No                      |
| blog.json      | https://raw.githubusercontent.com/amplience/dc-sample-blog-nextjs/master/schemas/blog.json      | Content Type | Yes                     |
| blog-post.json | https://raw.githubusercontent.com/amplience/dc-sample-blog-nextjs/master/schemas/blog-post.json | Content Type | Yes                     |
| image.json     | https://raw.githubusercontent.com/amplience/dc-sample-blog-nextjs/master/schemas/image.json     | Content Type | Yes                     |
| text.json      | https://raw.githubusercontent.com/amplience/dc-sample-blog-nextjs/master/schemas/text.json      | Content Type | Yes                     |
| video.json     | https://raw.githubusercontent.com/amplience/dc-sample-blog-nextjs/master/schemas/video.json     | Content Type | Yes                     |

### Creating Schemas & Registering Content Types

#### Import using our dc-cli tool (recommended)

You can import the schemas and content types to your hub using the [Dynamic Content CLI](https://www.npmjs.com/package/@amplience/dc-cli).

Install and configure the CLI tool, clone this repository and then use the the CLI import definitions included by running the following commands:

```
git clone https://github.com/amplience/dc-sample-blog-nextjs
cd dc-sample-blog-nextjs
npm install
npx dc-cli --clientId <YOUR_CLIENT_ID> --clientSecret <YOUR_CLIENT_SECRET> --hubId <YOUR_HUB_ID> configure
npm run sync
```

Notes:

- `npm run sync` imports the content-type-schemas and content-types as well as synchronizing any content type changes to your content items.

- The [CLI definitions](/dc-cli-definitions) assume that your hub contains a repository called 'content'. If your repository name is different you will need to update the definitions.

- If you do not want to use the CLI, you can create the schemas and register the content types listed above manually in Dynamic Content.

- Some places in the application use hardcoded values. Please be aware that these values will need to be changed when coding the application:
  - Header title (layouts/default.tsx)
  - Publisher logo/name in JsonLD (components/microdata/microdata.tsx)
  - Social links and Copyright information (components/footer/footer.tsx)

### Creating a Blog content item

Once you have installed and registered (or imported) all of the Schemas and Content Types, the next step is to create a blog content item. This is used to store the title and description for you blog to create the entry point for NextJs to build the blog.

How to create a blog content item for your blog:

1. Navigate to the "Production" section
2. Select the repo where you have registered "blog.json"
3. Click "Create content"
4. Select the "Blog" (or whatever label to assigned to the "blog.json" content type)
5. Enter a title, heading and search placeholder (these will appear on your blog)
6. Enter "blog" in the field \_meta > Delivery key (you may enter another value if you wish). This value will be used later on to retrieve the blog during the build phase.
7. Click "Save"
8. Click "Publish". The blog must be published for it to be available to the Netlify build process later, otherwise the build will fail.

### Creating a production search index for your published blog-posts

1. Navigate to the "Development" section
2. Select "Search Indexes"
3. Click "Create index"
4. Enter a search label (e.g. "blog posts")
5. Select the "Blog post" content type
6. Select "Production" when asked what kind of data is to be stored in this index.
7. Make a note of the index name in the top left (there's a copy text button next to it), we'll be needing this later
8. Select the "Keys" tab and make a note of the "Application ID" & "Search API key".

#### Configure your index

Configure searchable attributes, custom ranking (to ensure) and facets. Respectively these settings will ensure relevant keyword search, sort blog posts by the 'creation date' property (newest first), and enable filtering by author or tag.

On your index select the "Configure" tab and paste in the following configuration and click "Save".

```json
{
  "searchableAttributes": ["title", "description", "content"],
  "customRanking": ["desc(dateAsTimeStamp)"],
  "attributesForFaceting": ["tags", "authors.name"]
}
```

Note that the dateAsTimeStamp attribute used for ranking and sorting will not be available until you have configured the webhook custom payload and published some blog posts (see below).

#### Add sort options

For the sort-by drop menu to work we need to create the following sort options

| Property        | Ordering   |
| --------------- | ---------- |
| dateAsTimeStamp | Ascending  |
| readTime        | Ascending  |
| readTime        | Descending |

From the newly created search index click on the "Add sort option" button in the top right and enter the property and ordering and click "Save & complete" (repeating for each option).

#### Configure webhook custom payload

We have now created a Search Index and series of webhooks that can push and remove data to your search index whenever you publish or archive a Blog Post.

Next we have to customize the webhook payload, as we want change some of the data structures in the search index.

1. Navigate back to your Search Index (if you're not still there)
2. Select the "Webhooks" tab
3. Select the "indexing webhook" or "PUT" webhook, it should be called something like "Search Index: MyHub.blog-posts / Blog post" (you can click directly on the webhook name or via the context menu at the right hand side)
4. Scroll down the bottom of the webhook configuration screen and in "Payload" section replace `{{{JSONstringify this}}}` with the following:

```handlebars
{
  "_meta": {{{JSONstringify _meta}}},
  "title": {{{JSONstringify title}}},
  "description": {{{JSONstringify description}}},
  "deliveryKey": "{{{_meta.deliveryKey}}}",
  "schema": "{{{_meta.schema}}}",
  "authors": [
    {{~#forEach authors~}}
      { "name":"{{{name}}}" }{{#unless isLast}},{{/unless~}}
    {{~/forEach~}}
  ],
  {{#if tags~}}
    "tags": {{{JSONstringify tags}}},
  {{~/if~}}
  "date": "{{{this.date}}}",
  "dateAsTimeStamp": {{{moment date format="X"}}},
  "readTime": {{{readTime}}},
  "content": [
    {{~#each (pluck content "text")~}}
      {{{JSONstringify (sanitize (markdown this) ) }}}{{#unless @last}},{{/unless~}}
    {{~/each~}}
  ],
  "image": {{{JSONstringify image}}}
}
```

5. Click "Save" to save your changes

Notes:

- For more information regarding the webhook payload that is mentioned here, please our documentation - [Optimizing the Algolia record size](https://docs.amplience.net/integration/webhooksearchexamplepart2.html)

### Creating a staging search index for visualization and preview

1. Navigate to the "Development" section
2. Select "Search Indexes"
3. Click "Create index"
4. Enter a search label (e.g. "blog posts - staging")
5. Select the "Blog post" content type
6. Select "Staging" when asked what kind of data is to be stored in this index.
7. Make a note of the index name in the top left (there's a copy text button next to it), we'll be needing this later

#### Configure your index, Add sort options and Configure webhook custom payload

Repeat all of the steps used for your production index to configure your index, add sort options and configure webhook custom payload.

## Deploy To Netlify

Click on the button below to deploy this repository via Netlify.

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/amplience/dc-sample-blog-nextjs)

### Netlify Build Settings

During the Netlify setup process you will need to define the following build environment variables

#### Required settings

| Environment Var              | Description                                                             | Example                  |
| ---------------------------- | ----------------------------------------------------------------------- | ------------------------ |
| ALGOLIA_APPLICATION_ID       | The search application ID                                               | my-search-application-id |
| SEARCH_API_KEY               | The search API key                                                      | my-search-api-key        |
| SEARCH_INDEX_NAME_PRODUCTION | The production search index name                                        | my-hub.blog-posts        |
| DYNAMIC_CONTENT_DELIVERY_KEY | The Delivery Key of the Blog                                            | blog                     |
| DYNAMIC_CONTENT_HUB_NAME     | Your Dynamic Content Hub name (find this under Settings --> Properties) | my-hub                   |

#### Optional settings

| Environment Var                   | Description                                                                                | Example                                |
| --------------------------------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------- |
| DYNAMIC_CONTENT_BASE_URL          | Override the Content Delivery Base URL                                                               | https://api.amplience.net              |
| DYNAMIC_CONTENT_SECURE_MEDIA_HOST | Allows users with custom hostnames to override the hostname used when constructing secure media URLs | custom-secure-media-host.amplience.net |
| GA_TRACKING_ID                    | Google Analytics                                                                                | UA-1234567890                          |
| BASE_URL\*                        | Base URL, used in generating links                                                                   | https://blog.example.com               |
| ROBOTS_META_TAG_NOINDEX           | Adds a noindex,nofollow meta tag to blog pages                                                       | true                                   |
| SEARCH_INDEX_NAME_STAGING         | The Algolia staging index name, used for previewing content                                          | my-hub.staging-blog-posts              |
| AUTHORS_FACET_FIELD               | The name of the faceted field for authors                                                            | authors.name                           |
| TAGS_FACET_FIELD                  | The name of the faceted field for tags                                                               | tags                                   |
| HITS_PER_PAGE                     | The number of results to load from the search index (defaults to 10)                                 | 9                                      |

\* Netlify defines the `BASE_URL` environment variable for each build, meaning you don't have to supply it.

### Automate Netlify Deployments

It is possible to get Netlify to re-build and publish your blog whenever you publish a change in Dynamic Content using a [Dynamic Content Webhook](https://docs.amplience.net/integration/webhooks.html).

#### 1. Create a Netlify "Build hook"

1. Navigate to your Netlify Site settings section for you new blog.
2. Click on "Build & deploy".
3. Scroll down to the "Build hooks" section.
4. Click "Add a build hook".
5. Select the branch you wish to build, e.g. "master"

#### 2. Create a Dynamic Content Webhook

1. Navigate to the "Webhooks" section in Dynamic Content
2. Click "Add webhook"
3. Enter a sensible label (e.g. "Netlify Deployment")
4. Enter the Netlify "build hook" that you created in the previous section as your URL
5. Enable the Webhook trigger "Snapshot - Published"
6. Under "Filters", click new and add the JSON path "\$.payload.rootContentItem.contentTypeUri", ensure "Equals" operator is selected and enter "https://raw.githubusercontent.com/amplience/dc-sample-blog-nextjs/master/schemas/blog-post.json" as the value
7. Click "Save"

Notes:

- This will tell Netlify to rebuild your blog whenever you publish any Blog post changes

## Visualizations & Preview Support

Dynamic Content has two ways of allowing you to see you content changes before they go live:

- [Visualizations](https://docs.amplience.net/production/visualizations.html) provide an effective way of viewing a single content item directly from within Dynamic Content app during the authoring stage.
- [Previewing content](https://docs.amplience.net/planning/previewingcontent.html) is a great way of viewing how your entire blog site will look, showing the latest saved content before it is published.

### How to Configure Visualizations

For each of the Content Type Schemas that support visualization (see table in [Content Type Schemas](#Content-Type-Schemas)) update each registered content type to include a visualization. The Visualization URI should be the domain with the path of `/visualization/?vse={{vse.domain}}&content={{content.sys.id}}`, e.g. `https://blog.example.com/visualization/?vse={{vse.domain}}&content={{content.sys.id}}`

If you used the dc-cli tool to register your content types, they will already have visualizations added, so you just need to update each URI with the correct domain. You can do this by updating the CLI definitions in /dc-cli-definitions and running the `npm run sync` command again, or by manually updating your content types in Dynamic Content.

### How to configure or open Preview

To enable opening the application via the 'Preview' button in the Dynamic Content app's Planning section:

- Go to Hub settings > "Preview" in Dynamic Content. The Preview application URL should be the domain with the path of `/?vse={{vse.domain}}`, e.g.: `https://blog.example.com/?vse={{vse.domain}}`.
  To open the preview application directly in your browser:
- Go to Hub settings > "Preview" in Dynamic Content. Copy the Default preview staging environment domain. THis is your VSE domain.
- In your browser, go to your blog domain with with the preview domain passed in to the URL parameter `/?vse=`, e.g. `https://blog.example.com/?vse=example.staging.bigcontent.io`
  Notes:
- Since blog posts are published on demand, not through an edition, the purpose of the preview application is to display the blog with the latest staged content (current saved versions), no time-based preview will be possible. Therefore it is not required to configure it in Dynamic Content.

# Creating your first blog post

After all of that we now have everything setup and you are ready to start writing your first blog post.

1. In Dynamic Content go to the "Production" tab and select the "Content" repository on the left.
2. Click "Create content" and select the "Blog post" content-type
3. Proceed to fill out the form, you can click on the "( + )" icons to include other content items
4. Once done, click "Save"
5. Next we need to define the "Delivery Key" for this content item, this will become the URL path/slug (e.g. /blog/hello-and-welcome-to-our-new-blog)
6. You can preview your blog post via the visualization icon (the eye) in the toolbar.
7. Once you're happy, go ahead an publish.

# Publishing

Once you are ready to publish your blog within Dynamic Content just publish your new blog post directly from the "Production" side of Dynamic Content (select the context menu for the new blog post and select "Publish").

The webhooks that were generated when you created your search index will push your updates to the search index, and the Netlify webhook will be triggered to rebuild your site.

After a few moments your new blog post should be visible on your Netlify site.

# Local Development

Clone this repo and install the dependencies via npm:

```
npm ci
```

## Running Tests

The below command will run unit tests for the project:

```
npm run test
```

## Setup

To setup the application create a `.env` file within the root of the project containing the following - replacing values with the values you used during the setup of the blog.

```
DYNAMIC_CONTENT_DELIVERY_KEY=<Blog-Delivery-Key>
DYNAMIC_CONTENT_HUB_NAME=<Account-Name>
ALGOLIA_APPLICATION_ID=<SEARCH_INDEX_APPLICATION_ID>
SEARCH_API_KEY=<SEARCH_INDEX_SEARCH_KEY>
SEARCH_INDEX_NAME_PRODUCTION=<SEARCH_INDEX_NAME>
```

### Using Staging/Other Environments

To use the staging/other Dynamic Content environments, the base URL can be overridden to a different value.

```
DYNAMIC_CONTENT_BASE_URL=<Base-URL>
```

### Adding a noindex, nofollow meta tag to pages

It's possible that you do not want the content of the blog indexing just yet, so to help achieve this we have added a flag to add a noindex meta tag in the header of all blog pages.

Preview and visualization pages are always set to not be indexed, the pages that are configurable at the moment are the blog list and article pages.

**N.B. Blog pages are indexed by default.**

```
ROBOTS_META_TAG_NOINDEX=true
```

## Build & Run

First build the application using

```
npm run build
```

The application can then be started with

```
PORT=3000 npm run start
```

Note: Omitting the `PORT` environment var will mean your application will start up on port 5000.

## Run with Developer Mode

To start the application with Developer Mode use

```
PORT=3000 npm run dev
```

Note: Omitting the `PORT` environment var will mean your application will start up on port 3000.

## Export as Static Site

To generate the static site files use

```
npm run export
```

The files will be exported to the `out` directory, these can then be served as a static site.

## Built with

- [Next.js](https://nextjs.org/)
- [Amplience Dynamic Content Delivery API SDK](https://github.com/amplience/dc-delivery-sdk-js)

## Contributing

If you would like to contribute to this project, please follow our [contributing guide](./CONTRIBUTING.md).

## License

This software is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),

Copyright 2019 Amplience

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

repository: gopisv/dc-sample-blog-nextjs

repo_name: gopisv/dc-sample-blog-nextjs


text:
---
layout: post
title:  "Episode 20: Thinking Like Computers and Text Mining the Mueller Report"
date:   2019-04-26
categories: episode
---

In this episode, we discuss a study that recruits human researchers to try to predict how computers classify images. We then highlight a number of examples of natural language processing techniques applied to the Mueller Report.

<iframe src="https://anchor.fm/databytes/embed/episodes/20-Thinking-Like-Computers-and-Text-Mining-the-Mueller-Report-e3o0tg" height="102px" width="400px" frameborder="0" scrolling="no"></iframe>

### Sources

* [Researchers get humans to think like computers](https://www.sciencedaily.com/releases/2019/03/190322090239.htm)

* [Nature Communications: Humans can decipher adversarial images](https://www.nature.com/articles/s41467-019-08931-6.pdf)

* [Mueller Report and "Data Science" (part 1 in a series)](https://spdustin.gitlab.io/the-mueller-report/Part%201.html)

* [Using R To Analyze The Redacted Mueller Report](https://www.jlukito.com/blog/2019/4/20/using-r-to-analyze-the-redacted-mueller-report)


text:
# CalibrationErrors.jl

Estimation of calibration errors.

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://devmotion.github.io/CalibrationErrors.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://devmotion.github.io/CalibrationErrors.jl/dev)
[![Build Status](https://travis-ci.com/devmotion/CalibrationErrors.jl.svg?branch=master)](https://travis-ci.com/devmotion/CalibrationErrors.jl)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/devmotion/CalibrationErrors.jl?svg=true)](https://ci.appveyor.com/project/devmotion/CalibrationErrors-jl)
[![DOI](https://zenodo.org/badge/188981243.svg)](https://zenodo.org/badge/latestdoi/188981243)
[![Codecov](https://codecov.io/gh/devmotion/CalibrationErrors.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/devmotion/CalibrationErrors.jl)
[![Coveralls](https://coveralls.io/repos/github/devmotion/CalibrationErrors.jl/badge.svg?branch=master)](https://coveralls.io/github/devmotion/CalibrationErrors.jl?branch=master)

## Overview

This package implements different estimators of the expected calibration error
(ECE) and the squared kernel calibration error calibration error (SKCE) in the
Julia language.

## Example

Calibration errors can be estimated from a data set of predicted probabilities
and and a set of labels by executing
```julia
calibrationerror(estimator, data)
```

The data set `data` has to be a tuple of predictions and labels. The predictions
have to be provided as a matrix of size `(m, n)`, in which each of the `n`
columns corresponds to predicted probabilities of the labels `1,…,m`. The
corresponding labels have to be provided as a vector of length `n`, in which
every element is from the set `1,…,m`.

This package implements the estimator `ECE` of the ECE and the estimators
`BiasedSKCE`, `QuadraticUnbiasedSKCE`, and `LinearUnbiasedSKCE` for the SKCE.


text:
# quick-start-infrastructure

## Provisions tooling for the development environment.
* Concourse
* SonarQube
* HP Fortify
* Artifactory

## Related repositories
* https://github.com/ByteCubed/quick-start-microservice
* https://github.com/ByteCubed/quick-start-project
* https://github.com/ByteCubed/mdasii-challenge
* https://github.com/ByteCubed/developer-tools
* https://github.com/ByteCubed/quick-start-datascience
* https://github.com/ByteCubed/quick-start-infrastructure

repository: agile-samurai/AF-demo

gha_language: Java

repo_name: agile-samurai/AF-demo