text:
fb_ntp Cookbook
====================
This cookbook configures NTPD on a system.

Requirements
------------

Attributes
----------
* node['fb_ntp']['ntpd_options']
* node['fb_ntp']['ntpdate_options']
* node['fb_ntp']['ntpdate_retries']
* node['fb_ntp']['sync_hwclock']
* node['fb_ntp']['ntp_conf_server_options']
* node['fb_ntp']['preferred_servers']
* node['fb_ntp']['servers']
* node['fb_ntp']['noselect_servers']
* node['fb_ntp']['listen_interfaces']
* node['fb_ntp']['monitor']
* node['fb_ntp']['leapfile']
* node['fb_ntp']['leapsmearinterval']

Usage
-----
All the attributes will be populated by sane defaults and you shouldn't normally
need to set any of them.

`node['fb_ntp']['servers']` is an array of server that ntpd and ntpdate will
use. `node['fb_ntp']['preferred_servers']` is the same but the servers
defined there will be marked as "preferred" by ntpd.
`node['fb_ntp']['noselect_servers']` is an array of server that are only used
for display and are discarded by the selection algorithm.
`node['fb_ntp']['ntpd_options']` and `node['fb_ntp']['ntpdate_options']`
are the command line options passed respectively to ntpd and ntpdate. Finally,
`node['fb_ntp']['ntpdate_retries']` is number of retries ntpdate init script
tries to setup correct time on bootup.
`node['fb_ntp']['sync_hwclock']` is a boolean that controls whether we try
to sync the hardware clock after a successful ntpdate run on boot.
`node['fb_ntp']['ntp_conf_server_options']` is a string that will be appended
to all server lines in the ntp configuration file.
`node['fb_ntp']['listen_interfaces']` is an array of interface to limit ntp
to listen to.
`node['fb_ntp']['monitor']` when set to false disables the monlist feature which
can be used as a reflection DDOS (CVE-2013-5211).
`node['fb_ntp']['leapfile']` should be set only on Stratum 2 servers.
Contains an actual copy of [IETF Leap Seconds file](https://www.ietf.org/timezones/data/leap-seconds.list)
The file should be updated twice a year. We will get notification in
<EMAIL_ADDRESS>mailing list before it happens, and you will need to update
this file in the cookbook. If you want to add fake leap second for testing or
debug purposes, you will can use 'ntpchkng utils fakeseconds' to generate
fake leap seconds and update checksums in this file. Make sure that
the production version of the file contains only real leap seconds!
`node['fb_ntp']['leapsmearinterval']` should be set only on Stratum 2 servers.
Duration of time in seconds for smearing of the leap second offset.

Default recipe is included in fb_init, whereas the server one has to be included
in the runlist in roles definition. Usually only cm and routablecm tiers will
need it.

repository: facebook/chef-cookbooks

repo_name: facebook/chef-cookbooks


text:
# IoT based LED light automation with Raspberry Pi
This is a Simple IoT usecase to demonstrate "machine-to-machine" (M2M) communication using [Distributed Services Architecture(DSA)](http://iot-dsa.org/)

The LED bulb turns on automatically if the room is dark (due to power failure or some other reason) and sends an email alert to the building manager regarding the same. The brightness level in the room is monitored through light sensor in an android phone.
# Architecture

1. The Brightness level of a living area is monitored continously with the help of light sensor in an Android phone.

2. The DSLink, residing on android phone sends the brightness level recorded by the light sensor and streams the data every second to other DSLinks. (A DSLink is a device deployable piece of code written in Java SDK. It has capability to interact with any peripheral devices connected to an Edge device/node.)

3. The DSLinks follows Pub-Sub Pattern for information passage. The DSLink on Raspberry Pi has subscribed to DSLink on the android phone, thus Raspberry Pi is able to collect brightness level data generated by light sensor.

4. The streamed data is monitored for value dipping below a threshold, indicating the light source in the living room is not functioning. Raspberry then triggers two events, Turning LED on through GPIO modules and sending email alert to the configured email address.

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Top cryptocurrencies parser using CoinGecko API

### Installation
PyPI
```bash
pip install pycoingecko
pip install pandas
```

### Usage

```python
val = int(input("Please enter number n:\n"))
print(f'Top {val} cryptocurrencies by market capitalization \n')
print(sort_by_market_cap(val))
```

### Examples

Usage examples:
```python
# Please enter number n:
>>> 5
Top 5 cryptocurrencies by market capitalization

id
bitcoin        1
ethereum       2
cardano        3
tether         4
binancecoin    5

# OR Please enter number n:
>>> 10
Top 10 cryptocurrencies by market capitalization

id
bitcoin         1
ethereum        2
cardano         3
tether          4
binancecoin     5
ripple          6
solana          7
usd-coin        8
polkadot        9
dogecoin       10

```

license: MIT

branch_name: refs/heads/main


text:
# First Phase
### idea
* sand play on projection mappinged
* multi-user interactive installation
* user can make creatures
* detect depth of sand by using kinect sensor

### Very early concept sketch

** make a world with sand play
![concept sketch 01](../project_images/post/01/App_Idea_P32.png?raw=true "concept sketch 01")

** Rought technical sketch
![concept sketch 02](../project_images/post/01/App_Idea_P33.png?raw=true "concept sketch 02")

repository: SanghunHeo/devart-template

repo_name: SanghunHeo/devart-template


text:
# Go ADS1113, ADS1114, and ADS1115 interface

Golang ADS1113, ADS1114, and ADS1115 interface using periph.io driver

[![GoDoc Reference](https://godoc.org/github.com/MichaelS11/go-ads?status.svg)](http://godoc.org/github.com/MichaelS11/go-ads)
[![Go Report Card](https://goreportcard.com/badge/github.com/MichaelS11/go-ads)](https://goreportcard.com/report/github.com/MichaelS11/go-ads)

Should be easily extendable for ADS1111, ADS1112, and ADS1113, devices (ADS111x) with very little work. If you are intrested, let me know and we can work togeter to get it to work.

## Please note

Please make sure to setup your ADS1113, ADS1114, and ADS1115 correctly. Do a search on the internet to find guide. Here is an example of a guide:

https://learn.adafruit.com/adafruit-4-channel-adc-breakouts/

The examples below are from using a Raspberry Pi 3 with I2C1 for the bus and 0x48 for the address. Your setup may be different, if so, your bus and address would need to change in each example.

Tested on Raspberry Pi 3 with ADS1115. Please open an issue if there are any issues.

## Get

go get github.com/MichaelS11/go-ads

## ReadRetry example

```go
package main

import (
	"fmt"

	"github.com/MichaelS11/go-ads"
)

func main() {
	// call HostInit once
	err := ads.HostInit()
	if err != nil {
		fmt.Println(err)
	}

	// create new ads with wanted busName and address.
	var ads1 *ads.ADS
	ads1, err = ads.NewADS("I2C1", 0x48, "")
	if err != nil {
		fmt.Println(err)
	}

	// example changing config gain (2/3 is default, so only an example)
	ads1.SetConfigGain(ads.ConfigGain2_3)

	// read retry from ads chip
	var result uint16
	result, err = ads1.ReadRetry(5)
	if err != nil {
		ads1.Close()
		fmt.Println(err)
	}

	// close ads bus
	err = ads1.Close()
	if err != nil {
		fmt.Println(err)
	}

	// print results
	fmt.Println("result:", result)
	volts := (float64(result) / 32767.0 * 5.0)
	fmt.Println("volts:", volts)
	psi := 360.0*volts - 25.0
	fmt.Println("psi:", psi)
}
```

## ReadBackground example

```go
package main

import (
	"fmt"
	"time"

	"github.com/MichaelS11/go-ads"
)

func main() {
	// call HostInit once
	err := ads.HostInit()
	if err != nil {
		fmt.Println(err)
	}

	// create new ads with wanted busName and address
	var ads1 *ads.ADS
	ads1, err = ads.NewADS("I2C1", 0x48, "")
	if err != nil {
		fmt.Println(err)
	}

	// changing config gain
	ads1.SetConfigGain(ads.ConfigGain1)

	stop := make(chan struct{})
	stopped := make(chan struct{})
	var result uint16

	// get ads chip reading every 5 seconds in background
	go ads1.ReadBackground(&result, 5*time.Second, stop, stopped)

	// should have at least read the ads chip twice after 15 seconds
	time.Sleep(15 * time.Second)

	// to stop ReadBackground after done with reading, close the stop channel
	close(stop)

	// can check stopped channel to know when ReadBackground has stopped
	<-stopped

	// close ads bus
	err = ads1.Close()
	if err != nil {
		fmt.Println(err)
	}

	// print results
	fmt.Println("result:", result)
	volts := (float64(result) / 32767.0 * 5.0)
	fmt.Println("volts:", volts)
	psi := 360.0*volts - 25.0
	fmt.Println("psi:", psi)
}
```

## Read example

```go
	// call HostInit once
	err := ads.HostInit()
	if err != nil {
		fmt.Println(err)
	}

	// create new ads with wanted busName and address.
	var ads1 *ads.ADS
	ads1, err = ads.NewADS("I2C1", 0x48, "")
	if err != nil {
		fmt.Println(err)
	}

	// example changing config gain (2/3 is default, so only an example)
	ads1.SetConfigGain(ads.ConfigGain2_3)

	// read from ads chip
	var result uint16
	result, err = ads1.Read()
	if err != nil {
		ads1.Close()
		fmt.Println(err)
	}

	// close ads bus
	err = ads1.Close()
	if err != nil {
		fmt.Println(err)
	}

	// print results
	fmt.Println("result:", result)
	volts := (float64(result) / 32767.0 * 5.0)
	fmt.Println("volts:", volts)
	psi := 360.0*volts - 25.0
	fmt.Println("psi:", psi)
}
```

gha_language: Go

gha_license_id: MIT


text:
# Deploying vpc-router in production

## Installing and running the code

### Option 1: Installation via pip

This is the simplest way to install vpc-router:

    pip install vpcrouter

### Option 2: Installation via setup.py

After downloading the code, run the `setup.py` script, which performs a proper
install and puts vpcrouter in your path:

    $ git clone git@github.com:paninetworks/vpc-router.git
    $ cd vpc-router
    $ python setup.py install
    $ vpcrouter .......

### Option 3: Running in a container

Pre-built containers for the vpc-router are provided on Quay.io. You can
download the latest version:

    $ docker pull quay.io/romana/vpcrouter

If you prefer to build your own container, a [Dockerfile](Dockerfile) has been
provided with the software. To build your own container, use:

    $ docker build -t yourname/vpcrouter:1.3.2 .

A few command line arguments are set by default in the container, while
others still need to be specified when you run the container. Specifically, the
mode as well as any parameters this mode may require.

For example, to use the configfile mode, run the container with these options,
which provide a mapping for the directory containing the config file:

    $ docker run -v <host-dir-with-conf-file>:/conf \
         quay.io/romana/vpcrouter -m configfile -f /conf/<conffile-name>

To run it in HTTP mode, use the following, which exposes the port 33289 on
which vpc-router listens for requests. Also, a different listen address needs
to be specified:

    $ docker run -p 33289:33289 quay.io/romana/vpcrouter -m http -a <IP_ADDRESS>

Note that in the container, vpc-router logs to stdout, which tends to be the
preferred log destination in containerized environments.

## Running on an EC2 instance in the VPC

Note: The following information is independent of how vpc-router is installed
or run.

### IAM policies

The most common mode of operation is to run vpc-router on an EC2 instance
within the VPC for which routing tables need to be controlled. This has the
advantage that it can auto-detect the AWS region and VPC (the `-r` and `-v`
parameters). It also means that typically it has access to the various
instances for health check purposes.

To modify VPC routes, it requires permissions to access the AWS APIs.
Typically this is done by assigning IAM roles to the instance(s) on which it
runs. A suitable IAM policy for the vpc-router may look like this:

    {
        "Statement": [
            {
                "Action": [
                    "ec2:*Vpc*",
                    "ec2:*Route*",
                    "ec2:Describe*"
                ],
                "Resource": [
                    "*"
                ],
                "Effect": "Allow"
            }
        ]
    }

### Security rules for health checks

In its current form, vpc-router by default performs active health checks on all
the instances listed in the route spec, by sending ICMP Echo ("ping") requests
at regular intervals (`--health icmpecho` option). Please make sure that your
security rules allow for ICMP Echo requests and responses to be exchanged.

If you use different health monitoring plugins, please adjust your security
rules accordingly. For example for the 'tcp' plugin (`--health tcp` option),
please make sure you open the port to which it attempts to connect
(`--tcp_check_port` option).

If you use the multi plugin (`--health multi`) the security rules need to be
configured so that all specified sub plugins (`--multi_plugins ...` option)
can perform their security checks.

repository: grusy/vpc-router

repo_name: grusy/vpc-router


text:
My tryouts to refresh "Devops 2.0 toolkit" book repository to make things work again:
===============================================================================
- updated image used in book tutorials from ubuntu/trusty64 to ubuntu/xenial64;
- changed some deprecated versions of software packages were it was possible;
- changed some stuff in Ansible playbooks, considering things mentioned above;
- changed some features in Jenkins pipelines (some original jobs)

This repo is IaC part of the book practice. Application repo itself with automated tests is located here [mybooks-ms](https://github.com/awsivbilinskyy/mybooks-ms)

 NOTE:
* I've tried to fix the issues I faced myself passing the book chapters covering CI/CD automation, deployments, self-healing, and system monitoring, so the best way is to go through the book chapters mentioned above along with a code from this repo. However, some of my solutions are not the best so you are free to find the better suitable for you.

Prerequisits for host VM
----------------------------------------------------------------------------------
for Ubuntu (16.04/18.04) host:

* Installation of Oracle Virtual Box and Vagrant are required on host machine:
```
sudo apt-get install -y virtualbox

sudo apt-get install -y vagrant
```
* verify Vagrant installation and install additional vagrant plugins on host:
```
vagrant -v

vagrant plugin install vagrant-cachier && \
vagrant plugin install disksize && \
vagrant plugin install proxyconf
```

* Clone my repositories from github and navigate to a working directory:
```
git clone https://github.com/awsivbilinskyy/mybooks-ms.git

git clone https://github.com/awsivbilinskyy/myms-lifecycle.git

cd myms-lifecycle
```

----------------------------------------------------------------------------------
First chapters of the book
----------------------------------------------------------------------------------
The practice Chapters of the book:
- Setting Up the Development Environment With Vagrant and Docker
- Implementation of the Deployment Pipeline: Initial Stages
- Configuration Management in the Docker World
- Implementation of the Deployment Pipeline: Intermediate Stages
- Service Discovery: The Key to Distributed Services
- Proxy Services
- Implementation of the Deployment Pipeline: The Late Stages

were verified to work with no problems, however you should use
my [awsivbilinskyy/mybooks-ms](https://github.com/awsivbilinskyy/mybooks-ms.git) repo, instead [vfarcic/books-ms](https://github.com/vfarcic/books-ms.git)
and my [awsivbilinskyy/myms-lifecycle](https://github.com/awsivbilinskyy/myms-lifecycle.git) repo, instead [vfarcic/ms-lifecycle](https://github.com/vfarcic/ms-lifecycle.git)
running manual steps described in those chapters.

----------------------------------------------------------------------------------
Automating Implementation of the Deployment Pipeline (verify)
----------------------------------------------------------------------------------
(Book Chapter: "Automating Implementation of theDeployment Pipeline", page 178)

Start VM's for needed for this book chapter and connect to cd node:
```
vagrant up cd prod

vagrant ssh cd
```
clone application repository on cd node and enter working directory:
```
git clone https://github.com/awsivbilinskyy/mybooks-ms.git

cd mybooks-ms
```
now we will run Ansible playbook to deploy all provision steps described in book chapter
```
ansible-playbook /vagrant/ansible/service.yml -i /vagrant/ansible/hosts/prod --extra-vars "repo_dir=$PWD service_name=books-ms"
```
* notice: from time to time this may fail with an error:
"Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)" - to fix this just restart the playbook once more

to verify if application was deployed succesfuly the next command:
```
curl -i http://<IP_ADDRESS>/api/v1/books
```
should return "HTTP/1.1 200 OK..." responce

----------------------------------------------------------------------------------
Continuous Integration (CI), Delivery and Deployment (CD) Tools
----------------------------------------------------------------------------------
(Book Chapter: "Continuous Integration (CI), Delivery and Deployment (CD) Tools: Jenkins", page 196)

Start VM's for Jenkins setup and connect to cd node:
```
vagrant up cd prod

vagrant ssh cd
```
setup and configure Jenkins node and master nodes:
```
ansible-playbook /vagrant/ansible/jenkins-node.yml -i /vagrant/ansible/hosts/prod
ansible-playbook /vagrant/ansible/jenkins.yml -c local
```
launch Jenkins job to provision prod node with ansible http://<IP_ADDRESS>:8080/job/books-ms-ansible/

* notice from time to time this may fail with an error:
"Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)" - to fix this just restart the playbook once more

To start the parameterized job for service deployment follow the link http://<IP_ADDRESS>:8080/job/books-ms/
with default parameters

to verify service in Consul  http://<IP_ADDRESS>:8500/ui/#/dc1/services/books-ms

to verify service from console, connect to prod node and run curl command:
```
vagrant ssh prod

curl -i http://<IP_ADDRESS>/api/v1/books
```
should return "HTTP/1.1 200 OK ...."

----------------------------------------------------------------------------------
Automating Blue-Green Deployment
----------------------------------------------------------------------------------
(Book Chapter: "Blue-Green Deployment: Automating the Blue-Green Deployment with Jenkins Workflow", page 244)

Start VM's for Blue-Green Deployment and connect to cd node:
```
vagrant up cd prod

vagrant ssh cd
```
run playbooks to provision all that will be needed for Blue-Green deployment:
```
ansible-playbook /vagrant/ansible/prod2.yml -i /vagrant/ansible/hosts/prod

ansible-playbook /vagrant/ansible/jenkins-node.yml -i /vagrant/ansible/hosts/prod

ansible-playbook /vagrant/ansible/jenkins.yml -c local
```
* notice: from time to time this may fail with an error:
"Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)" - to fix this just restart the playbook once more

open Jenkins job http://<IP_ADDRESS>:8080/job/books-ms-blue-green/ ,click the "Scan Multi-branch Pipeline Now" link for running automated blue-green deployment.
At the first run it will deploy blue release. To verify what release is actually deployed from cd node execute the next:
```
export DOCKER_HOST=tcp://<IP_ADDRESS>:2375

docker ps -a --filter name=books --format "table {{.Names}}"
```
to verify this from console run:
```
curl <IP_ADDRESS>:8500/v1/catalog/services | jq '.'

curl <IP_ADDRESS>:8500/v1/catalog/service/books-ms-blue | jq '.'

curl -I <IP_ADDRESS>/api/v1/books
```
or you can verify current color of release deployed from Consul ui http://<IP_ADDRESS>:8500/ui/#/dc1/kv/books-ms/color/edit

----------------------------------------------------------------------------------
Swarm Cluster Blue-Green deployment with Jenkins jobs
----------------------------------------------------------------------------------
(Book Chapter: "Clustering And Scaling Services: Automating Deployment With Docker Swarm and Ansible", page 291)

Start VM's for a cluster with cd (node for provision) swarm-master and two swarm worker nodes
```
vagrant up cd swarm-master swarm-node-1 swarm-node-2
```
Connect to provision node
```
vagrant ssh cd
```
Start playbooks to provision swarm nodes and container with Jenkins master and slaves
```
ansible-playbook /vagrant/ansible/swarm.yml -i /vagrant/ansible/hosts/prod
ansible-playbook /vagrant/ansible/jenkins-node-swarm.yml -i /vagrant/ansible/hosts/prod
ansible-playbook /vagrant/ansible/jenkins.yml -c local
```
Open Jenkins console and launch the job "books-ms-swarm" (link on job http://<IP_ADDRESS>:8080/job/books-ms-swarm/ ) with "Scan Mutlibranch Pipeline Now" bottun to start the Blue deployment.
After succesful completition of the job, to checkout swarm cluster and application deployment from cd node, execute the follows:
```
export DOCKER_HOST=tcp://<IP_ADDRESS>:2375
docker info
docker ps -a --filter name=books --format "table {{.Names}}\t{{.Status}}"
```
which should return the next results:
```
NAMES                             STATUS
swarm-node-2/booksms_app-blue_1   Up 36 minutes
swarm-node-1/books-ms-db          Up 36 minutes
```
to verify the service of application itself run from bash:
```
curl <IP_ADDRESS>:8500/v1/catalog/service/books-ms-blue | jq '.'
curl <IP_ADDRESS>:8500/v1/kv/books-ms/color?raw
curl <IP_ADDRESS>:8500/v1/kv/books-ms/instances?raw
```
or open in browser http://<IP_ADDRESS>:8500/v1/catalog/service/books-ms-blue. To verify registered services status in Consul ui http://<IP_ADDRESS>:8500/ui/#/dc1/services.

Send data to application
```
curl -H 'Content-Type: application/json' -X PUT -d \
'{"_id": 1,
"title": "My First Book",
"author": "John Doe",
"description": "Not a very good book"}' \
<IP_ADDRESS>/api/v1/books | jq '.' && \
curl -H 'Content-Type: application/json' -X PUT -d \
'{"_id": 2,
"title": "My Second Book",
"author": "John Doe",
"description": "This one better"}' \
<IP_ADDRESS>/api/v1/books | jq '.'
```
verify the data were successfuly saved by URL http://<IP_ADDRESS>/api/v1/books or by shell:
```
curl <IP_ADDRESS>/api/v1/books | jq '.'
```
Run Jenkins job "books-ms-swarm" http://<IP_ADDRESS>:8080/job/books-ms-swarm/ once more to get Green Deployment and after completition verify the result:
```
docker ps -a --filter name=books --format "table {{.Names}}\t{{.Status}}" && \
curl <IP_ADDRESS>/api/v1/books | jq '.'
```
should return:
```
NAMES                              STATUS
swarm-node-1/booksms_app-green_1   Up 56 minutes
swarm-node-2/booksms_app-blue_1    Exited (137) 55 minutes ago
swarm-node-1/books-ms-db           Up 2 hours

[
  {
    "_id": 1,
    "title": "My First Book",
    "author": "John Doe"
  },
  {
    "_id": 2,
    "title": "My Second Book",
    "author": "John Doe"
  }
]
```
with Green deployment running, while Blue exited, with the data we've inputed for Blue deployment.

For cleaning up the environment exit the cd VM, and use cleanup.sh script.

----------------------------------------------------------------------------------
Self-Healing Systems - redeployment, scaling, descaling jobs
----------------------------------------------------------------------------------
(Book Chapter: "Self-Healing Systems: Self-healing with Docker, ConsulWatches, and Jenkins", page 312)

Start VM's for a cluster with cd (node for provision) swarm-master and two swarm worker nodes
```
vagrant up cd swarm-master swarm-node-1 swarm-node-2
```
Connect to provision node
```
vagrant ssh cd
```
Start playbooks to provision swarm nodes Jenkins master and slaves for service healing
```
### on cd node ###

ansible-playbook /vagrant/ansible/swarm.yml -i /vagrant/ansible/hosts/prod

ansible-playbook /vagrant/ansible/jenkins-node-swarm.yml -i /vagrant/ansible/hosts/prod

ansible-playbook /vagrant/ansible/jenkins.yml --extra-vars "main_job_src=service-healing-config.xml" -c local

ansible-playbook /vagrant/ansible/swarm-healing.yml -i /vagrant/ansible/hosts/prod

exit;
```
Open http://<IP_ADDRESS>:8500/ui/#/dc1/nodes/swarm-master to verify the new checks were created.

Start the job to deploy the books-ms application with health self-checks http://<IP_ADDRESS>:8080/job/books-ms/

To verify the results of job execution through Consul follow the link http://<IP_ADDRESS>:8500/ui/#/dc1/services/books-ms

Connect to swarm-master node and stop nginx container which will cause books-ms application to fail, which will triger the redeployment job to fix application state
```
vagrant ssh swarm-master

### on swarm-master node

docker stop nginx

exit;

### back to cd node

vagrant ssh cd

curl <IP_ADDRESS>/api/v1/books
```
after few minutes check the output of redeployment job which was triggered when books-ms application failed one of the checks
http://<IP_ADDRESS>:8080/job/service-redeploy/lastBuild/console
when service-redoploy job and has finished check application status from cd node :
```
curl -I <IP_ADDRESS>/api/v1/books
```

Now we triggered the same job but for the case when container with application is completely removed, run from cd node:
```
export DOCKER_HOST=tcp://<IP_ADDRESS>:2375

docker rm -f $(docker ps --filter name=booksms --format "{{.ID}}")
```
after few minutes check http://<IP_ADDRESS>:8080/job/service-redeploy/lastBuild/console, the job redeployed application, to verify this from the console:
```
docker ps --filter name=books --format "table {{.Names}}"

curl -I swarm-master/api/v1/books
```
should return HTTP responce 200

For scaling application run http://<IP_ADDRESS>:8080/job/books-ms-scale/ parametrised job with desired scale count set as paramter (default 2). This will redeploy the service. To verify this run the next:
```
export DOCKER_HOST=tcp://<IP_ADDRESS>:2375

docker ps --filter name=books --format "table {{.Names}}"

curl <IP_ADDRESS>:8500/v1/kv/books-ms/instances?raw
```
For descaling application run http://<IP_ADDRESS>:8080/job/books-ms-descale parametrised job with desired count of instances (default -2). To verify this run the next:
```
docker ps --filter name=books --format "table {{.Names}}"

curl <IP_ADDRESS>:8500/v1/kv/books-ms/instances?raw

exit;
```

----------------------------------------------------------------------------------
Centralized Logging and Monitoring (verified)
----------------------------------------------------------------------------------
(Book Chapter: "Centralized Logging and Monitoring: ", page 347)

Start environment VM's from host machine:
```
vagrant up cd prod logging
```

on cd node run the next playbook to provision monitoring toolset:
```
vagrant ssh cd

ansible-playbook /vagrant/ansible/elk.yml -i /vagrant/ansible/hosts/prod --extra-vars "logstash_config=file.conf"

exit;
```
* notice from time to time this may fail with an error:
"Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)" - to fix this just restart the playbook once more

connect to logging node and fill in and checkout the entries for logstash :
```
vagrant ssh logging

echo "my first log entry" >/data/logstash/logs/my.log && \
echo "my second log entry" >>/data/logstash/logs/my.log && \
echo "my third log entry" >>/data/logstash/logs/my.log

docker logs logstash
```
and verify those events displayed in Kibana http://<IP_ADDRESS>:5601 (note: first time index "logstash-*" needs to be created).

copy sample apache log into logstash:
```
cat /tmp/apache.log >>/data/logstash/logs/apache.log

docker logs logstash
```

replace logstash conffile with filters
```
sudo cp /data/logstash/conf/file-with-filters.conf /data/logstash/conf/file.conf && \
docker restart logstash

cat /tmp/apache2.log >>/data/logstash/logs/apache.log && \
docker restart logstash
```

```
ansible-playbook /vagrant/ansible/elk.yml -i /vagrant/ansible/hosts/prod --extra-vars "logstash_config=beats.conf"

ansible-playbook /vagrant/ansible/prod3.yml -i /vagrant/ansible/hosts/prod

docker -H tcp://<IP_ADDRESS>:2375 logs logstash
```
ansible-playbook /vagrant/ansible/elk.yml -i /vagrant/ansible/hosts/prod --extra-vars "logstash_config=syslog.conf"

repository: awsivbilinskyy/myms-lifecycle

gha_language: Groovy

repo_name: awsivbilinskyy/myms-lifecycle


text:
# ClamAv-Constraint

[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.png?v=103)](https://opensource.org/licenses/mit-license.php)

This is a custom Symfony anti-virus validator for file uploads.
It uses the [Quahog](https://github.com/jonjomckay/quahog) library
to connect to a running clamav unix socket and scan the uploaded file.

This repository is strongly influenced by the [clamav-validator for laravel](https://github.com/sunspikes/clamav-validator)
and the [TissueBundle](https://github.com/Evozon-PHP/TissueBundle).

## Installation

    composer require ferdynator/clamav-constraint

Also make sure you have [`ClamAv`](http://www.clamav.net/documents/installing-clamav) installed.

## Usage

Add this constraint in your entity of choice:

    use ferdynator\ClamAvConstraint\Validator\Constraints as VirusAssert;

    class JobImage {

        ...

        /*
         * ...
         * @VirusAssert\ClamAv
         */
        protected $file;

        ...
    }

### Configuration

#### Alternative socket

In case you are not using a unix socket or have it in a non-standard position
you can pass an alternative socket-url:

    /*
     * ...
     * @VirusAssert\ClamAv(
     *     socket="tcp://<IP_ADDRESS>:1234"
     * )
     */
    protected $file;

#### File permissions

The `clamav` daemon needs read-access to the uploaded file. You can specify
a chmod-mode with the `chmod` option of the constraint.

    /*
     * ...
     * @VirusAssert\ClamAv(
     *     chmod=0600
     * )
     */
    protected $file;

repository: ferdynator/clamav-constraint

repo_name: ferdynator/clamav-constraint


text:
# Shrine::Scp
[![Build Status](https://travis-ci.org/jordanandree/shrine-scp.svg?branch=master)](https://travis-ci.org/jordanandree/shrine-scp)
[![Dependency Status](https://gemnasium.com/badges/github.com/jordanandree/shrine-scp.svg)](https://gemnasium.com/github.com/jordanandree/shrine-scp)

Scp storage plugin for Shrine attachment and upload toolkit

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'shrine-scp'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install shrine-scp

## Usage

```ruby
require "shrine/storage/scp"

Shrine.storages[:store] = Shrine::Storage::Scp.new(
	directory: "/path/to/uploads" # Required argument
)
```

### Optional Configuration

**ssh_host:**
optional `user@hostname` for remote scp transfers

**host:**
URLs will by default be relative if `:prefix` is set, and you can use this option to set a CDN host (e.g. `//abc123.cloudfront.net`).

**prefix:**
The directory relative to `directory` to which files will be stored, and it is included in the URL.

**options:**
Additional arguments specific to scp. See: [https://linux.die.net/man/1/scp](https://linux.die.net/man/1/scp)

**permissions:**
bit pattern for permissions to set on uploaded files. i.e. group read permissions: `0644`

## Development

After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jordanandree/shrine-scp.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

repository: tranxuanthang/shrine-scp

repo_name: tranxuanthang/shrine-scp


text:
The source code of this class is located at [CpuSampleFrequencyAnalyzer.hpp](../../include/LiveProfiler/Analyzers/CpuSampleFrequencyAnalyzer.hpp).

CpuSampleFrequencyAnalyzer is an analyzer used to find out which symbol names appear most frequently.

There two different rankings:
- Top Inclusive Symbol Names: The functions that uses the most cpu, include the functions it called
- Top Exclusive Symbol Names: The functions that uses the most cpu, not include the functions it called

# Functions in CpuSampleFrequencyAnalyzer

### setInclusiveTraceLevel

Set how many levels should be considered for inclusive sampling, the default value is 3.
For example:

```
- a
  - b
  - c
  - d
  - e
(e calls d calls c calls b calls a)
```

If inclusive trace level is 3, then `[a, b, c, d]` will be treated as inclusive sample.

### getResult

Generate the result.
The result type is defined as:

``` c++
using SymbolNameAndCountType = std::pair<std::shared_ptr<SymbolName>, std::size_t>;

class ResultType {
public:
	const std::vector<SymbolNameAndCountType>& getTopInclusiveSymbolNames() const&;
	const std::vector<SymbolNameAndCountType>& getTopExclusiveSymbolNames() const&;
	std::size_t getTotalSampleCount() const;
};
```

# Example

Example code: [Main.cpp](../../examples/CpuSampleFrequencyAnalyzer/Main.cpp)

Run example:

``` bash
sh run.sh a.out 10000
```

The output is like:

``` text
top 16 inclusive symbol names:
No. Overhead Samples SymbolName
  1     1.71   50964 make(int, NodePool&)
  2     0.50   14860 apr_palloc
  3     0.47   13905 main._omp_fn.0
  4     0.30    8969 GOMP_parallel
  5     0.26    7776 vmxarea
  6     0.22    6496 Node::check() const
  7     0.01     279 apr_pool_clear
  8     0.01     185 main
  9     0.01     185 __libc_start_main
 10     0.00      47 apr_allocator_destroy
 11     0.00      25 apr_pool_destroy
 12     0.00      11 __munmap
 13     0.00       2 __vsprintf_chk
 14     0.00       2 mmap
 15     0.00       1 _IO_default_xsputn
 16     0.00       1 vfprintf

top 11 exclusive symbol names:
No. Overhead Samples SymbolName
  1     0.50   14860 apr_palloc
  2     0.23    6793 make(int, NodePool&)
  3     0.19    5749 Node::check() const
  4     0.04    1122 main._omp_fn.0
  5     0.01     279 apr_pool_clear
  6     0.00      47 apr_allocator_destroy
  7     0.00      25 apr_pool_destroy
  8     0.00      11 __munmap
  9     0.00       2 mmap
 10     0.00       1 _IO_default_xsputn
 11     0.00       1 vfprintf
```

repository: windsOne/live-profiler

repo_name: windsOne/live-profiler


text:
# Bluetooth-Voltmeter
Arduino + BTM-112 module that send voltage over bluetooth serial link. Using common Metex voltmeter protocol, it is compatible with software that can read this protocol, e.g.  SmuView.

license: Unlicense

repository: tombic/Bluetooth-Voltmeter

repo_name: tombic/Bluetooth-Voltmeter


text:
---
layout: default
---

{% include header.md %}

## Features

### Customizable Settings

Adjust the settings to fit all the needs of your server! You can select the channel to send welcome logs to, the welcome log message, the prefix of the bot for this server, and more…

### Reliable and High Quality

With our revolutionary infrastructure implementation, we’re proud to achieve absolute 99.9% uptime!. This means that Welcome-Bot will always be online, and ready to relay messages between your server staff and users!

### Multi-purpose

The bot is multi-purpose!! It means that there are a lot of other uses of the bot, some of them are banning, kicking, unbanning users, pruning (or purging) messages, etc.

### Open Source

We are an open source project on [GitHub](https://github.com/Welcome-Bot/welcome-bot). Don’t believe what we’ve said earlier? Check out the source code for yourself! This means the maximum level of transparency, so you’ll never have to worry about privacy concerns.

## Docs

Want help? Visit [docs]({{ '/docs' | relative_url }})

## Images

### Welcome users

![Welcome users image]({{ '/assets/img/welcome.png' | relative_url }})

### Paginated help

![Paginated help image]({{ '/assets/img/help.png' | relative_url }})

### Get changelog on latest version!

![Changelog image]({{ '/assets/img/changelog.png' | relative_url }})

### Random waifu image

![Waifu image]({{ '/assets/img/waifu.png' | relative_url }})

{% include footer.md %}


text:
---
layout: post
title: Unihack 2017 Virtual Pet App with Unity3d and Vuforia
---

![App](/images/woof/app.jpg)

For Unihack 2017, Team Woof made an augmented reality app in Unity. We wanted to do something that none of us had really touched before, as well as something that's pretty hot in the tech space right now. Augmented reality with Unity fit these criteria pretty well.

# App summary
Our mobile app allows users to interact with a virtual pet through voice commands and a joy stick. The motivation behind the app was to provide sick kids with a way to interact with animals wherever and whenever.

# Technologies
Check out our GitHub organisation [here](https://github.com/woofie).

- [Unity3d](https://unity3d.com/): Menu, UI, the whole app
- [Vuforia](https://www.vuforia.com/): A Unity plugin that handles all the augmented reality
- [Google Speech API](https://cloud.google.com/speech/): For voice recognition
- [Corgi model](https://www.assetstore.unity3d.com/en/#!/content/70082): We shelled out some cash to buy this cute little dog

# Features

We had grand plans for our virtual pet app at the beginning of the hackathon, but we quickly scaled down our features as the hackathon went on. To be fair, we took the healthy approach to Unihack: most of us went home and got a good night's sleep!

Our final app ended up with:

- **Voice commands** that trigger corresponding animations: e.g. "Hey Doggie, play dead!" causes the dog to fall on its side
- **Beautiful menu** with bespoke music and art designed by Albert Chen.

![Menu](/images/woof/menu.jpg){: .center-image}

- **Ball-chasing game** where the user moves the ball around and the pet chases after it, complete with dynamic speed and animation transitions.

<iframe width="420" height="315" src="https://youtube.com//embed/_-rcKmwVfJ4" frameborder="0" allowfullscreen></iframe>

# Improvements
## Voice commands
It was fairly hard to do voice recognition reliably with a dodgy phone mic and a noisy room. Simple buttons would be a practical addition to improving the user experience so that the dog would actually sit down when you want it to!

## Respawn
Judges who weren't used to AR would easily lose the dog by moving the camera view too far from the target image texture. The dog would then be lost in space... forever. A simple respawn script would be a good addition so that lost dogs are always found after `x` seconds :)

## Image Texture
We needed to use a pre-selected texture as our image target so that Vuforia could identify the orientation and position of the surface on which the dog would be rendered. I played with a bunch of different textures, from $5 to $10 notes to a Data61 promotional flyer that we picked up from the Unihack Careers Fair.

In an ideal world, we'd want Vuforia to find the plane that the camera is pointing at without the help of a pre-defined image texture. This generality would allow our app to function anywhere: in a hospital room, on a dinner table, etc.

I've been looking into AR more (for a chess recognition side project), and it seems like Apple's AR Kit provides this general plane-detection functionality. Check out a demo [here](https://blog.markdaws.net/arkit-by-example-part-2-plane-detection-visualization-10f05876d53).

# What we would do differently
Things got intense at the end, as hackathons do.

- Have a designated tester on the team.
- Test and build earlier
- Integrate components earlier
- Stay focused on the MVP

# The Team
- Xiao Liang
- Albert Chen
- Thomas Wang
- Martin Valentino
- Dennis Wirya
- Hayden Warmington
- Me


text:
---
title: "Frequently asked questions"
permalink: /docs/faq/
excerpt: "Frequently asked questions"
last_modified_at: 2017-05-05T10:16:34-04:00
---

{% include toc icon="columns" %}

# FAQ

## General

### GDPR and IoT DevKit

Microsoft collects data to operate effectively and provide you the best experiences
Participation is voluntary and when you choose to participate, your device automatically sends data to Microsoft about how you use the IoT DevKit.

If you choose to participate, you can stop at any time as described [here](https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting).

> If you are looking to disable the data collection for the old installation package, please follow the steps in [this document]({{"/docs/legacy/disable-data-collection" | absolute_url}}) .

### Is the IoT DevKit Microsoft hardware

No. The hardware manufacturer is [MXChip](http://www.mxchip.com), an established player for IoT hardware. Through a partnership between MXChip and Microsoft, we rapidly iterated on the design and engineering of an Arduino compatible board with rich pre-installed sensors. Microsoft's goal is to boost productivity for developers creating and prototyping IoT applications with awesome Visual Studio Code tooling that leverages the power of Microsoft Azure.

### Why Arduino compatible

Based on industry data and customer research, we believe Arduino has a powerful and active community among professional makers. We would rather be part of this strong community than building a new community from scratch.

### Are you going to open-source the product

Yes, we will open-source the firmware, toolchains, and all samples. Also, the board itself will be [open-source hardware](https://www.arduino.cc/en/Main/FAQ#toc3). That means we will release all original hardware design files.

Our plan is to do that as soon as we reach a stage where the entire framework is stable.

### Where can I buy it

You can purchase the kit from our hardware partner's product page: [https://aka.ms/iot-devkit-purchase](https://aka.ms/iot-devkit-purchase)

## Installation

### Failed to install Arduino Package for IoT DevKit

Sometimes, whether in the Arduino IDE or VS Code, developers experience a failure to install the MXChip IoT DevKit package with the following error:

![Smartscreen]({{"/assets/images/faq/crc.png" | absolute_url }})

This may be a cache issue either on local Arduino cache and/or the remote CDN cache.
Please clean the local cache first:

1. Uninstall the IoT DevKit package, whether in Arduino IDE or VS Code.

2. Manually remove the cache folder:

   - For Windows, remove *%localappdata%/Arduino15/staging/packages*
   - For macOS, remove *~/Library/Arduino15/staging*

3. Then re-install the package.

If you are still experiencing this issue please contact [us](https://gitter.im/Microsoft/azure-iot-developer-kit){:target="_blank"} for support.

## Wi-Fi Configuration

### Cannot connect to a Wi-Fi hotspot

This may be because the Wi-Fi network needs additional certification (other than WPA/WPA2) or, if an open Wi-Fi, requires terms acceptance like on a captive portal such as Starbucks Wi-Fi.

To resolve, try to use Wi-Fi with normal WPA/WPA2 authentication.

### Cannot connect to 5 GHz Wi-Fi

Currently, IoT DevKit only can connect to 2.4 GHz Wi-Fi, 5 GHz is not supported due to hardware restrictions.

## Provision Azure Services

### Cannot log in Azure because the access token expired

As a result of a previous Azure login, your access token may have expired.

To fix this, delete the web browser history including login data and run the command in `Azure IoT Device Workbench: Provision Azure Services...` again.

### Page hangs when log in Azure

This issue can occur if you have multiple browsers sessions opened with different Azure subscriptions.

To resolve the issue, please clear the browser's cache and cookies.

For more details please check [I can't sign in to manage my Azure subscription](https://docs.microsoft.com/en-us/azure/billing/billing-cannot-login-subscription).

## Development

### Visual Studio Code cannot find Arduino IDE

Occasionally, when you launch Visual Studio Code, you are prompted with an error message that it cannot find the Arduino IDE or related board package.

To resolve this issue, please install the latest version of Arduino IDE [here](https://www.arduino.cc/en/Main/Software). Then Open **File > Preference > Settings** and add following lines to set the configurations for Arduino.

    * Windows

        ```JSON
        "arduino.path": "C:\\Program Files (x86)\\Arduino",
        "arduino.additionalUrls": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json"
        ```

    * macOS

        ```JSON
        "arduino.path": "/Applications",
        "arduino.additionalUrls": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json"
        ```

    * Ubuntu

        ```JSON
        "arduino.path": "/home/{username}/Downloads/arduino-1.8.8",
        "arduino.additionalUrls": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json"
        ```

### Additional warnings during compilation

In certain environments, lots of warnings message pops up in the VS Code OUTPUT windows when you invoke `Arduino Verify`, `Arduino Upload` or `task device-upload` to compile the project.

This is caused by the incorrect warning handling between Visual Studio Code Arduino extension and Arduino IDE. To solve this problem, the work around is to uninstall Arduino IDE from your local system and install the latest version of [Arduino IDE](https://www.arduino.cc/en/Main/Software).

### Get "Error Presented: #include errors detected" when opening a project

The error message is **Error Presented: #include errors detected. Please update your includePath.**

This is an issue coming from the previous version of IoT DevKit SDK. To solve this problem,

- Open the **c_cpp_properties.json** file, update the version with the current installation SDK version in the include path:

 ![vsc-intellisense-issue-4]({{"/assets/images/faq/vsc-intellisense-4.png" | absolute_url }})

### Arduino upload return Error: STLinkMethod: Invalid option for "upload_method" option for board "MXCHIP_AZ3166"

In Visual Studio Code, when trying to invoke "Arduion:Board Config" to configure MXChip board ,the Upload Method selection wasn’t visible:

![upload_method invisible]({{"/assets/images/faq/upload_method_invisible.png" | absolute_url }})

This is because Arduino configuration for current project is not set correctly.
To solve this problem, in `.vsode\arduino.json`, replace `"configuration": "upload_method=STLinkMethod"` to `"configuration": "upload_method=OpenOCDMethod"`.

### Unable to sync time with NTP time server

IoT DevKit would synchronize time with NTP time server before connecting to Azure IoT Hub. Sometimes, user would get the following error from serial port:

```node
Unable to get the NTP host pool.ntp.org
Unable to get the NTP host cn.pool.ntp.org
Unable to get the NTP host europe.pool.ntp.org
Unable to get the NTP host asia.pool.ntp.org
Unable to get the NTP host oceania.pool.ntp.org
```

This may caused by NTP traffic blocking at the firewall in the Gateway. To solve this problem, make sure that UDP port 123 is open on all firewalls between IoT DevKit and the remote time servers.

| Time Server | port |
| --- | --- |
| pool.ntp.org | 123 |
| cn.pool.ntp.org | 123 |
| europe.pool.ntp.org | 123 |
| asia.pool.ntp.org | 123 |
| oceania.pool.ntp.org | 123 |

### How to generate a sample binary file and upload it to the MXCHIP

Frist you should install the latest version of Arduino IDE [here](https://www.arduino.cc/en/Main/Software) and open sample.ino like [this](https://github.com/Azure-Samples/mxchip-iot-devkit-get-started/blob/master/Device/GetStarted.ino) in Arduino IDE.

Go to **Tools > Board** and select the right board (for example, MXCHIP AZ3166).

To generate a sample.bin file from your sketch, go to **Sketch > Export compiled Binary**.

A new Arduino binary file in the folder should be created.

Download [boot.bin](https://github.com/microsoft/devkit-sdk/blob/master/AZ3166/src/bootloader/boot.bin) and [az3166_patch_binary.py](https://github.com/microsoft/azure-iot-developer-kit/tree/master/docs/_docs/bash/az3166_patch_binary.py) in the same folder.

Use the following command to generate the binary we need
```bash
	az3166_patch_binary.py your_arduino_binary_file_name.bin mxchip_getstarted.bin
```

Connect the MXChip IoT DevKit with your machine via USB. You can find a removable USB Mass Storage disk named AZ3166. Copy the mxchip_getstarted.bin into this disk. The MXChip IoT DevKit will reboot after finished the copy and run the new application.

{% include social-share.html %}

[Back-to-top](#faq)

repository: jimbobbennett/azure-iot-developer-kit

repo_name: jimbobbennett/azure-iot-developer-kit


text:
gomock-extra-matcher

---

## Menu

- [Menu](#menu)
- [Why ?](#why-)
- [How to use ?](#how-to-use-)
- [Matchers](#matchers)
  - [IntRangeMatcher](#intrangematcher)
    - [Explanation](#explanation)
    - [Example](#example)
  - [StringRegexpMatcher](#stringregexpmatcher)
    - [Explanation](#explanation-1)
    - [Example](#example-1)
  - [MapMatcher](#mapmatcher)
    - [Explanation](#explanation-2)
    - [Example](#example-2)
  - [StructMatcher](#structmatcher)
    - [Explanation](#explanation-3)
    - [Example](#example-3)
- [Thanks](#thanks)
- [Author](#author)
- [License](#license)

## Why ?

I've created this library because I cannot find such a library like this one and I don't want to create specific matcher for each structure, each map, ... in all tests that I have and can write.

Moreover, creating specific matcher need maintenance code and this is time consumption.

I'm sure that I'm not the only one that what to avoid all of this :) .

## How to use ?

Import the library in your tests files:

```go
import "github.com/oxyno-zeta/gomock-extra-matcher"
```

Use it in your gomock instance:

```go
mock.EXPECT().DoSomething(extra.StringRegexpMatcher(`^[a-z]+\[[0-9]+\]$`))
```

## Matchers

### IntRangeMatcher

#### Explanation

This matcher will allow to test that an int is inside a range. Here it is considered that input can be equal to the lower bound and the same for the upper bound.

#### Example

Here is an example of usage:

```go
mock.EXPECT().DoSomething(extra.IntRangeMatcher(lowerBound, upperBound))
```

### StringRegexpMatcher

#### Explanation

This matcher will allow to test that a string is validating a Regexp.

#### Example

Here is an example of usage:

```go
mock.EXPECT().DoSomething(extra.StringRegexpMatcher(`^[a-z]+\[[0-9]+\]$`))
```

### MapMatcher

#### Explanation

This matcher will allow to test map key and map value.

To this one, it is possible to give a gomock matcher to a key and also to the value.

The `Key` function is chainable. It is also possible to more than one test per key.

#### Example

Here are some example of usage:

```go
// Here we consider a map[string]string as input
mock.EXPECT().DoSomething(extra.MapMatcher().Key("key1", "value1").Key(gomock.Any(), "value1").Key("key1", gomock.Not("value2")))
```

### StructMatcher

#### Explanation

This matcher will allow to test public fields of a structure (Only public ones. Reflect can't manage private fields...).

To this matcher, it is possible to give either a gomock matcher or either a real value for validation.

The `Field` function is chainable. It is also possible to more than one test per field.

#### Example

```go
// Here we consider a struct as this one
/*
type Fake struct {
    Name string
    Data map[string]string
}
*/
mock.EXPECT().DoSomething(extra.MapMatcher().Field("Name", "value1").Field("Data", gomock.Eq(map[string]string{"fake":"value"})))
```

## Thanks

- My wife BH to support me doing this

## Author

- Oxyno-zeta (Havrileck Alexandre)

## License

Apache 2.0 (See in LICENSE)

repository: AlexDouze/gomock-extra-matcher

repo_name: AlexDouze/gomock-extra-matcher


text:
---
author: karim
comments: true
date: 2012-08-30 01:05:09+00:00
layout: post
slug: psod-failed-at-vmkdriverssrc_9vmklinux_9vmwarelinux_scsi-c2221-not-reached
title: PSOD Failed at vmkdrivers/src_9/vmklinux_9/vmware/linux_scsi.c:2221 — NOT REACHED
wordpress_id: 3078
categories:
- VMware
following_users:
- jarret
- kelatov
tags:
- esxcfg-info
- IBM x3690 X5
- LSI2008
- mpt2sas
- PSOD
---

I recently ran into the following PSOD:

[![](http://virtuallyhyper.com/wp-content/uploads/2012/08/psod-lsi-.png)](http://virtuallyhyper.com/wp-content/uploads/2012/08/psod-lsi-.png)

Some other people in the VMware communities have seen the same PSOD. Here is a [link](http://communities.vmware.com/message/2102510) to the communities page. We are crashing at:

```

Failed at vmkdrivers/src_9/vmklinux_9/vmware/linux_scsi.c:2221 -- NOT REACHED

```

It looks like the local disk driver is having an issue. Checking out the host's local controllers, I saw the following:

```

~ # lspci | grep vmhba
000:000:31.2 Mass storage controller: Intel Corporation ICH10 4 port SATA IDE Controller [vmhba0]
000:004:00.0 Mass storage controller: LSI Logic / Symbios Logic LSI2008 [vmhba1]
000:014:00.0 Mass storage controller: LSI Logic / Symbios Logic MegaRAID SAS SKINNY Controller [vmhba2]
000:019:00.0 Mass storage controller: LSI Logic / Symbios Logic LSI2008 [vmhba3]

```

Checking for the device drivers and the Vendor IDs, I see the following:

```

~ # esxcfg-info -a | sed -n '/SCSI\ Interface/,/BAR\ Info/p' | grep 'Name.*vmhba1' -A 16 | egrep 'Name|Driver|Vendor\ Id|Device\ Id|Sub-Vendor\ Id|Sub-Device\ Id'
               |----Name............................................vmhba1
               |----Driver..........................................mpt2sas
                  |----Vendor Id....................................0x1000
                  |----Device Id....................................0x0072
                  |----Sub-Vendor Id................................0x1014
                  |----Sub-Device Id................................0x03ca

```

vmhba3 was the same as above, and here is what I saw for vmhba2:

```

~ # esxcfg-info -a | sed -n '/SCSI\ Interface/,/BAR\ Info/p' | grep 'Name.*vmhba2' -A 16 | egrep 'Name|Driver|Vendor\ Id|Device\ Id|Sub-Vendor\ Id|Sub-Device\ Id'
               |----Name............................................vmhba2
               |----Driver..........................................megaraid_sas
                  |----Vendor Id....................................0x1000
                  |----Device Id....................................0x0073
                  |----Sub-Vendor Id................................0x1014
                  |----Sub-Device Id................................0x03b1

```

So we are using the mpt2sas and megaraid_sas drivers for our local drives. Here is HCL [link](http://www.vmware.com/resources/compatibility/detail.php?deviceCategory=io&productid=13971&deviceCategory=io&VID=1000&DID=0072&SVID=0000&SSID=0000&page=1&display_interval=10&sortColumn=Partner&sortOrder=Asc) for vmhba1 and here is the [link](http://partnerweb.vmware.com/comp_guide2/detail.php?deviceCategory=io&productid=12373&deviceCategory=io&VID=1000&DID=0073&SVID=1014&SSID=03b1&page=1&display_interval=10&sortColumn=Partner&sortOrder=Asc) for vmhba2.

For vmhba1:

[![](http://virtuallyhyper.com/wp-content/uploads/2012/08/hcl-vmhba1.png)](http://virtuallyhyper.com/wp-content/uploads/2012/08/hcl-vmhba1.png)

and for vmhba2:

[![](http://virtuallyhyper.com/wp-content/uploads/2012/08/hcl-vmhba2.png)](http://virtuallyhyper.com/wp-content/uploads/2012/08/hcl-vmhba2.png)

Here is our hardware and VMware versions:

```

~ # vmware -l
VMware ESXi 5.0.0 GA

~ # $ vsish -e cat /hardware/bios/dmiInfo | head -3
System Information (type1) {
   Product Name:System x3690 X5 -[7147AC1]-
   Vendor Name:IBM

~ # $ vsish -e cat /hardware/bios/biosInfo
BIOS Information (type 0) {
   BIOS Version:-[MLE170CUS-1.70]-
   BIOS Release Date:09/23/2011
}

```

So we are running ESXi 5.0GA on a IBM x3690 X5 host. Very close to the same guy from [this](http://communities.vmware.com/message/2101833) VMware communities page. Now from the HCL we can see that for vmhba2 the recommended version of the driver is:

> megaraid_sas version 4.32-1vmw

Now checking the version on the host, I saw the following:

```

~ # esxcli software vib list | grep megaraid-sas
scsi-megaraid-sas     4.32-1vmw.5<IP_ADDRESS>9512           VMware  VMwareCertified   2012-02-28

```

The recommended version for vmhba1 and vmhba3 is :

> mpt2sas version <IP_ADDRESS>-5vmw

Checking the current version, I saw the following:

```

~ # esxcli software vib list | grep mpt2sas
scsi-mpt2sas          <IP_ADDRESS>-6vmw.5<IP_ADDRESS>9512    VMware  VMwareCertified   2012-02-28

```

So we were at the latest version for both. Searching for the available mpt2sas drivers from the VMware downloads page, I saw the following:

[![](http://virtuallyhyper.com/wp-content/uploads/2012/08/mp2sas-drivers.png)](http://virtuallyhyper.com/wp-content/uploads/2012/08/mp2sas-drivers.png)

So these version of the drivers are available:

> <IP_ADDRESS>.vmw
<IP_ADDRESS>.1vmw
<IP_ADDRESS>.2vmw
<IP_ADDRESS>.1vmw
<IP_ADDRESS>.1vmw
<IP_ADDRESS>.1vmw
<IP_ADDRESS>.1vmw

Even though version "<IP_ADDRESS>.1vmw" wasn't on HCL for this device, we went ahead and installed it on our hardware and the PSODs haven't happened for over two weeks now. Here is the [link](https://my.vmware.com/web/vmware/details?downloadGroup=DT-ESXI50-LSI-mpt2sas-131002001vmw&productId=24) to that driver. Hopefully this helps someone out.


text:
# UniPa Trajectories Dataset
Synthetic dataset of trajectories set in the University of Palermo.

![alt text](https://github.com/giammandro/UniPa-Trajectories-Dataset/blob/master/unipa.png?raw=true)

The dataset was created according to the guidelines described in [1].
Some relevant statistics are:

* Users: 150
* Users Behavioral Profiles: 10
* Trajectories Records: 24824
* Unique Trajectories: 9653
* Average Trajectories per User: 165
* Points of Interest (PoIs): 54
* PoIs Semantic classes: 8
* User-Trajectory Matrix Sparsity: 0.982

The User-Trajectory heatmap is now shown:

![alt text](https://github.com/giammandro/UniPa-Trajectories-Dataset/blob/master/unipa_heatmap.png?raw=true)

the presence of multiple aligned dots suggests the viability of a collaborative approach for trajectory recommendation against this dataset.

# References
[1] A. D. Paola, A. Giammanco, G. L. Re and M. Morana, "Human Mobility Simulator for Smart Applications," 2019 IEEE/ACM 23rd International Symposium on Distributed Simulation and Real Time Applications (DS-RT), Cosenza, Italy, 2019, pp. 1-8, doi: 10.1109/DS-RT47707.2019.8958668.

# License
Creative Commons Zero v1.0 Universal
https://choosealicense.com/licenses/cc0-1.0/

repository: giammandro/UniPa-Trajectories-Dataset

repo_name: giammandro/UniPa-Trajectories-Dataset


text:
## Prerequisites

1. v1beta2 example manifest requires [aws-app-mesh-controller-for-k8s](https://github.com/aws/aws-app-mesh-controller-for-k8s) version [>=v1.0.0](https://github.com/aws/aws-app-mesh-controller-for-k8s/releases/tag/v1.0.0). Run the following to check the version of controller you are running.
```
$ kubectl get deployment -n appmesh-system appmesh-controller -o json | jq -r ".spec.template.spec.containers[].image" | cut -f2 -d ':'|tail -n1
```

You can use v1beta1 example manifest with [aws-app-mesh-controller-for-k8s](https://github.com/aws/aws-app-mesh-controller-for-k8s) version [=v0.3.0](https://github.com/aws/aws-app-mesh-controller-for-k8s/blob/legacy-controller/CHANGELOG.md)

2. Install Docker. It is needed to build the demo application images.

## Setup environment
- Setup following environment variables
  - **Your** account id:
    ```
    export AWS_ACCOUNT_ID=<your_account_id>
    ```
  - **Region** e.g. us-east-2
    ```
    export AWS_DEFAULT_REGION=us-east-2
    ```

- Setup EKS cluster with Fargate support.
  - You can use [clusterconfig.yaml](./v1beta2/clusterconfig.yaml) with [eksctl](https://eksctl.io). Update `metadata.region` to AWS_DEFAULT_REGION.
    ```
    eksctl create cluster -f v1beta2/clusterconfig.yaml
    ```

- (Optional) Override the default Helm chart App Mesh Envoy Image version.
  - If you'd like to use a different Envoy image version than the [default](https://github.com/aws/eks-charts/tree/master/stable/appmesh-controller#configuration), run `helm upgrade` to override the `sidecar.image.repository` and `sidecar.image.tag` fields.

## Deploy
1. Clone this repository and navigate to the walkthrough/howto-k8s-fargate folder, all commands will be run from this location
2. Deploy
    ```.
    ./deploy.sh
    ```

## Verify

1. Confirm that envoy containers are receiving configuration
   ```
   $ greenpod=$(kubectl get pod -n howto-k8s-fargate -o name | grep green | cut -f2 -d'/')

   $ kubectl exec -it -n howto-k8s-fargate $greenpod -c envoy curl http://localhost:9901/clusters | grep 'added_via_api::true'

    cds_ingress_howto-k8s-fargate_green-howto-k8s-fargate_http_8080::added_via_api::true
    cds_egress_howto-k8s-fargate_amazonaws::added_via_api::true

   $ kubectl exec -it -n howto-k8s-fargate $greenpod -c envoy curl http://localhost:9901/listeners

    lds_ingress_<IP_ADDRESS>_15000::<IP_ADDRESS>:15000
    lds_egress_<IP_ADDRESS>_15001::<IP_ADDRESS>:15001
   ```
2. Port-forward front application deployment
   ```
   $ kubectl -n howto-k8s-fargate port-forward deployment/front 8080:8080
   ```
3. Curl front-app
   ```
   $ while true; do  curl -s http://localhost:8080/color; sleep 0.1; echo ; done

    {"color":"green", "stats": {"blue":0.54,"green":0.46}}
    {"color":"green", "stats": {"blue":0.54,"green":0.46}}
   ```
4. Update the routes to your liking to see the responses changing.

repository: aws/aws-app-mesh-examples

gha_language: Shell

repo_name: aws/aws-app-mesh-examples


text:
# DataX TDengineWriter

[简体中文](./tdenginewriter-CN.md) | English

## 1 Quick Introduction

TDengineWriter Plugin writes data to [TDengine](https://www.taosdata.com/en/). It can be used to offline synchronize data from other databases to TDengine.

## 2 Implementation

TDengineWriter get records from DataX Framework that are generated from reader side. It has two whiting strategies:

1. For data from OpenTSDBReader which is in json format, to leverage the new feature of TDengine Server that support writing json data directly called [schemaless writing](https://www.taosdata.com/cn/documentation/insert#schemaless), we use JNI to call functions in `taos.lib` or `taos.dll`.(Since the feature was not included in taos-jdbcdrive until version 2.0.36).
2. For other data sources, we use [taos-jdbcdriver](https://www.taosdata.com/cn/documentation/connector/java) to write data. If the target table is not exists beforehand, then it will be created automatically according to your configuration.

## 3 Features Introduction
### 3.1 From OpenTSDB to TDengine
#### 3.1.1 Sample Setting

```json
{
  "job": {
    "content": [
      {
        "reader": {
          "name": "opentsdbreader",
          "parameter": {
            "endpoint": "http://<IP_ADDRESS>:4242",
            "column": [
              "weather_temperature"
            ],
            "beginDateTime": "2021-01-01 00:00:00",
            "endDateTime": "2021-01-01 01:00:00"
          }
        },
        "writer": {
          "name": "tdenginewriter",
          "parameter": {
            "host": "<IP_ADDRESS>",
            "port": 6030,
            "dbName": "test",
            "username": "root",
            "password": "taosdata"
          }
        }
      }
    ],
    "setting": {
      "speed": {
        "channel": 1
      }
    }
  }
}
```

#### 3.1.2 Configuration

| Parameter | Description                    | Required | Default  |
| --------- | ------------------------------ | -------- | -------- |
| host      | host of TDengine               | Yes      |          |
| port      | port of TDengine               | Yes      |          |
| username      | use name of TDengine           | No       | root     |
| password  | password of TDengine           | No       | taosdata |
| dbName    | name of target database        | No       |          |
| batchSize | batch size of insert operation | No       | 1        |

#### 3.1.3 Type Convert

| OpenTSDB Type    | DataX Type | TDengine Type |
| ---------------- | ---------- | ------------- |
| timestamp        | Date       | timestamp     |
| Integer（value） | Double     | double        |
| Float（value）   | Double     | double        |
| String（value）  | String     | binary        |
| Integer（tag）   | String     | binary        |
| Float（tag）     | String     | binary        |
| String（tag）    | String     | binary        |

### 3.2 From MongoDB to TDengine

#### 3.2.1 Sample Setting
```json
{
    "job": {
        "setting": {
            "speed": {
                "channel": 2
            }
        },
        "content": [
            {
                "reader": {
                    "name": "mongodbreader",
                    "parameter": {
                        "address": [
                            "<IP_ADDRESS>:27017"
                        ],
                        "userName": "user",
                        "mechanism": "SCRAM-SHA-1",
                        "userPassword": "password",
                        "authDb": "admin",
                        "dbName": "test",
                        "collectionName": "stock",
                        "column": [
                            {
                              "name": "stockID",
                              "type": "string"
                            },
                            {
                                "name": "tradeTime",
                                "type": "date"
                            },
                            {
                                "name": "lastPrice",
                                "type": "double"
                            },
                            {
                              "name": "askPrice1",
                              "type": "double"
                            },
                            {
                              "name": "bidPrice1",
                              "type": "double"
                            },
                            {
                                "name": "volume",
                                "type": "int"
                            }
                        ]
                    }
                },
                "writer": {
                    "name": "tdenginewriter",
                    "parameter": {
                        "host": "localhost",
                        "port": 6030,
                        "dbName": "test",
                        "username": "root",
                        "password": "taosdata",
                        "stable": "stock",
                        "tagColumn": {
                          "industry": "energy",
                          "stockID": 0
                        },
                        "fieldColumn": {
                          "lastPrice": 2,
                          "askPrice1": 3,
                          "bidPrice1": 4,
                          "volume": 5
                        },
                        "timestampColumn": {
                          "tradeTime": 1
                        }
                    }
                }
            }
        ]
    }
}
```

**Note：the writer part of this setting can also apply to other data source except for OpenTSDB **

#### 3.2.2 Configuration

| Parameter       | Description                                                     | Required                 | Default  | Remark              |
| --------------- | --------------------------------------------------------------- | ------------------------ | -------- | ------------------- |
| host            | host ofTDengine                                                 | Yes                      |          |
| port            | port of TDengine                                                | Yes                      |          |
| username            | username of TDengine                                           | No                       | root     |
| password        | password of TDengine                                            | No                       | taosdata |
| dbName          | name of target database                                         | Yes                      |          |
| batchSize       | batch size of insert operation                                  | No                       | 1000     |
| stable          | name of target super table                                      | Yes(except for OpenTSDB) |          |
| tagColumn       | name and position of tag columns in the record from reader, format:{tagName1: tagInd1, tagName2: tagInd2}      | No                       |          | index starts with 0 |
| fieldColumn     | name and position of data columns in the record from reader, format: {fdName1: fdInd1, fdName2: fdInd2}     | No                       |          |                     |
| timestampColumn | name and position of timestamp column in the record from reader | No                       |          |                     |

**Note**: You see that the value of tagColumn "industry" is a fixed string, this ia a good feature of this plugin. Think about this scenario: you have many tables with the structure and one table corresponds to one device. You want to use the device number as a tag in the target super table, then this feature is designed for you.

#### 3.2.3 Auto table creating
##### <IP_ADDRESS> Rules

If all of `tagColumn`, `fieldColumn` and `timestampColumn` are offered in writer configuration, then target super table will be created automatically.
The type of tag columns will always be `NCHAR(64)`. The sample setting above will produce following sql:

```sql
CREATE STABLE IF NOT EXISTS market_snapshot (
  tadetime TIMESTAMP,
  lastprice DOUBLE,
  askprice1 DOUBLE,
  bidprice1 DOUBLE,
  volume INT
)
TAGS(
  industry NCHAR(64),
  stockID NCHAR(64)
);
```

##### <IP_ADDRESS> Sub-table Creating Rules

The structure of sub-tables are the same with structure of super table. The names of sub-tables are generated by rules below:
1. combine value of tags like this:`tag_value1!tag_value2!tag_value3`.
2. compute md5 hash hex of  above string, named `md5val`
3. use "t_md5val" as sub-table name, in which "t" is fixed prefix.

#### 3.2.4 Use Pre-created Table

If you have created super table firstly, then all of tagColumn, fieldColumn and timestampColumn can be omitted. The writer plugin will get table schema by executing `describe stableName`.
The order of columns of records received by this plugin must be the same as the order of columns returned by `describe stableName`. For example, if you have super table as below:
```
             Field              |         Type         |   Length    |   Note   |
=================================================================================
 ts                             | TIMESTAMP            |           8 |          |
 current                        | DOUBLE               |           8 |          |
 location                      | BINARY                |           10 | TAG      |
```
Then the first columns received by this writer plugin must represent timestamp, the second column must represent current with type double, the third column must represent location with internal type string.

#### 3.2.5 Remarks

1. Config keys --tagColumn, fieldColumn and timestampColumn, must be presented or omitted at the same time.
2. If above three config keys exist and the target table also exists, then the order of columns defined by the config file and the existed table must be the same.

#### 3.2.6 Type Convert

|DataX Type | TDengine Type |
|-------------- | ----------------- |
|Long           | BIGINT            |
|Double         | DOUBLE            |
|String         | NCHAR(64)         |
|Date           | TIMESTAMP         |
|Boolean        | BOOL              |
|Bytes          | BINARY(64)        |

### 3.3 From Relational Database to TDengine

Take MySQl as example.

#### 3.3.1 Table Structure in MySQL
```sql
CREATE TABLE IF NOT EXISTS weather(
    station varchar(100),
    latitude DOUBLE,
    longtitude DOUBLE,
    `date` DATE,
    TMAX int,
    TMIN int
)
```

#### 3.3.2 Sample Setting

```json
{
  "job": {
    "content": [
      {
        "reader": {
          "name": "mysqlreader",
          "parameter": {
            "username": "root",
            "password": "passw0rd",
            "column": [
              "*"
            ],
            "splitPk": "station",
            "connection": [
              {
                "table": [
                  "weather"
                ],
                "jdbcUrl": [
                  "jdbc:mysql://<IP_ADDRESS>:3306/test?useSSL=false&useUnicode=true&characterEncoding=utf8"
                ]
              }
            ]
          }
        },
        "writer": {
          "name": "tdenginewriter",
          "parameter": {
            "host": "<IP_ADDRESS>",
            "port": 6030,
            "dbName": "test",
            "username": "root",
            "password": "taosdata",
            "batchSize": 1000,
            "stable": "weather",
            "tagColumn": {
              "station": 0
            },
            "fieldColumn": {
              "latitude": 1,
              "longtitude": 2,
              "tmax": 4,
              "tmin": 5
            },
            "timestampColumn":{
              "date": 3
            }
          }
        }
      }
    ],
    "setting": {
      "speed": {
        "channel": 1
      }
    }
  }
}
```

## 4 Performance Test

## 5 Restriction

1. NCHAR type has fixed length 64 when auto creating stable.
2. Rows have null tag values will be dropped.

## FAQ

### How to filter on source table？

It depends on reader plugin. For different reader plugins, the way may be different.

### How to import multiple source tables at once？

It depends on reader plugin. If the reader plugin supports reading multiple tables at once, then there is no problem.

### How many sub-tables will be produced?

The number of sub-tables is determined by tagColumns, equals to the number of different combinations of tag values.

### Do columns in source table and columns in target table must be in the same order?

No. TDengine require the first column has timestamp type，which is followed by data columns, followed by tag columns. The writer plugin will create super table in this column order, regardless of origin column orders.

### How dose the plugin infer the data type of incoming data?

By the first batch of records it received.

###  Why can't I insert data of 10 years ago? Do this will get error: `TDengine ERROR (2350): failed to execute batch bind`.

Because the database you created only keep 10 years data by default, you can create table like this: `CREATE DATABASE power KEEP 36500;`, in order to enlarge the time period to 100 years.

### What should I do if some dependencies of a plugin can't be found?

I this plugin is not necessary for you, just remove it from pom.xml under project's root directory.

repository: duhanmin/DataX

gha_license_id: NOASSERTION

repo_name: duhanmin/DataX


text:
---
description: The pre-user-registration extensibility point for use with Hooks
beta: true
topics:
    - hooks
    - extensibility-points
contentType:
  - how-to
useCase: extensibility-hooks
v2: true
---
# Implement Custom Actions Using Pre-User Registration Extensibility Points

For [Database Connections](/connections/database), the Pre-User Registration extensibility point allows you to add custom data points to a newly-created user's profile.

This allows you to implement scenarios such as setting conditional information (in the form of [metadata](/users/concepts/overview-user-metadata) on users that do not exist yet.

Implement a [Hook](/hooks/concepts/overview-hooks) using this extensibility point with either the [Dashboard](/hooks/guides/create-hooks-using-dashboard) or the [Command Line Interface](/hooks/guides/create-hooks-using-cli).

## Starter code and parameters

After you've created a new Hook that uses the Pre-User Registration extensibility point, open up the Hook and edit it using the Webtask Editor embedded in the Dashboard.

The parameters listed in the comment at the top of the code indicate the Auth0 objects (and the parameters within the objects) that can be passed into and used by the Hook's function.

```js
/**
@param {object} user - The user being created
@param {string} user.tenant - Auth0 tenant name
@param {string} user.username - user name
@param {string} user.password - user's password
@param {string} user.email - email
@param {boolean} user.emailVerified - is email verified?
@param {string} user.phoneNumber - phone number
@param {boolean} user.phoneNumberVerified - is phone number verified?
@param {object} context - Auth0 connection and other context info
@param {string} context.requestLanguage - language of the application agent
@param {object} context.connection - information about the Auth0 connection
@param {object} context.connection.id - connection id
@param {object} context.connection.name - connection name
@param {object} context.connection.tenant - connection tenant
@param {object} context.webtask - webtask context
@param {function} cb - function (error, response)
*/
module.exports = function (user, context, cb) {
  var response = {};

  // Add user or app metadata to the newly created user
  // response.user = {
  //   user_metadata: { foo: 'bar' },
  //   app_metadata: { vip: true, score: 7 }
  // };

  response.user = user;

  cb(null, response);
};
```

The callback function `cb` at the end of the sample code is used to signal completion and must not be omitted.

### Response

The default response object every time the Hook runs is similar to the following:

```json
{
  "user": {
    "tenant": "my-tenant",
    "username": "user1",
    "password": "xxxxxxx",
    "email"<EMAIL_ADDRESS>    "emailVerified": false,
    "phoneNumber": "1-000-000-0000",
    "phoneNumberVerified": false,
    "user_metadata": {
      "hobby": "surfing"
    },
    "app_metadata": {
      "plan": "full"
    }
  }
}
```

If you specify `app_metadata` and `user_metadata` in the response object, Auth0 adds this information to the new user.

::: note
Metadata property names must not start with the `$` character or contain the `.` character.
:::

## Testing your Hook

::: note
Executing the code using the Runner requires a save, which means that your original code will be overwritten.
:::

Once you've modified the sample code with the specific scopes of additional claims you'd like added to your Access Tokens, test your Hook using the Runner. The runner simulates a call to the Hook with the appropriate user information body/payload. The following is the sample body that populates the Runner by default (these are the same objects/parameters detailed in the comment at the top of the sample Hook code):

```json
{
  "user": {
    "tenant": "my-tenant",
    "username": "user1",
    "password": "xxxxxxx",
    "email"<EMAIL_ADDRESS>    "emailVerified": false,
    "phoneNumber": "1-000-000-0000",
    "phoneNumberVerified": false,
    "user_metadata": {
      "hobby": "surfing"
    },
    "app_metadata": {
      "plan": "full"
    }
  },
  "context": {
    "requestLanguage": "en-us",
    "connection": {
      "id": "con_xxxxxxxxxxxxxxxx",
      "name": "Username-Password-Authentication",
      "tenant": "my-tenant"
    }
  }
}
```

## Example: Add metadata to new users

```js
module.exports = function (user, context, cb) {
  var response = {};

  response.user = {
   user_metadata: { foo: 'bar' },
   app_metadata: { vip: true, score: 7 }
  };

  cb(null, response);
};
```

Using the [test runner](https://webtask.io/docs/editor/runner), we see that the response, reflecting the updated metadata, is as follows:

```json
{
  "user": {
    "user_metadata": {
      "foo": "bar"
    },
    "app_metadata": {
      "vip": true,
      "score": 7
    }
  }
}
```

::: note
The Pre-Registration Hook does not currently pass error messages to any Auth0 APIs.
:::

repository: AdrianaMusic/docs

gha_language: JavaScript

repo_name: AdrianaMusic/docs


text:
### Images

![Various widgets displaying temperatures from around the Word](https://raw.githubusercontent.com/ivan-saorin/adf-widget-wysiwyg/master/registry/adf-widget-weather-01.png "Various widgets displaying temperatures from around the Word")
###### Various widgets displaying temperatures from around the Word

![Configuration dialog of the weather widget](https://raw.githubusercontent.com/ivan-saorin/adf-widget-wysiwyg/master/registry/adf-widget-weather-02.png "Configuration dialog of the weather widget")
###### Configuration dialog of the weather widget


text:
## Exit successfully if there are no changes

This action now exits successfully if there are no changes to push. This can
happen when the action is run multiple times, for example when a failed workflow
is re-run. Previously, the action would exit with an error status on second run.

repository: ponylang/readme-version-updater-action

gha_language: Python

repo_name: ponylang/readme-version-updater-action


text:
# Github DID method specification

The `github` method is meant to make working with DIDs very simple at the cost of trusting Github.com for assisting in resolving DID Documents.

Many developers are familar with Github, and its 2 supported public key cryptosystems, GPG and SSH.

Linked Data Signatures are difficult to work with when operating a server or running a local node of some distributed system / blockchain is a requirement.

The objective of GitHub DID is to encourage contribution to the [DID Spec](https://w3c-ccg.github.io/did-spec/) and [Linked Data Signatures](https://w3c-dvcg.github.io/ld-signatures), and allow rapid development of extensions to these without requiring the use of slow, or complicated more trustless infrastructure, such as blockchains or other distributed systems.

## Method syntax

The namestring identifying this did method is `github`

A DID that uses this method MUST begin with the following prefix: `did:github`. Per the DID specification, this string MUST be in lowercase.

The remainder of a DID after the prefix, called the did unique suffix, MUST be a valid Github username

Example: `did:github:gjgd`

## CRUD Operations

### Create

In order to create a Github DID, a Github user MUST:
- Create a repo named `ghdid`
- Create a valid did document named `index.jsonld`
- Push the document on the `master` branch

### Read

In order to resolve a `did:github:USERNAME`, you MUST read the `index.jsonld` document on the `master` branch of the `ghdid` repository of the user USERNAME

As a shortcut, a user MAY resolve the following URL:
```
https://raw.githubusercontent.com/USERNAME/ghdid/master/index.jsonld
```

### Update

In order to update a did document, a Github MUST update the `index.jsonld` file on the `master` branch of their `ghdid` repo

### Delete

In order to delete a did document, a Github MUST delete the `index.jsonld` file on the `master` branch of their `ghdid` repo

## Security and privacy considerations

1. This method relies on trusting Github's for resolving DID Documents
2. This method relies on trusting Github's for authenticating updates to a did document, but a user MAY chose to use Linked Data Signatures via the `proof` field of their did document for a strong verifiable cryptographic proof

repository: gjgd/github-did

repo_name: gjgd/github-did


text:
# unit-testing-typescript-alsatian

This is an example of how to use [Alsatian](http://github.com/alsatian-test/alsatian) to test your TypeScript code, written for my blog post ["Unit testing TypeScript with Alsatian"](http://www.jamesmonger.com/post/unit-testing-typescript-alsatian.htm).


text:
# React Testing and Deployment

React in development mode uses a node service to create a live website that refreshes as you write code. This is NOT what actually gets deployed when you want your React website to go live. React, remember is an index.html file that uses Javascript to render components in the browser. The node server is only there to aid in your development.

Today, you will be deploying your React Application to a remote hosting environment.

... but not until you've written some tests to make sure it's going to work as you expect!

## Learning Objectives

### Students will be able to

#### Describe and Define

- Testing of a React App
  - Snap-Shots
  - "Shallow" mounting
  - "Full" mounting
- Deployment of a React App
  - Need to run a build
  - What is the React 'build' artifact
  - GitHub Pages
  - AWS S3
  - Netlify
  - Amplify
  - GoDaddy

#### Execute

- Write and Execute Snapshot tests for a React Application
- Write and Execute Enzyme (live) tests for a React Application
- Deploy a React application to AWS S3 manually
- Deploy a React application to GitHub Pages using a GitHub Action
- Deploy a React application to AWS Amplify directly from GitHub
- Deploy a React application to Netlify directly from GitHub

## Today's Outline

<!-- To Be Completed By Instructor -->

gha_language: C#


text:
---
'astro': minor
---

Adds support for the client:media hydrator

The new `client:media` hydrator allows you to define a component that should only be loaded when a media query matches. An example usage:

```jsx
---
import Sidebar from '../components/Sidebar.jsx';
---

<Sidebar client:media="(max-width: 700px)" />
```

This allows you to define components which, for example, only run on mobile devices. A common example is a slide-in sidebar that is needed to add navigation to a mobile app, but is never displayed in desktop view.

Since Astro components can have expressions, you can move common media queries to a module for sharing. For example here are defining:

**media.js**

```js
export const MOBILE = '(max-width: 700px)';
```

And then you can reference this in your page:

**index.astro**

```jsx
import Sidebar from '../components/Sidebar.jsx';
import { MOBILE } from '../media.js';
---

<Sidebar client:media={MOBILE} />
```

repository: naeluh/astro

repo_name: naeluh/astro


text:
# terraform-libvirt-network

A terraform module for creating libvirt neworks

## Usage

### Using module defaults

The following code example will create a libvirt
network with the name of test, in a flat network no
NAT or bridging and with a CIDR of <IP_ADDRESS>/24

```HCL
locals {
  name      = "test"
  mode      = "none"
  addresses = ["<IP_ADDRESS>/24"]
}

module "libvirt_net" {
  source    = "../../"
  name      = local.name
  mode      = local.mode
  addresses = local.addresses
}
```

### Overrding most defaults

```HCL
locals {
  forwarders = [
    {
      "address" = "<IP_ADDRESS>",
      "domain"  = ".com"
    },
    {
      "address" = "<IP_ADDRESS>",
      "domain"  = ".corp"
    }
  ]

  hosts = [
    {
      "hostname" = "ad",
      "ip"       = "<IP_ADDRESS>"
    },
    {
      "hostname" = "mon",
      "ip"       = "<IP_ADDRESS>"
    }
  ]

  routes = [
    {
      "cidr"    = "<IP_ADDRESS>/24",
      "gateway" = "<IP_ADDRESS>"
    },
    {
      "cidr"    = "<IP_ADDRESS>/24",
      "gateway" = "<IP_ADDRESS>"
    }
  ]

  name           = "newnet"
  mode           = "nat"
  addresses      = ["<IP_ADDRESS>/24"]
  domain         = "scratch"
  dhcp           = true
  mtu            = 1500
  autostart      = true
  dns_enabled    = true
  dns_local_only = false
}

module "libvirt_net_override" {
  source         = "../../"
  name           = local.name
  mode           = local.mode
  addresses      = local.addresses
  domain         = local.domain
  dhcp           = local.dhcp
  mtu            = local.mtu
  autostart      = local.autostart
  dns_enabled    = local.dns_enabled
  dns_local_only = local.dns_local_only
  dns_forwarders = local.forwarders
  dns_hosts      = local.hosts
  routes         = local.routes
}
```
## Testing

This module uses [cinc-auditor](https://cinc.sh/start/auditor/) as a test framework.
To install you can use the [download page](https://cinc.sh/download/) and the
[getting started guid](https://cinc.sh/start/auditor/). The auditor test are
located in the [test --> integration directory](./test/integration).
There is a [make file](./Makefile)
in the root of the repo that takes care of orchestrating the tests


text:
## COMP376

### Synopsis

These are my assignments for COMP 376 (Introduction to Game Development) during
the Fall 2014 semester.

Most of the code was written on the whim and things are generally just rough.

### Licensing

I am releasing the contents of this repository under the public domain. Feel
free to use whatever you'd like if you feel that it's useful.

If you intend to use anything for the purposes of education submission, do be
aware of your institutions rules regarding plagiarism to ensure that you're
not possibly infringing them.


text:
# TL;DR

Wrapper around the terraform binary that configures credentials (for AWS or GCP) if necessary.

## Example

* `gen3 tform help`

repository: uc-cdis/cloud-automation

repo_name: uc-cdis/cloud-automation


text:
---
title: "Camel K 1.5 release"
date: 2021-07-13
draft: false
authors: [squakez]
categories: ["Releases", "Camel K"]
preview: "What's new in Camel K 1.5"
---

[Camel K 1.5 version](https://github.com/apache/camel-k/releases/tag/v1.5.0) is public since a few days. We're proud to announce this new release containing enhancements and fixes. We've worked hard to fix the most important issues discovered with an eye on stabilization and performances. This new release is based on **Camel Quarkus 2.0** and **Apache Camel 3.11**.

Let's find out what's new in Camel K 1.5!

## New Camel Quarkus and Quarkus versions

**Camel Quarkus** runtime has become the building block on which the `Integration` is materialized. With the new 2.0 version out, there are great improvements which are leveraging the major release of **Quarkus 2.0**. We're inheriting all the good stuff in performance and components coverage that is introduced lately in this new version.

* [Camel Quarkus 2.0.0 released](/blog/2021/06/camel-quarkus-release-2.0.0/)
* [What's new in Camel 3.11.0](/blog/2021/06/Camel311-Whatsnew/)

## Tune your logs

As software developers, we are daily watching logs to discover what's going on for a piece of software that is failing. **Observability** and all the activities around that area are needed in order to have a reliable software solution. We know that, and we've introduced a new `trait` that will simplify the work of tuning and integrating the log streams in your logging systems.

You can learn more in [a blog dedicated to the topic](/blog/2021/05/new-camel-k-logging-features/).

## S3 dependencies

**S3** protocol is often used as a way to store Maven dependencies. With version 1.5 you will be able to configure your Camel K to retrieve such dependencies.

## Configuration refactoring

Prior to this version, we may have found a bit clumsy the work of providing a configuration file to our `Integration`. As a developer, you will now be able to define in details how and where to load a configuration file, filter a `Configmap` or a `Secret` and also distinguish between __build-time__ and __runtime__ properties. An entire blog covering this feature will be soon available, stay tuned!

## More Kamelet love

Since their appearence, **Kamelets** have gained quite a lot of traction. With this new release we've introduced new commands in the `kamel` CLI to help you discovering and managing them. You will have a new command available `kamel kamelet` that will help you listing and deleting any `Kamelet`. Also `kamel describe kamelet` has been introduced to help you analysing the available Kamelets.

We should also mention that we're having more Kamelets available in the [Apache Camel Kamelets Catalog](/camel-kamelets/next/index.html). We are counting 117 different source and sink Kamelets and we are actively adding many more.

## Allow configuration via traits annotations

We are aware that the CLI is not the only way to create an `Integration`. For this reason we've introduced a new way to simplify the setting of a `trait` directly in the `Integration` specification. Instead of specifying a trait in the `.spec.integration.traits.trait-id.configuration.trait-property` you will be now able to do so via `.metadata.annotations`.

## More test coverage

Of course, we haven't forgot to include more unit and integration tests to our code base. With this release we've introduced new test cases that are giving more confidence to the development lifecycle.

## Polish documentation

We are happy to announce a few new improvements in the online documentation. We're dedicating some more time to refresh the documentation that may be missing or that can be incomplete.

### Versioned documentation

One little but great improvements we've introduced lately is the versioning of the Camel K documentation website. Just look on the left bottom bar of your browser and you will be able to select either `latest` or `1.4.x`.

### Generated API

Another thing that is worth to mention is a first version of our API that is now available through the documentation pages. Have a look at [Camel K API resources documentation page](/camel-k/next/apis/camel-k.html) in order to understand how to interact directly with them.

# Thanks

Thanks to all contributors who made this possible. We're happy to receive feedback on this version through our [mailing list](/community/mailing-list/), our [official chat](https://camel.zulipchat.com/) or filing an issue on [Camel K Github repository](https://github.com/apache/camel-k).

repository: apache/camel-website

gha_language: CSS

repo_name: apache/camel-website


text:
# conformer [![Actions Status](https://github.com/chinedufn/conformer/workflows/ci/badge.svg)](https://github.com/chinedufn/conformer/actions) [![docs](https://docs.rs/conformer/badge.svg)](https://docs.rs/conformer)

> conformer helps you write and visualize conformance test suites.

## Background / Initial Motivation

I have a cross platform renderer.

At a high level it is a `Renderer` trait and then a few different structs that `impl Renderer for Self`.

Since mid February 2020 I've been using a test suite to assert that all of my renderers work properly when
called with different `RenderGraph`s.

During May 2021 I was working on cleaning this conformance testing code and decided to pull it out into an open
source library in case it helps others with writing their own conformance test suites.

## Usage

At this time, the best way to get started with conformer is to check out the [example where we test a simple renderer](./examples/renderer-test-suite).

## Visualizing

conformer comes bundles with two ways to visualize your test results.

### Simple Visual

The simple visualizer is useful for writing results to stdout.

```
Metal Graphics API Renderer Tests
Test the renderer.

25 test results
Renderer should use the desired clear color ... ok
Renderer should render a textured quad using a sub-section of a specified texture ... ok
Resize framebuffer depth texture ... ok
Render UI quad with solid background ... ok
Render two textured quads from different atlases ... FAILED
Render two textured quads from the same atlas ... ok
UI quads Z ... ok
Render mock text glyph quad using single component texture ... FAILED
Render disks using triangle strips ... ok
Resize framebuffer color texture ... ok
Renderer should update a sub-section of a texture on the GPU. ... ok
Render 3 particles ... FAILED
Non skinned mesh with high detail mesh shader - light from above ... FAILED
# ...
# ... REMOVED FOR README BREVITY ...
# ...

test result: FAILED. 11 passed; 14 failed
thread 'renderer_tests' panicked at 'FAILED', crates/renderer-test/src/lib.rs:199:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    renderer_tests

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.61s
```

### HTML Visual

The HTML visualizer is useful when you want to be able to see why a test failed.

It's flexible in that you can generate any HTML you like in order to best visualize your test case,
and it just wraps it with basic information like the test's title, description and whether or not
it passed or failed.

![HTML visualization](./html-visual.png)

## To Test

To run the test suite.

```sh
# Clone the repository
git clone git@github.com:chinedufn/conformer.git
cd conformer

# Run tests
cargo test --all
```

## License

conformer is licensed under either of

- Apache License, Version 2.0 ([LICENSE-APACHE][apache] or http://apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT][mit] or http://opensource.org/licenses/MIT)

[apache]: ./LICENSE-APACHE
[mit]: ./LICENSE-MIT

repository: chinedufn/conformer

repo_name: chinedufn/conformer