text:
---
layout: post
title: Download all videos from Safari Books Online course
category: tools
tags:
- Python
- Jupyter
---
Updating some of my certifications and wanted an offline way to watch a video course. Since they do not offer a way to download an entire course (except for the queue app, which is not what I'm after) I created this notebook to scratch that itch.

Only tested with this specific course, it might need some minor tweaks for other courses. The structure of the course material seems somewhat inconsistent, but this should be a good starting point for other courses.

<!-- more -->

{% highlight python %}
from bs4 import BeautifulSoup
import requests
import shutil
import os
url = 'https://www.safaribooksonline.com/library/view/ccna-routing-and/9780134580715/'
domain = 'https://www.safaribooksonline.com'
output_folder = './output'
username = 'username'
password = 'SuperSecretPassword'

req = requests.get(url)
soup = BeautifulSoup(req.text, 'html.parser')

lessons = soup.find_all('li', class_='toc-level-1')
print(len(lessons))

shutil.rmtree(output_folder, ignore_errors=True)
os.makedirs(output_folder)
module_name = 'Module 0'
for lesson in lessons:
    lesson_name = lesson.a.text
    if lesson_name.startswith('Module') and not 'Summary' in lesson_name:
        module_name = lesson_name
        os.makedirs(output_folder + '/' + module_name)
        # print(module_name)
        for index, video in enumerate(lesson.ol.find_all('a')):
            video_name = str(index) + ' - ' + video.text
            video_url = domain + video.get('href')
            video_out = output_folder + '/' + module_name + '/' + video_name + '.mp4'
            # print('        ', domain + video_url)
            # print('        ', video_out)
            print ("youtube-dl -u {} -p {} --output '{}' {}".format(username, password, video_out, video_url))
    else:
        os.makedirs(output_folder + '/' + module_name + '/' + lesson_name)
        # print('   ', lesson_name)
        for index, video in enumerate(lesson.ol.find_all('a')):
            video_name = str(index) + ' - ' + video.text
            video_url = domain + video.get('href')
            video_out = output_folder + '/' + module_name + '/' + lesson_name + '/' + video_name + '.mp4'
            # print('        ', domain + video_url)
            # print('        ', video_out)
            print ("youtube-dl -u {} -p {} --output '{}' {}".format(username, password, video_out, video_url))
{% endhighlight %}

Of course you need a valid username/password, have youtube-dl installed etc etc. Unfortunately youtube-dl does not handle corporate SSO logins, so regular accounts only.


text:
# Zax Dashboard

**Zax Dashboard** is a simple single page web app powered by [Angular](https://angular.io), introducing typical interactions with [Zax Relay](https://github.com/vault12/zax), a [NaCl-based Cryptographic Relay](https://s3-us-west-1.amazonaws.com/vault12/zax_infogfx.jpg). **Zax Dashboard** uses the [Glow.ts](https://github.com/vault12/glow.ts) library to provide a user-friendly access point to encrypted Mailboxes on a given relay. You can read the full [technical specification here](http://bit.ly/nacl_relay_spec).

## Demo

We maintain a live [Test Server](https://zt.vault12.com) that runs the stable build of Zax Dashboard. For testing purposes expiration of any communication on that relay is set to *30 minutes*.

You can also check the latest build of `master` branch on [Github Pages](https://vault12.github.io/zax-dashboard/).

## Features

- Create mailboxes
- Send and receive end-to-end encrypted messages between mailboxes
- Send and receive encrypted files via [Zax 2.0 File Commands](https://github.com/vault12/zax/wiki/Zax-2.0-File-Commands)
- Switch Zax relays on the fly

## Getting started

### Node.js

In order to build and use **Zax Dashboard** from source, you need to have a relatively recent version of [Node.js](https://nodejs.org) installed.

### Installation

In a terminal, navigate to the directory in which you'd like to install **Zax Dashboard** and type the following:

```Shell
# get the source
git clone git@github.com:vault12/zax-dashboard.git

# install dependencies
cd zax-dashboard
npm install

# run the dev server
npm run start
```

Then navigate to `http://localhost:4200` in your browser. The app will automatically reload if you change any of the source files.

## Configuration

To change the default relay, modify private `setDefaultRelay()` method of [app.component.ts](https://github.com/vault12/zax-dashboard/blob/master/src/app/app.component.ts). By default, it uses the same domain where Zax Dashboard is running, but falls back to our test server when run on *localhost* or *Github Pages*.

## Build

Run `npm run dist` to build the project. The build artifacts will be stored in the `docs/` directory, which serves as a root for [Github Pages](https://vault12.github.io/zax-dashboard/).

## Ecosystem

Project | Description
--- | ---
[Zax](https://github.com/vault12/zax) | NaCl-based Cryptographic Relay
[Glow](https://github.com/vault12/glow.ts) | Client library for interacting with Zax Cryptographic Relay
[TrueEntropy](https://github.com/vault12/TrueEntropy) | High volume thermal entropy generator

## License

Zax Dashboard is released under the [MIT License](http://opensource.org/licenses/MIT).

## Legal Reminder

Exporting/importing and/or use of strong cryptography software, providing cryptography hooks, or even just communicating technical details about cryptography software is illegal in some parts of the world. If you import this software to your country, re-distribute it from there or even just email technical suggestions or provide source patches to the authors or other people you are strongly advised to pay close attention to any laws or regulations which apply to you. The authors of this software are not liable for any violations you make - it is your responsibility to be aware of and comply with any laws or regulations which apply to you.

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive


text:
# docStack

this project contains submodules. when cloning use the following cmd:

  git clone --recursive https://github.com/schwamster/docStack.git

![Architecture diagram](docStack.png)

repository: gitter-badger/docStack

repo_name: gitter-badger/docStack


text:
---
published: true
layout: post
title: "Chapter 42 - I Helped You"
category: heaven-awakening
previous_chapter: 41
next_chapter: 43
date: 2016-05-27 15:21:00 +0200
has_note: false
note: ""
has_credits: true
translator: toomuchnoob
proofreader: Duncan Forsythe, appelemac
is_preview: false
---
Many students began to wake up at this point. They were completely stupefied as they saw the two corpses.

"What happened?" They began asking around.

At this moment, Qin Zhen was collapsed on the ground. He hadn’t been subjected to any injury, just some intimidation. Although he was a Perceiver, until now, he'd only been cultivating inside of the institute without any worries. Even though he wasn't clear on what future awaited him, this time's encounter of brushing against death was too abrupt for him. The moment the black-clothed man was punched by Lu Ping, his legs gave away and he collapsed on the ground.
<!--more-->

However, soon afterwards, he spotted his elder brother collapsed nearby. Although the latter's eyes were filled with a gratified expression, he was clearly suffering.

"Elder brother!" Qin Zhen's body was still shuddering, but even he himself didn't know where he had obtained the strength from as he rushed towards his brother rolling and crawling on the ground. As he got closer, he became even more frightened. Qin Yuan was completely immersed in a pool of blood; his face resembled white paper and his lips were constantly shuddering. It looked like he wanted to say something but was unable to produce any sounds.

"You don't need to worry." From the side, Xi Fan conveyed Qin Yuan's thoughts by looking at his lips and expressions.

"Since when can you interpret like this as well?" Su Tang said to Xi Fan.

"Ah.....This is my speciality...." Xi Fan said.

"Don't worry! He won't die!" Mo Lin was crouched beside Qin Yuan. In his right hand was a corn he'd taken out of nowhere. While chewing on it, he pulled Qin Yuan's right hand away from his neck with the other hand and checked the latter's wound.

"Lots of rest and lots of water, and he will be fine, right?"  Su Tang asked. Clearly, after the incident of Su Tang's injury last time, no one believed in these words of Mo Lin anymore: 'One who can poison can also heal.'

"I think drinking water won't do, no?  It would leak out from this wound!" Mo Lin said.

"Can you be a bit serious?" Su Tang said.

"Which part of me doesn't look serious to you?" Mo Lin said.

"What are you holding in your right hand?" Su Tang asked.

"Corn? Do you want to eat it? Then just take it." Mo Lin, as if being impatient, passed the corn towards Su Tang. Su Tang, deciding to ignore him, looked towards Lu Ping who had just arrived. Although Lu Ping also didn't know anything about medicine, his random words would still make her feel a hundred times better than relying on Mo Lin.

 Lu Ping asked Qin Zhen.

"Hey hey...." Mo Lin felt deeply hurt. Everyone is so distrusting towards him; he'd just made a mistake once, no?

"N....no we haven't.." Qin Zhen was extremely panicked. He took a while before answering Lu Ping's question.

Soul's Power was not for the battle purposes only. However, in order to differentiate occupations according to the Soul's Power, the minimal requirement was the realm of Linking Of Souls. Linked Ones chose the occupation that corresponded best to the ability they trained in, or they chose the occupation and then bitterly trained in the ability that was required for that occupation. However, all the students of Xia Feng were in the realm of Perceiving of Souls. This phase for them was akin to learning the basics. Hence, it was unlikely for the students to possess abilities related to the medical field. However, the students who were predetermined to pursue this field might have some relevant knowledge.

"I will go and ask Lu Qing." Qin Zhen, who had already denied a moment ago, suddenly sprang to his feet and sprinted away to look for the guy.

More and more students were waking up. The nights in the mountain forests were tranquil, but this wasn't the case at this moment. Students were discussing the incident in groups of three or five, though no one dared to approach the corpses. Even though some students did dare to advance, they were immediately stopped by a strict gaze from either Wei Yang or Wei Ying. After carefully inspecting the three corpses for any possible clues, the two of them were giving a meticulous report to Wei Tianqi who had finally come out.

Wei Tianqi was absent-mindedly hearing them speak, as he did during Wei Ming's report. Most of the time, his gaze was fixed on the seriously injured Qin Yuan. After hearing the report, he didn't comment anything either. Because he knew, the only power he possessed was that of being aware of the situation.

"What happened to Qin Yuan?" He asked. The report surprisingly didn't include a single word about the guy who had been seriously injured as a result of all this.

"He led the assassins, and moreover, after looking at our arrangements, he even tried to warn the assassins." Wei Ying said.

"Our arrangements, huh?" Wei Tianqi looked towards the emblem that originally should have been upon his tent. He wasn't aware of these arrangements at all, but he knew Wei Ming certainly would have a very good justification as to why he hadn't been informed. And as before, he wasn't fond of this feeling in the least.

However, the only thing he was displeased with was this feeling, nothing more. He didn't find anything inappropriate with these arrangements at all. He was the successor of the City Master's position; his safety obviously exceeded everything else.

"So?" He continued to ask.

"The possibility of him being a spy cannot be ruled out."

"Don't you guys know that this tent actually turned out to be the tent of his younger brother by chance? The reason why he warned the assassins is obvious, no?" Wei Tianqi said.

"That may be so, but the possibility still can't be ruled out." Wei Ying said.

"That's true. In that case, what did Wei Ming tell you to do?" Wei Tianqi asked.

"Closely monitor his actions." Wei Ying said.

"Very good. I am going to monitor him a bit." Wei Tianqi said and began to walk towards Qin Yuan. Wei Ying and Wei Yang exchanged a glance and didn't stop him, though, they did follow closely behind him. For them, the safety of the Young City Master came before anything else.

Many students had been gathered around Qin Yuan; as they saw Wei Tianqi coming towards them, they immediately moved aside.

Qin Yuan looked at Wei Tianqi; he didn't bother to conceal the hatred in his eyes at all. Even though his younger brother was finally safe, but this could not change the fact that this guy had completely disregarded the safety of their younger brothers and sisters. Qin Yuan felt that he was definitely going to die in a few moments; at present, he wasn't afraid of anything.

"Everybody move!" At this moment, Qin Zhen's voice sounded from outside the group surrounding Qin Yuan. Eventually, he was successful in finding Lu Qing and bringing him back. Lu Qing was an extremely ordinary student of Xia Feng institute's third grade. He didn't have any special achievements with respect to Soul's Power, however, he was a son of a doctor, and moreover, he was also determined to carry his father's legacy. Therefore, he was relatively knowledgeable in the medical field.

However, as they came out of the crowd, they saw Wei Tianqi standing in front of Qin Yuan and calmly speaking:

"I will not blame you." This was the first line that came out of Wei Tianqi's mouth. Afterwards, as Wei Tianqi saw Qin Zhen coming out of the crowd, he pointed towards him and continued:

"After all, he is your younger brother. Your mentality of not wanting any harm coming his way; I can totally understand." Wei Tian continued.

"However, did you lead the way for these assassins?

"Because your life was in danger, you decided to betray others without any hesitation?"

"It's still not that bad since I have special protection; however, what if some other fellow student was in my place? Wouldn't he have died already at your hands?"

"That is true...." Some people amongst the crowd, under some unfathomable thoughts, actually made sounds of agreement.

"If it had been us, we truly would have been killed by now, right?"

"Qin Yuan truly is..."

Apparently, some people were deeply aggrieved; not because of his injuries, but because of his actions.

And the rest of the students, who didn't share these views, did not dare to say anything and persevered silently.

However, Qin Zhen couldn't endure anymore. The person collapsed on the ground was his elder brother of flesh and blood. The latter was on the verge of death and yet had to face such comments of other people?

City Master's son? Influence of the Wei family? Completely disregarding such things, Qin Zhen was about to rush forward.

However, someone's movements were much quicker than him.

A fist!

Bringing along an extremely intense air turbulence and a whistling sound, a fist was aimed straight at Wei Tianqi's face.

"Ah!"

Wei Tianqi was only able to produce a frightened shriek. He'd never expected that someone would actually try to hit him. He thought about dodging, but in his flustered state, he was unable to move his legs.

Fortunately, a shadow timely covered his front. Wei Ying's movements were always very quick and very precise.

Bang!

This was the explosion due to the punch. As Wei Ying was stopping this fist, his figure fiercely shuddered. He hurriedly took a step back and stabilized his figure. Behind his body, Wei Tianqi only felt a strong current of wind grazing past his cheek, immediately followed by a sharp pain. He moved his hand to check and surprisingly found that his face was covered with blood stains. Just the wind of this punch had actually scratched his face.

Lu Ping?

In his opinion, apart from Lu Ping, it was impossible to think of a second person who would dare to hit him. However, after his vision made its way past Wei Ying's body, what he saw was a girl with a furious face.

Su Tang!

The one who had swung this fist was Su Tang!

Wei Tianqi was astonished, so was Wei Ying. Apparently this girl had Strength's Soul sixth heavenly Layer; she was just a Perceiver so how could her fist be this powerful? The right hand he'd used to resist her fist, and afterwards, the right leg he'd used as a support to stabilize his body, both were somewhat numb.

Su Tang withdrew her fist, and her expression was also much more tranquil than before.

"I am helping you!" She said to Wei Tianqi behind Wei Ying's body:

"If he'd acted instead of me, you would have already been dead."

The 'he' she was referring to was obviously not Qin Zhen. Behind Su Tang's body, Lu Ping was also very eager for his turn!


text:
#thirteen-ghost
==============
A Ghost theme based on Popular wordpress theme Twenty-thirteen.

##Live: [http://thirteenghost.apps.runkite.com](http://thirteenghost.apps.runkite.com/)

##Screenshot:
![](http://choyan.me/wp-content/uploads/2013/11/Thirteen%20Ghost.png)

##Usage:
- Download thirteen-ghost and place her inside /content/themes/
- Restart your instance of ghost
- Goto your blog settings and choose thirteen-ghost from the themes dropdown.

##License:
MIT

repository: choyan/thirteen-ghost

repo_name: choyan/thirteen-ghost


text:
# homebrew-taps

Collection of homebrew formulas created by befovy

* [fvm](https://github.com/befovy/fvm): Flutter Version Management: A simple cli to manage Flutter SDK versions.

repository: befovy/homebrew-taps

repo_name: befovy/homebrew-taps


text:
---
layout: relation
title:  'cc:preconj'
shortdef : 'preconjunct'
udver: '2'
---

The `cc:preconj` relation is used for the first part of a multi-word coordinating conjunction which appears before the head of a coordinated structure, as is the case with multi-word expressions, such as **_tako**-kot_ (_both-and_), **_niti**-niti_, **_ne**-ne_ (_neither-nor_), **_ali**-ali_ (_either-or_). The second element is considered to be the coordinating conjunction ([cc]()) and attaches to the following conjunct.

~~~ sdparse
Tudi zato s tovrstnim nasiljem ne ravnatelji ne učitelji nimajo izkušenj . \n Also because-of-this with such violence neither principals nor teachers have experience .
cc(učitelji,ne-8)
cc:preconj(ravnatelji,ne-6)
conj(ravnatelji,učitelji)
cc(teachers,nor)
cc:preconj(principals,neither)
conj(principals,teachers)
~~~
<!-- Interlanguage links updated Út 9. května 2023, 20:04:04 CEST -->

repository: UniversalDependencies/docs

branch_name: refs/heads/pages-source

repo_name: UniversalDependencies/docs


text:
# [ControllerAction]

Specifies how a [custom method](/modeling/model-components/methods.md) is exposed via HTTP. Can be used to customize the HTTP method/verb for the method, as well as caching behavior.

## Example Usage

``` c#
public class Person
{
    public int PersonId { get; set; }
    public string LastName { get; set; }

    public string PictureHash { get; set; }

    [Coalesce]
    [ControllerAction(Method = HttpMethod.Get)]
    public static long PersonCount(AppDbContext db, string lastNameStartsWith = "")
    {
        return db.People.Count(f => f.LastName.StartsWith(lastNameStartsWith));
    }

    [Coalesce]
    [ControllerAction(HttpMethod.Get, VaryByProperty = nameof(PictureHash))]
    public IFile GetPicture(AppDbContext db)
    {
        return new IntelliTect.Coalesce.Models.File(db.PersonPictures
            .Where(x => x.PersonId == this.PersonId)
            .Select(x => x.Content)
        )
        {
            ContentType = "image/jpg",
        };
    }
}
```

## Properties

<Prop def="public HttpMethod Method { get; set; } = HttpMethod.Post;" ctor=1 />

The HTTP method to use on the generated API Controller.

Enum values are:
- `HttpMethod.Post` Use the POST method.
- `HttpMethod.Get` Use the GET method.
- `HttpMethod.Put` Use the PUT method.
- `HttpMethod.Delete` Use the DELETE method.
- `HttpMethod.Patch` Use the PATCH method.

<Prop def="public string VaryByProperty { get; set; }" />

For HTTP GET model instance methods, if `VaryByProperty` is set to the name of a property on the parent model class, [ETag headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) based on the value of this property will be used to implement caching. If the client provides a matching `If-None-Match` Header with the request, the method will not be invoked and HTTP Status `304 Not Modified`` will be returned.

Additionally, if the `VaryByProperty` is set to a client-exposed [property](/modeling/model-components/properties.md), the value of the property will be included in the query string when performing API calls to invoke the method. If the query string value matches the current value on the model, a long-term `Cache-Control` header will be set on the response, allowing the client to avoid making future invocations to the same method while the value of the `VaryByProperty` remains the same.

repository: IntelliTect/Coalesce

branch_name: refs/heads/dev

gha_language: C#

repo_name: IntelliTect/Coalesce


text:
---
description: How to install Auth0 onto your Joomla platform.
topics:
    - joomla
    - cms
contentType: how-to
useCase:
  - add-login
---

# Joomla Installation

1. [Download](https://github.com/auth0/auth0-joomla/releases) the latest release of the Auth0-Joomla extension.

2. Log in to the Joomla Control Panel using an admin account.

    ![](/media/articles/cms/joomla/installation/joomla1.png)

3. Click **Install Extensions** from the left-hand navigation menu.

    ![](/media/articles/cms/joomla/installation/joomla2.png)

4. On the **Upload & Install Joomla Extension** tab, select the `.zip` file you downloaded above containing the Auth0-Joomla extension.

gha_language: JavaScript


text:
---
layout: post
title: Lesson 9 - Strings (Tutorial)
categories: [Strings, indexing, slicing, operators, methods]
---

Strings are among the most popular types in Python, we have used them extensively in our course. We are going a bit more in depth to describe and show many of the things that can be done with strings.

Become a Patron!

For this lesson we won't have a project, as there is too much to cover. In future projects we will be covering what we will learn in this lesson.

As mentioned before, **strings** are immutable primitive types, they can be defined as a **sequence of characters**.

For this lesson the following topics will be covered.

* String characters in Python
* Creating a string
* Removing and "editing" strings
* Strings indexing and slicing
* String iteration
* String Operators
* String Methods
* String formatting

## String characters in Python

In Python, **strings** are represented as a **sequence of immutable Unicode characters**. Unicode includes every character in all languages.

`string = "Sparse is better than dense."`

Each character has a numerical value. We will have to elicit the help of a couple of built in function, `ord()` and `chr()`.

* `ord()` : Converts character to an integer.

```python
>>> ord('n')
110
>>> ord('N')
78
```

* `chr()` : Converts an integer to a number.

```python
>>> chr(56)
'8'
>>> chr(123)
'{'
```

### The string object

We can turn an object into a string by using the built in function `str()`.

```python
>>> type(45)
<class 'int'>
>>> type(str(45))
<class 'str'>
>>> '4' in str(45)
True
```

## Creating a string

String are created by wrapping characters in single, double or triple quotes.

> Notice, the quotes must be the same at the start and end of the string.

```python
str_single = 'This is a string'
str_double = "This is a string"
str_triple = """ This is a string """
```

## Removing and "editing" strings

**Strings can not be edited** as they are immutable, but we can **reassign** a new string **to the same variable**.

```python
>>> string = 'aeio'
>>> string
'aeio'

>>> string = 'aeiou'
>>> string
'aeiou'
```

We can delete an entire string by using the keyword `del`, but we can not remove an individual character from a string.

```python
>>> del string

>>> string # no longer exists
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'string' is not defined
```

## Strings indexing and slicing

Strings as a series of positional characters are indexed from left to right starting with the number 0. and right to left with negative numbers starting with -1.

| P   | Y   | T   | H   | O   | N   |
| --- | --- | --- | --- | --- | --- |
| 0   | 1   | 2   | 3   | 4   | 5   |
| -6  | -5  | -4  | -3  | -2  | -1  |

We can count the number of characters in a string by using the `len()` function.

```python
>>> len('python')
6
```

We can access a character by specifying it's string index. We write the string followed by  square brackets `[n]` where `n` is the index number of the character we want to access.

```python
>>> 'python'[2]
't'
```

Inversely we can access the character from right to left using negative numbers, indexing backwards.

```python
>>> 'python'[-4]
't'
```

### String slicing

Is a more general form of indexing, designed to  extract an entire section in a single action, crating a new object with the result.

```python
>>> 'python'[1:4]
'yth'
```

In the example above, we sliced from index 1 up to (but not including) index 4. `[1:4]`.

| Y   | T   | H   |     |
| --- | --- | --- | --- |
| 1   | 2   | 3   | 4   |

Lets assign the string `"python"` to the variable `f` to simplify our examples.

* `f = 'python'`

If we omit the first index, Python assumes it starts at `0`.

```python
>>> f[:3]
'pyt'
>>> f[0:3]
'pyt'
```

If we omit the second index `[n:]`, Python will slice from `n` to the end of string, we don't have to know how long the string is.

```python
>>> f[2:]
'thon'
>>> f[-4:]
'thon'
>>> f[2:len(f)]
'thon'
```

To return the compleat string we can indicated as follow.

```python
>>> f[:]
'python'
```

To get an empty string, you can pass two indexes of equal value `[n:n]` or overlaping indexes.

```python
>>> f[2:2]
''
>>> f[2:-4]
''
```

Python slicing has a third index used to indicate `stepping` or by increments of `n`.
[x:y:n]

```python
>>> f[::2]
'pto'
```

We can also give a negative index for stepping [x:y:-n]. Python will step backwards through the string.

```python
>>> f[5:0:-2]
'nhy'
```

When there is no first or second index, the string indexes are reversed. To reverse a string we can use the following format `[::-1]`.

```python
>>> f[::-1]
'nohtyp'
```

## String iteration

We can iterate through each character of a string by using a `for` loop.

```python
>>> f = 'python'
>>> for l in f:
...     print(l)
...
p
y
t
h
o
n
```

## String Operators

There are a number of operators that can be used with strings adding even more flexibility to strings.

| Operator | Description                             |
| -------- | --------------------------------------- |
| `+`      | Joins two or more strings together.     |
| `*`      | Creates multiple copies of string.      |
| `in`     | Membership of string in another string. |
| `not in` | Is the opposite of the `in` operator.   |

### The `+` operator

The `+` is able to join two or more strings together.

```python
>>> st1 = 'The first string'
>>> st2 = 'The second string'
>>> new_st = st1 + st2
>>> print(new_st)
The first stringThe second string
```

we can add another string to add space between the `st1` and `st2`

```python
>>> st1 + ' ' + st2
'The first string The second string'
```

### The `*` Operator

The `*` generates multiple copies of a string, it works on any string.

```python
>>> '-' * 8
'--------'
>>> '123' * 4
'123123123123'
```

### The `in` Operator

Test membership of s string in another string. It returns a bulian `True` or `False`

```python
>>> master_st = 'Beautiful is better than ugly.'
>>> 'ugly' in master_st
True
```

### The `not in` Operator

The `not in` Operator is the opposite as the `in` operator.

```python
>>> 'ugly' not in master_st
False
>>> 'apple' not in master_st
True
```

## String Methods

Just as python has built-in functions, procedures which can be called to perform specific tasks on an object, ie. `len('hello')`.

Python also offers built-in methods, much like functions perform a procedure on a specific object. Methods are part of a class, they can be written specifically for an object type, hence "string method", these are written to perform tasks on string objects.

The way to call an object (string) method, is to write the object followed by `.method_name()`.

Because strings are immutable when we use a method, it returns a copy of the original string with the result.

There are over 40 built-in string methods available, we are just going to cover a few. For a full list, please see the Python documentation.

### `.capitalize()`

This method capitalizes a string.

```python
>>> x = 'hello'
>>> x.capitalize()
'Hello'
```

### `.upper()`

Use the this method to turn a string to all upper case.

```python
>>> u = 'hello world'
>>> u.upper()
'HELLO WORLD'
```

### `.lower()`

It returns a string with all lower case.

```python
>>> y = 'ReaDAbiLity CouNts.'
>>> y.lower()
'readability counts.'
```

### `.title()`

It will turn a string in to a title.

```python
>>> t = 'Beautiful is better than ugly.'
>>> t.title()
'Beautiful Is Better Than Ugly.'
```

Python also offers a number of Methods specifically for searching for a substring in a string.

### `.count()`

Returns the number of occurrences of a substrings in a string.

```python
>>> 'Now is better than never'.count('e')
4
>>> 'Now is better than never'.count('tt')
1
```

We can also limit the count to a specific range by passing a starting and ending index.

```python
>>> x = 'Now is better than never'
>>> x.count('e', 9, 24)
3
```

### `.startswith()` and `.endswith()`

These two methods determines if a target string starts, or ends, with a particular substring. The methods will return `True` or `False`.

#### `.startswith()`

```python
>>> x = 'Now is better than never'
>>> x.startswith('Now')
True
>>> x.startswith('is')
False
```

#### `.endswith()`

```python
>>> x.endswith('ever')
True
```

There are a number of very useful formatting methods. They allow us to enhance a string.

### `.center()`

We can center a strings on a given field of spaces.

```python
>>> 'Beautiful'.center(15)
'   Beautiful   '
```

We can also assign a fill character by passing the character as an argument.

```python
>>> 'Beautiful'.center(15, '~')
'~~~Beautiful~~~'
```

### `.ljust()` and `.rjust()`

Aside fom centering a string we can also left and right justify it.

```python
>>> 'Beautiful'.ljust(15)
'Beautiful      '
>>> 'Beautiful'.rjust(15)
'      Beautiful'
```

we can also fill the range with a character.

```python
>>> 'Beautiful'.ljust(15, '-')
'Beautiful------'
>>> 'Beautiful'.rjust(15, '-')
'------Beautiful'
```

### `.strip()`, `.lstrip()` and `.rstrip()`

Another useful string method are the `.strip()`, `.lstrip()` and `.rstrip()`

When we don't specify an argument, Python will strip all the leading and trailling spaces depending on the type of strip method we use.

```python
>>> n = '   Beautiful   '
>>> n.strip()
'Beautiful'
>>> n.lstrip()
'Beautiful   '
>>> n.rstrip()
'   Beautiful'
```

We can specify the characters to strip.

```python
>>> 'purity/?'.rstrip('/?')
'purity'
>>> 'Mr. Brown'.lstrip('Mr. ')
'Brown'
```

### `.replace()`

We can use the `.replace()` method to replace an **'old'** substring for a **'new'** one. Since strings are immutables, Python just creates a copy with the new changes.

```python
>>> 'Mr. Sophie Brown'.replace('Mr.', 'Mrs.')
'Mrs. Sophie Brown'
```

We can also specify the number of times we can replace a substring, from left to right.

If we don't specify the count, it would replace every instance of the 'old' word.

```python
>>> 'right.move.right.now'.replace('right','left', 1)
'left.move.right.now'
```

## String formatting

Python has three types of string formatting, expression, method and fstring.

> **Note:** variables for example in table below
>
> * `var_1 = 'Easy'`
> * `var_2 = 'Python'`

| Syntax                                | type       |
| ------------------------------------- | ---------- |
| print('%s = %s' % (var_1, var_2))     | Expression |
| print('{} = {}'.format(var_1, var_2)) | Method     |
| print(f'{var_1} = {var_2}')           | fstring    |
|                                       |
| **Easy = Python**                     | <= prints  |

### String formatting expression

Is the oldest type of formatting available since the start of the language based on the programming language C. You still will see this type of formatting around.

```python
>>> xx = 'her'
>>> 'I spoke to %s yesterday' % xx
'I spoke to her yesterday'
```

With the formatting expression one must specify the type of object being replaced, in the case above we used `%s` where `s` stands for string. Here is a partial list of types that can be used.

| Code | Meaning                                |
| ---- | -------------------------------------- |
| s    | String (or any object’s str(X) string) |
| c    | Character (int or str)                 |
| d    | Decimal (base-10 integer)              |
| i    | Integer                                |
| f    | Floating-point decimal                 |

You may look at the Python documentation for more information on formatting expressions.

### String formatting method

The formatting method, uses a method call to format a string object. The string becomes a template and the format method argument to pass values to the template.

The values passed as arguments in the formatting method are positional.

```python
>>> string_template = '{} is {} than {}.'
>>> string_template.format('Beautiful', 'better', 'ugly')
'Beautiful is better than ugly.'
```

Likewise you can assign the order in which the values are placed in the string by specifying the method's argument index.

```python
>>> string_template = '{1} is {0} than {2}.'
>>> string_template.format('Beautiful', 'better', 'ugly')
'better is Beautiful than ugly.'
```

The format method also allow us to format different number types integers, floats, binary as well as arranging a string in a given space.

```python
>>> 'pi with three decimals {:.3f}'.format(3.14159265)
'pi with three decimals 3.142'
```

We can also arrange a string in a given space for better display by using the format method.

```python
"|{:<12}|{:^12}|{:^12}|".format('Name','Date','Price')
'|Name        |    Date    |   Price    |'
```

There are many string formatting available to use with the `.format()` method. Please see the documentation for more detailed use.

### Formatted String Literal (f-string)

The `fstring` was introduced with Python version 3.6. It is probably the most intuitive of the ways to format strings.

By simply prefixing the string with the letter `f'sample {var}'` you can add curly brackets inside the strings call variables and execute some operations.

```python
>>> a = 24
>>> b = 45
>>> f'The result for {a} + {b} = {a + b}'
'The result for 24 + 45 = 69'
```

The **f-string** format is very extensive and requires its own tutorial. But you can see more in the Python documentation.

As you can see Python provides an extensive toolbox to handle string from starting at a very granular level. We covered the most relevant aspect of strings, but there is more that can be found in the reference documentation and others I will introduce at a later point.

---

## Next tutorial

TBA: most definitely will have something to do with strings.

## Things to try

Read through the tutorial, and find some of the topics I asked to search in the documentation.

* More on **f-strings**.
* Other formatting expression codes.
* Find other string methods we didn't cover here.

## Question

* How do you reverse the order of a string? so it prints backwards.
* What are the three types of string formatting?
* What string method would you use to create a copy of string all lower case?

Become a Patron!


text:
# markdawn [![Build Status](https://travis-ci.org/itajaja/markdawn.svg?branch=master)](https://travis-ci.org/itajaja/markdawn)

> markdown for paged documents. Outputs to pdf

[![NPM](https://nodei.co/npm/markdawn.png?downloads=true)](https://nodei.co/npm/markdawn/)

## Examples

Head over the [examples](examples/) folder to see some examples of the built in themes, or check out some templates that I am using at [Hyla Soft](https://github.com/hylasoft-usa/document-templates).

## Usage

Markdawn generates pdfs from markdown documents and HTML+CSS templates using [remarkable](https://github.com/jonschlinkert/remarkable) markdown generator and [node-html-pdf](https://github.com/marcbachmann/node-html-pdf) pdf generator behind the scenes.

### As command line tool

You can call markdawn from command line. To install:

````bash
$ npm install -g markdawn
````

type `markdawn -h` to show a list of options.

### As library

you can use markdawn in your node app as well:

````js
var md = require('markdawn');

var options = {};

md.generate('This _is_ my **input**!', options);
````

the `options` object can contain the following properties:

- `index`: path to the index.html file that defines a theme
- `format`: (e.g. "Letter", "A4") overrides the format specified in the theme
- `out`: name of output file
- `theme`: name of a preconfigured theme to use (this property has priority over the `index` property)
- `contentDir`: content directory to take the content source from

### As grunt task

Visit https://github.com/itajaja/grunt-markdawn/ for more informations

## Creating your theme

A theme needs at least two objects (in the same folder). The `index.html` defines the layout of the document. The `page.json` declares some values to use for the pdf generation (e.g: format).

You can look at the [preconfigured themes](https://github.com/itajaja/markdawn/tree/master/themes) to get an idea on how to build a theme of your own!

You can also use a preconfigured theme right away! type `markdawn --themes` to see the list of available themes and then use the `-t` option to use one of these themes.

## using metadata

You can declare multi-markdown style metadata at the top of your markdown file. The metadata will be stripped down, and the values will be injected in the generated file. For example, if your markdown file starts like that:

````md
Title: How to fart silently
Author: Giacomo Tagliabe
````

and the index.html looks like that:

````html
<div class="title-page">
  <div>{{Title}}</div>
  <div>{{Author}}</div>
</div>
````

The generated pdf will show the injected values in the title page. Have a look at the [preconfigured themes](https://github.com/itajaja/markdawn/tree/master/themes) for additional examples.

## TODO

- [x] a folder that contains all the static elements. (defaults to running folder?)
- [x] title page
- [ ] breakpages
- [ ] header + footer
- [x] margins (maybe inside metadata?)
- [x] metadata (title, author, whatever... multimarkdown style)
- [ ] themed sections
- [ ] multi column (hardly doable :/)
- [x] pdf options
- [x] theme selector
- [ ] @page media type
- [ ] math functions
- [ ] fix link and references

repository: itajaja/markdawn

gha_language: CSS

repo_name: itajaja/markdawn


text:
# Creating a dictionary from your own images

The sequence to create your own dictionary is pretty simple:

```javascript

const OrbIndexer = require('node-orbidx')

// Create an instance of the indexer and
// initialize it...
var orbIndexer = new OrbIndexer()
orbIndexer.initialize()

// Tell the indexer we are starting the training
orbIndexer.startTraining()

// Now for each image you want to train for:
orbIndexer.trainImageFile('image.jpg')
  .then(function(result) {
    console.log('Image added to training set')
  })
  .catch(function(error) {
    console.log('Error training with image: ', error.message);
  })

// Once you're done:
orbIndexer.saveTrainedIndex('trained-words.dat')
  .then(function(result) {
    console.log('Image Dictionary Saved!')
  })
  .catch(function(error) {
    console.log('Failed to save training results: ', error.message)
  })
```
You can use the dictionary you created in two ways, first you can use it at
initialization time:

```javascript
var orbIndexer = new OrbIndexer({
  wordIndexPath: 'trained-words.dat' // Use this file as visual words dictionary
})
```

Secondly you can load it when you want:

```javascript
orbIndexer.loadTrainedIndex('trained-words.dat')
  .then(function() {
    console.log('Custom word dictionary loaded')
  })
  .catch(function(error) {
    console.log('Failed to load custom dictionary: ', error.message)
  })
```

repository: CV-apps/node-orbidx

repo_name: CV-apps/node-orbidx


text:
# Question 5 (Difficulty Level: ***)

A function called `transform()` takes in two strings called `str1` and `str2` as its two parameters. The function tries to transform `str1` into `str2` by swapping two *adjacent* characters (i.e., two characters next to each other) every time. The function returns a list of strings that represents a sequence of transformations that can turn `str1` into `str2`.

You can assume that `str1` can always be turned into `str2` after a sequence of swaps of adjacent characters, i.e., `str1` and `str2` contain the same set of characters. You can also assume that `str1` does not contain any duplicate characters.

Eg., `transform('ABC', 'CBA')` may return `['ABC', 'ACB', 'CAB', 'CBA']` as a sequence of transformations. We can see that in the returned list, each string differs from the previous string with only two adjacent characters swapped, as illustrated below:

A**BC** (swapping B and C) -> **AC**B (swapping A and C) > C**AB** (swapping A and B) -> CBA

`transform('ABC', CBA')` may also return `['ABC', 'BAC', 'BCA', 'CBA']`, which is also a valid sequence of transformations. The function can return any valid sequence of transformations.

Another example: `transform('ABCDE', 'DBECA')` may return `['ABCDE', 'ABDCE', 'ADBCE', 'DABCE', 'DBACE', 'DBAEC', 'DBEAC', 'DBECA']`.

Implement this function `transform(str1, str2)` in [q5.py](../Original/q5.py).

Important Note: You are not allowed to use `while()` loop for this question. You are not allowed to use the `random` module for this question. Basically, you are not allowed to randomly generate swaps to try to solve the problem.

Use [q5_test.py](../Original/q5_test.py) to test your code. You do not need to modify q5_test.py. We will only grade your [q5.py](../Original/q5.py).

url: https://raw.githubusercontent.com/alphatrl/IS111/f09fc47f5321dc4d79b9dde97399109e2a368443/Lab Tests/2019.1 Lab Test/Question Paper/Q5.md


text:
Field builder
=============

Builder is a way to don't repeat field definition.

Define your custom field builder
```yaml
#app/config/config.yml
overblog_graphql:
    #...
    definitions:
        #...
        builders:
            field:
                -
                    alias: "RawId"
                    class: "MyBundle\\GraphQL\\Field\\RawIdField"
#               using short syntax
#               RawId: "MyBundle\\GraphQL\\Field\\RawIdField"
```

Builder class must implement `Overblog\GraphQLBundle\Definition\Builder\MappingInterface`

```php
<?php

namespace MyBundle\GraphQL\Field;

use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class RawIdField implements MappingInterface
{
    public function toMappingDefinition(array $config): array
    {
        $name = $config['name'] ?? 'id';
        $type = $config['type'] ?? 'Int!';

        return [
            'description' => 'The raw ID of an object',
            'type' => $type,
            'resolve' =><EMAIL_ADDRESS>        ];
    }
}
```

usage:

```yaml
User:
    type: object
    config:
        fields:
            rawId:
                builder: "RawId"
                description: "The user raw id"

Post:
    type: object
    config:
        fields:
            rawId:
                builder: "RawId"
                #config your builder
                builderConfig:
                    name: photoID
                    type: String
```

this is equivalent to:

```yaml
User:
    type: object
    config:
        fields:
            rawId:
                description: 'The user raw id'
                type: 'Int!'
                resolve<EMAIL_ADDRESS>
Post:
    type: object
    config:
        fields:
            rawId:
                description: "The raw ID of an object"
                type: 'String'
                resolve<EMAIL_ADDRESS>```

## Adding new types related to the field

Field builder can also generate additional types. Simply return an array in the following form from your builder:

```php
<?php
# \MyBundle\GraphQL\Field\MyFieldBuilder::toMappingDefinition
return [
    'field' => [
        // your field configuration, like in the example above
    ],
    'types' => [
        'NewType1' => [
            'type' => 'object',
            // your type configuration, like in a *.types.yaml file ...
        ],
        'NewType2' => [
            'type' => 'enum',
            // your type configuration, like in a *.types.yaml file ...
        ],
    ],
];
```

There are a few rules you have to take into account:

- New type(s) may not override existing types from configs (exception will be thrown)
- Builder may not output new type(s) more than once (exception will be thrown)
- New types will not have their builder configs processed. The type(s) must be complete (will result in exception).

Example implementation field builder with new types:

```php
<?php

namespace Overblog\GraphQLBundle\Tests\DependencyInjection\Builder;

use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class MutationField implements MappingInterface
{
    public function toMappingDefinition(array $config): array
    {
        $name = $config['name'] ?? null;
        $resolver = $config['resolver'] ?? null;
        $inputFields = $config['inputFields'] ?? [];

        $successPayloadFields = $config['payloadFields'] ?? null;
        $failurePayloadFields = [
            '_error' => ['type' => 'String'],
        ];

        foreach (\array_keys($inputFields) as $fieldName) {
            $failurePayloadFields[$fieldName] = ['type' => 'String'];
        }

        $payloadTypeName = $name.'Payload';
        $payloadSuccessTypeName = $name.'SuccessPayload';
        $payloadFailureTypeName = $name.'FailurePayload';
        $inputTypeName = $name.'Input';

        $field = [
            'type' => $payloadTypeName.'!',
            'resolve' => \sprintf('@=mutation("%s", args["input"])', $resolver),
            'args' => [
                'input' => $inputTypeName.'!',
            ],
        ];

        $types = [
            $inputTypeName => [
                'type' => 'input-object',
                'config' => [
                    'fields' => $inputFields,
                ],
            ],
            $payloadTypeName => [
                'type' => 'union',
                'config' => [
                    'types' => [$payloadSuccessTypeName, $payloadFailureTypeName],
                    'resolveType' => \sprintf(
                        '@=query("PayloadTypeResolver", value, "%s", "%s")',
                        $payloadSuccessTypeName,
                        $payloadFailureTypeName
                    ),
                ],
            ],
            $payloadSuccessTypeName => [
                'type' => 'object',
                'config' => [
                    'fields' => $successPayloadFields,
                ],
            ],
            $payloadFailureTypeName => [
                'type' => 'object',
                'config' => [
                    'fields' => $failurePayloadFields,
                ],
            ],
        ];

        return ['field' => $field, 'types' => $types];
    }
}
```

Example usage field builder with new types:

```yaml
Mutation:
    type: object
    config:
        fields:
            foo:
                builder: 'Mutation'
                builderConfig:
                    name: 'Foo'
                    resolver: 'Mutation.foo'
                    inputFields:
                        bar: {type: 'String!'}
                    payloadFields:
                        fooString: {type: 'String!'}
```

Would produce the following configuration:

```yaml
Mutation:
    type: object
    config:
        fields:
            foo:
                type: 'FooPayload!'
                resolve: '@=mutation("Mutation.foo", [args["input"]])'
                args:
                    input: {type: 'FooInput!'}

FooInput:
    type: input-object
    config:
        fields:
            bar: {type: 'String!'}

FooPayload:
    type: union
    config:
        types: ['FooSuccessPayload', 'FooFailurePayload']
        resolveType: '@=query("PayloadTypeResolver", value, "FooSuccessPayload", "FooFailurePayload")'

FooSuccessPayload:
    type: object
    config:
        fields:
            fooString: {type: 'String!'}

FooFailurePayload:
    type: object
    config:
        fields:
            _error: {type: 'String'}
            bar: {type: 'String'}
```

repository: overblog/GraphQLBundle

gha_language: PHP

repo_name: overblog/GraphQLBundle


text:
RadioactiveWorld Bukkit Plugin
==============================

This is a Bukkit Plugin which I wrote years ago. Since it had a few downloads, I decided to release the code for others to have fun with it.

Tested with CB 1.5.2-R0.1.

License: MIT.

Original BukkitDev description
==============================

A special map with highly increased difficulty!

Story
-----
The world is radioactive, only a few people were able to save themselves and escaped into a cave. They only had a few animals and basic things like wheat and water. Now, they have to survive, the overworld is contaminated forever. Only an expensive suit can protect from radiation; the radiation is less great at night.

This game is great for co-op & trading! It's more hard to get enough items to survive!

Features
--------
* players receive damage when the light level is higher than 15 (if they are in a water block: level 12)
* radiation suits (full (modified) diamond armor) prevents from beeing damaged by the sunlight
* multiworld support
* permission to bypass the damage (can be disabled)

Usage
-----
To craft a radiation suit, a diamond armor part with 8 (configurable) emeralds has to be put in the crafting field (it's a shapeless recipe): (see crafing.png in repository)

You need a Radiation Helmet, Radiation Chestplate, Radiation Leggings and Radiation Boots in order to be protected from radiation.

How to
------
- create a new map with big cave with animals, farms and whatever you like; don't forget to set the spawn point there
- set difficulty to normal; otherwise, it's boring
- install the plugin (instructions below)

Configuration
-------------
Just copy RadioactiveWorld.jar into your plugins-folder. Config files will be created on first run.

config.yml
----------
* `worlds`: list of worlds in which the plugin will be active
* `permission`: boolean; if set to false, the permissions will have no effect
* `armorcost`: integer; from 0 to 8: number of emeralds needed for crafting a part of a suit
* `playerdamage`: integer; player's damage per tick
* `armordamage`: float; damage of the radiation suit per tick

Permissions
-----------
* `RadioactiveWorld.bypass`: disables the plugin for the player

repository: derjasper/RadioactiveWorld

repo_name: derjasper/RadioactiveWorld


text:
---
title: Working from home with Amazon Alexa
description: "Having a virtual assistant while working from home provides some nice uses throughout the day."
tags: [Alexa, AI, assistant, discuss]
canonicalLink: https://dev.to/tonydiaz/make-your-own-gatsby-starter-template-349o
date: 2020-07-17
---

Smart speakers are now common in many households. More and more devices are getting built-in virtual assistants like Alexa, Google Home, or Siri.

I currently have three Amazon Echo devices in the house. One is on the desk I use while working from home.  I enjoy the convenience of sitting at my desk and asking Alexa to do numerous things without the need to get up.

![Amazon echo dot](https://dev-to-uploads.s3.amazonaws.com/i/ydjg0yw0nkmqldjb3se3.jpeg)

**Here are the ways I use Alexa during the day:**

## Music:
```
"Alexa play SiriusXM"
```
Probably the most popular feature of any smart speaker. Alexa has the ability to play music from all the major streaming apps (Spotify, Amazon Music, Apple Music, Pandora). I can pick the specific SiriusXM channel to listen to music throughout the day.

## News:
```
"Alex, tell me what's new"
```
I get the morning news from NPR. Typically it is the highlights of what is happening in the country and world. You can configure it to get more local news.

## Smart devices:
```
"Alexa set the thermostat to <desired temperature>"
```
I have an Ecobee smart thermostat at home that allows me to change the temperature without moving away from my desk.

## Reminders and Alarms:
```
"Alexa remind me to call Jen at 3 pm"
```
Alexa serves as a great assistant notifying me of reminders or alarms to get on a call before a meeting.

## Package delivery:
```
"Alexa, notifications"
```
When the echo dot has a green light shining on it means there is a notification for me. When packages are delivered Alexa will let me know and I can grab them. This is a really nice feature if you live in an area that may steal a package if it is left out for a while.

## Find misplaced phone:
```
"Alexa call my phone"
```
Alexa can call my phone if I have misplaced it. Although I don't use it very often it is helpful when I need to find my phone in the house.

## Other possibilities?
I feel like I'm just scratching the surface on the possibilities. I'd like to leverage even more ways to integrate an AI virtual assistant throughout my day to make things even more convenient.

Do you use a virtual assistant while you work? If so what do you use it for?


text:
# Wordpress dev environment using Docker

A docker setup for wordpress development.

## Requirements

- Docker: [https://docs.docker.com/engine/installation/#supported-platforms](https://docs.docker.com/engine/installation/#supported-platforms)
- Wordpress: You should be able to provide your own clean Wordpress installation. (Since this build uses PHP version 7.3 only Wordpress version 4.9.3 or higher is supported.).

Make sure you got both Docker: `docker -v` and docker-compose: `docker-compose -v`

## Usage

1. Navigate to the root of this project.
2. Add your Wordpress installation and name the folder containing your Wordpress files as `wordpress`. (If you want to call it anything else please also change this on line 6 and 14 of the docker-compose.yml file).
3. Replace the `<YOUR_THEME_FOLDER>` in the php and nginx volumes with your theme folder name. Caching everything except the theme folder will boost your performance on macOS.
4. Build the project with `docker-compose build`
   - Make sure you Use Linux containers (Windows only)
   - Execute commands in CMD as administrator (Windows only)
5. For performance reasons on Mac and Windows you should replace the web volume with the directory you are actively editing i.e. your theme folder during development. (Instead of the entire Wordpress directory).
6. Start the services by using `docker-compose up` you can add the -d option to run the services in the background.
7. Use `docker container ls` to check the status of the current active containers.

```text
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                                      NAMES
24a49c812b67        wordpress-docker_php   "docker-php-entrypoi…"   3 minutes ago       Up 5 seconds        <IP_ADDRESS>:80->80/tcp, <IP_ADDRESS>:443->443/tcp   wordpress_web
e318ce97efa6        mysql:8.0              "docker-entrypoint.s…"   3 minutes ago       Up 6 seconds        <IP_ADDRESS>:3306->3306/tcp, 33060/tcp          wordpress_db
```

8. You can use bash commands within a container by using `docker exec -ti <CONTAINER_NAME> bash` (CONTAINER_ID instead of CONTAINER_NAME will also work)
9. You can stop the containers by using `docker-compose stop`. Or stop a specific container by using `docker stop <CONTAINER_NAME>`
10. To access the Wordpress site in your browser use **localhost** as url.
11. During the Wordpress installation step, use the following credentials for your Database:
    1. Database Name: wordpress
    2. Username: wordpress
    3. Password: wordpress
    4. Database Host: db:3306

## Using xDebug

The xdebug php extension has been added to the php container for debugging purposes. To use the debugger you should listen to port **9001**. You should map your local wordpress folder to the /code folder on the container.

In VSCode the launch.json configuration will look as follows:

```json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9001,
      "pathMappings": {
        "/code": "${workspaceRoot}/wordpress"
      }
    }
  ]
}
```

## Using SSL

SSL is disabled by default but if you've got some local certificates you can easily enable it in the ./docker/php/apache.conf file.
Using the mkcert tool will make the process really easy.

repository: melvinversluijs/wordpress-docker

repo_name: melvinversluijs/wordpress-docker


text:
# fileCryption
 Note: The code is incomplete and works only for some cases.
(Practice code)

A simple C program for encryption/decryption/hashing of strings and files.

## Features
### Encrypt

* mono alphabetic cipher

* key file encryption

* AES

### Decrypt

* mono alphabetic cipher

* key file encryption

* AES

### Cryptographic hash
* SHA-1

### Usage
Use CLI to choose options to perform desired operations
(Note: This is not an API).

### Compiling
included make-file

gha_language: C


text:
# Octolo

[![Build Status](https://travis-ci.org/rail44/octolo.svg?branch=master)](https://travis-ci.org/rail44/octolo) [![crates.io](https://img.shields.io/crates/v/octolo.svg)](https://crates.io/crates/octolo)

Octo To Local, Open files with local editor from GitHub web.

## Supported Platforms

### Operating Systems

* Linux
* Mac OS

### Editors

* Neovim
* Visual Studio Code
* JetBrains IDEs

And, you can execute any command with editor kind `cmd` .

### Browsers

* Firefox
* Chrome
* Chromium

> note: Although not well tested, Opera, Edge and Vivaldi may run with configuration that same as Chrome.

## Installation

### Install Native Application

Because we use Native Messaging API, you should install native application.

#### with curl

Executable binary is available for each releases.

###### for Linux

```sh
# In any directory conteined in $PATH
$ curl -Lo octolo https://github.com/rail44/octolo/releases/latest/download/octolo-x86_64-unknown-linux-musl
$ chmod a+x octolo
```

###### for Mac OS

```sh
# In any directory conteined in $PATH
$ curl -Lo octolo https://github.com/rail44/octolo/releases/latest/download/octolo-x86_64-apple-darwin
$ chmod a+x octolo
```

#### with Cargo

```sh
$ cargo install octolo
```

### Configuration

Create `~/.config/octolo/octolo.toml` like bellow.

```toml
# Comment out browsers your using
browser_list = [
    # "Firefox",
    # "Chromium",
    # "Chrome"
]

# If you have configuration ghq.root, Octolo will use it as default
# root = "/home/john/src"

# path = github.com/{{user}}/{{repository}}

# Use configurations for editor your using
[[editors]]
kind = "neovim"
# The address that nvim listening. By default, Octolo uses $NVIM_LISTEN_ADDRESS
# address = ""

[[editors]]
kind = "visual-studio-code"
bin = "/usr/local/bin/code" # Path of $(which code)

[[editors]]
kind = "jetbrains-ide"
name = "IntelliJ IDEA" # or "PHPStorm", "RubyMine" ...
bin = "/usr/local/bin/idea" # Path of $(which idea)

# Or, you can execute any commands.
# cmd should be defined with handlebars syntax.
[[editors]]
kind = "cmd"
cmd = [
    "your-favorite-cli",
    "-f {{path}}",
    "-l {{line}}"
]
```

**Once creating configuration, run bellow**

```sh
$ octolo cofig dump
# Dump full config with optional fields...

$ octolo manifest
# Dump Native Messaging Manifests for each browsers

$ octolo manifest -w
# And place it!
```

Manifests contains absolute path for octolo.
When you change location of it, you should redo above.

### Install WebExtension

Firefox: [https://addons.mozilla.org/ja/firefox/addon/octolo/](https://addons.mozilla.org/ja/firefox/addon/octolo/)
Chrome: [https://chrome.google.com/webstore/detail/octolo/igdmgdknajejkdpaonpnpjedakhppiob](https://chrome.google.com/webstore/detail/octolo/igdmgdknajejkdpaonpnpjedakhppiob)

Then, you can open files by right-click menu from GitHub Web!

## Bulid

### WebExtension

```sh
# In `extension` dir
$ npm install
$ npm run build
```

### Native

```sh
# In `native` dir
$ cargo build
```

license: Unlicense

gha_language: Rust

gha_license_id: Unlicense


text:
fromxml utility -- converts XML to BSON.

NOTE: PRELIMINARY IMPLEMENTATION (at time of this writing).

## Usage

  fromxml <options> < infile.xml > outfile.bson

Run fromxml -h for options.

### Interpretation of structure

(Note this may evolve, but this version...)

<foo>asdf</foo>

becomes:

{ foo: "asdf" }

<foo x=33.3>asdf</foo> becomes:

{ foo: { x: "33.3", foo: "asdf" } }

3<c>asdf</c> becomes:

{ a: { b: "3", c: "asdf" } }

### Numerics

Use -t <options> or -f <field>=options to set rules for interpretation of datatypes.

<x>3</x>

would by default yield: { x : "3" }

with "-t n": { x : 3 } (where the 3 is an int32)

with "-t f": { x : 3.0 }

That is to say the 'n' option uses the smallest type that makes sense.

More data types will be done later hopefully.

repository: aksaharan/bsontools

repo_name: aksaharan/bsontools


text:
[![Build Status](https://travis-ci.com/FabrizioBrancati/SwiftyBot.svg?branch=master)](https://travis-ci.org/FabrizioBrancati/SwiftyBot)
[![Coverage Status](https://codecov.io/gh/FabrizioBrancati/SwiftyBot/branch/master/graph/badge.svg)](https://codecov.io/gh/FabrizioBrancati/SwiftyBot)
[![Maintainability](https://api.codeclimate.com/v1/badges/4e5f16144afda5c8ae36/maintainability)](https://codeclimate.com/github/FabrizioBrancati/SwiftyBot/maintainability)
[![Codebeat Badge](https://codebeat.co/badges/ff777248-e375-4c6d-8a77-4475c2bc9ae1)](https://codebeat.co/projects/github-com-fabriziobrancati-swiftybot-master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e71d428e5a9e493d966de02608e6e110)](https://www.codacy.com/manual/FabrizioBrancati/SwiftyBot)

[![Version](https://img.shields.io/badge/version-3.0.0-blue.svg)](https://developer.apple.com/swift/)
[![Language](https://img.shields.io/badge/language-Swift%205.1-orange.svg)](https://developer.apple.com/swift/)
[![Platforms](https://img.shields.io/badge/platform-Linux%20/%20macOS-cc9c00.svg)](https://developer.apple.com/swift/)
[![License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/FabrizioBrancati/SwiftyBot/blob/master/LICENSE)

---

    Features •
    Platforms and Tutorials •
    Language Support •
    Requirements •
    Communication •
    Contributing •
    Deploying •
    Platforms Usage •
    Documentation •
    Changelog •
    Demos •
    Authors •
    License

---

Features
========

SwiftyBot is an example of how to create a bot with [Swift](https://swift.org/) on top of [Vapor](https://github.com/vapor/vapor).

Here is the list of all the features:
- [x] Telegram bot integration
- [x] Facebook Messenger bot integration
- [x] Google Assistant bot integration
- [x] Well documented (you can find more in [Documentation](https://github.com/FabrizioBrancati/SwiftyBot#documentation) section)
- [x] Well tested (currently 99% of code coverage)
- [x] Clean (every bot platform has its folder with its files and tests)
- [x] Easy to follow (every bot platform comes with a tutorial, more in [Platforms and Tutorials](https://github.com/FabrizioBrancati/SwiftyBot#platforms-and-tutorials) section)
- [x] Multi language support

> There are a lot of bot platforms out there that can be added...

Platforms and Tutorials
=======================

| **Bot Platform**   | **Blog Post Link** |
|--------------------|--------------------|
| Telegram           | _[How to create a Telegram bot with Swift using Vapor on Ubuntu / macOS](https://www.fabriziobrancati.com/SwiftyBot)_ |
| Facebook Messenger | _[How to create a Facebook Messenger bot with Swift](https://www.fabriziobrancati.com/SwiftyBot-2)_ |
| Google Assistant   | _[Not Available Yet](#)_ |

Language Support
================

- English (en)

Requirements
============

- Ubuntu 14.04 or later with Swift 5.1 or later / macOS with Xcode 11.2 or later
- Telegram account and a Telegram app for any platform (Telegram bot only)
- Facebook account and a Facebook Messenger app for any platform (Facebook Messenger bot only)
- Google account and a Google Assistant app for any platform (Google Assistant bot only)

Communication
=============

- If you need help, open an issue.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, see [Contributing](https://github.com/FabrizioBrancati/SwiftyBot#contributing) section.

Contributing
============

See [CONTRIBUTING.md](https://github.com/FabrizioBrancati/SwiftyBot/blob/master/.github/CONTRIBUTING.md) file.

Deploying
=========

## Private Server
1. Install Swift on your computer / server
2. Install [Vapor Toolbox](https://github.com/vapor/toolbox) (Optional)
3. Enable TLS (You can use [Let's Encrypt](https://letsencrypt.org))
4. Use Apache or nginx as reverse proxy
5. Use Supervisor to ensure your bot is always up and running

If you need more help through this steps, you can read [How to create a Facebook Messenger bot with Swift](https://www.fabriziobrancati.com/SwiftyBot-2) blog post, from [Step 1](https://www.fabriziobrancati.com/SwiftyBot-2#step-1) to [Step 4](https://www.fabriziobrancati.com/SwiftyBot-2#step-4).

## Heroku
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

1. Click the button above
2. Go to the _Settings_ section of your application
3. Click on the _Reveal Config Vars_ button in _Config Vars_ section
4. Copy all the created secret key set to up the bots, read the next sections for more info

## Vapor Cloud
1. Create an account on [Vapor Cloud](https://dashboard.vapor.cloud)
2. Create an organization
3. Create a project
4. Create an application
5. Add an hosting service and connect it to your GitHub repository
6. Add at least 1 environment, 2 is better
7. Use the [Vapor Toolbox](https://github.com/vapor/toolbox) to deploy your bot

Platforms Usage
===============

## Telegram
1. Set a secret key in `TELEGRAM_SECRET` environment variable
2. Create a Telegram bot with [BotFather](https://telegram.me/botfather)

If you need more help through this steps, you can read [How to create a Telegram bot with Swift using Vapor on Ubuntu / macOS](https://www.fabriziobrancati.com/SwiftyBot) blog post.

## Facebook Messenger
1. Set a secret key in `MESSENGER_SECRET` environment variable
2. Create a Facebook app and Page
3. Get a Page access token and set it in `MESSENGER_TOKEN` environment variable

If you need more help through this steps, you can read [How to create a Facebook Messenger bot with Swift](https://www.fabriziobrancati.com/SwiftyBot-2) blog post.

## Google Assistant
1. Set a secret key in `ASSISTANT_SECRET` environment variable
2. Create an Actions on Google project
3. Setup Actions on Google project on Dialogflow

Documentation
=============

## Bot
- Every line of every project file is commented.
- If you need Vapor documentation you can find it [here](https://docs.vapor.codes/).

## Platforms
- If you need Telegram bot documentation you can find it [here](https://core.telegram.org/bots/api).
- If you need Facebook Messenger bot documentation you can find it [here](https://developers.facebook.com/docs/messenger-platform).
- If you need Google Assistant bot documentation you can find it [here](https://developers.google.com/assistant) and [here](https://dialogflow.com/docs). You can also find some JSON examples [here](https://developers.google.com/actions/conversation-api-playground) and [here](https://github.com/dialogflow/fulfillment-webhook-json).

Changelog
=========

To see what has changed in recent version of SwiftyBot, see the **[CHANGELOG.md](https://github.com/FabrizioBrancati/SwiftyBot/blob/master/CHANGELOG.md)** file.

Demos
=====

### Telegram
You can open Telegram and search for **[SwiftyBot](https://telegram.me/SwiftyBot)** to start talking with him!

### Facebook Messenger
You can open Facebook Messenger and search for **[SwiftyBotMessenger](http://m.me/SwiftyBotMessenger)** to start talking with him!

### Google Assistant
You can open Google Assistant and write **[Talk to SwiftyBot](https://assistant.google.com/services/invoke/uid/000000d447b4593f)** to start talking with him!

Authors
=======

### Bot
**Fabrizio Brancati**

[https://www.fabriziobrancati.com](https://www.fabriziobrancati.com) - [fabrizio.brancati<EMAIL_ADDRESS>
### Icon
**Roberto Chiaveri**

[http://robertochiaveri.it](http://robertochiaveri.it)

License
=======

SwiftyBot is available under the MIT license. See the **[LICENSE](https://github.com/FabrizioBrancati/SwiftyBot/blob/master/LICENSE)** file for more info.

repository: AleksandrMR/SwiftyBot

repo_name: AleksandrMR/SwiftyBot


text:
# 1.  Workshop 1 - Command Line, Git and Python, Getting started

## 1.1 Basic command line usage

Opening a terminal. Navigating through directories. Basic actions: executing files, creating and deleting files and directories, copying and moving.

An operating system is a series of excuses and abstractions that allow us to use text fields to control hardware operations. These text fields can be directly entered using a terminal emulator. (the real terminal is likely being used by your operating system to render the graphical environment that you're using and provides all the modern niceties of mouse support, windowed environments and anything that isn't strictly text based).

| Operating System        | Getting to your terminal emulator  |
| ------------- |-------------:|
| Windows      | Window + r gives you a "run" window. Into this enter either cmd.exe or powershell.exe |
| Linux      | Depends on your choice of window manager, common short cuts are Ctrl + Alt + T, but it could be just about anything. |
| Mac | Command + Spacebar and type in "terminal" |

You can replace the windows terminal emulator with Bash if you want, this can either be done by installing Git Bash, or by running Windows Subsystem for Linux (WSL). Whatever you do, it's highly recommended to set a key binding to open your terminal emulator.

These terminals take commands in the form of text and return responses in the form of text (generally ASCII encoded). This common format allows us to pass text not only to commands, but take the output of one command as the input to another.

| Command        | Unix (Linux or Mac) | Windows |
| ------------- |:-------------:| -----:|
| List Directory Contents |  `ls` | `dir` (ls will work on powershell) |
| Change Directory   |  `cd <path>` | `cd <path>` |
| Copy a file | `cp <source> <destination>` | `cp <source> <destination>` |
| Move a file | `mv <source> <destination>` | `mv <source> <destination>` |
| Make a directory | `mkdir <path to new directory>` | `mkdir <path to new directory>` |
| List processes and pids| `ps au` (or `top` or `htop`)| `tasklist` |
| Killing a process| `kill <pid>` | `taskkill /F /PID <pid>` |
| Shutdown | `shutdown now` | `poweroff -s -t 0` |
| Restart | `restart now` | `poweroff -r -t 0` |
| Execute a file | `<command to run file> <path to file>` | `<command to run file> <path to file>` |
| Executing a Python file | `python <path to file>` | `python <path to file>` |

When you need to specify a path as an argument this is a relative path from the current directory. Unix paths must use the forward-slash key (as backslash is reserved to escape certain characters) while windows originally used backslashed paths and now uses both.

There are a few useful short-cuts that are almost essential

| Command        |  Character | Example
| ------------- |:-------------:| -----:|
| Auto complete | tab | Just about anything really |
| Previous command | Up arrow key | |
| Absolute Path |  `/` or `C:\` | `cd /home/` or `cd C:\` |
| Up a directory   |  `..` | `cd ..` |
| Home Directory | `~` | `cd ~/Documents` |
| Previous command | `!!`| `sudo !!` |
| Interrupt a process | Ctrl + C| |
| EOF | Ctrl + D | |

It's worth noting that the tab key will auto complete paths (and some commands), making this quite a bit faster than typing everything out manually. Depending on how your shell is configured, pressing tab twice may also list possible completions if you aren't sure what you were looking for.

It's worth noting that the tab key will auto complete paths (and some commands), making this quite a bit faster than typing everything out manually. Depending on your terminal, pressing tab twice may also list possible completions if you aren't sure what you were looking for.

The terminal is an incredibly useful tool that we will be using throughout the workshop.

## *[Problem 5-10 minutes] - Command Line Blues*

Get used to the command line:

- Open up a terminal and try to navigate from your current position to the topmost (root) directory and then back to your own Documents folder.
- Once you've managed this, try to find the process ID of your terminal emulator and get it to terminate its own process.
- Re-open your terminal and navigate to `__equs__.python`, in here make a new directory titled 'problems'. Keep your code from today in here. (in later weeks we'll be converting this to a git repository).

As ever, if you are stuck or unsure about what to do, ask sooner rather than later.

## 1.2 Hello Version Control (Git)

Git is version control software that allows you to checkout and
collaborate with software projects. It is designed to track updates to
software projects through the use of `commit`s versions. Users can
construct checkout and have their own version of a software project by
`clone`ing the software repositoru.

We will be introducing you to git by making this very repository
a git repository. You will be able to clone your own version and
`push` to your own account or just simply hold it on your own system.

## 1.2.1 Checkout the tutorial

You can checkout the tutorial by cloning the following repository
`https://github.com/equs-python/__equs__.Python`. You will need to
use the `clone` subcommand with git like so.

```
git clone https://github.com/equs-python/__equs__.Python
```

If this command is not working, it is likely you have encountered an
issue with your platform's setup with git.

## 1.2.2 Constructing a repository

If you haven't already, please go to `github.com` and sign up for a github
account. This account allows you to store your software projects remotely
on github. This can enable collaborate and for this particular workshop,
   can be used to demonstrate and display your knowledge.

After creating an account, you can visit `https://github.com/equs-python/__equs__.Python` and `fork` the repository. This will allow you to have
your own snapshot of the repository as part of your own account.

## 1.3 Hello Python!

Python is a high-level scripting language. It's quite flexible and has a well supported package library that allows it to do everything from scientific computing to running a twitter bot. The ease of use of Python does come at something of a trade-off in performance, however in most cases the faster code development will more than offset the extra time required to run the code

For historical reasons currently Python 2 and 3 exist as slightly different languages, Python 2 support will end in less than a year and so it's not particularly worth going into the differences between the two except to suggest using Python 3.

Another key point is that Python is named after 'Monty Python', hence it is somewhat obligatory that any tutorial in the language include slightly too many references to 1970s British comedy. It is noted in advance that including jokes is a generally poor design choice for any real code.

### 1.3.1 Command line Interpreter

Open up the python command line interpreter (CLI) with the `python` command from your terminal emulator. As Python is an interpreted language, each line is read and executed in order. Thanks to this feature, we can use a Python terminal and simply give it Python code to execute.

Obviously, the first thing we do in any language is print the string "Hello World", I have it on good authority that the exclamation mark at the end of this string is strictly optional.

```python
>>> print("Hello World")
```

We can also treat it as a basic calculator

```python
>>> 1 + 2
3
```

The up arrow key will iterate through previous commands, which is faster than typing them out.

The regular maths operations are present (`+-/*`), as are powers: `**` and modulus `%`.

The up arrow key will iterate through previous commands, which is faster than typing them out.

### *[Problem - 2 Minutes] - Draw a box*

Use multiple print statements to output a box to the terminal. Your program should output the following
onto the terminal.

```
+=======+
|       |
|       |
|       |
+=======+
```

### 1.3.3 Literals and Variables

In the above examples `1` is a literal value, in theory I cannot change what `1` is, for example the following operation is illegal:
```python
1 = 2
```
The operations are baked into the instructions that are part of the program and for the most part cannot be modified.
Conversely I can define regions of memory that may hold a variable value. These regions of memory are labelled with some name and are termed variables. Variables may be assigned a value using the assignment operator `=`.

```python
variable = 2
```

Unlike some other languages, variables in Python are untyped, the interpreter decides what the best type for the variable based on the data provided. This also implies that literals carry their own type which is then assumed by the variable.

```python
an_int = 2
a_float = 2.2
a_string = 'abc'
another_string = "def"
more_strings = """hijk"""
and_the_other_way = '''lm"no'''
a_complex_number = 1j
a_boolean = True
a_none_type_object = None
a_bytes_object = b"001010"
```

The assignment operator may also be used to assign the value of one variable to another:

```python
x = 5
y = x
```

We now have two different regions of memory labelled `x` and `y` each containing the same data.

You can check the type of a variable using the `type()` function, for example:

```python
>>> type(an_int)
int
```

If you don't know what a function does you can use the `help()` function to read the documentation for the function, so for instance, you should be able to call

```python
help(type)
```

## *[Problem - 5 minutes] - Operational*

Some very basic Python:

 - Initialise a variable to some negative or complex number.
 - Figure out how to take the absolute value of your variable. The `help` function will be useful here. There may be more than one way to do this.
 - What is the type of the help function?
 - What is the type of the type function?

We've implicitly started using a number of operators here. What is the behaviour of each of the following operators and what types are they defined over? Some of these operators may exhibit different behaviour for different types. The `bin` function is defined over some types and may assist in decyphering some of these operators.

 - `=`
 - `+`
 - `-`
 - `%`
 - `/`
 - `*`
 - `|`
 - `&`
 - `^`
 - `~`

 Or some digraphs:

 - `==`
 - `//`
 - `<<`
 - `>>`
 - `**`

Lastly some compound operators:

 - `+=`
 - `**=`
 - `%=`
 - `<<=`

Some operators are also more verbose than those above:

 - `and`
 - `or`

This list is not exhaustive, especially the compound operators. Pay special attention to the division operators, what implicit type conversion occurs in each case?

## *[Problem - 5 minutes] - Binary Logic*
Distinguish between the `and` and `&` operator and the `or` and `|` operator. Consider the following cases:

 - `5 and 2` vs `5 & 2`
 - `5 or 2` vs `5 | 2`

### 1.2.3 Casting

We can cast between different types using the appropriate functions.

```python
print(int(5.1))
print(float(7))
print(chr(42)) # Have a look at the ascii table for this one - `man ascii`
print(ord('a'))
print(str(5))
print(str(5.0))
print(bin(5))
```

## *[Problem - 5 minutes] - Casting Logic*

 - Demonstrate that `ord` and `chr` are each other's inverse
 - Distinguish between the str and chr casts.
 - Consider the following casts:

 ```python
 int("5.0")
 int("50", 12)
 int("101010110", 2)
 ```
  - The `hex` function also contains an implicit cast, how would you invert the `hex` function?

### 1.2.4 Truth and Falsehood

Python has an interesting relationship with the notions of binary truth. Consider the following comparisons

 - `1 == True`
 - `0 == False`
 - `0.0 == False`
 - `1.0 == True`

 Initially we might consider that 0 is false and 1 is true and that is the end of it, but:

 - `2 == True`
 - `2 == False`
 - `'a' == True`
 - `'a' == False`
 - `'' == True`
 - `'' == False`

We're now posed with an object that is neither true nor false. At this point we adopt a model of "truthyness" and "falseyness", for the purposes of binary logic non-zero integers are considered to be "truthy" and hence will, when forced, evaluate to True, this is also true for non-empty strings. Conversely empty strings and the None type are considered to be "falsey" and will evaluate to false.

## 1.3 Control flow in Python

With our model of programs as a series of instructions in memory accessed by a particular address it follows that we can increment or set this address at will. If we increment by a variable we now have runtime programmatic control over the next sequence of instructions to execute. This is the basis of switches, loops, functions and more generally control flow.

It would be useful for Python to be more than a glorified if somewhat introspective calculator, so we need something to control the program flow. Typically these are switches (if statements) and loops (for and while). Unlike other languages blocks of code within these control statements are de-marked by indentation. Perhaps the biggest hurdle of learning to use Python is inconsistent use of tabs and spaces. To save time and effort, the correct approach according to Python is four spaces for an indent.

The start of an indented block is also indicated by a colon on the preceding line.

## *[Problem 5 minutes] Cacluating your grade*

You are required to construct a program that will
compute your current grade given the mark you have received
from your semester.

You are to read the mark from input and your program must output
what grade that mark corresponds to.

Given a mark of 85 or above, your program should output A
Given a mark of 75 or above, your program should output B
Given a mark of 65 or above, your program should output C
Given a mark of 50 or above, your program should output D
Given a mark below 50, your program should output F.

### 1.3.1 Switches
A switch is a common programming language feature where if a certain condition is met then the following code of block is executed. It consists of an `if` statement followed by the condition and the block to execute and then some number of optional `elif` statements with their own conditions before an optional `else` statement with its own block to be executed if none of the other conditions were met.

```python
if spanish_inquisition is True:
    print("Unexpected")
elif spanish_inquisition is None:  # elif is short for else if
    print("Probably also unexpected")
else:
    print("No spanish inquisition here")
```
At this point it's probably a good idea to introduce some more Python syntax. Unlike most languages, Python tends to use words rather than symbols for its logical operations (as opposed to the binary operations seen earlier). For instance `and` and `or` are keywords:

```python
if True or False:
    print("This will always return True!")

if True and False:
    print("This will never execute!")
```

Equality testing can be done using either the more traditional `==` or the `is` keyword. `is` really compares the addresses of the two objects, and hence: `x is y` is equivalent to `id(x) == id(y)`. Conversely the regular comparison operation compares the values stored at both of those addresses (with some interesting conversions between floating point and integer types).

```python
if 5 == 5:
```
or
```python
if 5 is 5
```
However
```python
5.0 == 5
True
```
and
```python
5.0 is 5
False
```

There are also the usual greater than and less than comparison operations.
```
> : Greater than
< : Less than
>= : Greater then or equal to
<= : Less than or equal to

```

Logical statements can also be nested or grouped using brackets

```python
if (x > 5) and (x < 7):
    print("x might be 6")
```

## *[Problem 5 minutes] Multiplicative*
Write a simple chunk of Python code that determines if a number is a multiple of 13 and a multiple of 3 but not a multiple of 9.

## 1.4.2 Introduction to Loops

Loops are a construct that repeat some section of code until a condition is fulfilled. If the condition cannot be fulfilled in a timely manner, they will persevere despite your efforts and you will probably need to intervene.

There are two types of loops in Python, the `for` loop and the `while` loop.

The for loop iterates over some collection or range of objects (more on this later) while the while loop simply waits for a condition to be fulfilled.

Try running the following code to get an idea of each of them:

```python
i = 0
while i < 10:
    i = i + 1
    print(i)
```

```python
for i in range(10):
    print(i)
```

Both of these loops have their uses, try to use one of each in the next problem.

## *[Problem - 10 minutes] - In the Loop*

Getting used to Loops and Switches:

- Write a loop to print each number from 2 to 100
- Modify your previous code to print each even number from 2 to 100
- Modify your previous code to print each prime number from 2 to 100
- (Extension) If you have time left over increase this to primes up to 10000 and `import time` to use the time.time() function to test the speed of your code. If you don't know what this function does, don't forget to use `help()`.
- Again, if you have spare time, try to improve the performance of your code!

## *[Problem - 10 minutes] - Input Sum*

Construct a program that will loop until the user specifies `Q`. In each iteration the program will ask the user
to `input` a number. This number will be added to a running total.

When `Q` is inputted, the program will output the running total and quit.

## 1.3.3 Scope

Unlike many other languages Python scope is at the function level not the block level, as a result the following is legal (but dangerous) Python code:

```python
if x:
  y = 6 # New variable y instantiated
print(y)
```

This code will function correctly if `x` evaluates to `True` but will throw an error regarding `y` being undefined if `x` evaluates to `False`.

### *[Problem - Homework] - No Ifs*
Write a program that takes three integer inputs:

 - If all inputs are equal print their sum
 - If one input differs, print the input that differs
 - If all inputs are different, print their product

You may *not* use the if keyword or any other control flow. The following relations may be helpful:

```python
int(False)
int(not not(x ^ 5))
5 ^ 6 ^ 5
```


text:
---
layout: post
title: "Raven: Open Surgical Robotic Platforms"
date: 2019-06-27 15:51:17
categories: arXiv_RO
tags: arXiv_RO Review
author: Yangming Li, Blake Hannaford, Jacob Rosen
mathjax: true
---

* content
{:toc}

##### Abstract
The Raven I and the Raven II surgical robots, as open research platforms, have been serving the robotic surgery research community for ten years. The paper 1) briefly presents the Raven I and the Raven II robots, 2) reviews the recent publications that are built upon the Raven robots, aim to be applied to the Raven robots, or are directly compared with the Raven robots, and 3) uses the Raven robots as a case study to discuss the popular research problems in the research community and the trend of robotic surgery study. Instead of being a thorough literature review, this work only reviews the works formally published in the past three years and uses these recent publications to analyze the research interests, the popular open research problems, and opportunities in the topic of robotic surgery.

##### Abstract (translated by Google)

##### URL
[http://arxiv.org/abs/1906.11747](http://arxiv.org/abs/1906.11747)

##### PDF
[http://arxiv.org/pdf/1906.11747](http://arxiv.org/pdf/1906.11747)