text:
---
type: about
---
Bureau Sepän is an interdisciplinary creative agency that addresses cultural needs on a local and global scale.

</br>

We are working with a global list of clients and creative talents to deliver unique enhanced cultural products.

</br>

Transmedial and modern, we aim to bring brands, cultural institutions, and creatives closer together.

</br>

Partners and clients include [Red Bull Music Academy](http://www.redbullmusicacademy.com/), [ARTE](https://www.arte.tv/), [Institut Français](https://www.institutfrancais.com/fr), [Pro-Helvetia](https://prohelvetia.ch/fr/), [ACUD MACHT NEU](http://acudmachtneu.de/), [Swiss Museum of Electronic Music Instruments](https://www.smemmusic.ch/), [Varia Instruments](https://www.varia-instruments.com/), and [The Vinyl Factory](https://thevinylfactory.coma/).

repository: sepaen/site

repo_name: sepaen/site


text:
---
name: Question
about: Ask a question.
title: ""
labels: "type: question"
assignees: ""
---

## Prework

* [ ] I understand and agree to `targetsketch`' [code of conduct](https://github.com/wlandau/targetsketch/blob/main/CODE_OF_CONDUCT.md).
* [ ] I understand and agree to `targetsketch`' [contributing guidelines](https://github.com/wlandau/targetsketch/blob/main/CONTRIBUTING.md).
* [ ] Be considerate of the maintainer's time and make it as easy as possible to troubleshoot any problems you identify. Read [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and [here](https://www.tidyverse.org/help/) to learn about minimal reproducible examples. Format your code according to the [tidyverse style guide](https://style.tidyverse.org/) to make it easier for others to read.

## Question

## Reproducible example

Be considerate of the maintainer's time and make it as easy as possible to troubleshoot any problems you identify. Read [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and [here](https://www.tidyverse.org/help/) to learn about minimal reproducible examples. Format your code according to the [tidyverse style guide](https://style.tidyverse.org/) to make it easier for others to read.

license: MIT

branch_name: refs/heads/main

extension: md

gha_license_id: NOASSERTION

license_type: permissive


text:
# 563. Binary Tree Tilt

Difficulty: Easy

https://leetcode.com/problems/binary-tree-tilt/

Given a binary tree, return the tilt of the whole tree.

The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values and the sum of all right subtree node values. Null node has tilt 0.

The tilt of the whole tree is defined as the sum of all nodes' tilt.

**Example:**
```
Input:
         1
       /   \
      2     3
Output: 1
Explanation:
Tilt of node 2 : 0
Tilt of node 3 : 0
Tilt of node 1 : |2-3| = 1
Tilt of binary tree : 0 + 0 + 1 = 1
```
**Note:**

1. The sum of node values in any subtree won't exceed the range of 32-bit integer.
2. All the tilt values won't exceed the range of 32-bit integer.

Companies: Indeed

Related Topics: Tree

repository: jiadaizhao/LeetCode

branch_name: refs/heads/master

gha_license_id: MIT

repo_name: jiadaizhao/LeetCode


text:
# Manual Testing

## Navigation bar

1. Load up the home page on a desktop and verify that the standard menu with the links on the right hand side of the screen appears and looks good.
    - Outcome: Pass

2. Reduce and expand the width of the screen and verify that the navbar content appears as expected and looks good at all screen widths.
    - Outcome: Pass

3. Reduce and expand the width of the screen and verify that the menu colapses and the bars icon appears at screen widths below 992px.
    - Outcome: Pass

4. Verify that when the user clicks on the bars icon the menu expands, the collapsable search bar collapses if it is expanded, and the bars icon changes to the times icon. Click on the times icon and verify that the menu collapses and the times icon changes to the bars icon.
    - Outcome: Pass

5. Reduce and expand the width of the screen and verify that the user dropdown is hidden at screen widths below 992px, and the register, sign in, sign out, account and product management links appear in the collapsable menu.
    - Outcome: Pass

6. Reduce and expand the width of the screen and verify that for all screen widths where the standard menu is visible the links do not wrap onto the next line.
    - Outcome: Pass

7. Click on the Tech Reviews logo and verify that it takes the user back the the home page.
    - Outcome: Pass

8. Click on the home link and verify that it takes the user to the home page.
     - Outcome: Pass

9. Click on the register link and verify that it takes the user to the sign up page.
    - Outcome: Pass

10. Click on the sign in link and verify that it takes the user to the sign in page.
    - Outcome: Pass

11. Verify that when a standard user is signed in the account and sign out links appear and the register and sign in links disappear.
    - Outcome: Pass

12. Click on the account link and verify that it takes the user to the account page.
    - Outcome: Pass

13. Click on the sign out link and verify that it signs the user out and takes them back to the previous page. A toast should also appear containing a message that informs the user that they have been signed out.
    - Outcome: Pass

14. Verify that when an admin user is signed in the product management and sign out links appear and the register and sign in links disappear.
    - Outcome: Pass

15. Click on the product management link and verify that it takes the user to the product management page.
    - Outcome: Pass

16. Click on the reviews dropdown and click on the mobiles link and verify that it takes the user to the mobiles page.
    - Outcome: Pass

17. Click on the reviews dropdown and click on the tablets link and verify that it takes the user to the tablets page.
    - Outcome: Pass

18. Click on the reviews dropdown and click on the laptops link and verify that it takes the user to the laptops page.
    - Outcome: Pass

19. Click on the reviews dropdown and click on the accessories link and verify that it takes the user to the accessories page.
    - Outcome: Pass

20. Click on the contact us link and verify that it takes the user to the contact us page.
    - Outcome: Pass

21. Verify that when the user hovers over a link, it appears in white.
    - Outcome: Pass

22. Verify that the search icon appears in the navbar and the search bar disappears at screen widths below 992px. Click on the search icon and verify that the collapsable search bar expands and the navbar collapses if it is expanded. Click on the search icon a second time and verify that the search bar collapses.
    - Outcome: Pass

23. Verify that when the user enters a search term into the search bar and clicks the search icon, they are taken to the reviews page.
    - Outcome: Pass

24. Verify that if the user hasn't entered any search criteria into the search bar, the user should be redirected to their previous page or the home page (if there is no request.referrer) and a toast should appear informing them that they didn't enter any search criteria.
    - Outcome: Pass

## Footer

1. Scroll down to the footer and verify that it appears with the content in two columns and looks good.
    - Outcome: Pass

2. Reduce and expand the width of the screen and verify that the footer appears as an accordion and looks good at all screen widths below 992px.
    - Outcome: Pass

3. Verify that when the accordion is closed and the user clicks on the accordion heading, it opens and the plus icon changes to a minus icon. Click on the accordion heading for a second time and verify that it closes and the minus icon changes to a plus icon.
    - Outcome: Pass

5. Click on the phones link  and verify that it takes the user to the phones page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

6. Click on the tablets link and verify that it takes the user to the tablets page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

7. Click on the laptops link and verify that it takes the user to the laptops page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

8. Click on the accessories link and verify that it takes the user to the accessories page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

9. Verify that when a standard user is signed in the account link appears both in the accordion links list and in the standard links list.
    - Outcome: Pass

10. Click on the account link and verify that it takes the user to the account page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

11. Verify that when an admin user is signed in the product management link appears both in the accordion links list and in the standard links list.
    - Outcome: Pass

12. Click on the product management link and verify that it takes the user to the product management page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

13. Click on the contact us link and verify that it takes the user to the contact us page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

14. Verify that when the user hovers over each link, it appears in green.
    - Outcome: Pass

15. Click on the Facebook icon and verify that it takes the user to the Facebook home page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

16. Click on the Twitter icon and verify that it takes the user to the Twitter home page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

17. Click on the Instagram icon and verify that it takes the user to the Instagram home page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

18. Click on the Youtube icon and verify that it takes the user to the Youtube home page, both in the accordion links list and in the standard links list.
    - Outcome: Pass

19. Verify that when the user hovers over an icon, it increases in size and appears in green.
    - Outcome: Pass

## Home page

1. Verify that the hero image appears as expected and looks good.
    - Outcome: Pass

2. Click on the get started button in the hero image and verify that it takes the user to the sign up page.
    - Outcome: Pass

3. Reduce and expand the width of the screen and verify that the hero image appears as expected and looks good at all screen widths.
     - Outcome: Pass

4. Scroll down to the featured products carousel and verify that it appears with 3 cards displayed, with each containing a product's name and image.
    - Outcome: Pass

5. Click the left arrow and verify that the carousel now shows the 2nd, 3rd and 4th cards.
    - Outcome: Pass

6. Click the right arrow and verify that the carousel now shows the 6th, 1st, and 2nd cards.
    - Outcome: Pass

7. Reduce and expand the width of the screen and verify that the number of cards changes to 2 at screen widths below 576px.
    - Outcome: Pass

8. Reduce and expand the width of the screen and verify that the carousel and cards look good at all screen widths.
    - Outcome: Pass

9. Scroll down to the newsletter sign up form and verify that it appears as expected and looks good at all screen widths.
    - Outcome: Pass

10. Verify that each card image links to the relevant product's review details page.
    - Outcome: Pass

11. Enter an email address that does not contain one character followed by an at sign, followed by two more characters and then a dot. Click on the sign up button and verify that the form does not submit and shows the invalid input error message.
    - Outcome: Pass

12. Verify that when the user enters an email address which is in the required format and clicks the sign up button, the form submits, the user's email address is added to the newsletters database and the HTML is dynamically updated to show a message thanking the user for signing up to the newsletter.
    - Outcome: Pass

## Sign In page

1. Verify that the sign in form appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. In the email address field, enter an email address that does not contain one character followed by an at sign, followed by two more characters and then a dot. Click on the sign in button and verify that the form does not submit and shows the invalid input error message on the email address field.
    - Outcome: Pass

3. In the password field, enter a password that does not contain 8 or more characters including at least one uppercase letter, one lowercase letter, one number. Click on the sign in button and verify that the form does not submit and shows the invalid input error message on the password field.
    - Outcome: Pass

4. Verify that when a user enters an email addess and password which is in the required format, but incorrectly enters their email address and / or password and clicks on the sign in button, they are redirected back to the sign in page and a toast appears informing them that their email address and / or password is incorrect.
    - Outcome: Pass

5. Verify that when a user correctly enters their email address and password, the form submits, and the user is signed in and redirected to their previous page or home page (if no next search perameter is in the sign in page's URL). A toast should also appear informing the user that they have been successfully signed in.
    - Outcome: Pass

6. Click on the register link and verify that it takes the user to the sign up page.
    - Outcome: Pass

## Sign Up page

1. Verify that the sign up form appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. Verify that the image to the right of the sign up form only appears on screen widths of 992px or above and looks good.
    - Outcome: Pass

3. In the first name field, enter a name that is not between 2 and 15 charaters long and only contains letters, hyphens and apostrophes. Click on the sign up button and verify that the form does not submit and shows the invalid input error message on the first name field.
    - Outcome: Pass

3. In the last name field, enter a name that is not between 2 and 15 charaters long and only contains letters, hyphens and apostrophes. Click on the sign up button and verify that the form does not submit and shows the invalid input error message on the last name field.
    - Outcome: Pass

4. In the email address field, enter an email address that does not contain one character followed by an at sign, followed by two more characters and then a dot. Click on the sign in button and verify that the form does not submit and shows the invalid input error message on the email address field.
    - Outcome: Pass

5. In the password field, enter a password that does not contain between 8 and 30 characters including at least one uppercase letter, one lowercase letter, one number. Click on the sign in button and verify that the form does not submit and shows the invalid input error message on the password field.
    - Outcome: Pass

6. In the confirm password field, enter a password that does not match the password entered in the password field. Click on the sign in button and verify that the form does not submit and shows the invalid input error message on the confirm password field.
    - Outcome: Pass

7. Enter details in the required format in each field of the form but enter an email address that is already registered. Click on the sign in button and verify that the user is redirected back to the sign up page and a toast appears informing them that their email address is already registered.
    - Outcome: Pass

8. Verify that when a user who is not alredy registered correctly enters their details in the required format in each field of the form and clicks the sign in button, the form submits, the user's details are added to the users database and they are signed in and redirected to their previous page or home page (if no next search perameter is in the sign up page's URL). A toast should also appear informing the user that they have been successfully registered.
    - Outcome: Pass

9. Click on the sign in link and verify that it takes the user to the sign in page.
    - Outcome: Pass

## Account Page

1. Verify that the account page appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. Verify that a card containing the review's title and edit and delete links appears for each review the user has written.
    - Outcome: Pass

3. Verify that if there are no reviews text appears informing the user that they haven't written any reviews yet.
    - Outcome: Pass

4. Verify that if the user clicks on a review's edit icon, they are taken to that review's edit review page.
    - Outcome: Pass

5. Verify that if the user clicks on a review's delete icon, the review is deleted from the reviews database, the product's ratings are updated in the products database, the page reloads and a toast appears informing the user that the review has been successfully deleted.
    - Outcome: Pass

6. Verify that if there are more than 10 results in the reviews list, pagination links are displayed and when the user clicks on a link, cards for the reviews in the relevant positions in the reviews list are displayed.
    - Outcome: Pass

7. Verify that users who are not signed in cannot access the account page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

7. Verify that users who are not signed in cannot access the account page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

## Reviews, Phones, Tablets, Laptops and Accessories Pages

1. Verify that the page appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. Verify that cards containing the product image, name, price and average overall rating for each product satisfying the search criteria are displayed 6 to a page.
    - Outcome: Pass

3. Verify that each product image links to the relevant product's review details page.
    - Outcome: Pass

4. Verify that if there no search results that satisfy the search criteria, text appears informing the user that there are no products which match their search criteria.
    - Outcome: Pass

5. Verify that the filters button only appears on screen widths below 768px and when the user clicks it the filters modal opens.
    - Outcome: Pass

6. Verify that the filters sidebar only appears on screen widths of 768px and above.
    - Outcome: Pass

7. Verify that when filters are selected and the apply button is clicked in the filters modal or sidebar, the page reloads and only the products which satisfy the search criteria and selected filters are displayed. The checkboxes and radio buttons for the selected filters should be checked in the filters modal and sidebar.
    - Outcome: Pass

8. Verify that when filters are selected and the reset button is clicked in the filters modal or sidebar, the page reloads and all products which satisfy the search criteria are displayed. No checkboxes or radio buttons should be checked in the filters modal and sidebar.
    - Outcome: Pass

9. Verify that when the user selects an option from the products dropdown, the page reloads and the products are sorted accordingly.
products    - Outcome: Pass

10. Verify that if there are more than 6 results in the reviews list, pagination links are displayed and when the user clicks on a link, cards for the products in the relevant positions in the reviews list are displayed.
    - Outcome: Pass

## Review Details Page

1. Verify that the review details page appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. Verify that the back link displays the name of the previous page, and when the user clicks on the link, it takes them back to the previous page. If the user has come from the home page, the link should take the user back to the relevant category reviews page.

3. Verify that the product specifications table only displays data for each specification contained in the database for the current product.
    - Outcome: Pass

4. Verify that the feature rating and star rating progress bars correctly calculates average ratings for the product's overall rating, performace, usability, price and quality, and percentage of the total ratings for each number of stars.
    - Outcome: Pass

5. Verify that if a user is signed in the add review link is displayed, and if the user clicks on the link, they are taken to that review's add review page.
    - Outcome: Pass

6. Verify that cards are displayed for each review written for the product containing the review title, stars for the overall rating, review text, author's name, date written, up vote and down vote icons, and edit and delete icons if the review's author is signed in. The reviews should be ordered by date written with the most recent first.
    - Outcome: Pass

7. Verify that if the user clicks on a review's edit icon, they are taken to that review's edit review page.
    - Outcome: Pass

8. Verify that if the user clicks on a review's delete icon, the review is deleted from the reviews database, the product's ratings are updated in the products database, the page reloads and a toast appears informing the user that the review has been successfully deleted.
    - Outcome: Pass

9. Verify that if the user clicks the up vote or down vote icons on any review the relevant vote count is updated in the reviews database and on the page and the button is disabled.
    - Outcome: Pass

## Add Review page

1. Verify that the add review page appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. Verify that if the user hasn't selected a rating for each of the ratings and entered a title and review in the relevant fields, when the add review button is clicked the form doesn't submit and the invalid input error message appears on the relevant field.
    - Outcome: Pass

3. Verify that when the user has selected a rating for each of the ratings and entered a title and review in the relevant fields, the form submits when the add review button is clicked. Confirm that the review is added to the reviews database and the relevant product's ratings are updated in the products database. The user should be returned to their previous page and a toast should appear informing them that the review has been successfully added.
    - Outcome: Pass

4. Verify that if there is no next search perameter in the add review page's URL, the user is returned to the 400 page.
    - Outcome: Pass

5. Verify that users who are not signed in cannot access the add review page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

## Edit Review page

1. Verify that the edit review page appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. Verify that if the user hasn't selected a rating for each of the ratings and entered a title and review in the relevant fields, when the update review button is clicked the form doesn't submit and the invalid input error message appears on the relevant field.
    - Outcome: Pass

3. Verify that when the user has elected a rating for each of the ratings and entered a title and review in the relevant fields, the form submits when the update review button is clicked. Confirm that the review is updated in the reviews database and the relevant product's ratings are updated in the products database The user should be returned to their previous page and a toast should appear informing them that the review has been successfully updated.
    - Outcome: Pass

4. Verify that if there is no next search perameter in the edit review page's URL, the user is returned to the 400 page.
    - Outcome: Pass

5. Verify that users who are not signed in cannot access the edit review page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

6. Verify that any user who is not the review's author cannot access the review's edit review page by manually typing in it's URL and are returned to the 403 page.
    - Outcome: Pass

## Delete Review page

1. Verify that if there is no next search perameter in the delete review page's URL, the user is returned to the 400 page.
    - Outcome: Pass

2. Verify that users who are not signed in cannot access the delete review page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

3. Verify that any user who is not the review's author cannot access the review's delete review page by manually typing in it's URL and are returned to the 403 page.
    - Outcome: Pass

## Product Management Page

1. Verify that the product management page appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. Verify that when the user selects an option from the sort by dropdown, the page reloads and the products are sorted accordingly.
    - Outcome: Pass

3. Verify that when the user clicks the add product link, they are taken to the add product page.
    - Outcome: Pass

4. Verify that if the user clicks on a product's edit icon, they are taken to that product's edit product page.
    - Outcome: Pass

5. Verify that if the user clicks on a product's delete icon, the product is deleted from the products database and the category filters lists are updated, in the categories database, the page reloads and a toast appears informing the user that the product has been successfully deleted.
    - Outcome: Pass

6. Verify that if there are more than 10 results in the products list, pagination links are displayed and when the user clicks on a link, rows for the products in the relevant positions in the products list are displayed.
    - Outcome: Pass

7. Verify that users who are not signed in cannot access the product management page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

8. Verify that standard users cannot access the product management page by manually typing in it's URL and are returned to the 403 page.
    - Outcome: Pass

## Add Product page

1. Verify that the add product page appears with the product details section displayed and looks good at all screen widths.
    - Outcome: Pass

2. Verify that if the user hasn't entered a value of the correct type in each field, when the next button is clicked the product details section is not hidden, the product details section is not shown and the invalid input error message appears on the relevant field.
    - Outcome: Pass

3. Verify that if the user has entered a value of the correct type in each field, when the next button is clicked the product details section is hidden and the product features section is shown.
    - Outcome: Pass

4. Verify that when the back button is clicked the product details section is shown and the product features section is hidden.
    - Outcome: Pass

5. Verify that when the add review button is clicked, the form is submits as the product details section has already been validated and the product features section contains no mandatory fields. Confirm that the product is added to the products database and the category filters lists are updated in the categories database. The user should be redirected to the product management page and a toast should appear informing them that the product has been successfully added.
    - Outcome: Pass

6. Verify that users who are not signed in cannot access the add product page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

7. Verify that whan standard users are signed in, they cannot access the add product page by manually typing in it's URL and are returned to the 403 page.
    - Outcome: Pass

## Edit Product page

1. Verify that the edit product page appears with the product details section displayed and looks good at all screen widths.
    - Outcome: Pass

2. Verify that if the user hasn't entered a value of the correct type in each field, when the next button is clicked the product details section is not hidden, the product details section is not shown and the invalid input error message appears on the relevant field.
    - Outcome: Pass

3. Verify that if the user has entered a value of the correct type in each field, when the next button is clicked the product details section is hidden and the product features section is shown.
    - Outcome: Pass

4. Verify that when the back button is clicked the product details section is shown and the product features section is hidden.
    - Outcome: Pass

5. Verify that when the update review button is clicked, the form is submits as the product details section has already been validated and the product features section contains no mandatory fields. Confirm that the product is updated in the products database and the category filters lists are in the categories database. The user should be redirected to the product management page and a toast should appear informing them that the product has been successfully updated.
    - Outcome: Pass

6. Verify that users who are not signed in cannot access the edit product page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

7. Verify that whan standard users are signed in, they cannot access the edit product page by manually typing in it's URL and are returned to the 403 page.
    - Outcome: Pass

## Delete Product page

1. Verify that users who are not signed in cannot access the delete product page by manually typing in it's URL and are returned to the sign in page.
    - Outcome: Pass

2. Verify that whan standard users are signed in, they cannot access the delete product page by manually typing in it's URL and are returned to the 403 page.
    - Outcome: Pass

## Contact Us Page

1. Verify that the contact us page appears as expected and looks good at all screen widths.
    - Outcome: Pass

2. Verify that the user's name and email address is automatically completed in the contact us form if the user is signed in.
    - Outcome: Pass

3. Verify that if the user hasn't entered a value of the correct type in each field, when the send message button is clicked the form does not submit and the invalid input error message appears on the relevant field.
    - Outcome: Pass

4. In the email address field, enter an email address that does not contain one character followed by an at sign, followed by two more characters and then a dot. Click on the send message button and verify that the form does not submit and shows the invalid input error message.
    - Outcome: Pass

5. Enter a valid value in each field and click the send message button. Verify that the form submits, the data inputted is added to the contact database and the HTML is dynamically updated to show a message thanking the user for their message.
    - Outcome: Pass


text:
[![Build Status](https://travis-ci.org/beevik/go6502.svg?branch=master)](https://travis-ci.org/beevik/go6502)
[![GoDoc](https://godoc.org/github.com/beevik/go6502?status.svg)](https://godoc.org/github.com/beevik/go6502)

go6502
======

_This project is currently under construction and is changing frequently._

go6502 is a collection of go packages that emulate a 6502 or 65C02 CPU. It
includes a CPU emulator, a cross-assembler, a disassembler, a debugger, and a
host that wraps them all together.

The interactive go6502 console application in the root directory provides
access to all of these features.

# Building the application

Make sure you have all the application's dependencies.

```
go get -u github.com/beevik/go6502
```

Then build go6502.

```
go build
```

# Tutorial

Let's start by considering the go6502 `sample.cmd` script:

```
load monitor.bin $F800
assemble file sample.asm
load sample.bin
reg PC START
d .
```

We'll describe what each of these commands does in greater detail later, but
for now know that they do the following things:
1. Load the `monitor.bin` binary file at memory address `F800`.
2. Assemble the `sample.asm` file using the go6502 cross-assembler, generating
   a `sample.bin` binary file and a `sample.map` source map file.
3. Load the `sample.bin` binary file and its corresponding `sample.map` source
   map file. The binary data is loaded into memory at the origin address
   exported during assembly into the `sample.map` file.
4. Set the program counter register to value of the `START` address, which
   was exported during assembly into the `sample.map` file.
5. Disassemble the first few lines of machine code starting from the program
   counter address.

To run this script, type the following on the command line:

```
go6502 sample.cmd
```

You should then see:

```
Loaded 'monitor.bin' to $F800..$FFFF.
Assembled 'sample.asm' to 'sample.bin'.
Loaded source map from 'sample.bin'.
Loaded 'sample.bin' to $1000..$10FF.
Register PC set to $1000.
1000-   A2 EE       LDX   #$EE
1002-   A9 05       LDA   #$05
1004-   20 19 10    JSR   $1019
1007-   20 1C 10    JSR   $101C
100A-   20 36 10    JSR   $1036
100D-   20 46 10    JSR   $1046
1010-   F0 06       BEQ   $1018
1012-   A0 3B       LDY   #$3B
1014-   A9 10       LDA   #$10
1016-   A2 56       LDX   #$56

1000-   A2 EE       LDX   #$EE      A=00 X=00 Y=00 PS=[------] SP=FF PC=1000 C=0
*
```

The output shows the result of running each sample script command. Once the
script has finished running, go6502 enters interactive mode and displays a `*`
prompt for further input.

Just before the prompt is a line starting with `1000-`. This line displays the
disassembly of the instruction at the current program counter address and the
state of the CPU registers. The `C` value indicates the number of CPU cycles
that have elapsed since the application started.

## Getting help

Let's enter our first interactive command. Type `help` to see a list of all
commands.

```
go6502 commands:
    annotate         Annotate an address
    assemble         Assemble commands
    breakpoint       Breakpoint commands
    databreakpoint   Data breakpoint commands
    disassemble      Disassemble code
    evaluate         Evaluate an expression
    execute          Execute a go6502 script file
    exports          List exported addresses
    load             Load a binary file
    memory           Memory commands
    quit             Quit the program
    register         View or change register values
    run              Run the CPU
    set              Set a configuration variable
    step             Step the debugger

*
```

To get more information about a command, type `help` followed by the command
name. In some cases, you will be shown a list of subcommands that must be used
with the command. Let's try `help step`.

```
* help step
Step commands:
    in               Step into next instruction
    over             Step over next instruction

*
```

This response indicates that the `step` command has two possible subcommands.
For example, if you wanted to step the CPU into the next instruction, you
would type `step in`.

Now let's get help on the `step in` command.

```
* help step in
Usage: step in [<count>]

Description:
   Step the CPU by a single instruction. If the instruction is a subroutine
   call, step into the subroutine. The number of steps may be specified as an
   option.

Shortcut: si

*
```

Every command has help text like this. Included in the help text is a
description of the command, a list of shortcuts that can be used to invoke the
command, and a usage hint indicating the arguments accepted by the command.
Usage arguments appear inside `<angle-brackets>`. Optional usage arguments
appear inside square `[<brackets>]`.

## Abbreviating commands

The go6502 application uses a "shortest unambiguous match" parser to process
commands. This means that when entering a command, you need only type the
smallest number of characters that uniquely identify it.  For instance,
instead of typing `quit`, you can type `q` since no other commands start with
the letter Q.

Most commands also have shortcuts. To discover a command's shortcuts, use
`help`.

## Stepping the CPU

Let's use one of the `step` commands to step the CPU by a single instruction.
Type `step in`.

```
1000-   A2 EE       LDX   #$EE      A=00 X=00 Y=00 PS=[------] SP=FF PC=1000 C=0
* step in
1002-   A9 05       LDA   #$05      A=00 X=EE Y=00 PS=[N-----] SP=FF PC=1002 C=2
*
```

By typing `step in`, you are telling the emulated CPU to execute the `LDX #$EE`
instruction at address `1000`. This advances the program counter to `1002`,
loads the value `EE` into the X register, and increases the CPU cycle counter
by 2 cycles.

Each time go6502 advances the program counter interactively, it disassembles
and displays the instruction to be executed next. It also displays the current
values of the CPU registers and cycle counter.

The shortcut for the `step in` command is `si`. Let's type `si 4` to step the
CPU by 4 instructions:

```
1002-   A9 05       LDA   #$05      A=00 X=EE Y=00 PS=[N-----] SP=FF PC=1002 C=2
* si 4
1004-   20 19 10    JSR   $1019     A=05 X=EE Y=00 PS=[------] SP=FF PC=1004 C=4
1019-   A9 FF       LDA   #$FF      A=05 X=EE Y=00 PS=[------] SP=FD PC=1019 C=10
101B-   60          RTS             A=FF X=EE Y=00 PS=[N-----] SP=FD PC=101B C=12
1007-   20 1C 10    JSR   $101C     A=FF X=EE Y=00 PS=[N-----] SP=FF PC=1007 C=18
*
```

This output shows that the CPU has stepped the next 4 instructions starting at
address `1002`.  Each executed instruction is disassembled and displayed along
with the CPU's register values at the start of each instruction. In this
example, a total of 18 CPU cycles have elapsed, and the program counter ends
at address `1007`.  The instruction at `1007` is waiting to be executed.

Note that the `step in` command stepped _into_ the `JSR $1019` subroutine call
rather than stepping _over_ it.  If you weren't interested in stepping through
all the code inside the subroutine, you could have used the `step over`
command instead. This would have caused the debugger to invisibly execute all
instructions inside the subroutine, returning the prompt only after the `RTS`
instruction has executed.

Since the CPU is about to execute another `JSR` instruction, let's try the
`step over` command (or `s` for short).

```
1007-   20 1C 10    JSR   $101C     A=FF X=EE Y=00 PS=[N-----] SP=FF PC=1007 C=18
* s
100A-   20 36 10    JSR   $1036     A=00 X=EE Y=00 PS=[-Z----] SP=FF PC=100A C=70
*
```

After stepping over the `JSR` call at address `1007`, all of the instructions
inside the subroutine at `101C` have been executed, and control has returned
at address `100A` after 52 CPU cycles have elapsed.

## Another shortcut: Hit Enter!

One shortcut you will probably use frequently is the blank-line short cut.
Whenever you hit the Enter key instead of typing a command, the go6502
application repeats the previously entered command.

Let's try hitting enter twice to repeat the `step over` command two more
times.

```
100A-   20 36 10    JSR   $1036     A=00 X=EE Y=00 PS=[-Z----] SP=FF PC=100A C=70
*
100D-   20 46 10    JSR   $1046     A=00 X=00 Y=00 PS=[-Z----] SP=FF PC=100D C=103
*
1010-   F0 06       BEQ   $1018     A=00 X=00 Y=00 PS=[-Z----] SP=FF PC=1010 C=136
*
```

go6502 has stepped over two more `JSR` instructions, elapsing another 66 CPU
cycles and leaving the program counter at `1010`.

## Disassembling code

Now let's disassemble some code at the current program counter address to get
a preview of the code about to be executed.  To do this, use the `disassemble`
command or its shortcut `d`.

```
* d .
1010-   F0 06       BEQ   $1018
1012-   A0 3B       LDY   #$3B
1014-   A9 10       LDA   #$10
1016-   A2 56       LDX   #$56
1018-   00          BRK
1019-   A9 FF       LDA   #$FF
101B-   60          RTS
101C-   A9 20       LDA   #$20
101E-   A5 20       LDA   $20
1020-   B5 20       LDA   $20,X
*
```

Note the `.` after the `d` command.  This is shorthand for the current program
counter address.  You may also pass an address or mathematical expression to
disassemble code starting from any address:

```
* d START+2
1002-   A9 05       LDA   #$05
1004-   20 19 10    JSR   $1019
1007-   20 1C 10    JSR   $101C
100A-   20 36 10    JSR   $1036
100D-   20 46 10    JSR   $1046
1010-   F0 06       BEQ   $1018
1012-   A0 3B       LDY   #$3B
1014-   A9 10       LDA   #$10
1016-   A2 56       LDX   #$56
1018-   00          BRK
*
```

By default, go6502 disassembles 10 instructions, but you can disassemble a
different number of instructions by specifying a second argument to the
command.

```
* d . 3
1010-   F0 06       BEQ   $1018
1012-   A0 3B       LDY   #$3B
1014-   A9 10       LDA   #$10
*
```

If you hit the Enter key after using a disassemble command, go6502 will
continue disassembling code from where it left off.

```
*
1016-   A2 56       LDX   #$56
1018-   00          BRK
1019-   A9 FF       LDA   #$FF
*
```

If you don't like the number of instructions that go6502 is configured to
disassemble by default, you can change it with the `set` command:

```
* set DisasmLines 20
```

## Annotating code

It's often useful to annotate a line of code with a comment. I use annotations
to leave notes to myself when I'm trying to understand how some piece of
machine code works.

Let's consider again the code loaded by the sample script.

```
* d $1000
1000-   A2 EE       LDX   #$EE
1002-   A9 05       LDA   #$05
1004-   20 19 10    JSR   $1019
1007-   20 1C 10    JSR   $101C
100A-   20 36 10    JSR   $1036
100D-   20 46 10    JSR   $1046
1010-   F0 06       BEQ   $1018
1012-   A0 3B       LDY   #$3B
1014-   A9 10       LDA   #$10
1016-   A2 56       LDX   #$56
*
```

The `JSR` instruction at address `1007` calls a subroutine that uses all
the addressing mode variants of the `LDA` command.  Let's add an annotation
to that line of code to remind ourselves later what its purpose is.

```
* annotate $1007 Use different forms of the LDA command
*
```

Now whenever we disassemble code that includes the instruction at address
`1007`, we will see our annotation.

```
* d $1000
1000-   A2 EE       LDX   #$EE
1002-   A9 05       LDA   #$05
1004-   20 19 10    JSR   $1019
1007-   20 1C 10    JSR   $101C     ; Use different forms of the LDA command
100A-   20 36 10    JSR   $1036
100D-   20 46 10    JSR   $1046
1010-   F0 06       BEQ   $1018
1012-   A0 3B       LDY   #$3B
1014-   A9 10       LDA   #$10
1016-   A2 56       LDX   #$56
*
```

To remove an annotation, use the `annotate` command with an address but without a description.

## Dumping memory

Another common task is dumping the contents of memory.  To do this, use the
`memory dump` command, or `m` for short.

```
* m $1000
1000- A2 EE A9 05 20 19 10 20   "n). ..
1008- 1C 10 20 36 10 20 46 10   .. 6. F.
1010- F0 06 A0 3B A9 10 A2 56   p. ;)."V
1018- 00 A9 FF 60 A9 20 A5 20   .).`) %
1020- B5 20 A1 20 B1 20 AD 00   5 ! 1 -.
1028- 02 AD 20 00 BD 00 02 B9   .- .=..9
1030- 00 02 8D 00 03 60 A2 20   .....`"
1038- A6 20 B6 20 AE 00 02 AE   & 6 ....
*
```

Memory dumps include hexadecimal and ASCII representations of the dumped
memory, starting from the address you specified. By default, the memory
dump shows 64 bytes, but you can specify a different number of bytes to
dump with a second argument.

```
* m $1000 16
1000- A2 EE A9 05 20 19 10 20   "n). ..
1008- 1C 10 20 36 10 20 46 10   .. 6. F.
*
```

As with the `disassemble` command, you can enter a blank line to continue
dumping memory from where you left off:

```
*
1010- F0 06 A0 3B A9 10 A2 56   p. ;)."V
1018- 00 A9 FF 60 A9 20 A5 20   .).`) %
*
1020- B5 20 A1 20 B1 20 AD 00   5 ! 1 -.
1028- 02 AD 20 00 BD 00 02 B9   .- .=..9
*
```

To change the default number of bytes that are dumped by a `memory dump`
command, use the `set` command:

```
* set MemDumpBytes 128
```

## Modifying memory

To change the contents of memory, use the `memory set` command, or `ms` for
short.

```
* ms 0x800 $5A $59 $58 $57
* m 0x800 4
0800- 5A 59 58 57               ZYXW
*
```

A sequence of memory values must be separated by spaces and may include
simple hexadecimal values like shown in the example above, or mathematical
expressions like in the following:

```
* ms 0x800 12*2 'A' 1<<4 $0F^$05
* m 0x800 4
0800- 18 41 10 0A               .A..
*
```

## Aside: Number formats

go6502 accepts numbers in multiple formats. In most of the examples we've seen
so far, addresses and byte values have been specified in base-16 hexadecimal
format using the `$` prefix.

The following table lists the number-formatting options understood by go6502:

 Prefix   | Format      | Base | Example     | Comment
----------|-------------|:----:|-------------|-------------------------
 _(none)_ | Decimal     | 10   | -151        | See note about hex mode.
 `$`      | Hexadecimal | 16   | `$FDED`     |
 `0x`     | Hexadecimal | 16   | `0xfded`    |
 `%`      | Binary      | 2    | `%01011010` |
 `0b`     | Binary      | 2    | `0b01011010`|
 `0d`     | Decimal     | 10   | `0d128`     | Useful in hex mode.

If you prefer to work primarily with hexadecimal numbers, you can change the
"hex mode" setting using the `set` command.

```
* set HexMode true
```

In hex mode, numeric values entered without a prefix are interpreted as
hexadecimal values. However, because hexadecimal numbers include the letters
`A` through `F`, the interpreter is unable to distinguish between a number and
an identifier. So identifiers are not allowed in hex mode.

## Inspecting and changing registers

The 6502 registers can be inspected using the `register` command, or `r`
for short.

```
* r
1000-   A2 EE       LDX   #$EE      A=00 X=00 Y=00 PS=[------] SP=FF PC=1000 C=0
*
```

If you wish to change a register value, simply add additional arguments.

```
* r A $80
Register A set to $80.
1000-   A2 EE       LDX   #$EE      A=80 X=00 Y=00 PS=[------] SP=FF PC=1000 C=0
*
```

Registers you can change this way include `A`, `X`, `Y`, `PC` and `SP`.

You can also change the CPU's status flags. Simply provide one of the flag
names (`N`, `Z`, `C`, `I`, `D` or `V`) instead of a register name.

```
* r Z 1
Status flag ZERO set to true.
1000-   A2 EE       LDX   #$EE      A=80 X=00 Y=00 PS=[-Z----] SP=FF PC=1000 C=0
* r Z 0
Status flag ZERO set to false.
1000-   A2 EE       LDX   #$EE      A=80 X=00 Y=00 PS=[------] SP=FF PC=1000 C=0
*
```

Further info about the `register` command can be found by typing
`help register`.

## Evaluating expressions

Sometimes it's useful to have a calculator on hand to compute the result of a
simple math expression. go6502 has a built-in expression evaluator in the form
of the `evaluate` command, or `e` for short. The evaluator understands most C
expression operators.

```
* e 1<<4
$0010
* e ($FF ^ $AA) | $0100
$0155
* e ('A' + 0x20) | 0x80
$00E1
* e 0b11100101
$00E5
* e -151
$FF69
```

Because go6502 is written for an 8-bit CPU with a 16-bit address space, the
results of all evaluations are displayed as 16-bit values.

## Assembling source code

go6502 has a built-in cross-assembler. To assemble a file on disk into a raw
binary file containing 6502 machine code, use the `assemble file` command (or
`a` for short).

```
* a sample.asm
Assembled 'sample.asm' to 'sample.bin'.
```

The `assemble file` command loads the specified source file, assembles it, and
if successful outputs a raw `.bin` file containing the machine code into the
same directory.  It also produces a `.map` source map file, which is used to
store (1) the "origin" memory address the machine code should be loaded at,
(2) a list of exported address identifiers, and (3) a mapping between source
code lines and memory addresses.

Once assembled, the binary file and its associated source map can be loaded
into memory using the `load` command.

```
* load sample.bin
Loaded source map from 'sample.map'.
Loaded 'sample.bin' to $1000..$10FF.
```

_To be continued..._


text:
---
title: Sublime Text tips
layout: post
categories: blog
excerpt:
tags: [tips, runningfile, sublimetext]
image:
  feature:
comments: True
published: True
---

Just an aide-memoire for myself really. When referring to keybindings then I will use `C` to indicate `Command` (OS X) or `Control` (Windows).

- `C-D` expands the current selection to the next word, but it's easy to overshoot. In which case, `C-U` will undo (called a soft undo, and therefore distinct to `C-Z` and `C-shift-Z`). A soft redo is `C-shift-U`. (tip via [Brett Terpstra](http://brettterpstra.com/2014/07/23/sublime-text-selections/)).

branch_name: refs/heads/develop

gha_language: JavaScript


text:
---
layout: post
title: LC 219. Contains Duplicate II
categories: [easy, arrays]
author: Nilanjan Deb
---
Here I use unordered map to store position data to its corresponding value. Then traversing over the array and check for every numbers as it appear before or not and if it's appear if the distance between them is less then the desired value. Remember about Corner cases.

This is my CPP solution.

```
class Solution {
public:
    bool containsNearbyDuplicate(vector<int>& nums, int k) {
        if(nums.size()==0 || nums.size()==1 || k==0){
            return false;
        }
        unordered_map<int,int>umap;
        for(int i=0;i<nums.size();i++){
            if(umap.find(nums[i])!=umap.end() && i - umap[nums[i]]<=k)
                return true;
            umap[nums[i]] = i;
        }
        return false;
    }
};
```
Time Complexity O(n);

gha_language: SCSS


text:
# Efficient DataFlow

This tutorial gives an overview of how to build an efficient DataFlow, using ImageNet
dataset as an example.
Our goal in the end is to have
a __generator__ which yields preprocessed ImageNet images and labels as fast as possible.
Since it is simply a generator interface, you can use the DataFlow in other frameworks (e.g. Keras)
or your own code as well.

We use ILSVRC12 training set, which contains 1.28 million images.
The original images (JPEG compressed) are 140G in total.
The average resolution is about 400x350 [[1]].
Following the [ResNet example](../examples/ResNet), we need images in their original resolution,
so we will read the original dataset instead of a down-sampled version, and
apply complicated preprocessing to it.
We will need to reach a speed of, roughly 1000 images per second, to keep GPUs busy.

Note that the actual performance would depend on not only the disk, but also
memory (for caching) and CPU (for data processing).
You will need to tune the parameters (#processes, #threads, size of buffer, etc.)
or change the pipeline for new tasks and new machines to achieve the best performance.

This tutorial is quite complicated because you do need this knowledge of hardware & system to run fast on ImageNet-sized dataset.
However, for __small datasets__ (e.g., several GBs), a proper prefetch should work well enough.

## Random Read

We start from a simple DataFlow:
```python
from tensorpack import *
ds0 = dataset.ILSVRC12('/path/to/ILSVRC12', 'train', shuffle=True)
ds1 = BatchData(ds0, 256, use_list=True)
TestDataSpeed(ds1).start_test()
```

Here `ds0` simply reads original images from the filesystem. It is implemented simply by:
```python
for filename, label in filelist:
  yield [cv2.imread(filename), label]
```

And `ds1` batch the datapoints from `ds0`, so that we can measure the speed of this DataFlow in terms of "batch per second".
By default, `BatchData`
will stack the datapoints into an `numpy.ndarray`, but since original images are of different shapes, we use
`use_list=True` so that it just produces lists.

On an SSD you probably can already observe good speed here (e.g. 5 it/s, that is 1280 samples/s), but on HDD the speed may be just 1 it/s,
because we are doing heavy random read on the filesystem (regardless of whether `shuffle` is True).

We will now add the cheapest pre-processing now to get an ndarray in the end instead of a list
(because TensorFlow will need ndarray eventually):
```eval_rst
.. code-block:: python
	  :emphasize-lines: 2,3

		ds = dataset.ILSVRC12('/path/to/ILSVRC12', 'train', shuffle=True)
		ds = AugmentImageComponent(ds, [imgaug.Resize(224)])
		ds = BatchData(ds, 256)
```
You'll start to observe slow down after adding more pre-processing (such as those in the [ResNet example](../examples/ResNet/imagenet-resnet.py)).
Now it's time to add threads or processes:
```eval_rst
.. code-block:: python
	  :emphasize-lines: 3

		ds0 = dataset.ILSVRC12('/path/to/ILSVRC12', 'train', shuffle=True)
		ds1 = AugmentImageComponent(ds0, lots_of_augmentors)
		ds = PrefetchDataZMQ(ds1, nr_proc=25)
		ds = BatchData(ds, 256)
```
Here we started 25 processes to run `ds1`, and collect their output through ZMQ IPC protocol.
Using ZMQ to transfer data is faster than `multiprocessing.Queue`, but data copy (even
within one process) can still be quite expensive when you're dealing with large data.
For example, to reduce copy overhead, the ResNet example deliberately moves certain pre-processing (the mean/std normalization) from DataFlow to the graph.
This way the DataFlow only transfers uint8 images as opposed float32 which takes 4x more memory.

Alternatively, you can use multi-threading like this:
```python
ds0 = dataset.ILSVRC12('/path/to/ILSVRC12', 'train', shuffle=True)
augmentor = AugmentorList(lots_of_augmentors)
ds1 = ThreadedMapData(
    ds0, nr_thread=25,
    map_func=lambda x: augmentor.augment(x), buffer_size=1000)
# ds1 = PrefetchDataZMQ(ds1, nr_proc=1)
ds = BatchData(ds1, 256)
```
Since no `fork()` is happening here, there'll be only one instance of `ds0`.
25 threads will fetch data from `ds0`, run the augmentor function and
put results into a buffer of size 1000.
To reduce the effect of GIL, you can then uncomment the line so that everything above it (including all the
threads) happen in an independent process.

There is no answer whether it is faster to use threads or processes.
Processes avoid the cost of GIL but bring the cost of communication.
You can also try a combination of both (several processes each with several threads).

## Sequential Read

Random read is usually not a good idea, especially if the data is not on a SSD.
We can also dump the dataset into one single file and read it sequentially.

```python
from tensorpack import *
class RawILSVRC12(DataFlow):
    def __init__(self):
        meta = dataset.ILSVRCMeta()
        self.imglist = meta.get_image_list('train')
        # we apply a global shuffling here because later we'll only use local shuffling
        np.random.shuffle(self.imglist)
        self.dir = os.path.join('/path/to/ILSVRC', 'train')
    def get_data(self):
        for fname, label in self.imglist:
            fname = os.path.join(self.dir, fname)
            with open(fname, 'rb') as f:
                jpeg = f.read()
            jpeg = np.asarray(bytearray(jpeg), dtype='uint8')
            yield [jpeg, label]
    def size(self):
        return len(self.imglist)
ds0 = RawILSVRC12()
ds1 = PrefetchDataZMQ(ds0, nr_proc=1)
dftools.dump_dataflow_to_lmdb(ds1, '/path/to/ILSVRC-train.lmdb')
```
The above script builds a DataFlow which produces jpeg-encoded ImageNet data.
We store the jpeg string as a numpy array because the function `cv2.imdecode` expect it later.
We use 1 prefetch process to speed up. If `nr_proc>1`, `ds1` will take data
from several forks of `ds0` and will not be identical to `ds0` any more.

It will generate a database file of 140G. We build a DataFlow to read the LMDB file sequentially:
```
from tensorpack import *
ds = LMDBData('/path/to/ILSVRC-train.lmdb', shuffle=False)
ds = BatchData(ds, 256, use_list=True)
TestDataSpeed(ds).start_test()
```
Depending on whether the OS has cached the file for you (and how large the RAM is), the above script
can run at a speed of 10~130 it/s, roughly corresponding to 250MB~3.5GB/s bandwidth. You can test
your cached and uncached disk read bandwidth with `sudo hdparm -Tt /dev/sdX`.
As a reference, on Samsung SSD 850, the uncached speed is about 16it/s.

```eval_rst
.. code-block:: python
	  :emphasize-lines: 2

	  ds = LMDBData('/path/to/ILSVRC-train.lmdb', shuffle=False)
	  ds = LocallyShuffleData(ds, 50000)
	  ds = BatchData(ds, 256, use_list=True)
```
Instead of shuffling all the training data in every epoch (which would require random read),
the added line above maintains a buffer of datapoints and shuffle them once a while.
It will not affect the model as long as the buffer is large enough,
but it can also consume much memory if too large.

Then we add necessary transformations:
```eval_rst
.. code-block:: python
    :emphasize-lines: 3-5

    ds = LMDBData(db, shuffle=False)
    ds = LocallyShuffleData(ds, 50000)
    ds = LMDBDataPoint(ds)
    ds = MapDataComponent(ds, lambda x: cv2.imdecode(x, cv2.IMREAD_COLOR), 0)
    ds = AugmentImageComponent(ds, lots_of_augmentors)
    ds = BatchData(ds, 256)
```

1. `LMDBDataPoint` deserialize the datapoints (from string to [jpeg_string, label])
2. Use OpenCV to decode the first component into ndarray
3. Apply augmentations to the ndarray

Both imdecode and the augmentors can be quite slow. We can parallelize them like this:
```eval_rst
.. code-block:: python
    :emphasize-lines: 3,7

    ds = LMDBData(db, shuffle=False)
    ds = LocallyShuffleData(ds, 50000)
    ds = PrefetchData(ds, 5000, 1)
    ds = LMDBDataPoint(ds)
    ds = MapDataComponent(ds, lambda x: cv2.imdecode(x, cv2.IMREAD_COLOR), 0)
    ds = AugmentImageComponent(ds, lots_of_augmentors)
    ds = PrefetchDataZMQ(ds, 25)
    ds = BatchData(ds, 256)
```

Since we are reading the database sequentially, having multiple identical instances of the
underlying DataFlow will result in biased data distribution. Therefore we use `PrefetchData` to
launch the underlying DataFlow in one independent process, and only parallelize the transformations.
(`PrefetchDataZMQ` is faster but not fork-safe, so the first prefetch has to be `PrefetchData`. This is [issue#138](https://github.com/ppwwyyxx/tensorpack/issues/138))

Let me summarize what the above DataFlow does:

1. One process reads LMDB file, shuffle them in a buffer and put them into a `multiprocessing.Queue` (used by `PrefetchData`).
2. 25 processes take items from the queue, decode and process them into [image, label] pairs, and
	 send them through ZMQ IPC pipes.
3. The main process takes data from the pipe and feeds it into the graph, according to
	 how the `Trainer` is implemented.

The above DataFlow can run at a speed of 5~10 batches per second if you have good CPUs, RAM, disks and augmentors.
As a reference, tensorpack can train ResNet-18 (a shallow ResNet) at 4.5 batches (of 256 samples) per second on 4 old TitanX.
So DataFlow will not be a serious bottleneck if configured properly.

## More Efficient DataFlow

To work with larger datasets (or smaller networks, or more/better GPUs) you could be severely bounded by CPU or disk speed of a single machine.
One way is to optimize the preprocessing routine (e.g. write something in C++ or use TF reading operators).
Another way to scale is to run DataFlow in a distributed fashion and collect them on the
training machine. E.g.:
```python
# Data Machine #1, process 1-20:
df = MyLargeData()
send_dataflow_zmq(df, 'tcp://<IP_ADDRESS>:8877')
```
```python
# Data Machine #2, process 1-20:
df = MyLargeData()
send_dataflow_zmq(df, 'tcp://<IP_ADDRESS>:8877')
```
```python
# Training Machine, process 1-10:
df = MyLargeData()
send_dataflow_zmq(df, 'ipc:///tmp/ipc-socket')
```
```python
# Training Machine, training process
df = RemoteDataZMQ('ipc:///tmp/ipc-socket', 'tcp://<IP_ADDRESS>:8877')
TestDataSpeed(df).start_test()
```

[1]: #ref

[[1]]. [ImageNet: A Large-Scale Hierarchical Image Database](http://www.image-net.org/papers/imagenet_cvpr09.pdf), CVPR09

repository: KuribohG/tensorpack

repo_name: KuribohG/tensorpack


text:
# StackBook package for Atom Code Editor

StackBook works to make StackOverflow reading like a Book.

![A screenshot of your package](https://f.cloud.github.com/assets/69169/2290250/c35d867a-a017-11e3-86be-cd7c5bf3ff9b.gif)

repository: CoryXie/StackBook

repo_name: CoryXie/StackBook


text:
# Dumber
Z: drive repackager for Symbian platform, compatible for all Symbian platform.

## Instructions:
* Please jailbreak your Symbian phone first.
* After that, open in menu folder "RnD Tools" and run **Dumber**
* Leave your phone there, if when you come back there is an error message or app exits, that means that there is not enough space or there is a error from the app. Else, a success message will display. Press any key to exit.
* Your repackage file should be in *E:* drive.

## Specification:
* EKA2L1 uses the RPKG format to package all *Z:* drive contents. Z: drive should have at least ROM (on previous platform), or is mounted with both *ROFS + ROM*. All contents are repackage to a single file without any compression. All entries should be sort by UID.
* Header
   - Magic: char[4] (RPKG)
   - Version:
      + Major: char
      + Minor: char
      + Build: short
   - File count: uint32_t
* Entry sections: *File count* * entries
   - Entry:
      + Attribute: Uint64_t
      + Time: TTime
      + FullPathLength: Uint64_t
      + PathStringRawData: UCS-2 string with length declared above
      + DataSize: Uint64_t


text:
# syslog

## Usage

The primary usage the library is with the golang package. The Ruby library was only a proof of concept.

### Golang

```sh
go get github.com/jtarchie/syslog
```

```go

import "github.com/jtarchie/syslog/pkg/log"

// ... some code far away ...
log, offset, err := syslog.Parse(line)
if err != nil {
  println("Error", err)
}
println("Message", string(log.Message()))
```

repository: jtarchie/syslog

gha_language: Go

repo_name: jtarchie/syslog


text:
# Gold Mine Problem using Dynamic Programming
Language used : **Python 3**

## 🎯 Aim
The aim of this script is to find out the maximum amount of gold that can be collected from the gold mine.

## 👉 Purpose
The main purpose of this script is to show the implementation of Dynamic Programming to find out the maximum amount of gold can be collected from the gold mine.

## 📄 Description
Given a gold mine of n*m dimensions. Each field in this mine contains a positive integer which is the amount of gold in tons. Initially the miner is at first column but can be at any row. He can move only `(right->,right up /,right down\)` that is from a given cell, the miner can move to the cell diagonally up towards the right or right or diagonally down towards the right. Find out maximum amount of gold he can collect.
Examples:

```
Input : mat[][] = {{1, 3, 3},
                   {2, 1, 4},
                  {0, 6, 4}};
Output : 12
{(1,0)->(2,1)->(1,2)}

Input: mat[][] = { {1, 3, 1, 5},
                   {2, 2, 4, 1},
                   {5, 0, 2, 3},
                   {0, 6, 1, 2}};
Output : 16
(2,0) -> (1,1) -> (1,2) -> (0,3) OR
(2,0) -> (3,1) -> (2,2) -> (2,3)
```
## 🧮 Algorithm
- Create a 2-D matrix `goldTable[][])` of the same as given matrix `mat[][]`. If we observe the question closely, we can notice following.
- Amount of gold is positive, so we would like to cover maximum cells of maximum values under given constraints.
- In every move, we move one step toward right side. So we always end up in last column. If we are at the last column, then we are unable to move right
- If we are at the first row or last column, then we are unable to move right-up so just assign 0 otherwise assign the value of `goldTable[row-1][col+1]` to right_up. If we are at the last row or last column, then we are unable to move right down so just assign 0 otherwise assign the value of `goldTable[row+1][col+1]` to right up.
- Now find the maximum of right, right_up, and right_down and then add it with that `mat[row][col]`. At last, find the maximum of all rows and first column and return it.

## 💻 Input and Output
- **Test Case 1 :**
```
Input Given :
{ {1, 3, 1, 5},
{2, 2, 4, 1},
{5, 0, 2, 3},
{0, 6, 1, 2}};
```

![](https://github.com/abhisheks008/PyAlgo-Tree/blob/main/Dynamic%20Programming/Gold%20Mine%20Problem/Images/gold1.PNG)

- **Test Case 2 :**
```
Input Given :
{{1, 3, 3},
{2, 1, 4},
{0, 6, 4}};
```
![](https://github.com/abhisheks008/PyAlgo-Tree/blob/main/Dynamic%20Programming/Gold%20Mine%20Problem/Images/gold2.PNG)

## ⏰ Time and Space complexity
- **Time Complexity :** `O(m*n)`.
- **Space Complexity :** `O(m*n)`.

---------------------------------------------------------------
## 🖋 Author
**Code contributed by, _Abhishek Sharma_, 2021 [@abhisheks008](github.com/abhisheks008)**

[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)

path: /Dynamic Programming/Gold Mine Problem/README.md


text:
# Copy'n Paste Web App
Share text, URLs, etc. between your devices or within groups with two clicks.

I coded this, cause I always need to share URLs, test-input, IDs etc. between my Linux development PC and the iPad or Android Phone -- without chatting and skyping with myself.

# Try it online
It's [installed here](http://mh-svr.de/copy/), you're free to use it.

# Set Up
1. Clone the GIT source to local files (git clone <GIThub-URL>
2. Edit the `web/db_connection.php` script to point to your database.
3. Copy files from the `web` folder to your hosting provider, e.g. to folder `/copypaste`.
1. Create a database calling the `https://myhost.com/copypaste/create_tables.php`

# Usage
It's easy, just open the URL base folder, e.g. `https://myhost.com/copypaste/`

You can create a new copy-paste page.

To load an exiting one, just enter the (5 digit) key and click the link.

On the copy-paste page you can past new text using the form or copy text you pasted already.

# TODO
- implement secret

# License
MIT License (MIT), Copyright (c) 2015 ma-ha

repository: ma-ha/copypaste

repo_name: ma-ha/copypaste


text:
# How to try sample program.

```shell script
# cd to this directory
cd sample/postgres

# run containers
docker-compose up -d

# execute sample program using pg8000
# If error "ModuleNotFoundError: No module named 'pg8000'" occurs, wait a few tens of seconds and try again.
docker-compose exec py python sample_pg8000.py

# execute sample program using sqlalchemy with psycopg2
# If error "ModuleNotFoundError: No module named 'pg8000'" occurs, wait a few tens of seconds and try again.
docker-compose exec py python sample_sqlalchemy.py

# exit containers
docker-compose down
```

repository: gomachssm/twsqlparser

gha_language: Python

repo_name: gomachssm/twsqlparser


text:
Transacted Hollowing
==========

[![Build status](https://ci.appveyor.com/api/projects/status/fpgr73aul25gc6kp?svg=true)](https://ci.appveyor.com/project/hasherezade/transacted-hollowing)

Transacted Hollowing - a PE injection technique. A hybrid between [Process Hollowing](https://github.com/hasherezade/libpeconv/tree/master/run_pe) and [Process Doppelgänging](https://github.com/hasherezade/process_doppelganging).

![](https://blog.malwarebytes.com/wp-content/uploads/2018/08/osildr1-2_.png)

More info [here](https://blog.malwarebytes.com/threat-analysis/2018/08/process-doppelganging-meets-process-hollowing_osiris/)

Characteristics:
-

+ Payload mapped as `MEM_IMAGE` (unnamed: not linked to any file)
+ Sections mapped with original access rights (no `RWX`)
+ Payload connected to PEB as the main module
+ Remote injection supported (but only into a newly created process)

Supported injections:
-
If the loader was built as 32 bit:
```
32 bit payload -> 32 bit target
```
If the loader was built as 64 bit:
```
64 bit payload -> 64 bit target
32 bit payload -> 32 bit target
```

How to use the app:
-
Supply 2 commandline arguments:

```
[payload_path] [target_path]
```

Payload is the PE to be executed impersonating the Target.


text:
Data Integration
==============

Integrate data focus on combining information from multiple tables or records to create new records or value.

The integrate data process can be done by different ways such as:

- two or more tables with different information about the same object can be merged together to create a new table with fields from the source tables
- perform the aggregation operation in which new values are created from summarizing information from various records and/or tables.


text:
# Django urls introspect

Introspect django urlpatterns to find potential bugs. Comes in handy during refactoring projects or as an extra sanity check

[ blog post ](http://www.szotten.com/david/introspecting-django-urls-for-fun-and-profit.html)

## Usage

    ./manage check_urs
    edit-members: url provides kwargs ['member_id'] not in the view sinature
    edit-members: view requires kwargs ['member_code'] not in the url kwargs

## License
MIT License

repository: davidszotten/django-urls-introspect

repo_name: davidszotten/django-urls-introspect


text:
# Team Contract

## A. Goals

- To do work that we are qualified and capable of doing.
- Operate in a proactive manner, anticipating potential problems and working to prevent them before they happen.
- Keep every team member informed.
- Work together through Google Doc to make sure works will be distributed in a fair and equitable way.
- Focus on what is best for the project as a whole, which means it will be acceptable for one team member to do more work than another under certain conditions.
- Expected working length would be two to three days for each lab to be completed.
- See the project through to completion.

## B. Meeting Norms

- Daily meeting and modification until each lab finished.
- No time restriction for each meeting, end daily meeting until we finished the part that we both agreed with from the begining of the meeting.
- Be honest and open during meetings.
- Encourage a diversity of opinions on all topics.
- Avoiding placing blame when things go wrong. We will discuss the process and explore how it can be improved.
- Let another team member be aware of any changes made as soon as possible.

## C. Work Norms

- Since lab 1 is hard to split jobs, we will work together on Google Doc and focus on what is best for the project.
- Quality of work are expected to satisfy the rubric, and to be verified by each group mumber.
- Listen openly to each other's points of view.
- Regard conflit as normal and as an opportunity to grow.
- When conflicts happened, choose an appropriate time place to discuss and explore the conflict, seek to find some common ground for agreement.
- Acknowledge valid points that the other person has made.
- When time conflict happened, seek to find other solutions through communication

## D. Decision Making

- Since we are working together at the same time for lab1 and only two of us in the group, concensus needed before making decision.
- Seek to find all needed information and data.
- Discuss criteria (cost, time, impact, ect.) for making a decision before choosing an option.
- Encourage and explore different interpretations of data.
- If one of us fixates on a particular idea, we can go for TA or Firas to ask for more opinion. And then seek to find agreement.

Fengcheng Liu

Haotian Jin

gha_language: Jupyter Notebook


text:
# neuralintents

Still in a buggy alpha state.

## Setting Up A Basic Assistant

```python

from neuralintents import GenericAssistant

assistant = GenericAssistant('intents.json', model_name="test_model")
assistant.train_model()
assistant.save_model()

done = False

while not done:
    message = input("Enter a message: ")
    if message == "STOP":
        done = True
    else:
        assistant.request(message)
```

## Binding Functions To Requests

```python
from neuralintents import GenericAssistant

def function_for_greetings():
    print("You triggered the greetings intent!")
    # Some action you want to take

def function_for_stocks():
    print("You triggered the stocks intent!")
    # Some action you want to take

mappings = {'greeting' : function_for_greetings, 'stocks' : function_for_stocks}

assistant = GenericAssistant('intents.json', intent_methods=mappings ,model_name="test_model")
assistant.train_model()
assistant.save_model()

done = False

while not done:
    message = input("Enter a message: ")
    if message == "STOP":
        done = True
    else:
        assistant.request(message)
```
## Sample intents.json File
```json
{"intents": [
  {"tag": "greeting",
    "patterns": ["Hi", "How are you", "Is anyone there?", "Hello", "Good day", "Whats up", "Hey", "greetings"],
    "responses": ["Hello!", "Good to see you again!", "Hi there, how can I help?"],
    "context_set": ""
  },
  {"tag": "goodbye",
    "patterns": ["cya", "See you later", "Goodbye", "I am Leaving", "Have a Good day", "bye", "cao", "see ya"],
    "responses": ["Sad to see you go :(", "Talk to you later", "Goodbye!"],
    "context_set": ""
  },
  {"tag": "stocks",
    "patterns": ["what stocks do I own?", "how are my shares?", "what companies am I investing in?", "what am I doing in the markets?"],
    "responses": ["You own the following shares: ABBV, AAPL, FB, NVDA and an ETF of the S&P 500 Index!"],
    "context_set": ""
  }
]
}
```

repository: charles-shaju/neuralintents

repo_name: charles-shaju/neuralintents


text:
# LMR
Luna's Magic Reference

## Description
Intended to be a detailed reference for ICPC contests, or for programming contests in general. This reference is aimed for regional-final level competition/Codeforces Div.1 contests, so some simpler algorithms (Shortest Path, etc.) are not included.

## Attribution
Some of the code is written by me, but much of it is done by students in my university or by others from Internet and it is a bit difficult to find the original author.

## Progress
Done. Feel free to fork it for your own likeness, and do tell me if you find some bugs or have a piece of code that fits within the context!

repository: Nisiyama-Suzune/LMR

repo_name: Nisiyama-Suzune/LMR


text:
# Property Pro Lite

[![Build Status](https://travis-ci.org/amilykassim/PropertyProLite.svg?branch=develop)](https://travis-ci.org/amilykassim/PropertyProLite)       [![Coverage Status](https://coveralls.io/repos/github/amilykassim/PropertyProLite/badge.svg?branch=develop)](https://coveralls.io/github/amilykassim/PropertyProLite?branch=develop)       [![Maintainability](https://api.codeclimate.com/v1/badges/3dbe4a90345d8b162c9b/maintainability)](https://codeclimate.com/github/amilykassim/PropertyProLite/maintainability)

# Project Overview

Property Pro Lite is a platform to buy and sell properties across the world.

# Features

- A user can create an account if he doesn't have one
- A user can log in to his account if he does have it
- A user can view all listed properties to buy
- A user can view more details about the property listed
- A user can sell a property
- A user can buy a property
- A user can log out to his account
- An admin user can update his listed property
- An admin user can delete his listed property
- An admin user can mark his property as sold
- User can reset his/her forgoten password

# Demo
![alt text](./UI/assets/preview.png)
# Built With
- Node.js
- Express framework
- Html
- CSS
- Javascript

# Api Endpoints

- POST    /auth/signup                                  - Create user account
- POST    /auth/signin                               - Login a user
- POST    /property                                  - Create a property ad
- PATCH   /property/<:property-id>                   - Update property data
- PATCH   /property/<:property-id>/sold              - Mark a property as sold so users know it’s no longer available.
- DELETE  /property/<:property-id>                   - Delete a property advert.

- GET     /property/<:property-id>   - View a specific property advert.

# API documentation

 The documenation of the API can be found at :
 <a href="https://property-pro-lite-amily.herokuapp.com/api-docs"> https://property-pro-lite-amily.herokuapp.com/api-docs </a>

# Known Issues
API is on point, i.e all endpoints works fine, but
- The client side doesn't have API links implemented yet, so you can query the api using your browser or postman.
- The data is not persisted on the database yet, i.e if you restart the application the data are erased.

# Installation
- Run git clone https://github.com/amilykassim/PropertyProLite.git
- Run cd `Property Pro Lite` to navigate to the project directory
- Run npm `install` to download and install all packages
- Run npm `start` to start the server
- And then Test the end points using postman or your browser

# Contributing
> You can contribute to this project by forking the project github.com/amilykassim/PropertyProLite.git

> And then submit your changes by creating a new pull request github.com/amilykassim/PropertyProLite/compare

# License
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
- MIT license
- Copyright (c) AMILY Kassim

repository: amilykassim/PropertyProLite

repo_name: amilykassim/PropertyProLite


text:
---
author: Sean
comments: true
date: 2012-08-15 16:45:04+00:00
layout: post
slug: what-to-do-if-your-email-is-hacked
title: What to do if your email's hacked
categories:
- Online
header-img: "img/what-to-do-if-email-hacked.jpg"
meta-description: Four simple things you can do to help yourself if your email account has been hacked and how to alert yourself in the future if your email is hacked
---

1. Start with changing your password on your account. As with any scenario, the primary step is to stop any harm. This will resolve most issues, depending on how your account was compromised.

2. Add a fake email address to your list of contacts<EMAIL_ADDRESS>This email address will probably be the first contact alphabetically in your address book, therefore will become the primary recipient of a spam email from a hacker. You will receive a mail failure notice as soon as any e-mail to this address isn't delivered. This is often also a fast means of checking whether or not ever-changing your password on your email account worked.

3. Update and run your antivirus program on your PC such as [AVG](http://free.avg.com/), [Kaspersky](http://www.kaspersky.co.uk/), Norton, etc. (I do not recommend McAfee due to past experience) to make sure your PC isn’t infected.

4. Write to everybody in your contact list and make them aware that your email was hacked and warn them to not click on the link of the previous email:

  * Make sure to send email your contacts by using the BCC line of your email so you're not sending out people’s non-public email addresses to others. (Put your email address within the To line.)

  * Only send your message to 10 contacts at a time, so your warning email doesn’t find yourself in their Spam folders.

extension: markdown


text:
Now, let's point our Kafka as a Source to the default broker instead of directly to a Knative Service.

Have another look to the next diagram this time pay attention to path ③.

![Lab Diagram](./images/lab-diagram.png "Lab Diagram")

First we need to update the KafkaSource we used before so that it point to the default broker.

> **Pay special attention to:**
>
> * **spec->sink:** because now it's pointing to the `default` broker
> * **spec-> bootstrapServers and topics:** no changes with regards to the previous lab

```yaml
apiVersion: sources.eventing.knative.dev/v1alpha1
kind: KafkaSource
metadata:
  name: kafka-source
spec:
  consumerGroup: knative-group
  bootstrapServers: knative-demo-kafka-bootstrap.kafka:9092 #note the kafka namespace
  topics: eventing
  sink:
    apiVersion: eventing.knative.dev/v1alpha1
    kind: Broker
    name: default
```

```execute-1
oc apply -f ./scripts/descriptors/kafka-source-to-channel.yml -n labs-%userid%
```

Let's test it by sending messages to our topic in kafka:

```execute-1
oc -n labs-%userid% delete pod kafka-producer
oc -n labs-%userid% run kafka-producer -ti --image=strimzi/kafka:0.14.0-kafka-2.3.0 --rm=true --restart=Never -- bin/kafka-console-producer.sh --broker-list knative-demo-kafka-bootstrap.kafka:9092 --topic eventing
```

Now you can send events from the prompt. Copy the next text and paste it in the console where the kafka-producer is running.

```copy
{"message" : "Hi guys from kafka source through channel!!"}
```

Let's check if there's a new pod being created...

```execute-2
oc get pod -n labs-%userid% | grep logevents
```

Nope? That's because our trigger has a filter.

```yaml
filter:
  attributes:
      type: dev.knative.demo
      source: dev.knative.demo/simplesource
```

Let's update our trigger so that it has no filter.

```execute-2
oc apply -f ./scripts/descriptors/demo-trigger-no-filter.yml -n labs-%userid%
```

Now, go back to the kafka-producer and try again, this time you should see new pod being created...

```execute-2
oc get pod -n labs-%userid% | grep logevents
```

Finally let's have a quick look to the logs:

> Paste new messages at the kafka-producer prompt

```execute-2
oc logs -f $(oc get pod -n labs-%userid% | grep logevents | awk '{print $1}') -c user-container -n labs-%userid%
```

Ctrl+C (both consoles) when you're done with testing the trigger.

Upper:

```execute-2
<ctrl+c>
```
Lower:

```execute-2
<ctrl+c>
```

repository: cvicens/lab-knative

repo_name: cvicens/lab-knative


text:
# Dexcom Code Challenge

#### _By Gloria Friesen_

#### Current Version:
1.0 - 09.08.2017

### Description
Front-end automation test code challenge for Dexcom. Duplicates "Register New User Test", running against  <https://shrouded-lowlands-66853.herokuapp.com/>

### Notes on My Solution
* I have the tests running in a Chrome browser. I needed a web driver to direct the tests toward a remote web application. Selenium defaulted to Firefox which had issues connecting to the heroku app. Switching the default driver to Selenium-Chrome and installing Chromedriver worked beautifully. Also, I love watching the tests run in the browser, it's both rewarding and magical.
* I chose to use Capybara and rspec matchers, without Cucumber. I felt that Capybara allowed me to have clear description statements without having to pull in (and learn) Cucumber.
* For clarity and to capture screenshots after each test step, I decided to write out each step as it's own test. When a test was failing, it was much easier to find the solution.
* Several of the test cases were the same "Navigate to the Testing Page" (A01, A06, A09, A13), resulting in redundancy. I considered not having those steps as separate test cases, but I thought it was worth including to ensure the application could navigate between errors and successes accurately. I would rather have redundancies than holes in test coverage.
* Most of the test cases include comprehensive test coverage. I test the expected outcome as well as the unexpected outcome. For example, if the expected outcome is navigating to the success page, I tested that the success page displayed and no error messages were displayed.

### Installation/Setup

#### Requirements
  * Ruby 2.0 or higher
    * Check your version: `$ ruby -v`
    * If you need to install or update: <https://www.ruby-lang.org/en/documentation/installation/>
  * Bundler
    * Not sure if you have it, check: `$ bundle version`
    * If you don't, install: `$ gem install bundler`
  * Xcode commandline tools
    * I needed to install this directly. Otherwise, my bundler could not install Capybara, which depends on Nokogiri, which depends on xcode commandline tools for installation. From the documentation, most people should not need to install it explicitly.
    * But, if you run into issues when installing Capybara via the Gemfile, try installing xcode: `$xcode-select --install`
  * Chromedriver
    * install: `$ brew install chromedriver`
    * if you don't have homebrew, install it with the command `$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`

#### Run it
  * clone the repository: `$ git clone <https://github.com/GloriaFriesen/dexcom-challenge.git>`
  * navigate to project folder: `$ cd dexcom-challenge`
  * install gems: `$ bundle install`
  * run the tests: `$ rspec`

## Test Cases

| Test Step | Action | Expected Result | Screenshot |
| :----------------------: | :----------------------: | :----------------------: | :----------------------: |
| A01 | Navigate to the Testing Page. | Page to register a new user is displayed. | [A01.png](screenshots/A01.png) |
| A02 | Fill out all required fields except for First Name with valid data and check all checkboxes. Select the Save User button. | An error message displays indicating that the First Name field requires a value. | [A02.png](screenshots/A02.png) |
| A03 | Clear all fields. Fill out all required fields except for First Name with valid data and check all checkboxes. Attempt to fill in the First Name field with 16 valid characters. | Only the first 15 characters are entered. Record the value you attempted to enter. Record the value which was actually entered. | [A03.png](screenshots/A03.png) |
| A04 | Clear all fields. Fill out all required fields with valid data and check all checkboxes. Do not select a suffix. | | [A04.png](screenshots/A04.png) |
| A05 | Select the Save User button. | The app navigates to the Success page. There is no error message indicating that a suffix is required. | [A05.png](screenshots/A05.png) |
| A06 | Navigate to the Testing Page. | | |
| A07 | Clear all fields. Fill out all required fields except for Title with valid data and check all checkboxes. In the Title field, enter a value containing letters and at least one number. Select the Save User button. | An error message displays indicating that the Title field only accepts letters and spaces. | [A06.png](screenshots/A06.png) |
| A08 | Clear all fields. Fill out all required fields except for Title with valid data and check all checkboxes. In the Title field, enter a value containing letters and at least one space. Select the Save User button. | The app navigates to the Success page. | [A07.png](screenshots/A07.png) |
| A09 | Navigate to the Testing Page. | | |
| A10 | Fill out all required fields except for Email with valid data and check all checkboxes. Fill out the Email field with abc. Select the Save User button. | An error message displays indicating that the Email field must be formatted as an email. | [A10.png](screenshots/A10.png) |
| A11 | Clear all fields. Fill out all required fields except for Email with valid data and check all checkboxes. Fill out the Email field with a@bc. Select the Save User button. | An error message displays indicating that the Email field must be formatted as an email. | [A11.png](screenshots/A11.png) |
| A12 | Clear all fields. Fill out all required fields except for Email with valid data and check all checkboxes. Fill out the Email field with<EMAIL_ADDRESS>Select the Save User button. | The app navigates to the Success page. | [A12.png](screenshots/A12.png) |
| A13 | Navigate to the Testing Page. | | |
| A14 | Clear all fields. Fill out all required fields except for Zip with valid data and check all checkboxes. Fill out the Zip field with between 1 and 4 valid characters. Select the Save User button. | An error message displays indicating that the length of the zip code must be between 5 and 20 characters. | [A14.png](screenshots/A14.png) |
| A15 | Clear all fields. Fill out all required fields except for Zip with valid data and check all checkboxes. Fill out the Zip field with between 21 and 25 valid characters. Select the Save User button. | An error message displays indicating that the length of the zip code must be between 5 and 20 characters. | [A15.png](screenshots/A15.png) |

## Support and contact details
Questions? Concerns? Suggestions? Reach out to me via github: <https://github.com/GloriaFriesen>.

## Technologies Used
* _Ruby_
* _Capybara_
* _rspec_
* _Selenium_

## License
This software is licensed under the MIT license.
Copyright (c) 2017 Gloria Friesen.

repository: GloriaFriesen/dexcom-challenge

repo_name: GloriaFriesen/dexcom-challenge


text:
# Karate Analytics
From version [1.2.0 onwards](https://github.com/karatelabs/karate/releases/tag/v1.2.0) Karate sends a very limited set of events to a hosted instance of [Posthog](https://posthog.com) - an open-source analytics solution. Access to this is managed by the [Karate Labs team](#who-can-see-the-data).

Only one (anonymous) event is captured: which is when someone views the HTML report that Karate generates. Note that using the HTML report is completely optional.

If you set an OS environment property called `KARATE_TELEMETRY` to the value `false`, no events will be sent.

Users can also completely disable HTML reporting via the [API](https://github.com/karatelabs/karate#parallel-execution) or [command-line](https://github.com/karatelabs/karate/tree/master/karate-netty#output-format).

There is always the option of [using a third-party report](https://github.com/karatelabs/karate/tree/master/karate-demo#example-report) (via the JUnit-XML or Cucumber-JSON output).

## Why We Need This Now
Karate is an open-source project and there is no direct way to track usage and whether awareness camapigns are working.

Now that we are a for-profit open-source company, a basic level of usage data will help us focus on the right areas of product development.

## What Is Tracked
* Anonymized Machine ID
* Browser Details (including OS info)
* Karate Version
* How Karate was invoked (via IDE plugin, NPM, etc.)

## Who Can See The Data
The dashboard is accessible only to the [Karate Labs](https://karatelabs.io) team that maintains Karate.

repository: chaudharydeepak/karate

repo_name: chaudharydeepak/karate


text:
# stay-awake-rs
Keep a Windows machine awake

![stay-awake workflow](https://github.com/curtisalexander/stay-awake-rs/workflows/stay%20awake/badge.svg)

## Get
Executable binaries for Windows may be found at the [Release](https://github.com/curtisalexander/stay-awake-rs/releases) page.

## Usage

The executable `stay-awake.exe` is intended to be run in a terminal in order to keep one's Windows machine awake.

There are two modes one may choose from:
- **System** [Default] → the machine will not go to sleep but the display could still turn off
- **Display** → the machine will not go to sleep and the display will remain on

The simplest use case is to run the executable without any switches.

```pwsh
stay-awake.exe
```

This will prevent the machine from going to sleep and will await any key press within the terminal before resetting the machine state.

> **NOTE:** As noted in the [Win32 documentation](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate), use of the `SetThreadExecutionState` function (which is the Win32 function called within `stay-awake`) does not prevent one from putting their computer to sleep by either closing the lid on their laptop or pressing the power button.  In addition, the screen saver may still execute.

### Details
Result of running `stay-awake --help`

```
stay awake ==> keep a Windows machine awake

USAGE:
    stay-awake.exe [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -a, --awake-mode <awake-mode>    Awake mode [default: System]  [possible values: Display, System]
```

## Testing
In order to test, open PowerShell with elevated (admin) privileges. After executing the program, run the following.

```pwsh
powercfg -requests
```

## Win32 Docs
> https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate

## Inspiration
Following along with Amos's ping series:
> https://fasterthanli.me/series/making-our-own-ping

## See Also
Created an earlier version in `C#`
> https://github.com/curtisalexander/stay-awake-cs

repository: scadu/stay-awake-rs

repo_name: scadu/stay-awake-rs


text:
---
targetMarket: Personal
type: app
status: publish
author: admin
android_link: https://play.google.com/store/apps/details?id=sworkitapp.sworkit.com
title: Sworkit
date: 2015-06-10 12:24:21
permalink: /sworkit/
itunes_id: "527219710"
highlight: true
feature: true
feature_image: /uploads/feature/sworkit-pg-feature.png
sticky: 5
devices:
- ios
- android
developer_link: http://sworkit.com
categories: app
thumb: /uploads/v2/4fc4bff54b9a1phonegap.jpg
slug: None
contact<EMAIL_ADDRESS>ios_link: http://itunes.apple.com/us/app/sworkit/id527219710?ls=1%26mt=8
developer: Nexercise Inc
layout: post
---

Sworkit is a workout app that provides guided, video-based workouts that you can do anywhere and anytime. Sworkit dynamically assembles exercise routines that can fit any time constraint from as little as 5 minutes to over 60 minutes, by merging high quality video content with audio guidance recorded in 13 different languages. Without needing to think heavily, users can easily follow along to the professional video and audio, and even skip an exercise they find challenging while still maintaining the length of their workout.

At Sworkit, PhoneGap and hybrid development is overwhelming regarded as a competitive advantage. Originally created by just a single developer, Sworkit has been downloaded over 4 million times with users completing over of 7 million minutes of exercise each month. This exceptional growth is credited to the rapid development, testing and distribution that hybrid development provides this very small team compared to its competitors.

Sworkit has been featured by the Apple App Store, Google Play, Amazon Appstore, Samsung Apps and  Xiaomi Market.


text:
# tree-view-project package

A short description of your package.

![A screenshot of your package](https://github.com/yejune/tree-view-project/blob/master/screenshot.gif?raw=true)

repository: yejune/tree-view-project

repo_name: yejune/tree-view-project