text:
# ADSigma's Crowdsale Contracts

Please see below ADSigma smart contracts for the [ADSigma Crowdsale][ADSigma].

![ADSigma Token](images/logo.png)

 is an ERC-20 compliant cryptocurrency built on top of the [Ethereum][ethereum] blockchain.

## Contracts

Please see the [contracts/](contracts) directory.

## The Crowdsale Specification
*	ADSI token is ERC-20 compliant.
*	ADSI Token is [Bancor][bancor] compliant.
*	Token allocation:
	* 60% of the total number of ADSI tokens will be allocated to contributors during the token sale.
	* 10% of the total number of ADSI tokens will be allocated to the team.
	* 30% of the total number of ADSI tokens will be allocated to ADSigma, to be used for future strategic plans and to develop the ADSigma' ecosystem

## ADSI PRICING PROGRAM
The ADSI / ETH rate will be 3000 ADSI for every ETH

## Develop

* Contracts are written in [Solidity][solidity] and tested using [Truffle][truffle] and [testrpc][testrpc].

* Our smart contract is based on [Sirin Labs ICO][sirinlabicogithub] and [Open Zeppelin][openzeppelin] smart contracts [v1.3.0][openzeppelin_v1.3.0]

* ADSI token is a **SmartToken**, implementing Bancor's SmartToken contract.

#### ADSigmaCrowdsale Functions

**getTotalFundsRaised**
```cs
function getTotalFundsRaised() public view returns (uint256)
```
Returns the total funds collected in wei(ETH and none ETH).

**addUpdateGrantee**
```cs
function addUpdateGrantee(address _grantee, uint256 _value) external onlyOwner beforeFinzalized
```
Adds/Updates address and token allocation for token grants.

Granted tokens are allocated to non-Ether, presale, buyers.

**setFiatRaisedConvertedToWei**
```cs
function setFiatRaisedConvertedToWei(uint256 _fiatRaisedConvertedToWei) external onlyOwner onlyWhileSale
```
Sets funds collected outside the crowdsale in wei.
funds are converted to wei using the market conversion rate of USD\ETH on the day on the purchase.

**hasEnded**
```cs
function hasEnded() public view returns (bool) {
```
Return true if the crowdsale cap was reached or endTime reached ( override crowdsale.sol)

**validPurchase**
```cs
function validPurchase() internal view returns (bool) {
```
Return true if hardcap was not reached ( override crowdsale.sol)

**deleteGrantee**
```cs
function deleteGrantee(address _grantee) external onlyOwner beforeFinzalized
```
Deletes entries from the grants list.

**claimTokenOwnership**
```cs
function claimTokenOwnership() external onlyOwner
```
Accepts new ownership on behalf of the ADSigmaCrowdsale contract. This can be used, by the token sale contract itself to claim back ownership of the ADSigmaSmartToken contract.

repository: AdSigma/ADSi-contracts

repo_name: AdSigma/ADSi-contracts


text:
---
title: Retaining open tree-nodes after URL navigation
description: Retaining open RadTreeView nodes after URL navigation. Check it now!
type: how-to
page_title: Retaining open tree-nodes after URL navigation
slug: treeview-retaining-open-tree-nodes-after-url-navigation
res_type: kb
---

 ## HOW-TO
Retain open tree-nodes after URL navigation

## SOLUTION

While RadTreeView retains open tree nodes after postback, it does not perist its state after URL redirect navigation (this is actually typical for all ASP.NET controls). Note, however, that you can easily make the clicked node visible by setting its **Selected** property to **True** and expanding all the parent nodes up to the root of the tree to make it visible.

Here's a common scenario - all nodes have unique **Value** properties (i.e 1,2,3...). They also have unique **Href** properties pointing to one page but with different id **Get** parameter, i.e ( "?Page.aspx&id=1", "?Page.aspx&id=2" ..)

In the **Page\_Load** method of the page you can get the **id **attribute from the query string, find the node in the tree and mark it as selected and expand nodes up the tree, e.g.

````C#
if (Request.QueryString["id"] != null)

{

      string id = Request.QueryString["id"];

      foreach (RadTreeNode node in RadTree1.GetAllNodes())

      {

            if (node.Value == id)

            {

                  node.ExpandParentNodes();

                  node.Selected = true;

            }

      }

}
````

repository: telerik/ajax-docs

branch_name: refs/heads/master

extension: md

gha_language: C#

license_type: permissive

repo_name: telerik/ajax-docs


text:
# ElevatorPitchGenerator

[![Gem Version](https://badge.fury.io/rb/elevator_pitch_generator.svg)](http://badge.fury.io/rb/elevator_pitch_generator)
[![Build Status](https://travis-ci.org/tbpgr/elevator_pitch_generator.png?branch=master)](https://travis-ci.org/tbpgr/elevator_pitch_generator)
[![Coverage Status](https://coveralls.io/repos/tbpgr/elevator_pitch_generator/badge.png)](https://coveralls.io/r/tbpgr/elevator_pitch_generator)
[![Code Climate](https://codeclimate.com/github/tbpgr/elevator_pitch_generator.png)](https://codeclimate.com/github/tbpgr/elevator_pitch_generator)

Elevator Pitch Generator is Elevator Pitch Generator.

## Elevator Pitch
[Elevator Pitch](./elevator_pitch/README.md)

## Installation

Add this line to your application's Gemfile:

    gem 'elevator_pitch_generator'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install elevator_pitch_generator

## Usage
### Steps
* generate Epitchfile

~~~bash
epitchgen init
~~~

generated File

~~~ruby
# encoding: utf-8

# For [potential needs or solution]
# needs is required
# needs allow only String
# needs's default value => "For TODO: write potential needs or solution"
needs "For TODO: write potential needs or solution"

# who [target]
# target is required
# target allow only String
# target's default value => "who TODO: write target"
target "who TODO: write target"

# The [product_name]
# product_name is required
# product_name allow only String
# product_name's default value => "The TODO: write product_name"
product_name "The TODO: write product_name"

# is a [category]
# category is required
# category allow only String
# category's default value => "is a TODO: write category"
category "is a TODO: write category"

# that [merit]
# merit is required
# merit allow only String
# merit's default value => "that TODO: write merit"
merit "that TODO: write merit"

# Unlike [difference of competition]
# diff_of_competition is required
# diff_of_competition allow only String
# diff_of_competition's default value => "Unlike TODO: write difference of competition"
diff_of_competition "Unlike TODO: write difference of competition"

# it [most important point]
# most_important_point is required
# most_important_point allow only String
# most_important_point's default value => "it TODO: write most important point"
most_important_point "it TODO: write most important point"
~~~

* edit Epitchfile manually.

~~~ruby
# encoding: utf-8

needs "For creator"
target "who supply some product"
product_name "The Elevator Pitch Generator"
category "is a generator of Elevator Pitch"
merit "that generate Elevator Pitch template automatically"
diff_of_competition "Unlike manuall-create that is redundant operation"
most_important_point "it provides formated template for Elevator Pitch"
~~~

* generate Elevator Pitch from Epitchfile

~~~bash
epitchgen generate
~~~

./elevator_pitch/README.md

~~~ruby
# The Elevator Pitch Generator's Elevator Pitch

## For creator
## who supply some product
## The Elevator Pitch Generator
## is a generator of Elevator Pitch
## that generate Elevator Pitch template automatically
## Unlike manuall-create that is redundant operation
## it provides formated template for Elevator Pitch
~~~

* append link in your project-root README.md

~~~markdown
[Elevator Pitch](./elevator_pitch/README.md)
~~~

## History
* version 0.0.1  : first release.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

license: MIT


text:
# wheelberry-i2c

I2C support code for the Wheelberry project.

### Building

To build the module requires the following npm modules - I install them globally to efficiently share them
between modules:

```
npm i -g coveralls prettier rimraf ts-node tslint tslint-config-prettier typescript
```

license: Unlicense

gha_language: TypeScript

gha_license_id: Unlicense


text:
# Cryptodex

Pure Ruby implementations of widely used [cryptographic primitives](https://en.wikipedia.org/wiki/Cryptographic_primitive).

## Block Ciphers

* XTEA (eXtended TEA)

license: ISC

repository: plutonbacon/cryptodex

repo_name: plutonbacon/cryptodex


text:
# Waiter and Haser

Similar to Official AWS PHP SDK, AsyncAws provides waiters to let you wait
until an long operation finished.

To ease the development, the above code is wrapped in a helper called "waiter".

```php
// create a queue Async and don't wait for the response.
$sqsClient->createQueue(['QueueName' => 'fooBar']);

$waiter = $sqsClient->queueExists(['QueueName' => 'fooBar']);

echo $waiter->isSuccess(); // false

$waiter->wait();

echo $waiter->isSuccess(); // true
```

A waiter provides methods that let you check the status of the operation.
* `isSuccess()` returns true when operation is successful
* `isFailure()` returns true when operation failed
* `isPending()` returns true when the state of the operation is not yet determinate
* `getState()` returns the state of the operation either `sucess`, `failure` or `pending`
* `wait($timeout, $delay)` waits until the state of the operation is determinate.

As usual, AsyncAws is async and not blocking by default:

```php
$waiter = $sqsClient->queueExists(['QueueName' => 'fooBar']);
while(true) {
    if ($waiter->wait(0)) {
        // When method `wait` returns true, the state is resolved.
        break;
    }

    // perform business logic
    sleep(1);
}

echo $waiter->isSuccess();
```

repository: gmorel/aws

gha_license_id: MIT

repo_name: gmorel/aws


text:
---
layout: post
title: "Version Control with Jupyter Notebooks"
excerpt: "I demonstrate a technique for easily using version control along with Jupyter Notebooks."
#modified: 2016-02-22
tags: [Python, git, version control, Jupyter Notebook]
comments: true
share: false

---

I'm a big fan of using [Jupyter Notebooks](http://jupyter.org/) for Python projects, but one downside is that version control is a pain.  Commits become very large and illegible if you opt to track the entire notebook with the output cells, especially when graphics are included.

There are a number of [proposed solutions](https://stackoverflow.com/questions/18734739/using-ipython-notebooks-under-version-control), but they require either changing your git configuration or generating a Jupyter [configuration file and modifying it](https://stackoverflow.com/a/25765194).  These approaches could vary by user and it's not clear from the code or repo how the changes are being tracked.  Below I outline an approach that might be better because the solution is included directly in a notebook cell.

## One Approach

One possibility is to use a tool called [nbstripout](https://github.com/kynan/nbstripout) (installable via pip) along with a bash command in a notebook cell to solve this problem.  Just add a cell like this one to your notebook, set the filenames, save the notebook, then run the cell to create a cleaned version of your notebook without the output.

{% highlight python %}

# Save your notebook and run this cell to create
# a cleaned file for version control:
import os
from datetime import datetime

notebook_path = os.path.join(os.getcwd(),'notebook_working.ipynb')
cleaned_path = os.path.join(os.getcwd(),'notebook_clean.ipynb')

#Bash command below:
!cat {notebook_path} | nbstripout > {cleaned_path}

date_str = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print('{0} Cleaned file created at: {1}'.format(date_str, cleaned_path))
{% endhighlight %}

    2017-06-23 12:57:40 Cleaned file created at: <current directory>/notebook_clean.ipynb

Then use git to track the cleaned version and only commit to your working version when you need to push viewable results.  This way people can easily see what changes have been made to the clean version and merge changes into the working version more confidently.

{% highlight bash %}

$ git add notebook_clean.ipynb
$ git commit -m "First change, no output tracked"
$ git add notebook_clean.ipynb
$ git commit -m "Second change, no output tracked"
$ git add notebook_clean.ipynb notebook_working.ipynb
$ git commit -m "Third change, with output tracked in working file"

{% endhighlight %}

You could even use .gitignore to completely untrack the working version if you don't need to display the output anywhere:

    # .gitignore
    notebook_working.ipynb

## An Alternative

Another option is to use Jupyter's built-in `nbconvert` to output your notebook as a Python file, then track changes to that file to make it easier to read commits.  This approach is nice because it doesn't require an external dependency, but the downside is you still need to track the notebook and it's incremental outputs.

Here's an example of how this could work:

{% highlight python %}
#Save, then run
import os
notebook_path = os.path.join(os.getcwd(),'notebook1.ipynb')

#Bash:
!jupyter nbconvert --to script {notebook_path}
{% endhighlight %}

    [NbConvertApp] Converting notebook <current directory>/notebook1.ipynb to script
    [NbConvertApp] Writing 588 bytes to <current directory>/nbconvert_test/notebook1.py

Then just track the resulting Python file each time you commit the notebook.  If you have multiple files that you want to convert at once for version control, you could include a cell like this:

{% highlight python %}
#Save, then run
import os
path1 = os.path.join(os.getcwd(),'notebook1.ipynb')
path2 = os.path.join(os.getcwd(),'notebook2.ipynb')
path_str = ' '.join([path1, path2])

#Bash:
!jupyter nbconvert --to script {path_str}
{% endhighlight %}

    [NbConvertApp] Converting notebook <current directory>/notebook1.ipynb to script
    [NbConvertApp] Writing 588 bytes to <current directory>/nbconvert_test/notebook1.py
    [NbConvertApp] Converting notebook <current directory>/notebook2.ipynb to script
    [NbConvertApp] Writing 588 bytes to <current directory>/nbconvert_test/notebook2.py

Both these approaches makes it a little more clear how the files are being tracked and don't resort to user specific configuration files that seem prone to error.

gha_language: HTML


text:
# Find duplicate rows in CSV File

This is just a simple PHP script that will find "duplicate rows" in one data file in CSV format.
And outputs information about duplicate records/rows.

There are probably online tools for this out there, but my client want to keep his infomration private. He requires privacy and security, and does not want to upload his data to 3rd party service/server.

Motivation for this tool: This is old way using one Excel sheet by multiple people within organization. After some time CSV data file now conrinas over 10,000 records and few records are there multiple times. Some of those records are exactly same but few only have changes in some columns. Instead of updating exiting row new rows were added with updated information.

This tool offers selection of CSV columns where do you want to be looking for duplicate values. It means you can select all of them or only few which are important to you.

This tool does not offer files upload option, I think that can be improved later. We provide one simple CSV data file example in "csv-data" directory.

repository: marekDeveloper/utilities-and-tools

repo_name: marekDeveloper/utilities-and-tools


text:
---
title: RDO Manager Troubleshooting
authors: snecklifter
wiki_title: RDO Manager Troubleshooting
wiki_revision_count: 1
wiki_last_updated: 2016-01-11
---

# RDO Manager Troubleshooting

## Undercloud

The undercloud is a basic OpenStack cloud leveraging Ironic, Heat and others for installing the main production cloud

Installation Errors

Problem: "Error: Could not run: Could not retrieve facts for $NODENAME: no address for $NODENAME"
Resolution: Remove the errant dns domain from the search parameter in /etc/resolv.conf. Usually due to one interface being on DHCP.

## Overcloud

The overcloud is the main production cloud deployed to baremetal or virtual machines from the undercloud. Expect most of your problems to arise here.

If your baremetal nodes have serial console configured and enabled, use ipmitool to view console output thus:

ipmitool -H $NODE_IPADDRESS -I lanplus -U $USERNAME -P $PASSWORD sol activate

If this works you should get the following output:

[SOL Session operational.  Use ~? for help]

repository: Yangthesilencer/website

repo_name: Yangthesilencer/website


text:
## Conda

Conda manages software dependencies across multiple programming languages (like 'apt' on Ubuntu, or 'homebrew' on Mac), and installs software into isolated 'environments' (like 'virtualenv' for Python). MountainLab packages are available for Linux and MacOS; apart from the first download step, the instructions are identical for these two operating systems.

The steps below assume you are using `bash` as your shell (the default on Linux and MacOS), and that you want to install conda and all of its files to `~/conda`

On Linux:
```
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda3.sh
```
On Mac:
```
curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o miniconda3.sh
```
Now install Conda
```
# Install conda in batch mode to ~/conda
bash miniconda3.sh -bp ~/conda

# Set up conda shell scripts on login (* see CONDA ACTIVATION note below)
conda init
```

Close and reopen your terminal. You should now be able to run the `conda` command to activate the base environment:

```
# activate the ‘base' conda environment
conda activate base

# have conda update itself
conda update conda

```

To create and activate a new conda environment:

```
conda create -n myenv1
conda activate myenv1
```

For more documentation of the conda install process, refer to the [conda docs](https://conda.io/docs/user-guide/install/index.html).

repository: alfonsogravante/mountainlab-js

repo_name: alfonsogravante/mountainlab-js


text:
# ScalaMock
[![Build Status](https://travis-ci.org/paulbutcher/ScalaMock.svg?branch=master)](https://travis-ci.org/paulbutcher/ScalaMock) [![Scaladex](https://index.scala-lang.org/paulbutcher/scalamock/scalamock/latest.svg?color=orange)](https://index.scala-lang.org/paulbutcher/scalamock) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d7250cea177b468c94bb07eb8d3366a4)](https://www.codacy.com/app/barkhorn/ScalaMock?utm_source=github.com&utm_medium=referral&utm_content=paulbutcher/ScalaMock&utm_campaign=Badge_Grade)

Native Scala mocking.

Official website: [http://scalamock.org/](http://scalamock.org/)

## Examples

### Expectations-First Style

```scala
test("drawline interaction with turtle") {
  // Create mock Turtle object
  val m = mock[Turtle]

  // Set expectations
  (m.setPosition _).expects(10.0, 10.0)
  (m.forward _).expects(5.0)
  (m.getPosition _).expects().returning(15.0, 10.0)

  // Exercise System Under Test
  drawLine(m, (10.0, 10.0), (15.0, 10.0))
}
```

### Record-then-Verify (Mockito) Style

```scala
test("drawline interaction with turtle") {
  // Create stub Turtle
  val m = stub[Turtle]

  // Setup return values
  (m.getPosition _).when().returns(15.0, 10.0)

  // Exercise System Under Test
  drawLine(m, (10.0, 10.0), (15.0, 10.0))

  // Verify expectations met
  (m.setPosition _).verify(10.0, 10.0)
  (m.forward _).verify(5.0)
}
```

A more complete example is on our [Quickstart](http://scalamock.org/quick-start/) page.

## Features

* Fully typesafe
* Full support for Scala features such as:
  * Polymorphic (type parameterised) methods
  * Operators (methods with symbolic names)
  * Overloaded methods
  * Type constraints
* ScalaTest and Specs2 integration
* Mock and Stub support
* Macro Mocks and Proxy Mocks
* Scala.js support
* built for Scala 2.10, 2.11, 2.12

## Using ScalaMock

Artefacts are published to Maven Central and JCenter.

For ScalaTest, to use ScalaMock in your Tests, add the following to your `build.sbt`:

```scala
libraryDependencies += "org.scalamock" %% "scalamock" % "4.0.0" % Test
```

## Documentation

For usage in Maven or Gradle, integration with Specs2, and more example examples see the [User Guide](http://scalamock.org/user-guide/)

## Donations

This project is run for fun as a hobby, but if you want to show your appreciation you can donate some ETH or tokens to 0x6A34A63dbD851e4BEC2D25eC7d4E7b50e213C3A7 ([QR Code](https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=0x6A34A63dbD851e4BEC2D25eC7d4E7b50e213C3A7&choe=UTF-8)). Or other crypto currencies (Bitcoin, etc) via Shapeshift [here](https://shapeshift.io/shifty.html?destination=0x6A34A63dbD851e4BEC2D25eC7d4E7b50e213C3A7&output=ETH). If you want to learn more about Ethereum, visit the [homepage](https://www.ethereum.org/) or [wikipedia](https://en.wikipedia.org/wiki/Ethereum).

## Acknowledgements

YourKit is kindly supporting open source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of innovative and intelligent tools for profiling
Java and .NET applications. Take a look at YourKit's leading software products:
[YourKit Java Profiler](http://www.yourkit.com/java/profiler/index.jsp) and
[YourKit .NET Profiler](http://www.yourkit.com/.net/profiler/index.jsp).


text:
# NativeScript Local Notifications Plugin

[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]
[![Twitter Follow][twitter-image]][twitter-url]

[npm-image]:http://img.shields.io/npm/v/nativescript-local-notifications.svg
[npm-url]:https://npmjs.org/package/nativescript-local-notifications
[downloads-image]:http://img.shields.io/npm/dm/nativescript-local-notifications.svg
[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me
[twitter-url]:https://twitter.com/eddyverbruggen

The Local Notifications plugin allows your app to show notifications when the app is not running.
Just like remote push notifications, but a few orders of magnitude easier to set up.

## Installation
From the command prompt go to your app's root folder and execute:
```bash
tns plugin add nativescript-local-notifications
```

#### TypeScript support
And do yourself a favor by adding TypeScript support to your nativeScript app:

```bash
tns install typescript
```

Now you can import the plugin as an object into your `.ts` file as follows:

```typescript
import * as LocalNotifications from "nativescript-local-notifications";

// then use it as:
LocalNotifications.hasPermission()
```

## Usage

If you want a quickstart, [clone our demo app](https://github.com/EddyVerbruggen/nativescript-local-notifications-demo).

### schedule
On iOS you need to ask permission to schedule a notification.
You can have the `schedule` funtion do that for you automatically (the notification will be scheduled in case the user granted permission),
or you can manually invoke `requestPermission` if that's your thing.

You can pass several options to this function, everything is optional:

|option|description|
|------|-----------|
|`id`     |A number so you can easily distinguish your notifications. Default 0.|
|`title`  |The title which is shown in the statusbar. Default empty.|
|`body`   |The text below the title. Default empty.|
|`groupedMessages`| An array of atmost 5 messages that would be displayed using android's notification [inboxStyle](https://developer.android.com/reference/android/app/Notification.InboxStyle.html). Note: The array would be trimed from the top if the messages exceed five. Default not set |
|`groupSummary`| An [inboxStyle](https://developer.android.com/reference/android/app/Notification.InboxStyle.html) notification summary. Default empty|
|`ticker` |On Android you can show a different text in the statusbar, instead of the `body`. Default not set, so `body` is used.|
|`at`     |A JavaScript Date object indicating when the notification should be shown. Default 'now'.|
|`badge`  |On iOS (and some Android devices) you see a number on top of the app icon. On most Android devices you'll see this number in the notification center. Default not set (0).|
|`sound`  |Notification sound. For custom notification sound, copy sound file in ```App_Resources/iOS``` (iOS) and ```App_Resources/Android/raw``` (Android). Set this to "default" (or do not set at all) in order to use default OS sound. Set this to `null` to suppress sound.|
|`interval` |Set to one of `second minute hour day week month quarter year` if you want a recurring notification.|
|`smallIcon` |On Android you can set a custom icon in the system tray. Pass in 'res://filename' (without the extension) which lives in App_Resouces/Android/drawable folders. If not passed, we look for a file named 'ic_stat_notify.png' in the App_Resources/Android/drawable folders. Default: the app icon.|
|`largeIcon` |Same as `smallIcon`, but this one is shown when you expand the notification center. The optional file we look for is not 'ic_stat_notify.png' but 'ic_notify.png'.|
|`ongoing` |Default is (`false`). Set whether this is an `ongoing` notification. Ongoing notifications cannot be dismissed by the user, so your application must take care of canceling them.(**Android Only**) |

Note that after a reboot the `smallIcon` and `largeIcon` are not restored but fall back to the default (app icon). This is a known issue and can be fixed in a future version.

```js
  LocalNotifications.schedule([{
    id: 1,
    title: 'The title',
    body: 'Recurs every minute until cancelled',
    ticker: 'The ticker',
    badge: 1,
    groupedMessages:["The first", "Second", "Keep going", "one more..", "OK Stop"], //android only
    groupSummary:"Summary of the grouped messages above", //android only
    ongoing: true, // makes the notification ongoing (Android only)
    smallIcon: 'res://heart',
    interval: 'minute',
    sound: require("application").ios ? "customsound-ios.wav" : "customsound-android", // can be also `null`, "default"
    at: new Date(new Date().getTime() + (10 * 1000)) // 10 seconds from now
  }]).then(
      function() {
        console.log("Notification scheduled");
      },
      function(error) {
        console.log("scheduling error: " + error);
      }
  )
```

### Notification icons

> __Background information:__ Local notifications may fail silently if you don't provide the notification icons in the correct dimensions. They may do work perfectly fine on one device but fail on the other. That's because android might fallback to your xxxhdpi launcher icon which is too big. This type of error is noticeable in logcat: `!!! FAILED BINDER TRANSACTION !!! (parcel size = 1435376)`

#### Spec for ic_stat_notify.png (smallIcon)

[Android API Guides → Status Bar Icons](https://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html)

#### Spec for ic_notify.png (largeIcon)

Unfortunately it seems like there's no official guide for these. Anyways there's a [dimen](https://github.com/android/platform_frameworks_base/blob/2d5dbba/core/res/res/values/dimens.xml#L181) that's telling us the dp size which we can translate to the following spec:

| Density qualifier | px | dpi
| -- | -- | --
| ldpi | 48 x 48 | 120
| mdpi | 64 x 64 | 160
| hdpi | 96 x 96 | 240
| xhdpi | 128 x 128 | 320
| xxhdpi | 192 x 192 | 480

__Don't include xxxhdpi__

> __xxxhdpi__: Extra-extra-extra-high-density uses (__launcher icon only__, see the note in Supporting Multiple Screens); approximately 640dpi. Added in API Level 18
> Source: [Density Qualifier Docs](https://developer.android.com/guide/topics/resources/providing-resources.html#DensityQualifier)

### addOnMessageReceivedCallback
Tapping a notification in the notification center will launch your app.
But what if you scheduled two notifications and you want to know which one the user tapped?

Use this function to have a callback invoked when a notification was used to launch your app.
Note that on iOS it will even be triggered when your app is in the foreground and a notification is received.

```js
  LocalNotifications.addOnMessageReceivedCallback(
      function (notification) {
        console.log("ID: " + notification.id);
        console.log("Title: " + notification.title);
        console.log("Body: " + notification.body);
      }
  ).then(
      function() {
        console.log("Listener added");
      }
  )
```

### getScheduledIds
If you want to know the ID's of all notifications which have been scheduled, do this:

Note that all functions have an error handler as well (see `schedule`), but to keep things readable we won't repeat ourselves.

```js
  LocalNotifications.getScheduledIds().then(
      function(ids) {
        console.log("ID's: " + ids);
      }
  )
```

### cancel
If you want to cancel a previously scheduled notification (and you know its ID), you can cancel it:

```js
  LocalNotifications.cancel(5 /* the ID */).then(
      function(foundAndCanceled) {
          if (foundAndCanceled) {
            console.log("OK, it's gone!");
          } else {
            console.log("No ID 5 was scheduled");
          }
      }
  )
```

### cancelAll
If you just want to cancel all previously scheduled notifications, do this:

```js
  LocalNotifications.cancelAll();
```

### requestPermission
On Android you don't need permission, but on iOS you do. Android will simply return true.

If the `requestPermission` or `schedule` function previously ran the user has already been prompted to grant permission.
If the user granted permission this function returns `true`, but if he denied permission this function will return `false`,
since an iOS can only request permission once. In which case the user needs to go to the iOS settings app and manually
enable permissions for your app.

```js
  LocalNotifications.requestPermission().then(
      function(granted) {
        console.log("Permission granted? " + granted);
      }
  )
```

### hasPermission
On Android you don't need permission, but on iOS you do. Android will simply return true.

If the `requestPermission` or `schedule` functions previously ran you may want to check whether or not the user granted permission:

```js
  LocalNotifications.hasPermission().then(
      function(granted) {
        console.log("Permission granted? " + granted);
      }
  )
```

## Future work
Let us know what you need by opening a Github issue.

We're thinking about adding support for things like:
- Interactive Notifications on iOS


text:
# RuleSchemaThenRetryBackoff

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**duration** | **str** | Initial duration to wait before retrying failed step | [optional]
**factor** | **int** | Wait duration multiplication factor during each retry attempt | [optional]
**max_duration** | **str** | Maximum duration to wait before retrying a failed step | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

repository: Juniper/healthbot-py-client

gha_language: Python

repo_name: Juniper/healthbot-py-client


text:
## Versioning

This project uses [semantic versioning](https://semver.org/).

The patch-version (3rd digit) is bumped up automatically at every merge to master (by [_Travis CI_](/.travis.yml)).

### Increment the patch version
This is done automatically by _Travis CI_. Nothing special to do here. Example: merging when latest tag is `v3.23.291`
will automaticall tag a version `v3.23.292`.

### Increment the minor version
Since _Travis CI_ only automatically increases the patch-version, we need to manually pre-tag with the new version we
want.

Scenario:
- actual version is `v3.23.291`
- tag one of the commit on your branch with the new version you want.
  - it is **important** that the patch version be `-1`, since it will be incremented automatically by _Travis CI_.
  - `git tag v3.24.-1 && git push --tags`
- open the pull request.
- after merge, _Travis CI_ will tag automatically the right final version `v3.24.0`.
- delete the temporary manual tag
  - `git tag -d v3.24.-1 && git push --tags`

### Increment the major version
Since _Travis CI_ only automatically increases the patch-version, we need to manually pre-tag with the new version we
want.

Scenario:
- actual version is `v3.23.291`
- tag one of the commit on your branch with the new version you want.
  - it is **important** that the patch version be `-1`, since it will be incremented automatically by _Travis CI_.
  - `git tag v4.0.-1 && git push --tags`
- open the pull request.
- after merge, _Travis CI_ will tag automatically the right final version `v4.0.0`.
- delete the temporary manual tag
  - `git tag -d v4.0.-1 && git push --tags`

repository: zalando-stups/skrop

gha_language: Go

repo_name: zalando-stups/skrop


text:
# Portmone Integration
[![Latest Stable Version](https://poser.pugx.org/wearesho-team/portmone/v/stable.png)](https://packagist.org/packages/wearesho-team/portmone)
[![Total Downloads](https://poser.pugx.org/wearesho-team/portmone/downloads.png)](https://packagist.org/packages/wearesho-team/portmone)
[![Build Status](https://travis-ci.org/wearesho-team/portmone.svg?branch=master)](https://travis-ci.org/wearesho-team/portmone)
[![codecov](https://codecov.io/gh/wearesho-team/portmone/branch/master/graph/badge.svg)](https://codecov.io/gh/wearesho-team/portmone)

[Portmone](https://portmone.com.ua) integration for PHP.

## Installation
Using composer:
```bash
composer require wearesho-team/portmone
```

## Usage
*todo: write usage documentation*

## Author
- [Wearesho](https://wearesho.com)
- [Alexander<EMAIL_ADDRESS>
## License
[MIT](./LICENSE.md)

repository: wearesho-team/portmone

gha_language: PHP

repo_name: wearesho-team/portmone


text:
# brute-force-login-protection

The purpose of this module is to block any login from an IP when 6 unsuccessful attemps have been made

# Installation

- In Jahia, go to "Administration --> Server settings --> System components --> Modules"
- Upload the JAR **brute-force-login-protection-X.X.X.jar**
- Check that the module is started

# Use
- Do not forget to configure the mail server settings if you want to be notified when an IP is blocked
- Go to "Administration --> Server settings --> Configuration --> Brute force login protection"
  - Set the CIDR blocks to whitelist, separated by a comma, in order to prevent any "secure" IP to be blocked
  - Activate the service then save

repository: Jahia/brute-force-login-protection

gha_language: Java

repo_name: Jahia/brute-force-login-protection


text:
# Karaf Features: CDI

## What is it?

Context dependency injection for Osgiliath framework

## How to use?

Reference this feature in your pom:
```
        <dependency>
			<groupId>net.osgiliath.framework</groupId>
			<version>${osgiliath.maven.version.version}</version>
			<artifactId>net.osgiliath.feature.cdi</artifactId>
			<type>xml</type>
			<classifier>features</classifier>
		</dependency>
```
And don't forget to add the feature you want to use on your app features.xml

Then, add these capabilities on your osgi.bnd:

```
    Require-Capability: osgi.extender;filter:="(osgi.extender=pax.cdi)", org.ops4j.pax.cdi.extension;filter:="(extension=pax-cdi-extension)"
```
You can also add a number of CDI portable extensions this way on your consumer bundle

Finally, add a mandatory META-INF/beans.xml file on your consumer project (for example, look at the cdi itests).
Take a look at the Pax-CDI documentation for more information


text:
## Overview
Face Recognition Using OpenCV and PyTorch.

This model uses GhostNet model for the recognition of the  User face.

Program is trained for 5 epochs, You can increase the number of epochs and the number of layers accordingly.

### Dependencies:
* pip install numpy
* pip install Pillow
* pip install tqdm
* pytorch (get from https://pytorch.org/)
* pip install opencv-python

Download haarcascades file from here=> https://github.com/opencv/opencv/blob/master/data/haarcascades/haarcascade_frontalface_default.xml

## ScreenShots

## Quick Start

- Fork and Clone the repository using-
```
git clone https://github.com/akshitagupta15june/Face-X.git
```
- Create virtual environment-
```
- `python -m venv env`
- `source env/bin/activate` (Linux)
- `env\Scripts\activate` (Windows)
```
- Install dependencies-

- Headover to Project Directory-
```
cd "Recognition using GhostNet"
```
- Create dataset using -
```
- Run create_dataset.py on respective idle(VS Code, PyCharm, Jupiter Notebook, Colab)
```
Note: Dataset is automatically split into train and val folders.

- Train the model -
```
- Run train-model.py
```
Note: Make sure all dependencies are installed properly.

- Final-output -
```
- Run output.py
```
Note: Make sure you have haarcascade_frontalface_default.xml file


text:
# MILSTD Military symbol standards in JSON

You should migrate to using the following two repositories instead:

* https://github.com/spatialillusions/mil-std-2525

* https://github.com/spatialillusions/stanag-app6

## License

The code is provided under the MIT license for easy reuse.


text:
## Config options

console.hook (boolean) - override console.log with hook function (also debug,info,warn,error). default is true
console.globalLogFn (string) - globalLogFn = 'Log'  - export console.'Log' as the original console.log. default is 'Log'
console.lineNumbers (boolean) - print line number & filename before console output. default is true
console.mute (boolean) - do not output anything to browser console
debugLib.hook (boolean) - redirect all debug lib output into console.log, which can then be overriden if console.hook is enabled. default is true
debugLib.hookConsole (boolean) - override console.log (also debug,info,warn,error) with debug lib loggers: console:log, console:info etc... default is true
debugLib.enable (string) - does debug.enable(string). default is 'console:* app:*'
report.onError (boolean) - hook into window.onerror and send report to remote url
report.ajaxOptions (object) - {method: 'POST', url: '/error'}
report.ajaxOptions.builtIn (boolean) - force using builtin ajax instead of $.ajax even if jquery exists
report.console (boolean) - forward all console output through report url
report.buffer (number) - buffer reports and send array every X seconds
report.url,errorText,errorName,errorStack,lineNumber,columnNumber,userAgent,browser,os,mobile - field to include in report

## License

(The MIT License)

Copyright (c) 2017 Dr. Sinisa;

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

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

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

repository: dsinisa/frontend-beacon-lib

repo_name: dsinisa/frontend-beacon-lib


text:
---
layout: post
title: "Weather App"
subtitle: "Build Weather app using Python"
date: 2020-01-26 23:45:13 -0400
background: '/img/posts/Weather-app-img/weather-app_upd.jpg'
---

## Project Summary
This project is to create Weather Application where it takes City or Zip code from user, retrieves information from openweathermap and displays weather information to user. Following information is displayed to the user:

1. Minimum Temperature
2. Maximum Temperature
3. Sunrise
4. Sunset
5. Windspeed and
6. Humidity

Project code is present in Github - [Project Link](https://github.com/santosh0924/Weather-App)


text:
# Stiff-competition
A repo to keep track of how a bunch of PHP CMS'es are doing. And some projects not built in PHP. And also some things that might not be completely CMS'es.

## Setup

First, configure the DB credentials, in `.env`

Then, run

```bash
bin/console doctrine:database:create
bin/console doctrine:schema:create
```

Update:

```
bin/console app:github
```

repository: bobdenotter/stiff-competition

repo_name: bobdenotter/stiff-competition


text:
# Multibracket Validation
Validate brackets ({}, (), []) if balanced or not. Paired with Liz Mahoney.

## Challenge
Given a string, create a multibracketvalidation method that will return boolean if the brackets are balanced or not.

## Approach and Efficiency
* The approach is to put the open brackets to the stack while traversing the character array. If the character is  the closing bracket, check the stack if it is the corresponding pair. To determine if it is the correct pair, the HashMap is utilized.
* Iteration through the character array takes 0(n) time and 0(n) space complexities in the multibracketvalidation method.

## API
To use: `MultiBracketValidation.multiBracketValidation(String input)`

## Source Code
* [MultiBracketValidation class](./src/main/java/multibracketvalidation/MultiBracketValidation.java)
* [MultiBracketValidationTest class](./src/main/test/multibracketvalidation/MultiBracketValidationTest.java)
* ![alt multi_bracket_validation](../../challenges-401/assets/multi_bracket_validation.jpg)

gha_language: JavaScript


text:
# Properties

<hr>

### Usage

The following items are properties.

- [Input](/source/properties/input.md)
- [Output](/source/properties/output.md)

repository: explooosion/Agm-Direction-Docs

repo_name: explooosion/Agm-Direction-Docs


text:
Customer Segmentation

RFM-Model for Customer Segmentation

Analyzed and performed EDA on customer transaction data.

From transaction data, RFM score is calculated for each customer.

Categorized the customers based on their RFM scores.

Customer clusters are formed based on R, F and, M values using K-Means Algorithm.

![](https://github.com/amarsharma441/Customer-Segmentation/blob/master/Images/RFM.PNG)

![](https://github.com/amarsharma441/Customer-Segmentation/blob/master/Images/clusters.PNG)

## :boy: Owner ##
Made with :heart:   by [Amar Sharma](https://www.linkedin.com/in/amarsharma441)

## :copyright: License ##
MIT © [License](https://github.com/amarsharma441/Customer-Segmentation/blob/master/LICENSE)


text:
---
layout: default
---

# 1994-02-23 - Re: Disinformation (or the Truth?) About Clipper

## Header Data

From<EMAIL_ADDRESS>(Timothy C. May)

To<EMAIL_ADDRESS>Message Hash: 246425086fb73b71cac9c83c3e211d13117e93a56b7d0edcc7c7b0cc79a46394

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1994-02-23 04:17:32 UTC

Raw Date: Tue, 22 Feb 94 20:17:32 PST

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Timothy C. May)
Date: Tue, 22 Feb 94 20:17:32 PST
To<EMAIL_ADDRESS>Subject: Re: Disinformation (or the Truth?) About Clipper
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

My use of the term "disinformation" seems to have taken on a life of
its own as "lying," with several posters saying that the truth is
best, that lying is bad, and that if we have to lie we deserve to have
Clipper and Capstone!

What I urge--and others are free to do as they wish--is to "educate"
people by describing to them the implications as we see them. That is,
we who have thought about Clipper and have seen past government
depredations and abuses, have seen from the beginning how Clipper is
likely to be abused, how the very concept of key escrow is anathema to
basic rights, how Clipper and its Big Brethren (I just coined this)
are likely to be made mandatory, etc. We see truth, not the charade of
"voluntarism" and the "social need" cited by the authorities.

So, is it "truthful" to tell people Clipper is a purely voluntary
standard, which is the official position? Is it "disinformation" to
undermine public support for Clipper by pointing to the very likely
(but unprovable, until it happens) banning of alternatives?

(The difficulty of banning alternatives is another issue, of course.)

I don't advocate ever using out-and-out lies, which is why I said the
following in my post this morning:

> Briefly, "Tell X to Y," where X and Y are the following:
>
> Tell them X:
>
> - Clipper is a wiretapping system

Is there any doubt about this?

> - Clipper has more than one back door

This is more speculative, but fits what folks as eminent as Whit
Diffie have discussed. Backdoors in the escrow system and in the
Skipjack algorithm must be assumed to exist until the algorithm has
been publically discussed, analyzed, tested, etc...and maybe still
even then.

I tell folks the history of other such algorithms, including the
speculations about DES. I point out that Skipjack is completely
secret, and the original key escorw procedure has been changed since
announcement, suggesting a more direct way in was planned from the gitgo.

> - Clipper keys have already been compromised by non-government
> entities

This I will concede is probably not the case. And I suppose I wouldn't
make this claim until more evidence comes out. But as soon as there
are hints that unauthorized wiretaps have occurred, or that foreign
phone calls mean the keys are revealed, etc., this will likely be a
true statement. I suspect it's close to being true.

> - Clipper is for spying on foreign-based corporations

No doubts.

> - Clipper will be used to monitor corporations

No doubts. Foreign subsidiaries mean the NSA can tap, without
warrants. The Criminal Enforcement division of the IRS does not
require warrants, I've been told by a fellow Cypherpunk (but I haven't
confirmed this).

> - Clipper chip makers (Mykotronx, VLSI Tech, National, etc.) have had
> their security systems breached

Recall the "dumpster diving" episode? And there's some stuff about
National's PCMCIA card product that I'm not free to talk about, but it
indicates further leaks are happening.

> - Clipper is Big Brother

A polemical statement, but not a lie.

So, of 7 statements, 5 truths, 1 marginal truth, and 1 wild
speculation.

> - journalists (e.g., I informed John Markoff of some of these things,
> which he mostly knew about--he knows more than I do!-- and the
> strategy of disinformation and sabotage....it made it into his Sunday
> article...and I'm talking to two other journalists now)
>
> (I'm honest with journalists: I tell them upfront that a
> disinformation/sabotage campaign is underway and that they should thus
> take anything I say, or anyone else says, in this light. They're
> usually very bright and see these things anyway, so this clears the
> air. It is not a contradiction to tell them that a
> disinformation/sabotage campaign is underway and then to tell them
> about reports the Clipper chip manufacturers have had security
> compromises. And other such things.)

Disinformation does not necessarily mean outright lying...it often means
putting a twist on things to make a point and to undermine confidence
in the opponent's party line.

Call it counter-propaganda if you wish.

By all means, tell the truth. But be sure to tell what you expect to
be the long-term truth, not just the immediate, official truth.

I tell people the governments of the world are clearly planning for
bans on unapproved, unescrowed encryption. The governments would call
this a lie, saying the Clipper and its Big Brethren are purely
voluntary standards. So who is lying?

--Tim May

--
..........................................................................
Timothy C. May         | Crypto Anarchy: encryption, digital money,
<EMAIL_ADDRESS>     | anonymous networks, digital pseudonyms, zero
408-688-5409           | knowledge, reputations, information markets,
W.A.S.T.E.: Aptos, CA  | black markets, collapse of governments.
Higher Power: 2^859433 | Public Key: PGP and MailSafe available.
"National borders are just speed bumps on the information superhighway."

{% endraw %}
```

## Thread

+ Return to [February 1994](/archive/1994/02)

+ Return to "[Blanc Weber <blancw@microsoft.com>](/authors/blanc_weber_blancw_at_microsoft_com_)"
+ Return to<EMAIL_ADDRESS>(Eric Hughes)](/authors/hughes_at_ah_com_eric_hughes_)"
+ Return to "[Mats Bergstrom <matsb@sos.sll.se>](/authors/mats_bergstrom_matsb_at_sos_sll_se_)"
+ Return to "[Rolf Michelsen <Rolf.Michelsen@delab.sintef.no>](/authors/rolf_michelsen_rolf_michelsen_at_delab_sintef_no_)"
+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_netcom_com_timothy_c_may_)"

+ 1994-02-22 (Tue, 22 Feb 94 12:59:54 PST) - [RE: the black budget](/archive/1994/02/f22ccfbb5b83097cfad8efd96ef8128f47a7016159e74cab51ab82ce0d5dee78) - _Blanc Weber<EMAIL_ADDRESS>  + 1994-02-22 (Tue, 22 Feb 94 13:38:24 PST) - [Disinformation (or the Truth?) About Clipper](/archive/1994/02/ae81cef4b8d63338c0eb73375401c073cf82d991eedddd9524c247282a8ea551) -<EMAIL_ADDRESS>(Timothy C. May)_
    + 1994-02-23 (Tue, 22 Feb 94 20:17:32 PST) - Re: Disinformation (or the Truth?) About Clipper -<EMAIL_ADDRESS>(Timothy C. May)_
    + 1994-02-23 (Wed, 23 Feb 94 00:01:05 PST) - [Re: Disinformation (or the Truth?) About Clipper](/archive/1994/02/963451e76e0b8b56ebf5fddaff1245613dfd11ab3c1f9c7b9e72b32d9b470e19) - _Rolf Michelsen<EMAIL_ADDRESS>    + 1994-02-23 (Wed, 23 Feb 94 08:10:15 PST) - [Re: Disinformation (or the Truth?) About Clipper](/archive/1994/02/c163378da277e95bc3f99792f5b60b497c87b50abd49fb2f850fdc51ef9af354) - _Mats Bergstrom<EMAIL_ADDRESS>  + 1994-02-22 (Tue, 22 Feb 94 14:27:55 PST) - [the black budget](/archive/1994/02/3fcf835a01753708024fdba82605c128cbdfaa4c894bba5eea2c5dd330249b4d) -<EMAIL_ADDRESS>(Eric Hughes)_


text:
---
layout: default
title: Setup / Bootstrap
permalink: /docs/usage/setup/
---

As explained in the [architecture description](/docs/architecture/), Flysystem uses
the _adapter pattern_. This means you'll always need an __adapter__, which needs to
be wrapped in a `Filesystem` instance.

## Adapter Setup

Each adapter has their own setup and dependencies. For each adapter a setup guide is
provided. You can find the guides in the `adapters` section in the menu.

For this example we'll use the local adapter:

```php
<?php

use League\Flysystem\Adapter\Local;

$adapter = new Local(__DIR__.'/path/to/root/');
```

## Setup Filesystem

Now that you've got your adapter setup you can use it to create the filesystem:

```php
<?php

use League\Flysystem\Filesystem;

$filesystem = new Filesystem($adapter);
```

## Global Configuration

Adapters each have their own configuration. Apart from adapter constructors configuration
options can be provided in global configuration through the `Filesystem`.

```php
<?php

use League\Flysystem\Filesystem;

$filesystem = new Filesystem($adapter, ['visibility' => 'public']);
```

The global available configuration options are:

option | description | type
--- | --- | ---
`visibility` | default visibility | `string`
`disable_asserts` | disable extra calls to assert whether or not a file exists, see [Performance](/docs/advanced/performance/) | `bool`
`case_sensitive` | whether or not the adapter's file system is case sensitive, e.g. [Dropbox](/docs/adapter/dropbox/) is case insensitive | `bool`

repository: mabuonomo/flysystem

repo_name: mabuonomo/flysystem


text:
term-hackernews
===============

Command line reader for [Hacker News](https://news.ycombinator.com/) using [node-term-list](https://github.com/visionmedia/node-term-list)

## run it

    $ npm install && node newsyc.js

## use it

 * up/down arrow keys to navigate
 * `return` opens the article
 * `space` opens the comment page
 * `q` to exit

repository: josephyzhou/term-hackernews

repo_name: josephyzhou/term-hackernews


text:
---
title: "trialML: Preparing a machine learning model for a statistical trial"
output: html_document
fontsize: 12pt
published: true
status: publish
mathjax: true
---

This post summarizes a newly released `python` package: [`trialML`](https://pypi.org/project/trialML/). This package is designed to help researchers and practitioners prepare their machine learning models for a statistical trial to establish a lower-bound on model performance. Specifically, this package helps to calibrating the operating threshold of a binary classifier and carry out a power analysis. A more formal description of these techniques can be found in the corresponding [arXiv paper](https://arxiv.org/abs/).

## Features

The main modules from `trialML` can be called in with one line of code: `from trialML import trial, power`. Their key methods are outlined below, and are described with more detail by the docstrings (e.g. `help('trialML.trial.classification')`).

1. `trial.classification(gamma, m, alpha)`: determine optimal threshold and calculate power of future trial
    1. `statistic(y, s, threshold, pval=..)`: return the performance measure for a given threshold (and possibly p-value from null hypothesis)
    2. `learn_threshold(y, s, method='..')`: calibrate the opearting threshold to obtain at least `gamma` 1-`alpha`% of the time.
    3. `calculate_power(spread, n_trial, threshold)`: estimate power for a given trial sample size and null hypothesis margin (spread). Threshold can be provided to estimate percent of samples that are class-specific.
2. `power.twosided_classification(m1, m2, alpha)`: estimate performance measure and power range (confidence interval) for two performance measures: `m1` and `m2`.
    1. `set_threshold(y, s, gamma1)`: Set the threshold to get a performance level of `gamma1` for the first performance measure `m1`.
    2. `statistic_CI(y, s, threshold)`: Get the (1-`alpha`) confidence interval for the empirical values of `m1` and `m2`.
    3. `statistic_pval(y, s, gamma0)`: Get the p-value on trial data for a given null hypothesis.

## How to use

The code blocks below provide two examples on different calibration exercises. The first shows shows how to pick a conservative operating threshold so that the classier will have a 95% likelihood of generalizing to at least 50% sensitivity. After this calibration, a trial is run and a test statistic value is returned. The second example shows how to estimate the range of performance measures and power for two test statistics for a given threshold estimated by a point estimate. See the [tutorials](https://github.com/ErikinBC/trialML/tree/main/trialML/tutorials) folder for more information.

### (i) Calibrating for sensitivity

```python
# Load modules
import numpy as np
from sklearn.linear_model import LogisticRegression
from trialML.trial import classification

## (1) Train a model and obtain scores on a test set
np.random.seed(1)
n, p = 150, 10
k1, k2 = 50, 100
X, y = np.random.randn(n, p), np.random.binomial(1, 0.5, n)
X_train, y_train, X_test, y_test = X[:k1], y[:k1], X[k1:k2], y[k1:k2]
mdl = LogisticRegression(penalty='none', solver='lbfgs')
mdl.fit(X=X_train, y=y_train)
# test set scores
s_test = mdl.predict_proba(X_test)[:,1]
s_test = np.log(s_test / (1-s_test))  # logit transform

## (2) Calibrate operating threshold to achieve 50% sensitivity, 95% of the time
gamma = 0.5  # performance measure target
alpha = 0.05  # type-I error rate for threshold selection
m = 'sensitivity'  # currently supports sensitivity/specificity/precision

# Set up statistical tool
calibration = classification(gamma=gamma, alpha=alpha, m=m)
# Learn threshold
calibration.learn_threshold(y=y_test, s=s_test, method='percentile', n_bs=1000, seed=1)
# Observe test-set performance
gamma_hat_test = calibration.statistic(y=y_test, s=s_test, threshold=calibration.threshold_hat)
print('Empirical sensitivity on test-set: %0.1f%%' % (100*gamma_hat_test))

## (3) Estimate power for trial data
X_trial, y_trial = X[k1:], y[k1:]
n_trial = len(X_trial)
gamma0 = 0.45
spread = gamma - gamma0

calibration.calculate_power(spread, n_trial, threshold=calibration.threshold_hat)
print('Expected trial power for a %0.1f%% margin is at least %0.1f%%' % (100*spread, 100*calibration.power_hat))

## (4) Run trial
s_trial = mdl.predict_proba(X_trial)[:,1]
s_trial = np.log(s_trial / (1-s_trial))  # logit transform
gamma_trial, pval_trial = calibration.statistic(y=y_trial, s=s_trial, gamma0=gamma0, threshold=calibration.threshold_hat)
print('Trial sensitivity: %0.1f%%, trial null-hypothesis: %0.1f%%, trial p-value: %0.5f' % (100*gamma_trial, 100*gamma0, pval_trial))
```

### (ii) Joint estimation for sensitivity and specificity

```python

# Load modules
import numpy as np
from sklearn.linear_model import LogisticRegression
from trialML.power import twosided_classification

## (1) Train a model and obtain scores on a test set
np.random.seed(1)
n, p = 150, 10
k1, k2 = 50, 100
X, y = np.random.randn(n, p), np.random.binomial(1, 0.5, n)
X_train, y_train, X_test, y_test = X[:k1], y[:k1], X[k1:k2], y[k1:k2]
X_trial, y_trial = X[k1:], y[k1:]
mdl = LogisticRegression(penalty='none', solver='lbfgs')
mdl.fit(X=X_train, y=y_train)
# test set scores
s_test = mdl.predict_proba(X_test)[:,1]
s_test = np.log(s_test / (1-s_test))  # logit transform

## (2) Select a point on the ROC curve when sensitivity equals 50%
m1 = 'sensitivity'
m2 = 'specificity'
alpha = 0.05  # type-I error rate for test
gamma1 = 0.5  # for sensitivity
power_2s = twosided_classification(m1, m2, alpha)
power_2s.set_threshold(y=y_test, s=s_test, gamma1=gamma1)

## (3) Get performance range
df_gamma = power_2s.statistic_CI(y=y_test, s=s_test, threshold=power_2s.threshold)
df_gamma.round(3)

## (4) Estimate power range
n_trial = len(X_trial)
margin = 0.05
df_power = power_2s.get_power(n_trial=n_trial, margin=margin, adjust=True)
df_power.round(3)

## (5) Run trial
gamma0 = df_gamma['gamma_hat'] - margin
s_trial = mdl.predict_proba(X_trial)[:,1]
s_trial = np.log(s_trial / (1-s_trial))  # logit transform
df_trial = power_2s.statistic_pval(y=y_trial, s=s_trial, gamma0=gamma0)
df_trial.round(3)
```

## How to install

`trialML` is available on [PyPI](https://pypi.org/project/trialML/) can be installed in one line: `pip install trialML`.


text:
# µunit
Minimal, freestanding unit testing for C.

µunit has three simple goals in mind:
 1. Lightweight and freestanding; no memory allocator necessary.
 2. Tiny and simple; it's just a single .h file.
 3. Easy to use.

Show me
-------

Here's a little contrived example of how to set up a couple of tests.

```c
# include <assert.h>
# include <stdio.h>
# include "uunit.h"

extern int myVar;
extern int myOtherVar;

unittest {
    printf("Testing myVar.\n");
    assert(myVar == SOME_VALUE);
}

unittest {
    printf("Testing myOtherVar.\n");
    assert(myOtherVar == SOME_OTHER_VALUE);
}

 . . .

```

µunit consists of just a single header, so including `"uunit.h"` is all that's needed to set it up. It doesn't need a standard library, and doesn't use a memory allocator.

Can I disable unit testing?
---------------------------

Yes. Defining either `NDEBUG` or `NUNITTEST` will stop unit tests from being generated entirely. When disabled `unittest` will expand to an unused function which is discarded by the compiler.

License
-------

µunit is available under the MIT license.

repository: mintyfresh/uunit

repo_name: mintyfresh/uunit


text:
# samebirthday

A Python 3.6+ script that, handed _your birthday_ (or any date, whatever) in `YYYY-MM-DD` format, grabs the "#Birth" list from the Wikipedia page for that specific day ([like this one](https://en.wikipedia.org/wiki/July_12#Births)) and prints out all of the Wikipedia-famous people who share your birthday.

I'm using `pipenv` to manage the two dependencies (`requests` and `bs4`), but use whatever makes you happiest.

Sample usage, assuming you're in your virtual environment: `python samebday.py "1945-07-12"`.

Redirect to a text file: `python samebday.py "1945-07-12" > my_birthday_buds.txt`

repository: cjwinchester/samebirthday

repo_name: cjwinchester/samebirthday


text:
# Admin API

## Introduction
It is important to note the purpose of the Administration API: **It is a cache, not a permanent data store**. It is designed such that external data sources can load objects into the cache for optimizing in two different ways: Fast Lookup, and On-Demand Lookup
Fast Lookup is ideal for storage methods which do not have inherently fast lookup, but are small enough to be easily cached in memory. The flat file implementation admin format of SourceMod fits this scenario. The entire file is read and stored in the cache.
On-Demand Lookup is ideal for storage methods which work over a network, or contain a large number of entries unsuitable for full retrieval, but fast atomic lookup. This is what SQL is good at. The SQL implementation of the SourceMod admin reader only stores admins in the cache once they have connected.
Note the difference between the two: In the first example, the cache is being used as a lookup mechanism itself, as well as storing the permissions. In the second example, the cache is being used only to store permissions, since lookup was done by the SQL server.

## Permissions
### Admin Flags
Permissions are granted through the AdminFlag data type. Each flag specifies an action or permission type that requires administrative access. For each admin, the set of flags which are enabled is called the admin's effective permissions.
AdminFlags are stored in a variety of ways to account for various coding flexibilities. Functions to convert in between these storage methods are available in the administration APIs for both C++ extensions and Pawn scripts.

* **AdminFlag**: Represents a single admin permission as part of an enumeration.
* **AdminFlag\[\]**: Represents an array of AdminFlags in no specific order, each member being a different flag enabled.
* **bool[]**: Represents a bit array, where each index i of the array specifies whether AdminFlag i is enabled (true) or disabled (false).
* **FlagBits**: Represents an unsigned 32bit integer, where each bit n of the integer specifies whether AdminFlag n is enabled (bit 1) or disabled (bit 0). Convenience macros are available for dealing with bitwise numbers. They are found in IAdminSystem.h and each start with ADMFLAG instead of Admin.

### Overrides
Permissions can also be granted through overrides. Overrides are specific permissions that override the default effective permissions. They can act on both commands and command groups (a command group is a set of commands under a common name). There are two types of overrides:

* **Global Overrides**: These override the default admin flag(s) required for a given command or command group.
* **Group Overrides**: These override whether members of the group can or cannot access a given command.

### Immunity
Immunity in SourceMod is based on immunity levels, which are arbitrary numbers greater than or equal to zero. If an admin has an immunity level of 0, that admin has no immunity. An admin can only target other admins if their immunity level is greater than or equal to the target's immunity level. This functionality can be tweaked via sm_immunity_mode in cfg/sourcemod.cfg.
When checking for immunity, the following heuristics are performed in this exact order:

* If the targeting client is not an admin, targeting fails.
* If the targetted client is not an admin, targeting succeeds.
* If the targeting client has ADMIN_ROOT, targeting succeeds.
* If the targetted client has ADMIN_IMMUNITY AND the targeting client does not have ADMIN_UNIMUNIZE, targeting fails.
* If no conclusion is reached via the previous steps, targeting succeeds.

The primary function for computing immunity is Plugin::canUserTarget().

## Cache Types
There are three cache types in the Administration API. To invalidate a cache means to entirely delete it and rebuild it from scratch. Rebuilding a cache means requesting each IAdminListener to rebuild that portion of the cache. Aside from rebuilding a cache, there are generally three major operations to each cache: Reading, Appending (adding new settings), and Deleting (deleting individual records).

* **Global Override Cache**: Holds global overrides.
	* Invalidation: Atomic
	* Readable: Yes
	* Appendable: Yes
	* Deletable: Yes
* **User Cache**: Holds Admin User objects.
	* Invalidation: Atomic
	* Readable: Yes
	* Appendable: Yes
	* Deletable: Yes
* **Group Cache**: Holds Admin Group objects.
	* Invalidation: Invalidates self and Admin Cache.
	* Readable: Yes
	* Appendable: Yes
	* Deletable: No

### Global Override Cache
The global override cache stores information about global overrides. Every operation to this cache occurs both retroactively and for future command creations. An override need not be tied to a command; however, if a command has the same name, the command will inherit that override's permissions.
#### Writing/Appending
New entries to the global override cache will affect both already existing commands and future commands registered during the cache's lifetime.
Each command can be assigned any or no access flags.
#### Deleting/Invalidation
Deleting a part or the whole of the global override cache will cause affected commands to revert to their original access behavior.
### Group Cache
The group cache scores all information about current groups. It is designed to be quite static, and thus modifying groups in memory is not very flexible.
Groups have a few important properties:

* **Add Flags**: These are flags added to any user who inherits the group.
* **Immunity**: Specifies rules for which admins cannot target this group.
* **Immunity Level**: If a user inheriting the group has a lower immunity level than this number, they inherit the new higher value from the group.
* **Specific**: Immunity from a list of specific groups.

#### Writing/Appending
* Add Flags**: These can be modified at any time. However, users which inherit the group will not have their member permissions updated for performance reasons.
* **Immunity**: Default and global immunity can be changed at any time. Users inheriting the group will be affected by the changes. Specific immunity can have new groups added (and it will affect member admins).
* **Overrides**: Overrides can be changed between allow or deny at any time.

#### Deleting/Invalidation
Per-group immunities cannot be removed once added. Groups themselves cannot be removed either, as this would be a potentially expensive operation. Instead, the entire group cache must be rebuilt (and with it, the admin cache). The goal with this design decision is to make group invalidations rare. In order to change a group fully, the entire admin cache must be "refreshed".

### Admin/User Cache
The user cache stores all information about currently known admins. Users stored can either be live (as in, their permissions are currently in use by a player), or idle (cached for future lookup).
Users have the following properties:

* **Flags**: These are the permission flags the admin inherits by default.
* **Effective Flags**: These are the permission flags the admin has at runtime. They are a combination of the base flags and the flags inherited from groups.
* **Groups**: The groups the admin is a member of.
* **Password**: A generic password that an authentication method might require.
* **Identities**: One or more mappings between authentication methods and unique identification strings.

#### Writing/Appending
* **Flags**: Flags can be changed at any time. Changing flags will affect effective flags, even if done after groups are inherited.
* **Groups**: Groups can be inherited at any time, although a group cannot be inherited twice. Permissions inherited from groups cannot be updated (yet).
* **Password**: Passwords can be changed at any time.
* **Identities**: Identities can be added, but not changed or removed.

#### Deleting/Invalidation
Groups cannot be removed from an admin's inherited group list. However, admins can be invalidated. This lets an authentication system, such as SQL, remove individual admins to refresh their privileges. Resources used by an admin object are always reclaimed efficiently.

repository: ScottLync/PRISM

repo_name: ScottLync/PRISM


text:
# CUFD
Code of [CUFD: An encoder-decoder network for visible and infrared image fusion based on common and unique feature decomposition](https://www.sciencedirect.com/science/article/pii/S1077314222000352)

Tips
---------
#### To train:

* Step1: Download [training dataset](https://pan.baidu.com/s/1yKJZu15aeSzqEjMjn-6Kag?pwd=0v11) or create your own training dataset by [code](https://github.com/hanna-xu/utils).
* Step2: In main.py, keep `IS_TRAINING==True` and choose the function train_part1.py (the 29th line in main.py), and then run main.py.
* Step3: In main.py, keep `IS_TRAINING==True` and choose the function train_part2.py (the 31th line in main.py), and then run main.py.

#### To test with the pre-trained model:

* In main.py, keep `IS_TRAINING==False`, and run main.py.

If this work is helpful to you, please cite it as:
```
@article{xu2022cufd,
  title={CUFD: An encoder--decoder network for visible and infrared image fusion based on common and unique feature decomposition},
  author={Xu, Han and Gong, Meiqi and Tian, Xin and Huang, Jun and Ma, Jiayi},
  journal={Computer Vision and Image Understanding},
  pages={103407},
  year={2022},
  publisher={Elsevier}
}
```
If you have any question, please email to me (meiqigong@whu.edu.cn).

repository: Linfeng-Tang/VIF-Benchmark

branch_name: refs/heads/main

repo_name: Linfeng-Tang/VIF-Benchmark


text:
# Developer guide for beginners on contributing to Fluent Bit

Assuming you have some basic knowledge of C, this guide should help you understand how to make code changes to Fluent Bit.

## Libraries

Most external libraries are embedded in the project in the [/lib](https://github.com/fluent/fluent-bit/tree/master/lib) folder. To keep its footprint low and make cross-platform builds simple, Fluent Bit attempts keep its dependency graph small.

The external library you are mostly likely to interact with is [msgpack](https://github.com/msgpack/msgpack-c).

For cryptographic support, Fluent Bit uses the system installed version of OpenSSL.
Please make sure to install openssl libraries and headers before building Fluent Bit.

### Memory Management

When you write Fluent Bit code, you will use Fluent Bit's versions of the standard C functions for working with memory:

* [`flb_malloc()`](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_mem.h) - equivalent to `malloc`, allocates memory.
* [`flb_calloc()`](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_mem.h)  - equivalent to `calloc`, allocates memory and initializes it to zero.
* [`flb_realloc()`](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_mem.h) - equivalent to `realloc`.
* [`flb_free()`](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_mem.h) - equivalent to `free`, releases allocated memory.

Note that many types have a specialized create and destroy function. For example, [`flb_sds_create()` and `flb_sds_destroy()`](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_sds.h) \(more about this in the next section\).

### Strings

Fluent Bit has a stripped down version of the popular [SDS](https://github.com/antirez/sds) string library. See [flb\_sds.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_sds.h) for the API.

In general, you should use SDS strings in any string processing code. SDS strings are fully compatible with any C function that accepts a null-terminated sequence of characters; to understand how they work, see the [explanation on Github](https://github.com/antirez/sds#how-sds-strings-work).

### HTTP Client

Fluent Bit has its own network connection library. The key types and functions are defined in the following header files:

* [flb\_upstream.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_upstream.h)
* [flb\_http\_client.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_http_client.h)
* [flb\_io.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_io.h)

The following code demonstrates making an HTTP request in Fluent Bit:

```c
#include <fluent-bit/flb_upstream.h>
#include <fluent-bit/flb_io.h>
#include <fluent-bit/flb_http_client.h>
#include <fluent-bit/flb_info.h>
#include <fluent-bit/flb_config.h>

#define HOST  "<IP_ADDRESS>"
#define PORT  80

static flb_sds_t make_request(struct flb_config *config)
{
    struct flb_upstream *upstream;
    struct flb_http_client *client;
    size_t b_sent;
    int ret;
    struct flb_upstream_conn *u_conn;
    flb_sds_t resp;

    /* Create an 'upstream' context */
    upstream = flb_upstream_create(config, HOST, PORT, FLB_IO_TCP, NULL);
    if (!upstream) {
        flb_error("[example] connection initialization error");
        return -1;
    }

    /* Retrieve a TCP connection from the 'upstream' context */
    u_conn = flb_upstream_conn_get(upstream);
    if (!u_conn) {
        flb_error("[example] connection initialization error");
        flb_upstream_destroy(upstream);
        return -1;
    }

    /* Create HTTP Client request/context */
    client = flb_http_client(u_conn,
                             FLB_HTTP_GET, metadata_path,
                             NULL, 0,
                             FLB_FILTER_AWS_IMDS_V2_HOST, 80,
                             NULL, 0);

    if (!client) {
        flb_error("[example] count not create http client");
        flb_upstream_conn_release(u_conn);
        flb_upstream_destroy(upstream);
        return -1;
    }

    /* Perform the HTTP request */
    ret = flb_http_do(client, &b_sent)

    /* Validate return status and HTTP status if set */
    if (ret != 0 || client->resp.status != 200) {
        if (client->resp.payload_size > 0) {
            flb_debug("[example] Request failed and returned: \n%s",
                      client->resp.payload);
        }
        flb_http_client_destroy(client);
        flb_upstream_conn_release(u_conn);
        flb_upstream_destroy(upstream);
        return -1;
    }

    /* Copy payload response to an output SDS buffer */
    data = flb_sds_create_len(client->resp.payload,
                              client->resp.payload_size);

    flb_http_client_destroy(client);
    flb_upstream_conn_release(u_conn);
    flb_upstream_destroy(upstream);

    return resp;
}
```

An `flb_upstream` structure represents a host/endpoint that you want to call. Normally, you'd store this structure somewhere so that it can be re-used. An `flb_upstream_conn` represents a connection to that host for a single HTTP request. The connection structure should not be used for more than one request.

### Linked Lists

Fluent Bit contains a library for constructing linked lists- [cfl\_list](https://github.com/fluent/fluent-bit/blob/master/lib/cfl/include/cfl/cfl_list.h). The type stores data as a circular linked list.

The [`cfl_list.h`](https://github.com/fluent/fluent-bit/blob/master/lib/cfl/include/cfl/cfl_list.h) header file contains several macros and functions for use with the lists. The example below shows how to create a list, iterate through it, and delete an element.

```c
#include <cfl/cfl.h>
#include <fluent-bit/flb_info.h>

struct item {
    char some_data;

    struct cfl_list _head;
};

static int example()
{
    struct cfl_list *tmp;
    struct cfl_list *head;
    struct cfl_list items;
    int i;
    int len;
    char characters[] = "abcdefghijk";
    struct item *an_item;

    len = strlen(characters);

    /* construct a list */
    cfl_list_init(&items);

    for (i = 0; i < len; i++) {
        an_item = flb_malloc(sizeof(struct item));
        if (!an_item) {
            flb_errno();
            return -1;
        }
        an_item->some_data = characters[i];
        cfl_list_add(&an_item->_head, &items);
    }

    /* iterate through the list */
    flb_info("Iterating through list");
    cfl_list_foreach_safe(head, tmp, &items) {
        an_item = cfl_list_entry(head, struct item, _head);
        flb_info("list item data value: %c", an_item->some_data);
    }

    /* remove an item */
    cfl_list_foreach_safe(head, tmp, &items) {
        an_item = cfl_list_entry(head, struct item, _head);
        if (an_item->some_data == 'b') {
            cfl_list_del(&an_item->_head);
            flb_free(an_item);
        }
    }
}
```

### Message Pack

Fluent Bit uses [msgpack](https://msgpack.org/index.html) to internally store data. If you write code for Fluent Bit, it is almost certain that you will interact with msgpack.

Fluent Bit embeds the [msgpack-c](https://github.com/msgpack/msgpack-c) library. The example below shows manipulating message pack to add a new key-value pair to a record. In Fluent Bit, the [filter\_record\_modifier](https://github.com/fluent/fluent-bit/tree/master/plugins/filter_record_modifier) plugin adds or deletes keys from records. See its code for more.

```c
#define A_NEW_KEY        "key"
#define A_NEW_KEY_LEN    3
#define A_NEW_VALUE      "value"
#define A_NEW_VALUE_LEN  5

static int cb_filter(const void *data, size_t bytes,
                     const char *tag, int tag_len,
                     void **out_buf, size_t *out_size,
                     struct flb_filter_instance *f_ins,
                     void *context,
                     struct flb_config *config)
{
    (void) f_ins;
    (void) config;
    size_t off = 0;
    int i = 0;
    int ret;
    struct flb_time tm;
    int total_records;
    int new_keys = 1;
    msgpack_sbuffer tmp_sbuf;
    msgpack_packer tmp_pck;
    msgpack_unpacked result;
    msgpack_object  *obj;
    msgpack_object_kv *kv;

    /* Create temporary msgpack buffer */
    msgpack_sbuffer_init(&tmp_sbuf);
    msgpack_packer_init(&tmp_pck, &tmp_sbuf, msgpack_sbuffer_write);

    /* Iterate over each item */
    msgpack_unpacked_init(&result);
    while (msgpack_unpack_next(&result, data, bytes, &off) == MSGPACK_UNPACK_SUCCESS) {
        /*
         * Each record is a msgpack array [timestamp, map] of the
         * timestamp and record map. We 'unpack' each record, and then re-pack
         * it with the new fields added.
         */

        if (result.data.type != MSGPACK_OBJECT_ARRAY) {
            continue;
        }

        /* unpack the array of [timestamp, map] */
        flb_time_pop_from_msgpack(&tm, &result, &obj);

        /* obj should now be the record map */
        if (obj->type != MSGPACK_OBJECT_MAP) {
            continue;
        }

        /* re-pack the array into a new buffer */
        msgpack_pack_array(&tmp_pck, 2);
        flb_time_append_to_msgpack(&tm, &tmp_pck, 0);

        /* new record map size is old size + the new keys we will add */
        total_records = obj->via.map.size + new_keys;
        msgpack_pack_map(&tmp_pck, total_records);

        /* iterate through the old record map and add it to the new buffer */
        kv = obj->via.map.ptr;
        for(i=0; i < obj->via.map.size; i++) {
            msgpack_pack_object(&tmp_pck, (kv+i)->key);
            msgpack_pack_object(&tmp_pck, (kv+i)->val);
        }

        /* append new keys */
        msgpack_pack_str(&tmp_pck, A_NEW_KEY_LEN);
        msgpack_pack_str_body(&tmp_pck, A_NEW_KEY, A_NEW_KEY_LEN);
        msgpack_pack_str(&tmp_pck, A_NEW_VALUE_LEN);
        msgpack_pack_str_body(&tmp_pck, A_NEW_VALUE, A_NEW_VALUE_LEN);

    }
    msgpack_unpacked_destroy(&result);

    /* link new buffers */
    *out_buf  = tmp_sbuf.data;
    *out_size = tmp_sbuf.size;
    return FLB_FILTER_MODIFIED;
```

Please also check out the message pack examples on the [msgpack-c GitHub repo](https://github.com/msgpack/msgpack-c).

## Plugin API

Each plugin is a shared object which is [loaded into Fluent Bit](https://github.com/fluent/fluent-bit/blob/1.3/src/flb_plugin.c#L70) using dlopen and dlsym.

### Input

The input plugin structure is defined in [flb\_input.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_input.h#L62). There are a number of functions which a plugin can implement, most only implement `cb_init`, `cb_collect`, and `cb_exit`.

The [`"dummy"` input plugin](https://github.com/fluent/fluent-bit/tree/master/plugins/in_dummy) is very simple and is an excellent example to review to understand more.

Note that input plugins can use threaded mode if the flag `FLB_INPUT_THREADED` is provided.
To enable threading in your plugin, add the `FLB_INPUT_THREADED` to the set of `flags` when registering:

```c
struct flb_input_plugin in_your_example_plugin = {
    .name         = "your example",
    .description  = "Ingest example data",
    .cb_init      = in_your_example_init,
    .cb_pre_run   = NULL,
    .cb_collect   = in_your_example_collect,
    .cb_flush_buf = NULL,
    .config_map   = config_map,
    .cb_pause     = in_your_example_pause,
    .cb_resume    = in_example_resume,
    .cb_exit      = in_example_exit,
    .flags        = FLB_INPUT_THREADED
};
```

### Filter

The structure for filter plugins is defined in [flb\_filter.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_filter.h#L44). Each plugin must implement `cb_init`, `cb_filter`, and `cb_exit`.

The [filter\_record\_modifier](https://github.com/fluent/fluent-bit/tree/master/plugins/filter_record_modifier) is a good example of a filter plugin.

Note that filter plugins can not asynchronously make HTTP requests. If your plugin needs to make a request, add the following code when you initialize your `flb_upstream`:

```c
/* Remove async flag from upstream */
upstream->flags &= ~(FLB_IO_ASYNC);
```

### Output

Output plugins are defined in [flb\_output.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_output.h#L57). Each plugin must implement `cb_init`, `cb_flush`, and `cb_exit`.

The [stdout plugin](https://github.com/fluent/fluent-bit/tree/master/plugins/out_stdout) is very simple; review its code to understand how output plugins work.

## Development Environment

Fluent Bit provides a standalone environment for development.
Developers who use different OS or distributions can develop on a simple, common stack.
The development environment provides the required libraries and tools for you.

Development environments provided for
- [Devcontainer](https://github.com/fluent/fluent-bit/blob/master/DEVELOPER_GUIDE.md#devcontainer)
- [Vagrant](https://github.com/fluent/fluent-bit/blob/master/DEVELOPER_GUIDE.md#vagrant).

## Testing

During development, you can build Fluent Bit as follows:

```text
cd build
cmake -DFLB_DEV=On ../
make
```

Note that Fluent Bit uses Cmake 3 and on some systems you may need to invoke it as `cmake3`.

To enable the unit tests run:

```text
cmake -DFLB_DEV=On -DFLB_TESTS_RUNTIME=On -DFLB_TESTS_INTERNAL=On ../
make
```

Internal tests are for the internal libraries of Fluent Bit. Runtime tests are for the plugins.

You can run the unit tests with `make test`, however, this is inconvenient in practice. Each test file will create an executable in the `build/bin` directory which you can run directly. For example, if you want to run the SDS tests, you can invoke them as follows:

```text
$ ./bin/flb-it-sds
Test sds_usage...                               [   OK   ]
Test sds_printf...                              [   OK   ]
SUCCESS: All unit tests have passed.
```

## Need more help?

The best way to learn how Fluent Bit code works is to read it. If you need help understanding the code, reach out to the community, or open a PR with changes that are a work in progress.

repository: fluent/fluent-bit-docs

gha_language: Shell

repo_name: fluent/fluent-bit-docs


text:
# [What is a Reverse Proxy vs. Load Balancer](https://www.nginx.com/resources/glossary/reverse-proxy-vs-load-balancer/)

* Reverse proxy accepts a request from a client, forwards the request to a server, and returns the server's response to the client
* Load balancer distributes requests from clients across a group of servers and returns the server's response to the appropriate client
* Load balancer use cases
  * Eliminating a single point of failure
  * Can detect when a server goes down and diverts requests from that server to other servers in the group
  * Session persistence - sending all the requests from a particular client to the same server
    * Allows persisting the shopping basket for an e-commerce site
* Reverse proxy use cases
  * Can still be used when single server (vs. load balancer which is used with group of servers)
  * Abstracts away internal services and serves as public interface
    * Malicious clients cannot directly access servers
    * Many reverse proxies implement DDoS protection
    * Can scale servers up and down since clients only see reverse proxy's IP address
  * Web acceleration
    * SSL termination - reverse proxies can decrypt incoming requests and encrypt server responses so servers don't have to do any of that
    * Reverse proxy can cache response for identical request increasing response time and reducing load on servers

repository: jaebradley/notes

repo_name: jaebradley/notes


text:
---
title: Streamlit Cloud (Teams and Enterprise)
slug: /streamlit-cloud/enterprise
---

## Streamlit Cloud (Teams and Enterprise)

Streamlit Cloud Teams and Enterprise tiers enable you to securely deploy, manage, and share your Streamlit apps within your company, customers, and partners.

<Note>

If you're completely new to Streamlit, check out our [Get started with Streamlit](/library/get-started) page!

</Note>

### Get started — launch your first app!

You should already have access to your workspace, so log in and start deploying apps 😁. Here is a quick get started guide with links to more documentation. We'd also love to hop on a call with you to go over any of your apps and any feedback or questions you have.

1. **Log in to your dashboard** 👩🏻💻

    Go to [share.streamlit.io](https://share.streamlit.io/) and click to authenticate with GitHub. If that fails it means that we don't have that GitHub account allow-listed, so just send the username to your Streamlit contact and we'll get it listed for you.

2. **Grant repo access** 👑

    When you log in for the first time you will need to grant access to the GitHub private repo you wish to use for your apps. An admin of the repo must grant the access, so if you are not an admin, please get them a Streamlit Cloud account so they can grant access.

3. **Launch a test app! 🎈**

    We suggest doing a sample deployment to get used to the interface. Follow along in the [deployment instruction guide](/streamlit-cloud/community) to deploy your first app. For your full apps you'll want to make sure your secrets and viewer auth are set up before launching the app.

4. **Set up secrets** 🗝

    Secure access to the data for your app with secrets management. Read the [documentation on using secrets](/streamlit-cloud/community#secrets-management). We also have a number of [guides on how to connect to different cloud services](/knowledge-base/tutorials/databases).

5. **Set up viewer auth** 🔒

    Lock down your app to a certain set of viewers using Google OAuth or one of several other single sign-on platforms. Read the [documentation on viewer auth](/streamlit-cloud/enterprise/single-sign-on-sso).

6. **Let us help!** 🙌

    No question is too small, no request too big. Let us know how we can help - whether it's more resources for an app, a step that is frustrating you, or the need for ideas on how to improve your app. Just ping your Streamlit contact or email<EMAIL_ADDRESS>
## A guide to Streamlit Cloud - Teams and Enterprise features

- **Private repos**

    Keep your code in your GitHub private repos and connect them to your Streamlit for Teams account to deploy apps and run CI/CD.

- **One-click deploy**

    Deploy apps directly from your GitHub repos. Just connect Streamlit for Teams to the repo, select the app file, and we'll do the rest!

    [One-click deploy documentation](/streamlit-cloud/community#deploy-your-app)

- **Secrets management**

    Securely access any data store or API from your Streamlit app by storing access credentials in encrypted secrets on our secure platform. Use them with `st.secrets`.

    [Secrets management documentation](/streamlit-cloud/community#secrets-management)

- **Single sign-on viewer authentication**

    Restrict access to your app to a selected set of users. Single sign-on with Google OAuth is currently supported, along with several other common platforms.

    [Single Sign-on documentation](/streamlit-cloud/enterprise/single-sign-on-sso)

- **App management**

    View apps, reboot, delete and inspect logs. If you need extra app resources, ping your Streamlit contact and we'll help configure it.

    [App management documentation](/streamlit-cloud/community#deploy-your-app)

- **Admin interface**

    Manage billing, view usage, and configure other team-wide settings.

<!-- ## Troubleshooting

### I'm not able to log in to the dashboard

We probably have the wrong username or email for you. Just ping your Streamlit contact and we'll quickly get you access.

### My repo isn't showing on the Deploy page

It's possible it just isn't showing up even though it is already there. Try typing it in. If we don't recognize it, you'll see the message below with a link to click and give access.

![Streamlit Cloud repo access](/images/repo_access.png)

If for some reason that doesn't work, please try logging out and back in again to make sure the change took effect. And if that doesn't work - please let us know and we'll get you sorted!

### I need to set a specific Python version for my app

When deploying an app, under advanced settings, you can choose which version of Python you wish your app to use.

![Streamlit Cloud Python version](/images/python_version.png)

### How do I store files locally?

If you want to store your data locally as opposed to in a database, you can store the file in your GitHub repository. Streamlit is just python, so you can read the file using `pandas.read_csv("data.csv")` or `open("data.csv")`

Note: if you have really big or binary data that you change frequently, and git is feeling slow, you might want to check out  [Git Large File Store (LFS)](https://git-lfs.github.com/) as a better way to store large files in GitHub. You don't need to make any changes to your app to start using it. If your GitHub repo uses LFS, it will now "just work" with Streamlit.

### My app is running into issues while deploying

Check the terminal on the right side of the screen to see the logs. Often the trouble is due to a dependency not being declared. See here for [more information on dependency management](/streamlit-cloud/community#add-python-dependencies).

If that's not the issue, then please send your Streamlit contact the logs and warning you are seeing and we'll help get you sorted!

### My app is hitting resource limits / my app is running very slowly

If your app is running slowly or you're hitting the 'Argh' page then just let us know and we'll adjust the limits for you. If you know in advance you are going to need more resources, also just let us know so we can set them up for you before you run into issues.

## Frequently Asked Questions

### How can I get help with my app?

If you have any questions, feedback, run into any issues, or need to reach us, you can

- Ask on the [forum](https://discuss.streamlit.io) ⬅ this is best for any question related to the open source library
- Email us at [support<EMAIL_ADDRESS>⬅ this is best for anything related to the app platform - deployment, SSO, etc.

If you want, we are also happy to help lend an eye on your app development. Just shoot us a note if you want to share some code or have our team take a look at your app and give you some tips.

### How will Streamlit secure my data?

Streamlit takes a number of measures to ensure your code, data, and apps are all secure. Read more in the [Streamlit for Teams Security Memo](/streamlit-cloud/enterprise/security-model).

### How do I add viewers to my Streamlit apps?

Before viewer authentication is added via single sign-on, [apps are secured via password protection](https://www.notion.so/Authentication-without-SSO-4319c6135b4b4ed58355fc06b33cac74). To give someone access, you just need to set up a password for them.

### Do viewers need access to the GitHub repo?

Nope! You only need access to the GitHub repo if you want to push changes to the app.

### Are there limits to resources or to viewers that I can have?

We want you to use as freely as possible, so just use as you naturally would! If you encounter any resource limitations, just send us a note and we'll get it adjusted for you.

### When will I be charged?

The beta period is free because we want your feedback! At the end of the beta (as per the beta terms you signed) we will then have a call to see how you're using Streamlit Cloud and what package makes the most sense for you.

### When will feature XYZ be added to the beta?

We will do our best to keep the timeline above updated and to proactively update you with anything coming soon, but you can always ask! Just reach out to your Streamlit contact.

### Can I get a custom URL for my app?

Not yet available in the beta. But this is planned for after the Streamlit Cloud launch. You can obviously do your own DNS redirects. If you want some more thoughts on this just ping your Streamlit contact.

Thanks for using Streamlit for Teams. We look forward to hearing your feedback 🎈 -->

repository: fredzannarbor/docs

repo_name: fredzannarbor/docs