text:
<!-- vim: set filetype=markdown : -->

Server-Client Interaction
=========================

Test in this order:
* Check that new client works with new server in emulation mode
* During downtime (e.g. at night), upload new server.  Check that old client (on phone) works with
  new server.
* Check that old client updates to new client
* Check that new client works with new server

Unfortunately, there appears to be no way to test upgrades of ApplicationSettings (there are tools
that work for Windows 8/Windows Phone 8 only).

Test Cases for Client
=====================

## Upgrade

This comes first since you often only get a single shot to do it easily.

* Install application on phone that has existing application, with cache.

  * Does the cache work (are the schedules shown on MainPage) or, if appropriate, are new schedules downloaded?
  * Does the list of displayed routes match the previous settings?
  * Are other settings (Settings Page) preserved?
  * Does the URL sent by the client show the new version number (use log to verify)?

## Clean Install

We typically don't test this specially, because it gets tested automatically when using
the emulator.

## MainPage

* Does the application start with MainPage?  Does it look right?
* Do departure times scroll horizontally?
* Does the East / West toggle work?
* Does the "East" / "West" text fade in when the toggle is used?
* Does each navigation item on MainPage take you to the appropriate page?
  * [i][!] button to the corresponding RoutePage?
  * Application bar icon to ChooseRoutes?
  * Application bar icon to Settings?
  * Application bar icon to Info?
* Does the "back" button return to MainPage in each case?

## RoutePage / AlertsPage

* Each route has it's own unique page.  Verify that sequences of selecting route pages
  produce the correct route page.
* Verify that re-visiting the same route page works.
* ...Interleaved with other route pages.
* Verify that re-visiting a route page works if MainPage has been switched between East & West
  (especially for routes whose names change).

* Does Route Page look correct?
* Verify that the correct times are in the correct boxes for at least one Route Page
* Verify that every Route Page has content in every box (unless legitimately empty), and
  that the formatting looks correct in every case.
* Does Route Page scroll vertically when content is longer than screen?

## Choose Routes Page

* Does the full list of routes show?
* Is it possible to check and uncheck each route?
* Check all routes and return to main page.  Are all routes present?
* Uncheck all routes and return to main page.  Does everything still work (though screen is empty)?
* Check and uncheck a single route multiple times.  Verify that there are no strange behaviors when
  returning to MainPage

## Info Page

* Typos?

## Settings Page

* Does the 12/24 hour setting correctly change the display on both Main page and Route page?
* Try above when re-visiting a previously-visited Route Page
* Does the buffer time slider work properly?
* Does the Location on/off toggle work properly?
* Does a double-tap on the blank part of the screen bring up the Debug toggle and link?
* Make changes, exit the app, re-enter and verify that the changes persisted.
(Refresh schedules handled below).

## Loading Schedules

* Does the "Refresh Schedules" button cause the explanatory text to change to reload app?
* With an internet connection, click "Refresh Schedules", and exit and re-enter app.  Do schedules
  load quickly?
* Without an internet connection, click, "Refresh Schedules", and exit and re-enter app.
  * Does a "downloading..." dialog appear almost immediately?
  * Navigate (quickly) to a Route page.  Verify that nothing breaks (though boxes are empty).
  * Return to Main Page.  Verify that "no network connection" popup appears within a few minutes.
  * Exit the app, restart the internet connection, and re-enter the app.  Do the schedules now load?
* Go through above process (until the nonetwork popup is showing).  Exit and re-enter app without
  an internet connection.  Verify that nonetwork popup returns.

## Special Schedules

* Engineer a special schedule to be sent to the test app only.  Verify that the app can receive
  and display a special schedule that affects one or multiple routes.
* Verify that the special schedule is not cached by turning the special schedule off on the server
  and restarting the app.  The special schedule should be gone.

## Travel Times

* Basically, make sure they look right.   Drive around with the app and observe changing impact on
  travel times.
* Verify that setting buffer time has the impact you expect on the travel times.
* Verify that waiting for travel times messages display appropriately: appear after a few seconds of
  waiting when there is no network access, and then turn off again when travel times are delivered.

## Alerts

* Engineer special alert(s) to be sent to the test app only.  Verify that the app can receive and
  display them.  Verify that the app can display multiple alerts for the same route.
* Verify that new alerts show as unread (icon on Mainpage and "new" text on alert itself).
* Verify that once a RouteAlert page has been visited, those alerts are no longer marked unread.
* Special case: verify that an alert that affects multiple routes is marked as read on all those routes.
* Verify that alert caching works:  after alerts have been received, restart the application without
  network access.  Verity that the previous set of alerts are still present.
* Verify that alert update works: change the alerts sent to include new alerts and remove some old ones.
  Verify that the app shows exclusively the new set of alerts (old ones are gone).  Verify that only
  the new alerts are marked unread.

## Logging & Bugsense

* Verify that with logging turned on, you can go to the Log page.
* Verify that with logging turned on, no other changes are visible in the app (the original logging
  code would put stuff on all pages).
* Verify that clearing and emailing the log files works.
* Verify that a thrown exception is caught by BugSense and displayed on the BugSense console.

## Application Life Cycle

* For each page type, use the Windows Phone button to start a new application.  Verify that the back
  button returns to the same location in the app, and that everything works (no data is lost).
  Especially do this for the Route/Alert page and verify that back returns to where the user left, and
  that back again returns to the main page.
* Do the same process in the emulator with the "tombstone on exit" option set, to verify the same
  behavior when the application gets tombstoned.
* With location and logging both on, from the Main Page use the Windows Phone button to start a new
  application.  Use the phone "lightly" (only small applications, so the NextFerry app is *not*
  tombstoned).  Leave the phone in this state for some time.  Return to the NextFerry app and verify
  that it has not been working (the log contains no notices of timer or other activity).   This is
  not a completely accurate test, since the log itself may have been disabled, but I don't have
  any better ideas.

## WP7 Integration
* Verify that the tile looks correct, both in the Applications list, and if placed on the main screen.
* Verify that changing the light/dark theme and the theme colors produces correct behavior (especially
  on Route Pages and highlighting on MainPage).
* Verify that a phone call occuring while the NextFerry app is open works: the phone call goes through
  and the app returns correctly afterwords.

license: MS-PL

repository: MrMichaelJKelly/nextferry

repo_name: MrMichaelJKelly/nextferry


text:
# libardrone-squaretracker

#Requirements:
(just run installer)

    PIL==1.1.7

    mock==1.0.1

    numpy==1.7.1

    Latest version of SimpleCV

#To Run:
  Run file 'akhil_demo.py'
  (At the top there are a list of variables to change if needed.)

        UPDATE FOR TRACKING CIRCLES

#contact:
<EMAIL_ADDRESS>
#Other stuff

  For additional information on this library visit adetaylor's repository:https://github.com/adetaylor/python-ardrone

  This software was tested with the following setup:

     Python 2.7.6

    Unmodified AR.Drone firmware 2.0

    Ubuntu 12.04

  License:

    This software is published under the terms of the MIT License:

    http://www.opensource.org/licenses/mit-license.php

license: MIT

repository: akhilcjacob/Quadcopter-Automation

branch_name: refs/heads/master

extension: md

gha_language: Python

license_type: permissive

repo_name: akhilcjacob/Quadcopter-Automation


text:
+++
title = "Optimistic locking"
weight = 1000
type = "docs"
+++

To make business decisions, you need a model to base those decisions on. In most cases, it is important that this
model is consistent with the facts published at the time of the decision and that the model is up-to-date.

For example, we want to ensure that the username is unique for the whole system.
In case of (potentially) distributed applications and especially in case of eventsourced applications,
this can be a difficult problem.
For sure what you want to avoid is pessimistic locking for all sorts of reasons,
which leaves us with optimistic locking as a choice.

On a general level, optimistic locking:

- **tries** _to make a change_ and then _to write that change_ **or**
- if something happens in the meantime that could invalidate this change,
  _discard the change_ and **try again** taking the new state into account.

Often this is done by adding a `versionId` or `timestamp` to a particular Entity/Aggregate to detect concurrent changes.

This process can be _repeated until the change is either successful or definitively unsuccessful and needs to be
rejected_.

For our example that would mean:

If a new user registers,

1. check if the username is already taken
   - if so, reject the registration
   - if not, prepare a change that creates the user
1. check if a new user was created in between, and
   - repeat from the beginning if this is the case
   - execute the change while making sure no other change can interfere.

In FactCast/Factus, there is no need to assign a `versionId` or `timestamp` to an aggregate or even have aggregates for
that matter.
All you have to do is to define a _scope_ of an optimistic lock to check for concurrent changes in order to either
discard the prepared changes and try again, or to publish the prepared change if there was no interfering change in
between.

Let's look at the example above:

Consider, you have a `SnapshotProjection` `UserNames` that we have seen before.

```java
public class UserNames implements SnapshotProjection {

  private final Map<UUID, String> existingNames = new HashMap<>();

  @Handler
  void apply(UserCreated created) {
    existingNames.put(created.aggregateId(), created.userName());
  }

  @Handler
  void apply(UserDeleted deleted, FactHeader header) {
    existingNames.remove(deleted.aggregateId());
  }

  boolean contains(String name) {
    return existingNames.values().contains(name);
  }

// ...
```

In order to implement the use case above (enforcing unique usernames), what we can do is basically:

```java
  UserNames names=factus.fetch(UserNames.class);
        if(names.contains(cmd.userName)){
        // reject the change
        }else{
        UserCreated prepared=new UserCreated(cmd.userId,cmd.userName));
        // publish the prepared UserCreated Event
        }
```

Now in order to make sure that the code above is re-attempted until there was no interference relevant to the UserNames
Projection and also that the business decision (the simple if clause) is always based on the latest up-to-date data,
Factus offers a simple syntax:

```java
/**
 * optimistically 'locks' on a SnapshotProjection
 */
<P extends SnapshotProjection> Locked<P> withLockOn(@NonNull Class<P> snapshotClass);
```

Applied to our example that would be

```java

UserRegistrationCommand cmd=...    // details not important here

        factus.withLockOn(UserNames.class)
        .retries(10)                     // optional call to limit the number of retries
        .intervalMillis(50)              // optional call to insert pause with the given number of milliseconds in between attempts
        .attempt((names,tx)->{
        if(names.contains(cmd.userName)){
        tx.abort("The Username is already taken - please choose another one.");
        }else{
        tx.publish(new UserCreated(cmd.userId,cmd.userName));
        }

        });
```

As you can see here, the attempt call receives a BiConsumer that consumes

1. your defined scope, updated to the latest changes in the Fact-stream
1. a `RetryableTransaction` that you use to either publish to or abort.

Note that you can use either a `SnapshotProjection` (including aggregates) as well as a `ManagedProjection` to lock on.
**A `SubscribedProjection` however is not usable here**, due to the fact that they are in nature eventual consistent,
which
breaks a necessary precondition for optimistic locking.

Also note that you should not (and cannot) publish to Factus directly when executing an attempt, as this would
potentially
break the purpose of the optimistic lock, and can lead to infinite loops.

For further details on how to add operations that are executed after successful publishing or on failure handling,
please consult the JavaDocs, or look at the provided examples.

repository: factcast/factcast

gha_language: Java

repo_name: factcast/factcast


text:
[Vagrant](http://www.vagrantup.com) provider for VMware vCloud Director®
=============

[Version 0.3.3](../../releases/tag/v0.3.3) has been released!
-------------

Please note that this software is still Alpha/Beta quality and is not recommended for production usage.

Right now a [Precise32](http://vagrant.tsugliani.fr/precise32.box) is available for use, or you can roll your own as you please, make sure to install VMware tools in it.

If you're unsure about what are the correct network settings for your Vagrantfile make sure to check out the [Network Deployment Options](https://github.com/frapposelli/vagrant-vcloud/wiki/Network-Deployment-Options) wiki page.

Features of Version 0.3.3 are:

- Critical Bug Fix for ```network_bridge``` users [[#67](../../issues/67)]

Features of Version 0.3.2 are:

- Added support for ```vagrant share``` command [[#31](../../issues/31)]  *experimental*
- Restructured the ```vagrant vcloud-status``` command to ```vagrant vcloud``` namespace for future-proofing [[#53](../../issues/53)]
- Added ```vagrant vcloud --redeploy-edge-gw``` to redeploy Edge Gateway [[#54](../../issues/54)]
- Fixed Issues [[#45](https://github.com/frapposelli/vagrant-vcloud/issues/45), [#46](https://github.com/frapposelli/vagrant-vcloud/issues/46), [#47](https://github.com/frapposelli/vagrant-vcloud/issues/47), [#48](https://github.com/frapposelli/vagrant-vcloud/issues/48), [#51](https://github.com/frapposelli/vagrant-vcloud/issues/51), [#52](https://github.com/frapposelli/vagrant-vcloud/issues/52), [#56](https://github.com/frapposelli/vagrant-vcloud/issues/56), [#57](https://github.com/frapposelli/vagrant-vcloud/issues/57), [#61](https://github.com/frapposelli/vagrant-vcloud/issues/61)]

Features of Version 0.3.1 are:

- Small hotfix to include "preRunning" condition when using vCloud Director 5.5 [[#44](https://github.com/frapposelli/vagrant-vcloud/issues/44)]. - [Andrew Poland](https://github.com/apoland)

Features of Version 0.3.0 are:

A substantial release, major kudos to [Stefan Scherer](https://github.com/StefanScherer) who submitted some substantious PRs!

- Added support for port mapping at the Organization Edge Gateway.
- Added a new configuration options ```vapp_prefix``` to change vApp prefix (defaults to Vagrant).
- Improved vcloud-status command.
- Fixed cygdrive path for rsync on Windows.
- Fixed Issue [[#33](../../issues/33)] - Error removing/creating NAT rules on second vagrant up.
- Fixed Issue [[#43](../../issues/43)] - Destroy fails if VMs are halted.

Features of Version 0.2.2 are:

- Fixed Issue [[#32](../../issues/32)] - Port Forwarding rules are deleted when Halting a VM.

Features of Version 0.2.1 are:

- Critical Bugfixes

Features of Version 0.2.0 are:

- It's now possible to connect to an existing VDC network without creating a vShield Edge using ```network_bridge = true``` in the Vagrantfile [[#23](../../issues/23)]. *experimental*
- Added a ```upload_chunksize``` parameter to specify the chunk dimension during box uploads [[#21](../../issues/21)].
- Added support for [vCloud® Hybrid Service™](http://www.vmware.com/products/vcloud-hybrid-service) API version 5.7.
- Added a new command to vagrant called ```vcloud-status``` that shows the current status of the vCloud instance relative to the Vagrant deployment. *experimental*
- General code cleanup, code should be more readable and there's a rubocop file for our code conventions.
- Passwords are now hidden when running in DEBUG mode.
- Initial support for Vagrant 1.5 (currently not supporting the new "share" features).
- Lowered Nokogiri requirement to 1.5.5 (you may need to remove a later version if installed).
- Fixed the Edge Gateway NAT rules creation / deletion.
- Added debug capabilities down to XML traffic exchanged during the REST calls.

Check the full releases changelog [here](../../releases)

Install
-------------

Latest version can be easily installed by running the following command:

```vagrant plugin install vagrant-vcloud```

Vagrant will download all the required gems during the installation process.

After the install has completed a ```vagrant up --provider=vcloud``` will trigger the newly installed provider.

Configuration
-------------

Here's a sample Multi-VM Vagrantfile, please note that ```vcloud.vdc_edge_gateway``` and ```vcloud.vdc_edge_gateway_ip``` are required only when you cannot access ```vcloud.vdc_network_name``` directly and there's an Organization Edge between your workstation and the vCloud Network.

```ruby
precise32_vm_box_url = "http://vagrant.tsugliani.fr/precise32.box"

nodes = [
  { :hostname => "web-vm",  :box => "precise32", :box_url => precise32_vm_box_url },
  { :hostname => "ssh-vm",  :box => "precise32", :box_url => precise32_vm_box_url },
  { :hostname => "sql-vm",  :box => "precise32", :box_url => precise32_vm_box_url },
  { :hostname => "lb-vm",   :box => "precise64", :box_url => precise32_vm_box_url },
  { :hostname => "app-vm",  :box => "precise32", :box_url => precise32_vm_box_url },
]

Vagrant.configure("2") do |config|

  # vCloud Director provider settings
  config.vm.provider :vcloud do |vcloud|
    vcloud.vapp_prefix = "multibox-sample"

    vcloud.hostname = "https://my.cloudprovider.com"
    vcloud.username = "MyUserName"
    vcloud.password = "MySup3rS3cr3tPassw0rd!"

    vcloud.org_name = "OrganizationName"
    vcloud.vdc_name = "vDC_Name"

    vcloud.catalog_name = "Vagrant"
    vcloud.ip_subnet = "<IP_ADDRESS>/<IP_ADDRESS>"

    vcloud.vdc_network_name = "MyNetwork"

    vcloud.vdc_edge_gateway = "MyOrgEdgeGateway"
    vcloud.vdc_edge_gateway_ip = "<IP_ADDRESS>"
  end

  nodes.each do |node|
    config.vm.define node[:hostname] do |node_config|
      node_config.vm.box = node[:box]
      node_config.vm.hostname = node[:hostname]
      node_config.vm.box_url = node[:box_url]
      node_config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true
      # node_config.vm.provision :puppet do |puppet|
      #   puppet.manifests_path = 'puppet/manifests'
      #   puppet.manifest_file = 'site.pp'
      #   puppet.module_path = 'puppet/modules'
      # end
    end
  end
end
```

For additional documentation on different network setups with vCloud Director, check the [Network Deployment Options](../../wiki/Network-Deployment-Options) Wiki page

Contribute
-------------

What is still missing:

- TEST SUITES! (working on that).
- Speed, the code is definitely not optimized.
- Permission checks, make sure you have at least Catalog Admin privileges if you want to upload boxes to vCloud.
- Thorough testing.
- Error checking is absymal.
- Some spaghetti code here and there.
- Bugs, bugs and BUGS!.

If you're a developer and want to lend us a hand, head over to our ```develop``` branch and send us PRs!

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/frapposelli/vagrant-vcloud/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

repository: appaneni/vagrant-vcloud

repo_name: appaneni/vagrant-vcloud


text:
# microservice-e57metadata

This microservice provides an API for extracting metadata from e57 (pointcloud) files.

The easiest way to test the microservice is to install docker (http://docker.io) and pull the latest version via

```shell
docker pull duraark/microservice-e57metadata
```

You can start a container afterwards via

```shell
docker run -d -p 1337:1337 -v /my_e57_files:/storage duraark/microservice-e57metadata
```

The container exposes port 1337. To bring your e57 files into the container use the "-v" flag and link the desired folder as "/storage".

The following API endpoints are available:

* http://localhost:1337/files -> lists all the files from the folder linked into the container
* http://localhost:1337/e57m/extract -> schedules the metadata extraction for a given file
* http://localhost:1337/e57m -> lists all pending and finished jobs
* http://localhost:1337/e57m/:id -> lists a single job ('id' starts with 1, not 0)

First, check which files are known to the system in querying the "files" endpoint:

```shell
curl http://localhost:1337/files
```

which results in a JSON response similar to:

```json
{
    "files": [
        "/storage/bunny.e57"
    ],
    "directories": []
}
```

In this case the system has access to a single file: "/storage/bunny.e57"

To schedule the metadata extraction for that file POST the filename to the "e57m/extract" endpoint like so:

```shell
curl -H "Content-Type: application/json" -d '{"files": ["/storage/bunny.e57"]}' http://localhost:1337/e57m/extract
```

The payload is an array, so it is possible to extract data from multiple files in one request.

To see a list of all scheduled jobs GET the "e57m" endpoint via curl or directly in the webbrowser. The curl command line is:

```shell
curl http://localhost:1337/e57m
```

The JSON response looks like:

```json
[{
    "originatingFile": "/storage/bunny.e57",
    "status": "finished",
    "metadata": {
        "e57_metadata": {
            ... lots of metadata ...
        }
    },
    "createdAt": "2015-01-21T22:51:40.429Z",
    "updatedAt": "2015-01-21T22:51:40.480Z",
    "id": 1
}]
```

If the job is still processing the JSON the "status" entry says "pending" and the "metadata" entry is an empty object, e.g.

```json
[{
    "originatingFile": "/storage/bunny.e57",
    "status": "pending",
    "metadata": {},
    "createdAt": "2015-01-21T22:51:40.429Z",
    "updatedAt": "2015-01-21T22:51:40.480Z",
    "id": 1
}]
```

Example e57 files can be found at http://www.libe57.org/data.html.

Enjoy!


text:
---
layout: news_item
title: 'jekyll-import 0.1.0.rc1 Released'
date: 2013-11-18 18:40:18 -0500
author: parkr
version: 0.1.0.rc1
categories: [release]
---

We're finally nearing a full release of `jekyll-import`! This release has some
critical bug fixes as well as some awesome enhancements.

**NOTE:** This version does not work with Jekyll v1.3.0's command-line
interface. Follow the docs you see for the importer you'd like to use and run
the Ruby shell command as seen there (with your own tweaks, of course).

Please [file any bugs you encounter!]({{ site.repository }}/issues/new)

repository: JeniT/jekyll-import

extension: markdown

repo_name: JeniT/jekyll-import


text:
# GS2 Post-Processing and Plotting

This is a tool and library for post-processing data from the gyrokinetic magnetised plasma turbulence code [GS2](http://gyrokinetics.sourceforge.net).

It consists of a command line tool and wrapper which provides an common interface to a series of separate packages, each of which presents a standardised interface to the wrapper.

## The command line interface:

    $ gs2pp <package> <command> <package_function> <options>

where command is one of:

1. `run`: a generic command which will simply run the analysis. Useful when analysis is complicated and it's more natural to write results and plots to file at the same time.
2. `plot`: display results to screen or save them to an image file.
3. `write`: write the results to a file (NetCDF, JSON, CSV) specified by command line argument or decided by package.
4. `return`: return a dict of results for further manipulation.

Options are package specific, with the following exceptions:

    -f filename # Name of file to write data to

E.g.

     $ gs2pp gs2_correlation netcdf all -f output.nc

## Standardised Package Interface

Each separate package within gs2pp defines the following standard function

    def gs2pp_interface( command, package_function, options ):

The parameters `command` and `package_function` are strings, and options is a dict. This function must do different things according to the value of `command`. The analysis package does *not* need to implement all `command` functions, only the ones which make sense for the package. The wrapper will handle exception handling to the user based on a (yet to be defined) way of getting the implemented methods from a given package.


text:
alto-sublime
============

A Sublime Text 2 package for opening [alto](https://github.com/jkocherhans/alto).

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

Add https://raw.github.com/jkocherhans/alto-sublime/master/repositories.json as a new Package Control channel, then install Alto from Package Control.

repository: jkocherhans/alto-sublime

repo_name: jkocherhans/alto-sublime


text:
# pal [![Build Status](https://travis-ci.org/Microsoft/pal.svg?branch=master)](https://travis-ci.org/Microsoft/pal)

The PAL is a Platform Abstraction Layer that is used in a variety of
projects. The PAL allows for easy compatibility between many different
flavors of UNIX/Linux, including AIX 6.1 and later, HP/UX 11.31 and
later, Solaris 5.10 and later, and most versions of Linux as far back
as RedHat 5.0, SuSE 10.1, and Debian 5.0.

The PAL has two primary components:

- [SCXCoreLib](#scxcorelib)
- [SCXSystemLib](#scxsystemlib)

### SCXCoreLib

SCXCoreLib provides portable services for:

- atomic handling
- UNIX conditions
- directory lookup
- file handling (reading/writing/modifying)
- ref-counted handle mechanism to release on last use
- common logging framework
- marshalling/unmarshalling
- DNS name resolution
- pocess launching/controlling
- regular expressions
- singletons
- threading
- time handling
- other various functions

The above list is not intended to be all-inclusive. Features are added
to the PAL as necessary.

### SCXSystemLib

SCXSystemLib primarily returns statistical information for products
like [SCXcore][] and [SCXcm][], and other [omi][] providers. This
subsystem primarily follows the CIM module (enumerate a set of
instances, get detailed information on a specific instance).

[SCXcore]: https://github.com/Microsoft/SCXcore
[SCXcm]: https://github.com/Microsoft/SCXcm
[omi]: https://github.com/Microsoft/omi

Primary enumeration information is supported for:

- bios
- computer system
- cpu statistics
- cpu property information
- disk information
- file system information
- installed software
- memory information
- network configuration
- network routing information
- operating system information
- process information
- processor information

This component tends to be highly system specific, and may run on
fewer systems than [SCXCoreLib](#scxcorelib), above.

repository: cephdon/pal

repo_name: cephdon/pal


text:
# #100DaysOfML

A Repository to some of my works done as a part of 100DaysOfML Challenge

The website can be accessed from here

gha_language: HTML

gha_license_id: MIT


text:
zfs-java-wrapper
================

[![Build Status](https://consolving.de/jenkins/buildStatus/icon?job=de.javastream.zfs-java-wrapper)](https://consolving.de/jenkins/job/de.javastream.zfs-java-wrapper/)

This is a basic java-wrapper for zfs.
There were a JNA Version of it (at least for the original ZFS - aka on Solaris), but it is not well maintenanced and modifying the JNA Bindings for every derivate (Solaris / Illumos / FreeBSD / FreeNAS...) is very time consuming.
So this Library will using the CLI Tools and then will parse the output.
There are some Text Snippets for that in _src/test/resources_.
Although most parsing works, there are some more minor errors.

repository: phaus/zfs-java-wrapper

repo_name: phaus/zfs-java-wrapper


text:
---
title: "Work in Progress Skins 2014"
date: 2014-02-12T03:00:00Z
tags:
  - Community
author: zag
featured_image:
  src: /images/blog/Celestium.webp
  title: "Celestium"
  alt: "Celestium"
---

The XBMC skinning engine has matured over the years to allow lots of different kinds of styles such as horizontal, vertical, touchscreen menus, fanart, clearart and advanced animations. Many users are familiar with our popular skins but we also have a vibrant community of developers creating radical new skins. Getting from a mockup, to a fully working skin can take time but the results can be incredible. Sometimes the skins never make it out of the design phase so we thought it might be nice to show a few of them off. If you want to see a skin developed why not help out or show your support by taking part in our [Skin WIP forum](https://forum.kodi.tv/forumdisplay.php?fid=160)?

So here are a few screenshots to whet your appetite:

NOTE: All these skins are work in progress and may not be available yet to actually use in XBMC.
 Some skin ideas may come from other designs or software. It should be the case that permission has been acquired to re-use the resources. Please feel free to discuss any issues in the individual threads.

Cycle - <https://forum.kodi.tv/showthread.php?tid=169945>![](https://www.theaudiodb.com/images/_extra/xbmc/small_Cycle.webp)

Celestium - <https://forum.kodi.tv/showthread.php?tid=153067>![](https://www.theaudiodb.com/images/_extra/xbmc/small_Celestium.webp)

Welo v2 - <https://forum.kodi.tv/showthread.php?tid=150753>
![](https://www.theaudiodb.com/images/_extra/xbmc/small_Welov2.webp)

**Avalon** - <https://forum.kodi.tv/showthread.php?tid=131965>![](https://www.theaudiodb.com/images/_extra/xbmc/small_avalon.webp)

Aerith - <https://forum.kodi.tv/showthread.php?tid=112835>
![](https://www.theaudiodb.com/images/_extra/xbmc/small_Aerith.webp)

Arctic - <https://forum.kodi.tv/showthread.php?tid=170954>
![](https://www.theaudiodb.com/images/_extra/xbmc/small_arctic.webp)

Immersive - <https://forum.kodi.tv/showthread.php?tid=139712>
![](https://www.theaudiodb.com/images/_extra/xbmc/small_immersive.webp)

**Lightbox** - <https://forum.kodi.tv/showthread.php?tid=177476>

**Maximinimalism** - <https://forum.kodi.tv/showthread.php?tid=170839>

Titan - <https://forum.kodi.tv/showthread.php?tid=148265>
![](https://www.theaudiodb.com/images/_extra/xbmc/small_Titan.webp)

MetroTV - <https://forum.kodi.tv/showthread.php?tid=138997>![](https://www.theaudiodb.com/images/_extra/xbmc/small_MetroTV.webp)

Simplicitas - <https://forum.kodi.tv/showthread.php?tid=170262>
![](https://www.theaudiodb.com/images/_extra/xbmc/small_Simplicitas.webp)

Alaska - <https://forum.kodi.tv/showthread.php?tid=168494>![](https://www.theaudiodb.com/images/_extra/xbmc/small_Alaska.webp)

Metroid - <https://forum.kodi.tv/showthread.php?tid=178956>![](https://www.theaudiodb.com/images/_extra/xbmc/small_Metroid.webp)

Zbox - <https://forum.kodi.tv/showthread.php?tid=170812>
![](https://www.theaudiodb.com/images/_extra/xbmc/small_zbox.webp)

MXE - <https://forum.kodi.tv/showthread.php?tid=184125>
![](https://www.theaudiodb.com/images/_extra/xbmc/small_MXE.webp)

Xbox One - <https://forum.kodi.tv/showthread.php?tid=167601>![](https://www.theaudiodb.com/images/_extra/xbmc/small_XboxOne.webp)

repository: ECCx/kodi-tv

branch_name: refs/heads/main

repo_name: ECCx/kodi-tv


text:
{Check It!|assessment}(test-484914084)

|||guidance
## Solution

- on the `if` line, we have `texts` instead of `text`
- the `if` line is missing the opening `{`
- the `else` block is not closed with a `}`

```javascript

// Get input from the command line
var text = process.argv[2]

if (text != 'Bingo') {
  console.log( 'Missed' )
}
else {
  console.log('Hit!')
}
```
|||

gha_language: Shell


text:
# Meeting Notes

## Week 1

* Set up the repository
* Determine the following plan

## Week 2

In this week, we
* decide the high level structure of our framework
* implementing the distributed file system
* constructing the framework for training language models
* preprocess the dataset

In the next week, we plan to:
* finish building the distributed file system
* start to implement the call back system based on the training framework
* disscuss about how to build the preemption handler and start to implement it

repository: qbetterk/final-project-torchfly

repo_name: qbetterk/final-project-torchfly


text:
[![codecov](https://codecov.io/bb/adastradev/data-ingestion-agent/branch/master/graph/badge.svg?token=VDVk2mP9Xu)](https://codecov.io/bb/adastradev/data-ingestion-agent)

# What is the Data Ingestion Agent?

The Data Ingestion Agent (DIA) enables the fast and secure delivery of data into the Ad Astra cloud without the need for Virtual Private Network (VPN) connections.

# Table of Contents

1. [Pre-requisites](#pre-requisites)
2. [Quick Start](#quick-start)
3. [Running the Agent](#running-the-agent)
4. [Uninstall](#uninstall)
5. [Administration](#administration)
6. [Security](#security)
7. [Development](#development)

***
## Pre-requisites

* Ad Astra Cloud credentials
* Review the docker [CLI documentation](https://docs.docker.com/engine/reference/commandline/cli/); familiarize yourself with the common commands noted in the [docker section](#docker)
* [Docker version 18.02 or greater](https://docs.docker.com/engine/install/) (Community Edition or any Enterprise Edition)
  * [Docker download for Windows](https://docs.docker.com/docker-for-windows/install/)
  * [Docker download for Mac](https://docs.docker.com/docker-for-mac/install/)
  * [Docker download for Linux (Ubuntu)](https://docs.docker.com/engine/install/ubuntu/)
  * [Docker download for Linux (Debian)](https://docs.docker.com/engine/install/debian/)
  * [Docker download for Linux (CentOS)](https://docs.docker.com/engine/install/centos/)
  * [Docker for Redhat Enterprise Linux (RHEL)](https://www.redhat.com/en/topics/containers/what-is-docker)
    * Redhat Enterprise Linux has its own software distribution system. Please see their documentation for installing Docker or other compatible container systems.
***

## Quick Start

To get started, you can use the built-in interactive wizard to build a properly formatted run command for the DIA. You should be prepared to collect the following information before using this wizard:

* Your Astra Cloud user credentials
* Your Student Information System database credentials for an administrative user, if you choose to ingest data into the Astra cloud
  * For all possible Oracle connection string options, see the [Oracle section](#oracle)
* Familiarize yourself with the different modes that the agent can run in before using the wizard.
  * See the [Running the Agent](#running-the-agent) section and corresponding descriptions to get a high level overview of the available agent modes

Some settings provide helpful defaults which you may wish to use for your first run. Hitting `enter` will use the default value (in parentheses).

**NOTE:** Unless you are comfortable with specifying the advanced run settings, we recommend responding "no" to the prompt "would you like to configure advanced run settings?" in the wizard.

**WARNING:** If you're installing Docker in a nested VM scenario using Hyper-V, see [this guide](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization).

**Expand and execute one of the following to install the latest version of the agent and start the wizard:**

(Windows) Command Prompt

```bat
docker pull adastradev/data-ingestion-agent:latest && ^
docker run -it adastradev/data-ingestion-agent:latest wizard
```

(Windows) Powershell

```powershell
docker pull adastradev/data-ingestion-agent:latest; `
docker run -it adastradev/data-ingestion-agent:latest wizard
```

(Linux/Mac) bash

```bash
docker pull adastradev/data-ingestion-agent:latest && \
docker run -it adastradev/data-ingestion-agent:latest wizard
```

***

## Resource Requirements

#### Docker Host

Hardware:

* Server grade systems are recommended for hosting Docker and the DIA. Using consumer grade devices such as personal laptops and desktops as the main host for the DIA is strongly discouraged.

Memory:

* 8GB (Recommended)

#### Container

Memory:

* 4GB (Recommended)

#### Oracle

When specifying the `ORACLE_ENDPOINT` value (a connection string) to your Oracle instance you may use one of the following formats:

```sh
# Easy Connect Connection String
CONNECTION_STRING="hostname:port/service_name"

# TNS Style Connection String using SID
CONNECTION_STRING="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=port))(CONNECT_DATA=(SERVER=DEDICATED)(SID=sid)))"

# TNS Style Connection String using SERVICE_NAME
CONNECTION_STRING="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=port))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=service_name)))"
```
When connecting to an Oracle database the specified database user must be given read/execute access to the following:

- `DBMS_METADATA.GET_DDL` (function)
- `ALL_TABLES` (view)
- `ALL_CONS_COLUMNS` (view)
- `ALL_CONSTRAINTS` (view)
- All tables referenced by this agent (see [Query Preview Mode](#query-preview-mode) section below)

***

## Running the Agent

The agent is highly dependent on the integration type you specify as part of your commands. Integration types are a simple identifier for the system from which you intend to ingest data. To see a full list of possible integration types, use the wizard as noted in the [Quick Start](#quick-start) section at the top of this guide.

The agent supports different 'modes' in which it can run. Each mode performs a specific action (see below) and then exits after the action is complete.

### Ingest Mode

This mode will immediately ingest data into the Ad Astra cloud environment. Upon completion of an ingest of data, the container will cease to run.

 In demo mode, the agent can verify connectivity to the Astra Cloud and push a mock dataset into S3.

The docker agent also supports the following optional arguments:
```sh
# [dev, prod]
-e DEFAULT_STAGE=prod
-e AWS_REGION=us-east-1
-e CONCURRENT_CONNECTIONS=5
-e INGEST_RESTORATION_RESOURCES=<false or FALSE>
# [error, warn, info, verbose, debug, silly]
-e LOG_LEVEL=info
-e RUN_MATILLION=<true or false> # defaults to false
```

### Query Preview Mode

Prior to sending any data, you can run the following Docker command to examine each query for the specified integration type. No data is sent to the destination using this command. Upon completion of a preview command, the container will cease to run.

**To run the agent expand and execute one of the following commands.**

(Windows) Command Prompt

```bat
REM See Host System Requirements above for agent resource requirements
SET PROCESS_MAX_MEMORY_SIZE_MB=4096

docker pull adastradev/data-ingestion-agent:latest && ^
docker run -i ^
-m %PROCESS_MAX_MEMORY_SIZE_MB%'M' ^
-e PROCESS_MAX_MEMORY_SIZE_MB=%PROCESS_MAX_MEMORY_SIZE_MB% ^
-e ASTRA_CLOUD_USERNAME=<your_username> ^
-e ASTRA_CLOUD_PASSWORD=<your_password> ^
-e INTEGRATION_TYPE=<SIS Type> ^
--network=bridge ^
adastradev/data-ingestion-agent:latest ^
preview
```

(Windows) Powershell

```powershell
# See Host System Requirements above for agent resource requirements
$PROCESS_MAX_MEMORY_SIZE_MB = 4096

docker pull adastradev/data-ingestion-agent:latest; `
docker run -i `
-m $PROCESS_MAX_MEMORY_SIZE_MB'M' `
-e PROCESS_MAX_MEMORY_SIZE_MB=$PROCESS_MAX_MEMORY_SIZE_MB `
-e ASTRA_CLOUD_USERNAME=<your_username> `
-e ASTRA_CLOUD_PASSWORD=<your_password> `
-e INTEGRATION_TYPE=<SIS Type> `
--network=bridge `
adastradev/data-ingestion-agent:latest `
preview
```

(Linux/Mac) bash

```bash
# See Host System Requirements above for agent resource requirements
PROCESS_MAX_MEMORY_SIZE_MB = 4096

docker pull adastradev/data-ingestion-agent:latest && \
docker run -i \
-m $PROCESS_MAX_MEMORY_SIZE_MB'M' \
-e PROCESS_MAX_MEMORY_SIZE_MB=$PROCESS_MAX_MEMORY_SIZE_MB \
-e ASTRA_CLOUD_USERNAME=<your_username> \
-e ASTRA_CLOUD_PASSWORD=<your_password> \
-e INTEGRATION_TYPE=<SIS Type> \
--network=bridge \
adastradev/data-ingestion-agent:latest \
preview
```

The following links display the default set of queries that run for each of the respective SIS integrations:

[Banner Queries](https://2089dnykgd.execute-api.us-east-1.amazonaws.com/1-0-0/queries?integrationstage=Ingestion&formatted=true&integrationtype=Banner)

[PeopleSoft Queries](https://2089dnykgd.execute-api.us-east-1.amazonaws.com/1-0-0/queries?integrationstage=Ingestion&formatted=true&integrationtype=PeopleSoft)

[DegreeWorks Queries](https://2089dnykgd.execute-api.us-east-1.amazonaws.com/1-0-0/queries?integrationstage=Ingestion&formatted=true&integrationtype=DegreeWorks)

[Colleague SQL Queries](https://2089dnykgd.execute-api.us-east-1.amazonaws.com/1-0-0/queries?integrationstage=Ingestion&formatted=true&integrationtype=Colleague)

***

## Uninstall

The DIA is a long running process that may be performing work when an uninstall occurs. To reduce negative side effects of immediately stopping the agent, it is advised to always stop the container with a grace period as shown below. Outright usage of `docker kill` is discouraged.

If multiple versions of the ingestion agent exist, be sure to specify the optional tag when removing an image.

```sh
docker stop --time 10 <container_name_or_id>
docker rm <container_name_or_id>
docker rmi <image>:<tag>
```
***

## Administration

### Common Command Reference

#### Docker

* [docker run](https://docs.docker.com/engine/reference/commandline/run/) - Start a docker container
* [docker ps](https://docs.docker.com/engine/reference/commandline/ps/) - Observe the status of containers
* [docker stats](https://docs.docker.com/engine/reference/commandline/stats/) - Monitor resource usage of a running container
* [docker stop](https://docs.docker.com/engine/reference/commandline/stop/) - Stop a container
* [docker rm](https://docs.docker.com/engine/reference/commandline/rm/) - Remove a container
* [docker rmi](https://docs.docker.com/engine/reference/commandline/rmi/) - Remove an image

To review all the possible Docker CLI commands [see their CLI guide](https://docs.docker.com/engine/reference/commandline/cli/)

### Automation

Windows

Open notepad or notepad++

Copy and paste:

```
docker pull adastradev/data-ingestion-agent:latest

docker run ....<your data ingestion run cmd>
```

Save As > NameYourFile.bat

Open Windows Task Scheduler > 'Create Task' > Name your Task
-General > Check 'Run with highest privileges' > Select additional desired criteria
-Triggers > 'New' > Select desired ingest schedule > 'Ok'
-Actions > 'New' > Action is 'Start A Program' > Browse to the .bat file you just created > select that file > 'Ok'

To test, right click the task in Task Scheduler and hit run. A Command Prompt should appear, your docker pull command will run first followed by your ingest command.

Linux/Mac

Create a shell script to contain your DIA run command. For example, the following commands will create a script in your home directory.

```sh
$ echo "docker pull adastradev/data-ingestion-agent:latest && docker run ....<your data ingestion run cmd>" > run_ingestion_agent.sh
$ chmod +x run_ingestion_agent.sh
```

Open up the cron job configuration file.

```sh
crontab -e
```

Call your script as a job to be executed on a schedule. In this case, once a day and append to a log file each time.

```sh
0 0 * * * sh /home/run_ingestion_agent.sh >> /home/agent.log
```

In addition to scheduling the DIA, it is helpful to automate checking if Docker is running. Here are some links to Docker's documentation to help address those areas:

[Configure Docker to start on reboot](https://docs.docker.com/install/linux/linux-postinstall/#configure-docker-to-start-on-boot)

[Check whether Docker is running](https://docs.docker.com/config/daemon/#check-whether-docker-is-running)

### Configure Network Access
The DIA requires *outbound* internet access over HTTPS to Amazon Web Services (*.amazonaws.com). In general, the agent should be provided outbound internet access via providing a bridge network as shown above. If runnning through an internet proxy, it is recommended to configure the proxy at `docker run` time by using an environment variable `--env HTTPS_PROXY="https://<IP_ADDRESS>:3001"`. For more information, see the [Configure Docker to use a proxy server](https://docs.docker.com/network/proxy/).

No *inbound* access to the agent is required.

See [Getting started with HTTPS proxies](https://github.com/adastradev/data-ingestion-agent/blob/master/docs/HttpsProxy.md) for more information.

### Authentication
The DIA utilizes JWT/AWS IAM token authentication for all request authentication. The DIA does not currently use AWS Key Management. The JWT/IAM tokens are only valid for short periods (possibly an hour), at which point the DIA must re-authenticate.

### Root Access to a running agent container
After starting the agent and confirming a healthy status, you can use the containers name or ID to access the virtual machine via command line (bash) as follows:

```sh
docker exec -it <container_id_or_name> /bin/bash
```

### Container Health Monitoring
The DIA periodically informs Docker of its current health. Using `docker inspect` you can get a general idea of the applications state.

```sh
docker inspect --format='{{json .State.Health.Status}}' <container_name_or_id>
```

To monitor container resource usage run the following:
```sh
docker stats <container_name_or_id>
```

### View agent logs
```sh
# View console output from container host
docker logs <container_name_or_id>
# Copy/export logs from the container to the host
# Create a destination path to store log files. After running the command the copied log file stored in your destination path should be renamed so files are not overwritten.
docker cp <container_name_or_id>:/var/log/dia/. <destination_path>
```
See the [Docker cp command guide for help copying logs to a local file system](https://docs.docker.com/engine/reference/commandline/cp/)

***

## Security

* Encryption:
  * Data is encrypted in-transit over HTTPS
  * Data at rest is encrypted in a private AWS S3 bucket using AES-256 bit encryption

***

## Development
See the [Development guide for the Data Ingestion Agent](https://github.com/adastradev/data-ingestion-agent/blob/master/docs/DevelopmentGuide.md)

repository: adastradev/data-ingestion-agent

gha_language: TypeScript

repo_name: adastradev/data-ingestion-agent


text:
# sic-db
A small javascript (hash) database of sic codes and helper functions

### Usage

Use npm to install in your project:
```sh
npm install sic-db
```
or, clone and include in your project using require (CommonJS, NodeJS):
```javascript
var sicdb = require('sic-db');
```

or, simply include as a script tag:
```html
<script src="sicdb.js" />
```

It exposes a few hash objects such as:

- sicdb.divs which provides full division names as values corresponding to the division code ("A" - "K")

- sicdb.divs_cats which provides relation from division codes to major (2 digit) category code using division code as key ("A" - "K") and associated values stored as an array

- sicdb.list which provides the complete hash of sic major category (2 digit), sub-category (3 digit) and SIC (4 digit) codes stored as keys with category names stored as corresponding values.

- sicdb.cats_divs which provides a reverse index of sicdb.divs_cats such that major category (2 digit) codes are the keys and their associated values represent sicdb.divs entries (keys).

TODO: provide some commonly used helper functions, also unit-testing and coverage

Contributions are welcome

license: Unlicense

repository: ReinsBrain/sic-db

repo_name: ReinsBrain/sic-db


text:
---
id: probabilistic-rev-sharing
title: Probabilistic Revenue Sharing
sidebar_label: Probabilistic revenue sharing
---

More often than not, high quality content involves more than one person. So, how do you share a portion of your revenue if only one payment pointer is supported in the `monetization` meta tag?

One way is through probabilistic revenue sharing (revshare). In Web Monetization, probabilistic revenue sharing works by randomly choosing from a list of predefined payment pointers each time a web monetized visitor loads your page. The visitor pays to the chosen pointer until the page is reloaded or closed.

The chance of a payment pointer being chosen is based on its assigned weight. For example, if Alice's payment pointer has a weight of 50, the pointer has a 50% chance of being chosen. The laws of probability state that Alice’s share will approach 50% of the page’s total revenue as more users visit the site.

:::info
Want to try probabilistic revenue sharing right away? Check out our [Probabilistic Revshare Generator](/prob-revshare)
:::

## A basic example

This example shows how to define a list of payment pointers and assign each pointer a weight. The easiest way to establish weight is by assigning values that add to 100.

### Code

```html
<head>
  <script>
    // Define your revenue share here.
    // If these weights add to 100 then they represent the percent each pointer gets.
    const pointers = {
      '$alice.example': 50,
      '$bob.example': 40,
      '$connie.example': 9.5,
      '$dave.example': 0.5
    }

    function pickPointer () {
      const sum = Object.values(pointers).reduce((sum, weight) => sum + weight, 0)
      let choice = Math.random() * sum

      for (const pointer in pointers) {
        const weight = pointers[pointer]
        if ((choice -= weight) <= 0) {
          return pointer
        }
      }
    }

    window.addEventListener('load', () => {
      const monetizationTag = document.createElement('meta')
      monetizationTag.name = 'monetization'
      monetizationTag.content = pickPointer()

      document.head.appendChild(monetizationTag)
    })
  </script>
</head>
```

### How does it work?

First, we define the payment pointers and assign each one a weight. If the weights total 100, then they represent the percentage each pointer gets.

```js
const pointers = {
  '$alice.example': 50,
  '$bob.example': 40,
  '$connie.example': 9.5,
  '$dave.example': 0.5
  }
```

Next, we define how a payment pointer is chosen.

```js
function pickPointer () {
  const sum = Object.values(pointers).reduce((sum, weight) => sum + weight, 0)
  let choice = Math.random() * sum

  for (const pointer in pointers) {
    const weight = pointers[pointer]
    if ((choice -= weight) <= 0) {
      return pointer
    }
  }
}
```

Finally, we add the code that dynamically inserts the randomly chosen payment pointer into the page on each load/refresh.

```js
window.addEventListener('load', () => {
  const monetizationTag = document.createElement('meta')
  monetizationTag.name = 'monetization'
  monetizationTag.content = pickPointer()

  document.head.appendChild(monetizationTag)
})
```

### Interactive example

This example shows how the random choices will approach the correct percentages over enough tries. You can customize the number of times to randomly choose a pointer and it will show you the results. The example doesn't require you to have Web Monetization enabled in your browser. No real payments are occurring.

If you see the source files instead of the example, click **View App** in the bottom right.

<div class="glitch-embed-wrap" style={{ height: '420px', width: '100%' }}>
  <iframe
    src="https://glitch.com/embed/#!/embed/probabalistic-revenue-share-experiment?path=README.md&previewSize=100"
    title="probabalistic-revenue-share-experiment on Glitch"
    allow="geolocation; microphone; camera; midi; vr; encrypted-media"
    style={{ height: '100%', width: '100%', border: '0' }}>
  </iframe>
</div>

## Advanced topic and future ideas

Imagine you're embedding an image into an article. To use the image, the photographer has asked for a percentage of your earnings, so you add the photographer to your revshare.

But what if the photographer is also sharing their revenue? You'd have to include everyone in the photographer's revshare in your revshare, but with a scaled-down percentage. Plus, you'd have to update your revshare every time the photographer's changes. That's a huge pain!

To make the process smoother, we can put probabilistic revshare into your payment pointer itself, instead of your page's JavaScript. The idea is similar to the vanity payment pointers discussed in [an article by ctrl.blog](https://www.ctrl.blog/entry/ilp-payment-pointer-redirects.html). A vanity payment pointer is a redirect to your actual payment pointer. If we want to put in probabilistic revshare, we need to make that redirect random instead of redirecting to the same pointer each time.

You can pick several payment pointers and a chance for each of them to be chosen, just like in the example in the previous section. The chance that you redirect to each pointer is equal to that pointer’s expected share of the revenue.

Here’s an example of how you can implement this in an Express.js server. It uses the same code as our previous snippet to implement the `pickPointer` function. We plan on offering a hosted tool that lets you manage revenue sharing payment pointers without writing code in the near future!

### Code

```js
// Define your revenue share here.
// If these weights add to 100 then they represent the percent each pointer gets.
const pointers = {
  '$alice.example': 50,
  '$bob.example': 40,
  '$connie.example': 9.5,
  '$dave.example': 0.5
}

// this is the same `pickPointer()` function implemented in the previous snippet
function pickPointer () {
  const sum = Object.values(pointers).reduce((sum, weight) => sum + weight, 0)
  let choice = Math.random() * sum

  for (const pointer in pointers) {
    const weight = pointers[pointer]
    if ((choice -= weight) <= 0) {
      return pointer
    }
  }
}

app.use((req, res, next) => {
  // is this request meant for Web Monetization?
  if (req.header('accept').includes('application/spsp4+json')) {
    // choose our random payment pointer
    const pointer = pickPointer()

    // turn the payment pointer into a URL in accordance with the payment pointer spec
    // https://paymentpointers.org/
    const asUrl = new URL(pointer.startsWith('$') ? 'https://' + pointer.substring(1) : pointer)
    asUrl.pathname = asUrl.pathname === '/' ? '/.well-known/pay' : asUrl.pathname

    // redirect to our chosen payment pointer so they get paid
    res.redirect(302, asUrl.href)
  } else {
    // if the request is not for Web Monetization, do nothing
    next()
  }
})
```

With this scheme, your payment pointer contains all the revshare logic and you don't need to repeat the information on every page. The scheme also works recursively. One of the pointers that a vanity pointer randomly chooses could go on to make a random choice of its own. Your blog could choose the photographer's payment pointer 1% of the time, then 10% of the time the photographer's pointer chooses the photo editor's pointer.

This lets you make some revsharing schemes that would be wildly impractical with existing schemes. By taking the pain out of revenue sharing, we can help everyone get compensated fairly!

If you want to get started with probabilistic revenue sharing today, try out our [Probabilistic Revshare Generator](/prob-revshare)!

repository: jasikpark/webmonetization

repo_name: jasikpark/webmonetization


text:
Differential Line
=============

![ani](/img/ani.gif?raw=true "animation")

This algorithm is inspired by the way a number of biological things in nature
grows. Among other things it is made to mimic the growth of the human brain, as
well as a great number of plants.

![img](/img/img.jpg?raw=true "image")

In brief; we start of with a number of connected nodes in a circle. Gradually
we introduce new nodes on the line—prioritizing segments where the curve bends
more sharply.  Over time the curve grows increasingly intricate, but it never
self-intersects.

![img](/img/img1.jpg?raw=true "image")

![img](/img/img2.jpg?raw=true "image")

If we start with a different shape, and draw the outside position of the object
for each growth step, we can get an entirely different kind of system with an
interesting 3D illusion.

![img](/img/img3.jpg?raw=true "image")

## Prerequisites

In order for this code to run you must first download and install these two
repositories:

*    `render`: http://github.com/inconvergent/render
*    `zonemap`: https://github.com/inconvergent/zonemap

## Other Dependencies

The code also depends on:

*    `numpy`
*    `cython`
*    `python-cairo` (do not install with pip, this generally does not work)

## Running it

To install the libraries locally, run `make`. I have only tested this code in
Ubuntu 14.04 LTS, but my guess is that it should work on most platforms.
However the scripted install in `make` will not work in Windows (and I haven't
tested it on Mac.)

## Running on OS X

To install on OS X, you'll need to install [OpenMP / Clang](https://clang-omp.github.io/), and then have cc linked
as to that installation. So, in the differential-line directory:

```bash
$ brew install clang-omp
$ ln -s /usr/local/bin/clang-omp /usr/local/bin/cc
$ make
$ rm /usr/local/bin/cc
```

Also, you'll need to have pygtk installed to run the included files.

```bash
$ brew install pygtk
```

Done! You should now have a copy installed.

-----------
http://inconvergent.net

repository: burningion/differential-line

repo_name: burningion/differential-line


text:
To install jx 2.0.377 see the [install guide](https://jenkins-x.io/getting-started/install/)

### Linux

```shell
curl -L https://github.com/jenkins-x/jx/releases/download/v2.0.377/jx-linux-amd64.tar.gz | tar xzv
sudo mv jx /usr/local/bin
```

### macOS

```shell
brew tap jenkins-x/jx
brew install jx
```
## Changes

### Chores

* fix the path to the jx binary (testing)

repository: yadavalimahendra/python-flask-docker

repo_name: yadavalimahendra/python-flask-docker


text:
---
title: "My Wi-Fi access point revisited"
tagline: "RIP Linksys and Ubiquiti"
category: linux
tags: [linux, networking, wifi, ath9k, core]
---

No more consumer routers!
-------------------------

A while ago I dumped my consumer NAT router in favor of using my desktop router.  I do most of my work at my apartment on my desktop, so why not make it my router and file server?  Great question, great choice.  No longer am I restricted by buggy firmware, half implemented DHCP or DNS servers, NAT limitations, etc.  I demoted by Linksys WRT54G running DD-WRT to just AP roles which lasted for a few more years before the hardware finally died.  RIP WRT54G, you outlived your useful life while delivering above and beyond my expectations.

My Linux desktop / server with an additional Intel PCIe NIC and Linux NAT capabilities make a pretty awesome combination.  Add dnsmasq for simple DHCP, DNS and sometimes TFTP capabilities.  No more consumer routers, the last thing I need is more stuff to configure.

Enter the Ubiquiti PicoStation2
-------------------------------

I read alot of good things about Ubiquiti a while ago when I was planning to build a quad copter and do cool things with Linux + Pandaboard.  The Picostation2 was supposed to be the high powered radio to control the who thing.  Life happened.  The quad never got built, but I didn't give up until after I bought a few pieces such as the Picostation2.  After my Linksys WRT54G died, the Picostation2 was put into action.  I was impressed by the polish of the AirOS web interface.  The Linux SDK seemed cool (until I learned how /old/ the kernel actually was).  But, all my devices (Mac Book Retina Pro, Nexus 4, Lenovo Thinkpad, etc) all had issues with the AP just not working that well.  The connection would just die.  I attempted to reconfigure it and fix it thinking it was my fault, but my attempts were in vain.

A work project demanded Wi-Fi access for some testing at home and the PicoStation2 was making this more difficult.  The PictionStation2 was then retired back to the drawer.

Linksys EA6400
--------------

I bought a Linksys EA6400 on sale thinking I could just replace my AP and be done.  Nope, never that simple.  Linksys created this "Smart Wi-Fi" feature that makes it a major pain to configure.  Just Google "Linksys Smart Wi-Fi" and see what people have to say about the "502 Bad Gateway" error the router constantly threw me whenever I tried to use it as a bridging access point.

Apparently Smart Wi-Fi phones home to Linksys's cloud to allow you to configure it from the web.  What if the Internet connection isn't configured?  Oh, use the included CD for Windows.  I don't even have an optical drive reader or easy access to Windows.  I did some tricks and got it to "kind of work" but not really.

I shipped it back several days later.  I'm done with Linksys and will likely never buy a Linksys product if this is the route they are going.  That's too bad, I loved my old WRT54G and was hoping the EA6400 would be similar.  I was wrong.

Linux + HostAPd + TL-WDN4800
----------------------------

Linux wireless is a lot more stable then it was several years ago, and host/software access points now work quite well.  This coupled with the idea that my desktop / server already runs my NAT, DNS, DHCP and this is a no brainer.  I looked in to buying a PCIe Wi-Fi card.

I settled on the TP-Link TL-WDN4800 card.  It features an Atheros AR9380 that can do 3 spatial streams, Short-GI, 2.4 GHz, 5 GHz, and HT40 (40 MHz channels).  When configured as a 5 GHz AP my rMBP connects to with a linksys of 450 Mbps.  I can't ask for any more.  Speed tests show over 100 Mb/s actual data rate.  Beyond that I didn't test much.  If I need speed faster then that I'll use gigabit Ethernet.  My Nexus 4 has only 1 spatial stream, and negotiates a bitrate of 72 Mbps, which is the fastest the device can do.  Did I mention the card was only $45 and the Ubuntu 12.10 + development Linux 3.9 kernel just works after a little hostapd config?  I paid 3x this for the EA6400 that barely worked (even though it was dual simultaneous band and had 802.11ac).

Back to Reality
---------------

While the 450 Mbps bitrate of 5 GHz + HT40 + Short-GI was nice, it didn't work with all my devices.  As a result I had to fall back to 2.4 GHz channels and HT20.  My rMBP now gets link speed of 217 Mb/s which is still pretty good.  Most of the time it will do in excess of 50 Mb/s of real world data throughput.  Plenty fast for web surfing.  My Nexus 4 is still happy at 72 Mb/s.

I also chose to create a separate subnet for my Wi-Fi clients.  This reduced broadcast traffic from my wired devices and helps keep the Wi-Fi channel a little quieter and improves performance slightly.  I also believe that people are ignorant and simply bridge devices because they don't understand routing and firewall rules.... but that's just me. :)

Configuration
-------------

For people interested in my configuration files see below.  Don't forget to enable the hostapd service update-rc.d hostapd enable.

#### hostapd.conf ####

	interface=wlan0
	driver=nl80211
	ssid=<your ssid>
	macaddr_acl=0
	auth_algs=1
	ignore_broadcast_ssid=0
	wpa=2
	wpa_passphrase=<your passphrass>
	wpa_key_mgmt=WPA-PSK
	wpa_pairwise=TKIP
	rsn_pairwise=CCMP

	#country_code=US
	#ieee80211d=1

	ieee80211n=1
	wmm_enabled=1
	ht_capab=[HT40-][HT40+][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][LDPC]

    # 5 GHz
	#hw_mode=a
	#channel=149
	#channel=157

    # 2.4 GHz
	hw_mode=g
	# 70.7 Mbit/s
	#channel=1

	# 62.6 Mbit/s + jitter
	#channel=2

	# 57.4 Mbits/s
	channel=7

#### /etc/network/interfaces ####

	...

	auto wlan0
	iface wlan0 inet static
			address <IP_ADDRESS>
			netmask <IP_ADDRESS>

#### iw phy0 info ####

	$ iw phy0 info
	Wiphy phy0
		Band 1:
			Capabilities: 0x11ef
				RX LDPC
				HT20/HT40
				SM Power Save disabled
				RX HT20 SGI
				RX HT40 SGI
				TX STBC
				RX STBC 1-stream
				Max AMSDU length: 3839 bytes
				DSSS/CCK HT40
			Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
			Minimum RX AMPDU time spacing: 8 usec (0x06)
			HT TX/RX MCS rate indexes supported: 0-23
			Frequencies:
				* 2412 MHz [1] (20.0 dBm)
				* 2417 MHz [2] (20.0 dBm)
				* 2422 MHz [3] (20.0 dBm)
				* 2427 MHz [4] (20.0 dBm)
				* 2432 MHz [5] (20.0 dBm)
				* 2437 MHz [6] (20.0 dBm)
				* 2442 MHz [7] (20.0 dBm)
				* 2447 MHz [8] (20.0 dBm)
				* 2452 MHz [9] (20.0 dBm)
				* 2457 MHz [10] (20.0 dBm)
				* 2462 MHz [11] (20.0 dBm)
				* 2467 MHz [12] (20.0 dBm)
				* 2472 MHz [13] (20.0 dBm)
				* 2484 MHz [14] (disabled)
			Bitrates (non-HT):
				* 1.0 Mbps
				* 2.0 Mbps (short preamble supported)
				* 5.5 Mbps (short preamble supported)
				* 11.0 Mbps (short preamble supported)
				* 6.0 Mbps
				* 9.0 Mbps
				* 12.0 Mbps
				* 18.0 Mbps
				* 24.0 Mbps
				* 36.0 Mbps
				* 48.0 Mbps
				* 54.0 Mbps
		Band 2:
			Capabilities: 0x11ef
				RX LDPC
				HT20/HT40
				SM Power Save disabled
				RX HT20 SGI
				RX HT40 SGI
				TX STBC
				RX STBC 1-stream
				Max AMSDU length: 3839 bytes
				DSSS/CCK HT40
			Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
			Minimum RX AMPDU time spacing: 8 usec (0x06)
			HT TX/RX MCS rate indexes supported: 0-23
			Frequencies:
				* 5180 MHz [36] (23.0 dBm)
				* 5200 MHz [40] (23.0 dBm)
				* 5220 MHz [44] (23.0 dBm)
				* 5240 MHz [48] (23.0 dBm)
				* 5260 MHz [52] (23.0 dBm) (passive scanning, no IBSS, radar detection)
				* 5280 MHz [56] (23.0 dBm) (passive scanning, no IBSS, radar detection)
				* 5300 MHz [60] (23.0 dBm) (passive scanning, no IBSS, radar detection)
				* 5320 MHz [64] (23.0 dBm) (passive scanning, no IBSS, radar detection)
				* 5500 MHz [100] (disabled)
				* 5520 MHz [104] (disabled)
				* 5540 MHz [108] (disabled)
				* 5560 MHz [112] (disabled)
				* 5580 MHz [116] (disabled)
				* 5600 MHz [120] (disabled)
				* 5620 MHz [124] (disabled)
				* 5640 MHz [128] (disabled)
				* 5660 MHz [132] (disabled)
				* 5680 MHz [136] (disabled)
				* 5700 MHz [140] (disabled)
				* 5745 MHz [149] (30.0 dBm)
				* 5765 MHz [153] (30.0 dBm)
				* 5785 MHz [157] (30.0 dBm)
				* 5805 MHz [161] (30.0 dBm)
				* 5825 MHz [165] (30.0 dBm)
			Bitrates (non-HT):
				* 6.0 Mbps
				* 9.0 Mbps
				* 12.0 Mbps
				* 18.0 Mbps
				* 24.0 Mbps
				* 36.0 Mbps
				* 48.0 Mbps
				* 54.0 Mbps
		max # scan SSIDs: 4
		max scan IEs length: 2257 bytes
		Coverage class: 0 (up to 0m)
		Supported Ciphers:
			* WEP40 (00-0f-ac:1)
			* WEP104 (00-0f-ac:5)
			* TKIP (00-0f-ac:2)
			* CCMP (00-0f-ac:4)
			* CMAC (00-0f-ac:6)
		Available Antennas: TX 0x7 RX 0x7
		Configured Antennas: TX 0x7 RX 0x7
		Supported interface modes:
			 * IBSS
			 * managed
			 * AP
			 * AP/VLAN
			 * WDS
			 * monitor
			 * mesh point
			 * P2P-client
			 * P2P-GO
		software interface modes (can always be added):
			 * AP/VLAN
			 * monitor
		valid interface combinations:
			 * #{ managed, WDS, P2P-client } <= 2048, #{ AP, mesh point, P2P-GO } <= 8,
			   total <= 2048, #channels <= 1, STA/AP BI must match
		Supported commands:
			 * new_interface
			 * set_interface
			 * new_key
			 * new_beacon
			 * new_station
			 * new_mpath
			 * set_mesh_params
			 * set_bss
			 * authenticate
			 * associate
			 * deauthenticate
			 * disassociate
			 * join_ibss
			 * join_mesh
			 * remain_on_channel
			 * set_tx_bitrate_mask
			 * action
			 * frame_wait_cancel
			 * set_wiphy_netns
			 * set_channel
			 * set_wds_peer
			 * Unknown command (82)
			 * Unknown command (81)
			 * Unknown command (84)
			 * Unknown command (87)
			 * Unknown command (85)
			 * Unknown command (89)
			 * Unknown command (92)
			 * testmode
			 * connect
			 * disconnect
		Supported TX frame types:
			 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
			 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
			 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
			 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
			 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
			 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
			 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
			 * Unknown mode (10): 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		Supported RX frame types:
			 * IBSS: 0x40 0xb0 0xc0 0xd0
			 * managed: 0x40 0xd0
			 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
			 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
			 * mesh point: 0xb0 0xc0 0xd0
			 * P2P-client: 0x40 0xd0
			 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
			 * Unknown mode (10): 0x40 0xd0
		Device supports RSN-IBSS.
		WoWLAN support:
			 * wake up on disconnect
			 * wake up on magic packet
			 * wake up on pattern match, up to 6 patterns of 1-256 bytes
		HT Capability overrides:
			 * MCS: ff ff ff ff ff ff ff ff ff ff
			 * maximum A-MSDU length
			 * supported channel width
			 * short GI for 40 MHz
			 * max A-MPDU length exponent
			 * min MPDU start spacing
		Device supports TX status socket option.
		Device supports HT-IBSS.

#### Kernel Info ####

	$ uname -a
	Linux core 3.9.0-999-generic #201303290406 SMP Fri Mar 29 08:07:25 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

	$ modinfo ath9k
	filename:       /lib/modules/3.9.0-999-generic/kernel/drivers/net/wireless/ath/ath9k/ath9k.ko
	license:        Dual BSD/GPL
	description:    Support for Atheros 802.11n wireless LAN cards.
	author:         Atheros Communications
	srcversion:     FCAC5F4D12AA0733811B1B7
	alias:          platform:qca955x_wmac
	alias:          platform:ar934x_wmac
	alias:          platform:ar933x_wmac
	alias:          platform:ath9k
	alias:          pci:v0000168Cd00000036sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000037sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000034sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000033sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000032sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000030sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd0000002Esv*sd*bc*sc*i*
	alias:          pci:v0000168Cd0000002Dsv*sd*bc*sc*i*
	alias:          pci:v0000168Cd0000002Csv*sd*bc*sc*i*
	alias:          pci:v0000168Cd0000002Bsv*sd*bc*sc*i*
	alias:          pci:v0000168Cd0000002Asv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000029sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000027sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000024sv*sd*bc*sc*i*
	alias:          pci:v0000168Cd00000023sv*sd*bc*sc*i*
	depends:        ath9k_hw,ath9k_common,mac80211,ath,cfg80211
	intree:         Y
	vermagic:       3.9.0-999-generic SMP mod_unload modversions
	parm:           debug:Debugging mask (uint)
	parm:           nohwcrypt:Disable hardware encryption (int)
	parm:           blink:Enable LED blink on activity (int)
	parm:           btcoex_enable:Enable wifi-BT coexistence (int)
	parm:           enable_diversity:Enable Antenna diversity for AR9565 (int)

#### Other commands that may be useful for testing setups ####

*  Dump info about channels: iw dev wlan0 survey dump
*  Dump info about connected stations: iw dev wlan0 station dump

gha_language: SCSS


text:
# Single_Tello_Test
## Step1
Write the command set to be run in command.txt, for example:：
```
command
takeoff
land
```
## Step2
The script will automatically send a command to Tello. After receiving the reply from the previous command, the next command will be sent immediately.
To add a delay, you can use the Delay command and the script will automatically delay. The unit of delay is seconds, which can be given to decimals.
```
delay 5
```
## Step3
Run the script
```
python tello_test.py command.txt
```
The command window will type each instruction and its reply. After the execution is finished, the commands will be stored in the log folder to name the test end time.


text:
# Dovab's PHPCS Ruleset

To install the complete ruleset, please run `bash vendor/dovab/coding-standard-ruleset/install-rulesets.sh` to register
the rulesets. Afterwards run `vendor/bin/phpcs -i` and check if `Dovab` is listed as a set.

repository: dovab/coding-standard-ruleset

repo_name: dovab/coding-standard-ruleset


text:
# ADR 013: Observability

## Changelog

* 20-01-2020: Initial Draft

## Status

Proposed

## Context

Telemetry is paramount into debugging and understanding what the application is doing and how it is
performing. We aim to expose metrics from modules and other core parts of the Cosmos SDK.

In addition, we should aim to support multiple configurable sinks that an operator may choose from.
By default, when telemetry is enabled, the application should track and expose metrics that are
stored in-memory. The operator may choose to enable additional sinks, where we support only
[Prometheus](https://prometheus.io/) for now, as it's battle-tested, simple to setup, open source,
and is rich with ecosystem tooling.

We must also aim to integrate metrics into the Cosmos SDK in the most seamless way possible such that
metrics may be added or removed at will and without much friction. To do this, we will use the
[go-metrics](https://github.com/hashicorp/go-metrics) library.

Finally, operators may enable telemetry along with specific configuration options. If enabled, metrics
will be exposed via `/metrics?format={text|prometheus}` via the API server.

## Decision

We will add an additional configuration block to `app.toml` that defines telemetry settings:

```toml
###############################################################################
###                         Telemetry Configuration                         ###
###############################################################################

[telemetry]

# Prefixed with keys to separate services
service-name = {{ .Telemetry.ServiceName }}

# Enabled enables the application telemetry functionality. When enabled,
# an in-memory sink is also enabled by default. Operators may also enabled
# other sinks such as Prometheus.
enabled = {{ .Telemetry.Enabled }}

# Enable prefixing gauge values with hostname
enable-hostname = {{ .Telemetry.EnableHostname }}

# Enable adding hostname to labels
enable-hostname-label = {{ .Telemetry.EnableHostnameLabel }}

# Enable adding service to labels
enable-service-label = {{ .Telemetry.EnableServiceLabel }}

# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink.
prometheus-retention-time = {{ .Telemetry.PrometheusRetentionTime }}
```

The given configuration allows for two sinks -- in-memory and Prometheus. We create a `Metrics`
type that performs all the bootstrapping for the operator, so capturing metrics becomes seamless.

```go
// Metrics defines a wrapper around application telemetry functionality. It allows
// metrics to be gathered at any point in time. When creating a Metrics object,
// internally, a global metrics is registered with a set of sinks as configured
// by the operator. In addition to the sinks, when a process gets a SIGUSR1, a
// dump of formatted recent metrics will be sent to STDERR.
type Metrics struct {
  memSink           *metrics.InmemSink
  prometheusEnabled bool
}

// Gather collects all registered metrics and returns a GatherResponse where the
// metrics are encoded depending on the type. Metrics are either encoded via
// Prometheus or JSON if in-memory.
func (m *Metrics) Gather(format string) (GatherResponse, error) {
  switch format {
  case FormatPrometheus:
    return m.gatherPrometheus()

  case FormatText:
    return m.gatherGeneric()

  case FormatDefault:
    return m.gatherGeneric()

  default:
    return GatherResponse{}, fmt.Errorf("unsupported metrics format: %s", format)
  }
}
```

In addition, `Metrics` allows us to gather the current set of metrics at any given point in time. An
operator may also choose to send a signal, SIGUSR1, to dump and print formatted metrics to STDERR.

During an application's bootstrapping and construction phase, if `Telemetry.Enabled` is `true`, the
API server will create an instance of a reference to `Metrics` object and will register a metrics
handler accordingly.

```go
func (s *Server) Start(cfg config.Config) error {
  // ...

  if cfg.Telemetry.Enabled {
    m, err := telemetry.New(cfg.Telemetry)
    if err != nil {
      return err
    }

    s.metrics = m
    s.registerMetrics()
  }

  // ...
}

func (s *Server) registerMetrics() {
  metricsHandler := func(w http.ResponseWriter, r *http.Request) {
    format := strings.TrimSpace(r.FormValue("format"))

    gr, err := s.metrics.Gather(format)
    if err != nil {
      rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("failed to gather metrics: %s", err))
      return
    }

    w.Header().Set("Content-Type", gr.ContentType)
    _, _ = w.Write(gr.Metrics)
  }

  s.Router.HandleFunc("/metrics", metricsHandler).Methods("GET")
}
```

Application developers may track counters, gauges, summaries, and key/value metrics. There is no
additional lifting required by modules to leverage profiling metrics. To do so, it's as simple as:

```go
func (k BaseKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error {
  defer metrics.MeasureSince(time.Now(), "MintCoins")
  // ...
}
```

## Consequences

### Positive

* Exposure into the performance and behavior of an application

### Negative

### Neutral

## References

repository: cosmos/cosmos-sdk

gha_language: Go

repo_name: cosmos/cosmos-sdk


text:
---
hrs_structure:
  division: '1'
  volume: '1'
  title: '5'
  chapter: 39A
  section: 39A-341
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0039A-0341
    parent: HRS0039A
    name: 39A-341 Definitions
weight: 59010
title: Definitions
full_title: 39A-341 Definitions
---
**[PART XII.] ASSISTING DAM AND RESERVOIR OWNERS**

Note

This part was enacted by Act 147 (2012). Section 3 of Act 147 provides:

"SECTION 3\. This Act shall take effect on July 1, 2012, and upon ratification of constitutional amendments [sic] authorizing the State to issue special purpose revenue bonds and use the proceeds from the bonds to assist dam and reservoir owners."

Although House Bill No. 2594 (2012) proposed an amendment to article VII, §12 of the state constitution to authorize the State to issue special purpose revenue bonds and use the proceeds from the bonds to assist dam and reservoir owners, that constitutional amendment was not ratified in the 2012 election. However, in 2014, Senate Bill No. 2876 proposed an amendment to the same article and section of the state constitution to similarly authorize the State to issue special purpose revenue bonds and use the proceeds from the bonds to assist dam and reservoir owners. That constitutional amendment was ratified in the 2014 election.

**[§39A-341] Definitions.** Whenever used in this part, unless a different meaning clearly appears from the context:

"Appurtenant works" shall have the same meaning in this part as it has in section 179D-3.

"Dam" shall have the same meaning in this part as it has in section 179D-3.

"Department" means the department of budget and finance.

"Owner" means any person subject to chapter 179D who has a right, title, or interest in or to the dam or reservoir or to the property upon which the dam, reservoir, or appurtenant works are located or proposed to be located.

"Person" or "persons" means an individual, firm, enterprise, partnership, corporation, association, cooperative or other legal entity, governmental body or agency, board, bureau or other instrumentality thereof, or any combination of the foregoing.

"Project" means any work on a dam, reservoir, or appurtenant works necessary to maintain or improve the dam, reservoir, or appurtenant works.

"Project agreement" means any agreement entered into under this part by the department with a project party to finance, construct, operate, or maintain a project from the proceeds of special purpose revenue bonds, or to lend the proceeds of special purpose revenue bonds to assist dam and reservoir owners, including without limitation any loan agreement.

"Project party" means a person or persons who are dam and reservoir owners.

"Reservoir" shall have the same meaning in this part as it has in section 179D-3.

"Special purpose revenue bonds" or "bonds" means bonds, notes, or other evidences of indebtedness of the State issued pursuant to this part. [L 2012, c 147, pt of §1]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# Home assistant custom component for Azure IoT Hub

Based on Wictor Wilén (@wictorwilen) [script](https://gist.github.com/wictorwilen/cf2de4ff98105eff4dfb16dd04c879d4).
The original script was migrated for using the latest version (2.0) of Azure IoT Hub Device Client python SDK.
In order to use the plugin SDK must be installed into environment:

```bash
pip3 install azure-iot-device
```

**Example configuration.yaml:**

```yaml
# Example configuration.yaml entry
azure_iot_hub:
    host: <azure-iot-host>
    devices:
        <azure-iot-device-name>:
        auth_key: <auth-key>
        include:
          - <sensors>
        <another-azure-iot-device-name>:
        auth_key: <auth-key>
        include:
          - <sensors>
```
A full configuration example can be found below:

```yaml
# Example configuration.yaml entry
azure_iot_hub:
    host: myazureiothub
    devices:
      hass_device_1:
        auth_key: ABC1230ABC1230ABC1230ABC1230ABC1230ABC12300=
        include:
          - sun.sun
          - sensor.dht_sensor_temperature
          - sensor.yr_temperature
      hass_device_2:
        auth_key: ABC1230ABC1230ABC1230ABC1230ABC1230ABC12300=
        include:
          - group.phones
          - group.computers
```

**Configuration variables:**

Key | Type | Required | Description
-- | -- | -- | --
`azure-iot-host` | `string` | `True` |  Name of your Azure IoT Hub host (without .azure-devices.net)
`azure-iot-device-name` | `string` | `True` |  Name of your Azure IoT Hub device
`auth-key` | `string` | `True` |  The authentication key for the device
`sensors` | `array` | `False` |  The sensor values you want to send to the Azure IoT hub.<br/> _Note: not specifying any sensors will send all event changes to Azure IoT_

***


text:
# FlowGoogleCharts
Vaadin Flow - Integration of Google Charts Webcomponent

Could not believe how easy it is to use (well documented) WebComponents with Vaadin Flow.

In this small project I'm creating a class wrapping https://www.webcomponents.org/element/GoogleWebComponents/google-chart (GoogleChart.java) and using it XGoogleChartsView.java.

These chart types have been tested:
* Pie
* Pie3D
* Donut
* Line
* Area
* Stacked Area
* Column
* Bar
* Time Series
* Geo Chart

with data:
* from json file
* dynamically created

There are quite some things that need to be improved:
* solved: there is a npe at "com.vaadin.flow.internal.JsonCodec.decodeWithoutTypeInfo" which I could not yet localize
* solved: not yet figured out how json data have to be formatted when used from a file in a geo-chart
* not yet figured out how setting a date dynamically can be achieved

any input on these topics is appreciated

repository: bachlge/flow-google-chart

repo_name: bachlge/flow-google-chart


text:
# **Floating Types**
Floating-point numbers, often known as real numbers, are numbers with fractional parts (usually expressed with a decimal point). We use such numbers when we have to define calculations such as square root, sine, and cosine or a real number like pi.

Java has two types of floating-point numbers:-
* [float](#float)
* [double](#double)

>## **float**
The type float denotes a single-precision value that is stored in 4 bytes (32 bits). It can contain up to 7 decimal digits and ranges from 1.40239846 x 10-45 to 3.40282347 x 1038 (positive or negative). In terms of Java variables, we can use float when initializing or declaring any variable that may expect a fractional result but does not require a high degree of precision. We use float when representing rupees and paisa, temperature, height, etc.
```
For example float price, temp;
```
## **Float Class**
The Float class is a wrapper for the type float, and it contains several fields, constructors, and methods for working with float values. The float value can be stored in a Float class object.

### **Fields:**
1. **MAX_VALUE**: Assigns the largest positive finite float value.
2. **MIN_VALUE**: Assigns the smallest positive nonzero float value.
3. **MIN_NORMAL**: Assigns the smallest positive normal float value.
4. **MAX_EXPONENT**: Assigns the maximum exponent a finite float variable can have.
5. **MIN_EXPONENT**: Assigns the minimum exponent a normalized float variable can have.
6. **BYTES**: Gives the number of bytes that are used to represent a float variable.
7. **SIZE**: Gives the number of bits that are used to represent a float variable.
8. **TYPE**: Gives the Class instance representing the primitive type float.
9. **NaN**: Assigns a Not-a-Number (NaN) value of type float.
10. **POSITIVE_INFINITY**: A constant that represents the positive infinity of type float.
11. **NEGATIVE_INFINITY**: A constant that represents the negative infinity of type float.

### **Constructor:**
1. **Float(float value)**: Constructs a Float Object that takes a float argument.
2. **Float(double value)**: Constructs a Float Object that takes a double argument which gets converted to the type float.
3. **Float(String s)**: Constructs a Float Object that takes a String representing the float value.

### **Methods:**
  1. **byteValue()**: Returns the value of Float as a byte value.
  2. **shortValue()**: Returns the value of Float as a short value.
  3. **intValue()**: Returns the value of Float as an int value.
  4. **longValue()**: Returns the value of Float as a long value.
  5. **doubleValue()**: Returns the value of Float as a double value.
  6. **floatValue()**: Returns the value of Float as a float value.
  7. **hashCode()**: Returns the value of Float as a hash code.
  8. **isFinite()**: Returns true if the Float value is a finite floating-point value.
  9. **isInfinite()**: Returns true if the Float value is not a finite floating-point value.
  10. **isNan()**: Returns true if the Float value is a Not-a-Number (NaN).
  11. **toString()**: Returns the float value converted to a String.
  12. **parseFloat()**: Returns a new float with the value represented by the specified String as its initial value.
  13. **valueOf()**: Returns the float value representing the Float Object.
  14. **toHexString()**: Returns the hexadecimal representation corresponding to the float value.
  15. **floatToIntBits()**: Returns the IEEE 754 floating-point "single format" bit layout representation of the float value.
  16. **floatToRawIntBits()**: Returns the IEEE 754 floating-point "single format" bit layout representation of the float value while preserving Not-a-Number (NaN) values.
  17. **intBitsToFloat()**: Returns the float value of the given integer bit representation.
  18. **equals()**: Compares the Float Object against another Float Object.
  19. **compare()**: Compares the two specified float values.
  20. **compareTo()**: Compares two Float Objects.
  21. **min()**: Returns the minimum of the two float values entered.
  22. **max()**: Returns the maximum of the two float values entered.
  23. **sum()**: Adds two float values.

>## **double**
The type double denotes a double-precision value that is stored in 8 bytes (64 bits). It can contain up to 16 decimal digits and ranges from 4.9406564584124654 x 10-324 to 1.7976931348623157 x 10308 (positive or negative). On some modern processors, double-precision is faster than single-precision. We use double when representing an area, sine, cosine, etc.
```
For example double area, pi;
```
## **Double Class**
The Double class is a wrapper for the type double, and it contains several fields, constructors, and methods for working with double values. The double value can be stored in a Double class object.

### **Fields:**
1. **MAX_VALUE**: Assigns the largest positive finite double value.
2. **MIN_VALUE**: Assigns the smallest positive nonzero double value.
3. **MIN_NORMAL**: Assigns the smallest positive normal double value.
4. **MAX_EXPONENT**: Assigns the maximum exponent a finite double variable can have.
5. **MIN_EXPONENT**: Assigns the minimum exponent a normalized double variable can have.
6. **BYTES**: Gives the number of bytes that are used to represent a double variable.
7. **SIZE**: Gives the number of bits that are used to represent a double variable.
8. **TYPE**: Gives the Class instance representing the primitive type double.
9. **NaN**: Assigns a Not-a-Number (NaN) value of type double.
10. **POSITIVE_INFINITY**: A constant that represents the positive infinity of type double.
11. **NEGATIVE_INFINITY**: A constant that represents the negative infinity of type double.

### **Constructor:**
1. **Double(double value)**: Constructs a Double Object that takes a double argument.
2. **Double(String s)**: Constructs a Double Object that takes a String representing the double value.

### **Methods:**
  1. **byteValue()**: Returns the value of Double as a byte value.
  2. **shortValue()**: Returns the value of Double as a short value.
  3. **intValue()**: Returns the value of Double as an int value.
  4. **longValue()**: Returns the value of Double as a long value.
  5. **doubleValue()**: Returns the value of Double as a double value.
  6. **floatValue()**: Returns the value of Double as a float value.
  7. **hashCode()**: Returns the value of Double as a hash code.
  8. **isFinite()**: Returns true if the Double value is a finite floating-point value.
  9. **isInfinite()**: Returns true if the Double value is not a finite floating-point value.
  10. **isNan()**: Returns true if the Double value is a Not-a-Number (NaN).
  11. **toString()**: Returns the double value converted to a String.
  12. **parseDouble()**: Returns a new double with the value represented by the specified String as its initial value.
  13. **valueOf()**: Returns the double value representing the Double Object.
  14. **toHexString()**: Returns the hexadecimal representation corresponding to the double value.
  15. **doubleToLongBits()**: Returns the IEEE 754 floating-point "double format" bit layout representation of the double value.
  16. **doubleToRawLongBits()**: Returns the IEEE 754 floating-point "double format" bit layout representation of the double value while preserving Not-a-Number (NaN) values.
  17. **longBitsToDouble()**: Returns the double value of the given long bit representation.
  18. **equals()**: Compares the Double Object against another Double Object.
  19. **compare()**: Compares the two specified double values.
  20. **compareTo()**: Compares two Double Objects.
  21. **min()**: Returns the minimum of the two double values entered.
  22. **max()**: Returns the maximum of the two double values entered.
  23. **sum()**: Adds two double values.

[Back to top](#floating-types)

path: /Java/Primitive Data Type/Floating Types/Floating_Types_Documentation.md

gha_language: Jupyter Notebook


text:
# Hapi Mongoose Boilerplate v1.1.0.

![hapi](https://myhappyagency.com/blog/wp-content/uploads/2019/12/Copie-de-Design-sans-titre.png)

Hapi boilerplate made with Mongoose, Bcrypt & Nodemon.
Build powerful, scalable applications, with minimal overhead and full out-of-the-box functionality - your code, your way.

## Installation

This template works with env variables and a MONGODB_URI.

Install dependencies:
```
npm i
```
Create an .env file at project root & fill a valid MONGODB_URI:
```
MONGODB_URI=
```
Start with nodemon:
```
npm run serve
```
Without nodemon:
```
npm run start
```

## Built With

* [Hapi](https://github.com/hapijs/hapi) - The Simple, Secure Framework Developers Trust
* [Mongoose](https://mongoosejs.com/) - Elegant MongoDB object modeling for Node.js
* [bcrypt](https://www.npmjs.com/package/bcrypt) - A library to help you hash passwords.
* [nodemon](https://www.npmjs.com/package/nodemon) - nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.

## Versioning

We use [SemVer](http://semver.org/) for versioning.

## Authors

* **Guillaume Duhan** - *Initial work* - [Github](https://github.com/guillaumeduhan)

## License

This project is licensed under the MIT License.

gha_language: JavaScript


text:
---
external help file: LithnetPasswordProtection.dll-Help.xml
Module Name: LithnetPasswordProtection
online version:
schema: 2.0.0
---

# Add-CompromisedPassword

## SYNOPSIS
Adds a compromised password to the store

## SYNTAX

### String (Default)
```
Add-CompromisedPassword [-Value] <String> [<CommonParameters>]
```

### SecureString
```
Add-CompromisedPassword [-SecureString] <SecureString> [<CommonParameters>]
```

## DESCRIPTION
This cmdlet adds a string into the compromised password store. When the password filter is configured to check against compromised passwords, any password that is an exact match to this string will rejected.

## EXAMPLES

### Example 1
```powershell
Add-CompromisedPassword -Value "password"
```

This example adds a single compromised password to the store

### Example 2
```powershell
Add-CompromisedPassword -SecureString (Read-Host -Prompt "Enter the compromised password to add to the store" -AsSecureString)
```

This example prompts for a password to add to the compromised password store

## PARAMETERS

### -SecureString
The password to add to the compromised password store as a secure string

```yaml
Type: SecureString
Parameter Sets: SecureString
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -Value
The password to add to the compromised password store

```yaml
Type: String
Parameter Sets: String
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### System.String

### System.Security.SecureString

## OUTPUTS

## NOTES
To import a file of compromised passwords, use the Import-CompromisedPassword cmdlet or the Import-CompromisedPasswordHashes cmdlets.

## RELATED LINKS

repository: lithnet/ad-password-protection

gha_language: C#

repo_name: lithnet/ad-password-protection


text:
[version]: https://api.bintray.com/packages/jagrosh/maven/JDA-Utilities/images/download.svg
[download]: https://bintray.com/jagrosh/maven/JDA-Utilities/_latestVersion
[license]: https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg
[issues]: https://img.shields.io/github/issues/JDA-Applications/JDA-Utilities.svg
[issues-link]: https://github.com/JDA-Applications/JDA-Utilities/issues

[ ![version][] ][download]
[ ![license][] ](https://github.com/JDA-Applications/JDA-Utilities/tree/master/LICENSE)
[ ![issues][] ][issues-link]

## JDA-Utilities
JDA-Utilities is a series of tools and utilities for use with [JDA](https://github.com/DV8FromTheWorld/JDA)
to assist in bot creation.

## Packages

Since JDA-Utilities 2.x, the library has been split into multiple modular projects,
in order to better organize it's contents based on what developers might want to use and not use.

+ [Command Package](https://github.com/JDA-Applications/JDA-Utilities/tree/master/command)
+ [Commons Package](https://github.com/JDA-Applications/JDA-Utilities/tree/master/commons)
+ [CommandDoc Package](https://github.com/JDA-Applications/JDA-Utilities/tree/master/doc)
+ [Examples Package](https://github.com/JDA-Applications/JDA-Utilities/tree/master/examples)
+ [Menu Package](https://github.com/JDA-Applications/JDA-Utilities/tree/master/menu)

Visit individual modules to read more about their contents!

## Getting Started
You will need to add this project as a dependency (either from the latest .jar from the releases page,
or via maven or gradle), as well as [JDA](https://github.com/DV8FromTheWorld/JDA).

With maven:
```xml
  <dependency>
    <groupId>com.jagrosh</groupId>
    <artifactId>jda-utilities</artifactId>
    <version>JDA-UTILITIES-VERSION</version>
    <scope>compile</scope>
    <type>pom</type>
  </dependency>
  <dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>JDA-VERSION</version>
  </dependency>
```
```xml
  <repository>
    <id>central</id>
    <name>bintray</name>
    <url>http://jcenter.bintray.com</url>
  </repository>
```

With gradle:
```groovy
dependencies {
    compile 'com.jagrosh:jda-utilities:JDA-UTILITIES-VERSION'
    compile 'net.dv8tion:JDA:JDA-VERSION'
}

repositories {
    jcenter()
}
```

Individual modules can be downloaded using the same structure shown above, with the addition of the module's
name as a suffix to the dependency:

With maven:
```xml
  <dependency>
    <groupId>com.jagrosh</groupId>
    <!-- Notice that the dependency notation ends with "-command" -->
    <artifactId>jda-utilities-command</artifactId>
    <version>JDA-UTILITIES-VERSION</version>
    <scope>compile</scope>
  </dependency>
```

With gradle:
```groovy
dependencies {
    // Notice that the dependency notation ends with "-command"
    compile 'com.jagrosh:jda-utilities-command:JDA-UTILITIES-VERSION'
}
```

## Examples
Check out the [ExampleBot](https://github.com/jagrosh/ExampleBot) for a simple bot example.

Other guides and information can be found on the [wiki](https://github.com/JDA-Applications/JDA-Utilities/wiki).

## Projects
[**Vortex**](https://github.com/jagrosh/Vortex) - Vortex is an easy-to-use moderation bot that utilizes the JDA-Utilities library for the Command Client and some of the menus

[**JMusicBot**](https://github.com/jagrosh/MusicBot) - This music bot uses the Command Client for its base, and several menus, including the OrderedMenu for search results and the Paginator for the current queue

[**GiveawayBot**](https://github.com/jagrosh/GiveawayBot) - GiveawayBot is a basic bot for hosting quick giveaways!

repository: JDA-Applications/JDA-Utilities

repo_name: JDA-Applications/JDA-Utilities