text:
# water-tracking and other IoT automata
### Primary function:
IoT integration between Tuya smart switch and Rach.io irrigation control to track and alert on water consumption
* Poll data from Tuya and Rach.io
* Postprocessing to understand usage
* Http service for plotting data
* Email monitoring if current (short term filtered) rates exceed historical rates

### Secondary functions:
* Simple script for monitoring Foscam IP cameras and Windows desktop, and reboot on demand with email reporting.
* Manage log rotation on foscam videos ftp folder.
* Image classifier for garage door status with email reporting
* Test uplink for external IP address, and speedtest
* Monitor laptop "GARMOUGAL" for blacklisted websites

### Ternary functions:
* Add foscams to alexa via homebridge straddles.

## Project Timelines:
* 08-10-2018: Initial concept for water-monitoring after n-th breakage of drip irrigation and many days of wasted water.
* 08-22-2018: Buy smart switches with energy monitoring (aka: Tuya)
* 08-25-2018: Energy monitor cli scraper tested
* 08-28-2018: Enhancements to tuya-cli to get electric current readings
* 08-30-2018: [v0.1]   Simple script to get csv logs of scrape, with a 3 step manual process to generate MS Excel plots.
* 09-03-2018: [v0.5]   1st online plot with canvasJS on apache server. "We have live data on pump state"
* 09-10-2018: [v0.6]   Harden: autostart polling script, crontabs, etc.
* 09-20-2018: [v0.8]   Plot histogram data. Looks good but not actionable. "May help find a leak"
* 10-06-2018: [v0.9]   Build rachio cli scraper. Plot rachio data. We now have full visibility on what is going on!
                       Actionable but not easy to understand. "Will help find a leak"
* 10-25-2018: [v1.0]   Plot "rates"! Actionable, easy to understand, but not accurate. "Will find leaks, but also high FA/MD"
* 11-01-2018: [v1.0.1] Build rachio event parser
* 11-04-2018: [v1.1]   Move to event parsing. "Definitive", but reactive.
* 11-06-2018: [v1.1.1] Better handling of missing events.
* 11-09-2018: [v1.2]   Emails. "Definitive with Reminders". Quick hack emails. Dropped the dummy zonestats.
                       Fix events handling for missing start event, or partial irrigation data by always starting RachioEvents reader from midnight.
* 11-16-2018: [v1.2.1] Refactor. Drop the low confidence data from short runs for Drip zones
* 11-17-2018: [v1.3]   Email alerts - 1st version. Seems to be about right, but will need tweaking. "Definitive and proactive"
* 11-21-2018: [v1.3.1] Refactor emails. Better handling of alerting, email frequency, content
* 12-08-2018: [v1.4]   Extend email capabilties. Add Foscam/Alpha monitoring to ecosystem. Refactor directories
* 12-08-2018: [v1.4.1] Use logger and arg parser in Parser. Remove symlink to lib files
* 01-15-2019: [v1.4.2] Github repo.
* 01-15-2019: [v1.4.3] Better filtering on email reports. Add pumpDutyCycle to emails.
* 01-20-2019: [v1.4.4] Better reporting on reboot. Add deep inspection to confirm windows is healthy
* 01-21-2019: [v1.5.0] Foscam garage image fetch. ML experimentation stubs.
                       Further refinement on email reports (inc script error traceback)
* 01-23-2019: [v1.5.1] HTML emails. CPU temp monitoring for host OS. Foscam ftp folder sanity check
* 01-25-2019: [v1.5.2] HTML emails part 2. Minor tweak to averaging computation. Installation notes for tensorflow
* 01-28-2019: [v1.5.3] Minor tweaks on plotter/email. bug fix on check_deep_state. restartable background processes in cron.
* 01-30-2019: [v1.5.4] Minor fix in rates computation. Post report on the website too. bug fixes on check_garage. Drop the non-alert day.
* 02-13-2019: [v1.5.5] Maintenance release. TF libraries finally working (Details below).
* 02-14-2019: [v1.5.6] Some cleanup around email alerts
* 02-16-2019: [v1.5.7] Bug fix on node check, simplified Mailer logic -> move complexity into cron
                       New TF model training and predictor script (but still not working for garage image)
* 02-17-2019: [v1.6.0] First version of garage door detector (Recall: 0% :( )
                       Note: Need to run, and save transferlearning output before first activation
                       Moved everything down to python 3.5 to support TF.
* 02-17-2019: [v1.6.1] Bug fix on alerting exposed by python3.5 not using ordered dicts. Fix logger level.
                       Garage detector can now bypass image save to disk. Recall is still 0%. Install notes for OpenCV
* 02-18-2019: [v1.6.2] OpenCV only available for python3.6. In general seems to be a bad idea to stay with 3.5, as apt-get will misbehave.
                       Building TF for 3.6 and we expect cruising. Some cleanup - retry for nodecheck, config of "logs" directory.
* 02-19-2019: [v1.6.3] favicon. Better error reporting on purge_foscam_files. Opencv install notes. refactor PumpReports.
* 03-01-2019: [v1.6.4] Better sizing for charts. Stablize Garage TF on python3.5. Improvements to deletion of foscam logging directory
* 03-10-2019: [v1.6.5] Improvements to deletion of foscam logging directory. Add foscam image checking to Rebooter
* 03-16-2019: [v1.6.6] Bring foscam deletion under the proper email control (instead of using cron reports)
* 03-17-2019: [v1.6.7] Early Success on Garage ML! Worked on animals library...
```
    Loading model: /home/abutala/bin/GarageCheck/my_model.h5
    Recheck model on training dir: /home/abutala/image_classification/train_animals/
    Found 197 images belonging to 3 classes.
    Loss:  0.2567218820632998 Accuracy:  0.9187817258883249
    Predicting image: /home/abutala/image_classification/train_animals/horses/images.jpg
    1/1 [==============================] - 4s 4s/step
    Best Guess: horses (Confidence: 0.94)  -- [0.01,0.04,0.94]
```
* 03-18-2019: [v2.0.0] First working release of ML detector
* 02-16-2020: [v2.1.0] Add uplink test diagnostics
* 02-17-2020: [v2.1.1] Add reboot foscams to landing page. Refine stats sort order on landing page
* 03-22-2020: [v2.1.2] uplink test retry logic
* 04-25-2020: [v2.1.3] Rollup of minor enhancements to error handling
* 05-22-2020: [v2.2.0] New module for remote browser web usage alerting. Also add Twilio SMSing
* 06-02-2020: [v2.2.1] Dynamically reload-able config
* 05-29-2022: [v2.3.0] Telsa Powerwall state machine

### Pending:
* Eliminate Constants.sh using https://goo.gl/UgfwCr

## Dependencies:
* Base:
  * wget -c https://nodejs.org/dist/latest-v10.x/node-v10.9.0-linux-arm64.tar.gz
  * sudo tar -xzf node-v10.9.0-linux-arm64.tar.gz --strip-components=1 --group=root --no-same-owner -C /usr/local/
  * apt-get install npm
  * apt-get install python3.6 python3-pandas python3-numpy python3-scipy python3-keras python3-matplotlib python3-opencv python3-h5py python3-pip
  * Note: keras is a part of TF, but in order to support legacy code, we need the standalone package too.
* Tuya/Rachio/Foscam/Liftmaster/TeslaPy:
  * https://github.com/TuyaAPI/cli
  * https://github.com/codetheweb/tuyapi
  * sudo npm -g i rachio
  * pip3 install pyfoscam
  * pip3 install pymyq
  * https://github.com/tdorssers/TeslaPy.git
* bazel-- modify scripts/bootstrap/compile.sh with .. BAZEL_JAVAC_OPTS="-J-Xms384m -J-Xmx512m"
* Tensorflow and opencv -- See below
* checkout homebridge.io
  * Configuring it for alexa: https://gist.github.com/johannrichard/0ad0de1feb6adb9eb61a/
* speedtest:
  * sudo apt-get install gnupg1 apt-transport-https dirmngr, lsb-release
  * export INSTALL_KEY=379CE192D401AB61
  * export DEB_DISTRO=$(lsb_release -sc)
  * sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
  * echo "deb https://ookla.bintray.com/debian ${DEB_DISTRO} main" | sudo tee  /etc/apt/sources.list.d/speedtest.list
  * sudo apt-get update
  * sudo apt-get install speedtest

### Changes to libraries:
* In cli, modify get to passthrough config. Add support for dps option
* In tuyaApi, add support for dps option
* In python3: site-packages/foscam/__init__.py (from foscam.foscam import ... )

### Tensorflow/Opencv:
* Two options here: Either install TF for Py3.6 [recommended] or Opencv for Py3.5 (Opencv is officially available for py3.6)
* We tired v. hard to compile tf, but failed, so finalled compiled opencv
* For TF: [Note: building bazel will take ~1 day, building TF will take ~2 days!!]
* Confirm that odroid has sufficent power (may fail if powered froma CPU usb port).
  * If still hitting odroid reboots: cpulimit -l 10 -- <command>
* Increase system swap to 4GB:
  * grep SwapTotal /proc/meminfo
  * sudo swapoff -a
  * sudo dd if=/dev/zero of=/swapfile bs=1G count=4
  * sudo chmod 600 /swapfile
  * sudo mkswap /swapfile
  * sudo swapon /swapfile
  * Also add to fstab
* Finally did not use virtual env, but if required:
  * sudo apt-get install virtualenv
  * virtualenv --system-site-packages -p python3.6 ./python-tf/
* Build TF: https://www.tensorflow.org/install/source
  * bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
  * ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
  * pip3 install --upgrade tensorflow-\*aarch64.whl
* Alternative (we found a TF wheel for p3.5 and compiled openCV):
  * wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v1.12.0/tensorflow-1.12.0-cp35-none-linux_aarch64.whl
  * python3.5 -m pip install --upgrade tensorflow-1.12.0-cp35-none-linux_aarch64.whl
  * python3.5 -m pip install scipy pandas keras
* opencv -- Install notes here: https://medium.com/@JMoonTech/install-opencv-and-tensorflow-on-odroid-c2-e23f13484bc0
  * cd <dir>; git clone https://github.com/Itseez/opencv.git; cd opencv; git checkout 4.0.1
  * cd <dir>; git clone https://github.com/Itseez/opencv_contrib.git; cd opencv_contrib; git checkout 4.0.1
  * cd /usr/include/aarch64-linux-gnu/ffmpeg; ln -sf /usr/include/aarch64-linux-gnu/libavformat/<avformat|avio>.h .
  * In opencv/cmake/OpenCVDetectCXXCompiler.cmake change "dumpversion" to "dumpfullversion"
  * ```
     mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=RELEASE
    -DCMAKE_INSTALL_PREFIX=/usr/local -DINSTALL_PYTHON_EXAMPLES=ON
    -DINSTALL_C_EXAMPLES=OFF
    -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-<ver>/modules
    -DPYTHON3_EXECUTABLE=/usr/bin/python3.5
    -DPYTHON3_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.5m.so
    -DBUILD_EXAMPLES=OFF -DWITH_LIBV4L=OFF -DWITH_V4L=OFF
    -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_OPENCV_PYTHON3=1 i
    -DENABLE_PRECOMPILED_HEADERS=OFF
    -Wno-dev ..
    ```
  * make -j2; ...

repository: abutala/water-tracking

repo_name: abutala/water-tracking


text:
# Haskell 101 Codelab

## Setup

To setup your machine please consult [the official haskell website](https://www.haskell.org/platform/). We have also provided a docker container that can be used to run the test suite. This method for running the tests requires [Docker](https://www.docker.com/get-started) and [Docker compose](https://docs.docker.com/compose/install/) but avoids the need to set up haskell on your machine.

## Running tests

To run the tests just run `make` in each of the directories. The special `00_setup` directory is only used for testing the environment, but all others contain exercises to resolve.

### From local haskell

> **NOTE**: You must make sure your setup is working locally.

For each of the exercises, replace `codelab` with your implementation. When complete, running `make` would result in an output similar to below:

```console
add       1 2                             OK got: 3
subtract  7 2                             OK got: 5
double    3                               OK got: 6
multiply  3 11                            OK got: 33
divide    9 2                             OK got: 4.5
divide    8 4                             OK got: 2.0
factorial 30                              OK got:<PHONE_NUMBER>12191058636308480000000
gcd       12 4                            OK got: 4
gcd       17 7                            OK got: 1
```

## Using a docker container

If you are using the docker, build and run the tests run with `docker-compose up _EXERCISE_NAME_`. For example, for `docker-compose run 01-functions` runs the exercise `01-functions`, defined as a docker-compose service `01-functions` you should see output similar to below:

> **NOTE**: the following output is longer the first time of the execution as the docker image is first created before docker-compose spawns a new docker container to execute the tests.

```console
$ docker-compose up 01_functions
Starting codelab_01_functions_1 ... done
Attaching to codelab_01_functions_1
01_functions_1     | make: Entering directory '/google/trainings/haskell-101/01_functions'
01_functions_1     | Completed 3 action(s).
01_functions_1     | add       1 2                             OK got: 3
01_functions_1     | subtract  7 2                             OK got: 5
01_functions_1     | double    3                               OK got: 6
01_functions_1     | multiply  3 11                            OK got: 33
01_functions_1     | divide    9 2                             OK got: 4.5
01_functions_1     | divide    8 4                             OK got: 2.0
01_functions_1     | factorial 30                              OK got:<PHONE_NUMBER>12191058636308480000000
01_functions_1     | gcd       12 4                            OK got: 4
01_functions_1     | gcd       17 7                            OK got: 1
01_functions_1     | make: Leaving directory '/google/trainings/haskell-101/01_functions'
codelab_01_functions_1 exited with code 0
```

## From within a Docker Container

* Running within a docker container means you have full access to haskell, stack, cabal, etc.

> **NOTE**: this requires an update of docker-compose.yaml for the current version.

```diff
   03_lists:
     <<: [ *generic-haskell-runtime ]
-    #<<: [ *docker-cli-mode ]
-    command: make -C 03_lists
+    <<: [ *docker-cli-mode ]
+    #command: make -C 03_lists
```

* Create a new container attached to the terminal

> **NOTE**: The built docker image has `vim`, which will allows you to edit files
> from within the docker container and reflect when the container is terminated.

```console
$ docker-compose run 03_lists
Creating codelab_03_lists_run ... done
root@9bc17a3fe02a:/google/trainings/haskell-101# ghci --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7
root@9bc17a3fe02a:/google/trainings/haskell-101# cd 03_lists/
root@9bc17a3fe02a:/google/trainings/haskell-101/03_lists# vim src/
Codelab.hs   Internal.hs  Main.hs      Solution.hs
root@9bc17a3fe02a:/google/trainings/haskell-101/03_lists# vim src/Codelab.hs
root@9bc17a3fe02a:/google/trainings/haskell-101/03_lists# stack run
codelab> configure (exe)
Configuring codelab-<IP_ADDRESS>...
...
...
```

repository: google/haskell-trainings

branch_name: refs/heads/master

extension: md

gha_language: Haskell

license_type: permissive

repo_name: google/haskell-trainings


text:
# Scala.js typings for unpaginated

Typings are for version 3.0

## Library description:
Dead simple pagination

|                    |                 |
| ------------------ | :-------------: |
| Full name          | unpaginated |
| Keywords           | pagination, paginate, depaginate, unpaginated, functional, concurrency, cursor, page, offset, total |
| # releases         | 14 |
| # dependents       | 0.0 |
| # downloads        |<PHONE_NUMBER>6666666 |
| # stars            | ? |

## Links
- [Homepage](https://github.com/manuscriptmastr/unpaginated#readme)
- [Bugs](https://github.com/manuscriptmastr/unpaginated/issues)
- [Npm](https://www.npmjs.com/package/unpaginated)

## Note
This library has been generated from typescript code from [DefinitelyTyped](https://definitelytyped.org).

Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped)

## Usage
See [the main readme](../../readme.md) for instructions.

license: MIT

repository: ScalablyTyped/Distribution

gha_license_id: MIT

repo_name: ScalablyTyped/Distribution


text:
---
slug: flourish-monterey-county-focus-of-speaker-series
title: "'Flourish Monterey County' focus of speaker series"
date: January 01 2020
---

Kicks off March 4 with talk on economic development

  With the theme, “Flourish Monterey County,” this year’s President’s Speaker
  Series at California State University, Monterey Bay will get under way on
  March 4 when Mary Jo Waits visits campus.

  Ms. Waits, director of the Economic, Human Services and Workforce Division of
  the National Governors Association, was one of the most thought-provoking
  speakers at the recent colloquium on Fort Ord redevelopment. She will expand
  on her ideas on how to leverage university research to enhance economic
  development.

  One of the messages that emerged from the colloquium was the need to move
  beyond jurisdictional battles and take a comprehensive look at what makes
  economic and environmental sense for the area. In her talk, Ms. Waits will
  continue the discussion begun at the colloquium.

  Her presentation will start at 3:30 p.m. in the World Theater on Sixth Avenue
  near A Street. Driving directions and a campus map are available
  here.

  The community is invited to this free event. No tickets are necessary, but
  reservations are requested. Please RSVP by calling the World Theater box
  office at 582-4580, or going online at csumb.edu/rsvp.

  The series continues on March 28, when Dr. David Kennedy of Harvard’s John F.
  Kennedy School of Government visits. He directed the Boston Gun Project, which
  sharply reduced the youth homicide rate in that city. Jeff Edmondson of Strive
  Together, the national group that works to improve the cradle-to-career
  pipeline, will visit on April 9.

  The speaker series is in keeping with Cal State Monterey Bay’s role as a
  community resource, providing forums for thoughtful and provocative
  discussions that can impact thought and action on issues important to our
  community.

repository: csumb-archives/news-gatsby

gha_language: JavaScript

repo_name: csumb-archives/news-gatsby


text:
[![Build Status](https://github.com/gap-packages/crypting/workflows/CI/badge.svg?branch=master)](https://github.com/gap-packages/crypting/actions?query=workflow%3ACI+branch%3Amaster)
[![Code Coverage](https://codecov.io/github/gap-packages/crypting/coverage.svg?branch=master&token=)](https://codecov.io/gh/gap-packages/crypting)

# The GAP 4 package `crypting'

This package implements some cryptographic primitives. At the moment
this is a custom implementation of SHA256 and HMAC, which is needed
to sign messages in the Jupyter kernel.

Bindings to a full crypto library are a possibility for the future, and
pull-requests (after discussion) are appreciated.

repository: gap-packages/crypting

gha_language: C

repo_name: gap-packages/crypting


text:
The idea behind this project is to have a ready to work API hidding your mailjet key on which you can plug your front app without worrying about implementing a backend.

[![Build Status](https://travis-ci.com/adelplace/go-mailjet-api-relay.svg?branch=master)](https://travis-ci.com/adelplace/go-mailjet-api-relay)

## Getting Started

You can deploy this app everywhere you want using docker.

### Prerequisites

This project use google recaptcha service to protect you from robots and spammers so you will need :
- A google recaptcha account
- A Mailjet account
- Docker installed on your server

### Installing

You will need some mandatory parameters to launch the app

| Parameter | Description |
| --------- | ----------- |
| RECAPTCHA_SECRET | Your recpatcha secret from https://www.google.com/recaptcha/admin |
| MAILJET_PRIVATE_KEY | Your mailjet private key from https://app.mailjet.com/account/api_keys |
| MAILJET_PUBLIC_KEY | Your mailjet public key from https://app.mailjet.com/account/api_keys |
| EMAIL | The email that will send the mail (must be configured in mailjet). Usually your own email |

#### Using docker

```
docker run --rm -d \
  -p 8080:80
  -e RECAPTCHA_SECRET="..." \
  -e MAILJET_PRIVATE_KEY="..." \
  -e MAILJET_PUBLIC_KEY="..." \
  -e EMAIL="..." \
  alexandredelplace/go-mailjet-api-relay
```

#### Using docker-compose

Create a docker-compose.yml file

```docker-compose
version: '3.7'
services:
  go-mailjet-api-relay:
    image: alexandredelplace/go-mailjet-api-relay
    ports:
      - "8080:80"
    environment:
      RECAPTCHA_SECRET: "..."
      MAILJET_PRIVATE_KEY: "..."
      MAILJET_PUBLIC_KEY: "..."
      EMAIL: "..."
```

Then run the container

```
docker-compose up -d
```

#### Using binaries

First you need to clone and build the project. Be sure to have a go version installed and up to date on your computer

```
git clone ...
go build ./...
```

Then fill the required env vars and run the application on the port of your wish

```
export RECAPTCHA_SECRET="..."
export MAILJET_PRIVATE_KEY="..."
export MAILJET_PUBLIC_KEY="..."
export EMAIL="..."

./application --addr=80
```

### Usage

You need to send few parameters to send your mail.
The only one that is required is "g-recaptcha-response". If you don't send the other parameters, they will be replaced by an empty strings.

| Parameter | Description |
| --------- | ----------- |
| g-recaptcha-response | The token from the google recaptcha response |
| email | Email of the contact |
| name | Name of the contact |
| subject | Subject of the contact |
| message | Message of the contact |

So a curl request to send an email with the API would be something like

```
curl --request POST \
  --url http://localhost:8080 \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'g-recaptcha-response=my_captcha_response&name=my_name&subject=my_subject&message=my_message&email=my_email'
```

#### Return codes

The API return a json object that contain the status of your request

```json
{
  "success": false|true,
  "message": "Example message",
  "code": "example_error_code"
}
```

Here are the different codes that you can get from the API

| Status | Code    | Description |
| ------ | ------- | ----------- |
| 200    | success | The mail has been successfully delivred to Mailjet |
| 405    | method_not_allowed | Only POST requests are allowed |
| 400    | invalid_data | The sent data are invalid |
| 400    | no_captcha | The "g-recaptcha-response" parameter is missing |
| 400    | invalid_captcha | The captcha response is invalid/expired |
| 400    | mailjet_error | Mailjet returned an error |

## Running the tests

```
go test ./...
```

## License

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

repository: adelplace/go-mailjet-api-relay

repo_name: adelplace/go-mailjet-api-relay


text:
SVG to React Loader
===================

> A Webpack Loader to turn SVGs into React Components

Summary
-------

A webpack loader allowing for inline usage of a SVG as a React component, or for
composing individual SVGs into larger ones.

The latest version has been refactored to allow for receiving an SVG/XML string
or an JSON [object-tree](#object-tree-api) representing an SVG. This allows for
other loaders before `svg-react` to alter/update/remove nodes before reaching
`svg-react`.

In addition, the new [filters](#filters) API allows for additional ways to
modify the generated SVG Component. This allows `svg-react` to also be used as a
pre-loader (with `filters` and `raw=true` params) for modifying SVGs before they
are acted on by the loader version of `svg-react`.

There is a filter which creates 'unique' IDs and mask, fill, and xlink:href
references to those IDs by prefixing the SVG filename. This solves a common problem
encountered when loading multiple SVGs onto the same page: if the IDs within the different
SVGs are the same, there will be ID collisions which will cause a variety of issues with
the rendering of the SVG components. Although there are plugins available for [SVGO](https://github.com/svg/svgo)
designed to solve this problem, the solution implemented here provides another way to
avoid ID collision issues on SVGs.

### Notes

> As of version 0.4.0, `svg-react-loader` no longer requires `babel` to
> transpile the generated code. Everything is returned as an ES5-7 compatible
> module, and the component is just a
> [function](https://facebook.github.io/react/docs/reusable-components.html#stateless-functions).
> With that, it only works with<EMAIL_ADDRESS>

Installation
------------
~~~
% npm install --save-dev svg-react-loader
~~~

Usage
-----

ES6+ (Assuming a `babel-loader` is used on `/\.jsx?$/` files):

~~~js
import React, { Component } from 'react';
import Icon from 'svg-react-loader?name=Icon!../svg/my-icon.svg';

export default class MyIcon extends Component {
    render () {
        return <Icon className='normal' />;
    }
};
~~~

ES5

~~~js
var React = require('react');
var Icon = require('svg-react-loader?name=Icon!../svg/my-icon.svg');

module.exports = React.createClass({
    render () {
        return React.createElement(Icon, { className: 'normal' });
    }
});
~~~

Documentation
-------------

### Query Params

Query params can be used on the loader path, or on the resource's path. Those on
the resource will override those given for the loader.

* `name`: `displayName` to use for the compiled component. Defaults to using the
  resource's file name, capitalized and camelCased. ex. `"?name=MyIcon"`

* `tag`: Override the root-level tag name.

* `props`: Attributes to apply to the root-level tag. If a certain attribute is
  already assigned to the tag, the value here will override that.

* `attrs`: Alias for `props`

* `filters`: If given on the query string, it is a list of module names, or
  filepaths, to load as [filter functions](#filters). If given in the webpack
  config as a `svgReactLoader.filters`, or as `query.filters` for the loader
  configuration object, it is an array of functions.

* `classIdPrefix`: A string to prefix all class or id selectors in found style
  blocks, or within `className` properties, with. If indicated without a string,
  the file's basename will be used as a prefix.

* `uniqueIdPrefix`: When set to `true` will prefix the filename to the IDs and
  references within the SVG, solving the problem of ID collision when multiple
  SVGs are used on the same page.

* `raw`: If set to `true` will output the parsed object tree repesenting the SVG
  as a JSON string. Otherwise, returns a string of JavaScript that represents
  the component's module.

* `propsMap`: If given on the query string, it is an array of colon separated
  `propname:translatedname` pairs. If given in the webpack configuration as
  `svgReactLoader.propsMap`, or in an object query for the loader configuration,
  is a simple object of `propname: 'translatedname'`

* `xmlnsTest`: A regular expression used to remove non-supported xmlns
  attributes. Default is `/^xmlns(Xlink)?$/`

* `titleCaseDelim`: A regular expression used to generate component's name. It
  would be ignore if `name` was set.
  Default is `/[._-]/`

#### Examples

~~~js
// webpack configuration
module: {
    loaders: [
        {
            test: /\.svg$/,
            exclude: /node_modules/,
            loader: 'svg-react-loader',
            query: {
                classIdPrefix: '[name]-[hash:8]__',
                uniqueIdPrefix: true,
                filters: [
                    function (value) {
                        // ...
                        this.update(newvalue);
                    }
                ],
                propsMap: {
                    fillRule: 'fill-rule',
                    foo: 'bar'
                },
                xmlnsTest: /^xmlns.*$/
            }
        }
    ]
}

// Resource paths
import MyIcon from 'svg-react-loader?name=MyIcon!../svg/icon.svg';
import MyIcon from 'svg-react-loader?tag=symbol!../svg/icon.svg';
import MyIcon from 'svg-react-loader?tag=symbol&props[]=id:my-icon?../svg/icon.svg';
import MyIcon from 'svg-react-loader?filters[]=./my-filter.js!../svg/icon.svg';
~~~

### Object Tree API

Internally, `svg-react-loader` converts the given SVG/XML into an object tree
that looks something like:

~~~js
{
    "tagname": "svg",
    "props": {
        "xmlns": "http://www.w3.org/2000/svg",
        "xmlns:xlink": "http://www.w3.org/1999/xlink",
        "viewBox": "0 0 16 16",
        "enable-background": "new 0 0 16 16",
        "xml:space": "preserve"
    },
    "children": [
        {
            "tagname": "rect",
            "props": {
                "x": "0",
                "y": "0",
                "width": "16",
                "height": "16",
                "fill": "#fff"
            }
        },
        {
            "tagname": "text",
            "children": ["Foobar"]
        }
    ]
}
~~~

It then uses a variety of [filters](#filters) to modify the tree to conform to
how `React` expects to see props, styles, etc...

If `svg-react-loader` receives a JSON string instead of string of SVG/XML, it
expects to receive it in the above format (i.e.: objects with properties
'tagname', 'props', and 'children'). Children is always an array (unless empty),
and children can be objects with the mentioned props, or a plain string (for
text nodes).

### Filters

A filter is just a function that accepts one value, and it has the same `this`
context as the [traverse](https://www.npmjs.com/package/traverse) API.

`svg-react-loader` is really just a series of filters applied to a parsed
SVG/XML, or JSON, string and then regenerated as a string to form a React
functional component.

Review [lib/sanitize/filters](lib/sanitize/filters) for some examples.

Report an Issue
---------------

* [Bugs](http://github.com/jhamlet/svg-react-loader/issues)
* Contact the author<EMAIL_ADDRESS>* For issues with the generation of unique ID prefixes, please contact<EMAIL_ADDRESS>

License
-------

[MIT](./LICENSE)


text:
# Stan Stuff
Modeling examples I find interesting using Stan anything.

* [Wages Example: `quantile_functions.stan`, `gld_helpers.R`, `stan_lm`, `loo`, `bayesplot`](https://arpasan.github.io/stan_stuff/wages.html)
* [Some Preliminary Thoughts on Rankings: `rstanarm`, `stan_clogit`](https://arpasan.github.io/stan_stuff/just.html)
* [DK & SE - Time Series on Covid-19 Data Using Stan: `stan_glm`](https://arpasan.github.io/stan_stuff/cdss2020_kyb_aa_abridged.html)
* [Hands-on Bayesianism: Frequentist VS Bayesian Regression](https://arpasan.github.io/stan_stuff/stan_lm_intro.html)
* [Predicting Credit Card Fraud: ML VS Bayes](https://arpasan.github.io/stan_stuff/capital1_arpasan.html)


text:
---
title: Thoughts on the video 'Eating less Meat won't save the Planet. Here's Why'
tags: environmentalism
toc: true
state: publish
---

<iframe max-width="100%" height="auto" src="https://www.youtube-nocookie.com/embed/sGG-A80Tl5g" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

[transcript](https://drive.google.com/file/d/1GykxwpRxCHXMtOULQwDjDqiMUY5pnwOB/view?usp=sharing)

## Arguments given

### Green-water-usage

Criticisms: [Green-water-could-be-used-in-other-ways](#green-water-could-be-used-in-other-ways)

[additional source](https://waterfootprint.org/en/resources/interactive-tools/product-gallery/)

Cows are typically fed using non-irrigated fodder and pasture. The water 'consumed' by cows is taken from, and reintroduced to the water cycle, in contrast to water that is irrigated, which takes from groundwater.

As meat is a 'nutrient concentrator' it provides more nutrients per litre of water consumed.

### Cows-upcycle-waste

Counterpoint: [Cows-are-mostly-fed-using-crops](#cows-are-mostly-fed-using-crops)

The food cows receive and the vast majority of the land cows occupy would otherwise go unused, as they aren't fit for human edible cultivation.

Think of the mountainous pastures of the alps or the arid grasslands of the prairies.

Besides non-edible crops, 2.8 kg of human-edible food is consumed per kg of beef, which isn't that much if you consider the relative nutrient densities.

Livestock also makes the agricultural loop more efficient by turning waste products into nutrients.

### Western-meat-production-is-efficient

Counterpoint: [Global-statistics-matter](#global-statistics-matter)

Meat is produced much more efficiently in the west than in developing countries. Reducing the meat consumption of someone living in the west is proportionally less impactful than reducing the meat consumption of someone in a developing country.

### Cows-dont-add-to-the-carbon-cycle

Counterpoint: [Environmental-effects](#environmental-effects)

It is true that cows contribute methane to the carbon cycle, however the cellulose and other starches they consume were already present in the atmosphere in the form of CO2, which plants capture through photosynthesis.

Contrast this with fossil fuels, which release sequestered carbon.

### Reducing-food-waste-is-more-important

Counterpoint: [Multiple-issues-can-be-handled-at-once](#multiple-issues-can-be-handled-at-once)

Per capita, 74 kg of food go to waste a year. Isn't this a more pertinent concern?

## Counterpoints

### Green-water-could-be-used-in-other-ways

See: [Green-water-usage](#green-water-usage)

The green water used for growing pasture can be used instead to grow human-edible crops.

It could mean less water being drawn from the ground for irrigation, if the water that falls on pasture and fodders crops were to instead be used for plant-based agriculture.

In addition, in natural conditions, nitrogen rich waste water \(urine and manure contaminated water\) can be reintegrated into the water cycle. Due to the realities of industrial agriculture this isn't the case; instead of a roaming herd that spreads the waste water, [cows are concentrated in feedlots](https://agrilife.org/tammi/files/2014/04/Sweeten.pdf). This leads to [deadzones due to nutrient run-off](https://link.springer.com/chapter/10.1007/978-981-15-3372-3_17).

I have unfortunately not found any studies that provide a clear breakdown in the contribution of livestock and plant-agriculture to nutrient runoffs.

Finally, rain water that is utilised for agricultural purposes is [no longer suitable for replenishment of aquifers](https://pubs.acs.org/doi/10.1021/es1038358).

### Cows-are-mostly-fed-using-crops

See: [Cows-upcycle-waste](#cows-upcycle-waste)

> Grazing systems supply about 9 percent of the world's production of beef and about 30 percent of the world's production of sheep and goat meat

[Source](http://www.fao.org/3/X5303E/x5303e05.htm#chapter%202:%20livestock%20grazing%20systems%20&%20the%20environment)

This suggests that most of the beef produced in the world is derived from cattle that are partially or wholly fed on crops. While this does include waste products, such as husks and stems, the fact remains that 1/3 of the land dedicated to livestock is arable land which could be used for human-edible crops.

In addition, fodder crops such as alfalfa are often [irrigated](https://extension.unr.edu/publication.aspx?PubID=2575#:~:text=Amount%20of%20water%20to%20apply,every%20ton%20of%20hay%20produced.&text=By%20early%20June%2C%20this%20can,as%202.0%20inches%20per%20week.), \(partially\) negating the point made in [Green-water-usage](what-ive-learned-today-meat.md#green-water-usage).

Regardless of apparent nutrient balance differences, 2.8 kilograms of human edible food is consumed to create a kilogram of beef, in addition to the non human edible food grown on land that could be used for human-edible food. This represents an inefficiency, which would be exacerbated if one includes the percentage of fodder grown on land viable for growing human-edible food.

### Global-statistics-matter

See: [Western-meat-production-is-efficient](#western-meat-production-is-efficient)

The inefficiencies of developing countries do impact us due to global trade.

Brazil is the world's [largest beef exporter](https://www.pnas.org/content/117/50/31770), and importers also include Western countries.

When we eat meat from, for example, Brazil we're not just eating inefficient beef, but we're also adding the cost of global transportation to that beef.

### Environmental-effects

see: [Cows-dont-add-to-the-carbon-cycle](#cows-dont-add-to-the-carbon-cycle)

Despite the carbon already being in the environment, turning CO2 to methane is still a net increase in the _warming effect_ due to its high [GWP](https://www.epa.gov/ghgemissions/understanding-global-warming-potentials).

In addition, intensive grazing can lead to [soil degradation](http://www.uky.edu/Ag/Agronomy/Extension/ssnv/ssvl182.htm) and [decreased biodiversity](https://sci-hub.st/https://doi.org/10.4141/P06-114) \(Note: the study suggests that a moderate level of grazing is _beneficial_ to soil biodiversity, perhaps because the land was grazed in a smilar manner by natural megafauna prior to human agriculture in the region\).

In [developing countries](https://www.sciencedirect.com/science/article/pii/S0378112715003394) _and_ [developed countries](https://conbio.onlinelibrary.wiley.com/doi/abs/10.1046/j.1523-1739.2002.01199.x), important carbon sinks _are_ being cleared through burning/cutting forest and clearing marshlands, either intentionally, to increase the amount of 'productive land' or inadvertently through land management strategies that damage surrounding wild areas. See: [the burning of the Amazon](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/2015JG002914)

### Multiple-issues-can-be-handled-at-once

see: [Reducing-food-waste-is-more-important](#reducing-food-waste-is-more-important)

Food waste and meat consumption can both be reduced through policy and awareness, in fact, the same awareness pushes can be applied to both concerns.

The author presents a false dichotomy by suggesting that the urgence of one dilemma is so great that the other issue is irrelevant.

url: https://raw.githubusercontent.com/mgmoens/ivorentoren/4f192bcf37c8e0059ff178e029583ade0ca9f9de/_notes/20210528-Thoughts Eating Less Meat Won't Save the Planet.md

repository: mgmoens/ivorentoren

branch_name: refs/heads/main

repo_name: mgmoens/ivorentoren


text:
# Android Project: Walk in Clinics Services App

The application addresses the need for people to know waiting times at nearby walk-in clinics without having to leave their home. It also allows users to know the services offered by nearby walk-in clinics and allow them to check-in/book appointments at the clinic of their choice.

## Instructions

1. Project will be done in teams of 5 +/- 1 person.
2. Only one team member needs to submit the deliverables via Brightspace, but make sure
all team members are identified (name and student number) on your cover page or
README.md file.
3. The team must present only one version of the application. For instance, one student
having one screen with the search functionality and other one having another different screen (running on a different phone) with the clinic’s employee functionality, **WILL NOT** be accepted. The team must produce a single application with all the required functionality.

The purpose of this project is to expand on the theoretical work, allowing students to gain practical experience implementing the concepts learned in class. This project is also designed to allow students to learn how to work with their colleagues and develop mobile applications. Learning outcomes range from increased understanding of concepts relating to software engineering, to overall knowledge of programming for android, management and team-relation skills.

The main outcome of the project is the implementation of a walk in clinics services application for android devices. Students are to implement all components of the project, from their design, specification, UML and additional documentation, graphical assets and source code. Students are encouraged to use the available toolset in android studio but should refrain from
copying whole blocks of code from the internet to implement features. Should a group want to use a non-standard tool/API they should request permission before doing so.

---

The app will be conceived with three different types of users in mind. The administrator, the walk-in clinics employees, and the patients. The administrator manages all the possible services that can be offered to patients by walk-in clinics. The walk-in clinic employee creates a profile for the clinic and selects the services offered by the walk-in clinic and the working hours. The patients can search for a walk-in clinic by address/type of service provided or by working hours.

The features that should be available to each type of user are given below. Note that those are the minimum required features, and you are free to add more features you think might enrich your application.

### The administrator can:
1. Create services (at least 5) to be offered by walk-in clinics using the application.
2. Delete accounts of walk in clinics and users

### The walk in clinic employee can:
1. Create an account for the walk in clinic
2. Select services provided and the rate for each service
3. Enter the working hours of the walk in clinic

### The patient can:
1. Create an account
2. Search for a walk in clinic by address/type of service provided/working hours
3. Check in/book an appointment
4. Rate his/her experience at the walk in clinic

### Your application should:
1. Show the expected waiting times for walk in clinics based on the number of patients waiting to be seen (assume a fixed time of 15 minutes per patient)
2. Show the rating that each walk in clinic has
3. Show the admin account all registered users to allow him/her to delete user accounts

**Note**: This course does not focus on interface design; hence, we do not focus on usability aspects. However, students are welcome to “beautify” their projects, should they be comfortable with user interface design. Consider the Android Design Guidelines when designing
your application. This topic will be covered in a tutorial session and detailed information is available at: https://developer.android.com/design/index.html

---

## DELIVERABLES

The project is divided into 4 incremental deliverables (and 1 demo).

Each deliverable will include the following:

* A feature branch with all content for the deliverable
* A Pull-Request (PR) of that branch back into the main branch
* PR approved by all team members and merged back into the main branch
* A README.md outlining the team members, and a summary of the deliverable

Students are required to submit a text file containing links to the
above by the posted deadline online using Brightspace.

For example

```
Forward Inc.
Team Members
Andrew Forward, 1484511

James Url | 1929204

Ayana Nurse | 2128439

PR:
https://github.com/professor-forward/walkinclinic/pull/2

Last Commit:
https://github.com/professor-forward/walkinclinic/commit/564d6484cce8af2ae6c15891178b2b086a4cb9ff

Instructions

+ Additional instructions about this deliverable
```

A break down of the marking scheme for the project is below.
Note that you will be responsible for giving a demo to your
TAs during the last week of labs / tutorials.

Click on the deliverable name for more details.

| # | Deliverable | Weight | Due Date |
| --- | --- | --- | --- |
| 1 | [Github repository and user accounts](/docs/deliverable01.md) | 3% | Oct 20 |
| 2 | Admin functionality | 3% | Nov 10 |
| 3 | Walk-in employee user functionality | 3% | Nov 20 |
| 4 | Patient and application functionality | 9% | Dec 04 |
| 5 | Demo (during labs / tutorials) | 2% | Last week |

The project is to be carried out throughout the session and students are
strongly encouraged to maintain a log of their project activities,
as task allocation and project flow are a component of the final
document provided alongside the android application.
We suggest students keep track of duty assignment, with complexity
of allocated tasks and completion dates. **You can track and assign tasks
with GitHub**.

Your application must be written in Java and built using the Android Studio 3.1. You should compile your project against the earliest possible SDK version allowed by the API methods you are using (API 10, level 29). By the end of the semester, you must implement and submit a working application based on the specifications. Firebase or SQLite can be used for storing and retrieving the application data.

## ACADEMIC HONESTY

All work that you do towards the fulfillment of this course's expectations
must be your own unless collaboration is explicitly allowed (e.g., by some
problem set or the final project). Viewing or copying another individual's
work (even if left by a printer or stored in a public directory) or lifting
material from a book, magazine, website, or other source-even in part- and
presenting it as your own constitutes academic dishonesty, as does showing
or giving your work, even in part, to another student.

repository: callmekungfu/chad

repo_name: callmekungfu/chad


text:
#### [PATCH 1/4] KVM: arm64: pmu: Fix cycle counter truncation
##### From: Marc Zyngier<EMAIL_ADDRESS>
```c
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Marc Zyngier<EMAIL_ADDRESS>X-Patchwork-Id: 11200869
Return-Path<EMAIL_ADDRESS>Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
 [<IP_ADDRESS>])
	by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BEFF614ED
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 10:11:39 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [<IP_ADDRESS>])
	by mail.kernel.org (Postfix) with ESMTP id 9C1BF222C3
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 10:11:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
	s=default; t=1571566299;
	bh=V53P7Vn0aPiKYwrOMap7wcByveXMeM32VmJKA4bI76s=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From;
	b=TEsBLYMsyZJmHytVvWlx5a4Rr8qGIaz7kLKqfp/UdiI3nGqaNcbMsDCHDJbjIkk15
	 aJizWVHtvQNR/boNPzW4ref/B/YHEJ799eFMnj36vAUOBPx5Ckn6j/j2fT9so2bTKO
	 nU0xkLprK3SZ1U2lQkeaSWShMCAI0E7h3idV2ocA=
Received<EMAIL_ADDRESS>by vger.kernel.org via listexpand
        id S1726179AbfJTKLj (ORCPT
        <rfc822;patchwork-kvm@patchwork.kernel.org>);
        Sun, 20 Oct 2019 06:11:39 -0400
Received: from mail.kernel.org ([<IP_ADDRESS>]:55342 "EHLO mail.kernel.org"
        rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
        id S1725893AbfJTKLi (ORCPT <rfc822;kvm@vger.kernel.org>);
        Sun, 20 Oct 2019 06:11:38 -0400
Received: from big-swifty.lan (78.163-31-62.static.virginmediabusiness.co.uk
 [<IP_ADDRESS>])
        (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
        (No client certificate requested)
        by mail.kernel.org (Postfix) with ESMTPSA id 6929D222BD;
        Sun, 20 Oct 2019 10:11:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=default; t=1571566297;
        bh=V53P7Vn0aPiKYwrOMap7wcByveXMeM32VmJKA4bI76s=;
        h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
        b=peYUqeE2CB2w33fmbugervLQNX+GX31Uh5sbOoiIy1LVvBeTnM0OewPJuZ2QHh4fk
         +p8U85CFm+SrKBF+MQhBhnaWCIHAxHNbgKhplRjH8mHeC3qn+Ke5Lvgat8eFVrafJZ
         LGMMdfb/RiiK/jb3OMUP3kjM9ATxDcgxa6oOk1bA=
From: Marc Zyngier<EMAIL_ADDRESS>To: Paolo Bonzini<EMAIL_ADDRESS> =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?=<EMAIL_ADDRESS>Cc: Julien Thierry<EMAIL_ADDRESS>        Suzuki K Poulose<EMAIL_ADDRESS>        James Morse<EMAIL_ADDRESS>        Andrew Murray<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>Subject: [PATCH 1/4] KVM: arm64: pmu: Fix cycle counter truncation
Date: Sun, 20 Oct 2019 11:11:26 +0100
Message-Id<EMAIL_ADDRESS>X-Mailer: git-send-email 2.20.1
In-Reply-To<EMAIL_ADDRESS>References<EMAIL_ADDRESS>MIME-Version: 1.0
Sender<EMAIL_ADDRESS>Precedence: bulk
List-ID: <kvm.vger.kernel.org>
X-Mailing-List<EMAIL_ADDRESS>
When a counter is disabled, its value is sampled before the event
is being disabled, and the value written back in the shadow register.

In that process, the value gets truncated to 32bit, which is adequate
for any counter but the cycle counter (defined as a 64bit counter).

This obviously results in a corrupted counter, and things like
"perf record -e cycles" not working at all when run in a guest...
A similar, but less critical bug exists in kvm_pmu_get_counter_value.

Make the truncation conditional on the counter not being the cycle
counter, which results in a minor code reorganisation.

Fixes: 80f393a23be6 ("KVM: arm/arm64: Support chained PMU counters")
Reviewed-by: Andrew Murray<EMAIL_ADDRESS>Reported-by: Julien Thierry<EMAIL_ADDRESS>Signed-off-by: Marc Zyngier<EMAIL_ADDRESS>---
 virt/kvm/arm/pmu.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

```
#### [GIT PULL] KVM/arm fixes for 5.4-rc5
##### From: Marc Zyngier<EMAIL_ADDRESS>
```c
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Marc Zyngier<EMAIL_ADDRESS>X-Patchwork-Id: 11200867
Return-Path<EMAIL_ADDRESS>Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
 [<IP_ADDRESS>])
	by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F6AB139A
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 10:11:37 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [<IP_ADDRESS>])
	by mail.kernel.org (Postfix) with ESMTP id 0747F222C3
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 10:11:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
	s=default; t=1571566297;
	bh=R9nxM6A3Yhddcl9A7C/26LLhq+KqjO+NyOwb1yqAA94=;
	h=From:To:Cc:Subject:Date:List-ID:From;
	b=LAGGwOf4eIcNeXqUdP4+RI4LtnteQwdV+CkvpjRHta8TnTfUn/IibYRsLbpV+5b0Z
	 KTsM107Owpm3pQ08Umqm7xaQD1fFLWJHRC7DCEhaLpD0VM23fqbhO5F+FMjJsO5GZH
	 p8Ict+us70JuukcN5mZqkWd1IfUh3Vn+3n0DLHR8=
Received<EMAIL_ADDRESS>by vger.kernel.org via listexpand
        id S1726019AbfJTKLf (ORCPT
        <rfc822;patchwork-kvm@patchwork.kernel.org>);
        Sun, 20 Oct 2019 06:11:35 -0400
Received: from mail.kernel.org ([<IP_ADDRESS>]:55320 "EHLO mail.kernel.org"
        rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
        id S1725893AbfJTKLf (ORCPT <rfc822;kvm@vger.kernel.org>);
        Sun, 20 Oct 2019 06:11:35 -0400
Received: from big-swifty.lan (78.163-31-62.static.virginmediabusiness.co.uk
 [<IP_ADDRESS>])
        (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
        (No client certificate requested)
        by mail.kernel.org (Postfix) with ESMTPSA id 89A342190F;
        Sun, 20 Oct 2019 10:11:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=default; t=1571566294;
        bh=R9nxM6A3Yhddcl9A7C/26LLhq+KqjO+NyOwb1yqAA94=;
        h=From:To:Cc:Subject:Date:From;
        b=wZl1P5TR+YzkoKz8Z0Krfdf4skT5kHoKhxSmiYkJoZu/u3uDDGVRFMn0t4GTos/u9
         +masS9rK4tdB5WNUk7ko/gKMJTmaJTpuqTCTETNz91MjZ+XPLk1mF3T/760PDMMKB5
         cAFy5HjwCjjvImUIHXutqDnA9xTObx4YpNbz5uQk=
From: Marc Zyngier<EMAIL_ADDRESS>To: Paolo Bonzini<EMAIL_ADDRESS> =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?=<EMAIL_ADDRESS>Cc: Julien Thierry<EMAIL_ADDRESS>        Suzuki K Poulose<EMAIL_ADDRESS>        James Morse<EMAIL_ADDRESS>        Andrew Murray<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>Subject: [GIT PULL] KVM/arm fixes for 5.4-rc5
Date: Sun, 20 Oct 2019 11:11:25 +0100
Message-Id<EMAIL_ADDRESS>X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Sender<EMAIL_ADDRESS>Precedence: bulk
List-ID: <kvm.vger.kernel.org>
X-Mailing-List<EMAIL_ADDRESS>
Paolo, Radim,

Here's the latest (and hopefully last) set of KVM/arm fixes for
5.4. 4 patches exclusively covering our PMU emulation, which exhibited
several different flavours of brokenness.

Please pull,

	M.

The following changes since commit da0c9ea146cbe92b832f1b0f694840ea8eb33cce:

  Linux 5.4-rc2 (2019-10-06 14:27:30 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git tags/kvmarm-fixes-5.4-2

for you to fetch changes up to 8c3252c06516eac22c4f8e2506122171abedcc09:

  KVM: arm64: pmu: Reset sample period on overflow handling (2019-10-20 10:47:07 +0100)

----------------------------------------------------------------
KVM/arm fixes for 5.4, take #2

Special PMU edition:

- Fix cycle counter truncation
- Fix cycle counter overflow limit on pure 64bit system
- Allow chained events to be actually functional
- Correct sample period after overflow

----------------------------------------------------------------
Marc Zyngier (4):
      KVM: arm64: pmu: Fix cycle counter truncation
      arm64: KVM: Handle PMCR_EL0.LC as RES1 on pure AArch64 systems
      KVM: arm64: pmu: Set the CHAINED attribute before creating the in-kernel event
      KVM: arm64: pmu: Reset sample period on overflow handling

 arch/arm64/kvm/sys_regs.c |  4 ++++
 virt/kvm/arm/pmu.c        | 48 ++++++++++++++++++++++++++++++++++-------------
 2 files changed, 39 insertions(+), 13 deletions(-)

From patchwork Sun Oct 20 10:11:27 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Marc Zyngier<EMAIL_ADDRESS>X-Patchwork-Id: 11200871
Return-Path<EMAIL_ADDRESS>Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
 [<IP_ADDRESS>])
	by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FC0014ED
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 10:11:42 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [<IP_ADDRESS>])
	by mail.kernel.org (Postfix) with ESMTP id 434DB222D2
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 10:11:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
	s=default; t=1571566302;
	bh=azhX068/Llc0POTSFJ7hQa0blYq+N0fFcX/ZEjAr9sY=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From;
	b=IqjatqmEhRH1ZieQNJHw2XNyoP0bx/eGnBNiNX8FhMXVqZq0Hhv6DlqVVX81y+M4n
	 GQn01IZzSMTB4VHF0fLxsUr7npdfzTPL8fnwsNLHwxA383FjflTJuQXOojbK0fL3+8
	 FYtkn4xYFCDGfUqZfLfwJP1lUpG2gMmJhJEMuWK8=
Received<EMAIL_ADDRESS>by vger.kernel.org via listexpand
        id S1726258AbfJTKLl (ORCPT
        <rfc822;patchwork-kvm@patchwork.kernel.org>);
        Sun, 20 Oct 2019 06:11:41 -0400
Received: from mail.kernel.org ([<IP_ADDRESS>]:55366 "EHLO mail.kernel.org"
        rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
        id S1726212AbfJTKLl (ORCPT <rfc822;kvm@vger.kernel.org>);
        Sun, 20 Oct 2019 06:11:41 -0400
Received: from big-swifty.lan (78.163-31-62.static.virginmediabusiness.co.uk
 [<IP_ADDRESS>])
        (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
        (No client certificate requested)
        by mail.kernel.org (Postfix) with ESMTPSA id 481CB2190F;
        Sun, 20 Oct 2019 10:11:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=default; t=1571566300;
        bh=azhX068/Llc0POTSFJ7hQa0blYq+N0fFcX/ZEjAr9sY=;
        h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
        b=HCve6BGyoxxbhjwhXItirYvlpIK6Wp1TyfF5jyy3UCbpT9/+nOdAlaLZ8zMu0/aGb
         +aHMhQ0zj322GshIh/8gAma86d6kBcqUpIDuYVv/wsJdlMH59V/Xzt98xRKBr8bA3h
         JTE9WtuBVDzyPNYwjmo36ejQ9cKJGhNXKg9pR9hw=
From: Marc Zyngier<EMAIL_ADDRESS>To: Paolo Bonzini<EMAIL_ADDRESS> =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?=<EMAIL_ADDRESS>Cc: Julien Thierry<EMAIL_ADDRESS>        Suzuki K Poulose<EMAIL_ADDRESS>        James Morse<EMAIL_ADDRESS>        Andrew Murray<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>Subject: [PATCH 2/4] arm64: KVM: Handle PMCR_EL0.LC as RES1 on pure AArch64
 systems
Date: Sun, 20 Oct 2019 11:11:27 +0100
Message-Id<EMAIL_ADDRESS>X-Mailer: git-send-email 2.20.1
In-Reply-To<EMAIL_ADDRESS>References<EMAIL_ADDRESS>MIME-Version: 1.0
Sender<EMAIL_ADDRESS>Precedence: bulk
List-ID: <kvm.vger.kernel.org>
X-Mailing-List<EMAIL_ADDRESS>
Of PMCR_EL0.LC, the ARMv8 ARM says:

	"In an AArch64 only implementation, this field is RES 1."

So be it.

Fixes: ab9468340d2bc ("arm64: KVM: Add access handler for PMCR register")
Reviewed-by: Andrew Murray<EMAIL_ADDRESS>Signed-off-by: Marc Zyngier<EMAIL_ADDRESS>---
 arch/arm64/kvm/sys_regs.c | 4 ++++
 1 file changed, 4 insertions(+)

```
#### [PATCH v3 2/4] KVM: VMX: Remove vmx->hv_deadline_tsc initialization from vmx_vcpu_setup()
##### From: Xiaoyao Li<EMAIL_ADDRESS>
```c
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Xiaoyao Li<EMAIL_ADDRESS>X-Patchwork-Id: 11200663
Return-Path<EMAIL_ADDRESS>Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
 [<IP_ADDRESS>])
	by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 947F7139A
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 09:26:25 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [<IP_ADDRESS>])
	by mail.kernel.org (Postfix) with ESMTP id 7C6472064A
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 09:26:25 +0000 (UTC)
Received<EMAIL_ADDRESS>by vger.kernel.org via listexpand
        id S1726307AbfJTJ0J (ORCPT
        <rfc822;patchwork-kvm@patchwork.kernel.org>);
        Sun, 20 Oct 2019 05:26:09 -0400
Received: from mga12.intel.com ([<IP_ADDRESS>]:39083 "EHLO mga12.intel.com"
        rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
        id S1726298AbfJTJ0J (ORCPT <rfc822;kvm@vger.kernel.org>);
        Sun, 20 Oct 2019 05:26:09 -0400
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([<IP_ADDRESS>])
  by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 20 Oct 2019 02:26:08 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.67,319,1566889200";
   d="scan'208";a="348494036"
Received: from lxy-clx-4s.sh.intel.com ([<IP_ADDRESS>])
  by orsmga004.jf.intel.com with ESMTP; 20 Oct 2019 02:26:06 -0700
From: Xiaoyao Li<EMAIL_ADDRESS>To: Paolo Bonzini<EMAIL_ADDRESS> =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?=<EMAIL_ADDRESS> Sean Christopherson<EMAIL_ADDRESS> Vitaly Kuznetsov<EMAIL_ADDRESS>Jim Mattson<EMAIL_ADDRESS> Joerg Roedel<EMAIL_ADDRESS>Cc: Xiaoyao Li<EMAIL_ADDRESS>        Krish Sadhukhan<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>Subject: [PATCH v3 2/4] KVM: VMX: Remove vmx->hv_deadline_tsc initialization
 from vmx_vcpu_setup()
Date: Sun, 20 Oct 2019 17:10:59 +0800
Message-Id<EMAIL_ADDRESS>X-Mailer: git-send-email 2.19.1
In-Reply-To<EMAIL_ADDRESS>References<EMAIL_ADDRESS>MIME-Version: 1.0
Sender<EMAIL_ADDRESS>Precedence: bulk
List-ID: <kvm.vger.kernel.org>
X-Mailing-List<EMAIL_ADDRESS>
... It can be removed here because the same code is called later in
vmx_vcpu_reset() as the flow:

kvm_arch_vcpu_setup()
	-> kvm_vcpu_reset()
		-> vmx_vcpu_reset()

Signed-off-by: Xiaoyao Li<EMAIL_ADDRESS>---
 arch/x86/kvm/vmx/vmx.c | 1 -
 1 file changed, 1 deletion(-)

```
#### [PATCH v3 1/4] KVM: VMX: Write VPID to vmcs when creating vcpu
##### From: Xiaoyao Li<EMAIL_ADDRESS>
```c
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Xiaoyao Li<EMAIL_ADDRESS>X-Patchwork-Id: 11200657
Return-Path<EMAIL_ADDRESS>Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
 [<IP_ADDRESS>])
	by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 549D51575
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 09:26:21 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [<IP_ADDRESS>])
	by mail.kernel.org (Postfix) with ESMTP id 330522064A
	for<EMAIL_ADDRESS> Sun, 20 Oct 2019 09:26:21 +0000 (UTC)
Received<EMAIL_ADDRESS>by vger.kernel.org via listexpand
        id S1726263AbfJTJ0H (ORCPT
        <rfc822;patchwork-kvm@patchwork.kernel.org>);
        Sun, 20 Oct 2019 05:26:07 -0400
Received: from mga12.intel.com ([<IP_ADDRESS>]:39083 "EHLO mga12.intel.com"
        rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
        id S1725893AbfJTJ0G (ORCPT <rfc822;kvm@vger.kernel.org>);
        Sun, 20 Oct 2019 05:26:06 -0400
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([<IP_ADDRESS>])
  by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 20 Oct 2019 02:26:06 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.67,319,1566889200";
   d="scan'208";a="348494029"
Received: from lxy-clx-4s.sh.intel.com ([<IP_ADDRESS>])
  by orsmga004.jf.intel.com with ESMTP; 20 Oct 2019 02:26:04 -0700
From: Xiaoyao Li<EMAIL_ADDRESS>To: Paolo Bonzini<EMAIL_ADDRESS> =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?=<EMAIL_ADDRESS> Sean Christopherson<EMAIL_ADDRESS> Vitaly Kuznetsov<EMAIL_ADDRESS>Jim Mattson<EMAIL_ADDRESS> Joerg Roedel<EMAIL_ADDRESS>Cc: Xiaoyao Li<EMAIL_ADDRESS>        Krish Sadhukhan<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>Subject: [PATCH v3 1/4] KVM: VMX: Write VPID to vmcs when creating vcpu
Date: Sun, 20 Oct 2019 17:10:58 +0800
Message-Id<EMAIL_ADDRESS>X-Mailer: git-send-email 2.19.1
In-Reply-To<EMAIL_ADDRESS>References<EMAIL_ADDRESS>MIME-Version: 1.0
Sender<EMAIL_ADDRESS>Precedence: bulk
List-ID: <kvm.vger.kernel.org>
X-Mailing-List<EMAIL_ADDRESS>
Move the code that writes vmx->vpid to vmcs from vmx_vcpu_reset() to
vmx_vcpu_setup(), because vmx->vpid is allocated when creating vcpu and
never changed. So we don't need to update the vmcs.vpid when resetting
vcpu.

Signed-off-by: Xiaoyao Li<EMAIL_ADDRESS>---
 arch/x86/kvm/vmx/vmx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

```


text:
#GRADUATION THESIS

# DESCRIPTION
Nowaday, with the development of e-commerce, users are more and more familiar with online purchases. To help consumers choose the right time to buy, I built a tool to help track price movements of products on e-commerce sites. When the price fluctuates, it will notify the user to make a decision whether to buy or not.

# Technology
1. PHP (Yii 2 framework)
2. Bootstrap, Jquery
3. Web crawler
4. MySql
5. Service worker (Notify via browser)
6. Zalo api (Notify via Zalo)
7. Facebook api (Login)

# SCREENSHOTS

# Homepage
![image](https://user-images.githubusercontent.com/26851862/131857348-8e89050c-ac79-4089-9691-dde968fc37a0.png)

# Sign up
![image](https://user-images.githubusercontent.com/26851862/131857473-ee9de219-57cf-48a7-bf64-86ab8be13ae3.png)

# Sign in
![image](https://user-images.githubusercontent.com/26851862/131857561-c07dedd1-b6b9-446c-ab04-549c551cbd4e.png)

# The most tracking
![image](https://user-images.githubusercontent.com/26851862/131857682-cf8257ab-0de0-422a-bdcb-a8287fcff4b8.png)

# List support website
![image](https://user-images.githubusercontent.com/26851862/131857741-f0b340e8-461f-4cb4-9206-e2f645912976.png)

# User profile
![image](https://user-images.githubusercontent.com/26851862/131857808-b9900651-1807-494f-9dba-826acb0309f3.png)

# View price's history of product
![image](https://user-images.githubusercontent.com/26851862/131857901-b26f068b-ac1f-4bd5-bbd6-264e82e52a52.png)

# Tracking product's price
![image](https://user-images.githubusercontent.com/26851862/131858000-39f4ea73-8333-4e6f-9e90-6db7a8f76326.png)

# List product tracking of user
![image](https://user-images.githubusercontent.com/26851862/131858108-94e89023-9d0a-49a1-9ef3-e1509e8a63d2.png)

# News page
![image](https://user-images.githubusercontent.com/26851862/131858184-73f1be7c-c22d-4fea-ab3d-1fffd1abd752.png)

# Setup notify for product
![image](https://user-images.githubusercontent.com/26851862/131858271-7bc37a3d-d697-4b67-9417-9673f229be5e.png)

# Notify via Zalo
![image](https://user-images.githubusercontent.com/26851862/131858336-c09116b6-95e4-4123-a7c2-294e9adaca7c.png)

# Notify via email
![image](https://user-images.githubusercontent.com/26851862/131858379-e185f83b-2822-4b76-a2de-d6b45b46ba5e.png)


text:
# Changelog

## vCurrent
## [v0.1.2] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.1.2)
#### 17/12/14 by Morten Henriksen
## [v0.1.1] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.1.1)
#### 17/12/14 by Morten Henriksen
- Bump to version 0.1.1

- mbr update, remove versions.json

## [v0.1.0] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.1.0)
#### 17/12/14 by Morten Henriksen
- mbr update versions and fix warnings

- *Merged pull-request:* "Remove the unused function makeSafeCallback()." [#4](https://github.com/zcfs/Meteor-cfs-worker/issues/4) ([DouglasUrner](https://github.com/DouglasUrner))

- Remove the unused function makeSafeCallback().

- *Merged pull-request:* "Minor formatting edit." [#2](https://github.com/zcfs/Meteor-cfs-worker/issues/2) ([DouglasUrner](https://github.com/DouglasUrner))

- Minor formatting edit.

- 0.9.1 support

Patches by GitHub user [@DouglasUrner](https://github.com/DouglasUrner).

## [v0.0.20] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.20)
#### 28/08/14 by Morten Henriksen
- Meteor Package System Update

## [v0.0.19] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.19)
#### 27/08/14 by Eric Dobbertin
## [v0.0.18] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.18)
#### 27/08/14 by Eric Dobbertin
- Merge branch 'master' of https://github.com/zcfs/Meteor-cfs-worker

- change package name to lowercase

## [v0.0.17] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.17)
#### 09/08/14 by Eric Dobbertin
- *Merged pull-request:* "Fixed bug preventing temp chunks deletion" [#1](https://github.com/zcfs/Meteor-cfs-worker/issues/1) ([GuillaumeZuff](https://github.com/GuillaumeZuff))

- Fixed bug preventing temp chunks deletion

Patches by GitHub user [@GuillaumeZuff](https://github.com/GuillaumeZuff).

## [v0.0.16] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.16)
#### 06/04/14 by Eric Dobbertin
- use uploadedAt so that we can remove chunk info when it's no longer needed

## [v0.0.15] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.15)
#### 05/04/14 by Morten Henriksen
## [v0.0.14] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.14)
#### 31/03/14 by Eric Dobbertin
- use latest releases

## [v0.0.13] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.13)
#### 29/03/14 by Morten Henriksen
- remove underscore deps

## [v0.0.12] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.12)
#### 29/03/14 by Morten Henriksen
- Refactoring and clean ups

## [v0.0.11] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.11)
#### 23/03/14 by Morten Henriksen
- Rollback to specific git dependency

- use collectionFS travis version force update

## [v0.0.10] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.10)
#### 22/03/14 by Morten Henriksen
- try to fix travis test by using general package references

## [v0.0.9] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.9)
#### 22/03/14 by Morten Henriksen
- out factor fileobj update when file is stored

- clean up and use the correct end event for streams

- reference released collectionFS pkg

## [v0.0.8] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.8)
#### 21/03/14 by Morten Henriksen
## [v0.0.7] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.7)
#### 18/03/14 by Eric Dobbertin
- Remove from temp store when removed from collection

## [v0.0.6] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.6)
#### 18/03/14 by Morten Henriksen
- fix refactor name for removeFile

- add back code for running beforeSave function, with stream support (just getting it working for now, can be switched to transform streams later)

- changed method name

- minor changes using chunks in file record

- Add streaming WIP

## [v0.0.5] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.5)
#### 07/03/14 by Eric Dobbertin
- should be installing devel

- small change because tempstore no longer tracks chunks in the file object

## [v0.0.4] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.4)
#### 03/03/14 by Eric Dobbertin
- moved beforeSave out of SA and into here

- move saveCopy here, out of fs.collection

- just package and doc tweaks

## [v0.0.3] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.3)
#### 15/02/14 by Morten Henriksen
## [v0.0.2] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.2)
#### 13/02/14 by Morten Henriksen
## [v0.0.1] (https://github.com/zcfs/Meteor-cfs-worker/tree/v0.0.1)
#### 13/02/14 by Morten Henriksen
- init commit

repository: Azorimor/wekan

repo_name: Azorimor/wekan


text:
---
layout: post
title:  "Automated testing and development in Android"
date:   2014-05-22 22:13:00
categories: android
disqus: true
---

Working with the Android ecosystem, you want to have tools to make your development
life easier.

I've decided to write weekly development blogs on some topic that I either
tackled that week at work or something I've been working on. I don't write much since
graduating college, and that's a big reason for doing this blog. This will
also be a good opportunity to reflect on my own progress with software engineering, and if I could
help anyone out, that's just bonus points.

I spend a lot of my time with the Android SDK and all the fun that comes with it.
Android development can be difficult because of its nature: open source platform forked by
many manufacturers and other businesses, along with numerous devices with different hardware and API versions.
A good development environment can ease the pain that one will endure at times in your app development.

#### Step 1: Make sure your SDK installation is up to date as much as possible.

Why not automate that?

Here's a little script that can do that for you:

{% highlight bash %}
#!/bin/bash
#/usr/bin/expect
if [ -z $(which android) ] ; then
	echo "android binary not in your user's path."
	exit
fi
expect -c '
set timeout -1 ;
spawn android update sdk --no-ui;
expect {
    "Do you accept the license" { exp_send "y\r" ; exp_continue }
    eof
}
'
{% endhighlight %}

The most important line in this bash script is
`android update sdk --no-ui`, as this is the binary
that will update your sdk installation.
Unfortunately, this will require you to accept the licenses for all the new updates
so we'll use the expect utility to automate our "yes" responses for each prompt.

Run this in, say, cron, and enjoy your automatic updates.

#### Step 2: Automate your testing

The app I develop at work is supported on over 5000 devices (from api level 2.2 to 4.4.2, as of the time of this writing).
Testing new code and refactors on different devices/emulators/VMs takes time, so having a good test suite/continuous integration can facilitate development.

I will not get into how to go about writing/using tests for your app, there are many good tutorials.
For reference, check the Android developer site [here](http://developer.android.com/training/activity-testing/activity-basic-testing.html).

For the app I work on, I use the Robotium framework for its ease of use, minimal development time, and quick execution.
Remember I have a big range of devices properties to test against! Check out [robotium](https://code.google.com/p/robotium/).

Using Robotium, I have a nice collection of essential UI/integration tests, and unit tests to ensure
the experience is consistent from one device to the next, from one user to the next.

Despite the urge to buy a bunch of devices, I have to settle with emulators and virtual machines to span the properties of devices I normally
could not physically get my hands on (like API version, screen size, etc.). I have a significant amount of virtual device configurations, as the app can be supported on almost every kind of device.

Ideally I would love to automate this too! Get a coffee and have all the tests run on every emulator and device,
find the failing tests and get to work fixing any issues.

So I wrote a bash script to do that for me, partially because I liked the idea and mostly because I want to get better at shell scripting. It's not perfect, but it serves its intended purpose. Feel free to fork it and make it work for you, if so desired.

{% highlight bash %}
#!/bin/bash
#************************************************#
#              test_automator.sh                 #
#           written by Matt Miller               #
#                May 9, 2014                     #
#                                                #
#          Run robotium tests on connected       #
#	         android devices and emulators         #
#************************************************#

usage() {
	echo "Usage: $0 -p package-name [-t testcase] [-a] [-e]"
	echo "-a Run all tests in package"
	echo "-t testcase or testcases delimited by commas"
	echo "-p required: package name of your application's tests"
	echo "-e start emulators"
}

# Function to start avds we have created
function startEmulators {
	echo "Looking for AVDs..."
	avds=( $(android list avd | awk '/Name:/ {print $2}') )

	echo "Available AVDs:"

	for avd in "${avds[@]}"
	do
		echo "Starting emulator ", $avd
		emulator -avd $avd &
		avd_processes+=($!)
	done

	#wait just a bit for ADB to catch up
	sleep 5

	# Get all emulator ids that are waiting to boot
	# We must wait until the lock screen is showing to begin the testing.
	avd_to_boot=( $(adb devices | awk '/emulator-/ {print $1}') )

	#set the timeout form the config
	if [ -z $timeout ]; then
		echo "Timeout config not set, defaulting to 120 second boot timeout"
		TIMEOUT=120 #2 minute boot time for the emulators
	else
		TIMEOUT=$timeout
	fi

	#If we are booted add to the current booted devices
	declare -A booted_devices

	starttime=$(date +%s)

	while [ "${#booted_devices[@]}" -lt "${#avd_to_boot[@]}" ]; do
		currenttime=$(date +%s)
		diff=`expr $currenttime - $starttime`
		echo "Diff = $diff"
		if [ $diff -ge $TIMEOUT ]; then
			break
		fi
		for avd in "${avd_to_boot[@]}"
		do
			ret=$(adb -s $avd shell getprop init.svc.bootanim)
			echo "here: $ret"
			if [[ "$ret" == *"stopped"* ]]; then
				echo "$avd is booted!"
				booted_devices[$avd]=$avd
			fi
		done
		sleep 15
	done

	#kill the rest of the devices that didn't boot
	for avd in "${avd_to_boot[@]}"
	do
		if [ -z "$booted_devices[$avd]" ]; then
			adb -s $avd emu kill
		fi
	done
}

# Function to execute test on a device
function executeTest {
	device=$1

	# Make sure the app APK and the test APK are installed
	# And install them if not from the config or args

	res=$(adb -s $device shell pm list instrumentation $package)
	if [ -z  "$res" ]; then
		echo "Test apk not installed, installing from config"
		adb -s $device install $test_apk_location
   	fi

	res=$(adb -s $device shell pm list packages $package)
	if [ -z "$res" ]; then
		echo "App Apk not installed, installing from config"
		adb -s $device install $apk_location
	fi

	if [ "$runall" = true ]; then
		echo "Running all tests for device $device"
		#run all tests
		cmd="adb -s $1 shell am instrument -w -e package $package.test $package.test/android.test.InstrumentationTestRunner"
		echo $cmd
		adb -s $device shell am instrument -w -e package $package.test $package.test/android.test.InstrumentationTestRunner > $device.results &
	else
		echo "Running testcases $testcases for device $device"
		#run all tests
		cmd="adb -s $1 shell am instrument -w -e class $testcases $package.test/android.test.InstrumentationTestRunner"
		adb -s $device shell am instrument -w -e class $testcases $package.test/android.test.InstrumentationTestRunner >> $device.results &
	fi
}

function checkDependencies {
	# Dependency ADB (Android Debug Bridge)
	if [ -z $(which adb) ] ; then
		echo "adb binary not in your user's path. It is a dependency of this script."
		exit
	fi

	if [ -z $(which android) ] ; then
		echo "android binary not in your user's path. It is a dependency of this script."
		exit
	fi
}

# Catch ctrl-c and kill all subprocesses that the script started.
trap ctrl_c INT
function ctrl_c() {
	echo "Script terminating..."
	pkill -P $$
	exit
}

# our vars
package=
runall=true
testcases=
avd_processes=()

source test_config
echo "APK location = $apk_location"
echo "Test APK location = $test_apk_location"
# parse cmd line args
while getopts :p:aet: opt; do
	case $opt in
		p)
			package=$OPTARG
			;;
		a)
			runall=true
			;;
		t)
			runall=false
			testcases=$OPTARG
			;;
		e)
			startEmulators
			;;
		*)
			usage
			exit
			;;
	esac
done

#required
if [ -z "$package" ]; then
	echo "Missing package."
	usage
	exit
fi

checkDependencies

#Get all devices currently running on adb and store their ids into an array
output=$(adb devices)
devices=( $(printf "%s","$output" | awk '{if (NR!=1){print $1}}') )

#iterate over each device, running tests we've specified.
for device in "${devices[@]}"
do
	echo "Running test on device $device"
	executeTest $device
done
wait
echo
echo "Tests finished for all devices"
{% endhighlight %}

It's 200 lines of fun, so let me explain the gist of it.

#### Basic usage

{% highlight bash %}
usage() {
	echo "Usage: $0 -p package-name [-t testcase] [-a] [-e]"
	echo "-a Run all tests in package"
	echo "-t testcase or testcases delimited by commas"
	echo "-p required: package name of your application's tests"
	echo "-e start emulators"
}
{% endhighlight %}

This is relatively self-explanatory. Given the package name of your app,
(e.g. com.example.myapp), your tests are located in <i>package_name</i>/test.

You can run all the test cases or one particular test case, using the -a or -t param flags.

By default, the tests will run on all physical devices you have connected to your computer, interfacing through
ADB (the android debug bridge).

If you want to run the test(s) on your emulators also, use the -e flag.

#### Dependencies
{% highlight bash %}
function checkDependencies {
	# Dependency ADB (Android Debug Bridge)
	if [ -z $(which adb) ] ; then
		echo "adb binary not in your user's path. It is a dependency of this script."
		exit
	fi

	if [ -z $(which android) ] ; then
		echo "android binary not in your user's path. It is a dependency of this script."
		exit
	fi
}
{% endhighlight %}

The *android* and *adb* binaries must be in your PATH environment variable.
We use the android binary to install your app's APK on each device, as they may not have it,
and adb to run your tests on each device.

In part 2, I'll explain the rest of the code.

extension: markdown


text:
# Products

Our products are free to use so anyone can leverage them, pay what you like or don't. The idea is to basically crowd fund products for educators and students that are truely open. Free to use, open sourced without any caveats : no ad walls, no data mining etc.

{{< hint danger >}}Question Bank{{< /hint >}}

{{< columns >}}
Question Bank provides personalised question papers. You start by taking a test.

Based on the test scores the app infers what topics you need to work on, which it reflects on the question set next time you take a test.
<--->
This way, your test acts as a diagnostic tool that shows you where you lag behind.

The app can also generate question sets based on tags you provide. And includes previous year questions.
<--->
![Ding](/images/bank.gif)

{{< /columns >}}

{{< hint danger >}}School Management System{{< /hint >}}

{{< columns >}}
Can you recall how in Harry potter, teachers when caught a student credited points for the house ?

Expand shortcode can help to decrease clutter on screen by hiding part of text. Expand content by clicking on it.Expand shortcode can help to decrease clutter on screen by hiding part of text. Expand content by clicking on it.

<--->
Expand shortcode can help to decrease clutter on screen by hiding part of text. Expand content by clicking on it.Expand shortcode can help to decrease clutter on screen by hiding part of text. Expand content by clicking on it.
<--->
![Ding](/images/manage.gif)

{{< /columns >}}

repository: FrappeFortyTwo/openSlice-website

repo_name: FrappeFortyTwo/openSlice-website


text:
# Evaluating Models

## Summary

Here we will perform two modeling tasks: regression and classification.  We will show how to evaluate the models in the TensorFlow algorithm

## Regression Model

The regression model is from a prior section.  We will generate input data which will be distributed as Normal(mean=1, sd=0.1) and target data or repeating 10.0 values.  The model will optimize a multiplication factor (theoretically = 10) to predict the target data.

## Classification Model

The classification model will be half values from Normal(mean=-1, sd=1) and half from Normal(mean=2, sd=1).  There will be some overlap in the distributions.  The classification model will optimize on predicting a middle point, of which is will classify everything less than it as the first distribution and everything greater than it as the latter distribution.  Theoretically, we know that the ideal cutoff is between the two normals at x = 0.5.

## Outline

The idea is that we want to split our labeled data set into a training and test set.  We then train on the test set, and look at the accuracy on the test set.

## Classification Results

Here is the classification results visualized as a histogram:

![Classification Results](../images/08_Evaluating_Models.png "Classification Results")

gha_language: Jupyter Notebook


text:
# Kyma Operator

## Overview

Kyma Operator is a tool for installing all Kyma components. The project is based on the Kubernetes operator pattern. It tracks changes of the Installation custom resource and installs, uninstalls, and updates Kyma accordingly.

>**NOTE:** The Kyma Operator is designed to work as a [singleton](https://en.wikipedia.org/wiki/Singleton_pattern), meaning that you should deploly only one replica of the controller, and only one Installation CR.

The controller extends the api-server with the following custom resources:
- `installation.installer.kyma-project.io/v1alpha1`

## Prerequisites

- recent version of Go with the support for modules, for example 1.12.6
- make
- kubectl
- access to Kubernetes environment: Minikube or a remote Kubernetes cluster

## Details

### Use commandline flags

| Name | Required | Description | Default value |
|------|:----------:|-------------|-----------------|
| **kubeconfig** | NO | Path to a `kubeconfig` file. | Taken from the **KUBECONFIG** environment parameter.|
| **kymaDir** | NO | Directory holding helm releases within the image or Pod. | `/kyma` |
| **backoffIntervals** | NO | Number of seconds to wait before subsequent retries. | `10,20,40,60,80` |
| **overrideLogFile** | NO | Log file to print installation overrides to. | `/dev/stdout` |
| **overrideLogFormat** | NO | Installation override log format. The accepted values are text or JSON. | `text` |
| **helmMaxHistory**  | NO | Maximum number of releases returned by the Helm release history query. | `10` |
| **helmDriver** | NO | Helm backed storage drivers. Read more about [options and details](https://helm.sh/docs/helm/helm/#helm). | `secrets` |
| **helmDebugMode** | NO | Enables/Disables Helm client output in the Kyma Operator logs. | `false` |

### Supported environment variables

| Name | Default | Description |
| ---- | ------- | ----------- |
| **INST_NAMESPACE** | `default` | Namespace in which the Installation CR is located. |
| **INST_RESOURCE** | `kyma-installation` | Name of the Installation custom resource. |
| **OVERRIDES_NAMESPACE** | `kyma-installer` | Namespace in which the Installer overrides are located. |

## Installer custom resource

The `installations.installer.kyma-project.io` CustomResourceDefinition (CRD) is a detailed description of the kind of data and the format the Kyma Operator Controller listens for. To get the up-to-date CRD and show
the output in the `yaml` format, run this command:

```bash
kubectl get crd installations.installer.kyma-project.io -o yaml
```

### Sample custom resource

The [Installation custom resource file](https://kyma-project.io/docs/root/kyma/#custom-resource-installation) provides the basic information for Kyma installation.

## Additional information

### Upgrade Kyma

The upgrade procedure relies heavily on Helm. When you trigger the upgrade, Helm performs `helm upgrade` on Helm releases that exist in the cluster and are defined in the Kyma version you're upgrading to. If a Helm release is defined in the Kyma version you're upgrading to but is not present in the cluster when you trigger the upgrade, Helm performs `helm install` and installs such a release.

When you trigger the Kyma upgrade, the Kyma Operator lists the Helm releases installed in your current Kyma version. This list is compared against the list of Helm releases of the Kyma version you're upgrading to, to match the releases by their names. The releases that match between versions are upgraded through `helm upgrade`. Releases that don't match are treated as new and installed through `helm install`.

>**NOTE:** If you changed the name of a Helm release for a component, remove it before upgrading Kyma to prevent a situation where two Helm releases of the same component exist in the cluster.

The Operator doesn't migrate custom resources to a new version when the upgrade is triggered. The custom resource backward compatibility, or lack thereof, is determined at the component or Helm release level.

repository: Rider-io/kyma

repo_name: Rider-io/kyma


text:
I recently read Clean Code, the famous book by the prolific Uncle bob martin and it was one of the eye opening experiences of my life as a programmer. This book has given me a lot of knowledge on what are the best practises and how to actually write code. Now I feel ashamed of my coding skills. Though I always strive to better my code, this book has taught a lot more.

Now, you are reading this blog for two reasons.  Second, you want to be a better programmer. Good. We need better programmers.

## What is Clean Code, anyway?

             Imagine being in a record store, and you are looking for some albums. If the store sorted and categorized their albums, you will find your albums faster. In addition, the cool interior design & architecture will make the whole experience much comfortable. Clean code is like that well organised, sophisticated record store.

    There are two types of programming. Good programming and bad programming. Even bad code works. But it is not enough for code to work. It should be understandable at once, readable and scalable. It should not make other developers scratch their head in frustation! So how do we achieve it? The following way :

## Characteristics of a Clean code
* Elegant: Clean code is pleasing to read, should make you smile.
* Readable: Clean code should read like well-written prose.
* Simple: Do one thing with the Single Responsibility Principle (SRP).
* Testable: Run all the tests.

## Meaningful Names
>“You should name a variable using the same care with which you name a first-born child.”
>“There are only two hard things in Computer Science: cache invalidation and naming things” — Phil Karlton

   Everything in an application has a name, from variables, functions, arguments, classes, modules, to packages, source file, directories.

Naming things is the most common problem of every developer. A good name will make understanding the code much easier. Uncle Bob has shared some simple rules to create good names:

### Do's:
Use intention-revealing Names

The name should tell you why it exists, what it does, and how it is used. If a name requires a comment, it is a bad name.

var a = 0 # the name a reveals nothing : bad .

var age = 0; # : good

Use Pronounceable Names

Humans are good at words and words are, by definition, pronounceable.
 This matters because programming is a social activity.

edvbn = circle.radius  : bad

circle_radius = circle.radius  : good

Class Names

Classes and objects should have noun or noun phrase names like Customer, WikiPage, Account, and AddressParser. Avoid words like Manager, Processor, Data, or Info in the name of a class.
A class name should not be a verb.

Method Names

Methods should have a verb or verb phrase names. Examples: createUser, deletePhoto or save

Pick One Word per Concept

One and the same concept in your application should have the same name. For example, it’s confusing to have fetch, retrieve, and get as equivalent methods of different classes.
Using the same word per concept will help developers more easy to understand the code.

### Don'ts:
 Encodings

Encoded names are seldom pronounceable and are easy to mistype.

 Mental Mapping

Readers shouldn’t have to mentally translate your names into other names they already know. This problem generally arises from a choice to use neither problem domain terms nor solution domain terms.
One difference between a smart programmer and a professional programmer is that the professional understands that clarity is king. Professionals use their powers for good and write code that others can understand.

 Pun

Avoid using the same word for two purposes. Using the same term for two different ideas is essentially a pun.

## Functions
A Function should do one thing only and do it really well
### Certain tips for writing effective functions:

* Avoid passing boolean into a function, this is a hint that func has an if statement within which causes it to do more than one thing.
* Functions should either do something or answer something, but not both. This ensures a function does not have hidden side effects. e.g a func named isEven() should only return a bool and not do any other operations
* Prefer Exceptions to Returning Error Codes and extract error handling try catch into their own function.
* Avoid output arguments. Function if it has to, should change state of its owning object
* Code should always be separated with blank line to club logical blocks together. Think of different lines of code as thoughts and then always think of organizing similar thoughts together
* Each function should read like a newspaper, every functions implementation following its call and having less vertical density
* Don’t return null

## Comments

If you are writing comments to prove your point, you are doing a blunder. Ideally, comments are not required at all. If your code needs commenting, you are doing something wrong. Our code should explain everything. Modern programming languages are english like through which we can easily explain our point. Correct naming can prevent comments.

## Unit Tests
 > “Code, without tests, is not clean. No matter how elegant it is, no matter how readable and accessible, if it hath not tests, it be unclean. Dave” ― Robert C. Martin

The Test Driven Development (TDD): It is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only.

Uncle Bob describes TDD with 3 laws:

* First Law: You may not write production code until you have written a failing unit test.
* Second Law: You may not write more of a unit test than is sufficient to fail, and not compiling is failing.
* Third Law: You may not write more production code than is sufficient to pass the currently failing test.

So folks, that's it. This surely does not include all the details of clean code but it can help you get basics of clean code right. We also have many tools available to help writing clean code. I will be introducing them in my upcoming blog-posts.
Till then, happy clean-coding!


text:
# pkgcloud-sync

A cloud storage syncing library. Allows you to synchronize a container from one cloud to another.

#### Supported Providers

- Amazon AWS Simple Storage Service (s3) `amazon`
- HP Cloud `hp`
- Openstack Swift `openstack`
- Rackspace Cloud Files `rackspace`

### Basic Usage

```javascript
var Sync = require('pkgcloud-sync').Sync;

var sync = new Sync({
  source: {
    provider: 'rackspace',
    region: 'dfw',
    username: '<rackspace-username>',
    apiKey: '<rackspace-apiKey>'
  },
  destination: {
    provider: 'rackspace',
    region: 'dfw',
    username: '<rackspace-username>',
    apiKey: '<rackspace-apiKey>'
  },
  containers: 'my-container'
});

sync.run(function(err) {
	if (err) {
		log.error(err);
	}
	process.exit(err ? 1 : 0);
});
```

This will sync all of the contents of container `my-container` from the `DFW` region to the `IAD` region for Rackspace. Subsequent executions of the sync will validate contents before uploading, thus saving significant time.

**It is strongly encouraged to run this from either the source or destination region.**

#### Unsupported Providers

The following providers are unsupported at this time:

- Google Cloud Storage `google`

The Google Cloud Storage provider is somewhat functional, but is not yet fully tested. See [pkgcloud#399](https://github.com/pkgcloud/pkgcloud/issues/399) for more information.

license: ISC

repository: jeremymturner/pkgcloud-sync

repo_name: jeremymturner/pkgcloud-sync


text:
## Empathy Map

#### What is it?
An empathy map is a collaborative tool teams can use to gain a deeper insight into their customers. Much like a user persona, an empathy map can represent a group of users, such as store managers.

#### Why do you use it?
Empathy map helps the designer summarize what is learned about the user from the Understand phase in a format that really pushes the designer into the mindset of an end user.

#### When to use it?
After user interviews. It can be used for general understanding of the persona, or for a specific user scenario.

#### How to do it?
To produce an empathy map, you'll simply need to find answers to the questions in this empathy map canvas:
![Empathy Map Canvas](/images/empathy-map-canvas.png?raw=true "Empathy Map Canvas")

---

Reference:

https://medium.com/the-xplane-collection/updated-empathy-map-canvas-46df22df3c8a

https://www.solutionsiq.com/resource/blog-post/what-is-an-empathy-map/


text:
# TODO #

### Primary tasks ###
* Create another mapper, to map item prototype/DTO to "real" item model
* Create factory for item model decoration
* Decorate item model, to add more functionality like eg. convert `Category`-`Id` pair
from external source, to `item name`, `excelent options` etc.
* Create manager with functionality:
    * add new item
    * remove item
    * modify item
    * move item in collection
    * fetch all items

### Secondary tasks ##
* Create Item.txt import component. Sample scenario:
    * User import Item.txt via admin panel
    * mutant-items-manager will parse the content
    * component will create DTOs based on parsed content
    * list of newly created DTOs will be received by eg. data provider for further processing
* Create manager to support operations on non-binary items (from webshop)

repository: mutantmuonline/mutant-items-manager

repo_name: mutantmuonline/mutant-items-manager


text:
# Slot: biocide

List of biocides (commercial name of product and supplier) and date of administration

URI: [mixs.vocab:biocide](https://w3id.org/mixs/vocab/biocide)

## Domain and Range

None ->  OPT [String](types/String.md)

## Parents

 *  is_a: [environment field](environment_field.md)

## Children

## Used by

 * [HydrocarbonResources-fluidsSwabs](HydrocarbonResources-fluidsSwabs.md)
 * [HydrocarbonResources-fluidsSwabsME](HydrocarbonResources-fluidsSwabsME.md)
 * [HydrocarbonResources-fluidsSwabsMIGSBacteria](HydrocarbonResources-fluidsSwabsMIGSBacteria.md)
 * [HydrocarbonResources-fluidsSwabsMIGSEukaryote](HydrocarbonResources-fluidsSwabsMIGSEukaryote.md)
 * [HydrocarbonResources-fluidsSwabsMIGSOrg](HydrocarbonResources-fluidsSwabsMIGSOrg.md)
 * [HydrocarbonResources-fluidsSwabsMIGSPlant](HydrocarbonResources-fluidsSwabsMIGSPlant.md)
 * [HydrocarbonResources-fluidsSwabsMIGSVirus](HydrocarbonResources-fluidsSwabsMIGSVirus.md)
 * [HydrocarbonResources-fluidsSwabsMIMAG](HydrocarbonResources-fluidsSwabsMIMAG.md)
 * [HydrocarbonResources-fluidsSwabsMIMARKSSpecimen](HydrocarbonResources-fluidsSwabsMIMARKSSpecimen.md)
 * [HydrocarbonResources-fluidsSwabsMIMARKSSurvey](HydrocarbonResources-fluidsSwabsMIMARKSSurvey.md)
 * [HydrocarbonResources-fluidsSwabsMISAG](HydrocarbonResources-fluidsSwabsMISAG.md)
 * [HydrocarbonResources-fluidsSwabsMIUVIG](HydrocarbonResources-fluidsSwabsMIUVIG.md)

## Other properties

|  |  |  |
| --- | --- | --- |
| **Aliases:** | | biocide administration |
| **Mappings:** | | MIXS:0001011 |
| **Comments:** | | Expected value: name;name;timestamp |
|  | | Occurrence: 1 |
|  | | Position: 30.0 |
|  | | This field is used uniquely in: hydrocarbon resources-fluids_swabs |
| **Examples:** | | Example(value='ALPHA 1427;Baker Hughes;2008-01-23', description=None) |


text:
## Multi-Site High-Frequency Stochastic Precipitation Generator

This is a github repository for the paper entitled "Multi-Site High-Frequency Stochastic Precipitation Generator Using Censored Skew-Symmetric Distributions". The paper is currently under review.

This project is designed to propose a multi-site stochastic weather generator (SWG) to reproduce the statistical properties of high- frequency precipitation.

The motivating data was collected by Institute of Earth Surface Dynamics (IDYST) at the University of Lausanne in 2016 using eight Pluvimate acoustic rain gauges, designed by [Dryptich](http://www.driptych.com). The detailed description of the Pluvimate rain gauges can be found in Benoit et al. (2018)[1]. This instrument can measure precipitations at a 0.01mm and 30 second resolution by counting individual raindrops. From April 4th to April 14th, 2016, a total number of 230,400 observations were recorded by the network of eight rain gauges located within a radius of 1 km.

### Main Results

The following figure shows the performance comparison between our proposed model with skew-t errors and a similar model with Gaussian errors (Koch (2016)[2]). We show that our model can capture the high intensity better than existing methods.

### Required R packages
* Rmarkdown
* here
* downloader
* readr
* reshape2
* ggplot2
* dplyr
* sn
* geoR

Please run "install_packages.R" file first to make sure the required R packages are installed.

### Run
To reproduce the tables and figures, one can clone or download the repository and open the "rainfall generator.Rproj" to run the codes. The source codes are store in the directory /R.

The file "99_make_all.R" offers a simple one-click way to reproduce all of the results. It will take several hours to run.

One can also run the scripts one by one by following the steps below. All of the scripts are self-explained and written in either .R or .Rmd format.

1. (optional) 01_gather_data.R file provides a automatic way to obtain the data used in this study. The downloaded data are stored in /data directory.
1. 02_describing_raw_data.Rmd file reads the raw data and provides some simple description.
1. 03_preprocessing_data.Rmd file preprocesses the raw data and save the preprocessed data to ./results directory as .Rdata files.
1. 04_estimating_parameters.Rmd file includes the algorithm to estimate the required parameters in our model and saves the fitted parameters to ./results directory as .Rdata files.
1. 05_inference_and_simulation.Rmd file provides the data simulation in order to reproduce the high-frequency rainfall. It also provides inferences based on the estimation results. Most of the results and figures are generated by this file.
1. 11_simulation_study.Rmd includes the simulation study to validate our model and compare with others.
1. 99_make_all.R provides an automatic way to run all of the aforementioned files.

### Reference
* [1] [Stochastic Rainfall Modeling at Sub-kilometer Scale](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2018WR022817)
* [2] [A frailty-contagion model for multi-site hourly precipitation driven by atmospheric covariates](https://www.sciencedirect.com/science/article/pii/S0309170815000032)

### Author
- Yuxiao Li and Ying Sun

repository: aleksada/MultisiteHighFreqPG

repo_name: aleksada/MultisiteHighFreqPG