text:
# netcdf

**This library currently only supports netcdf v4**

Crystal bindings to libnetcdf v4.

Based on [swillner's NodeJS](https://github.com/swillner/netcdf4-js) bindings

## Installation

NetCDF must be [installed](https://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html): `brew install hdf5 netcdf`

Add this to your application's `shard.yml`:

```yaml
dependencies:
  netcdf:
    github: fridgerator/netcdfcr
```

## Usage

```crystal
require "netcdf"

file = NetCDF::File.open("path/to/file.nc")
group = file.groups.first
attr = group.attributes.first
puts attr.name
puts attr.value

variable = group.variables.first
puts variable.name
puts variable.read(0) # one dimension
puts variable.read(0, 0, 0) # 3 dimensions
puts variable.read_slice(0, 10, 0, 1, 0, 1) # read slice of 10 for 3 dimensions

attr = variable.attributes.first
puts attr.value

file.close
```

### Classes

#### File

Properties:

* `id`: NetCDF file id

Methods:

* `close` : Close file
* `sync` : Sync file to disk
* `add_group` : Adds a group to a file
* `add_dimension` : Adds a dimension to a file
* `add_variable` : Adds a variable to a file
* `attributes` : Returns an array of global attributes
* `add_attribute` : Creates a global attribute

#### Group

Properties:

* `parent_id` : NetCDF id of parent
* `id` : NetCDF id
* `name` : Group name

Methods:

* `full_name` : Full name
* `unlimited` : Returns array of unlimited Dimensions in group
* `attributes` : Returns an array of attributes
* `dimensions` : Returns an array of dimensions
* `variables` : Returns an array of variables
* `groups` : Returns an array of groups
* `add_group` : Adds a group within a group
* `add_dimension` : Adds a dimension to a group
* `add_variable` : Adds a variable to a Group

#### Dimension

Properties:

* `parent_id` : NetCDF id of parent
* `id` : NetCDF id
* `name` : Dimension name
* `length` : Dimension length

#### Attribute

Properties:

* `parent_id` : NetCDF id of parent
* `id` : NetCDF id
* `name` : Attribute name
* `attribute_type` : Attribute type `Int32`

Methods:

* `value` : Attribute value

#### Variable

Properties:

* `parent_id` : NetCDF id of parent
* `id` : NetCDF id
* `name` : Variable name
* `var_type` : Variable type `Int32`
* `ndims` : Number of dimensions

Methods:

* `attributes` : Returns an array of variable attributes
* `endianness` : Endianness: "little", "big", or "native"
* `checksum_mode` : Checksum mode: "none" or "fletcher32"
* `chunk_mode` : Chunk mode: "contiguous", or "chunked"
* `chunk_sizes` : Array of chunk sizes, one size per dimension
* `fill_mode` : Boolean switch for fill mode
* `fill_value` : Fill value
* `compression_shuffle` : Boolean switch for shuffle
* `compression_deflate` : Boolean switch for compression
* `compression_level` : Compression level (1-9)
* `read_slice` : Reads and returns an array of values (cf. "[Specify a Hyperslab](https://www.unidata.ucar.edu/software/netcdf/docs/programming_notes.html#specify_hyperslab)") at positions and sizes given for each dimension, `readSlice(pos1, size1, pos2, size2, ...)` e.g. `readSlice(2, 3, 4, 2)` gives an array of the values at position 2 for 3 steps along the first dimension and position 4 for 2 steps along the second one.
* `read` : Reads and returns a single value at positions, one argument per dimension
* `add_attribute` : Creates an attribute for a variable
* `write` : Write a value at positions given, `write(2, 3, "a")` writes "a" at position 2 along the first dimension and position 3 along the second one
* `write_slice` : Write values from an array (array must be of same type) at positions and sizes given for each dimension. `writeSlice(2, 3, 4, 2, [0, 1, 2, 3, 4, 5])` writes the array at position 2 for 3 steps along the first dimension and position 4 for 2 step along the second one

## Contributing

1. Fork it ( https://github.com/fridgerator/netcdfcr/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request

## Contributors

- [fridgerator](https://github.com/fridgerator) Nick Franken - creator, maintainer

repository: fridgerator/netcdfcr

gha_language: Crystal

repo_name: fridgerator/netcdfcr


text:
# Alternative display and output formats

In the documentation, we have presented the output from MixedModels.jl in the same format you will see when working in the REPL.
You may have noticed, however, that output from other packages received pretty printing.
For example, DataFrames are converted into nice HTML tables.
In MixedModels, we recently (v3.2.0) introduced limited support for such pretty printing.
(For more details on how the print and display system in Julia works, check out [this NextJournal post](https://nextjournal.com/sdanisch/julias-display-system).)

In particular, we have defined Markdown, HTML and LaTeX output, i.e. `show` methods, for our types.
Note that the Markdown output can also be easily and more flexibly translated into HTML, LaTeX (e.g. with `booktabs`) or even a MS Word Document using tools such as [pandoc](https://pandoc.org/).
Packages like `IJulia` and `Documenter` can often detect the presence of these display options and use them automatically.

```@example Main
using MixedModels
form = @formula(rt_trunc ~ 1 + spkr * prec * load +
                          (1 + load | item) +
                          (1 + spkr + prec + load | subj))
contr = Dict(:spkr => EffectsCoding(),
             :prec => EffectsCoding(),
             :load => EffectsCoding(),
             :item => Grouping(),
             :subj => Grouping())
kbm = fit(MixedModel, form, MixedModels.dataset(:kb07); contrasts=contr)
```

Note that the display here is more succinct than the standard REPL display:

```@example Main
using DisplayAs
kbm |> DisplayAs.Text
```

This brevity is intentional: we wanted these types to work well with traditional academic publishing constraints on tables.
The summary for a model fit presented in the REPL does not mesh well with being treated as a single table (with columns shared between the random and fixed effects).
In our experience, this leads to difficulties in typesetting the resulting tables.
We nonetheless encourage users to report fit statistics such as the log likelihood or AIC as part of the caption of their table.
If the correlation parameters in the random effects are of interest, then [`VarCorr`](@ref) can also be pretty printed:

```@example Main
VarCorr(kbm)
```

Similarly for [`BlockDescription`](@ref), `OptSummary` and `MixedModels.likelihoodratiotest`:

```@example Main
BlockDescription(kbm)
```

```@example Main
kbm.optsum
```

```@example Main
m0 = fit(MixedModel, @formula(reaction ~ 1 + (1|subj)), MixedModels.dataset(:sleepstudy))
m1 = fit(MixedModel, @formula(reaction ~ 1 + days + (1+days|subj)), MixedModels.dataset(:sleepstudy))
MixedModels.likelihoodratiotest(m0,m1)
```

To explicitly invoke this behavior, we must specify the right `show` method.
(The raw and not rendered output is intentionally shown here.)
```julia
show(MIME("text/markdown"), m1)
```
```@example Main
println(sprint(show, MIME("text/markdown"), kbm)) # hide
```
```julia
show(MIME("text/html"), m1)
```
```@example Main
println(sprint(show, MIME("text/html"), kbm)) # hide
```
Note for that LaTeX, the column labels for the random effects are slightly changed: σ is placed into math mode and escaped and the grouping variable is turned into a subscript.
Similarly for the likelihood ratio test, the χ² is escaped into math mode.
This transformation improves pdfLaTeX and journal compatibility, but also means that XeLaTeX and LuaTeX may use a different font at this point.
```julia
show(MIME("text/latex"), m1)
```
```@example Main
println(sprint(show, MIME("text/latex"), kbm)) # hide
```
This escaping behavior can be disabled by specifying `"text/xelatex"` as the MIME type.
(Note that other symbols may still be escaped, as the internal conversion uses the `Markdown` module from the standard library, which performs some escaping on its own.)
```julia
show(MIME("text/xelatex"), m1)
```
```@example Main
println(sprint(show, MIME("text/xelatex"), kbm)) # hide
```

This output can also be written directly to file:

```julia
open("model.md", "w") do io
    show(io, MIME("text/markdown"), kbm)
end
```

license: MIT

branch_name: refs/heads/main

extension: md

gha_language: Julia

gha_license_id: MIT

license_type: permissive


text:
# Team Profile Generator
![badge](https://img.shields.io/badge/license-MIT-green)

## Description
This is a team profile generator. When you're on a team (especially if it's a large group), it's important to know what roles everyone has, so that the manager doesn't give out tasks to the wrong people. Plus, if there's a problem, employees know who to talk to. Keeping this important info all in one, concise place keeps employees from getting confused.

I learned how to use fs.appendFile and how important "return" is.

## Video Walkthrough

## Link
Github Link

## License
License

repository: aurorabrynn/team-profile-generator

repo_name: aurorabrynn/team-profile-generator


text:
---
layout: "podcast-or-interview"

mp3_bytes: "56964096"
mp3_duration: "59:20"

guest: "Kshitij Sinha"
guest_avatar: "kshitij-sinha"
guest_website: "https://creativehire.co/"

category: "podcast"
tags:
  - "django"
  - "python"
  - "react"
  - "aws"
  - "circle-ci"
  - "firebase"
  - "lets-encrypt"
  - "mailgun"
  - "netlify"
  - "nginx"
  - "postgres"
  - "redis"
  - "s3"
  - "sentry"
  - "ubuntu"
  - "webpack"

title: "Creative Hire Helps Match Designers and Companies to Various Jobs"
description:
  Kshitij Sinha goes over building his job finding platform with Django.
  It's hosted on a single t2 micro AWS instance using the free tier.
---

In this episode of Running in Production, {{ page.guest }} walks us through his
job finding platform called Creative Hire. It was written in Python and Django
and is hosted on AWS' free tier. It's been up and running since early 2020
after the MVP was built in about 6 weeks.

Kshitij is the solo developer on the project. It's a monolith split across a
few Django apps with 2 git repos (one for the back-end and one for the
front-end). It does a quite a bit of NLP to help categorize submissions and
more.

## Topics Include

- 3:58 -- Motivation to rewrite the app in Django and Python
- 6:29 -- It's 1 monolithic Django app that's split up with Django apps
- 11:12 -- Django REST Framework is used as an API back-end with React on the front-end
- 15:48 -- It's about 200k lines of Python and 78k lines of JS split across 2 git repos
- 18:13 -- Picking the right NLP Python library (he went with spaCy in the end)
- 23:44 -- Redis is the back-end for Celery and it's used for caching too
- 27:41 -- Using Ant Design Pro to help manage front-end assets (which uses Webpack)
- 30:36 -- Docker is being used for everything except nginx runs directly on the host
- 33:47 -- It's hosted on a single EC2 instance (free tier) on AWS running Ubuntu 18.04 LTS
- 41:34 -- The server was set up manually by mostly following tutorials
- 42:40 -- Using Mailgun and Sentry, also right now Creative Hire is free during early access
- 45:58 -- The process to develop and deploy code to production
- 53:13 -- Database backups happen about once a week and how alerts happen
- 56:12 -- Best tips? Have a test environment and make small changes when pushing new code
- 58:28 -- Besides [their site]({{ page.guest_website }}), Creative Hire also has a [Facebook page](https://www.facebook.com/crreativehire)

## Links

###### 📄 References

- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html>

###### ⚙ Tech Stack

{% include services-used.html %}

###### 🛠 Libraries Used
- <https://github.com/boto/boto3>
- <https://github.com/celery/celery>
- <https://github.com/encode/django-rest-framework>
- <https://spacy.io/>
- <https://github.com/alexfernandez/loadtest>
- <https://pro.ant.design/>
- <https://gunicorn.org/>
- <https://github.com/KristianOellegaard/django-health-check>

branch_name: refs/heads/master

gha_language: HTML


text:
## Exercise 1: Basic Syntax
In this exercise, you'll practice selecting HTML elements, and assigning basic styles to the elements. To do this, you'll make a nametag that looks like this:

![complete](imgs/complete.png)

As described in [module-4](https://github.com/info343c-a16/m4-git-intro), start by forking and cloning this repository. If you're feeling ambitious, I suggest you try to mimic the rendering _without_ the following instructions. The HTML elements are already in place, so you'll apply the following styles in your `css/main.css` file:

Apply the following styles to the container element of your name tag:
- Assign a `width` of `400px`
- Assign a `height` of `200px`
- Make the text centered by assigning the appropriate value to the `text-align` property
- Give it a border that is 1px solid red
- Make a thick red bottom border of 20px
- Give the container rounded edges by setting the `border-radius` property to 10px

Give the top section of your name tag the following styles:
- The font-family should be sans-serif
- The bottom borer should be 1px solid black
- To set the text color, assign the `color` property a value of `white`
- Round the top-left and top-right borders to match the container styles

Select all top-level headers and assign the following styles:
- Set the top and bottom margins to 0px
- Set a font-size 3 times the root element's font-size
- To achieve the font appearance, you'll need to set a font-weight of 100, and a font-variant of small-caps

Assign the following styles to second-level headers:
- Set a margin-top of 1px, and a margin-bottom of 3px
- Achieve the font look by setting the font-style to `italic` and the font-size to .8rem

Assign a color of `red` to all elements with class `red`.

Manipulate the _name_ area by assigning these styles:
- Set the font-size to `3rem`
- Set the font-family to `fantasy`
- Assign a margin of 25px

See the `complete` branch for answers.


text:
# BeMyHand

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

A web application that provides the four voice and eye-gaze controllable tools for our users who can not use their hands and provide them a complete toolkit to build a professional stance.
The tools are:

- Portfolio Web Page
- CV Builder
- Text Editor
- Article Directory

### Description of the main product element

### `Text Editor`
This is a core module of our application that provides facility to write documents using voice and dictation. At the end the document can be saved as draft, converted and downloaded to PDF or Docx. It includes all the necessary components which a text editor should have to write professional documents i.e. headings, paragraphs, bullet points, inserting images, and applying decoration to the text like bold and italics.

### `Articles Directory`
This module makes our users able to manage their articles directory by creating new articles, saving those as drafts, making articles private or public, maintaining version history and publishing them and this all by using their voice and eye-gaze.
This is the module where our target users can showcase their writing skills to the world. The recruiters/employers can visit and see their published work and contact them using their details available in their profile.

### `CV Builder`
This module builds a professional CV by providing our users three professional templates at the very beginning. By selecting one out of the given 3 templates, all the fields can be filled by our user using their voice and all in a smooth and user-oriented way. The CV can be saved, added to the Portfolio Web Page (next module) or downloaded as a PDF.

### `Portfolio Builder`
This module makes a complete online presence of our users by providing them a webpage where they can add their top-quality work as well as their documents like CV, their details and this all using their voice and eye-gaze. Like CV Builder, it also provides 3 basic templates where a user can select one can build and style it by dragging and dropping complete sections, elements or styles. We provide a unique link to every user which they can share to the world and using that link they can visit their portfolio web page and see their work.

## Project Status

BeMyHand is currently in development. Users can use text editor to write the articles with their voice and can also store them in articles directory.

## Project Screenshots

### Home page Screen

### Articles Directory

### Text Editor

## Installation and Setup Instructions

1. Download Nodejs Installer from the the link https://nodejs.org/en/download/
2. After downloading is finished, run the downloaded software
3. Setup wizard will open, click next
4. License agreements will be shown, if you agree the agreements, click next
5. Select installation location and click next
6. Installation undergoing
7. Click finish
8. Open windows cmd
9. To verify installation, open command prompt
10. write "node -v" and see if as a result version of the installed node appears
11. Download/Clone Client and Server Code from Github

    - FrontEnd https://github.com/BeMyHand/BeMyHand.git

    - BackEnd https://github.com/BeMyHand/BeMyHandBackend.git

12 Finally, In the project directory, you can run:

### `npm start`

Runs the app in the development mode.

Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.

You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.

See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.

It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

 The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `npm run build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

repository: BeMyHand/BeMyHand

gha_language: JavaScript

repo_name: BeMyHand/BeMyHand


text:
Two scripts in this directory: scraper.py and pgn_generator.py

The first one hits Lichess's search endpoint with our filters (Stockfish Level
5, etc) and populates game_ids.pkl.

The second one takes game_ids.pkl and hits Lichess's export endpoint and
generates a games.pgn file, containing the pgn for each game_id in
game_ids.pkl.

Plan:

`example_requests` give a few examples of the GET requests sent when scrolling
down the search result page. We can get expected responses without providing
any headers, it seems (not even cookies).

An example response is in `example_page`

The response gives a full web page. This web page has `div`s of class "game_row
paginated_element", each of which has, as a top level internal element, an
anchor tag with href=[GAME CODE].

Example [GAME CODE]s: /KeaUF5g0, /FTPmiuah, /Ma74vB2j, etc.
Note that, sometimes, a `/black` might follow the [GAME CODE] (eg
/KeaUF5g0/black). You probably want to strip that. This happens when black won
the game, I think.

Sending a GET request to https://lichess.org/game/export[GAME
CODE]?evals=0&clocks=0 initiates the download of a png file with the game's
info.

This png file is all we want. An example file is in this directory as
`example_game.pgn`. There are 15 rows containing a piece of information within
square brackets, where each piece of information follows the format [KEY]
[WHITESPACE] "[VALUE]" (eg: [Date "2018.11.02"] is a row), followed by a blank
line, followed by a line containing the algebraic notation of the game (this is
the 18th line in the example file), followed by two blank lines.

repository: satojk/fishnet

gha_language: Python

repo_name: satojk/fishnet


text:
+++
# About/Biography widget.
date = "2020-09-11T00:00:00"
draft = false

widget = "about"

# Order that this section will appear in.
weight = 1

# List your academic interests.
[interests]
  interests = [
    "Magmatism and volcanism",
    "Fault mechanics and geodynamics",
    "Reservoir geomechanics (aquifers)",
    "Space Geodesy and Geophysics"
  ]

# List your qualifications (such as academic degrees).
[[education.courses]]
  course = "PhD in Geodesy"
  institution = "Universidad Complutense de Madrid, Spain"
  year = 2010

[[education.courses]]
  course = "MSc in Geodetic Engineering"
  institution = "Universidad Complutense de Madrid, Spain"
  year = 2006

[[education.courses]]
  course = "BSc in Geological Sciences"
  institution = "Universidad de Granada, Spain"
  year = 2003

+++

# Biography
Pablo J. González is a Senior Researcher in Geodynamics and Structure of the Lithosphere, at the [Estación Volcanológica de Canarias](https://www.ipna.csic.es/en/research-lines/volcanology) (IPNA-CSIC) located in La Laguna, Tenerife, Canary Islands.

We study volcano and fault mechanics, or in simple terms, how and why volcanoes and faults deform. A knowledge with practical application for geological hazard assessment, and risk reduction. To learn more about magmatic sytems and fault zone processes we use constrains from geophysical and geodetic observations, mainly Earth Observation data. Our ultimate goal is to gain insights into the physical behaviour of volcanoes and fault systems to incorporate into models with ever increasing predictive power.

# Research interests
* Magma storage and migration at volcanoes
* Fault dynamics and kinematics, including volcano-tectonics
* Fluid-rock mechanical interactions (Induced seismicity, groundwater changes)
* Geodetic and geophysical techniques: data processing and analysis
* Geophysical inverse problems (Bayesian inference)
* Machine Learning (Reduce Order Models and Deep Learning)


text:
> [Go to French version](/fr/Règlements/Décrets,%20ordonnances%20et%20règlements%20statutaires/91/33.md)

# Regulations Prescribing Purposes for Which New Successor Corporations Shall Be Deemed to Be the Same Corporations as and Continuations of Predecessor Amalgamated or Wound-Up Corporations

**SOR/91-33**

Enabling authorities:
- [EXCISE TAX ACT](/en/Acts/Revised%20Statutes%20of%20Canada/E/E-15.md)

Date registered: 18 December 1990

----------

His Excellency the Governor General in Council, on the recommendation of the Minister of Finance, pursuant to subsection 277(1)[*] of the [Excise Tax Act](/en/Acts/Revised%20Statutes%20of%20Canada/E/E-15.md), is pleased hereby to make the annexed Regulations prescribing purposes for which new successor corporations shall be deemed to be the same corporations as and continuations of predecessor amalgamated or wound-up corporations.

*: S.C. 1990, c. 45, s. 12

## Short Title

**1** These Regulations may be cited as the Amalgamations and Windings-Up Continuation (GST/HST) Regulations.
> SOR/99-173, s. 1.

## Prescribed Purpose

**2** For the purposes of sections 271 and 272 of the [Excise Tax Act](/en/Acts/Revised%20Statutes%20of%20Canada/E/E-15.md), “prescribed purpose” means for the purpose of applying any provision of that Act set out in the schedule.

### **SCHEDULE**
**(Section 2)**
- Section 120
- Definition ***builder*** in subsection 123(1)
- Section 134
- Section 148
- Section 148.1
- Subsection 149(1)
- Section 150
- Section 156
- Section 160
- Section 166
- Section 181.1
- Section 182
- Subsections 183(2) and (4) to (8)
- Subsections 184(2) to (7)
- Subsection 186(1)
- Section 194
- Section 219
- Section 222
- Subsection 223(2)
- Section 224
- Section 225
- Section 225.2
- Section 227
- Section 228
- Section 229
- Section 230
- Section 230.1
- Section 232
- Section 233
- Section 237
- Section 238
- Section 261
- Section 263
- Section 263.1
- Section 264
- Section 265
- Section 266
- Section 273
- Section 273.2
- Section 274
- Divisions VIII and IX of PART IX
> SOR/2013-71, s. 19; SOR/2019-59, s. 8.

repository: TravisMadill/CanadianLaws

path: /en/Regulations/Statutory Orders and Regulations/91/33.md

repo_name: TravisMadill/CanadianLaws


text:
Ideas

Original idea was to list items in your fridge and have the program find recipes for you to try.
Current Idea is have a user list up to 5 ingrediants and the computer will list the first 3(maybe 5) recipes
on the site. For now 1 site, maybe two.
Features in the far future will be have the program create a food schedule for you depending on eating
5 times a day or 3 big meals. Can be schedule for the day or for the week but that's a bit more complicated.
I want my CLI to show 3 or 5 recipe ideas listed form 1-5 and if none are good, press option 5 or 6
to show what's next on the list. Another 5. Currently food network give's 10 recipes on their search results.

Name
Cooking time
Description if available
Serving Size

CLI INTERFACE
Hello, welcome to this gem
Can you please list up to 5 ingrediants?
Shows 5 numbered recipe names - Serving size - Cooking time
Enter the number for the recipe you would like for a description and recipe
Type list for the original list of 5 or Enter to re enter a new list of up to 5 ingrediants
Goodbye, thank you for using this gem

http://www.foodnetwork.com/search/search-results.recipes.html?searchTerm=garlic+cilantro+ground+eggs&form=global&_charset_=UTF-8
When adding items into the search bar in foodnetwork.com it goes in between the searchTerm= and &form=
So for every item the user inputs, we can enter a plus inbetween each item

http://allrecipes.com/search/results/?ingincl=chicken,mango,cilantro&sort=re
each item downcased in between ingincl= and &sort=re

PROBLEMS
Have to find solution for when the website returns no results. When no results, it
only shows one recipe with different/similar ingredients.
http://www.foodnetwork.com/search/search-results.recipes.html?searchTerm=egg+cheeeeee&form=global&_charset_=UTF-8
Can use the "showing 1 recipe result for" number inside to determine when to say "Sorry, no results for this. Can you enter another set of ingredients"

Can impliment in the code when no results are found and it reroutes to another search.

repository: WilliamMena/food-idea

repo_name: WilliamMena/food-idea


text:
---
title: R/Pharma 2022
date: 2022-02-27
summary: First announcement of R/Pharma 2022.
featured: false
---

We are pleased to announce R/Pharma 2022!!

R/Pharma 2022 will be held as a free virtual conference from November 8-10, 2022 with workshops running the week before.

More details on keynote speakers and call-for-talks will follow shortly.

R/Pharma 2020 and 2021 were huge successes as virtual events with over 2000 registrations for the 2021 event.  We decided to keep the 2022 conference virtual in order to include as many participants as possible.  For 2023 we are considering a hybrid event.

repository: rpodcast/r-pharma

repo_name: rpodcast/r-pharma


text:
# Cerbos PHP SDK

[![Latest Stable Version](http://poser.pugx.org/cerbos/cerbos-sdk-php/v)](https://packagist.org/packages/cerbos/cerbos-sdk-php)
[![Total Downloads](http://poser.pugx.org/cerbos/cerbos-sdk-php/downloads)](https://packagist.org/packages/cerbos/cerbos-sdk-php)
[![License](http://poser.pugx.org/cerbos/cerbos-sdk-php/license)](https://packagist.org/packages/cerbos/cerbos-sdk-php)

PHP client library for the [Cerbos](https://github.com/cerbos/cerbos) open source access control solution. This library
includes gRPC client for accessing the Cerbos PDP.

Find out more about Cerbos at https://cerbos.dev and read the documentation at https://docs.cerbos.dev.

# Installation

You can install the SDK via [Composer](https://getcomposer.org/). Run the following command:
```bash
composer require cerbos/cerbos-sdk-php
```

# Examples

## Creating a gRPC client

```php
$client = CerbosClientBuilder::newInstance($this->host)
    ->withPlaintext(true)
    ->build();
```

## Check a single principal and resource

```php
$request = CheckResourcesRequest::newInstance()
    ->withRequestId(RequestId::generate())
    ->withPrincipal(
        Principal::newInstance("john")
            ->withRole("employee")
            ->withPolicyVersion("20210210")
            ->withAttribute("department", AttributeValue::stringValue("marketing"))
            ->withAttribute("geography", AttributeValue::stringValue("GB"))
    )
    ->withResourceEntry(
        ResourceEntry::newInstance("leave_request", "xx125")
            ->withActions(["view:public", "approve"])
            ->withPolicyVersion("20210210")
            ->withAttribute("department", AttributeValue::stringValue("marketing"))
            ->withAttribute("geography", AttributeValue::stringValue("GB"))
            ->withAttribute("owner", AttributeValue::stringValue("john"))
    )

$checkResourcesResponse = $client->checkResources($request);
$resultEntry = $checkResourcesResponse->find("xx125");

if ($resultEntry->isAllowed("view:public")) { // returns true if `view:public` action is allowed
    // ...
}

if ($resultEntry->isAllowed("approve")) { // returns true if `approve` action is allowed
    // ...
}
```

## Check a single principal and multiple resource & action pairs

```php
$request = CheckResourcesRequest::newInstance()
    ->withRequestId(RequestId::generate())
    ->withPrincipal(
        Principal::newInstance("john")
            ->withRole("employee")
            ->withPolicyVersion("20210210")
            ->withAttribute("department", "marketing")
            ->withAttribute("geography", "GB")
    )
    ->withResourceEntries(
        array(
            ResourceEntry::newInstance("leave_request", "xx125")
                ->withAction("approve")
                ->withPolicyVersion("20210210")
                ->withAttribute("department", AttributeValue::stringValue("marketing"))
                ->withAttribute("geography", AttributeValue::stringValue("GB"))
                ->withAttribute("owner", AttributeValue::stringValue("john")),

            ResourceEntry::newInstance("leave_request", "xx225")
                ->withAction("defer")
                ->withPolicyVersion("20210210")
                ->withAttribute("department", AttributeValue::stringValue("marketing"))
                ->withAttribute("owner", AttributeValue::stringValue("john"))
        )
    )

$checkResourcesResponse = $client->checkResources($request);

$resultEntry = $checkResourcesResponse->find("xx125");
if ($resultEntry->isAllowed("approve")) { // returns true if `approve` action is allowed
    // ...
}

$resultEntry = $checkResourcesResponse->find("xx225");
if ($resultEntry->isAllowed("defer")) { // returns true if `defer` action is allowed
    // ...
}
```

## Plan Resources API

```php
$request = PlanResourcesRequest::newInstance()
    ->withRequestId(RequestId::generate())
    ->withAction("approve")
    ->withPrincipal(
        Principal::newInstance("maggie")
            ->withRole("manager")
            ->withAttribute("department", AttributeValue::stringValue("marketing"))
            ->withAttribute("geography", AttributeValue::stringValue("GB"))
            ->withAttribute("team", AttributeValue::stringValue("design"))
    )
    ->withResource(
        Resource::newInstance("leave_request", "xx125")
            ->withPolicyVersion("20210210")
    );

$planResourcesResponse = $this->client->planResources($request);
if ($planResourcesResponse->isAlwaysAllowed()) {
    // ...
}
else if ($planResourcesResponse->isAlwaysDenied()) {
    // ...
}
else {
    // ...
}
```

# Upgrading from `v0.1.x`

Newer versions of the library make use of gRPC libraries. This is in order to make the integration with Cerbos easier to manage. This change requires existing users of 0.1.x versions to perform some migration steps.

## gRPC

This library requires the `gRPC` extension to be installed. Follow the [instructions for your environment](https://cloud.google.com/php/grpc#installing_the_grpc_extension) to install the extension.

## Differences between SDK API v0.1.x

### PHP version requirements

The minimum supported version of PHP is `8.1`.

### Simpler `CerbosClientBuilder`

`CerbosClientBuilder` is simpler and only expects `hostname` as a parameter.
```php
$client = CerbosClientBuilder::newInstance("localhost:3593")
    ->withPlaintext(true)
    ->build();
```

### Renamed `ResourceAction` to `ResourceEntry`

The `ResourceAction` class has been renamed to `ResourceEntry`.

### New `AttributeValue` builder class

Principal and resource attributes must be created using the `AttributeValue` builder class.

Creating a bool value;
```php
$val = AttributeValue::boolValue(true);
```

Creating a string value;
```php
$val = AttributeValue::stringValue("marketing");
```

### New `CheckResourcesRequest` and `PlanResourcesRequest` builder classes

Use the new builder classes to construct `CheckResources` and `PlanResources` requests.
```php
$request = CheckResourcesRequest::newInstance()
    ->withRequestId(RequestId::generate())
    ->withPrincipal(
        Principal::newInstance("john")
            ->withRole("employee")
            ->withPolicyVersion("20210210")
            ->withAttribute("department", "marketing")
    )
    ->withResourceEntries(
        array(
            ResourceEntry::newInstance("leave_request", "xx125")
                ->withAction("approve")
                ->withAttribute("department", AttributeValue::stringValue("marketing")),

            ResourceEntry::newInstance("leave_request", "xx225")
                ->withAction("defer")
                ->withAttribute("department", AttributeValue::stringValue("marketing"))
        )
    );
```

```php
$request = PlanResourcesRequest::newInstance()
    ->withRequestId(RequestId::generate())
    ->withAction("approve")
    ->withPrincipal(
        Principal::newInstance("maggie")
            ->withRole("manager")
            ->withAttribute("department", AttributeValue::stringValue("marketing"))
    )
    ->withResource(
        Resource::newInstance("leave_request", "xx125")
            ->withAttribute("department", AttributeValue::stringValue("marketing"))
    );
```

### Simpler `CerbosClient`

The `checkResources` and `planResources` methods on the `CerbosClient` now accepts only a `CheckResourcesRequest` or
`PlanResourcesRequest` object respectively.

repository: cerbos/cerbos-sdk-php

gha_language: PHP

repo_name: cerbos/cerbos-sdk-php


text:
# 😺 [Kitten Scraper](https://github.com/skylarstein/kitten-scraper) Change Log

## [2.5.1](https://github.com/skylarstein/kitten-scraper/compare/v2.5.0...v2.5.1) (2022-03-21)

* Fixed a bug that prevented auto-complete of mentees without animals
* Forgot to include "rabbit" as supported critter type

## [2.5.0](https://github.com/skylarstein/kitten-scraper/compare/v2.4.0...v2.5.0) (2022-02-11)

* Improved support for mentee status and animal status in "dog mode"
* Includes critter support in feline reports (guinea pig, hamster, rat)

## [2.4.0](https://github.com/skylarstein/kitten-scraper/compare/v2.3.0...v2.4.0) (2021-10-15)

* Been a while. How's things?
* Mentee and animal status: handle server-side changes that broke web scraping. Pull animal bio status, photo status, age (credit to Carla for this great idea). Pull surgery appointment from mentor spreadsheet. Optimizations.
* Fix auto-complete of mentee status (mentees with multiple pages of "Responsible For" animals were not handled previously)
* Fix "currently in foster" edge cases when operating in "dog mode"
* Improved validation/identification of mentor sheets
* Update to chromedriver 94.0.4606.61
* Update Python package dependencies (requirements.txt)
* Removing most mentions of the Box spreadsheet reader. This code will need some updates if we ever want to support Box again.
* General cleanup

## [2.3.0](https://github.com/skylarstein/kitten-scraper/compare/v2.2.0...v2.3.0) (2020-09-12)

* General cleanup

## [2.2.0](https://github.com/skylarstein/kitten-scraper/compare/v2.1.0...v2.2.0) (2020-07-07)

* Auto-update completed mentees in the mentor spreadsheet
* Consider only name/email/id columns when searching for a matching mentor
* Mentee/Mentor status refactoring: '--mentee_status [verbose,autoupdate,export]'
* Include mentor/mentee status in CSV report (active mentee count, days since last mentee assignment)
* -c/--config no longer optional
* Removed -o/--output to keep things simple, output to ~/Desktop, will resurrect later if necessary
* Update dependencies

## [2.1.0](https://github.com/skylarstein/kitten-scraper/compare/v2.0.8...v2.1.0) (2020-03-20)

* Adds Box support for mentors spreadsheet
* Renames "canine mode" to "dog mode" since I like the sound of that better
* Adds "dog mode" support for Mentee Status Report
* Adds animal name to animal status strings
* Adds optional -c/--config command line arg to specify a config file (defaults to 'config.yaml')
* Updates dependencies
* Various small details and improvements

## [2.0.8](https://github.com/skylarstein/kitten-scraper/compare/v2.0.7...v2.0.8) (2019-10-08)

* Adds Windows support

## [2.0.7](https://github.com/skylarstein/kitten-scraper/compare/v2.0.6...v2.0.7) (2019-09-19)

* Default canine_mode = False if not found in config.yaml, allow enable from command line
* Updated chromedriver

## [2.0.6](https://github.com/skylarstein/kitten-scraper/compare/v2.0.5...v2.0.6) (2019-09-09)

* Kitten Scraper now supports canine mode, how about that?

## [2.0.5](https://github.com/skylarstein/kitten-scraper/compare/v2.0.4...v2.0.5) (2019-09-02)

* Mentee status report improvements (remove duplicates, include S/N status)

## [2.0.4](https://github.com/skylarstein/kitten-scraper/compare/v2.0.3...v2.0.4) (2019-08-04)

* Fix under-reported "previous animals fostered" counts
* Add "Current mentee status" function
* It's been fun Python 2, but Python 3 is now required

## [2.0.3](https://github.com/skylarstein/kitten-scraper/compare/v2.0.2...v2.0.3) (2019-07-07)

* Calculate loss rate
* Update to chromedriver 75.0.3770.90, maybe we'll have some luck with the lost-login-cookie issue when running headless

## [2.0.2](https://github.com/skylarstein/kitten-scraper/compare/v2.0.1...v2.0.2) (2019-05-08)

* Cache Google Sheets data on load (performance optimization)

## [2.0.1](https://github.com/skylarstein/kitten-scraper/compare/v2.0.0...v2.0.1) (2019-05-06)

* Wait for lazy-loaded content, update chromedriver to 74.0.3729.6

## [2.0.0](https://github.com/skylarstein/kitten-scraper/compare/v1.8.0...v2.0.0) (2019-03-14)

* Move most configuration to the online mentor spreadsheet. Makes it easier to update the config without new deployment
* General cleanup and improvements
* Update dependencies

## [1.8.0](https://github.com/skylarstein/kitten-scraper/compare/v1.7.0...v1.8.0) (2018-12-13)

* Retrieve current animal status, filter out animals not currently in foster
* Cleanup output CSV, add current animal status, remove unnecessary data, sort
* Improved debug output and error handling
* Fixes Python3 support
* Adds missing dependency

## [1.7.0](https://github.com/skylarstein/kitten-scraper/compare/v1.6.0...v1.7.0) (2018-08-05)

* Support up to 4 emails per foster parent (not covering N emails complexity for now)
* Better handling of empty animal age string
* User friendly error if no VPN connection at login

## [1.6.0](https://github.com/skylarstein/kitten-scraper/compare/v1.5.0...v1.6.0) (2018-07-16)

* Include spay/neuter status with each animal number

## [1.5.0](https://github.com/skylarstein/kitten-scraper/compare/v1.4.0...v1.5.0) (2018-07-13)

* Include 'Special Animal Message'

## [1.4.0](https://github.com/skylarstein/kitten-scraper/compare/v1.3.0...v1.4.0) (2018-07-11)

* Dismiss alert dialog on Animal Details page if it exists

## [1.3.0](https://github.com/skylarstein/kitten-scraper/compare/v1.2.0...v1.3.0) (2018-06-13)

* Add a note if foster parent is a mentor
* Handle issues with daily reports which occasionally omit data (missing animal type, other corner cases)
* Improved user-friendly error handling (empty daily reports, etc)
* Assure output path exists
* Chromedriver 2.40.565386, Linux support
* General cleanup, organization

## [1.2.0](https://github.com/skylarstein/kitten-scraper/compare/v1.1.0...v1.2.0) (2018-06-03)

* Validate current foster parent ID for each animal ID (daily report is inconsistent)

## [1.1.0](https://github.com/skylarstein/kitten-scraper/compare/v1.0.0...v1.1.0) (2018-05-28)

* Google Sheets integration to associate foster parents with existing mentors
* Add animal numbers to the animal quantity string

## 1.0.0 (2018-05-26)

* Finally got around to tagging a release, yay!
* Handle unknown animal age (sometimes missing from daily reports)
* Add support for do_not_assign_mentor config

repository: skylarstein/kitten-scraper

repo_name: skylarstein/kitten-scraper


text:
## Project: Search and Sample Return
### Writeup

---

**The goals / steps of this project are the following:**

**Training / Calibration**

* Download the simulator and take data in "Training Mode"
* Test out the functions in the Jupyter Notebook provided
* Add functions to detect obstacles and samples of interest (golden rocks)
* Fill in the `process_image()` function with the appropriate image processing steps (perspective transform, color threshold etc.) to get from raw images to a map.  The `output_image` you create in this step should demonstrate that your mapping pipeline works.
* Use `moviepy` to process the images in your saved dataset with the `process_image()` function.  Include the video you produce as part of your submission.

**Autonomous Navigation / Mapping**

* Fill in the `perception_step()` function within the `perception.py` script with the appropriate image processing functions to create a map and update `Rover()` data (similar to what you did with `process_image()` in the notebook).
* Fill in the `decision_step()` function within the `decision.py` script with conditional statements that take into consideration the outputs of the `perception_step()` in deciding how to issue throttle, brake and steering commands.
* Iterate on your perception and decision function until your rover does a reasonable (need to define metric) job of navigating and mapping.

[//]: # (Image References)

[image1]: ./misc/rover_image.jpg
[image2]: ./calibration_images/example_grid1.jpg
[image3]: ./calibration_images/example_rock1.jpg
[image4]: ./misc/vlcsnap-2017-12-18-19h40m47s828.png
[image5]: ./misc/vlcsnap-2017-12-18-19h46m52s664.png

## [Rubric](https://review.udacity.com/#!/rubrics/916/view) Points
### Here I will consider the rubric points individually and describe how I addressed each point in my implementation.

---
### Writeup / README

### Notebook Analysis
#### 1. Run the functions provided in the notebook on test images (first with the test data provided, next on data you have recorded). Add/modify functions to allow for color selection of obstacles and rock samples.

In the notebook I modified the `color_thresh()` function, in the `perception.py` I used three functions.
The test_mapping.mp4 is in the current folder.

```
def color_thresh(img, rgb_thresh=(160, 160, 160)):
    # Create an array of zeros same xy size as img, but single channel
    color_select = np.zeros_like(img[:, :, 0])
    # Require that each pixel be above all three threshold values in RGB
    # above_thresh will now contain a boolean array with "True"
    # where threshold was met
    above_thresh = (img[:, :, 0] > rgb_thresh[0]) \
                   & (img[:, :, 1] > rgb_thresh[1]) \
                   & (img[:, :, 2] > rgb_thresh[2])
    # Index the array of zeros with the boolean array and set to 1
    color_select[above_thresh] = 1

    # below_thresh = (img[:, :, 0] <= rgb_thresh[0]) \
    #                & (img[:, :, 1] <= rgb_thresh[1]) \
    #                & (img[:, :, 2] <= rgb_thresh[2])
    below_thresh = np.invert(above_thresh)
    color_select[below_thresh] = 0

    rock_thresh = (img[:, :, 0] < 220) \
                   & (img[:, :, 0] > 130) \
                   & (img[:, :, 1] < 180) \
                   & (img[:, :, 1] > 100) \
                   & (img[:, :, 2] < 25)

    color_select[rock_thresh] = 3

    # Return the binary image
    return color_select

threshed = color_thresh(warped)
plt.imshow(threshed, cmap='gray')
```
For path trace the threshold above 160 in all the RGB channel pixels is adequate for finding the travershable path.
```
above_thresh = (img[:, :, 0] > rgb_thresh[0]) \
                   & (img[:, :, 1] > rgb_thresh[1]) \
                   & (img[:, :, 2] > rgb_thresh[2])
```
All the others are considered as obstacles with the inversion of `below_thresh = np.invert(above_thresh)`.
For rocks, after an image analysis of the calibration images I ended up to the following thresholds
```
   rock_thresh = (img[:, :, 0] < 220) \
                   & (img[:, :, 0] > 130) \
                   & (img[:, :, 1] < 180) \
                   & (img[:, :, 1] > 100) \
                   & (img[:, :, 2] < 25)
```

#### 2. Populate the `process_image()` function with the appropriate analysis steps to map pixels identifying navigable terrain, obstacles and rock samples into a worldmap.  Run `process_image()` on your test data using the `moviepy` functions provided to create video output of your result.
````
def perception_step(Rover):
    # Perform perception steps to update Rover()
    # TODO:
    # NOTE: camera image is coming to you in Rover.img
    # 1) Define source and destination points for perspective transform
    dst_size = 5
    bottom_offset = 6
    source = np.float32([[14, 140], [301, 140], [200, 96], [118, 96]])
    destination = np.float32([[Rover.img.shape[1] / 2 - dst_size, Rover.img.shape[0] - bottom_offset],
                              [Rover.img.shape[1] / 2 + dst_size, Rover.img.shape[0] - bottom_offset],
                              [Rover.img.shape[1] / 2 + dst_size, Rover.img.shape[0] - 2 * dst_size - bottom_offset],
                              [Rover.img.shape[1] / 2 - dst_size, Rover.img.shape[0] - 2 * dst_size - bottom_offset],
                              ])
    # 2) Apply perspective transform
    warped = perspect_transform(Rover.img, source, destination)
    # 3) Apply color threshold to identify navigable terrain/obstacles/rock samples
    threshed = color_thresh(warped)
    rock_threshed = rock_thresh(warped)
    obstacle_threshed=obstacle_thresh(warped)
    # 4) Update Rover.vision_image (this will be displayed on left side of screen)
    Rover.vision_image[:,:,0] = obstacle_threshed*255
    Rover.vision_image[:,:,1] = rock_threshed*255
    Rover.vision_image[:,:,2] = threshed*255

    # 5) Convert map image pixel values to rover-centric coords
    xpix, ypix = rover_coords(threshed)
    obxpix, obypix = rover_coords(obstacle_threshed)
    rockxpix, rockypix = rover_coords(rock_threshed)
    # 6) Convert rover-centric pixel values to world coordinates
    rover_xpos = Rover.pos[0]
    rover_ypos = Rover.pos[1]
    rover_yaw = Rover.yaw
    worldmap = Rover.worldmap
    scale = 10
    x_world, y_world = pix_to_world(xpix, ypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)

    obstacle_x_world, obstacle_y_world = pix_to_world(obxpix, obypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)
    rock_x_world, rock_y_world = pix_to_world(rockxpix, rockypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)
    # 7) Update Rover worldmap (to be displayed on right side of screen)
    Rover.worldmap[obstacle_y_world, obstacle_x_world, 0] += 1
    Rover.worldmap[rock_y_world, rock_x_world, 1] += 1
    Rover.worldmap[y_world, x_world, 2] += 1

    # 8) Convert rover-centric pixel positions to polar coordinates
    rover_centric_pixel_distances, rover_centric_angles = to_polar_coords(xpix, ypix)
    # Update Rover pixel distances and angles
    Rover.nav_dists = rover_centric_pixel_distances
    Rover.nav_angles = rover_centric_angles

    return Rover
````
Firstly, a perpective trasnform is applied in each new Rover.img. Then for each terrain/obstacles/rock the functions `color_thresh(), rock_thresh(),obstacle_thresh()` are performed, respectively to identify terrain/obstacles/rocks.
Each color channel shows the terrain/obstacles/rocks
````
   Rover.vision_image[:,:,0] = obstacle_threshed*255
    Rover.vision_image[:,:,1] = rock_threshed*255
    Rover.vision_image[:,:,2] = threshed*255
````
Then, for all the  terrain/obstacles/rocks, we perform rover centric trasmformation and then world-centric trasnsormation by
````
  xpix, ypix = rover_coords(threshed)
    obxpix, obypix = rover_coords(obstacle_threshed)
    rockxpix, rockypix = rover_coords(rock_threshed)
````
and
````
x_world, y_world = pix_to_world(xpix, ypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)

    obstacle_x_world, obstacle_y_world = pix_to_world(obxpix, obypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)
    rock_x_world, rock_y_world = pix_to_world(rockxpix, rockypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)
````
with the necessary scale for upadating the worldmap.
````
 Rover.worldmap[obstacle_y_world, obstacle_x_world, 0] += 1
    Rover.worldmap[rock_y_world, rock_x_world, 1] += 1
    Rover.worldmap[y_world, x_world, 2] += 1
````
Finally, the Rover pixel distances and angles are updated, for use in the upcoming image.
A snapshot of the notebook output after `moviepy` is shown below:

![alt text][image4]

### Autonomous Navigation and Mapping

#### 1. Fill in the `perception_step()` (at the bottom of the `perception.py` script) and `decision_step()` (in `decision.py`) functions in the autonomous mapping scripts and an explanation is provided in the writeup of how and why these functions were modified as they were.

````
def perception_step(Rover):
    # Perform perception steps to update Rover()
    # TODO:
    # NOTE: camera image is coming to you in Rover.img
    # 1) Define source and destination points for perspective transform
    dst_size = 5
    bottom_offset = 6
    source = np.float32([[14, 140], [301, 140], [200, 96], [118, 96]])
    destination = np.float32([[Rover.img.shape[1] / 2 - dst_size, Rover.img.shape[0] - bottom_offset],
                              [Rover.img.shape[1] / 2 + dst_size, Rover.img.shape[0] - bottom_offset],
                              [Rover.img.shape[1] / 2 + dst_size, Rover.img.shape[0] - 2 * dst_size - bottom_offset],
                              [Rover.img.shape[1] / 2 - dst_size, Rover.img.shape[0] - 2 * dst_size - bottom_offset],
                              ])
    # 2) Apply perspective transform
    warped = perspect_transform(Rover.img, source, destination)
    # 3) Apply color threshold to identify navigable terrain/obstacles/rock samples
    threshed = color_thresh(warped)
    rock_threshed = rock_thresh(warped)
    obstacle_threshed=obstacle_thresh(warped)
    # 4) Update Rover.vision_image (this will be displayed on left side of screen)
    Rover.vision_image[:,:,0] = obstacle_threshed*255
    Rover.vision_image[:,:,1] = rock_threshed*255
    Rover.vision_image[:,:,2] = threshed*255

    # 5) Convert map image pixel values to rover-centric coords
    xpix, ypix = rover_coords(threshed)
    obxpix, obypix = rover_coords(obstacle_threshed)
    rockxpix, rockypix = rover_coords(rock_threshed)
    # 6) Convert rover-centric pixel values to world coordinates
    rover_xpos = Rover.pos[0]
    rover_ypos = Rover.pos[1]
    rover_yaw = Rover.yaw
    worldmap = Rover.worldmap
    scale = 10
    x_world, y_world = pix_to_world(xpix, ypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)

    obstacle_x_world, obstacle_y_world = pix_to_world(obxpix, obypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)
    rock_x_world, rock_y_world = pix_to_world(rockxpix, rockypix, rover_xpos,
                                rover_ypos, rover_yaw,
                                worldmap.shape[0], scale)
    # 7) Update Rover worldmap (to be displayed on right side of screen)
    Rover.worldmap[obstacle_y_world, obstacle_x_world, 0] += 1
    Rover.worldmap[rock_y_world, rock_x_world, 1] += 1
    Rover.worldmap[y_world, x_world, 2] += 1

    # 8) Convert rover-centric pixel positions to polar coordinates
    rover_centric_pixel_distances, rover_centric_angles = to_polar_coords(xpix, ypix)
    # Update Rover pixel distances and angles
    Rover.nav_dists = rover_centric_pixel_distances
    Rover.nav_angles = rover_centric_angles

    return Rover
````

Here I used three functions `color_thresh`, `obstacle_thresh` and `rock_thresh` for identifying navigable terrain/obstacles/rock samples, respectively. Their warped output was used to update the `Rover.vision_image` in the three different color channels. All terrain/obstacles/rock pixels were converted to rover centric and then to world centric coordinates for updating the worldmap.
Finally the `Rover.nav_dists` and `Rover.nav_angles` were updated for use in the new upcoming Rover image.

````
def decision_step(Rover):

    # Implement conditionals to decide what to do given perception data
    # Here you're all set up with some basic functionality but you'll need to
    # improve on this decision tree to do a good job of navigating autonomously!
    # Check if we have been stuck

    #int(Rover.pos[0])
    #int(Rover.pos[1])
    Rover.q.append([round(Rover.pos[0],1),round(Rover.pos[1],1),int(Rover.yaw)])
    print(Rover.q)
    #print(Rover.q.count([round(Rover.pos[0],1),round(Rover.pos[1],1),int(Rover.yaw)]))
    if Rover.q.count([round(Rover.pos[0],1),round(Rover.pos[1],1),int(Rover.yaw)]) >= 15 and Rover.laststeer == 'right':
        Rover.throttle = 0
        Rover.brake = 0
        Rover.steer = 15
        Rover.mode = 'stacked'
        print('Stached1')

    if Rover.q.count([round(Rover.pos[0], 1), round(Rover.pos[1], 1), int(Rover.yaw)]) >= 15 and Rover.laststeer == 'left':
        Rover.throttle = 0
        Rover.brake = 0
        Rover.steer = -15
        Rover.mode = 'stacked'
        print('Stacked2')

    if Rover.q.count([round(Rover.pos[0], 1), round(Rover.pos[1], 1), int(Rover.yaw)]) < 15:
        Rover.mode = 'forward'

    # Example:
    # Check if we have vision data to make decisions with
    if Rover.nav_angles is not None:
        # Check for Rover.mode status
        if Rover.mode == 'forward':
            # Check the extent of navigable terrain
            if len(Rover.nav_angles) >= Rover.stop_forward:
                # If mode is forward, navigable terrain looks good
                # and velocity is below max, then throttle
                if Rover.vel < Rover.max_vel:
                    # Set throttle value to throttle setting
                    Rover.throttle = Rover.throttle_set
                else: # Else coast
                    Rover.throttle = 0
                Rover.brake = 0
                # Set steering to average angle clipped to the range +/- 15
                Rover.steer = np.clip(np.mean(Rover.nav_angles * 180/np.pi), -15, 15)
            # If there's a lack of navigable terrain pixels then go to 'stop' mode
            elif len(Rover.nav_angles) < Rover.stop_forward:
                    # Set mode to "stop" and hit the brakes!
                    Rover.throttle = -0.1
                    # Set brake to stored brake value
                    Rover.brake = Rover.brake_set
                    #Rover.throttle = 0
                    #Rover.steer = 0
                    Rover.mode = 'stop'

        # If we're already in "stop" mode then make different decisions
        elif Rover.mode == 'stop':
            # If we're in stop mode but still moving keep braking
            if Rover.vel > 0.2:
                Rover.throttle = 0
                Rover.brake = Rover.brake_set
                Rover.steer = 0
            # If we're not moving (vel < 0.2) then do something else
            elif Rover.vel <= 0.2:
                #Rover.brake = 0
                # Now we're stopped and we have vision data to see if there's a path forward
                if len(Rover.nav_angles) < Rover.go_forward:
                    #Rover.throttle = 0
                    # Release the brake to allow turning
                    #Rover.brake = 0
                    #Rover.throttle = -0.1
                    print(np.mean(Rover.nav_angles * 180/np.pi))
                    # Turn range is +/- 15 degrees, when stopped the next line will induce 4-wheel turning
                    if np.mean(Rover.nav_angles * 180/np.pi)>=-45 or  np.mean(Rover.nav_angles * 180/np.pi)=='nan':
                        #Rover.throttle = 0
                        #Rover.brake = Rover.brake_set
                        Rover.brake = 0
                        Rover.steer = 15
                        Rover.laststeer = 'left'

                        #Rover.throttle = -Rover.throttle_set
                        #Rover.steer = 15 # Could be more clever here about which way to turn
                    elif np.mean(Rover.nav_angles * 180/np.pi)<-45:
                         #Rover.throttle = -Rover.throttle_set
                         #Rover.throttle = 0
                         #Rover.brake = Rover.brake_set
                        Rover.brake = 0
                        Rover.steer = -15
                        Rover.laststeer = 'right'
                    else:
                        if Rover.laststeer == 'right':
                            Rover.steer = -15
                        else:
                            Rover.steer = 15

                # If we're stopped but see sufficient navigable terrain in front then go!
                if len(Rover.nav_angles) >= Rover.go_forward and Rover.mode !='stacked':
                    # Set throttle back to stored value
                    Rover.throttle = Rover.throttle_set
                    # Release the brake
                    Rover.brake = 0
                    # Set steer to mean angle
                    Rover.steer = np.clip(np.mean(Rover.nav_angles * 180/np.pi), -15, 15)
                    Rover.mode = 'forward'

    # If in a state where want to pickup a rock send pickup command
    if Rover.near_sample and Rover.vel == 0 and not Rover.picking_up:
        Rover.send_pickup = True

    return Rover
 ````
In the `decision_step()` I introduced one more mode for the Rover 'Stacked' where this mode is initiated when all x,y,yaw values remain the same for a small period of time. This is achived through `self.q = _collections.deque(maxlen=20)` where I store the last 20 X,y,yaw values and check if more than 15 (rounded) values are the same in the que. When Stacked flag is initiated, a turn maneuver is applied.
When the Rover is stopped and there is enough vision forward data, the turn is based upon the `np.mean(Rover.nav_angles * 180/np.pi)` citeria for turnting left or right.

#### 2. Launching in autonomous mode your rover can navigate and map autonomously.  Explain your results and how you might improve them in your writeup.

**Note: running the simulator with different choices of resolution and graphics quality may produce different results, particularly on different machines!  Make a note of your simulator settings (resolution and graphics quality set on launch) and frames per second (FPS output to terminal by `drive_rover.py`) in your writeup when you submit the project so your reviewer can reproduce your results.**

The video output file can be found in the following Dropbox Link:
https://www.dropbox.com/s/7jgqjbeu3tdwjpt/Rover%20Simulator%2014-Dec-17%205_49_45%20PM.mp4?dl=0

Video and Resolution Settings:
64-Bit Rover Simulator
Screen Resolution: 1024x768
Graphics Quality: Good
Windowed: Yes
FPS: 27
Pick up Rock Routine Implemented: No

The Rover can easily avoid obstacles, map efficiently the world, and has the intelligence to understand if it has been stacked.
Rocks are identified and located in the worldmap efficiently and the rover can espace from dead-ends. The only drawback is that it might not map the entire world and miss some paths. This could be resolved if we apply a labyrinth concept of always moving with obstacles from one side. This means that the rover should move forward always and close to the rocks in its right (or left) side.

A snapshot of the video output after `drive_rover.py` is shown below:

![alt text][image5]

repository: aaman-ee/RoboND

repo_name: aaman-ee/RoboND


text:
% DBSCAN

# NAME

DBSCAN clustering - Density-Based Spatial Clustering of Applications with
Noise (DBSCAN) is a clustering algorithm commonly used in EDA (exploratory
data analysis). It is a base algorithm for density-based clustering, which
can discover clusters of different shapes and sizes from a large amount of
data, containing noise and outliers.

# SYNOPSIS

    class frovedis.mllib.cluster.DBSCAN(eps=0.5, min_samples=5, metric=‘euclidean’,
                                        metric_params=None, algorithm=‘auto’,
                                        leaf_size=30, p=None, n_jobs=None,
                                        batch_fraction=None, verbose=0)

## Public Member Functions

fit(X, y = None, sample_weight = None)
fit_predict(X, sample_weight = None)
score(X, y, sample_weight = None)
get_params(deep = True)
set_params(\*\*params)
release()
is_fitted()

# DESCRIPTION

DBSCAN is a Density-Based Clustering unsupervised learning algorithm that identifies
distinctive groups/clusters in the data, based on the idea that a cluster in
data space is a contiguous region of high point-density, separated from other
such clusters by contiguous regions of low point-density.

It is able to find arbitrary shaped clusters and clusters with noise (i.e.
outliers). The main idea behind DBSCAN is that a point belongs to a cluster if
it is close to many points from that cluster.
DBSCAN algorithm requires two key parameters: **eps** and **min_samples**.

Based on these two parameters, the points are classified as core point, border point,
or outlier:
- **Core point**: A point is a core point if there are at least minPts number of points
(including the point itself) in its surrounding area with radius eps.
- **Border point**: A point is a border point if it is reachable from a core point
and there are less than minPts number of points within its surrounding area.
- **Outlier**: A point is an outlier if it is not a core point and not reachable
from any core points.

The main advantage of using DBSCAN is that it is able to find arbitrarily size and
arbitrarily shaped clusters and identify noise data while clustering.

This module provides a client-server implementation, where the client application is
a normal python program. Frovedis is almost same as Scikit-learn clustering module
providing DBSCAN support, but it doesn’t have any dependency with Scikit-learn. It
can be used simply even if the system doesn’t have Scikit-learn installed. Thus, in
this implementation, a python client can interact with a frovedis server sending the
required python data for training at frovedis side. Python data is converted into
frovedis compatible data internally and the python ML call is linked with the
respective frovedis ML call to get the job done at frovedis server.

Python side calls for DBSCAN on the frovedis server. Once the training is completed
with the input data at the frovedis server, it returns an abstract model with a
unique model ID to the client python program.

When prediction-like request would be made on the trained model, the python program
will send the same request to the frovedis server. After the request is served at
the frovedis server, the output would be sent back to the python client.

## Detailed Description

### 1. DBSCAN()

__Parameters__

_**eps**_: A positive double (float64) parameter containing the epsilon value or distance
that specifies the neighborhoods. (Default: 0.5)
Two points are considered to be neighbors if the distance between them is less than or equal to eps.
_**min_samples**_: A positive integer parameter which specifies the number of samples in a
neighborhood for a point to be considered as a core point.
This includes the point itself. (Default: 5)
_**metric**_: A string object parameter used when calculating distance between instances
in a feature array. (Default: 'euclidean')
It only supports 'euclidean' distance.
_**metric_params**_: It is unused parameter which is an additional keyword arguments for the
metric function. (Default: None)
_**algorithm**_:  A string object parameter, used to compute pointwise distances and find nearest
neighbors. (Default: 'auto')
When it is 'auto', it will be set as 'brute'(brute-force search approach). Unlike Scikit-learn,
currently it supports only 'brute'.
_**leaf_size**_: An unused parameter, which is used to affect the speed of the
construction and query. (Default: 30)
_**p**_: An unused parameter specifying the power of the Minkowski metric to be
used to calculate distance between points. (Default: None)
_**n_jobs**_:  An unused parameter specifying the number of parallel jobs to run. (Default: None)
_**batch_fraction**_: A positive double (float64) parameter used to calculate the batches of specific
size. These batches are used to construct the distance matrix. (Default: None)
It must be within the range of 0.0 to 1.0. When it is None (not specified explicitly),
it will be set as np.finfo(np.float64).max value.
_**verbose**_: An integer parameter specifying the log level to use. Its value is set
as 0 by default (for INFO mode). But it can be set to 1 (for DEBUG mode) or 2 (for TRACE
mode) for getting training time logs from frovedis server.

__Attributes__
_**labels\_**_: It is a python ndarray, containing int64 typed values and has shape
**(n_samples,)**. These are the coordinates of cluster centers.
_**core_sample_indices\_**_:  It is a python ndarray, containing int32 or int64 typed values
and has shape **(n_samples,)**.  These are the core samples indices.
_**components\_**_:  It is a numpy array or FrovedisRowmajorMatrix, containing float
or double (float64) typed values and has shape **(n_samples, n_features)**.
These are the copy of each core sample found by training.

__Purpose__
It initializes a DBSCAN object with the given parameters.

The parameters: "metric_params", "leaf_size", "p" and "n_jobs" are simply kept to make
the interface uniform to Scikit-learn DBSCAN clustering module. They are not used
anywhere within frovedis implementation.

__Return Value__
It simply returns "self" reference.

### 2. fit(X,  y = None, sample_weight = None)
__Parameters__
_**X**_: A numpy dense or scipy sparse matrix or any python array-like object or
an instance of FrovedisCRSMatrix for sparse data and FrovedisRowmajorMatrix for
dense data of float or double (float64) type. It has shape **(n_samples, n_features)**.
_**y**_: None or any python array-like object (any shape). It is simply ignored
in frovedis implementation, like in Scikit-learn.
_**sample\_weight**_: Python array-like containing the intended weights for each input
samples and it should be the shape of **(n_samples, )**.
When it is None (not specified explicitly), an uniform weight vector is assigned on
each input sample.

__Purpose__

It clusters the given data points (X).

For example,

    # loading sample matrix data
    train_mat = np.loadtxt("sample_data.txt")

    # fitting input matrix on DBSCAN object
    from frovedis.mllib.cluster import DBSCAN
    dbm = DBSCAN(eps = 5, min_samples = 2).fit(train_mat)

When native python data is provided, it is converted to frovedis-like inputs and
sent to frovedis server which consumes some data transfer time. Pre-constructed
frovedis-like inputs can be used to speed up the training time, especially when
same data would be used for multiple executions.

For example,

    # loading sample matrix data
    train_mat = np.loadtxt("sample_data.txt")

    # Since "train_mat" is numpy dense data, we have created FrovedisRowmajorMatrix.
    # For scipy sparse data, FrovedisCRSMatrix should be used instead.
    from frovedis.matrix.dense import FrovedisRowmajorMatrix
    rmat = FrovedisRowmajorMatrix(train_mat)

    # DBSCAN with pre-constructed Frovedis-like inputs
    from frovedis.mllib.cluster import DBSCAN
    dbm = DBSCAN(eps = 5, min_samples = 2).fit(rmat)

__Return Value__
It simply returns "self" reference.

### 3. fit_predict(X, sample_weight = None)
__Parameters__
_**X**_: A numpy dense or scipy sparse matrix or any python array-like object or
an instance of FrovedisCRSMatrix for sparse data and FrovedisRowmajorMatrix for
dense data of float or double (float64) type. It has shape **(n_samples, n_features)**.
_**sample\_weight**_: Python array-like containing the intended weights for each input
samples and it should be the shape of **(n_samples, )**.
When it is None (not specified explicitly), an uniform weight vector is assigned on
each input sample.

__Purpose__

It computes the clusters from the given data points (X) or distance matrix and predict
labels.

For example,

    # loading sample matrix data
    train_mat = np.loadtxt("sample_data.txt")

    # fitting input matrix on DBSCAN object
    from frovedis.mllib.cluster import DBSCAN
    dbm = DBSCAN(eps = 5, min_samples = 2)
    print(dbm.fit_predict(train_mat))

Output

    [0 0 1 1 1]

Like in fit() frovedis-like input can be used to speed-up training at server side.

For example,

    # loading sample matrix data
    train_mat = np.loadtxt("sample_data.txt")

    # Since "train_mat" is numpy dense data, we have created FrovedisRowmajorMatrix.
    # For scipy sparse data, FrovedisCRSMatrix should be used instead.
    from frovedis.matrix.dense import FrovedisRowmajorMatrix
    rmat = FrovedisRowmajorMatrix(train_mat)

    # using pre-constructed input matrix
    from frovedis.mllib.cluster import DBSCAN
    dbm = DBSCAN(eps = 5, min_samples = 2)
    print(dbm.fit_predict(rmat))

Output

    [0 0 1 1 1]

__Return Value__
It returns a numpy array of int64 type containing the cluster labels,
with shape **(n_samples,)**.

### 4. score(X, y, sample_weight = None)
_**X**_: A numpy dense or scipy sparse matrix or any python array-like object or
an instance of FrovedisCRSMatrix for sparse data and FrovedisRowmajorMatrix for
dense data of float or double (float64) type. It has shape **(n_samples, n_features)**.
_**y**_: A python ndarray or an instance of FrovedisVector containing the true
labels for X. It has shape **(n_samples,)**.
_**sample\_weight**_: An unused parameter whose default value is None. It is simply
ignored in frovedis implementation, like in Scikit-learn as well.

__Purpose__
It calculates homogeneity score on given test data and labels i.e homogeneity score
of self.predict(X, y) wrt. y.

For example,

    dbm.score(train_mat, [0 0 1 1 1])

Output

    1.0

__Return Value__
It returns a score of float type.

### 5. get_params(deep = True)

__Parameters__
_**deep**_: A boolean parameter, used to get parameters and their values for an estimator. If True, will return the
parameters for an estimator and contained subobjects that are estimators. (Default: True)

__Purpose__
This method belongs to the BaseEstimator class inherited by DBSCAN. It is used to get parameters and their values of
DBSCAN class.

For example,

    print(dbm.get_params())

Output

    {'algorithm': 'auto', 'batch_fraction': None, 'eps': 5, 'leaf_size': 30,
    'metric': 'euclidean', 'metric_params': None, 'min_samples': 2, 'n_jobs': None,
    'p': None, 'verbose': 0}

__Return Value__
A dictionary of parameter names mapped to their values.

### 6. set_params(\*\*params)
__Parameters__
_**\*\*params**_: All the keyword arguments are passed to this function as dictionary. This dictionary
contains parameters of an estimator with its given values to set.

__Purpose__
This method belongs to the BaseEstimator class inherited by DBSCAN, used to set parameter values.

For example,

    print("Get parameters before setting:")
    print(kmeans.get_params())
    # User just needs to provide the arguments and internally it will create a
    dictionary over the arguments given by user
    kmeans.set_params(n_clusters=4, n_init=5)
    print("Get parameters after setting:")
    print(kmeans.get_params())

Output

    Get parameters before setting:
    {'algorithm': 'auto', 'copy_x': True, 'init':'random', 'max_iter': 300,
    'n_clusters': 2, 'n_init': 1, 'n_jobs': 1, 'precompute_distances': 'auto',
    'random_state': None, 'tol': 0.0001, 'use_shrink': False, 'verbose': 0}
    Get parameters after setting:
    {'algorithm': 'auto', 'copy_x': True, 'init': 'random', 'max_iter': 300,
    'n_clusters': 4, 'n_init': 5, 'n_jobs': 1, 'precompute_distances': 'auto',
    'random_state': None, 'tol': 0.0001, 'use_shrink': False, 'verbose': 0}

__Return Value__
It simply returns "self" reference.

### 7. release()

__Purpose__
It can be used to release the in-memory model at frovedis server.

For example,

    dbm.release()

This will reset the after-fit populated attributes to None, along with
releasing server side memory.

__Return Value__
It returns nothing.

### 8. is_fitted()

__Purpose__
It can be used to confirm if the model is already fitted or not. In case, fit_predict()
is used before training the model, then it can prompt the user to train the clustering
model first.

__Return Value__
It returns ‘True’, if the model is already fitted otherwise, it returns ‘False’.

# SEE ALSO
- **[Introduction to FrovedisRowmajorMatrix](../matrix/rowmajor_matrix.md)**
- **[Introduction to FrovedisCRSMatrix](../matrix/crs_matrix.md)**
- **[Agglomerative Clustering in Frovedis](./agglomerative_clustering.md)**
- **[Spectral Clustering in Frovedis](./spectral_clustering.md)**
- **[KMeans in Frovedis](./kmeans.md)**

repository: frovedis/frovedis

repo_name: frovedis/frovedis


text:
# CS50 - 2017 - Problem Sets

[![CS50](http://i.imgur.com/DN8KfOe.jpg "This is CS50")](https://www.edx.org/course/cs50s-introduction-to-computer-science)

## Table of Content

- [CS50 - 2017 - Problem Sets](#cs50---2017---problem-sets)
    - [Table of Content](#table-of-content)
    - [Intro](#intro)
    - [Dependencies](#dependencies)
    - [Problem Set 0](#problem-set-0)
        - [Scratch](#scratch)
    - [Problem Set 1](#problem-set-1)
        - [Hello](#hello)
        - [Water](#water)
        - [Mario, less comfortable](#mario-less-comfortable)
        - [Mario, more comfortable](#mario-more-comfortable)
        - [Greedy, less comfortable](#greedy-less-comfortable)
        - [Credit, more comfortable](#credit-more-comfortable)
    - [Problem Set 2](#problem-set-2)
        - [Initials, less comfortable](#initials-less-comfortable)
        - [Initials, more comfortable](#initials-more-comfortable)
        - [Caesar, less comfortable](#caesar-less-comfortable)
        - [Vigenere, less comfortable](#vigenere-less-comfortable)
        - [Crack, more comfortable](#crack-more-comfortable)
    - [Problem Set 3](#problem-set-3)
        - [Find, less comfortable](#find-less-comfortable)
        - [Find, more comfortable](#find-more-comfortable)
        - [Game of Fifteen](#game-of-fifteen)
    - [Problem Set 4](#problem-set-4)
        - [Whodunit](#whodunit)
        - [Resize, less comfortable](#resize-less-comfortable)
        - [Resize, more comfortable](#resize-more-comfortable)
        - [Recover](#recover)
    - [Problem Set 5](#problem-set-5)
        - [Speller](#speller)
    - [Problem Set 6](#problem-set-6)
        - [Mario python](#mario-python)
        - [Greedy, less comfortable python](#greedy-less-comfortable-python)
        - [Credit, more comfortable python](#credit-more-comfortable-python)
        - [Caesar, less comfortable python](#caesar-less-comfortable-python)
        - [Vigenere, less comfortable python](#vigenere-less-comfortable-python)
        - [Crack, more comfortable python](#crack-more-comfortable-python)
        - [Sentiments](#sentiments)
    - [Problem Set 7](#problem-set-7)
        - [Finance](#finance)
    - [Problem Set 8](#problem-set-8)
        - [Mashup](#mashup)
    - [License](#license)

## Intro

This is a work in progress repository containing solutions for CS50 problem sets.

I mainly use this as personal training grounds to try out different things and learn while doing it.

Feel free to contribute in any way you see fit, all feedback is welcome.

## Dependencies

[Latest CS50 Library](https://github.com/cs50/cs50) for C.

[How to install](https://manual.cs50.net/library/) _(Might be outdated)_

## Problem Set 0

### Scratch

As per [specifications](http://docs.cs50.net/2017/x/psets/0/pset0.html#tl-dr) make a program in [scratch](https://scratch.mit.edu):

![Scratch](https://cdn2.scratch.mit.edu/get_image/project/104489209_282x210.png)

My implementation of a simple [game](https://scratch.mit.edu/projects/104489209/).

## Problem Set 1

### Hello

A program that prints out a simple greeting to the user:

```text
./hello

Hello, world!
```

Official specifications for [hello](http://docs.cs50.net/problems/hello/hello.html) on CS50.

My implementation of [hello](PSET1/hello.c).

### Water

A program that reports a user’s water usage, converting minutes spent in the shower to bottles of drinking water:

```text
./water

Minutes: 1
Bottles: 12
```

```text
./water

Minutes: 10
Bottles: 120
```

Official specifications for [water](http://docs.cs50.net/problems/water/water.html) on CS50.

My implementation of [water](PSET1/water.c).

### Mario, less comfortable

A program that prints out a half-pyramid of a specified height:

```text
./mario

Height: 5
    ##
   ###
  ####
 #####
######
```

```text
./mario

Height: 3
  ##
 ###
####
```

Official specifications for [mario](http://docs.cs50.net/problems/mario/less/mario.html) on CS50.

My implementation of [mario](PSET1/mario.c).

### Mario, more comfortable

A program that prints out a double half-pyramid of a specified height:

```text
./mario

Height: 4
   #  #
  ##  ##
 ###  ###
####  ####
```

Official specifications for [mario](http://docs.cs50.net/problems/mario/more/mario.html) on CS50.

My implementation of [mario](PSET1/mario_more.c).

### Greedy, less comfortable

A program that calculates the minimum number of coins required to give a user change:

```text
./greedy

O hai! How much change is owed?
0.41
4
```

Official specifications for [greedy](http://docs.cs50.net/problems/greedy/greedy.html) on CS50.

My implementation of [greedy](PSET1/greedy.c).

### Credit, more comfortable

A program that determines whether a provided credit card number is valid according to [Luhn’s algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm):

```text
./credit

Number:<PHONE_NUMBER>10005
AMEX
```

Official specifications for [credit](http://docs.cs50.net/problems/credit/credit.html) on CS50.

My implementation of [credit](PSET1/credit.c).

## Problem Set 2

### Initials, less comfortable

A program that, given a person’s name, prints a person’s initials:

```text
./initials

Regulus Arcturus Black
RAB
```

Official specifications for [initials](http://docs.cs50.net/problems/initials/less/initials.html) on CS50.

My implementation of [initials](PSET2/initials.c).

### Initials, more comfortable

A program that, given a person’s name, prints a person’s initials, while ignoring additional whitespace:

```text
./initials

  Regulus    Arcturus   Black
RAB
```

Official specifications for [initials](http://docs.cs50.net/problems/initials/more/initials.html) on CS50.

My implementation of [initials](PSET2/initials_more.c).

### Caesar, less comfortable

A program that encrypts messages using Caesar’s cipher:

```text
./caesar 13

plaintext:  HELLO
ciphertext: URYYB
```

Official specifications for [caesar](http://docs.cs50.net/problems/caesar/caesar.html) on CS50.

My implementation of [caesar](PSET2/caesar.c).

### Vigenere, less comfortable

A program that encrypts messages using Vigenère’s cipher:

```text
./vigenere ABC

plaintext:  HELLO
ciphertext: HFNLP
```

Official specifications for [vigenere](http://docs.cs50.net/problems/vigenere/vigenere.html) on CS50.

My implementation of [vigenere](PSET2/vigenere.c).

### Crack, more comfortable

A program that cracks passwords:

```text
./crack 50fkUxYHbnXGw

rofl
```

Official specifications for [crack](http://docs.cs50.net/problems/crack/crack.html) on CS50.

My implementation of [crack](PSET2/crack.c).

## Problem Set 3

### Find, less comfortable

A program that finds a number among numbers:

```text
./generate 1000 | ./find 42

Didn't find needle in haystack.
```

Official specifications for [find](http://docs.cs50.net/problems/find/less/find.html) on CS50.

My implementation of [find](PSET3/find_less/).

### Find, more comfortable

A program that finds a number among numbers:

```text
./generate 1000 | ./find 42

Didn't find needle in haystack.
```

Official specifications for [find](http://docs.cs50.net/problems/find/more/find.html) on CS50.

My implementation of [find](PSET3/find_more).

### Game of Fifteen

Game of Fifteen:

```text
./fifteen 3

WELCOME TO GAME OF FIFTEEN

8  7  6

5  4  3

2  1  _

Tile to move:
```

Official specifications for [game of fifteen](http://docs.cs50.net/problems/fifteen/fifteen.html) on CS50.

My implementation of [fifteen](PSET3/fifteen).

## Problem Set 4

### Whodunit

A program that reveals a reveals a hidden message in a BMP:

```text
./whodunit clue.bmp verdict.bmp
```

Official specifications for [whodunit](http://docs.cs50.net/problems/whodunit/whodunit.html) on CS50.

My implementation of [whodunit](PSET4/bmp/whodunit.c).

### Resize, less comfortable

Implement a program that resizes BMPs:

```text
./resize 4 small.bmp large.bmp
```

Official specifications for [Resize](http://docs.cs50.net/problems/resize/less/resize.html) on CS50.

My implementation of [Resize](PSET4/bmp/resize_less.c).

### Resize, more comfortable

Implement a program that resizes BMPs:

```text
./resize 4 small.bmp large.bmp
```

```text
./resize .25 large.bmp small.bmp
```

Official specifications for [Resize](http://docs.cs50.net/problems/resize/more/resize.html) on CS50.

My implementation of [~~Resize~~](PSET4/bmp/resize_more.c).

### Recover

Implement a program that recovers JPEGs from a forensic image:

```text
./recover card.raw
```

Official specifications for [Recover](http://docs.cs50.net/problems/recover/recover.html) on CS50.

My implementation of [Recover](PSET4/jpg/recover.c).

## Problem Set 5

### Speller

Implement a program that spell-checks a file:

```text
./speller texts/austinpowers.txt

MISSPELLED WORDS
[...]
Bigglesworth
[...]
Virtucon
[...]
friggin
[...]
trippy
[...]

WORDS MISSPELLED:
WORDS IN DICTIONARY:
WORDS IN TEXT:
TIME IN load:
TIME IN check:
TIME IN size:
TIME IN unload:
TIME IN TOTAL:
```

Official specifications for [Speller](http://docs.cs50.net/problems/recover/recover.html) on CS50.

My old implementation of [Speller](PSET5/old).
My trie implementation of [Speller](PSET5/trie).

## Problem Set 6

Port some previous programs from C to Python.

Official specifications for [Problem Set 6](http://docs.cs50.net/2017/x/psets/6/pset6.html#problems)

### Mario python

My implementation of [Mario](PSET6/mario_less.py), less comfortable on python.

My implementation of [Mario](PSET6/mario_more.py), more comfortable on python.

### Greedy, less comfortable python

My implementation of [Greedy](PSET6/greedy.py) on python.

### Credit, more comfortable python

My implementation of [Credit](PSET6/credit.py) on python.

### Caesar, less comfortable python

My implementation of [Caesar](PSET6/caesar.py) on python.

### Vigenere, less comfortable python

My implementation of [Vigenere](PSET6/vigenere.py) on python.

### Crack, more comfortable python

My implementation of [Crack](PSET6/crack.py) on python.

### Sentiments

Official specifications for [Sentiments](http://docs.cs50.net/problems/sentiments/sentiments.html)

1. Implement a program that categorizes a word as positive or negative.

    ```text
    ./smile love

    :)

    ./smile hate

    :(

    ./smile Stanford

    :|
    ```

    My implementation of [smile](PSET6/sentiments/smile) and [analyzer](PSET6/sentiments/analyzer.py)

    <br>

2.  Implement a website that generates a pie chart categorizing a user’s tweets.

    ![Tweet pie](http://i.imgur.com/twGxbdI.png)

    My implementation of [application](PSET6/sentiments/application.py) and [helpers](PSET6/sentiments/helpers.py)

## Problem Set 7

### Finance

Implement a website via which users can "buy" and "sell" stocks.

Official specifications for [finance](http://docs.cs50.net/problems/finance/finance.html) on CS50.

![Finance](http://i.imgur.com/LC4yMws.png)

My implementation of [finance](PSET7/finance/) and [online website](http://implaier.pythonanywhere.com/).

## Problem Set 8

### Mashup

Implement a website that lets users search for articles atop a map.

Official specifications for [mashup](http://docs.cs50.net/problems/mashup/mashup.html) on CS50.

![Mashup](http://i.imgur.com/r7g6y7k.png)

My implementation of [mashup](PSET8/mashup/) and [online website](http://implaiercs50.pythonanywhere.com/).

## License

[MIT](LICENSE.md)


text:
# docker-tutorial

[![Binder](http://mybinder.org/badge.svg)](http://beta.mybinder.org/v2/gh/ds421/docker-tutorial/master)

## Docker - Local

- Deploy RStudio
- Optional: linking local volumes, starting & stopping containers. `docker exec`. Dockerfiles.

## Docker - Cloud

- Deploy RStudio
- Optional: Docker Compose, Deploy additional containers

## Databases

- See the `[docker-compose.yml](docker-compose.yml)` included here.

- See [dbplyr Vignette](https://cran.r-project.org/web/packages/dbplyr/vignettes/dbplyr.html).  Most useful is the advice on why you want to use a database:

> - Your data is already in a database.
> - You have so much data that it does not all fit into memory simultaneously and you need to use some external storage engine.
> (If your data fits in memory there is no advantage to putting it in a database: it will only be slower and more frustrating.)

repository: chippiekizzle/docker-tutorial

repo_name: chippiekizzle/docker-tutorial


text:
---
title: Modern Web
layout: layout-home-background
slogan: Guides, tools and libraries for modern web development.
callToActionItems:
  [{ text: 'Follow Guides', href: '/guides/' }, { text: 'Browse Docs', href: '/docs/' }]
reasonHeader: Why Modern Web?
reasons:
  [
    {
      header: Built on web standards,
      text: "Work with and extend what's available in modern browsers, learning skills, and writing code that stays relevant.",
    },
    {
      header: Lightweight,
      text: 'Simple solutions that are lightweight and have a low barrier to entry. With extension points for power users.',
    },
    {
      header: Low complexity,
      text: 'Write code that is close to what actually runs in the browser, reducing abstractions and complexity.',
    },
  ]
---

repository: aomarks/web

repo_name: aomarks/web


text:
# GOG Galaxy 2.0 Export Script

This script helps a user export their GOG Galaxy 2.0 Library.

## Usage

Simply run the script and it'll create a CSV in the current working directory of a list of all the games you've added to the launcher. The output is in the following format:

| Title | List of Platforms | Developers | Publishers | Release Date | Genres | Themes | Critics Score |
| ----- | ----------------- | ---------- | ---------- | ------------ | ------ | ------ | ------------- |

## Dependencies

- Python 3

## Platform Support

Question marks beside a platform mean it is unclear what platform it refers to. Please create a pull request to correct them.

- [x] 3DO Interactive Multiplayer
- [x] Aion: Legions of War
- [x] Aion: The Tower of Eternity
- [x] Amazon Games
- [x] Amiga 500
- [x] Arc Games
- [x] Atari 2600
- [x] Atari Jaguar
- [x] Battle.net
- [x] Beamdog
- [x] Bethesda Launcher
- [x] BlackBerry Games??
- [x] Blade and Soul Launcher
- [x] Commodore 64
- [x] DC??
- [x] Direct2Drive
- [x] Discord
- [x] Dotemu
- [x] EGG??
- [x] Elder Scrolls Online
- [x] Elite Dangerous
- [x] Epic Games Store
- [x] Fanatical
- [x] Final Fantasy XI
- [x] Final Fantasy XIV
- [x] Game.co.uk
- [x] GameHouse
- [x] GameSessions
- [x] GG.deals
- [x] Glyph
- [x] Google Stadia
- [x] Green Man Gaming
- [x] Guild Wars
- [x] Guild Wars 2
- [x] Humble Bundle
- [x] IndieGala
- [x] Itch<span>.io
- [x] Kartridge
- [x] LINE Games
- [x] Microsoft Store
- [x] Microsoft Store
- [x] Microsoft Xbox
- [x] Minecraft
- [x] Neogames
- [x] Nintendo 3DS
- [x] Nintendo 64
- [x] Nintendo DS
- [x] Nintendo Entertainment System
- [x] Nintendo Game Boy
- [x] Nintendo GameCube
- [x] Nintendo Switch
- [x] Nintendo Wii
- [x] Nintendo Wii U
- [x] Nuuvem
- [x] Oculus
- [x] Origin
- [x] Other
- [x] Paradox
- [x] Path of Exile
- [x] Placeholder
- [x] Playasia
- [x] Playfire
- [x] Riot Games
- [x] Rockstar Games Launcher
- [x] Sega 32X
- [x] Sega CD
- [x] Sega Genesis
- [x] Sega Saturn
- [x] Sms??
- [x] Sony PlayStation® 2
- [x] Sony PlayStation® Network
- [x] Sony PlayStation® Portable
- [x] Sony PlayStation® Vita
- [x] Sony PSX
- [x] Star Citizen??
- [x] Steam
- [x] Super Nintendo Entertainment System
- [x] Total War
- [x] TurboGrafx-16 Mini
- [x] Twitch
- [x] Uplay
- [x] Vision??
- [x] Wargaming??
- [x] Weplay??
- [x] ZX Spectrum

## Wiki

Check the [Wiki tab](https://github.com/AB1908/GOG-Galaxy-Export-Script/wiki).

## Roadmap

Check the [Projects tab](https://github.com/AB1908/GOG-Galaxy-Export-Script/projects).

## Contribution

Feel free to add issues and pull requests.

## License

This repository is licensed under the [MIT License](https://github.com/AB1908/GOG-Galaxy-Export-Script/blob/master/LICENSE).


text:
# Fastly::RelationshipTlsCertificate

## Properties

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **tls_certificate** | [**RelationshipTlsCertificateTlsCertificate**](RelationshipTlsCertificateTlsCertificate.md) |  | [optional] |

[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

repository: fastly/fastly-ruby

gha_language: Ruby

repo_name: fastly/fastly-ruby


text:
[![Build Status](https://travis-ci.org/poroh/erl_lru.svg?branch=master)](https://travis-ci.org/poroh/erl_lru) [![Coverage Status](https://coveralls.io/repos/github/poroh/erl_lru/badge.svg?branch=master)](https://coveralls.io/github/poroh/erl_lru?branch=master)

# Erlang Cache of Least Recently Used items

Idea is to implement functional data structure that implements LRU.

## Usage

This cache may be used in two manners;
* Queue with remove operation
* Least recently used cache

Full module documentation is availble [here](http://github.com/poroh/erl_lru/blob/master/doc/erl_lru.md).

### Queue

```erlang

Q0 = erl_lru:new(),

%% Add new elements:
Q1 = erl_lru:push(key1, value1, Q0),
Q2 = erl_lru:push(key2, value2, Q1),
Q3 = erl_lru:push(key3, value3, Q2),

%% Remove element:
{value2, Q4} = erl_lru:take(key2, Q3),

%% Get element from head:
{key1, value1, Q5}  = erl_lru:pop(Q4),
{key3, value3, Q6}  = erl_lru:pop(Q5),

...
```

### LRU

```erlang

Size = 3,
LRU0 = erl_lru:new(Size),

%% Add new elements:
LRU1 = erl_lru:add(key1, value1, LRU0),
LRU2 = erl_lru:add(key2, value2, LRU1),
LRU3 = erl_lru:add(key3, value3, LRU2),

%% Updating exist elements (element become reacently updated)
{ok, value2, LRU4} = erl_lru:lookup_and_update(key2, LRU3),

%% Add new element that automatically removes least recently used (key1)
LRU5  = erl_lru:add(key4, value4, LRU4),
false = erl_lru:has_key(key1, LRU5),

...
```

## Performance

All read-only operations has O(1) complexity

All modification operations has O(log(N)) complexity.

## License

MIT (http://github.com/poroh/erl_lru/blob/master/LICENSE)

## Build

```
$ rebar3 compile

```

## Under the hood

Under the hood two data structures:

1. Unordered map: #{key() => {order(), value()}} for quick lookup
2. Binary search tree: gb_tree(order(), key()) for odering element in cache

order() is almost always incrementing integer which represent pseudo-time in the cache:
* When new element is added to cache it has highest order() value
* When exist element is updated its order value is changest to highest
* When cache is overflowed element with lowest order is removed
* When cache become empty highest order value is set to 0