text:
#Topology Converter Documentation

##Table of Contents
* [Glossary](#glossary)
* [Features](#features)
* [Installation](#installation)
* [Using Topology Converter](#using-topology-converter)
  * [The Basic Workflow](#the-basic-workflow)
  * [What is it doing?](#what-is-happening-when-you-run-topology-converter)
  * [Functional Defaults](#functional-defaults)
* [Optional Features](#optional-features)
  * [Providers](#providers)
  * [Faked Devices](#faked-devices)
  * [Boot Ordering](#boot-ordering)
  * [MAC Address Handout](#mac-handout)
  * [Ansible Hostfile Generation](#ansible-hostfile-generation)
  * [Inter-Hypervisor Simulation](#inter-hypervisor-simulation)
  * [Custom Templates](#custom-templates)
  * [Passthrough Attributes](#passthrough-attributes)
  * [Provisioning Scripts](#provisioning-scripts)
  * [Specifying an Ansible Playbooks](#ansible-playbooks)
  * [Debugging Mode](#debugging-mode)
* [Miscellaneous Info](#miscellaneous-info)
* [Example Topologies](#example-topologies)
  * [The Reference Topology](#the-reference-topology)
  * [2 Switch](#2-switch-topology)
  * [1 Switch 1 Server](#1-switch-1-server-topology)
  * [2 Switch 1 Server](#2-switch-1-server-topology)
  * [3 Switch Circular](#3-switch-circular-topology)

```
                                                                       +---------+
                                                                  +--> | LibVirt |
                    +----------------------+                      |    +---------+
+--------------+    |                      |    +--------------+  |
| Topology.dot +--> |  Topology-Converter  +--> | Vagrantfile  +--+
+--------------+    |                      |    +--------------+  |
                    +----------------------+                      |    +------------+
                                                                  +--> | VirtualBox |
                                                                       +------------+
```

##Glossary:
* **Topology File** -- Usually a file ending in the ".dot" suffix. This file describes the network topology link-by-link. Written in https://en.wikipedia.org/wiki/DOT_(graph_description_language). This file can be the same one used as part of the [Perscriptive Topology Manager (PTM) feature](https://docs.cumulusnetworks.com/display/DOCS/Prescriptive+Topology+Manager+-+PTM) in Cumulus Linux.
* **Provider** -- similar to a hypervisor, providers are Vagrant's term for the device that is either directoy hosting the VM (virtualbox) or the subsystem that vagrant is communicating with to further orchestratrate the creation of the VM (libvirt)
* **Interface Remapping** -- Interface remapping is the process by which interfaces are renamed to match the interfaces specified in the topology file. Interface Remapping uses UDEV rules that are orchestrated in the Vagrantfile and applied by the apply_udev.py script on the machines under simulation. This process allows a device in a topologyfile to simulate ports like "swp49" without having to simulate ports swp1-48. See the "[Miscellaneous Info](#miscellaneous-info)" Section for additional information.

##Features
* Converts a topology file "topology.dot" into a Vagrantfile
* 1 file is modified by the user to create a suitable Vagrantfile (topology.dot)
* Handles interface remapping on Vx instances (and hosts) to match the interfaces used in the provided topology file
* Removes extra Ruby-based logic from the Vagrantfile making a simple human-readable output
* Can generate Vagrantfiles that contain servers and switches and anything else that can be found in a Vagrant Box image
* Does not require Vagrant/Virtualbox/libvirt to be installed to create the Vagrantfile
* Supports the Virtualbox and Libvirt Vagrant Providers (Hypervisors)

##Installation

###Ubuntu
Both 16.04 and 14.04.

```
sudo apt install python-pip
sudo pip install --upgrade pip
sudo pip install setuptools
sudo pip install pydotplus
sudo pip install jinja2
```

###Mac

```
sudo easy_install pip
sudo pip install --upgrade pip
sudo pip install setuptools
sudo pip install pydotplus
sudo pip install jinja2
```

##Using Topology Converter
To use Topology Converter [TC] you need to work with one file: topology.dot

The actual name of the topology file is irrelevant. Your "topology.dot" file could be named "HAPPYHAPPYJOYJOY.dot" and that would be just fine.

###The Basic Workflow
**1). Create a Topology File**
Create a topology.dot file or borrow a provided ".dot" file from the "topology_converter/examples/" directory
In this example, we'll work with the topology_converter / examples / 2switch_1server.dot file shown below:

```
graph dc1 {
 "leaf1" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" config="./helper_scripts/extra_switch_config.sh"]
 "leaf2" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" config="./helper_scripts/extra_switch_config.sh"]
 "server1" [function="host" os="boxcutter/ubuntu1404" memory="400" ubuntu=True config="./helper_scripts/extra_server_config.sh"]
   "leaf1":"swp40" -- "leaf2":"swp40"
   "leaf1":"swp50" -- "leaf2":"swp50"
   "server1":"eth1" -- "leaf1":"swp1"
   "server1":"eth2" -- "leaf2":"swp1"
}
```

Place this topology.dot file in the same directory as topology_converter.py (or any subdirectory beneath the directory which contains topology_converter.py)

**2). Convert it to a Vagrantfile**

```
      $ python ./topology_converter.py ./topology.dot
```

or if using Libvirt:

```
      $ python ./topology_converter.py ./topology.dot -p libvirt
```

**3). Start the Simulation**

```
      $ vagrant up
```

or if using Libvirt:

```
      $ vagrant up --provider=libvirt
```

###What is happening when you run Topology Converter?
1. When topology_converter (TC) is called, TC reads the provided topology file line by line and learns information about each node and each link in the topology.
2. This information is stored in a variables datastructure. (View this datastructure using the "python ./topology_converter.py [topology_file] -dd" option)
3. A jinja2 template "Vagrantfile.j2" (stored in the /templates directory) is used to render a Vagrantfile based on the variables datastructure.

###Functional Defaults
Functional defaults provide basic options for memory and OS when using pre-defined functions. Presently the functional defaults are defined as follows but can be overwritten by manually specifying the associated attribute.

**For Functions:** "oob-switch" "exit" "spine" "leaf"

**Functional Defaults are:**
* os="CumulusCommunity/cumulus-vx"
* memory="300"

**For Functions:** "oob-server" and "host"

**Functional Defaults are:**
* os="boxcutter/ubuntu1604"
* memory="500"

Note: See more information about what functions are used for in the [Faked Devices](#faked-devices) and [Boot Ordering](#boot-ordering) sections.

##Optional Features (Everything Else)

###Providers
Topology Converter supports the use of two providers, Virtualbox and Libvirt (/w KVM). Virtualbox is the default provider.

To use Libvirt/KVM specify the "-p libvirt" option

```
-p PROVIDER, --provider PROVIDER
                      specifies the provider to be used in the Vagrantfile,
                      script supports "virtualbox" or "libvirt", default is
                      virtualbox.
```

###Faked Devices
In virtual environments it may not always be possible to simulate every single device due to memory restrictions, interest, proprietary OSes etc. Faked devices give Topology Converter a way to know that a device in a topology.dot file is not actually going to be simulated. However when a faked device is connected to a real device the real device MUST create an interface as if the faked device was actually present.
Creating the interface allows for the simulation of interface configuration that would face the faked device. If no interface was present, the interface configuration may fail which could inhibit automation tooling tests and ultimately provide a less accurate simulation. To specify that a device is to be faked, add it to the "function" attribute of the node definition in the topology file.

```
graph dc1 {
 "leaf1" [function="fake"]
 "leaf2" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" config="./helper_scripts/extra_switch_config.sh"]
   "leaf1":"swp40" -- "leaf2":"swp40"
   "leaf1":"swp50" -- "leaf2":"swp50"
}
```

###Boot Ordering
Boot ordering is accomplished in Virtualbox by using the "function" attribute of the node:
Order:

1). function="oob-server"

2). function="oob-switch"

3). function="exit"

4). function="spine"

5). function="leaf"

6). function="host"

7). function= ANYTHING ELSE

The boot order directly relates to the location of the VM's definition in the generated Vagrantfile... VMs at the top of the Vagrantfile will boot first.

###MAC Handout
If a MAC address is not specified using the format shown below then it will be auto assigned starting from the address [ 44:38:39:00:00:00 ] which is Cumulus' private MAC address range.

```
graph dc1 {
 "leaf1" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" config="./helper_scripts/extra_switch_config.sh"]
 "leaf2" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" config="./helper_scripts/extra_switch_config.sh"]
   "leaf1":"swp1" -- "leaf2":"swp1" [ left_mac="44:38:39:1eaf:11", right_mac="44:38:39:1eaf:21"]
   "leaf1":"swp2" -- "leaf2":"swp2" [ left_mac="44:38:39:1eaf:12", right_mac="44:38:39:1eaf:22"]
   "leaf1":"swp3" -- "leaf2":"swp3" [ left_mac="44:38:39:1eaf:13", right_mac="44:38:39:1eaf:23"]
   "leaf1":"swp4" -- "leaf2":"swp4" [ left_mac="44:38:39:1eaf:14", right_mac="44:38:39:1eaf:24"]
}
```

At the conclusion of the run, the MAC address to interface mapping will be written in CSV format to the dhcp_mac_map file that lives in the same directory as topology_converter.py. The format for that file is as follows:

```
#Device,interface,MAC
leaf1,swp1,4438391eaf11
leaf1,swp2,4438391eaf12
leaf1,swp3,4438391eaf13
leaf1,swp4,4438391eaf14
leaf2,swp1,4438391eaf21
leaf2,swp2,4438391eaf22
leaf2,swp3,4438391eaf23
leaf2,swp4,4438391eaf24
```

###Ansible Hostfile Generation
When the "-a" option is specified, Ansible hostfiles will be generated by Vagrant. TC will create a dummy playbook in the helper_scripts directory (called: empty_playbook.yml) with one task (shell: "uname -a") which will force Vagrant to create a hostfile which can be used to run other Ansible playbooks later if you chose. TC will also create an "ansible.cfg" file for use with Ansible.

```
-a, --ansible-hostfile
                      When specified, ansible hostfile will be generated
                      from a dummy playbook run.
```

###Inter-Hypervisor Simulation
![InterHypervisor Simulation](interhypervisor_simulation.png)

It is possible to strech simulations across an L3 fabric to place different simulated devices on different physical nodes. This can only be done using the Libvirt provider option and only with libvirt v 1.2.20+ which contains the relevent patches to support the UDP tunnel infrastructure which Cumulus engineers contributed to the libvirt codebase. This is possible using the "tunnel_ip" node-parameter. When not specified for a libvirt simulation the default of <IP_ADDRESS> is assumed for a fully contained local simulation.

```
graph dc1 {
 "leaf1" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="300" config="./helper_scripts/extra_switch_config.sh" tunnel_ip="<IP_ADDRESS>"]
 "leaf2" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="300" config="./helper_scripts/extra_switch_config.sh" tunnel_ip="<IP_ADDRESS>"]
   "leaf1":"swp11" -- "leaf2":"swp1" [ left_mac="44:38:39:1e:af:11", right_mac="44:38:39:1e:af:21"]
   "leaf1":"swp2" -- "leaf2":"swp2" [ left_mac="44:38:39:1e:af:12", right_mac="44:38:39:1e:af:22"]
   "leaf1":"swp33" -- "leaf2":"swp3" [ left_mac="44:38:39:1e:af:13", right_mac="44:38:39:1e:af:23"]
   "leaf1":"swp4" -- "leaf2":"swp4" [ left_mac="44:38:39:1e:af:14", right_mac="44:38:39:1e:af:24"]
}
```

###Custom Templates
TC works by reading information from a topology file into variables which are then used to populate a Jinja2 template for the Vagrantfile (called: ./templates/Vagrantfile.j2). TC allows you to specify additional templates that can be filled in using the same information from the topology file.

To see a list of the variables that will be passed to a template use the "-dd" which is short for "display datastructure" option.

```
python ./topology_converter.py ./examples/2switch.dot -dd

```

To specify a custom template use the "-t" option:

```
  -t [templatefile] [rendered_output_location], --template TEMPLATE TEMPLATE
                        Specify an additional jinja2 template and a
                        destination for that file to be rendered to.

```

###Passthrough Attributes
When working with custom templates or when modifying the included Vagrantfile template (called: ./templates/Vagrantfile.j2) it may be useful to provide additional parameters to populate variables in your customized template. By default any variable specified at the node level is automatically passed through to the templates whether or not TC actually uses it. This allows for maximum flexibility for end-users to add custom information about nodes and attributes.

**Note: for links it is possible to override the attributes generated for the link by TC since passthrough attributes are applied last. One could use this to manually specify a particular network number for the virtualbox provider. For attributes specified on links, any attrubutes which are not "left_mac" or "right_mac" will be applied to both ends of the link.**

Node-Based Passthrough Attribute shown below: "testattr"

Link-Based Passthrough Attribute shown below: "newattribute"

```
graph dc1 {
 "leaf1" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" config="./helper_scripts/extra_switch_config.sh"]
 "leaf2" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" config="./helper_scripts/extra_switch_config.sh"]
 "server1" [function="host" os="boxcutter/ubuntu1404" memory="400" ubuntu=True config="./helper_scripts/extra_server_config.sh" testattr="123456"]
   "leaf1":"swp40" -- "leaf2":"swp40"
   "leaf1":"swp50" -- "leaf2":"swp50" [newattribute="some value"]
   "server1":"eth1" -- "leaf1":"swp1"
   "server1":"eth2" -- "leaf2":"swp1"
}
```

###Provisioning Scripts
Scripts can be specified for execution on the end host using the "config=" node attribute in a topology file. In the example below, a "custom_script.sh" is used to provision the leaf1 device.

```
graph dc1 {
 "leaf1" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" config="./helper_scripts/custom_script.sh"]
 "leaf2" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" ]
 "server1" [function="host" os="boxcutter/ubuntu1404" memory="400" ubuntu=True ]
   "leaf1":"swp40" -- "leaf2":"swp40"
   "leaf1":"swp50" -- "leaf2":"swp50"
   "server1":"eth1" -- "leaf1":"swp1"
   "server1":"eth2" -- "leaf2":"swp1"
}
```

###Ansible Playbooks
Similar to the above option, provisioning and configuration can be performed by specifying a node-specific Ansible Playbook. Specifiying a playbook here will call the Vagrant Ansible provisioner and force Vagrant to generate an Ansible hostfile.

```
graph dc1 {
 "leaf1" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" playbook="main.yml"]
 "leaf2" [function="leaf" os="CumulusCommunity/cumulus-vx" memory="200" ]
 "server1" [function="host" os="boxcutter/ubuntu1404" memory="400" ubuntu=True ]
   "leaf1":"swp40" -- "leaf2":"swp40"
   "leaf1":"swp50" -- "leaf2":"swp50"
   "server1":"eth1" -- "leaf1":"swp1"
   "server1":"eth2" -- "leaf2":"swp1"
}
```

###Debugging Mode
Use the -v option.

```
-v, --verbose         enables verbose logging mode
```

###synced_folder=False
Documentation coming soon!

##Miscellaneous Info
* When simulating with Vagrant, vagrant will usually create two extra interfaces in addition to all of the interfaces that are needed for simulation. The reason for this behavior is unknown at this point in time.
* When simulating with Ubuntu, specify the "ubuntu=True" node-level attribute in the topology file. This will enable proper handling of network interfaces after a reboot.
* Point to Multipoint connections are not supported at this time.
* Vagrantfiles written for the libvirt provider will come up in parallel by default regardless of the order specified in the Vagrantfile this give libvirt an obvious advantage for simulations with many nodes. To avoid this use "vagrant up --provider=libvirt --no-parallel
* The Virtualbox provider supports a maximum of 36 interfaces of which one is consumed by the vagrant interface giving an end-user 35 interfaces to interconnect in the topology. (I am not aware of any such interface limitation on libvirt)
* **Note that topology converter requires that python be installed on whatever system is to be simulated so that interface remapping can be performed via the apply_udev.py script.** This is especially important for devices running Fedora (which does not ship with python installed by default)

# Example Topologies
These topologies can be used to get started with topology converter.

## The Reference Topology
This topology can be used to simulate any feature offered by Cumulus Linux. It is not necessary to turn on each device in this topology, only those which you intend to use (to keep the simulation more manageable on a laptop). For more information on the reference topology see the [internal wiki page](https://wiki.cumulusnetworks.com/display/SAL/Reference+Topology), public documentation on the Reference Topology is coming soon!

![Reference Topology](reference_topology.png)

## 2 Switch Topology
Simple 2 Switch connectivity at it's best. 4 links of fury.

![2 Switch Topology](2switch.png)

## 1 Switch 1 Server Topology
Great to test Quagga on the Host Scenarios.

![1 Switch 1 Server Topology](1switch_1server.png)

## 2 Switch 1 Server Topology
Your basic MLAG scenario.

![2 Switch 1 Server Topology](2switch_1server.png)

## 3 Switch Circular Topology
This topology can be linear if you shut one of the links somewhere in the topology. Useful for testing the propogation of routing updates and configurations.

![3 Switch Circular Topology](3switch_circular.png)


text:
# MCMHeaderAnimated

```MCMHeaderAnimated``` allows you to add an animation between list and detail views.

*Note: The sample code design was inspired by [Tryolabs Mobile Showcase](http://blog.tryolabs.com/2015/05/12/tryolabs-mobile-showcase-going-full-mobile/)*

## Usage

First, import ```MCMHeaderAnimated```:

```swift
import MCMHeaderAnimated
```

Create a new instance of ```MCMHeaderAnimated``` in the list controller, like this:

```swift
private let transitionManager = MCMHeaderAnimated()
```

then, assign that to the transitioningDelegate property of the destination controller:

```swift
destination.transitioningDelegate = self.transitionManager
```

and finally extend MCMHeaderAnimatedDelegate and implement __headerView__ and __headerCopy__ functions in both controllers.

If you want to add user interaction to dismiss detail view, like the example, you can add the following line:

```swift
self.transitionManager.destinationViewController = destination
```

## Requirements

iOS 8.0+

## Installation

### CocoaPods

MCMHeaderAnimated is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
use_frameworks!
pod "MCMHeaderAnimated"
```

Then, run the following command:

```
$ pod install
```

### Manual

If you prefer not to use [CocoaPods](http://cocoapods.org), you can integrate MCMHeaderAnimated into your project manually. Just drag and drop all files in the [__Source__](Source) folder into your project.

## Demo

Build and run the example project in Xcode to see MCMHeaderAnimated in action.

Or, run the following command:

```
$ pod try MCMHeaderAnimated
```

## Contributing

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

## Author

Mathias Carignani<EMAIL_ADDRESS>
## License

MCMHeaderAnimated is available under the MIT license. See the LICENSE file for more info.

license: MIT

repository: efremidze/MCMHeaderAnimated

branch_name: refs/heads/master

extension: md

gha_language: Swift

license_type: permissive

repo_name: efremidze/MCMHeaderAnimated


text:
---
layout: post
title: Django CreateView with automatically filled fields.
---

I have a model with *required* fields and I want to use it with Django's generic CreateView.

In my exampe I am creating a todo list where a task object belongs to a logged in user.
However I have two fields that I want filled automatically - the user should be the logged in user, and the created dat should be the time when the form is saved.

I use class based views when possible, as it cuts down on a lot of the code needed, they are well writen and have probably covered more edge cases than I have considered.

So in this case I am using a *CreateView*

So with optional fields this is relatively easy. Let the form do its things, add the auto-filled fields after and save a second time.

But that isn't going to work for the use case above, as when form tries to ssave the model it will complai nthat the required fields aren't available.

The ModelForm we have created does not know about the user or the request.


text:
## Given an integer array arr, return the length of a maximum size turbulent subarray of arr.

## A subarray is turbulent if the comparison sign flips between each adjacent pair of elements in the subarray.

## More formally, a subarray [arr[i], arr[i + 1], ..., arr[j]] of arr is said to be turbulent if and only if:

For i <= k < j:
arr[k] > arr[k + 1] when k is odd, and
arr[k] < arr[k + 1] when k is even.
Or, for i <= k < j:
arr[k] > arr[k + 1] when k is even, and
arr[k] < arr[k + 1] when k is odd.

## Example 1:

Input: arr = [9,4,2,10,7,8,8,1,9]
Output: 5
Explanation: arr[1] > arr[2] < arr[3] > arr[4] < arr[5]

## Example 2:

Input: arr = [4,8,12,16]
Output: 2
Example 3:

Input: arr = [100]
Output: 1

## Constraints:

1 <= arr.length <= 4 * 104
0 <= arr[i] <= 109

repository: shaheen-senpai/Hacktoberfest-Hack-Codes

branch_name: refs/heads/main

gha_license_id: MIT

repo_name: shaheen-senpai/Hacktoberfest-Hack-Codes


text:
Sortifiable
===========

[![Build Status][build]][travis] [![Dependency Status][depends]][gemnasium]

This gem provides an acts_as_list compatible capability for sorting
and reordering a number of objects in a list. The class that has this
specified needs to have a +position+ column defined as an integer on
the mapped database table.

This gem requires ActiveRecord 3.0 as it has been refactored to use
the scope methods and query interface introduced with Ruby on Rails 3.0

Example
-------

``` ruby
class TodoList < ActiveRecord::Base
  has_many :todo_items, :order => "position"
end

class TodoItem < ActiveRecord::Base
  belongs_to :todo_list
  acts_as_list :scope => :todo_list
end

todo_list.first.move_to_bottom
todo_list.last.move_higher
```

Contributions
-------------

Bug fixes and new feature patches are welcome. Please provide tests and
documentation wherever possible - without them it is unlikely your patch
will be accepted. If you're fixing a bug then a failing test for the bug
is essential. Once you have completed your patch please open a GitHub
pull request and I will review it and respond as quickly as possible.

Thanks to the following people for their contributions:

* Manuel Meurer
* Reinier de Lange

Copyright (c) 2011 Andrew White, released under the MIT license

[build]: https://secure.travis-ci.org/pixeltrix/sortifiable.png
[travis]: http://travis-ci.org/pixeltrix/sortifiable
[depends]: https://gemnasium.com/pixeltrix/sortifiable.png?travis
[gemnasium]: https://gemnasium.com/pixeltrix/sortifiable

repository: pixeltrix/sortifiable

gha_language: Ruby

repo_name: pixeltrix/sortifiable


text:
### [CVE-2014-125068](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-125068)
![](https://img.shields.io/static/v1?label=Product&message=maps-js-icoads&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=%3D%20n%2Fa%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Vulnerability&message=CWE-22%20Path%20Traversal&color=brighgreen)

### Description

A vulnerability was found in saxman maps-js-icoads and classified as critical. This issue affects some unknown processing of the file http-server.js. The manipulation leads to path traversal. The name of the patch is 34b8b0cce2807b119f4cffda2ac48fc8f427d69a. It is recommended to apply a patch to fix this issue. The associated identifier of this vulnerability is VDB-217643.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/Live-Hack-CVE/CVE-2014-125068

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve


text:
  Xolentum is a decentralized, peer-to-peer and open source digital currency. It's fast, secure and completely private.

## About

This is the core implementation of Xolentum. It is open-source and completely free to use without restrictions, except for those specified in the [license](LICENSE). There are no restrictions on anyone creating an alternative implementation of Xolentum that uses the protocol and network in a compatible manner.

## Branches

  Master -

  Development -

**NOTE:** The `master` branch contains the latest Xolentum release. All changes are made on the `development` branch, hence, please direct all pull requests there.

## Installing

We offer compiled binaries of Xolentum for all the supported OS. **Click [here](https://github.com/xolentum/xolentum/releases/latest) to download.**

You can also compile Xolentum from source. **Click [here](https://xolentum.org/resources/guides/compilation) for instructions.**

## Contributing

We welcome all contributions from the community. If you are looking to help out, please refer to the [contributing guide](CONTRIBUTING.md) for a set of guidelines.

## Supporting

Xolentum is a completely community-driven project. We would really appreciate if you are willing to support our project financially. Here are the donation addresses:

* Xolentum - `Xwmjr3jep6H6FBzLJjkj7v59qJQqLJyK5K67hiJPnJ1hVsvDUr4LPDXYFoPhBXMMoDJK4i27UdvAAhHShuxaY96r1NuL4n5jF`
* BitCoin - `1DyqVvN4KR5Rxdf3zGpA6gRBHsN5uR29nf`
* Monero - `49EPmSiHM9ibXxdgNmPFeKcoqjY1WKMtx4BGLGXREXZ2CzYsXDjfVfuRZivR3kGFqWAELbJJwrmia2qsGvScZZFkHZLE5Ef`

If you would like to donate/support the project through any other means, please reach out to a Staff member on [our Discord server](https://chat.xolentum.org/).

## License

[BSD 3-Clause License](https://github.com/xolentum/xolentum/blob/master/LICENSE)

Copyright (c) 2020, The Xolentum Developers

Copyright (c) 2014-2020, The Monero Developers

Parts of the project are originally copyright (c) 2012-2013 The CryptoNote
Developers

Parts of the project are originally copyright (c) 2014 The Boolberry
Developers (MIT License)

repository: wrkzdev/xolentum

repo_name: wrkzdev/xolentum


text:
# oscilloscope widget package for Flutter

Oscilloscope is a graphical display  similar to the trace on an oscilloscope that will display values as it scrolls across the screen. The widget uses a *List <double>* as the source of the data to display and will scale the information to fit the display. Take a look at the example to see how it can be used.

Each time a value is added to the dataset another point is plotted on the trace, this trace will extends from left to right across the screen until it reaches the end. At this point the trace will then scroll to show new values.

The display can be customised using the following values:

 - *backgroundColor*  - the default is Colors.black
 - *traceColor* - the default color is Colors.white
 - *margin* - the default is *EdgeInsets.all(10.0)*
 - *strokeWidth* - the default width is 2.0
 - *showYAxis* - show or hide  a line representing the 0 yAxis (default is false)
 - *yAxisColor* - if the yAxis is set for display it will show in this color (default is Colors.white)

 The other settings are

 - *dataSet* - this is the data that is used to generate the trace
 - *yAxisMin* - an indicator to define the minimum value found in the *dataSet* (default 0.0)
 - *yAxisMax* - an indicator to define the maximum value found in the *dataSet* (default 1.0)

 *yAxisMin* and *yAxisMax* are used by the widget to determine the scaling factor so all data values are displayed. These values can be altered to modify the data display scale.

<img src="https://raw.githubusercontent.com/magnatronus/oscilloscope/master/scope.gif" />

## Getting Started

For package install [see here](https://pub.dartlang.org/packages/oscilloscope).

For help getting started with Flutter, view the online [documentation](https://flutter.io/).

repository: magnatronus/oscilloscope

gha_language: Dart

repo_name: magnatronus/oscilloscope


text:
# `@shopify/react-html`

[![Build Status](https://travis-ci.org/Shopify/quilt.svg?branch=master)](https://travis-ci.org/Shopify/quilt) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md) [![npm version](https://badge.fury.io/js/%40shopify%2Freact-html.svg)](https://badge.fury.io/js/%40shopify%2Freact-html)

A collection of utilities for constructing an HTML document.

## Installation

```bash
$ yarn add @shopify/react-html
```

## Usage

This package exposes two entrypoints:

- `@shopify/react-html`: which contains code that can be used on server and client. Code in your `app` and `client` directories should import from this entrypoint.
- `@shopify/react-html/server`: which contains all of `react-html`, but also includes some features that are not safe to run in a browser context. Code in your `server` directory should import from this entrypoint.

> Note: because this package creates an HTML document, this package is only for applications that are server rendered in Node. Rails apps generally have Rails perform the render of the HTML document, so they do not benefit from any part of this library.

### In your server middleware

Your server needs construct an HTML document. To do this, you can use the `Html` component and `render` function from `@shopify/react-html/server`:

```tsx
import * as React from 'react';
import {render, Html} from '@shopify/react-html-next/server';

import App from '../app';

export default function middleware(ctx) {
  ctx.body = render(
    <Html>
      <App />
    </Html>,
  );
}
```

The component will automatically propagate any usage of the [`react-helmet` library](https://github.com/nfl/react-helmet) in your app’s content to manipulate the title or other top level HTML or HEAD attributes. If you want to make use of the serialization techniques [documented below](#in-your-app-code), you must also construct a `Manager` instance, pass it to a `<Provider />` component, and call `@shopify/react-effect`’s `extract` method:

```tsx
// in App.tsx
import {Manager, Provider} from '@shopify/react-html-next';

function App({htmlManager}: {htmlManager: Manager}) {
  return <Provider manager={htmlManager}>Hello world!</Provider>;
}
```

```tsx
// Somewhere in your server
import {extract} from '@shopify/react-effect/server';
import {render, Html, Manager} from '@shopify/react-html-next/server';

export default function middleware(ctx) {
  const manager = new Manager();
  const app = <App htmlManager={manager} />;

  await extract(app);

  ctx.body = render(<Html manager={manager}>{app}</Html>);
}
```

You can also use the `Script`, `Style`, and `Serialize` components detailed in the [API reference](#api-reference) to manually construct a variety of tags, which you will typically insert into the document with the [`Html` component’s `headMarkup` and `bodyMarkup` props](#html).

### In your client entrypoint

Your client needs to rehydrate the React application. In development, it also needs to remove some of the temporary markup we create to prevent flashes of unstyled content. To do so, use the `showPage` function exported from `@shopify/react-html`:

```tsx
import {hydrate} from 'react-dom';
import {showPage} from '@shopify/react-html-next';
import App from '../app';

hydrate(<App />, document.querySelector('#app'));
showPage();
```

You do not need to create a `Manager`/ `Provider` component on the client.

### In your application code

Some parts of your application code may have some form of state that must be rehydrated when the server-rendered page is rehydrated on the client. To do so, application code can use the `createSerializer` function exported from `@shopify/react-html`.

`createSerializer()` accepts a single string argument for the identifier to use; this will help you find the serialized `script` tag if you need to debug later on. It also accepts a generic type argument for the type of the data that will be serialized/ available after deserialization.

The function returns a pair of components:

```tsx
const {Serialize, WithSerialized} = createSerializer<string>('MyData');

// Would create components with the following types:

function Serialize({data}: {data(): string}): null;
function WithSerialized({
  children,
}: {
  children(data: string | undefined): React.ReactNode;
}): React.ReactNode;
```

The general pattern for using these components is to render the `WithSerialized` component as the top-most child of a component responsible for managing this state. Within the render prop, construct whatever stateful store or manager you need, using the data that was retrieved in cases where the serialization was found (on the browser, or on subsequent server renders). Finally, render the UI that depends on that stateful part, and a `Serialize` component that extracts the part that you you need to communicate between server and client.

Here is a complete example, using `@shopify/react-i18n`’s support for async translations as the data that needs to be serialized:

```tsx
import {createSerializer} from '@shopify/react-html-next';
import {Provider, Manager} from '@shopify/react-i18n';

interface Props {
  locale: string;
  children: React.ReactNode;
}

const {Serialize, WithSerialized} = createSerializer<
  ReturnType<Manager['extract']>
>('i18n');

export default function I18n({locale, children}: Props) {
  return (
    <WithSerialized>
      {data => {
        const manager = new Manager(
          {locale: data ? data.locale : locale},
          data && data.translations,
        );

        return (
          <>
            <Provider manager={manager}>{children}</Provider>
            <Serialize
              data={() => ({
                locale: manager.details.locale,
                translations: manager.extract(),
              })}
            />
          </>
        );
      }}
    </WithSerialized>
  );
}
```

The rationale for this approach to handling serialization is available in [our original proposal](https://github.com/Shopify/web-foundation/blob/master/Proposals/02%20-%20Serialization%20in%20application%20code.md).

## API reference

### `<Html />`

The `<Html>` component serves as a top level wrapper for a React application, allowing you to avoid needing any kind of server-side template. It is only available from the server entrypoint of this package (`@shopify/react-html/server`). The `Html` component accepts the following props:

- `manager`: a `Manager` instance. When provided, the `Html` component will extract all the information from this object and place it in an appropriate place in the document.
- `children`: the application. It will be rendered to a string and placed inside a `div` with an ID of `app`.
- `locale`: the language to use for the HTML `lang` attribute.
- `styles`: descriptors for any style tags you want to include in the HEAD of the document.
- `scripts`: descriptors for any script tags you want to include in your document. All scripts passed to this property will be deferred by appending them to the end of the document. We encourage this as a default because it improves the initial rendering performance of your page.
- `blockingScripts`: descriptors for any script tags you want to include in the HEAD of the document. These will block HTML parsing until they are evaluated, so use them carefully.
- `headMarkup`: additional JSX to be embedded in the head of the document (after styles, but before blocking scripts).
- `bodyMarkup`: additional JSX to be embedded in the body of the document (before serialization markup and deferred scripts).

```tsx
import {Html} from '@shopify/react-html-next/server';

const html = (
  <Html
    locale="fr"
    styles={[{path: '/style.css'}]}
    scripts={[{path: '/script.js'}]}
  >
    <App />
  </Html>
);
```

### `<Style />`

The `<Style />` component lets you render `<link>` tags in your document dynamically as part of your react app. It supports all of the props of a basic `link` tag, but forces some properties to be the values needed for a stylesheet. In general, prefer the `styles` prop of the `Html` component instead of using this component explicitly.

```tsx
import {Style} from '@shopify/react-html-next';

<Style
  href="./some-style.css"
  integrity="some-integrity-hash"
  crossOrigin="anonymous"
/>;
```

### `<Script />`

The `<Script />` component lets you render `<script>` tags in your document dynamically as part of your react app. It supports all the props of a basic `script` tag. In general, prefer the `scripts` prop of the `Html` component instead of using this component explicitly.

```tsx
import {Script} from '@shopify/react-html-next';

<Script
  src="./some-script.js"
  integrity="some-integrity-hash"
  crossOrigin="anonymous"
/>;
```

### `<Serialize />`

The Serialize component takes care of rendering a `script` tag with a serialized version of the `data` prop. It is provided for incremental adoption of the `createSerializer()` method of generating serializations [documented above](#in-your-app-code).

### `render()`

The `render()` function creates a stringified version of the HTML document with an appropriate DOCTYPE. It is only available from the server entrypoint of this package (`@shopify/react-html/server`).

```tsx
import {render, Html} from '@shopify/react-html-next/sever';

const markup = render(<Html>Hello world!</Html>);
```

### `showPage()`

This function encapsulates the logic for showing the page in development, where it is hidden on the initial render by default. You must call this function from your client entry point, usually right after hydrating your React app. It returns a promise that resolves after the document is guaranteed to be visible.

### `getSerialized<Data>()`

To help in migration, this function can imperatively return the parsed value of a serialization. It returns the data cast to whatever is passed for `Data`. It should only be called on the client.

## Migration

- [Migrating from 4.x to 5.x](../documentation/migration-version-4-to-5.md)

repository: nickjs/perfect-app

repo_name: nickjs/perfect-app


text:
# Quotebot Client

A quotebot client library for Tokenly.

[![Build Status](https://travis-ci.org/tokenly/quotebot-client.svg?branch=master)](https://travis-ci.org/tokenly/quotebot-client)

# Installation

### Add the package via composer

```
composer require tokenly/quotebot-client
```

## Usage with Laravel

### Add the Service Provider

Add the following to the `providers` array in your application config:

```
Tokenly\QuotebotClient\ServiceProvider\QuotebotServiceProvider::class,
```

### Set the environment variables

```
QUOTEBOT_CONNECTION_URL=https://quotebot.tokenly.com
QUOTEBOT_API_TOKEN=my-api-token
```

### Simple BTC quote

Get a BTC in USD.  This will use bitcoinAverage and then fallback to bitstamp if the data is not current

```php
$quotebot_client = app('Tokenly\QuotebotClient\Client');
$usd_float = $quotebot_client->getCurrentBTCQuoteWithFallback();
```

### Get a token quote

Get a token quote by going to BTC and then from BTC to USD.  This will use the default fallback sources of bitcoinAverage and bitstamp for the BTC quote.

```php
$quotebot_client = app('Tokenly\QuotebotClient\Client');
$usd_float = $quotebot_client->getTokenValue('poloniex', 'XCP');
```

repository: tokenly/quotebot-client

repo_name: tokenly/quotebot-client


text:
[**Review #1268 | Scotch Review #441 - Glen Scotia 16yr**]( https://t8ke.review/review-1268-glen-scotia-16yr)

**The Schtick:** This is an OB release of Glen Scotia, coming in the form of a 50ml mini. Let's see how it is.

-----

**Distiller:** Glen Scotia

**Bottler:** Glen Scotia

**Selection:** N/A

**ABV:**  46% ABV

**Age:** 16 Years

-----

**Nose:**  Pungent dough, salted caramel, light ash and sea air. Intoxicating creme brulee.

**Taste:** Honey, brine, fresh baked bread, toffee. Nice ash character, some minerality. Salted caramel. Delightful.

**Finish:** Long, rich and savory. Ash, soapstone, faint burning wood, fresh baked cake, salted caramel. Savory and delightful.

**Overall:** I love this. This is rich, powerful, savory and quintessentially Glen Scotia. Yum.

Thanks for reading!

**Rank: 7**

-----

**4 Most Recent Glen Scotia Expressions I Have Reviewed:**

- [Review #1268. Glen Scotia 16yr]( https://t8ke.review/review-1268-glen-scotia-16yr)

- [Review #955. Glen Scotia 21 Year Samaroli 1992]( https://t8ke.review/review-955-glen-scotia-21yr-samaroli-1992/)

- [Review #197. Glen Scotia 22yr Signatory Vintage 1991]( https://t8ke.review/review-197-glen-scotia-22yr-signatory-vintage/)

- [Review #215. Glen Scotia 15 Year]( https://t8ke.review/review-215-glen-scotia-15yr/)

-----

[WEBSITE](https://t8ke.review) | [SEARCHABLE ARCHIVE](https://t8ke.review/review-archive/) | [SUBREDDIT](https://reddit.com/r/t8kereviews)

-----

Decoded:

**1** | **Disgusting** | So bad I poured it out.

**2** | **Poor** | I wouldn't consume by choice.

**3** | **Bad** | Multiple flaws.

**4** | **Sub-par** | Not bad, but many things I'd rather have.

**5** | **Good** | Good, just fine.

**6** | **Very Good** | A cut above.

**7** | **Great** | Well above average

**8** | **Excellent** | Really quite exceptional.

**9** | **Incredible** | An all time favorite

**10** | **Perfect** | Perfect

----


text:
---
metaTitle: "Microsoft SQL Server - OVER Clause"
description: "Cumulative Sum, Using Aggregation functions with OVER, Using Aggregation funtions to find the most recent records, Dividing Data into equally-partitioned buckets using NTILE"
---

# OVER Clause

## Cumulative Sum

Using the [Item Sales Table](http://stackoverflow.com/documentation/sql/280/example-database/1016/cars-table#t=201604051713005624555), we will try to find out how the sales of our items are increasing through dates. To do so we will calculate the **Cumulative Sum** of total sales per Item order by the sale date.

```sql
SELECT item_id, sale_Date
       SUM(quantity * price) OVER(PARTITION BY item_id ORDER BY sale_Date ROWS BETWEEN UNBOUNDED PRECEDING) AS SalesTotal
  FROM SalesTable

```

## Using Aggregation functions with OVER

Using the [Cars Table](http://stackoverflow.com/documentation/sql/280/example-database/1016/cars-table#t=201604051640186575813), we will calculate the total, max, min and average amount of money each costumer spent and haw many times (COUNT) she brought a car for repairing.

Id    CustomerId    MechanicId    Model    Status    Total Cost

```sql
SELECT CustomerId,
       SUM(TotalCost) OVER(PARTITION BY CustomerId) AS Total,
       AVG(TotalCost) OVER(PARTITION BY CustomerId) AS Avg,
       COUNT(TotalCost) OVER(PARTITION BY CustomerId) AS Count,
       MIN(TotalCost) OVER(PARTITION BY CustomerId) AS Min,
       MAX(TotalCost) OVER(PARTITION BY CustomerId) AS Max
  FROM CarsTable
 WHERE Status = 'READY'

```

Beware that using OVER in this fashion will not aggregate the rows returned. The above query will return the following:

|CustomerId|Total|Avg|Count|Min|Max
|---|---|---|---|---|---|---
|1|430|215|2|200|230
|1|430|215|2|200|230

The duplicated row(s) may not be that useful for reporting purposes.

If you wish to simply aggregate data, you will be better off using the GROUP BY clause along with the appropriate aggregate functions Eg:

```sql
SELECT CustomerId,
       SUM(TotalCost) AS Total,
       AVG(TotalCost) AS Avg,
       COUNT(TotalCost) AS Count,
       MIN(TotalCost) AS Min,
       MAX(TotalCost)  AS Max
  FROM CarsTable
 WHERE Status = 'READY'
GROUP BY CustomerId

```

## Using Aggregation funtions to find the most recent records

Using the [Library Database](http://stackoverflow.com/documentation/sql/280/example-databases/4978/library-database#t=201607221318512510656), we try to find the last book added to the database for each author. For this simple example we assume an always incrementing Id for each record added.

```sql
SELECT MostRecentBook.Name, MostRecentBook.Title
FROM ( SELECT Authors.Name,
              Books.Title,
              RANK() OVER (PARTITION BY Authors.Id ORDER BY Books.Id DESC) AS NewestRank
       FROM Authors
       JOIN Books ON Books.AuthorId = Authors.Id
     ) MostRecentBook
WHERE MostRecentBook.NewestRank = 1

```

Instead of RANK, two other functions can be used to order. In the previous example the result will be the same, but they give different results when the ordering gives multiple rows for each rank.

- `RANK()`: duplicates get the same rank, the next rank takes the number of duplicates in the previous rank into account
- `DENSE_RANK()`: duplicates get the same rank, the next rank is always one higher than the previous
- `ROW_NUMBER()`: will give each row a unique 'rank', 'ranking' the duplicates randomly

For example, if the table had a non-unique column CreationDate and the ordering was done based on that, the following query:

```sql
SELECT Authors.Name,
       Books.Title,
       Books.CreationDate,
       RANK() OVER (PARTITION BY Authors.Id ORDER BY Books.CreationDate DESC) AS RANK,
       DENSE_RANK() OVER (PARTITION BY Authors.Id ORDER BY Books.CreationDate DESC) AS DENSE_RANK,
       ROW_NUMBER() OVER (PARTITION BY Authors.Id ORDER BY Books.CreationDate DESC) AS ROW_NUMBER,
FROM Authors
JOIN Books ON Books.AuthorId = Authors.Id

```

Could result in:

|Author|Title|CreationDate|RANK|DENSE_RANK|ROW_NUMBER
|---|---|---|---|---|---|---
|Author 1|Book 1|22/07/2016|1|1|1
|Author 1|Book 2|22/07/2016|1|1|2
|Author 1|Book 3|21/07/2016|3|2|3
|Author 1|Book 4|21/07/2016|3|2|4
|Author 1|Book 5|21/07/2016|3|2|5
|Author 1|Book 6|04/07/2016|6|3|6
|Author 2|Book 7|04/07/2016|1|1|1

## Dividing Data into equally-partitioned buckets using NTILE

Let's say that you have exam scores for several exams and you want to divide them into quartiles per exam.

```sql
-- Setup data:
declare @values table(Id int identity(1,1) primary key, [Value] float, ExamId int)
insert into @values ([Value], ExamId) values
(65, 1), (40, 1), (99, 1), (100, 1), (90, 1), -- Exam 1 Scores
(91, 2), (88, 2), (83, 2), (91, 2), (78, 2), (67, 2), (77, 2) -- Exam 2 Scores

-- Separate into four buckets per exam:
select ExamId,
       ntile(4) over (partition by ExamId order by [Value] desc) as Quartile,
       Value, Id
from @values
order by ExamId, Quartile

```

[<img src="https://i.stack.imgur.com/jJfx2.png" alt="Our exam data divided into quartiles per exam" />](https://i.stack.imgur.com/jJfx2.png)

`ntile` works great when you really need a set number of buckets and each filled to approximately the same level.  Notice that it would be trivial to separate these scores into percentiles by simply using `ntile(100)`.

#### Parameters

|Parameter|Details
|---|---|---|---|---|---|---
|PARTITION BY|The field(s) that follows PARTITION BY is the one that the 'grouping' will be based on

#### Remarks

The OVER clause determines a windows or a subset of row within a query result set. A window function can be applied to set and compute a value for each row in the set. The OVER clause can be used with:

- Ranking functions
- Aggregate functions

so someone can compute aggregated values such as moving averages, cumulative aggregates, running totals, or a top N per group results.

In a very abstract way we can say that OVER behaves like GROUP BY. However OVER is applied per field / column and not to the query as whole as GROUP BY does.

**Note#1:** In SQL Server 2008 (R2) ORDER BY Clause cannot be used with aggregate window functions ([link](https://msdn.microsoft.com/en-us/library/ms189461(v=sql.105).aspx)).

repository: haifenghuang/generate

repo_name: haifenghuang/generate


text:
## Class  `StopAtStepHook`
请求在指定步骤停止的挂钩。

Inherits From: [ `SessionRunHook` ](https://tensorflow.google.cn/api_docs/python/tf/estimator/SessionRunHook)

**别名** : [ `tf.compat.v1.estimator.StopAtStepHook` ](/api_docs/python/tf/estimator/StopAtStepHook), [ `tf.compat.v1.train.StopAtStepHook` ](/api_docs/python/tf/estimator/StopAtStepHook), [ `tf.compat.v2.estimator.StopAtStepHook` ](/api_docs/python/tf/estimator/StopAtStepHook)

##  `__init__`
[View source](https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/python/training/basic_session_run_hooks.py#L393-L417)

```
 __init__(
    num_steps=None,
    last_step=None
)

```

Initializes a  `StopAtStepHook` .

This hook requests stop after either a number of steps have beenexecuted or a last step has been reached. Only one of the two options can bespecified.

if  `num_steps`  is specified, it indicates the number of steps to executeafter  `begin()`  is called. If instead  `last_step`  is specified, itindicates the last step we want to execute, as passed to the  `after_run()` call.

#### 参数：
- **`num_steps`** : Number of steps to execute.
- **`last_step`** : Step after which to stop.

#### 加薪：
- **`ValueError`** : If one of the arguments is invalid.

## 方法

###  `after_create_session`
[View source](https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/python/training/basic_session_run_hooks.py#L424-L427)

```
 after_create_session(
    session,
    coord
)

```

在创建新的tensorflow会话时调用。

This is called to signal the hooks that a new session has been created. Thishas two essential differences with the situation in which  `begin`  is called:

- When this is called, the graph is finalized and ops can no longer be addedto the graph.
- This method will also be called as a result of recovering a wrappedsession, not only at the beginning of the overall session.

#### 参数：
- **`session`** : A TensorFlow Session that has been created.
- **`coord`** : A Coordinator object which keeps track of all threads.

###  `after_run`
[View source](https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/python/training/basic_session_run_hooks.py#L432-L442)

```
 after_run(
    run_context,
    run_values
)

```

每次调用run（）后调用。

The  `run_values`  argument contains results of requested ops/tensors by `before_run()` .

The  `run_context`  argument is the same one send to  `before_run`  call. `run_context.request_stop()`  can be called to stop the iteration.

If  `session.run()`  raises any exceptions then  `after_run()`  is not called.

#### 参数：
- **`run_context`** : A  `SessionRunContext`  object.
- **`run_values`** : A SessionRunValues object.

###  `before_run`
[View source](https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/python/training/basic_session_run_hooks.py#L429-L430)

```
 before_run(run_context)

```

在每次调用run（）之前调用。

You can return from this call a  `SessionRunArgs`  object indicating ops ortensors to add to the upcoming  `run()`  call.  These ops/tensors will be runtogether with the ops/tensors originally passed to the original run() call.The run args you return can also contain feeds to be added to the run()call.

The  `run_context`  argument is a  `SessionRunContext`  that providesinformation about the upcoming  `run()`  call: the originally requestedop/tensors, the TensorFlow Session.

此时图表已完成，无法添加操作。

#### 参数：
- **`run_context`** : A  `SessionRunContext`  object.

#### 返回：
None or a  `SessionRunArgs`  object.

###  `begin`
[View source](https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/python/training/basic_session_run_hooks.py#L419-L422)

```
 begin()

```

在使用会话之前调用一次。

When called, the default graph is the one that will be launched in thesession.  The hook can modify the graph by adding new operations to it.After the  `begin()`  call the graph will be finalized and the other callbackscan not modify the graph anymore. Second call of  `begin()`  on the samegraph, should not change the graph.

###  `end`
[View source](https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/python/training/session_run_hook.py#L171-L186)

```
 end(session)

```

在会话结束时调用。

The  `session`  argument can be used in case the hook wants to run final ops,such as saving a last checkpoint.

If  `session.run()`  raises exception other than OutOfRangeError orStopIteration then  `end()`  is not called.Note the difference between  `end()`  and  `after_run()`  behavior when `session.run()`  raises OutOfRangeError or StopIteration. In that case `end()`  is called but  `after_run()`  is not called.

#### 参数：
- **`session`** : A TensorFlow Session that will be soon closed.

repository: veaba/tensorflow-docs

repo_name: veaba/tensorflow-docs


text:
Rate limiting ChangeLog
========================================================================

## ?.?.? / ????-??-??

* Merged PR #2: Migrate to new testing library - @thekid

## 3.1.0 / 2022-02-28

* Added XP 11 support - @thekid

## 3.0.0 / 2020-04-10

* Implemented xp-framework/rfc#334: Drop PHP 5.6:
  . **Heads up:** Minimum required PHP version now is PHP 7.0.0
  . Rewrote code base, grouping use statements
  . Converted `newinstance` to anonymous classes
  (@thekid)

## 2.0.1 / 2020-04-05

* Made compatible with XP 10 - @thekid

## 2.0.0 / 2018-12-29

* **Heads up: Dropped PHP 5.5 support** - @thekid
* Made compatible with PHP 7.2+ - @thekid

## 1.0.0 / 2016-02-21

* Added version compatibility with XP 7 - @thekid

## 0.3.0 / 2016-01-24

* Fix code to use `nameof()` instead of the deprecated `getClassName()`
  method from lang.Generic. See xp-framework/core#120
  (@thekid)

## 0.2.0 / 2015-10-10

* **Heads up: Dropped PHP 5.4 support**. *Note: As the main source is not
  touched, unofficial PHP 5.4 support is still available though not tested
  with Travis-CI*.
  (@thekid)

## 0.1.0 / 2015-02-12

* First public release - @thekid

repository: xp-forge/ratelimit

gha_language: PHP

repo_name: xp-forge/ratelimit


text:
Description
===========

This is a puppet module that will install and configure Gazzang's zNcrypt encryption utility.

Requirements
============

Platform
--------

* Debian, Ubuntu
* CentOS, Red Hat
* SLES, OpenSUSE

Tested on:

* Ubuntu 12.04
* CentOS 6.4

Puppet Module Dependencies
--------------------------

For Ubuntu and Debian support:

* puppetlabs-apt

For SUSE support:

* darin-zypprepo

Connectivity
------------

An internet connection is required for package resolution.

Usage
=====

There are a couple of parameters that need to be changed prior to running:

zTrustee Registration/Activation Options
----------------------------------------

$keyserver = ""

This will be the zTrustee Key Management server that the zNcrypt client will attempt to register with.

$organization = ""
$authorization = ""

These are the credentials passed to the keyserver upon registration. These are generated server-side, and should be kept secret.

If you do not know where to find your `organization` or `authorization` code, then please contact<EMAIL_ADDRESS>
zNcrypt Configuration Options
-----------------------------

$passphrase = ""

$passphrase2 = ""

These will be the passphrases used to control access to the encrypted data. These passwords are hard-coded for testing purposes, but should be changed and randomized per-machine for production environments.

$zncrypt_prefix = "/var/lib/zncrypt"

$zncrypt_mount = "$zncrypt_prefix/encrypted"

$zncrypt_storage = "$zncrypt_prefix/.private"

These are the directories that will hold the zNcrypt encrypted file system.

License and Author
==================

Copyright:: 2014 Gazzang, Inc

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.

Special Thanks
==============

- Darin Perusich (deadpoint)

repository: clouderasecurity/puppet

repo_name: clouderasecurity/puppet


text:
# Pyconcrete-Python
- Example of encrypting a python script using the pyconcrete
- I recommend that you should ignore the commented instructions with an octothorpe, #.
- Modified date: July 26, 2020.

## Table of contents
0.  [Summarized environments about the Pyconcrete-Python](#envs)
1.  [Create a virtualenv for python3 and activate it.](#pip3_virtualenv)
2.  [Install python packages.](#pip3_pkgs)
3.  [Run a demo code without encyrption](#demo_wo_enc)
4.  [Encrypt a python source code using the pyconcrete and run a demo code with encryption.](#demo_w_enc)
5.  [Encrypt all python source codes using the pyconcrete and run a demo code with encryption.](#demo_w_enc_full)

## 1. Summarized environments about the Pyconcrete-Python
- Operating System (OS): Ubuntu MATE 18.04.3 LTS (Bionic)
- Graphics Processing Unit (GPU): NVIDIA TITAN Xp, 1ea
- GPU driver: Nvidia-440.100
- CUDA toolkit: CUDA 10.2
- cuDNN: cuDNN v7.6.5

## 2. Create a virtualenv for python3 and activate it.
- The root directory for the virtualenv: /home/usrname/pip3_virtualenv
- The name of new virtualenv to be created: pyconcrete
- Please note that the python version (e.g. python3.6) to be installed should be equal to the default python3 version for a python3 package, pyconcrete.
```bash
usrname@hostname:~/curr_path$ mkdir -p /home/usrname/pip3_virtualenv/pyconcrete
usrname@hostname:~/curr_path$ virtualenv /home/usrname/pip3_virtualenv/pyconcrete/ --python=python3.6
usrname@hostname:~/curr_path$ source /home/usrname/pip3_virtualenv/pyconcrete/bin/activate
usrname@hostname:~/curr_path$ source /home/usrname/pip3_virtualenv/pyconcrete/bin/activate
(pyconcrete) usrname@hostname:~/curr_path$
```

## 3. Install python packages.
- The name of activated virtualenv: pyconcrete
- I recommend that you should install the python package, pyconcrete from source, not pip3.
- Thus, the provided requirements.txt does not include the python3 package, pyconcrete.
```bash
(pyconcrete) usrname@hostname:~/curr_path$ git clone https://github.com/vujadeyoon/Pyconcrete-Python
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ pip3 install -r requirements.txt
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ mkdir -p /home/usrname/pip3_packages
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ git clone https://github.com/Falldog/pyconcrete /home/usrname/pip3_packages/pyconcrete
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ cd /home/usrname/pip3_packages/pyconcrete
(pyconcrete) usrname@hostname:~/pyconcrete$ python setup.py install
(pyconcrete) usrname@hostname:~/pyconcrete$ cd ~/Pyconcrete-Python
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$
```

## 4. Run a demo code without encyrption
- Please note that you should download a checkpoint for the pretrained model, resnet18 (i.e. resnet18-5c106cde.pth) from the Facebook torchvision using the wget.
- Please note that you should prepare an image to ./Pyconcrete-Python/image.png.
```bash
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ wget "https://download.pytorch.org/models/resnet18-5c106cde.pth"
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ python3 main.py
torch.Size([1000])
tensor(800, device='cuda:0')
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$
```

## 5. Encrypt a python source code using the pyconcrete and run a demo code with encryption.
- If you have not prepared the checkpoint and image, please refer to the section 4 and prepare them.
- The path for a python source code to be encrypted: ~/Pyconcrete-Python/resnet.py
```bash
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ cd /home/usrname/pip3_packages/pyconcrete
(pyconcrete) usrname@hostname:~/pyconcrete$ pyconcrete-admin.py compile --source=~/Pyconcrete-Python/resnet.py --pye
(pyconcrete) usrname@hostname:~/pyconcrete$ rm -rf ~/Pyconcrete-Python/resnet.py
(pyconcrete) usrname@hostname:~/pyconcrete$ cd ~/Pyconcrete-Python
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ python3 main.py
torch.Size([1000])
tensor(800, device='cuda:0')
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$
```

## 6. Encrypt all python source codes using the pyconcrete and run a demo code with encryption.
- If you have not prepared the checkpoint and image, please refer to the section 4 and prepare them.
- The path for a python source code to be encrypted: ~/Pyconcrete-Python/*.py
```bash
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ cd /home/usrname/pip3_packages/pyconcrete
(pyconcrete) usrname@hostname:~/pyconcrete$ pyconcrete-admin.py compile --source=~/Pyconcrete-Python/ --pye
(pyconcrete) usrname@hostname:~/pyconcrete$ find ~/Pyconcrete-Python/ -name "*.py" -exec rm -rf {} \;
(pyconcrete) usrname@hostname:~/pyconcrete$ cd ~/Pyconcrete-Python
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$ pyconcrete main.pye
torch.Size([1000])
tensor(800, device='cuda:0')
(pyconcrete) usrname@hostname:~/Pyconcrete-Python$

repository: duanzhihua/Pyconcrete-Python

repo_name: duanzhihua/Pyconcrete-Python


text:
## Conditions in Loops

You are going to practice your `for..of` loops some more. In this exercise, you are going to add a `if/else` code block inside the loop.

A quick example first.

```js
const wines = [ "red", "white", "white", "white", "red", "white", "red" ]
const wineCellar = []
const wineRefrigerator = []

for (const wine of wines) {
	if (wine === "red") {
		wineCellar.push(wine)
	}
	else {
		wineRefrigerator.push(wine)
	}
}

console.log(`
Contents of wine cellar: ${wineCellar}
Contents of wine refrigerator: ${wineRefrigerator}
`)
```

Feel free to copy that code into the editor and run it to see what happens.

In that example, you still iterate the entire array, but depending on the value of the `wine` variable, one of two different things could happen.

 You notice that if you get less than 7 hours of sleep, you are grumpy all day long. If you get 7 or more hours of sleep, you are in a happy mood all day.

You start recording how many hours of sleep you get every night for two weeks. Based on the hours of sleep, you want to generate a readable report that shows you how many days you were grumpy and how many days you were happy.

There is an array provided to you in the starter code for your tracked hours of sleep. You need to complete the code using the above code as an example. One thing you will do differently is instead of putting the array in the output like the example does, you need to display the number of items in `grumpyHours` and the number of items in the `happyHours` arrays.

### Setup

```sh
cd
cd workspace
mkdir moods
cd moods
touch main.js
code .
```

Once VS Code starts, open the `main.js` file copy the following code into the file.

```js
const hours = [ 6, 9, 7, 8, 6, 6, 8, 5, 9, 8, 7, 6, 7, 7, 8, 6, 9 ]
const grumpyHours = []
const happyHours = []

console.log()
```

### Run Your Code

In your terminal, run your code with the following command.

```sh
node main.js
```

When you run the code, it should display the following.

```sh
I was grumpy on 6 days.
I was happy on 11 days.
```

gha_language: Shell


text:
# GPS and roughness automation

This programs provide you a way to collect average roughness of a road and store it to Database.

This repository is for Data Acquisition class final project.

## Requirements

- Kidbright device
- Python3
- Mobile Device
- Facebook account
- Node-RED on mobile
- MQTT Broker

## Setting up

### Setting up roughness measurement for Kidbright

1. Install imu.py module in your Kidbright device from git Here.
2. In file `Roughness_measure.py`, change the following:
    - In line 46, change `WIFI_NAME` and `WIFI_PASSWORD` to the name and password of the wifi your kidbright will use.
    - In line 52, change `MQTT_BROKER` to MQTT Broker you will use.
3. Change TIMES and SLEEP in line 7,8 to the amount of times you will measure roughness to average and interval between each measures.

### Setting up GPS tracker

1. Download python libraries from `requirements.txt` using
```pip install -r requirements.txt```

2. Create `.env` files that contains the following:
    - MQTT_BROKER={your MQTT broker (must be the same as the one you used for Kidbright) }

Example `.env` fle:
```
MQTT_BROKER=iot.cpe.ku.ac.th
```

### Setting up Node-RED Database Handler (For PC or Moblie)

1. Import `Node-RED_GPS_Automation.json` to your Node-RED

2. Edit node `Edit your Mqtt Broker node here` and edit `Your MQTT Broker` then change `MQTT_BROKER` to your MQTT Broker

3. Edit node `Edit your Database Here` and edit `Your Database` based on your database setting

### Setting up Node-RED GPS tracker (Mobile only)

1. Import `Node-RED-Mobile_GPS_tracking.json` to your mobile Node-RED

2. Edit node `ku/daq2020/cosmic/gps` and edit `Your MQTT Broker` then change `MQTT_BROKER` to your MQTT Broker

## Running

### Running Node-RED Database Handler

Press the Deploy button

### Setting up Node-RED GPS tracker

Press the button next to `Subscribe` Node

### Running Kidbright

You can run your kidbright with the file `Roughness_measure.py` to run on your Kidbright with program like Thonny.

### Running GPS tracker

1. Run `GPSextract.py` on Idle

2. Enter your grouping are on the prompt `Enter your grouping : `

## Once you ran all 4 programs, your location and roughness will be track and automatically added to your database

path: /Data acquisition/GPS and Roughness Automation/README.md

gha_language: Python


text:
[![Build Status](https://travis-ci.com/yoomoney/db-queue.svg?branch=master)](https://travis-ci.com/github/yoomoney/db-queue/branches)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Javadoc](https://img.shields.io/badge/javadoc-latest-blue.svg)](https://yoomoney.github.io/db-queue/)
[![Download](https://img.shields.io/badge/Download-latest)](https://search.maven.org/artifact/ru.yoomoney.tech/db-queue)
# Database Queue

Library provides worker-queue implementation on top of Java and database.
Project uses [Semantic Versioning](http://semver.org/).
Library is available on [Maven Central](https://search.maven.org/)

```
implementation 'ru.yoomoney.tech:db-queue:13.0.0'
```

## Why?

There are several reasons:

* You need simple, efficient and flexible task processing tool which supports delayed job execution.
* You already have a database and don't want to introduce additional tools
in your infrastructure (for example ActiveMq or RabbitMq)
* You have somewhat small load. This worker queue mechanism can handle
more than 1000 rps on single database and table. Moreover you can shard your database and get horizontal scalability.
However we cannot guarantee that it would be easy to auto scale or handle more than 1000 rps.
* You require strong guaranties for task delivery or processing. Library offers at-least-once delivery semantic.

## How it works?

1. You have a task that you want to process later.
2. You tell [QueueProducer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/QueueProducer.java) to schedule the task.
3. [QueueProducer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/QueueProducer.java) optionally chooses a database shard.
4. [QueueProducer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/QueueProducer.java) converts the task payload to string representation through [TaskPayloadTransformer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/TaskPayloadTransformer.java).
5. [QueueProducer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/QueueProducer.java) inserts the task in the database through [QueueDao](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/dao/QueueDao.java).
6. ... the task has been selected from database at specified time according to queue settings ...
7. The task payload is converted to typed representation through [TaskPayloadTransformer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/TaskPayloadTransformer.java).
8. The task is passed to the [QueueConsumer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/QueueConsumer.java) instance in order to be processed.
9. You process the task and return processing result.
10. ... the task is updated according to processing result and queue settings ...

## Features

* Persistent working-queue
* Support for PostgreSQL, MSSQL, Oracle, H2.
* Storing queue tasks in a separate tables or in the same table ([QueueLocation](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/settings/QueueLocation.java)).
* Storing queue tasks in a separate databases for horizontal scaling ([QueueShard](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/config/QueueShard.java)).
* Delayed task execution.
* At-least-once task processing semantic.
* Tracing support via [Brave](https://github.com/openzipkin/brave)
* Several retry strategies in case of a task processing error ([TaskRetryType](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/settings/TaskRetryType.java)).
* Task event listeners ([TaskLifecycleListener](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/config/TaskLifecycleListener.java), [ThreadLifecycleListener](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/config/ThreadLifecycleListener.java)).
* Strong-typed api for task processing and enqueuing ([TaskPayloadTransformer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/TaskPayloadTransformer.java)).
* Several task processing modes ([ProcessingMode](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/settings/ProcessingMode.java)).
* And many other features, look at [Settings package](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/settings).

## Database support

As of now the library supports PostgreSQL, MSSQL, Oracle and H2 as backing database, however library architecture
makes it easy to add other relational databases which has support for transactions and "for update skip locked" feature,
for example MySql.
Feel free to add support for other databases via pull request.

## Modularity

The library is divided into several modules.
Each module contains minimal set of dependencies to easily integrate in any project.

* `db-queue-core` module provides base logic and requires `org.slf4j:slf4j-api` library
* `db-queue-spring` module provides access to database and requires Spring Framework: spring-jdbc and spring-tx.
Other features of Spring ecosystem are not in use.
* `db-queue-brave` module provides tracing support with help of [Brave](https://github.com/openzipkin/brave)
* `db-queue-test` module provides integration testing across all modules.
It might help to figure out how to use the library in your code.

# Usage

## Configuration

### PostgreSQL

Create table (with index) where tasks will be stored.
```sql
CREATE TABLE queue_tasks (
  id                BIGSERIAL PRIMARY KEY,
  queue_name        TEXT NOT NULL,
  payload           TEXT,
  created_at        TIMESTAMP WITH TIME ZONE DEFAULT now(),
  next_process_at   TIMESTAMP WITH TIME ZONE DEFAULT now(),
  attempt           INTEGER                  DEFAULT 0,
  reenqueue_attempt INTEGER                  DEFAULT 0,
  total_attempt     INTEGER                  DEFAULT 0
);
CREATE INDEX queue_tasks_name_time_desc_idx
  ON queue_tasks USING btree (queue_name, next_process_at, id DESC);
```

You should always analyze your database workload before applying
these recommendations.

* Fill Factor

You need to set a low fill-factor for table in order to
let database put row updates to the same page.
In that case database will need less amount of random page writes.
This technique also prevents fragmentation so we get more robust selects.
Same rules are applied to an indexes. You can safely set fill-factor
for tables and indexes to 30%.

Our production settings for frequently updated tasks table are:
```sql
CREATE TABLE queue_tasks (...) WITH (fillfactor=30)
CREATE INDEX ... ON queue_tasks USING btree (...) WITH (fillfactor=30)
```

* Autovacuum

You need to make autovacuum more aggressive in order to eliminate dead tuples.
Dead tuples leads to excessive page reads because they occupy space
that can be reused by active tuples. Autovacuum can be configured in many ways,
for example, you can set
[scale-factor](https://www.postgresql.org/docs/current/static/runtime-config-autovacuum.html#GUC-AUTOVACUUM-VACUUM-SCALE-FACTOR) to 1% or even lower.

Our production settings for frequently updated tasks tables are:
```sql
CREATE TABLE queue_tasks (...) WITH (
autovacuum_vacuum_cost_delay=5,
autovacuum_vacuum_cost_limit=500,
autovacuum_vacuum_scale_factor=0.0001)
```

### MSSQL

Create table (with index) where tasks will be stored.
```sql
CREATE TABLE queue_tasks (
  id                INT IDENTITY(1,1) NOT NULL,
  queue_name        TEXT NOT NULL,
  payload           TEXT,
  created_at        DATETIMEOFFSET NOT NULL  DEFAULT SYSDATETIMEOFFSET(),
  next_process_at   DATETIMEOFFSET NOT NULL  DEFAULT SYSDATETIMEOFFSET(),
  attempt           INTEGER NOT NULL         DEFAULT 0,
  reenqueue_attempt INTEGER NOT NULL         DEFAULT 0,
  total_attempt     INTEGER NOT NULL         DEFAULT 0,
  PRIMARY KEY (id)
);
CREATE INDEX queue_tasks_name_time_desc_idx
  ON queue_tasks (queue_name, next_process_at, id DESC);
```

### Oracle

Create table (with index) where tasks will be stored.
```sql
CREATE TABLE queue_tasks (
  id                NUMBER(38) NOT NULL PRIMARY KEY,
  queue_name        VARCHAR2(128) NOT NULL,
  payload           CLOB,
  created_at        TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
  next_process_at   TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
  attempt           NUMBER(38)                  DEFAULT 0,
  reenqueue_attempt NUMBER(38)                  DEFAULT 0,
  total_attempt     NUMBER(38)                  DEFAULT 0
);
CREATE INDEX queue_tasks_name_time_desc_idx
  ON queue_tasks (queue_name, next_process_at, id DESC);
```
Create sequence and specify its name through `QueueLocation.Builder.withIdSequence(String)`
or `id-sequence` in file config.
```sql
CREATE SEQUENCE tasks_seq;
```

### H2 database

A table that is needed for a work
```sql
CREATE TABLE queue_tasks (
  id                BIGSERIAL PRIMARY KEY,
  queue_name        VARCHAR(100) NOT NULL,
  payload           VARCHAR(100),
  created_at        TIMESTAMP WITH TIME ZONE DEFAULT now(),
  next_process_at   TIMESTAMP WITH TIME ZONE DEFAULT now(),
  attempt           INTEGER                  DEFAULT 0,
  reenqueue_attempt INTEGER                  DEFAULT 0,
  total_attempt     INTEGER                  DEFAULT 0
);
CREATE INDEX queue_tasks_name_time_desc_idx
  ON queue_tasks (queue_name, next_process_at, id DESC);
```

### Code

Simple configuration: [ExampleBasicConfiguration](db-queue-test/src/test/java/ru/yoomoney/tech/dbqueue/test/ExampleBasicConfiguration.java).
Tracing configuration: [ExampleTracingConfiguration](db-queue-test/src/test/java/ru/yoomoney/tech/dbqueue/test/ExampleTracingConfiguration.java)

The main steps to configure the library:
* Specify a queue configuration through [QueueConfig](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/settings/QueueConfig.java) instance (or use [QueueConfigsReader](src/main/java/ru/yoomoney/tech/dbqueue/settings/QueueConfigsReader.java)).
* Implement [QueueProducer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/QueueProducer.java) interface.
* Implement [QueueConsumer](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api/QueueConsumer.java) interface.
* Create [QueueService](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/config/QueueService.java).
* Register `QueueConsumer` in `QueueService`
* Start queues through `QueueService`

## Project structure

* [api](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/api)

You should provide implementation for interfaces in that package.
The package contains classes which are involved in processing or enqueueing tasks.

* [settings](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/settings)

Queue settings.

* [dao](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/dao)

Additional classes for managing storage.

* [config](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/config)

Registration and configuration.

* internal

Internal classes. **Not for public use**.

*Backward compatibility for classes in that package maybe broken in any release*

# Known Issues

* Uneven load balancing

One of the hosts can consequently process several tasks very quickly while other hosts are sleeping.

* No support for Blue-green deployment

There is no support for blue-green deployment because a task is not bound to a host or to a group of hosts.

* Hard to write tests.

Task processing is asynchronous. Therefore, it is hard to write tests because you always must think about that fact
and write code according to it. To ease development of tests you can use `wakeup` method of [QueueService](db-queue-core/src/main/java/ru/yoomoney/tech/dbqueue/init/QueueService.java)

repository: satheeshreddy/db-queue

repo_name: satheeshreddy/db-queue


text:
Checks the indentation of the method name part in method calls
that span more than one line.

# Examples

```ruby
# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c# good
while myvariable
  .b

  # do something
end# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c
```

[Source](http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/MultilineMethodCallIndentation)

repository: codacy/codacy-rubocop

gha_license_id: NOASSERTION

repo_name: codacy/codacy-rubocop


text:
# `carbon_nanotube_Tersoff_LAMMPS`

Example carbon_nanotube_Tersoff_LAMMPS illustrates how to perform thermal
transport simulation for a 10,0 carbon nanotube (40 atoms per cell) system using
[LAMMPS USER-PHONON ](https://lammps.sandia.gov/doc/Packages_details.html#pkg-user-phonon) package as force calculator.

External files required:
			1). forcefields/C.optimize.tersoff
			2). unit.xyz : (10,0) Carbon Nanotube unit cell (40 atoms per cell)

- 0_generate_LAMMPS_input_and_supercell_structures.py proceeds as follows:

    1. Loading in 10,0 CNT unit cell structure (unit.xyz) and write it as LAMMPS input format (CNT.lmp).

    2. Replicate the unit cell (1x1x3 supercell) and write it to force constant input folder (fc_CNT).

- The force constant calculation proceeds as follows:

    in.CNT:
    1.  Compute 2nd, 3rd force constants computed with LAMMPS USER-PHONON

	or

	get_precalculated_fc.sh:
	1.  Download precalculated force constants computed with LAMMPS USER-PHONON

- 1_CNT_Tersoff_thermal_conductivity_quantum.py proceeds as follows:

    1. Set up force constant object by loading in computed 2nd, 3rd force constants computed with LAMMPS USER-PHONON.

    2. Set up phonon object (1x1x151 k-point mesh) and perform quantum simulation at 300K.

    3. Set up Conductivity object and compute thermal conductivity for infinite and finite size samples.

-  2_CNT_Tersoff_thermal_conductivity_classical.py proceeds as follows:

    1. Set up force constant object by loading in computed 2nd, 3rd force constants computed with LAMMPS USER-PHONON.

    2. Set up phonon object (1x1x151 k-point mesh) and perform classical simulation at 300K.

    3. Set up Conductivity object and compute thermal conductivity for infinite and finite size samples.

- LAMMPS packages to install/compile include: [MAKE, MANYBODY, MOLECULE, KSPACE, USER-PHONON](https://lammps.sandia.gov/doc/Packages_details.html).

- To generate input files for LAMMPS calculations and the supercell structures, navigate to this directory and execute:
```python
python 0_generate_LAMMPS_input_and_supercell_structures.py
```
- To compute 2nd and 3rd order force constants with LAMMPS USER-PHONON, navigate to this directory and execute:
```bash
./mpirun -np 8 /path/to/lammps/src/lmp_mpi < in.CNT > CNT.log
```
- To obtain precalculated 2nd and 3rd order force constants, navigate to this directory and execute:
```bash
chmod +x  get_precalculated_fc.sh
./get_precalculated_fc.sh
```
- To perform thermal transport after computing force constants, navigate to this directory and execute:
```python
python 1_CNT_Tersoff_thermal_conductivity_quantum.py
python 2_CNT_Tersoff_thermal_conductivity_classical.py
```
- To access data computed during simulations, navigate to this folder: ***ALD_CNT***
- Reference conductivity (1x1x3 supercell,1x1x151 k-point mesh): 2999.680 W/m-K (classical), 8794.771 W/m-K (Quantum)
- Reference conductivity (1x1x5 supercell,1x1x151 k-point mesh): 3120.487 W/m-K (classical), 8639.604 W/m-K (Quantum)


text:
# sshd

You can run shell directly on the container instead of connecting through ssh with this command.

```sh
homestack exec <container> sh -l
```

But you may still want to install it in order to make the services work with the softwares that can only connect with ssh...

## Install

sshd can be installed to alpine based, supervisor supported containers such as php and alpine using a ready to use script in one line...

In your `.install` script;

```sh
#!/bin/sh

cd $BUILD_FOLDER

scripts/alpine/sshd.sh
```

and build the container again.

```sh
homestack build php73
```

`sshd.sh` script installs ssh server and configures the supervisor installed accordingly.

## Configure Port

Before running the container you need to map the port to connect from host operating system.

In your `docker-compose.override.yml`

```yaml
  php73:
    ports:
      - "7322:22"
```

## Keys and configurations

You can add the public keys that can authorize through ssh in `/root/.ssh/authorized_keys` file in the container. The home folder is
 mounted as volume so the changes in this folder won't be lost after you `down`.

repository: cangelis/homestack-docs

gha_language: JavaScript

repo_name: cangelis/homestack-docs


text:
---
title: "Harbor 2.0 takes a giant leap in expanding supported artifacts with OCI support"
author:
  name: "Harbor Team"
description: "Making Harbor the first OCI-compliant open source registry"
date: 2020-05-13T12:00:00+04:00
draft: false
showPageInfo: true
---

We are pleased to announce general availability of [Harbor 2.0](https://github.com/goharbor/harbor/releases/tag/v2.0.0). This
release makes Harbor the first OCI ([Open Container
Initiative](https://www.opencontainers.org/))-compliant open source
registry capable of storing a multitude of cloud-native artifacts like
container images, Helm charts, OPAs, Singularity, and much more.

*If you're interested in learning more about Harbor 2.0,
*[*register today for the CNCF Project Webinar on Harbor on May 28, 2020
at 10:00am
PDT*](https://zoom.us/webinar/register/7415882601786/WN_dVQGhggoQXmJ1rKPugEKyg)*.*

Let's first dive into what OCI is and what the release of Harbor 2.0
means for the community.

OCI is a tried-and-true industry standard that defines specifications
around format, runtime, and the distribution of cloud-native artifacts.
Most users are familiar with some of the more popular OCI-compliant
artifacts, like docker images and Helm charts. The OCI specification
helps bring artifact authors and registry vendors together behind a
common standard. As a developer, I can now adopt the OCI standard for my
artifacts and be confident that I can use an OCI-compliant registry like
Harbor with minimal to no changes.

At a high level, OCI puts forth two specifications: an
[image](https://github.com/opencontainers/image-spec/blob/master/spec.md)
specification and a
[runtime](https://github.com/opencontainers/runtime-spec/blob/master/spec.md)
specification. The image specification defines what the image looks
like, including the archival format and the contents, including the
manifest, the (optional) image index, the ordinal set of filesystem
layers, and a
[configuration](https://github.com/opencontainers/image-spec/blob/master/config.md)
file. The OCI runtime then takes that configuration and converts it into
an executable that consumes the filesystem bundle in accordance with the
runtime specification. Put another way, the image specification
facilitates the creation of interoperable tools for building,
transporting, and preparing images for running whereas the runtime
specification dictates the configuration, execution environment, and
lifecycle of a container.

Supporting OCI-compliant images in Harbor means supporting its set of
APIs and interpreting key information. Such information includes the OCI
schemas and media types that are used to determine what can or cannot be
pushed onto Harbor. For example, the manifest.config.mediaType field is
critical for identifying itself to the registry while the
layer.mediaType defines the filesystem layers that are to be stored and
persisted on the registry---without the registry having to pull and
dissect the layers first.

**For example, Helm charts can now be pushed onto Harbor via Helm3.**
Instead of being hosted separately in ChartMuseum, Helm charts are now
stored under artifacts alongside container images. In this figure below,
we see a container image, a Helm chart, and a Cloud Native Application
Bundles (CNAB) hosted in the same project.

![](../img/harbor-2.0-artifacts.png)

Harbor gets another key benefit from being OCI-compliant: It is now
fully capable of handling an OCI
[index](https://github.com/opencontainers/image-spec/blob/master/image-index.md),
a higher-level manifest representing a bundling of image manifests
that's ideal for multi-architecture scenarios. Imagine pulling an image
without having to specify the operating system and platform and instead
relying entirely on the client tooling to ensure the correct version of
that image is fetched. This index structure is widely leveraged by
artifacts like CNAB for managing distributed cloud-agnostic
applications.

Although Harbor is now OCI-compliant, existing users should not worry;
all of the familiar operations and key benefits of Harbor translate well
to OCI. You can push, pull, delete, retag, copy, scan, and sign indexes
just like you've been able to do with images. Vulnerability scanning and
project policies, key ingredients to enforcing security and compliance,
have been revamped to work with OCI artifacts. We also provided a new,
key capability: you now have the ability to delete an image tag without
deleting the underlying manifest and all other associated image tags.
You can also view untagged images, and have the option to exclude them
from being garbage-collected.

As artifact types will undoubtedly come and go, it's crucial that Harbor
exists outside of any particular container format, and be flexible
enough to onboard and discard any artifact type based on community
demand and adherence to common standards.

## Shipping Aqua Trivy as the default scanner

This release also replaces Clair with [Aqua's
Trivy](https://github.com/aquasecurity/trivy) as the default image
scanner. Trivy takes container image scanning to higher levels of
usability and performance than ever before. Since adding support for
Trivy through our pluggable scanning framework in Harbor v1.10, we have
received great feedback and have seen increasing traction among the
Harbor community, making Trivy the perfect complement to Harbor. Trivy
has wide coverage for scanning different operating systems and
application package managers, and is easy to integrate into CI/CD
systems. It also conducts deep scans and picks up vulnerabilities across
popular distros like CentOS, Photon OS, Debian, and Ubuntu, among
others. Clair also continues to be supported in Harbor as a built-in
scanner. In fact, during an upgrade to Harbor v2.0, projects using Clair
as the scanner of choice will be unaffected; Trivy will be set as the
default scanner only for new installations.

![](../img/harbor-2.0-interrogation-services.png)

## Notable features

We listened to user feedback and are making strides towards an improved
design for Harbor robot accounts, a design that reflects common usage
patterns. Harbor v2.0 introduces the ability to set an expiration date
on each individual robot account as opposed to a system-wide setting. In
a future release, we will grant robot accounts the ability to be
targeted to one or more projects, and will offer better credential
handling for Kubernetes deployments.

Also new in Harbor v2.0 is the ability to configure SSL for core Harbor
services. When configured, internal Harbor services will encrypt their
service-to-service communication. This feature enhances the security
posture of Harbor and reduces the likelihood of man-in-the-middle
attacks.

Webhooks can now be individually triggered, and come with Slack
integration. Some users may not want to receive callbacks for every
supported webhook action, so this update enables users to configure, at
the project level, which webhooks to receive and the preferred callback
method, HTTP or Slack.

![](../img/harbor-2.0-dark-light.png)

Did you also notice the all-new dark mode in the updated Harbor UI?
Download [Harbor v2.0](https://github.com/goharbor/harbor/releases/tag/v2.0.0) and give it a shot!

Hopefully Harbor v2.0 has your attention. Join us for the CNCF Project
Webinar on Harbor v2.0 on May 28, 2020 at 10:00am PDT by registering
[here](https://zoom.us/webinar/register/7415882601786/WN_dVQGhggoQXmJ1rKPugEKyg).

## Community Shoutouts!

- A huge thank-you to the Harbor maintainer team for delivering Harbor v2.0
- [@stuclem](https://github.com/stuclem) for revamping our documentation
- [@lucperkins](https://github.com/lucperkins) for the snazzy new
  [goharbor.io](https://goharbor.io/) website
- [@ninjadq](https://github.com/ninjadq) for certificate enablement
  and SSL enhancements
- [@danfengliu](https://github.com/danfengliu) for QA and CI
  contributions to Harbor v2.0
- [@allForNothing](https://github.com/AllForNothing),
  [@jwangyangls](https://github.com/jwangyangls) for the new Harbor UI
- [@heww](https://github.com/heww),
  [@stonezdj](https://github.com/stonezdj),
  [@bitsf](https://github.com/bitsf) for the Harbor v2.0 code
  refactoring
- [@tedgxt](https://github.com/tedgxt) for the webhook enhancements

## About Harbor

[Harbor](http://github.com/goharbor/harbor) is an open source, trusted
cloud native registry project that stores, signs, and scans container
images, Helm charts, and any other OCI-compliant artifacts. Harbor
extends the open-source Docker Distribution by adding key
enterprise-level features in authentication and access control (LDAP and
AD as well as OIDC support for RBAC), two-way replication to and from
other third-party registries, advanced garbage collection, and
authenticity and provenance capabilities through third-party image
scanning and signing solutions. Harbor, which supports Docker Compose
and Kubernetes, deploys in under 30 minutes. Harbor can be fully managed
through a single web console and comes with a rich set of APIs managed
with Swagger.

## Collaborate with the Harbor Community!

Get updates on Twitter
([@project\_harbor](https://twitter.com/project_harbor))

Chat with us on Slack
([#harbor](https://cloud-native.slack.com/messages/harbor)
and [#harbor-dev](https://cloud-native.slack.com/messages/harbor-dev)
on the[CNCF Slack](https://slack.cncf.io/))

Collaborate with us on GitHub:[
github.com/goharbor/harbor](https://github.com/goharbor/harbor)

Attend the community meetings:
[https://github.com/goharbor/community/wiki/Harbor-Community-Meetings](https://github.com/goharbor/community/wiki/Harbor-Community-Meetings)

Alex Xu
Harbor Contributor
Senior Product Manager, VMware
[@xaleeks](https://github.com/xaleeks)

repository: goharbor/website

repo_name: goharbor/website