text:
# Changelog

## 0.2.6
* Allow newer Auth0 library and jwt library

## 0.2.5
* No Changes (version bump).

## 0.2.4
* Fixed issue with updating a user where a user on a different strategy than the database connection can't have its name attributes updated.

## 0.2.3
* Updated the user sync to stop storing the user name fields on app_metadata.
* Updated the mock exception throwing to support working with newer versions of the auth0 gem.

## 0.2.2
* Updated the versions of various gem dependencies.
* Updated the user sync to store the user name fields directly on the user. We'll remove them from the app_metadata in a future version.

## 0.2.1
* Replacing calls to UUIDTools::UUID.timestamp_create to be UUIDTools::UUID.random_create instead to resolve an error with GCloud hosting.

## 0.2.0
* No Changes (version bump).

## 0.1.9
* Updated the update_user call to not send the verification email if the email is already verified.

## 0.1.8
* Removed specific version requirement for json gem.
* Loosened the jwt gem version dependency.

## 0.1.7
* Fixing issue with email uniqueness validation finding unrelated email addresses.

## 0.1.6
* Updating SyncAttrWithAuth0::Auth0#find_by_users back to using a lucene email search.

## 0.1.5
* Updating SyncAttrWithAuth0::Auth0#find_by_users to use new v2 users-by-email endpoint instead of a search.

## 0.1.4
* Upgrading the versions of gem dependencies, including jwt.

## 0.1.3
* Renamed SyncAttrWithAuth0::Adapters::ActiveRecord::Sync to be Auth0Sync to prevent collisions.

## 0.1.2
* Updated the user search to support filtering the current user's Auth0 user id from the results.

## 0.1.1
* Updated the create to submit the app_metadata hash.

## 0.1.0
* Updated the configuration so a config block can be used. Any setting on the model will override the config block.
* Changed the default for the Auth0 namespace setting to look at 'AUTH0_NAMESPACE' instead of 'AUTH0_DOMAIN'.
* Changed the attribute settings to use non-abbreviated variable names.
* Updated the usage to include the fields to sync separate from the rest of the config.
* A bunch of refactoring of methods into multiple modules to hopefully improve future maintenance (Configuration, Validation, Sync, etcetera).
* Updated the sync so on create and on update, it determines if the sync to Auth0 should be a create or patch separately (to resolve issues with data inconsistency).
* Updated the Auth0 update to always submit passwords and emails when they are changed, even if they are not fields to sync (that shouldn't be a requirement).

## 0.0.25
* Slackening the rest-client dependency.

## 0.0.24
* Added the ability to sync email changes to Auth0.

## 0.0.23
* Changed the Auth0 user id updates to occur after-commit instead of within the create or update transaction.

## 0.0.22
* If the password is the only change, the gem will still update with Auth0.

## 0.0.21
* Added a check to see if the sync'd attributes have changed to determine if the update callback should run.

## 0.0.20
* Expanded the handler for the situation where the local user record has an invalid Auth0 user id to lookup the user or create it.

## 0.0.19

## 0.0.18
* Added some simple error handling for when the local user has an invalid Auth0 user id.

## 0.0.17
* Added validation for the required environment variables.

## 0.0.16
* Updated the default password to contain a capital letter.

## 0.0.15
* Updated to only submit the password if it's being changed.
* If the password is not stored on the local user record, setting the password attribute will be considered the same as changing the value.

## 0.0.14
* Added the ability to send password changes on-update.

## 0.0.13
* Added auth0 and jwt gems as dependencies.
* Switched to using the auth0 gem to make API calls to Auth0.
* Updated the options for the gem.
* Updated the sync to always push all the data.

## 0.0.12

## 0.0.11

## 0.0.10

## 0.0.9
* Made the attribute options unique to prevent collisions.
* Suppressed the create when the user record already has an Auth0 user id.

## 0.0.8
* Temporarily resolving an issue where the email_verfied attribute does not have a boolean value.

## 0.0.7

## 0.0.6

## 0.0.5
* Updated to handle the password and email_verified missing on the model.

## 0.0.4
* Made the "ok to validate" and "ok to sync" checks assume it's ok if the attributes controlling the decision are missing on the model.

## 0.0.3
* Added additional Auth0 API support for create, updating emails, updating passwords, validating emails, etcetera.

## 0.0.2
* Removed sqlite development dependency.

## 0.0.1
* Initial Release


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

### Description

PD PORTAL 4.0 stores sensitive information under the web root with insufficient access control, which allows remote attackers to download a database via a direct request for db/db.mdb.

### POC

#### Reference
- http://packetstormsecurity.org/1001-exploits/pdportal-disclose.txt

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

license: MIT

repository: trickest/cve

branch_name: refs/heads/main

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive

repo_name: trickest/cve


text:
# bettersigntool

A wrapper around signtool with added features

* Batch mode (supply a .txt of filenames)
* Parallel signing
* Automatic retry with exponential back-off

Currently only supports the **sign** operation with a PFX and password

## Basic usage

Almost all switches are named the same as the default signtool (`/du` is `-du`, for example). The only exception is the input filename, which must be prefixed with `-I` (capital i)

	bettersigntool -d "Organisation Name" -du "http://mycompany.com" -f "C:\my.pfx" -p "password" -I myfile.dll

By default, the timeserver is Verisign, but you can override this by specifying the `-t` argument, as per the default signtool, i.e.:

	-t "http://timestamp.myspecialtimeserver.com"

## Batch mode

bettersigntool can take a .txt file and sign all of the filenames listed inside of it. The paths should be relative to the location of the .txt file itself.

The .txt extension is automatically detected on the input file and the tool behaves accordingly.

e.g.

### myfile.txt

	bin/file.dll
	bin/file2.dll

### Calling arguments

	bettersigntool -d "Organisation Name" -du "http://mycompany.com" -f "C:\my.pfx" -p "password" -I myfile.txt

Both `file.dll` and `file2.dll` will be signed as a result of the above

## Failure mode

As mentioned above, bettersigntool supports retry with exponential back-off. By default the tool will attempt 2 retries (three attempts total) per file but you can set this number via the optional `-ma` parameter.

The default behaviour is currently:

* Signing will be attempted a *total* of 3 times (i.e. 1 initial attempt, 2 retries)
* Initial base is 6 seconds (6000ms), with an exponent of 2 for each subsequent attempt
* Each back-off delay is jittered to between 50-100% of base
* Initial delay is between 3-6 seconds (6000ms)
* Second delay is between 6 and 12 seconds

repository: squaredup/bettersigntool

branch_name: refs/heads/master

gha_language: C#

repo_name: squaredup/bettersigntool


text:
# HaventecAuthenticate

[![Version](https://img.shields.io/cocoapods/v/HaventecAuthenticate.svg?style=flat)](https://cocoapods.org/pods/HaventecAuthenticate)
[![License](https://img.shields.io/cocoapods/l/HaventecAuthenticate.svg?style=flat)](https://cocoapods.org/pods/HaventecAuthenticate)
[![Platform](https://img.shields.io/cocoapods/p/HaventecAuthenticate.svg?style=flat)](https://cocoapods.org/pods/HaventecAuthenticate)

A collection of functions for native iOS apps to facilitate the integration with Haventec Authenticate

## Installation

HaventecAuthenticate is available through [CocoaPods](https://cocoapods.org/pods/HaventecAuthenticate). To install
it, simply add the following line to your Podfile:

```ruby
pod 'HaventecAuthenticate'
```

Afterwards, make sure to run pod install in your working project directory.

## Usage

Import the main class HaventecAuthenticate:

```
import HaventecAuthenticate;
```

This class has the following methods:

* **initialiseStorage:** It initilises the Android Storage for a specific Haventec Authenticate user. Your app has to call this method once you know the username of the user.

* **updateStorage:** It updates the Android Storage with the new user details. Whenever your app invokes a method that changes the authentication state (add user, add device, activate user, activate device, or login), your app must update the Haventec SDK storage using this method.

* **hashPin:** It returns a SHA-512 Hashing of the PIN passed as argument.

* **getAccessToken:** It returns the session access token of the current authenticated user from the Android Storage

* **getAuthKey:** It returns the current authKey of the current user from the Android Storage

* **getUsername:** It returns the username of the current user from the Android Storage.

* **getDeviceUuid:** It returns the deviceUuid of the current user from the Android Storage

To initialise, call the initialiseStorage method. This provisions the device persisted storage for the username.

Whenever you invoke a method that changes the authentication state of the device - add user, add device, activate user,
activate device, login - you must update the Haventec SDK storage, using updateStorage.
This can accept the NSData object directly returned from any of these endpoints.

In order to authenticate with Haventec endpoints, a hashed version of the pincode is required, so the hashPin method is used for that.

The rest of the methods provide easy access to the data that is required for the Haventec endpoints.

## Demo app

To run the example project, you need to perform the following:

1. Clone the repo
2. Update the app configuration file in "/Example/HaventecAuthenticate/App.example.plist" with appropriate values
3. Rename "/Example/HaventecAuthenticate/App.example.plist" to "/Example/HaventecAuthenticate/App.plist" for the app target build to use that config.
4. Finally, run the HaventecAuthenticate-Example target build on a iOS device in xCode.

## Requirements

No dependencies are required for this SDK.

## Author

Haventec - (https://www.haventec.com/)

## License

HaventecAuthenticate is available under the MIT license. See the LICENSE file for more info.

repository: zip-code/authenticate-ios-sdk

repo_name: zip-code/authenticate-ios-sdk


text:
# PwlLang

A little language extension based on [mbeddr](https://mbeddr.com) for [Papers We Love @ Seattle](https://github.com/papers-we-love/seattle).

It adds an `unless` statement type:

```c
do {
  // Some stuff.
} unless (aReasonNotToDoIt);
```
And the sandbox has some examples of using it together with other mbeddr modules.

repository: fernomac/PwlLang

repo_name: fernomac/PwlLang


text:
---
title: Spreadsheets Lesson 5
layout: post
author: jack.morgan2
permalink: /spreadsheets-lesson-5/
source-id: 1T85GUInXPO_tcgzInEtgmRNMNaA5utB6iRkJCEUKrSA
published: true
---

    Title
    Spreadsheets Lesson 5
    Date
    11/09/17

    Starting point:
    Last lesson we had made a cost sheet

    Target for this lesson?
    To work out the cost of our items

    Did I reach my target?

    Yes, I totalled how much my items are going to cost.

    Lesson Review

    How did I learn? What strategies were effective?

    At the beginning of today's lesson, we were discussing why it is important to learn how to use spreadsheets. We came up with answers such as : You will need to use them in your job, you can use them to help with tax returns, you can even use them to see which deal you should get when buying something.  He considered the petrol, tax, insurance and cost of the car. This goes to show how useful spreadsheets actually are and, therefore, how important it is that we learn about them.

 During today's lesson, we were looking at discount codes. We created a new sheet called discount codes:

This includes, the starting two letters of the code, the issued code and then the discount that it gives. We then added a new section below our sub-total which was discount. I also made a small box where you can easily add your code, and then a box next to it saying the % discount. There is also a section that shows you how much money you get taken of because of the discount. We had to use the V-LOOKUP function to find the correct discount code and then show us the price that it reduces it by. To find the % discount of a code I used the =VLOOKUP(B13, discounts, 3) command. This finds the 3rd column of the discount named range. I also use =C13*F11*-1 To find out how much the discount reduces the subtotal by.

Therefore, I have a working discounts section on my order form.

This lesson needed lots of perseverance to solve problems to debug. It requires lots of logical thinking but you need to have the right attitude when it comes to problem solving. Otherwise, you will get nowhere. However, when things do get hard, I can collaborate with the person next to me to achieve something together.

Here is what my sheet looks like so far:
 height="700" width="675">

    What limited my learning? Which habits do I need to work on?

    Today my learning was not limited. I got on with the work and achieved my goal.

    What will I change for next time? How will I improve my learning?

    I personally Think that I am a "Very Good" student on the criteria that our teacher gave us. However, to push myself that bit harder and become an “Excellent Student” I will need to contribute and put my hand up in class. This is a target that I am trying to work on in all subjects, not just computer science.


text:
Erlware Commons
===============

Erlware commons can best be described as an extension to the
[stdlib application](http://www.erlang.org/doc/apps/stdlib/index.html)
that is distributed with Erlang. These are things that we at
[Erlware](http://www.erlware.org) have found useful for production
applications but are not included with the distribution. We hope
that as things in this library prove themselves useful, they will make
their way into the main Erlang distribution. However, whether they do
or not, we hope that this application will prove generally useful.

### Goals for the project

* Generally Useful Code
* High Quality
* Well Documented
* Well Tested

How To Use the Code
-------------------

In general the [erldocs](http://erlware.github.com/erlware_commons)
will describe how to use each module in the application. There is some
additional information that is useful, but for the most part it's all
there.

Generally Useful Code
---------------------

We are trying to keep the code base clean, so we only accept code into
the application that has proven to be useful in multiple projects over
the course of years (generally). This shouldn't be a dumping ground
for everything that *might* be useful in random projects.

High Quality
------------

Every piece of Erlware code gets peer reviewed by one or more of the
core committers (there are four of us at the moment) before it ever
makes it into a canonical Erlware repo. We all write Erlang code for a
living and care alot about quality. It is our hope that this makes the
Erlware Commons code, and Erlware code in general, some of the best
out there.

Well Documented
---------------

We have some minimal standards for documentation that are required
(public apis have to be spec'd and commented). However, it's very
difficult to standardize 'well documented'. That's one of the nice
places code review comes in. We all have a good feel for what 'well
documented' is and we try to make sure that happens for all the code.

Well Tested
-----------

For Erlware Commons we have a hard requirement that we get 75% test
coverage on every module in the system as reported by the Erlang Cover
application. In many modules we have much better coverage, but 75% is
the minimum. Things don't go into Erlware Commons without being well
tested, period. Again, we hope that this will lead to usable, durable
code base.

Conclusion
----------

Dig in, use the code. We hope it's as helpful to you as it is to us.
Feel free to contribute back bug fixes, suggestions, issues etc.
You can find more information at

* [Erlware Website](http://www.erlware.org)
* [Erlware General Mailing List](http://groups.google.com/group/erlware-questions)
* [Erlware Dev Mailing List](http://groups.google.com/group/erlware-dev)

<!--  LocalWords:  apis
 -->


text:
# On-Call Issue Filer

[![Docker Repository on Quay](https://quay.io/repository/philips/oncall-issue-filer/status "Docker Repository on Quay")](https://quay.io/repository/philips/oncall-issue-filer)

File issues on GitHub based on acknowledged alerts.

On-call rotations where an incident requires multiple stakeholders coming
together over a period of days or weeks need a coordination point. For many
teams that is GitHub Issues.

This tool will assist an on-call person coordinate by automatically filing a
GitHub issue once an alert has been acknowledged.

| Tool       | Supported?  |
| ---------- |------------ |
| OpsGenie   | Yes         |
| Pager Duty | Help Wanted |
| ???        | Help Wanted |

## Kubernetes Usage

Deploy the CronJob:

```
git clone https://github.com/philips/oncall-issue-filer
kubectl create -f kube/cronjob.yaml
```

Add your secrets based on `kube/secret.yaml`. Keep in mind the [fields are base64 encoded](https://kubernetes.io/docs/concepts/configuration/secret/).

## Hacking

Make sure you have Go 1.11+ installed then:

```
git clone https://github.com/philips/oncall-issue-filer
export GO111MODULE=on
go run main.go
```

## OpsGenie Configuration

### User Tag Configuration

Every user must add a `github=GITHUB_USERNAME` tag to their OpsGenie profile for the tool to work.

![User Configuration](/docs/opsgenie/user-tag.png)

### Alert Configuration

**Ignore Replies**

Add Ignore Filter for `(?:(?i)re: |fwd: )?(.*)`.

![Ignore Filter Configuration](/docs/opsgenie/ignore-filter.png)

**Alert Fields**

Configure as shown below.

![Alert Fields Configuration](/docs/opsgenie/alert-fields.png)

## TODO

- Refactor into cleaner packages
- Introduce dry-run via refactor

repository: philips/oncall-issue-filer

repo_name: philips/oncall-issue-filer


text:
# Changelog

## [1.3.2] - 2021-12-03
### Changes
- Added better error handling to the `IDependencyInjectionCompleteHandler`.
- Added `EnableLogging` property, and added several logs.
- Refactored the type cache, improving injection performance.
- Identified optimization opportunity and documented it with comments.

## [1.3.1] - 2021-09-07
### Changes
- Added LICENSE.md

## [1.3.0] - 2020-10-27
### Changes
- `InjectToSceneObjects` can now optionally inject to inactive game objects (default behaviour is to include inactive objects)

repository: kkjamie/unity-dependency-injection

branch_name: refs/heads/development

repo_name: kkjamie/unity-dependency-injection


text:
# Fundamentals of computational data analysis using R
## Multivariate statistics: multiple regression
#### Contact<EMAIL_ADDRESS>
---

### Index

- [Multiple regression](#multiple-regression)
- [Correlated predictors](#correlated-predictors)
- [Interactions](#interactions)

### Check your understanding

- [Check 1](#check-your-understanding-1)
- [Check 2](#check-your-understanding-2)
- [Check 3](#check-your-understanding-3)

---

### Multiple regression

So far we have looked at estimating population parameters based on random
  samples, where those parameters have described either the distribution of
  a single variable considered in isolation (e.g. the one-sample t-test
  and one-sample proportion test), or how the distribution of one variable
  depends on the value of another. When two variables are independent,
  the value of one variable has no impact on the distribution of the other.
  When they are not independent, then the distribution of one of the variables
  is conditional on the value of the other. For instance, the t-test tests
  whether the value of a categorical variable (designating which one of the
  two groups being compared an observation belongs to) affects some aspect
  (in particular, the mean) of the distribution of the continuous variable.
  The ANOVA extends this analysis to the case of a categorical variable with
  more than two categories. We also used the proportion test for two
  categorical variables to see if the group proportions of one variable
  was independent of the group value of the other variable. We used
  correlation tests to see if the distribution of two continuous variables
  were linearly independent of one another. We extended the ideas of the
  correlation test and the t-test to use linear regression to estimate the
  conditional mean of one continuous variable based on the value of another
  continuous variable. We saw that linear regression could also incorporate
  categorical predictors, in which case it could be shown to be equivalent to
  the equal variances t-test and ANOVA procedures.

When fitting a simple linear regression model with a **continuous predictor** `x`,
  we saw that two coefficients would be estimated. One was the coefficient for the
  continuous predictor `b1`, which is equivalent to the slope of the prediction line.
  The other coefficient was the intercept `b0`, which is a constant term in the
  prediction formula that describes the value of the response `y` when `x`
  is zero. This value sets the vertical position of the prediction line. That is,
  increasing `b0` shifts the regression line upward without changing its slope,
  while decreasing `b0` shifts the regression line downward. Knowing these two
  coefficients alone allows us to make predictions for future values:
  `y = b0 + b1 * x1`. The accuracy of predictions would depend on the accuracy
  of the assumption that the true relationship was linear, the accuracy with
  which the coefficients were estimated, and the magnitude of the error term,
  which describes the spread of data points around the prediction line.

When fitting a simple linear regression model with a **categorical predictor** `x`,
  we saw that the number of coefficients estimated for `x` would depend on how
  many categories or 'levels' `x` contains. In general, the number of coefficients
  would be the number of categories minus one, plus one coefficient for the
  intercept. For instance, if there were two categories, say 'A' and 'B', we would
  estimate the intercept `b0` and one group coefficient `b1`. There are many
  possible ways of specifying the same relationship using two coefficients that
  result in identical predictions, even though each way results in different
  values for the coefficients. The different ways of encoding the relationship
  with the coefficients is called the **contrast** used during the regression
  (or ANOVA). One simple to interpret (and the default for unordered factor
  categories) contrast is the **treatment contrast**. In this case, `b0` is the
  mean of a 'reference' group (say 'A', though we can designate any group), and
  `b1` is the difference between the mean of group 'B' and the group mean of 'A'.
  Predictions for any observation with group membership 'A' is simply: `y = b0`;
  while predictions for observations with group membership 'B' will be
  `y = b0 + b1`. In the case of three groups ('A', 'B' and 'C'), we will end up
  with an estimate of the intercept `b0`, which represents the mean for the
  **reference group** (for instance group 'A', though we can specify which group),
  and two additional coefficients, `b1` representing the difference in means between
  group 'A' and group 'B', as well as `b2`, representing the difference between the
  mean of group 'C' and the mean of group 'A'. Now prediction for observations
  belonging to group 'A' are `y = b0`, predictions for group 'B' are `y =  b0 + b1`
  and for group 'C', predictions are `y = b0 + b2`. That is, each prediction is a
  horizontal line with an intercept that depends on the group. Therefore, the
  prediction for each group is simply the mean of that group in the training data.

We are often dealing with response variables whose value depends on more than one
  explanatory variable. For instance, the area of a rectangle depends on not only
  the height, but also the width. We can extend the linear model to multiple
  explanatory variables, including combinations of continuous and categorical
  variables. It can also include the addition of multiple polynomial terms for a
  single explanatory variable. We will begin with this latter case:

```
library('caret')
library('MASS')
rm(list=ls())
set.seed(1)

summary(wtloss)

par(mfrow=c(1, 1))
plot(wtloss)

fit1 <- lm(Weight ~ Days, data=wtloss)
smry1 <- summary(fit1)
coef(smry1)
smry1$adj.r.squared
par(mfrow=c(2, 3))
plot(fit1, which=1:6)

## residuals vs. fitted clearly suggests second order (squared)
##   but residuals look homoskedastic, so don't want to mess
##   with Weight.

fit2 <- lm(Weight ~ I(Days ^ 2), data=wtloss)
smry2 <- summary(fit2)
coef(smry2)
smry2$adj.r.squared
par(mfrow=c(2, 3))
plot(fit2, which=1:6)

## Residuals vs Fitted plot suggests model still has wrong shape.
##   Normally, unless theory dictates otherwise, we include
##   all the lower powers of the variable as well:

fit3 <- lm(Weight ~ Days + I(Days ^ 2), data=wtloss)
smry3 <- summary(fit3)
coef(smry3)
smry3$adj.r.squared
par(mfrow=c(2, 3))
plot(fit3, which=1:6)             ## Much better!

```

Now we see our list of coefficients has grown to three, with one `b0` (we'll
  call it that here for notational convenience, but it is actually labeled
  `(Intercept)` in the output) for the intercept, another `b1` for `Days`
  (labeled `Days`) and a last one `b2` for `Days ^ 2` (labeled `I(Days^2)`).
  Predictions for new observations would then be made as:
  `y = b0 + b1 * Days + b2 * (Days ^ 2)`:

```
b0 <- coef(smry3)['(Intercept)', 'Estimate']
b1 <- coef(smry3)['Days', 'Estimate']
b2 <- coef(smry3)['I(Days^2)', 'Estimate']

days <- seq(from=min(wtloss$Days), to=max(wtloss$Days), length.out=100)

y1 <- predict(fit3, newdata=data.frame(Days=days))
y2 <- b0 + b1 * days + b2 * (days ^ 2)
all(y1 == y2)

```

Let's plot the three fits to see the differences graphically:

```
## for plotting: predictions on dense grid of Days:
days <- seq(from=min(wtloss$Days), to=max(wtloss$Days), length.out=10000)
newdata <- data.frame(Days=days)
prd1 <- predict(fit1, newdata=newdata)
prd2 <- predict(fit2, newdata=newdata)
prd3 <- predict(fit3, newdata=newdata)

par(mfrow=c(1, 1))
plot(Weight ~ Days, data=wtloss)
lines(x=days, y=prd1, lty=2, col='cyan')
lines(x=days, y=prd2, lty=3, col='magenta')
lines(x=days, y=prd3, lty=4, col='orangered')
legend(
  'topright',
  legend=c('linear', 'quadratic', 'both'),
  col=c('cyan', 'magenta', 'orangered'),
  lty=c(2, 3, 4)
)

```

The addition of both linear and quadratic terms looks to be better than either
  alone. It is interesting that the quadratic only fit `fit3` is curved the
  wrong way! In general, unless theory suggests the lower order polynomial
  terms are not needed, we usually include them if any higher order term is
  significant.

We'll now look at an example where we'll try including different variables, as
  well as polynomial terms for one of them:

```
rm(list=ls())

par(mfrow=c(1, 1))
plot(mtcars)

## break out some interesting looking variables to predict mpg:
plot(mtcars[, c('mpg', 'wt', 'disp', 'hp')])

## correlation between variables:
cor(mtcars[, c('mpg', 'wt', 'disp', 'hp')])

## let's start w/ variable w/ highest cor to mpg:
fit1 <- lm(mpg ~ wt, data=mtcars)
summary(fit1)                     ## wt coefficient significant
par(mfrow=c(2, 3))
plot(fit1, which=1:6)             ## Residuals vs Fitted suggests quadratic

## maybe add wt^2 quadratic component:
fit2 <- lm(mpg ~ wt + I(wt ^ 2), data=mtcars)
summary(fit2)                     ## adj.r.squared improves, wt^2 coef significant
par(mfrow=c(2, 3))
plot(fit2, which=1:6)             ## residuals much better, though not normal and influence so so

fit3 <- lm(mpg ~ wt + I(wt ^ 2) + disp, data=mtcars)
summary(fit3)                     ## slightly better adj.r.squared, but disp barely signif
par(mfrow=c(2, 3))
plot(fit3, which=1:6)             ## residuals about the same as for fit2

fit4 <- lm(mpg ~ wt + I(wt ^ 2) + hp, data=mtcars)
summary(fit4)                     ## bigger jump in adj.r.squared; hp coef significant
par(mfrow=c(2, 3))
plot(fit4, which=1:6)             ## plot still looks ok

fit5 <- lm(mpg ~ wt + I(wt ^ 2) + hp + disp, data=mtcars)
summary(fit5)                     ## disp coef still not significant; fit4 is better
par(mfrow=c(2, 3))
plot(fit5, which=1:6)             ## plot still looks ok

```

Interestingly, even though `disp` has a higher correlation with `mpg` than `hp`, the latter
  appears to be a more useful predictor. We will return to this phenomena shortly, but
  first, since the residual plots don't look that great, let's see if CV supports our choice
  of `fit3`:

```
library(caret)
set.seed(1)

dat <- mtcars[, c('mpg', 'wt', 'disp', 'hp')]

f.mse <- function(frm, dat.trn, dat.tst) {
  fit <- lm(frm, data=dat.trn)
  prd <- predict(fit, newdata=dat.tst)
  mse <- mean((dat.tst$mpg - prd) ^ 2, na.rm=T)
}

f <- function(idx.trn) {
  dat.trn <- mtcars[idx.trn, ]
  dat.tst <- mtcars[-idx.trn, ]
  mse0 <- f.mse(mpg ~ 1, dat.trn, dat.tst)
  mse1 <- f.mse(mpg ~ wt, dat.trn, dat.tst)
  mse2 <- f.mse(mpg ~ wt + I(wt ^ 2), dat.trn, dat.tst)
  mse3 <- f.mse(mpg ~ wt + I(wt ^ 2) + disp, dat.trn, dat.tst)
  mse4 <- f.mse(mpg ~ wt + I(wt ^ 2) + hp, dat.trn, dat.tst)
  mse5 <- f.mse(mpg ~ wt + I(wt ^ 2) + hp + disp, dat.trn, dat.tst)
  c(mse0=mse0, mse1=mse1, mse2=mse2, mse3=mse3, mse4=mse4, mse=mse5)
}

k <- 10
times <- 7
idx <- 1:nrow(dat)

## make list of k * times folds; elements are training-set indices:
folds <- createMultiFolds(idx, k=k, times=times)

rslt <- sapply(folds, f)          ## run f() on each training-set index in folds
apply(rslt, 1, mean)              ## best: mpg ~ wt + I(wt ^ 2) + hp
apply(rslt, 1, sd)                ## best: mpg ~ wt + I(wt ^ 2) + hp; but SEs are large!

```

Finally, we'll look at an example of using both a continuous and categorical
  predictor. In this case, the number of coefficients estimated for the categorical
  vector will be the number of categories minus one. The 'reference' category, will
  by default be the first categorical label alphabetically, but this can be changed by
  the user. In this case, the intercept term represents the reference category and
  all the other category coefficients represent constant vertical (along the response
  variable axis) displacements of the prediction line for each group. That is, the
  slope of the response vs the continuous variable remains constant, but the intercept
  becomes group-specific, so there is one line per group, with all lines parallel, having
  the same slope, but vertically displaced by the group coefficient, so each group
  effectively ends up with a different intercept.

```
rm(list=ls())

dat <- iris[iris$Species %in% c('virginica', 'setosa'), ]
fit1 <- lm(Sepal.Length ~ Sepal.Width + Species, data=dat)
summary(fit1)
par(mfrow=c(2, 3))
plot(fit1, which=1:6)

## intercepts (Sepal.Length where Sepal.Width==0) differ,
##   but slope is the same (prediction lines parallel):

coefs <- coef(fit1)
predict(fit1, newdata=data.frame(Sepal.Width=0, Species='setosa'))
coefs['(Intercept)']

predict(fit1, newdata=data.frame(Sepal.Width=0, Species='virginica'))
coefs['(Intercept)'] + coefs['Speciesvirginica']

## let's compare the prediction lines graphically:

w <- seq(from=min(dat$Sepal.Width), to=max(dat$Sepal.Width), length.out=10000)
pred1 <- predict(fit1, newdata=data.frame(Sepal.Width=w, Species='virginica'))
pred2 <- predict(fit1, newdata=data.frame(Sepal.Width=w, Species='setosa'))

## note lines are parallel:
pred1[1] - pred2[1]
pred1[length(pred1)] - pred2[length(pred2)]

par(mfrow=c(1, 1))
plot(x=range(w), y=range(c(pred1, pred2)), type='n')
i.v <- dat$Species == 'virginica'
i.s <- dat$Species == 'setosa'
points(Sepal.Length ~ Sepal.Width, data=dat[i.v, ], pch='+', col='cyan')
points(Sepal.Length ~ Sepal.Width, data=dat[i.s, ], pch='o', col='magenta')
lines(x=w, y=pred1, lty=2, col='cyan')
lines(x=w, y=pred2, lty=3, col='magenta')

```

[Return to index](#index)

---

### Check your understanding 1

1) Use 10-fold cross-validation repeated 7 times to see which of the following formula best fit
     the `MASS::wtloss` training set: `Weight ~ Days`, `Weight ~ I(Days ^ 2)`, or
     `Weight ~ Days + I(Days ^ 2)`? Examine both the mean prediction error as well as its spread.

2) How does the improvement in performance offered by the best fit compare to the standard
     deviation of the performance of the best fit?

[Return to index](#index)

---

### Correlated predictors

When we include multiple explanatory variables in a conventional linear
  regression, correlations between the explanatory variables can cause problems
  with the calculation of the model fit. You will typically see that the
  inclusion of correlated variables tends to increase the standard errors of
  coefficient estimates, sometimes to the point of making otherwise very
  significant coefficients non-significant. In addition, the correlation means
  the information in each variable is at least partially redundant, and therefore
  the effects of both variables on the response are not easy to tease apart: it
  is hard to know how much of the change in `y` to assign to changes in `x1`
  instead of `x2` when `x1` and `x2` are highly correlated, because every time
  `x1` changes, `x2` is changing in a related pattern. This can lead to nearly
  all the 'responsibility' for changes in `y` being assigned to `x1` and nearly
  none to `x2`, or vice-versa, which means that the coefficient estimates can be
  quite far from their true population values (in this case, the `x1`
  coefficient will be inflated and the `x2` coefficient deflated). When the two
  variables are redundant, the
  two coefficients can both end up being inflated in a way that they offset
  each other. That is, if `x1` is approximately the same as `x2`, then the
  predictions made by the formula `y = x1 + x2` will be approximatly the same
  as `y = 3 * x1 - x2` or `y = 4 * x1 - 2 * x2`,  or even
  `y = 300 * x1 - 298 * x2`, etc. That is, very similar predictions can be
  produced with wildly different coefficients, which makes the fitting process
  extremely unstable (partially reflected in the standard errors rising). We
  will discuss methods for dealing with highly correlated predictors in the
  machine learning section of this course.

```
x1 <- 3
x2 <- x1 * 1.0001

3 * x1 - x2
4 * x1 - 2 * x2
300 * x1 - 298 * x2

```

We saw some hint of this going on in the previous example. When we included
  the `I(wt ^ 2)` term, which is correlated with `wt` itself, it increased the
  standard error for the `wt` coefficient estimate, decreasing the corresponding
  t-statistic and coefficient significance. Although `hp` had a lower pairwise
  correlation with `mpg` than `disp`, it was a more useful predictor, because
  it added more 'new' information to the fit, since `hp` had a lower correlation
  with `wt` than did `disp`. That is, much of the information `disp` had to
  offer was already included with the inclusion of the `wt` variable.

```
rm(list=ls())

## some fits we've seen:
fit1 <- lm(mpg ~ wt, data=mtcars)
fit2 <- lm(mpg ~ wt + I(wt ^ 2), data=mtcars)
fit3 <- lm(mpg ~ wt + I(wt ^ 2) + disp, data=mtcars)
fit4 <- lm(mpg ~ wt + I(wt ^ 2) + hp, data=mtcars)
fit5 <- lm(mpg ~ wt + I(wt ^ 2) + hp + disp, data=mtcars)

## correlation between variables:
dat <- mtcars[, c('wt', 'disp', 'hp')]
dat$wt2 <- dat$wt ^ 2
dat <- dat[, c('wt', 'wt2', 'disp', 'hp')]
cor(dat)

coef(summary(fit1))
coef(summary(fit2))
coef(summary(fit3))
coef(summary(fit4))
coef(summary(fit5))

```

We can use a synthetic example to demonstrate this more dramatically. In the first
  case we will use an example with two uncorrelated predictors, and we will see that
  inclusion of the second predictor greatly improves the standard error and
  significance of the first predictor coefficient. This is because inclusion of the
  second predictor adds unique explanatory value that improves prediction and thereby
  decreases the deviations of the observations from the conditional mean, resulting
  in a reduction in the magnitude of the estimated error term for the model. Decreasing
  the magnitude of the error term reduces the standard error for all individual
  coefficients. In the second example, we use two highly correlated predictors and
  show how adding the second predictor to the model actually can make the model worse:

```
rm(list=ls())
set.seed(1)

x1 <- runif(100, 0, 1)
x2 <- runif(100, 0, 1)
e <- rnorm(100, 0, 0.1)
y <- x1 + x2 + e
cor(cbind(y, x1, x2, e))          ## x1, x2 both correlated w/ y, but not each other

fit1 <- lm(y ~ x1)
fit2 <- lm(y ~ x2)
fit3 <- lm(y ~ x1 + x2)
coef(summary(fit1))               ## coefficient estimate about right
coef(summary(fit2))               ## coefficient estimate about right
coef(summary(fit3))               ## improved coef estimates, std errors, and p-values!!!

x1 <- runif(100, 0, 1)
x2 <- 0.99 * x1 + 0.01 * runif(100, 0, 1)
y <- x1 + x2 + e
cor(cbind(y, x1, x2, y))          ## x1 and x2 highly correlated; info redundant!

fit1 <- lm(y ~ x1)
fit2 <- lm(y ~ x2)
fit3 <- lm(y ~ x1 + x2)
coef(summary(fit1))               ## coefficient estimate way off;
coef(summary(fit2))               ## coefficient estimate way off;
coef(summary(fit3))               ## standard errors, t-values, p-values much worse

```

[Return to index](#index)

---

### Check your understanding 2

1) Peform the following variable generation pattern and two fits 1000 times. Return the
     standard deviation of the estimates of the coefficient for `x1` separately for `fit1`
     and for `fit2`:

```
rm(list=ls())

e <- rnorm(100, mean=0, sd=0.1)   ## error
x1 <- runif(100, min=0, max=1)    ## predictor 1
x2 <- runif(100, min=0, max=1)    ## uncorrelated second predictor

## correlated third predictor:
x3 <- 0.999 * x1 + 0.001 * runif(100, min=0, max=1)

## rescale to ensure w/i interval [0, 1]:
x3 <- (x3 - min(x3)) / max(x3)

y1 <- x1 + x2 + e
y2 <- x1 + x3 + e
fit1 <- lm(y1 ~ x1 + x2)
fit2 <- lm(y2 ~ x1 + x3)

```

[Return to index](#index)

---

### Interactions

So far, we have looked at adding polynomial terms for a single explanatory
  variable, as well as adding additional continuous or categorical
  variables to a linear regression. However, we have only looked at how to
  include terms in an additive way. That is, we considered cases where
  the contribution of a term to the net effect was additive relative to
  other terms in the model. Therefore, the effect of a variable depended
  only on the value of that variable, but not any other variable. But
  sometimes we want to model a multiplicative relationship between variables,
  or a relationship where the value of a categorical variable changes not
  only the intercept, but also the slope of the response vs. the continuous
  variable.

We mentioned earlier in the course that we can convert multiplicative
  relationships into additive ones by taking the log of the multiplicative
  formula. However, this can result in a non-linear relationship in some
  cases, or problems with the residual distribution, or simply may make
  the relationship harder to interpret because of the tranformation. In
  cases of a multiplicative relationship between explanatory variables,
  we can introduce 'interactions' between those variables. In the case of
  two continuous variables, this essentially amounts to including the
  product of the two variables as a new variable in the regression formula.

Here we will use the synthetic example of rectangle areas, where the area
  is the product of the height and width of the rectangle. We know this
  formula from primary school, so we could pick the right formula *a priori*,
  but if we were looking at some new data where the underlying phenomena
  and relationships were not understood, we might have to arrive at the right
  formula through some trial and error. In general, we would want to do
  this with some pilot data, rather than with the main experiment we would
  like to ultimately analyze. Once the choice of model is made based on the
  pilot data, we should still with that model for the primary analysis of
  the main experiment: hunting for a good fitting model during the main
  experiment drastically increases the likelihood that we will find a model
  that fits our sample well based on chance, but actually fits the underlying
  population poorly, leading to poor reproducibility of our conclusions.
  That is, you are likely to find models that fit the noise in the sample
  more than the signal. In formulas and coefficient naming, the `:` symbol
  between variables indicates an interaction term. In formulas, the `*`
  operator, when not protected by the `I()` function, serves to include both
  terms plus their interaction. That is `y ~ x1 * x2` is equivalent to
  `y ~ x1 + x2 + x1:x2`, where `x1:x2` represents the interaction. However,
  the number of possible interactions grows very rapidly with the number of
  variables. For instance, `y ~ x1 * x2 * x3` is equivalent to
  `y ~ x1 + x2 + x3 + x1:x2 + x1:x3 + x2:x3 + x1:x2:x3`. With many variables,
  this can result in trying to estimate too many coefficients for the available
  data, decreasing the stability/reliability of all the estimates. In order
  to limit or otherwise specify the maximal degree of interactions to include,
  we can use the `^` formula operator. For instance, `y ~ (x1 + x2 + x3) ^ 2`
  is equivalent to `y ~ x1 + x2 + x3 + x1:x2 + x1:x3 + x2:x3`. The three-way
  interaction `x1:x2:x3` was excluded because it is of degree three, while
  the `^ 2` notation indicated to only include interactions of degree two or
  less.

One can also nest variables using `y ~ x1 / x2`, where `x2` is a categorical
  variable, which results in a different `y ~ x1` slope for each category in
  `x2` without introducing an additive effect for `x2`. This makes sense when
  the meaning of `x1` in some sense differs between the different groups
  specified by `x2`. For instance, some schools might grade their Geometry
  class based on a curve, with the average being a `85`, others using a curve
  with an average of `75` while others report unadjusted scores. Therefore,
  the grade may only make sense within the context of the school in which the
  grade was assigned. So we can have a formula like: `days_absent ~ grade / school`,
  which would generate a different `days_absent` vs `grade` slope for each
  `school`, but all the schools have the same intercept (so `school` does not
  have an effect except to qualify the meaning and effect of `grade`).

```
rm(list=ls())
set.seed(1)

h <- runif(100, min=1, max=10)    ## heights
w <- runif(100, min=1, max=10)    ## widths
e <- rnorm(100, 0, 0.2)           ## 'measurement error'
a <- h * w + e                    ## measurements of rectangle areas
dat <- data.frame(area=a, h=h, w=w)

fit1 <- lm(area ~ h + w, data=dat)
summary(fit1)
par(mfrow=c(2, 3))
plot(fit1, which=1:6)             ## strong quadratic component

fit2 <- lm(area ~ h + w + I(h^2) + I(w^2), data=dat)
summary(fit2)                     ## quadratic terms non-significant
plot(fit2, which=1:6)             ## did not fix the issue w/ fit1

## we know this works; note only 2 coeficients
fit3 <- lm(area ~ I(h * w), data=dat)
summary(fit3)                     ## only intrcpt + I(h*w) coefs
plot(fit3, which=1:6)             ## pretty good

## adds h, w and interaction between h and w (4 coefficients total):
fit4 <- lm(area ~ h * w, data=dat)
summary(fit4)                     ## intrcpt, h, w and h:w interaction
plot(fit4, which=1:6)             ## pretty good

## add all 2-way interactions (since only h and w, same as fit4):
fit5 <- lm(area ~ . ^ 2, data=dat)
summary(fit5)
plot(fit5, which=1:6)

## explicitly include interaction term (same as fit4):
fit6 <- lm(area ~ h + w + h:w, data=dat)
summary(fit6)
plot(fit6, which=1:6)

```

An interaction between **two continuous variables** is modeled as the product
  of the two variables times the coefficient for the interaction term.
  Therefore, **predictions** for `fit4` proceed from the coefficients as
  follows:

```
smry <- summary(fit4)
(coefs <- coef(smry))
b0 <- coefs['(Intercept)', 'Estimate']
b1 <- coefs['h', 'Estimate']
b2 <- coefs['w', 'Estimate']
b12 <- coefs['h:w', 'Estimate']

pred1 <- b0 + b1 * h + b2 * w + b12 * h * w
pred2 <- predict(fit4, newdata=dat)
names(pred2) <- NULL
all.equal(pred1, pred2)

```

An interaction between **categorical and continuous** variables results in the
  slope of the response vs. the continuous variable changing from group
  to group. If the categorical variables are also included as individual terms
  (they normally would be, if the interaction is included and theory does not
  provide justification for removing the individual terms), the intercepts
  will also be different in different groups. In the following example, we will
  look at how the slope of `Sepal.Length` vs `Sepal.Width` varies between two
  iris species:

```
rm(list=ls())

dat <- iris[iris$Species %in% c('virginica', 'setosa'), ]
fit1 <- lm(Sepal.Length ~ Sepal.Width * Species, data=dat)
summary(fit1)
par(mfrow=c(2, 3))
plot(fit1, which=1:6)

w <- seq(from=min(dat$Sepal.Width), to=max(dat$Sepal.Width), length.out=10000)
pred1 <- predict(fit1, newdata=data.frame(Sepal.Width=w, Species='virginica'))
pred2 <- predict(fit1, newdata=data.frame(Sepal.Width=w, Species='setosa'))

par(mfrow=c(1, 1))
plot(x=range(w), y=range(c(pred1, pred2)), type='n')
i.v <- dat$Species == 'virginica'
i.s <- dat$Species == 'setosa'
points(Sepal.Length ~ Sepal.Width, data=dat[i.v, ], pch='+', col='cyan')
points(Sepal.Length ~ Sepal.Width, data=dat[i.s, ], pch='o', col='magenta')
lines(x=w, y=pred1, lty=2, col='cyan')
lines(x=w, y=pred2, lty=3, col='magenta')

## notice lines are more spread out at the end of the range than at the
##   beginning, reflecting the differing slopes (lines are not parallel!!!):

pred1[1] - pred2[1]
pred1[length(pred1)] - pred2[length(pred2)]

```

Now we will take a look at an example in the `mtcars` dataset with a smaller
  but still apparently significant interaction, this time between numeric
  variable `wt` (weight of the vehicle) and the categorical variable `gear`,
  which specifies the number of gears the vehicle has. Since we have no idea
  if the response variable `mpg` (miles-per-gallon) should have a monotonic,
  let alone linear, relationship with `gear`, and since there are only three
  distinct values for `gear`, we will model it as a categorical variable.
  This will allow the effect of gear to follow an arbitrary pattern, rather
  than assuming linarity or even monotonicity.

```
rm(list=ls())

## get the data together:
dat <- mtcars[, c('mpg', 'wt', 'gear')]
table(dat$gear)
dat$gear <- factor(dat$gear, ordered=F)
summary(dat)
par(mfrow=c(1, 1))
plot(dat)

fit1 <- lm(mpg ~ wt, data=dat)
summary(fit1)
par(mfrow=c(2, 3))
plot(fit1, which=1:6)             ## maybe quadratic?

## lets try adding other variables:
fit2 <- lm(mpg ~ wt + gear, data=dat)
summary(fit2)
par(mfrow=c(2, 3))
plot(fit2, which=1:6)             ## similar residuals vs fitted as fit1

## allow for an interaction:
fit3 <- lm(mpg ~ wt * gear, data=dat)
summary(fit3)
par(mfrow=c(2, 3))
plot(fit3, which=1:6)             ## residuals look better

## here is an example of a nested relationship: gear has no direct
##   effect, but only an effect on the slope of mpg vs wt:
fit4 <- lm(mpg ~ wt / gear, data=dat)
summary(fit4)
par(mfrow=c(2, 3))
plot(fit4, which=1:6)

```
In the above example, the coefficient for `wt` captures the slope of the
  relationship between `mpg` and `wt` for the 'reference' group, which was
  selected by default to be the observations where `dat$gear == '3'`. For
  this group, the intercept and this slope are all that is required for
  making predictions. For observations where `dat$gear == '4'`, we add
  a constant additive effect, corresponding to `coefs['gear4', 'Estimate']`,
  plus an interaction effect between `gear` and `wt`, which has the net
  effect of changing the slope of `mpg` vs `wt` for the `gear4` group.
  A constant additive effect and effect on slope of `mpg` vs `wt` are also
  modeled for the `gear5` group.

This case allows us to demonstrate how **predictions** are made when there are
  interactions between a **continuous and categorical** variable:

```
prd2 <- predict(fit3, data=dat)

coefs <- coef(summary(fit3))
b0 <- coefs['(Intercept)', 'Estimate']
b1 <- coefs['wt', 'Estimate']
b24 <- coefs['gear4', 'Estimate']
b25 <- coefs['gear5', 'Estimate']
b34 <- coefs['wt:gear4', 'Estimate']
b35 <- coefs['wt:gear5', 'Estimate']

wt <- dat$wt
gr <- dat$gear

i4 <- gr == '4'                    ## only true for gear4
i5 <- gr == '5'                    ## only true for gear5

effect.wt <- b1 * wt

## constant additive effects of gear:
##   0 for gear3; b24 for gear4; b25 for gear5:
effect.gear <- i4 * b24 + i5 * b25

## interaction between gear and wt; equiv to a change in slope;
##   0 for gear3; (b34 * wt) for gear4; (b35 * wt) for gear5
effect.inter <- i4 * b34 * wt + i5 * b35 * wt

prd1 <- b0 + effect.wt + effect.gear + effect.inter
prd2 <- predict(fit3, data=dat)
names(prd2) <- NULL
all.equal(prd1, prd2)

```

Now we will look at a dataset with a possible interaction between **two categorical
  variables**. In this case, a significant interaction coefficient would suggest that
  the contribution of each categorical variable is conditional on the value
  of the other variable. Therefore, for **prediction**, the effects of the variables
  involved in the interaction are modeled as constants whose value depends on the
  other variable, rather than as constants whose values only depend on the first
  variable.

```
rm(list=ls())
library('caret')

## subset some data:
dat <- diamonds
dat <- as.data.frame(dat)
dat <- dat[dat$carat == 1, c('price', 'color', 'clarity')]
dat <- dat[dat$color %in% c('E', 'G'), ]
dat <- dat[dat$clarity %in% c('SI1', 'VS2'), ]

## make unordered, so default contrasts are 'treatment':
dat$color <- factor(dat$color, ordered=F)
dat$clarity <- factor(dat$clarity, ordered=F)

summary(dat)
par(mfrow=c(1, 1))
plot(dat)
nrow(dat)

fit1 <- lm(price ~ color * clarity, data=dat)
summary(fit1)
par(mfrow=c(2, 3))
plot(fit1, which=1:6)

## how coefficients become predictions:

coefs <- coef(fit1)
b0 <- coefs['(Intercept)']
b1 <- coefs['colorG']
b2 <- coefs['clarityVS2']
b3 <- coefs['colorG:clarityVS2']

i.G <- dat$color == 'G'
i.VS2 <- dat$clarity == 'VS2'

table(i.G)
table(i.VS2)
summary(dat)

prd1 <- b0 + i.G * b1 + i.VS2 * b2 + (i.G & i.VS2) * b3
prd2 <- predict(fit1, newdata=dat)
names(prd2) <- NULL
all.equal(prd1, prd2)

```

[Return to index](#index)

---

### Check your understanding 3

Using the following dataset:

```
dat <- mtcars[, c('mpg', 'wt', 'gear')]
table(dat$gear)
dat$gear <- factor(dat$gear, ordered=F)
summary(dat)

```

1) Plot the variables against one another.

2) Fit the linear model with formula `mpg ~ wt * gear` to the data. Are the individual variable
     coefficients significantly different from zero? Are the interaction coefficients significantly
     different from zero?

3) Plot separate regression lines for three values of `gear`.

[Return to index](#index)

---

## FIN!

repository: anhnguyendepocen/FunDataR

repo_name: anhnguyendepocen/FunDataR


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

### Description

An issue was discovered in Deskpro before 2019.8.0. The /api/tickets endpoint failed to properly validate a user's privilege, allowing an attacker to retrieve arbitrary information about all helpdesk tickets stored in database with numerous filters. This leaked sensitive information to unauthorized parties. Additionally, it leaked ticket authentication code, making it possible to make changes to a ticket.

### POC

#### Reference
- https://blog.redforce.io/attacking-helpdesks-part-1-rce-chain-on-deskpro/

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


text:
# Win32::Loquendo

Ruby interface to the Loquendo speech synthesis (text to speech / TTS) program.

It also ships a command line utility `say` which allows you to get spoken
text directly from the console.

This gem only runs on Microsoft Windows as it relies both on the Win32 API as
well as the DLL files used by the Loquendo distribution. For that reason it
has been name spaced in the win32 module to make it abundantly clear which
platform it supports.

## Prerequisites

* Must have Loquendo installed on the machine in order to use this gem.
* ruby ffi library, will be installed automatically through rubygems

## Installation

    $ gem install win32-loquendo

## API usage

Basic example showing the three types of use

    require 'win32/loquendo'

    reader = Win32::Loquendo::Reader.new()

    reader.say("Say it aloud")  # Send the text to the sound card

    reader.say("Give me the data") do |data|
      # do stuff with the string of PCM WAVE bytes
    end

    reader.write("audio.wav", "Save the spoken text to a file")

Customize how the text is spoken

    reader = Win32::Loquendo::Reader.new({
      :sample_rate => 32000,       # Pick a sample rate in Hz
      :channels    => 2,           # Stereo or mono (1 or 2 audio channels)
      :voice       => "Elizabeth"  # Specify the default voice to use
    })

    reader.say "Hi, this is Elizabeth speaking"  # Speak with the default voice.
    reader.say "and this is Simon", "Simon"      # Override the default voice
                                                 # for this utterance.

    reader.voices.each do |name|              # List installed voices that can
      reader.say "My name is #{name}", name   # be used for speaking.
    end

Note that you can customize a lot on the fly regarding how Loquendo speaks, by
simply adding commands as part of the text being spoken. For example:

* Trigger whatever pre-programmed demo phrase the voice used was shipped with.

        reader.say("\\demosentence and I'm speaking through ruby win32-loquendo")

* Provide proper pronunciation for words using [X-SAMPA][*]

        reader.say("Hello, or in Finnish; \SAMPA=;('t_de4ve)", "Dave")

Finally you can launch speech prompts in parallel, overlapping to the degree
you'd like by running reader instances in separate threads. This example
generates something eerily similar to Google's audio captchas, using 10
overlapping voices.

    (0...40).to_a.shuffle.each_slice(4).map{|a| a.join(" ") }.map{|s|
      Thread.new { Win32::Loquendo::Reader.new.say(s) }
    }.each {|t|
      t.join
    }

A note of caution: Only ever interact with a reader from one and the same thread.
If used from different threads it will cause undefined behavior (errors,
hangs, crashes), since the library interact with C-code over FFI and such
interactions are not thread safe.

## Command line usage

The command line program is named `say`

    Usage: say [OPTIONS] [TEXT]

    TEXT is the text you want to be spoken.
    If no text is provided as arguments, text will be fetched from STDIN instead.

    Options:
      -c (1|2)  audio channels to use
      -f FILE   write audio to FILE instead of speaking it aloud
      -h        show this help text
      -l        lists the available voices
      -s N      sample rate in Hz
      -v voice  is the voice to use for speaking

To speak a phrase with the default voice, it's as easy as

    say My PC can now speak, just like my Mac!

You can also change the default voice, so you don't have to provide the `-v`
option all the time. To change the default voice, create the file
"`%HOME%/.win32-loquendo`" and enter the voice you want to use on the first
line in that file.

[*]: http://en.wikipedia.org/wiki/X-SAMPA


text:
This demo application illustrates how to enhance the danek schema
validator with knowledge of additional schema types.

The `ExtendedSchemaValidator` class illustrates how to write a subclass
of `SchemaValidator`. Most of the code in this class is boilerplate text
that delegates to the parent class. The important part of this class is
the implementation of `registerTypes()`, which registers a singleton
instance of each new schema type. For the purposes of this demo, this
operation registers the `SchemaTypeHex` class, which performs schema
validation for hexadecimal numbers.

A class that provides a new schema type must implement two operations:

- `checkRule()` is invoked when the schema type is used in a schema
rule.

- `isA()` is invoked during schema validation of a configuration
file.

The `SchemaTypeHex` class illustrates how to implement the above
operations. In addition, the class provides some utility functions that
might be useful to application developers: `lookupHex()`, `stringToHex()`
and `isHex()`.

The `FooConfiguration` class encapsulates use of danek and the new
schema type. This class illustrates how to make use of the enhanced
schema validator and the utility functions provided by the
`SchemaTypeHex` class.

Examples of running the demo:

```
demo -h                             (prints a usage statement)
demo -cfg runtime.cfg -scope foo
```

repository: offa/danek

repo_name: offa/danek


text:
# This is the coolest web component router

## More documentation coming up later!!!

Eagrouter is an easy to use component router for custom elements. It works just like any other custom element. It takes in 2 properties, a route configuration object and an optional route base string. Eagrouter is really a wrapper around [Pagejs](https://github.com/visionmedia/page.js) which is a tiny express-inspired client-side router; if you like pagejs, then you would like Eagrouter. It uses almost all the same api's for declaring routes as pagejs . It also uses rxjs for reactivity and LitElement for handling custom elements. This three libraries combined together makes the router awseome to use.

---

> ## Installation

<!-- Code blocks -->

```bash
npm install eagrouter
```

> ## Usage

```javascript
import "eagrouter";
```

Use as a normal html tag in your project root, and provide your route config.

This example uses lit-element as a base class. But it works with other web component libraries also.

```javascript
import { LitElement, html } from "lit-element";

export class AppRoot extends LitElement {
  routes = [
    {
      path: "/",
      redirect: "/home",
    },

//   For pages without lazyloading, use like this
    {
      component: "<home-page></home-page>",
      path: "/home",
    },

//   For pages with lazyloading, use like this
    {
      component: "<products-page></products-page>",
      path: "/products",
      bundle: () => import("./pages/products"),
    },

// Use * to match multiple paths
     {
      component: "<products-page></products-page>",
// Mathes all products path because of * symbol
      path: "/products/*",
      bundle: () => import("./pages/products"),
    },

    // use * for pages with routes that don't match.
    {
      path: "*",
      component: "<page-not-found></page-not-found>",
      bundle: () => import("./pages/page-not-found"),
    },
  ];

  render() {
    return html`<eag-router .routes=${this.routes}></eag-router>`;
  }
}

customElements.define("app-root", AppRoot);
```

---

You can import these other things from eagrouter. More documentation coming soon.

```javascript
import { Route, navigationEvents$, NavState, queryString$, param$, routerHistory } from "eagrouter";
```

```javascript

// "queryString$, navigationEvents$ and param$" are just regular observables.

// Use this to get the full query string when making http requests

queryString$.subscribe(fullQuery => {

   console.log(queryString)
})

// Use this to get the current navigation state.
// Use "NavState" to know the type of navigation available
navigationEvents$.subscribe(navState => {
   console.log(queryString)
})

// Get a specific query param like this
param$('someId').subscribe(param => {
   console.log(param)
})

// For programmatic routing use the
// Router history object
routerHistory.push("some-route");

```

For child paths, use the router child element in the parent component.
```html
<eag-router-child></eag-router-child>
```
---
```javascript
// ..........

export class ProductsPage extends LitElement {

  // Use the full path to reference the child component.

  routes = [
    {
      component: "<products-page-one></products-page-one>",

      path: "/products/pageone",
    },
     {
      component: "<products-page-two></products-page-two>",
      path: "/products/pagetwo",
    },
  ];

  render() {
    return html`<eag-router-child .routes=${this.routes}></eag-router-child>`;
  }
}

customElements.define("products-page", ProductsPage);
```
<br>

> ## Router Guards

To guard a path; add a guard property to the object in the array. The property should return a boolean value. It can also take an observable or promise that returns a boolean value

```javascript
// This function just returns a regular promise
const ireturnAPromise = () => {
  const myFirstPromise = new Promise((resolve, reject) => {
    resolve(true)
  })
return myFirstPromise
}
```

```javascript
// ............
    {
      component: "<somepage-page></somepage-page>",
      path: "/products/xy",
      guard: () => false
    },
    {
      component: "<somepage2-page></somepage2-page>",
      path: "/products/xyz",
      guard: () => ireturnAPromise()
    },
    {
      component: "<somepage3-page></somepage3-page>",
      path: "/products/xyz2",
      guard: () => of(true)
    }

```

 You can find me on linkedin to ask for more info. This project is stable but is in aplha state for now.
https://www.linkedin.com/in/emmanuel-agarry-a22931122/

repository: untitled-engineer/eagrouter

repo_name: untitled-engineer/eagrouter


text:
# petstore-full

This package was auto-generated by [openapi-client-generator](https://github.com/avanov/openapi-client-generator).

```bash

pip install petstore-full

```

## Client instantiation example

```python
import petstore_full

client = petstore_full.common.http.Client(service_url="https://openapi-service-url/")
response = petstore_full.service.<path.to.endpoint>.<method>.call(
    client,
    <params, headers, payloads>
)
```

repository: stjordanis/openapi-client-generator

repo_name: stjordanis/openapi-client-generator


text:
# RobotBuild
This repo documents the robot build used to compete in the Robot Riot + later addition and/or upgrades.

## Base
3D printed robot speed tank style sourced from Thingiverse (thing:2414983)

## Pinion Gears
A pair of 11T style gears can be 3D printed thing:2352724  You will probably grind through these pretty rapidly.
You can find metals version of these on Amazon / Ebay or a Hobby Shop.

## Motors
A pair of 35T 540 style DC motors from Amazon.

## Speed Controller
Generic Brushed ESC from Amazon or Ebay.

## Other Parts
A lot of bolts and nuts.
300-lb Linear Actuator with DC Motor.
### LED Lighting
I chose EL wire for the trim and 10mm LED for the headlights.

repository: sirwalterrrich/RobotBuild

repo_name: sirwalterrrich/RobotBuild


text:
# spring-profiles
Some (very simple) Spring profiles.

Releases are hosted over at [bintray](https://bintray.com/capgeminiuk/maven/spring-profiles/view).  Licence is Apache v.2.0.

Use these as follows:

In your "default" Spring component:

    import org.springframework.context.annotation.Profile;

    import static com.capgemini.spring.profiles.SpringProfiles.DEFAULT_PROFILE_NAME;
    ...
    @Profile({DEFAULT_PROFILE_NAME})
    public class MyProdService {

And then in a stub-equivalent Spring component:

    import org.springframework.context.annotation.Profile;

    import static com.capgemini.spring.profiles.SpringProfiles.;
    ...
    @Profile(STUBBED_PROFILE_NAME)
    public class MyStubbedService {

Read more on Spring Profiles and what you can do with them in the [Spring Docs](http://docs.spring.io/autorepo/docs/spring-boot/current/reference/html/boot-features-profiles.html).


text:
# NSD.Lib MML support in Atom

The package adds colors to various MML commands for NES Sound Driver & Library (NSD.Lib).

![Example1](https://raw.githubusercontent.com/hallyvorc/language-mml-nsdlib/master/screenshot.png)

repository: hallyvorc/language-mml-nsdlib

repo_name: hallyvorc/language-mml-nsdlib


text:
# discovery-swarm

A network swarm that uses [discovery-channel](https://github.com/maxogden/discovery-channel) to find and connect to peers.

This module implements peer connection state and builds on discovery-channel which implements peer discovery. This uses TCP sockets by default and has experimental support for UTP.

```
npm install discovery-swarm
```

[![build status](http://img.shields.io/travis/mafintosh/discovery-swarm.svg?style=flat)](http://travis-ci.org/mafintosh/discovery-swarm)

## Usage

``` js
var swarm = require('discovery-swarm')

var sw = swarm()

sw.listen(1000)
sw.join('ubuntu-14.04') // can be any id/name/hash

sw.on('connection', function (connection) {
  console.log('found + connected to peer')
})
```

## API

#### `var sw = swarm()`

Create a new swarm

#### `sw.join(key)`

Join a channel specified by `key` (usually a name, hash or id, must be a **Buffer** or a **string**). After joining will immediately search for peers advertising this key, and re-announce on a timer.

#### `sw.leave(key)`

Leave the channel specified `key`

#### `sw.connecting`

Number of peers we are trying to connect to

#### `sw.queued`

Number of peers discovered but not connected to yet

#### `sw.connections`

List of active connections to other peers

#### `sw.on('connection', connection)`

Emitted when you connect to another peer

#### `sw.listen(port)`

Listen on a specific port. Should be called before add

## License

MIT

repository: lpmaurice/discovery-swarm

repo_name: lpmaurice/discovery-swarm


text:
# Food Search App

Search for businesses near to you, using [Yelp API](https://yelp.com/fusion).

![alt release](https://img.shields.io/github/v/release/jeferson-sb/food-app?style=flat-square)

<img alt="FoodApp" title="#delicinha" src=".github/Mockup.png" width="300px" />

## 📱 Demo

[Download for Android](https://github.com/jeferson-sb/food-app/releases/latest)

## 🚀 Quick Start

### Installation

```bash
cd food-app && yarn
```

### Usage

```bash
yarn start
```

## 📝License

This project is licensed under the [MIT License](https://github.com/jeferson-sb/food-app/blob/master/LICENSE.md)

repository: jeferson-sb/food-app

gha_language: JavaScript

repo_name: jeferson-sb/food-app


text:
# WEBSTACK IMPLEMENTATION (LAMPSTACK) IN AWS
I will be deploying a LAMP stack on AWS using EC2 instance
LAMP means: - Linux, Apache2, Mysql, Python/Perl/Php

The first step is to create an EC2 instance after logging in to AWS Management console
![image](https://user-images.githubusercontent.com/20463821/113478715-856b6780-9482-11eb-9d80-7d67d928cb10.png)

This instance inbound rules has TCP running on port 22 (to allow ssh connection) and port 80 (default HTTP access) and has it source on <IP_ADDRESS>/0. This signifies that any ip address can access this instance.
![image](https://user-images.githubusercontent.com/20463821/113478800-0c204480-9483-11eb-8478-00fe0c390ed8.png)

It is time to connect the running instance to our local machine, such that we can communicate with the instance from our local machine. During the creation of the instance you are expected to have saved the key-pair on your local machine, this saved key is what will be used to initiate the connection. On my linux machine, the key-pair is saved as aws-key.pem. using `ssh -i <key-pair file/directory> ubuntu@Public-IP`. Also take note of the public IP of the instance created.

On your Linux machine:
![image](https://user-images.githubusercontent.com/20463821/113479009-48a07000-9484-11eb-9c23-67951efc4b59.png)

Run `sudo apt update` to update the necessary packages.
Afterwards, install apache2 using `sudo apt install apache2`, confirm apache2 service is running using `sudo systemctl status apache2`. Enable firewall using `sudo ufw enable` after add http rule in the security group. Then allow apache traffic on the server `sudo ufw allow 'apache`
![image](https://user-images.githubusercontent.com/20463821/113479284-17c13a80-9486-11eb-8502-79527c5b83b6.png)

Install Mysql and run the configuration script, using `sudo apt install mysl-server` and `sudo mysql_secure_installation`
![image](https://user-images.githubusercontent.com/20463821/113479360-8b634780-9486-11eb-9b49-2cbcaf1b161e.png)

To install php packages using `sudo apt install php libapache2-mod-php php-mysql`
Enable PHP on website
![php](https://user-images.githubusercontent.com/20463821/113479416-edbc4800-9486-11eb-9cae-27b9fa0fb3fe.PNG)

Congratulations on your first Webstack implementation, more accomplishments!!!


text:
# Covid Tracker
**Covid Tracker** is an Android app which helps its user keep track of the COVID-19 cases all around the globe.

## Screenshots
![CovidTracker Screenshots](screenshots/covid_tracker_screenshots.png)

## How is the app built?
This app is built natively using Android Studio with Java.

## Features
* See the World wide cases and some other details in the Home page
* A list of COVID-19 cases country wise is available
* Use the search bar to search for a specific country
* Sort the cases by the name of the country and the number of cases
* Click on any country for further information regarding COVID-19
* See the precautions to be taken

## Components used
* **Navigation** - For simplified navigation through fragments

## Other libraries/services used
* **Shimmer** - For showing the shimmer effect while loading a page
* **Glide & Volley** - For loading images into ImageView
* **Gson** - For converting JSON to POJO and vice versa
* **Lottie** - For loading animations from lottiefiles.com
* **disease.sh API** - For getting the data

## Developer and Designer
* **Dinesh B S** [(@DineshBS44)](https://github.com/DineshBS44)

## License
Licensed under MIT License :  https://opensource.org/licenses/MIT

gha_language: Java


text:
# Example Atom Package in Purescript

This repository is a WIP/hack to see how hard it is to develop Atom packages
using Purescript. It is by no means finished/nice code and instead represents
an experiment (that is hopefully useful to others).

## Development Setup

For development - it is useful to use a symlink to link this directory to
your Atom packages directory. This allows you to make changes and simply reload
Atom to see your changes.

    ln -s . ~/.atom/packages/atom-ps

## Building/Getting Started

This example uses [Pulp](https://github.com/bodil/pulp) as the build tool, and
compiles the Purescript module to a single JS file (`lib/main.js`).

To get started - run:

    pulp build --main PurescriptTest -O --to lib/main.js

When Atom runs (and the package is triggered by running `pst:dev`), it will
execute the transpiled Purescript file. This will evaluate `PurescriptTest.main`
which is responsible for re-exporting the API/interface required by Atom (see
`PurescriptTest.expose`). Atom will then execute the functions on the *exposed*
interface.

This setup means that Purescript performs optimizations (dead code elimination),
and we don't have to mess around with the CommonJS module system (which has some
weird effects when used with Atom).


text:
# GLTFQuickLook
macOS QuickLook plugin for glTF files. (.gltf/.glb)

![ScreenShot](https://github.com/magicien/GLTFQuickLook/blob/master/screenshot.png)

![ScreenShot2](https://github.com/magicien/GLTFQuickLook/blob/master/screenshot2.gif)

## System Requirements

- macOS 10.13 (High Sierra) or later

## Install

### Using [Homebrew Cask](https://github.com/phinze/homebrew-cask)

- Run `brew cask install gltfquicklook`

### Manually

1. Download **GLTFQuickLook_vX.X.X.zip** from [Releases](https://github.com/magicien/GLTFQuickLook/releases/latest).
2. Put **GLTFQuickLook.qlgenerator** (in the zip file) into `/Library/QuickLook` (for all users) or `~/Library/QuickLook` (only for the logged-in user).
3. Run `qlmanage -r` command to reload QuickLook plugins.

## Build

It needs to install [Carthage](https://github.com/Carthage/Carthage) to get frameworks.
```
$ git clone https://github.com/magicien/GLTFQuickLook.git
$ cd GLTFQuickLook
$ carthage bootstrap --platform mac
$ xcodebuild
```

## See also

- [GLTFSceneKit](https://github.com/magicien/GLTFSceneKit/) - glTF loader for SceneKit

repository: otri/GLTFQuickLook

repo_name: otri/GLTFQuickLook


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

### Description

LibreOffice before 4.4.5 and Apache OpenOffice before 4.1.2 uses the stored LinkUpdateMode configuration information in OpenDocument Format files and templates when handling links, which might allow remote attackers to obtain sensitive information via a crafted document, which embeds data from local files into (1) Calc or (2) Writer.

### POC

#### Reference
- http://www.openoffice.org/security/cves/CVE-2015-4551.html
- http://www.oracle.com/technetwork/topics/security/linuxbulletinoct2015-2719645.html

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


text:
# asa-ansible-example

This is a sample Ansible playbook for enrolling and securing access to servers with Okta Advanced Server Access (ASA).

To leverage this example, you must have access to an Ansible controller and Okta ASA as administrator.

**NOTE:** If you don’t have an Okta ASA account yet, you can go and [create one here](https://app.scaleft.com/p/signup).

# Setup

Step 1: Clone this repository:

```
git clone https://github.com/sudobinbash/asa-ansible-example.git
cd asa-ansible-example
```

Step 2: Edit the `asa-playbook.yml`. On line 3, replace `<hosts>` with the hosts you want to enroll in ASA:

```
-
  name: Install SFT
  hosts: <hosts>
```

Step 3: Get An Enrollment in ASA:

1. Access Okta ASA as Administrator.
2. Click **Projects** and then select or create a new project.
3. Click **Enrollment** > **Create Enrollment Token**.
4. Enter a name (i.e. `ansible-token`) and click **Submit**.
5. Copy the enrollment token

![ASA: Enrollment token](img/asa-get-token.png)

Step 4: Install the Ansible Galaxy module for zypper (required for installing ASA in SUSE Linux):

```
ansible-galaxy install community.general.zypper
```

Step 5: Enroll servers using the ansible-playbook command:

```
ansible-playbook asa-playbook.yml -i <inventory> --extra-vars "asa_enrollment_token=<token>"
```

Replace:
- `<inventory>`: with your inventory file (or any list of servers)
- `<token>`: with the enrollment token from ASA

Ansible will run and register your servers, and return the following:

![Ansible Summary](img/ansible-summary.png)

In ASA, you will see the servers enrolled in your project:

![ASA: Servers Enrolled](img/asa-list-servers.png)

## Power Tips / FAQ

**Wait... what does the `asa-playbook.yml` do?**

The playbook installs the ASA server agent and then enroll your servers into ASA for remote access.

The playbook supports multiple Linux distros using the server distro family to identify the ideal installation tasks:

```
  tasks:
    #INSTALL
    - name: Install Debian
      include_tasks: asa-samples/install-debian.yml
      when: ansible_facts['os_family'] == "Debian"

    - name: Install RedHat
      include_tasks: asa-samples/install-redhat.yml
      when: ansible_facts['os_family'] == "RedHat"

    - name: Install Suse
      include_tasks: asa-samples/install-suse.yml
      when: ansible_facts['os_family'] == "Suse"
```

The steps for enrolling the servers are the same across all Linux distros, and listed on the after the installation tasks.

**How do I define the server names listed in ASA? (aka Canonical Names)**

Servers are registered in ASA with a canonical name that can be used to launch ssh sessions (i.e. `ssh <canonical-name>`). Our playbook uses the Ansible `inventory_hostname` as canonical name. You can change the canonical name according to your preferences, using variables and server facts from Ansible.

```
    - name: Creating canonical file (using server names from the inventory)
      copy:
        dest: "/etc/sft/sftd.yaml"
        content: |
          ---
          # CanonicalName: Specifies the name clients should use/see when connecting to this host.
          CanonicalName: "{{ inventory_hostname }}"
      become: yes
```

**Can I use this playbook with other Ansible provisioning modules?**

Yes. You can use this sample with any other module available in [Ansible](https://docs.ansible.com/ansible/latest/collections/index.html) or the Ansible Galaxy. This includes provisioning modules to IaaS providers and Hypervisors, such as [AWS](https://docs.ansible.com/ansible/latest/collections/amazon/aws), [VMWare](https://docs.ansible.com/ansible/latest/collections/community/vmware), [GCP](https://docs.ansible.com/ansible/latest/collections/google/cloud), [OpenStack](https://docs.ansible.com/ansible/latest/collections/openstack/cloud), and [Azure](https://docs.ansible.com/ansible/latest/collections/azure/azcollection). To do this, use the inventory plugins available with these modules to capture the inventory of servers and tags to apply the playbook.

**Any extra recommendations?**

Absolutely yes:

1. **Experiment before broad rollout:** Use the `asa-playbook.yml` with few servers before a broad rollout (i.e. set `hosts: all`).
2. **Store the enrollment token in Ansible Vault:** In our example, we set the `asa_enrollment_token` variable directly in the ansible-playbook command for testing purposes. If you expect to run this command multiple times in production, we recommend using a secret manager, like [Ansible's vault](https://docs.ansible.com/ansible/2.8/user_guide/vault.html). Here's a [cool example from Tristan Fisher](https://gist.github.com/tristanfisher/e5a306144a637dc739e7).
3. **Securing the Ansible Controller**: You can also secure access to the Ansible controller server with ASA using the same playbook. To do that, update your `asa-playbook.yml`, changing the hosts to `local`, and then run the playbook pointing to local: `ansible-playbook  -c local -i localhost asa-playbook.yml --extra-vars "asa_enrollment_token=<local>"`

repository: okta-server-asa/asa-ansible-example

repo_name: okta-server-asa/asa-ansible-example


text:
---
layout: post
title: "Daily Digest #11"
type: digest
tags:
    - daily
    - development
description: ""
publish: true
---

 - [Stream & Go: News Feeds for Over 300 Million End Users](https://stackshare.io/stream/stream-and-go-news-feeds-for-over-300-million-end-users)
 - [What Really Happened with Vista: An Insider’s Retrospective](https://blog.usejournal.com/what-really-happened-with-vista-an-insiders-retrospective-f713ee77c239)
 - [Chrome is turning into the new Internet Explorer 6](https://www.theverge.com/2018/1/4/16805216/google-chrome-only-sites-internet-explorer-6-web-standards)
 - [Implications of Tech Stack Complexity for Executives](https://www.thoughtworks.com/insights/blog/implications-tech-stack-complexity-executives)
 - [Refactoring with Composed Method pattern](https://www.agile-code.com/blog/refactoring-with-composed-method-pattern/)
 - [How we design enterprise software](https://blog.usejournal.com/how-we-design-enterprise-software-916124fb73db)
 - [Tutorial: Distributed Tracing in Ruby with OpenTracing](http://blog.scoutapp.com/articles/2018/01/17/tutorial-distributed-tracing-in-ruby-with-opentracing)
 - [Why Factories?](https://robots.thoughtbot.com/why-factories)
 - [How do Ruby & Python profilers work?](https://jvns.ca/blog/2017/12/17/how-do-ruby---python-profilers-work-/)
 - [Event-Driven Microservices with RabbitMQ and Ruby](https://blog.kontena.io/event-driven-microservices-with-rabbitmq-and-ruby/)
 - [The Ruby 2.5.0 feature nobody talks about](https://medium.com/@coorasse/the-ruby-2-5-0-feature-nobody-talks-about-38e6c4585fdd)
 - [Asynchronous JavaScript: From Callback Hell to Async and Await](https://www.toptal.com/javascript/asynchronous-javascript-async-await-tutorial)
 - [Building Your First Node App Using Docker](https://www.javascriptjanuary.com/blog/building-your-first-node-app-using-docker)
- [Paying Technical Debt - How To Rescue Legacy Code through Refactoring](https://blog.intracto.com/paying-technical-debt-how-to-rescue-legacy-code-through-refactoring)
- [Announcing The Node.js Application Showcase](https://medium.com/@nodejs/announcing-the-node-js-application-showcase-9fbaaa3e4824)
- [Node v9.4.0 released](https://nodejs.org/en/blog/release/v9.4.0/)

##### Tools & code
- [Minimesos](https://www.minimesos.org/)
- [Redmine Security Scanner](https://plan.io/redmine-security-scanner/)
- [Polka -- micro web server](https://github.com/lukeed/polka)
- [Mongoose 5.0](http://m


text:
[![Build Status](https://travis-ci.org/cesine/ToolsForFieldLinguistics.svg)](https://travis-ci.org/cesine/ToolsForFieldLinguistics)

# ToolsForFieldLinguistics

A collection of scripts and recipes for fieldlinguistics and RAs in data heavy labs

## Getting Started
### On the server
Install the module with: `npm install git://github.com/cesine/ToolsForFieldLinguistics.git`

```javascript
var ToolsForFieldLinguistics = require('tools-for-field-linguistics');
console.log(ToolsForFieldLinguistics);
```

### In the browser
Download the [development version][max].

[max]: https://raw.github.com/cesine/ToolsForFieldLinguistics/master/dist/tools-for-field-linguistics.js

In your web page:

```html
<script src="dist/tools-for-field-linguistics.js"></script>
<script>
init(); // "init"
</script>
```

In your code, you can attach ToolsForFieldLinguistics's methods to any object.

```html
<script>
var exports = Stuff.utils;
</script>
<script src="dist/tools-for-field-linguistics.js"></script>
<script>
Stuff.utils.init(); // "init"
</script>
```

## Documentation
https://github.com/cesine/ToolsForFieldLinguistics/tree/master/docs

## Examples
For screencasts to see how you can use the code:
https://github.com/cesine/ToolsForFieldLinguistics/tree/master/watchmes

For sample code to see how you can use and re-use the code, see the specs and tests:
https://github.com/cesine/ToolsForFieldLinguistics/tree/master/test

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. If you know how, add unit tests for any new or changed functionality. The project comes with automated linting and testing for your javascript code using [NPM Scripts](https://docs.npmjs.com/misc/scripts).

###Contributing Examples

Want to contribute? (easy)

1. Click on Edit on any of the pages on GitHub
3. Edit the code, and commit your changes saying what you changed (git commit -m "added some more regex to the text cleaner"). GitHub will create an Issue for you which asks us to bring in your changes

Want to contribute? (advanced)

1. Fork the repo
2. Create a branch which describes your change (git checkout -b more_regex)
3. Make your modifications
4. Run the dev tools (linter and tests if you modified the javascript)
 $ npm install
 $ npm run lint
 $ npm test
5. Commit your changes (git commit -m "added some more regex to the text
cleaner")
6. Push to the branch (git push origin more_regex)
7. Create a Pull Request (adding more details if necessary)

JavaScript Syntax highlighting using Sublime
-------------------------
* Download the source code
* Open the entire folder

Groovy Syntax highlighting using Eclipse
-------------------------
* Download the source code
* Create a Groovy project and import the source files

## License
Copyright (c) 2010-2019 cesine, hisakonog, vronvali
Licensed under the Apache 2.0 license.

repository: cesine/ToolsForFieldLinguistics

gha_license_id: NOASSERTION

repo_name: cesine/ToolsForFieldLinguistics


text:
#Docker - utf8 (unicode_ci)

Build with the standard mysql image and adds utf-8 character set and collation to utf8_unicode_ci.
Basic mysql documentation on https://hub.docker.com/_/mysql/ .

```
To see variable just type
mysql> show variables like "%character%";


text:
# Werval Maven Plugin

## Testing

See the
[Review of Plugin Testing Strategies](http://docs.codehaus.org/display/MAVENUSER/Review+of+Plugin+Testing+Strategies)
CodeHaus wiki for reference.
Also see the [Maven Unit and Integration Test Guide](http://khmarbaise.github.io/maui/) that contains many examples of
using the `maven-invoker-plugin`.

Actual unit testing is done using `maven-plugin-testing-harness`.
Integration testing leverage the `install` goal of `maven-invoker-plugin` to create a temporary local repository and
is implemented using `maven-failsafe-plugin` and a JUnit test that uses `maven-invoker` directly.

## Others

Maven plugin descriptor:
http://books.sonatype.com/mvnref-book/reference/writing-plugins-sect-plugin-descriptor.html

Maven Java 8 issues:
https://cwiki.apache.org/confluence/display/MAVEN/Java+8+Upgrade

repository: feelrelieved/werval

repo_name: feelrelieved/werval


text:
---
layout: post
title: My First Post!
categories: [Coding]
---

Finally - my first post attempting to figure out how to use github Pages. I attached some random python code below. Let's see if it works. Sorry for the shortness.

This is a Python snippet:

```python

def find_mean(arr):
  sum = 0
  for i in arr:
    sum = sum + i
  return sum / len(arr)
```


text:
---
layout: post
title: NAS Server in the Cloud?
---
### What does it mean, really?

Cloud evangelists forecast the future of data center are in the Cloud, yet I am not convinced that leads to the demise of
storage servers. I believe storage vendors will find a new home for their products: **Cloud**.

NetApp, a storage vendor who sells NAS boxes transforms itself to an AWS server image provider. The server image just provides the same function as the NAS boxes do.

### Why people still need storage servers, even in Cloud?

#### Compatibility

Cloud storage like S3 and Swift are object store, while most enterprise applications still work with file and block based storage.
Shifting data center into the Cloud must first deal with this API level differences.

#### Portability

Cloud storage technologies may vary from one vendor to another, with absence of industry wide protocols. This poses a migration risk for
Cloud hoppers. In constrast, NFS/CIFS/iSCSI/FC protocols are found in all storage servers, as long as in-cloud storage server exists,
such migration risk is much deminished.

#### Value

It is undeniable that storage vendors like EMC, NetApp, HP, Hitachi, and IBM pride themselves on technologies (and patents) that Cloud storage don't yet have. Their value proposition won't evaporate any time soon.

### How does it look like?

My rough component level comparision is illustrated here.

![_config.yml]({{ site.baseurl }}/images/cloud-server.png)


text:
What Git concepts were you struggling with prior to the GPS session?

Git merge conflicts didn't make a lot of sense until we made one. So I wasn't sure what merge conflicts looked like in practice so didn't know how to fix them.

What concepts were clarified during the GPS?

Git merge conflicts were clarified after we merged them. And I got to see that divider line between the two versions in markdown.

What questions did you ask your pair and the guide?

We struggled to figure out one error that I hadn't seen before. It was something about the github request timing out.

Another question we asked was about was what checkout meant in git branch. In essence, we weren't sure what it individually caused other than git checkout -b new-branch leading us to that new branch that was just made.

What still confuses you about Git?

I'm a bit confused about url permissions. And remotes.

How was your first experience of pairing in a GPS?

It was really good! As the driver, I had a hard time not looking to figure out the problem that the navigator was working on. But we worked on that and the pairing was really positive.


text:
---
Title: Getting Started
---

Here are some explanations for the basics and themes of Self-Hosted.

- [Difficulty tiers]({{<ref "difficulty-tiers.md">}} "Difficulty tiers")
- [How do I self-host?]({{<ref "how-to-self-host.md">}} "Self-hosted how-to")
- [Intro to reverse proxies]({{<ref "reverse-proxies.md">}} "Intro to reverse proxies")
- [Operating systems]({{<ref "operating-systems.md">}} "Operating systems")
- [What are some self-hosted alternatives to stuff I use every day?]({{<ref "self-hosted-alternatives.md">}} "Self-hosted alternatives")
- [What is self-hosting?]({{<ref "self-hosting.md">}} "What is self-hosting?")

repository: ZolVas/wiki

path: /content/Getting Started/_index.md

repo_name: ZolVas/wiki


text:
# ![alt text](src/images/icon48.png "logo")Is It Localhost ?

Chrome Plugin to help you know if you are working on a localhost website or not

This Extension was realised by the [Garden Media Community](http://www.garden-media.fr "Garden Media Homepage")

## What is it for ?
As a developer, I often work on localhost : best rates, and no more need internet connection to work.
For practical reasons, I use the same domain name as the published website. So I change my hosts file to point to the local server.

The problem is, because you juggle between the local server and the published website, sometimes you do not remember exactly where you are actually working and a mishandling can quickly happen ...

Is It Localhost reads the hosts file on your computer and displays a discreet little red inset on localhost websites.You need to specify in the plugin options the location of this file. Then it will create a symlink.

## Screenshots
### Working on localhost :
Do you see the small vertical red notice on the left ?
![alt text](with-extension.png "Working on localhost")

### Working on published website :

![alt text](without-extension.png "Working on published website")

## Installation
In order this plugin correctly works you will need to create a vhost on your local server.

### Get the plugin :
Clone this repository somewhere on your local server

```
$cd /web/document/root/
$git clone https://github.com/eInyzant/is-it-localhost.git
```

### Create a vhost
You must create a vhost with the following domain name :
```
is-it-locahost.local
```

Please pay attention to the correct Document root of your vhost. You must fill the folder where your plugin is installed.

Vhost example :
```
<VirtualHost *:80>
  ServerAdmin<EMAIL_ADDRESS>  DocumentRoot "/web/root/is-it-localhost/"
  ServerName is-it-localhost.local
</VirtualHost>
```

### Add entry to hosts file
In order to work, you need to add the is-it-Localhost.local domain name to your hosts file
For example :
```
<IP_ADDRESS> is-it-localhost.local
```

### Permissions and user group
Finally, be sure you correctly set files and folders permissions. The server will need to create a symlink to the hosts file. So it need write permissions.
Usally, on apache web server the user group is set to "www-data"

repository: eInyzant/is-it-localhost

repo_name: eInyzant/is-it-localhost


text:
---
title: "From gene expression atlases to ultrastructure: the contribution of multimodal imaging to study specific cell types in multicellular organisms"
layout: post
date: 2019-05-23 14:00
image: https://www-db.embl.de/EMBLPersonGroup-PersonPicture/GetPicture?ID=CP-60016118.jpg
headerImage: true
tag:
- invited
- CLEM
- imaging-across-scales
category: projects
author:
#description: Markdown summary with different options
---

_**Yannick Schwab**_

EMBL Heidelberg, Meyerhofstr. 1, 69121 Heidelberg, Germany

## Abstract

Capitalising on the highly stereotypical development of the marine annelid Platynereis dumerilii, we combined fluorescence microscopy and volume EM on multiple specimens at the same developmental stage (6 pdf). By fluorescent in situ hybridisation (FISH), we could map with high precision the expression pattern of more than 200 genes, and serial block face scanning electron microscopy (SBEM) enabled sub-cellular imaging of one full larvae, containing nearly 12000 cells. Further analysis of both modalities lead us to explore in great details how cell types can be characterised from the combination of which genes they express and which specific sub-cellular morphologies they develop.

This work is the result of a large and interdisciplinary consortium, and is now fully accessible online [1].

[1] Vergara HM, Pape C, Meechan KI, Zinchenko V, Genoud C, Wanner AA, Mutemi KN, Titze B, Templin RM, Bertucci PY, Simakov O, Dürichen W, Machado P, Savage EL, Schermelleh L, Schwab Y, Friedrich RW, Kreshuk A, Tischer C, Arendt D. Whole-body integration of gene expression and single-cell morphology. Cell. 2021 Aug 7:S0092-8674(21)00876-X. doi: 10.1016/j.cell.2021.07.017. Epub ahead of print. PMID: 34380046.

extension: markdown