text:
# masai_service_discovery_api

DiscoverySearchEngine - JavaScript client for masai_service_discovery_api
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
This SDK is automatically generated by the link:https://github.com/swagger-api/swagger-codegen[Swagger Codegen] project:

- API version: v1
- Package version: v1
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen

## Installation

### For link:https://nodejs.org/[Node.js]

#### npm

To publish the library as a link:https://www.npmjs.com/[npm],
please follow the procedure in link:https://link:docs.npmjs.com/getting-started/publishing-npm-packages["Publishing npm packages"].

Then install it via:

```shell
npm install masai_service_discovery_api --save
```

##### Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:

```shell
npm install
```

Next, link:https://link:docs.npmjs.com/cli/link[link] it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:

```shell
npm link
```

Finally, switch to the directory you want to use your masai_service_discovery_api from, and run:

```shell
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
```

You should now be able to `require('masai_service_discovery_api')` in javascript files from the directory you ran the last
command above from.

#### git
#
If the library is hosted at a git repository, e.g.
https://github.com/GIT_USER_ID/GIT_REPO_ID
then install it via:

```shell
    npm install GIT_USER_ID/GIT_REPO_ID --save
```

### For browser

The library also works in the browser environment via npm and link:http://browserify.org/[browserify]. After following
the above steps with Node.js and installing browserify with `npm install -g browserify`,
perform the following (assuming *main.js* is your entry file, that's to say your javascript file where you actually
use this library):

```shell
browserify main.js > bundle.js
```

Then include *bundle.js* in the HTML pages.

### Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error:
Cannot resolve module", most certainly you should disable AMD loader. Add/merge
the following section to your webpack config:

```javascript
module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}
```

## Getting Started

Please follow the link:#installation[installation] instruction and execute the following JS code:

```javascript
var DiscoverySearchEngine = require('masai_service_discovery_api');

var api = new DiscoverySearchEngine.ApiApi()

var discoverApis = new DiscoverySearchEngine.SearchCriteria(); // {SearchCriteria} Represent a service discovery object, used to performs search queries

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.apiSearchForService(discoverApis, callback);

```

## Documentation for API Endpoints

All URIs are relative to *http://apis.masai.teleticketing.eu/ServiceDiscovery*

|===
Class | Method | HTTP request | Description

|*DiscoverySearchEngine.ApiApi* | link:docs/ApiApi.html#apiSearchForService[**apiSearchForService**] | **POST** /api/searchForServices | Search for available services at a specific location
|===

## Documentation for Models

 - link:docs/Contact.html[DiscoverySearchEngine.Contact]
 - link:docs/Data.html[DiscoverySearchEngine.Data]
 - link:docs/DiscoveryRequest.html[DiscoverySearchEngine.DiscoveryRequest]
 - link:docs/DiscoveryRequestServiceType.html[DiscoverySearchEngine.DiscoveryRequestServiceType]
 - link:docs/JsonExpectedSchema.html[DiscoverySearchEngine.JsonExpectedSchema]
 - link:docs/JsonSchema4.html[DiscoverySearchEngine.JsonSchema4]
 - link:docs/JsonXmlObject.html[DiscoverySearchEngine.JsonXmlObject]
 - link:docs/Location.html[DiscoverySearchEngine.Location]
 - link:docs/Maintainers.html[DiscoverySearchEngine.Maintainers]
 - link:docs/Price.html[DiscoverySearchEngine.Price]
 - link:docs/Properties.html[DiscoverySearchEngine.Properties]
 - link:docs/Rating.html[DiscoverySearchEngine.Rating]
 - link:docs/SearchCriteria.html[DiscoverySearchEngine.SearchCriteria]
 - link:docs/SearchResponse.html[DiscoverySearchEngine.SearchResponse]
 - link:docs/SearchResult.html[DiscoverySearchEngine.SearchResult]
 - link:docs/SwaggerContact.html[DiscoverySearchEngine.SwaggerContact]
 - link:docs/SwaggerDocument.html[DiscoverySearchEngine.SwaggerDocument]
 - link:docs/SwaggerDocumentPaths.html[DiscoverySearchEngine.SwaggerDocumentPaths]
 - link:docs/SwaggerExternalDocumentation.html[DiscoverySearchEngine.SwaggerExternalDocumentation]
 - link:docs/SwaggerInfo.html[DiscoverySearchEngine.SwaggerInfo]
 - link:docs/SwaggerLicense.html[DiscoverySearchEngine.SwaggerLicense]
 - link:docs/SwaggerOperation.html[DiscoverySearchEngine.SwaggerOperation]
 - link:docs/SwaggerParameter.html[DiscoverySearchEngine.SwaggerParameter]
 - link:docs/SwaggerResponse.html[DiscoverySearchEngine.SwaggerResponse]
 - link:docs/SwaggerSecurityScheme.html[DiscoverySearchEngine.SwaggerSecurityScheme]
 - link:docs/SwaggerTag.html[DiscoverySearchEngine.SwaggerTag]

## Documentation for Authorization

 All endpoints do not require authorization.

repository: MASAICommunity/ServiceDiscovery

repo_name: MASAICommunity/ServiceDiscovery


text:
# Get Started

The waiter package comes with a few members of staff but the core member is the waiter which will let you show full page or partial loading screens in your shiny application.

## How to

It's fairly straightforward

1. Place `use_waiter` anywhere in your UI.
2. Create a waiter
3. Show the waiter
4. Hide the waiter

> [!TIP]
> Make sure you include the dependencies with `use_waiter` or nothing will work.

## Examples

A basic example could be like this, upon clicking a button we display a full page loading screen.

``` r
library(shiny)
library(waiter)

ui <- fluidPage(
  use_waiter(), # include dependencies
  actionButton("show", "Show loading for 3 seconds")
)

server <- function(input, output, session){
  # create a waiter
  w <- Waiter$new()

  # on button click
  observeEvent(input$show, {
    w$show()
    Sys.sleep(3)
    w$hide()
  })
}

shinyApp(ui, server)
```

![](_assets/img/waiter.gif)

By default the waiter will show a spinner, 1) you can choose from more than [100 spinners](https://shiny.john-coene.com/waiter/) 2) you are by no means limited to a spinner since the `html` argument takes any htmltools or shiny tag. Below we change the spinner, add some text and change the background color.

``` r
library(shiny)
library(waiter)

waiting_screen <- tagList(
  spin_flower(),
  h4("Cool stuff loading...")
)

ui <- fluidPage(
  use_waiter(), # include dependencies
  actionButton("show", "Show loading for 3 seconds")
)

server <- function(input, output, session){
  observeEvent(input$show, {
    waiter_show(html = waiting_screen, color = "black")
    Sys.sleep(3) # do something that takes time
    waiter_hide()
  })
}

shinyApp(ui, server)
```

![](_assets/img/waiter-text.gif)

Visit the [full waiter documentation](/waiter) to learn how to further customise your waiting screen, have it appear on parts of the application, show loading bars, and more.

license: MIT

repository: gadenbuie/waiter

branch_name: refs/heads/master

extension: md

gha_license_id: NOASSERTION

license_type: permissive

repo_name: gadenbuie/waiter


text:
<!--
[![Maintainability](https://api.codeclimate.com/v1/badges/124348de2ee6850d682f/maintainability)](https://codeclimate.com/github/andrew-codes/gatsby-plugin-elasticlunr-search/maintainability)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7230ae7191f44a9489834553760310c2)](https://www.codacy.com/app/andrew-codes/gatsby-plugin-elasticlunr-search?utm_source=github.com&utm_medium=referral&utm_content=andrew-codes/gatsby-plugin-elasticlunr-search&utm_campaign=Badge_Grade)

-->

# Search Plugin for Gatsby

This plugin enables search integration via elastic lunr. Content is indexed and then made available via graphql to rehydrate into an `elasticlunr` index. From there, queries can be made against this index to retrieve pages by their ID.

It is a fork of [gatsby-plugin-elasticlunr-search](https://github.com/andrew-codes/gatsby-plugin-elasticlunr-search) made in order to use the plugin with gatsby-v2.

# Getting Started

Install the plugin via `npm install --save @gatsby-contrib/gatsby-plugin-elasticlunr-search`.

See the [example site](https://gatsby-contrib.github.io/gatsby-plugin-elasticlunr-search/) [code](./example) for more specific implementation details.

Next, update your `gatsby-config.js` file to utilize the plugin.

## Setup in `gatsby-config`

Here's an example for a site that create pages using markdown, in which you you'd like to allow search features for `title` and `tags` frontmatter entries.

`gatsby-config.js`

```javascript
module.exports = {
  plugins: [
    {
      resolve: `@gatsby-contrib/gatsby-plugin-elasticlunr-search`,
      options: {
        // Fields to index
        fields: [`title`, `tags`],
        // How to resolve each field`s value for a supported node type
        resolvers: {
          // For any node of type MarkdownRemark, list how to resolve the fields` values
          MarkdownRemark: {
            title: node => node.frontmatter.title,
            tags: node => node.frontmatter.tags,
            path: node => node.frontmatter.path,
          },
        },
        // Optional filter to limit indexed nodes
        filter: (node, getNode) =>
          node.frontmatter.tags !== 'exempt',
      },
    },
  ],
}
```

## Consuming in Your Site

The serialized search index will be available via graphql. Once queried, a component can create a new elasticlunr index with the value retrieved from the graphql query. Search queries can be made against the hydrated search index. The results is an array of document IDs. The index can return the full document given a document ID.

In gatsby-v2, it is possible to use graphql queries inside components using [`StaticQuery`](https://www.gatsbyjs.org/docs/static-query/).

Suppose that you want to include the `Search` component inside an `Header` component. _(Of course, you could also query `siteSearchIndex` from `layout.js` component, and pass it down as prop to any component that need it.)_

First, query the data with `StaticQuery` inside the `Header` component, and pass it as props to the `Search` component.

`components/header.js`

```javascript
import React from "react"
import { StaticQuery, Link } from "gatsby"
import { graphql } from "gatsby"

import Search from "./search"

const Header = () => (
  <StaticQuery
    query={graphql`
      query SearchIndexQuery {
        siteSearchIndex {
          index
        }
      }
    `}
    render={data => (
      <header>
        ... header stuff...
        <Search searchIndex={data.siteSearchIndex.index} />
      </header>
    )}
  />
)

export default Header
```

And then use the `searchIndex` inside your `Search` component.

`components/search.js`

```javascript
import React, { Component } from "react"
import { Index } from "elasticlunr"

// Search component
export default class Search extends Component {
  constructor(props) {
    super(props)
    this.state = {
      query: ``,
      results: [],
    }
  }

  render() {
    return (
      <div>
        <input type="text" value={this.state.query} onChange={this.search} />
        <ul>
          {this.state.results.map(page => (
            <li key={page.id}>
              <Link to={"/" + page.path}>{page.title}</Link>
              {": " + page.tags.join(`,`)}
            </li>
          ))}
        </ul>
      </div>
    )
  }
  getOrCreateIndex = () =>
    this.index
      ? this.index
      : // Create an elastic lunr index and hydrate with graphql query results
        Index.load(this.props.searchIndex)

  search = evt => {
    const query = evt.target.value
    this.index = this.getOrCreateIndex()
    this.setState({
      query,
      // Query the index with search string to get an [] of IDs
      results: this.index
        .search(query, {})
        // Map over each ID and return the full document
        .map(({ ref }) => this.index.documentStore.getDoc(ref)),
    })
  }
}
```

## Partial Searches

If you want your search to include partial matches, for example if you had the following data:

```javascript
sku: ["ab21345", "ab98765", "abcdef12"]
```

And wanted a search for "**_ab_**" to return all of those data, then you can simply include `{ expand: true }` as the second parameter to `this.index.search()` when setting the `results` state.

Taking the above example implementation, adapt the `search` function in the `Search` component to the following:

```javascript
search = evt => {
  const query = evt.target.value
  this.index = this.getOrCreateIndex()
  this.setState({
    query,
    // Query the index with search string to get an [] of IDs
    results: this.index
      .search(query, { expand: true }) // Accept partial matches
      // Map over each ID and return the full document
      .map(({ ref }) => this.index.documentStore.getDoc(ref)),
  })
}
```

## Optimize handling of data models with nested nodes

There are times when you have a data model that has nested nodes. Example resolver configuration in `gatsby-config.js`:
```
resolvers : {
  // For any node of BlogPost, list how to resolve the fields' values
  BlogPost : {
    title         : node => node.title,
    featuredImage : node => node.featuredImage___NODE // featuredImage is of type Asset below and is an id reference to Asset
  },

  // For any node of type Asset, this is how BlogPost featuredImage is resolved
  Asset : {
    fileUrl : node => node.file && node.file.url
  }
}
```
The problem with the above resolvers configuration is that it will include all Asset models in the `elasticlunr` index,
potentially bloating the `elasticlunr` index and leading to large bundle sizes and slower page load times.

The solution is to make use of the second paramater passed to each field resolver function called `getNode`. `getNode` is the same function provided by gatsby
to the [setFieldsOnGraphQLNodeType](https://www.gatsbyjs.org/docs/node-apis/#setFieldsOnGraphQLNodeType) node api method and when called
with a data model node id it will return a node with all it's data. The above example of the `BlogPost` model with the nested `featuredImage` property of
type `Asset` then becomes:
```
resolvers : {
  // For any node of BlogPost, list how to resolve the fields' values
  BlogPost : {
    title         : node => node.title,
    featuredImage : (node, getNode) => getNode(node.featuredImage___NODE) // featuredImage is of type Asset and is now the Asset model itself
  }
}
```
Now you can use the `featuredImage` data of `BlogPost` model without including all `Asset` models in the `elasticlunr` index [(see PR #3 for more details)](https://github.com/gatsby-contrib/gatsby-plugin-elasticlunr-search/pull/3).

repository: rockimmortal/riweb

gha_language: Python

gha_license_id: MIT

repo_name: rockimmortal/riweb


text:
# Simple rerouting demo

[Source](https://www.youtube.com/watch?v=YntoPdPFFkU&ab_channel=TienanLiTienanLi)

## Description

This demo enforces single vehicle to change its route.

### Declaring SUMO_HOME variable

```bash
export SUMO_HOME=<your path here>
```

### Which path to choose for SUMO_HOME ?

```bash
whereis sumo
```

You can choose one of them for example /usr/share/sumo

### Building

In case of denied permissions:

```bash
chmod +x demo.py
```

And then:

```bash
./demo.py
```

Pops up SUMO GUI. Set appropriate time delay and run simulation.

repository: Traffree/traffree

branch_name: refs/heads/main

repo_name: Traffree/traffree


text:
![License: MIT](https://img.shields.io/github/license/Broad-Ai-Lab/emotion)

# Speech Emotion Recognition
This repository contains scripts for processing emotional speech
datasets, and training machine learning models on the datasets.

## Datasets
See [`datsets/README.md`](datasets/README.md) for more information about
the supported datasets and the required processing.

## Installation
This project requires Python 3.7+. It is advised to run the scripts in a
Python virtual environment. One can be created with the command
```
python -m venv .venv
```
Then you can use this virtual environment:
```
. .venv/bin/activate
```
To install the `emorec` library:
```
python setup.py install
```
Or, if you want to develop continuously:
```
python setup.py develop
```

The scripts are all located in the `scripts` directory, and are not
installed. They must be run from the root of the project directory.

### Python Dependencies
This project has a number of Python dependencies, including NumPy,
TensorFlow, PyTorch, scikit-learn and Pandas. You should run
```
pip install -r requirements.txt
```
to install all the Python dependencies.

### Third-party tools
Some third-party tools are included in this repository, under the
`third_party` directory. See the [README](third_party/README.md) for
more details.

## Scripts
All scripts are contained in the [`scripts/`](scripts/) directory. The
four main types of scripts are preprocessing, training, utility and
results analysis. Each script should have usage info if you give
`--help` as an argument.

There are also some scripts for batch processing all corpora for
classification experiments, although these are subject to change until
a paper is published, in which case they will be put in the
[`papers/`](papers/) directory.

## Papers
The [`papers/`](papers/) directory contains copies of scripts used to
run experiments and results for a given paper. Each directory
corresponds to a publicaiton and has a README with a description of the
paper and how to run the experiments. Each publication will also be
associated with a git tag and a GitHub release on the
[releases](https://github.com/Broad-AI-Lab/emotion/releases) page.

NOTE: Scripts in the `papers/` directory will not be updated. Please
checkout the appropriate git tag to use these scripts.


text:
# OpenSatelliteProject
Project Information
TODO: Write this page.

# Compiling Guide (Ubuntu 16.04)

That compile guide is a adapted version from @hdoverobinson that was published on gist and OSP Rocket chat. He also created a script to automatically download deps and build OSP! You can check it here: [https://gist.github.com/hdoverobinson/82e3f08c34052d36c92e8db5a027d129](https://gist.github.com/hdoverobinson/82e3f08c34052d36c92e8db5a027d129)

1. Download needed dependencies
```bash
# Create working dir
mkdir -p OSP/deps
mkdir -p OSP/bin
cd OSP/deps
# Add upstream drivers and gnuradio modules from myriadrf
sudo add-apt-repository ppa:myriadrf/drivers -y
sudo add-apt-repository ppa:myriadrf/gnuradio -y
# Add Mono Upstream key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian xenial main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
# Update APT Cache
sudo apt-get update
# Install required deps
sudo apt-get -y install libairspy-dev libusb-1.0-0-dev libhackrf-dev libhackrf0 libaec0 libaec-dev mono-complete monodevelop nuget libopenal-dev referenceassemblies-pcl ttf-mscorefonts-installer gtk-sharp3 build-essential git
# Install MonoGame (Not required for Web Version)
wget http://www.monogame.net/releases/v3.5.1/monogame-sdk.run
chmod +x monogame-sdk.run
sudo ./monogame-sdk.run
# Get back to root of OSP folder
cd ..
```

2. Compiling Demodulator and Decoder
```bash
# Clone xritdemod repository
git clone https://github.com/opensatelliteproject/xritdemod.git
# Enter on folder
cd xritdemod
# Compile / Install libcorrect
make libcorrect
sudo make libcorrect-install
# Compile / Install libSatHelper
make libSatHelper
sudo make libSatHelper-install
# Compile / Install upstream librtlsdr
make librtlsdr
sudo make librtlsdr-install
# Compile / Test xritdemod
make
make test
# Copy binares to bin folder
cp decoder/build/xritDecoder demodulator/build/xritDemodulator ../bin
# Back to OSP folder
cd ..
```

3. Compiling Decompressor Lib
That library is needed for decompressing LRIT/HRIT Files. It's a wrapper to `libaec`.
```bash
# Clone Decompressor repository
git clone https://github.com/opensatelliteproject/decompressor.git
cd decompressor
# Create build folder and makefile scripts
mkdir -p build
cd build
cmake ..
# Build
make
# Install
sudo make install
sudo ldconfig
# Back to OSP Folder
cd ../..
```

4. Compiling GOES Dump
```bash
# Clone goesdump repository
git clone https://github.com/opensatelliteproject/goesdump.git
cd goesdump
# Restore Nuget dependencies
nuget restore goesdump.sln
# Build GOES Dump
mdtool build goesdump.sln -c:Release
# Copy Binaries to binary folder
cp goesdump/bin/Release/* ../bin
# Back to OSP Dir
cd ..
```

5. Get the Web Interface

The web interface package can be downloaded here: https://github.com/opensatelliteproject/goesdump/releases/tag/1.0.2-beta named as `goes-web.zip`. Just extract all content under a `web` folder inside `OSP/bin`.
```bash
# Download it
wget https://github.com/opensatelliteproject/goesdump/releases/download/1.0.2-beta/goesdump-web.zip
mkdir OSP/bin/web -p

# Extract it
unzip goesdump-web.zip -d OSP/bin/web
```

Now you should have all needed binaries under `OSP/bin` folder.

# Support
There is a RocketChat page where you can ask questions and suggest features: [https://osp.teske.net.br/](https://osp.teske.net.br/).

# GOES Dump Configuration File

Now GOES Dump config file is a SQLite database named `config.db`. All configs can be changed on WebUI and you can also open the `config.db` with [SQLite Browser](http://sqlitebrowser.org/)

# Configuring Syslog for GOES Dump Headless

Edit the file `/etc/rsyslog.conf` and find this lines:
```
# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")
```

Uncomment the last two save and restart rsyslog:
```
# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")
```

`service rsyslog restart`

repository: Rb-tech-byte/OpenSatelliteProject

repo_name: Rb-tech-byte/OpenSatelliteProject


text:
---
layout: article
title: use vmcli to get vminfo
cover: /img/vm.webp
tags: vmware powershell tools installation windows
category: vmware
---

use vmcli to get both assigned and used cpu memory and harddisk information and gen a csv report

1. install Windows Management Framework 4.0 : [https://www.microsoft.com/en-us/download/details.aspx?id=40855](https://www.microsoft.com/en-us/download/details.aspx?id=40855) (don't try to get 3.0, the patch cause my windows 7 sp1 crashed)

2. install vmware powercli 6.5 : [https://my.vmware.com/web/vmware/details?downloadGroup=PCLI650R1&productId=614](https://my.vmware.com/web/vmware/details?downloadGroup=PCLI650R1&productId=614)

4. you must set the 'Execution Policy' of PowerShell to enable it to be able to run scripts, open vmware powercli as administrator(not using powershell), enter :

```
Set-ExecutionPolicy RemoteSigned
```

Restart vmware powercli as administrator

5. create a powershell file, in this case I named it getvminfo.ps1, place it to c:

```
connect-viserver -server yourvmname_or_ip
Get-View -ViewType VirtualMachine | %{
New-Object PSObject -Property @{
Name = $_.Name
Host = (Get-View $_.Summary.Runtime.Host).Name
Datastore = [system.String]::Join(",",($_.Storage.PerDatastoreUsage | %{Get-View $_.Datastore} | %{$_.Name}))
Size = (Get-VM $_.Name | Select-Object -Property ProvisionedSpaceGB).ProvisionedSpaceGB #($_.Storage.PerDatastoreUsage | Measure-Object -Property Committed -Sum).Sum
Usedspace = (Get-VM $_.Name | Select-Object -Property UsedSpaceGB).UsedSpaceGB
CPU = (Get-VM $_.Name | Select-Object -Property numCPU).NumCpu
Memory = (Get-VM $_.Name | Select-Object -Property MemoryMB).MemoryMB
Network = (Get-NetworkAdapter $_.Name | Select-Object -Property NetworkName).NetworkName
usedMemory = [Math]::Round(((Get-VM $_.Name | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)
}
} | Export-Csv "C:\VM-report.csv" -NoTypeInformation -UseCulture
```

reference link :
[http://vstrong.info/2014/11/18/powercli-average-cpu-memory-network-and-disk-usage/](http://vstrong.info/2014/11/18/powercli-average-cpu-memory-network-and-disk-usage/)


text:
---
title: "Functional Programming: Concepts, Idioms and Philosophy"
date: 2016-03-19 10:06
categories: [code]
tags: [functional programming, python, scala, java]
---

[Functional Programming][fp] has risen as a solution to most modern days problems, such as concurrency and scaling. For some, it is a mystique concept that applies only to Erlang, Haskell and other strange languages that are either too complicated or irrelevant. This is simply not true, and I'm going to show how to apply some functional programming concepts on non-functional languages.

I'll deconstruct the functional paradigm by first defining what 'Functional Programming' really means, then explaining common idioms and comparing the syntax.
In the end, I'll show how to make relevant changes to non-functional in order to follow the Functional Programming Philosophy.

Please note that this post is mostly intended to those who never programmed functionally before and the goal here is to present Functional Programming as a practice not strict to language features, but as a philosophy that can, to some extent, be followed in any languages, enhancing code safety and bringing some of the advantages of FP to non-functional languages.

Defining 'Functional Programming'
---------------------------------

The simplest definition of Functional Programming is [pure functions][pure-functions] (or even simpler, _deterministic functions_).

This, on the other hand, can have several meanings and have to be carefully analyzed. It also leads to several other important rules to FP, such as immutable variables and composable functions.

### Deterministic Functions

As a general rule, think of your code as if you were writing a mathematical function:

  * Should its result vary according to anything that isn't supplied as a parameter? No
  * Should it alter any of the parameters that were supplied? No
  * Should it alter anything outside its scope? No
  * Should the result be always the same for the same supplied parameters? __Yes.__

If, as you read this, you remembered a code that doesn't conform, I'm afraid it wasn't functional. Why?

Functions have a special meaning on those languages, such that they are __first class citizens__. They can be passed around as 'variables' and can be partially applied to compose new functionalities. I'll talk more about this later when I'll describe some idioms. The thing to have in mind here is that __functions are designed to be reusable and composable.__ Any side effect or external interference will make functions unpredictable and hardly reusable.

### Immutable Values

Stateful systems are very difficult to parallelize, having to implement mutexes, locks, semaphores and other forms of __access constraints__ to make the code safer. FP simply bashes the concept of mutability; instead, when coding in a functional language, you compose functions to obtain the values you need.

This is one of the concepts that are most difficult to picture, coming from a non-functional language. The good thing about it is that immutability forces you to rethink your problems in order to have a (functionally) correct solution for the problem. This should not be a problem once you understand that Functional Programming is much more __about how you design your functions than about how you design your data__.

Some Idioms not Quite Familiar
------------------------------

Coming from OO to FP might be complicated if you have never seen a FP source code and how it looks like. You'll probably not be seeing the `for` and `if` commands you are used to, but instead, `map`, `reduce`, `filter` and `flatten`. You'll learn of the (not so complicated) [Monads][monad], Functors and [Algebraic Data Types][algebraic-scala]. What is all that supposed to mean and why can't the old structures be used?

I'll be using the [scala][scala] names for the idioms presented here, but they are all the same in functional languages.

### Monads, Functors and Friends

Monads are [amazingly simple][simple-monad] with amazingly complicated rules. Monads are containers. Period. There are rules that regulate how Monads work and interact with other Monads and this rules also define terms such as Functors, Monoids, Applicative Functors and other extraneous terms to those who never programmed in functional languages. For the sake of simplicity, I'll group them here as simply 'Monad', taking the risk of being semantically wrong to make you understand the concept. I promise I'll disambiguate this later, ok?

Let me show you some scala code to illustrate what this means:

```scala
def someComputation(): Option[String] = ...

val myPossibleString = someComputation()
```

Imagine, for example, that you can either have a value (in this example, a `String`) or not, as a result of some computation. Instead of the good ol' `null`, which can lead to serious problems such as the not-so-good ol' `NullPointerException`, you can return a `Option[String]`. An `Option` is a Monad that scala provides which wraps your data that allows you to safely interact with it __only if it exists__.

In a java code, you'd check for `null` before doing anything to avoid a NPE:

```java
String myPossibleString = someComputation();
if(myPossibleString == null) {
  //Short circuit out
}
return myPossibleString.toUpper();
```

In a functional programming language, you can `map` over the Monad to achieve the same safety level:

```scala
myPossibleString.map(_.toUpper)
```

The only difference here is that the java code will return a `String`, while the scala code will return an `Option[String]`.

By mapping a monad, we transform the cointained value while keeping the same container. The result of this can be either:

```scala
Some("MYUPPERSTRING") // if the computation was successful

// or

None // if the computation was unsuccessful
```

Note that `_.toUpper` won't break if `None` was supplied. This allows chaining operations on a value without having to short circuit all the possible problems:

```java
String myStr = someComputation();
if(myStr == null) {
  return false;
}
myStr = newOperationOnStr(str);
if(myStr == null || myStr.length < 3) {
  return false;
} else if (!matchRegex(str)) {
  return false;
} else {
  return true;
}
```

This code can be written as the following in scala, using `Option[String]`:

```scala
someComputation()
  .map(newOperationOnStr(_))
  .filter(s => s.length >= 3 && matchRegex(s))
  .isDefined
```

I could spend several hours here writing about how monads allow you to express your code better, in a functional way, but I'll leave that up to you.

### Algebraic Data What?

There is a complete mathematical theory backing this kind of data, but I'll humbly limit myself to explaining that algebraic data types are meaningful, composite types. An algebraic data type defined _by the sum of all definitions of its forms_. Some monads are defined as algebraic data types, such as scala `Options` we've seen before. It can be either `Some` or `None`. Each of those have different behaviors when mapped, filtered and reduced.

This means that while monads provide laws to data containers, algebraic data types provide __form__ and __meaning__. `Try` and `Option` are both quite similar in terms of API and can behave quite similarly, but what differs both is that you'll want to use `Try` when the error can be meaningful or several kinds of errors can be thrown, each requiring different actions. You can also use `Either`, if you must deal with two possible outcomes for a function. The range of monadic algebraic types is immense and they help you to structure your application without heavy, imperative concepts.

In general, using this kind of abstractions lead to a cleaner, meaningful code. Personally, I consider this kind of abstraction to be much higher and more valuable than Object Oriented programming. Of course OO has its value, but its much easier to express logic algebraic data structures.

But how can I start using it?
-----------------------------

While some languages provide native idioms to allow you write code aligned with the Functional Philosophy, there are several concepts that can be ported to non-functional (or natively non-functional) languages. It is important to note that writing code in a functional language doesn't make it immediately functional. What makes a code truly functional is the usage of aforementioned concepts. The same way you can have OO code in scala, you can have functional code in python, for example.

Imagine such situation, replacing the dummy functions with actual stuff:

```python
my_value = []

def fetch_values():
  # Imagine that you're fetching a real data
  # I'll return a dummy list of dummy ints
  my_value = [8, 3, 2, 5, 1, 4]

def filter_values(even=True):
  t = []
  for i in my_value:
    if even:
      if i % 2 == 0:
        t.append(i)
    else:
      if i % 2 == 1:
        t.append(i)
  my_value = t

def process_value(x):
  # Also dummy here.
  return x * x

def process_all_values():
  for i in my_value:
    process_value(x)

def do_process():
  fetch_values()
  # We (for some reason) need to process evens before odds
  filter_values(true)
  process_all_values()
  fetch_values()
  filter_values(false)
  process_all_values()
```

I broke all possible laws to make the example easier to transport. Hopefully, you'll be able to recognize some of the anti-patterns above on real, production code. We want to take them out. Below, I'll write a python code that fixes all of the above anti-patterns, but try to find them and imagine a functional approach before actually reading the transformed version.

```python
from functools import reduce

def fetch_values():
  return [8, 3, 2, 5, 1, 4]

def partition_values(vals):
  return reduce(lambda l, v: l[v % 2].append(v) or l, vals, ([], []))

def process_value(x):
  # Processing here is a pure function.
  return x * x

def process_all_values(lst):
  # Be cautious when plumbing functions here;
  # You should only map over pure functions, to avoid
  # intermittent state or unhandled errors.
  return map(process_value, lst)

def do_process():
  id_list = fetch_values()
  evens, odds = partition_values(id_list)
  p_evens, p_odds = process_all_values(evens), process_all_values(odds)

  # Python `map` is lazy, so we force evaluation
  list(p_even)
  list(p_odds)
```

While not yet optimal due to python limitations, we have already a more functional code. There are tons of enhancements we'd be able to do here, such as using monadic algebraic types to wrap our mapped computations, allowing us to safely handle possible errors that happened during `process_value`.

Also, note that, while this slice of code is functional, it is only safe to do this __as is__ if `process_value` is a pure function. Otherwise you'll have problems such as indefinite state if an exception is thrown during this process or you'll have to reprocess all the stuff.

Some other concepts help you deal with this kind of problem and are orthogonal to FP, such as idempotence. It is important to know that functional programming (or the functional programming philosophy) is only a tool that helps you write safer code.

Conclusion
----------

You'll find that code that follows the functional philosophy is easier to test, to parallelize, to reuse and to understand. This, of course, doesn't mean that FP is the silver bullet that will solve all programming problems. If that was the case, I wouldn't be advertising the usage of those practices on non-functional languages, but rather advocating the migration to FP languages. The true value here is that you have an alternative to traditional imperative code style, which can result in the aforementioned advantages

This post got longer than I initially though and is only scratching the surface of FP. I'll surely write more about FP on future posts and I'll always focus more on the philosophy and how can you think functionally, even if your current language doesn't fully implement functional idioms. There are tons of useful techniques that one can borrow from functional programming which makes code safer, cleaner and more expressive.

Feel free to write me if you agree, disagree or just want to have a beer with me. I still don't have comments on my blog and this is something I'll take care of on the next week.
:x

[fp]: https://en.wikipedia.org/wiki/Functional_programming
[pure-functions]: http://www.sitepoint.com/functional-programming-pure-functions/
[monad]: https://en.wikipedia.org/wiki/Monad_%28functional_programming%29
[simple-monad]: http://maciejpirog.github.io/fishy/
[algebraic-scala]: http://io.pellucid.com/blog/abstract-algebraic-data-type
[scala]: http://www.scala-lang.org/
[neophytes]: http://danielwestheide.com/scala/neophytes.html

gha_language: CSS


text:
# rapid-downloader
Ez to use accelerated downloader for Node.js enviroment. Greatly increase download speed by taking adavantage of node's non-io-blocking, divide the job into multiple network connections.

[![NPM](https://nodei.co/npm/rapid-downloader.png?compact=true)](https://nodei.co/npm/rapid-downloader/)

In a hurry? There is example in the end. Skip bellow. Go to last section.

## What is inside the box

- DownloadWorker: the core conception of downloading, and managing download connections. One worker mean one file that need to be downloaded.
- utils: Cause it is not a class, I named it lowercase. This object contains many utilities functions to work with files/DownloadWorker's result.

P/s: The most useful one inside utils is **utils.dynamicSpeedUnitDisplay(progress.bytesPerSecond, 2)**
That function is for making human-readable download speed string from raw progress result of DownloadWorker. For more details, see example bellow.

## Want to use rapid-downloader in terminal?

Try out: https://github.com/minhnhut/rapid-downloader-cli

## What happen inside DownloadWorker

DownloadWorker a.k.a worker, will first try to make a HEAD request. To determine if source server is supporting [Range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests). After this point, there will be two cases:

1. If it is advertised as ranges is supported, worker will then initilize multiples connection which is divided perfectly to download the file. Each connections will download it's part to seperated file. After all connections done it's jobs. Worker will then join all partial files into one. The download is completed.

2. If worker decided that source server doesn't have ranges support, it will initilize only one connection. Source file will be then transfered byte by byte to single local file. After that single connection done it's job. The download is completed.

## Available DownloadWorker options, and its default value

```javascript
const options = {
    // Number of connections should be used
    // the bigger number, the faster download be
    // ... and the greater stress on your network also
    // default: 4
    maxConnections: 4,

    // Force DownloadWorker to use multiple connections
    // even target server is saying that ranges is not support
    // (may rise an error, if target server is really doesn't support range requests)
    // default: false
    forceMultipleConnections : false,

    // Force single connection
    // oposite to forceMultipleConnections, force worker to download with
    // single connection, even target server accept range requests
    // Note: If both forceSingleConnection and forceMultipleConnections are true
    //       single connection will be used
    // default: false
    forceSingleConnection: false,

    // Number of miliseconds should wait for each progress calculation cycle
    // because it cost a little bit CPU to calculate the progress.
    // You should keep this updating cycle slow as posible, idle is 200ms
    // default: 200
    progressUpdateInterval: 200
};
```

## How to use (show me the code!)

### Simplest form, just download a file

In below example, Linode's server support Ranges request, so DownloadWorker will go with multiple connections.

```javascript
const {DownloadWorker} = require("rapid-downloader");

const worker = new DownloadWorker("http://speedtest.tokyo2.linode.com/100MB-tokyo2.bin", "100MB-tokyo2.zip");
worker.on('ready', () => {
    worker.on('start', () => console.log('started'))
    worker.on('progress', (progress) => {
        console.log(`${progress.completedPercent}% - ${progress.bytesPerSecond} B/s`)
    });
    worker.on('finishing', () => console.log('Download is finishing'));
    worker.on('end', () => console.log('Download is done'));
    worker.start();
});

```

### Specify number of desired connections, display human-readable download speed

```javascript
const {DownloadWorker, utils} = require("rapid-downloader");

// Multi connections
const worker = new DownloadWorker("http://speedtest.tokyo2.linode.com/100MB-tokyo2.bin", "100MB-tokyo2.zip", {
    maxConnections: 8
});
worker.on('ready', () => {
    worker.on('start', () => console.log('started'))
    worker.on('progress', (progress) => {
        const speed = utils.dynamicSpeedUnitDisplay(progress.bytesPerSecond, 2);
        console.log(`${progress.completedPercent}% - ${speed}`)
    });
    worker.on('finishing', () => console.log('Download is finishing'));
    worker.on('end', () => console.log('Download is done'));
    worker.start();
});

```

### Force DownloadWorker to download by using single connection

```javascript
const {DownloadWorker, utils} = require("rapid-downloader");

const worker = new DownloadWorker("http://speedtest.tokyo2.linode.com/100MB-tokyo2.bin", "100MB.zip", {
    forceSingleConnection: true
});
worker.on('ready', () => {
    worker.on('start', () => console.log('started'))
    worker.on('progress', (progress) => {
        const speed = utils.dynamicSpeedUnitDisplay(progress.bytesPerSecond, 2);
        console.log(`${progress.completedPercent}% - ${speed}`)
    });
    worker.on('finishing', () => console.log('Download is finishing'));
    worker.on('end', () => console.log('Download is done'));
    worker.on('error', error => console.log(error));
    worker.start();
});
```

repository: minhnhut/rapid-downloader

gha_language: JavaScript

repo_name: minhnhut/rapid-downloader


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

title: 'Disk, interval, point: on constructions of quantum field theories with holomorphic
  action functionals'
subtitle: ''
summary: ''
authors:
- Nafiz Ishtiaque
- Junya Yagi
tags: []
categories: []
date: '2020-02-24'
lastmod: 2020-12-09T16:35:55+08:00
featured: false
draft: false

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

# Projects (optional).
#   Associate this post with one or more of your projects.
#   Simply enter your project's folder or file name without extension.
#   E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
#   Otherwise, set `projects = []`.
projects: []
publishDate: '2020-12-09T08:35:55.381389Z'
publication_types:
- '2'
abstract: 'Bosonic quantum field theories with holomorphic action functionals are realized by two types of constructions involving supersymmetric quantum field theories, compactified on an interval in one type and compactified on a disk and deformed in the other. We establish the equivalence between the two types of constructions by reducing the disk to the interval and the interval to a point. As examples, we discuss constructions of zero-dimensional gauged sigma model, gauged quantum mechanics, gauged symplectic bosons in two dimensions, and Chern–Simons theory and its higher-dimensional variants.'
publication: '*JHEP* **06** (2020) 180'
doi: 10.1007/JHEP06(2020)180
links:
- name: arXiv
  url: 'https://arxiv.org/abs/2002.10488'
---

repository: jnyg/starter-academic

repo_name: jnyg/starter-academic


text:
# GL-kernel-net

## Task description

Device driver must provide a /dev/ character node for userspace applications.

On Open, driver creates designated network interface testN. Close removes the
network interface.

Every packet Linux sends to the interface is placed into a buffer and it can
be read by the process this interface belongs to, and the opposite
way - written packets should be received and processed by the OS.

One packet - one syscall. (Read and write operate on complete packets).
Userspace process should block on read if no data available.

## Bonus points for:

* Interface (ifconfig) and ethtool (ethtool -S) statistics.

* Multiple RX and TX buffers to avoid packet loss.

* Non-blocking IO support.

## Hints
To send and receive traffic, interface must be UP and have IP address
assigned. For example:
```
# ip link set up dev test0
# ip addr add <IP_ADDRESS>/24 dev test0
```

Watch out for NetworkManager, it may take over the device management.

Look how other drivers work. For example: loopback, dummy, veth, tun.

## Testing the driver
Optionally, you may use the `pingable.py` Python 2 script, which opens
device node, handles basic traffic flow and handles ARP and ICMP Ping
packets. Script can be modified to suit the needs better if necessary.

### Usage example

After the script start, new interface is created, IPv6 stuff start to
happen and NetworkManager tries to configure IPv4:
```
# python pingable.py

RX: unknown dst [51, 51, 0, 0, 0, 22], src [6, 5, 208, 93, 13, 96], ethertype 34525, len: 76
RX: IP/UDP dst <IP_ADDRESS>, src <IP_ADDRESS>, len: 308
RX: unknown dst [51, 51, 255, 171, 84, 154], src [6, 5, 208, 93, 13, 96], ethertype 34525, len: 64
RX: unknown dst [51, 51, 0, 0, 0, 22], src [6, 5, 208, 93, 13, 96], ethertype 34525, len: 76
RX: unknown dst [51, 51, 0, 0, 0, 22], src [6, 5, 208, 93, 13, 96], ethertype 34525, len: 76
RX: unknown dst [51, 51, 0, 0, 0, 2], src [6, 5, 208, 93, 13, 96], ethertype 34525, len: 48
RX: unknown dst [51, 51, 0, 0, 0, 22], src [6, 5, 208, 93, 13, 96], ethertype 34525, len: 76
RX: unknown dst [51, 51, 0, 0, 0, 2], src [6, 5, 208, 93, 13, 96], ethertype 34525, len: 48
RX: IP/UDP dst <IP_ADDRESS>, src <IP_ADDRESS>, len: 308
...
```

In another terminal window new interface can be configured:
```
# ip a s dev test0
8: test0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000
    link/ether ea:83:83:db:e0:4f brd ff:ff:ff:ff:ff:ff
    inet6 fe80::1eb0:8ef4:e7ec:1d3/64 scope link
       valid_lft forever preferred_lft forever
# ip a a <IP_ADDRESS>/24 dev test0
```

Ping should work now:
```
# ip a a <IP_ADDRESS>/24 dev test0
# ping <IP_ADDRESS>
PING <IP_ADDRESS> (<IP_ADDRESS>) 56(84) bytes of data.
64 bytes from <IP_ADDRESS>: icmp_seq=1 ttl=75 time=5.22 ms
64 bytes from <IP_ADDRESS>: icmp_seq=2 ttl=75 time=65.8 ms
64 bytes from <IP_ADDRESS>: icmp_seq=3 ttl=75 time=1.91 ms
...
```

And `pingable.py` window:
```
...
RX: ARP req for <IP_ADDRESS> from <IP_ADDRESS>
==>	It's me!
RX: ICMP ping from <IP_ADDRESS>
RX: ICMP ping from <IP_ADDRESS>
RX: ICMP ping from <IP_ADDRESS>
...
```

repository: vitalyvb/GL-kernel-net

repo_name: vitalyvb/GL-kernel-net


text:
####Table of Contents

1. [Overview](#overview)
2. [Setup - What needs to be edited, changed, and configured](#setup)
    * [.fixtures.yml](#fixtures)
    * [Gemfile](#gemfile)
    * [.gitignore](#gitignore)
    * [metadata.json](#metadata)
    * [Rakefile](#rakefile)
3. [Manifests](#manifests)
4. [Rspec Tests](#rspec-tests)

##Overview

This is a stub that can be used to create a Puppet module. It includes basic support for building and testing using an rvm environment, which includes CI tools such as Jenkins or Travis. The rakefile includes support for rspec, lint, and syntax tests. It also includes the files needed to release the module to the Puppet Forge.

##Setup

While the files are in place, they are either in an unconfigured state or have dummy data in them. They will need to be edited to make them actually usable. Instructions are included below.

###.fixtures.yml

The .fixtures.yml file is a helper file used by the puppetlabs\_spec\_helper gem to make it easier to tell rspec where to find the module, as well as any modules from the forge or git repos. This is a part of the [rspec test framework](#rspec-tests) discussed below. Replace *module\_name* with your module's name and add any module dependencies. Full documentation is at https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures

###.gitignore

The files that you want git to ignore. Change this to suit your environment.

###Gemfile

The Gemfile is used to tell bundler which gems the module need to have installed in the ruby environment. It is configured to support a basic module with basic dependencies. If you need to add more gems, this is where to do it. It is vital that this be kept in sync with your module's needs if you are going to develop under rvm based ruby environments or if you are going to use a CI tool such as Jenkins or Travis. More information on the Gemfile can be found at http://bundler.io/man/gemfile.5.html

###metadata.json

The metadata.json file is used by the Puppet Forge to generate the module's page when it is published. Edit the file, replace the *Changeme* items with your own information, set the version number, update the dependencies, supported operating systems and versions, and requirements to suit your environment. Full documentation for the metadata.json file is found at https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html#write-a-metadatajson-file

###Rakefile

The Rakefile is ready to use as is. To run all tests, including syntax validation, linting, and rspec tests, just run "rake test". If you want to include syntax checking of hiera data, uncomment the relevant line and update the paths as needed.

##Manifests

The "manifests" directory is where you place your Puppet classes, following the best practices and instructions at https://docs.puppetlabs.com/pe/latest/quick_writing_nix.html

##Rspec Tests

The spec directory is where your rspec tests live. There is a stub in the "spec/classes" directory to get you started. If you need to use hiera data, it should be put in the "fixtures/hiera" directory. The hiera.yaml file in there is configured to load hiera data based on the "testname" fact, which can be set in your test files. See the documentation at http://rspec-puppet.com for more information.


text:
# DeepOcrService
![](./data/images/Screenshot.png)

Todo:
- [ ] English crnn model

# Requirements
- Ubuntu 16.04
- Tensorflow-gpu >= 1.6

# How to use

Get code:
```
git clone --recursive git@github.com:Sanster/DeepOcrService.git
```

Install dependencies:
```
pip3 install -r requirements.txt
```

Download models:

- Download `ctpn_vgg16.pb` and `crnn_raw.pb` from [sanster/models](https://github.com/Sanster/models)
, save to `data/models`.
- Rename `ctpn_vgg16.pb` as `ctpn.pb`, rename `crnn_raw.pb` as `crnn.pb`.

Build Cpython code:
```
cd tf_ctpn/lib && make
```

# Start web app
```
python3 app.py
```

Visit http://localhost:5000

# Do infer on commond line
```
python3 infer.py \
--img_dir= \
--viz
```

Press `ESC` to exit. Press `Space` to continue.


text:
<!--Copyright 2023 The HuggingFace Team. All rights reserved.

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

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

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

# Conditional image generation

[[open-in-colab]]

Conditional image generation allows you to generate images from a text prompt. The text is converted into embeddings which are used to condition the model to generate an image from noise.

The [`DiffusionPipeline`] is the easiest way to use a pre-trained diffusion system for inference.

Start by creating an instance of [`DiffusionPipeline`] and specify which pipeline [checkpoint](https://huggingface.co/models?library=diffusers&sort=downloads) you would like to download.

In this guide, you'll use [`DiffusionPipeline`] for text-to-image generation with [`runwayml/stable-diffusion-v1-5`](https://huggingface.co/runwayml/stable-diffusion-v1-5):

```python
>>> from diffusers import DiffusionPipeline

>>> generator = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", use_safetensors=True)
```

The [`DiffusionPipeline`] downloads and caches all modeling, tokenization, and scheduling components.
Because the model consists of roughly 1.4 billion parameters, we strongly recommend running it on a GPU.
You can move the generator object to a GPU, just like you would in PyTorch:

```python
>>> generator.to("cuda")
```

Now you can use the `generator` on your text prompt:

```python
>>> image = generator("An image of a squirrel in Picasso style").images[0]
```

The output is by default wrapped into a [`PIL.Image`](https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=image#the-image-class) object.

You can save the image by calling:

```python
>>> image.save("image_of_squirrel_painting.png")
```

Try out the Spaces below, and feel free to play around with the guidance scale parameter to see how it affects the image quality!

<iframe
	src="https://stabilityai-stable-diffusion.hf.space"
	frameborder="0"
	width="850"
	height="500"
></iframe>

repository: huggingface/diffusers

repo_name: huggingface/diffusers


text:
MutationObserver
========================

[![Browser Test Status](https://saucelabs.com/browser-matrix/mutationobserver.svg)](https://saucelabs.com/u/mutationobserver)
Note: the svg swapped the working browsers; IE8 works while IE7 fails 1 test

A polyfill for the [MutationObserver API](http://www.w3.org/TR/2013/WD-dom-20131107/#mutation-observers) ([can I use?](http://caniuse.com/mutationobserver)). The polyfill is more cause we can than should (with subtree at any rate)... It's async and uses a recursive timeout fallback (default checks changes every 30ms + runtime) instead of using the deprecated [DOM3 MutationEvents](http://www.w3.org/TR/DOM-Level-3-Events/#events-mutationevents) so theoretically can support virtually any environment.

```sh
$ npm install mutationobserver-shim
$ bower install MutationObserver-shim
```

CDN [![](https://data.jsdelivr.com/v1/package/npm/mutationobserver-shim/badge)](https://www.jsdelivr.com/package/npm/mutationobserver-shim)

```html
<script src="//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js"></script>
```

### Polyfill differences from standard interface

#### MutationObserver

* Implemented using a recursive `setTimeout` (every ~30 ms) rather than using a `setImmediate` polyfill; so calls will be made less frequently and likely with more data than the standard MutationObserver. In addition, it can miss changes that occur and then are lost in the interval window.
* Setting an observed elements html using `innerHTML` will call `childList` observer listeners with several mutations with only 1 addedNode or removed node per mutation. With the standard you would have 1 call with multiple nodes in addedNodes and removedNodes node lists.
* With `childList` and `subtree` changes in node order (eg first element gets swapped with last) should fire a `addedNode` and `removedNode` mutation but the correct node may not always be identified.

#### MutationRecord

* `addedNodes` and `removedNodes` are arrays instead of `NodeList`s
* `oldValue` is always called with attribute changes
* `nextSibling` and `previousSibling` correctfullness is questionable (hard to know if the order of appended items). I'd suggest not relying on them anyway (my tests are extremely permissive with these attributes)

### Supported MutationObserverInit properties

Currently supports the following [MutationObserverInit properties](https://developer.mozilla.org/en/docs/Web/API/MutationObserver#MutationObserverInit):

* **childList**: Set to truthy if mutations to target's immediate children are to be observed.
* **subtree**: Set to truthy to do deep scans on a target's children.
* **attributes**: Set to truthy if mutations to target's children are to be observed. As explained in #4, the `style` attribute may not be matched in ie<8.
* **attributeFilter**: Set to an array of attribute local names (without namespace) if not all attribute mutations need to be observed.
* **attributeOldValue**: doesn't do anything attributes are always called with old value
* **characterData**: currently follows Mozilla's implementation in that it will only watch `textNodes` values and not, like in webkit, where setting .innerHTML will add a characterData mutation.

### Performance

By default, the polyfill will check observed nodes about 25 times per second (30 ms interval) for mutations. Try running [these jsperf.com tests](http://jsperf.com/mutationobserver-shim) and the JSLitmus tests in the test suite for usage performance tests. It may be worthwile to adapt `MutationObserver._period` based on UA or heuristics (todo).

From my tests observing any size element without `subtree` enabled is relatively cheap. Although I've optimized the subtree check to the best of my abilities it can be costly on large trees. You can draw your own conclusions based on the JSLitmus and jsperf tests noting that you can expect the `mo` to do its check 28+ times a second (by default).

Although supported, I'd recommend against watching `attributes` on the `subtree` on large structures, as the check is complex and expensive on terrible hardware like my phone :(

The included minified file has been tuned for performance.

### Compatibility

I've tested and verified compatibility in the following browsers + [these Sauce browsers](https://saucelabs.com/u/mutationobserver)

* Internet Explorer 8 (emulated), 9, 10 in win7 and win8
* Firefox 4, 21, 24, 26 in OSX, win7 and win8
* Opera 11.8, 12.16 in win7
* "Internet" on Android HTC One V
* Blackberry 6.0.16

Try [running the test suite](https://rawgithub.com/megawac/MutationObserver.js/master/test/index.html) and see some simple example usage:

* http://jsbin.com/suqewogone listen to images being appended dynamically
* http://jsbin.com/bapohopuwi autoscroll an element as new content is added

See http://dev.opera.com/articles/view/mutation-observers-tutorial/ for some sample usage.


text:
#Ethereum.NET

A .NET implementation of the [Ethereum](https://www.ethereum.org/) protocol; a platform for building decentralised applications.

##What?
Whilst the internet is an excellent medium for facilitating communication and collaboration; there is a problem with trust. It's just too easy to lie. Our current model mitigates this by relying on centralised authorities to arbitrate between parties. A few limitations with this model include:

- single point of failure
- single point of control
- may be biased/incompetent/corrupt/untrustworthy themselves

##How?
Ethereum is a platform for building decentralised applications. It avoids centralised authorities by means of cryptographically verified peer consensus. The client provides a [turing complete](http://en.wikipedia.org/wiki/Turing_completeness) language built on top of a generic [blockchain](https://en.bitcoin.it/wiki/Block_chain). The original whitepaper by Vitalik Buterin can be found [here](https://github.com/ethereum/wiki/wiki/White-Paper). For the academically inclined, please see the yellowpaper by Dr Gavin Wood [here](http://gavwood.com/Paper.pdf).


text:
---
layout:         page
title:          "Cube U's Content Strategy"
breadcrumb:     "Content Strategy"
author:         Kohl, Mosser
status:
category:
contenttype:
tags:       Tracking, Workflow, Spreadsheet, Content Strategy
---

{% include toc.html %}

## Introduction
This section lays out the plan for populating CubeU content.

## Prerequisites
* None

## Cube U Content Strategy

### Phases
There is so much to do in capturing content, so we've planned our work around
specific phases.

**Proprietary Content**
For PI 6, we focused on capturing the more proprietary content of CUBE. This
ensured we got the things that may be less familiar to newcomers and also to get
these critical pieces documented in the event that team members depart GAIG.

**Non-proprietary Content**
For PI 7 and 8, we are are focusing on the remaining content which is more about
all the other more open source technologies *as applied* at Great American.

### Evolution of Content
We believe that learning best occurs by direct application with plenty of good
examples through repetition. Initially though we need to get the base
information rounded up in a simpler text format with text and graphics.

Later we plan on adding short videos and actual code examples. One of the great
benefits of using GitHub is the ability to include actual source code in the
style of plunkrs. We will also explore the incorporation of Kata based learning
into CubeU.

### Evolution of Platform
We have focused more on function and less on form at this juncture.

We plan on:

 * improving the layout and style of the site.
 * resolving a few known issues which we will resolve after the content work is
   completed.

We also want to add a mechanism that can review the existing content tree and
flag deficiencies or recommend better placement. We've been calling this system
"Squirrel" in the manner of creatures scavenging, gathering and storing
knowledge acorns. This is a future yet vital project that has not yet commenced.

## Workflow Process for Initial Content

As CubeU works to become a reality, we are depending on the efforts of many
teams to submit their expertise. We are also pulling in existing content from
Jive, Sharepoint and other sources.

So we've defined these workflow steps to get your content into CubeU:

  * **Plan** - specify a delivery Sprint; mark in Planning Worksheet
  * **Active** - you've actually begun the work in the planned sprint
  * **Ingest** - we've received your content and converting to Markdown format
  * **Curate** - we are adapting the content to be consistent with Cube U style
  * **Review** - we've sent a link back to you for your blessing
  * **Finished** - content is ready for consumption

## Tracking Spreadsheet

We are using a [Content Tracking Spreadsheet](https://gaig.jiveon.com/docs/DOC-27534)
for our planning purposes. We've asked Tech Leads and/or Scrummasters to update
the progress on the individual content pieces.

The spreadsheet contains a detailed list with status of all planned content
modules. If you think of any items that are missing, please add them (and let us
know). ![](../images/cubeUPlanning.png){: .image}

There is also a summary worksheet which details the status of these items
throughout Program Increment 6, 7 and 8. ![](../images/cubeUDelivery.png){:
.image}

## For Further Reading

* Links

repository: octobiwancatnobi/squirrel-u

branch_name: refs/heads/gh-pages

gha_language: HTML

repo_name: octobiwancatnobi/squirrel-u


text:
# apc_cas

In case anyone is puzzled by the function name, "cas" refers to http://en.wikipedia.org/wiki/Compare-and-swap

---

[Official documentation page](https://www.php.net/manual/en/function.apc-cas.php)

**[To root](/README.md)**


text:
# Mobile CDISC Library Browser Editor

A CDISC Library browser optimized for mobile devices

Visit [defineeditor.com/cla-mobile](http://defineeditor.com/cla-mobile) to learn more about the Browser.

# Support

* [Github Issues](https://github.com/defineEditor/cla-mobile/issues)
* [Telegram](https://t.me/defineeditor)
* [support<EMAIL_ADDRESS>
# Building the application from source

### Prerequisites

The following software is needed to compile the application:
* Git
* Node.js
* NPM

### Installing

Clone the repository:
```
git clone https://github.com/defineEditor/cla-mobile.git
```
Install all required dependencies:
```
npm install
```

## Running in development mode
The application is served using HTTPS protocol. It is needed to generate local certificates and make them trusted by your browser. This can be achieved with [mkcert](https://github.com/FiloSottile/mkcert). The files should be placed in a cert subfolder (localhost.pem and localhost-key.pem).

To run the application in a development mode use the following command:
```
npm start
```
After that you should be able to access the application using [https://localhost:3000](https://localhost:3000)

## Authors

* [**Dmitry Kolosov**](https://www.linkedin.com/in/dmitry-kolosov-91751413/)

## License

This project is licensed under the MIT - see the [LICENSE.txt](LICENSE.txt) file for details.

repository: defineEditor/cla-mobile

repo_name: defineEditor/cla-mobile


text:
Prerender Rails [![Build Status](https://travis-ci.org/prerender/prerender_rails.png)](https://travis-ci.org/prerender/prerender_rails) [![Gem Version](https://badge.fury.io/rb/prerender_rails.png)](http://badge.fury.io/rb/prerender_rails)
===========================

Google, Facebook, Twitter, and Bing are constantly trying to view your website... but Google is the only crawler that executes a meaningful amount of JavaScript and Google even admits that they can execute JavaScript weeks after actually crawling. Prerender allows you to serve the full HTML of your website back to Google and other crawlers so that they don't have to execute any JavaScript. [Google recommends using Prerender.io](https://developers.google.com/search/docs/guides/dynamic-rendering) to prevent indexation issues on sites with large amounts of JavaScript.

Prerender is perfect for Angular SEO, React SEO, Vue SEO, and any other JavaScript framework.

This middleware intercepts requests to your Node.js website from crawlers, and then makes a call to the (external) Prerender Service to get the static HTML instead of the JavaScript for that page. That HTML is then returned to the crawler.

`Note` Make sure you have more than one webserver thread/process running because the prerender service will make a request to your server to render the HTML.

Add this line to your application's Gemfile:

    gem 'prerender_rails'

And in `config/environment/production.rb`, add this line:

```ruby
	config.middleware.use Rack::Prerender
```

or if you have an account on [prerender.io](https://prerender.io/) and want to use your token:

```ruby
	config.middleware.use Rack::Prerender, prerender_token: 'YOUR_TOKEN'
```

`Note` If you're testing locally, you'll need to run the [prerender server](https://github.com/prerender/prerender) locally so that it has access to your server.

## Testing

When testing make sure you're not using a single threaded application server like default WEBrick one, use Puma or Unicorn to prevent a deadlock when the Prerender Service needs to render your HTML on the fly.

The best way to test the prerendered page is to [set the User Agent of your browser to Googlebot's user agent](https://developers.google.com/web/tools/chrome-devtools/device-mode/override-user-agent) and visit your URL directly. If you View Source on that URL, you should see the static HTML version of the page with the `<script>` tags removed from the page. If you still see `<script>` tags then that means the middleware isn't set up properly yet.

`Note` If you're testing locally, you'll need to run the [prerender server](https://github.com/prerender/prerender) locally so that it has access to your server.

## How it works
1. The middleware checks to make sure we should show a prerendered page
	1. The middleware checks if the request is from a crawler by checking the user agent string against a default list of crawler user agents
	2. The middleware checks to make sure we aren't requesting a resource (js, css, etc...)
	3. (optional) The middleware checks to make sure the url is in the whitelist
	4. (optional) The middleware checks to make sure the url isn't in the blacklist
2. The middleware makes a `GET` request to the [prerender service](https://github.com/prerender/prerender)(phantomjs server) for the page's prerendered HTML
3. Return that HTML to the crawler

# Customization

### Whitelist

Whitelist a single url path or multiple url paths. Compares using regex, so be specific when possible. If a whitelist is supplied, only url's containing a whitelist path will be prerendered.
```ruby
config.middleware.use Rack::Prerender, whitelist: '^/search'
```
```ruby
config.middleware.use Rack::Prerender, whitelist: ['/search', '/users/.*/profile']
```

### Blacklist

Blacklist a single url path or multiple url paths. Compares using regex, so be specific when possible. If a blacklist is supplied, all url's will be prerendered except ones containing a blacklist path.
```ruby
config.middleware.use Rack::Prerender, blacklist: '^/search'
```
```ruby
config.middleware.use Rack::Prerender, blacklist: ['/search', '/users/.*/profile']
```

### before_render

This method is intended to be used for caching, but could be used to save analytics or anything else you need to do for each crawler request. If you return a string from before_render, the middleware will serve that to the crawler instead of making a request to the prerender service.
```ruby
config.middleware.use Rack::Prerender,
	before_render: (Proc.new do |env|
		# do whatever you need to do.
	end)
```

### after_render

This method is intended to be used for caching, but could be used to save analytics or anything else you need to do for each crawler request. This method is a noop and is called after the prerender service returns HTML.
```ruby
config.middleware.use Rack::Prerender,
	after_render: (Proc.new do |env, response|
		# do whatever you need to do.
	end)
```

### build_rack_response_from_prerender

This method is intended to be used to modify the response before it is sent to the crawler. Use this method to add/remove response headers, or do anything else before the request is sent.
```ruby
config.middleware.use Rack::Prerender,
	build_rack_response_from_prerender: (Proc.new do |response, prerender_response|
		# response is already populated with the prerender status code, html, and headers
		# prerender_response is the response that came back from the prerender service
	end)
```

### protocol

Option to hard-set the protocol for Prerender accessing your site instead of the middleware figuring out the protocol based on the request.
```ruby
config.middleware.use Rack::Prerender, protocol: 'https'
```

## Caching

This rails middleware is ready to be used with [redis](http://redis.io/) or [memcached](http://memcached.org/) to return prerendered pages in milliseconds.

When setting up the middleware in `config/environment/production.rb`, you can add a `before_render` method and `after_render` method for caching.

Here's an example testing a local redis cache:

_Put this in `config/environment/development.rb`, and add `gem 'redis'` to your Gemfile._

```ruby
require 'redis'
@redis = Redis.new
config.middleware.use Rack::Prerender,
  before_render: (Proc.new do |env|
    @redis.get(Rack::Request.new(env).url)
  end),
  after_render: (Proc.new do |env, response|
    @redis.set(Rack::Request.new(env).url, response.body)
  end)
```

## Using your own prerender service

We host a Prerender server at [prerender.io](https://prerender.io/) so that you can work on more important things, but if you've deployed the prerender service on your own... set the `PRERENDER_SERVICE_URL` environment variable so that this middleware points there instead. Otherwise, it will default to the service already deployed by [prerender.io](https://prerender.io/).

	$ export PRERENDER_SERVICE_URL=<new url>

Or on heroku:

	$ heroku config:add PRERENDER_SERVICE_URL=<new url>

As an alternative, you can pass `prerender_service_url` in the options object during initialization of the middleware

``` ruby
config.middleware.use Rack::Prerender, prerender_service_url: '<new url>'
```

## License

The MIT License (MIT)

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

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

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

gha_language: Ruby


text:
# MessageBot.io
*A modern customer relationship and analytics platform*

[![CircleCI](https://circleci.com/gh/messagebot/messagebot-core.svg?style=svg)](https://circleci.com/gh/messagebot/messagebot-core)

## Requirements

| Software          | Version   |
|-------------------|-----------|
| Node.JS           | >=4.0.0   |
| Redis             | >=2.0.0   |
| MySQL or Postgres | "modern"  |

## Screenshots

      Dashboard

      Search Results

      Template Creation

      System Status

## Install

- `npm install`
- `cp .env.example .env`, and adjust according to your system/needs

## Configuration and Running

- Start `redis`
- Start your relational database, IE: `mySQL`
  - be sure to create the database you need for development, IE:
    - (mysql) `mysql -u root -e "crete database messagebot_development"`
    - (postgres) `createdb messagebot_development`
  - Install any additional database drivers needed for your relational database:
    - `npm install --save pg pg-hstore`
    - `npm install --save mysql`
    - etc
- Configure `.env` with the secrets you need, or ensure that they are already present within the environment
  - ensure that the databases you listed exist and that the user(s) you have configured can reach & access them
- Source your environment, ie: `source .env`
- Create the First Team from the CLI:
  - `npx actionhero messagebot team create --name MessageBot --trackingDomainRegexp "^.*$" --trackingDomain "http://tracking.myapp.com"<EMAIL_ADDRESS>--password="password"`
  - This will also create the first admin user for this team.  Take note of this user's email and password.
- Start the App: `npm start`

## Migration Options

Run `npm run migrate` to migrate the database.

## Faker

To generate seed data, you can run 2 faker commands:

- `npm run faker:seed` will generate `process.env.USERS_COUNT || 1000` users who follow the funnel between now and 30 days ago.
- `npm run faker:run` will start generating fake users and events now, creating a new one every `parseInt(process.env.SLEEP) || (1000 * 2.2)`ms

Both faker commands follow a funnel designed to emulate a simple e-commerce applications conversion funnel.  Reaching the final `thank you` page will also genearte a purchase event.
```js
exports.funnel = [
  { pages: ['index.html'],                                                rate: 1.00 },
  { pages: ['about.html', 'learn_more.html'],                             rate: 0.50 },
  { pages: ['signup.html', 'log-in.html'],                                rate: 0.50 },
  { pages: ['cool-hat.html', 'aweseome-shoes.html', 'ugly-sweater.html'], rate: 0.30 },
  { pages: ['cart.html'],                                                 rate: 0.50 },
  { pages: ['checkout.html'],                                             rate: 0.50 },
  { pages: ['thank-you.html'],                                            rate: 0.99 },
];
```

Users will be assigned one of the following sources at random:
```js
exports.sources = ['web', 'iphone', 'android', 'referral'];
```

The funnel and sources can be modified via `db/fakers/common.js`

## CLI

The MessageBot CLI is used to manage system-level data, IE: the creation and removal of teams.  You can learn more about the CLI by running `./bin/messsagebot help`

## Testing

`npm test` should postinstall and run everything you need, including the creation and seeding of your database.  Ensure that the environment and various config files are prepared correctly.

**Notes**
- At this time, the test suite will only run on MySQL or Postgres, and assumes the test databases are local (on the same host) as where you are running the test suite code.
- The test suite will configure a new redis database to be used equal to your normal database ID + 1

## Notes

This product includes GeoLite2 data created by MaxMind, available from [www.maxmind.com](http://www.maxmind.com).

---

# Plugin Guide

`MessageBot Plugins` are normal [`ActionHero Plugins`](http://www.actionherojs.com/docs/#plugins). They can be installed from NPM, Git, or locally checked into your project.  In additional to the normal creation of Actions and Initializers, you can also modify the core of MessageBot:

## Settings

If your plugin requires that a team configure a setting, you can use the `setting` API:

```js
api.teams.settings.push({
  key: 'client:tracking:web:cookieExpiry',
  value: (1000 * 60 * 60 * 24 * 365), // 1 year
  description: 'How long to store the personId cookie in the browser for (ms)'
});
```

Please use verbose key names like the above to avoid collisions.  You can add your key in any initializer.

## Transports

Transports let you send messages by other mediums.  Transports have a `name`, `description`, `requiredDataKeys` (properties of events and people which must exists and are used to send the message), `campaignVariables` (properties which must be sent when creating a campaign using this transport), and finally a `deliver()` method.

The `deliver()` method accepts a payload (which contains `body` and the `campaignVariables`), a person, and a callback.

The simplest transport, `logger` (which just logs the message to MessageBot's logs) would be:

```js
// in an initializer
let transport = {
  name: 'logger',
  description: 'for testing messages by sending them to a log file',

  requiredDataKeys: {
    person: ['firstName', 'lasName']
  },

  campaignVariables: [
    'logPrefix',
    'logLevel',
  ],

  deliver: function(payload, person, callback){
    let message = '';
    message += '[' + payload.logPrefix + ' | to ' + person.data.data.firstName + ' ' + person.data.data.firstName + '] ';
    message += payload.body;

    api.log(message, payload.logLevel);
    return callback();
  }
}

api.transports.push(transport);
```

## Front-End Routes

To Modify the navigation elements of the application (the top-nav of the website), use `api.navigation.navigation`:

```js
api.navigation.navigation.push({
  title: 'Data',
  align: 'left',
  glyphicon: 'glyphicon-equalizer',
  loggedIn: true,
  elements: [
    {route: '/#/people/recent', title: 'People: Recent', glyphicon: 'glyphicon-user', highlights: ['^\/people\/recent.*$']},
    {route: '/#/people/search', title: 'People: Search', glyphicon: 'glyphicon-user', highlights: ['^\/people\/search.*$']},
    {route: '/#/person/new', title: 'Person: New', glyphicon: 'glyphicon-user', highlights: ['^\/person\/new$']},
    {divider: true},
    {route: '/#/events/recent', title: 'Events: Recent', glyphicon: 'glyphicon-equalizer', highlights: ['^\/events\/recent.*$']},
    {route: '/#/events/search', title: 'Events: Search', glyphicon: 'glyphicon-equalizer', highlights: ['^\/events\/search.*$']},
    {route: '/#/event/new', title: 'Event: New', glyphicon: 'glyphicon-equalizer', highlights: ['^\/event\/new$']},
    {divider: true},
    {route: '/#/messages/recent', title: 'Messages: Recent', glyphicon: 'glyphicon-envelope', highlights: ['^\/messages\/recent.*$']},
    {route: '/#/messages/search', title: 'Messages: Search', glyphicon: 'glyphicon-envelope', highlights: ['^\/messages\/search.*$']},
    // {route: '/#/message/new', title: 'Message: New', glyphicon: 'glyphicon-envelope', highlights: ['^\/message\/new$']},
  ]
});

```

---

# Client-Side Tracking

## Image Link Tracking

When rendering templates to your users, including `{{{ beacon }}}` will insert a tracking image into the body of your message (for HTML messages/emails).  You can also refrence `{{{ view.beconLink }}}` to obtain just the URL for the tracking image. URLs will take the form of `{{ team.trackingDomain }}/api/message/track.gif?verb=read&guid={{ messageGuid }}`.

Loading this image denotes the message was "viewed", updating the message and creating an event for having viewed the message.

Any HTML links in your template can be configured to track the click, and therefore mark the message as 'acted'.  Use the `track` function, ie: `{{#track}}http://messagebot.io{{/track}}`.  This will transform your links to something of the form: `{{ team.trackingDomain }}/api/message/track.gif?verb=act&guid={{ messageGuid }}&link=http://messagebot.io`

You can include template within other templates as well.  Use the mustache function `include`, and pass the name or ID of the template you want to include, ie: `{{#include}}footer{{/include}}`.

## JavaScript / Browser

- You'll get a link to the client-side JS from the settings page.
- Include it in your app (`<script src="https://tracking.yoursite.com/api/client"></script>`)

### The Person
```js
// Init the person we are tracking
// This will automatically capture relevant browser data
// If you don't have a PersonID, we will generate one at random.
// We will set a cookie with this personID, so on subsequent pages you don't need to set it
//   nor will you need to call init again manually
MESSAGEBOT.init('<your PersonID>');
// If you pass your PersonID via the URL, you can get it
MESSAGEBOT.init( MESSAGEBOT.getURLParameter('personID') );

// You can modify/add extra properties to the person
MESSAGEBOT.person.edit({firstName: 'tester'});

// You can also display what MessageBot knows about the person
// We'll also update `MESSAGEBOT.data.person` to inspect later
MESSAGEBOT.person.hydrate(function(error, data){ console.log(data); });

// And you can delete the person
MESSAGEBOT.person.delete();

// People can opt in/out of your communications as well
// Opt Out of one list:
MESSAGEBOT.person.opt({direction: 'out', listGuid: 123});
// Opt back in:
MESSAGEBOT.person.opt({direction: 'in', listGuid: 123});
// Opt out of all communications all together:
MESSAGEBOT.person.opt({direction: 'out', global: true});
```

### Events
Tracking events is as simple as:
```js
// simple
MESSAGEBOT.track({type: 'pageview'});

// complex
MESSAGEBOT.track({
  type: 'purchase',
  data: {
    value: 12.50, tax: 0.50, products: [
      {name: 'car', make: 'Toyota', model: 'Prius', price: 12.00}
    ]
  }
});
```

Tracking an event will automatically append many relevant variables about the page, like referrer, href, browser type, etc.  You can track events at any time, even before the person is initialized.  We'll wait until the person is loaded up until actually sending events to the server.

## iOS
TODO

## Android
TODO

---

repository: messagebot/messagebot-core

repo_name: messagebot/messagebot-core


text:
# Options

## Color

Any color supported by [chart.js](https://www.chartjs.org/docs/master/general/colors) is supported by the annotation plugin.

## Font

Fonts use the same format as [chart.js](https://www.chartjs.org/docs/master/general/fonts).

## Padding

Paddings use the same format as [chart.js](https://www.chartjs.org/docs/master/general/padding.html).

## Point Style

Point styles use the same format as [chart.js](https://www.chartjs.org/docs/master/configuration/elements.html#point-styles).

## Interaction

Interaction uses the same format as [chart.js](https://www.chartjs.org/docs/latest/configuration/interactions.html#interactions).

:::warning

Interaction `index` and `dataset` modes are not supported by the plugin. If set, the plugin will use `nearest` mode.

Interaction `r` axis is not supported by the plugin. If set, the plugin will use `xy` mode.

:::

## Scriptable Options

As with most options in chart.js, the annotation plugin options are scriptable. This means that a function can be passed which returns the value as needed. In the example below, the annotation is hidden when the screen is less than 1000px wide.
The function receives 2 arguments, first is the [option context](#option-context) representing contextual information. An options resolver is passed as second argument, which can be used to access the options that were originally passed in to configure the annotation element.

```js chart-editor
/* <block:options:0> */
const options = {
  plugins: {
    annotation: {
      annotations: {
        box1: {
          drawTime: 'afterDatasetsDraw',
          display: (context, opts) => {
            const body = document.querySelector('body');
            const rect = body.getBoundingClientRect();
            return rect.width >= 1000;
          },
          type: 'box',
          xMin: 1,
          xMax: 2,
          yMin: 50,
          yMax: 70,
          backgroundColor: 'rgba(255, 99, 132, 0.5)'
        }
      }
    }
  }
};
/* </block:options> */

/* <block:config:1> */
const config = {
  type: 'line',
  data: {
    labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
    datasets: [{
      label: 'My First Dataset',
      data: [65, 59, 80, 81, 56, 55, 40],
      fill: false,
      borderColor: 'rgb(75, 192, 192)',
      tension: 0.1
    }]
  },
  options
};
/* </block:config> */

module.exports = {
  config
};
```

## Draw Time

The `drawTime` option for an annotation determines where in the chart lifecycle the drawing occurs. Four potential options are available:

| Option | Notes
| ---- | ----
| `'beforeDraw'` | Occurs before any drawing takes place
| `'beforeDatasetsDraw'` | Occurs after drawing of axes, but before datasets
| `'afterDatasetsDraw'` | Occurs after drawing of datasets but before items such as the tooltip
| `'afterDraw'` | After other drawing is completed.

## Option Context

The option context is used to give contextual information when resolving options and only applies to scriptable options. The object is preserved, so it can be used to store and pass information between calls / options.

There are 2 levels of option context objects:

* `chart`
  * `annotation`

The context object contains the following properties:

### chart

* `chart`: the associated chart
* `type`: `'chart'`

The [chart](#chart) option context is provided by Chart.js. It is passed to scriptable options when resolving annotation `id`, `type` and `drawTime` or adjusting scale ranges in `afterDataLimits` hook. The options resolved at that time are `scaleID`, `xScaleID`, `yScaleID`, `value`, `endValue`, `xMin`, `xMax`, `yMin`, `yMax`, `xValue` and `yValue`.

### annotation

In addition to [chart](#chart)

* `id`: the annotation id
* `element`: the annotation element
* `type`: `'annotation'`

The [annotation](#annotation) option context is passed to scriptable options in all other cases, except when resolving `id`, `type` or adjusting scale ranges. The same values resolved in `afterDataLimits` with [chart](#chart) context are again evaluated in `afterUpdate` with [annotation](#annotation) context.

Note that the annotation element may be undefined or partially uninitialized, since scriptable options may be invoked during the initial chart display, before everything's been resolved and initialized.

repository: stockiNail/chartjs-plugin-annotation

repo_name: stockiNail/chartjs-plugin-annotation


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

### Description

The sqlite3VXPrintf function in printf.c in SQLite before 3.8.9 does not properly handle precision and width values during floating-point conversions, which allows context-dependent attackers to cause a denial of service (integer overflow and stack-based buffer overflow) or possibly have unspecified other impact via large integers in a crafted printf function call in a SELECT statement.

### POC

#### Reference
- http://www.oracle.com/technetwork/security-advisory/cpujul2018-4258247.html
- http://www.oracle.com/technetwork/topics/security/bulletinapr2016-2952098.html

#### Github
- https://github.com/ARPSyndicate/cvemon

repository: trickest/cve

repo_name: trickest/cve


text:
unpi
========================
Unified Network Processor Interface for Texas Instruments Wireless SoCs.

[![NPM](https://nodei.co/npm/unpi.png?downloads=true)](https://nodei.co/npm/unpi/)

[![Travis branch](https://img.shields.io/travis/simenkid/unpi/master.svg?maxAge=2592000)](https://travis-ci.org/simenkid/unpi)
[![npm](https://img.shields.io/npm/v/unpi.svg?maxAge=2592000)](https://www.npmjs.com/package/unpi)
[![npm](https://img.shields.io/npm/l/unpi.svg?maxAge=2592000)](https://www.npmjs.com/package/unpi)

<br />

## Documentation

Please visit the [Wiki](https://github.com/simenkid/unpi/wiki).

## Overview

The *unpi* is the packet builder and parser for Texas Instruments [_Unified Network Processor Interface (UNPI)_](http://processors.wiki.ti.com/index.php/Unified_Network_Processor_Interface) used in RF4CE, BluetoothSmart, and ZigBee wireless SoCs. As stated in TI's wiki page:

> TI's Unified Network Processor Interface (NPI) is used for establishing a serial data link between a TI SoC and external MCUs or PCs. This is mainly used by TI's network processor solutions.

## Installation

> $ npm install unpi --save

## Usage

Here is an quick example. See [Usage](https://github.com/simenkid/unpi/wiki#Usage) on the Wiki for details.

```js
var Unpi = require('unpi'),
    SerialPort = require("serialport").SerialPort;

var sp = new SerialPort("/dev/ttyUSB0", {
        baudrate: 57600
    }),
    unpi = new Unpi({
        lenBytes: 1
        phy: sp
    });

unpi.on('data', function (data) {
    console.log(data);  // The parsed data receiving from the serial port
});
```

## License

Licensed under [MIT](https://github.com/simenkid/unpi/blob/master/LICENSE).

repository: Koenkk/unpi

repo_name: Koenkk/unpi


text:
+++
City = "Portland"
Year = "2016"
date = "2016-07-09T09:00:00-08:00"
title = "Ken Mugrage"
type = "talk"
+++

**Title:** What we’re learning about burnout and how a DevOps culture can help

**Description:**

One of the most overlooked advantages of converting to a DevOps culture can be the reduction of stress. This could be due to “sharing the load” as a whole team, the feeling of joint ownership in solving a business problem, or many other things.

If you’re asked to support somebody else’s application without any insight to how it was built and what problems it’s trying to solve you’re likely to experience more than a little stress. The same is true if you’ve toiled away creating the perfect application only to see it deployed in a way that makes it unable to perform.

The combination of stress and burnout is perhaps the biggest health threat in our industry. In fact, recent research has found that burnout--and the related concept of "vital exhaustion"--increases your risk of cardiovascular disease as much as body mass index, smoking and lipid levels. Unfortunately there are also well-known stories of burnout-related suicides in our industry, making this literally a life and death issue.

If that isn’t reason enough to address the issue, we also know from the State of DevOps survey that the #1 indicator of company success is job satisfaction.

In this talk Ken will go over some of the leading research in the area of burnout. We’ll talk about some of the more common causes of burnout as identified by clinical research and talk about how you can learn from organizations with solid DevOps cultural practices to help alleviate them.

repository: vjanelle/devopsdays-web

repo_name: vjanelle/devopsdays-web


text:
# Shareculator (in processing)

Shareculator is an Open-source online share calculator. It allows multiple user access and edit a shared list of payments, and calculate the final payment that each sharer should pay. ShareCulator is easy to load, save and share, and support graphic chart and finance analyze

Features:

Online Calculator for splitting payment

Client-side Operation

Up to 8 Users

Payments Recommendation

Mobile friendly design

English & Chinese support

Operations: add, delete, drag and drop, undo

Further Design:

Data analyze with chart (please see miniChart.js)

Massive user architecture(database)

Information:

Author: Hao Hu @Boston University

Email<EMAIL_ADDRESS>
License: MIT

repository: Hardys-/Shareculator

repo_name: Hardys-/Shareculator