text:
---
layout: tutorial
key: programming
title: "Java 8 - Functional Interfaces"
index: 2355
subcategory: java-java8
date: 2017-05-04
tags: [Predicate, Supplier, Consumer]
---

> Functional Interfaces in Java 8.

## 1. Functional Interface
A `functional interface` in Java is an interface that contains only a single abstract (unimplemented) method. A functional interface can contain default and static methods which do have an implementation, in addition to the single unimplemented method.

Here is a Java functional interface example:
```java
public interface MyFunctionalInterface {
    public void execute();
}
```
The above counts as a functional interface in Java because it only contains a single method, and that method has no implementation. Normally a Java interface does not contain implementations of the methods it declares, but it can contain implementations in default methods, or in static methods. Below is another example of a Java functional interface, with implementations of some of the methods:
```java
public interface MyFunctionalInterface2{
    public void execute();

    public default void print(String text) {
        System.out.println(text);
    }

    public static void print(String text, PrintWriter writer) throws IOException {
        writer.write(text);
    }
}
```
The above interface still counts as a functional interface in Java, since it only contains a single non-implemented method.

## 2. Functional Interfaces Can Be Implemented by a Lambda Expression
A Java functional interface can be implemented by a Java Lambda Expression. Here is an example that implements the functional interface MyFunctionalInterface defined in the beginning of this Java functional interface tutorial:

MyFunctionalInterface lambda = () -> {
    System.out.println("Executing...");
}
A Java lambda expression implements a single method from a Java interface. In order to know what method the lambda expression implements, the interface can only contain a single unimplemented method. In other words, the interface must be a Java functional interface.

## 3. Built-in Functional Interfaces in Java 8
Java contains a set of functional interfaces designed for commonly occuring use cases, so you don't have to create your own functional interfaces for every little use case. Some of these built-in functional interfaces:
* Function
* Predicate
* UnaryOperator
* BinaryOperator
* Supplier
* Consumer

### 3.1 Function
The Java Function interface (java.util.function.Function) interface is one of the most central functional interfaces in Java. The Function interface represents a function (method) that takes a single parameter and returns a single value. Here is how the Function interface definition looks:
```java
public interface Function<T,R> {

    public <R> apply(T parameter);
}
```
The Function interface actually contains a few extra methods in addition to the methods listed above, but since they all come with a default implementation, you do not have to implement these extra methods.

The only method you have to implement to implement the Function interface is the `apply()` method. Here is a Function implementation example:
```java
public class AddThree implements Function<Long, Long> {

    @Override
    public Long apply(Long aLong) {
        return aLong + 3;
    }
}
```
This Function implementation implements the apply() method so it takes a Long as parameter, and returns a Long. Here is an example of using the above AddThree class:
```java
Function<Long, Long> adder = new AddThree();
Long result = adder.apply((long) 4);
System.out.println("result = " + result);
```
First this example creates a new AddThree instance and assigns it to a Function variable. Second, the example calls the apply() method on the AddThree instance. Third, the example prints out the result (which is 7).

You can also implement the Function interface using a Java lambda expression. Here is how that looks:
```java
Function<Long, Long> adderLambda = (value) -> value + 3;
Long resultLambda = adder.apply((long) 8);
System.out.println("resultLambda = " + resultLambda);
```
As you can see, the Function interface implementation is now inlined in the declaration of the adderLambda variable, rather than in a separate class. This is a bit shorter, plus we can see directly in the above code what it is doing.
### 3.2 Predicate
The Java Predicate interface, java.util.function.Predicate, represents a simple function that takes a single value as parameter, and returns true or false. Here is how the Predicate functional interface definition looks:
```java
public interface Predicate {
    boolean test(T t);
}
```
The Predicate interface contains more methods than the test() method, but the rest of the methods are default or static methods which you don't have to implement.

You can implement the Predicate interface using a class, like this:
```java
public class CheckForNull implements Predicate {
    @Override
    public boolean test(Object o) {
        return o != null;
    }
}
```
You can also implement the Java Predicate interface using a Lambda expression. Here is an example of implementing the Predicate interface using a Java lambda expression:
```java
Predicate predicate = (value) -> value != null;
```
This lambda implementation of the Predicate interface effectively does the same as the implementation above that uses a class.
### 3.3 UnaryOperator
The Java UnaryOperator interface is a functional interface that represents an operation which takes a single parameter and returns a parameter of the same type. Here is an example of a Java UnaryOperator implementation:
```java
UnaryOperator<Person> unaryOperator =
        (person) -> { person.name = "New Name"; return person; };
```
The UnaryOperator interface can be used to represent an operation that takes a specific object as parameter, modifies that object, and returns it again - possibly as part of a functional stream processing chain.
### 3.4 BinaryOperator
The Java BinaryOperator interface is a functional interface that represents an operation which takes two parameters and returns a single value. Both parameters and the return type must be of the same type.

The Java BinaryOperator interface is useful when implementing functions that sum, subtract, divide, multiply etc. two elements of the same type, and returns a third element of the same type.

Here is an example implementation of the BinaryOperator interface:
```java
BinaryOperator<MyValue> binaryOperator =
        (value1, value2) -> { value1.add(value2); return value1; };
```
### 3.5 Supplier
The Java Supplier interface is a functional interface that represents an function that supplies a value of some sorts. The Supplier interface can also be thought of as a factory interface. Here is an example implementation of the Java Supplier interface:
```java
Supplier<Integer> supplier = () -> new Integer((int) (Math.random() * 1000D));
```
This Java Supplier implementation returns a new Integer instance with a random value between 0 and 1000.
### 3.6 Consumer
The Java Consumer interface is a functional interface that represents an function that consumes a value without returning any value. A Java Consumer implementation could be printing out a value, or writing it to a file, or over the network etc. Here is an example implementation of the Java Consumer interface:
```java
Consumer<Integer> consumer = (value) -> System.out.println(value);
```
This Java Consumer implementation prints the value passed as parameter to it out to System.out.

## 4. References
* [Java Functional Interfaces](http://tutorials.jenkov.com/java-functional-programming/functional-interfaces.html)


text:
# KeypadInterface
PIC16F15324 based keypad 4x4 or 3x4 to I2C interface with interrupt line
3.3v and 5v compatible

Use this to interface a standard keypad to I2C. Reduces needed GPIO pins on main uC and makes main uC program simpler.

Connections :
Column - Port
C1 - RA3
C2 - RA2
C3 - RA1
C4 - RA0

Row - Port
R1 - RC3
R2 - RC2
R3 - RC1
R4 - RC0

I2C:
SDA - RC5
SCL - RA5

Interrupt :
RC4 (open drain)

Tips:
*don't forget i2c pullup resistors
*disconnect programmer while testing (pulldowns lines)
*use free available MPLAB with XC8 to compile

license: MIT

repository: skysoft/KeypadInterface

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: skysoft/KeypadInterface


text:
---
layout: single-page
title: "TDWG 2015: Applications, Standards and Capacity Building for Sustaining Global Biodiversity"
date: 2015-09-28
date_shown: 2015-09-28 to 2015-10-01
type: Conference
status: Finished
---

## {{ page.title }}

#### Description

During the conference, GBIF France team with the help of the community presented the Living Atlases as well as the Atlas of Living Australia modules. Through a poster and a talk, GBIF France technical team was able to describe an existing example of national data portal based on ALA platform.

#### Resources

##### Presentation & Poster
- Presentation: [Atlas of Living Australia: a modular data portal framework for national needs](../assets/presentation/tdwg-2015/6-TDWG-talk.pdf) (PDF) by Marie-Elise Lecoq (GBIF France), Dave Martin (Atlas of Living Australia), Tim Robertson (GBIF).
- Poster: [The GBIF France new portal : Atlas of Living France (ALF)](../assets/presentation/tdwg-2015/6-ALF-poster.pdf) (PDF) by Marie-Elise Lecoq (GBIF France), Anne-Sophie Archambeau (GBIF France), Eric Chenin (IRD - GBIF France), Fabien Cavière (GBIF France), Sophie Pamerlon (GBIF France), Régine Vignes-Lebbe (UPMC - GBIF France).

repository: melecoq/la-website

branch_name: refs/heads/master

repo_name: melecoq/la-website


text:
---
layout: post
title: Hey, my Service Principal expired!
tags: [azure, platform]
---
If you used Azure DevOps long enough, you will eventually run into a situation like this - your Service Principal will expire and throw this error:

![](/images/posts/2019-08-19-20-55-34.png)

![](/images/posts/2019-08-19-20-51-22.png)

Don't panic if you see this - when you authorise an Azure Resource Manager Service Connection Azure DevOps creates a new App Registration in Azure Active Directory (even if you are using as public tenant like hotmail - you will still get an AAD tenant to use):

![](/images/posts/2019-08-19-20-38-35.png)

This App Registration has a default expiration of two years:

![](/images/posts/2019-08-19-20-39-30.png)

The error simply means that your Service Principal expired. All you have to do is to renew the Service Principal **from the Azure DevOps UI** and you will be good to go. Don't renew it from the Portal, as otherwise Azure DevOps won't know how to handle the secret!

gha_language: HTML

gha_license_id: MIT


text:
# ![LOGO](logo.png) Article Search **flow**ground Connector

## Description

A generated **flow**ground connector for the Article Search API (version 1.0.0).

Generated from: https://api.apis.guru/v2/specs/nytimes.com/article_search/1.0.0/swagger.json

Generated at: 2019-05-07T17:43:19+03:00

## API Description

With the Article Search API, you can search New York Times articles from Sept. 18, 1851 to today, retrieving headlines, abstracts, lead paragraphs, links to associated multimedia and other article metadata.

 Note: In URI examples and field names, italics indicate placeholders for variables or values. Brackets [ ] indicate optional items. Parentheses ( ) are not a convention — when URIs include parentheses, interpret them literally.

## Authorization

Supported authorization schemes:
- API Key
## Actions

### Article Search

> Article Search requests use the following URI structure:

*Tags:* `Stories`

#### Input Parameters
* `q` - _optional_ - Search query term. Search is performed on the article body, headline and byline.

* `fq` - _optional_ - "Filtered search query using standard Lucene syntax.

The filter query can be specified with or without a limiting field: label.

See Filtering Your Search for more information about filtering."

* `begin_date` - _optional_ - "Format: YYYYMMDD

Restricts responses to results with publication dates of the date specified or later."

* `end_date` - _optional_ - "Format: YYYYMMDD

Restricts responses to results with publication dates of the date specified or earlier."

* `sort` - _optional_ - "By default, search results are sorted by their relevance to the query term (q). Use the sort parameter to sort by pub_date."

    Possible values: newest, oldest.
* `fl` - _optional_ - "Comma-delimited list of fields (no limit)

  Limits the fields returned in your search results. By default (unless you include an fl list in your request), the following fields are returned:

  web_url

  snippet

  lead_paragraph

  abstract

  print_page

  blog

  source

  multimedia

  headline

  keywords

  pub_date

  document_type

  news_desk

  byline

  type_of_material

  _id

  word_count"

* `hl` - _optional_ - Enables highlighting in search results. When set to true, the query term (q) is highlighted in the headline and lead_paragraph fields.

Note: If highlighting is enabled, snippet will be returned even if it is not specified in your fl list."

* `page` - _optional_ - "The value of page corresponds to a set of 10 results (it does not indicate the starting number of the result set). For example, page=0 corresponds to records 0-9. To return records 10-19, set page to 1, not 10."

* `facet_field` - _optional_ - Comma-delimited list of facets

Specifies the sets of facet values to include in the facets array at the end of response, which collects the facet values from all the search results. By default no facet fields will be returned. Below is the list of valid facets:

section_name

document_type

type_of_material

source

day_of_week

To learn more about using facets, see Using Facets.

* `facet_filter` - _optional_ - When set to true, facet counts will respect any applied filters (fq, date range, etc.) in addition to the main query term. To filter facet counts, specifying at least one facet_field is required. To learn more about using facets, see Using Facets.

## License

**flow**ground :- Telekom iPaaS / nytimes-com-article-search-connector

Copyright © 2019, [Deutsche Telekom AG](https://www.telekom.de)

contact<EMAIL_ADDRESS>
All files of this connector are licensed under the Apache 2.0 License. For details
see the file LICENSE on the toplevel directory.


text:
## hdfs-perf

Micro benchmarks for Apache HDFS/HCFS perf testing. The package includes the following two tests:

1. FsStress: A very simplistic multi-threaded client that can issue metadata requests to a Apache Hadoop-Compatible File System (HCFS) to measure its metadata IOPS.
1. WriteFile: A multi-threaded write IO test that allows tweaking write parameters like replication, IO size, number of threads etc. A single thread should be able to saturate the network or single disk bandwidth (whichever is lower).

## Building

You will need Maven + JDK7 to build the benchmark source code. The command to build the jar is

    mvn clean package -DskipTests

## Running the Tests

### FsStress

Usage:
```
  Usage: FsStress -t <runTime> -n NumThreads --enabledTests=....

   -t runTime     : Specify the runtime in seconds. Default is 300

   -n NumThreads  : Number of client threads. Default is 1

   --enabledThreads=... : A comma-separated list of requests that are enabled.
                          Where tests can be one or more of:
                            CREATE, DELETE, MKDIRS, RENAME, STAT, GETCONTENTSUMMARY
                            or 'ALL' for everything (default); or 'READS'
                            for all read requests, 'WRITES' for all write requests
```

Example Usage:
Run test for 5 minutes, measuring FileSystem read performance with 4 client threads.
```
hadoop jar FsPerfTest-1.0-SNAPSHOT.jar net.arp7.FsPerfTest.FsStress -t 300 -n 4 --enabledTests=reads
```

### WriteFile

A single-threaded write test with a 100GB file can be started as follows:

    hadoop jar FsPerfTest-1.0-SNAPSHOT.jar net.arp7.FsPerfTest.WriteFile -s 100GB

Run without parameters to see usage.

    hadoop jar FsPerfTest-1.0-SNAPSHOT.jar net.arp7.FsPerfTest.WriteFile

*Apache®, Apache Hadoop, Hadoop®, and the yellow elephant logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.*

repository: anuengineer/FsPerfTest

repo_name: anuengineer/FsPerfTest


text:
# BC Image Copyright

Display and manage copyright information of your (image) image files.

## Requirements

* [PHP](https://secure.php.net/) 7.1 or newer
* [WordPress](https://wordpress.org/) 4.9 or newer

## Front-end usage

Use `bc_image_copyright` function to display or fetch copyright information of particular image:

```php
// Display copyright information of image (attachment) with ID = 123
echo bc_image_copyright(123);

// Display copyright information of current featured image.
if (has_post_thumbnail()) {
  echo bc_image_copyright(get_post_thumbnail_id());
}

// Display only manually entered copyright information (if any), do not read image file metadata as fallback.
echo bc_image_copyright(123, true);
```

license: Unlicense

repository: chesio/bc-image-copyright

repo_name: chesio/bc-image-copyright


text:
---
hrs_structure:
  division: '2'
  volume: '8'
  title: 23a
  chapter: '428'
  section: 428-1009
type: hrs_section
tags:
  - Business
menu:
  hrs:
    identifier: HRS_0428-1009
    parent: HRS0428
    name: 428-1009 Action by attorney general
weight: 50410
title: Action by attorney general
full_title: 428-1009 Action by attorney general
---
**[§428-1009] Action by attorney general.** The attorney general may maintain an action to restrain a foreign limited liability company from transacting business in this State in violation of this part. [L 1996, c 92, pt of §1]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# Community

If you have any questions, you can:

* Join the Liquid Haskell [slack channel](https://join.slack.com/t/liquidhaskell/shared_invite/enQtMjY4MTk3NDkwODE3LTFmZGFkNGEzYWRkNDJmZDQ0ZGU1MzBiZWZiZDhhNmY3YTJiMjUzYTRlNjMyZDk1NDU3ZGIxYzhlOTIzN2UxNWE)
* Mail the [users mailing list](https://groups.google.com/forum/#!forum/liquidhaskell)

Alternatively, feel free to drop [Ranjit Jhala](https://github.com/ranjitjhala) or
[Niki Vazou](https://github.com/nikivazou) an email.

repository: pbougou/liquidhaskell

branch_name: refs/heads/develop

gha_language: Haskell

gha_license_id: NOASSERTION

repo_name: pbougou/liquidhaskell


text:
# College-Portal Backend

For now, all we have are migration scripts for our user-and-roles systems

### How to use

- Create an SQL DB on your system and give it a name like `college-portal`

- Copy the `.env.example` file to `.env`, and specify the values for connecting to the DB you just created

- Open the terminal and be sure to be in the `./src` directory

- `npm install`

- `npm run migrate` should create the tables and relationships in your DB

### Testing

- Test scripts should be in the format: `<script-name>.test.js`

- Run `npm test` in your terminal to run the tests, to guide you when modifying code

gha_language: JavaScript


text:
# quickie-HTML

> It's a quickie HTML/JS sandbox!

## Getting started

[Proceed to the live site](https://schas002.github.io/quickie-HTML), then proceed to add `myHTML` and `myJS` query string parameters with your HTML/JS. You can escape using `.` instead of `%`.

## Maintainer

- Andrew Zyabin - @schas002 - [@zyabin101@botsin.space](https://botsin.space/@zyabin101).

## Contribute

Bang! Every issue and PR is welcome.

Every contributor to this repository must follow the code of conduct, which is: don't be rude.

## License

[MIT](LICENSE) © Andrew Zyabin

Ah yeah, quickie HTML also uses [Normalize.css](https://github.com/necolas/normalize.css) and [sakura](https://github.com/oxalorg/sakura) under the same license.


text:
# Velo theme

This theme is a fork of [meverss/barracuda](https://github.com/meverss/barracuda), with an attempt of removing termux dependency. No updates are guaranteed.

Barracuda is in essence:

> A theme for nerds, makes fish even more powerful. It's equipped with a hell of a
lot of nice functions and key bindings to speed up your workflow

## Requirements

* An up-to-date fish shell version from [github][fish-git] or a
[nightly build][fish-nightly].
* Patched Powerline fonts installed. \(See how to install [here](https://github.com/powerline/fonts))

nodejs

```fish
apt install nodejs
```

pv

```fish
apt install pv
```

## Configuration

### General configuration

The theme behaves similar to vim's airline/powerline plugins. Thus, it needs a
[powerline font][font].
It's also crucial to have vi mode enabled. Thus, execute
```
set -U fish_key_bindings fish_vi_key_bindings
```
before enabling the theme.

### Colors

Two color schemes for bright and dark environments are predefined. You can
enable them with `day` and `night`, respectively.

### Command history
Commands that shouldn't appear in the command history are defined by a universal
list `$barracuda_nocmdhist`. Default:
```
set -U barracuda_nocmdhist c d ll ls m s
```

### Show Node version

To show your current node version, do following in your Fish configs

Enable:
```
set -g barracuda_alt_environment "node -v"
```

Disable:
```
set -U barracuda_alt_environment
```

## Outer prompt segments

- Vi mode is indicated by color of outer segments, cursor color also changes
  if terminal supports it:
    * green: NORMAL mode
    * yellow: INSERT mode
    * blue: VISUAL mode

## Left prompt segments

- Present working directory (on top)
- Prompt line number
- Barracuda ASCII logo
- Git repository information
- Status symbols
    * ✻: keep track of this shell session, can be toggled with `#` to show the number of
       the session within the sessions list
    * ⭐: present working directory is in bookmark list, can be toggled with `#` to
        show the number of the bookmark
    * V: vi is parent process
    * R: [ranger][ranger] is parent process
    * ⬜: there are background jobs, can be toggled with `#` to show the amount of
        background jobs
    * 🔒: no write permissions in present working directory
    * ⚔: there are tasks scheduled for this week, can be toggled with `#` to
        show the amount of weekly tasks
    * ⚑: there are appointments for today, can be toggled with `#` to
        show the amount of appointments
    * ✔: last command succeeded, can be toggled with `#` to show the status value
    * ✘: last command failed, can be toggled with `#` to show the status value
    * ⚡: superuser indicator
- Active Python [virtual environment](https://virtualenv.pypa.io/en/latest/). Requires [Virtual Fish](https://github.com/adambrenecki/virtualfish/)

## Right prompt segments

- Shows current interface language

## Quickly navigate in history of working directories

The function `d` drops down a menu showing the history as enumerated list. Unlike
fish's builtin `dirh`, `d` does not show any duplicates. Enter a number to jump
to a directory within the list.

The following shortcuts need vi-mode:
- Press `H` in NORMAL mode to change present working directory to previous
  working directory in history.
- Press `L` in NORMAL mode to change present working directory to next working
  directory in history.

## Quickly navigate in command history

The function `c` drops down a menu showing the command history as enumerated list similarly to
the `d` function. Selections are also pasted into the X clipboard. It's possible
to load a command of a former prompt by giving the prompt line number as
argument.

## Bookmarks

A bookmark can be created with `mark`. It can be removed with `unmark`.

`unmark` can take an argument to remove a specific bookmark in the bookmark list.
Simply add the number of the bookmark you would like to remove as the argument.

Bookmarks are universal and thus persistant.
A new shell automatically changes working directory on startup to newest bookmark.
`m` is a function that drops down a menu showing the bookmarks as enumerated list
equivalently to `d`.

The following shortcuts need vi mode:
- Create a bookmark for present working directory with `m` in NORMAL mode.
- Remove a bookmark for present working directory with `M` in NORMAL mode.

By default the shell will change to the directory of the latest bookmark on a new session.
This can be disabled by adding the following line:

```
set -U barracuda_no_cd_bookmark
```

## Edit commandline with your favorite editor

The function `edit-commandline` let you edit the commandline with your editor.
It makes the commandline as powerful as your editor. If `$EDITOR` is not set,
vi is used.

The following shortcut needs vi mode:
- Type `.` in NORMAL mode to edit commandline in editor.

## Sessions

Shell session can be stored with `s <session name>`. If a session with `session
name` already exists, the session with this name will be attached. If a session with
`session name` is already active within another terminal, this terminal will be
focussed.

A list of available sessions can be shown with `s`.

A session can be erased with `s -e <session name>`.

Type `s -d` to detach current session.

## Set window title

Just type `wt <title>`.

## Ring the bell in order to set the urgency hint flag

If you have configured your terminal application to use the visual bell, your
window manager will tell you when a job running in your shell has finished. You
don't need to check manually whether it's done.

Switch it off in that case:
```
set -U barracuda_nobell
```

[font]: https://github.com/Lokaltog/powerline-fonts
[ranger]: http://ranger.nongnu.org/
[remind]: http://www.roaringpenguin.com/products/remind
[fish-git]: https://github.com/fish-shell/fish-shell.git
[fish-nightly]: https://github.com/fish-shell/fish-shell/wiki/Nightly-builds
[screenshot]: https://raw.githubusercontent.com/tannhuber/media/master/budspencer.jpg
[colors]: https://raw.githubusercontent.com/tannhuber/media/master/budspencer_replace_colors.jpg
[pwdstyle]: https://raw.githubusercontent.com/tannhuber/media/master/budspencer_pwd_style.jpg


text:
## learn-cpp
This is small project for C++ learning process.

### Tools usage
```shell
$ python tools/cpplint.py path/to/files.cpp
```

repository: vmelnychuk/learn-cpp

repo_name: vmelnychuk/learn-cpp


text:
- Start Date: (fill me in with today's date, YYYY-MM-DD)
- RFC PR: (leave this empty)
- VuePress Issue: (leave this empty)

# Summary

Brief explanation of the feature.

# Basic example

If the proposal involves a new or changed API, include a basic code example. Omit this section if it's not applicable.

# Motivation

Why are we doing this? What use cases does it support? What is the expected outcome?

Please focus on explaining the motivation so that if this RFC is not accepted, the motivation could be used to develop alternative solutions. In other words, enumerate the constraints you are trying to solve without coupling them too closely to the solution you have in mind.

# Detailed design

This is the bulk of the RFC. Explain the design in enough detail for somebody familiar with VuePress to understand, and for somebody familiar with the implementation to implement. This should get into specifics and corner-cases, and include examples of how the feature is used. Any new terminology should be defined here.

# Drawbacks

Why should we *not* do this? Please consider:

- implementation cost, both in term of code size and complexity
- whether the proposed feature can be implemented in user space
- the impact on teaching people VuePress
- integration of this feature with other existing and planned features
- cost of migrating existing VuePress applications (is it a breaking change?)

There are tradeoffs to choosing any path. Attempt to identify them here.

# Alternatives

What other designs have been considered? What is the impact of not doing this?

# Adoption strategy

If we implement this proposal, how will existing VuePress developers adopt it? Is this a breaking change?

# How we teach this

What names and terminology work best for these concepts and why? How is this idea best presented? As a continuation of existing VuePress patterns?

Would the acceptance of this proposal mean the VuePress documentation must be re-organized or altered? Does it change how VuePress is taught to new developers at any level?

How should this feature be taught to existing VuePress developers?

# Unresolved questions

Optional, but suggested for first drafts. What parts of the design are still TBD?

repository: vuejs/vuepress

repo_name: vuejs/vuepress


text:
---
layout: post
title: "Adding New Users with PowerShell"
date: 2015-10-13 14:07:57 -0400
comments: true
categories:
---
For the next few weeks I am going to highlight some useful scripts that you can use today no matter how experienced or how much of a novice you are at PowerShell. These scripts are immediately practical and yet by taking a look at the structure of the script and how we are using the facilities of the PowerShell scripting language, we can learn a lot about how to write our own scripts.

Have you ever had a batch of users you needed to create accounts for, but you did not want to page through the wizards in Active Directory Users & Computers? This kind of rote, repetitive task is exactly what Windows PowerShell is designed to handle.

Import-Module ActiveDirectory
Import-Csv "C:\powershell\users.csv" | ForEach-Object {
$userPrincipal = $_."samAccountName" +<EMAIL_ADDRESS>New-ADUser -Name $_.Name `
-Path $_."ParentOU" `
-SamAccountName $_."samAccountName" `
-UserPrincipalName $userPrincipal `
-AccountPassword (ConvertTo-SecureString "cheeseburgers4all" -AsPlainText -Force) `
-ChangePasswordAtLogon $true `
-Enabled $true
Add-ADGroupMember "Office Users" $_."samAccountName";
}

In this script, we use the Import-Csv cmdlet, which knows how to read .CSV formatted files. We tell the Import-CSV cmdlet that each row of the CSV located in C:\powershell called users.csv contains information in three columns – the Name of the user, the samAccountName of the user which is basically the login ID for the user, and the organizational unit (OU) of Active Directory that the user needs to live in – and that we are using the columns samAccount Name to create the login ID for the user by marrying the value that lives in that column with the string<EMAIL_ADDRESS>to complete the user principal name (UPN).

From there, we loop through the file using ForEach-Object and send that assembled string (which is stored in the PowerShell variable name $userPrincipal).

We assign the default password to each user "cheeseburgers4all" and then set the Active Directory flag to require the user to change the password at first logon. At the end of the script, we then add all of these accounts to the Active Directory security group called Office Users.

extension: markdown


text:
---
title: Azure Storage Persistence Upgrade Version 4 to 5
summary: Instructions on how to migrate from Azure Table Persistence version 4 to 5
reviewed: 2022-11-06
component: ASP
related:
- persistence/azure-table
redirects:
isUpgradeGuide: true
upgradeGuideCoreVersions:
- 8
---

## Switching to `Azure.Data.Tables`

This version introduces support for [`Azure.Data.Tables`](https://www.nuget.org/packages/Azure.Data.Tables/) and moves away from the deprecated [`Microsoft.Azure.Cosmos.Table`](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Table/1.0.8) package.

For an overview of the SDK changes, refer to the official Azure [migration guide](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/tables/Azure.Data.Tables/MigrationGuide.md).

In brief though, instances of `CloudTableClient` need to be replaced with `TableServiceClient` and `TableEntity` needs to be replaced with `ITableEntity` when declaring saga entities. Any properties that should be excluded from storage, use the `IgnoreDataMember`-attribute instead of `IgnoreProperty`.

### Passing an instance of the client

Instead of:

```csharp
var persistence = endpointConfiguration.UsePersistence<AzureTablePersistence>();
var account = CloudStorageAccount.Parse(connection);
var cloudTableClient = account.CreateCloudTableClient();
persistence.UseCloudTableClient(cloudTableClient);
```

Use:

```csharp
var persistence = endpointConfiguration.UsePersistence<AzureTablePersistence>();
var tableServiceClient = new TableServiceClient(connection);
persistence.UseTableServiceClient(tableServiceClient);
```

### Configuring a client provider

Previously, a custom Cloud table client provider could be created by implementing `IProvideCloudTableClient` which is now replaced with `IProvideTableServiceClient` to reflect the new client type.

See the configuration section for [additional guidance](/persistence/azure-table/configuration.md#configuring-a-table-service-client-provider).

### Compatibility mode

This package continues to be fully compatible with the NServiceBus.Persistence.AzureStorage version 1 and 2. It supports both sagas that use secondary index entries as well as sagas that don't have a secondary index entries.
It's important to note that the compatibility mode does need to be manually enabled. It has been disabled by default in favor of performance.

To opt-in for the compatibility mode, use:

```csharp
var persistence = endpointConfiguration.UsePersistence<AzureTablePersistence>();
var compatibility = persistence.Compatibility();
compatibility.EnableSecondaryKeyLookupForSagasCorrelatedByProperties();
```

gha_language: C#


text:
# React HOC demo in TypeScript

This is repo related to my [Medium article](https://medium.com/@DanHomola/react-higher-order-components-in-typescript-made-simple-6f9b55691af1) on React Higher–Order Components.

## How to use

To try it yourself, just clone this repository and then run
```
yarn install
yarn start
```

For the best experience, I recommend using [Visual Studio Code](https://code.visualstudio.com/).

## Acknowledgements

This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app), using the wonderful [TypeScript-React-Starter](https://github.com/Microsoft/TypeScript-React-Starter) project.

repository: SunithaMannam/typescript-hoc-tutorial

repo_name: SunithaMannam/typescript-hoc-tutorial


text:
# 100DaysofCode

_**My 100-day code challenge.**_

The goal is to:

1. Start from the very basics, refresh the usage.
2. Proceed to lists, tuples, dicts, sets etc.
3. Refresh various loop structures
4. Error handling
5. Functions and Classes.
6. Use and learn the Python Standard Library.
7. Proceed to LeetCode / HackerRank problems.

### References

* `Python 101` - Michael Driscoll
* `Python 201` - Michael Driscoll
* `The Python 3 Standard Library by Example` - Doug Hellmann
* `Leetcode`
* `HackerRank`


text:
---
title: "Web Api"
date: 2021-09-17T12:54:12-07:00
weight: 999
summary: "The contract for the web API that manages scripts."
author: "Shaen"
tags: ["api", "web"]
---

Runs on port 2080.

Returns appropriate HTTP status codes on error:

- Bad trigger name: bad request (400)
- Bad script name: bad request (400)
- Duplicate name: conflict (409)
- Script not found: not found (404)

# Authentication

Token-based authentication API for authorizing other API's use.

## POST /auth/login

Logs a player in and retrieves an access and refresh token.

```
in: {
  username: String,
  password: String
}

out: {
  access_token: String,
  refresh_token: String
}
```

## POST /auth/refresh

Requests a new token pair if the access token has expired.

```
in: {
  refresh_token: String
}

out: {
  access_token: String,
  refresh_token: String
}
```

## POST /auth/logout

Logs the player out, removing all stored tokens.

Uses bearer authentication.

```
headers:
Authorization: Bearer <access token>

in: {}
out: {}
```

# Scripting

## POST /scripts/create

Creates and compiles a new script, returning any compilation errors.

Uses bearer authentication.

```
headers:
Authorization: Bearer <access token>

in: {
  name: String,
  trigger: String,
  code: String
}

out: {
  error?: {
    line?: Number,
    position?: Number,
    message: String
  }
}
```

## POST /scripts/read

Retrieves a script and its compilation status.

Uses bearer authentication.

```
headers:
Authorization: Bearer <access token>

in: {
  name: String
}

out: {
  name: String,
  trigger: String,
  code: String
  error?: {
    line?: Number,
    position?: Number,
    message: String
  }
}
```

## POST /scripts/read/all

Retrieves a list of all scripts including their length and compilation status.

Uses bearer authentication.

```
headers:
Authorization: Bearer <access token>

in: {}
out: {
  scripts: [
    {
      name: String,
      trigger: String,
      lines: Number,
      error?: {
        line?: Number,
        position?: Number,
        message: String
      }
    }
  ]
}
```

## POST /scripts/update

Updates a script returning any compilation errors.

Uses bearer authentication.

```
headers:
Authorization: Bearer <access token>

in: {
  name: String,
  trigger: String,
  code: String
}

out: {
  error?: {
    line?: Number,
    position?: Number,
    message: String
  }
}
```

## POST /scripts/delete

Deletes a script.

Uses bearer authentication.

```
headers:
Authorization: Bearer <access token>

in: {
  name: String
}

out: {}
```

# Websockets

Allows spinning up a websocket connection to ReMUD.

## /ws

The websocket endpoint. Supports upgrading properly formed client requests to websockets.

**From client to server:**

```
{
  "type": "game",
  "data": {
    "message": String
  }
}
```

**From server to client:**

```
{
  "type": "game",
  "data": {
    "is_prompt": true | false,
    "segments": [
        {
            t: "t",
            d: {
                text: "the message",
            }
        },
        {
            t: "cs",
            d: {
                color: "ffffff",
            }
        },
        {
            t: "ce",
            d: {},
        },
    ]
  }
}
```
Each message from the server is a line that is to be displayed. It's broken up into segments that represent how to color pieces of the line.
`is_prompt` indicates whether the line is meant to be a player prompt - on the client, text is appended to the most recent prompt.

- `t` segments contain the actual text, including whitespace.
- `cs` segments are 'color start' indicators and contain the color to apply to the subsequent segments
- `ce` is the 'color end' segment, and indicates to stop the previously applied color.

repository: krixi/remud

gha_language: Rust

repo_name: krixi/remud


text:
# iso-svg

Isometric projection rendered in SVG

![Cube](images/cube.PNG)

## How to build

```
stack setup
stack build
```

* To build the examples, `stack build --flag iso-svg:examples`

## TO DO

* Use normal to determine shading
* Render using a camera
* Fix rotation in `isometricProject`

## DONE

* ~~Scene graph, camera, etc.~~
* ~~Evaluate scene graph~~

## License

BSD3

## Contributions

Bug reports, pull requests, feature requests are welcome

repository: j-mueller/iso-svg

repo_name: j-mueller/iso-svg


text:
---
layout: "note"
title: "Brave old new world"
date: "2020-01-19 12:00:00"
date: "2020-01-19T21:05:12.984Z"
---

As just posted, [Netlify has started to charge me](/paternoster/notes/2020-01-19-getting-charged-by-netlify-for-the-first-time/). I've had five or so really good years with Netlify, but this concerns me a little. As I get older I get crankier and I want something that a) I can feel confident about what it will cost (and whether it'll be around for the long term) and b) doesn't use Github and Cloudfront (yes, that cranky).

So, I'm thinking: traditional LAMP hosting. The greener, the better. Monthly charge around five dollars, or so. I hear goodish things about [Greenhost](https://greenhost.net/). I'll continue to use Jekyll for the time being, but...

The whole Ruby dependency thing is annoying me. When I get the time I'll move to Kirby, which just relies on PHP. I'll get a CMS too.

But, urgh: FTP again for the short term, at least. We really have been spoiled by the automated Git/Netlify workflow.

Finally, I want email on my own domain. I've just set up a work site with [Fastmail](https://www.fastmail.com/), and it was simple. No ads, proper privacy etc. etc. etc. Cost: five dollars a month. So, that's a clunkier set up that costs more 💪🏼.

repository: eklausme/saaze-paternoster

repo_name: eklausme/saaze-paternoster


text:
---
id: version-1.7.0-wordpress-pages-configuration
title: Pages Configuration
original_id: wordpress-pages-configuration
---

Here is the list of the page types you can assign to each page of your Webflow project:

## WordPress Pages
- **Home** (this is the home page of your website, usually index.html);
- **Standard Template** (pre-styled template used as default template to create other pages);
- **Generic** (this is the WordPress single page that is used for example to create typical "About us" or "Contact us" page)
- **Template** (pre-styled page that can be chosen to create other pages directly from WordPress).

## Blog Pages

- **Single Post** (the page that shows the single post of your WordPress blog);
- **Blog Archive** (the page where all your blog posts will be visible, it must have the element Blog Archive or Masonry Blog Archive inside);
- **Template for single post** (pre-styled page that can be chosen to style a post of your blog differently;
- **Specific Tag Page** (used to style a specific tag archive page of your blog. *The page must be named as the slug of the tag*);
- **Specific Category Page** (used to style a specific category archive page of your blog. *The page must be named as the slug of the category*);

## Search Pages
- **Search Results** (page used to show the search results of a specific query, it must have the element Search Results inside).

## WooCommerce Pages
- **Shop** (this is the Shop page in which you can manage all the products included in your storage);
- **Single Product** (this page illustrates the card of the single product and all its specifications);
- **Category** (Used to style a specific category archive page of your shop, the page must be named as the slug of the category);
- **Tag** (Used to style a specific tag archive page of your shop, the page must be named as the slug of the tag);
- **Single Product Template** (pre-styled page that can be choosen to style a product of your shop differently);
- **Search Results** (page used to show the search results of a specific query within WooCommerce, it must contain the element “Search Results”).

## Easy Digital Downloads Pages
- **Downloads Archive** (this is the page where all your EDD downloads will be visible, it must have the Downloads element inside);
- **Single EDD Download** (the page showing the single EDD Download);
- **Template for Single EDD Download** (choose your own template to stylize some EDD Downloads differently, from WordPress directly);
- **Specific EDD Download Category** (used to style an EDD specific category archive page, the page must be named as the slug of the category);
- **Specific EDD Download Tag** (used to style an EDD specific tag archive page, the page must be named as the slug of the category );
- **EDD Search Results** (page used to show the search results of a specific query, it must contain the element "Search Results").

## Utility Pages
- **Utility** (page used to create the typical server error pages, for example 404-Not found);
- **Maintenance** (it is a temporary placeholder to use when a site needs to be offline for updates, backups or maintenance);
- **Do not convert** (the selected page won't be converted. This prevents the presence of the page in the generated theme, usually used for some automatically generated Webflow pages).

## Custom Post Type Pages
- **Archive for Custom post Type** (custom post type are content types like posts and pages. This is the page where all your Custom Post Type posts will be visible. It must have the element Archive Posts inside. *The page must be named "archive-the name of your custom post type slug"*);
- **Single Custom Post Type page** (this is the page that shows your Custom Post Type single post. *The page must be named "detail_the name of your custom post type slug"*);
- **Template for Custom Post Type** (this is a pre-styled page that can be chosen to style a post of your custom post type differently. *The page must be named "template-the name of your custom post type slug"*).

repository: BGDV-HQ/udesly-docs

repo_name: BGDV-HQ/udesly-docs


text:
# ResonantHPC

[![CI Testing](https://github.com/Kitware/resonanthpc/workflows/CI%20Testing/badge.svg)](https://github.com/Kitware/resonanthpc/actions?query=workflow%3A%22CI+Testing%22)

Please visit our website: [kitware.github.io/resonanthpc/](https://kitware.github.io/resonanthpc/)

ResonantHPC is designed to increase scientific productivity by providing HPC
capable pre-and-post processing for easier and faster turnaround and
integration with modern and next-generation simulation systems.
This system will extend the standard scientific computing environment
(Jupyter) so that researchers can prepare, execute, and analyze the results
of remote exascale-level simulation from their workstations.

ResonantHPC will:
* provide a data integration module that enables pulling data from
  heterogeneous sources as well as running required preprocessing.
* include a modeling interface that enables the user to generate
  an input mesh (through the execution of an external mesher) and
  to associate additional attributes to mesh elements.
* enable, through a simple user interface, the execution
  and monitoring of HPC jobs such as preprocessing, simulation and
  visualization modules.
* incorporate a leading parallel analysis and visualization module.
* run inside a web browser and provide both user interface and
  scripting access to its functionality.

## Acknowledgment

This material is based upon work supported by the U.S. Department of Energy, Office of Science, Office of Acquisition and Assistance, under Award Number DE-SC0020503

## Project Team

- [Aashish Chaudhary](https://github.com/aashish24) - Kitware, Inc.
- [Bane Sullivan](https://github.com/banesullivan) - Kitware, Inc.
- [John Tourtellott](https://www.kitware.com/john-tourtellott/) - Kitware, Inc.
- [Dan Lipsa](https://www.kitware.com/dan-lipsa/) - Kitware, Inc.
- [David Moulton](https://github.com/jd-moulton) - Los Alamos National Laboratory
- [Dipankar Dwivedi](https://eesa.lbl.gov/profiles/dipankar-dwivedi/) - Lawrence Berkeley National Laboratory

## Software Utilized

The following are a list of the open-source software we are utilizing in this
effort.

- [ParaView](https://www.paraview.org)
- [Amanzi and ATS](https://amanzi.github.io)
- [Computational Model Builder](https://www.computationalmodelbuilder.org)
- [SMTK](https://smtk.readthedocs.io/en/latest/)
- [LaGriT](https://lanl.github.io/LaGriT/)
- [Project Jupyter](https://jupyter.org)

## Connections

In addition to this repository, several other tools are being developed for
this effort. Please take a look at these connected repositories:

- [`ipyvtk_simple`](https://github.com/Kitware/ipyvtk-simple)
- [`ipyparaview`](https://github.com/Kitware/ipyparaview)

## Project Concept and Goal

ResonantHPC is building a turnkey platform for model-data integration that
simplifies access to data and processing, simulation model input generation,
and validation across scientific computing workflows.
This project is focused on providing open-source tools to model input
generation, run models easily at scale, and then interactively visualize models
using world-class ParaView and Jupyter. Our current efforts are focused on
providing this workflow for the [Amanz/ATS](https://amanzi.github.io)
hydrological simulation software.

![workflow](docs/assets/img/workflow.png)

The left side of this workflow entails defining the input parameters to set up
the simulation in Computational Model Builder.

![cmb](docs/assets/img/cmb.png)

We then run the simulation with the defined problem, yield results and provide
an end-to-end platform for running simulations and visualizing their results.

![ipyparaview](docs/assets/img/ipyparaview.png)

repository: Kitware/resonanthpc

gha_language: Python

repo_name: Kitware/resonanthpc


text:
# Healthcare Stock Analysis
> Project to analyze and predict stock prices of Healthcare companies.
> Live demo on Google Colab [_here_](https://colab.research.google.com/drive/1ua6hSK3-e3-JxLUcDDsWIj5_5LUj_g4O?usp=sharing). <!-- link to hosted project -->

## Table of Contents
* [General Info](#general-information)
* [Technologies Used](#technologies-used)
* [Features/Insights Generated](#features-insights-generated)
* [Screenshots](#screenshots)
* [Setup](#setup)
* [Usage](#usage)
* [Project Status](#project-status)
* [Room for Improvement](#room-for-improvement)
* [Acknowledgements](#acknowledgements)
* [Contact](#contact)
* [License](#license)

## General Information
- I applied ETL process for 4 Healthcare companies’ stock closing prices (MOH, ANTM, HUM, UNH) historical data from Yahoo Finance and analyzed the data.
- I built and deployed Deep Learning model to make prices prediction as a Microservice using Python FastAPI.
- I decided to choose Molina Healthcare, Inc. (MOH), Anthem, Inc. (ANTM), Humana Inc. (HUM), and UnitedHealth Group Incorporated (UNH) as my 4 stock prices to work on because they are among the largest and most dominant companies in the Healthcare insurance industry of the United States. Therefore, I think it would be very fascinating to predict, analyze and obtain some insights about their stock prices.

## Technologies Used
- Python - version 3.9
- Python FastAPI - version 0.65.2
- Tensorflow - version 2.6.0

## Features Insights Generated
- Correlation Matrices showed the relationship among the targeted stocks.
- Price prediction for UNH stock by a Neural Network model using Tensorflow and deployed using Python FastAPI.

## Screenshots
![Example screenshot](./img/demo.png)

## Setup
The project requirements/dependencies are listed in [_requirements.txt_](./requirements.txt) in this project.

## Usage
The code was generated by Google Colab, to try out this project: go to [_this project Google Colab link_](https://colab.research.google.com/drive/1ua6hSK3-e3-JxLUcDDsWIj5_5LUj_g4O?usp=sharing), make a copy then explore with the [_OriginalStock.csv_](./OriginalStock.csv) in this project.

## Project Status
Project is: _in progress_ for improvement.

## Room for Improvement
Room for improvement:
- Improvement by working on the the front end
- Deploy this project using Docker or others

To do:
- Work on React
- Learn and apply Docker

## Acknowledgements
This project was inspired by many Data Scientists working at the Hewlett Packard Enterprise Data Science Institute and in Healthcare Industry.

## Contact
Created by Anh Nguyen - [aqnguy30](https://github.com/aqnguy30) -<EMAIL_ADDRESS>- feel free to contact me!

## License
This project is open source and available under the [Apache License 2.0](./LICENSE).

gha_language: Jupyter Notebook


text:
# MixUp
An Android app for creating photo collages. This app demonstrates NavigationUI, Espresso testing, Robolectric testing, custom views, low-level UI manipulation, and more.

## Play Store
You can download MixUp on the Google Play store [here](https://play.google.com/store/apps/details?id=com.gerardbradshaw.v2mixup)

## Building from Source
You can also build the releases from the source for added security or beta versions.

Start by getting a copy of the master branch. You can download it from [Github](https://github.com/GerardBradshaw/MixUp/tree/master) or clone it by running:
```shell
git clone -b master https://github.com/GerardBradshaw/MixUp.git
```


text:
# Welcome to virusCounter
You may have been been imagining how anti-virus software monitors the activities of all the processes in real time for long time, not getting the correct solution. Actually, the anti-virus loaded a **module**([Loadable Kernel Module](https://en.wikipedia.org/wiki/Loadable_kernel_module), LKM) into the kernel, intercepting the **system calls**. [System calls](https://en.wikipedia.org/wiki/System_call) are collections of API(Application Programming Interface) provided by kernel, including the most common I/O command **open**, **read**, **write** and others. Aha, you may now realized that how smart the anti-virus softwares are. The wrap a jacket on top of original system calls, performing virus checking codes.

The virtusCounter implemented an anti-virus LKM, monitoring characteristics code among difference I/O processes.

The sandBoxer enabled user to run unsafe software under limited privileges by modifying User ID of process through LKM, and also implement executable to check the modified process UID.

## Getting Started
### The Anti-Virus module

#### For linux

1. Compile the module and test program if you haven't yet:

  ```
  cd phase1
  sudo make
  ```

2. Open any file include the **VIRUS** character:

  ```
  nano test2.txt
  ```

3. Display the system log about virus detection history:

  ```
  grep 'mal' /var/log/syslog
  ```

4. Remove module and clean up files:

  ```
  sudo make clean
  ```

### The shift to user id module
#### For linux
1. Compile the module and user space program if you haven't yet:

  ```
  cd phase2
  sudo make
  ```

2. Run shift2uid program:

  ```
  ./shift2user -u [uid] -p [pid]
  ```

2. Run getloginuid program:

  ```
  ./getloginuid -p [pid]
  ```

3. Display the system log

  ```
  dmesg
  ```

4. Remove module and clean up files:

  ```
  sudo make clean
  ```

## Contributing

We encourage everyone to interact in virusCounter and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists.

## The authors
[Yang liu](https://github.com/byliuyang) (Harry) from [Worcester Polytechnic Institute](http://www.wpi.edu/academics/cs/)

[Huyen Nguyen](https://github.com/HuyenNguyen2302) from [Worcester Polytechnic Institute](http://www.wpi.edu/academics/cs/)

## License
virusCounter are released under the [MIT License](http://opensource.org/licenses/MIT).

repository: my-course-work/virusCounter

repo_name: my-course-work/virusCounter


text:
# Minibench

A simple harness for benchmarking JavaScript code.

Supports both synchronous and asynchronous code being benchmarked, plus both sync/async setup and teardown logic.

## Sample

See `sample-benchmarks.js`. To run it, serve `sample.html` from a local webserver.

## Caveats

Absolutely no support provided.

## License

MIT

repository: dotnet/aspnetcore

repo_name: dotnet/aspnetcore


text:
---
layout: post
title: 'Rails <IP_ADDRESS> has been released!'
categories: releases
author: rafaelfranca
published: true
date: 2019-12-18 16:25:51 -03:00
---
Hi everyone,

I am happy to announce that Rails <IP_ADDRESS> has been released. This is a complementary release to
rack in order to address [CVE-2019-16782](https://www.openwall.com/lists/oss-security/2019/12/18/2).

## CHANGES since 6.0.2

To view the changes for each gem, please read the changelogs on GitHub:
* [Action Cable CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/actioncable/CHANGELOG.md)
* [Action Mailbox CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/actionmailbox/CHANGELOG.md)
* [Action Mailer CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/actionmailer/CHANGELOG.md)
* [Action Pack CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/actionpack/CHANGELOG.md)
* [Action Text CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/actiontext/CHANGELOG.md)
* [Action View CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/actionview/CHANGELOG.md)
* [Active Job CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/activejob/CHANGELOG.md)
* [Active Model CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/activemodel/CHANGELOG.md)
* [Active Record CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/activerecord/CHANGELOG.md)
* [Active Storage CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/activestorage/CHANGELOG.md)
* [Active Support CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/activesupport/CHANGELOG.md)
* [Railties CHANGELOG](https://github.com/rails/rails/blob/v<IP_ADDRESS>/railties/CHANGELOG.md)

To see a summary of changes, please read the release on GitHub:

[<IP_ADDRESS> CHANGELOG](https://github.com/rails/rails/releases/tag/v<IP_ADDRESS>)

*Full listing*

To see the full list of changes, [check out all the commits on
GitHub](https://github.com/rails/rails/compare/v6.0.2...v<IP_ADDRESS>).

## SHA-256

If you'd like to verify that your gem is the same as the one I've uploaded,
please use these SHA-256 hashes.

Here are the checksums for <IP_ADDRESS>:

```
$ shasum -a 256 *-<IP_ADDRESS>.gem
3eedea1285b08d40762a14a122dc5a9c1d6226526f8380dc4ac0d0f4ef086dbe  actioncable-<IP_ADDRESS>.gem
6132861d7706cefed207817d6a097e3e991e5656bdefd5b2c927e88465b957f7  actionmailbox-<IP_ADDRESS>.gem
13e6eb571bc3764859982d5b3f19f43c88969e99cf5fa4b42696d962b85d2d84  actionmailer-<IP_ADDRESS>.gem
df65fc4db1eb21dad71a0c73b9acf21373644580787e2eecd68fb6244af95ebd  actionpack-<IP_ADDRESS>.gem
7857e4f1242ca2064d0b24154fb1d2d05537e24ec78b31ccd51eab7549459c09  actiontext-<IP_ADDRESS>.gem
ccc69763b6d02069a2c5fef62a08d247620e0f9213ce3eaaa79118384141230c  actionview-<IP_ADDRESS>.gem
11dc8701c7d5b80572786e928e264f42cb1ab75b07957955f41d4d367074b0cd  activejob-<IP_ADDRESS>.gem
6d138b1e3e5f009b5fa9a0587f65f25ff58ef42e6a95a3f720fc53caa2aaf84b  activemodel-<IP_ADDRESS>.gem
083928e6fda8b886f24c198d37a6e9e0a077c1bf178ae76668a973175b6b578b  activerecord-<IP_ADDRESS>.gem
e88e5ae590df2fcf7fe3cf4bdd1822dc95841dd1c10fcb5fe26cb66799ce235a  activestorage-<IP_ADDRESS>.gem
817e19e0ce4bc8c6afc63ed064ea84d0e3c8a2ee3d8fb1bb86ab39670c7ca6b5  activesupport-<IP_ADDRESS>.gem
32a07bc27a22c80752847936aa52497c5d97de9c577b1120a2e897dda77f93b0  rails-<IP_ADDRESS>.gem
8f6b9622975fc0f4807770b0633c9998c54ff59a98045a78f6fab110d87bcd66  railties-<IP_ADDRESS>.gem
```

As always, huge thanks to the many contributors who helped with this release.

repository: rails/weblog

branch_name: refs/heads/gh-pages

repo_name: rails/weblog


text:
# otis: HTTP request rewriting engine

**otis** is an Erlang application to be used with an HTTP agent to
rewrite requests.

Rewrite rules are expressed in a YAML configuration file. The rules are
used to generate and compile an Erlang module at runtime. This module
can be regenerated on-the-fly to change the rules. Thanks to this, the
overhead of the rewrite engine remains very low.

Currently, only [Yaws](http://yaws.hyber.org/) is supported. But the
glue between the HTTP agent and otis is isolated in a separate module,
so it's easy to add support for another web server.

otis is distributed under the terms of the **2-clause BSD license**; see
`COPYING`.

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

## Installation

### Rebar

If you use rebar, you can run the following command to build the
application:
```bash
rebar get-deps
rebar compile
```

### Autotools

Requirements:
* [yamerl](https://github.com/yakaz/yamerl)
* [Yaws](http://yaws.hyber.org/)

If you use the Autotools and `make(1)`, run the following commands to
build the application:
```bash
# Generate Autotools files.
autoreconf -vif

# Build the application.
./configure
make

# Install it.
sudo make install
```

The default installation path is your Erlang's distribution libraries
directory (see `code:lib_dir()`).

## Getting started

Before using otis, the application must be started:
```erlang
application:start(yamerl),
application:start(otis).
```

### Specifying a rules configuration file

Once you have a rules configuration file ready (see below for its
syntax), you have two ways of specifying its path to otis:

* Pass the filename to `otis:reload_engine/1`:
    ```erlang
    otis:reload_engine("/path/to/rules.yaml").
    ```

* Use the `config` application environment parameter. Here's an example
    in `sys.config`:
    ```erlang
    %% sys.config
    [
        {otis, [
            {config, "/path/to/rules.yaml"}
        ]}
    ].
    ```

### Configuring Yaws

Currently, the rewrite engine is global to all virtual hosts, but you
can use conditions to only affect a particular vhost.

To enable the rewrite engine, add the following directive to any
relevant virtual hosts:
```
<server www.example.com>
    ...
    arg_rewrite_mod = otis_yaws_mod_rewrite
    ...
</server>
```

### Writing rules

The file uses a [YAML](http://www.yaml.org/) syntax. Here's a simple
example:
```yaml
- name: www.example.com/myaccount is handled by /core/accounts.php
  rule:
    - eq:
        $(HOST): "www.example.com"
    - eq:
        $(PATH): "/myaccount"
    - set:
        $(PATH): "/core/accounts.php"
```

You can test this rule from the Erlang shell:
```erlang
%% Start otis and load rules.
application:start(yamerl).
application:start(otis).
otis:reload_engine("/path/to/rules.yaml").

otis_reqrw_engine:uri("http://www.example.com").
%% Return: "http://www.example.com/"

otis_reqrw_engine:uri("http://www.example.com/myaccount").
%% Returns: "http://www.example.com/core/accounts.php"
```

One important difference compared to Apache's `mod_rewrite` is that
**a matching rule is final, unless specified otherwise**! This is the
opposite to `mod_rewrite`.

### Reloading rules

* If you use the `config` application environment parameter:
    ```erlang
    otis:reload_engine().
    ```

* If you don't use the `config` parameter:
    ```erlang
    otis:reload_engine("/path/to/rules.yaml").
    ```

If an error occurs while loading the new rules, the previous set of
rules remains active.

## Complete documentation

See the `doc` subdirectory for a complete user guide and reference manual.

repository: yakaz/otis

repo_name: yakaz/otis


text:
# Neo4j Flex Templates

This project contains FlexTemplates that facilitate loading files within
Google Cloud Platform to the Neo4j graph database.

## Version History

a 0.1 - initial PR

b 0.1 - updates solved dependency challenges

b 0.11 - made properties in transposed/compact syntax, optional

b 0.12 - throw RuntimeException from failed actions

## Project Introduction

Neo4j has released flex templates for GCP Dataflow which support complex ETL
processes through configuration not code. This capability fills a gap for joint
GCP and Neo4j customers who are looking for cloud native data integration
without having to manage Spark services. Over the past decade, graph databases
have become an invaluable tool for discovering fraud, understanding network
operations and supply chains, disambiguating identities, and providing
recommendations – among other things. Now, BigQuery and Google Cloud
Storage customers will be able to easily leverage graphs to mine insights in the
data.

There are many ways to move data into Neo4j. The most popular approach for bulk
loading Neo4j is the LOAD CSV cypher command from any client connection such as
Java, Python, Go, .NET, Node, Spring and others. Data scientists tend to favor
the Neo4j Spark connector and Data Warehouse connector, which both run on
DataProc and are easily incorporated into python notebooks. For individual
users, the graphical ETL import tool is very convenient and for enterprises
needing lifecycle management, Apache Hop, a project co-sponsored by Neo4j, is a
great option.

The Dataflow approach is interesting and different for a few reasons. Although
it requires a customized JSON configuration file, that’s all that is required.
No notebooks, no Spark environment, no code, no cost when the system is idle.
Also, Dataflow runs within the context of GCP security so if a resource is
accessible to the project and service account there is no need to track and
secure another resource locator and set of credentials. Finally, the Neo4j flex
template implements Neo4j java API best practices.

These features make this solution ideal for copy-and-paste re-use between
customer environments. For example, a best-practices mapping that loads Google
Analytics (GA) from BigQuery to Neo4j could be leveraged by any GA customer.
ISVs may leverage this capability to move their solutions to the Google cloud
and Google Data Lake adopters will accelerate their adoption of graph as an
essential side-car service in their reference data architectures.

## Executing Template Example

The template requires the following parameters:

* jobSpecUri: GCS hosted job specification file
* neo4jConnectionUri: GCS hosted Neo4j configuration file
* inputFilePattern: (Optional) Job spec source override with GCS text file
* readQuery: (Optional) Job spec source override with query
* optionsJson: (Optional) JSON formatted string to supply runtime variables that
  replace `$` delimited variables

Template can be executed using the following gcloud command:

```sh
export PROJECT=<my-project>
export IMAGE_NAME_VERSION=b0.12
export TEMPLATE_SPEC_GCSPATH="gs://neo4j-dataflow/flex-templates/images/googlecloud-to-neo4j-image-spec-${IMAGE_NAME_VERSION}.json"
export REGION=us-central1
export MACHINE_TYPE=n2-highmem-8

gcloud dataflow flex-template run "googlecloud-to-neo4j-text-cli-`date +%Y%m%d-%H%M%S`" \
    --project "$PROJECT" \
    --region "$REGION" \
    --template-file-gcs-location="TEMPLATE_SPEC_GCSPATH" \
    --parameters jobSpecUri="gs://neo4j-dataflow/job-specs/testing/text/text-northwind-jobspec.json" \
    --parameters neo4jConnectionUri="gs://neo4j-dataflow/job-specs/testing/connection/auradb-free-connection.json" \
    --parameters workerMachineType="$WORKER_MACHINE" \
    --max-workers=1
```

## Building Project

The following code allows creating a new FlexTemplate image and the JSON template files that drives DataFlow template UI and also

#### Compiling the pipeline

Execute the following command from the directory containing the root pom.xml:

```sh
mvn clean compile -pl v2/googlecloud-to-neo4j -am -DskipTests
```

Running spotless from root

```sh
mvn -pl v2/googlecloud-to-neo4j spotless:apply
```

#### Executing unit tests

Execute the following command from the directory containing the root pom.xml:

```shell script
mvn clean test -pl v2/googlecloud-to-neo4j -am
```

### Building Container Image

* Set environment variables that will be used in the build process.
* Note that /template is the working directory inside the container image

```sh
export PROJECT= [YOUR_PROJECT_ID]
export APP_NAME=googlecloud-to-neo4j
export REGION=us-central1
export MACHINE_TYPE=n2-highmem-8
export IMAGE_NAME=neo4j-dataflow
export IMAGE_NAME_VERSION=b0.12
export BUCKET_NAME= [URI FOR CLOUD STORAGE BUCKET AND FOLDER (ex. gs://bucket-name/folder-name)]
export TARGET_GCR_IMAGE=us.gcr.io/${PROJECT}/${IMAGE_NAME}-${IMAGE_NAME_VERSION}
export BASE_CONTAINER_IMAGE=gcr.io/dataflow-templates-base/java11-template-launcher-base
export BASE_CONTAINER_IMAGE_VERSION=latest
export TEMPLATE_POM_MODULE=googlecloud-to-neo4j
export APP_ROOT=/template/${APP_NAME}
export COMMAND_SPEC=${APP_ROOT}/resources/${APP_NAME}-command-spec.json
export TEMPLATE_IMAGE_SPEC=${BUCKET_NAME}/images/${APP_NAME}-image-spec-${IMAGE_NAME_VERSION}.json
gcloud config set project ${PROJECT}
```

* Build and push image to Google Container Repository
* Execute the following command from the directory containing the root pom.xml:

```sh
mvn -DskipTests=true clean install \
    -pl v2/${TEMPLATE_POM_MODULE} \
    -am \
    -Djib.container.mainClass=com.google.cloud.teleport.v2.neo4j.templates.GoogleCloudToNeo4j \
    -Dimage=${TARGET_GCR_IMAGE} \
    -Dbase-container-image=${BASE_CONTAINER_IMAGE} \
    -Dbase-container-image.version=${BASE_CONTAINER_IMAGE_VERSION} \
    -Dapp-root=${APP_ROOT} \
    -Dcommand-spec=${COMMAND_SPEC}
```

### Creating Image Spec

Create file in Cloud Storage with path to container image in Google Container
Repository.

```sh
echo "{
  \"image\": \"${TARGET_GCR_IMAGE}\",
  \"metadata\": {
    \"name\": \"Google Cloud to Neo4j\",
    \"description\": \"Copy data from Google Cloud (BigQuery, Text) into Neo4j\",
    \"parameters\": [
      {
        \"name\": \"jobSpecUri\",
        \"label\": \"Job configuration file\",
        \"helpText\": \"Configuration, source and target metadata\",
        \"paramType\": \"TEXT\",
        \"isOptional\": false
      },
      {
        \"name\": \"neo4jConnectionUri\",
        \"label\": \"Neo4j connection metadata\",
        \"helpText\": \"Neo4j connection metadata json file\",
        \"paramType\": \"TEXT\",
        \"isOptional\": false
      },
      {
        \"name\": \"inputFilePattern\",
        \"label\": \"Text file\",
        \"helpText\": \"Override text file pattern (optional)\",
        \"paramType\": \"TEXT\",
        \"isOptional\": true
      } ,
      {
        \"name\": \"readQuery\",
        \"label\": \"Query SQL\",
        \"helpText\": \"Override SQL query (optional)\",
        \"paramType\": \"TEXT\",
        \"isOptional\": true
      } ,
      {
        \"name\": \"optionsJson\",
        \"label\": \"Options JSON\",
        \"helpText\": \"Runtime tokens like: {token1:value1,token2:value2}\",
        \"paramType\": \"TEXT\",
        \"isOptional\": true
      }
      ]
    },
    \"sdk_info\": {
       \"language\": \"JAVA\"
    }
  }" > ./v2/googlecloud-to-neo4j/docs/${APP_NAME}-image-spec-${IMAGE_NAME_VERSION}.json
gsutil cp ./v2/googlecloud-to-neo4j/docs/${APP_NAME}-image-spec-${IMAGE_NAME_VERSION}.json ${TEMPLATE_IMAGE_SPEC}
```

## Rewrite default image to latest
```sh
cp ./v2/googlecloud-to-neo4j/docs/${APP_NAME}-image-spec-${IMAGE_NAME_VERSION}.json ./v2/googlecloud-to-neo4j/docs/${APP_NAME}-image-spec.json
gsutil cp ./v2/googlecloud-to-neo4j/docs/${APP_NAME}-image-spec-${IMAGE_NAME_VERSION}.json ${BUCKET_NAME}/images/${APP_NAME}-image-spec.json
```

## Other resources

    https://cloud.google.com/sdk/gcloud/reference/dataflow/flex-template/build
    https://cloud.google.com/sdk/gcloud/reference/dataflow/flex-template/run

repository: GoogleCloudPlatform/DataflowTemplates

gha_language: Java

repo_name: GoogleCloudPlatform/DataflowTemplates


text:
# Open Exposure Data (OED)

The OED format was developed by a working group of industry practitioners chaired by Matthew Jones with the technical work led by Aiste Kalinauskaite, as a robust and documented input framework for Oasis based platforms and models.

Responsibility for OED has been handed over from NASDAQ to Oasis LMF who now curate and govern this standard - so there will be no further changes to the assets in this repository.

The new repository for Open Data Standards, including OED can be found at:

Open Data Standards

The content of the Open Exposure Data (OED) format itself is licensed under the CC0 1.0 Universal license.

Any related MS SQL scripts provided and used to generate the relational database structure are licensed under the MIT license.

View the full license.

repository: Simplitium/OED

repo_name: Simplitium/OED


text:
See https://www.idupree.com/README

Run `./setup.py develop` to create a symlink-like thing
in your python package directory to here, so that you can
include these modules in your code, and git pull and push
and edit this library code to your liking.

You may want to use a virtualenv (`virtualenv` or `pyvenv`).
It's up to you.

Outside a virtualenv, you can use `./setup.py develop --user`.

repository: idupree/idupree-websitepy

repo_name: idupree/idupree-websitepy


text:
---
currentMenu: configuration
parentMenu: manager
---

#Configuration

## What to configure

* the Data Analyzer public endpoint IP address
* the Data Analyzer public endpoint port
* the Manager endpoint IP address
* the Manager endpoint port
* the RDF History DB IP address
* the RDF History DB Port

## How to configure

The monitoring manager can be configured by means of different options (latters replaces the formers):
* Default Configuration
* Environment Variables
* System Properties
* CLI Arguments

### Default Configuration

* the Data Analyzer public endpoint IP address: `<IP_ADDRESS>`
* the Data Analyzer public endpoint port: `8175`
* the Manager endpoint IP address: `<IP_ADDRESS>`
* the Manager endpoint port: `8170`
* the RDF History DB IP address: none
* the RDF History DB Port: `31337`

** If no RDF History DB IP address is specified, the manager assumes there is no RDF History DB and the model updates will not be saved on it **

### Environment Variables

* the Data Analyzer public endpoint IP address: `MODACLOUDS_TOWER4CLOUDS_DATA_ANALYZER_ENDPOINT_IP_PUBLIC`
* the Data Analyzer public endpoint port: `MODACLOUDS_TOWER4CLOUDS_DATA_ANALYZER_ENDPOINT_PORT_PUBLIC`
* the Manager endpoint IP address: `MODACLOUDS_TOWER4CLOUDS_MANAGER_ENDPOINT_IP`
* the Manager endpoint port: `MODACLOUDS_TOWER4CLOUDS_MANAGER_ENDPOINT_PORT`
* the RDF History DB IP address: `MODACLOUDS_TOWER4CLOUDS_RDF_HISTORY_DB_ENDPOINT_IP`
* the RDF History DB Port: `MODACLOUDS_TOWER4CLOUDS_RDF_HISTORY_DB_ENDPOINT_PORT`

### System Properties

Same values used for Environment Variables.

### CLI Arguments

Usage available by running `./tower4clouds-manager -h`:

```bash
Usage: tower4clouds-manager [options]
  Options:
    -h, --help
       Shows this message
       Default: false
    -v, --version
       Shows the version number
       Default: false
    -daip
       Data Analyzer public endpoint IP address
       Default: <IP_ADDRESS>
    -daport
       Data Analyzer public endpoint port
       Default: 8175
    -manip
       Manager endpoint IP address
       Default: <IP_ADDRESS>
    -manport
       Manager endpoint port
       Default: 8170
    -rdf-history-db-ip
       RDF History DB endpoint IP address
    -rdf-history-db-port
       RDF History DB endpoint port
       Default: 31337
```


text:
# Description

This directory contents source code and the Rust's mid-level intermediate representation
(MIR) of the application (Redox-relibc. [GitLab](https://gitlab.redox-os.org/redox-os/relibc)),
which has four previously unknown use-after-free bugs detected by our use-after-free detector. (Sec. 7.1. Lines 1228-1229).

## relibc

This directory contents the source code of the relibc version we used for PLDI'20 submission.

## relibc_mir_detected_bugs

You can directly run our use-after-free detector on those MIR files. The detailed
instructions is in the README file under the detector's root directory.
This directory only has the MIR files of the four detected bugs mentioned Sec. 7.1.
You can dump all MIR files by

```
cd relibc
cargo clean && cargo rustc -- -Zdump-mir="PreCodegen"
```

repository: system-pclub/rust-study

repo_name: system-pclub/rust-study


text:
# Sharder

## Overview
Sharder is an image that knows how to shard HTTP requests out to a list of
servers, optionally sharding only on things that match a certain regular
expression.

## Usage
Sharder has three parameters that can be supplied as environment variables:
   * `SHARD_ADDRESSES` - Required - A comma separated list of shards to pass to
   * `PATH_REGEXP` - Optional - A reglar expression containing a group, anything matching the group is used hashed to get the shard, anything not in that group is ignored.  If the regexp doesn't match, the entire original path is used.
   * `SERVER_ADDRESS` - Optional - The <host>:<port> to serve on, default is
`localhost:8080`

## Examples

```
docker run -e SHARD_ADDRESSES=http://localhost:8001,http://localhost:8002 brendanburns/sharder:<hash>
```

Shard to two different sites, hashing the entire HTTP Path

```
docker run -e SHARD_ADDRESSES=http://localhost:8001,http://localhost:8002 -e "PATH_REGEXP=.*/(foo/[^/]*)/.*"brendanburns/sharder:<hash>
```

Shard to two different sites, hashing on `foo/.*` extracted from the path.

repository: metaparticle-io/container-lib

repo_name: metaparticle-io/container-lib


text:
# Deployment

- [Prerequisites](#prerequisites)
- [Build Images](#build-images)
- [Deploy Database](#deploy-database)
- [Run Db migration](run-db-migration)
- [Deploy API Service](#deploy-api-service)
  - [Update API Secret](#update-api-secret)
  - [Update API ConfigMap](#update-api-configmap)
  - [Update API Image](#update-api-image)
  - [Setup Ingress/Route](#setup-route-or-ingress)
- [Deploy UI](#deploy-ui)
  - [Update UI ConfigMap](#update-ui-configmap)
  - [Update UI Image](#update-ui-image)
  - [Setup Ingress/Route](#setup-route-or-ingress)
- [Add resources in DB](#add-resources-in-db)
- [Setup Catalog Refresh CronJob](#setup-catalog-refresh-cronjob)
- [Adding New Users in Config](#adding-new-users-in-config)
- [Deploying on Disconnected Cluster](#deploying-on-disconnected)
- [Troubleshooting](#troubleshooting)

## Prerequisites

- Kubernetes Cluster
  - You can also deploy on [Minkube][minikube], [kind][kind] or [OpenShift][openshift].
- [kubectl][kubectl]
- [docker][docker] or [podman][podman]

## Build Images

Lets build and push all images to a registry and then create deployments.

**Note** : You can use images from quay and skip the build image section.

- The image tag would be same as release tag. You can check the latest release [here](https://github.com/tektoncd/hub/releases)

- For example:

  - UI Image: quay.io/tekton-hub/ui:v1.3.0

  - DB Migration Image: quay.io/tekton-hub/db-migration:v1.3.0

  - API Image: quay.io/tekton-hub/api:v1.3.0

### UI Image

Ensure you are in `ui` directory and logged in you image registry.

```
docker build -t <image> . && docker push <image>
```

Replace `<image>` with the registry and image name.
eg. `quay.io/<username>/ui`

### API & DB Migration Image

Ensure you are in `api` directory and logged in you image registry.

Build the API image using below command

```
docker build -t <image> . && docker push <image>
```

Replace `<image>` with the registry and image name.
eg. `quay.io/<username>/api`

Now, Build the Db migration image using below command

```
docker build -f db.Dockerfile -t <image> . && docker push <image>
```

Replace `<image>` with the registry and image name.
eg. `quay.io/<username>/db-migration`

Make sure all images are public before creating deployments.

---

> ### NOTE: In case of using Github Enterprise make sure you deploy Hub in the same network where Github Enterprise server is running. Example if your Github Enterprise is running behind VPN then your Kubernetes Cluster should also be behind VPN.

---

## Deploy Database

Now, we have all images pushed to registry. Lets deploy the database first.

Navigate to `config` directoy in the root of the project.

Execute below command

```
kubectl apply -f 00-init/ -n tekton-hub
```

This will create `tekton-hub` namespace, db deployment with `postgres` image, secret to save db credentials, pvc for the db and a ClusterIP service to expose the db internally.

All resources are created in `tekton-hub` namespace.

Wait till the pod comes in a running state

```
kubectl get pod -n tekton-hub -w
```

## Run Db migration

Once the pod is in running state now we can run db migration. This will create all the tables required in the database.

Edit the `01-db/10-db-migration.yaml` and add the replace the image you created previously and apply the yaml.

```
kubectl apply -f 01-db/10-db-migration.yaml -n tekton-hub
```

This will create a job which will read the db credentials from the secret created while deploying database and create all required tables.

```bash
$ kubectl get pods -n tekton-hub
NAME                   READY   STATUS      RESTARTS   AGE
db-589d44fdd5-ksf8v    1/1     Running     0          50s
db-migration-8vhpd     0/1     Completed   0          17s
```

The `Pod` will go into `Completed` state if the job succeeds. You can also check the logs using `kubectl logs -n tekton-hub db-migration-8vhpd`. In case of any failure the `Pod` will go into `Error` state.

```bash
$ kubectl get pods -n tekton-hub
NAME                   READY   STATUS      RESTARTS   AGE
db-589d44fdd5-ksf8v    1/1     Running     0          50s
db-migration-8vhpd     0/1     Error       0          17s
```

## Deploy API Service

### Update API Secret

Edit `02-api/20-api-secret.yaml` and update the configuration

- Create a GitHub OAuth with `Homepage URL` and `Authorization callback URL` as `http://localhost:5000`. We will update this URL once we deploy the UI pod. Follow the steps given [here][oauth-steps] to create a GitHub OAuth.
- After creating the OAuth add the Client ID and Client Secret in the yaml file.
- For JWT_SIGNING_KEY, you can add any random string, this is used to sign the JWT created for users.
- For `ACCESS_JWT_EXPIRES_IN` and `REFRESH_JWT_EXPIRES_IN` add time you want the jwt to be expired in. Refresh time should be greater than Access time.
  eg. 1m = 1 minute, 1h = 1 hour, 1d = 1 day

```yaml
apiVersion: v1
kind: Secret
metadata:
  name: api
  namespace: tekton-hub
type: Opaque
stringData:
  GH_CLIENT_ID: Oauth client id
  GH_CLIENT_SECRET: Oauth secret
  JWT_SIGNING_KEY: a-long-signing-key
  ACCESS_JWT_EXPIRES_IN: time such as 15m
  REFRESH_JWT_EXPIRES_IN: time such as 15m
  GHE_URL: Add Github Enterprise URL in case of authenticating through Github Enterprise (Example (https|http)://myghe.com) --> Do not provide the catalog URL
```

### Update API ConfigMap

- Update the [config.yaml][config-yaml] to add at least one user with all scopes such as

  - refresh a catalog,
  - refresh config file
  - create an agent token

- For example

```
scopes:
  - name: agent:create
    users: [foo]        <<< Where `foo` is your Github Handle
  - name: catalog:refresh
    users: [foo]
  - name: config:refresh
    users: [foo]
```

- Commit the changes and push the changes to your fork

- Edit the `02-api/21-api-configmap.yaml` and change the URL to point to your fork. By default it is pointing to [config.yaml][config-yaml] in Hub which has Application Data.

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: api
  namespace: tekton-hub
  labels:
    app: api
data:
  CONFIG_FILE_URL: https://raw.githubusercontent.com/tektoncd/hub/master/config.yaml ## Change the file URL here
```

All users have default scopes `rating:read` and `rating:write`. Once user get login to Hub, they get the appropriate scopes which allows them to rate the resource

**WARN** : Make sure you have updated Hub config before starting the api server

### Update API Image

Edit the `02-api/22-api-deployment.yaml` and replace the image with the one created previously and executed below command

```bash
kubectl apply -f 02-api/ -n tekton-hub
```

This will create the deployment, secret, configmap and a NodePort service to expose the API server.

### Setup Route or Ingress

After the deployment is done successfully, we need to expose the URL to access the API.

- If deploying on OpenShift:-

  ```bash
  kubectl apply -f 04-openshift/40-api-route.yaml -n tekton-hub
  ```

- If deploying on Kubernetes:-

  - Create the secret containing tls cert and tls key

    ```bash
    kubectl create secret tls api-hub-tekton-dev-tls --cert=path/to/cert/file --key=path/to/key/file -n tekton-hub
    ```

  - Apply the Ingress

    ```bash
    kubectl apply -f 04-kubernetes/40-api-ingress.yaml -n tekton-hub
    ```

#### Verify if api route is accessible

For `OpenShift`:-

```bash
curl -k -X GET $(oc get -n tekton-hub routes api --template='https://{{ .spec.host }}/v1/categories')
```

NOTE: At this moment, there are no resources in the db. Only the tags and categories from hub config are added in the db.

Let's deploy the UI first and then we will add the resources in db.

## Deploy UI

### Update UI ConfigMap

Edit `config/10-config.yaml` and set your GitHub OAuth Client ID and the API URL.

You can get the API URL using below command (OpenShift)

```
  kubectl get -n tekton-hub routes api --template='https://{{ .spec.host }}'
```

```yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: ui
  namespace: tekton-hub
data:
  API_URL: API URL   <<< Update this by API url
  GH_CLIENT_ID: GH OAuth Client ID   <<< Update this OAuth client id
  API_VERSION: API VERSION  <<< Update this by API version (For e.g-"v1")
  GHE_URL: Github Enterprise URL <<< Update this if you are getting logged in via Github Enterprise
```

### Update UI Image

Edit the `03-ui/30-ui-configmap.yaml` and replace the image with the one created previously and executed below command

```bash
kubectl apply -f 03-ui/ -n tekton-hub
```

This will create the deployment, configmap and a NodePort service to expose the UI.

Ensure pods are up and running

```bash
kubectl get pods -n tekton-hub
```

eg. wait till status of UI pod is running

```
NAME                   READY   STATUS      RESTARTS   AGE
api-6dfc6f97d9-vk66r   1/1     Running     3          21m
db-9bd4cdf99-zsq89     1/1     Running     0          21m
db-migration-26ngs     0/1     Completed   0          21m
ui-55fc66cc6b-69dsp    1/1     Running     0          58s
```

### Setup Route or Ingress

After the deployment is done successfully, we need to expose the URL to access the UI.

- If deploying on OpenShift:-

  ```bash
  kubectl apply -f 04-openshift/41-ui-route.yaml -n tekton-hub
  ```

- If deploying on Kubernetes:-

  - Create the secret containing tls cert and tls key

    ```bash
    kubectl create secret tls ui-hub-tekton-dev-tls --cert=path/to/cert/file --key=path/to/key/file -n tekton-hub
    ```

  - Apply the Ingress

    ```bash
    kubectl apply -f 04-kubernetes/41-ui-ingress.yaml -n tekton-hub
    ```

#### Verify if ui route is accessible

For `OpenShift`:-

```
    kubectl get routes -n tekton-hub ui --template='https://{{ .spec.host }} '
```

Open the URL in a browser.

Note: In UI you won't be able see the resources on homepage as there are not any in the db but you should see Categories on the left side.

Update your GitHub OAuth created with the UI route in place of `Homepage URL` and `Authorization callback URL`.

## Add resources in DB

1. Login through the Hub UI. Click on `Login` on right corner and then `Sign in with GitHub/Github Enterprise`.

2. Copy the Hub Token by clicking on the user profile which is at the right corner on the Home Page

3. Call the Catalog Refresh API:

   - To refresh a catalog with name

     ```
     curl -X POST -H "Authorization: <jwt-token>" \
         <api-url>/catalog/<catalogName>/refresh
     ```

     Replace `<access-token>` with your Hub token copied from UI and replace `<api-url>` with your api pod url.

     This will give an output as below

     ```
     [{"id":1,"catalogName":"tekton","status":"queued"}]
     ```

   - To refresh all catalogs

     ```
     curl -X POST -H "Authorization: <jwt-token>" \
         <api-url>/catalog/refresh
     ```

     Replace `<access-token>` with your Hub token copied from UI and replace `<api-url>` with your api pod url.

     This will give an output as below

     ```
     [{"id":1,"catalogName":"tekton","status":"queued"}]
     ```

4. Refresh your UI, you will be able to see resources.

## Setup Catalog Refresh CronJob (Optional)

You can setup a cronjob which will refresh your db after an interval if there are any changes in your catalog.

NOTE: The catalog refresh will add new resources or update existing resource if it is updated in catalog but it doesn't delete a resource in db even if it is deleted in catalog.

1. You will need a JWT token with catalog refresh scope which can be used.

2. A User token is short lived so you can create an agent token which will not expire.

3. To create an agent, you can use the `/system/user/agent`. You will need `agent:create` scope in your JWT which has to be added in config.yaml

   ```
   curl -X PUT --header "Content-Type: application/json" \
       -H "Authorization: <access-token>" \
       --data '{"name":"catalog-refresh-agent","scopes": ["catalog:refresh"]}' \
       <api-route>/system/user/agent
   ```

   Replace `<access-token>` with your JWT, you can create an agent with any required scopes. In this case we need the agent with `catalog:refresh`. You can give any name to agent.

   This will gives an output as:

   ```
   {"token":"agent jwt token"}
   ```

   A token will be returned with the requested scopes. You can check using the jwt decoder. Use this token for the catalog refresh cron job.

4. Edit `05-catalog-refresh-cj/50-catalog-refresh-secret.yaml` and Set the Hub Token

   ```yaml
   apiVersion: v1
   kind: Secret
   metadata:
     name: catalog-refresh
     namespace: tekton-hub
   type: Opaque
   stringData:
     HUB_TOKEN: hub token
   ```

   Set the token created in last step as Hub token.

5. Apply the YAMLs

   ```
   kubectl apply -f 05-catalog-refresh-cj/ -n tekton-hub
   ```

   The cron job is configured to run every 30 min, you can change the interval in `05-catalog-refresh-cj/51-catalog-refresh-cronjob.yaml`.

## Adding New Users in Config

By default when any user login for the first time, they will have only default scope even if they are added in config.yaml. To get additinal scopes, make sure the user has logged in once.

Now, we need to refresh the config. To do that do a POST API call.

```
curl -X POST -H "Authorization: <access-token>" \
    --header "Content-Type: application/json" \
    --data '{"force": true} \
  <api-route>/system/config/refresh
```

Replace `<access-token>` with your JWT token. you must have `config-refresh` scope to call this API.

## Deploying on Disconnected Cluster

- To deploy on a disconnected cluster you need to fork the [tektoncd/catalog][catalog] or you can use your own catalog but it must follow the [Catalog TEP][catalog-tep].
- Fork the tektoncd/hub and update the [hub config][hub-config] file for your catalog details.
  - Update the catalog details with your catalog
  ```
  catalogs:
    - name: tekton
      org: tektoncd
      type: community
      url: https://github.com/tektoncd/catalog
      revision: main
  ```
  You can find the template at bottom of [hub config][hub-config] file.
- Mirror the Hub Deployment Images to the registry disconnected cluster has access to.
  You can use release images or build your own. For hub release images, you can use latest release tag as image tag. for eg. `quay.io/tekton-hub/ui:v1.3.0`. You can check the latest release [here][hub-releases].
- List of images to be mirrored

  - UI - `quay.io/tekton-hub/ui`
  - API - `quay.io/tekton-hub/api`
  - DB-Migration - `quay.io/tekton-hub/db-migration`
  - DB - `postgres:13@sha256:260a98d976574b439712c35914fdcb840755233f79f3e27ea632543f78b7a21e`

  You can mirror the images using `oc` as below

  ```
  oc image mirror quay.io/tekton-hub/ui:v1.3.0 your.registry/project/ui:v1.3.0
  ```

- Now, follow the steps from [Deploy Database Section](#deploy-database) above. Make sure you update the images in deployment files before applying.

## Troubleshooting

#### UI is not showing resources but catalog refresh is successful

- If you have insecure connection the UI might not be able to hit the API.
- So, hit the API URL in your browser `https://<api-url>` once you get the response as `status: ok`, refresh you UI.

#### UI is not showing resources but catalog refresh is successful (Console Error)

- Verify catalog refresh is successful by hitting the `/v1/resources` API using the API URL.
- If is returning resources than check for console errors on UI.
- Right click -> Inspect or (Ctrl + Shift + I) (For Chrome). Then click on console tab.
- If there is cors error then check the UI config map and the URL you have added.
- The URL should be for example `https://api.hub.tekton.dev` and not `https://api.hub.tekton.dev/` there shouldn't be `/` at the end.

[ko]: https://github.com/google/ko
[kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[kind]: https://kind.sigs.k8s.io/docs/user/quick-start/
[minikube]: https://kubernetes.io/docs/tasks/tools/install-minikube/
[openshift]: https://www.openshift.com/try
[docker]: https://docs.docker.com/engine/install/
[podman]: https://podman.io/getting-started/installation
[config-yaml]: https://raw.githubusercontent.com/tektoncd/hub/master/config.yaml
[oauth-steps]: https://docs.github.com/en/developers/apps/creating-an-oauth-app
[catalog]: https://github.com/tektoncd/catalog
[catalog-tep]: https://github.com/tektoncd/community/blob/main/teps/0003-tekton-catalog-organization.md
[hub-config]: https://github.com/tektoncd/hub/blob/main/config.yaml

repository: sudhirverma/hub

gha_language: Go

repo_name: sudhirverma/hub


text:
# Readings-Notes-Repository

## Class 01 notes for my Readings in Code Fellows 301 Course

[Back To Main](https://matthewadamstewart.github.io/readings-notes-repository/)

### [What Google Learned From Its Quest to Build the Perfect Team](https://www.google.com/amp/mobile.nytimes.com/2016/02/28/magazine/what-google-learned-from-its-quest-to-build-the-perfect-team.amp.html)
[My 201 Notes on What Google Learned From Its Quest to Build the Perfect Team](https://pale-crusader.github.io/reading-notes/class-14)

### [How I explained REST to my brother](https://gist.github.com/brookr/5977550)
* Explains structure of URL
* http is a protocol which describes location on the global web, for pages and a lot else
* explains resources and URLs
* Explains Webservices and API
* Uses those protocols without a person sitting there, allowing machines to talk to each other without a person
* explains noun, adjative and verb important

* Important explains verbs affect nouns in a syntaxually significant way that makes sense in english

* **Example:**
> ME: Well.. Take a look at your coffee table. What are the nouns? Laptop, bottle, book, paper. Now, what are some things you can do to all of these things?

> Brother: I don't understand what you mean...

> ME: You can "get" them, right? You can pick them up. You can knock them on the floor. You can burn them. You can apply those same exact verbs to any of the objects sitting there.

> Brother: Okay... so?

> ME: Well, that's important. What if instead of me being able to say to you, "get the bottle," and "get the magazine," and "get the book"; what if instead we needed to come up with different verbs for each of the nouns? I couldn't use the word "get" universally, but instead had to think up a new word for each verb/noun combination. "shmet the bottle", "mandle the magazine", "zorp the book"

* "GET is a pretty important verb", indeed it is


text:
Bundler
=======

OWIN Middleware for making use of bundling pipelines

[![Build status](https://ci.appveyor.com/api/projects/status/emu6eyfjqsk6ycxs)](https://ci.appveyor.com/project/msarchet/bundler)

Quick Start
===========

The easiest way to get started using BundlerMiddleware is to use the BundlerMiddleware.System.Web package

    Install-Package BundlerMiddleware.System.Web

Add the following line to your Startup class

    app.UseBundlerMiddleware()

Add a route pointing to the file you want to inject into to your global.asax

    BundlerRoute.Routes.FromVirtualPath("/", "~/index.html"));

Then if you have a bundle of `~/bundles/scripts` or styles `~/styles/main`

  		!!styles:~/styles/main`

      !!scripts:~/bundles/scripts!!

And that's it!

Bundler uses `!!` as syntax to look for `scripts:<bundlename>` or `styles:<bundlename>` and replaces them with the appropriate script or link tags. Since the `BundlerMiddleware.System.Web` uses the standard `System.Web.Optimization` resolvers it will insert the proper tags based on your environments debug mode.

Markdown Support
================

You can now achieve markdown conversion

    Install-Package BundlerMiddleware.Markdown

For now you need to create a seperate route table for using the markdown and then

    app.UseBundlerMarkdown(MarkdownRoutes);

If you want to use a template for your markdown you can do the following

    app.UseBundlerMarkdownWithTemplate("template.html", MarkdownRoutes);

Where the template has

    !!block content!!

at the place that you want the markdown content inserted for each route.

An example template could look like

	<!doctype html>

			<tile>Title</title>
			!!styles:~/styles/main!!

Home

			!!block content!!
			!!scripts:~/bundles/main!!

Currently templating is only provided with the markdown package. It will be moved into core and be useable throughout any Bundler middleware.

Example Project
===============

There is now a test site in this repository that shows code for using most of the current features.

[Test Project](https://github.com/msarchet/Bundler/tree/master/BundlerTestSite)

More Information
================

http://msarchet.com/using-the-asp-dot-net-bundling-pipeline-with-owin/

Roadmap
=======

This is a rough listing of planned features:

- Fluent route declarations
- Namespaced routes
- Templates everywhere
- Support for custom titles in templates, by convention
- Supoprt for nested templates

repository: msarchet/Bundler

repo_name: msarchet/Bundler