text:
# Setting up WizBot on Linux

| Table of Contents                            |
|:---------------------------------------------|
| [Linux From Source]                          |
| [Source Update Instructions]                 |
| [Linux Release]                              |
| [Release Update Instructions]                |
| [Tmux (Preferred Method)]                    |
| [Systemd]                                    |
| [Systemd + Script]                           |
| [Setting up WizBot on a VPS (Digital Ocean)] |

#### Operating System Compatibility

It is recommended that you use **Ubuntu 20.04**, as there have been nearly no problems with it. Also, **32-bit systems are incompatible**.

### Ubuntu 22.04 is ruled as incompatible so double check which ubuntu version you are using.

##### Compatible operating systems:

- Ubuntu: 16.04, 18.04, 20.04
- Mint: 19, 20
- Debian: 10, 11
- CentOS: 7
- openSUSE
- Fedora: 33, 34, 35

## Linux From Source

##### Migration from v3 -> v4

Follow the following few steps only if you're migrating from v3. If not, skip to installation instructions.

Use the new installer script:  `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/-/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
> - Install prerequisites (type `1` and press `enter`)
> - Download (type `2` and press `enter`)
> - Run (type `3` and press `enter`)
> - Done

##### Installation Instructions

Open Terminal (if you're on an installation with a window manager) and navigate to the location where you want to install the bot (for example `cd ~`)

1. Download and run the **new** installer script `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
2. Install prerequisites (type `1` and press enter)
3. Download the bot (type `2` and press enter)
4. Exit the installer (type `6` and press enter)
5. Copy the creds.yml template `cp wizbot/output/creds_example.yml wizbot/output/creds.yml`
6. Open `wizbot/output/creds.yml` with your favorite text editor. We will use nano here
    - `nano wizbot/output/creds.yml`
7. [Click here to follow creds guide](../../creds-guide)
    - After you're done, you can close nano (and save the file) by inputting, in order
       - `CTRL` + `X`
       - `Y`
       - `Enter`
8. Run the installer script again `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
9. Run the bot (type `3` and press enter)

##### Source Update Instructions

1. ⚠ Stop the bot ⚠
2. Update and run the **new** installer script `cd ~ && wget -N https://github.com/Wizkiller96/wizbot-bash-installer/raw/v4/linuxAIO.sh && bash linuxAIO.sh`
3. Update the bot (type `2` and press enter)
4.  (Optional) Installing Redis
   - ubuntu installation command: `sudo apt-get install redis-server`
2. Playing music requires `ffmpeg`, `libopus`, `libsodium` and `youtube-dl` (which in turn requires python3)
   - ubuntu installation command: `sudo apt-get install ffmpeg libopus0 opus-tools libopus-dev libsodium-dev -y`
3. Make sure your python is version 3+ with `python --version`
   - if it's not, you can install python 3 and make it the default with: `sudo apt-get install python3.8 python-is-python3`

*You can use wizbot bash script [prerequisites installer](https://github.com/Wizkiller96/wizbot-bash-installer/blob/v4/w-prereq.sh) as a reference*

##### Installation Instructions

1. Download the latest release from <https://gitlab.com/WizNet/wizbot/-/releases>
    - Look for the file called "X.XX.X-linux-x64-build.tar" (where X.XX.X is a series of numbers) and download it
2. Untar it
    - ⚠ Make sure that you change X.XX.X to the same series of numbers as in step 1!
    - `tar xf X.XX.X-linux-x64-build.tar`
3. Rename the `wizbot-linux-x64` to `wizbot`
    - `mv wizbot-linux-x64 wizbot`
4. Move into wizbot directory and make WizBot executable
    - `cd wizbot && chmod +x WizBot`
5. Copy the creds.yml template
    - `cp creds_example.yml creds.yml`
6. Open `creds.yml` with your favorite text editor. We will use nano here
    - `nano wizbot/output/creds.yml`
8. [Click here to follow creds guide](../../creds-guide)
    - After you're done, you can close nano (and save the file) by inputting, in order
       - `CTRL` + `X`
       - `Y`
       - `Enter`
9. Run the bot
    - `./WizBot`

##### Release Update Instructions

1. Stop the bot
2. Download the latest release from <https://gitlab.com/WizNet/WizBot/-/releases>
    - Look for the file called "x.x.x-linux-x64-build.tar" (where `X.X.X` is a version, for example 3.0.4) and download it
3. Untar it
    - ⚠ Make sure that you change `X.X.X` to the same series of numbers as in step 2!
    - `tar xf x.x.x-linux-x64-build.tar`
4. Rename the old wizbot directory to wizbot-old (remove your old backup first if you have one, or back it up under a different name)
    - `rm -rf wizbot-old 2>/dev/null`
    - `mv wizbot wizbot-old`
5. Rename the new wizbot directory to wizbot
    - `mv wizbot-linux-x64 wizbot`
6. Remove old strings and aliases to avoid overwriting the updated versions of those files
    - ⚠ If you've modified said files, back them up instead
    - `rm wizbot-old/data/aliases.yml`
    - `rm -r wizbot-old/data/strings`
7. Copy old data
    - `cp -RT wizbot-old/data/ wizbot/data`
8. Copy creds.yml
    - `cp wizbot-old/creds.yml wizbot/`
9. Move into wizbot directory and make the WizBot executable
    - `cd wizbot && chmod +x WizBot`
10. Run the bot
    - `./WizBot`

🎉 Enjoy

##### Steps 3 - 9 as a single command

Don't forget to change X.XX.X to match step 2.
```sh
tar xf X.XX.X-linux-x64-build.tar && \
rm -rf wizbot-old 2>/dev/null && \
mv wizbot wizbot-old && \
mv wizbot-linux-x64 wizbot && \
rm wizbot-old/data/aliases.yml && \
rm -r wizbot-old/data/strings && \
cp -RT wizbot-old/data/ wizbot/data && \
cp wizbot-old/creds.yml wizbot/ && \
cd wizbot && chmod +x WizBot
```

## Running WizBot

While there are two run modes built into the installer, these options only run WizBot within the current session. Below are 3 methods of running WizBot as a background process.

### Tmux Method (Preferred)

Using `tmux` is the simplest method, and is therefore recommended for most users.

1. Start a tmux session:
    - `tmux`
2. Run the installer: `bash linuxAIO.sh`

3. There are a few options when it comes to running WizBot.

   - Run `3` to *Run the bot normally*
   - Run `4` to *Run the bot with Auto Restart* (This is may or may not work)

4. If option `4` was selected, you have the following options
```
1. Run Auto Restart normally without updating WizBot.
2. Run Auto Restart and update WizBot.
3. Exit

Choose:
[1] to Run WizBot with Auto Restart on "die" command without updating.
[2] to Run with Auto Updating on restart after using "die" command.
```
- Run `1` to update the bot upon restart. (This is done using the `.die` command)
- Run `2` to restart the bot without updating. (This is also done using the `.die` command)

5. That's it! to detatch the tmux session:
    - Press `Ctrl` + `B`
    - Then press `D`

WizBot should now be running in the background of your system. To re-open the tmux session to either update, restart, or whatever, execute `tmux a`.

### Systemd

Compared to using tmux, this method requires a little bit more work to set up, but has the benefit of allowing WizBot to automatically start back up after a system reboot or the execution of the `.die` command.

1. Navigate to the project's root directory
    - Project root directory location example: `/home/user/wizbot/`
2. Use the following command to create a service that will be used to start WizBot:

    ```bash
    echo "[Unit]
    Description=WizBot service
    After=network.target
    StartLimitIntervalSec=60
    StartLimitBurst=2

    [Service]
    Type=simple
    User=$USER
    WorkingDirectory=$PWD/output
    # If you want WizBot to be compiled prior to every startup, uncomment the lines
    # below. Note  that it's not neccessary unless you are personally modifying the
    # source code.
    #ExecStartPre=/usr/bin/dotnet build ../src/WizBot/WizBot.csproj -c Release -o output/
    ExecStart=/usr/bin/dotnet WizBot.dll
    Restart=on-failure
    RestartSec=5
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=WizBot

    [Install]
    WantedBy=multi-user.target" | sudo tee /etc/systemd/system/wizbot.service
    ```

3. Make the new service available:
    - `sudo systemctl daemon-reload`
4. Start WizBot:
    - `sudo systemctl start wizbot.service && sudo systemctl enable wizbot.service`

### Systemd + Script

This method is similar to the one above, but requires one extra step, with the added benefit of better error logging and control over what happens before and after the startup of WizBot.

1. Locate the project and move to its parent directory
    - Project location example: `/home/user/wizbot/`
    - Parent directory example: `/home/user/`
2. Use the following command to create a service that will be used to execute `WizBotRun.sh`:

    ```bash
    echo "[Unit]
    Description=WizBot service
    After=network.target
    StartLimitIntervalSec=60
    StartLimitBurst=2

    [Service]
    Type=simple
    User=$USER
    WorkingDirectory=$_WORKING_DIR
    ExecStart=/bin/bash WizBotRun.sh
    Restart=on-failure
    RestartSec=5
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=WizBot

    [Install]
    WantedBy=multi-user.target" | sudo tee /etc/systemd/system/wizbot.service
    ```

3. Make the new service available:
    - `sudo systemctl daemon-reload`
4. Use the following command to create a script that will be used to start WizBot:

    ```bash
    {
    echo '#!/bin/bash'
    echo ""
    echo "echo \"Running WizBot in the background with auto restart\"
    youtube-dl -U

    # If you want WizBot to be compiled prior to every startup, uncomment the lines
    # below. Note  that it's not necessary unless you are personally modifying the
    # source code.
    #echo \"Compiling WizBot...\"
    #cd \"$PWD\"/wizbot
    #dotnet build src/WizBot/WizBot.csproj -c Release -o output/

    echo \"Starting WizBot...\"

    while true; do
        if [[ -d $PWD/wizbot/output ]]; then
            cd $PWD/wizbot/output || {
                echo \"Failed to change working directory to $PWD/wizbot/output\" >&2
                echo \"Ensure that the working directory inside of '/etc/systemd/system/wizbot.service' is correct\"
                echo \"Exiting...\"
                exit 1
            }
        else
            echo \"$PWD/wizbot/output doesn't exist\"
            exit 1
        fi

        dotnet WizBot.dll || {
            echo \"An error occurred when trying to start NadekBot\"
            echo \"Exiting...\"
            exit 1
        }

        echo \"Waiting for 5 seconds...\"
        sleep 5
        youtube-dl -U
        echo \"Restarting WizBot...\"
    done

    echo \"Stopping WizBot...\""
    } > WizBotRun.sh
    ```

5. Start WizBot:
    - `sudo systemctl start wizbot.service && sudo systemctl enable wizbot.service`

### Setting up WizBot on a Linux VPS (Digital Ocean Droplet)

If you want WizBot to play music for you 24/7 without having to hosting it on your PC and want to keep it cheap, reliable and convenient as possible, you can try WizBot on Linux Digital Ocean Droplet using the link [DigitalOcean](https://m.do.co/c/7290047d0c84) (by using this link, you will get **$10 credit** and also support WizBot)

To set up the VPS, please select the options below
```
These are the min requirements you must follow:

OS: Any between Ubuntu, Fedora, and Debian

Plan: Basic

CPU options: regular with SSD
1 GB / 1 CPU
25 GB SSD Disk
1000 GB transfer

Note: You can select the cheapest option with 512 MB /1 CPU but this has been a hit or miss.

Datacenter region: Choose one depending on where you are located.

Authentication: Password or SSH
(Select SSH if you know what you are doing, otherwise choose password)
```

**Setting up WizBot**
Assuming you have followed the link above to setup an account and a Droplet with a 64-bit operational system on Digital Ocean and got the `IP address and root password (in your e-mail)` to login, it's time to get started.

**This section is only relevant to those who want to host WizBot on DigitalOcean. Go through this whole section before setting the bot up.**

#### Prerequisites

- Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
- Download [WinSCP](https://winscp.net/eng/download.php) *(optional)*
- [Create and invite the bot](../../creds-guide).

#### Starting up

- **Open PuTTY** and paste or enter your `IP address` and then click **Open**.
  If you entered your Droplets IP address correctly, it should show **login as:** in a newly opened window.
- Now for **login as:**, type `root` and press enter.
- It should then ask for a password. Type the `root password` you have received in your e-mail address, then press Enter.

If you are running your droplet for the first time, it will most likely ask you to change your root password. To do that, copy the **password you've received by e-mail** and paste it on PuTTY.

- To paste, just right-click the window (it won't show any changes on the screen), then press Enter.
- Type a **new password** somewhere, copy and paste it on PuTTY. Press Enter then paste it again.

**Save the new password somewhere safe.**

After that, your droplet should be ready for use. [Follow the guide from the beginning](#linux-from-source) to set WizBot up on your newly created VPS.

[Linux From Source]: #linux-from-source
[Source Update Instructions]: #source-update-instructions
[Linux Release]: #linux-release
[Release Update Instructions]: #release-update-instructions
[Tmux (Preferred Method)]: #tmux-preferred-method
[Systemd]: #systemd
[Systemd + Script]: #systemd-script
[Setting up WizBot on a VPS (Digital Ocean)]: #setting-up-wizbot-on-a-linux-vps-digital-ocean-droplet

gha_language: C#


text:
---
title: Live Streams
layout: page
permalink: stream/
image: /assets/images/live-stream-on-landing-pages-offline.jpg
---

Thanks for dropping by. My live streams are currently off and I might resume them in the future. You can find me on [Twitter][twitter] to be notified if I start them again.
{: .intro }

---

## Past seasons:

* In Season 3 (Mar 24 - Apr 28, 2022), I worked on the **landing page for [readwith.club](https://readwith.club)**, a small app to help sell your reading notes from a book you're reading.
* In Season 2 (Jan 27 - Mar 3, 2022), I put together **the landing page for [stimulus.pascal.works](https://stimulus.pascal.works)**, a consultancy for those building an app and struggling with a Stimulus JS problem.
* In Season 1 (Fall of 2021), I was **reviewing landing pages of other apps**, something I'm thinking of restarting soon.

Stay Sharp!
[@pascallaliberte][twitter]

[twitter]: https://twitter.com/pascallaliberte

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: SCSS

gha_license_id: MIT

license_type: permissive


text:
The NumberUtil module provides utility functions for Lua numbers.

--------------------

### `E`
The irrational number e.

```lua
NumberUtil.E == 2.7182818284590
```

--------------------

### `Tau`
Equal to `2π`.

```lua
NumberUtil.Tau == 6.2831853071796
```

--------------------

### `Lerp(min, max, alpha)`
Interpolate between two numbers by a certain alpha/percentage. The name "lerp" comes from combining _**l**inear int**erp**olation_.

Visually, think of a number line ranging from 'min' to 'max' and then move along that line by 'alpha' percent.

```lua
NumberUtil.Lerp(5, 15, 0.5) == 10
NumberUtil.Lerp(5, 15, 0)   == 5
NumberUtil.Lerp(5, 15, 0.7) == 12
NumberUtil.Lerp(5, 15, 2)   == 25
```

--------------------

### `LerpClamp(min, max, alpha)`
The same as Lerp, except `alpha` is clamped between the range of `[0, 1]`. This helps avoid the resultant number being out of the input range of `[min, max]`.

```lua
NumberUtil.LerpClamp(5, 15, 0.5) == 10
NumberUtil.LerpClamp(5, 15, 2)   == 15  -- 'alpha' clamped to 1.
```

--------------------

### `InverseLerp(min, max, num)`

The inverse of the Lerp function. It returns the `alpha` value between the range of `[min, max]` given the `num`.

```lua
NumberUtil.InverseLerp(5, 15, 10) == 0.5
NumberUtil.InverseLerp(5, 15, 12) == 0.7
```

--------------------

### `Map(n, inMin, inMax, outMin, outMax)`
Remaps the range of 'num' from its old range of `[inMin, inMax]` to a new range of `[outMin, outMax]`. This is useful when needing to convert a range of inputs to a different output. For instance, remapping gamepad stick input to a larger range controlling a vehicle steering wheel.

Mathematically, this is done by doing an inverse lerp with `n` on `[inMin, inMax]` to get the correct alpha value, and then lerping that alpha value with the range of `[outMin, outMax]`.

```lua
NumberUtil.Map(0.5, 0, 1, -10, 10) == 0
NumberUtil.Map(1, -1, 1, 0, 5)     == 5
```

--------------------

### `Round(num)`
Rounds a number to the nearest whole number.

Internally, this uses the `math.floor` and `math.ceil` Lua math functions to round the number.

```lua
NumberUtil.Round(1.5)  == 2
NumberUtil.Round(3.2)  == 3
NumberUtil.Round(-0.5) == -1
```

--------------------

### `RoundTo(num, multiple)`
Rounds a number to the nearest given multiple. An example would be locking world positions onto a larger grid.

```lua
NumberUtil.RoundTo(3.4, 5) == 5
NumberUtil.RoundTo(12, 5)  == 10
```

repository: Sleitnick/AeroGameFramework

gha_language: Lua

repo_name: Sleitnick/AeroGameFramework


text:
# README

# Requirement
_see requirements.txt for dependency required_

# Installation

- Go to specified directory which the app will be installed

- Clone app from repository
`git clone https://github.com/ardzix/instalment-app.git`

- Create settings `project/settings.py` file based on `project/settings_example.py`

- Install virtual environment to current directory
`virtualenv env`
_[Go to this link to install virtualenvirontment](http://pypi.python.org/pypi/virtualenv)_

- Activate the environtment
`source env/bin/activate`

- Install dependencies
`pip install -r requirements.txt`

- App ready to run
_[Go to this link to see how to run django-app](https://www.djangoproject.com/)_

repository: ardzix/instalment-app

repo_name: ardzix/instalment-app


text:
My first website
#### Website that describes my first website's characteristics, 1.0
#### By **Geoffrey**
## Description
Has a Homepage and a favourites page
## Setup/Installation Requirements
* Install any browser
## Known Bugs
No known bugs
## Technologies Used
Used Html
## Support and contact details
Contact<EMAIL_ADDRESS>for questions of queries
### License
This project is licensed under the terms of the MIT license.
Copyright (c) 2021 **wgathagu**

repository: WGathagu/my-first-website

repo_name: WGathagu/my-first-website


text:
---
layout: leftnav-page-content
title: What happens to recyclables
permalink: /recycle/what-happens-to-recyclables/
breadcrumb: What happens to recyclables
collection_name: recycle
---

![Recycling Process](/images/recycling-process.jpeg)

1. Recyclables are collected by a dedicated recycling truck and sent to a Materials Recovery Facility (MRF).

2. At the MRF, the recyclables will be sorted out into paper, glass, metal and plastic.

3. After sorting each type of waste is packed into bundles.

4. The bundles are then sent to recycling plants for recycling.

Learn more about the [recycling process](https://www.nea.gov.sg/our-services/waste-management/3r-programmes-and-resources/types-of-recyclables-and-recycling-processes){:target="_blank"}

Also, watch what happens at a [Materials Recovery Facility (MRF)](/resources/videos/materials-recovery-facility).

repository: nyp-fionalim/isomerpages-mewr-zerowaste

repo_name: nyp-fionalim/isomerpages-mewr-zerowaste


text:
#Objectives and Key Results

Objectives and Key Results (OKRs) is a method for defining and keeping track of goals and their outcomes. They organize our goals by breaking them into high-level aspirations (objectives) and the measurable results that determine whether or not we’ve reached them (key results). Typically, OKRs are set at the company and at individual level to help everyone see how their personal goals align with the company goals, and also see how other people in the organization are working for the same outcomes from a different perspective.

When we first tried setting OKRs for Q1 2016, we found that the founding team's collaborative workstyle made individual OKRs very difficult to set. Members of each team frequently cross-delegate and contribute to initiatives in near-equal capacities depending on what is the most effective that day or week. Thus we've decided to set Foodnome OKRs at company and team levels this quarter, rather than company and individual levels. The idea is that currently every one on our team can work on almost everything that falls within their team OKRs, so granular delegation of projects and tasks can happen on a shorter timeline, allowing for team optimized efficacy, rather than strict specialization.

While we're proud that communication within the founding team currently allows for this type of work fluidity, we realize that it is a luxury we will outgrow as soon as we grow the team and need more objective and individualized goal setting. Our plan is to re-evaluate the need for individual OKR setting for Q2 of 2016.

## Examples

Objectives are the high level achievements you are shooting for, like:

* Increase cook satisfaction

* Improve cook vetting and onboarding process

* Increase customer cook cross-pollination

* Tell the story of our community to a broader audience

* Help cooks market to their audiences more easily

* Bring Foodnome to new strategic markets

Key results are the measurable outcomes that define success for the objectives. **Key results must be measurable on a scale from 0-10**, so for the second example objective, the results might be:

* Review onboarding process for 10 most recently onboarded cooks and identify steps that took the longest amount of time to complete on average (% completion)

* Write documentation and create tools for 3 biggest improvement opportunities within the vetting and onboarding process by July 15 (-2 points for each day late)

* Onboard 8 new cooks using improved vetting and onboarding practices by Sept 31 (% complete)

* Reduce average time from application recieved to first meal by 25%, starting at 16 days (% completion)

## Setting OKRs

Every team at Foodnome sets their OKRs quarterly, writing them in the first week of the quarter and then evaluating them in the last week. At a startup it’s easy to focus on the immediate problems, but by setting our goals quarterly we ensure that everyone spends some time thinking about the challenges at least 3 months out.

Each team should set 3 to 5 objectives for the quarter, and each objective should have a maximum of 4 key results. Each objective also has a Description explaining what it means and an Alignment that explains how it aligns with company-wide goals. Each key result should explain how it will be scored at the end of the quarter.

## Tracking OKRs

Every team's OKRs will be compiled and kept in a Google Spreadsheet in the OKRs Folder. Within the spreadsheet, there should be a new sheet for each new quarter.

More specific units of work revolving around Key Results should be organized in team-specific Trello Boards (or Zenhub) that are accessible to the entire company. This is where individual task owners can be assigned and tasks can be re-prioritized.

OKRS should be talked about every two weeks to consider how each objective is progressing, places where help may be necessary, and how well they reflect current objectives.

## Scoring and Evaluating OKRs

OKRs are scored at the end of the quarter, with a score generated for each Key Result. The average of the key results give a score for each Objective, and the average scores of the Objectives gives an overall score for the quarter.

A key result can be scored in any way that makes sense for the result, but there are a few common ways to score a Key Result:

* **% completion** -- if the goal is to do some number of actions, or achieve some number of results (post 3 blog posts or get 300 views), then the Key Result can be scored according to the % that were completed. Posting 2 results out of 3 would earn a score of ⅔ x 10 (because 10 is the total possible number of points) or a 6.7.

* **Due date** -- if a resource should be delivered on a given day, then a fixed number of points can be docked based on how many days late the resource is finished. The penalty should be set with the key result and should vary depending on how time-sensitive the result is. For instance, if my coworker needs me to finish something on time so that they can use it, then there should be a heavy penalty for being late. If the penalty for an item is -2 points per day, then finishing it 3 days late gives a score of 4.

* **Deviation** -- if you are trying to hit a precise target, and do not want to go above or below it, then the score can be based on how far off you were.

The scoring method should be included with each key result. If two people independently evaluated your OKRs at the same time, they should be sure to get the same scores because the criteria for evaluation should be unambiguous.

OKRs should never be used in evaluating employee performance, and should be ambitious. An average score of 7 is ideal, and no one should ever get to a full 10. If they do, their goals were set too low.

url: https://raw.githubusercontent.com/foodnome/handbook/e44ff5a09b454a8518f91da9337efcf6c6c883bb/Onboarding Documents/Objectives and Key Results.md

repository: foodnome/handbook

filename: Objectives and Key Results.md

repo_name: foodnome/handbook


repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

repo_name: trickest/cve


text:
# Rapid7VmConsole::UserRole

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**all_asset_groups** | **BOOLEAN** | Whether the user has access to all asset groups. | [optional]
**all_sites** | **BOOLEAN** | Whether the user has access to all sites. | [optional]
**id** | **String** | The identifier of the role the user is assigned to. | [optional]
**name** | **String** | The name of the role the user is assigned to. | [optional]
**privileges** | **Array<String>** | The privileges granted to the user by their role. | [optional]
**superuser** | **BOOLEAN** | Whether the user is a superuser. | [optional]

repository: ewb-infosec/vm-console-client-ruby

repo_name: ewb-infosec/vm-console-client-ruby


text:
Redux Notes
===========
<!-- TOC -->

- [0.1. Main components of `redux`.](#01-main-components-of-redux)
- [0.2. Reducer](#02-reducer)
- [0.3. Store](#03-store)
- [0.4. combining reducers](#04-combining-reducers)
- [0.5. `react-redux` bindings](#05-react-redux-bindings)
    - [0.5.1. Pass store via  `Provider`](#051-pass-store-via--provider)
        - [<IP_ADDRESS>. App.jsx](#0511-appjsx)
    - [0.5.2. Using `connect` to create higher order wrapper components](#052-using-connect-to-create-higher-order-wrapper-components)
        - [<IP_ADDRESS>. TodoList.jsx](#0521-todolistjsx)
        - [<IP_ADDRESS>. TodoListRedux.jsx](#0522-todolistreduxjsx)

<!-- /TOC -->
Redux is useful for state management. More info can be found on the [Redux Website](https://redux.js.org/)

Here are some notes on redux. Hope they help, I wanted to refresh my memory on using it for the future.

## 0.1. Main components of `redux`.

  - *Store* - State is stored as a single object and maintained via a object called a _store_. it has important 3 methods for dispatching actions, listening for state changes and doing a callback, and getting state object
  - *Reducer* - The reducer is a pure function / series of functions that take in state, action. An action is dispatched from your components

## 0.2. Reducer

Reducers must be pure and accept two arguments.
  - `state` which represents the entire state of your application as an object.
  - `action` which is an object literal with a `type` property describing your action, generally a string is used for its serializability and easy to read. Additionally any other attributes can be added to the object

Typically switch statements are useful to determine actions. Another note is for unknown actions, which shouldn't occur, but can occur as a bug or be part of the intent, it is best to have a default action that return the current state unmodified.

``` js
//  here is a simple counter reducer with two actions + a default .
  const counterReducer = (state = 0, action) => {
    switch(action.type) {
      case 'INCREMENT':
        return state + 1;
      case 'DECREMENT':
        return state - 1;
      default:
        return state;
    }
  }

```

## 0.3. Store

A store is what we need to create the store with redux. you pass your reducer to the store on creating it

``` js

import {createStore} from 'Redux';

// note: we pass in our reducer at store creation
const store = createStore(counterReducer);

```
There are 3 important methods that can be called on the store object:

  - `store.subscribe(callback)` is used to listen for state changes and do a function like `rerender()`
  - `store.getState()` is used to get the state as an object
  - `store.dispatch(action)` is used to dispactch an action

``` js

// first we define a render method to the DOM
const render = () => {
  //for our counter it would be a number..so we can just update this way
  document.innerText = store.getState();
}

// lets get our state changes to trigger our render function
store.subscribe(render);

//and lets set up some event handlers for a + and - button
document.querySelector('#increment').addEventListener('click', (e) => {
  store.dispatch({type: 'INCREMENT'});
});
document.querySelector('#decrement').addEventListener('click', (e) => {
  store.dispatch({type: 'DECREMENT'});
});
```

## 0.4. combining reducers

Most times for more complex apps you will not want a single reducer to rule them all, or at least, you want the ability to split up your logic thats inside your reducer into more modular related functions.

For instance in a todo app, w lets say we have two features that we wanted to have two seperate functions. Our state in our store looks something like:

``` js
{
  'visibilityFilter': 'SHOW_ALL',
  'todos' : [...,{
    id: 25,
    descriptor: 'mow the lawn',
    completed: false
  },...]
}
```

  - Visibility (Show completed, Show all, Show Uncompleted)
    - Action 01:  SET_VISIBILITY_FILTER
  - Adding / Modifying todos
    - Action 01: ADD_TODO
    - Action 02: TOGGLE_TODO_COMPLETED

Well we can actually use another utility method of redux to handle mapping parts of the state to seperated reducer functions! This is called `combineRedccers` from Redux, unsurprisingly and what it does is take in an object where `keys` are the correspond keys on your state. and the value is the reducer function to handle that portion. Behind the scenes Redux will combine the reducers for you into one masterReducer funciton.

``` js

import {createStore, combineReducers} from 'Redux';

// pretend that these are our seperate reducers, they might even be imported from seperate files
const todoAddModifyReducer = (state=[], action) => {...}
const todoVisibilityReducer = (state='SHOW_ALL', action) => {...}

// specify mappings
const mainReducer = {
  todos: todoAddModifyReducer,
  visibilityFilter: todoVisibilityReducer
};

// comveniently combined!
const store = createStore(mainReducer);
```

## 0.5. `react-redux` bindings

So now we can manually pass our store down to our child components via props, but this gets very tedious. So we can use the `react-redux` library to help us do two things:

  - `provider` - Provider is a parent component wrapper that magically passes the store to all child components without actually explicitly specifying it as a prop. This is done behind the scenes via react's [Context](https://reactjs.org/docs/context.html).
  - `connect` - Connect essentially automatically creates a higher order component that gets your component the appropriate props. It basically takes in *two* mappings (one for `dispatch` event handlers (like `onClick`) and one for `state` mappings like `todos`).
    - `mapStateToProps(state, ownProps)` - takes redux store state keys and maps them to your components props. it should be a function that returns a object `{propsKey: stateValue}`
    - `mapDispatchToProps(dispatch, ownProps)` -  it should be a function that returns a object `{..., propsKey: eventThatDispatchesAnAction, ...}`

Imagine our file structure looks like
``` sh
APP/
│───index.js
│
├───components/
│       App.jsx
│       TodoItem.jsx
│       TodoList.jsx
│       TodoListRedux.jsx
│
└───reducers/
        myReducer.js
```

### 0.5.1. Pass store via  `Provider`

First we have our provider setup in our main app. Note: how we use provider here! See above for how to setup your reducer

#### <IP_ADDRESS>. App.jsx
``` js

import React from 'react';
import TodoListRedux from './TodoListRedux';
import { Provider } from 'react-redux';
import {createStore} from 'Redux';
import {myReducer} from '../reducers/myReducer.js';

const App = () => (
  <Provider store={createStore(myReducer)}>
  <div>
    <TodoListRedux />
  </div>
  </Provider>
)

```

### 0.5.2. Using `connect` to create higher order wrapper components

For our todo list you can see this being done here. Our normal `todoList` is a presentation component. We will use `connect` from `react-redux` to automatically create `TodoItemRedux`, a wrapper component that automatically provides the `props` needed for dispatching actions and state.

#### <IP_ADDRESS>. TodoList.jsx
``` js
import React from 'react';
import PropTypes from 'prop-types';
import TodoItem from './TodoItem';

const TodoList = ({ todos, toggleTodo }) => (
  <ul>
    {todos.map(todo => (
      <TodoItem key={todo.id} {...todo} onClick={() => toggleTodo(todo.id)} />
    ))}
  </ul>
)

TodoList.propTypes = {
  todos: PropTypes.arrayOf(
    PropTypes.shape({
      id: PropTypes.number.isRequired,
      completed: PropTypes.bool.isRequired,
      text: PropTypes.string.isRequired
    }).isRequired
  ).isRequired,
  toggleTodo: PropTypes.func.isRequired
}

export default TodoList

```

#### <IP_ADDRESS>. TodoListRedux.jsx
``` js

import React from 'react';
import { connect } from 'react-redux';
import TodoList from './TodoList';

const toggleTodo = (id) => {
  // .. would literally return an action object 'TOGGLE_TODO'
}

const mapStateToProps = state => ({
  todos: state.todos
})

const mapDispatchToProps = dispatch => ({
  toggleTodo: id => dispatch(toggleTodo(id))
})

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(TodoList)

```

repository: allenhsieh/notesWiki

repo_name: allenhsieh/notesWiki


text:
# .Net 3DS Toolkit
.Net 3DS Toolkit is a code library intended to simplify extracting and rebuilding 3DS ROMs.  Requires the .Net Framework 4.6.

Supported formats for extraction:
* Decrypted CCI (aka .3DS)
* Decrypted CIA
* Decrypted CXI (like what Braindump would give you)
* NDS ROM

Supported formats for building:
* Decrypted CCI (aka .3DS)
  * For use with Citra
  * Can be used for Gateway and Sky 3DS (with CFW) if encrypted using Decrypt9
* 0-Key Encrypted CCI
  * For use with Gateway
* CIA
  * For use with CFW
* HANS RomFS, Code.Bin, and Homebrew Launcher Shortcut
* NDS ROM

Planned Features
* Automatically add private header to 0-key encrypted CCI's.

Known Limitations
* DSi ROMs are not supported.
* Pokémon Sun/Moon cannot be build using the "0-Key Encrypted CCI" option.  The work-around for Gateway is to either use a CIA, or build as "Decrypted CCI (aka .3DS)", then using Decrypt-9 to re-encrypt.  It may need to be converted to use Card-2 saves, which this program currently cannot do.
* When extracting Pokémon Sun/Moon, the following error message may display; however, the resulting files appear to be fully functional:
```
[3dstool] ERROR: uncompress error
[3dstool] ERROR: extract file failed
```

Using the library (VB.Net):
```
' To Extract
Using c As New DotNet3dsToolkit.Converter
	' To use the most appropriate format based on the extension
	Await c.ExtractAuto("C:/MyROM.cxi", "C:/RawFiles/")

    ' To extract a decrypted CCI
    Await c.ExtractCCI("C:/MyROM.3ds", "C:/RawFiles/") 'Do not run these functions concurrently.  If you need to do so, create another instance of DotNet3dsToolkit.Converter to build another directory.

	' To extract a decrypted CXI
	Await c.ExtractCXI("C:/MyROM.cxi", "C:/RawFiles/")

	' To extract a decrypted CIA
	Await c.ExtractCIA("C:/MyROM.cia", "C:/RawFiles/")

	' To extract an NDS ROM
	Await c.ExtractNDS("C:/MyROM.nds", "C:/RawFiles-NDS/")

End Using 'It is important to dispose of the converter when finished.  This will delete temporary files created during extraction.

' To Build
Using c As New DotNet3dsToolkit.Converter
	' To build a CIA
	' Extensions don't matter, but incorrect extensions may cause confusion later.
    Await c.BuildCia("C:/RawFiles/", "C:/MyRom-Rebuilt.cia") 'Do not run these functions concurrently.  If you need to do so, create another instance of DotNet3dsToolkit.Converter to build another directory.

	' To build a CCI for use with Gateway
	Await c.Build3DS0Key("C:/RawFiles/", "C:/MyRom-Rebuilt.3dz")

	' To build a decrypted CIA for use with Citra or Decrypt9
	Await c.Build3DSDecrypted("C:/RawFiles/", "C:/MyRom-Rebuilt.3ds")

	' To build an NDS ROM
	Await c.BuildNDS("C:/RawFiles-NDS/", "C:/MyRom-Rebuilt.nds")

	' To use the most appropriate format based on the extension
	Await c.BuildAuto("C:/RawFiles/", "C:/MyRom-Rebuilt.cia")

	' To build files for HANS (not supported by BuildAuto)
	Await c.BuildHans("C:/RawFiles/", "G:/", "MyHack")
End Using
```

Using the library (C#.Net):
```

// To Extract
using (DotNet3dsToolkit.Converter c = new DotNet3dsToolkit.Converter()) {
	// To use the most appropriate format based on the extension
	await c.ExtractAuto("C:/MyROM.cxi", "C:/RawFiles/");

    // To extract a decrypted CCI
    await c.ExtractCCI("C:/MyROM.3ds", "C:/RawFiles/"); 'Do not run these functions concurrently.  If you need to do so, create another instance of DotNet3dsToolkit.Converter to build another directory.

	// To extract a decrypted CXI
	await c.ExtractCXI("C:/MyROM.cxi", "C:/RawFiles/");

	// To extract a decrypted CIA
	await c.ExtractCIA("C:/MyROM.cia", "C:/RawFiles/");

	// To extract an NDS ROM
	await c.ExtractNDS("C:/MyROM.nds", "C:/RawFiles-NDS/");

} // It is important to dispose of the converter when finished.  This will delete temporary files created during extraction.

// To Build
using (DotNet3dsToolkit.Converter c = new DotNet3dsToolkit.Converter()) {
	// To build a CIA
	// Extensions don't matter, but incorrect extensions may cause confusion later.
    await c.BuildCia("C:/RawFiles/", "C:/MyRom-Rebuilt.cia"); 'Do not run these functions concurrently.  If you need to do so, create another instance of DotNet3dsToolkit.Converter to build another directory.

	// To build a CCI for use with Gateway
	await c.Build3DS0Key("C:/RawFiles/", "C:/MyRom-Rebuilt.3dz");

	// To build a decrypted CIA for use with Citra or Decrypt9
	await c.Build3DSDecrypted("C:/RawFiles/", "C:/MyRom-Rebuilt.3ds");

	// To build an NDS ROM
	await c.BuildNDS("C:/RawFiles-NDS/", "C:/MyRom-Rebuilt.nds");

	// To use the most appropriate format based on the extension
	await c.BuildAuto("C:/RawFiles/", "C:/MyRom-Rebuilt.cia");

	// To build files for HANS (not supported by BuildAuto)
	await c.BuildHans("C:/RawFiles/", "G:/", "MyHack");
}

```

Using the ToolkitConsole.exe:
`ToolkitConsole.exe <source> <destination> [hans raw file name] [-source-cxi|-source-cia|-source-nds] [-key0]`
* <source> can be a decrypted CCI/3DS ROM, a decrypted CIA, a decrypted CXI, or a directory created by ToolkitConsole.exe.
* <destination> can be a *.3DS, *.3DZ, *.CCI, or *.CIA file, or a directory if the source is a ROM.
* [hans raw file name] is the future name of the raw files for HANS, if the ""-hans"" argument is present.  Shorter strings work better, but the exact requirements are unknown.
* Input format is detected by the extension.
  * *.CXI files are treated as decrypted CXI files.
  * *.CIA files are treated as decrypted CIA files.
  * *.NDS and *.SRL files are treated as NDS ROMs.
  * All others are treated as decrypted CCI files.  This can be overridden by using the -source-cxi flag to treat input as a CXI or the -source-cia flag to treat the input as a CIA.
* Output format is detected by the extension.
  * *.CIA files are outputted as CIA files.
  * *.3DZ files are outputted as 0-key encrypted CCI ROMs.
  * *.NDS and *.SRL files are outputted as NDS ROMs.
  * All others are outputted as decrypted CCI ROMs.  This can be overridden by using the -key0 flag to output as a 0-key encrypted CCI ROM instead.

Credits:
* SciresM for [3DS Builder](https://github.com/SciresM/3DS-Builder) ([modified to use command-line arguments](https://github.com/evandixon/3DS-Builder))
* profi200 for [Project_CTR](https://github.com/profi200/Project_CTR)'s ctrtool and makerom
* dnasdw for [3dstool](https://github.com/dnasdw/3dstool)
* DarkFader for ndstool
* Asia81 for HackingToolkit3DS, which provided the usage for 3dstool.
* Steveice10 for FBI, which I'm using in my unit tests to read title IDs.


text:
---
title: 'audio'
---

Type: `boolean`<br/>
Default: `false`

It enables audio source detection from the target URL.

<MultiCodeEditor languages={{
  Shell: `microlink-api https://soundcloud.com/theaipodcast/gtc-weather&audio`,
  'Node.js': `const mql = require('@microlink/mql')

module.exports = async () => {
  const { status, data, response } = await mql(
    'https://soundcloud.com/theaipodcast/gtc-weather', {
      audio: true
  })

 console.log(status, data)
}
  `
  }}
/>

<Figcaption children="Some websites can be different output based on User Agent." />

The audio source URL detected will be in a browser-friendly format to be possible embedded it.

The audio detection introduce some human readable fields as part of the payload:

```json{26, 34}
{
  "data": {
    "lang": "en",
    "author": "The AI Podcast",
    "title": "Ep. 51: Live at GTC - Deep Learning Can Save Lives by Predicting Severe Weather",
    "publisher": "SoundCloud",
    "image": {
      "url": "https://i1.sndcdn.com/artworks-000326780052-0h7mz1-t500x500.jpg",
      "width": 0,
      "height": 0,
      "type": "jpg",
      "size": 83581,
      "size_pretty": "83.6 kB"
    },
    "description": "One of the things that makes the weather so dangerous is that it’s so hard to predict. Tornadoes, hail, high winds and flash floods cause billions of dollars worth of property damage, and injure or ki",
    "date": "2018-03-29T02:06:49.000Z",
    "logo": {
      "url": "https://a-v2.sndcdn.com/assets/images/sc-icons/ios-a62dfc8f.png",
      "width": 114,
      "height": 114,
      "type": "png",
      "size": 3144,
      "size_pretty": "3.14 kB"
    },
    "url": "https://soundcloud.com/theaipodcast/gtc-weather",
    "audio": {
      "url": "https://cf-media.sndcdn.com/clcG6IDMnbiy.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vY2xjRzZJRE1uYml5LjEyOC5tcDMiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE1NTU2OTcwOTN9fX1dfQ__&Signature=NoWAUhnQ0G2z~utNOzYC06hjKa5acOfj8waGu81bm93zNUsu4NS4N7-pzoj~D~3jdyncprnLqPMRjVUFAW1HpizByYysKNx9sYSDtTHhc2fxzGx2Hx41iVJHeONQtsRdCpa7SyLxtHMiK7uI~dbowrGnGh1jKb5Rd0BNdT6UZy5m0qMyY41oMDW1ZC4WPo6GjEuzq-RY9GAk1iFz86LpVskXH3LVFy035NejgMbO-Su5N64JrmdREZqTjMvaJiHlnApAGneVbCqBoDqeh7NZtQWVGtjP4IWrsqa~p3hmMxSvtKWPUPC5rM7EoME~ZcnwXcByksUjpLkwv5E9M5zsJQ__&Key-Pair-Id=APKAJAGZ7VMH2PFPW6UQ",
      "type": "mp3",
      "size": 23061732,
      "size_pretty": "23.1 MB",
      "duration": 1441.332245,
      "duration_pretty": "24m"
    }
  },
  "status": "success"
}
```

repository: mateomorris/www

repo_name: mateomorris/www


text:
---
layout: default
---

# 1995-11-05 - Re: Credentials Without Identity

## Header Data

From: Rich Graves<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: aea9ab65727e6d34ab14faa76c00191492e679296f28d7108e20831b8a78b627

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1995-11-05 02:51:28 UTC

Raw Date: Sun, 5 Nov 1995 10:51:28 +0800

## Raw message

```
{% raw  %}From: Rich Graves<EMAIL_ADDRESS>Date: Sun, 5 Nov 1995 10:51:28 +0800
To<EMAIL_ADDRESS>Subject: Re: Credentials Without Identity
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

On Sat, 4 Nov 1995, Timothy C. May wrote:

> (And as a measure of how apologetic some folks are getting about discussing
> anything not on Perry's List of Approved Topics, Rich unfortunately labeled
> his post "[ID point semi-off-topic]..." In fact, the issue of credentials
> and identity is NOT off-topic, not even semi-off-topic. It is central to
> the themes of our list. I urge all to read Chaum's seminal work on
> "credentials without identity.")

Thanks for the newbie correction.

In case anyone else is new to this, I couldn't find that paper, but Chaum's
ideas and references are at http://www.digicash.com/publish/sciam.html

> >Proving legal residency requires a combination of two documents, one each
> >from specified lists. Most commonly a driver's license, green card (which
> >is actually pink), or birth certificate from list A, and a social
> >security card from list B.
> >
> >Chris Hibbert's SSN FAQ talks a little bit about how this works, and why
> >it's a Good Thing. Basically, for privacy and security reasons, it is a
> >very good idea to separate the issues of identity and authorization.
> >
> >I don't care how securely you can authenticate who I am -- by PGP, retinal
> >scan, whatever. I do not want a single digitizable token to be the key to
> >my identity. Even if that identity cannot be forged (and everything can be
> >forged), it can be used to track me, by the government, by the Direct
> >Marketing Association, by the private investigators of certain wacky
> ....
>
> Rich's (or Chris') points are admirable, but getting more and more
> irrelevant by the day. The notion of unlinking identity and authorization
> by separate pieces of identification is another form of "security through
> obscurity."

True. But until digital technology becomes ubiquitous, we're stuck with
it, and it does help. I see no analog, well, analog to credential
technology. It absolutely requires machines that can generate and handle
large random numbers. Right?

My point was, even people who should know better, like the managers and
clients of FBOI (fboi@netcom.com), are relying on security through appeal
to irrelevant crypto authority, which is even worse. Using your primary
pgp key as a traceable link to your credit card number or bank account can
be just as bad as publishing your credit card number.

> Happily, Chaum's work on "credentials without identity," based essentially
> on the kind of "blinding" used in digital cash (with some differences, of
> course), allows for one to display a credential showing one is old enough
> to enter a bar or library (in 2005), without revealing a name (which is
> just another credential).

I haven't yet fully digested this concept, but don't you get into a bit of
a chicken-and-egg problem when you start applying this to things like
proof of age and citizenship? Until you reach a certain age, you're not
going to remember your passphrase. I still think there's a role for
private keys held by some authority (I realize that's not a popular word).

I'd guess this would be addressed by a "secret sharer"/secsplit kind of
thing, where your parents hold a combination of keys that together can
represent your secret key until you're old enough to change it yourself.
Still I'd worry about what kind of information was gathered about me in my
youth, and how that might be carried over into maturity.

-rich

{% endraw %}
```

## Thread

+ Return to [November 1995](/archive/1995/11)

+ Return to "[Mats Bergstrom <asgaard@sos.sll.se>](/authors/mats_bergstrom_asgaard_at_sos_sll_se_)"
+ Return to "["Perry E. Metzger" <perry@piermont.com>](/authors/perry_e_metzger_perry_at_piermont_com_)"
+ Return to "[Rich Graves <llurch@networking.stanford.edu>](/authors/rich_graves_llurch_at_networking_stanford_edu_)"
+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_got_net_timothy_c_may_)"

+ 1995-11-05 (Sun, 5 Nov 1995 09:53:11 +0800) - [Credentials Without Identity](/archive/1995/11/c11d3f847544082d850b0538eb0c8f9ca93cafd68fb7ebbab395cdb2fb8c04c7) -<EMAIL_ADDRESS>(Timothy C. May)_
  + 1995-11-05 (Sun, 5 Nov 1995 10:51:28 +0800) - Re: Credentials Without Identity - _Rich Graves<EMAIL_ADDRESS>  + 1995-11-05 (Sun, 5 Nov 1995 12:43:55 +0800) - [Re: Credentials Without Identity](/archive/1995/11/c8edbbaaec39aa1f86aa05b7ffb665e271e4f39e28aa32accf581621d273f6ca) - _Mats Bergstrom<EMAIL_ADDRESS>  + 1995-11-05 (Mon, 6 Nov 1995 00:46:11 +0800) - [Re: Credentials Without Identity](/archive/1995/11/42923c215eb629b42b0be677a7f607ce6cb839a330cf0890e7efe5c289ffe585) - _"Perry E. Metzger"<EMAIL_ADDRESS>


text:
  Internationalization in Gatsby Sites

  This app was built live on Learn With Jason and it was super fun and I’m sad you weren’t there.

  But don’t worry! You can still:
  watch the video ·
  see the demo ·
  deploy this project ·
  see upcoming episodes

Making your website available in multiple languages is a great way to expand your audience. In this episode, [Aisha Blake](https://twitter.com/AishaBlake) teaches us how to add i18n to our Gatsby sites!

## More Information

- [Watch this app get built live + see links and additional resources][episode]
- [Follow _Learn With Jason_ on Twitch][twitch] to watch future episodes live
- [Add the _Learn With Jason_ schedule to your Google Calendar][cal]

[episode]: https://www.learnwithjason.dev/internationalization-in-gatsby-sites
[twitch]: https://jason.af/twitch
[cal]: https://jason.af/lwj/cal


text:
# Sample: Hello Windows Buildpack

A no-op buildpack whose intent is to show minimal requirements of a buildpack on Windows.

### Prerequisites
* Docker with Windows Containers and support for 1809 images

### Usage

```bash
pack build sample-hello-world-windows-app --builder cnbs/sample-builder:nanoserver-1809 --buildpack . --trust-builder
```

THEN

```
docker run sample-hello-world-windows-app echo hello
```

repository: buildpacks/samples

gha_language: Shell

repo_name: buildpacks/samples


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

An application for the Digital and Microprocessor Laboratory using domain-driven design concepts.
The application uses [.NET Core](https://github.com/dotnet/core) as its target framework and is
thus cross-platform.

## Usage

#### Windows

If you have Microsoft Visual Studio 2017 installed then you can simply open the solution file.
#### OSX/Linux

Follow the instructions for installing .NET Core by clicking [here](https://www.microsoft.com/net/core).

After installation, open a command prompt inside any project in the solution and run:

```
dotnet restore
dotnet run
```

## License

The application is licensed under the [MIT license](http://opensource.org/licenses/MIT).

repository: ferrerojosh/Aromato

repo_name: ferrerojosh/Aromato


text:
---
title: Contenta
repo: contentacms/contenta_jsonapi
homepage: http://www.contentacms.org
twitter: contentacms
opensource: "Yes"
typeofcms: "API Driven"
supportedgenerators:
  - All
description: Contenta is an API-First Drupal distribution.
---

## Contenta

Contenta is an API-First Drupal distribution. It’s all about the content.

### API ready

An HTTP API provided ready to use with full auto-generated documentation.

### Example content

Example content to help you understand how all works. This can be removed all in one click.

### Example consumers

Many consumers in different technologies can show you how easy is to build a Contenta project.

### By the community

A community of experts is ready to guide with Contenta and solve common challenges together.

repository: TryGhost/nodecmsguide

gha_language: JavaScript

repo_name: TryGhost/nodecmsguide


text:
## Let's talk about default args
What does the following code output?
```python
def foo(a=[]):
    a.append(1)
    return a
print(foo())
print(foo())
```
If you've never been bitten by using mutable default args in a function, it might surprise you to learn that the list object ```a=[]``` is only instantiated once, at function definition time, and is then carried around by the function object. Then, if you mutate it, the mutated version is what's used as the default in all subsequent calls. Therefore, the code outputs
```python
[1]
[1, 1]
```
The usual solution is to move the instantiation into the function body, i.e. do something like
```python
def foo(a=None):
    if a is None:
        a = []
    ...
```
or, if ```None``` is a valid input,
```python
_SENTINEL = object()
def foo(a=_SENTINEL):
    if a is _SENTINEL:
        a = []
    ...
```
but that obfuscates the code unnecessarily. Let's try to do better.

## Defaulter
defaulter.py re-evaluates the function default arguments at call-time, letting you use mutable objects without worry.
```python
import defaulter

@defaulter
def foo(a=[]):
    a.append(1)
    return a
print(foo()) # [1]
print(foo()) # [1]
```
defaulter.py works with any default comprised of a python literal, literal-expression, or function call. Want to see the time taken in a function?
```python
import defaulter, datetime
@defaulter
def long_running_function(start_time=datetime.datetime.now(), ...):
   ...
   time_taken = datetime.datetime.now() - start_time
```

Just don't get too cute:
```python
import defaulter
some_var = []

@defaulter
def foo(a=some_var):
    a.append(1)
    return a
print(foo()) # [1]
print(foo()) # [1, 1]
```
Also, obviously, never actually use this.

license: Unlicense

repository: mmurakowski/defaulter

repo_name: mmurakowski/defaulter


text:
#Team1160 v5.0 beta "BORON"

##Theme by Titanium Robotics and Nathan Wong

This is the fifth version of the Titanium Robotics Theme for titaniumrobotics.com.  You are allowed to download and use this theme on your own blog, but it was designed specifically for the titaniumrobotics.com web structure and is therefore, personalized with specific urls and icons.

#About

In this version of Team 1160's theme, Boron, everything from typography to user-interface to load time has been considered and designed to work in better harmony. The design is more robust, the pagespeed enhanced, and the connection to the brand identity of Titanium Robotics has been made more elegant.

##UI
More responsive design, cleaner and better use of web elements. Created a better and more balanced feel to the design of the website.

##Performance & Speed
Performance and speed have drastically increased in this version. On a good day with a good server, this theme with basic server-end enhancements (Content Delivery Network, Caching, Minifcations, etc.) will get 90%+ on Google's Pagespeed.

##Behind the hood
The CSS has been cleaned up through combing and a lot of useless/unnecessary things were removed. Much of the files were combined, some were separated into different files to make it easier to follow. Use file combining to make it easier for the files to be delivered. Possible SCSS switch for the website in the future.

Working on removing useless trailing spaces and cleaning PHP code. Also working on optimizing the CSS code to be easier to follow and have comments so that people know whats up and how to use the code and what everything does. This may take a while, though because tbh I don't know what the code does all the time.

#Customization and features and stuff for other teams to use this as a boilerplate if they want to.....
This theme would be great if it were a more general use theme. However, it's more stylistically branded towards Titanium Robotics. This doesn't mean that you can't use it, though! Below are some of the comments on how our theme is customized towards our own brand. Of course, it doesn't include everything, but we're still working on making it have everything.

##Logo
The logo used in this theme is 100px in height. You may replace the logo with your own logo, but remember to replace the link too.

##Colors
The main color is:#0067C6, it's the bright blue that is basically everywhere. If you want to replace it, just do a find all and replace with whatever color you would like to use. Some of the colors use RGBA() or RGB(), do a search for "RGB" and you should be able to find it all.

There are classes for certain links like Twitter and Facebook and such that use the specific colors for those brands. There's also secondary color palette that is outlined by the Titanium Robotics Brand book and we use classes to make it easier for us to standardize our color usage accross the web.

###SVG Files
SVG files probably have #0067C6 or something that Adobe Illustrator converted a Pantone color to as one of the colors. You might want to change those too. (for example the down arrow svg file for the menu, you may want to replace that on your own, though because it is serving from our own static server)

##Page Under Construction
To set a page as "Under Construction," go to the "Custom Fields" section of the Wordpress page and add a new "construction" field with the value "Under Construction." To disable, just delete the field.

#WIP
This doc is currently a work in progress. It may or may not be completed, but it's quite easy to customize this theme to your liking as long as you're thorough.

####v4.1

* Bug crushing
* better responsiveness
* basically all the same things....
* basically stable.... or something.....

###v4.0 "Beryllium"

* Typography
** Typography has been enhanced both aesthetics-wise and performance-wise through the use of standard ratios and Google Fonts. "Source Sans Pro" has been selected for the font because it is the standard font used in all of Titanium Robotics's marketing materials.

* UI
** The User-Interface has been enhanced so that it follows basic rules of front-end web design. We reduced the number of clicks required to reach a destination, and we've enhanced the visibility of objects and the contrast on some of the more hard to see elements. The mobile version utilizes "responsivenav.js" in order to enhance the menu in a mobile environment. The anchors in mobile apps have been increased in size in order to prevent unintentional tappage.

* Performance & Speed
** Performance and speed have drastically increased in this version.

* got rid of the splash page because it was coded extremely wrong and bad and it just looked a little weird.
* less blue header, but better and more stable coding/design
* WAY BETTER SPEED

####v3.1

* Brand spanking new bug fixes (probably brand spanking new bugs too)
* even better integration with Titanium Robotics branding
* Google Pagespeed scores of up to 90/100 (most of it is dependent on a good, fast server)
* FAST
* Better, more responsive Typography based on proven values for size.
* Use of 'Source Sans Pro'
* Some things that were added to make weird changes in CSS look perfectly intentional

###v3.0 "Lithium":

* New Navigation & Header (Easier to use, Easier to navigate site, More Dynamic and ROBUST)
* New Splash Page (Cleaner, Easier to navigate, More Modern, More Unique)
* Update to Fonts (Now using Google Webfonts to quicken load times, Change to sizing of Headings., Update to the Icon Font)

###v2.0 "Helium":

* I don't even remember... I think it introduced responsiveness... it was a really bad design
* don't you just love these throwbacks
* Are you catching on to our naming scheme?

###v1.0 "Hydrogen":

* Super Unstable
* Bad.
* Didn't work at all
* you don't want to see screenshots

The website can be seen at [www.titaniumrobotics.com](http://www.titaniumrobotics.com)

All included images are COPYRIGHT 2013 [TITANIUM ROBOTICS](http://www.titaniumrobotics.com) and are free to use as long as you follow the [Styles Guide](http://www.titaniumrobotics.com/press/branding/).

#License

The MIT License (MIT)

Copyright (c) 2014 Titanium Robotics

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
# csvcmp
A small tool for comparing Lantern CSVs

# How to run

The overall format is

    ./csvcmp.py first_csv_to_compare second_csv_to_compare --original-file file_both_csvs_were_derived_from

The two CSVs to compare are Lantern analysis result files. The "original file" is the file originally uploaded to the Lantern instances.

The output is a CSV with one or more sections, focussing on the differences within one column at a time:

    column in first.csv, same column in second.csv, PMCID from original file, PMID from original, DOI from original, Title from original
    # ... some differences

    another column in first.csv, the same column in second.csv, (... the 4 identifying columns from the original CSV ...)

    # and so on.

As you can see, the original file is used to supply information on the identifiers of the articles which were found to have different values. Columns 3-6 can essentially be copy-pasted as they are into a new CSV, for easy re-running in the two Lantern instances being compared.

There is an additional output: suspicious records. Those rows which had no identifier in common (PMCID, PMID, DOI) are regarded as suspicious - i.e. perhaps the same row describes a totally different article in the two result files. If there are less than 50 suspicious records, these will be output to the screen. For more than 50 another CSV will be written.

# Example

The command

    ./csvcmp.py apc_2012_2013_results.csv processed_apc_2012_2013.csv --original-file apc_2012_2013.csv

was used on the files in the example/ directory in order to produce the results

    example/apc_2012_2013_results.csv_comparison_processed_apc_2012_2013.csv.csv
    example/apc_2012_2013_results.csv_suspicious_processed_apc_2012_2013.csv.csv

# Configuration

The script supports two config options at the moment, WHITELIST_COLUMNS and EXPECTED_HEADER_DIFFERENCES_RAW.

If WHITELIST_COLUMNS is set, then all column names which are not in that list will be deleted from the 2 CSVs to be compared prior to comparison.

If EXPECTED_HEADER_DIFFERENCES_RAW is set, then it describes alternative names for columns which are in the same position in both CSV files being compared. E.g. "AAM?" and "Author Manuscript?" have the same meaning, but must also be in the same position in both files.

You can set settings for all files in settings.json in the directory of the script.

You can set per-csv settings by saving them as [original_filename].json . So if comparing `1.csv` to `2.csv` with `--original-file apc_2012_2013.csv`, you could write a specific whitelist in `apc_2012_2013.csv.json` in the script's directory.

repository: CottageLabs/csvcmp

repo_name: CottageLabs/csvcmp


text:
---
layout: post
title: Lambda Lambda Lambda-- Revenge of the Functional Interfaces
---

## **Using Java Functional Interfaces with Lambda Expressions**

### **Lambda Expressions - "Look, Ma - No Objects!"**

Java lambda expressions were Java's first foray into the land of functional programming. Unlike everything else we've learned so far about Java, lambda expressions are functions which can be created *without* being part of a class. Lambda expressions are a way to pass a function implementation as a parameter.

When we use lambda expressions, we don't have to declare a type.  This is because we are using them to act on methods from Functional Interfaces that define the variable types for us. This is called *type inference*.  Another example of type inference in Java is using "var" when we're declaring a new variable.

Lambda expressions have two parts:

    ( formal-parameter-list )  -> { expression-or-statements }

The class examples below use a functional interface called `IntMath`.  It defines the parameters for one method, `.doMath()`, as two integers.

    public interface IntMath {
       int doMath(int x, int y);
    }

Consider `.addition_with_lambda()` in the next block of code. It has one method `.doMath()` whose operation in the `.additionwithlambda()` method is defined by the lambda expression `a+b`.

    @Test
    void addition_with_lambda(){
    IntMath math = (a,b) -> a+b;
    assertEquals(5, math.doMath(2,3));
    }

Using lambda expressions here allowed us to define a simple addition function to use in the `addition_with_lambda` method without declaring a whole separate class that implements the `IntMath` interface.

### **Functional Interfaces**

Any interface with a SAM(Single Abstract Method) is a functional interface. SAMs are different from regular interfaces because they can only have one abstract method for which they define parameters. This is because SAMs were created to work with lamda expressions.

A little digging yielded this list of 43 functional interfaces available in Java. Here are some descriptions of a few of types of functional interfaces that we've used or discussed in bootcamp:

Functional Interface examples:
* Function - receives one value and returns another
* Consumer - receives one value but doesn't return one
* Supplier - supplies results of a certain type (boolean, int, etc.)
* Comparator - compares two pieces of data
* Predicate - Represents a predicate (Boolean-valued function) of one argument.

And now for something completely different as your reward for slogging through this whole post.


text:
# Github-Profile-Generator
### A basic node app to create a pdf from a github portfolio

This is a basic cli-app using node to construct an engineer's GitHub profile as an html and pdf file. Additionally, it is a way for me to get basic experience with Puppeteer and Chromium, as well as using Hnadlebars for templating.

# Design Notes

Inputs and Outputs -
The app prompts the user for a GirHun username and a color pallet. Then the app generates both a pdf and an html report in the output directory with the users's GitHub info nicely fomratted.

## Viewing and using the website

Download the repo.

Install the node dependencies:
`npm install`
* puppeteer _for mocking output and pdf printing_
* inquirer _for CLI interface
* handlebars _for templating_
* octonode _for GirHub API_
* html-pdf _deprecated, but left in for experiementation. Original option for pdf generation_

 and then initalize the app by running:
`node app.js`

Here is an example of the formatted output created as /output/[name-date].[fileType]:
![Mainpage Screenshot Demo](https://github.com/anzook/Github-Profile-Generator/blob/master/output/OutputExample.jpg)

## Acknowledgements and Credits

Website created as an assignment for the Johns Hopkins full-stack web development bootcamp (in partnership with Trilogy Education Services).
Guidance and assistance provided by:
* Stetson Lewis (Instructor)
* Donald Hesler (TA)
* Dan Thareja (Inspiration)

repository: weisisheng/Github-Profile-Generator

repo_name: weisisheng/Github-Profile-Generator


text:
# Functional Go
Here are a list of higher order functions written in golang.

### Notation
- f(a) -> bool: This means function f applied to value a returns a bool.
- f(a) -> type(a): This means function f applied to a will return a value that is of type of a
- A: A List of values a1,....an
- F: A series of function f1,....fn

### This includes
- Map: The map function will take an array of elements and apply the same function to all the elements.
> Given a list A and a function f, Map(A, f) -> type(A) = f(A) = f(a1), f(a2),...f(an)

- ParMap: This is a parallel version of the map function that takes in the same arguments as the map function. The difference is that this function takes in an extra argument. This argument specifies the amount of threads to use whilst performing the operation.

- Filter: The filter function takes in a function that returns a boolean and a list and return the values that satisfies the predicate function.
> Filter(A, f(a)) -> type(A) where f(a) -> bool and a is an element of A.

- Reduce: Given a list and a function that takes in two parameters of the same type of the function return the acculumated value based on the function.
> Reduce(A, f(a = type(a), b =type(a)) -> type(a), initialValue = type(a)) -> type(a) where a and b are different elements of A.

- Compose: This applies a series of function on a list of objects from right to left.
> Compose(F) = where F is in the order f1 ----> fn, applies the function list in the order fn(fn-1(fn-2(.......f1))).

- Pipe: This applies a series of function on a list of objects from left to right.
> Pipe(F) = where F is in the order f1 ----> fn, applies the functions in the order f1(f2(f3(.......fn))).

repository: unwosu/gohigh

repo_name: unwosu/gohigh


text:
---
title: 'Use React Hooks in an Element Block'
metaTitle: 'Use React Hooks in an Element Block'
metaDescription: 'This how-to guide will teach you how to add a state to React functional components without using a class.'
---

# Write a Block Using React Hooks

React hooks allow you add a state to React _functional components_ without using a class. You can read more about it in the [official documentation](https://reactjs.org/docs/hooks-intro.html).

## Using React Hooks in an Element Block

Using hooks in an Element block is the same as using them in any other React component. Here, we'll be modifying the [Starter Block](https://github.com/volusion/element-BlockStarter/blob/master/src/Block.js) to create a stateful component using React hooks.

1. Update your import statement for React to also import the `useState` hook:

```javascript
import React, { useState } from 'react'
```

2. Replace the block component with the following implementation, which uses `useState` to keep track of a stateful `count` variable:

```javascript
function StarterBlock(props) {
  const [count, setCount] = useState(0)

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>Click me</button>
    </div>
  )
}
```

For more details about how and why to use hooks, refer to React's [official documentation](https://reactjs.org/docs/hooks-intro.html).

repository: volusion/element

repo_name: volusion/element


text:
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/openh2labs/elastic-erga/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/openh2labs/elastic-erga/?branch=master)

# elastic-erga
A toolkit for elastic search.

We are aiming to create a simple toolkit which will allow users to monitor various elastic search servers & indeces for user
configurable conditions and alert if they are met.

The application is used entirely via a web UI

# Contribute

## Quick Start

### setup homestead

    composer install
    php vendor/bin/homestead make
    vagrant up

### enter the box

    vagrant ssh

### build front-end

    npm i
    gulp

### migrate the tables

    php artisan migrate:refresh --seed

repository: vaughnangoy/elastic-erga

repo_name: vaughnangoy/elastic-erga


text:
# Irrational Numbers

An irrational number is any number which *cannot* be written as a fraction.

Examples include:

* sqrt(2)
* Pi
* e

url: https://raw.githubusercontent.com/mhoare/compsci-notes/546af00471cca03499648849c5109d76a291913a/Paper 2/4.5 Fundamentals of data representation/4.5.1 Number systems/4.5.1.4 Irrational numbers.md

repository: mhoare/compsci-notes

filename: 4.5.1.4 Irrational numbers.md

gha_language: Makefile

repo_name: mhoare/compsci-notes


text:
---
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: single
author_profile: true
title: Game Development with adventurelib + repl.it
---

### A step by step approach to building a simple text-based adventure game

## Create an account on repl.it

You must be at least age 13 or older to create an account on repl.it so if you aren’t then get a parent or guardian to create an account for you. Accounts are **free** and will allow code Python in a browser and also copy or fork example code into your own account.

To sign up, go here: [https://repl.it/signup](https://repl.it/signup)

It is worth repeating, but if offered any price plans when creating an account, always choose the **free** option.

## About adventurelib

adventurelib provides basic functionality for writing text-based adventure games, with the aim of making it easy enough for young teenagers to do. This article is based on the excellent documentation that adventurelib provides and which you can access here: [https://adventurelib.readthedocs.io/en/stable/index.html](https://adventurelib.readthedocs.io/en/stable/index.html)

## Fork our Starter project

Our starter project really only has the bare bones including the adventurelib.py library which we’ll use to create our text-based adventure game but it should give you enough to understand how we use repl.it and how to run a basic game.

Click on the following link: [https://repl.it/@CoderDojoBanb/adventurelibStarterProject](https://repl.it/@CoderDojoBanb/adventurelibStarterProject)

You will see a few things:

On the top left of the page, you’ll notice **Files** which shows:

_main.py_ -> contains the code to run our game

_adventurelib.py_ -> contains the adventurelib code that helps build our game

![repl.it files](/assets/images/adventurelib_replit_files.png){:height="100%" width="100%"}

Along the top you’ll see two buttons. **run** & **fork** where _fork_ performs the same function as Remix in Scratch, i.e copies the code into your account so you can change and modify your own copy. _run _is somewhat similar to pressing the Green Flag in Scratch in that it will start your code running. Press **fork** now and it will take you to your own copy of the code in your account and then press **run** (you should notice that the _fork_ button is no longer visible after you press it).

![fork or run files](/assets/images/adventurelib_fork_run.png){:height="100%" width="100%"}

On the right black screen you will eventually see something like the box below. Type ?, help and some other text to see what happens.

```pycon
>
```

## Grab a sheet of paper and draw a map

We’re going to be creating our own adventure where we’ll use text commands to navigate around the game, visiting a series of rooms. So, if you haven’t done so already, draw a map with 3 to 4 rooms. You could use rooms to describe any concept of location, in order to tell your story:

*   Drifting in space
*   Entering a spooky mansion
*   On top of a hill
*   Underneath the floorboards
*   Nowhere

Here’s the one I’ve drawn to help me visualize the rooms my space adventure will take place in:

![space map](/assets/images/adventurelib_space_map.jpg){:height="100%" width="100%"}

Think about how you’d describe each room and what elements would be in it?

## Add a command

All of the rest of your code should go in between the `from adventurelib import *` and the `start()` lines.

Text adventure games respond to commands entered by the player. Some typical commands might be:

*   north
*   take wand
*   give wand to wizard

We can use the **_@when_** decorator to create a command that a player can type in order to interact with your game, your code will then decide what happens when the command is issued. Let’s add a “brush teeth'' command and use the **_say()_** function from adventurelib to output text in response:

```python3
@when("brush teeth")
def brush_teeth():
    say("""
        You brush your teeth. They feel clean.
    """)
```

Try it out by running your code in repl.it Note that this is case-insensitive, so it will also be called when the player types “BRUSH TEETH” or “bRuSh TeEtH”:

If stuck, you can _fork_ this working code: [https://repl.it/@CoderDojoBanb/adventurelibAddCommand](https://repl.it/@CoderDojoBanb/adventurelibAddCommand)

## Capturing Values

While you could write separate functions for “open airlock” and “close airlock”, it’s more normal to write a single function that will be called when the player types “anything airlock”.

This code will be called when the player types “_anything_ airlock”, and the words that match the anything will be passed into the function so that you can react to what it was they tried to do to the airlock (**Note**: the words we are capturing are the ones in CAPITAL letters and there will be a corresponding argument of the same name but in lower characters passed to the function):

```python3
@when("ACTION airlock")
def airlock(action):
    print(f"You {action} the airlock.")
```

So, in a game:

```pycon
> open airlock
You open the airlock.

> close airlock
You close the airlock.
```

You can also capture multiple words, e.g.

```python3
@when("blast RECIPIENT with the ITEM")
def blast(recipient, item):
    print(f"You blast {recipient} with the {item}.")
```

If stuck, try this completed example here: [https://repl.it/@CoderDojoBanb/adventurelibCaptureValues](https://repl.it/@CoderDojoBanb/adventurelibCaptureValues)

## Rooms

As mentioned already, a room represents any location, inside or outside. You create a **_Room_** object by passing a description, so make sure it’s a rich evocative piece of text that helps tell a story and gives the player clues as to what can happen in there.

It’s also good to keep track of where you currently are, so we’ll use a **_current_room_** global variable (a global variable is one that is available throughout your program).

We’ll also place each room relative to each other, i.e. whether it is north, south etc of one of more rooms.

For my space themed adventure I’ll add two initial rooms:

```python3
# Define our current_room to be our starting room, i.e. space
current_room = space = Room("""
You are drifting in space. It feels very cold and you are alone.

A slate-blue space station sits completely silently to the south, its airlock open and waiting.
""")

# Define airlock relative to space, i.e. it will lie south of the previous room
airlock = space.south = Room("""
You are in an airtight room with two entrances that allows an astronaut to go on a spacewalk without letting the air out of the space station.

The walls of the room contain the space suits of your fellow astronauts.
""")
```

If stuck, you can _fork_ this working code where we also have the living area and escape pod rooms in our space station: [https://repl.it/@CoderDojoBanb/adventurelibAddRooms](https://repl.it/@CoderDojoBanb/adventurelibAddRooms)

## Moving Between Rooms

We defined rooms but they’ve not played a part in our game yet. We need to allow our character to move around.

We could add a command for each direction, but let’s just use one instead and use a captured argument, **_direction_**, to see what the direction was. We’ll also need to change our global variable **_current_room_** to become the new room if we do change positions, note how we use **_global_** to make sure it’s the global version we use and not a new local version.

Finally we use the **_exit(direction)_** function from **_Room_** to do the moving. If no room exists in the direction we move then **_room_** will be empty and we won’t go into the **_if_** block:

```python3
@when('north', direction='north')
@when('south', direction='south')
@when('east', direction='east')
@when('west', direction='west')
def go(direction):
    global current_room
    room = current_room.exit(direction)
    if room:
        current_room = room
        say('You go %s.' % direction)
        look()
```

At this point it might be useful to describe the room we enter and for that we’ll add a new function **_look()_**. It is there on the last line of our go function but we’ve not defined it yet so let’s add it now:

```python3
@when('look')
def look():
    say(current_room)
```

**_say(Room)_** prints out our description of the **_current_room_**. We will also add a call to look right before our **_start()_** line so that when the game starts you get a description of the room you start in:

```python3
look()
start()
```

If stuck, _fork_ this code: [https://repl.it/@CoderDojoBanb/adventurelibMoveAround](https://repl.it/@CoderDojoBanb/adventurelibMoveAround)

## Items & Bags

Many games will allow players to pick up objects. Also perhaps some actions in the game will cause players to receive objects, such as when given them by a character.

To support this, adventurelib provides two classes that work together: **Item** and **Bag**.

### Item

An **Item** can be used to represent a non-playing character or an object you can use in the game. In our game, a non-playing character could be a crew mate but for us we’ll add in a book of escape codes that we can use to program our escape pod.

```python3
escapes_codes = Item('book of escape codes', 'codes', 'escape codes', 'book')
```

The first name you give is the default name for the item, which can be inserted into strings. All the other names you give are aliases for the object.

### Bag

A **Bag** is a collection of **Item**s. This does not need to be a literal “bag” that the player is holding - it’s a metaphor!  Or a group of Characters could be held in a **Bag**. The point of a **Bag** is to allow you to look up items by the names that players have typed for them, letting you **find**, **take Item**s from a **Bag** as well as being able to **add** items to it. Let’s add a Bag to some rooms as well as our player.

```python3
Room.items = Bag()

living_area.items = Bag({
    escapes_codes,
})

pocket = Bag()
```

Let’s add a command to pocket those items:

```python3
@when('take ITEM')
def take(item):
    obj = current_room.items.take(item)
    if obj:
        say('You pocket the %s.' % obj)
        pocket.add(obj)
    else:
        say('There is no %s here.' % item)
```

Next we’ll update the look function to loop over the **Item**s in a **Room** and print them out:

```python3
def look():
    say(current_room)
    if current_room.items:
        for i in current_room.items:
            say('A %s is here.' % i)
```

If totally stuck or confused, _fork_ this: [https://repl.it/@CoderDojoBanb/adventurelibBagsAndItems](https://repl.it/@CoderDojoBanb/adventurelibBagsAndItems)

## Let’s add some randomness, Context and win/lose scenarios

Simply moving from room to room can be a bit dull, can’t it? Lets add a pinch of randomness! To use the random library, we need to import it and do so at the top of our code, as shown here:

```python3
import random
```

Let’s add a function that acts like a coin toss, returning true if heads, false if tails:

```python3
def cointoss():
    return True if random.randint(0, 1) == 0 else False
```

Now we need to think where best to place this randomness. I’m going to add it to our living area and introduce a random chance that on entering the room, the space station is hit by a meteor. If that condition is reached, we’ll use **set_context** to add a command context as well which we’ll examine next:

```python3
def check_danger():
    if current_room == living_area and cointoss:
        say("""

        Suddenly the station shakes as it is hit by space debris. A klaxon sounds, indicating the hull has been breached and the station will implode very shortly.
  """)
        set_context('danger')
```

**Note:** Add a call to **check_danger()** as the last line of our **go(direction)** function.

Finally, we want to have a command that will only be present and available in some circumstance. Enter that command context we mentioned above. We’ve set the context to danger and now we’ll add a function which will only be called when that context matches:

```python3
@when('enter code', context='danger')
def code():
    if current_room == escape_pod:
        obj = pocket.find('codes')
        if not obj:
            say("""
        You knew you should have lifted that code book, but it's too late now as the station collapses around you!
        """)
        else:
            say("""
        You frantically pull the code book out of your pocket and key the correct code into the pod's computer. The pod slips away from the station just as it begins to collapse in on itself.
        """)
        exit()
```

We’ve covered a lot there, so _fork_ this: [https://repl.it/@CoderDojoBanb/adventurelibRandomContext](https://repl.it/@CoderDojoBanb/adventurelibRandomContext)

branch_name: refs/heads/develop

gha_language: Ruby


text:
---
title: "Making a map."
date: "2019-01-20"
tags:
  - "azure"
  - "maps"
---

I like how WordPress' default on these blog posts is "tell your story". LOL.

[Recently](https://irwinium.wordpress.com/2019/01/13/conquering-complexity-with-a-map/), I described wanting to use Azure App Insights for dependency tracking. I started by looking at documentation on it. I ended up using [this](https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#trackdependency), along with this [video](https://www.youtube.com/watch?v=TA3g28RkK-8).

As I started looking into the first place to drop in dependency notification, which was where I create my Azure Container Instance. The tutorial's code suggested dropping this fragment into a finally around where the dependency was, like so:

![](images/image.png)

From: https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#trackdependency

Then I found myself wondering if for the dependencies I was going to track, wouldn't a C# attribute be really good. Then I fell down a rabbit hole of [when to create attributes](https://stackoverflow.com/questions/3673941/what-is-the-purpose-of-attributes-in-c).

And then I emerged out of that hole, attribute-less.

So, after I applied guidance from the Application Insights document, I colored my external operations with track dependency calls and ended up with this image:

![](images/image-1.png)

Azure Application Insights application map for my solution

This does what I wanted, which is to visualize the components and dependencies of my solution, with information on success/failure and duration of the calls.

I'd like to do more with this.

gha_language: CSS


text:
---
layout: default
title: Louisiana Folklore
parent: Home
nav_exclude: true
---

# Understanding Folk Narratives in the Louisiana Context

> 2011 August 14 (Sunday). Overheard in the bathroom at Green Room last night: (girl on phone) "Hey. What's up? <pause> Wait, you're drunk. Like, Mamou drunk." -- from a 335 student's field notes.

English 335: Louisiana Folklore
10:00–10:50 MWF, HLG 202
[Course Agenda](agenda.md)

Pr. John Laudun, HLG 356, MW 2:30-3:30, Tuesdays 9:00–12:00, and by appointment. 482-5493 or<EMAIL_ADDRESS>

## Description

Someone once called Louisiana a “folklore land” and we do live in a state, and in a region of the state, where folklore not only abides in abundance but is the subject of a great deal of attention by scholars and citizens, tourists and natives. This course encourages students to take a closer look for themselves not only at the folklore that surrounds and shapes each of us but also at the various ways it has been and is currently being represented. Taking a closer look *requires* participants to go out and see for themselves, engaging in field research in order to observe, document, and analyze folk culture as they experience and know it. While our chief focus will be verbal culture, we will explore other forms.

## Objectives

Participants in this course will learn how to read scholarly and scientific definitions and analyses of human nature with a special emphasis on folk culture in general and narrative in particular and then apply those definitions or reproduce such analyses in their own thinking and writing. Writing is a significant component of any communication, be it scientific or professional, and participants in this course will be required to assume those voices necessary to accomplishing a particular task. In addition, as a course in folklore studies participants will also create documentation containing both metadata and data in appropriate markup, which may or may not include things like XML.

## Texts & Materials

### Required

In addition to the book below, we will be reading a lot of articles available either through JSTOR, Project Muse, or through the course's Moodle website. All will be in PDF form, so please make sure you understand how to access and have also set aside money to print these materials. (We can discuss possible uses of devices, but phones are not among them. Don't even.)

Lindahl, Carl, Maida Owens, and C. Renée Harvison. 1997. _Swapping Stories: Folktales from Louisiana_. University Press of Mississippi and the Louisiana Division of the Arts.

Please note that all readings are sequenced/timed to make your understanding of particular lectures, discussions, or activities more profound and complete. Any and all materials found in the texts can, and will be, on any quiz or exam without necessarily having been directly addressed in class: if you have questions about anything you read, be sure to ask them in class.

Other course expenses include equipment and/or supplies for recording and producing various kinds of documentary projects. (See the [project specifications](project.md) for more information.) Most modern devices are sufficiently general purpose in nature to provide the ability to make audio and/or video recordings of reasonable quality, but it may require some proficiency on your part to do so. If you currently do not possess that proficiency, please make sure to set aside the time to acquire it, and do be sure that you are comfortable establishing your own needs and shepherding your education according to your resources. (This assumption of your competence is a requirement of this course.)

### Recommended

The books listed below offer a general background and some specific treatments of topics central to the study of south Louisiana’s folk cultures. Their being listed here does not certify their accuracy. They are offered simply as possible reading for those interested in the ways Louisiana folk cultures have been examined in the past.

Ancelet, Barry Jean. 1994. _Cajun and Creole Folktales: The French Oral Tradition of South Louisiana_. University Press of Mississippi.

deCaro, Frank and Rosan Jordan. 1998. _Louisiana Sojourns: Travelers’ Tales and Literary Journeys_. Louisiana State University Press.

Ancelet, Pitre, Edwards. 1986. _Cajun Country_. University Press of Mississippi.

Brasseaux, Carl. 2005. _French, Cajun, Creole, Houma: A Primer On Francophone Louisiana_. Louisiana State University Press.

## Requirements

To meet the course objectives enumerated above, students must attend both in-class lectures and discussions, keep up with the readings, and engage in a semester-long research project of their own devising and execution. Thus, this course is best enjoyed when taken by independent, self-motivated learners. In addition, this course also requires a reasonable level of emotional maturity, since folklore is "equipment for living" and materials we examine and discuss come from life itself, where things can be inflammatory or embarrassing. Participants must be prepared for this. *No, really: if you are easily offended, then this course may not be for you.*

### Assignments

PARTICIPATION & QUIZZES (20%). Regular participation means being in class (on time), prepared, and participating actively both through listening and through talking. No more than three absences will be excused without consent of the instructor. As noted above, the chief delivery vehicle for information in this course is in class.[^1]

From time to time, to check for comprehension and currency, I give in-class quizzes, which are folded into your participation grade. Unlike the exams, which are scheduled in advance and can also be made up, quizzes are one-time-only affairs.

Part of the participation and quiz grade are small assignments, like the one where you collect a single story early in the semester. Like the grades on quizzes, a check mark means you got credit.

EXAMS (30%). There are two exams in this course, which cover materials from lectures, discussions, readings, and viewings. The purpose of the exams is for you to demonstrate to me and to yourself your knowledge and comprehension of the theoretical and historical material presented in class.

PROJECT (50%). This course has at its core an individual research project which you propose, plan, develop, draft, and submit over the course of the semester. The final submission includes a paper of 2500 words of polished prose and the appropriate documentation, and recordings, for the material analyzed in the paper. For a complete description, see the [project page](project.md).

## Agenda

This topics and assignments in this class proceed in a sequence described in a separate document [here](agenda.md).

## Emergency Evacuation Procedures

A map of this floor is posted near the elevator marking the evacuation route and “Designated Rescue Area.” Students who need assistance should identify themselves to the instructor.

## Contact Information

Immediately look around where you are sitting and get the name and number of two responsible-looking people. Write that information below so that when you do have to miss class, you can contact them about what you missed.

Contact:

Contact:

[^1]: Please note that I take roll for the first few weeks of class in order to learn your names, after that, you will often see me taking roll as class begins and/or making notes about someone who has made a contribution to class, a plus (+), or someone who is clearly studying for the exam in their next class, a minus (–). (You would be surprised how much one can see while standing in the front of the room.)

repository: johnlaudun/teaching

repo_name: johnlaudun/teaching


text:
# Legal Ass…

![](http://cl.ly/XnDW/Screen%20Shot%202014-09-30%20at%2011.32.37%20AM.png)

Truncates text. Prevents embarassing word splices. Truncation + business rules = FUNcation!

[![Build Status](https://travis-ci.org/banterability/legal-ass.svg?branch=master)](https://travis-ci.org/banterability/legal-ass)

## Installation

```bash
npm install legal-ass --save
```

## Usage

**`LegalAss(phrase, options)`**, where `phrase` is the string you'd like truncated and `options` is an object specifying the following:

| Key        | Value | Required? |
| ---------- | ---- | ----- |
| length     | (Integer) The maximum number of characters in the truncated return string, including any ellipses string that follows. | **Yes** |
| splitWords | (Boolean) Should the library truncate in the middle of a word? Defaults to `false`, meaning that the return string may be shorter than `length` if that's necessary to split between words. | No |
| ellipses   | (String) A string to append to the end of the truncated text. Its length will be factored in to where a string truncates. Defaults to a single-character ellipses (`…`). | No |

```js
var LegalAss = require('legal-ass');

LegalAss('So this is a story all about how', {length: 22});
// -> 'So this is a story…'
```

Note that the returned string is only 19 characters long, since a longer string would have split in the middle of the word "all". If you don't care about this, pass `{splitWords: true}`:

```js
LegalAss('So this is a story all about how', {length: 22, splitWords: true});
// -> 'So this is a story al…'
```

If you'd like to use your own string instead of ellipses, pass that as `ellipses`:

```js
LegalAss('So this is a story all about how', {length: 22, ellipses: ' (More >)'});
// -> 'So this is a (More >)'
```

Note that the original phrase above was truncated with a trailing space and the library made the end result an additional character shorter by eliminating it.

repository: banterability/legal-ass

repo_name: banterability/legal-ass