text:
Welcome to the competition reserved to the students of the Recommender Systems course in Politecnico di Milano.

Goal

The application domain is a music streaming service, where users listen to tracks (songs) and create playlists of favorite songs. The main goal of the competition is to discover which track a user will likely add to a playlist, based on

other tracks in the same playlist
other playlists created by the same user
Description

Please read carefully till the end of the page!

In this competition you are required to predict a list of 5 tracks for a set of playlists. The original unsplitted dataset includes around 1M interactions (tracks belonging to a playlist) for 57k playlists and 100k items (tracks). A subset of about 10k playlists and 32k items has been selected as test playlists and items. The goal is to recommend a list of 5 relevant items for each playlist. MAP@5 is used for evaluation. You can use any kind of recommender algorithm you wish (e.g., collaborative-filtering, content-based, hybrid, etc.) written in any language.

The prize

Each team will receive a final score according to the quality of recommendations computed on the private leaderboard, based on:

the position in the final leaderboard when the competition ends;
the position in the leaderboard every 2 weeks, during the competition;
the quality of recommendation in comparison to the baselines;
the size of the team.
The score is computed with the following formula:

$$ \textrm{score} = \textrm{baseline_bonus} + \textrm{standing_points} + \textrm{team_points} $$

Attention. Results on the public leaderboard are computed on a different subset of the test set, so it may differ from the private one.

Baseline bonus

You are provided with 8 baseline scores. Each baseline is computed with a different algorithm. If you are able to do better than n baselines, you will receive a bonus score that adds to your final score

$$ b = 2 \times n $$

Maximum baseline bonus is 16 points.

Important. The top most baseline (Algorithm LG DDTDM) does not count for scoring purposes.

Standing points

According to the standing in the private leaderboard, every two weeks points will be assigned to the teams, in the following manner:

$$ s_i = 18 - 18 \times \log_2{ \left [ \frac{\textrm{rank}-1}{N_\textrm{teams} - 1} +1 \right ] } $$

where i is the deadline,

$$ N_\textrm{teams} = \textrm{number of teams} $$

and

$$ \textrm{rank} = \textrm{ranking of the team in the leaderboard} = 1..N_\textrm{teams} $$

Maximum standing vote is 18 points.

Important. You can register in any moment, regardless of the fact that one or more of the deadlines already passed. If you do not make any submission before the first deadlines, you will get 0 standing point for each of the missed deadlines.

Team points

Single-person teams receive one point of bonus

$$ t = 0 \textrm{ (two persons team)}$$ $$ t = 1 \textrm{ (one person team)}$$

Final score

The total score is computed from the private leaderboard with the following formula:

$$ \textrm{score} = \frac{ \sum_{i} w_i \cdot s_i }{\sum_{i} w_i} + b + t $$

where "i" is the i-th biweekly deadline, and

$$ w_i = 1 \textrm{ (intermediate deadline)} $$ $$ w_i = 2 \textrm{ (final deadline)} $$

The last deadline weights twice each intermediate deadline.

Maximum final score is 35 points.

Attention. Results on the public leaderboard are computed on a different subset of the test set, so it may differ from the private one.

Enrolling to the competition

When registering on Kaggle, you must use your mail.polimi.it email address. If you use a different email address, your mark will not be registered.

Team merging

Team merging won't be allowed after November 14th. After the merging, for each of the past deadlines, the team will get the best final score of the single members.

For instance, suppose students A and B merge into the AB team. If student A got 24 and student B got 28 as final scores for the first deadline, the AB team will have 28 as score for the first deadline.

Attention. At the end of the competition, we will evaluate the activity and contributions of each team member. If we decide that a member has provided only a minimal contribution, we reserve the right to reduce or cancel his/her mark and, eventually, to add a bonus to the mark of the other member.

Team splitting

Team splitting is not allowed in any moment, unless you cancel your Kaggle account and create a new account with the same email address. In this case, you will lose all of your previous submissions (and the related points).

Deadlines

Deadlines will be every 15 days, on the following dates (at 23.59 CET):

15 October
1 November
15 November
1 December
15 December
15 January (final deadline)

repository: moritzmeister/RecSysChallenge

repo_name: moritzmeister/RecSysChallenge


text:
# Configure the application

To configure the application you have to build a configuration file.

All application preferences can be configured through a configuration file.
At least the database connection must be configured through in the configuration file.

All other options can be configured in the file or via the database.
The configured values in the database have a higher priority than the values from the config file.
If a value is configured in the database and the configuration file, then the value from the database is used.

Main features / requirements of the configuration file:
* File is configured in JSON
* Different configuration files can be loaded for diffent node environment variables
* A custom configuration file can be loaded with the config paramater on the start of the application

Main features / requirements of the database configuration:
* Connection to database must be configured in config file
* Options are configured in the table system_preferences
* Multiple values can be stored to a preference

# Loading different configuration files

Normally the configuration files are stored in the "config" directory of the application root directory.

In that directory can be stored different configuration files and the file suited the **NODE_ENV** environment variable will be loaded.

For example:
> NODE_ENV=production
>
> File loaded = <Application_Root>/config/production.json

## Loading a manual configuration file

If you want to load a configuraiton file from custom directory you can start the application with the **--config** paramter.

With that parameter you can set a manual path to the configuration. A config paramter you must set the path to the file

> #> ./dist/lib/index.js --config ./custom_config.json

# Available configuration parameters

In the following section are listed all available configuration parameter and a description of the each of these parameters.

## Parameter for the server

The following paramter defines configuration paramter to configure the server and its api. The configuration parameter are mostly optional, but should be read carfully, espacially the ports, on which the server should run on.

Configuration parameters should match the conifguration for the clients of the server, espacially the ports and the graphql endpoint to get data from the api.

Paramter | Default value | Description
--- | --- | ---
SERVER.HTTP_PORT | 3000 | The port on which the HTTP server would be available
SERVER.HTTPS_PORT | 3001 | The port on which the HTTPS server would be available
SERVER.USE_HTTPS | false | True or false, if HTTPS should be used for th api
SERVER.PRIVATE_KEY | - | Only required, if HTTPS is used for the api. Configuration paramter defines the path to the private key file, used for the SSL encryption
SERVER.CERTIFICATE | - | Only required, if HTTPS is used for the api. Configuration paramter defines the path to the certificate used for the SSL encryption
SERVER.GRAPHQL_ENDPOINT | /graphql | The URL endpoint, where the graphql api is available
SERVER.GRAPHIQL_ENDPOINT | /graphiql | Only required, if the graphiql endpoint is activated. Defineds the URL endpoint on which the graphical user interface for the graphql api is available
SERVER.GRAPHIQL_ACTIVE | true | True or false, if the graphical user interface for the graphql endpoint should be activated
SERVER.REST_ENDPOINT | /rest | The base url of the REST api of the musicserver

## Parameter for the logger

Parameter | Default value | Description
--- | --- | ---
LOGGER.LEVEL | warn | The level which messages are logged.
Available levels, in ascending orders:

error

warn

info

verbose

debug

silly

LOGGER.DIRECTORY | . | The directory, in which the log file will be saved. All configuration files will be stored in that directory
LOGGER.FILENAME | musicserver | The name of the log file.
 The log file will be saved with a suffix (e.g. a timestamp) and the date type log
LOGGER.SINGLE_FILE | false | If true a log file will be stored in the logger directory and all logs will be stored in these file
LOGGER.CONSOLE | true | If true all the logs will be printed on the console
LOGGER.ROTATION_FILE | true | If true in the logger directory will be stored a log file, which will be rotated every day. So in the directory will be a log file for every day.

## Parameter for the database connection

All parameters of the database are required.
Without each of the parameters the musicserver will not start.

Parameter | Default value | Description
--- | --- | ---
DATABASE.TYPE | | The type of the database you want to connect to.
 Allowed values:

mysql

pg

mssql

DATABASE.HOST | | The host address of the database you want to connect to
DATABASE.PORT | | The port, on which the database connector is listening on
DATABASE.USERNAME | | The user, with which the database connection should be established. The user needs full rights on the database / the schema, including the right to create and drop tables
DATABASE.PASSWORD | | The password, which should be used to connect to the database
DATABASE.DATABASE | | The name of the schema, the databse, in which the information of the musicserver should be stored. In the best case that should be a emtpy database, where only the defined user has access on

## Security parameters

The following parameters can be used to configure the security level of the application.
The parameters are optional and are configured with a default value to achieve a moderate security level.

Paramter | Default value | Description
--- | --- | ---
SECURITY.SALT_ROUNDS | 10 | The number of rounds, which are used to generate a salt for the hashing of the passwords

## Authentification paramters

The following parameters can be used to configure the authentification service for your interests.
The paramters are optional.

Parameter | Default value | Description
--- | --- | ---
SIGNUP.POSSIBLE | false | A config paramter, which shows, if the self-signup for users is available. If false new users can only be created by the administartor of the application

## Storage parameters

The following paramters are required, to save files to the filesystem, which is required by the application.

In the storage various files, like covers or artist pictures will be saved.

Select a empty directory, on which the process of the application server has write acces to. The rest of the file structure will be created automatically.

Parameter | Default value | Description
--- | --- | ---
STORAGE.PATH | - | The absolute path on the filesystem, where the files of the application should be stored in

## Image processing parameters

The following parameters can be used to configure the image processing.

Parameter | Default value | Description
--- | --- | ---
IMAGE.FORMAT | JPEG | The format to which the images should be converted

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# NAME

opener_server.pl - Http Container for run any code with http server.

## VERSION

Version 1.1

## SYNOPSIS

    perl opener_server.pl 10008 0
    start a https server which listen on 10008 with built-in api.
    '0' means not autorun code in opener.conf.

## DESCRIPTION

    opener_server.pl is a http container. It's the implement of OPener_Server protocol.
    It aims to quick run code with http server.
	opener_server.pl is very simple programme. It only have one file and all code are in it.
	It's easy to read and to be changed. You can change all by yourself.
    You can injection any code to a http server to get any function you want.
    You can connect programme lannguange with http.

## Manange API

### http service manage

	{action:'new_http_server',port:"",ip:""}

start http server which listen on 'port' and 'ip'.

	{action:'new_https_server',port:"",ip:"",cert_file:""}

start https server which listen on 'port' and 'ip' with certificate file is 'cert_file'. Certificate file is same dir with opener_server.pl.

	{action:'stop_server',ip:"",port:""}

stop http or https server which listen on 'port' and 'ip'.

### register url to get new http api

Host Example: host:"<IP_ADDRESS>:80" or host: "www.aa.com:443". If you need match all, use "*". Example: host:"*.80" to match all request on 80 port.
Url Example: url:"/aa/11/22". If you need match all, use "*". Example: url:"/aa/*".

	{action:'reg_url',url:"",host:'*:*',type:'file',go:""}

reg a "url" with "host", the url point to a file where location is "go".

	{action:'reg_url',url:"",host:'*:*',type:'file_index',go:""}

reg a "url" with "host", the url point to a dir where location is "go".  The url display all files in the "go".

	{action:'reg_url',url:"",host:'*:*',type:'file_down',go:""}

reg a "url" with "host", the url point to a file where location is "go". When you goto the url, browser will download the file.

	{action:'reg_url',url:"*",host:'*:*',type:'file_root',go:""}

reg a "url" with "host", the url point to a dir where location is "go". When opener_server.pl can't find you requset file, it will find it in the root dir at last.

	{action:'reg_url',url:"",host:'*:*',type:'http_get',go:""}

reg a "url" with "host", the url point to a function which code is in "go". The request url type is GET.

	{action:'reg_url',url:"",host:'*:*',type:'form_post',go:""}

reg a "url" with "host", the url point to a function which code is in "go". The request url type is POST, it's specail for form post action.

	{action:'reg_url',url:"",host:'*:*',type:'ajax_post',go:""}

reg a "url" with "host", the url point to a function which code is in "go". The request url type is POST, it's specail for ajax post action.

	{action:'reg_url',url:"",host:'*:*',type:'html5_file_post',go:""}

reg a "url" with "host", the url point to a function which code is in "go". The request url type is POST, it's specail for html5 file upload action.

	{action:'remote_reg_url',remote_url:"",url:"",host:'*:*',type:""}

reg a "url" with "host", the url point to a function which code is in "remote_url".

### container service manage

	{action:'list_url',host:""}

list all registered urls with "host".

	{action:'del_url',url:"",host:""}

delete a registered "url" with "host".

	{action:'list_server'}

list all start http or https service.

	{action:'start_worker',port:"",autorun:"1"}

start a new process with opener_server.pl. It's a clone process of opener_server.pl with manager "port". If "autorun" is true, new opener_server.pl process will run the injection startup code.

	{action:'stop'}

quit the current opener_server.pl process.

	{action:'clear_all'}

clear all injection code and registered url to get a clean opener_server.pl process(not recommend).

### code injection

	{action:'code',code:""}

inject "code" to current opener_server.pl container. "code" should be utf8 encoding.

	{action:'remote_code',remote_url:""}

inject code to current opener_server.pl container. The code content is on a http location of "remote_url"

	{action:'script',script:""}

start a new perl process to run "script". "script" should be utf8 encoding.

	{action:'remote_script',remote_url:""}

start a new perl process to run "script". The script content is on a http location of "remote_url"

### Get opener_server.pl log

	{action:'get_logs',id:""}

Get the logs in opener_server.pl. "id" come from 0 and means get logs which more than "id".

### reg or clear startup

	{action:'',reg_startup:"1"}

If reg_startup is true, this action will reg autorun with current manager port of opener_server.pl.

	{action:'clear_startup'}

clear all startup code of current opener_server.pl process

### reg or clear default startup

	{action:'',reg_default_startup:"1"}

If reg_default_startup is true, this action will reg autorun with all manager port of opener_server.pl as default run.

	{action:'clear_default_startup'}

clear all default_startup code of all opener_server.pl process

## AUTHOR

    Larry Wang "<a at openerserver.com>"

## License

    The Apache License
    Version 2.0, January 2004
    http://www.apache.org/licenses/

## WebSite

    https://www.openerserver.com


text:
# project-interaction
[![license](https://img.shields.io/hexpm/l/plug.svg)](LICENSE)
[![jitpack](https://img.shields.io/badge/jitpack-1.1.0-green.svg)](https://jitpack.io/#bigstark/project-interaction)

I'm gonna develop various components and animations in this project.
I hope this project helps you use interaction.

## Include your project
add build.gradle
```
allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}
```
```
dependencies {
    compile 'com.github.bigstark:project-interaction:1.1.1'
}
```

## Loading Indicator
When people use android application, loading is the most common things to happen. If screens do not show any changes while waiting for request or response, users think the application stops. Eventually, this occurs negative effects to users. That is why we need to tell users it's loading. Therefore Loading Indicator is a essential factor for application.

### Circle Loading View
![CircleLoadingView](https://github.com/bigstark/project-interaction/blob/master/screenshots/CircleLoadingView.gif)

- Usage
```xml
<com.bigstark.interaction.CircleLoadingView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/circle_loading_view"
    android:layout_width="100dp"
    android:layout_height="100dp"
    app:circleColor="#FF0000"
    app:circleRadius="17dp"
    />
```

### Random Tile View
![RandomTileLoadingView](https://github.com/bigstark/project-interaction/blob/master/screenshots/RandomTileLoadingView.gif)

- Usage
```xml
<com.bigstark.interaction.RandomTileLoadingView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/random_tile_loading_view"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_marginTop="20dp"
    app:tileColor="#00FF00"
    app:tileMargin="10dp"
    />
```

License
-------

    Copyright 2017 BigStarK

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

repository: bigstark/project-interaction

repo_name: bigstark/project-interaction


text:
# flink-money-enrichment
**A streaming data enrichment application powered by Apache Flink.**

This project is an extensive POC of using Apache Flink (DataStream API) to implement a streaming
data enrichment.

## Requirements

#### Non-functional

- Scalability, low latency and high throughput. Provided by Flink out of the box.
- High availability and fault tolerance. Provided by Flink and RocksDB as state backend.
- Exactly once end-to-end processing. Achieved by using Flink Kafka Source/Sink connectors.
- Application evolution without reprocessing all data from the beginning. Achieved by using AVRO as data type for Flink state.
- Easy to test. Provided by so-called Flink harnesses and MiniCluster .
- Observability of Flink internal state. Achieved by using Flink QueryableStateClient.
- Bootstrapping state based on historical data. Provided by Flink State Processor API.

#### Functional

- It should enrich a stream of transactions events (money) coming from a Kafka topic with data from two other Kafka topics (session event stream + user event stream)
- It should process events out of order.
- It should deduplicate money events.
- It should detect first occurrence of money events per user.
- It should process each event exactly once.
- It should clean session info state after session expiration.
- It should produce same results in real time as in backfill scenarios. (See Inspirations section)
- It should enrich late money events with data from an external service without blocking. (Flink AsyncFunction)
- It should use Avro as a serialization system and Scala case classes representing the domain. (No Java generated POJOS) (See Inspirations section)

#### BTW, Apache Flink:

- is battle tested. (https://flink.apache.org/poweredby.html)
- is good supported. Flink's community is huge and very active. Moreover, Ververica offers great courses and production supporting.
- offers a Scala API.

## Usage

**To run the tests**
```
cd .../money-enrichment/
sbt test
```

**To run and test the application locally**

We have 3 options:

- SBT. Run `sbt run` from the application root folder.
- IDE. Run org.kindofdev.MoneyEnrichmentApp class.
- Flink cluster.
  * Package the application into a fat jar with `sbt clean assembly` from the application root folder and then ...
  * Submit it to Flink with `./bin/flink run .../money-enrichment/target/scala-2.12/money-enrichment-assembly-0.1-SNAPSHOT.jar`

Note that before bringing up the application, we need Kafka and Zookeeper running
```
cd .../money-enrichment/docker
docker-compose up
```

**To query internal state**

We can use `org.kindofdev.query.QueryClient`. There's a Scala worksheet with an example called `query_state_worksheet.sc`

## To-do list

- Create performance tests + Tune parallelism and maxParallelism.
- Create automated tests for state migration/evolution. (It was tested manually, and it worked properly).
- Play with Flink State Processor API.
- Find out why the test "not deduplicate events if ttl finished" fails. (It works correctly when it is tested manually) (this test is ignored currently).
- Find out why the test "fail due to a timeout in async session enrichment" fails. (this test is ignored currently).

## Inspirations

- The approach followed to achieve application evolution using Scala case classes and AVRO is based on ING WBAA team's approach shown in the following article.
  https://medium.com/wbaa/making-sense-of-apache-flink-state-migration-with-scala-and-avro-69091c232646

- Determinism in backfill scenarios vs real time is based on Bird Engineering's article
https://medium.com/bird-engineering/replayable-process-functions-in-flink-time-ordering-and-timers-28007a0210e1

## License
[MIT](https://choosealicense.com/licenses/mit/)

Made with ♥ in Malaga by Jose Velasco

repository: MaximePley/flink-money-enrichment

branch_name: refs/heads/main

repo_name: MaximePley/flink-money-enrichment


text:
# Steven

A work in progress Minecraft client in Go.

## Images

![Steven](http://i.imgur.com/VVnmbkV.png)

![Steven with Nether style background and a resource pack](https://i.imgur.com/QjBb1UT.png)

![Steven's server list after disconnecting from a server](https://i.imgur.com/JRFXt0e.png)

## Building

To build:

```
export GOPATH=your/install/directory
go get github.com/thinkofdeath/steven/cmd/steven
```

To update, run `go get` with the `-u` option.

## What works

* Connecting to servers
* Online mode
* Rendering most blocks
* Block model support

## What doesn't work

* 99% of Minecraft's features

## Chat

I generally am on the `irc.spi.gt` irc network in the `#think` channel.
Feel free to pop in to say hi, [Webchat can be found here](https://irc.spi.gt/iris/?channels=think)

## Builds

**Latest:**

|  #  |      Linux      | OS X |      Windows      |
|:---:|:---------------:|:----:|:-----------------:|
| x64 | [linux_amd64.zip](http://ci.thinkofdeath.uk/guestAuth/repository/download/Steven_Client/.lastSuccessful/linux_amd64.zip) |   [Issue](https://github.com/thinkofdeath/steven/issues/27)  | [windows_amd64.zip](http://ci.thinkofdeath.uk/guestAuth/repository/download/Steven_Client/.lastSuccessful/windows_amd64.zip) |
| x32 |   [Issue](https://github.com/thinkofdeath/steven/issues/28)       |   [Issue](https://github.com/thinkofdeath/steven/issues/27)  |  [windows_386.zip](http://ci.thinkofdeath.uk/guestAuth/repository/download/Steven_Client/.lastSuccessful/windows_386.zip)  |

Older builds can be found [here](http://ci.thinkofdeath.co.uk/viewType.html?buildTypeId=Steven_Client&guest=1)

## Running

### Via the Offical Minecraft launcher

![Profile example](http://i.imgur.com/NBMGhPL.png)

You need to create a new profile (or edit an existing one) on the Minecraft
launcher and modify the profile to look like the above but replace the path
to steven with the location you built it at or downloaded it too and change the
`server` parameter to the target server. Currently only works in online mode
(with no plans for offline mode currently). If the `server` parameter isn't
passed then a server list will be displayed.

### Standalone

Just running steven via a double click (Windows) or `./steven` (everything else)
will bring up a login screen followed by a server list which you can select a server
from.

Providing a username, uuid and access token via the command line as followed:
  `--username <username> --uuid <uuid> --accessToken <access token>`
will skip the login screen and jump straight to the server list. Providing a
server address via `--server <server>:<port>` will skip the server list and
connect straight to the server. As it currently stands providing all the arguments
allows for the client to parallelise connecting to the server and loading the
textures/models/other assets as a 'quick connect'.

repository: ammaraskar/steven

repo_name: ammaraskar/steven


text:
# Defold Builder

A tiny Bash script for building, running and bundling Defold Games.
Originally developed by [@AstroChilli](https://github.com/astrochili) for using
Vscode with Defold, but has been extracted and hosted here for use with
other text editors too.

## Prerequisites

- Bob, the builder from the [Defold downloads page](https://d.defold.com)
- Dmengine from the [Defold downloads page](https://d.defold.com)

### Additional steps on Windows

- If you're running on Windows, you need to install Bash for Windows
- Download [x86_64-win32/defoldsdk.zip](https://d.defold.com/stable/) and
configure paths to `OpenAL32.dll` and `wrap_oal.dll` in `build.sh`.

After downloading the prerequisites, configure the path to bob.jar and dmengine
in `buid.sh`.

## Commands

The supported commands that you can execute are

- `./build.sh clean` : Cleans the build folder
- `./build.sh resolve` : Resolves all external library dependencies.
- `./build.sh build` : Builds the game for the current platform
- `./build.sh launch` : Launches the built game.
- `./build.sh bundle platform` : Bundles the game for the specified platform,
where platform is one of `Windows`, `Linux`, `macOS`, `Android`, `iOS` or `HTML5`.

## Fields

The script provides various fields that you can modify.

### General

- `bob_path` : The path to bob.jar
- `dummy_engine_path` : The path to the local download of dmengine. This version
is used to run Defold games without Native Extensions.
- `exclude` : The folders to be excluded from builds.

### Dependencies

- `email` : The email used to resolve dependencies
- `auth`  : Authentication token to resolve dependencies

### Bundle

- `texture_compression` : Whether texture compression should be used as
specified in texture profiles. Defaults to true.
- `with_symbols` : If the symbol file should be generated (if applicable).
Defaults to true.
- `liveupdate` : Whether liveupdate content should be published. Defaults to
false.

### iOS

- `mobileprovisioning` : Path to mobileprovisioning profile.
- `identity` : The name of your code signing identity from Keychain.

### Android

- `keystore` : The keystore to be used for signing the bundle
- `keystore_pass` : The password for the keystore used when signing the bundle.
- `bundle_format` : The format in which the apk should be bundled. Accepts either
`apk` or `aab`. Defaults to apk.


text:
---
layout: post
title: Data structure and simple plotting!
categories: R
tags: [Data structure, plotting]
---
This post focuses on proper data structure and some basic plotting techniques.

----------

**Data structure**
How you structure your data in excel is very important. Putting your data in a complicated structure can make coding very difficult.  The best way to organize your data is by using a long format.

*What does it mean to have a long format?*

Lauren Pandori, a grad student in the Sorte Lab, supplied me with some of her data for this lesson.  Let's take a look at how she formatted it.

The first time that she sent me her data it was formatted like this:

![ShortFormat]({{ njsilbiger.github.io }}/images/Week2/ShortFormat.png)

There are two issues with this formatting:
1) It is in short format.  You can see that every quadrat has its own column.  This is completely fine for analyzing data in excel, but it is not appropriate for R.
2) The names have spaces and non alphanumeric characters in them and they are long.

Here is an example of this same data, but formatted in a way that is much more amenable to R:

![LongFormat]({{ njsilbiger.github.io }}/images/Week2/LongFormat.png?raw=true =200x200)

You can see now that every row is a unique data point with all the columns listing the different attributes of that data point.

----------
**Simple Plotting**

Today we are going to take Lauren's data and make a simple plot. Lauren's data set consists of mussel counts across 5 different microhabitat types (Tide pools, Unsheltered Solitary, Sheltered Aggregate, and Unsheltered Aggregate) in 3 different tidal zone (Low, Mid, High). She also has 10 replicate quadrats across each tidal zone and microhabitat type. When I asked Lauren how she wanted her data plotted she sent me this picture. :) So, this is what we are going to plot today!

![LaurenDrawing]({{ njsilbiger.github.io }}/images/Week2/LaurenDrawing.JPG?raw=true =200x200)

----------

**Let's code!**

First, remember from last week how to properly structure your script. So, let's follow our best practices

```R
####################################################
# Script to create plot for Lauren's ocean project #
# Created by Nyssa
# created on 1/16/2017
####################################################

## clear workspace---------
rm(lists=ls())

## set working directory------
setwd(getwd())

# load libraries------------------
library(plyr) #need to summarize data

## Load Data-------------
Data<-read.csv('Data/PandoriData.csv')

## Data analysis-----------------
```

Before we start any data analysis it is always best to check your dataset and make sure that there are no errors. You can do this by using the head () and tail () function. This shows your the first 6 and last six rows of your data. Then you can see if there is anything weird and you can clean it

```R
# clean the data--------------
# check the data
head(Data)
tail(Data)

## there seems to be an extra row, probably because something was deleted

#remove extra/unwanted column
Data$X<-NULL

```

Our data are now in a clean *dataframe* (the name of the data strucutre).  You will notice that there are two different types of data in this dataframe. A *factor* and an *integer*. The factor are discrete data that have levels.  For example, Tide height here is a factor with levels low, mid, and high.  R automatically puts the levels in alphabetical order, but sometimes this does not make sense.  For example, high should go after mid, not before. So now we are going to order the factors in a way that makes sense for Lauren's data.

```R
# order the habitat data by level of environmental filtering:
# 1. Unsheltered solitary (Usol), 2. Unsheltered aggregate (Uagg), 3. Sheltered solitary (Ssol),
# 4. Sheltered aggregate (Sagg), 5. Tidepool (Tide)

Data$Uhab <- ordered(Data$Uhab, levels = c("Usol", "Uagg", "Ssol","Sagg","Tide"))

# check that they are ordered the correct way
unique(Data$Uhab)

#Let's do the same for tide height
Data$TideHt<-ordered(Data$TideHt, levels = c("Low","Mid","High"))
```

Next, we want to take the averages by tide height, life stage, and habitat type to make the figure that she would like.  We are going to have an entire lesson on different ways to summarize data so I am not going to go into detail on different ways to do this.  I really like the *ddply* function from the *plyr* package so that is what I am going to use.

```R
## take the averages by tide height, juve/adult, and habitat
Data.mean<-ddply(Data, c("TideHt","LifeStage","Uhab"), summarize,
                 Abun.Mean = mean(Abun, na.rm=TRUE), # this is saying to take the mean and ignore missing data if there is any
                 N = sum(!is.na(Abun)), # how many samples do you have (code says what is not a missing value and sum the counts)
                 Abund.SE = sd(Abun)/sqrt(N) # this is the standard erre
                 )

# check the data
Data.mean  #notice that it calculated the means and SE in the order that you specified above
# Low, then Mid, then High, and same for the order for Uhab

```

I now have a new dataframe with the averages and standard error values by each group that I am interested in visualizing.

Now let's plot the data. First let's create a barplot with just the low tide data. Because we have 2 different groupings (Tide height and also Life stage), we need to make the data a matrix with adults on top and juveniles on the bottom. The below code will put the first 5 data points (adults) in one column and then the second 5 in the second column and then I used t to transpose it so that there are 5 columns and 2 rows.

```R
# I created a matrix for the mean and named it m
m<-t(matrix(Data.mean$Abun.Mean[Data.mean$TideHt=='Low'],5,2))
# a matrix for the SE and names it mse
mse<- t(matrix(Data.mean$Abund.SE[Data.mean$TideHt=='Low'],5,2))
```

Now let's create a barplot with this data.

```R
x<-barplot(m) # m is our mussel mean data

```
When we run this code we get a really simple plot below with all the defaults.

![simpleplot]({{ njsilbiger.github.io }}/images/Week2/simpleplot.png)

 The default is to stack the data on top of each other.  If this were % cover data it would be fine, but it is not so let's put them next to each other using beside=TRUE. Also, let's customize it a bit so that it is more informative. The names.arg says what we should name the x-axis.  You can also manually put in names to make it prettier. I also set the y axes from 0 to the max abundance across + SE the entire data set and I gave it a title of Low tide and a y-label of mussel density. Look at ?barplot to find all the ways that you can manipulate a barplot.

```R
x<-barplot(m, # m is our mussel mean data
        beside=TRUE, names.arg = unique(Data.mean$Uhab), ylim=c(0, max(Data.mean$Abun.Mean)+ max(Data.mean$Abund.SE)),
        main='Low Tide', ylab="Mussel Density")
```

This code will now create the plot below.

![LowTide1]({{ njsilbiger.github.io }}/images/Week2/LowTide1.png)

Now, let's add error bars. One of the ways to make error bars in the base package is with the function *arrows* which essentially adds an arrow from point x to point y in whatever direction that you want. I named the barplot above x. You will notice that now x is a 2 x 5 matrix.  These are the positions of the data (the bars in the figure) along the x-axis.  The first row is the adult and the second are the Juveniles

```R
# the code the add the arrows
arrows(x, m + mse,  # x , mean + SE
       x, m - mse,  # x, mean - SE
       angle=90, code=3, length = 0.05) # angle is 90 degrees (180 is horizontal), code is the time of arrowhead, and
# length is the length of the arrow head

```
![LowTide2]({{ njsilbiger.github.io }}/images/Week2/LowTide2.png)

Lauren also wanted lines connecting the different data points. To add another layer of lines to the plot we use the functions lines, like so:

```R
lines(x[1,],m[1,]) # line for adults
lines(x[2,],m[2,], lty = 2) # line for juveniles
# I made this line type dashed to make it different from the first using lty=2
```
![LowTide3]({{ njsilbiger.github.io }}/images/Week2/LowTide3.png)

Now, let's say that you want to compare the data across tide heights. We can make multiple subplots in one figure using the par() function.  The par() function basically does all the different types of plot manipulating that you want, including changing margins, number of subplots, removing background, and many more. For subplotting we use par(mfrow=c(rows,columns)).  Where you put the number of rows and columns you want in your plot.  Here we have 3 tide heights so we are going to put in 1 row and 3 columns. Then we can copy and paste all the code above, but select data for the mid and high tide heights to make the graph.  In a future lesson, I am going to show you how to do this with a for loop so that it is much more streamlined.

```R
# let's make 3 columns and one row
par(mfrow=c(1,3))
#Low tide data
m<-t(matrix(Data.mean$Abun.Mean[Data.mean$TideHt=='Low'],5,2))
mse<- t(matrix(Data.mean$Abund.SE[Data.mean$TideHt=='Low'],5,2))
# plot
x<-barplot(m, # m is our mussel mean data
           beside=TRUE, names.arg = unique(Data.mean$Uhab), ylim=c(0, max(Data.mean$Abun.Mean)+ max(Data.mean$Abund.SE)),
           main='Low Tide', ylab="Mussel Density")
#error bars
arrows(x, m + mse,  # x , mean + SE
       x, m - mse,  # x, mean - SE
       angle=90, code=3, length = 0.05)
# lines
lines(x[1,],m[1,])
lines(x[2,],m[2,], lty = 2)

#Mid tide data
m<-t(matrix(Data.mean$Abun.Mean[Data.mean$TideHt=='Mid'],5,2))
mse<- t(matrix(Data.mean$Abund.SE[Data.mean$TideHt=='Mid'],5,2))
# plot
x<-barplot(m, # m is our mussel mean data
           beside=TRUE, names.arg = unique(Data.mean$Uhab), ylim=c(0, max(Data.mean$Abun.Mean)+ max(Data.mean$Abund.SE)),
           main='Mid Tide', ylab="Mussel Density")
#error bars
arrows(x, m + mse,  # x , mean + SE
       x, m - mse,  # x, mean - SE
       angle=90, code=3, length = 0.05)
# lines
lines(x[1,],m[1,])
lines(x[2,],m[2,], lty = 2)

#Hight tide data
m<-t(matrix(Data.mean$Abun.Mean[Data.mean$TideHt=='High'],5,2))
mse<- t(matrix(Data.mean$Abund.SE[Data.mean$TideHt=='High'],5,2))
# plot
# also in this last plot let's add a legend.  We can also manually add a legend outside of this code using the function legend()
x<-barplot(m, # m is our mussel mean data
           beside=TRUE, names.arg = unique(Data.mean$Uhab), ylim=c(0, max(Data.mean$Abun.Mean)+ max(Data.mean$Abund.SE)),
           main='High Tide', ylab="Mussel Density", legend.text = c('Adult','Juvenile'))
#error bars
arrows(x, m + mse,  # x , mean + SE
       x, m - mse,  # x, mean - SE
       angle=90, code=3, length = 0.05)
# lines
lines(x[1,],m[1,])
lines(x[2,],m[2,], lty = 2)

```

The plot now looks like this.

![Subplot1]({{ njsilbiger.github.io }}/images/Week2/Subplot1.png)

**Saving the plot**

Lastly, we want to save this plot with specific dimensions so that it comes out perfect every time we run it. You can save a plot in almost any format (e.g., pdf, png, jpg, etc.). Here, I will show you have to save a pdf file.

The code for saving a pdf file is pdf(file = "filename", width = x, height = y), where width and height are in inches.  Note, that now all formats save in inches.  This line goes before your code for the figure that you are creating, then at the end of your figure you put dev.off().  Which says, turn off the graphics device and save the figure.

```R
pdf(file = 'Output/LaurenBarChart.pdf', width = 8, height = 6) # name the file, put it in your output folder, then say how big you want it to be in inches.

 # now put all the code we just ran here
# and close it with

dev.off() # turn off the device and export the figure
```

So, all together now

```R
pdf(file = 'Output/LaurenBarChart.pdf', width = 8, height = 6) # name the

# let's make 3 columns and one row
par(mfrow=c(1,3))
#Low tide data
m<-t(matrix(Data.mean$Abun.Mean[Data.mean$TideHt=='Low'],5,2))
mse<- t(matrix(Data.mean$Abund.SE[Data.mean$TideHt=='Low'],5,2))
# plot
x<-barplot(m, # m is our mussel mean data
           beside=TRUE, names.arg = unique(Data.mean$Uhab), ylim=c(0, max(Data.mean$Abun.Mean)+ max(Data.mean$Abund.SE)),
           main='Low Tide', ylab="Mussel Density")
#error bars
arrows(x, m + mse,  # x , mean + SE
       x, m - mse,  # x, mean - SE
       angle=90, code=3, length = 0.05)
# lines
lines(x[1,],m[1,])
lines(x[2,],m[2,], lty = 2)

#Mid tide data
m<-t(matrix(Data.mean$Abun.Mean[Data.mean$TideHt=='Mid'],5,2))
mse<- t(matrix(Data.mean$Abund.SE[Data.mean$TideHt=='Mid'],5,2))
# plot
x<-barplot(m, # m is our mussel mean data
           beside=TRUE, names.arg = unique(Data.mean$Uhab), ylim=c(0, max(Data.mean$Abun.Mean)+ max(Data.mean$Abund.SE)),
           main='Mid Tide', ylab="Mussel Density")
#error bars
arrows(x, m + mse,  # x , mean + SE
       x, m - mse,  # x, mean - SE
       angle=90, code=3, length = 0.05)
# lines
lines(x[1,],m[1,])
lines(x[2,],m[2,], lty = 2)

#Hight tide data
m<-t(matrix(Data.mean$Abun.Mean[Data.mean$TideHt=='High'],5,2))
mse<- t(matrix(Data.mean$Abund.SE[Data.mean$TideHt=='High'],5,2))
# plot
# also in this last plot let's add a legend.  We can also manually add a legend outside of this code using the function legend()
x<-barplot(m, # m is our mussel mean data
           beside=TRUE, names.arg = unique(Data.mean$Uhab), ylim=c(0, max(Data.mean$Abun.Mean)+ max(Data.mean$Abund.SE)),
           main='High Tide', ylab="Mussel Density", legend.text = c('Adult','Juvenile'))
#error bars
arrows(x, m + mse,  # x , mean + SE
       x, m - mse,  # x, mean - SE
       angle=90, code=3, length = 0.05)
# lines
lines(x[1,],m[1,])
lines(x[2,],m[2,], lty = 2)

dev.off() # turn off the device and export the figure
```

Now, your figure is saved in your output folder as a PDF!
----------

OK, now your turn!


text:
[![Build Status](https://travis-ci.org/JFTechnology/ember-route-metadata.svg)](https://travis-ci.org/JFTechnology/ember-route-metadata)
[![Ember Observer Score](https://emberobserver.com/badges/-jftechnology-ember-route-metadata.svg)](https://emberobserver.com/addons/@jftechnology/ember-route-metadata)
[![npm version](https://badge.fury.io/js/%40jftechnology%2Fember-route-metadata.svg)](https://badge.fury.io/js/%40jftechnology%2Fember-route-metadata)
[![Dependency Status](https://david-dm.org/JFTechnology/ember-route-metadata.svg)](https://david-dm.org/JFTechnology/ember-route-metadata)
[![devDependency Status](https://david-dm.org/JFTechnology/ember-route-metadata/dev-status.svg)](https://david-dm.org/JFTechnology/ember-route-metadata#info=devDependencies)

@jftechnology/ember-route-metadata
==============================================================================

Breadcrumbs, page title management, and transition aware window scrolling leveraging the new
  [0398-RouteInfo-Metadata]
  feature.

See [addon docs](https://jftechnology.github.io/ember-route-metadata) for details.

Compatibility
------------------------------------------------------------------------------

* Ember.js (LTS) v3.8 or above (requires ember-decorators-polyfill for Ember versions < 3.10)
* Ember CLI v3.8 or above

Installation
------------------------------------------------------------------------------

```
ember install @jftechnology/ember-route-metadata
```

For Ember 3.8 / 3.9 you need to install the decorator polyfill as well...

```
ember install ember-decorators-polyfill
```

Usage
------------------------------------------------------------------------------

See [addon docs](https://jftechnology.github.io/ember-route-metadata) for details.

License
------------------------------------------------------------------------------

This project is licensed under the [MIT License](LICENSE.md).

repository: JFTechnology/ember-route-metadata

gha_language: JavaScript

gha_license_id: MIT

repo_name: JFTechnology/ember-route-metadata


text:
# SBU gets 2019-20 campaign underway against Ohio

Published at: **2019-11-01T22:15:29+00:00**

Author: **EndPlay**

Original: [WFXT](https://www.boston25news.com/news/sbu-gets-201920-campaign-underway-against-ohio/1004178626?utm_source=homestream&utm_medium=site_navigation&utm_campaign=homestream_click)

ST. BONAVENTURE, N.Y. - Ohio (0-0) vs. Saint Bonaventure (0-0)
Reilly Center, St. Bonaventure, New York; Tuesday, 7:30 p.m. EDT
BOTTOM LINE: Saint Bonaventure begins its 2019-20 campaign by hosting the Ohio Bobcats. Ohio went 14-17 last year and finished 11th in the MAC, while Saint Bonaventure ended up 18-16 and finished fourth in the A10.
DID YOU KNOW: Ohio went 7-4 against non-conference programs last season. In those 11 games, the Bobcats gave up 74.1 points per game while scoring 72.3 per matchup. Saint Bonaventure went 4-9 in non-conference play, averaging 67.5 points and allowing 67.4 per game in the process.
___
For more AP college basketball coverage: https://apnews.com/Collegebasketball and http://twitter.com/AP_Top25
___
This was generated by Automated Insights, http://www.automatedinsights.com/ap, using data from STATS LLC, https://www.stats.com

license: Unlicense

repository: dsadlollioygjmzvcxv/tdc-exported

repo_name: dsadlollioygjmzvcxv/tdc-exported


text:
# MABWiser: Parallelizable Contextual Multi-Armed Bandits

MABWiser is a research library written in Python for rapid prototyping of multi-armed bandit algorithms.
It supports **context-free**, **parametric** and **non-parametric** **contextual** bandit models and provides built-in
parallelization for both training and testing components. The library also provides a a simulation utility for comparing
different policies and performing hyper-parameter tuning. MABWiser follows a scikit-learn style public interface, adheres to
[PEP-8 standards](https://www.python.org/dev/peps/pep-0008/), and is tested heavily.

MABWiser is developed by the Artificial Intelligence Center of Excellence at Fidelity Investments.

## Quick Start

```python
# An example that shows how to use the UCB1 learning policy
# to make decisions between two arms based on their expected rewards.

# Import MABWiser Library
from mabwiser.mab import MAB, LearningPolicy, NeighborhoodPolicy

# Data
arms = ['Arm1', 'Arm2']
decisions = ['Arm1', 'Arm1', 'Arm2', 'Arm1']
rewards = [20, 17, 25, 9]

# Model
mab = MAB(arms, LearningPolicy.UCB1(alpha=1.25))

# Train
mab.fit(decisions, rewards)

# Test
mab.predict()
```

## Available Bandit Policies

Available Learning Policies:
* Epsilon Greedy
* LinUCB
* Softmax
* Thompson Sampling (TS)
* Upper Confidence Bound (UCB1)

Available Neighborhood Policies:
* Clusters
* K-Nearest
* Radius

## Installation

There are two alternatives to install the library:

1. Install from the provided wheel package
2. Build from the source code

### Requirements

The library requires Python **3.6+**. The ``requirements.txt`` lists the necessary
packages. The following packages are used currently:

```python
joblib
numpy
pandas
scikit-learn
scipy
seaborn>=0.9.0
```

### Install from wheel package

You can install the library from the provided wheel package using the following commands:

```bash
git clone https://github.com/fmr-llc/mabwiser.git
cd mabwiser
pip install dist/mabwiser-X.X.X-py3-none-any.whl
```
Note: Don't forget to replace ``X.X.X`` with the current version number.

### Install from source code

Alternatively, you can build a wheel package on your platform from scratch using the source code:

```bash
git clone https://github.com/fmr-llc/mabwiser.git
cd mabwiser
pip install setuptools wheel # if wheel is not installed
python setup.py bdist_wheel
pip install dist/mabwiser-X.X.X-py3-none-any.whl
```

### Test Your Setup
To confirm that cloning the repo was successful, run the tests and all should pass.

```bash
git clone https://github.com/fmr-llc/mabwiser.git
cd mabwiser
python -m unittest discover tests
```

To confirm that installation was successful, import the library in Python shell or notebook.

```python
from mabwiser.mab import MAB, LearningPolicy, NeighborhoodPolicy
```

### Upgrade the Library

To upgrade to the latest version of the library, run ``git pull origin master`` in the repo folder,
and then run ``pip install --upgrade --no-cache-dir dist/mabwiser-X.X.X-py3-none-any.whl``.

## Usage Examples

See the [/examples](https://github.com/fmr-llc/mabwiser/tree/master/examples) folder for self-contained usage examples:

* [Content-Free Bandits](https://github.com/fmr-llc/mabwiser/blob/master/examples/context_free_mab.py)
* [Contextual Parametric Bandits](https://github.com/fmr-llc/mabwiser/blob/master/examples/parametric_mab.py)
* [Contextual Non-Parametric Bandits](https://github.com/fmr-llc/mabwiser/blob/master/examples/contextual_mab.py)
* [Customizing Bandits](https://github.com/fmr-llc/mabwiser/blob/master/examples/customized_mab.py)
* [Parallelization](https://github.com/fmr-llc/mabwiser/blob/master/examples/parallel_mab.py)
* [Hyper-Parameter Tuning](https://github.com/fmr-llc/mabwiser/blob/master/examples/simulator.py)

Conceptually, given a set of historical decisions and their corresponding rewards,
the high-level idea behind MABWiser is to train a model using the `fit()` method, and then, predict the
next best decisions using the `predict()` method.

Apart from the actual predictions, it is also possible to retrieve the expected reward of each arm using
the `predict_expectations()` method. As time progresses and new decision and reward history becomes available, online
training can be performed using the `partial_fit()` method. New arms can be introduced to the system dynamically using
the `add_arm()` method.

In terms of input data types, decisions and rewards data support lists, 1D numpy arrays, and pandas series while
contexts data supports 2D lists, 2D numpy arrays, pandas series and data frames.

## Multi-Armed Bandits In a Nutshell

There are many real-world situations in which we have to decide between multiple options yet we are
only able to learn the best course of action by testing each option sequentially.

[**Multi-Armed Bandit (MAB)** algorithms](https://en.wikipedia.org/wiki/Multi-armed_bandit) are suitable for such
sequential, online decision making problems under uncertainty.
As such, they play an important role in many machine learning applications in internet advertising, recommendation
engines, and clinical trials among many others.
In this setting, for each and every renewed decision we face an underlying question:
Do we stick to what we know and receive an expected result ("**_exploit_**") or choose an option we do not know much
about and potentially learn something new ("**_explore_**")?

**Problem Definition:** In a multi-armed bandits problem, the model of outcomes is unknown, and the outcomes can be
deterministic
or stochastic. The agent needs to make a sequence of decisions in time *1, 2, ..., T*.
At each time *t* the agent is given a set of *K* arms, and it has to decide which arm to pull.
After pulling an arm, it receives a *reward* of that arm, and the rewards of other arms are unknown.
In a stochastic setting the reward of an arm is sampled from some unknown distribution. Situations exist in which we
also observe side information at each time *t*. This side information is referred to as *context*. The arm that has the
highest expected reward may be different given different contexts.
This variant is called **contextual multi-armed bandits**. Overall, the objective is to minimize _regret_, or
equivalently, maximize the cumulative expected reward in the long run.

## License

MABWiser is licensed under the [Apache License 2.0](LICENSE.md).

<br>

repository: skadio/mabwiser

repo_name: skadio/mabwiser


text:
# py-twitter-bot
A basic template for creating a twitter bot with Python 3 and the tweepy library. The functionality of this will grow over the next month, so follow along.

# Instructions

1. Clone or download repo
2. Install tweepy by running 'pip install tweepy' from command line
3. Create a Twitter Account
4. Create a Twitter App
5. Get your Consumer Key, Consumer Secret Key, Auth Token and Auth Secret Token
6. Insert the Keys and Tokens into the creds.py file and keep this file private. *Add to your .gitignore if you use a repo.*
7. Put your tweet string into the twitter-bot.py tweet method call
8. Run twitter-bot.py *You can put on a CRON scheduler to keep on firing at specific times*

repository: jandricksen/py-twitter-bot

repo_name: jandricksen/py-twitter-bot


text:
# Recursion

## Recursion Links

- [Dijkstra was right - recursion should not be difficult](https://indepth.dev/dijkstra-was-right-recursion-should-not-be-difficult/) has a good overview of Recursion.
- [Recursion made simple](https://www.codeproject.com/Articles/32873/Recursion-made-simple)
- [Iteration vs Recursion](https://www.codeproject.com/Articles/21194/Iterative-vs-Recursive-Approaches) gives a good overview of the efficiency comparison between recursion, iteration, and an optimized recursion where the values are stored in a Dictionary. The optimized recursion could be made even more efficient using tail recursion, though for things like the Fibonacci numbers & factorial the iterative solution is going to be more efficient if for no other reason than it doesn't make additional method calls.
- [Thinking about Recursion](https://www.solipsys.co.uk/new/ThinkingAboutRecursion.html)

## Tail Recursion

- [Understanding Tail Recursion](https://codeburst.io/understanding-tail-recursion-7975af331296)

## Implementing Recursion

From DonaldPShimoda, Hacker News:

1. Write down what your function does in a comment.  (e.g., "sum all the elements of a binary tree").
2. Write the function signature.
3. Write the base case. (This is usually straightforward.)
4. Stop thinking.
5. Assume your function already works and write the recursive case.
6. Profit!

## Factorial, Fibonacci, and other Recursive Functions

- Some more discussion about [methods to find Fibonacci numbers](https://blog.paulhankin.net/fibonacci/)
- VIDEO: [The Ackermann Function](https://www.youtube.com/watch?v=i7sm9dzFtEI)

## Recursive Games

- [Towers of Hanoi](https://www.mathsisfun.com/games/towerofhanoi.html)

### Conway's Game of Life

- [Wikipedia article](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)
- [Play Online](https://bitstorm.org/gameoflife/)
- Or [play online here](https://playgameoflife.com/)
- A great [overview](http://pi.math.cornell.edu/~lipa/mec/lesson6.html)

## Applications of Recursion

- [Recursive drawing](http://recursivedrawing.com/) lets you make interesting recursive drawings
- This article about [recursive data structures](http://raganwald.com/2016/12/27/recursive-data-structures.html) starts with an interesting application of recursion to rotate images.

## Recursion Humor

To understand recursion, you must first understand recursion.

repository: j-dwo/codeexamples

repo_name: j-dwo/codeexamples


text:
Code Access Security Sample
====================================
---

##Introduction##
The sample demonstrates the use of CAPL to provide declarative code access security on a method.  The sample uses a declarative attribute, CaplCodeAccessAttribute, derived from the CodeAccessSecurityAttribute to perform access control, i.e., allowing or denying access to a method.

##Instructions##
Open the Sample.CodeAccess solution found in capl/samples/codeaccess folder.

- Compile the solution
-  Run the solution in debug mode
    -  A Web app and 2 console apps with open
- Select the Policy Manager console app and press enter
- Select the Code Access Policy console app and press enter
    - The app should continue to call the method showing that the method was executed.
- Select the Policy Manager console app and press "Y" to change the policy.
    - Enter "foo" at the prompt and press Enter
- The Code Access Policy app should show the method cannot be called due to not authorized.
- Select the Policy Manager console app and press "Y" to change the policy.
    - Enter "manager" at the prompt and press Enter
- The Code Access Policy app should the method can now be accessed again.

repository: skunklab/capl

repo_name: skunklab/capl


text:
# raspberryPiHotspot
Raspberry Pi 4 Install Raspbian and Launch Hotspot / 树莓派4设置以及创建热点

# Easier alternative way
> [https://github.com/billz/raspap-webgui]

## Useful commands:
```bash
# print architecture
uname -m
dpkg --print-architecture
sudo shutdown -h now
sudo reboot
exit
ping raspberrypi.local
# ping ipv4
ping raspberrypi.local -4
ssh<EMAIL_ADDRESS># ssh ipv4 [https://michele.blog/force-ssh-over-ipv4-or-ipv6/]
ssh -4<EMAIL_ADDRESS># ssh to ipv6
ssh pi@fe80::a957:4002:81fa:2c4c%18
# Switch to root privileges
sudo -i
# system log
tail -100f /var/log/syslog
sudo iptables -L
# check linux version
cat /etc/os-release
ping -S <IP_ADDRESS> google.com
# find out the default gateway
ip route show
ip route show | grep default
# find IP packet trace
Windows:
tracert -4
Linux:
traceroute -4
```

## set up hostname and connect to wifi(it takes long time for new hostname to work)
> instead, just ping raspberrypi/raspberrypi.local for a few times. It would sometimes let you ssh via a weird IP
sometimes the pi is assigned wrong ip address, cannot ssh with hostname, nmap, ping
```
ssh to pi, open the file(cannot edit sd card directly, permission denied)
/rootfs/etc/dhcpcd.conf
sudo nano /etc/dhcpcd.conf

Append eth0 for pi4, usb0 for pi zero
interface eth0
static ip_address=<IP_ADDRESS>/24
static routers=<IP_ADDRESS>
static domain_name_servers=<IP_ADDRESS>

If you have multiple pi, change hostname(doesn't work)
terminal:
hostname pi0a
hostname pi0b
hostname pi4a
hostname pi4b

change hostname with:
sudo raspi-config

sudo reboot

windows get ip from hostanme
nslookup pi0a
```

## install ssh
```
sudo apt-get install openssh-server
sudo service ssh status
hostname -I
ssh -p 2022<EMAIL_ADDRESS>```

## pi default username and password
```
pi
raspberry
```

## Remote control pi from windows [http://larsonm.com/index.php/2013/remotely-reboot-your-raspberry-pi-from-a-windows-desktop-shortcut-using-plink-putty/]
```
install putty on windows, then you would have plink
plink -ssh user@server -pw password reboot
plink -ssh<EMAIL_ADDRESS>-pw password reboot
plink -ssh<EMAIL_ADDRESS>-pw password "sudo shutdown -h now"
```

## vnc change resolution[https://shumeipai.nxez.com/2019/07/08/set-the-resolution-of-the-raspberry-pi-vnc.html]
sudo raspi-config -> advanced option -> resolution -> 1280 * 720

## print ip table
```
Windows:
route print -4
```

## interface vs. gateway
```
In this example, the address in the interface column is used to identify the particular interface (your computer may have more than one). Since naming conventions often depend on hardware, it is easier to identify them by IP address.

For example, your routing table shows the default gateway is <IP_ADDRESS>, and it can be reached by using the interface that has the IP address <IP_ADDRESS>.

IP routing tables assume the device has multiple network interfaces, although most PCs have only one. When there is more than one, the device needs to know which interface to use to reach the gateway. The interface column defines that. In the context of home networking, only your router has more than one interface.
```

## arp binding
Sometime your network may not be safe. Host and guest cannot arp bind at the same time.
```
Linux:
arp
sudo arp -s <IP_ADDRESS> b0:39:56:d3:08:2d
Windows CMD admin:
netsh interface ipv4 add neighbors "Wi-Fi 2" <IP_ADDRESS> b0-39-56-d3-08-2d
netsh interface ip delete neighbors "Network card name here" "Gateway.IP.goes.here"
```

## error “Internet Connection Sharing is currently enable for connection” when sharing my Wifi to ethernet
> https://www.thewindowsclub.com/an-error-occurred-while-internet-connection-sharing-was-being-enabled
```
windows open services
restart Internet Connection Sharing (ICS) service
```

## Notes:
* Pi 4 won't boot without HDMI plugged in
> Adding hdmi_force_hotplug=1 to /boot/config.txt seems to have solved the problem. [https://www.raspberrypi.org/forums/viewtopic.php?t=253312]

* nmap, raspberrypi.local tutorial[https://www.raspberrypi.org/documentation/remote-access/ip-address.md]
> windows[https://nmap.org/download.html]
> nmap cheatsheet[https://hackertarget.com/nmap-cheatsheet-a-quick-reference-guide/]
```
nmap -sn <IP_ADDRESS>/24
# find domain name server
cat /etc/resolv.conf
```

* Resolve "Host key verification failed"
> Delete raspberrypi.local column in known_hosts file if you are using windows
> For example, C:\Users\ybob\.ssh\known_hosts

* HDMI port
> Raspberry Pi 4 uses Micro HDMI
> Raspberry Pi Zero uses Mini HDMI

* X-forwarding(not working, use vnc instead)
> [https://www.raspberrypi.org/documentation/remote-access/ssh/unix.md]
> [http://raspberrypiprogramming.blogspot.com/2014/07/how-to-execute-x11-applications-from.html]
`ssh -Y<EMAIL_ADDRESS>
* When PC reboots, pi may lose network
> disable Wifi card, ethernet card, Wifi card sharing. Then reopen.

## Steps:
1. Download Raspbian[https://www.raspberrypi.org/downloads/raspbian/]
We choose "Raspbian Buster with desktop and recommended software"

2. Flash Raspbian system to SD card with balenaetcher[https://www.balena.io/etcher/]

3. Use ethernet cable to connect your PC ethernet port to Raspberry Pi ethernet port
  Looks like this:
    >PC - PC ethernet port - Raspberry Pi ethernet port - Raspberry Pi

    PC ethernet port configuration:
    >IP address: <IP_ADDRESS>
    >Subnet mask: <IP_ADDRESS>

    If your PC is using Wifi, right click -> properites -> sharing -> allow other users -> Home networking connection(Ethernet, the one connects with pi). Now, your pi would have the network.

4. Boot Raspberry Pi, enable SSH, VNC [https://www.raspberrypi.org/documentation/remote-access/ssh/]
Open terminal, type
```
  ifconfig
```

    or

```
  ip a
```

    From eth0 row, write down your pi IP address. My pi shows <IP_ADDRESS>

5. Switch back to your PC, ping pi_ip_address to verify if your connection works
```
  ping pi_ip_address
```

    or

```
  ping raspberrypi.local
```

6. From PC, SSH to your pi
```
  ssh pi@pi_ip_address
```

    or

```
  ssh<EMAIL_ADDRESS>```

7. Set up static IP[https://www.ionos.com/digitalguide/server/configuration/provide-raspberry-pi-with-a-static-ip-address/]
```
sudo nano /etc/dhcpcd.conf
```
append
```
interface eth0
static ip_address=<IP_ADDRESS>/24
static routers=<IP_ADDRESS>
static domain_name_servers=<IP_ADDRESS>
```
then
```
sudo reboot
```
verify by
```
ping raspberrypi.local -4
```

8. Install Chinese Input (optional)
```
// Install Google Pinyin input method
sudo apt-get install fcitx fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin
// Restart the Raspberry Pi
reboot
// Use shift to change input method
```

9. Launch Hotspot
[https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md]
[https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md]
[https://thepi.io/how-to-use-your-raspberry-pi-as-a-wireless-access-point/]
[https://elinux.org/RPI-Wireless-Hotspot]
[https://www.thegeekpub.com/240065/setup-a-raspberry-pi-wireless-access-point/]

```
# dnsmasq -> DHCP service, hostapd -> launch wifi
sudo apt install dnsmasq hostapd
# turn off first
sudo systemctl stop dnsmasq
sudo systemctl stop hostapd

# configure static IP
sudo nano /etc/dhcpcd.conf
# append at the end
interface wlan0
    static ip_address=<IP_ADDRESS>/24
    nohook wpa_supplicant
# restart dhcpcd
sudo service dhcpcd restart
# configure DHCP service
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf
# append
interface=wlan0      # Use the require wireless interface - usually wlan0
dhcp-range=<IP_ADDRESS>,<IP_ADDRESS>,<IP_ADDRESS>,24h
# start dnsmasq
sudo systemctl start dnsmasq

# configure hostapd
sudo nano /etc/hostapd/hostapd.conf
# copy & paste, fill in the password
# pi 4 uses the same driver number as pi 3. hw_mode=g is the best choice here
interface=wlan0
driver=nl80211
ssid=ChiTown2
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# open
sudo nano /etc/default/hostapd
# Find the line with #DAEMON_CONF, and replace it with this:
DAEMON_CONF="/etc/hostapd/hostapd.conf"

# start up
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
# check status
sudo systemctl status hostapd
sudo systemctl status dnsmasq

# Add routing and masquerade
# Edit /etc/sysctl.conf and uncomment this line:

net.ipv4.ip_forward=1
# Add a masquerade for outbound traffic on eth0:

sudo iptables -t nat -A  POSTROUTING -o eth0 -j MASQUERADE

or[https://learn.sparkfun.com/tutorials/setting-up-a-raspberry-pi-3-as-an-access-point/all]:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

# Save the iptables rule.

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Edit /etc/rc.local and add this just above "exit 0" to install these rules on boot.

iptables-restore < /etc/iptables.ipv4.nat

# Reboot and ensure it still functions.
```
[http://www.zsythink.net/archives/1199]
![](iptables.png)

To be continued...

## ssh into pi zero only with USB[https://desertbot.io/blog/ssh-into-pi-zero-over-usb]
```
1. enable ssh
touch /boot/ssh
2. open config.txt, Append this line to the bottom
dtoverlay=dwc2
3. Edit cmdline.txt, After rootwait, append this text leaving only one space between rootwait and the new text (otherwise it might not be parsed correctly):
modules-load=dwc2,g_ether
4. use data port to boot pi
5. ssh
ssh -4<EMAIL_ADDRESS>6. open ssh, vnc[https://www.raspberrypi.org/documentation/remote-access/vnc/]
sudo raspi-config
7. check memory, CPU usage
top
```

## Additonal Notes:
bridge etho and wifi0[https://www.pcgamer.com/how-to-build-a-raspberry-pi-wireless-access-point/]
```
First:

'auto br0'

To bring the interface up at boot time.

'iface br0 inet manual'

To tell the bridge that we want the router’s DHCP service to deal with assigning it an IP address. Finally:

'bridge_ports eth0 wlan0'

To tell the bridge precisely what you want it to do—that is, sit between the Ethernet and Wi-Fi devices, and bridge all network ports between them.
```
```
配置Pycharm环境变量：
假设你把pycharm安装到/home/pi/pycharm-community-2019.1.3
那么在~/.profile里加一句话
export PATH=$PATH:~/pycharm-community-2019.1.3/bin
保存，然后打开一个新命令行
输入：
pycharm.sh
程序就会启动啦。当命令行关闭时，pycharm会被强制关掉
注：~/.bash_rc似乎没法使用，不知道为啥
```
Adding A 2nd Fixed IP Address To The Ethernet Port
```
For example, say you want the RPi Ethernet port to use DHCP, but to also have a fixed IP address so you can connect to it using a direct cable connection from a laptop.

sudo nano /etc/network/interfaces
Use this for the eth0 adaptor:

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

auto eth0:1
iface eth0:1 inet static
       address <IP_ADDRESS>
       netmask <IP_ADDRESS>
```
route ip packet from wifi to ethernet [https://www.raspberrypi.org/forums/viewtopic.php?t=223295]
```
Install dnsmasq.
Code: Select all

sudo apt-get install dnsmasq
Assign eth0 an IP address. Open /etc/dhcpcd.conf with a text editor and add this at the bottom.
Code: Select all

interface eth0
static ip_address=<IP_ADDRESS>/24
Save original dnsmasq.conf
Code: Select all

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Open /etc/dnsmasq.conf with a text editor and add this
Code: Select all

interface=eth0
dhcp-range=<IP_ADDRESS>,<IP_ADDRESS>,<IP_ADDRESS>,12h
Edit /etc/sysctl.conf and uncomment
Code: Select all

net.ipv4.ip_forward=1
Open /etc/rc.local with a text editor and add this just above "exit 0"
Code: Select all

iptables -t nat -A  POSTROUTING -o wlan0 -j MASQUERADE
Reboot.

If you have problems with the dhcp service, you can check the status of dnsmasq.conf.
Code: Select all

sudo service dnsmasq status
It should show active (running), and a list of IP assignments to each mac address..
```
sh vc. bash
> [https://stackoverflow.com/questions/5725296/difference-between-sh-and-bash]
```
The complication is that /bin/sh could be a symbolic link or a hard link. If it's a symbolic link, a portable way to resolve it is:

% file -h /bin/sh
/bin/sh: symbolic link to bash
If it's a hard link, try

% find -L /bin -samefile /bin/sh
/bin/sh
/bin/bash
```

repository: minweny/raspberryPiHotspot

repo_name: minweny/raspberryPiHotspot


text:
# 💔 Darling: A Filtering RSS Aggregator

Darling is an RSS aggregator—it can combine multiple RSS or Atom feeds into a single feed—that provides simple filtering. It thus can serve as a feed muxer and demuxer.

## Aggregation

Darling will transform an unlimited number of feeds into a single feed. For instance, to produce a unified feed of posts from Lobste.rs and Tilde News: `darling https://tilde.news/rss https://lobste.rs/rss`. All items are interleaved into a single feed, sorted by creation time.

## Word Matching

Darling supports blacklisting (based on case-insensitive, whole-word matching) and whitelisting. Whitelisting takes priority over blacklisting. The asterisk is a wildcard matcher, and multiple tokens to match may be provided.

To produce a list of Julia Evans blog posts that _aren't_ about SQL or her zine: `darling -b sql -b zine -b zines https://jvns.ca/atom.xml`.

To demux her feed into one that's zine-specific: `darling -b "*" -w zine -w zines https://jvns.ca/atom.xml`.

Be aware that producing an empty feed is a valid result!

## Time Matching

Darling also supports time-based matching, returning all items _published_ (not _updated_) after a given time. This time can be relative to now or a specific date or datetime. For relative times, a subset of the standard Unix date format tokens are used: `YmdHMS`.

* Every NetNewsWire commit found from the last twelve hours: `darling  --since 12H https://github.com/brentsimmons/NetNewsWire/commits/master.atom`
* Every Dinosaur Comics entry found from the last week: `darling --since 7d https://qwantz.com/rssfeed.php`
* Every Lambda the Ultimate entry found since the beginning of 2019: `darling http://lambda-the-ultimate.org/rss.xml --since 2019-01-01`
* Every Hill Cantons entry found since Halloween, 2018: `darling https://hillcantons.blogspot.com/feeds/posts/default?alt=rss --since 2018-10-31T00:00:00-04:00`

Note that darling does not currently (and may never) handle paging through older issues on feeds which support offsets; adjust your expectations accordingly when trying to load older content.

## Limits

You can also restrict the number of items process per feed. If you wanted to get only the most recent item from film critic Nathan Rabin, perhaps to support a widget: `https://www.nathanrabin.com/happy-place/?format=rss -n 1`.

Word matching, time matching, and limits may all be applied within a single call: `darling -n 1 --since 3d --b cat --b dog --b ghost https://strangeco.blogspot.com/feeds/posts/default` would return a feed consisting of the last post from the Strange Company blog, but only if it was in the last three days and didn't mention a dog, a cat, or a ghost (and _especially_ not a ghost dog or cat).

repository: snark/darling

gha_language: Go

repo_name: snark/darling


text:
# Registered User Guide

[![Ubuntu Version](https://img.shields.io/badge/Ubuntu%20Server-18.04-yellowgreen.svg)](https://launchpad.net/ubuntu/+mirror/releases.ubuntu.csg.uzh.ch-releases)
[![Anaconda Version](https://img.shields.io/badge/Miniconda-4.8.2-orange.svg)](https://repo.anaconda.com/miniconda/)
[![CUDA Version](https://img.shields.io/badge/CUDA-10.2-blue.svg)](https://developer.nvidia.com/cuda-downloads)
[![cuDNN Version](https://img.shields.io/badge/cuDNN-7.6.5-blue.svg)](https://developer.nvidia.com/cuda-downloads)
[![TensorFlow Version](https://img.shields.io/badge/TensorFlow-2.2-yellow.svg)](https://www.tensorflow.org/)
[![PyTorch Version](https://img.shields.io/badge/PyTorch-1.5-yellow.svg)](http://pytorch.org/)
[![DMLC Version](https://img.shields.io/badge/xgboost-1.1.1-yellow.svg)](https://xgboost.readthedocs.io/en/latest/)
[![DMLC Version](https://img.shields.io/badge/mxnet-1.6-yellow.svg)](https://mxnet.incubator.apache.org/)

## General Message

__Please read this paragraph carefully before installation__

+ The machine is for everyone, so please do not dump big files on the machine.
If you need to connect an external hard disk on the machine, please talk to Yuhuang Hu.

+ It is intended to have separate workspace for everyone. So please setup your own Python
distribution (Anaconda is recommended) instead of messing with the system python.

+ No, you are not granted with `sudo` access.

+ If you are gonna install anything with `sudo`, or edit protected system folder (e.g. `/usr`, `/etc`, etc),
please tell Yuhuang before you do it.

+ If you want to access the machine outside of INI, then please connect INI's VPN.
Find the Wiki to setup.

+ It is intended that there is no GUI on these machines. And please don't install one as it would consume GPU power for rendering.

+ We have a calendar for managing usage of GPU machines, please send your Gmail (or similar) account to<EMAIL_ADDRESS>He will share the calendar to you.

+ You can only use the machine if you booked it. Otherwise, the current user has the
right of terminating your program without consulting with you.

+ Generally, you can still do some low-cost jobs when there is someone using the machine.
But please consult with the person.

+ Please do not `reboot` for no good reasons.

+ DO NOT UPDATE THE MACHINE VIA `sudo apt-get upgrade`

+ Please backup your data, experiment logs regularly.
Your data will only be there if:
    + You still need to run some more experiments
    + You will use your account in later projects (but still, please remove out-dated data)

+ Your account will be deleted if it's no longer active and the admin has connected you and failed to get response.

+ DO NOT SHARE THE ACCOUNT WITH SOMEONE ELSE, THERE ARE SECURITY LESSONS IF YOU DID SO.

## Access The Machine

Access the machine via ssh

```
$ ssh<EMAIL_ADDRESS>```

The username and password will be sent through email.

The available machine names are:

+ `zucca`
+ `zpaghetti`
+ `zabaglione`
+ `zampone`

For first time `*nix` user, checkout this useful [cheat sheet](https://www.cheatography.com/davechild/cheat-sheets/linux-command-line/) for commandline help.

## Setup Home

Run following scripts

```
$ mkdir $HOME/Downloads
$ mkdir $HOME/workspace
```

The above is preferred configuration so that all your downloaded files are
at `Downloads` and all your projects are at `workspace`

## Setup Deep Learning Environment

We have develop a working setup script for setting up your DL environment.
This script is a runnable script

1. Clone the repo

    ```
    $ git clone https://github.com/duguyue100/NSC-GPU-GUIDE
    $ cd NSC-GPU-GUIDE/setup
    $ cp user-conf-template.sh user-conf.sh
    ```
2. Configure the template. The default configuration is a GPU setup with Python 2. TensorFlow, PyTorch and Keras are installed. The configuration file is as follows:

    ```bash
    #!/usr/bin/env bash

    # True if NVIDIA CUDA is installed.
    ENABLE_GPU=true

    # True if you need Python, support from Miniconda
    ENABLE_PYTHON=true

    # True if you want to install all libraries locally
    ENABLE_DL_ALL=false

    # true to install TensorFlow
    ENABLE_TENSORFLOW=true
    # true to install PyTorch
    ENABLE_PYTORCH=true
    # true to install DMLC packages (xgboost, mxnet)
    ENABLE_DMLC=false
    ```

    You can customize this file that fits you needs. _For example, if you want to install all the libraries, just change `ENABLE_DL_ALL` to `true`._

3. Run the installation script!

    ```
    $ ./user-setup.sh
    ```

4. The installation will take about 10min, grab a coffee and wait!

5. Source the new bash profile

    ```
    $ source $HOME/.bashrc
    ```

    And you are all set!

### Reset the environment

By running `user-setup-clean.sh`, you can hit the reset button of your environment.
This is for easy re-setup and a life-saver option if you messed up the environment somehow.

```
$ ./user-setup-clean.sh
```

## Contacts

Yuhuang Hu
Email<EMAIL_ADDRESS>

gha_language: Python


text:
Responsive-Lightbox
===================
by [Duncan McDougall](http://www.duncanmcdougall.co.uk) | [@duncanmcdougall](http://www.twitter.com/duncanmcdougall)

jQuery responsive lightbox plugin.

Shrinks the image to the width & height of the browser. Only handles images so it's nice and lightweight.

Demonstration
-------------
[Responsive Lightbox Demo](http://www.duncanmcdougall.co.uk/projects/responsive-lightbox.html)

Dependencies
-------------
jQuery >= 1.4

Browser Support
-------------
IE7+

Usage
------

```html
<html>
<head>
<link rel="stylesheet" href="lightbox.css" />
</head>
<body>
<!-- Link to the image -->
<div class="gallery">
<a href="photo1.jpg">Image 1</a>
<a href="photo2.jpg">Image 2</a>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="lightbox.min.js"></script>

<script>
 $(function()
 {
    $('.gallery a').lightbox();

	// If you want seperate galleries on the same page
	// just specify different class names.
	$('.gallery-2 a').lightbox();
 });
</script>
</body>

```

Options
------

```bash
    $('.gallery').lightbox({ margin: 20, nav: false, blur: true, minSize: 480 });
```

* margin - int - default 50. Minimum margin around the image
* nav - bool - default true. enable navigation
* blur - bool - default true. Blur other content when open using css filter
* minSize - int - default 0. Min window width or height to open lightbox. Below threshold will open image in a new tab.

Captions
------

Add your captions as a data attribute to the anchor. e.g.

```html
    <a href="myimage.jpg" data-caption="This is a picture of a cat" >
```

Installing with Bower
------

If bower is your thing you can install using the following command

```bash
bower install responsive-lightbox
```

Contributing
------

First, clone a copy of using the GUI or the main git repo by running:

```bash
git clone git://github.com/duncanmcdougall/Responsive-Lightbox.git
```

I'm using GruntJS to do all the minification and linting as build tasks.

Install the grunt-cli package so that you will have the correct version of grunt available from any project that needs it. This should be done as a global install:

```bash
npm install -g grunt-cli
```

Enter the jquery directory and install the Node dependencies, this time *without* specifying a global install:

```bash
cd Responsive-Lightbox && npm install
```

Make sure you have `grunt` installed by testing:

```bash
grunt -version
```

Then, to get a complete, minified (w/ Uglify.js), linted (w/ JSHint) version of the plugin, type the following:

```bash
grunt
```

The built version of the plugin will be saved to .min versions.

Next Steps
------
* Options: { loop }
* Faster image switching
* Light and dark simple themes

Thanks To
--------
I'd like to thank [Matthew Hartman](http://www.matthewhartman.com.au/), [imiric](https://github.com/imiric) et all for contributing a number of improvements to the lightbox.

MIT License
--------
This plugin is released under the [MIT License](http://duncanmcdougall.mit-license.org/). Enjoy.

repository: angelikatyborska/fitness-class-schedule

extension: markdown

gha_language: Ruby

repo_name: angelikatyborska/fitness-class-schedule


text:
# mysql-search.php
PHP script that implements a search algorithm using MySQL Full Text Search feature.

**The algorithm:**
1. Take the search text string and split it into a list of words.
2. Remove all "stopwords" (See: https://en.wikipedia.org/wiki/Stop_words) from the previous list. The remaining words will be called "keywords".
3. Apply a stemming algorithm over the list of keywords (See: https://en.wikipedia.org/wiki/Stemming).
4. Construct and execute an SQL query (SELECT) over an arbitrary list of "Full Text Search" indexed fields (MATCH) and using the previous list of words stems (AGAINST).
5. Fetch the obtained search results.

There is an example of use in "example" folder. The frontend part of the example is implemented using VueJS framework.

**How to deploy example:**
1. Clone (or download and unzip) this repository.
2. Install Composer, if you don't have it installed (See: https://getcomposer.org/).
3. Open the repository folder in a terminal console and run the following command: "composer install"
4. Create a MySQL database called "test" and import the "test.sql" file (found in "example" folder).
5. See "config.php" (found in "example" folder) file comments and choose between PDO handler and MySQLi handler.
6. Open a web browser and navigate to "example" folder.

repository: PedroUrday/mysql-search-php

repo_name: PedroUrday/mysql-search-php


text:
shrunk
======
A URL shortener for Rutgers University.

Uses MongoDB. Python code targets _Python 3.3_.

Virtual Environment
-------------------
Python dependencies are enumerated in `pip.req`. You can set up an appropriate
virtual environment with the following:

    $ virtualenv --no-site-packages --python="python3" virtualenv
    $ source virtualenv/bin/activate
    $ pip install -r pip.req

Features
--------
### Web Application
- Log in with a Rutgers NetID
- Create a short URL from a long URL
- Given a NetID, what URLs have they created?
- Analytics on visits

### URL Shortening Service
- Given a short URL, redirect to the long URL
- Track visits to the short URL
- Track popularity and number of clicks

repository: Andrea-Wu/shrunk

repo_name: Andrea-Wu/shrunk


text:
heroku-buildpack-sass
=====================

heroku-buildpack-sass is a [custom buildpack][1] for [Heroku][2] that compiles
[Sass][3]/SCSS files to CSS.

Unless you're deploying a static site, using no other languages, and serving
with magic(!), you'll probably want to combine this with other buildpacks using
[heroku-buildpack-compose][4] or [heroku-buildpack-multi][5].

This buildpack finds all .scss and .sass files, and compiles them to files
with the extension changed to .css and any parent directories named scss or
sass changed to css. So `./scss/style.scss` becomes `./css/style.css`.

If you think of a better way, [sethwklein][6] tries to keep up with pull
requests and issues!

[1]: https://devcenter.heroku.com/articles/buildpacks#using-a-custom-buildpack
[2]: https://www.heroku.com/
[3]: http://sass-lang.com/
[4]: https://github.com/bwhmather/heroku-buildpack-compose
[5]: https://github.com/ddollar/heroku-buildpack-multi
[6]: https://github.com/sethwklein

repository: sethwklein/heroku-buildpack-sass

repo_name: sethwklein/heroku-buildpack-sass


text:
#summary explanation how you have to compile c-generic-library

# How to Compile

Like the most linux tools you can compile the library by using following shell commands;

```
./configure
make
```

The compiled libraries should be found in the directory ./lib. By default there should be a static and a dynamic library.

# Optionals builds

The units and test files are optionally. This means that the command above won't compile them! If you wish to compile the test and unit cases you have to call configure with the enabling flag.

```
./configure --enable-tests=yes --enable-units=yes
make
```

The units are based on the library http://check.sourceforge.net/. If you want to build the unit tests then you have to install the *check* library.

#Trouble?

Make sure that 2.67 version of autotools or later is installed. They can be downloaded from this source http://lists.gnu.org/archive/html/autoconf/2010-08/msg00010.html.
Make sure that you run make clean.
Make sure that your system is using libtool 2.2.6b from http://www.gnu.org/software/libtool/.
If you have problem by using the commands above you can recreate the configure script. You must install the version 2.68 from http://en.wikipedia.org/wiki/GNU_build_system autotools. To create the configuration script run the commands:

```
autoreconf -i --force
automake --add-missing
```

# Mac OS X

On Mac OS X you have to install the autotools by hand! If you have already installed Xcode the existing autotools does not match the needed version and will fail. There are two ways to upgrade the building system.

1. Download and install the applications *autoconf*, *automake*, *m4* and *libtool*. If you do this version of "upgrading", please mind that Xcode may fails by trying to build stuff and you can only restore Xcode by downloading the whole package (something around 3GB) - don't choose this way!

2. Use [http://www.macports.org/ MacPort] to install the application above.

```
sudo port install autoconf automake m4 libtool
```

Create a copy of the existing build system

```
sudo cp /usr/bin/autoconf /usr/bin/autoconf-old
...
```

Create a symlink to the new building system

```
sudo ln -s /opt/local/bin/autoconf /usr/bin/autoconf
...
```

If Xcode fails you still have your old building system. Just rename it and you're fine.


text:
# InArray Validator

`Zend\Validator\InArray` allows you to validate if a given value is contained
within an array. It is also able to validate multidimensional arrays.

## Supported options

The following options are supported for `Zend\Validator\InArray`:

- `haystack`: Sets the haystack for the validation.
- `recursive`: Defines if the validation should be done recursively. This option
  defaults to `false`.
- `strict`: Three modes of comparison are offered owing to an often overlooked,
  and potentially dangerous security issue when validating string input from
  user input.
    - `InArray::COMPARE_STRICT`: This is a normal `in_array()` strict comparison
      that checks value and type.
    - `InArray::COMPARE_NOT_STRICT`: This is a normal `in_array()` non-strict
      comparison that checks value only, but not type.
    - `InArray::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILTY`: This
      operates in essentially the same way as `InArray::COMPARE_NOT_STRICT`,
      but ensures that strings are not cast to integer during comparison,
      preventing `0 == 'foo43'` types of false positives.

> ### Use non-strict carefully
>
> Non-strict mode (`InArray::COMPARE_NOT_STRICT`) may give false positives when
> strings are compared against ints or floats owing to `in_array()`'s behaviour
> of converting strings to int in such cases. Therefore, `'foo'` would become
> `0`, `'43foo'` would become `43`, while `foo43'` would also become `0`.

## Array validation

Basic usage is to provide an array during instantiation:

```php
$validator = new Zend\Validator\InArray([
    'haystack' => ['value1', 'value2',...'valueN'],
]);

if ($validator->isValid('value')) {
    // value found
} else {
    // no value found
}
```

This will behave exactly like PHP's `in_array()` method when passed only a
needle and haystack.

> ### Non-strict by default
>
> By default, this validation is not strict, nor can it validate
> multidimensional arrays.

Alternately, you can define the array to validate against after object
construction by using the `setHaystack()` method. `getHaystack()` returns the
actual set haystack array.

```php
$validator = new Zend\Validator\InArray();
$validator->setHaystack(['value1', 'value2',...'valueN']);

if ($validator->isValid('value')) {
    // value found
} else {
    // no value found
}
```

## Array validation modes

As previously mentioned, there are possible security issues when using the
default non-strict comparison mode, so rather than restricting the developer,
we've chosen to offer both strict and non-strict comparisons, and add a safer
middle-ground.

It's possible to set the strict mode at initialisation and afterwards with the
`setStrict` method. `InArray::COMPARE_STRICT` equates to `true` and
`InArray::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY` equates to
`false`.

```php
// defaults to InArray::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY
$validator = new Zend\Validator\InArray([
    'haystack' => ['value1', 'value2', /* ... */ 'valueN'],
]);

// set strict mode
$validator = new Zend\Validator\InArray([
    'haystack' => ['value1', 'value2', /* ... */ 'valueN'],
    'strict'   => InArray::COMPARE_STRICT,  // equates to ``true``
]);

// set non-strict mode
$validator = new Zend\Validator\InArray([
    'haystack' => ['value1', 'value2', /* ... */ 'valueN'],
    'strict'   => InArray:COMPARE_NOT_STRICT,  // equates to ``false``
]);

// or

$validator->setStrict(InArray::COMPARE_STRICT);
$validator->setStrict(InArray::COMPARE_NOT_STRICT);
$validator->setStrict(InArray::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY);
```

> ### Non-strict safe-mode by default
>
> Note that the `strict` setting is per default `false`.

## Recursive array validation

In addition to PHP's `in_array()` method, this validator can also be used to
validate multidimensional arrays.

To validate multidimensional arrays you have to set the `recursive` option.

```php
$validator = new Zend\Validator\InArray([
    'haystack' => [
        'firstDimension' => ['value1', 'value2', / ... */ 'valueN'],
        'secondDimension' => ['foo1', 'foo2', /* ... */ 'fooN'],
    ],
    'recursive' => true,
]);

if ($validator->isValid('value')) {
    // value found
} else {
    // no value found
}
```

Your array will then be validated recursively to see if the given value is
contained. Additionally you could use `setRecursive()` to set this option
afterwards and `getRecursive()` to retrieve it.

```php
$validator = new Zend\Validator\InArray([
    'firstDimension' => ['value1', 'value2', /* ... */ 'valueN'],
    'secondDimension' => ['foo1', 'foo2', /* ... */ 'fooN'],
]);

$validator->setRecursive(true);

if ($validator->isValid('value')) {
    // value found
} else {
    // no value found
}
```

> ### Default setting for recursion
>
> By default, the recursive validation is turned off.

> ### Option keys within the haystack
>
> When you are using the keys `haystack`, `strict`, or `recursive` within
> your haystack, then you must wrap the `haystack` key.

gha_language: PHP


text:
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/dotnet/sqlclient/master/LICENSE)
[![Nuget](https://img.shields.io/nuget/dt/Microsoft.Data.Encryption.Cryptography?label=Microsoft.Data.Encryption.Cryptography&style=flat-square&color=green)](https://www.nuget.org/packages/Microsoft.Data.Encryption.Cryptography)
[![Nuget](https://img.shields.io/nuget/dt/Microsoft.Data.Encryption.FileEncryption?label=Microsoft.Data.Encryption.FileEncryption&style=flat-square&color=green)](https://www.nuget.org/packages/Microsoft.Data.Encryption.FileEncryption)
[![Nuget](https://img.shields.io/nuget/dt/Microsoft.Data.Encryption.AzureKeyVaultProvider?label=Microsoft.Data.Encryption.AzureKeyVaultProvider&style=flat-square&color=green)](https://www.nuget.org/packages/Microsoft.Data.Encryption.AzureKeyVaultProvider)

# Microsoft Data Encryption SDK (Preview)

The Microsoft Data Encryption SDK provides encryption support to applications. It allows developers to implement column- or field-level encryption for data stored in various data stores, including Azure data services.

## The modules of the SDK

The SDK consists of the following modules:

* Cryptography
* File Encryption
* Azure Key Vault Provider

### Cryptography

The Cryptography module provides APIs for objects like encryption keys, serializers, key store provider interfaces, and associated caches.

The module implements cryptographic operations using a two-level key hierarchy composed of:

* Data Encryption Keys (DEKs) - symmetric keys that encrypt data.
* Key Encryption Keys (KEKs) - asymmetric keys that encrypt DEKs.

The Cryptography module uses cryptographic algorithms that are fully compatible with [Always Encrypted](https://docs.microsoft.com/sql/relational-databases/security/encryption/always-encrypted-database-engine) in Azure SQL. The data encryption algorithm is AEAD_AES_256_CBC_HMAC_SHA_256 that is derived from the IETF specification draft at [https://tools.ietf.org/html/draft-mcgrew-aead-aes-cbc-hmac-sha2-05](https://tools.ietf.org/html/draft-mcgrew-aead-aes-cbc-hmac-sha2-05). The key encryption algorithm is RSA with OEAP padding. For more information, see [Always Encrypted cryptography](https://docs.microsoft.com/sql/relational-databases/security/encryption/always-encrypted-cryptography?view=sql-server-ver15).

### File Encryption

This module supports encrypting and decrypting columns in parquet files. It implements storing encryption metadata in the JSON format within the parquet file metadata footer.

### Azure Key Vault Provider

This module implements the key store provider interface using Azure Key Vault. It allows you to use KEKs stored in Azure Key Vault.

## Using the SDK for data protection in Azure

The below diagram shows an example of an Azure application and illustrates the benefits of the Microsoft Data Encryption SDK.

The sample application is a data analytics pipeline that loads data stored in parquet files on premises to Azure Data Lake. Subsequently, Azure Data Factory jobs transform and transport the data to other Azure data services, including Synapse SQL, CosmosDB and Azure SQL. Then, custom applications hosted in Azure VMs or Azure App Services, and Spark jobs in Synapse Analytics access and process the data.

![Microsoft Encryption SDK Overview Diagram](/media/SdkDiagram.jpg)

In such applications, the SDK helps ensure:

* Sensitive data gets encrypted at ingestion to Azure.
  * For example, you can achieve that by building an on-premises application that that encrypts sensitive data columns in Parquet files using the File Encryption module of the SDK, before uploading the files to Azure Data Lake.

* Sensitive data stays encrypted when it flows to other Azure data services.
  * Administrators in your organization as well Microsoft operators of the data services you are using, will not be able to access the data in plaintext, assuming your safeguard the KEKs and DEKs, your are using.
  * You can use Azure Data Factory jobs to move encrypted data to other Azure data services, while keeping the data encrypted all the time.
* Control over which Azure compute services and which users can decrypt and access the data in plaintext.
  * A service or an application, using the SDK, can access and perform computations on plaintext data only if you explicitly grant service’s/application’s identity in Azure Active Directly access to the key encryption keys in Azure Key Vault.
  * For example, if you want an Azure Data Factory job to perform transformations of encrypted sensitive data stored in Azure Data Lake, or if you want a Spark job or an application in an Azure VM or Azure App Services to compute encrypted data stored in Synapse SQL, you need to integrate the SDK into the job and grant it access to the key encryption keys in Azure Key Vault.
* Interoperability with Always Encrypted in Azure SQL
  * You can load the data, encrypted using the SDK, to databases columns configured with Always Encrypted in Azure SQL.
  * If you ensure the database columns are encrypted in the same way as the data you are inserting, your Azure Data Factory and Spark jobs as well as your applications can transparently decrypt the data stored in the database and run confidential queries using Azure SQL client drivers. This is because the SDK is compatible with Always Encrypted.
  * Similarly, you can move the data from a database in Azure SQL to another service or application without decrypting it. Then, you can use the SDK to decrypt the data where it needs to be decrypted, rather than in an application that directly talks to the database.

## Supported Platforms

The SDK currently supports the following platforms:

* .NET – for more information, see [Microsoft Data Encryption SDK for .NET](./net/)

## Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode<EMAIL_ADDRESS>with any additional questions or comments.

## License

These samples and templates are all licensed under the MIT license. See the LICENSE.txt file in the root.

repository: Xtrimmer/microsoft-data-encryption-sdk

repo_name: Xtrimmer/microsoft-data-encryption-sdk