text:
# super-proxy

`superProxy` is a function that returns a function/object that has *every* property as a recursive version of itself. This is useful if you want to fake that an object exists but you want to remove the behaviour.

## Installation
**In a browser**
```
<script<EMAIL_ADDRESS>```
**With npm**
```
npm install super-proxy
```

## Usage
```js
const foo = superProxy()
foo.bar // this is okay
foo.bar() // also okay
new foo.bar().baz // all of this is okay
```

## Use Case Example

Let's say you have loaded [Segment](https://segment.com) with a script tag and in your application you have many calls to `window.analytics.track` that you would like to skip.

With `super-proxy` you can do:

```js
window.analytics = superProxy()
window.analytics.identify(...) // this does nothing now
window.analytics.track(...) // same here
window.analytics.whatever(...) // there is no tracking!
```

repository: terrencewwong/super-proxy

repo_name: terrencewwong/super-proxy


text:
---
layout: post
title: Intel Realsense T265 tracking camera for mobile robotics - first impressions
description: "I have used the Intel Realsense T265 tracking camera for quite a while now. This post summarizes my experience with it and provides some tips on how to use it with ROS."
modified: 2019-10-15
comments: true
tags: [ROS, Robotics]
image:
  feature: t265.jpg
---

In this post I will write about my first impressions after working with Realsense T265 on a wheeled mobile robot and give some tips on the configuration I think is most correct with respect to ROS standards.

## Setting up

Robosynthesis development platform

I've tested the T265 on a Robosynthesis Dev Platform that you might have seen it in my [previous post](https://msadowski.github.io/hands-on-with-slam_toolbox/). While working with the T265 tracking camera I spent a fair bit of time going through the documentation and ROS package source code, hope that any of the insights I describe in this post will help you get started.

There are two sets of software we will be interested in in this blog post:
* realsense-ros package ([GitHub](https://github.com/IntelRealSense/realsense-ros)) (while working on this post I was on da4bb5d commit hash)
* librealsense ([GitHub](https://github.com/IntelRealSense/librealsense))

There are some inconsistencies between the above packages and I'll do my best to clear them up in this post. Please note that the T265 seems to be in an active state of development therefore some of the information contained in this post might change over time (I'll do my best to keep it up to date though).

## Coordinate frames

Coordinate frame setup is something I had the most issues with when I first started with T265 with realsense-ros package. First let's look at the T265 frame (as seen in [librealsense](https://github.com/IntelRealSense/librealsense/blob/master/doc/t265.md)).

T265 coordinate frames

T265 uses a VR coordinate system which differs from the one you would expect in ROS. Fortunately the realsense-ros handles the tf transforms for us, making our lives a bit easier. Here is what we need to keep in mind:
* Any frames with a word **optical** in them (e.g. camera_fisheye_optical_frame) are the same frames are the T265 frames in VR coordinates
* The camera and IMU messages are delivered in the optical frames
* The parameter pose_frame_id in the realsense-ros **differs** from the librealsense pose frame. Its orientation follows ROS convention (x-front, y-left, z-up in the global frame)
* pose_frame_id in realsense-ros is the location of the camera in the odometry frame. There is a static transform between the pose_frame_id and the base_frame_id of the camera (not to be mistaken with the base_frame in the ROS traditional sense)

Below you can see an example ROS tf tree that the realsense-ros can provide for us:

slam_toolbox RViz plugin window

You should be able to get the same output by setting the following parameters in the launch file (pseudocode):
* camera = "rs_t265"
* tf_prefix = "$(arg camera)"
* publish_odom_tf = "true"
* odom_frame_id = "odom"
* base_frame_id = "$(arg tf_prefix)_link"
* pose_frame_id = "$(arg tf_prefix)_pose_frame"

### Shortcomings

There are two things to note about the above tf structure (most of them coming from [REP-105](https://www.ros.org/reps/rep-0105.html))
* A tf frame can have only one parent. This means that if you have a base_link frame specified in your robot description you won't be able to directly specify a transform for base_link->rs_t265_link or base_link->rs_t265_pose_frame as this would break your tree
* By convention the measurements in the odometry frame have to be continuous (without discrete jumps) this means that if you were to use the setup described above then you would need to set "enable_pose_jumping" parameter to false ([GitHub issue](https://github.com/IntelRealSense/realsense-ros/issues/923#issuecomment-531547065)). More on this later

## The most ROS-proper setup I can think of

Here are some of the considerations for creating a most proper setup with ROS package for Intel Realsense T265 that I can think of.

First of all, I like my sensor frames being relative to the base_link frame of my robot platform. Therefore in my urdf description I would define a static base_link to the camera pose_frame (the ROS one). To have this working we need to set "publish_odom_tf" parameter to false (this way we ensure that the camera pose_frame has a single parent, a base_link).

Say we would like to use the camera as a source of odometry. My suggestion for getting there is to:
* Run a [robot_localization node](http://docs.ros.org/melodic/api/robot_localization/html/index.html) that will listen to the odometry message from T265 and publish an odom->base_link transform. That way we can easily ensure that the tree is continuous
* Set enable_pose_jumping parameter to false so that the pose of the robot in odometry frame is continuous (**WARNING** read this section until the end before implementing it since it might cause significant errors). Some of the packages you might be using might make some assumptions following REP-105 so better safe than sorry
* Optional: create a t265 filter node that will change the odometry frame_id from the pose_frame to base_link. That way you should be able to directly compare the various odometry sources on your platform (at least comparing the wheel odometry against the t265 odometry sounds like an interesting experiment)

I successfully run some tests with the first two points from the above list and I was quite satisfied with how 'clean' the setup was w.r.t. ROS good practices. Because of [velocity drift](https://github.com/IntelRealSense/librealsense/issues/4876) that I observed on multiple occasions in my setup I stopped looking into it.

## Wheel odometry

According to [the docs](https://github.com/IntelRealSense/realsense-ros#using-t265) T265 absolutely requires wheel odometry for robust and accurate tracking. To provide the odometry information you will need to:

1. Specify the *topic_odom_in* parameter
2. Create a file with odometry calibration

The first requirement is trivial; you just need to make sure that you correctly specify the topic name.

The fields you need to fill in in the calibration file are T and W vectors in extrinsics field (you will find an example in [this comment](https://github.com/IntelRealSense/librealsense/pull/3462#issuecomment-472491730)). What you need to keep in mind is that T is the translation from camera pose frame (in the sensor/VR frame, **not the realsense-ros pose frame**) to your base_link and W is the rotation between these two frames in **axis-angle representation**. You will find some useful information about this in [this pull request](https://github.com/IntelRealSense/librealsense/pull/3462).

## Closing thoughts

I really like the idea behind the Realsense T265. Having an affordable sensor that can be easily integrated onto any robot would be a great thing to have. I think the T265 is going in the right direction, however I would let it mature before using it on a commercial system but I think it will get there and will provide a true 'plug&play' ROS experience, adhering to good ROS practices.

Is there anything that I missed? Your feedback is highly valued so feel free to leave a comment! I'll be following the T265 development and try to update this post as needed.

## Update

It has been almost 1 year since I wrote this blog post. I was recently looking to integrate it on a robot. Unfortuantely there are two problems that prevented me from using it on the robot:
* [Pose data is NaN](https://github.com/IntelRealSense/librealsense/issues/4518)
* [Odometry drift when PoseJumping is disabled](https://github.com/IntelRealSense/librealsense/issues/5850#issuecomment-688791413)

As you will see in the comments Intel is not planning to address any existing or new issues on T265 as they shifted focus to the new products. If you are making robots that have to run over long period of times with high accuracy I would advise to wait for the new products to come out before investing in T265.

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: CSS

license_type: permissive


text:
---
layout: post
title: Linux HA 集群原理和配置-01
key: 20160610
tags: ha linux pcs pacemaker corosync
modify_date: 2018-03-05
---

CentOS7上可通过三大模块corosync（心跳管理），pacemaker（资源管理），pcs（配置工具）来实现最基本的高可用性集群功能，本文将介绍这些工具的工作原理和配置过程。

<!--more-->

## 1. 实验环境

- 虚拟化软件：
    - [Virtual Box 5.6.2](https://www.virtualbox.org/wiki/Downloads)
    - [Vagrant 2.0.2](https://www.vagrantup.com/downloads.html)

- 实验虚机：
    - iscsi-disks: <IP_ADDRESS>，通过iSCSI协议提供共享存储，默认配置1个cpu，1G内存。
    - ha-host1: <IP_ADDRESS>，默认配置1个cpu，1G内存。
    - ha-host2: <IP_ADDRESS>，默认配置1个cpu，1G内存。
    - ha-host3: <IP_ADDRESS>，默认配置1个cpu，1G内存。

- 安装和管理网络：<IP_ADDRESS>/24，该网络为VirtualBox的Host-Only网络，支持物理机和VirtualBox虚机间的互相访问。

## 2.  创建pcs集群

**Step 1 安装软件包**

在3台集群主机上安装corosync，pacemaker，pcs包, 启动pcsd服务。
```
# yum -y install corosync pacemaker pcs
# systemctl start pcsd && systemctl enable pcsd
```

**Step 2 修改hacluster用户密码**

在3台集群主机上修改用户hacluster的密码，3台主机的密码保持一致。这个用户仅用于集群主机间通信，无法登陆系统。因此该密码仅在主机集群认证时一次性使用。

```
[root@ha-host1 ~]# passwd hacluster
Changing password for user hacluster.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
```

**Step 3 互相认证集群主机**
```
[root@ha-host1 ~]# pcs cluster auth ha-host1 ha-host2 ha-host3
Username: hacluster
Password:
ha-host1: Authorized
ha-host2: Authorized
ha-host3: Authorized
[root@ha-host1 ~]#
```

**Step 4 创建集群**
```
[root@ha-host1 ~]# pcs cluster setup --name linuxha ha-host1 ha-host2 ha-host3
Destroying cluster on nodes: ha-host1, ha-host2, ha-host3...
ha-host3: Stopping Cluster (pacemaker)...
ha-host1: Stopping Cluster (pacemaker)...
ha-host2: Stopping Cluster (pacemaker)...
ha-host2: Successfully destroyed cluster
ha-host1: Successfully destroyed cluster
ha-host3: Successfully destroyed cluster

Sending 'pacemaker_remote authkey' to 'ha-host1', 'ha-host2', 'ha-host3'
ha-host2: successful distribution of the file 'pacemaker_remote authkey'
ha-host1: successful distribution of the file 'pacemaker_remote authkey'
ha-host3: successful distribution of the file 'pacemaker_remote authkey'
Sending cluster config files to the nodes...
ha-host1: Succeeded
ha-host2: Succeeded
ha-host3: Succeeded

Synchronizing pcsd certificates on nodes ha-host1, ha-host2, ha-host3...
ha-host1: Success
ha-host2: Success
ha-host3: Success
Restarting pcsd on the nodes in order to reload the certificates...
ha-host1: Success
ha-host2: Success
ha-host3: Success
```

**Step 5 启动集群并设置自动启动**
```
[root@ha-host1 ~]# pcs cluster start --all
ha-host1: Starting Cluster...
ha-host2: Starting Cluster...
ha-host3: Starting Cluster...
[root@ha-host1 ~]# pcs cluster enable --all
ha-host1: Cluster Enabled
ha-host2: Cluster Enabled
ha-host3: Cluster Enabled
```

**Step 6 查看集群状态**
```
[root@ha-host1 ~]# pcs status
Cluster name: linuxha
WARNING: no stonith devices and stonith-enabled is not false
Stack: corosync
Current DC: ha-host3 (version 1.1.16-12.el7_4.8-94ff4df) - partition with quorum
Last updated: Mon Apr 23 03:39:50 2018
Last change: Mon Apr 23 03:38:08 2018 by hacluster via crmd on ha-host3

3 nodes configured
0 resources configured

Online: [ ha-host1 ha-host2 ha-host3 ]

No resources

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled
```

pcs status的结果显示:

1. 当前的仲裁节点(Current DC, DC即为Designated Co-ordinator）为ha-host3，这个节点负责向集群中的节点发出一系列指令，使各个资源按照定义（存储在cib数据库中）启动或停止。

2. 3台集群主机ha-host1，ha-host2，ha-host3都已经online，但是目前没有任何资源。

3. 有一个关于stonith设备的Warning:

    > WARNING: no stonith devices and stonith-enabled is not false

    stonith设备在后面将会介绍，目前因为还没有创建，因此先向stonith-enabled属性设为false。关闭后该WARNING消失。
    ```
    [root@ha-host1 ~]# pcs property set stonith-enabled=false
    [root@ha-host1 ~]# pcs status
    Cluster name: linuxha
    Stack: corosync
    Current DC: ha-host3 (version 1.1.16-12.el7_4.8-94ff4df) - partition with quorum
    Last updated: Mon Apr 23 03:40:17 2018
    Last change: Mon Apr 23 03:40:15 2018 by root via cibadmin on ha-host1

    3 nodes configured
    0 resources configured

    Online: [ ha-host1 ha-host2 ha-host3 ]

    No resources

    Daemon Status:
      corosync: active/enabled
      pacemaker: active/enabled
      pcsd: active/enabled
    ```

## 4. 创建资源

创建一个最简单的IP资源：
```
[root@ha-host1 ~]# pcs resource create vip ocf:heartbeat:IPaddr2 ip=<IP_ADDRESS> cidr_netmask=24 op monitor interval=30s
```

查看pcs的状态：
```
[root@ha-host1 ~]# pcs status
Cluster name: linuxha
Stack: corosync
Current DC: ha-host3 (version 1.1.16-12.el7_4.8-94ff4df) - partition with quorum
Last updated: Mon Apr 23 03:41:46 2018
Last change: Mon Apr 23 03:41:40 2018 by root via cibadmin on ha-host1

3 nodes configured
1 resource configured

Online: [ ha-host1 ha-host2 ha-host3 ]

Full list of resources:

 vip    (ocf::heartbeat:IPaddr2):       Started ha-host1

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled
```
上面显示新创建的资源vip，这个IP被分配在ha-host1上。

检查ha-host1的网口，可以看到ha-host1的eth1网口上分配了新的IP <IP_ADDRESS>
```
[root@ha-host1 ~]# ip a
...
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:55:a1:19 brd ff:ff:ff:ff:ff:ff
    inet <IP_ADDRESS>/24 brd <IP_ADDRESS> scope global eth1
       valid_lft forever preferred_lft forever
    inet <IP_ADDRESS>/24 brd <IP_ADDRESS> scope global secondary eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe55:a119/64 scope link
       valid_lft forever preferred_lft forever
[root@ha-host1 ~]# ssh <IP_ADDRESS>
Last login: Wed Apr 18 05:38:11 2018 from <IP_ADDRESS>
[root@ha-host1 ~]# exit
logout
Connection to <IP_ADDRESS> closed.
```

## 5. 触发切换

将ha-host1的eth1网口停掉，可发现<IP_ADDRESS>这个IP被切换到了ha-host2的eth1端口。

```
[root@ha-host1 ~]# ifconfig eth1 down
```

```
[root@ha-host2 ~]# pcs status
Cluster name: linuxha
Stack: corosync
Current DC: ha-host3 (version 1.1.16-12.el7_4.8-94ff4df) - partition with quorum
Last updated: Mon Apr 23 03:43:36 2018
Last change: Mon Apr 23 03:41:39 2018 by root via cibadmin on ha-host1

3 nodes configured
1 resource configured

Online: [ ha-host2 ha-host3 ]
OFFLINE: [ ha-host1 ]

Full list of resources:

 vip    (ocf::heartbeat:IPaddr2):       Started ha-host2

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled
```

```
[root@ha-host2 ~]# ip a
...
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:bc:94:42 brd ff:ff:ff:ff:ff:ff
    inet <IP_ADDRESS>/24 brd <IP_ADDRESS> scope global eth1
       valid_lft forever preferred_lft forever
    inet <IP_ADDRESS>/24 brd <IP_ADDRESS> scope global secondary eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:febc:9442/64 scope link
       valid_lft forever preferred_lft forever
```

上面pcs status的结果显示了ha-host1变为了OFFLINE状态，这是因为eth1也是ha-host1的集群间的通信网口。在实际部署中，虚拟IP资源一般用于承载业务，应该和集群通信用的网络分开。

## 6. Pacemaker中的资源定义

Pacemaker中的资源类型使用standard, provider（仅当standard为ocf使用）和agent来进行标识，格式如下：
\<standard\>:[provider]:\<agent\>

可用pcs resources list指令列出当前支持的资源类型：
```
[root@ha-host1 ~]# pcs resource list
...
ocf:heartbeat:iface-vlan - Manages VLAN network interfaces.
ocf:heartbeat:IPaddr - Manages virtual IPv4 and IPv6 addresses (Linux specific
                       version)
ocf:heartbeat:IPaddr2 - Manages virtual IPv4 and IPv6 addresses (Linux specific
                        version)
ocf:heartbeat:IPsrcaddr - Manages the preferred source address for outgoing IP
                          packets
ocf:heartbeat:iSCSILogicalUnit - Manages iSCSI Logical Units (LUs)
ocf:heartbeat:iSCSITarget - iSCSI target export agent
ocf:heartbeat:LVM - Controls the availability of an LVM Volume Group
ocf:heartbeat:MailTo - Notifies recipients by email in the event of resource
                       takeover
ocf:heartbeat:mysql - Manages a MySQL database instance
ocf:heartbeat:nagios - Nagios resource agent
...
```
以上输出中可以找到之前创建的vip资源类型 ocf:heartbeat:IPaddr2。

然后使用pcs resource describe指令查看该类型资源所需参数
```
[root@ha-host1 ~]# pcs resource describe ocf:heartbeat:IPaddr2
ocf:heartbeat:IPaddr2 - Manages virtual IPv4 and IPv6 addresses (Linux specific
                        version)

This Linux-specific resource manages IP alias IP addresses.
It can add an IP alias, or remove one.
In addition, it can implement Cluster Alias IP functionality
if invoked as a clone resource.

If used as a clone, you should explicitly set clone-node-max >= 2,
and/or clone-max < number of nodes. In case of node failure,
clone instances need to be re-allocated on surviving nodes.
This would not be possible if there is already an instance on those nodes,
and clone-node-max=1 (which is the default).

Resource options:
  ip (required): The IPv4 (dotted quad notation) or IPv6 address (colon
                 hexadecimal notation) example IPv4 "<IP_ADDRESS>". example IPv6
                 "2001:db8:DC28:0:0:FC57:D4C8:1FFF".
  nic: The base network interface on which the IP address will be brought
       online. If left empty, the script will try and determine this from the
       routing table. Do NOT specify an alias interface in the form eth0:1 or
       anything here; rather, specify the base interface only. If you want a
       label, see the iflabel parameter. Prerequisite: There must be at least
       one static IP address, which is not managed by the cluster, assigned to
       the network interface. If you can not assign any static IP address on the
       interface, modify this kernel parameter: sysctl -w
       net.ipv4.conf.all.promote_secondaries=1 # (or per device)
  cidr_netmask: The netmask for the interface in CIDR format (e.g., 24 and not
                <IP_ADDRESS>) If unspecified, the script will also try to
                determine this from the routing table.
  broadcast: Broadcast address associated with the IP. If left empty, the script
             will determine this from the netmask.
  iflabel: You can specify an additional label for your IP address here. This
           label is appended to your interface name. A label can be specified in
           nic parameter but it is deprecated. If a label is specified in nic
           name, this parameter has no effect.
  lvs_support: Enable support for LVS Direct Routing configurations. In case a
               IP address is stopped, only move it to the loopback device to
               allow the local node to continue to service requests, but no
               longer advertise it on the network. Notes for IPv6: It is not
               necessary to enable this option on IPv6. Instead, enable
               'lvs_ipv6_addrlabel' option for LVS-DR usage on IPv6.
  lvs_ipv6_addrlabel: Enable adding IPv6 address label so IPv6 traffic
                      originating from the address's interface does not use this
                      address as the source. This is necessary for LVS-DR health
                      checks to realservers to work. Without it, the most
                      recently added IPv6 address (probably the address added by
                      IPaddr2) will be used as the source address for IPv6
                      traffic from that interface and since that address exists
                      on loopback on the realservers, the realserver response to
                      pings/connections will never leave its loopback. See
                      RFC3484 for the detail of the source address selection.
                      See also 'lvs_ipv6_addrlabel_value' parameter.
  lvs_ipv6_addrlabel_value: Specify IPv6 address label value used when
                            'lvs_ipv6_addrlabel' is enabled. The value should be
                            an unused label in the policy table which is shown
                            by 'ip addrlabel list' command. You would rarely
                            need to change this parameter.
  mac: Set the interface MAC address explicitly. Currently only used in case of
       the Cluster IP Alias. Leave empty to chose automatically.
  clusterip_hash: Specify the hashing algorithm used for the Cluster IP
                  functionality.
  unique_clone_address: If true, add the clone ID to the supplied value of IP to
                        create a unique address to manage
  arp_interval: Specify the interval between unsolicited ARP packets in
                milliseconds.
  arp_count: Number of unsolicited ARP packets to send at resource
             initialization.
  arp_count_refresh: Number of unsolicited ARP packets to send during resource
                     monitoring. Doing so helps mitigate issues of stuck ARP
                     caches resulting from split-brain situations.
  arp_bg: Whether or not to send the ARP packets in the background.
  arp_mac: MAC address to send the ARP packets to. You really shouldn't be
           touching this.
  arp_sender: The program to send ARP packets with on start. For infiniband
              interfaces, default is ipoibarping. If ipoibarping is not
              available, set this to send_arp.
  flush_routes: Flush the routing table on stop. This is for applications which
                use the cluster IP address and which run on the same physical
                host that the IP address lives on. The Linux kernel may force
                that application to take a shortcut to the local loopback
                interface, instead of the interface the address is really bound
                to. Under those circumstances, an application may, somewhat
                unexpectedly, continue to use connections for some time even
                after the IP address is deconfigured. Set this parameter in
                order to immediately disable said shortcut when the IP address
                goes away.
  run_arping: Whether or not to run arping for IPv4 collision detection check.
  preferred_lft: For IPv6, set the preferred lifetime of the IP address. This
                 can be used to ensure that the created IP address will not be
                 used as a source address for routing. Expects a value as
                 specified in section 5.5.4 of RFC 4862.

Default operations:
  start: interval=0s timeout=20s
  stop: interval=0s timeout=20s
  monitor: interval=10s timeout=20s
```

之前创建vip资源时使用的资源参数（ip，cidr_netmask）和操作参数（monitor:interval）都可在以上输出中找到。

gha_license_id: MIT


text:
# Yup Schemas Are Validated Asynchronously

[Yup](https://github.com/jquense/yup) provides a flexible object schema
validation DSL. For instance, if you want to enforce that a certain value is
a number, you can define something like this:

```javascript
const numSchema = yup.number();
```

You can then validate anything against that schema.

```javascript
const validator = (val) => {
  numSchema.validate(val)
    .then(result => {
      console.log(result); // it is the value of `val`
      return true;
    })
    .catch(error => {
      console.log(error.errors); // array of validation error messages
      return false;
    });
};
```

The validation is async, so if it succeeds the `then` block is hit. If the
validation fails, it will fall through to the `catch`.

```javascript
validator(5) // => true
validator('what') // => false
```

repository: jbranchaud/til

gha_language: Vim Script

repo_name: jbranchaud/til


text:
---
layout: post
title: "Improving Question Answering with External Knowledge"
date: 2019-02-03 23:44:10
categories: arXiv_CL
tags: arXiv_CL Knowledge QA
author: Xiaoman Pan, Kai Sun, Dian Yu, Heng Ji, Dong Yu
mathjax: true
---

* content
{:toc}

##### Abstract
Prior background knowledge is essential for human reading and understanding. In this work, we investigate how to leverage external knowledge to improve question answering. We primarily focus on multiple-choice question answering tasks that require external knowledge to answer questions.
 We investigate the effects of utilizing external in-domain multiple-choice question answering datasets and enriching the reference corpus by external out-domain corpora (i.e., Wikipedia articles). Experimental results demonstrate the effectiveness of external knowledge on two challenging multiple-choice question answering tasks: ARC and OpenBookQA.

##### Abstract (translated by Google)

##### URL
[http://arxiv.org/abs/1902.00993](http://arxiv.org/abs/1902.00993)

##### PDF
[http://arxiv.org/pdf/1902.00993](http://arxiv.org/pdf/1902.00993)


text:
# listking

This was a project I took upon myself before I started school at The
Iron Yard. I used help from the JQuery/JS tutorials to get the .js
part down. The CSS though was just from me looking at the pictures in
the book and trying to recreate them myself. The HTML was taken from
Dockett's book.

#### Technologies Used:

- JavaScript
- jQuery
- HTML
- CSS


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

### Description

SQL injection vulnerability in index.php in Tilde CMS 4.x and earlier allows remote attackers to execute arbitrary SQL commands via the aarstal parameter in a yeardetail action, a different vector than CVE-2006-1500.

### POC

#### Reference
- http://securityreason.com/securityalert/3402

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

repo_name: trickest/cve


text:
# Linna Filter Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [v0.4.0](https://github.com/linna/filter/compare/v0.3.0...v0.4.0) - 2019-XX-XX

### Changed
* minimum php version 7.2
* tests updated

## [v0.3.0](https://github.com/linna/filter/compare/v0.2.0...v0.3.0) - 2018-10-04

### Added
* `Linna\Filter\Result` class, abstract, returned by `Linna\Filter\Filter->filter()` as anonymous class
* `Linna\Filter\Rules\CustomRule` for declare user validation and sanitization custom rules
* `Linna\Filter\Rules\Ip` check for valid ipv4 and ipv6 address
* `Linna\Filter\Rules\IPRange` check if provided ipv4/ipv6 is in CIDR range
* `Linna\Filter\Rules\StringLenCompare` new alias `strlen`
* Namespace for tests

### Changed
* `Linna\Filter\Filter->filterOne()` and `Linna\Filter\Filter->filterMulti()` merged in `Linna\Filter\Filter->filter()`
* `Linna\Filter\Lexer` class improved
* `Linna\Filter\Rules\Regex` now throw an `InvalidArgumentException` if invalid regex is provided

### Fixed
* [Issue #2](https://github.com/linna/filter/issues/2)

## [v0.2.0](https://github.com/linna/filter/compare/v0.1.0...v0.2.0) - 2018-07-28

### Added
* Rule aliases
* New rule and more human readable message system
* `Linna\Filter\Filter->filterOne()` and `Linna\Filter\Filter->filterMulti()` methods now return a results object
* `Linna\Filter\Rules\NumberIntervall` check if a number is inside or outside a range with operators ><, <>, >=<, <=
* `Linna\Filter\Rules\NumberCompare` check and compare numbers with operators <, >, >=, <=, =
* `Linna\Filter\Rules\Regex` check if value match a regex
* `Linna\Filter\Rules\StringLenCompare` check length of a string with operators <, >, >=, <=, =, !=
* `Linna\Filter\Rules\Str` sanitize strings (convert data type to string)

### Removed
* `Linna\Filter\Rules\Between`
* `Linna\Filter\Rules\MaxLength`
* `Linna\Filter\Rules\Max`
* `Linna\Filter\Rules\Min`
* `Linna\Filter\Rules\MinLength`

## [Initial Release][v0.1.0](https://github.com/linna/filter/compare/v0.1.0...master) - 2018-05-29

### Added
* `Linna\Filter\Rules\Between` validate numbers, between two values
* `Linna\Filter\Rules\Date` validate a date
* `Linna\Filter\Rules\DateCompare` validate dates with operators <, >, >=, <=, =
* `Linna\Filter\Rules\Email` validate an email
* `Linna\Filter\Rules\Escape` convert special chars to html entities
* `Linna\Filter\Rules\Max` validate numbers, lower than
* `Linna\Filter\Rules\MaxLength` validate strings length, lower than
* `Linna\Filter\Rules\Min` validate numbers, higher than
* `Linna\Filter\Rules\MinLength` validate strings length, higher than
* `Linna\Filter\Rules\Number` sanitize numbers (convert data type to int or float)

repository: linna/filter

gha_language: PHP

repo_name: linna/filter


text:
# ci4-ligatcode
[![](https://badgen.net/badge/icon/Website?icon=chrome&label)](https://blog.simeedun.com)
[![](https://badgen.net/badge/license/MIT/blue)](https://github.com/irev/ci4-ligatcode/blob/master/LICENSE)
![](https://badgen.net/github/commits/irev/ci4-ligatcode)
![](https://badgen.net/github/last-commit/irev/ci4-ligatcode)
![](https://badgen.net/github/status/irev/ci4-ligatcode/master)

### Codeigniter 4 CRUD Generator 1.0 (only Codeigniter 4)
About :
Codeigniter 4 CRUD Generator is a simple tool to automatically generate models, controllers and views from your tables. This tool is re-designed from the previous generator tool, Harviacode works for codeigniter 3. This tool will improve your writing code. This CRUD generator will perform complete CRUD operations, pagination, search, form *, ~~form validation, export to excel, and export to word~~. This CRUD generator uses bootstrap 4 style. You will still need to change the result code for more customization.

## TASK lISH :clock10:
- [x] CRUD Generator
- [x] MODEL, VIEW, CONTROLER
- [x] Tabel Paging
- [ ] form validation
- [ ] \(Optional) export excel :soon:
- [ ] \(Optional) export word :soon:
- [ ] \(Optional) export pdf :soon:

#

* generate textarea and text input only
:fire: Codeigniter 4 CRUD Generator Please visit and like [blog.simeedun.com](blog.simeedun.com) for more info and PHP tutorials.
* :fire: Codeigniter 3 CRUD Generator Please visit and like [harviacode.com](harviacode.com) for more info and PHP tutorials.

## Preparation before using this Codeigniter 4 CRUD Generator (Important) :

On Controller `app/Controller/BaseController.php` , load `database library`, `session library` and `url helper`

```
protected $helpers = ['html','text','form','session'];
```

On file `.env` setting DATABASE, Find `CTR+F`

```
database.default.hostname = localhost
database.default.database = database
database.default.username = username
database.default.password = password
database.default.DBDriver = MySQLi
```

#### Using this CRUD Generator :

Simply put 'Ligatcode' folder,view folder, 'asset' folder and .htaccess file into your project root folder.
Open http://localhost/{yourprojectname}/ligatcode.
Select table and push generate button.
FAQ :

Select table show no data. Make sure you have correct database configuration on application/config/database.php and load database library on autoload.
Error chmod on mac and linux. Please change your application folder and harviacode folder chmod to 777
Error cannot Read, Update, Delete. Make sure your table have primary key.

#### Update Codeigniter 4 CRUD Generator

##### V.1.0 (meedun) - 30 August 2020
* Add the displayed database field selector
* construct (model, view and controller) for Codeigniter framework version 4.0.4
* Support custom page layout, built-in features of Codeigniter 4 This feature only affects the Generator button, ignored in Generate All button
#

`las't named \*harviacode\* to \*ligatcode\*`

@radenrap/aci-harviacode What do you think about these updates?

#
© 2020-2020 blog.simeedun.com

repository: rizkyharahap/pencarian-magang

repo_name: rizkyharahap/pencarian-magang


text:
As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier.
There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects. Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

```
//Bad:
var foo_;
var __proto__ = {};
foo._bar();

```

[Source](http://eslint.org/docs/rules/no-underscore-dangle)

gha_license_id: NOASSERTION


text:
# React Native Select Lists

## Instalation

```
npm i react-native-select-lists --save-dev
```

## Usage

```js
import { Select, Option } from 'react-native-select-lists';

<Select>
  <Option value={1}>List item 1</Option>
  <Option value={2}>List item 2</Option>
  <Option value={3}>List item 3</Option>
</Select>
```

### Select properties

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| **onSelect** | Function | null | This function is invoked when some option is selected. |
| **padding** | number | 10 | Horizontal padding for select box. Text is always centered vertially. |
| **zIndex** | number | 999 | It is used to pop the select above all other elements. |
| **selectStyle** | Object | null | Set custom style to your select. |
| **selectTextStyle** | Object | null | Set custom style to your select box text. |
| **caret** | string or React element | null | You can set default caret with setting this property to 'down' or 'up'. If you want to set some custom image or view you can set an element to the caret property. Explicitly set width and height to caret element if you are using an Image element. |
| **caretSize** | number | 15 | Customize caret size. It is used only when caret is set to 'down' or 'up'. |
| **caretColor** | string | '#333333' | Customize caret color. It is used only when caret is set to 'down' or 'up'. |
| **listHeight** | number | 100 | The maximum list height.
| **listPosition** | string | 'down' | Change position of dropdown list. You can set it 'up', so it will shows above the select. If dropdown cannot fit the screen size it will expand to the oposite direction. |
| **listStyle** | Object | null | Styles for dropdown list.

### Option properties

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| **optionStyle** | Object | null | Set custom style to Option element. |
| **optionTextStyle** | Object | null | Set custom style to Option text. |
| **last** | boolean | false | Add it to last element so it will not have bottom border. |


text:
# IntroductoryOTML

This repository contains the code and presentation for the lecture "Introduction of Optimal Transport for Machine Learning", for third year undergraduate students @ Universidade Federal do Ceará (UFC). You may find the presentation on the following link: [[Presentation]](https://eddardd.github.io/TalksAndPresentations/IntroductoryOTML/)

For executing the code here presented, you will need the following packages,

```
pot >= 0.7.0
numpy >= 1.19.1
pandas >= 1.0.3
seaborn >= 0.10.0
scikit-image >= 0.16.2
scikit-learn >= 0.22.2
tensorflow == 1.15.2
```

This repository presentation uses [reveal.js](https://github.com/hakimel/reveal.js/).

repository: eddardd/TalksAndPresentations

repo_name: eddardd/TalksAndPresentations


text:
Welcome to webpack-react-todolist 👋

> React To-do List with Firebase Server Example

## Install

```sh
yarn install
```

## Usage

```sh
yarn start
```

## Run tests

```sh
yarn test
```

## Author

👤 **Bulgaru Liliana**

* Github: [@lilianabulgaru3pg](https://github.com/lilianabulgaru3pg)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/lilianabulgaru3pg/React-TodoList/issues).

## Show your support

Give a ⭐ if this project helped you!

***
_This README was generated with ❤ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

gha_language: JavaScript


text:
+++
date = "2018-07-31T12:00:00-07:00"
title = "Prometheus"
description = "Prometheus collects and stores all the Linkerd metrics. It is a component of the control plane and can be integrated with existing metric systems, such as an existing Prometheus install."
aliases = [
  "/2/prometheus/"
]
[menu.l5d2docs]
  name = "Prometheus"
  parent = "observability"
+++

## Exporting metrics

If you have an existing Prometheus cluster, it is very easy to export Linkerd's
rich telemetry data to your cluster.  Simply add the following item to your
`scrape_configs` in your Prometheus config file (replace `{{.Namespace}}` with
the namespace where Linkerd is running):

```yaml
- job_name: 'linkerd'
  kubernetes_sd_configs:
  - role: pod
    namespaces:
      names: ['{{.Namespace}}']

  relabel_configs:
  - source_labels:
    - __meta_kubernetes_pod_container_name
    action: keep
    regex: ^prometheus$

  honor_labels: true
  metrics_path: '/federate'

  params:
    'match[]':
      - '{job="linkerd-proxy"}'
      - '{job="linkerd-controller"}'
```

That's it!  Your Prometheus cluster is now configured to scrape Linkerd's
metrics.

Linkerd's proxy metrics will have the label `job="linkerd-proxy"`.  Linkerd's
control-plane metrics will have the label `job="linkerd-controller"`.

For more information on specific metric and label definitions, have a look at
[Proxy Metrics](../proxy-metrics).

For more information on Prometheus' `/federate` endpoint, have a look at the
[Prometheus federation docs](https://prometheus.io/docs/prometheus/latest/federation/).

## Exporting metrics from Prometheus to other data stores

If you want to export to a data store other than Prometheus, you can query
Linkerd's Prometheus’ instance directly, via the Federation API or JSON API.

### Prometheus Federation API

#### Inside Kubernetes cluster

```bash
curl -G --data-urlencode 'match[]={job="linkerd-proxy"}' --data-urlencode 'match[]={job="linkerd-controller"}' http://prometheus.linkerd.svc.cluster.local:9090/federate
```

#### Outside Kubernetes cluster

```bash
kubectl -n linkerd port-forward $(kubectl -n linkerd get po --selector=linkerd.io/control-plane-component=prometheus -o jsonpath='{.items[*].metadata.name}') 9090:9090
```
and then:
```bash
curl -G --data-urlencode 'match[]={job="linkerd-proxy"}' --data-urlencode 'match[]={job="linkerd-controller"}' http://localhost:9090/federate
```

### Prometheus JSON API

Similar to the `/federate` API, Prometheus provides a JSON API to retrieve all
metrics:

```bash
curl http://prometheus.linkerd.svc.cluster.local:9090/api/v1/query?query=request_total
```

## Querying Linkerd's `/metrics` endpoint

If you want to query a Linkerd proxy directly, you can use its `/metrics`
endpoint.

Each Linkerd proxy, injected as a sidecar with your application, provides
application-level metrics for all requests transiting through your application's
pod.

For example, to view `/metrics` from a single Linkerd proxy, running in the
`linkerd` namespace:

```bash
kubectl port-forward -n linkerd $(kubectl -n linkerd get pods -l linkerd.io/control-plane-ns=linkerd -o jsonpath='{.items[0].metadata.name}') 4191:4191
```
and then:
```bash
curl localhost:4191/metrics
```


text:
# Delivery Application KOTLIN-MVVM

This project uses location for delivery location, it is advised to use a map api key.

## Instructions of using map api key
1. Generate a map api key in [Google Console](https://developers.google.com/maps/documentation/android-sdk/get-api-key)
2. Find google_maps_api.xml inside values directory of the app
3. Paste the generated api key from google console

## Framework Included
 1. RxJava2
 2. Dagger2
 3. Retrofit2
 4. OkHttp3
 5. Glide
 6. Databinding
 7. Navigation Component
 8. Room

# LICENSE
MIT License
```
Copyright (c) 2019 Edward Bryan Abergas

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

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

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


text:
# PSyclone Wrapper Library for LFRic

This is a wrapper library that maps PSyclone's PSyData profiling API
to the timer functionality provided in LFRic.

## Dependencies

While this wrapper library uses LFRic infrastructure code for the timer,
the library itself can be used independent of LFRic for any code. The
``Makefile`` will create two different versions of the library:
- ``libpsy_lfric_timer.a``

  This version needs to be linked with the
  LFRic infrastructure library, which provides the actual timer
  code (and dependencies for the timer). This version is meant to be
  used for LFRic, since the corresponding objects files are already
  included in the LFRic build. In order to compile this library using
  already compiled LFRic code, you can use the following command:
  ```
  LFRIC_DIR=$SOME_PATH/lfric/trunk/miniapps/gravity_wave/working/utilities/ make libpsy_lfric_timer.a

  ```
  This will pick up the module file for the LFRic timer from the
  specified directory.

- ``libpsy_lfric_timer_standalone.a``

  This version of the library contains all dependencies to use the
  LFRic timer and can be used with any application. It uses the files
  of the simplified LFRic infrastructure library contained in
  ``../../../src/psyclone/tests/test_files/dynamo0p3/infrastructure``.

## Compilation

Compilation is done with ``make``. You can adjust the variables
``F90`` and ``F90FLAGS`` to point to your Fortran compiler and the
compiler flags you want to use. The output is written to the file
``timer.txt``, which will be overwritten if it already exists.

Example output:

```
$ less timer.txt
||=           Routine            =||=   min time(s)     =||=   mean time(s)    =||=   max time(s)     =||=     No. calls     =||=       %time       =||= time per call(s)  =||
||            psy_test:invoke_0:r0||                 0.00||                 0.00||                 0.00||                    1||               100.00||                 0.00||
||psy_test:invoke_1_update_field:u||                 0.00||                 0.00||                 0.00||                    1||                37.11||                 0.00||

```

repository: yqin/PSyclone

repo_name: yqin/PSyclone


text:
# InventoryManager

This is a C++ based program for managing a grocery store's inventory. It is extensible enough to allow for any type of inventory management, but my team has decided to base it on a Grocery Store. Inventory Manager's focus is from a corporate view point, but does offer a customer cart and client side transactions.  This is for our Advanced Object Oriented Design Class.

## Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

### Prerequisites

[Visual Studio](https://visualstudio.microsoft.com/)
[Qt](https://www.qt.io/developers/) - GUI

### Installing

1. Install Visual Studio if not installed.
2. Clone or download this repository.
3. Add files to a project.
4. Install QT.
5. * TBD

More to come on this

## Running the tests

Explain how to run the automated tests for this system

### Break down into end to end tests

Explain what these tests test and why

```
Give an example
```

### And coding style tests

Explain what these tests test and why

```
Give an example
```

## Deployment

Add additional notes about how to deploy this on a live system

## Built With

* [Visual Studio](https://visualstudio.microsoft.com/)
* [Qt](https://www.qt.io/developers/) - GUI

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).

## Authors

* **Shane Kavage** - *Initial work* - Concept, Planning, Item Hierarchy and Inventory Handling
* **Tyler Kavage** - *Initial work* - Concept, Planning, GUI
* **Jake Arsenau** - *Initial work* - Concept, Planning, File Reading and Writing

See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.

## License

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

## Acknowledgments
* Inspiration
* etc


text:
ABWebDevelopers\PinPayments\Endpoint\Recipients
===============

* Class name: Recipients
* Namespace: ABWebDevelopers\PinPayments\Endpoint
* Parent class: [ABWebDevelopers\PinPayments\Endpoint\Endpoint](ABWebDevelopers-PinPayments-Endpoint-Endpoint.md)

Properties
----------

### $client

    protected mixed $client

* Visibility: **protected**

Methods
-------

### post

    mixed ABWebDevelopers\PinPayments\Endpoint\Recipients::post(\ABWebDevelopers\PinPayments\Entity\Recipient $recipient)

* Visibility: **public**

#### Arguments
* $recipient **[ABWebDevelopers\PinPayments\Entity\Recipient](ABWebDevelopers-PinPayments-Entity-Recipient.md)**

### get

    mixed ABWebDevelopers\PinPayments\Endpoint\Recipients::get(\ABWebDevelopers\PinPayments\Entity\Recipient $recipient)

* Visibility: **public**

#### Arguments
* $recipient **[ABWebDevelopers\PinPayments\Entity\Recipient](ABWebDevelopers-PinPayments-Entity-Recipient.md)**

### getAll

    mixed ABWebDevelopers\PinPayments\Endpoint\Recipients::getAll()

* Visibility: **protected**

### getDetails

    mixed ABWebDevelopers\PinPayments\Endpoint\Recipients::getDetails(\ABWebDevelopers\PinPayments\Entity\Recipient $recipient)

* Visibility: **protected**

#### Arguments
* $recipient **[ABWebDevelopers\PinPayments\Entity\Recipient](ABWebDevelopers-PinPayments-Entity-Recipient.md)**

### put

    mixed ABWebDevelopers\PinPayments\Endpoint\Recipients::put(\ABWebDevelopers\PinPayments\Entity\Recipient $recipient)

* Visibility: **public**

#### Arguments
* $recipient **[ABWebDevelopers\PinPayments\Entity\Recipient](ABWebDevelopers-PinPayments-Entity-Recipient.md)**

### getTransfers

    mixed ABWebDevelopers\PinPayments\Endpoint\Recipients::getTransfers(\ABWebDevelopers\PinPayments\Entity\Recipient $recipient)

* Visibility: **public**

#### Arguments
* $recipient **[ABWebDevelopers\PinPayments\Entity\Recipient](ABWebDevelopers-PinPayments-Entity-Recipient.md)**

### __construct

    mixed ABWebDevelopers\PinPayments\Endpoint\Endpoint::__construct(\ABWebDevelopers\PinPayments\ApiClient $client)

* Visibility: **public**
* This method is defined by [ABWebDevelopers\PinPayments\Endpoint\Endpoint](ABWebDevelopers-PinPayments-Endpoint-Endpoint.md)

#### Arguments
* $client **[ABWebDevelopers\PinPayments\ApiClient](ABWebDevelopers-PinPayments-ApiClient.md)**


text:
## :first-of-type [**Back**](./../pseudoClass.md)

- `:first-of-type` is a pseudo-class selector that selects an element that is the first element (sibling(兄弟姐妹關係)) of its type in the list of children of its parent.

#### Case: understanding `:first-of-type`

See the Pen OMxrLj by aleen42 (@aleen42) on CodePen.

#### Note

- Differences between `:first-child` and `:first-of-type` is:

```html
<article>
    <h1>Article Title</h1>
    <p>
        First paragraph.
    </p>
    <p>
        Second paragraph.
    </p>
    <!-- .... -->
</article>
```

```css
p:first-child {
    /** styles is not applied because there is a h1 tag before the p tag */
}

p:first-of-type {
    /** stsyles will applied to the first paragrath */
}
```

repository: ackuser/css

repo_name: ackuser/css


text:
React Live

A flexible playground for live editing React code

**React Live** brings you the ability to render React components with editable source code and live preview.
It supports server-side rendering and comes in a tiny bundle.

The library is structured modularly and lets you style and compose its components freely.

## Usage

Install it with `npm install react-live` or `yarn add react-live` and try out this piece of JSX:

```js
import {
  LiveProvider,
  LiveEditor,
  LiveError,
  LivePreview
} from 'react-live'

<LiveProvider code="<strong>Hello World!</strong>">
  <LiveEditor />
  <LiveError />
  <LivePreview />
</LiveProvider>
```

## Demo

[https://react-live.kitten.sh/](https://react-live.kitten.sh/)

## FAQ

### How does it work?

It takes your code and transpiles it with [Bublé](https://github.com/bublejs/buble), while the code is displayed using [`react-simple-code-editor`](https://github.com/satya164/react-simple-code-editor) and the code is highlighted using [`prism-react-renderer`](https://github.com/FormidableLabs/prism-react-renderer).

The transpiled code is then rendered in the preview component (`LivePreview`), which does a fake mount if the code
is a React component.

### What code can I use?

The code can be one of the following things:

- React elements, e.g. `<strong>Hello World!</strong>`
- React pure functional components, e.g. `() => <strong>Hello World!</strong>`
- React component classes

If you enable the `noInline` prop on your `LiveProvider`, you’ll be able to write imperative code,
and render one of the above things by calling `render`.

### How does the scope work?

The `scope` prop on the `LiveProvider` accepts additional globals. By default it injects `React` only, which
means that the user can use it in their code like this:

```js
//                    ↓↓↓↓↓
class Example extends React.Component {
  render() {
    return <strong>Hello World!</strong>
  }
}
```

But you can of course pass more things to the scope. They will be available as variables in the code. Here's an example using [styled components](https://github.com/styled-components/styled-components):

```js
import styled from 'styled-components';

const headerProps = { text: 'I\'m styled!' };

const scope = {styled, headerProps};

const code = `
  const Header = styled.div\`
    color: palevioletred;
    font-size: 18px;
  \`

  render(<Header>{headerProps.text}</Header>)
`

<LiveProvider code={code} scope={scope} noInline={true}>
  <LiveEditor />
  <LiveError />
  <LivePreview />
</LiveProvider>
```

Here's an example using a custom component `<MyButton />`. This component lives in a different directory. It gets passed into the scope wrapped in an Object. Note that since we are not using `render()` in the code snippet we let `noInline` stay equal to the default of `false`:

```js

import { MyButton } from './components/MyButton';

const scope = { MyButton };

const code = `
  <MyButton />
`

<LiveProvider code={code} scope={scope}>
  <LiveEditor />
  <LiveError />
  <LivePreview />
</LiveProvider>
```

### What bundle size can I expect?

Our reported bundle size badges don't give you the full picture of
the kind of sizes you will get in a production app. The minified
bundles we publish _exclude_ some dependencies that we depend
on.

In an actual app when you use `react-live` you will also be bundling
Buble for transpilation, which adds `~135kB` to your bundle. This also
includes their dependency on `regenerate-unicode-properties`, which
is rather large as well.

We maintain a fork of Buble which excludes the ESnext Regular Expression
transpilation with removes Buble's large dependency and weighs in at
a smaller size of `~51kB`, which you can find published at [`@philpl/buble`](http://npm.im/@philpl/buble).

You can alias this in Webpack or the build tool of your choice, which
will reduce the overall bundle size of `react-live` to about `83kB`.

## API

### <LiveProvider />

This component provides the `context` for all the other ones. It also transpiles the user’s code!
It supports these props, while passing any others through to the `children`:

|Name|PropType|Description|
|---|---|---|
|code|PropTypes.string|The code that should be rendered, apart from the user’s edits
|scope|PropTypes.object|Accepts custom globals that the `code` can use
|noInline|PropTypes.bool|Doesn’t evaluate and mount the inline code (Default: `false`). Note: when using `noInline` whatever code you write must be a single expression (function, class component or some `jsx`) that can be returned immediately. If you'd like to render multiple components, use `noInline={true}`
|transformCode|PropTypes.func|Accepts and returns the code to be transpiled, affording an opportunity to first transform it
|language|PropTypes.string|What language you're writing for correct syntax highlighting. (Default: `jsx`)
|disabled|PropTypes.bool|Disable editing on the `<LiveEditor />` (Default: `false`)
|theme|PropTypes.object|A `prism-react-renderer` theme object. See more [here](https://github.com/FormidableLabs/prism-react-renderer#theming)

All subsequent components must be rendered inside a provider, since they communicate
using one.

The `noInline` option kicks the Provider into a different mode, where you can write imperative-style
code and nothing gets evaluated and mounted automatically. Your example will need to call `render`
with valid JSX elements.

### <LiveEditor />

This component renders the editor that displays the code. It is a wrapper around [`react-simple-code-editor`](https://github.com/satya164/react-simple-code-editor) and the code highlighted using [`prism-react-renderer`](https://github.com/FormidableLabs/prism-react-renderer).

### <LiveError />

This component renders any error that occur while executing the code, or transpiling it.
It passes through any props to a `pre`.

> Note: Right now when the component unmounts, when there’s no error to be shown.

### <LivePreview />

This component renders the actual component that the code generates inside an error boundary.

|Name|PropType|Description|
|---|---|---|
|Component|PropTypes.node|Element that wraps the generated code. (Default: `div`)

### withLive

The `withLive` method creates a higher-order component, that injects the live-editing props provided
by `LiveProvider` into a component.

Using this HOC allows you to add new components to react-live, or replace the default ones, with a new
desired behavior.

The component wrapped with `withLive`  gets injected the following props:

|Name|Type|Description|
|---|---|---|
|code|string|Reflects the code that is passed in as the `code` prop
|error|string|An error that the code has thrown when it was previewed
|onError|function|A callback that, when called, changes the error to what's passed as the first argument
|onChange|function|A callback that accepts new code and transpiles it
|element|React.Element|The result of the transpiled code that is previewed

> Note: The code prop doesn't reflect the up-to-date code, but the `code` prop, that is passed to the `LiveProvider`.

## FAQ
> **I want to use experimental feature x but Bublé doesn't support it! Can I use babel instead?**

`react-live` doesn't currently support configuring the transpiler and it ships with Bublé.  The current workaround for using some experimental features `bublé` doesn't support  would be to use the `transformCode` prop on `LiveProvider` to transform your code with `babel` alongside `bublé`.

Here is a  minimal example on how you could use `babel` to support class-properties in `react-live`:

[![Edit 7ml9mjw766](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/7ml9mjw766?fontsize=14)

## Comparison to [component-playground](https://github.com/FormidableLabs/component-playground)

There are multiple options when it comes to live, editable React component environments. Formidable actually has **two** first class projects to help you out: [`component-playground`](https://github.com/FormidableLabs/component-playground) and [`react-live`](https://github.com/FormidableLabs/react-live). Let's briefly look at the libraries, use cases, and factors that might help in deciding which is right for you.

Here's a high-level decision tree:

- If you want **fast and easy** setup and integration, then `component-playground` may be the ticket!
- If you want **a smaller bundle**, **SSR**, and **more flexibility**, then `react-live` is for you!

Here are the various factors at play:

- **Build**: `component-playground` uses `babel-standalone`, `react-live` uses `bublé`. (_Note_: `react-live` might make transpiler customizable in the future).
- **Bundle size**: `component-playground` has a larger bundle, but uses a more familiar editor setup. `react-live` is smaller, but more customized editor around `prism`.
- **Ease vs. flexibility**: `react-live` is more modular/customizable, while `component-playground` is easier/faster to set up.
- **SSR**: `component-playground` is not server-side renderable, `react-live` is.
- **Extra features**: `component-playground` supports raw evaluation and pretty-printed output out-of-the-box, while `react-live` does not.
- **Error handling**: `component-playground` might have more predictable error handling than `react-live` in some cases (due to `react-dom`, although this might change with React 16).

## Maintenance Status

**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.

repository: Jonathansoufer/meetapp

repo_name: Jonathansoufer/meetapp


text:
# moneymoney-datev-kassenbuch
A Python script that converts a MoneyMoney export to the DATEV Kassenbuch CSV format

I am using [MoneyMoney](https://moneymoney-app.com/) for my (business) online banking.
One of the monthly bookkeeping tasks is to export the account statement for my business
credit card and import them into DATEV (which, unlike the checking account, can't automatically
import these from my bank). Unfortunately, the MoneyMoney CSV format does not match DATEV's,
so I wrote a Python script that reads a MoneyMoney export and converts it into DATEV Kassenbuch
compatible csv files (one for each month).

repository: lukasklein/moneymoney-datev-kassenbuch

repo_name: lukasklein/moneymoney-datev-kassenbuch


text:
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPAppAuthAccessToken.html
external help file: PnP.PowerShell.dll-Help.xml
title: Get-PnPAppAuthAccessToken
---

# Get-PnPAppAuthAccessToken

## SYNOPSIS
Returns the access token for SharePoint Online

## SYNTAX

```powershell
Get-PnPAppAuthAccessToken [-Connection <PnPConnection>]
```

## DESCRIPTION
Returns the SharePoint Online access token from the current client context. This will only work in the App authentication flow (App+user or App-Only). For the Microsoft Graph access token, use `Get-PnPAccessToken` instead.

## EXAMPLES

### EXAMPLE 1
```powershell
$accessToken = Get-PnPAppAuthAccessToken
```

This will put the SharePoint Online access token from current context in the $accessToken variable

## PARAMETERS

### -Connection
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

```yaml
Type: PnPConnection
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

repository: radityoardi/PnP-PowerShell

branch_name: refs/heads/dev

repo_name: radityoardi/PnP-PowerShell


text:
# Alien Race Unit Tests

This subproject adds unit tests to the AlienRaces Mod using the [NUnit](https://docs.nunit.org/) C# testing framework.
Nothing from this project should ever be copied to the Release folder.

## Do I have to use the tests
NO!

We definitely encourage use of the tests to make sure your changes work well but automated testing can be daunting at first.
If this is too much, don't worry about it. It is a great skill to pick up though.
Start slow and ask questions if you need to. Unit tests do not replace play testing.
They are simply another option.

## Why tests
Unit tests allow us to confirm simple things, like that we can parse Genders from XML. As well as that the complex multi-layered fallbacks work as intended given known inputs.

Writing a test for the current behaviour before you make a change allows you to be confident your change hasn't broken what worked before.
It also allows us to test small things, ideally single functions behave as we expect without the complexity of the rest of the Rimworld process.

It also allows us to ask what if style questions like: what does happen if you get a pawn with no backstory?

It also makes it easier to contribute. Contributors can feel happier making changes because they can see there are tests that will catch their mistakes.
They also can copy and adapt existing tests to help them make changes and see what happens on a small scale long before it's all hooked into the game.

It can also help contributors to understand what is actually going on. What *should* happen if there's no graphic for a specific body-addon?
Contributors can read the code but in complex code-bases like this it can be daunting.
Indeed we don't even know if a piece of current behaviour is intended. By writing a test you are asserting what you expect to happen and making sure it won't change unintentionally.
Even the names of tests can answer the questions without needing to actually read the test. Test names should tell you what the expectation is for what input and then prove it!

## How do I run the tests
In Visual Studio or Rider you simply need to right click on the test project and choose `Run unit tests`
The exact wording may vary. This will run the tests and give you a lovely screen telling you how many tests passed and failed
as well as any output and you can double click on tests to go to the code.

If you are using VSCode or Notepad++ or other text editors there are other plugins.
But in general outside of IDEs NUnit provides a console runner and a GUI.
You can read more about this on the [NUnit website](https://docs.nunit.org/articles/nunit/running-tests/Index.html)

To make sure NUnit ConsoleRunner is installed you may need to run `dotnet restore` and or `nuget restore` to install the packages listed in the `packages.config`
This puts the NUnit ConsoleRunner into the `packages` folder.

In order for the tests to find the test data files this command assumes you change directory into the `AlienRaceTest` folder then run a command something like this:

```powershell
..\packages\NUnit.ConsoleRunner.3.15.0\tools\nunit3-console.exe --work=testOutput .\AlienRaceTest.csproj
```

As you can see we call `nunit3-console.exe` we then tell it to dump all the files it may make into the `testOutput` folder using the `--work` argument.
This has been added to the `.gitignore` so we recommend you just use this folder for simplicity.
NUnit makes some log files on every call and because at the CLI you don't have a pretty UI it puts the results in a `TestResult.xml` file.

There are many other options such as `--noresult` and `--inprocess` which can further reduce the output if all you want to see is if the tests pass.

When it's finished you should see something like this:
```text
Test Run Summary
  Overall result: Passed
  Test Count: 16, Passed: 16, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2022-07-30 02:55:50Z
    End time: 2022-07-30 02:55:52Z
    Duration: 1.922 seconds
```

As you can see I have 16 passing tests, lovely :)

### Why not just run the tests on Github
That would be ideal. Github can easily run these for you.
However to do so it would need the Rimworld DLLs.
I do not believe the license permits including the Rimworld DLLs themselves.
So the tests must sadly be run on a machine with Rimworld installed.
And thus cannot be run automatically on Github.

## Writing tests
This section gives a little guidance on writing your own tests.

### What should we be testing
Some things are very hard to test particularly in games like Rimworld which make heavy use of reflection and static methods.
Testing harmony patches work as intended for example is really quite hard. These things are not worth spending time on.

You want to test small functions in isolation, using as little of Rimworld as possible.
Rimworld code can change so you mostly want to test only your own code assuming that Rimworld will give you the input you expect.
Should this change you have a clear view of what has changed and can verify things work again after fixing.
You can still test that your harmony patches do as expected in isolation if you like but testing the whole Harmony patching system is probably not worthwhile.

A guiding principle is not to test your libraries so don't bother checking that the library works as intended.

Test any situation you think is worth making clear what you expect to happen.
Also if you find a bug it can be worth writing a test!
Make a test that causes the bug, then fix the bug and boom green test!
This means you fixed it, it won't come back and it can help others not fall into the same trap.

When you have things that read XML, make a test to confirm it can read things as you expect.
Maybe add tests for weird things like what if the backstory has spaces?
I like to test both a tiny piece of config and that a whole block of config can still be read properly and completely.

### Wrapping things that are hard to test
The Rimworld Pawn class is a great example.
It is possible to make a `Verse.Pawn` very easily, but depending on what you do it may try and do things you don't want.
So rather than passing a `Pawn` around directly you can simply wrap it in something you have complete control over.
The `BodyAddonPawnWrapper` has the dual benefit of making the code using pawns a lot easier to read but also,
because that's what is being passed in we can mock that and hide away all the calls to functions that might cause us problems.
Testing the wrapper itself is hard but as long as it is fairly simple we can still test all the hard code.
We don't need to test that Rimworld gives us the right backstory.

### What is a mock?
When you're trying to test your code you want to keep it as isolated as possible.
A mock simply allows you to replace almost any non static object with something that looks the same,
but where it doesn't actually _do_ anything.

What you care about is what your code does with the returned `Building_Bed`.
So you Mock the pawn making something that looks like a Pawn but always returns a specific bed.
You can chain this on so if a `Building_Bed` is hard to work with,
Simply return a Mock bed as well. Your code will be able to work with it like it was real.
By default though everything will return null or some default.
To make the mock do what you want you have to tell it using the `Setup` methods.

For example:
```csharp
Mock<BodyAddonPawnWrapper> mockPawnWrapper = new Mock<BodyAddonPawnWrapper>();
    mockPawnWrapper.Setup(p => p.CurrentLifeStageDefMatches(this.mockOtherAdultLifestageDef.Object))
                   .Returns(true);
```
First I make a mock that can stand in for a real `BodyAddonPawnWrapper`
Then I say when someone calls `CurrentLifeStageDefMatches`,
specifically when they call it with another mock I made earlier `mockOtherAdultLifestageDef`
then I want it to return true. So in this way I'm saying when you see this thing I gave you earlier, assume it does match that life stage.
But I never had to call the potentially complicated code to do that check. It doesn't matter.
It's just been replaced.

You might notice the `.Object` on that match, that's just because the Mock is of type `Mock<BodyAddonPawnWrapper>`.
The `.Object` simply makes it back into the `BodyAddonPawnWrapper` type that the function expects.

The cool thing is you can then ask the mock after you're done with it what happened to it.
If you were expecting something to happen you can check that it did. Such is the power of Mocking.

Do take a look at some of the existing tests to see how this works.

We are using the [Moq](https://github.com/Moq/moq4/wiki/Quickstart) framework for this.

Mocking is quite verbose though, it's usually not worth Mocking simple things.
Mock complex things that try to interact with other parts of Rimworld and cause you problems.

### Things that we've worked around
Static functions can't easily be replaced or intercepted.
One big example is the logger, this uses some internal unity thing which is hard to swap out in tests.
The TestSupport folder contains a helpful base class which resolves some of these common issues.
Things like the logger and trying to load a save for example.
We use reflection to simply set the field to something we control to avoid calling the code that is hard to work with.

Hopefully you don't run into any of these, if you do it may not be worth your time to fix it.
Unit testing is only one tool in making stable software. If it's too problematic, test a different way and don't worry about it.

repository: erdelf/AlienRaces

gha_language: C#

repo_name: erdelf/AlienRaces


text:
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.5.1](https://github.com/microlinkhq/keyv/compare/v1.5.0...v1.5.1) (2021-09-16)

**Note:** Version bump only for package @keyvhq/memoize

# [1.4.0](https://github.com/microlinkhq/keyv/compare/v1.3.0...v1.4.0) (2021-09-12)

**Note:** Version bump only for package @keyvhq/memoize

# [1.3.0](https://github.com/microlinkhq/keyv/compare/v1.2.7...v1.3.0) (2021-09-01)

**Note:** Version bump only for package @keyvhq/memoize

## [1.2.7](https://github.com/microlinkhq/keyv/compare/v1.2.6...v1.2.7) (2021-08-24)

**Note:** Version bump only for package @keyvhq/memoize

## [1.2.6](https://github.com/microlinkhq/keyv/compare/v1.2.5...v1.2.6) (2021-08-24)

**Note:** Version bump only for package @keyvhq/memoize

## [1.2.5](https://github.com/microlinkhq/keyv/compare/v1.2.4...v1.2.5) (2021-08-19)

### Features

* **memoize:** add a way to invalidate on demand ([82e713b](https://github.com/microlinkhq/keyv/commit/82e713b3e73686598f2a5a815467aa9ba6e7d532))

## [1.2.4](https://github.com/microlinkhq/keyv/compare/v1.2.3...v1.2.4) (2021-08-19)

### Bug Fixes

* stale ttl value could be 0 ([694ea16](https://github.com/microlinkhq/keyv/commit/694ea1680eac5245c78af296033fa96c845ca9f4))

## [1.2.3](https://github.com/microlinkhq/keyv/compare/v1.2.2...v1.2.3) (2021-08-17)

### Bug Fixes

* indent ([0e2c243](https://github.com/microlinkhq/keyv/commit/0e2c243d687676ed200ac4390d2c30be79db19f1))

## [1.2.2](https://github.com/microlinkhq/keyv/compare/v1.2.1...v1.2.2) (2021-08-16)

**Note:** Version bump only for package @keyvhq/memoize

## [1.2.1](https://github.com/microlinkhq/keyv/compare/v1.2.0...v1.2.1) (2021-08-12)

**Note:** Version bump only for package @keyvhq/memoize

# [1.2.0](https://github.com/microlinkhq/keyv/compare/v1.1.1...v1.2.0) (2021-08-11)

### Bug Fixes

* clear pending after stale is refreshed ([ee49c03](https://github.com/microlinkhq/keyv/commit/ee49c03b1e6f88231b385f16b2e1ab0688464333))

### Features

* expose more memoize methods ([c032e93](https://github.com/microlinkhq/keyv/commit/c032e939e787bfadf587cd89fde2a9f225307ac5))

## [1.1.1](https://github.com/microlinkhq/keyv/compare/v1.1.0...v1.1.1) (2021-07-30)

**Note:** Version bump only for package @keyvhq/memoize

# [1.1.0](https://github.com/microlinkhq/keyv/compare/v1.0.2...v1.1.0) (2021-07-30)

### Features

* add memoize package ([25e1c4f](https://github.com/microlinkhq/keyv/commit/25e1c4f94115dc99e72d1dca28c3e31211d45b5a))

repository: forkkit/keyv

repo_name: forkkit/keyv


text:
PortAudio.jl
============

PortAudio.jl is a wrapper for [libportaudio](http://www.portaudio.com/), which gives cross-platform access to audio devices. It is compatible with the types defined in [SampledSignals.jl](https://github.com/JuliaAudio/SampledSignals.jl). It provides a `PortAudioStream` type, which can be read from and written to.

## Opening a stream

The easiest way to open a source or sink is with the default `PortAudioStream()` constructor, which will open a 2-in, 2-out stream to your system's default device(s). The constructor can also take the input and output channel counts as positional arguments, or a variety of other keyword arguments.

```julia
PortAudioStream(inchans=2, outchans=2; eltype=Float32, samplerate=48000Hz, bufsize=4096)
```

You can open a specific device by adding it as the first argument, either as a `PortAudioDevice` instance or by name. You can also give separate names or devices if you want different input and output devices

```julia
PortAudioStream(device::PortAudioDevice, args...; kwargs...)
PortAudioStream(devname::AbstractString, args...; kwargs...)
```

You can get a list of your system's devices with the `PortAudio.devices()` function:

```julia
julia> PortAudio.devices()
6-element Array{PortAudio.PortAudioDevice,1}:
 PortAudio.PortAudioDevice("AirPlay","Core Audio",0,2,0)
 PortAudio.PortAudioDevice("Built-in Microph","Core Audio",2,0,1)
 PortAudio.PortAudioDevice("Built-in Output","Core Audio",0,2,2)
 PortAudio.PortAudioDevice("JackRouter","Core Audio",2,2,3)
 PortAudio.PortAudioDevice("After Effects 13.5","Core Audio",0,0,4)
 PortAudio.PortAudioDevice("Built-In Aggregate","Core Audio",2,2,5)
```

## Reading and Writing

The `PortAudioStream` type has `source` and `sink` fields which are of type `PortAudioSource <: SampleSource` and `PortAudioSink <: SampleSink`, respectively. are subtypes of `SampleSource` and `SampleSink`, respectively (from [SampledSignals.jl](https://github.com/JuliaAudio/SampledSignals.jl)). This means they support all the stream and buffer features defined there. For example, if you load SampledSignals with `using SampledSignals` you can read 5 seconds to a buffer with `buf = read(stream.source, 5s)`, regardless of the sample rate of the device.

PortAudio.jl also provides convenience wrappers around the `PortAudioStream` type so you can read and write to it directly, e.g. `write(stream, stream)` will set up a loopback that will read from the input and play it back on the output.

## Examples

### Set up an audio pass-through from microphone to speaker

```julia
stream = PortAudioStream()
write(stream, stream)
```

### Open your built-in microphone and speaker by name
```julia
stream = PortAudioStream("Built-in Microph", "Built-in Output")
write(stream, stream)
```

### Record 10 seconds of audio and save to an ogg file

```julia
julia> using PortAudio, SampledSignals, LibSndFile

julia> stream = PortAudioStream("Built-in Microph", 2, 0)
PortAudio.PortAudioStream{Float32,SIUnits.SIQuantity{Int64,0,0,-1,0,0,0,0,0,0}}
  Samplerate: 48000 s⁻¹
  Buffer Size: 4096 frames
  2 channel source: "Built-in Microph"

julia> buf = read(stream, 10s)
480000-frame, 2-channel SampleBuf{Float32, 2, SIUnits.SIQuantity{Int64,0,0,-1,0,0,0,0,0,0}}
10.0 s at 48000 s⁻¹
▁▄▂▃▅▃▂▄▃▂▂▁▁▂▂▁▁▄▃▁▁▄▂▁▁▁▄▃▁▁▃▃▁▁▁▁▁▁▁▁▄▄▄▄▄▂▂▂▁▃▃▁▃▄▂▁▁▁▁▃▃▂▁▁▁▁▁▁▃▃▂▂▁▃▃▃▁▁▁▁
▁▄▂▃▅▃▂▄▃▂▂▁▁▂▂▁▁▄▃▁▁▄▂▁▁▁▄▃▁▁▃▃▁▁▁▁▁▁▁▁▄▄▄▄▄▂▂▂▁▃▃▁▃▄▂▁▁▁▁▃▃▂▁▁▁▁▁▁▃▃▂▂▁▃▃▃▁▁▁▁

julia> save(joinpath(homedir(), "Desktop", "myvoice.ogg"), buf)
```


text:
# Contributing to Xquisite Framework

Welcome, and thank you for your interest in contributing to Xquisite Framework!

There are many ways in which you can contribute, beyond writing code. The goal of this document is to provide a high-level overview of how you can get involved.

Keep checking this space for an update on contributions. For any queries, drop a mail at <a href="xquisite<EMAIL_ADDRESS>

repository: AnirudhMergu/XquisiteFramework

gha_language: Sass

repo_name: AnirudhMergu/XquisiteFramework


text:
# SEEDS

- What is the name of your project?	- What is the name of your project?
Answer:	Answer: SEEDS - Regenerate Money

- What is your project about? What is your mission & vision?	- What is your project about? What is your mission & vision?
Answer:	Answer: A regenerative financial system for a thriving global society. SEEDS is a global movement that aligns radical empowerment of purpose with finance with the mission to bring about a modern day Renaissance.

- How will this benefit the earth and why do you think this is relevant? 	- How will this benefit the earth and why do you think this is relevant?
Answer:	Answer: We're leaving the age of siloed competition where people and planet were exploited by systems and entering an age of cooperation where the people are in direct control and ownership of the abundant systems they inhabit.

- What is the link between ThreeFold and your project? 	- What is the link between ThreeFold and your project?
Answer:	Answer: SEEDS and Threefold are a natural pair a decentralized cooperative internet to run a decentralized cooperative financial system.

- How will your project use the ThreeFold grid and / or 3Bot?	- How will your project use the ThreeFold grid and / or 3Bot?
Answer:	Answer: We intend to integrate our systems. Together we provide essential tools for shaping a civilization which is more resilient, rewarding, and regenerative.

### Roadmap	### Roadmap

- Generic explanation: what is there today, what is coming up?	- Generic explanation: what is there today, what is coming up?
Answer:	Answer: The evidence is clear, the current system is reaching a historical moment that demands a paradigmatic shift. Since its alpha release on November 5th 2019 and its public launch in March 2020, SEEDS has gathered 150+ alliance members from across multiple bioregions. We are in the stage of cultivating a grassroots movement uniting the people and organizations dedicated to a breakthrough towards genuine sustainability, freedom, and peace.

- How does your project intend to measure impact?	- How does your project intend to measure impact?
Answer:	Answer: Holistic approaches are accomplished by evaluating the effectiveness through all four dimensions of natural, human, social and built capital. We measure effectiveness based on the valuation of all outcomes with the understanding that human activity should enhance the environment and the community by providing benefits to the majority and not only a few.

```python

[milestone]

name = "Go Live Event"
#date format: YYYY/MM
date = "21/06"
funding_required_tft = ""
funding_required_usd = ""
description ="Triggered by the citizens of SEEDS"

[milestone]
name = ""
date = ""
funding_required_tft = ""
funding_required_usd = ""
description ="Please provide more details about this milestone.."

```

### data

```python
[links]
linkedin = "https://www.linkedin.com/company/seeds-the-conscious-currency/"

websites = ["https://www.joinseeds.com/"]
wiki = ""
video = "https://player.vimeo.com/video/412275062"

[info]
team = []
countries = ["Global"]
cities = ["Global"]

[ecosystem]
# can be chosen from: experiencecreator, experiencepartner, solutionprovider, farmer, systemintegrator
categories = ["experiencepartner"]
# can be chosen from: tftgranted (receiving TFT Grant), planetfirstalliance (memeber of Planet First Alliance)
badges = []
```


text:
# PyTorch CapsNet: Capsule Network for PyTorch

[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/cedrickchee/capsule-net-pytorch/blob/master/LICENSE)
![completion](https://img.shields.io/badge/completion%20state-95%25-green.svg?style=plastic)

A CUDA-enabled PyTorch implementation of CapsNet (Capsule Network) based on this paper:
[Sara Sabour, Nicholas Frosst, Geoffrey E Hinton. Dynamic Routing Between Capsules. NIPS 2017](https://arxiv.org/abs/1710.09829)

The current `test error is 0.21%` and the `best test error is 0.20%`. The current `test accuracy is 99.31%` and the `best test accuracy is 99.32%`.

**What is a Capsule**

> A Capsule is a group of neurons whose activity vector represents the instantiation parameters of a specific type of entity such as an object or object part.

You can learn more about Capsule Networks [here](#learning-resources).

**Why another CapsNet implementation?**

I wanted a decent PyTorch implementation of CapsNet and I couldn't find one at the point when I started. The goal of this implementation is focus to help newcomers learn and understand the CapsNet architecture and the idea of Capsules. The implementation is **NOT** focus on rigorous correctness of the results. In addition, the codes are not optimized for speed. To help us read and understand the codes easier, the codes comes with ample comments and the Python classes and functions are documented with Python docstring.

I will try my best to check and fix issues reported. Contributions are highly welcomed. If you find any bugs or errors in the codes, please do not hesitate to open an issue or a pull request. Thank you.

**Status and Latest Updates:**

See the [CHANGELOG](CHANGELOG.md)

**Datasets**

The model was trained on the standard [MNIST](http://yann.lecun.com/exdb/mnist/) data.

*Note: you don't have to manually download, preprocess, and load the MNIST dataset as [TorchVision](https://github.com/pytorch/vision) will take care of this step for you.*

I have tried using other datasets. See the [Other Datasets](#other-datasets) section below for more details.

## Requirements
- Python 3
  - Tested with version 3.6.4
- [PyTorch](http://pytorch.org/)
    - Tested with version 0.3.0.post4
    - Code will not run with version 0.1.2 due to `keepdim` not available in this version.
    - Code will not run with version 0.2.0 due to `softmax` function doesn't takes a dimension.
- CUDA 8 and above
  - Tested with CUDA 8 and CUDA 9.
- [TorchVision](https://github.com/pytorch/vision)
- [tensorboardX](https://github.com/lanpa/tensorboard-pytorch)
- [tqdm](https://github.com/tqdm/tqdm)

## Usage

### Training and Evaluation
**Step 1.**
Clone this repository with ``git`` and install project dependencies.

```bash
$ git clone https://github.com/cedrickchee/capsule-net-pytorch.git
$ cd capsule-net-pytorch
$ pip install -r requirements.txt
```

**Step 2.**
Start the CapsNet on MNIST training and evaluation:

- Training with default settings:
```bash
$ python main.py
```

- Training on 8 GPUs with 30 epochs and 1 routing iteration:
```bash
$ CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python main.py --epochs 30 --num-routing 1 --threads 16 --batch-size 128 --test-batch-size 128
```

**Step 3.**
Test a pre-trained model:

If you have trained a model in Step 2 above, then the weights for the trained model will be saved to `results/trained_model/model_epoch_10.pth`. [WIP] Now just run the following command to get test results.

```bash
$ python main.py --is-training 0 --weights results/trained_model/model_epoch_10.pth
```

### Pre-trained Model

You can download the weights for the pre-trained model from my Google Drive. We saved the weights (model state dict) and the optimizer state for the model at the end of every training epoch.

- Weights from [epoch 50 checkpoint](https://drive.google.com/uc?export=download&id=1lYtOMSreP4I9hr9un4DsBJZrzodI6l2d) [84 MB].
- Weights from [epoch 40 to 50](https://drive.google.com/uc?export=download&id=1VMuVtJrecz47czsT5HqLxZpFjkLoMKaL) checkpoints [928 MB].

Uncompress and put the weights (.pth files) into `./results/trained_model/`.

*Note: the model was **last trained** on 2017-11-26 and the weights **last updated** on 2017-11-28.*

### The Default Hyper Parameters

| Parameter | Value | CLI arguments |
| --- | --- | --- |
| Training epochs | 10 | --epochs 10 |
| Learning rate | 0.01 | --lr 0.01 |
| Training batch size | 128 | --batch-size 128 |
| Testing batch size | 128 | --test-batch-size 128 |
| Log interval | 10 | --log-interval 10 |
| Disables CUDA training | false | --no-cuda |
| Num. of channels produced by the convolution | 256 | --num-conv-out-channel 256 |
| Num. of input channels to the convolution | 1 | --num-conv-in-channel 1 |
| Num. of primary unit | 8 | --num-primary-unit 8 |
| Primary unit size | 1152 | --primary-unit-size 1152 |
| Num. of digit classes | 10 | --num-classes 10 |
| Output unit size | 16 | --output-unit-size 16 |
| Num. routing iteration | 3 | --num-routing 3 |
| Use reconstruction loss | true | --use-reconstruction-loss |
| Regularization coefficient for reconstruction loss | 0.0005 | --regularization-scale 0.0005 |
| Dataset name (mnist, cifar10) | mnist | --dataset mnist |
| Input image width to the convolution | 28 | --input-width 28 |
| Input image height to the convolution | 28 | --input-height 28 |

## Results

### Test Error

CapsNet classification test error on MNIST. The MNIST average and standard deviation results are reported from 3 trials.

The results can be reproduced by running the following commands.

```bash
 python main.py --epochs 50 --num-routing 1 --use-reconstruction-loss no --regularization-scale 0.0       #CapsNet-v1
 python main.py --epochs 50 --num-routing 1 --use-reconstruction-loss yes --regularization-scale 0.0005   #CapsNet-v2
 python main.py --epochs 50 --num-routing 3 --use-reconstruction-loss no --regularization-scale 0.0       #CapsNet-v3
 python main.py --epochs 50 --num-routing 3 --use-reconstruction-loss yes --regularization-scale 0.0005   #CapsNet-v4
```

Method | Routing | Reconstruction | MNIST (%) | *Paper*
:---------|:------:|:---:|:----:|:----:
Baseline |  -- | -- | -- | *0.39*
CapsNet-v1 | 1 | no | -- | *0.34 (0.032)*
CapsNet-v2 | 1 | yes | -- | *0.29 (0.011)*
CapsNet-v3 | 3 | no | -- | *0.35 (0.036)*
CapsNet-v4 | 3 | yes | 0.21 | *0.25 (0.005)*

### Training Loss and Accuracy

The training losses and accuracies for CapsNet-v4 (50 epochs, 3 routing iteration, using reconstruction, regularization scale of 0.0005):

![](results/train_loss_accuracy.png)

Training accuracy. Highest training accuracy: 100%

![](results/train_accuracy.png)

Training loss. Lowest training error: 0.1938%

![](results/train_loss.png)

### Test Loss and Accuracy

The test losses and accuracies for CapsNet-v4 (50 epochs, 3 routing iteration, using reconstruction, regularization scale of 0.0005):

![](results/test_loss_accuracy.png)

Test accuracy. Highest test accuracy: 99.32%

![](results/test_accuracy.png)

Test loss. Lowest test error: 0.2002%

![](results/test_loss.png)

### Training Speed

- Around `5.97s / batch` or `8min / epoch` on a single Tesla K80 GPU with batch size of 704.
- Around `3.25s / batch` or `25min / epoch` on a single Tesla K80 GPUwith batch size of 128.

![](results/training_speed.png)

In my case, these are the hyperparameters I used for the training setup:

- batch size: 128
- Epochs: 50
- Num. of routing: 3
- Use reconstruction loss: yes
- Regularization scale for reconstruction loss: 0.0005

### Reconstruction

The results of CapsNet-v4.

Digits at left are reconstructed images.

[WIP] Ground truth image from dataset

### Model Design

```bash
Model architecture:
------------------

Net (
  (conv1): ConvLayer (
    (conv0): Conv2d(1, 256, kernel_size=(9, 9), stride=(1, 1))
    (relu): ReLU (inplace)
  )
  (primary): CapsuleLayer (
    (conv_units): ModuleList (
      (0): Conv2d(256, 32, kernel_size=(9, 9), stride=(2, 2))
      (1): Conv2d(256, 32, kernel_size=(9, 9), stride=(2, 2))
      (2): Conv2d(256, 32, kernel_size=(9, 9), stride=(2, 2))
      (3): Conv2d(256, 32, kernel_size=(9, 9), stride=(2, 2))
      (4): Conv2d(256, 32, kernel_size=(9, 9), stride=(2, 2))
      (5): Conv2d(256, 32, kernel_size=(9, 9), stride=(2, 2))
      (6): Conv2d(256, 32, kernel_size=(9, 9), stride=(2, 2))
      (7): Conv2d(256, 32, kernel_size=(9, 9), stride=(2, 2))
    )
  )
  (digits): CapsuleLayer (
  )
  (decoder): Decoder (
    (fc1): Linear (160 -> 512)
    (fc2): Linear (512 -> 1024)
    (fc3): Linear (1024 -> 784)
    (relu): ReLU (inplace)
    (sigmoid): Sigmoid ()
  )
)

Parameters and size:
-------------------

conv1.conv0.weight: [256, 1, 9, 9]
conv1.conv0.bias: [256]
primary.conv_units.0.weight: [32, 256, 9, 9]
primary.conv_units.0.bias: [32]
primary.conv_units.1.weight: [32, 256, 9, 9]
primary.conv_units.1.bias: [32]
primary.conv_units.2.weight: [32, 256, 9, 9]
primary.conv_units.2.bias: [32]
primary.conv_units.3.weight: [32, 256, 9, 9]
primary.conv_units.3.bias: [32]
primary.conv_units.4.weight: [32, 256, 9, 9]
primary.conv_units.4.bias: [32]
primary.conv_units.5.weight: [32, 256, 9, 9]
primary.conv_units.5.bias: [32]
primary.conv_units.6.weight: [32, 256, 9, 9]
primary.conv_units.6.bias: [32]
primary.conv_units.7.weight: [32, 256, 9, 9]
primary.conv_units.7.bias: [32]
digits.weight: [1, 1152, 10, 16, 8]
decoder.fc1.weight: [512, 160]
decoder.fc1.bias: [512]
decoder.fc2.weight: [1024, 512]
decoder.fc2.bias: [1024]
decoder.fc3.weight: [784, 1024]
decoder.fc3.bias: [784]

Total number of parameters on (with reconstruction network): 8227088 (8 million)
```

### TensorBoard

We logged the training and test losses and accuracies using tensorboardX. TensorBoard helps us visualize how the machine learn over time. We can visualize statistics, such as how the objective function is changing or weights or accuracy varied during training.

TensorBoard operates by reading TensorFlow data (events files).

#### How to Use TensorBoard

1. Download a [copy of the events files](https://drive.google.com/uc?export=download&id=1lZVffeZTkUQfSxmZmYDViRzmhb59wBWL) for the latest run from my Google Drive.
2. Uncompress the file and put it into `./runs`.
3. Check to ensure you have installed tensorflow (CPU version). We need this for TensorBoard server and dashboard.
4. Start TensorBoard.
```bash
$ tensorboard --logdir runs
```
5. Open TensorBoard dashboard in your web browser using this URL: http://localhost:6006

### Other Datasets

#### CIFAR10

In the spirit of experiment, I have tried using other datasets. I have updated the implementation so that it supports and works with CIFAR10. Need to note that I have not tested throughly our capsule model on CIFAR10.

Here's how we can train and test the model on CIFAR10 by running the following commands.

```bash
python main.py --dataset cifar10 --num-conv-in-channel 3 --input-width 32 --input-height 32 --primary-unit-size 2048 --epochs 80 --num-routing 1 --use-reconstruction-loss yes --regularization-scale 0.0005
```

##### Training Loss and Accuracy

The training losses and accuracies for CapsNet-v4 (80 epochs, 3 routing iteration, using reconstruction, regularization scale of 0.0005):

![](results/cifar10/train_loss_accuracy.png)

- Highest training accuracy: 100%
- Lowest training error: 0.3589%

##### Test Loss and Accuracy

The test losses and accuracies for CapsNet-v4 (80 epochs, 3 routing iteration, using reconstruction, regularization scale of 0.0005):

![](results/cifar10/test_loss_accuracy.png)

- Highest test accuracy: 71%
- Lowest test error: 0.5735%

## TODO
- [x] Publish results.
- [x] More testing.
- [ ] Inference mode - command to test a pre-trained model.
- [ ] Jupyter Notebook version.
- [ ] Create a sample to show how we can apply CapsNet to real-world application.
- [ ] Experiment with CapsNet:
    * [x] Try using another dataset.
    * [ ] Come out a more creative model structure.
- [x] Pre-trained model and weights.
- [x] Add visualization for training and evaluation metrics.
- [x] Implement recontruction loss.
- [x] Check algorithm for correctness.
- [x] Update results from TensorBoard after making improvements and bug fixes.
- [x] Publish updated pre-trained model weights.
- [x] Log the original and reconstructed images using TensorBoard.
- [ ] Update results with reconstructed image and original image.
- [ ] Resume training by loading model checkpoint.

*WIP is an acronym for Work-In-Progress*

## Credits

Referenced these implementations mainly for sanity check:
1. [TensorFlow implementation by @naturomics](https://github.com/naturomics/CapsNet-Tensorflow)

## Learning Resources

Here's some resources that we think will be helpful if you want to learn more about Capsule Networks:

- Articles and blog posts:
  - [Understanding Hinton's Capsule Networks. Part I: Intuition.](https://medium.com/@pechyonkin/understanding-hintons-capsule-networks-part-i-intuition-b4b559d1159b)
  - [Dynamic routing between capsules](https://blog.acolyer.org/2017/11/13/dynamic-routing-between-capsules/)
  - [What is a CapsNet or Capsule Network?](https://hackernoon.com/what-is-a-capsnet-or-capsule-network-2bfbe48769cc)
  - [Capsule Networks Are Shaking up AI — Here's How to Use Them](https://hackernoon.com/capsule-networks-are-shaking-up-ai-heres-how-to-use-them-c233a0971952)
  - [Capsule Networks Explained](https://kndrck.co/posts/capsule_networks_explained/)
- Videos:
  - [Capsule Networks: An Improvement to Convolutional Networks](https://www.youtube.com/watch?v=VKoLGnq15RM)
  - [Capsule Networks (CapsNets) – Tutorial](https://www.youtube.com/watch?v=pPN8d0E3900)

## Other Implementations

- TensorFlow:
  - The first author of the paper, [Sara Sabour has released the code](https://github.com/Sarasra/models/tree/master/research/capsules).


text:
# Release

This document contains information on releasing Fleet.
**Please note: it may be sparse since it is only intended for maintainers.**

## Pre-Release

1. Ensure that all modules are at their desired versions in `go.mod`
1. Ensure that all nested and external images are at their desired versions (check `charts/` as well, and you can the following [ripgrep](https://github.com/BurntSushi/ripgrep) command at the root of the repository to see all images used: `rg "repository:" -A 1 | rg "tag:" -B 1`
1. Run `go mod tidy` and `go generate` and ensure that `git status` is clean
1. Determine the tag for the next intended release (must be valid [SemVer](https://semver.org/) prepended with `v`)

## Release Candidates

1. Checkout `master`
1. Use `git tag` and append the tag from the **Pre-Release** section with `-rcX` where `X` is an unsigned integer that starts with `1` (if `-rcX` already exists, increment `X` by one)

## Full Releases

1. Open a draft release on the GitHub releases page
1. Send draft link to maintainers with view permissions to ensure that contents are valid
1. Create GitHub release and create a new tag while doing so (using the tag from the **Pre-Release** section)

## Post-Release

1. Pull Fleet images from DockerHub to ensure manifests work as expected
1. Open a PR in [rancher/charts](https://github.com/rancher/charts) that ensures every Fleet-related chart is using the new RC (branches and number of PRs is dependent on Rancher)


text:
---
title: 'About me'
template: 'page'
socialImage: 'https://res.cloudinary.com/hacktivist/image/upload/v1582900689/IMG_9816_pnaxcf.jpg'
---

Hi there, I'm Shedrack Akintayo! 👋

I am a Developer Advocate 🥑, Software Developer, and Technical Writer. I have ~4 years professional expertise in Software Development, majoring mostly in Frontend technologies.

I love to [write](/), code, and [teach](/pages/talks).

Personally, I love constant learning, growing and working towards becoming a better version of myself 😄.

Lately, I lead Developer Relations efforts at [Cloud Foundry Foundation](https://cloudfoundry.com), where we are working on providing the best developer experience on kubernetes.

I am well experienced in organising developer driven events and also managing developer communities. On some days, I enjoy writing API documentation, as well as building APIs, using Nodejs alongside logging and ARM tools like New Relic etc.

In my free time, I write techincal articles mostly on Cloud Native Technologies, Javascript etc. ~3 experience in Technical writing for companies and publications alongside a track record in helping many developer communities in my locality organise and plan events.

### Main Spoken Language

- English

## Writing Engagements

- [Smashing Magazine](https://www.smashingmagazine.com/author/shedrack-akintayo/)
- [LogRocket](https://blog.logrocket.com/author/shedrackakintayo/)
- [ITNEXT](https://medium.com/@Sheddy_Nathan)
- Codeburst

## Technologies & Skills

- Javascript
- React
- Node
- Docker
- Cloud Foundry
- NoSQL Databases (mongoDB etc.)
- Community Management and Building
- Technical Writing
- API Documentation
- Communication
- Organizing Developer-Driven Events

## Communities Involved With

- Community Manager at [Facebook Developers Circles:Lagos](https://web.facebook.com/groups/devcReactNigeria/)
- Core Team [Open Source Community Africa](https://oscafrica.org)
- Lead [AR|MR|VR](http://mrarvr.in/) Lagos
- Organizer [React Summit Nigeria](https://reactsummit2017.splashthat.com/)

repository: sodiqalase/sheddy-xyz

repo_name: sodiqalase/sheddy-xyz