text:
# Express-Highlights

Integrates [Express](https://www.npmjs.com/package/express) and [Highlights](https://www.npmjs.com/package/highlights)
to make writing [Handlebars](https://www.npmjs.com/package/handlebars) templates containing highlighted code snippets easy.

It achieves that by providing a [express-handlebars](https://www.npmjs.com/package/express-handlebars) helper that calls
Highlights, the [Atom](https://atom.io) syntax highlighter, to perform the actual highlighting.

Atom has lots of highlight [themes](http://atom.github.io/highlights/examples/),
such as the [atom-dark-syntax](https://github.com/atom/atom-dark-syntax) and the
[solarized-light-syntax](https://github.com/atom/solarized-light-syntax).

See below how to use them in your own HTML pages.

## Installation

```
npm install express-highlights
```

## Basic Usage

Include your favourite syntax highlight [theme](http://atom.github.io/highlights/examples/)'s CSS in the
HTML file that includes the handlebars template:

```html
<link rel="stylesheet" href="atom-dark.css" theme="theme" title="Atom Dark">
```

On the server, add the `express-highlights` helper to your `express-handlebars` engine:

```js
const highlight = require("express-highlights").highlight;
const exphbs = require('express-handlebars');

// create handlebars instance that uses express-highlights
const hbs = exphbs.create({
    helpers: {
        code: highlight
    }
});

// register it with Express and you're all set
app.engine('handlebars', hbs.engine);
```

Now, in your handlebars templates, you can wrap your code snippets into `code` blocks like this:

```handlebars
<div>
{{#code}}
var hello = "world"
{{/code}}
</div>
```

The default language is JS, but you can change that by giving the `code` directive the name of the language:

```handlebars
<div>
{{#code "java"}}
String hello = "world";
{{/code}}
</div>
```

## Using custom languages

Highlights supports a few languages out-of-the-box, such as JavaScript, CoffeeScript, Java and Python.

If your language grammar is not included by default, you can install it as in the example below for
[Scala support](https://www.npmjs.com/package/language-scala):

```js
const expressHighlights = require("express-highlights");
const scala = require.resolve('language-scala/package.json');

expressHighlights.use(scala);

// create handlebars instance that uses express-highlights
const hbs = exphbs.create({
    helpers: {
        code: expressHighlights.highlight
    }
});
```

Now, use the `code` directive with `"scala"` as an argument:

```handlebars
<div>
{{#code "scala"}}
val hello = "world"
{{/code}}
</div>
```

repository: renatoathaydes/express-highlights

repo_name: renatoathaydes/express-highlights


text:
---
layout: post
title: Kaggle titanic challenge with torch7
tags: [Machine-learning]
---

![Kaggle Titanic Challenge]({{ site.baseurl }}/images/2015062000.png "Kaggle Titanic Challenge")

[Kaggle titanic challenge](https://www.kaggle.com/c/titanic) is a famous knowledge competition which many new Kaggler will try their
first Kaggle competition. Since there are currently no tutorial to solve this challenge with artificial neural network, I decided to use
torch7 to compete in this competition. FYI, [click here to get the data](https://www.kaggle.com/c/titanic/data).

### Why Torch7

Deep learning is state of the art machine learning algorithm in learning image, video, sound and natural language.
[Torch7](http://torch.ch/) is one of the famous deep learning framework, which is already used within Facebook, Google, Twitter, NYU,
IDIAP, Purdue and several other companies and research labs.

### Model

![Learning Model]({{ site.baseurl }}/images/2015062001.png "Learning Model")

### Validation

Validation is using back the training dataset since the dataset will be too small if I separate it. As I am using tanh as transfer function
, for those model output bigger than 0, I classified it as survived. Using model after training for 20000 epoch, the result are:

- False Positive : 31
- True Positive : 276
- False Negative : 66
- True Negative : 518

### Submission Result

The score is the percentage of passengers we correctly predict. The submission result using model on epoch 20000 is 0.74641. From the
result, we know that our model is slightly overfitted because training set accuracy is 89.113% while test set is 74.646%.

### Some Thought

I have showed that torch7 works in Kaggle titanic challenge too. With this method, I can easily get the probability that a passenger is
survived based on the input, and this Bayesian behavior is really important in real world use case.

### Some Picture
![Torch7]({{ site.baseurl }}/images/2015062003.png "Torch7")

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Parsing for the CSV format

This example presents a way to parse a table in the
CSV format.

The function `csv_parse_line_nerr` in the npm-based package
*atscntrb-hx-csv-parse* parses a given string into a list of
substrings separated by COMMA (or another character chosen by
the user).

Let us use the name dframe (data-frame) to refer to a table
of the following format:

```
Date,Open,High,Low,Close,Adj Close,Volume
1985-10-01,110.620003,112.160004,110.565002,112.139999,112.139999,153160000
1985-10-02,112.139999,112.540001,110.779999,110.824997,110.824997,164640000
...
```

where the first row contains the name of each column. The function
`dframe_read_fileref` in the file *myread.dats* parses such a table
(contained in the file referred to by a given file handle) into a list
of gvhasbtbl-values, each of which is essentially a hashtable of gvalues
(declared in the file *$PATSHOME/libats/ML/SATS/gvalue.sats*).

Please find in *NDX100.dats* some code that parses the historic data
for NDX100 (NASDAQ 100).

If you have [tcc](https://bellard.org/tcc/) installed, you can simply
issue the following command-line:

```shell
bash ./NDX100.dats
```

to compile and then execute the code in *NDX100.dats*, effectively using
ATS as a scripting language!

Happy programming in ATS!!!

repository: ats-lang/ATS-CodeBook

repo_name: ats-lang/ATS-CodeBook


text:
# Vapor-Catalogue

Vapor-Catalogue is simple API for CD collection database. I learned on this project the basic concepts of backend development in Swift. Fun part is related to user session based on JWT token.

**Albums**
* `GET /albums` - all albums in database
* `GET /album/:id` - get one album
* `POST /albums` - create new album
* `DELETE /album/:id` - delete album

**Artists**
* `GET /artists` - all artists in database
* `GET /artists/:id` - get one artist
* `POST /artists` - create new artist
* `DELETE /artists/:id` - delete artist

**Additional**
* `GET /albums/:id/artists` - artist of particular album
* `GET /artists/:id/albums` - albums of particular artist

**User management**
* `POST /auth/signup` - create user
* `POST /auth/login` - login user
* `GET user/albums` - get all albums of user
* `POST user/album` - create album and assign it to the user

* `GET artists/search?q=...` - search artist by name

repository: DanielCech/Vapor-Catalogue

repo_name: DanielCech/Vapor-Catalogue


text:
# Cesium
This is the repository where my work on a Cesium app will be stored for sharing

The "HelloGamepadV1.html" file should be in your \CESIUM\Apps directory

Before launching this app :

Do not forget to download CesiumJS : https://cesium.com/cesiumjs/

And to launch the server in the command prompt with the following : node server.cjs

To make it work, follow the link given in your command prompt
i.e. : http://localhost:8080/Apps/HelloGamepad.html

Don't hesitate to tell me if anything goes wrong

repository: MartinGongSing/Cesium

repo_name: MartinGongSing/Cesium


text:
# Value object

A 'Value Object' is an object that represents a value! Basically that. :)
Value Object are mentioned by Eric Evans in his famous DDD book because value objects help building strong domains, avoiding future modeling problems in their and the famous "code smell bad"

# Characteristics

- They are immutable.
- They have no identity.
- They are small.
- They help abuse of primitive obsession.
- They help withing documentation.

# Pratical example

Below, I demonstrate some of the most common use cases today.

``` cs

string document = "132.545.983-32"; // This value represents a Brazilian document that we call cpf.

var documentIsValid = CPFHelper.Validate(cpf);

if (documentIsValid)
{
    var cpfFormated = CPFHelper.Format(cpf);
    Console.WriteLine(cpfFormated);

    //output:<PHONE_NUMBER>2
}

```

or

``` cs

public class Customer
{
  public string Id { get; set; }

  private readonly string _cpf;
  public string Cpf
  {
    get { return _cpf; }
    set
    {
        var documentCpf = CPFHelper.Validate(value);

        if(documentCpf)
        {
            _cpf = CPFHelper.Format(value);
        }
        else
        {
            throw new CpfException("Any stupid message.");
        }

    }
  }
}

```

## Okay, but what's wrong with the code snippet above?

If you are using this in your modeling software, you will need to study a little more about good practice and OOP.

> Reader: But Bruno, what is the problem with the section above bro?

> Author: It seems harmless but it is not, there are those who disagree but this excerpt is a "code smell bad" and that's it !!!

Observe the assignment of the value ``"132.545.983-32"`` to the variable ``document`` (As much as there are better ways of implementation in the example above, the result will be the same; big shit).

Realize that ```document``` is a type of ```string``` and to change this value you need some manipulator to perform any treatment. This is where ```Helper``` or ```Util``` Patern is born (or rather, the anti-pattern). Understand that it will be necessary to have another object (Helper) to change the state of the ```document``` but the correct is thing to be an Type and  is to be your own owner and make your decisions.

NOTE: If you are using this type of ```CPFHelper``` (anti-pattern) pattern it means that your modeling went to the hole because something was born wrong and is growing wrong.

We will try to predict the future and imagine the possible problems of this use.

- I predict that you will have duplication of logic to handle this value. At some point you will find someone manipulating
the value which in turn will not be the Helper or Ultil class.

- When the above prophecy happens, armageddon will be near because you will lose control of whoever manipulates this value.

- The value will be assigned by variables with bizarre names, example: ``` _ ```, ``` cpf ```, ``` value ```, ``` customerPerson ```, etc ... Now imagine your system growing and being used and manipulated by 100 methods in 200 classes.

Writing ... will soon be finished ....

repository: brbarmex/dotnet-craftsman

branch_name: refs/heads/main

gha_language: C#

gha_license_id: MIT

repo_name: brbarmex/dotnet-craftsman


text:
# Sample Blog News Portal

## Application & Data

### Language Framework and Libraries

* PHP  >= 5.5
* Zend Framework 2([ Documentation ](http://framework.zend.com/manual/current/en/index.html))
* Composer - Dependency Manager for PHP ([ site ](https://getcomposer.org/))

#### Notes

* Zend\I18n\View\Helper component requires the intl PHP extension
* Composer may ask to Github Auth Token

#### Architecture

* HMVC Architecture ([ Wiki ](https://en.wikipedia.org/wiki/Hierarchical_model%E2%80%93view%E2%80%93controller))

#### Libraries

* Imagine       ([ GitHub ](https://github.com/avalanche123/Imagine)) - Image Resize and Manipulate
* PHP Mailer    ([ GitHub ](https://github.com/PHPMailer/PHPMailer))  - Send Email

##### Self Write Zend Modules

* Welcome - List latest 10 news
* Account - Verify registered users, do authenticated user operations ( create new post and delete )
* News    - read news, convert to pdf and subscribe RSS feeds.

##### 3rd Party Zend Modules

* ZendDeveloperTools    ([ GitHub ](https://github.com/zendframework/ZendDeveloperTools)) - Debug tools for working with the Zend Framework 2
* DOMPDFModule          ([ GitHub ](https://github.com/raykolbe/DOMPDFModule))            - HTML to PDF
* ZfcBase               ([ GitHub ](https://github.com/ZF-Commons/ZfcBase))               - Common classes used across several ZF2 modules
* ZfcUser               ([ GitHub ](https://github.com/ZF-Commons/ZfcUser))               - user registration and authentication module for Zend Framework 2

### Databases

* MySQL 5.6 +

| Database                 | charset       | collation            |
| ------------------------ |:-------------:| --------------------:|
| blog                     | utf8          | utf8_unicode_ci      |

## Theme

* Clean Blog ([ Download Original ](http://startbootstrap.com/template-overviews/clean-blog/))

## Developers

* Zeki Unal<EMAIL_ADDRESS>

repository: zekiunal/zend-framework-blog-sample

repo_name: zekiunal/zend-framework-blog-sample


text:
# Slider 2d

```
python run_slider2d.py
```

custom widget to have an x y gui slider

![alt text](images/slider2d.gif "Slider2DWidget")

repository: svenfraeys/sf-labs-python

repo_name: svenfraeys/sf-labs-python


text:
# Hosebird Client (hbc) [![Build Status](https://travis-ci.org/twitter/hbc.png?branch=master)](https://travis-ci.org/twitter/hbc) [![Coverage Status](https://coveralls.io/repos/twitter/hbc/badge.png?branch=master)](https://coveralls.io/r/twitter/hbc?branch=master)
A Java HTTP client for consuming Twitter's [Streaming API](https://dev.twitter.com/docs/streaming-apis)

## Features
* GZip support
* OAuth support
* Partitioning support
* Automatic reconnections with appropriate backfill counts
* Access to raw bytes payload
* Proper backoffs/retry schemes
* Relevant statistics/events
* Control stream support for sitestreams

## Getting Started

The Hosebird client is broken down into two modules: hbc-core and hbc-twitter4j. The hbc-core module uses a message queue, which the consumer can poll for the raw String messages, while the hbc-twitter4j module uses the [twitter4j](http://twitter4j.org) listeners and data model on top of the message queue to provide a parsing layer.

The latest hbc artifacts are published to maven central. Bringing hbc into your project should be as simple as adding the following to your maven pom.xml file:

```xml
  <dependencies>
    <dependency>
      <groupId>com.twitter</groupId>
      <artifactId>hbc-core</artifactId> <!-- or hbc-twitter4j -->
      <version>2.2.0</version> <!-- or whatever the latest version is -->
    </dependency>
  </dependencies>
```

### Quickstart

Declaring the connection information:
```java
/** Set up your blocking queues: Be sure to size these properly based on expected TPS of your stream */
BlockingQueue<String> msgQueue = new LinkedBlockingQueue<String>(100000);
BlockingQueue<Event> eventQueue = new LinkedBlockingQueue<Event>(1000);

/** Declare the host you want to connect to, the endpoint, and authentication (basic auth or oauth) */
Hosts hosebirdHosts = new HttpHosts(Constants.STREAM_HOST);
StatusesFilterEndpoint hosebirdEndpoint = new StatusesFilterEndpoint();
// Optional: set up some followings and track terms
List<Long> followings = Lists.newArrayList(1234L, 566788L);
List<String> terms = Lists.newArrayList("twitter", "api");
hosebirdEndpoint.followings(followings);
hosebirdEndpoint.trackTerms(terms);

// These secrets should be read from a config file
Authentication hosebirdAuth = new OAuth1("consumerKey", "consumerSecret", "token", "secret");
```

Creating a client:
```java
ClientBuilder builder = new ClientBuilder()
  .name("Hosebird-Client-01")                              // optional: mainly for the logs
  .hosts(hosebirdHosts)
  .authentication(hosebirdAuth)
  .endpoint(hosebirdEndpoint)
  .processor(new StringDelimitedProcessor(msgQueue))
  .eventMessageQueue(eventQueue);                          // optional: use this if you want to process client events

Client hosebirdClient = builder.build();
// Attempts to establish a connection.
hosebirdClient.connect();
```

Now, msgQueue and eventQueue will now start being filled with messages/events. Read from these queues however you like.
```java
// on a different thread, or multiple different threads....
while (!hosebirdClient.isDone()) {
  String msg = msgQueue.take();
  something(msg);
  profit();
}
```

You can close a connection with

```java
hosebirdClient.stop();
```

### Quick Start Example

To run the sample stream example:

```
mvn install && mvn exec:java -pl hbc-example -Dconsumer.key=XYZ -Dconsumer.secret=SECRET -Daccess.token=ABC -Daccess.token.secret=ABCSECRET
```

You can find these values on http://dev.twitter.com and navigating to one of your applications then to the API Keys tab.
The API key and secrets values on that page correspond to hbc's `-Dconsumer.*` properties.

Alternatively you can set those properties in hbc-examples/pom.xml

## The Details

### Authentication:

Declaring OAuth1 credentials in the client (preferred):

```java
new OAuth1("consumerKey", "consumerSecret", "token", "tokenSecret")
```

Declaring basic auth credentials in the client:

```java
new BasicAuth("username", "password")
```

Be sure not to pass your tokens/passwords as strings directly into the initializers. They should be read from a configuration file that isn't checked in with your code or something similar. Safety first.

### Specifying an endpoint

Declare a StreamingEndpoint to connect to. These classes reside in the package com.twitter.hbc.core.endpoint, and correspond to all of our endpoints. By default, the HTTP parameter "delimited=length" is set for all of our StreamingEndpoints for compatibility with our processor (next section). If you are using our StringDelimitedProcessor this parameter must be set. For a list of available public endpoints and the http parameters we support, see [Twitter's Streaming API docs](https://dev.twitter.com/docs/streaming-apis/streams/public).

#### Filter streams:

```java
StatusesFilterEndpoint endpoint = new StatusesFilterEndpoint();
// Optional: set up some followings and track terms
List<Long> followings = Lists.newArrayList(1234L, 566788L);
List<String> terms = Lists.newArrayList("twitter", "api");
endpoint.followings(followings);
endpoint.trackTerms(terms);
```

#### Firehose streams:

```java
StreamingEndpoint endpoint = new StatusesFirehoseEndpoint();
// Optional: set up the partitions you want to connect to
List<Integer> partitions = Lists.newArrayList(0,1,2,3);
endpoint.partitions(partitions);
// By default, delimited=length is already set for use by our StringDelimitedProcessor
// Do this to unset it (Be sure you really want to do this)
// endpoint.delimited(false);
```

#### Setting up a Processor:

The hosebird client uses the notion of a "processor" which processes the stream and put individual messages into the provided BlockingQueue. We provide a StringDelimitedProcessor class which should be used in conjunction with the StreamingEndpoints provided. The processor takes as its parameter a BlockingQueue, which the client will put String messages into as it streams them.

Setting up a StringDelimitedProcessor is as easy as:

```java
new StringDelimitedProcessor(msgQueue);
```

### Control streams for Sitestream connections

Hosebird provides [control stream support for sitestreams](https://dev.twitter.com/docs/streaming-apis/streams/site/control).

To make control stream calls with the hosebird client, first create a client. When calling connect() to create a connection to a stream with control stream support, the first message you receive will be the streamId. You'll want to hold on to that when processing the messages if you plan on using control streams, so after calling connect(), be sure to keep track of the streamId of this connection. Note that due to reconnections, the streamId could change, so always use the latest one. If you're using our twitter4j layer, keeping track of the control messages/streamIds will be taken care of for you.

```java
SitestreamController controlStreams = client.getSitestreamController();
// When making a connection to the stream with control stream support one of the response messages will include the streamId.
// You'll want to hold on to that when processing the messages if you plan on using control streams

// add userId to our control stream
controlStreams.addUser(streamId, userId);
// remove userId to our control stream
controlStreams.removeUser(streamId, userId);
```

### The hbc-twitter4j module

The hbc-twitter4j module uses the twitter4j listeners and models. To use it, create a normal Client object like before using the ClientBuilder, then depending on which type of stream you are reading from, create an appropriate Twitter4jClient. The Twitter4jClient wraps around the Client it is passed, and calls the callback methods in the twitter4j listeners whenever it retrieves a message from the message queue. The actual work of polling from the message queue, parsing, and executing the callback method is done by forking threads from an executor service that the client is passed.

If connecting to a status stream (filter, firehose, sample), use Twitter4jStatusClient:

```java
// client is our Client object
// msgQueue is our BlockingQueue<String> of messages that the handlers will receive from
// listeners is a List<StatusListener> of the t4j StatusListeners
// executorService
Twitter4jClient t4jClient = new Twitter4jStatusClient(client, msgQueue, listeners, executorService);
t4jClient.connect();

// Call this once for every thread you want to spin off for processing the raw messages.
// This should be called at least once.
t4jClient.process(); // required to start processing the messages
t4jClient.process(); // optional: another Runnable is submitted to the executorService to process the msgQueue
t4jClient.process(); // optional
```

If connecting to a userstream, use Twitter4jUserstreamClient. If making a sitestream connection, use Twitter4jSitestreamClient.

#### Using Handlers, a Twitter4j listener add-on

All Twitter4jClients support Handlers, which extend their respective Twitter4j listeners: StatusStreamHandler extends StatusesListener, UserstreamHandler extends UserstreamListener, SitestreamHandler extends SitestreamHandler. These handlers have extra callback menthods that may be helpful for parsing messages that the Twitter4j listeners do not yet support

```java
UserstreamListener listener = new UserstreamHandler() {
  /**
   * <UserstreamListener methods here>
   */

  @Override
  public void onDisconnectMessage(DisconnectMessage disconnectMessage) {
    // this method is called when a disconnect message is received
  }

  @Override
  public void onUnfollow(User source, User target) {
    // do something
  }

  @Override
  public void onRetweet(User source, User target, Status retweetedStatus) {
    // do your thing
  }

  @Override
  public void onUnknownMessageType(String msg) {
    // msg is any message that isn't handled by any of our other callbacks
  }
}

listeners.append(listener);
Twitter4jClient t4jClient = new Twitter4jUserstreamClient(client, msgQueue, listeners, executorService);
```

## Building / Testing

To build locally (you must use java 1.7 for compiling, though we produce 1.6 compatible classes):

```
mvn compile
```
To run tests:

```
mvn test
```

## Problems?

If you find any issues please [report them](https://github.com/twitter/hbc/issues) or better,
send a [pull request](https://github.com/twitter/hbc/pulls).

## Authors:
* Steven Liu
* Kevin Oliver

## License
Copyright 2013 Twitter, Inc.

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

repository: lemurcina/hbc

gha_language: Java

repo_name: lemurcina/hbc


text:
# hasgel

My project for learning Haskell and OpenGL.

The project aims to implement the classic game, Space Invaders. As this is my
first larger project with Haskell, the scope of the game will (hopefully) be
kept at the minimum.

## Planned Features

The following features are planned. For a more detailed overview, check the
`Design.md` file.

  * A 3D model for player.
  * A model for regular alien ships and another model for the special ship.
  * Simple shooting animation.
  * A laser shot effect.
  * An explosion animation.
  * Destructible, defensive blockades.
  * Scoreboard
  * Demo recording and playing.
  * Rebindable keys.

## Building & Running

The source has only been tested on GNU/Linux and Glasgow Haskell Compiler. In
order to build and run you will need the following:

  * SDL 2 library
  * GPU drivers supporting OpenGL 4
  * `ghc` - Glasgow Haskell Compiler
  * `cabal-install` - tool for installing and building Haskell packages
    (usually installed with `ghc`)
  * `stack` - tool for Haskell projects; can be installed using `cabal install
    stack`

This project uses `stack` for building. It will download the required versions
of other Haskell packages which are known to work with the project. `stack`
will also handle that the appropriate `ghc` version is used for the project.

Build steps are as follows:

    stack setup
    stack build

After the compilation is done, the main application can be run with:

    stack exec hasgel


text:
---
title: Unix Commands
---

Directory Change = cd directory-name

Directory New = mkdir new-directory-name

Directory New + Change to = take new-directory name

Directory Home = cd

Directory Back One = cd..

Directory Back Two = cd...

Directory Path of Working Directory = pwd

Directory List Files = ls or echo *

***

**¡Warning!**

Directory Remove Verbose = rm -v

Directory Force Remove = rm -rf

**¡Warning!**

***

File Move = mv

File Copy = cp

File Open = open

File Run = program filename

File Read = cat

File Nano Open = nano filename

File Nano Close = control + X, Y to save

File Vim Open = vi filename

File Vim Close = Press Esc, :wq

File Filter = grep

File Input = echo input >

repository: arthuranteater/my-blog

gha_language: JavaScript

repo_name: arthuranteater/my-blog


text:
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
# React Week 2 Code Review

#### _TapRoom_, _February 2020_

#### By _**Tyler Yates**_

## Description

_Lets a user view and add kegs to a list_

## Setup/Installation Requirements

Currently the project can be accessed by downloading or cloning the repository at github [here](https://github.com/YTyler/reactWeek2.git) and running the following commands in the root directory via the terminal

`npm install`
`npm start`

The repository can be found

## Project Structure

![Component Structure](./src/images/structure.jpg)

## Known Bugs

* No known bugs at this time

## Support and contact details

_The author can be contacted at<EMAIL_ADDRESS>
## Technologies Used

* Javascript (React)

### License

MIT License

Copyright (c) 2019 Tyler Yates

*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:
Homework 4
==========

Read

* Economic Dynamics, Section 5.2.2, and/or
* M. Kandori, et al., "Learning, Mutation, and Long Run Equilibria in Games,"
  Econometrica 61 (1993), 29-56.

Implement the Kandori-Mailath-Rob (KMR) model, and
for a couple of values of epsilon,

* run a simulation, and
* compute the stationary distribution.

Due on November 25:
Push your python script file and/or IPython notebook to your GitHub repository.

* Once you have written your code for 2x2 games,
  try to extend it to games with more than two actions.


text:
Welcome to mytinerary react native 👋

> WebApp for travellers around the world to describe their itineraries and help other people decide if a city is the perfect place to enjoy vacation or not.
### [Video REACT NATIVE](https://www.youtube.com/watch?v=coX5zn_GAyM)
### ✨ [Demo WEB](https://mytinerary-budtke.herokuapp.com/)
### [Video WEB](https://www.youtube.com/watch?v=3mt5EXRBIhM)
### [WEB Repo](https://github.com/WernerBudtke/mytinerary-budtke)

## Install

```sh
npm install
```

## Usage

```sh
expo start
```
## Technologies
```
React Native
Redux
```
## Author

👤 **Federico Budtke**

* Github: [@WernerBudtke](https://github.com/WernerBudtke)
* LinkedIn: [@https://www.linkedin.com/in/fwbudtke/](https://www.linkedin.com/in/fwbudtke/)

## 🤝 Contributing

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

## Show your support

Give a ⭐ if this project helped you!

## 📝 License

Copyright © 2021 [Federico Budtke](https://github.com/WernerBudtke).


text:
---
title: Using R and lme/lmer to fit different two- and three-level longitudinal models
date: 2015-04-21 17:30
author: Kristoffer Magnusson
category: R
tags:
   - Statistics
   - Longitudinal
   - Multilevel
   - Linear mixed-effects model
   - lme4
   - nlme
   - Tutorial
slug: r-guide-longitudinal-lme-lmer
summary: I often get asked about how to fit different longitudinal models in lme/lmer. In this post I cover several different two-level, three-level and partially nested models.
include_toc: true
---

I often get asked how to fit different multilevel models (or individual growth models, hierarchical linear models or linear mixed-models, etc.) in R. In this guide I have compiled some of the more common and/or useful models (at least common in clinical psychology), and how to fit them using `nlme::lme()` and `lme4::lmer()`. I will cover the common two-level random intercept-slope model, and three-level models when subjects are clustered due to some higher level grouping (such as therapists), partially nested models were there are clustering in one group but not the other, and different level 1 residual covariances (such as AR(1)). The point of this post is to show how to fit these longitudinal models in R, not to cover the statistical theory behind them, or how to interpret them.

# Data format
In all examples I assume this data structure.

| subjects |  tx   | therapist | time  |   y   |
| :------: | :---: | :-------: | :---: | :---: |
|    1     |   0   |     1     |   0   |  10   |
|    1     |   0   |     1     |   1   |  12   |
|    1     |   0   |     1     |   2   |  14   |
|    2     |   0   |     1     |   0   |   4   |
|    2     |   0   |     1     |   1   |  14   |
|    2     |   0   |     1     |   2   |  13   |
|    3     |   0   |     2     |   0   |  12   |
|    3     |   0   |     2     |   1   |  15   |
|    3     |   0   |     2     |   2   |  16   |
|    4     |   0   |     2     |   0   |  17   |
|    4     |   0   |     2     |   1   |  13   |
|    4     |   0   |     2     |   2   |  12   |
|    5     |   0   |     3     |   0   |  15   |
|    5     |   0   |     3     |   1   |  13   |
|   ...    |  ...  |    ...    |  ...  |  ...  |

Where `subjects` is each subject's id, `tx` represent treatment allocation and is coded 0 or 1, `therapist` is the refers to either clustering due to therapists, or for instance a participant's group in group therapies. `Y` is the outcome variable.

# Power analysis, and simulating these models
Most of the designs covered in this post are supported by my R package `powerlmm`, [(http://cran.r-project.org/package=powerlmm)](http://cran.r-project.org/package=powerlmm). It can be used to calculate power for these models, or to simulate them to investigate model misspecification. I will soon integrate the package into this post, in order to create example data sets. For now, see the package's vignettes for tutorials.

# Longitudinal two-level model
We will begin with the two-level model, where we have repeated measures on individuals in different treatment groups.
![Two-level multilevel model in R. By Kristoffer Magnusson](./img/2lvl.png)

## Unconditional model
Model formulation
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + U_{0j} \\
\end{aligned}
$$
with,
$$

U_{0j} \sim\mathcal{N}(0, ~\tau_{00}^2)
,

$$
and
$$

R_{ij} \sim\mathcal{N}(0, ~\sigma^2)

$$

To fit this model we run
```r
# lme4
lmer(y ~ 1 + (1 | subjects), data=data)

# nlme
lme(y ~ 1, random = ~ 1 | subjects, data=data)
```

## Unconditional growth model
Model formulation
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + \beta_{1j}t_{ij} + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + U_{0j} \\
\beta_{1j} &= \gamma_{10} + U_{1j} \\
\end{aligned}
$$
with,
$$

\begin{pmatrix}
U_{0j} \\
 U_{1j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & \tau_{01}\\
 \tau_{01} & \tau_{10}^2
\end{matrix}
\right)
,

$$
and
$$

R_{ij} \sim\mathcal{N}(0, ~\sigma^2)

$$

To fit this model we run
```r
# lme4
lmer(y ~ time + (time | subjects), data=data)

# nlme
lme(y ~ time, random = ~ time | subjects, data=data)
```

 ## Conditional growth model
Model formulation
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + \beta_{1j}t_{ij} + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + \gamma_{01} TX_j + U_{0j} \\
\beta_{1j} &= \gamma_{10} + \gamma_{11} TX_j + U_{1j} \\
\end{aligned}
$$
with,
$$

\begin{pmatrix}
U_{0j} \\
 U_{1j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & \tau_{01}\\
 \tau_{01} & \tau_{10}^2
\end{matrix}
\right)
,

$$
and
$$

R_{ij} \sim\mathcal{N}(0, ~\sigma^2)

$$

To fit this model we run
```r
# lme4
lmer(y ~ time * tx + (time | subjects), data=data)

# nlme
lme(y ~ time * tx, random = ~ time | subjects, data=data)
```

## Conditional growth model: dropping random slope
Model formulation
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + \beta_{1j}t_{ij} + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + \gamma_{01} TX_j + U_{0j} \\
\beta_{1j} &= \gamma_{10} + \gamma_{11} TX_j \\
\end{aligned}
$$
with,
$$

U_{0j} \sim\mathcal{N}(0, ~\tau_{00}^2)

$$
and
$$

R_{ij} \sim\mathcal{N}(0, ~\sigma^2)

$$

To fit this model we run
```r
# lme4
lmer(y ~ time * tx + (1 | subjects), data=data)

# nlme
lme(y ~ time * tx, random = ~ 1 | subjects, data=data)
```

## Conditional growth model: dropping random intercept
Model formulation
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + \beta_{1j}t + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + \gamma_{01} TX_j \\
\beta_{1j} &= \gamma_{10} + \gamma_{11} TX_j + U_{1j}\\
\end{aligned}
$$
with,
$$

U_{1j} \sim\mathcal{N}(0, ~\tau_{10}^2)

$$
and
$$

R_{ij} \sim\mathcal{N}(0, ~\sigma^2)

$$

To fit this model we run
```r
# lme4
lmer(y ~ time * tx + ( 0 + time | subjects), data=data)

# nlme
lme(y ~ time * tx, random = ~ 0 + time | subjects, data=data)
```

## Conditional growth model: dropping intercept-slope covariance
Model formulation
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + \beta_{1j}t + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + \gamma_{01} TX_j + U_{0j} \\
\beta_{1j} &= \gamma_{10} + \gamma_{11} TX_j + U_{1j} \\
\end{aligned}
$$
with,
$$

\begin{pmatrix}
U_{0j} \\
 U_{1j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & 0\\
 0 & \tau_{10}^2
\end{matrix}
\right)
,

$$
and
$$

R_{ij} \sim\mathcal{N}(0, ~\sigma^2)

$$
To fit this model we run
```r
# lme4
lmer(y ~ time * tx +
            (time || subjects) , data=data)

# same as above
lmer(y ~ time * tx +
            (1 | subjects) +
            (0 + time | subjects) ,
          data=data)

# nlme
lme(y ~ time * tx,
          random = list(subjects = pdDiag(~time)),
          data=data)
```

# Three-level models
Here I will cover some different three-level models. In my examples clustering at the highest level is due to therapists. But the examples generalize to other forms of clustering as well, such as group therapy or clustering due to health-care provider.
![Three-level multilevel model in r. By Kristoffer Magnusson](./img/3lvl.png)
## Conditional three-level growth model
We will jump straight to the conditional three-level growth model, with the following model formulation:
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ijk} &= \beta_{0jk} + \beta_{1jk}t_{ijk} + R_{ijk}\\
\text{Level 2}& \\
\beta_{0jk} &= \gamma_{00k} + U_{0jk} \\
\beta_{1jk} &= \gamma_{10k} + U_{1jk} \\
\text{Level 3}& \\
\gamma_{00k} &= \delta_{000} + \delta_{001} TX_k + V_{0k} \\
\gamma_{10k} &= \delta_{100} + \delta_{101} TX_k + V_{1k} \\
\end{aligned}
$$
with,
$$

\begin{pmatrix}
U_{0j} \\
 U_{1j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & \tau_{01}\\
 \tau_{01} & \tau_{10}^2
\end{matrix}
\right)
,

$$
and,
$$

\begin{pmatrix}
V_{0k} \\
 V_{1k} \\
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \varphi_{00}^2 & \varphi_{01} \\
 \varphi_{01} & \varphi_{10}^2
\end{matrix}
\right)
,

$$
and
$$

R_{ijk} \sim\mathcal{N}(0, ~\sigma^2)

$$

To fit this model we use `therapist/subjects`, which specifies nesting. This formula expands to a main effect of therapist and a interaction between therapist and subjects (which is the subject level effect).
```r
# lme
lmer(y ~ time * tx +
                (time | therapist/subjects),
        data=df)
## expands to
lmer(y ~ time * tx +
                (time | therapist:subjects) +
                (time | therapist),
        data=df)

# nlme
lme(y ~ time * tx,
         random = ~time | therapist/subjects,
         data=df)

## expands to
lme(y ~ time * tx,
         random = list(therapist = ~time,
                        subjects = ~time),
         data=df)
```

## Subject level randomization (therapist crossed effect)
In the previous example therapists only provided one type of treatment (nested design). Sometimes therapists will be a crossed effect, i.e. in a parallel group design they will deliver both treatments. If it's a randomized trial then in this design we have subject level randomization, whereas in the previous example randomization was at the therapist level.

![Three-level multilevel model in r: subject-level randomization. By Kristoffer Magnusson](./img/3lvl-crossed.png)

$$
\begin{aligned}
\text{Level 1}& \\
Y_{ijk} &= \beta_{0jk} + \beta_{1jk}t_{ijk} + R_{ijk}\\
\text{Level 2}& \\
\beta_{0jk} &= \gamma_{00k} + \gamma_{01k} TX_{jk} + U_{0jk} \\
\beta_{1jk} &= \gamma_{10k} + \gamma_{11k} TX_{jk} + U_{1jk} \\
\text{Level 3}& \\
\gamma_{00k} &= \delta_{000} + V_{0k} \\
\gamma_{10k} &= \delta_{100} + V_{1k} \\
\gamma_{01k} &= \delta_{010} + V_{2k} \\
\gamma_{11k} &= \delta_{110} + V_{3k} \\
\end{aligned}
$$
with,
$$

\begin{pmatrix}
U_{0j} \\
 U_{1j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & \tau_{01}\\
 \tau_{01} & \tau_{10}^2
\end{matrix}
\right)
,

$$
and,
$$

\begin{pmatrix}
V_{0k} \\
 V_{1k} \\
 V_{2k} \\
 V_{3k}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \varphi_{00}^2 & 0 & 0 & 0 \\
  0 & \varphi_{10}^2 & 0 & 0 \\
  0 & 0 & \varphi_{20}^2 & 0 \\
  0 & 0 & 0 & \varphi_{30}^2
\end{matrix}
\right)
,

$$

and
$$

R_{ijk} \sim\mathcal{N}(0, ~\sigma^2)

$$

In this model we estimate no covariances at level 3. However, at the therapist level we have random effects for *time*, *treatment* and *time * treatment*. I fit this saturated model because you can easily delete a random effect in the expanded `lmer` syntax below.

```r
# lme4
lmer(y ~ time * tx +
            (time | therapist:subjects) +
            (time * tx || therapist),
            data=df)
## expands to
lmer(y ~ time*tx +
             (time | subjects:therapist) +
             (1 | therapist) +
             (0 + tx | therapist) +
             (0 + time | therapist) +
             (0 + time:tx | therapist), data=df)

# nlme
lme(y ~ time * tx,
           random = list(therapist = pdDiag(~time * tx),
                         subjects = ~time),
           data=df)
```

### Different level 3 variance-covariance matrix
We might hypothesize that therapists that are allocated participants that report worse symptoms at treatment start have better outcomes (more room for improvement). To allow for separate covariances in each treatment group we update the variance-covariance matrix at level 3
$$
\begin{pmatrix}
V_{0k} \\
 V_{1k} \\
 V_{2k} \\
 V_{3k}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \varphi_{00}^2 & \varphi_{01} & 0 & 0 \\
  \varphi_{01} & \varphi_{10}^2 & 0 & 0 \\
  0 & 0 & \varphi_{20}^2 & \varphi_{23} \\
  0 & 0 & \varphi_{23} & \varphi_{30}^2
\end{matrix}
\right)
$$

To fit this model we run

```r
# lme4
lmer(y ~ time * tx + (time | therapist:subjects) +
                 (time | therapist) +
                 (0 + tx + time:tx | therapist),
              data=data)

# nlme
lme(y ~time * tx,
           random = list(therapist = pdBlocked(list(~time, ~0 + tx + time:tx)),
                          subjects = ~time ),
                        data=data)
```

Of course, we could also estimate all six covariances at level 3. For instance, we could look at if therapists who are more successful with Treatment A are also more successful with Treatment B, i.e. $cov(V_{2k}, V_{3k}) = \varphi_{23}$, and so forth. The full unstructured level 3 variance-covariance matrix we will estimate is thus

$$
\begin{pmatrix}
V_{0k} \\
 V_{1k} \\
 V_{2k} \\
 V_{3k}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \varphi_{00}^2 & \varphi_{01} & \varphi_{02} & \varphi_{03} \\
  \varphi_{01} & \varphi_{10}^2 & \varphi_{12} & \varphi_{13} \\
  \varphi_{02} & \varphi_{12} & \varphi_{20}^2 & \varphi_{23} \\
  \varphi_{03} & \varphi_{13} & \varphi_{23} & \varphi_{30}^2
\end{matrix}
\right)
$$

Which we fit by running
```r
# lme4
lmer(y ~ time * tx +
            (time | therapist:subjects) +
            (time * tx | therapist),
            data=df)
# nlme
lme(y ~ time * tx,
           random = list(therapist = ~time * tx,
                         subjects = ~time),
           data=df)

```

## Partially nested models
Partially nesting occurs when we have nesting in one group but not the other. For instance, we might compare a treatment group to a wait-list condition. Subjects in the wait-list will not be nested, but subjects in treatment group will be nested within therapists.

![Partially-nested growth model in R. By Kristoffer Magnusson](./img/partially-nested.png)

We can write this model like this
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ijk} &= \beta_{0jk} + \beta_{1jk}t_{ijk} + R_{ijk}\\
\text{Level 2}& \\
\beta_{0jk} &= \gamma_{00} + \gamma_{01k} TX_{jk} + U_{0jk} \\
\beta_{1jk} &= \gamma_{10} + \gamma_{11k} TX_{jk} + U_{1jk} \\
\text{Level 3}& \\
\gamma_{01k} &= \delta_{010} + V_{0k} \\
\gamma_{11k} &= \delta_{110} + V_{1k} \\
\end{aligned}
$$
with,
$$
\begin{pmatrix}
U_{0j} \\
 U_{1j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & 0\\
 0 & \tau_{10}^2
\end{matrix}
\right)
,
$$
and,
$$
\begin{pmatrix}
V_{0k} \\
 V_{1k}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \varphi_{00}^2 & 0 \\
 0 & \varphi_{10}^2
\end{matrix}
\right)
,
$$

and
$$
R_{ijk} \sim\mathcal{N}(0, ~\sigma^2)
$$

```
# lme4
 lmer(y ~ time * tx +
                   (1 | therapist:subjects) +
                   (0 + time | therapist:subjects) +
                   (0 + time:tx | therapist) +
                   (0 + tx | therapist),
           data=data)

# nlme
lme(y ~ time * tx,
         random = list(therapist = pdDiag(~ 0 + time:tx + tx),
                       subjects = pdDiag(~time)),
                    data=data)
```

# More on level 1 specification
## Heteroscedasticity at Level 1
Only `lme` allows modeling heteroscedastic residual variance at level 1. If we wanted to extend our two level model and allow for different level 1 residual variance in the treatment groups, we'd get

$$
\begin{aligned}
(R_{ij} \ | \ \text{TX} = 0) &\sim\mathcal{N}(0, ~\sigma_0^2) \\
(R_{ij} \ | \ \text{TX} = 1) &\sim\mathcal{N}(0, ~\sigma_1^2)
\end{aligned}
$$

If we wanted to extend our two-level model with this level 1 structure we'd run

```r
lme(y ~ time * tx,
        random = ~ time | subjects,
        weights = varIdent(form= ~ 1 | tx), data=data)
```

### More grouping
We could also add another grouping factor such as time, and fit a model with heteroscedastic level 1 residuals for each time point in each treatment group. For instance, for *i* = 0, 1, 2 we get
$$
(R_{ij} \ | \ \text{TX} = 0)
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
    \sigma_{00}^2 & 0 & 0\\
    0 & \sigma_{01}^2 & 0 \\
    0 & 0 & \sigma_{02}^2
\end{matrix}
\right)
$$

$$
(R_{ij} \ | \ \text{TX} = 1)
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
    \sigma_{10}^2 & 0 & 0\\
    0 & \sigma_{11}^2 & 0 \\
    0 & 0 & \sigma_{12}^2
\end{matrix}
\right) \\
$$
which we'd fit by running
```r
lme(y ~ time * tx,
        random = ~ time | subjects,
        weights = varIdent(form= ~ 1 | tx * time),
      data=data)
```

## First-order Autoregressive AR(1) residuals
For $T = 1, 2, 3, ..., N_1$ time points we get the level 1 variance-covariance matrix
$$
\Sigma =
\sigma^2
\begin{pmatrix}
1 & \rho & \rho^2 & \cdots & \rho^{T-1} \\
\rho & 1 & \rho & \cdots & \rho^{T-2} \\
\rho^2 & \rho & 1 & \cdots & \rho^{T-3} \\
\vdots  & \vdots  & \vdots & \ddots & \vdots \\
\rho^{T-1} & \rho^{T-2} & \rho^{T-3} & \cdots & 1
\end{pmatrix}
$$
we leads to
$$
R_{ij}
\sim\mathcal{N}
\left(
0
,
\Sigma
\right)
$$

To fit this level 1 residual structure we use the `correlation`  argument.

```r
lme(y ~ time * tx,
        random = ~ time | subjects,
        correlation = corAR1(),
        data=data)
```

## Heterogenous AR(1)
We can also extend the level 1 variance-covariance matrix from above, to allow for different residuals at each time point.
$$
\Sigma =
\begin{pmatrix}
\sigma_0^2 & \sigma_0 \sigma_1 \rho & \sigma_0 \sigma_2 \rho^2 & \cdots & \sigma_0 \sigma_i \rho^{T-1} \\
\sigma_1 \sigma_0 \rho & \sigma_1^2 & \sigma_1 \sigma_2 \rho & \cdots & \sigma_1 \sigma_i \rho^{T-2} \\
\sigma_2 \sigma_0 \rho^2 & \sigma_2 \sigma_1 \rho & \sigma_2^2 & \cdots & \sigma_2 \sigma_i \rho^{T-3} \\
\vdots  & \vdots  & \vdots & \ddots & \vdots \\
\sigma_T \sigma_0 \rho^{T-1} & \sigma_T \sigma_1 \rho^{T-2} & \sigma_T \sigma_2 \rho^{T-2} & \cdots & \sigma_T^2
\end{pmatrix}
$$

and we have that

$$
R_{ij}
\sim\mathcal{N}
\left(
0
,
\Sigma
\right)
$$

To fit this level 1 model we simply use both the `correlation` and the `weights` argument.

```r
lme(y ~ time * tx,
        random = ~ time | subjects,
        weights = varIdent(form= ~ 1 | time),
        correlation = corAR1(),
        data=data)
```

## More level 1 variance-covariances matrices
Se `?corClasses` for the different types of residual variance-covariances matrices `lme` can estimate.

## Changing the functional form of time
All of the examples above assume linear change. Here I will cover some examples of how to model nonlinear change at level 1. The examples will be based on the two-level model, but you could easily be combined them with the three-level models outlined above.

### Quadratic trend
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + \beta_{1j}t_{1ij} + \beta_{2j}t_{1ij}^2 + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + \gamma_{01} TX_j + U_{0j} \\
\beta_{1j} &= \gamma_{10} + \gamma_{11} TX_j + U_{1j} \\
\beta_{2j} &= \gamma_{20} + \gamma_{21} TX_j + U_{2j} \\
\end{aligned}
$$
with,
$$

\begin{pmatrix}
U_{0j} \\
 U_{1j} \\
  U_{2j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & \tau_{01} & \tau_{02} \\
 \tau_{01} & \tau_{10}^2 & \tau_{12} \\
  \tau_{02} & \tau_{12} & \tau_{20}^2
\end{matrix}
\right)
,

$$
and
$$

R_{ij} \sim\mathcal{N}(0, ~\sigma^2)

$$

```r
# lme4
lmer(y ~ (time + I(time^2)) * tx +
            (time + I(time^2) | subjects),
             data=data)

# or use poly()
lmer(y ~ poly(time, 2, raw = TRUE) * tx +
            (poly(time, 2, raw = TRUE) | subjects),
             data=data)

# nlme
lme(y ~ (time + I(time^2)) * tx,
            random = ~time + I(time^2) | subjects,
             data=data)
```

#### Orthogonal polynomials
If you'd like to fit orthogonal polynomials you can use the `poly()` function with `raw = FALSE` (which is the default).

```r
# lme4
lmer(y ~ poly(time, 2) * tx +
            (poly(time, 2) | subjects),
             data=data)

# nlme
lme(y ~ poly(time, 2) * tx,
            random = ~poly(time, 2) | subjects,
             data=data)
```

### Piecewise growth curve
Segmenting the time trend into different pieces has got more to do with simple dummy coding of regression variables, than any specifics of `lme` or `lmer`. However, I will cover some common scenarios anyway.

To fit a piecewise growth model we simply replace `time` with two dummy variables `time1` and `time2`, that represent the different time periods. A common scenario is that the first piece represents the acute treatment phase, and piece 2 represent the follow-up phase.

#### Coding scheme 1: separate slopes

| Time   | 0   | 1   | 2   | 3   | 4   | 5   |
| ------ | --- | --- | --- | --- | --- | --- |
| Time 1 | 0   | 1   | 2   | 2   | 2   | 2   |
| Time 2 | 0   | 0   | 0   | 1   | 2   | 3   |

#### Coding scheme 2: incremental/decremental slope

| Time   | 0   | 1   | 2   | 3   | 4   | 5   |
| ------ | --- | --- | --- | --- | --- | --- |
| Time 1 | 0   | 1   | 2   | 3   | 4   | 5   |
| Time 2 | 0   | 0   | 0   | 1   | 2   | 3   |

These two coding schemes only differ in the interpretation of the regression coefficients. In scheme 1 the two slope coefficients represent the actual slope in the respective time period. Whereas in scheme 2 the coefficient for time 2 represents the deviation from the slope in period 1, i.e. if the estimate is 0 then the rate of change is the same in both periods.

![Piecewise growth model in R. By Kristoffer Magnusson](./img/piecewise.png)

We could specify this model like this

$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + \beta_{1j}t_{1ij} + \beta_{2j}t_{2ij} + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + \gamma_{01} TX_j + U_{0j} \\
\beta_{1j} &= \gamma_{10} + \gamma_{11} TX_j + U_{1j} \\
\beta_{2j} &= \gamma_{20} + \gamma_{21} TX_j + U_{2j} \\
\end{aligned}
$$
with,
$$
\begin{pmatrix}
U_{0j} \\
 U_{1j} \\
  U_{2j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & \tau_{01} & \tau_{02} \\
 \tau_{01} & \tau_{10}^2 & \tau_{12} \\
  \tau_{02} & \tau_{12} & \tau_{20}^2
\end{matrix}
\right)
,
$$
and
$$
R_{ij} \sim\mathcal{N}(0, ~\sigma^2)
$$

In this model I've fit the full level 2 variance-covariance matrix. If we wanted to fit this model we'd do it like this

```r
J <- 20 # J participants
data$time1 <- rep(0:5, J)
data$time2 <- rep(c(0,0,0,1,2,3), J)

# lme4
lmer(y ~ (time1 + time2) * tx +
                   (time1 + time2 | subjects),
           data=data)
# nlme
lme(y ~ (time1 + time2) * tx,
                random = ~time1 + time2 | subjects,
        data=data)
```
#### Drop the correlation between time piece 1 and 2
Sometimes you might want to fit a model with a correlation between the random intercept and time piece 1, but no correlation between time piece 2 and the other effects. This would change the level 2 variance-covariance from above to this

$$
\begin{pmatrix}
U_{0j} \\
 U_{1j} \\
  U_{2j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & \tau_{01} & 0 \\
 \tau_{01} & \tau_{10}^2 & 0\\
  0 & 0 & \tau_{20}^2
\end{matrix}
\right)
$$

Fitting this model is straight-forward in `lmer` and more complicated in `lme`.

```r
# lme4
 lmer(y ~ (time1 + time2) * tx +
            (time1 | subjects) +
            (0 + time2 | subjects),
             df)

# nlme
lme(y ~ (time1 + time2) * tx,
          random = list(subjects = pdBlocked(list(~time1, ~0 + time2))),
          data=df)
```

#### Adding a quadratic effect
We could extend the two-part piecewise growth model to allow for non-linear change during one or both of the pieces. As an example, I'll cover extending the model to allow for quadratic change during piece 1.

![Piecewise growth model with quadratic trend in R. By Kristoffer Magnusson](./img/piecewise-quadratic.png)

We could write this model like this
$$
\begin{aligned}
\text{Level 1}& \\
Y_{ij} &= \beta_{0j} + \beta_{1j}t_1 + \beta_{2j}t_{1ij}^2 + \beta_{3j}t_{2ij} + R_{ij}\\
\text{Level 2}& \\
\beta_{0j} &= \gamma_{00} + \gamma_{01} TX_j + U_{0j} \\
\beta_{1j} &= \gamma_{10} + \gamma_{11} TX_j + U_{1j} \\
\beta_{2j} &= \gamma_{20} + \gamma_{21} TX_j + U_{2j} \\
\beta_{3j} &= \gamma_{30} + \gamma_{31} TX_j + U_{3j} \\
\end{aligned}
$$
with,
$$
\begin{pmatrix}
U_{0j} \\
 U_{1j} \\
  U_{2j} \\
  U_{3j}
\end{pmatrix}
\sim\mathcal{N}
\left(
\begin{matrix}
0 &\\
0 &\\
0 &\\
0
\end{matrix}
,
\begin{matrix}
 \tau_{00}^2 & \tau_{01} & \tau_{02}  & \tau_{03} \\
 \tau_{01} & \tau_{10}^2 & \tau_{12} &  \tau_{13}\\
 \tau_{02} & \tau_{12} & \tau_{20}^2 & \tau_{23} \\
 \tau_{03} & \tau_{13} & \tau_{23} & \tau_{30}^2
\end{matrix}
\right)
,
$$
and
$$
R_{ij} \sim\mathcal{N}(0, ~\sigma^2)
$$

This model could be fit like this
```r
# lme4
lmer(y ~ (time1 + I(time1^2) + time2) * tx +
            (time1 + I(time1^2) + time2 | subjects),
             df)

# nlme
lme(y ~ (time1 + I(time1^2) + time2) * tx,
          random =  ~time1 + I(time1^2) + time2 | subjects,
          data=df)
```

If you wanted to fit a reduced random effects structure you could use the method outlined in *"Drop the correlation between time piece 1 and 2"*.

# Hypothesis tests
`lmer` does not report *p*-values or degrees of freedoms, see `?pvalues` and [r-sig-mixed-models FAQ](http://glmm.wikidot.com/faq) for why not. However, there are other packages that will calculate *p*-values for you. I will cover some of them here.

## Wald test
```r
summary(lme.mod)
```

## Likelihood ratio test
```r
fm1 <- lmer(y ~ 1 + (1 | subjects), data=data)
fm2 <- lmer(y ~ 1 + (time | subjects), data=data)
# also works with lme objects
anova(fm1, fm2)
```

## Profile confidence intervals
```r
confint(lmer.mod)
```

## Parametric bootstrap
```r
confint(lmer.mod, method="boot", nsim=1000)
```

## Kenward-Roger degrees of freedom approximation
```r
library(lmerTest)
anova(lmer.mod, ddf = "Kenward-Roger")
```

## Shattertwaite degrees of freedom approximation
```r
library(lmerTest)
anova(lmer.mod)
#or
summary(lmer.mod)
```

# Book recommendations
Not all of these books are specific to R and longitudinal data analysis. However, I've found them all useful over the years when working with multilevel/linear mixed models.

* Singer & Wilett (2003). <a href="http://www.amazon.com/gp/product/0195152964/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0195152964&linkCode=as2&tag=rpsyc-20&linkId=53JJ3JAUSFZ64VHP">Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence</a>
* Pinheiro & Bates (2009). <a href="http://www.amazon.com/gp/product/1441903178/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1441903178&linkCode=as2&tag=rpsyc-20&linkId=2Z4KDF5IE73GMZP5">Mixed-Effects Models in S and S-PLUS (Statistics and Computing)</a>
* Hedeker & Gibsson (2006). <a href="http://www.amazon.com/gp/product/0471420271/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0471420271&linkCode=as2&tag=rpsyc-20&linkId=RPVTFDG4UHVXX5FY">Longitudinal Data Analysis</a>
* Fitzmaurice, Laird, & Ware (2011). <a href="http://www.amazon.com/gp/product/0470380276/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0470380276&linkCode=as2&tag=rpsyc-20&linkId=CSBEDQ3ABDZ3COSP">Applied Longitudinal Analysis</a>
* Diggle et al (2013). <a href="http://www.amazon.com/gp/product/0199676755/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0199676755&linkCode=as2&tag=rpsyc-20&linkId=WITAB5KBDIZPYOBE">Analysis of Longitudinal Data (Oxford Statistical Science Series)</a>
* Gelman & Hill (2006). <a href="http://www.amazon.com/gp/product/052168689X/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=052168689X&linkCode=as2&tag=rpsyc-20&linkId=W3EUL34BHUQSWV45">Data Analysis Using Regression and Multilevel/Hierarchical Models</a>
* Raudenbush  & Bryk (2001). <a href="http://www.amazon.com/gp/product/076191904X/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=076191904X&linkCode=as2&tag=rpsyc-20&linkId=R7H6FE6VV4LTDSBX">Hierarchical Linear Models: Applications and Data Analysis Methods</a>
* Snijders & Bosker (2011). <a href="http://www.amazon.com/gp/product/184920201X/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=184920201X&linkCode=as2&tag=rpsyc-20&linkId=JST5JW5FZ2DTUZZD">Multilevel Analysis: An Introduction to Basic and Advanced Multilevel Modeling</a>
* Hox, J (2010). <a href="http://www.amazon.com/gp/product/1848728468/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1848728468&linkCode=as2&tag=rpsyc-20&linkId=PRHBSG3QY2LPID4V">Multilevel Analysis: Techniques and Applications, Second Edition</a>
* Goldstein, H (2010). <a href="http://www.amazon.com/gp/product/0470748656/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0470748656&linkCode=as2&tag=rpsyc-20&linkId=J3IUJFIMN7VNYH72">Multilevel Statistical Models</a>
* Mirman (2014). <a href="http://www.amazon.com/gp/product/1466584327/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1466584327&linkCode=as2&tag=rpsyc-20&linkId=UQ6VHSCCLULBTZVO">Growth Curve Analysis and Visualization Using R</a>
* Finch, Bolin, & Kelley (2014). <a href="http://www.amazon.com/gp/product/1466515856/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1466515856&linkCode=as2&tag=rpsyc-20&linkId=4Q3A3CMXA5DZCSMJ">Multilevel Modeling Using R</a>

# Suggestions, errors or typos
Please don't hesitate to <a href="http://rpsychologist.com/about">contact me</a> if you find some errors in this guide.

repository: rpsychologist/rpsychologist-com

repo_name: rpsychologist/rpsychologist-com


text:
# SmartGadget-GATT
This module uses the [Bluetooth GATT SDK](https://github.com/getsenic/gatt-python) to retrieve data from a [Sensirion SHT31 SmartGadget](https://www.sensirion.com/en/environmental-sensors/humidity-sensors/development-kit/) Development Kit.

This sensor measures temperature and humidity in a room, and communicates using Bluetooth LE (SMART, Bluetooth 4.0).

Requirements:
- Python 3.4+
- [Bluetooth GATT SDK for Python](https://github.com/getsenic/gatt-python)
- a Bluetooth LE (4.0) enabled adapter

Usage:
```python
import smartgadget

sm = smartgadget.SmartGadget(adapter_name='hci0', device_mac='E9:28:88:82:2B:E2')

print("SmartGadget: Temperature (°C): %.1f" % (sm.temperature())
print("SmartGadget: Humidity (%%): %.0f" % (sm.humidity())
print("SmartGadget: Dew point (°C): %.1f" % (sm.dew()))
```
See the documentation of the Bluetooth GATT SDK for info about device scanning and how to get the MAC address of the sensor.

Tested on a Raspberry Pi Model 3 with Raspbian 9.

See the gatt-examples folder for further details and low-level code.

Credits to the manufacturer code:
- https://github.com/Sensirion/SmartGadget-iOS
- https://github.com/Sensirion/SmartGadget-Firmware

repository: albertosottile/SmartGadget-gatt

repo_name: albertosottile/SmartGadget-gatt


text:
# releases
Uses GitHub API to show feed of releases and open bugs for a given project. You can see a live version of releases in action [here](https://braindump.pw).

## Preview

![Preview Image](https://levlaz.org/wp-content/uploads/2015/11/Screenshot-2015-11-24-19.47.48.png)

## Installation

Releases is now packaged as a npm module, you can install it with `npm install releases`.

## Usage

Add the following HTML to the page where you want the releases to be displayed.

```
<div class="container">
  <h1> Known Issues </h1>
  <ul id="bugs">
  </ul>
  <h1> Latest Releases </h1>
  <ul id="releases">
  </ul>
  <p id="more-releases">
  </p>
</div>
```

Load the following scripts on the same page as where you put the code above. (*note* if you are using Bootstrap you probably are already loading jQuery)

```
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="js/marked.js"></script>
<script src="js/moment.js"></script>
<script src="js/releases.js"></script>
```

Add the Styles from style.css to your existing stylesheet.

```
/* Style for Releases Plugin */
#releases {
  list-style-type: none;
  margin: 0;
  padding: 0;
}
```

Update the `window.repo` variable on [Line 5](https://github.com/levlaz/releases/blob/master/js/releases.js#L5) of `releases.js` to be whatever repo you want to display releases for.

repository: levlaz/releases

repo_name: levlaz/releases


text:
# GBM Tutorial

The purpose of this tutorial is to walk new users through a GBM analysis in H2O Flow.

Those who have never used H2O before should refer to Getting Started for additional instructions on how to run H2O Flow.

## Getting Started

This tutorial uses a publicly available data set that can be found at:
<ahref="http://archive.ics.uci.edu/ml/datasets/Arrhythmia" target="_blank">http://archive.ics.uci.edu/ml/datasets/Arrhythmia.

The original data are the Arrhythmia data set made available by UCI
Machine Learning repository. They are composed of 452 observations and 279 attributes.

If you don't have any data of your own to work with, you can find some example datasets here: http://data.h2o.ai

### Importing Data
Before creating a model, import data into H2O:

1. Click the **Assist Me!** button (the last button in the row of buttons below the menus).

 ![Assist Me button](../images/Flow_AssistMeButton.png)
2. Click the **importFiles** link and enter the file path to the dataset in the **Search** entry field.
3. Click the **Add all** link to add the file to the import queue, then click the **Import** button.
  ![Importing Files](../images/GBM_ImportFile.png)

### Parsing Data
Now, parse the imported data:

1. Click the **Parse these files...** button.

 >**Note**: The default options typically do not need to be changed unless the data does not parse correctly.

2. From the drop-down **Parser** list, select the file type of the data set (Auto, XLS, CSV, or SVMLight).
3. If the data uses a separator, select it from the drop-down **Separator** list.
4. If the data uses a column header as the first row, select the **First row contains column names** radio button. If the first row contains data, select the **First row contains data** radio button. You can also select the **Auto** radio button to have H2O automatically determine if the first row of the dataset contains the column names or data.
5. If the data uses apostrophes ( `'` - also known as single quotes), check the **Enable single quotes as a field quotation character** checkbox.
6. Review the data in the **Data Preview** section, then click the **Parse** button.

  ![Parsing Data](../images/GBM_Parse.png)

  **NOTE**: Make sure the parse is complete by confirming progress is 100% before continuing to the next step, model building. For small datasets, this should only take a few seconds, but larger datasets take longer to parse.

### Building a Model

1. Once data are parsed, click the **View** button, then click the **Build Model** button.
2. Select `Gradient Boosting Machine` from the drop-down **Select an algorithm** menu, then click the **Build model** button.
3. If the parsed arrhythmia.hex file is not already listed in the **Training_frame** drop-down list, select it. Otherwise, continue to the next step.
4. From the **Ignored_columns** section, select the columns to ignore in the *Available* area to move them to the *Selected* area. For this example, do not select any columns.
5. From the drop-down **Response** list, select column 1 (`C1`).
6. In the **Ntrees** field, specify the number of trees to build  (for this example, `20`).
7. In the **Max_depth** field, specify the maximum number of edges between the top node and the furthest node as a stopping criteria (for this example, use the default value of `5`).
8. In the **Min_rows** field, specify the minimum number of observations (rows) to include in any terminal node as a stopping criteria (for this example, `25`).
9. In the **Nbins** field, specify the number of bins to use for data splitting (for this example, use the default value of `20`). The split points are evaluated at the boundaries at each of these bins. As the value of **Nbins** increases, the algorithm approximates more closely the evaluation of each individual observation as a split point. The cost of this refinement is an increase in computational time.
10. In the **Learn_rate** field, specify the tuning parameter (also known as shrinkage) to slow the convergence of the algorithm to a solution, which helps prevent overfitting. For this example, enter `0.3`.
11. Click the **Build Model** button.

  ![Building Models](../images/GBM_BuildModel.png)

### Viewing GBM Results

The output for GBM includes the following:

- Model parameters (hidden)
- A graph of the scoring history (training MSE vs number of trees)
- A graph of the variable importances
- Output (model category, validation metrics, initf)
- Model summary (number of trees, min. depth, max. depth, mean depth, min. leaves, max. leaves, mean leaves)
- Scoring history in tabular format
- Training metrics (model name, model checksum name, frame name, description, model category, duration in ms, scoring time, predictions, MSE, R2)
- Variable importances in tabular format
- POJO Preview

  ![GBM Model Results](../images/GBM_ModelResults.png)

For classification models, the MSE is based on the classification error within the tree. For regression models, MSE is calculated from the squared deviances, as it is in standard regressions.

### Viewing Predictions

To view predictions, click the **Predict** button. From the drop-down **Frame** list, select the arrhythmia.hex file and click the **Predict** button.

To view more prediction data, click the **View Prediction Frame** button.

  ![GBM: Viewing Prediction Frame](../images/GBM_ViewPredictFrame.png)

gha_language: Jupyter Notebook


text:
```### makeElement => string
[
  ["name", "string"],
  ["options?", "MakeElementOptions"]
]
```

This function will create an element as a string given its name and the options. The attributes will be split by new lines whenever the line width reaches the length of 100 symbols, and each line of the content will be indented by 2 spaces as well.

%TYPEDEF types/make-element.xml MakeElementOptions%

%EXAMPLE: example/make-element.js, ../src => @svag/lib%

%FORK-svg example example/make-element%

%~ width="15"%

repository: svagco/lib

repo_name: svagco/lib


text:
# repodoctor
Check your repository health

List of checks:

1. README.md - must not be git default
2. LICENSE
3. CONTRIBUTING.md
4. .travis.yml
5. Travis CI build status
6. .gitignore
7. Test cases

The application works with the repository url. The Python scripts runs above
checks to rate your project on the basis of collaborative friendliness of the
project.

More checks can be implemented as we progress!

repository: abbycabs/repodoctor

repo_name: abbycabs/repodoctor


text:
# Stackdriver Logging Agent
==============

Stackdriver Logging Agent is a DaemonSet which spawns a pod on each node
that reads logs, generated by kubelet, container runtime and containers
and sends them to the Stackdriver. When logs are exported to the Stackdriver,
they can be searched, viewed, and analyzed.

Learn more at: https://kubernetes.io/docs/tasks/debug-application-cluster/logging-stackdriver

## Troubleshooting

In Kubernetes clusters in version 1.10.0 or later, fluentd-gcp DaemonSet can be
manually scaled. This is useful e.g. when applications running in the cluster
are sending a large volume of logs (i.e. over 100kB/s), causing fluentd-gcp to
fail with OutOfMemory errors. Conversely, if the applications aren't generating
a lot of logs, it may be useful to reduce the amount of resources consumed by
fluentd-gcp, making these resources available to other applications. To learn
more about Kubernetes resource requests and limits, see the official
documentation ([CPU][cpu], [memory][memory]). The amount of resources requested
by fluentd-gcp on every node in the cluster can be fetched by running following
command:

```
$ kubectl get ds -n kube-system -l k8s-app=fluentd-gcp \
-o custom-columns=NAME:.metadata.name,\
CPU_REQUEST:.spec.template.spec.containers[].resources.requests.cpu,\
MEMORY_REQUEST:.spec.template.spec.containers[].resources.requests.memory,\
MEMORY_LIMIT:.spec.template.spec.containers[].resources.limits.memory
```

This will display an output similar to the following:

```
NAME                  CPU_REQUEST   MEMORY_REQUEST   MEMORY_LIMIT
fluentd-gcp-v2.0.15   100m          200Mi            300Mi
```

In order to change those values, a [ScalingPolicy][scalingPolicy] needs to be
defined. Currently, only base values are supported (no automatic scaling). The
ScalingPolicy can be created using kubectl. E.g. to set cpu request to 101m,
memory request to 150Mi and memory limit to 400Mi:

```
$ cat <<EOF | kubectl apply -f -
apiVersion: scalingpolicy.kope.io/v1alpha1
kind: ScalingPolicy
metadata:
  name: fluentd-gcp-scaling-policy
  namespace: kube-system
spec:
  containers:
  - name: fluentd-gcp
    resources:
      requests:
      - resource: cpu
        base: 101m
      - resource: memory
        base: 150Mi
      limits:
      - resource: memory
        base: 400Mi
EOF
```

To remove the override and go back to GKE-provided defaults, it is enough to
just remove the ScalingPolicy:

```
$ kubectl delete -n kube-system scalingpolicies.scalingpolicy.kope.io/fluentd-gcp-scaling-policy
```

[cpu]: https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/
[memory]: https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/
[scalingPolicy]: https://github.com/justinsb/scaler

repository: kubernetes/kubernetes

gha_language: Go

repo_name: kubernetes/kubernetes


text:
# MapboxLayer

`MapboxLayer` is an implementation of [mapbox](https://www.npmjs.com/package/mapbox-gl)'s custom layer API. By adding a `MapboxLayer` instance to an mapbox map, one can render any deck.gl layer inside the mapbox canvas / WebGL context. This is in contrast to the traditional deck.gl/mapbox integration where the deck.gl layers are rendered into a separate canvas over the base map.

See [mapbox documentation](https://www.mapbox.com/mapbox-gl-js/api/#map#addlayer) for how to add a layer to an existing layer stack.

## Example

There are two options to construct a `MapboxLayer`.

### Make a Layer from Scratch

This option works best for static layers that do not require advanced interaction controls, or frequent adding/removing/updating.

```js
import {MapboxLayer} from<EMAIL_ADDRESS>import {ScatterplotLayer} from<EMAIL_ADDRESS>
const map = new mapboxgl.Map({...});

const myScatterplotLayer = new MapboxLayer({
    id: 'my-scatterplot',
    type: ScatterplotLayer,
    data: [
        {position: [-74.5, 40], size: 100}
    ],
    getPosition: d => d.position,
    getRadius: d => d.size,
    getColor: [255, 0, 0]
});

// wait for map to be ready
map.on('load', () => {
    // add to mapbox
    map.addLayer(myScatterplotLayer);

    // update the layer
    myScatterplotLayer.setProps({
      getColor: [0, 0, 255]
    });
}
```

### Use a Layer from an Existing Deck's Layer Stack

This option allows one to take full advantage of the `Deck` API, e.g. top-level props such as `pickingRadius`, `onHover`, and adding/removing/updating layers in a reactive fashion by setting the `layers` array.

```js
import {MapboxLayer} from<EMAIL_ADDRESS>import {Deck} from<EMAIL_ADDRESS>import {ScatterplotLayer} from<EMAIL_ADDRESS>
const map = new mapboxgl.Map({...});

const deck = new Deck({
    gl: map.painter.context.gl,
    layers: [
        new ScatterplotLayer({
            id: 'my-scatterplot',
            data: [
                {position: [-74.5, 40], size: 100}
            ],
            getPosition: d => d.position,
            getRadius: d => d.size,
            getFillColor: [255, 0, 0]
        })
    ]
});

// wait for map to be ready
map.on('load', () => {
    // add to mapbox
    map.addLayer(new MapboxLayer({id: 'my-scatterplot', deck}));

    // update the layer
    deck.setProps({
        layers: [
            new ScatterplotLayer({
                id: 'my-scatterplot',
                data: [
                    {position: [-74.5, 40], size: 100}
                ],
                getPosition: d => d.position,
                getRadius: d => d.size,
                getFillColor: [0, 0, 255]
            })
        ]
    });
}
```

## Constructor

```js
import {MapboxLayer} from<EMAIL_ADDRESS>new MapboxLayer(props);
```

Parameters:

- `props` (Object)
  + `props.id` (String) - an unique id is required for each layer.
  + `props.deck` (`Deck`, optional) - a `Deck` instance that controls the rendering of this layer. If provided, the layer will be looked up from its layer stack by `id` at render time, and all other props are ignored.
  + `props.type` (`Layer`, optional) - a class that extends deck.gl's base `Layer` class. Required if `deck` is not provided.
  + Optional: any other prop needed by this type of layer. See deck.gl's [layer catalog](/docs/api-reference/layers/README.md) for documentation and examples on how to create layers.

## Methods

##### setProps(props)

```js
const layer = new MapboxLayer({
    id: 'my-scatterplot',
    type: ScatterplotLayer,
    ...
});

layer.setProps({
    radiusScale: 2
});
```

Update a layer after it's added. Has no effect if `props.deck` is provided.


text:
---
title: "Install Certificate"
date: 2018-10-29T08:06:26-04:00
description: ""
categories: []
keywords: []
slug: ""
aliases: []
toc: false
draft: false
reviewed: true
---

For all light-4j instances, it is highly recommended to use HTTPS/HTTP2 instead of HTTP unless your infrastructure doesn't support HTTPS. That is why HTTPS/2 are enabled right out of the light-codegen with a set of built-in [keystores and truststores][] for development. Before moving to an official testing environment, you need to replace the self-signed certificates with your self-signed or commercial certificates. Please be aware that client.yml, client.keystore, and client.truststore will only be generated when you have the following config attribute in the config.json for light-codegen input. You need to enable this flag if your service is going to call other services in the call stack.

```
"supportClient": true,
```

If you are unsure what kind of certificate should be used in your use case, please refer to [Self-signed vs CA-signed certificate][] for more info. From the process perspective, there is no difference between a CA-signed or self-signed certificate.

The following tutorial will only focus on the server side configuration. If you want to setup client-side certificate, please follow [adding server certificate to client.truststore][] for one-way TLS.

You can use the existing server.keystore and replace the default certificate with the new one, but we don't recommend it as the process is a little bit more complicated and error-prone. It is easier to create your server.keystore with the certificate you have. Different vendors will have different formats with their issued certificate. Sometimes you will get two files, and sometimes you will get three files. There will be a lot of tutorials on the Internet on how to use Java keytool to create .keystore with varying formats of the certificate. You vendor might have a guideline for Java application as well. If you are using [Let's Encrypt][], then you can follow this [CA-signed certificate][] tutorial to create a server.keystore.

If you want a quick reference of Java keytool, please refer to [keytool][].

Often, the public tutorial will use .jks as the file extension. It is OK for one-way TLS but might be confusing if two-way TLS is in use. It is a good idea to stay with the convention of light-4j and name your file as server.keystore.

Once the file is created, copy it into the config folder and update the server.yml to specify the filename.

```
# Keystore file name in config folder. KeystorePass is in secret.yml to access it.
keystoreName: server.keystore
```

During the creation of server.keystore, two passwords need to be captured. They need to be input into the secret.yml file.

```
# Sever section

# Key store password, the path of keystore is defined in server.yml
serverKeystorePass: password

# Key password, the key is in keystore
serverKeyPass: password

```

If you config folder is externalized, then you need to restart your service. Otherwise, you need to rebuild the server and restart it to ensure that the new certificate is used.

[keystores and truststores]: /tutorial/security/keystore-truststore/
[Self-signed vs CA-signed certificate]: /faq/self-ca-signed-cert/
[adding server certificate to client.truststore]: /tutorial/security/publickey-truststore/
[keytool]: /tool/keytool/
[Let's Encrypt]: /tutorial/security/lets-encrypt/
[CA-signed certificate]: /tutorial/security/ca-certificate/

repository: networknt/light-doc

gha_language: CSS

repo_name: networknt/light-doc


text:
# Rust_ELMA ELMA running on Rust Language

Project Goals:
-- Create an ELMA project running On Rust Language
-- I will translate all the c++ code created for elma to rust
-- I will succeed if I am able to port the main parts of elma code to rust
  and the code compiles
-- I will use docker, and may need a rust compiler of some sort

Five Milestones:
1. Research what is needed to run a Rust Project
2. Create a new docker for Rust project
3. Set up the docker to run Rust
4. Translate elma core code
5. Create unit test/ or create testing platform

# HW_9 update
Finished step 1, and step 2 to research and create rust project using docker.
Next I will begin porting all the elma c++ code to rust and creat a test environment
What may be challenging is creating docs and tests for the rust language I will
have to learn what king of libraries are out there and how to used them.

# Rust App In Docker
This repo is a simple example of how to package a Rust app in
a Docker container and support ENV variables (like 12-factor app)

# Requirements
 * Docker environment and familiarity with command lines

# Setup
 * Clone this repo and `cd Elma_Rust`

# Build
`docker build -t my-rust-app .`

# Run (without ENV)
`docker run --rm --name rusty my-rust-app`
 * prints `Hello World`


text:
# What's new in Bookmarks 9

* Moves the Treeview to its own **Activity Bar**
* Adds **column position** for bookmarks
* Adds **Labeled Bookmarks** with a new command `Toggle Labeled`
* Supports for **theme file icon** in Treeview
* Trim leading whitespaces in bookmarks list

# Bookmarks

**Bookmarks** is an open source extension created for **Visual Studio Code**. While being free and open source, if you find it useful, please consider [supporting it](#support-bookmarks).

It helps you to navigate in your code, moving between important positions easily and quickly. _No more need to search for code._ It also supports a set of **selection** commands, which allows you to select bookmarked lines and regions between bookmarked lines. It's really usefull for log file analyses.

Since version 9 you can also define **Labels** for you bookmarks!

Here are some of the features that **Bookmarks** provides:

* **Mark/unmark positions** in your code
* Mark positions in your code and **give it name**
* **Jump** forward and backward between bookmarks
* Icons in **gutter** and **overview ruler**
* See a list of all Bookmarks in one **file**
* See a list of all Bookmarks in your **project**
* A dedicated **Activity Bar**
* **Select lines** with bookmarks
* **Select regions** between bookmarks

# Features

## Available commands

* `Bookmarks: Toggle` Mark/unmark positions with bookmarks
* `Bookmarks: Toggle Labeled` Mark labeled bookmarks
* `Bookmarks: Jump to Next` Move the cursor forward, to the bookmark below
* `Bookmarks: Jump to Previous` Move the cursor backward, to the bookmark above
* `Bookmarks: List` List all bookmarks in the current file
* `Bookmarks: List from All Files` List all bookmarks from all files
* `Bookmarks: Clear` remove all bookmarks in the current file
* `Bookmarks: Clear from All Files` remove all bookmarks from all files
* `Bookmarks (Selection): Select Lines` Select all lines that contains bookmarks
* `Bookmarks (Selection): Expand Selection to Next` Expand the selected text to the next bookmark
* `Bookmarks (Selection): Expand Selection to Previous` Expand the selected text to the previous bookmark
* `Bookmarks (Selection): Shrink Selection` Shrink the select text to the Previous/Next bookmark

## Manage your bookmarks

### Toggle

You can easily Mark/Unmark bookmarks on any position.

![Toggle](https://github.com/alefragnani/vscode-bookmarks/raw/master/images/bookmarks-toggle.png)

### Toggle Labeled

You can even mark _labeled_ bookmarks on any position.

![Toggle](https://github.com/alefragnani/vscode-bookmarks/raw/master/images/bookmarks-toggle-labeled.gif)

## Navigation

### Jump to Next / Previous

Quicky move between bookmarks backward and forward, even if located outside the active file.

### List / List from All Files

List all bookmarks from the current file/project and easily navigate to any of them. It shows a line preview and temporarily scroll to its position.

![List](https://github.com/alefragnani/vscode-bookmarks/raw/master/images/bookmarks-list-from-all-files.gif)

* Bookmarks from the active file only shows the line number and its contents
* Bookmarks from other files in the project also shows the relative path and filename
* Bookmarks from files outside the project are denoted with ![Folder](https://github.com/alefragnani/vscode-bookmarks/raw/master/images/bookmarks-folder-icon.png)

## Selection

You can use **Bookmarks** to easily select lines or text blocks. Simply toggle bookmarks in any position of interest and use some of the _Selection_ commands available.

#### Select Lines

Select all bookmarked lines. Specially useful while working with log files.

![Select Lines](https://github.com/alefragnani/vscode-bookmarks/raw/master/images/bookmarks-selection-select-line.gif)

#### Expand Selection to the Next/Previous Bookmark or Shrink the Selection

Manipulate the selection of lines _between_ bookmarks, up and down.

![Expand/Shrink](https://github.com/alefragnani/vscode-bookmarks/raw/master/images/bookmarks-selection-expand-shrink.gif)

## Available Settings

* Allow navigation through all files that contains bookmarks (`false` by default)
```
    "bookmarks.navigateThroughAllFiles": true
```

* Bookmarks are always saved between sessions, and you can decide if it should be saved _in the Project_, so you can add it to your Git/SVN repo and have it in all your machines _(`false` by default)_
```
    "bookmarks.saveBookmarksInProject": true
```

* Path to another image to be shown as Bookmark (16x16 px)
```
    "bookmarks.gutterIconPath": "c:\\temp\\othericon.png"
```

## Activity Bar

The **Bookmarks** are now presented in its own Activity Bar, giving you more free space in your Explorer bar. You will have a few extra commands available:

* Jump to a bookmark, simply clicking in the bookmark item
* Remove a bookmark, right clicking in the bookmark item
* Clear the bookmark's file, right-clickin in the file item

![Treeview](https://github.com/alefragnani/vscode-bookmarks/raw/master/images/bookmarks-activity-bar.gif)

## Support Bookmarks

While **Bookmarks** is free and open source, if you find it useful, please consider supporting it.

I've been building **Bookmarks** since VS Code internal beta days, and while I enjoy developing it, I would like to be able to give more attention to its growth.

---

# License

[MIT](https://github.com/alefragnani/vscode-bookmarks/blob/master/LICENSE.md) © Alessandro Fragnani

repository: avanslaars/code-profiles

repo_name: avanslaars/code-profiles


text:
# About

A simple command-line utility for password-protected
file encryption, akin to the scrypt utility.

# Usage

```sh
pwcrypt enc --infile foo.txt --outfile foo.txt.enc
pwcrypt dec --infile foo.txt.enc --outfile foo.txt
```

repository: joachifm/pwcrypt

extension: markdown

repo_name: joachifm/pwcrypt


text:
---
layout: main-no-sidebar
title: "NSF 1815238 -- III: Small: An end-to-end pipeline for interactive visual analysis of big data"
---

# Summary

This is the webpage for the NSF project "III: Small: An end-to-end
pipeline for interactive visual analysis of big data".

* Duration: September 1st, 2018 -- August 31st, 2021.

* NSF Information: [award page, NSF-1815238](https://www.nsf.gov/awardsearch/showAward?AWD_ID=1815238).

* Original proposal document: [pdf](assets/nsf-1815238-project-description.pdf).

## Personnel

* PI: [Carlos Scheidegger](https://cscheid.net)

* PhD Student: Zhe Wang (now graduated)

* PhD Student: Mingwei Li (5th year)

* PhD Student: Zhenge Zhao (5th year)

## Publications

* [NeuralCubes: Deep Representations for Visual Data
  Exploration](https://arxiv.org/abs/1808.08983). Zhe Wang, Dylan
  Cashman, Mingwei Li, Jixian Li, Matthew Berger, Joshua A. Levine,
  Remco Chang, Carlos Scheidegger. [arXiv preprint arXiv:1808.08983](https://arxiv.org/abs/1808.08983).

* [Disentangling Influence: Using disentangled representations to
audit model
predictions](http://papers.nips.cc/paper/8699-disentangling-influence-using-disentangled-representations-to-audit-model-predictions.pdf). Charles
Marx, Richard Phillips, Sorelle Friedler, Carlos Scheidegger, Suresh
Venkatasubramanian. Proceedings of NeurIPS 2019.

* [A Structured Review of Data Management Technology for Interactive Visualization and
  Analysis](db-tech-for-interactive-vis/). Leilani Battle and Carlos
  Scheidegger, IEEE VIS 2020.

* [Visualizing Neural Networks with the Grand Tour](http://hdc.cs.arizona.edu/~mwli/grandtour/). Mingwei Li,
  Zhenge Zhao, Carlos Scheidegger. [Distill](https://distill.pub/2020/grand-tour/). DOI: 10.23915/distill.00025

* [Anteater: Interactive Visualization for Program
  Understanding](https://arxiv.org/abs/1907.02872). Rebecca Faust,
  Kate Isaacs, William Bernstein, Michael Sharp, Carlos
  Scheidegger. [arXiv preprint
  arXiv:1907.02872](https://arxiv.org/abs/1907.02872).

## Software

* [pothos](https://github.com/hdc-arizona/pothos) is the code
  platform for the data cube research in this project.

* [neuralcubes](https://github.com/hdc-arizona/neuralcubes) is the code
  platform for the deep neural networks used to approximate data cubes in [NeuralCubes](https://arxiv.org/abs/1808.08983).

<!-- ## Datasets -->

## Acknowledgments

This material is based upon work supported or partially supported by the National Science Foundation under Grant Number 1815238, project titled "III: Small: An end-to-end pipeline for interactive visual analysis of big data"

Any opinions, findings, and conclusions or recommendations expressed in this project are those of author(s) and do not necessarily reflect the views of the National Science Foundation.

Web page last update: 2020-02-13.

gha_language: TeX


text:
# Starwars Api

This Starwars Api is a simple node.js application built to fetch, transform and aggregate data from SWAPI api

- Node version: v8.10.0
- Application version: v1.0.0
- Framework Version: Express ^4.16.4

# Architecture

The application is structured in a component base architecture, where each feature is placed in a component folder of its own. The content of the components folder is the different features of the application in this case; movies, characters, comments under each of this feature folder there are controller, route, service.

###### Route:

This recieves requests from the main router which ha come from the client, and then picks the appropriate controller function to process the request.

###### Controller:

Requests from the routes are pushed to the controller, the controller then calls the appropriate functionalities to process the request, which includes calling the service to fetch data from models(database) or external api.

###### Service:

The Service functionality process' request for data, and chooses the appropriate channel to get the data from, be it a database or a an external api.

###### Folder Structure

Some files and folders where ignored on purpose since they had no great consequence on undertanding the application

######

######

```
starwars
│   README.md
│   index.js
|   package.json
│
└───api
│   │
|   └─── tests
│   │
|   └─── v1.0.0
|   |   |
|   |   └───  components
│   │   |   |
|   |   |   └───  characters
|   |   |   |       | characters.controller.js
|   |   |   |       | character.routes.js
│   │   |   |       | character.service.js
|   |   |   └───  comments
│   │   |   |       | comments.controller.js
|   |   |   |       | comments.routes.js
|   |   |   |       | comments.service.js
|   |   |   └───  movies
|   |   |   |       | movies.controller.js
|   |   |   |       | movies.routes.js
|   |   |   |       | movies.service.js
|   |
|   |   route.js
|   |
│
└─── config
|    │   config.json
|
└───  migrations
|   | ...
|
└───  models
|   | comments.js
|   | index.js
|
└───  node_modules
|   |...
|
└───  dist
```

# Install!

Go to your terminal annd run
```
  - git clone https://github.com/preciousgeorge/starwars
  - cd starwars & yarn
  - ./node_modules/.bin/sequelize db:migrate
```

Open projectfolder/config/config.json.ed
Rename the file to config.json

Set the database configurations there to the ones specific for your environment, please enter `null` for value that does not apply to your environment.

Then run the command below in your terminal from the project dirctory

```
  - ./node_modules/.bin/sequelize db:migrate
```

##### Movies

Movie endpoint returns all movies

| url                                                                             | verb | sample request                                                                                |
| ------------------------------------------------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------- |
| api/v1/movies/                                                                  | GET  | FULL URL: http\|https://url/api/v1/movies                                                                              |
| api/v1/movies/:id                                                               | GET  | FULL URL: http\|https://url/api/v1/movies/1                                                                            |
| api/v1/movies/:id/comments                                                      | GET  | FULL URL: http\|https://url/api/v1/movies/1/comments                                                                   |
| api/v1/movies/:id/comments                                                      | POST | FULL URL: http\|https://url/api/v1/movies/1/comments Request Content: {comment:"Starwars is the best movie franchise"} |
| api/v1/movies/:id/characters                                                    | GET  | FULL URL: http\|https://url/api/v1/movies/1/characters                                                                 |
| api/v1/movies/:id/characters?sortby={gender, height, e.t.c}?orderby=asc or desc | GET  | FULL URL: http\|https://url/api/v1/movies/1/characters?sortby=height?orderby=asc                                       |
| api/v1/movies/:id/characters?filterby=gender                                    | GET  | FULL URL: http\|https://url/api/v1/movies/1/characters?filterby=male                                                   |

###### URL path:

- api : is the path to the api part of the application
- v1 : is the version, if a lot of features are to be added that would change the way the present implementation, instead of just changing everything, another version should be created. Versioning is to help prevent issues with clients making requests and expecting a certain result but getting something entirely different, some client applications would not neccessarily change as much as the api they request to.
- :id : this is an integer used to identify a unique data set, e.g movie :id identifies one movie, so anywhere it is required, a single dataset or it's relations is either being fetched, modified or created.

###### Query Strings and how to use them:

- sortby: the sortby query string takes a string arguement of either gender, height e.t.c
- orderby: the orderby query string must be followed by the string asc or desc (where asc = ascending, desc = descending) and the ordering would only work if the sorbyby query string is used
- filterby: the filterby query string must be followed by a string e.g gender, the result returned would be that of containing the filter string.

## License

MIT

repository: preciousgeorge/starwars

repo_name: preciousgeorge/starwars


text:
# Save Extension
[![Version](https://img.shields.io/github/v/release/piperift/SaveExtension?label=version)](https://github.com/PipeRift/SaveExtension/releases)
![UE4](https://img.shields.io/badge/UE4-4.19%2B-orange)
[![Discord](https://img.shields.io/discord/288221302089711616?color=%237289da&label=discord)](https://discord.gg/nnsdr22)

Save Extension allows your projects to be saved and loaded.

This plugin is for Unreal Engine 4 and actively supports the last 2 versions of the engine.

## Introduction

At Piperift we like to release the technology we create for ourselves.

Save Extension is part of this technology, and as such, we wanted it to be public so that others can enjoy it too, making the job of the developer considerably easier.

This plugin was designed to fulfill the needs for automatic world saving and loading that are unfortunately missing in the engine at this moment in time. Automatic in the sense that any actor in the world can be saved, including AI, Players, controllers or game logic without any extra components or setups.

## Intended Usage

All our technology is designed to work for very different games and needs, but, naturally, it was created around certain requirements.

In the case of SaveExtension, it has been developed to support games with high amounts of content in the world like open worlds or narrative games.

What I mean by this is that you usually wouldn't serialize a world for a mario game. It can do it, but may not be worth it. Other games might have items to be picked, player states, AI, or streaming levels that require this serialization and here's where the strength of SaveExtension comes.

## Documentation

Documentation is available online:

#### [Documentation](https://piperift.com/SaveExtension/)

repository: PipeRift/SaveExtension

repo_name: PipeRift/SaveExtension


text:
# MEP API
MEP API is a very simple python package to scrape data on members of the European Parliament and output it in a neat JSON.

### Installation
Install this repository with pip:
```
pip install mep_api
```

### Usage

#### Scraping one MEP's information
To create an MEP object, import the package pass the URL of an MEP's EP home page. For instance:
```python
import mep_api
mep1 = mep_api.mep("https://www.europarl.europa.eu/meps/en/113892/ERIC_ANDRIEU/home")
```
Then you can add the information you want to the object:
```python
mep1.get_personal_data()
mep1.get_committees()
mep1.get_assistants()
```
or you can scrape everything at once:
```python
mep1.scrape_all()
```
You can then either get a JSON string containing all of the MEP's information and write to a file by running:
```python
mep1.to_json() #returns JSON string
mep1.to_json("file.json") #writes JSON file to specified path
```

#### Scraping multiple MEPs' information
It is possible to scrape data for multiple MEPs with a single line of code with `batch_scrape()` as follows:
```python
url_list = ["https://www.europarl.europa.eu/meps/en/113892/ERIC_ANDRIEU/home", "https://www.europarl.europa.eu/meps/en/124831/ISABELLA_ADINOLFI/home", "https://www.europarl.europa.eu/meps/en/28161/MARGRETE_AUKEN/home"]
mep_api.batch_scrape(url_list) #return JSON string
mep_api.batch_scrape(url_list, outfile="file.json") #writes JSON file to specified path
```
The `get_mep_urls()` function returns a list of all MEP home page URLs and makes collecting data on all MEPs at once easy. It is also possible to scrape available data for so-called "outgoing" MEPs, MEPs who have left the parliament during the current parliamentary term. To do so, it is sufficient to use the `batch_scrape()` function with the argument `add_outgoing = True` which is `False` by default. It is possible not to pass a `url_list` to the function to collect data only on outgoing MEPs. It is however not possible to collect data on single outgoing MEPs as of now.
```python
all_mep_urls = mep_api.get_mep_urls() #creates a list of all MEP URLS
mep_api.batch_scrape(all_mep_urls) #collects data on all current MEPs
mep_api.batch_scrape(all_mep_urls, add_outgoing=True) #collects data on all current MEPs and outgoing MEPs
mep_api.batch_scrape(add_outgoing=True) #collects data on outgoing MEPs
```


text:
# Meta Learning to Rank

Here provides the guiding code for running meta-learning to reweight technique, which uses target data to reweight training data during the learning to rank process.

A detailed introduction to the technology can be found in the paper [**Few-Shot Text Ranking with Meta Adapted Synthetic Weak Supervision**](https://arxiv.org/pdf/2012.14862.pdf).

## Running

The code to run meta-learning is in the shell file
```
bash meta_dist_train.sh
```
In the shell file, the code is written as

```
export gpu_num=4 ## GPU Number
export master_port=23900
export job_name=MetaBERT

## ************************************
export DATA_DIR= ## please set your dataset path here.
export SAVE_DIR= ## please set your saving path here.

repository: wyfunique/OpenMatch

repo_name: wyfunique/OpenMatch


text:
It is named after Carmen Miranda, the dancer in the tutti-frutti hat.

## Overview

In order to accept Apple Pay payments on the web a merchant session object is required.

The `miranda` package provides a Dance function to perform the server side steps through it's MerchantValidationService interface.

A partner is required for this dance in order to perform the client side steps and provide the validation URL.

See https://developer.apple.com/reference/applepayjs/applepaysession#2166532

repository: flanchegong/EmporiumsNewClothes

repo_name: flanchegong/EmporiumsNewClothes