text:
# c_basic_examples
This repository contains basic examples in the C language to cover topics like variable initialization, flow control, basic pointer arithmetic etc.

## Implement a function that reverses a string

```
char *reverseString(char* _string);
```

## Implement a function that counts the occurrence of a given character in a given string
```
int countOccurrence(char *_string, char _c);
```

## Implement a function that sorts the characters of a string in alphabetically ascending order ("a"<"b")
```
char* sortAsc(char* _string);
```


text:
---
layout: post
title: Ubuntu 20.04 on Lenovo T14s AMD Gen1
date: 2022-04-10 19:26 +0800
img_path: /assets/
categories: linux
tags: ubuntu
---

Basically, all machine functions working well, including:

* Intel AX200 wireless card
* HDMI output with audio
* DP output on USB-C port (one cable, including power supply, video and audio output)
* USB hub on USB-C port
* wake up from sleep

All above functions tested in `Ubuntu 20.04.4 LTS` with kernel  `5.13.0-39-generic`

```shell
mike@ThinkPad-T14s:~$ uname -a
Linux ThinkPad-T14s 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
```

### Requirements

#### Bootable USB drive

1. download latest image from  [Ubuntu official website](https://ubuntu.com/download/desktop).
2. use [Rufus](https://rufus.ie/en/)  burn ISO to your `USB` Drive

#### BIOS Settings

Before migrate from `Windows` to `Ubuntu`,  you need change some `BIOS` settings to make `Ubuntu` behave normally.

**how to enter `BIOS`**:

1.  press `enter` on the Lenovo screen when booted.
2.  press `F12` enter the `BIOS`.

**Settings**:

* set “OS Optimized Defaults” to “Disabled”.

![image-20220313115835171](T14sUbuntu.assets/image-20220313115835171.png)

* disable secure boot

* set sleep state to `Linux`( this fix can not wake up issues)

  config->power->sleep state

#### Installment

**boot from USB drive**:

1.  press `enter` on the Lenovo screen when booted.
2.  press `F12` enter the boot source selection screen.
3.  chose your `USB` drive

**third-party driver**:

The opensource third-party driver for `AMD Ryzen 7 PRO` series chips runs really well on `Thinkpad T14s`, remember check the box on install wizard.

![](T14sUbuntu.assets/2-3.png)

**update system**:

After install, update system to latest.

```shell
sudo apt update && sudo apt upgrade
```

### Optimization

Below sections are optional optimizations for `Ubuntu`. Make your own choice.

Tips: If you install `Ubuntu` with the latest ISO image from [Ubuntu official website](https://ubuntu.com/download/desktop), you don't  need install the OEM kernel manully. [switch to Linux oem kernel](#switch-to-linux-oem-kernel).

#### switch to Linux oem kernel

After you install `Ubuntu`, default kernel is generic. It may have some annoying problems, like, you can not size brightness with hotkeys, and display colors are not accurate compare to windows. Recommend switch to Linux oem kernel, all above problems will gone.

more details about OEM Kernels, see below link:

[OEM Kernel](https://wiki.ubuntu.com/Kernel/OEMKernel)

use this command to install:

```shell
sudo apt install linux-oem-20.04b
```

#### set mouse wheel speed

Ubuntu default mouse speed is too slow.We need use a config to make it better.

1. install imwheel

   ```shell
   sudo apt install imwheel
   ```

2. create `.imwheelrc`

   ```shell
   sudo gedit ~/.imwheelrc
   ```

   content:

   ```shell
   ".*"
   None,      Up,   Button4, 3
   None,      Down, Button5, 3
   Control_L, Up,   Control_L|Button4
   Control_L, Down, Control_L|Button5
   Shift_L,   Up,   Shift_L|Button4
   Shift_L,   Down, Shift_L|Button5
   ```

   change the number 3 more smaller if you think the speed is too fast.

3. starting onboot

   use command `imwheel -kill` to start imwheel. Also, you could use `gnome-session-properties` set this command as a startup command.

#### Change Ubuntu notification position to right

1. install  gnome tweaks and gnome-shell-extensions

   ```shell
   sudo apt install gnome-tweaks gnome-shell-extensions
   ```

2. install Host Connector ()

   ```shell
   sudo apt install chrome-gnome-shell
   ```

3. use chrome open https://extensions.gnome.org/, install `Notification Banner Position`

#### Show the net speed on the status bar

1. make sure you already installed `gnome-tweak`, `gnome-shell-extensions`
2. search  `Net speed Simplified ` in the extensions store.

![image-20220410155456298](T14sUbuntu.assets/image-20220410155456298.png)

### Software recommendation

For using Ubuntu more conveniently , I recommend some nice software on `Ubuntu`.

#### Onedrive

If you just migrate from `Windows`, and still have some important files on `onedrive`, you should use this opensource [onedrive client](https://github.com/abraunegg/onedrive) for Ubuntu(works in terminal).

you can use the install script from `github`, or install from a custom apt repository.

1. add repository and install

   ```shell
   sudo add-apt-repository ppa:yann1ck/onedrive && sudo apt install -y onedrive
   ```

2. login

   ```shell
   onedrive
   ```

3. sync with specific directory

   ```shell
   onedrive --synchronize --single-directory [dirName]
   ```

#### flameshot

Best sceenshot tools on linux.

```shell
sudo apt install flameshot
```

#### Remmina

Best remote desktop app in Linux, support `RDP` ,`VNC` protocals. If you have another windows machine which is often accessed, use this app to access your windows machine on `Ubuntu`.

```shell
sudo snap install remmina
```

license: MIT

branch_name: refs/heads/main

extension: md

gha_language: HTML

license_type: permissive


text:
---
title: Core Services
page_title: Core Services
description: Explains how to create schemas for Core service objects
keywords: core services, services
allowSearch: true
---

## Overview
This page explains the jobs to be run to bring up the Core services.

## Prerequisites

1.Create a container in the Azure blob and make it public to publish content. The container name must be the same as the variable **sunbird_content_azure_storage_container** specified in the **common.yml** file present in the core inventory.

2.Switch to the `Build` folder and run all jobs. Set the value for **github_release_tag** according to the details mentioned in this page - [Current Release Tags and Jenkins Jobs Reference](developer-docs/server-installation/current_release_tags_n_jenkins_jobs){:target="_blank"}

## Running the Jobs

> Note: Adhere to the following sequence when running the jobs.

### DevOps Administration

| Operation Name | Function |
|--------------------|-----------|
| Bootstrap | Creates Deployer User |

### Builds

| Build Name | Function (Builds) | CURRENT RELEASE TAG |
|--------------------|-----------| -------------------
| Adminutils | Adminutils docker image | release-3.4.0
| API MANAGER | API manager docker image | release-3.4.0
| API MANAGER Echo | API manager echo docker image | master
| Badger | Badger docker image |
| Cassandra | Jar for migration| release-3.4.0 |
| Lms | LMS service docker image | release-3.4.0
| Content | Content service docker image | release-3.4.0
| Search  | search service docker image |release-3.4.0
| KnowledgeMW | Knowledge-mw service docker image | release-3.4.0
| Learner | Learner service docker image | release-3.4.0
| Player | Player service docker image. | release-3.4.5
| Cert | Cert service docker image | release-1.1.1
| EncService | Envservice docker image | release-1.1.1
| Proxy | Proxy docker image | release-3.4.0
| Telemetry | Telemetry docker image | release-2.1.0
| Keycloak | Keycloak zip file | release-1.15_RC9|
| Analytics | Analytics service docker image | release-3.4.0
| Taxonomy  | Taxonomy service docker image | release-3.4.0

### Artifacts
Ensure that all Artifacts are uploaded

### Provision

| Operation Name | Function | Description | CURRENT RELEASE TAG |
|--------------------|-----------|---------| ------------------- |
| (Deploy) ApplicationES( Kubernetes folder) | Provisions Elasticsearch 6.2.3 version used by core services | From the Deploy Folder, **Deploy ApplicationES** provisions for the Elasticsearch and creates indices necessary for Sunbird Core| release-3.4.0
| ESMapping (Under OpsAdministarion. Provide the value as *all* for job parameter indices_name) | Creates Elasticsearch indexes | Creates the specific index with its mapping or all indices which will be used by our sunbird app | release-3.4.0
| Postgres | Provisions for Postgres | Provisions the Postgres instance | release-3.4.0
| PostgresDbUpdate | Creates the databases, assigns roles and creates users | Creates a schema with DB's, Tables | release-3.4.0 **Perform Kong migration once db update is done, steps are mentioned in the kong migration section**
| EsReindexing (Under OpsAdministario, parameters should be esHost: es ip, oldIndex: certreg, newIndex: certv2, aliasName: certs, indexFileLocation: sunbird-es-utils/src/main/resources/reindexing/indices/certreg_indices.json, mappingFileLocation: sunbird-es-utils/src/main/resources/reindexing/mappings/certreg_mappings.json) | --- | --- | release-3.4.0

### Deploy

| Operation Name | Function | Description |  CURRENT RELEASE TAG |
|------|------|---------------------------------| --------------|
|BootstrapMinimal |creating the namespace for kubernetes orchestration and also Bootstrap minimal create docker registry secrets and nginx ssls also | Creates namespace for the core service | release-3.4.0
|nginx-private-ingress |xxxx | xxxx | release-3.4.0
| API Manager | Deploys the API manager Kong and API manager Echo | Manages consumers and APIs of sunbird | release-3.4.0
| OnboardAPIS | Onboards all API's to Sunbird | onboards sunbird API's | release-3.4.0
| OnboardConsumers | Onboards sunbird consumers |onboards sunbird consumers | release-3.4.0
Update **core_vault_sunbird_api_auth_token**, **core_vault_kong__test_jwt** and **core_vault_sunbird_ekstep_api_key** with the **jwt token** from the Jenkins output of **api-management-test-user** if you are using the Knowledge Platform and Data Pipeline along with core| Generates user specific key |  Onboards new consumer to Sunbird and generates the consumer specific API key |
| (Provision) Cassandra |Provisions Cassandra and create keyspaces required for Sunbird Core | Provisions Cassandra and creates keyspaces and performs migration | release-3.4.0|
| Cassandra | Performs keyspace schema migration | Performs migration if required. Deploy this thrice by choosing different zip files using the build_number parameter. Ensure that you get a success message for the Cassandra migration on the Jenkins console output. Do not rely only on the red or green status indicator on Jenkins job | release-3.4.0
|(Provision) Keycloak | Install dependencies for keycloak | Provisions Keycloak by installing prerequisites like Java and environment variables | release-3.4.0
| Keycloak | Deploys Keycloak service to VM | Centralized user management for sunbird | release-3.4.0
| KeycloakRealm(Core folder) |  User management -Creates sunbird realm | Creates a Sunbird Realm. After the Sunbird realm is created, configure Keycloak by using the steps mentioned in the **Keycloak Configuration** section | release-3.4.0
|Adminutil | Deploys the Adminutil container | Creates tokens for the sunbird devices | release-3.4.0
| Player |  UI for sunbird  | Deploys portal UI | release-3.4.0
| Learner | Deploys the Learner Service |  Handles user management and helps to search org | release-3.4.0 **before deploying learner service Create root org by using the steps mentioned in the Create Org section below**
| Content | Deploys content service | Helps to create content | release-3.4.0
| Search              | Deploys the search service artefacts and starts the search service | |release-3.4.0
| KnowledgeMW | Deploys knowledgemw service | Deploys the knowledgemw service | release-3.4.0
| Lms | Deploys LMS Service | Provides the APIs for LMS functionality of Sunbird| release-3.4.0
| EncService | Deploys enc service | Encrypts and decrypt the keys to generate certificate | release-3.4.0
| Cert | Deploys cert services | Issues certificates | release-3.1.0
| Telemetry | Aggregates and send telemetry data to kafka | Telemetry management service| release-3.4.0
| Analytics | Deploys Analytics service | Deploys Analytics service | release-3.4.0
| Taxonomy | Deploys Taxonomy service | Deploys Taxonomy service | release-3.4.0 after deploying taxonomy service create master category and run definition scripts by using the steps mentioned in **Create master category** section
|nginx-public-ingress | Deploys Proxy service | Deploys Nginx | release-3.4.0
|BootstrapMinimal |creating the namespace for kubernetes orchestration  and also Bootstrap minimal create docker registry secrets and nginx ssls also| Creates namespace for the core service | release-3.4.0

### Keycloak Configuration

> Note: From release-2.0.0 keycloak admin portal is disabled from public internet.
You must tunnel the port in to the local machine via ssh tunnelling.
`ssh -L 8080:localhost:8080 ops@~keycloak-ip-address~`
You can access keycloak via `localhost:8080`

| Step | Action  |
|------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | Login to Keycloak using the user name **admin** and password as given in the private **secrets.yml** file. Or, login to keycloak using <localhost:8080>/auth |
| 2 | Navigate to Sunbird Realm > Realm Settings > Keys. Click `Public Key`. Copy the key value that you see and update the variable core_vault_sso_public_key |
| 3 | Creating keycloak federation [Deployment Steps for Keycloak User Federation](developer-docs/server-installation/keycloak_user_federation) |
| 4 | Creating keycloak lms client [Creation Steps for Keycloak lms client](developer-docs/server-installation/keycloak_lms_configuration) |
| 5 | Create Keycloak Password policy: navigate to Authentication > Password Policy > from add policy drop down select `Hashing Iterations, Minimum Length, Special Characters, Uppercase Characters, Lowercase Characters`
| 6 | Get the value for variable adminutil_refresh_token_public_key_kid [Steps to get the value for variable](developer-docs/server-installation/adminutil_refresh_token) |

**Note:**
If the Cassandra migration fails, run the query manually to set the corresponding version for the failed migration to True

**Example:**

`SELECT * from sunbird.cassandra_migration_version;`

Check the rows for which the value in the success column is False. The following is an example -

`1.80 |   180685665 |   cassandra |              4 |         null | 2019-12-01 13:58:52.401000+0000 |            136 | V1.80_cassandra.cql |   False |  CQL |           80`

Run the update query for each row separately

`update sunbird.cassandra_migration_version set success=True where version ='1.80';`

Verify that all the values in the success column are True and rerun the Jenkins job again with same zip file and tag

Once this succeeds, use the second zip file and tag to deploy again

The current migration version is 1.88. The output of the Jenkins job should be as follows -

`Migrating keyspace Sunbird to version 1.88 - Cassandra
Successfully applied 3 migrations to keyspace sunbird (execution time 00:20.547s).
Migration Completed at ==1571996508540`

### Create Root org

```
   # Create root org
      # cqlsh
      INSERT INTO sunbird.organisation (id,channel,orgname,hashtagid,isrootorg) values ('1234567890','default', 'default','1234567890',true);

      # from Elastic search
      # Sync to es
      curl -X PUT "localhost:9200/org/_doc/1234567890?pretty" -H 'Content-Type: application/json' -d'
      {
        "id": "1234567890",
        "channel": "default",
        "orgname": "default",
        "hashtagid": "1234567890",
        "isrootorg": true
      }

      #cqlsh
      # Insert in to system settings
      INSERT INTO sunbird.system_settings (id,field,value) values ('custodianOrgId','custodianOrgId','1234567890');
      INSERT INTO sunbird.system_settings (id,field,value) values ('custodianOrgChannel','custodianOrgChannel','1234567890');

```

### Knong migration

```
   set or export postgres variables
   export PG_HOST="postgres ip"
   export PG_USER="postgres"
   export PGPASSWORD="pgpassword"   #  copy value from core_vault_postgres_password variable
   export PG_DB="kong db name"   # by default db name will be api_manager_{{env}}, verify in postgres database for knong db name

   docker run --name kong-migration \
   -e ""KONG_DATABASE=postgres"" \
   -e ""KONG_PG_DATABASE=$PG_DB"" \
   -e ""KONG_PG_HOST=$PG_HOST"" \
   -e ""KONG_PG_PASSWORD=$PGPASSWORD"" \
   -e ""KONG_PG_USER=$PG_USER"" \
   -e ""KONG_PROXY_ACCESS_LOG=/dev/stdout"" \
   -e ""KONG_ADMIN_ACCESS_LOG=/dev/stdout"" \
   -e ""KONG_PROXY_ERROR_LOG=/dev/stderr"" \
   -e ""KONG_ADMIN_ERROR_LOG=/dev/stderr"" \
   -e ""KONG_ADMIN_LISTEN=<IP_ADDRESS>:8001"" \
   -p 8000:8000 \
   -p 8001:8001 \
   kong:0.14.1 kong migrations up --vv

```

### Create master category

1.login to taxonomy service container and execute the curl commands to create master category. curl commands are availabe in the file [master_category_create](https://github.com/project-sunbird/knowledge-platform/blob/release-3.4.0/definition-scripts/master_category_create)

2.Replace the host to http://localhost:9000 while running

3.Run other defintion scripts from taxonomy service [definition-scripts](https://github.com/project-sunbird/knowledge-platform/tree/release-3.4.0/definition-scripts) Since master_category_create is already ran do not run again.

branch_name: refs/heads/master

gha_license_id: MIT


text:
# Universal Login
### Checklist / Things to do
- [ ] Login Page
  - [x] Create initial login page
  - [x] Login page should send ajax post request to login server
  - [ ] Store returned token to local storage
  - [ ] Include token to Authorization: Bearer header.
  - [ ] Redirect to auth page (empty page that tells you are logged in)
- [ ] /init page
  - [ ] Administrate other universal login instance
    - [ ] Server URL
    - [ ] Secret admin key
  - [ ] Admin key token
    - [ ] Show Token
    - [ ] Generate new token
- [ ] /change-admin-password page
  - [ ] 2 inputs (with confirmation, client side verified)
- [ ] /admin page
  - [ ] ....

repository: ghabxph/universal-login

repo_name: ghabxph/universal-login


text:
# **Notes**

## **Redux Explained**

- JS Framework for managing the frontend state of a web application.

  - Gives us ability to store information in an organized manner in a web app and quickly retrieve that information from anywhere in the app.

- **`Redux`**
  - Client Side Data Management
  - Controls "Frontend State"
  - NOT Your Database
  - NOT Component State
  - Just used for managing Data

![pic](https://i.gyazo.com/60842c925c90bf2c1d310360ea7ab5b0.png)

- Visual of how an app without React manages it's data.

  - A lot of prop threading happening.

- Data stored in a sep. location - `global data`.

**The Anatomy of Redux**

- **`Store`**
  - Holds the Frontend State
  - Provides an API for the Frontend State
- **`Action`**
  - POJOs
  - Outline Changes to Frontend State
- **`Reducers`**
  - Functions
  - Make Changes to Frontend State

**Where did Redux come from?**

- There are three central philosophies of Redux:
  1. `A Single Source of Truth` : state is stored in a POJO
  2. `State is Read Only` : State is immutable, modified by dispatching actions.
  3. `Changes are Made with Pure Functions` : Reducers that receive the actions and return updated state are pure functions of the old state and action.

**When is it appropriate to use Redux?**

- When doing a project with simpler global state requirements, it may be better to choose React's Context API over Redux.

- Redux offers more flexibility and support for middleware along with richer developer tools.

**Vocabulary**

- **`State`**

  - _Redux is a State Manager_
  - State is all the information stored by that program at a particular point in time.
  - Redux's main job is to store the state and make it directly available to your entire app.

- **`Store`**

  - _Redux stores state in a single store_.
  - Redux store is a single JS object with a couple of methods (not a class!)
    - Methods include:
      `getState`, `dispatch(action)`, and `subscribe(listener)`

- **`Actions`**

  - _Redux store is updated by dispatching actions_
  - Action is just a POJO that includes a mandatory `type` property.
  - Contain info to update the store.
  - We dispatch actions in response to User actions or AJAX requests.

- **`Pure Functions`**

  - _Redux Reducers are Pure Functions_
  - Functions are pure when their behavior depends only on it's arguments as has no side effects.
  - Simply takes in an argument and outputs a value.

- **`Reducer`**

  - _Redux handles actions using reducers_
  - A function that is called each time an action is dispatched.
  - Takes in an `action` and `current state`
  - Required to be pure functions so their behavior is predictable.

- **`Middleware`**

  - _Customize response to dispatch actions by using Middleware_
  - Middleware is an optional component of Redus that allows custom responses to dispatched actions.
  - Most common use is to dispatch async requests to a server.

- **`Time Traveling Dev Tools`**

  - _Redux can time travel wow_
  - Time travel refers to Redux's ability to revert to a previous state because reducers are all pure functions.

- **`Thunks`**
  - _Convenient format for taking async actions in Redux_
  - General concept in CS referring to a function who's primary purpose is to call another function.
  - Most commonly used to make async API requests.

---

## **Flux and Redux**

**What is Flux?**

- Front-end application architecutre.
- A pattern in which to structure an application.
- Unidirectional Data Flow - offers more predictability.
  ![flux](https://s3.amazonaws.com/lecture-assets/redux-flux.png)

- `Actions` : Begins the data flow of data, simple object that contains a type; type indicates the type of change to be performed.

- `Dispatcher` : Mechanism for distributing actions to the store.

- `Store` : The entire state of the application, responsible for updating the state of your app.

- `View` : Unit of code that's responsible for rendering the user interface. Used to re-render the application when actions and changes occur.

![graph](https://Lambda-open-assets.s3-us-west-1.amazonaws.com/fullstack/react/assets/flux-loop.png)

**Redux**

![rdx](https://assets.aaonline.io/fullstack/react/assets/redux.gif)

- Library that facilitates the implementation of Flux.
- Redux Three Principles
  - `Single Source of Truth`
  - `State is Read-Only`
  - `Only Pure Functions Change State`

---

## **Store**

- Simply an object that holds the application state wrapped in an API.
- **`Three methods`**:
  - **`getState()`** : Returns the store's current state.
  - **`dispatch(action)`** : Passes an action into the store's reducer to tell it what info to update.
  - **`subscribe(callback)`** : Registers a callback to be triggered whenever the store updates.

**Updating the Store**

```js
store.dispatch(action);

// Add Orange Action
const addOrange = {
  type: "ADD_FRUIT",
  fruit: "orange",
};

// Reducer for Orange Action
const fruitReducer = (state = [], action) => {
  switch (action.type) {
    case "ADD_FRUIT":
      return [...state, action.fruit];
    default:
      return state;
  }
};

// Run the Dispatch
console.log(store.getState()); // []
store.dispatch(addOrange);
console.log(store.getState()); // [ 'orange' ]
```

**Subscribing to the store**

- Whenever a store process a dispatch(), it triggers all its subscribers.
- **`Subscribers`** : callbacks that can be added to the store via subscribe().

```js
const display = () => {
  console.log(store.getState());
};

const unsubscribeDisplay = store.subscribe(display);

store.dispatch(addOrange); // [ 'orange', 'orange' ]

// display will no longer be invoked after store.dispatch()
unsubscribeDisplay();

store.dispatch(addOrange); // no output
```

**Reviewing a simple example**

```js
// app.js

const { createStore } = require("redux");

// Define the store's reducer.
const fruitReducer = (state = [], action) => {
  switch (action.type) {
    case "ADD_FRUIT":
      return [...state, action.fruit];
    default:
      return state;
  }
};

// Create the store.
const store = createStore(fruitReducer);

// Define an 'ADD_FRUIT' action for adding an orange to the store.
const addOrange = {
  type: "ADD_FRUIT",
  fruit: "orange",
};

// Log to the console the store's state before and after
// dispatching the 'ADD_FRUIT' action.
console.log(store.getState()); // []
store.dispatch(addOrange);
console.log(store.getState()); // [ 'orange' ]

// Define and register a callback to listen for store updates
// and console log the store's state.
const display = () => {
  console.log(store.getState());
};
const unsubscribeDisplay = store.subscribe(display);

// Dispatch the 'ADD_FRUIT' action. This time the `display` callback
// will be called by the store when its state is updated.
store.dispatch(addOrange); // [ 'orange', 'orange' ]

// Unsubscribe the `display` callback to stop listening for store updates.
unsubscribeDisplay();

// Dispatch the 'ADD_FRUIT' action one more time
// to confirm that the `display` method won't be called
// when the store state is updated.
store.dispatch(addOrange); // no output
```

## **Reducers**

- Reducer function receives the current `state` and `action`, updates the state appropriately based on the `action.type` and returns the following state.

- You can bundles different action types and ensuing logic by using a switch/case statement.

```js
const fruitReducer = (state = [], action) => {
  switch (action.type) {
    case "ADD_FRUIT":
      return [...state, action.fruit];
    case "ADD_FRUITS":
      return [...state, ...action.fruits];
    case "SELL_FRUIT":
      const index = state.indexOf(action.fruit);
      if (index !== -1) {
        // remove first instance of action.fruit
        return [...state.slice(0, index), ...state.slice(index + 1)];
      }
      return state; // if action.fruit is not in state, return previous state
    case "SELL_OUT":
      return [];
    default:
      return state;
  }
};
```

**Reviewing how Array#slice works**

```js
const fruits = ["apple", "apple", "orange", "banana", "watermelon"];

// The index of the 'orange' element is 2.
const index = fruits.indexOf("orange");

// `...fruits.slice(0, index)` returns the array ['apple', 'apple']
// `...fruits.slice(index + 1)` returns the array ['banana', 'watermelon']
// The spread syntax combines the two array slices into the array
// ['apple', 'apple', 'banana', 'watermelon']
const newFruits = [...fruits.slice(0, index), ...fruits.slice(index + 1)];
```

- Approach that can be used to remove an element without mutating the original array.

**Avoiding state mutations**

- **Your reducer must always return a new object if the state changes.**

**GOOD**

```js
const goodReducer = (state = { count: 0 }, action) => {
  switch (action.type) {
    case "INCREMENT_COUNTER":
      const nextState = Object.assign({}, state);
      nextState.count++;
      return nextState;
    default:
      return state;
  }
};
```

**BAD**

```js
const badReducer = (state = { count: 0 }, action) => {
  switch (action.type) {
    case "INCREMENT_COUNTER":
      state.count++;
      return state;
    default:
      return state;
  }
};
```

---

## **Actions**

- Actions are the only way to trigger changes to the store's state.

**Using action creators**

```js
const addOrange = {
  type: "ADD_FRUIT",
  fruit: "orange",
};

store.dispatch(addOrange);
console.log(store.getState()); // [ 'orange' ]
```

- fruit is the `payload key` and orange is the `state data`

- **`Action Creators`** : Functions created from extrapolating the creation of an action object.

```js
const addFruit = (fruit) => ({
  type: "ADD_FRUIT",
  fruit,
});
```

- Use parenthesis for implicit return value.
- We can now add whatever fruit we'd like.

```js
store.dispatch(addFruit("apple"));
store.dispatch(addFruit("strawberry"));
store.dispatch(addFruit("lychee"));
console.log(store.getState()); // [ 'orange', 'apple', 'strawberry', 'lychee' ]
```

**Preventing typos in action type string literals**

```js
const ADD_FRUIT = "ADD_FRUIT";
const ADD_FRUITS = "ADD_FRUITS";
const SELL_FRUIT = "SELL_FRUIT";
const SELL_OUT = "SELL_OUT";

const addFruit = (fruit) => ({
  type: ADD_FRUIT,
  fruit,
});

const addFruits = (fruits) => ({
  type: ADD_FRUITS,
  fruits,
});

const sellFruit = (fruit) => ({
  type: SELL_FRUIT,
  fruit,
});

const sellOut = () => ({
  type: SELL_OUT,
});
```

- Using constant variables helps reduce simple typos in a reducer's case clauses.

---

## **Debugging Arrow Functions**

- It is important to learn how to use debugger statements with arrow functions to effectively debug Redux cycle.

**Understanding the limitations of implicit return values**

```js
const addFruit = (fruit) => {
  return {
    type: "ADD_FRUIT",
    fruit,
  };
};

const addFruit = (fruit) => {
  debugger;
  return {
    type: "ADD_FRUIT",
    fruit,
  };
};
```

- You must use explicit return statement arrow function to use a debugger.

---


text:
## 1.2.1

* Determine orientation of JPEG images and automatically rotate them (usually an issue when uploading from mobile devices)

## 1.1.1

* Bugs fixed:
  * return image file too when original image is not requested;
  * pass isOriginalSize prop down to the Cropper.

## 1.1.0

* now cropper simply accept image file instead of dataURL of it, through same
prop `image`
* onCrop callback now returns two arguments: cropped image dataURI and image file

## 1.0.0

* updated to react 16 and webpack 4 and at least making sure it works with it
* codestyle updated (ES6)

## 0.4.0

* return original cropped size image by default, instead of given canvas size

* add prop isOriginalSize to Cropper (default: true)

## 0.3.0

* add device touches events (now dragging is allowed on devices)

## 0.2.0

* add semantic-ui-react modal component instead of react-bootstrap modal

repository: yusupova/react-avatar-cropper

repo_name: yusupova/react-avatar-cropper


text:
Artifactory HTTP SSO Config User Plugin
=======================================

Allows REST access to the HTTP SSO configuration. This plugin exposes two
executions:

getHttpSso
----------

`getHttpSso` returns a JSON representation of the current HTTP SSO
configuration. The returned JSON string has the following fields:

- `httpSsoProxied`: Whether Artifactory is proxied by a secure HTTP server.
- `noAutoUserCreation`: Whether users who log in via HTTP SSO are created
  automatically by Artifactory.
- `allowUserToAccessProfile`: Whether users created automatically by HTTP SSO
  are allowed to access their profile page, generate API keys, etc.
- `remoteUserRequestVariable`: The name of the HTTP request variable to use to
  extract the user identity.

For example:

```
$ curl -u admin:password 'http://localhost:8081/artifactory/api/plugins/execute/getHttpSso'
{
    "httpSsoProxied": false,
    "noAutoUserCreation": false,
    "allowUserToAccessProfile": false,
    "remoteUserRequestVariable": "REMOTE_USER"
}
```

setHttpSso
----------

`setHttpSso` updates the current HTTP SSO configuration using the provided JSON
object. This object may have any combination of the fields listed above, and
only the provided fields will be updated in the configuration.

For example:

```
$ curl -u admin:password -X POST -H 'Content-Type: application/json' -d '{
> "httpSsoProxied": false,
> "noAutoUserCreation": true,
> "allowUserToAccessProfile": true,
> "remoteUserRequestVariable": "REMOTE_USER"
> }' 'http://localhost:8081/artifactory/api/plugins/execute/setHttpSso'
```

repository: jfrog/artifactory-user-plugins

gha_language: Groovy

repo_name: jfrog/artifactory-user-plugins


text:
---
title: Consuming applications through the Service Catalog
type: Details
---

To consume the external solutions, referred to as Remote Environments, register them in Kyma. As a result of registering the external solutions, ClusterServiceClasses are created in the Service Catalog.

### How an external solution is represented in the Service Catalog
This document presents the example referring to the Order API ClusterServiceClass. This class is registered in Kyma with a `targetUrl` pointing to `https://www.orders.com/v1/orders`. The response `id` during the registration is `01a702b8-e302-4e62-b678-8d361b627e49`.

As a result, the Remote Environment Broker, which provides ServiceClasses to the Service Catalog, contains the class with the following `id`:
```
re-{remote-environment-name}-gateway-{service-id}
```
The `{service-id}` is an identifier returned in the process of registration. The `{remote-environment-name}` is the name of the Remote Environment created in Kyma. It represents an instance of the external solution that owns the registered service. Such an `id` in the Service Broker is referred to as a `name` of the ClusterServiceClass in the Service Catalog.
Example `name`:
```
re-ec-default-gateway-01a702b8-e302-4e62-b678-8d361b627e49
```

### Service consumption

After provisioning the Order API in the environment using the Service Catalog, you can bind it to your application and consume it by calling the `url` provided during the binding operation.

The following example shows the Gateway `url` provided for your applications:
```
re-ec-default-gateway-01a702b8-e302-4e62-b678-8d361b627e49.kyma-integration/orders
```
The Gateway proxies all your requests to `https://www.orders.com/v1/orders`, in the case of the Order API example. You do not have to obtain the OAuth token in your application to access the API because the Gateway does it for you.

repository: Disper/kyma

repo_name: Disper/kyma


text:
Governance Committee Charter
============================

This document defines the charter of the Open Enclave Community Governance Committee.

----

When making decisions, the Community Governance Committee uses a "consensus
seeking" process. This means that most decisions should be reached by consensus,
but when that fails, the Committee calls for a vote where the super majority
(two-thirds) wins. This is to prevent obstructionism by removing the possibility
of a one person veto.

Quorum for Community Governance Committee meetings requires at least two-thirds
all members of the Community Governance Committee to be present. The
Community Governance Committee may continue to meet if quorum is not met but will
be prevented from making any decisions at the meeting.

All decisions by vote, whether during a meeting or otherwise, require a super majority
vote of all members of the Community Governance Committee.

The running minutes for the Community Governance Community meetings are located
at [aka.ms/openenclave/cgc](https://aka.ms/openenclave/cgc).

Committee Responsibilities
--------------------------

The primary responsibilities of this Committee are:

- to establish and ensure the health of SIGs and WGs in support of the overall project health
- to maintain membership of the Committee itself, adding or removing as defined in this charter
- to define the governance structures of the Open Enclave SDK project as a whole
- to assist in the resolution of disagreements between community organizations when necessary
- to support the community through handling any code of conduct incidents and reports
- to work with the mentor assigned by the Confidential Computing Consortium
(CCC) in tracking a [growth plan](growth-plan.md)
- to take the Linux Foundation course [Inclusive Open Source Community Orientation](https://training.linuxfoundation.org/training/inclusive-open-source-community-orientation-lfc102/) and help the community follow its principles

This Committee is not intended to make technical decisions, as those should
generally be made by agreement among contributors PRs are reviewed and merged,
and within the respective SIG and WG organizational structures.

Where disagreements take place and need further resolution, those can be brought
up with the Committee as part of its responsibility to maintain the project's
community health.

Regarding Codes of Conduct
--------------------------

In addition to granting rights, the Committee must also remove committer rights
and membership from those found to be violating the project's Code of Conduct or
otherwise negatively affecting the project's community health. It is duty of
each committee member to receive and address reported violations of the Code of
Conduct while maintaining the confidentiality of the reporter.

Meetings and Committee Obligations
----------------------------------

The Community Governance Committee should meet regularly, for example, once a
month. This meeting is a private meeting among just the Committee members to nominate
new committers and Committee members. Priority consideration should be given to
those actively contributing to the project. The Committee uses the consensus
seeking process outlined above when making decisions, including adding or
removing any members. The Committee should also discuss the community's health
and work to resolve any negative issues.

In order to maintain a healthy developer community, it is recommended that the
Committee also host a regular public community meeting. This meeting should be
open all members of the community, and start with an open forum to hear
questions or concerns from the community. Any remaining time in the meeting
should be used to discuss and review open pull requests or issues (especially
including design documents).

Committee Membership
--------------------

Process to join or leave committee TBD

Chair appointment process TBD

Committee member appointment period TBD

Optimal committee size TBD

repository: openenclave/openenclave

gha_language: C

repo_name: openenclave/openenclave


text:
# Laravel Migration Pipeline
A migration pipeline to make sure same migration is not run again in multiple server setup

## Version Support :

Works for Laravel version 5.3 and above.

## Introduction :

When you run `php artisan migrate` in laravel, it checks if there are any new migration files which are not yet migrated. If yes, then it runs each migration one by one and adds an entry into `migrations` table with migration name and batch number.

However, when you have multiple servers on autoscalling and have the CICD pipelines to automatically pull the latest releases of git webhooks, the post webhook script having `php artisan migrate` runs almost simultaneously on all those servers.

For example lets say, you have 3 laravel servers running. When you push latest releases to git, git webhook triggers the CICD pipeline and then all servers receive  the webhooks almost at the same time.

All these 3 servers will run webhook scripts, which will have git pull and then php artisan commands. One of which will be `php artisan migrate`. If you have 3 new migrations in the release, all these 3 will be attempted to run with different(mostly consecutive) batch numbers.

We want to avoid that. If a migration is already run on the 1st server out of 3, we do not want 2nd and 3rd server to re-run it. This is when this package comes into picture.

In any given situation, if a migration is running on one server or already run ina different batch number, it will not run again. This will avoid the above problem.

## Installation :

To install the package using composer :

~~~bash
composer require techsemicolon/gitdeployer
~~~

Once installed, you can add service provider in `config/app.php` file for laravel version <= 5.4. For later versions the service provider will be automatically included.
~~~php
Techsemicolon\MigrationPipeline\ServiceProvider::class,
~~~

## Example :

Following screenshot gives you an idea where both the servers are running `php artisan migrate` at the same time. However, the right server ran migration_1 hence, left server skipped that and ran the remaining ones.

Also, once the migration_1 was ran by right server, migration_2, migration_3 and migration_4 were skipped because those were already run by the left server.

## Note :

This package assumes/requires that you give unique names to your migrations. By default each migration in laravel is unique if you use `php artisan make:migration some_table_migration` where laravel adds timestamp at the start of migration file name. But in case you are removing that timestamp, make sure you have something in the migration file name which marks it as unique.

## License :

This package is open-sourced software licensed under the MIT license


text:
# Deprecated features

If you feel a "public" feature(API) is not needed anymore, mark it as deprecated before you can completely remove it from the engine.

Don't take anything for granted: do not suppose that the features should not have been used by users. The publics is public once it was public. The publics for example are module exports, public class members, fields of public interfaces.

## Things you should do

You should take the following rules to mark a feature as deprecated.

### JsDoc

Mark the API as deprecated using JsDoc:

```ts
/**
 * @deprecated Reason or detail.
 */
export function f () {}
```

Illustrate the version you deprecate it. An explanation couldn't be better.

### Put it in an isolated module

When building the engine, users may be allowed to remove a version range of deprecated features. Below is the common practice.

Put a serials of deprecated features, with same deprecating date, in a module file with stem name as `deprecated-${version}`, the `version` is the version since where you deprecate them. `version` shall be a valid **semver version**. For example `1.2.0` instead of `1.2`. If the version is in the specific range, the module will be removed.

You may also simplify the stem name as `deprecated`.
In such cases, the module is removed regardless of the user specified range. But it's strongly not recommended.

Such a name convention is applied to all module files of engine.
The regular module file names should not starts with a `deprecated` or `deprecated-` prefix.

The "removal" is implemented as if each of the module is replaced as an empty module: `export {};`. Due to this,
you shall not do named import/export from deprecated modules
in modules that would be included in the building. For example, the following is not permitted:

```ts
export { Deprecated } from './deprecated-1.2.0';
```

In most cases, the named import/export is not required. If it does, simply constructs an also-deprecated module and export it:

```ts
// Module select-deprecated-1.2.0
export { Deprecated } from './deprecated-1.2.0';
```

and the importing module:

```ts
export * from './select-deprecated-1.2.0';
```

### More Reference
[How to deprecate an API](./deprecated-api.md)

repository: shrinktofit/engine

branch_name: refs/heads/develop

gha_license_id: NOASSERTION

repo_name: shrinktofit/engine


text:
# Data structures

A **data structure** is a **collection of values**. The values can be related to each other in various ways, and they can have functions applied to them.

Different types of data structures are optimized for various purposes. Usually we can put things in data structures and we can take things out of them.

# Algorithms

An **algorithm** are the collection of steps (or processes) we put into place in order to manipulate data structures.

# Programs

**Data structures** and **algorithms**, when put together, create **programs**. A program is a collection of data structures with algorithms applied to them in order to achieve a desired result.

# CPU, RAM and Storage

Variables are stored in RAM. That's how programs run. Data on storage is permanent (persistent), but access is slow. The CPU can access RAM much faster when performing operations.

A computer can only store a certain amount of information. RAM consists of **addresses** that hold bits (8 bits each, totalling to a byte). Each **random address** in memory can be accessed, but the **memory controller** can read addresses which are close to each other **faster**.

**Cache** is a tiny memory space in the CPU that holds a copy of information we've accessed before.

So let's get back to data structures. They are, once again, basically **a way to store information**. Each data type has a number of bits associated with it, that needs to be stored in the system. The system allocates that storage, and the CPU reads from it. A data structure is an arrangement of data in RAM that can be interacted with in a certain way. Some structures are arranged next to each other, and some are spread apart, and they all have pros and cons on read and write access. When choosing the write data structure, the goal is to **minimize the number of operations** we need to perform in order for the CPU to access the information we care about.

# Operations
Some of the most common operations performed on data structures are:
* Insertion
* Deletion
* Traversal (access each data item exactly once for processing)
* Searching
* Sorting
* Access

# DSA key examples
Some of the most important **data structures** include:
* Arrays
* Stacks
* Queues
* Linked Lists
* Trees
* Tries
* Graphs
* Hash Tables

Some of the key **algorithms** are:
* Sorting
* Dynamic Programming
* BFS/DFS (Searching)
* Recursion


text:
Screenshots:
------------

### using surf with classic proxy against 3 test sites.

![Proof-of-Concept using surf with classic proxy against 3 test sites.](screenshot-classic.png)

### using surf against 3 test sites.

![Proof-of-Concept using surf against 3 test sites.](screenshot-browser.png)

### using the new proxy against the same site twice.

Interestingly, i2p only sends the X-I2p-Dest* headers the first time a
destination visits another destination.

![Proof-of-Concept using the new proxy against the same site twice.](screenshot-browser-samesite.png)

### using Firefox against test site 1.

![Proof-of-Concept using Firefox against test site 1.](screenshot-firefox-1.png)

### using Firefox against test site 2.

![Proof-of-Concept using Firefox against test site 2.](screenshot-firefox-2.png)

### using Firefox against test site 3.

![Proof-of-Concept using Firefox against test site 3.](screenshot-firefox-3.png)

### using multiple visits to all test sites.

![Proof-of-Concept using multiple visits to all test sites.](screenshot-multivisit.png)

### screenshot of it in development, with the pipes.

![Proof-of-Concept screenshot of it in development, with the pipes.](screenshot-pipes.png)


text:
+++
author = "Christopher Hunt"
authortwitter = "https://twitter.com/logicaldiagram"
category = ["Blog"]
comments = true
date = "2014-04-10T16:31:27-04:00"
sharing = true
tags = ["tools", "powershell", ".net"]
title = "Humanize your scripts"
slug = "humanize-your-scripts"
+++

This is a quick example of some of the stuff you can do with [Humanizer](http://humanizr.net/) to make your script's output a bit more user friendly.

### Strings from numbers.

    PS C:\temp> [Humanizer.NumberToWordsExtension]::ToWords(2)
    two

    PS C:\temp> [Humanizer.NumberToWordsExtension]::ToWords(253)
    two hundred and fifty-three

    PS C:\temp> [Humanizer.ToQuantityExtensions]::ToQuantity("box", 4)
    4 boxes

<!--more-->
### New up a TimeSpan object.

    PS C:\temp> [Humanizer.NumberToTimeSpanExtensions]::Weeks(2)

    Days              : 14
    Hours             : 0
    Minutes           : 0
    Seconds           : 0
    Milliseconds      : 0
    Ticks             :<PHONE_NUMBER>0000
    TotalDays         : 14
    TotalHours        : 336
    TotalMinutes      : 20160
    TotalSeconds      : 1209600
    TotalMilliseconds :<PHONE_NUMBER>

### Remove underscores.

    PS C:\temp> [Humanizer.StringHumanizeExtensions]::Humanize("Underscored_input_String_is_turned_INTO_sentence")
    Underscored input String is turned INTO sentence

### Truncation

    PS C:\temp> [Humanizer.Truncator]::Truncate("Long text to truncate", 10)
    Long text…

### Turn TimeSpan objects into human readable values.

    PS C:\temp> $past = get-date

    PS C:\temp> $later = Get-Date

    PS C:\temp> [Humanizer.TimeSpanHumanizeExtensions]::Humanize( $later - $past)
    11 seconds

    PS C:\temp> dir | select -First 5 @{l="File last modified";e={[Humanizer.DateHumanizeExtensions]::Humanize($_.LastWriteTime)}}

    File last modified
    ------------------
    7 months ago
    7 months ago
    7 months ago
    7 months ago
    one year ago

### A bunch of way to get a specific DateTime without date maths.

    PS C:\temp> [Humanizer.In+Five]::Months

    Wednesday, September 10, 2014 7:37:55 PM

    PS C:\temp> [Humanizer.In+Five]::Years

    Wednesday, April 10, 2019 7:49:23 PM

    PS C:\temp> [Humanizer.In]::MayOf(2015)

    Friday, May 01, 2015 12:00:00 AM

    PS C:\temp> [Humanizer.In]::April

    Tuesday, April 01, 2014 12:00:00 AM

    PS C:\temp> [Humanizer.In+Two]::MonthsFrom([Humanizer.On+April]::The10th)

    Tuesday, June 10, 2014 12:00:00 AM

### Even support for Roman Numeral generation.

    PS C:\temp> [Humanizer.RomanNumeralExtensions]::ToRoman(2014)
    MMXIV

Update: Check out the [follow-up](/blog/2014/04/11/humanize-follow-up/) on how to make this easier to work with.

repository: cdhunt/automatedops

repo_name: cdhunt/automatedops


text:
#MoltenVK Demo Projects

Copyright (c) 2014-2018 [The Brenwill Workshop Ltd.](http://www.brenwill.com)

*This document is written in [Markdown](http://en.wikipedia.org/wiki/Markdown) format.
For best results, use a Markdown reader.*

Table of Contents
-----------------

- [Introduction](#intro)
- [LunarG Vulkan Samples](#lunarg-vulkan-samples)
	- [Installing the LunarG `VulkanSamples` Library](#lunarg-vulkan-samples-install)
	- [*Demos*](#lunarg-vulkan-samples-demos)
	- [*API-Samples*](#lunarg-vulkan-samples-api)
	- [*Hologram*](#lunarg-vulkan-samples-hologram)
- [Khronos Vulkan Samples](#khronos-vulkan-samples)
	- [Installing the Khronos `Vulkan-Samples` Library](#khronos-vulkan-samples-install)
	- [*AsynchronousTimeWarp*](#khronos-vulkan-samples-atw)
- [Sascha Willems Vulkan Samples](#sascha-willems-vulkan-samples)
	- [Installing the *Sascha Willems* Library](#sascha-willems-install)
- [Cinder Vulkan Samples](#cinder-vulkan-samples)
	- [Installing the *Cinder* Library](#cinder-install)
	- [*Fish Tornado*](#cinder-vulkan-samples-fish-tornado)

Introduction
------------

The *Xcode* projects in this folder are a set of demo applications that demonstrate
how to integrate *Vulkan* into an *Xcode* project, and demonstrate the features and
capabilities of *Vulkan* when using using **MoltenVK** on the *iOS* and *macOS* platforms.

Although the demo projects are provided with this `MoltenVK` distribution,
the source code and resources for the demo applications come from publicly-available
open-source repositories. Follow the instructions for each section below to learn
how to download the demo application source code and resources for each set of
demo applications.

To review and run all of the available demo apps, open the `Demos.xcworkspace`
*Xcode* workspace in *Xcode*.

LunarG Vulkan Samples
---------------------

[LunarG](https://lunarg.com), who have been involved in *Vulkan* development from the
beginning, and are one of the original developers of *Vulkan* tools and SDK's, provides
a suite of demo apps, that demonstrate a wide range of basic *Vulkan* features.

These demo apps can be found in the `LunarG-VulkanSamples` folder of this `Demos`
folder, and in the `LunarG-VulkanSamples` group in the *Xcode Project Navigator*
in the `Demos.xcworkspace` *Xcode* workspace.

These **MoltenVK** demos use a modified version of the *LunarG Vulkan Samples*, that allows
the demo apps to run under *iOS* and *macOS*. To download these modified *LunarG Vulkan Samples*,
and link them to the demo *Xcode* projects in this `MoltenVK` distribution, follow the instructions
in the [Installing the LunarG `VulkanSamples` Library](#lunarg-vulkan-samples-install) section next.

###Installing the LunarG *VulkanSamples* Library

To run the *LunarG Vulkan Samples* demo apps, **MoltenVK** uses a modified version of the
*LunarG* `VulkanSamples` library. To install this modified *LunarG* `VulkanSamples` library,
open a *Terminal* session and perform the following command-line steps:

1. In a folder outside this `MoltenVK` distribution, clone the modified `VulkanSamples` repo:

		git clone https://github.com/brenwill/VulkanSamples.git

2. In the `MoltenVK/Demos/LunarG-VulkanSamples` folder, replace the `VulkanSamples` symlink as follows:

		ln -sfn path-to-VulkanSamples-repo-folder VulkanSamples

3. Run the `MoltenVKShaderConverter` tool to convert the *GLSL* shaders in the `VulkanSamples`
   library to *SPIR-V*:

		cd path-to-MoltenVK-package
		MoltenVKShaderConverter/Tools/MoltenVKShaderConverter -gi -so -xs "-" -d Demos/LunarG-VulkanSamples/VulkanSamples/demos

###LunarG Vulkan Samples: *Demos*

This demo is a simple renderings that originally were included in the *Vulkan* SDK.

The demo can be found in the `MoltenVK/Demos/LunarG-VulkanSamples/Demos` folder,
and in the `LunarG-VulkanSamples/Demos` group in the *Xcode Project Navigator*
in the `Demos.xcworkspace` *Xcode* workspace.

####Cube

A basic textured cube that spins in place.

To run this demo, run either the `Cube-iOS` or `Cube-macOS` *Scheme* from within *Xcode*.

This demo is a simple example of installing **MoltenVK** as a dynamic library, instead of as
a statically-linked framework. In this demo, the **MoltenVK** dynamic library is embedded in
the application, but it could have been installed as a system library instead.

###LunarG Vulkan Samples: *API-Samples*

This *Xcode* project actually contains a large number of modular demos, with each demo
demonstrating a particular *Vulkan* feature, or suite of calls.

> **Note:** For simplicity, the `API-Samples` demos are bare-bones. Each of the `API-Samples`
> demos renders a single frame during app startup, and then leaves the rendered image static.
> There is no display loop or motion in any of these demos.
> **This is normal for these demos, and the demo has not "hung" or "crashed" when this occurs.**

This demo can be found in the `MoltenVK/Demos/LunarG-VulkanSamples/API-Samples` folder,
and in the `LunarG-VulkanSamples/API-Samples` group in the *Xcode Project Navigator* in
the `Demos.xcworkspace` *Xcode* workspace.

To run this demo, run either the `API-Samples-iOS` or `API-Samples-macOS` *Scheme* from within *Xcode*.

To specify which of the many modular demos to run, open the `Samples.h` in the `API-Samples`
project in the *Xcode Project Navigator* in the `Demos.xcworkspace` *Xcode* workspace, and
follow the instructions in the comments within that file.

To see descriptions and screenshots of each of the demos, open
[this summary document](LunarG-VulkanSamples/VulkanSamples/samples_index.html#AdditionalVulkan),
after you have [installed](#lunarg-vulkan-samples-install) the `LunarG Vulkan Samples` repository.

###LunarG Vulkan Samples: *Hologram*

> **Note:** In order to build the `Hologram` demo, you must have *Python3* installed
> on your build computer.

This is a sophisticated particle demo that populates command buffers from multiple threads.

This demo can be found in the `MoltenVK/Demos/LunarG-VulkanSamples/Hologram` folder, and in the
`LunarG-VulkanSamples/Hologram` group in the *Xcode Project Navigator* in the `Demos.xcworkspace`
*Xcode* workspace.

To run this demo, run either the `Hologram-iOS` or `Hologram-macOS` *Scheme* from within *Xcode*.

On *macOS*, once the demo is open, you can use the *Up-arrow* and *Down-arrow* keys on the
keyboard to zoom the camera in and out of the scene. Zooming out will show more items on screen.

The demo allows some customization, by modifying the arguments passed to the demo at startup.
To customize, modify the arguments created in the `DemoViewController viewDidLoad` method
found in the `iOS/DemoViewController.mm` or `macOS/DemoViewController.mm` file.

This demo illustrates the use of the **MoltenVK** API `vkGetMoltenVKDeviceConfigurationMVK()`
and `vkSetMoltenVKDeviceConfigurationMVK()` functions to enable **MoltenVK** debugging, including
logging the conversion of shaders from *SPIR-V* to *Metal Shading Language*. See the use of these
functions in the `Hologram/Hologram.cpp` file. To see the effect, modify the `Hologram-iOS` or
`Hologram-macOS` *Scheme* from within *Xcode* to use the **Debug** *Build Configuration* setting.

Khronos Vulkan Samples
----------------------

[Khronos](https://khronos.org), the standards organization that developed *Vulkan* provides
a suite of demo apps, that demonstrate a range of sophisticated *Vulkan* features.

These demo apps can be found in the `Khronos-Vulkan-Samples` folder of this `Demos`
folder, and in the `Khronos-Vulkan-Samples` group in the *Xcode Project Navigator*
in the `Demos.xcworkspace` *Xcode* workspace.

These **MoltenVK** demos use a modified version of the *Khronos Vulkan Samples*, that allows
the demo apps to run under *iOS* and *macOS*. To download these modified *Khronos Vulkan Samples*,
and link them to the demo *Xcode* projects in this `MoltenVK` distribution, follow the instructions
in the [Installing the Khronos `Vulkan-Samples` Library](#khronos-vulkan-samples-install) section next.

###Installing the Khronos `Vulkan-Samples` Library

To run the *Khronos Vulkan Samples* demo apps, **MoltenVK** uses a modified version of the
*Khronos* `Vulkan-Samples` library. To install this modified *Khronos* `Vulkan-Samples` library,
open a *Terminal* session and perform the following command-line steps:

1. In a folder outside this `MoltenVK` distribution, clone the modified `Vulkan-Samples` repo:

		git clone https://github.com/brenwill/Vulkan-Samples.git

2. In the `MoltenVK/Demos/Khronos-Vulkan-Samples` folder, replace the `Vulkan-Samples` symlink as follows:

		ln -sfn path-to-Vulkan-Samples-repo-folder Vulkan-Samples

###Khronos Vulkan Samples: *AsynchronousTimeWarp*

This demo was contributed by *Oculus VR, LLC*, and demonstrates a variety of critical tests for
evaluating accurate synchronization between the two scene images in a virtual reality headset.

This demo can be found in the `MoltenVK/Demos/Khronos-Vulkan-Samples/AsynchronousTimeWarp` folder,
and in the `Khronos-Vulkan-Samples/AsynchronousTimeWarp` group in the *Xcode Project Navigator*
in the `Demos.xcworkspace` *Xcode* workspace.

You can make a large number of configuration changes to this demo, to increase or decrease the
rendering and computational load of the scene. You can set these configuration values by passing
command-line arguments to the demo at start-up. You pass these command-line arguments by setting
them in the `Arguments` tab of the `AsynchronousTimeWarp-VK-iOS` or `AsynchronousTimeWarp-VK-macOS`
*Xcode* schemes.

For example, the following command-line arguments can be used to set the scene complexity:

- `-q [0-3]`  :  controls whether a minimal, small, medium, or large quantity of objects
                 will be rendered.
- `-w [0-3]`  :  controls whether each object will be rendered with a minimal, small,
                 medium, or large quantity of triangles.
- `-e [0-3]`  :  controls whether a minimal, small, medium, or large number of lights
                 will be used to illuminate the scene.

On *macOS*, once the demo is open, you can also tap the `Q`, `W`, or `E` keys on the keyboard
to cycle each of these same configuration parameters through their range of possible values.

For the full instructions for this demo, including a list and explanation of all of
the configuration options, read the notes at the top of the `atw/atw_vulkan.c` file.

This demo illustrates the use of the **MoltenVK** API `vkGetMoltenVKDeviceConfigurationMVK()`
and `vkSetMoltenVKDeviceConfigurationMVK()` functions to enable performance tracking and logging,
and to enable **MoltenVK** debugging, including logging the conversion of shaders from *SPIR-V*
to *Metal Shading Language*. See the use of these functions in the `atw/atw_vulkan.c` file.
To see the effect of shader conversion logging, modify the `AsynchronousTimeWarp-VK-iOS` or
`AsynchronousTimeWarp-VK-macOS` *Scheme* from within *Xcode* to use the
**Debug** *Build Configuration* setting.

Sascha Willems Vulkan Samples
-----------------------------

[*Sascha Willems*](https://github.com/brenwill/Vulkan) provides an open-source library containing
a large number of sophisticated *Vulkan* examples. The library contains support for running these
examples on *iOS* and *macOS* in *Xcode*, using **MoltenVK**.

###Installing the *Sascha Willems* Library

To install the *Sascha Willems Vulkan* samples, open a *Terminal* session and perform
the following command-line steps:

1. In a folder outside this `MoltenVK` distribution, clone the modified *Sascha Willems* `Vulkan` repo:

		git clone https://github.com/brenwill/Vulkan.git

2. Follow the instructions in the `Vulkan\xcode\README_MoltenVK_Examples.md` document
   within the *Sascha Willems* `Vulkan` repository.

Cinder Vulkan Samples
---------------------

[*Cinder*](https://libcinder.org) is a cross-platform 3D graphics engine built in C++.
*Cinder* supports *Vulkan*, and includes several *Vulkan* demos.

These demo apps are included as part of the *Cinder* code repository.

These **MoltenVK** demos use a modified version of *Cinder*, that allows *Vulkan* to run under
*iOS* and *macOS*. To download the modified version of *Cinder*, and link it to **MoltenVK**,
follow the instructions in the [Installing the `Cinder` Library](#cinder-vulkan-samples-install)
section next.

###Installing the *Cinder* Library

To run the *Cinder Vulkan Samples* demo apps, **MoltenVK** uses a modified version of the
*Cinder* library. To install this modified *Cinder* library, and link it to **MoltenVK**,
open a *Terminal* session and perform the following command-line steps:

1. In a folder outside this `MoltenVK` distribution, clone the modified `Cinder` repo,
   including required submodules:

		git clone --recursive https://github.com/brenwill/Cinder.git

2. Build the core *Cinder* library:

		Cinder/xcode/fullbuild.sh

3. By default, the *Cinder Vulkan* samples expect **MoltenVK** to be installed in a directory
   beside the `Cinder` repository:

		Cinder/
   		MoltenVK/

    If you have installed **MoltenVK** somewhere else, you can redirect the *Cinder Vulkan*
    samples to the location of your **MoltenVK** installation as follows:

		cd Cinder/samples/_vulkan_explicit
		ln -sfn path-to-the-MoltenVK-distribution/MoltenVK

###Cinder Vulkan Samples: *Fish Tornado*

This is a sophisticated simulation of a *Fish Tornado*, a swirling school of thousands of fish.

This demo can be found in the `samples/_vulkan_explicit/FishTornado` folder of the *Cinder* repository.
To build and run this demo for either *iOS* or *macOS*, open the `xcode-ios/FishTornado.xcodeproj`
or `xcode/FishTornado.xcodeproj` *Xcode* project, respectively.

repository: ePirat/MoltenVK

repo_name: ePirat/MoltenVK


text:
## Parameters

`command_queue`
Must be a valid host command-queue.

`memobj`
A valid memory (buffer or image) object. The OpenCL context associated
with `command_queue` and `memobj` must be the same.

`mapped_ptr`
The host address returned by a previous call to
[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) or
[`clEnqueueMapImage`](clEnqueueMapImage.html) for `memobj`.

`event_wait_list ,` `num_events_in_wait_list`
Specify events that need to complete before `clEnqueueUnmapMemObject`
can be executed. If `event_wait_list` is NULL, then
`clEnqueueUnmapMemObject` does not wait on any event to complete. If
`event_wait_list` is NULL, `num_events_in_wait_list` must be 0. If
`event_wait_list` is not NULL, the list of events pointed to by
`event_wait_list` must be valid and `num_events_in_wait_list` must be
greater than 0. The events specified in `event_wait_list` act as
synchronization points. The context associated with events in
`event_wait_list` and `command_queue` must be the same. The memory
associated with `event_wait_list` can be reused or freed after the
function returns.

`event`
Returns an event object that identifies this particular copy command and
can be used to query or queue a wait for this particular command to
complete. `event` can be NULL in which case it will not be possible for
the application to query the status of this command or queue a wait for
this command to complete.
[`clEnqueueBarrierWithWaitList`](clEnqueueBarrierWithWaitList.html) can
be used instead. If the `event_wait_list` and the `event` arguments are
not NULL, the `event` argument should not refer to an element of the
`event_wait_list` array.

## Notes

Reads or writes from the host using the pointer returned by
[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) or
[`clEnqueueMapImage`](clEnqueueMapImage.html) are considered to be
complete.

[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) and
[`clEnqueueMapImage`](clEnqueueMapImage.html) increment the mapped count
of the memory object. The initial mapped count value of a memory object
is zero. Multiple calls to
[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) or
[`clEnqueueMapImage`](clEnqueueMapImage.html) on the same memory object
will increment this mapped count by appropriate number of calls.
`clEnqueueUnmapMemObject` decrements the mapped count of the memory
object.

[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) and
[`clEnqueueMapImage`](clEnqueueMapImage.html) act as synchronization
points for a region of the buffer object being mapped.

Accessing mapped regions of a memory object

This section describes the behavior of OpenCL commands that access
mapped regions of a memory object.

The contents of the region of a memory object and associated memory
objects (sub-buffer objects or 1D image buffer objects that overlap this
region) mapped for writing (i.e. `CL_MAP_WRITE` or
`CL_MAP_WRITE_INVALIDATE_REGION` is set in `map_flags` argument to
[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) or
[`clEnqueueMapImage`](clEnqueueMapImage.html)) are considered to be
undefined until this region is unmapped.

Multiple commands in command-queues can map a region or overlapping
regions of a memory object and associated memory objects (sub-buffer
objects or 1D image buffer objects that overlap this region) for reading
(i.e. `map_flags` = `CL_MAP_READ`). The contents of the regions of a
memory object mapped for reading can also be read by kernels and other
OpenCL commands (such as
[`clEnqueueCopyBuffer`](clEnqueueCopyBuffer.html)) executing on a
device(s).

Mapping (and unmapping) overlapped regions in a memory object and/or
associated memory objects (sub-buffer objects or 1D image buffer objects
that overlap this region) for writing is an error and will result in
`CL_INVALID_OPERATION` error returned by
[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) or
[`clEnqueueMapImage`](clEnqueueMapImage.html).

If a memory object is currently mapped for writing, the application must
ensure that the memory object is unmapped before any enqueued kernels or
commands that read from or write to this memory object or any of its
associated memory objects (sub-buffer or 1D image buffer objects) or its
parent object (if the memory object is a sub-buffer or 1D image buffer
object) begin execution; otherwise the behavior is undefined.

If a memory object is currently mapped for reading, the application must
ensure that the memory object is unmapped before any enqueued kernels or
commands that write to this memory object or any of its associated
memory objects (sub-buffer or 1D image buffer objects) or its parent
object (if the memory object is a sub-buffer or 1D image buffer object)
begin execution; otherwise the behavior is undefined.

A memory object is considered as mapped if there are one or more active
mappings for the memory object irrespective of whether the mapped
regions span the entire memory object.

Accessing the contents of the memory region referred to by the mapped
pointer that has been unmapped is undefined.

The mapped pointer returned by
[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) or
[`clEnqueueMapImage`](clEnqueueMapImage.html) can be used as `ptr`
argument value to [`clEnqueueReadBuffer`](clEnqueueReadBuffer.html),
[`clEnqueueWriteBuffer`](clEnqueueWriteBuffer.html),
[`clEnqueueReadBufferRect`](clEnqueueReadBufferRect.html),
[`clEnqueueWriteBufferRect`](clEnqueueWriteBufferRect.html),
[`clEnqueueReadImage`](clEnqueueReadImage.html), and
[`clEnqueueWriteImage`](clEnqueueWriteImage.html), provided the rules
described above are adhered to.

## Errors

`clEnqueueUnmapMemObject` returns `CL_SUCCESS` if the function is
executed successfully. Otherwise, it returns one of the following
errors:.

-   `CL_INVALID_COMMAND_QUEUE` if `command_queue` is not a valid host
    command-queue.

-   `CL_INVALID_MEM_OBJECT` if `memobj` is not a valid memory object or
    is a pipe object.

-   `CL_INVALID_VALUE` if `mapped_ptr` is not a valid pointer returned
    by [`clEnqueueMapBuffer`](clEnqueueMapBuffer.html) or
    [`clEnqueueMapImage`](clEnqueueMapImage.html) for `memobj`.

-   `CL_INVALID_EVENT_WAIT_LIST` if `event_wait_list` is NULL and
    `num_events_in_wait_list` > 0, or `event_wait_list` is not NULL and
    `num_events_in_wait_list` is 0, or if event objects in
    `event_wait_list` are not valid events.

-   `CL_OUT_OF_RESOURCES` if there is a failure to allocate resources
    required by the OpenCL implementation on the device.

-   `CL_OUT_OF_HOST_MEMORY` if there is a failure to allocate resources
    required by the OpenCL implementation on the host.

-   `CL_INVALID_CONTEXT` if the context associated with `command_queue`
    and `memobj` are not the same or if the context associated with
    `command_queue` and events in `event_wait_list` are not the same.

## Also see

[`clEnqueueMapBuffer`](clEnqueueMapBuffer.html),
[`clEnqueueMapImage`](clEnqueueMapImage.html)

## Specification

[OpenCL 2.1 API Specification, page
165](https://www.khronos.org/registry/cl/specs/opencl-2.1.pdf#page=165)

## Copyright

[Copyright © 2007-2017 The Khronos Group Inc.](copyright.html)

repository: Galarius/vscode-opencl

gha_language: TypeScript

repo_name: Galarius/vscode-opencl


text:
# ETH_ColdBrainWallet
Ethereum client side brain wallet that can be inferred on demand from several input parameters with transaction signing. Fully offline.

These is also standalone version where all js libraries are embedded into single html. This could be more convinient when transferring and using at different devices. It could be used on an old smartphone with no internet access for an example.

You can try it [online](https://amchercashin.github.io/ETH_ColdBrainWallet/ColdBrainWallet-standalone.html), but for real personal use you should download it from [github repo](https://github.com/amchercashin/ETH_ColdBrainWallet/) and put on a offline device.

## Goal
Find a sweet spot between safety from theft, safety from loss and ease of use.

## Functionality
### Offline Ethereum wallet (private key and address) generation as a function of 3 parameters (inspired by [original idea and code by Vitalik](https://www.reddit.com/r/ethereum/comments/535ovp/is_there_a_javascript_library_for_generating/d7q8hq7/?st=j7gaygm8&sh=435756ff)):
  1. Hardness: integer value from [1000, 3000] range. This (with the function iteslf) ensures to take some coputational effort to get a key. Thus making it more time consuming to brute-force.
  2. Email. To protect from batch key picking attack, where keys generated for every popular password or phrase, then check for positive balance.
  3. Secret phrase. Actually a password. Should be long enough, not a actual meaningfull phrase in any language, not a "popular" password and not used anywhere else.

     Function [keccak_256](https://en.wikipedia.org/wiki/SHA-3) implemented as recursive (but not a standardised SHA-3 version, but one that used inside Ethereum):

     Step_(1) = keccak_256[ hardness * ( email + phrase ) ]

     Step_(hardness) = keccak_256[ hardness * Step_(hardness-1) ],

     Where "+", "*" are string operations: concatenation and string multiplication.

     So in first step we concatenate _email_ and _phrase_, then concatenating this string with iteslf _hardness_ times to get one very long string. Then feed this string to keccak_256, which returns a hash: string of 64 hex characters always, despite the input.

     Every next step we take the result from previous step (string of 64 hex chars, without leading "0x"), concatenate it with iteslf _hardness_ times again, and then feed again to keccak_256. Repeat this _hardness_ times.

     Total steps = _hardness_ parameter.

     It takes form 10s on my laptop to 1.5 minutes on a smartphone to get keypair or sign transaction.

### Get address from any private key
Simply, infer Ethereum address from private key you can provide. Usefull if you have your own way to generate private key.

### Sign offline transaction
This can be done with key, generated on the fly again with hardness, email, and secret phrase parameters. Or with raw private key instead.

Generated transaction code contains no private information and could be safly posted everywhere (if you are going to actually make it, surely). To _make_ a transaction you should broadcast this code to the blockchain (use MyEtherWallet.com or etherscain.io servoces for an example).

## Dependencies:
1. Browserifyed [ethereumjs-tx](https://github.com/ethereumjs/ethereumjs-tx) v1.3.3 for general Ethereum / crypto functions.
2. [QRCode.js](https://github.com/davidshimjs/qrcodejs) for QR Codes.


text:
---
outputFileName: index.html
---

# Optimistic Concurrency & Idempotence

Writing supports an optimistic concurrency check on the version of the stream to which events are written. The method of specifying what the expected version is depends whether you are making writes using the HTTP or Event Store Client API.

The Event Store Client API has constants which you can use to represent certain conditions:

| Parameter                        | Description                                                                                |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ExpectedVersion::ANY`           | Disables the optimistic concurrency check.                                                                                |
| `ExpectedVersion::NO_STREAM`     | Specifies the expectation that target stream does not yet exist.                                                                                |
| `ExpectedVersion::EMPTY_STREAM`  | Specifies the expectation that the target stream has been explicitly created, but does not yet have any user events written in it.                         |
| `ExpectedVersion::STREAM_EXISTS` | Specifies the expectation that the target stream or its metadata stream has been created, but does not expect the stream to be at a specific event number. |
| `Any other integer value`        | The event number that you expect the stream to currently be at.                                                                                |

If the optimistic concurrency check fails during writing, a `WrongExpectedVersionException` is thrown.

## Idempotence

If identical write operations occur, Event Store treats them in a way which makes it idempotent. If a write is treated in this manner, Event Store acknowledges it as successful, but duplicate events are not written. The idempotence check is based on the `EventId` and `stream`. It is possible to reuse an `EventId` across streams whilst maintaining idempotence.

The level of idempotence guarantee depends on whether the optimistic concurrency check is not disabled during writing (by passing `ExpectedVersion.Any` as the `expectedVersion` for the write).

### If you specify an expected version

The specified `expectedVersion` is compared to the `currentVersion` of the stream. This will yield one of three results:

-   **`expectedVersion > currentVersion`** - a `WrongExpectedVersionException` is thrown.

-   **`expectedVersion == currentVersion`** - events are written and acknowledged.

-   **`expectedVersion < currentVersion`** - the `EventId` of each event in the stream starting from `expectedVersion` are compared to those in the write operation. This can yield one of three further results:

    -   **All events have been committed already** - the write is acknowledged as successful, but no duplicate events written.

    -   **None of the events were previously committed** - a `WrongExpectedVersionException` is thrown.

    -   **Some of the events were previously committed** - this is considered a bad request. If the write contains the same events as a previous request, either all or none of the events should have been previously committed. This surfaces as a `WrongExpectedVersionException`.

### If you specify `ExpectedVersion::ANY`

> [!NOTE]
> Idempotence is **not** guaranteed if you use `ExpectedVersion::ANY`. The chance of a duplicate event is small, but is possible.

The idempotence check will yield one of three results:

-   **All events have been committed already** - the write is acknowledged as successful, but no duplicate events written.

-   **None of the events were previously committed** - the events are written and the write acknowledged.

-   **Some of the events were previously committed** - this is considered a bad request. If the write contains the same events as a previous request, either all or none of the events should have been previously committed. This currently surfaces as a `WrongExpectedVersionException`.

repository: prooph/documentation

gha_language: CSS

repo_name: prooph/documentation


text:
# new-rn-camera

Hi! This was just a fun and challenging task. I didn't have much experience with native _UI_ components before this, and the camera is such a huge part of so many mobile apps, I thought it was worth just putting together a quick native module to get a sense of the native platform APIs.

 [Skip to here](#installation--setup).

### Goals & scope

- Zoom control with a pinch gesture ✅
- Zoom control with a toggle ✅
- Auto-focus/exposure control with touch coordinates ✅
- Toggle for the front/back camera ✅
- Toggle for the flashlight ✅

Some personal goals:

- Use Android CameraX
  - Some of the complications here were that most of Google's own examples were using their now deprecated Camera module
- Minimize code and maximize readability
- Use Kotlin
- Use no deprecated classes or methods on iOS (no sidebar warnings when building)

### Limitations and challenges

- Had quite a bit of trouble getting started with CameraX on Android
  - I like to work by getting _something_ functioning (first achieve a displayed Camera preview), and then organizing and moving forward from there. That preview took longer than I expected due to a React Native bug: https://github.com/facebook/react-native/issues/17968. After adding that, "poof" it worked.
  - CameraX API is pretty great once you're set up 👍
- Android permissions take a lot more code to set up than iOS. Put together a scrap implementation for development, then realized that relying directly on React Native's AndroidPermissions API was much more suitable for now. Doesn't look like it's worth building out a custom implementation.
  - For reference, iOS permissions took ~20 lines of code. One direct method
- Not a fully thought out story once you have the image because I'm not sure if it's an image we want to save to an album specifically in the app, or save to the user's media library directly

### Future work

- Crop module
- Refine zoom factors
- Add support for negative zoom for compatible devices
- Gain a better understanding of Android camera apps & how users prefer them to work
- Built in Animated support for zooming? (that's also overrideable)
- More file output options?

## Installation & setup

```sh
yarn add new-rn-camera // This module isn't available on npm yet, you'll have to install it from source
npx pod-install
```

### Android

Android requires some additional permissions declared in your `AndroidManifest.xml` file:

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="your.package.name">
          ...
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```

### iOS

iOS requires some additional permissions declared in your `info.plist` file:

```xml
<key>NSCameraUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to use the camera</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to use the microphone</string>
```

## Usage

```js
import { Camera } from 'new-rn-camera';

// ...

<Camera
  ref={camera}
  style={styles.box}
  zoom={zoom}
  cameraFacing={face}
  torch={torch}
/>;
```

Please see the `example/src/App.tsx` file for a full example.

If you'd like to run the example locally:

- clone this repo
- `cd example/`
- `yarn && npx pod-install`
- `yarn android` or `yarn ios`

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

repository: cruzach/new-rn-camera

repo_name: cruzach/new-rn-camera


text:
# bootstrap-portfolio

Hi! welcome to my portfolio, its still a work in progress but this is where I will be displaying all of my projects as I create them.

## installation
* Here is the link to the [GitHub Repository](https://github.com/austinatkinson93/bootstrap-portfolio)
* Have a look at my [Bootstrap portfolio](https://austinatkinson93.github.io/bootstrap-portfolio/)

## Usage
* The website is fairly straight forward. It will eventually be used to house all the projects I will be working on.
    There are no special features at this time but will explain those as needed for future changes to the webpage.

## Credits

Austin Atkinson: [GitHub](https://github.com/austinatkinson93)

## License

Copyright (c) [year] [fullname]

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:
# CS-499 ePortfolio

## Introduction

This artifact was part of my Final Project from CS-405 Secure Coding, which I took in September 2019. In that class, I was given a small C++ project with five source files and I was to find vulnerabilities and security flaws in the project code. As part of the Final Project in that class, I created a document that listed the vulnerabilities and security flaws I found and the solutions I implemented.
My enhancement to the artifact was to apply the same procedures of analysis to a more complicated set of C++ code files and to produce the same type of solutions report.

## Why I Included This Artifact

In this project, I demonstrated my mastery of the following outcomes – analyzing source code using manual and automated testing methods for the identification of potential vulnerabilities and code weaknesses, evaluating the vulnerabilities I identified using best practices and industry standards, and describing the implications on non-secure code, modifying the code by correcting weaknesses and reducing vulnerabilities, and recommending testing processes and necessary protocols for producing secure code.

I chose the artifact for the following reasons:
- It showcases my ability to develop secure code.
- It displays my skill in analyzing existing code for vulnerabilities and security weaknesses and in fixing that code to eliminate risks.

## Using this Artifact

The entire artifact C++ source file shows the inclusion of block and line comments that make the code more understandable. The addition of the comments will show that I can read, understand and document code. I created a separate document with details on the vulnerabilities and security flaws I found in the code. That summary list shows that I can analyze one or more code files and determine where weaknesses, security flaws and bad coding practices exist, and how I fixed them to produce robust code.

## How this Artifact Was Improved

The artifact was improved by removing code vulnerabilities and security weaknesses and by adding block and line comments. When received, the code had no comments of any form. I added numerous block and line comments to the code.

![Image](images/E2/TopLevelCommentBlockAdded.png)

I changed all the hard-coded string buffer lengths into const int variables and the set the buffers to the assigned length. Nothing is hard coded anymore.

![Image](images/E2/ConstInt.png)

Library functions such as gets and strcpy were changed to a secure version of the function gets_s and strcpy_s that includes the length of the data to be processed.

![Image](images/E2/Strcpy.png)

Removed all inline string literals from the code and placed them together for easy reference. Each string is identified by a static const char*  value.

![Image](images/E2/StringLiterals.png)

Comments were added to all of the code, below is an example of comments added to a loop.

![Image](images/E2/CodeComments.png)

## What Did I Learn By Enhancing The artifact

When inspecting the artifact visually, I used the SEI CERT C Coding Standard (Svoboda, 2018) as my guide when looking for vulnerabilities. The Software Engineering Institute (SEI) "was established in 1984 as a federally funded research and development center" (Software Engineering Institute, n.d.). The coding standards developed at SEI included support for many programming languages. I used the standards that were developed for C and C++ when reviewing the Railway Reservation System. I learned about coding standards and the standards for developing secure code that mitigates weaknesses and security flaws.
I also reviewed and used several static analysis tools in the process of improving the code I selected. Two of the tools easily integrated with Visual Studio, a third tool ran from the Windows command line with the path and name of the file provided.

The only challenge I faced was the amount of time it took to modify the original code with all of the changes that needed to be made. After doing a visual inspection of the code, and running two static analysis tools on the code, I needed to make lots of changes to functions and character strings. Then I began slowly walking through the code and adding comments to the code. Understanding and then documenting the code took more time than the inspections I had performed.

### Portfolio Links

**Porfolio Links**

* [Professional Self-Assessment](https://w-coleman-moore.github.io/index.html)

* [Refinement Plan & Code Review](https://w-coleman-moore.github.io/ePortfolio/CodeReview.html)

* [Enhancement One - Software Engineering & Design](https://w-coleman-moore.github.io/ePortfolio/EnhancementOne.md)

* [Enhancement Two - Data Structures & Algorithms](https://w-coleman-moore.github.io/ePortfolio/EnhancementTwo.md)

* [Enhancement Three - Databases](https://w-coleman-moore.github.io/ePortfolio/EnhancementThree.md)

repository: wcolemanmoore/ePortfolio

repo_name: wcolemanmoore/ePortfolio


text:
# Upgrading The Jenkins Service - Master Node

## Purpose

This document is intended to walk the automation-user through the process of upgrading a Jenkins service from a previous, template-based deployment.

## Caveats

While this procedure has proven to be fairly reliable, it _does_ depend on success of the to-be-upgraded instance's backups. It is best to verify that the available sync-backups are good before initiating this procedure. Overall, this process should be vetted and run under any relevant site-local policies regarding upgrades.

## Dependencies

In order to use these templates, the following things will be necessary:

* Access to an AWS account
* An IAM user or role with (at least) enough permissions to:
    * Modify classic Elastic LoadBalancers (ELBs)
    * Create/Modify CloudWatch Logs log-groups (Optional: only required if deploying to a region that supports the use of the CloudWatch Logs service and wishing to take advantage of same)
    * Create/Modify DNS records in Route53 (Optional: only required if deploying to a region that supports Route53 and use of Route53 DNS service is desired)
* Access to a computer that has a modern git client
* Access to a computer that has Python installed (and is pip-enabled)
* Access to a computer that has a modern web browser
* Access to a computer that has the AWS CLI installed or _installable_ (e.g., `pip install awscli`)
* Ability to configure the AWS CLI to use the previously-described IAM user or role

## Assumptions/Dependencies

* The automation user has a verified backup of the running configuration (or the ability to do so immediately prior to attempting th
e upgrade)
* The Jenkins-hosting EC2 instance was deployed using the `make_jenkins_EC2-Master-instance.tmplt.json` template
* The "JenkinsRpmName" parameter-value was specified as a version-pinned value in the previous deployment
* Automation user has sufficient privileges to execute an instance-replacing CloudFormation stack-update action

## Workflow Description

While this task can, notionally, be done through both the CloudFormation web UI and the AWS CLI, only procedures for use with the we
b UI have been validated.

### Update Via Web UI

1. Login to the CloudFormation web console
1. Locate the previously-deployed stack
1. Select the  previously-deployed stack
1. Select the "Update Stack" option from the `Action` button/menu
1. Select "Use current template" from the "Select Template" page.
1. Change the value of the "JenkinsRpmName" parameter to the Jenkins RPM you wish to upgrade to.
1. Force a redeployment by:
   * Changing the value of the "AmiId" parameter to the AMI you wish to update to; and/or
   * Changing the value of the "SubnetId" to one of the other subnets in the VPC (if VPC has public and private subnets, change to another subnet of the same type).
1. Note: Other parameters may also be modified. However, doing so is out of scope for this document.
1. Click on the "Next" button to get to the "Options" page
1. Click on the "Next" button to get to the "Review" page
1. Validate all values are as desired. Note that the instance should be shown for replacement in the "Preview your changes" section.
1. Click on the "Update" button to commence the process.
1. Track the update process
    * If the update succeeds, the previous instance will be terminated
    * If the update fails, the new instance will be terminated. If — per the caveats section — the previous instance wa
stopped, it will need to be restarted for services to resume.
1. Login to the Jenkins service and verify that previous functionality is present on the replacement node.

### Update Via AWS CLI

**TBD**

## "Under the Covers"

When the stack-update executes, a new EC2 instance is launched in parallel. The application installation/configuration scripts will attempt to find a recent sync-backup in the associated S3 bucket's `Backups/sync/` folder. If it finds a good backup, it will attempt to auto-recover from that data as part of the deployment processes. Once complete, the original instance will be terminated and a new, upgraded instance should be online with all of the data of the prior instance's last sync-backup.


text:
# Libxmljs-mt
[![Build Status](https://secure.travis-ci.org/gagern/libxmljs.svg?branch=master)](http://travis-ci.org/gagern/libxmljs)

[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/64dea28o6yuaq7om/branch/master?svg=true)](https://ci.appveyor.com/project/gagern/libxmljs/branch/master)

This project is a fork of [libxmljs](https://github.com/libxmljs/libxmljs).
The current version 0.18.3 is based on libxmljs 0.18.7 and libxml 2.9.4.

Libxmljs was originally designed with single-threaded operations in mind.
There are no asynchroneous operations for things like parsing XML documents.
But even more importantly, since the embedded [libxml](http://xmlsoft.org/)
was configured only for single-threaded use, no other package
could build on this to provide multi-threaded operations using libxml.
The issue is discussed at length in upstream
[issue 296](https://github.com/libxmljs/libxmljs/issues/296).

This package here adds multi-threading support to libxmljs.
It does offer a method to asynchroneously parse an XML file using

```js
libxmljs.fromXmlAsync(buffer, options, function callback(err, doc) {…});
```

and it can be used by other packages to provide
more advanced asynchroneous operations.
To do so, the code has to construct a `libxmljs::WorkerParent` object
on the V8 thread and then a `libxmljs::WorkerSentinel` on the worker thread.
Both of these are RAII sentinels, so they do some setup in their constructor
and some cleaning up in their destructor.
Getting their lifetime right is important.
When using nan, it's easiest to make the `WorkerParent` a member
of the class derived from `NanAsyncWorker`
and have a `WorkerSentinel` variable in the `Execute` method of that class.

It is to be hoped that this fork is a temporary solution,
and that the original libxmljs project will adapt
either this solution or a similar one to become usable in a multi-threaded way.
But the corresponding bug report has remained open for too long,
and even though there was some very valuable discussion going on,
there were also long spans with no activity at all.
It is hard to tell when this fork will become obsolete, if ever.

Note that this project makes use of a git submodule for the libxml code,
so if you are building from a git checkout you might have to perform
`git submodule update --init` before you can do `npm install`.

Below comes the documentation from the original project,
with only slight modifications where appropriate.

-----

# Libxmljs
LibXML bindings for [node.js](http://nodejs.org/)

```javascript
var libxmljs = require("libxmljs-mt");
var xml =  '<?xml version="1.0" encoding="UTF-8"?>' +
           '<root>' +
               '<child foo="bar">' +
                   '<grandchild baz="fizbuzz">grandchild content</grandchild>' +
               '</child>' +
               '<sibling>with content!</sibling>' +
           '</root>';

var xmlDoc = libxmljs.parseXml(xml);

// xpath queries
var gchild = xmlDoc.get('//grandchild');

console.log(gchild.text());  // prints "grandchild content"

var children = xmlDoc.root().childNodes();
var child = children[0];

console.log(child.attr('foo').value()); // prints "bar"
```

## Support

* Docs - [http://github.com/libxmljs/libxmljs/wiki](http://github.com/libxmljs/libxmljs/wiki)
* Mailing list - [http://groups.google.com/group/libxmljs](http://groups.google.com/group/libxmljs)

## API and Examples

Check out the wiki [http://github.com/libxmljs/libxmljs/wiki](http://github.com/libxmljs/libxmljs/wiki).

See the [examples](https://github.com/gagern/libxmljs/tree/master/examples) folder.

## Installation via [npm](https://npmjs.org)

```shell
npm install libxmljs-mt
```

## Contribute

Start by checking out the open issues both for [the upstream project](https://github.com/libxmljs/libxmljs/issues?state=open) and the [multi-threaded fork](https://github.com/gagern/libxmljs/issues?state=open). Specifically the [desired feature](https://github.com/libxmljs/libxmljs/issues?labels=desired+feature&page=1&state=open) ones.

### Requirements

Make sure you have met the requirements for [node-gyp](https://github.com/TooTallNate/node-gyp#installation). You *do not* need to manually install node-gyp; it comes bundled with node.

repository: gagern/libxmljs

repo_name: gagern/libxmljs


text:
# pal-platform
Repository to hold deployment information for PAL-supported OS's, toolchains, middleware and devices

Current version is 3.0.0, copied from from [pal platfrom 3.0.0 release][pal-platfrom-3-0-0-release].

## Table of Contents

- [pal-platform utility script](pal-platform-util.md)
- [pal-platform build system](pal-platform-buildSystem.md)
- [adding a new port to build system](pal-platform-newPort.md)

[pal-platfrom-3-0-0-release]:https://github.com/ARMmbed/pal-platform/releases/tag/3.0.0

repository: edmund-troche/mbl-core

repo_name: edmund-troche/mbl-core


text:
---
layout: default
---

# 1996-01-17 - Re: A weakness in PGP signatures, and a suggested solution (long)

## Header Data

From: "E. ALLEN SMITH"<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: abf13615673e82dac11b4104f45f497883cef4b0c8c207404b5dce6f57d5f73b

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-01-17 08:56:04 UTC

Raw Date: Wed, 17 Jan 1996 16:56:04 +0800

## Raw message

```
{% raw  %}From: "E. ALLEN SMITH"<EMAIL_ADDRESS>Date: Wed, 17 Jan 1996 16:56:04 +0800
To<EMAIL_ADDRESS>Subject: Re: A weakness in PGP signatures, and a suggested solution (long)
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

From<EMAIL_ADDRESS>(Christopher R. Key)

>First of all, if the recipient is a newsgroup, why would that particular
information need to be part of the signed information?  If you post to a
newsgroup a message that is only signed (as opposed to encrypted also),
then you are obviously not worried about who reads it.  The signature is
only a method of proving that the important text (message) is unchanged and
intact, and that the person who it is supposed to be from is the same who
signed it.
--------------
     How about proving that you _weren't_ spamming? I.e., an enemy spots a
message on a newsgroup from you with a signature, then duplicates it with
header modifications on 500 newsgroups including news.admin.net-abuse.misc
(to add insult to injury). Sorry if a bunch of other people have pointed this
out by the time my message gets to toad.com, but...
     -Allen

{% endraw %}
```

## Thread

+ Return to [January 1996](/archive/1996/01)

+ Return to "["E. ALLEN SMITH" <EALLENSMITH@ocelot.Rutgers.EDU>](/authors/e_allen_smith_eallensmith_at_ocelot_rutgers_edu_)"

+ 1996-01-17 (Wed, 17 Jan 1996 16:56:04 +0800) - Re: A weakness in PGP signatures, and a suggested solution (long) - _"E. ALLEN SMITH"<EMAIL_ADDRESS>