text:
---
title: A Beginner's Guide to using Typescript with React
date: '2019-05-23T20:03:01.414Z'
spoiler: Having spent the last few months developing React applications and libraries using Typescript, I thought I'd share some of the things I've learned along the way.
---

Having spent the last few months developing React applications and libraries using Typescript, I thought I'd share some of the things I've learned along the way. These are the patterns I use with Typescript and React about 80% of the time.

Is it worth learning Typescript for developing React applications? Absolutely. I've found that having robust typing has led to more reliable code and faster iteration especially within a larger codebase. You're likely to be frustrated at first, but as you work through it you'll find that the minimal extra boilderplate is very much worth it. And if you get stuck on something, remember that you can always type something as `any`. Any is your friend!

To bootstrap a react typescript project I recommend using [create-react-app](https://facebook.github.io/create-react-app/docs/adding-typescript).

```
yarn create react-app my-app --typescript
```

Alternatively, you can use [codesandbox](https://codesandbox.io/s/new).

Let's get to the examples.

#### Your basic react component with typescript

So what does a standard react component look like with typescript? Let's compare it to a standard javascript react component.

```jsx
import React from 'react'
import PropTypes from 'prop-types'

export function StandardComponent({ children, title = 'Dr.' }) {
  return (
    <div>
      {title}: {children}
    </div>
  )
}

StandardComponent.propTypes = {
  title: PropTypes.string,
  children: PropTypes.node.isRequired,
}
```

And now the typescript version:

```tsx
import * as React from 'react'

export interface StandardComponentProps {
  title?: string
  children: React.ReactNode
}

export function StandardComponent({
  children,
  title = 'Dr.',
}: StandardComponentProps) {
  return (
    <div>
      {title}: {children}
    </div>
  )
}
```

Pretty similar, eh? We've replaced our propTypes with a typescript interface. Our title prop remains optional, while a children prop is required and we've exported our interface in case another component needs reference to it.

#### Extending standard HTML attributes

If we want the parent component to be able to provide additional typed `div` attributes, such as `aria-hidden`, `style`, or `className` we can either define these in our `interface` or we can extend a built in interface. In the example below, we are saying that our component accepts any standard `div` props in addition to `title` and `children`.

```tsx
import * as React from 'react'

export interface SpreadingExampleProps
  extends React.HTMLAttributes<HTMLDivElement> {
  title?: string
  children: React.ReactNode
}

export function SpreadingExample({
  children,
  title = 'Dr.',
  ...other
}: SpreadingExampleProps) {
  return (
    <div {...other}>
      {title}: {children}
    </div>
  )
}
```

#### Handling events

We can type our event handlers to ensure that our event argument is typed properly. The below example demonstrates various ways of achieving this:

```tsx
export interface EventHandlerProps {
  onClick: (e: React.MouseEvent) => void
}

export function EventHandler({ onClick }: EventHandlerProps) {
  // handle focus events in a separate function
  function onFocus(e: React.FocusEvent) {
    console.log('Focused!', e.currentTarget)
  }

  return (
    <button
      onClick={onClick}
      onFocus={onFocus}
      onKeyDown={e => {
        // When using an inline function, the appropriate argument signature
        // is provided for us
      }}
    >
      Click me!
    </button>
  )
}
```

Unsure which argument signature to use? In your editor trying hovering your cursor over the relevant event handler prop.

#### Using Generics with your react components

This is more of an advanced feature, but one that is really powerful. Typically you'll define data types in your react components with their specific attributes. Let's say your component requires a profile object.

```tsx
interface ProfileType {
  name: string
  image: string
  age: number | null
}

interface ProfilesProps {
  profiles: Array<ProfileType>
}

function Profiles(props: ProfilesProps) {
  // render a set of profiles
}
```

But now let's imagine that you have a component which can accept an array of any type. Generics are analogous to sending a parcel in the mail. The courior (our component) doesn't need to know the exact contents of the parcel that you're sending, but the sender (parent component) expects the recipient to get the contents that they sent.

Here's how we do it:

```tsx
interface GenericsExampleProps<T> {
  children: (item: T) => React.ReactNode
  items: Array<T>
}

export function GenericsExample<T>({
  items,
  children,
}: GenericsExampleProps<T>) {
  return (
    <div>
      {items.map(item => {
        return children(item)
      })}
    </div>
  )
}
```

A bit of a weird example... but it demonstrates the point. The component accepts an array of items of any type, iterates through that array and calls children as a render function with the item object. When our parent component provides the render callback as a child, the `item` will be typed properly!

Don't get it? That's okay. I still don't fully understand generics either, but you're unlikely to need this very often. And the more you work with typescript, the more it'll make sense.

#### Typing hooks

Hooks mostly works out of the box. The two exceptions are sometimes `useRef` and `useReducer`. The below example demonstrates how we can type refs.

```tsx
import * as React from 'react'

interface HooksExampleProps {}

export function HooksExample(props: HooksExampleProps) {
  const [count, setCount] = React.useState(0)
  const ref = React.useRef<HTMLDivElement | null>(null)

  // start our timer
  React.useEffect(
    () => {
      const timer = setInterval(() => {
        setCount(count + 1)
      }, 1000)

      return () => clearTimeout(timer)
    },
    [count]
  )

  // measure our element
  React.useEffect(
    () => {
      if (ref.current) {
        console.log(ref.current.getBoundingClientRect())
      }
    },
    [ref]
  )

  return <div ref={ref}>Count: {count}</div>
}
```

Our state is automatically typed, but we have manually typed our `ref` to indicate that it will either be null or contain a `div` element. When we access our ref in our `useEffect` function, we need to ensure that it's not null.

#### Typing a reducer

A reducer is a bit more complex, but having it properly typed is really nice.

```tsx
// Yeah, I don't understand this either. But it gives us nice typing
// for our reducer actions.
type Action<K, V = void> = V extends void ? { type: K } : { type: K } & V

// our search response type
interface Response {
  id: number
  title: string
}

// reducer actions. These are what you'll "dispatch"
export type ActionType =
  | Action<'QUERY', { value: string }>
  | Action<'SEARCH', { value: Array<Response> }>

// the form that our reducer state takes
interface StateType {
  searchResponse: Array<Response>
  query: string
}

// our default state
const initialState: StateType = {
  searchResponse: [],
  query: '',
}

// the actual reducer
function reducer(state: StateType, action: ActionType) {
  switch (action.type) {
    case 'QUERY':
      return {
        ...state,
        query: action.value,
      }

    case 'SEARCH':
      return {
        ...state,
        searchResponse: action.value,
      }
  }
}

interface ReducerExampleProps {
  query: string
}

export function ReducerExample({ query }: ReducerExampleProps) {
  const [state, dispatch] = React.useReducer(reducer, initialState)

  React.useEffect(
    () => {
      if (query) {
        // emulate async query
        setTimeout(() => {
          dispatch({
            type: 'SEARCH',
            value: [{ id: 1, title: 'Hello world' }],
          })
        }, 1000)
      }
    },
    [query]
  )

  return state.searchResponse.map(response => (
    <div key={response.id}>{response.title}</div>
  ))
}
```

#### Using `typeof` and `keyof` to type component variants

Let's say we wanted to build a button with various appearances, each defined in an object with a set of keys and styles, like this:

```jsx
const styles = {
  primary: {
    color: 'blue',
  },
  danger: {
    color: 'red',
  },
}
```

Our button component should accept a `type` prop which can be any key of the `styles` object (i.e, 'primary' or 'danger'). We can type this quite easily:

```tsx
const styles = {
  primary: {
    color: 'blue',
  },
  danger: {
    color: 'red',
  },
}

// creates a reusable type from the styles object
type StylesType = typeof styles

// ButtonType = any key in styles
export type ButtonType = keyof StylesType

interface ButtonProps {
  type: ButtonType
}

export function Button({ type = 'primary' }: ButtonProps) {
  return <button style={styles[type]}>My styled button</button>
}
```

These examples should get you 80% of the way there. If you get stuck, it's often worth looking at existing open source examples.

[Sancho UI](https://github.com/bmcmahen/sancho) is a set of react components built with typescript and emotion.

[Blueprint](https://github.com/palantir/blueprint) is another set of react components built with typescript.

And here's a CodeSandBox with most of the above examples:

<iframe src="https://codesandbox.io/embed/staging-silence-bm97c?fontsize=14" title="typescript-by-example" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>

repository: bmcmahen/portfolio

repo_name: bmcmahen/portfolio


text:
# Vipps API documentation page configuration

The configuration files are loaded by the documentation site, and renders the
page according to their contents.

## How to use

Branch out from master. Name your branch in a meningful way. Use
the template to create a new configuration file, or update the
existing. Then make a PR to merge it back to master.
You can test the feature branch in the UAT environment.

license: MIT

repository: vippsas/api-docs-config

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: vippsas/api-docs-config


text:
## Schedule

1. **Monday** Structure of Messy Code --- Pure, Tell-Don't-Ask, and Messy
2. **Tuesday** Leadership and Ownership --- Obsoleting Accountability
3. **Wednesday** Decision-Making Styles ---  Rapid and Effective Decision-Making
4. **Thursday** Knowability (Cyneffin) --- The Difference Between Unknown and Unknowable
5. **Friday** Knowability Based Planning --- Planning Without Increasing the Probability of Total Project Failure

## Not Scheduled

* Intentional Decision-Making
* Levels of Coupling
* Read by Refactoring
* Building Psychological Safety --- In Practice

# Details

## Structure of Messy Code --- Pure, Tell-Don't-Ask, and Messy

Key audience: technical.

Long methods have a common un-structure. Let’s explore it, see what that means, and how to fix it.

Requires:

* 1 laptop with code access.
* (optional) pick a long method in advance

Agenda:

1. Structure of a Messy Function
	1. Draw it.
	2. Find it in functions (the glance method)
2. Transform a Messy Function (do, if possible)
	1. CQRS
	2. The Pure Part
	3. The TDA Part

## Leadership and Ownership --- Obsoleting Accountability

Key audience: management, teams, HR.

Most companies focus on accountability. But a focus on accountability can actually significantly decrease ownership and result in decreased performance. Let’s explore how to create ownership and ensure the company gets the results they need.

You will exit this session with a different perspective on leadership, and a shift in how you do feedback that will allow you to create ownership with every interaction.

Agenda:

1. Accountability Cycle
2. Ownership Cycle
3. Questions and Feedback
	1. Toss up ideas and categorize (ownership vs accountability)
	2. Try it: presenter/leader/observers

## Decision-Making Styles ---  Rapid and Effective Decision-Making

Key audience: management, teams.

The most common default decision-making style is “nominally consensus:” we ensure every voice is heard, and listen to everyone (without clear direction)…until time runs short and someone gets frustrated. And then that person just makes a decision, because "consensus has stalled / will take to long and we just have to go.” There are other ways. Let’s explore them.

You will exit this session with a knowledge of 4 different styles, when to choose each, and the ability to get to consensus with any group up to about 60 people in around 10-15 minutes.

Agenda:

1. Present the Styles
2. Facilitating Consent

## Knowability (Cyneffin) --- The Difference Between Unknown and Unknowable

Key audience: project planners and funders. (day 1 of 2)

Some projects are best managed using backlogs. For others, using a backlog is a significant source of project failure risk. Some need MVPs and throughput accounting; for others, that is pure wasted effort. The differences arise because we need to make different kinds of decisions.

We, as humans, make decisions based on what we know. Yet often business requires making decisions where the most important input is what is not known. And there are different characteristics of “not known” that need to inform how we decide, plan, act, and govern. Let’s explore a model for understanding what key problems to focus on for what projects.

You will exit this session with an ability to identify what problems have what risk and unknown characteristics, and the key project funding and planning decisions that need to be made in each category.

Agenda:

1. Cyneffin, with examples
2. Key problem in each domain
3. Categorize Features / tasks

## Knowability Based Planning --- Planning Without Increasing the Probability of Total Project Failure

Key audience: project planners and funders. (builds on Cyneffin)

Yesterday we identified that different projects have different key problems based on their kinds of knowability. That means they need to be managed, governed, and planned with different methods. In this session, ew will define an effective project management style for each domain, including funding.

You will exit this session with multiple planning frameworks, and able to clearly communicate with each other about what to do when.

Agenda:

1. Planning in Each Domain
2. Governing Each Domain
3. Running a Project in Each Domain

##  Intentional Decision-Making

Key audience: management, teams. (builds on Decision-Making Styles)

We now have intentional styles to make decisions. However, there’s one remaining space for unclarity: who owns what decisions? Which choices should be made by the team and which by a manager? Why? How should this change over time? Let’s do a facilitated conversation to clarify decision scope.

You will exit this session with clarity around team scope and how that will change over time. You will also be able to re-run this discussion periodically as the situation changes.

Agenda:

1. Scope Exercise
2. Agree on Decision-Making Style
3. Discuss Ramifications

## Levels of Coupling

Agenda:

1.

## Read by Refactoring

Agenda:

1.

## Building Psychological Safety --- In Practice

Agenda

1. Discuss Safety Mandate
2. Do Emotion Check-in
3. Do Safety Check
4. Discuss Safety issues that come up, probably back to Safety Mandate

gha_language: HTML


text:
A project to manage a collection of hearthstone cards
=====================================================

This project is based on the website [Hearthstone Decks]("http://www.hearthstone-decks.com")

Dependencies: MongoDB, ImageMagick, Python >= 2.7

QuickStart on OSX:
------------------
Installation:
  * install [homebrew](https://brew.sh/index_fr.html)
  * from a terminal, type: brew update ; brew install mongodb ; brew install ImageMagick
  * install the [Anaconda Python Distribution](https://www.continuum.io)
  * from a terminal, type: conda install pymongo ; pip install fire

Running:
  * first you need to create the database. From the root directory, type: python crawl.py get_cards
  * then you need to install the website dependencies. From the "website" directory type: bower install
  * From the root directory, type: ./server.py

repository: fjossinet/hearthstone

repo_name: fjossinet/hearthstone


text:
## About

[Pablo Bravo Site](https://yandroskaos.github.io), made with Jekyll.

## Template used

[Monochrome](https://github.com/dyutibarma/monochrome)

## License

Released under [MIT License](license.md).


text:
# Presentazione sessione #ODFest17

Presentazione della sessione "[Non fidarsi più dell'ennesima agenda: servono uno o più progetti di civic hacking](http://www.spaghettiopendata.org/content/non-fidarsi-pi-dellennesima-agenda-servono-uno-o-pi-progetti-di-civic-hacking)" mostrata al raduno [OpenDataFest](http://www.opendatafest.it) il venerdì pomeriggio.

Per visualizzarla è sufficiente aprire questo link: <br/> [gitpitch.com/dagoneye/civic-hacking-andiamo-oltre-lagenda](gitpitch.com/dagoneye/civic-hacking-andiamo-oltre-lagenda).

Realizzata con GitPith.

---
_dal readme originale:_

## What is GitPitch?

GitPitch is a service that turns **[PITCHME.md](https://gitpitch.com/#gitpitch-pitchme-markdown)** markdown into online and offline, interactive slideshows. You can use it to promote, pitch or present anything from designs and best practices, to code snippets and complete frameworks.

Each slideshow presentation is made instantly available online just as soon as you git-commit and push **PITCHME.md** on any branch within a public [GitHub, GitLab, Bitbucket, Gitea, or Gogs](https://github.com/gitpitch/gitpitch/wiki/Git-Repo-Services) repo.

![URL](images/gp-url.jpg)

GitPitch is an open source project so you can fork, clone, and modify the source. You can find detailed build instructions [here](https://github.com/gitpitch/gitpitch/wiki/Server-Build-Instructions). You can also submit bug, feature and pull-requests on this repo. If you like this project please show your support with a [GitHub star](https://github.com/gitpitch/gitpitch/stargazers). Much appreciated.

## GitPitch slideshow presentations just work

GitPitch requires no sign-up. And no configuration. Just add **PITCHME.md** ;)

The [GitPitch Wiki](https://github.com/gitpitch/gitpitch/wiki) provides a detailed `How-To` that walks you through getting started, building, customizing, and sharing your GitPitch slideshow presentations.

## GitPitch - An Open Source Project

The GitPitch server is a [Play Framework 2.5.x](https://playframework.com/) Web application open-sourced under an MIT License. This means you can fork, clone, and modify the source and build and test the server on your local machine.

You can find detailed build instructions [here](https://github.com/gitpitch/gitpitch/wiki/Server-Build-Instructions). You can also submit bug, feature and pull-requests on this repo. If you like this project please show your support with a [GitHub star](https://github.com/gitpitch/gitpitch/stargazers). Much appreciated.

GitPitch has been designed to follow standard Play Framework conventions. In order to understand the layout of this project see the following article, [Anatomy of a Play Application](https://playframework.com/documentation/2.5.x/Anatomy).

## MIT License

Copyright (c) 2016 David Russell

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

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

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

gha_language: Java


text:
---
layout: home
title: Addition Without Carrying
#permalink: index.html # in case of we remove the index.md file, this doc will be the index page
---

## Description

---

A little boy is studying arithmetics. He has just learned how to add two integers, written one below another, column by column. But he always forgets about the important part - carrying.

Given two integers, your task is to find the result which the little boy will get.

_Note: The boy had learned [from](https://www.mathsisfun.com/numbers/addition-column.html) this site, so feel free to check it out too if you are not familiar with column addition_.

**Example**

For param1 = 456 and param2 = 1734, the output should be
additionWithoutCarrying(param1, param2) = 1180.

   456

  1734

+ ____

  1180

The boy performs the following operations from right to left:

- 6 + 4 = 10 but he forgets about carrying the 1 and just writes down the 0 in the last column
- 5 + 3 = 8
- 4 + 7 = 11 but he forgets about the leading 1 and just writes down 1 under 4 and 7.
- There is no digit in the first number corresponding to the leading digit of the second one, so the boy imagines that 0 is written before 456. Thus, he gets 0 + 1 = 1.

**Input/Output**

- **[execution time limit] 4 seconds (js)**

- **[input] integer param1**

  A non-negative integer.

  _Guaranteed constraints:_

  0 \leq param1 \le 10^5.

- **[input] integer param1**

  A non-negative integer.

  _Guaranteed constraints:_

  0 \leq param2 \le 6 · 10^4.

- **[output] integer**
  - The result that the little boy will get by using column addition without carrying.

**[JavaScript (ES6)] Syntax Tips**

{% highlight javascript linenos=table %}
// Prints help message to the console
// Returns a string
function helloWorld(name) {
console.log("This prints to the console when you Run Tests");
return "Hello, " + name;
}
{% endhighlight %}

## Solution

---

{% highlight sql linenos=table %}

{% include_relative solution.js %}

{% endhighlight %}

repository: wachino/codefights-arcade-thecore

repo_name: wachino/codefights-arcade-thecore


text:
---
title: cups-filters 1.28.8 released!
layout: single
author: Till
excerpt: Bugfix release, to fix several different issues
---
Bug fix release, to fix several different issues
- libcupsfilters: Made check whether the driverless PPD to generate should be a fax out PPD more reliable (Issue #343).
- foomatic-rip: Options in the 5th command line argument of the CUPS filter command line are separated only by white space and not by comma, also make sure that an option "none" is not considered a custom page size (Issue #348).
- implicitclass: Raise timeout for cups-browsed's answer from 20s to 60s (Pull request #346).
- libcupsfilters: In the PPD generator really give priority to Apple Raster against PDF (Issue #331).

[**More Details and Download**](https://github.com/OpenPrinting/cups-filters/releases/tag/1.28.8)


text:
# Sleeping Barber Problem

*Please use only the C++ standard library in your solution\*, and make sure to provide compiling instructions if no build system is provided. You can use any combination of tools and operating systems to solve this problem, but it should be compilable on a standard Linux installation (i.e. with GCC). Additionally, your solution should make use of objected-oriented programming concepts.*

*Please make sure to also add sufficient comments to your code. Defining "sufficient" is up to you.*

*\* E.g. you should use "std::thread" instead of POSIX threads (a.k.a. "pthreads").*

## Problem Description

This problem is about simulating a barber shop with the following characteristics. The barber shop has a waiting room with *M* seats and a separate room with a single barber chair where the barber works. If there are no waiting customers, nor a customer having a haircut, the barber takes a break and sleeps. The moment a customer arrives, s/he wakes the barber up so that they can have their haircut. If another customer arrives while the barber is working, s/he will either sit in the waiting room (if there are available seats) or leave (if no seats are available).

## Implementation Details

The only (command line) input for your program will be the number *M* of seats in the waiting room. The barber needs to be implemented as a thread which runs indefinitely, always performing one of the 3 possible tasks: sleeping, waking up and working. The barber sleeps if there are no awaiting customers.

There must be a thread which is responsible for creating new threads from time to time to simulate new customers arriving in the barber shop. This thread should run an infinite loop creating new threads every 3 seconds. Each created thread need to receive an integer parameter (sequentially incremented) which will serve as the customer ID.

In the beginning of the program, the barber is sleeping and there are no customers in the shop. When a customer arrives, s/he wakes the barber up so that they can have their haircut. The haircut is to be simulated with a thread sleep of *N* seconds, where *N* is a random number between 1 and 5, inclusive (i.e. [1,5]). If a new customer (thread) arrives while the barber is busy, they should wait in one of the seats of the waiting room, if one is available, or leave if none is available. Leaving is simulated by simply terminating the execution of the thread.

## Expected Output

The program must output the following given the current status of the program:

---

**Case 1**

There are no customers having a haircut and the barber is sleeping while waiting for customers.

```
Barber sleeping
Waiting room:
```

---

**Case 2**

The barber is cutting the hair of customer 12 and customers 13 to 16 are waiting.

```
Barber cutting the hair of customer 12
Waiting room: 13 14 15 16
```

---

**Case 3**

The barber is cutting the hair of customer 12 and customers 15, 16, 17, 19 and 21 are waiting (assuming there are only 5 seats in the waiting room) when customer 22 arrives and ends up leaving because there are no available seats.

```
Barber cutting the hair of customer 12
Waiting room: 15 16 17 19 21
Customer 22 leaving
```

*Note: given the behavior of the program, customers 13, 14, 18 and 20 must have arrived when no seats were available.*

---

The customer number is the argument given when creating the thread, as explained above.

> If you have any specific questions, please contact me at<EMAIL_ADDRESS>
> Good luck!


text:
# Disclaimer
The information contained in this README.md file and any accompanying materials (including, but not limited to, scripts, sample codes, etc.) are provided "AS-IS" and "WITH ALL FAULTS." Any estimated pricing information is provided solely for demonstration purposes and does not represent final pricing and Microsoft assumes no liability arising from your use of the information. Microsoft makes NO GUARANTEES OR WARRANTIES OF ANY KIND, WHETHER EXPRESSED OR IMPLIED, in providing this information, including any pricing information.

# Introduction
This project creates a public vm that you can SSH into on your desired VNET.

# Get Started
To create this networking environment in your Azure subscription, please follow the steps below.

0. Be sure to read and create https://github.com/msft-davidlee/az-internal-network as this is needed for AKS networking.
1. Fork this git repo. See: https://docs.github.com/en/get-started/quickstart/fork-a-repo
2. Create two resource groups to represent two environments. Suffix each resource group name with either a -dev or -prod. An example could be networking-dev and networking-prod.
3. Next, you must create a service principal with Contributor roles assigned to the two resource groups.
4. In your github organization for your project, create two environments, and named them dev and prod respectively.
5. Create the following secrets in your github per environment. Be sure to populate with your desired values. The values below are all suggestions.
6. Note that the environment suffix of dev or prod will be appened to your resource group but you will have the option to define your own resource prefix.

## Secrets
| Name | Comments |
| --- | --- |
| AZURE_CREDENTIALS |
{
    "clientId": "",
    "clientSecret": "",
    "subscriptionId": "",
    "tenantId": ""
}
 |
| PREFIX | myvms - or whatever name you would like for all your resources etc |
| RESOURCE_GROUP | vm - or whatever name you give to the resource group |
| NETWORKING_PREFIX | platform - this is the default used in https://github.com/msft-davidlee/az-internal-network - see more comments below |

Note that the NETWORKING_PREFIX is the networking resources i.e. VNETs created from https://github.com/msft-davidlee/az-internal-network. Please make sure you complete that before starting this project. It is the PREFIX used in that project.

repository: msft-davidlee/az-win-public-vm

branch_name: refs/heads/main

repo_name: msft-davidlee/az-win-public-vm


text:
# Elasticsearch integration pack

Pack provides many operations helping to manage your Elasticsearch indices and snapshots.

## Configuration

Copy the example configuration in [elasticsearch.yaml.example](./elasticsearch.yaml.example)
to `/opt/stackstorm/configs/elasticsearch.yaml` and edit as required.

It must contain:

* ``host`` - Host where Elasticsearch is running
* ``port`` - Elasticsearch port - default 9200
* ``query_window`` - Rolling window size in seconds. Default 30s
* ``query_string`` - Query string
* ``cooldown_multiplier`` - Multiple of query window to cooldown after successful hit. Default 2
* ``count_threshold`` - Minimum number of hits before emitting trigger. Default 5
* ``index`` - Index to query - e.g. 'logstash*'

You can also use dynamic values from the datastore. See the
[docs](https://docs.stackstorm.com/reference/pack_configs.html) for more info.

**Note** : When modifying the configuration in `/opt/stackstorm/configs/` please
           remember to tell StackStorm to load these new values by running
           `st2ctl reload --register-configs`

## Curator based actions

These actions operate similar to [curator](https://www.elastic.co/guide/en/elasticsearch/client/curator/current/actions.html) for Elasticsearch.

Action | Description
------ | -----------
**cluster.cluster_routing** | This action changes the shard routing allocation for the selected indices.
**indices.alias** | Add indices to or remove them from aliases.
**indices.allocation** | Set routing allocation based on tags.
**indices.close** | Close indices.
**indices.create_index** | Create index.
**indices.delete_indices** | Delete indices.
**indices.forcemerge** | Perform a forceMerge on the selected indices, merging them to max_num_segments per shard.
**indices.index_settings** | Update the specified index settings for the selected indices.
**indices.open** | Opens the seleted indices.
**indices.optimize** | Optimizes the selected indices.
**indices.reindex** | Reindex selected indices.
**indices.replicas** | Set replica count per shard.
**indices.rollover** | Rolls an alias over to a new index when the existing index is considered to be too large or too old.
**indices.show** | Show indices.
**indices.shrink** | Shrink indices.
**indices.snapshot** | Capture snapshot of indices.
**search.body** | Search query using request body.
**search.q** | Search query using query string as a parameter.
**snapshots.delete_snapshots** | Delete selected snapshots from 'repository'.
**snapshots.restore** | Restore all indices in the most recent snapshot with state SUCCESS.
**snapshots.show** | Show snapshots.

Actions invocation parameters will be described further. But for more detailed description what each action actually does please also refer to the [curator docs](http://www.elastic.co/guide/en/elasticsearch/client/curator/current/), it is more in-depth.

### Common parameters

These parameters include general options such as elasticsearch host, port etc.

Parameter | Description | Default
------------ | ------------ | ------------
**host** | Specifies Elasticsearch host to connect to. | `none`
**url_prefix** | Specifies Elasticsearch http url prefix. | `/`
**port** | Specifies port remote Elasticsearch instance is running on. | `9200`
**use_ssl** | Set to `true` to connect to Elasticsearch through SSL. | `false`
**http_auth** | Colon separated string specifying HTTP Basic Authentication. | `none`
**master_only** | Set to `true` to allow operation only on elected master. If a host you connect to is not a master node then the operation will fail. | `false`
**timeout** | Specifies Elasticsearch operation timeout in seconds. | `600`
**log_level** | Specifies log level \[critical\|error\|warning\|info\|debug\]. | `warn`
**dry_run** | Set to `true` to enable *dry run* mode not performing any changes. | `false`

### Filtering the list of indices and/or snapshots

Please see details on how to select indices or snapshots using filters:

  https://www.elastic.co/guide/en/elasticsearch/client/curator/current/filters.html

## Search actions

Search actions perform a specified query in Elasticsearch. There are two search actions available: **search.q** and **search.body**. The first one takes a query string (given in lucene syntax), while the former allows to perform more sophisticated searches using Elasticsearch query DSL.

Both search actions use the same *common parameters* as curator based actions.

### search.q specific parameters

This action is enhanced with *index selection* parameters to simplify indices matching.

Parameter | Description
------------ | ------------
**q** | Query in the Lucene query string syntax (**required**).
**df** | The default field to use when no field prefix is defined within the query.
**default_operator** | The default operator to be used, can be AND or OR. Defaults to OR.
**from** | The starting from index of the hits to return. Defaults to 0.
**size** | The number of hits to return. Defaults to 10.
**pretty** | Set to `true` to pretty print JSON response.

### search.body specific parameters

Parameter | Description
------------ | ------------
**body** | The search definition using the Query DSL (**required**).
**indices** | A comma-separated list of index names to search. Defaults to `"_all"`.
**from** | The starting from index of the hits to return. Defaults to 0.
**size** | The number of hits to return. Defaults to 10.
**pretty** | Set to `true` to pretty print JSON response.

## Usage and examples

Performing *curator operations* on indices or snapshots **at least one** filtering parameter must be specified. This's a generic rule applied to all of curator actions except. However *show* actions can be invoked without any filtering parameters, in this case *show*  actions will display full list of indices or snapshots.

Now let's have a look at a few invocation examples.

### Showing and deleting indices

* Show indices older than 2 days:
```
st2 run elasticsearch.indices.show host=elk older_than=2 timestring=%Y.%m.%d
```
Shows this on my node:
```json
{
    "result": null,
    "exit_code": 0,
    "stderr": "",
    "stdout": "logstash-2015.05.02
logstash-2015.05.04
"
}
```
* Delete all indices matching *^logstash.\**:

```
st2 run elastic.indices.delete host=elk prefix=logstash
```

### Snapshot operations

* Create a snapshot of indices  based on time range criteria:
```
st2 run elasticsearch.indices.snapshot host=elk repository=my_backup newer_than=20 older_than=10 timestring=%Y.%m.%d
```

This command will create a snapshot of indices newer than 20 days and older than 10 days. Notice that filtering parameters of snapshot command *apply to indices* not to snapshots. That's why it's important not to mess it up. For example, the timestring parameter when created by curator with default options has a different time scheme.

* Delete specific snapshots:
```
st2 run elasticsearch.snapshots.delete host=elk repository=my_backup snapshot=curator-20150506155615,curator-20150506155619
```
* Delete all snapshots:
```
st2 run elasticsearch.snapshots.delete host=elk repository=my_backup all_indices=true
```

### Querying Elasticsearch

On successful search (*total hits > 0*) query actions exit with *return code* == 0, if no documents have been found *return code* == 1. In all other case such as execution exceptions *return code* is 99.

Let's look at a few examples:

* Run query using DSL syntax:
```
st2 run elasticsearch.search.body host=elk body='{"query":{"match_all":{}}}' pretty=true
```

* Run query using URI syntax where **q** is a Lucene string:
```
st2 run elasticsearch.search.q host=elk q='message:my_log_event' prefix=logstash
```

## License and Authors

* Author:: StackStorm (st2-dev<EMAIL_ADDRESS>* Author:: Denis Baryshev<EMAIL_ADDRESS>

gha_language: Python


text:
# auraliser

Auralisation is the process of rendering a soundfield audible.
With the `auraliser` module it is possible to create auralisations of outdoor environments.

## Installation

The latest release can be found on PyPI and installed with `pip install streaming`.
Otherwise, you can clone this repository and install with `pip install` or `pip install -e` when you want an editable install.

## Tests

The test suite can be run with

`python setup.py test`

or

`py.test`

## Documentation

The latest version of the documentation can be found at http://fridh.github.io/auraliser.

## License

The BSD 2-Clause License applies to the code.

repository: FRidh/auraliser

repo_name: FRidh/auraliser


text:
# Basic

```
chef generate cookbook cookbooks/{cookbook}
chef generate template cookbooks/{cookbook}/ {file}
```

Enable whyrun mode with *-W, --why-run*
```
chef-client --local-mode -Fmin -W --runlist 'recipe[{cookbook}::{recipe}]'
```

```
chef-client --local-mode --runlist 'recipe[{cookbook}::{recipe}]'
```

# My cookbook
Cookbook [webdev](cookbooks/webdev) can be used by Vagrant.
It has two recipes:
1. [packages.rb](cookbooks/webdev/recipes/packages.rb)
2. [users.rb](cookbooks/webdev/recipes/users.rb)

repository: decodable/DevOps

repo_name: decodable/DevOps


text:
# Protobuf files for defining custom config-data packet structures

This is an example proto file defining custom configuration related data packet structures, namely -
1. CustomConfigRequest - for sending configuration data consisting of various fields (Info and Version)
2. CustomConfigResponse - for receiving configuration status (fail/success)

Note : These proto files are not automatically compiled during the build process.

# Compilation

Compilation requires protoc (Protobuf Compiler) and protoc-c (Protobuf C Compiler) installed. Since the generated files are to remain the same, as long as the proto files are not modified, therefore the generated files are already available under `examples/provisioning/custom_config/components/custom_provisioning/proto-c` and `examples/provisioning/custom_config/components/custom_provisioning/python` directories, and thus running cmake / make (and installing the Protobuf compilers) is optional.

If using `cmake` follow the below steps. If using `make`, jump to Step 2 directly.

## Step 1 (Only for cmake)

When using cmake, first create a build directory and call cmake from inside:

```
mkdir build
cd build
cmake ..
```

## Step 2

Simply run `make` to generate the respective C and Python files. The newly created files will overwrite those under `examples/provisioning/custom_config/components/custom_provisioning/proto-c` and `examples/provisioning/custom_config/components/custom_provisioning/python`

gha_language: C


text:
# golang-ca-certificates

![Docker Image Size (tag)](https://img.shields.io/docker/image-size/myolnir/golang-ca-certificates/latest)
![GitHub last commit](https://img.shields.io/github/last-commit/myolnir/golang-ca-certificates)
![GitHub](https://img.shields.io/github/license/saran-thala/alpine-tz-ca-certificates)

Docker baseline image with Golang latest version + ca-certificates

repository: Myolnir/golang-ca-certificates

repo_name: Myolnir/golang-ca-certificates


text:
Historian docker files
======================

Build your own
--------------

use appropriate version of jar !

Build historian-server

```shell script
mvn clean package
```

copy paste jar and conf file

```shell script
cd ./docker
cp ../target/historian-server-1.3.9-fat.jar .
cp ../target/classes/config.json .

cd  ../../historian-resources/conf/solr/conf/
zip -r historian-configset.zip ./*
cd -;
mv ../../historian-resources/conf/solr/conf/historian-configset.zip .

```

Building the image, modify version of jar in ENTRYPOINT if needed

```shell script
docker build --rm -t hurence/historian-server .
docker tag hurence/historian-server:latest hurence/historian-server:1.3.9
```

Deploy the image to Docker hub
------------------------------

tag the image as latest

verify image build :

```shell script
docker images
docker tag <IMAGE_ID> latest
```

then login and push the latest image

```shell script
docker login
docker push hurence/historian-server
docker push hurence/historian-server:1.3.9
````

repository: Hurence/historian

gha_language: Jupyter Notebook

repo_name: Hurence/historian


text:
---
layout: page
title: Reading List
---

Books that I've read, in chronological order, some with comments.

## 2017

---

### Outliers by Malcolm Gladwell

---

### Losing My Virginity by Richard Branson

---

### Made in America by Sam Walton

Not as interesting as the reviews might suggest. I found it rather
light on facts.

---

### Delivering Happiness by Tony Hsieh

A great read and Tony Hsieh's humor really resonates with me.

---

### The Upstarts by Brad Stone

---

### The Everything Store by Brad Stone

---

### Shoe Dog by Phil Knight

Awesome and captivating book focusing on Phil Knight's
"not-so-obvious" and emotional challenges of growing his business,
Nike.

---

### Deep Work by Cal Newport

---

## 2016

---

### The 7 Day Startup by Dan Norris

Not that rich in content. You could summarize it by saying "ship your
product fast and gather feedback".

---

### Zero to One by Peter Thiel

---

### So Good They Can't Ignore You by Cal Newport

---

### Originals by Adam Grant

---

### Sherlock Holmes Books by Sir Arthur Conan Doyle

A great read! Especially fun to discover all the hidden references
after watching the series with Benedict Cumberbatch.

repository: olieidel/blog-content

repo_name: olieidel/blog-content


text:
# wserver

[![Build Status](https://www.travis-ci.org/alfred-zhong/wserver.svg?branch=master)](https://www.travis-ci.org/alfred-zhong/wserver) [![GoDoc](https://godoc.org/github.com/alfred-zhong/wserver?status.svg)](https://godoc.org/github.com/alfred-zhong/wserver) [![Go Report Card](https://goreportcard.com/badge/github.com/alfred-zhong/wserver)](https://goreportcard.com/report/github.com/alfred-zhong/wserver)

Package for setup websocket server with message push

> This package is still not stable and not recommended to be used in production.

## Basic Usage

Try to start a wserver, you just need to write like this.

### Start wserver

```go
server := wserver.NewServer(":12345")
if err := server.ListenAndServe(); err != nil {
    panic(err)
}
```

Now wserver listens on port: 12345.

### Browser connecting

Now browser can connect to `ws://ip:12345/ws`. After connection established, browser should send a message to register. Register message looks like this.

```json
{
    "token": "03A3408D-3BD4-4C6C-BDC7-8596E6D31848",
    "event": "whatever-it-interested"
}
```

The `token` is used for identification and `event` means what kind of messages the client interested (Like topic in MQ).

### Push messages

Now you can send a request to `http:/ip:12345/push` to push a message. Message should look like this.

```json
{
    "userId": "03A3408D-3BD4-4C6C-BDC7-8596E6D31848",
    "event": "whatever-it-interested",
    "message": "Hello World"
}
```

The `userId` is equal to token is not specified (customize by using `server.AuthToken`). The `event` is equal to that above and `message` is the real content will be sent to each websocket connection.

## Example

The server code:

```go
func main() {
	server := wserver.NewServer(":12345")

	// Define websocket connect url, default "/ws"
	server.WSPath = "/ws"
	// Define push message url, default "/push"
	server.PushPath = "/push"

	// Set AuthToken func to authorize websocket connection, token is sent by
	// client for registe.
	server.AuthToken = func(token string) (userID string, ok bool) {
		// TODO: check if token is valid and calculate userID
		if token == "aaa" {
			return "jack", true
		}

		return "", false
	}

	// Set PushAuth func to check push request. If the request is valid, returns
	// true. Otherwise return false and request will be ignored.
	server.PushAuth = func(r *http.Request) bool {
		// TODO: check if request is valid

		return true
	}

	// Run server
	if err := server.ListenAndServe(); err != nil {
		panic(err)
	}
}
```

If you want to run a demo. Then follow the steps below:

* Go to **_examples/server** and run `go run main.go` to start a wserver.
* Open the webpage **_examples/index.html** in the browser.

If all success, you will see the content like this:

![demo-success](./demo-success.png)

## PS

Package is still not stable and I will improve it then.

PRs will be welcomed. 🍺

repository: small-small-bug/wserver

repo_name: small-small-bug/wserver


text:
JavaScript Snake

By Patrick Gillespie

License: MIT

http://patorjk.com/games/snake

This is a DOM-based game of Snake that I wrote in JavaScript a few years back.

Other than the full screen mode demonstrated in the code, it can also be
initialized in div tags within a page. Example:

    var mySnakeBoard = new SNAKE.Board( {
                                            boardContainer: "game-area",
                                            fullScreen: false,
                                            width: 580,
                                            height:400
                                        });

The comments are formatted a little strange because at the time I was playing
around with YUI Doc.

repository: ApolloHighSchoolKY/CodeCove

gha_language: JavaScript

repo_name: ApolloHighSchoolKY/CodeCove


text:
---
layout: default
---

# 1997-04-13 - A Rumor and Reputation Paradox...

## Header Data

From: Robert Hettinga<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: 6e63699d48bc9dd656ba89e6ee08fd7978a4b8fe480fc3b58f9c4c2f477240e3

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1997-04-13 16:49:11 UTC

Raw Date: Sun, 13 Apr 1997 09:49:11 -0700 (PDT)

## Raw message

```
{% raw  %}From: Robert Hettinga<EMAIL_ADDRESS>Date: Sun, 13 Apr 1997 09:49:11 -0700 (PDT)
To<EMAIL_ADDRESS>Subject: A Rumor and Reputation Paradox...
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Here's something from cyberia which talks about the persistence of
anti-reputation memes even in the presence of perfectly contradictory
information.

We've all heard about apocryphal stories, the $50 Corvette and the like,
but here's a case which has financial reprocussions. It reminds me of the
"satanism" claims about the Procter and Gamble moon and stars corporate
symbol a while back.

My first attempt at tackling this would be some kind of distributed
reputation system, but it seems to me that if someone I trusted said
something bad about Mr. Hilfinger, in the absence of any other respectable
data, I would believe them. I guess that means the need for reputation
"rental", like what financial intermediaries do, and also what we now call
journalism, will increase, not deminish, in geodesic markets.

Cheers,
Bob Hettinga

--- begin forwarded text

Mime-Version: 1.0
Date:         Sat, 12 Apr 1997 23:58:30 -0400
Reply-To:     Law & Policy of Computer Communications
<EMAIL_ADDRESS>Sender:       Law & Policy of Computer Communications
<EMAIL_ADDRESS>From:         Larry Kolodney<EMAIL_ADDRESS>Subject:      Re: America Online and liability... the Horror
To<EMAIL_ADDRESS>
>Recall the libertarian maxim that the best response to
>offensive speech is more speech.

To anyone who actually believes this bit of 18th century enlightenment
mythology, I would recommend the article "Dirty Linen: Why are they saying
all those mean things about Tommy Hilfiger?" by Lakshmi Gopalkrishnan in
the current edition of Slate
(http://www.slate.com/TangledWeb/97-04-10/TangledWeb.asp).  In essence, the
article documents a number of vicious rumours which have been spread on the
internet about the clothing designer Tommy Hilfiger and allegedly racist
comments that he made on the Ophrah Winfrey show.

Not withstanding the fact that 1) Mr. Hilfiger never appeared on the
Winfrey show and never made the statements in question, and 2) Hilfiger Co.
has engaged in an online P.R. campaign to counter these rumours, they are
persistent and widespread.

According to the article:

BEGIN QUOTE
        A spotty paraphrase of the allegations appeared in a Nov. 13, 1996,
article in the Philippine newspaper Isyu. Titled "Eat Your Clothes, Mr.
Racist Designer," the piece has been excerpted on the Official Philippine
Anti-Tommy Hilfiger site. The writer tiptoes around the charges, but is
markedly less tentative when expressing her outrage. "I am shocked," she
fulminates. "If [Hilfiger] really did insult my people, you can bet I will
do every single thing I can in my power to make sure that his label never
makes it here."

       Forums ranging from soc.culture.african.american to talk.rumors and
Streetsound have been thick with anti-Tommy talk of late. When rumors of
the designer's alleged racist outbursts filtered into the mainstream media,
they were debunked by Time magazine, USA Today, and the Washington Post.
But that didn't stem angry calls for a boycott of his products. Nor did the
official response of the Hilfiger Corp. Claiming to have become aware of
the brouhaha only recently, the company has posted a memo on various
anti-Tommy sites detailing the "simple and incontrovertible facts":
Hilfiger has never been on Oprah. Hilfiger has never been on Style. Far
from wanting to limit his appeal, Hilfiger is on record about wanting to
cross ethnic lines to appeal to everyone everywhere.

***

In theory, the Web should be as good at eradicating legends as it is at
cultivating them, but in practice, denials are quickly buried by new
messages and updates. A week ago, Hilfiger's official response clogged
newsgroup indexes. Today, it has been swamped by even newer anti-Tommy
postings and returning favorites.

END QUOTE

Lest you think that such rumours are just a minor irritant and part of
doing business, consider that, according to the article, "In the late
1980s, purported connections with the Ku Klux Klan so damaged the
reputation of athletic-wear
manufacturer Troop (whose name was rumored to be a Ku Klux Klan acronym for
"To Rule Over Oppressed People") that it was forced into bankruptcy."

So here we have vicious rumours being spread about a company with millions
of public relations dollars at its disposal, and it is helpless in the face
of a rumour that has not one grain of truth to it.

After reading this account, how could anyone seriously argue beleive
individuals such as the hapless Mr. Zeran have the slightest ability to
counter defamation with "more speech" over the internet?  (Note that Mr.
Zeran did not even have an internet account!)

Larry Kolodney

--- end forwarded text

-----------------
Robert Hettinga (rah@shipwright.com), Philodox
e$, 44 Farquhar Street, Boston, MA 02131 USA
Lesley Stahl: "You mean *anyone* can set up a web site and compete
               with the New York Times?"
Andrew Kantor: "Yes."  Stahl:  "Isn't that dangerous?"
The e$ Home Page: http://www.shipwright.com/

{% endraw %}
```

## Thread

+ Return to [April 1997](/archive/1997/04)

+ Return to "[Jeremiah A Blatz <jer+@andrew.cmu.edu>](/authors/jeremiah_a_blatz_jer_at_andrew_cmu_edu_)"
+ Return to "[Robert Hettinga <rah@shipwright.com>](/authors/robert_hettinga_rah_at_shipwright_com_)"
+ Return to "[Toto <toto@sk.sympatico.ca>](/authors/toto_toto_at_sk_sympatico_ca_)"

+ 1997-04-13 (Sun, 13 Apr 1997 09:49:11 -0700 (PDT)) - A Rumor and Reputation Paradox... - _Robert Hettinga<EMAIL_ADDRESS>  + 1997-04-13 (Sun, 13 Apr 1997 14:51:29 -0700 (PDT)) - [Re: A Rumor and Reputation Paradox...](/archive/1997/04/1832e442a223a3fb39b29a79abfa7550c3796c717388f34c4d8124e0b9c5ca5e) - _Toto<EMAIL_ADDRESS>  + 1997-04-16 (Wed, 16 Apr 1997 05:56:51 -0700 (PDT)) - [Re: A Rumor and Reputation Paradox...](/archive/1997/04/ee511b5895d8d11e53b3e09170e799d16c6b9aab45136c5b340ca2ff74bbe826) - _Jeremiah A Blatz<EMAIL_ADDRESS>


text:
# Blink Example

## Introduction

This Example demonstrates a MRAA blink Example.Note that mraa-lib needs to be installed before running the example.

See: https://github.com/intel-iot-devkit/mraa/blob/master/README.md for installing MRAA

This example blinks an led connected to P9_12 once in each second.

Use ctrl+Z to exit

to run the example :

```
node blink.js
```


text:
# node-tap

A TAP test framework for
Node.js.

![Build Status](https://github.com/tapjs/node-tap/workflows/ci/badge.svg)

_Just wanna see some code? [Get started!](http://www.node-tap.org/basics/)_

It includes a command line test runner for consuming TAP-generating test
scripts, and a JavaScript framework for writing such scripts.

* [Getting started guide](http://www.node-tap.org/basics/)
* Built-in [test coverage](http://www.node-tap.org/coverage/)
* Many [reporter formats](http://www.node-tap.org/reporting/)
* Extensive [API](http://www.node-tap.org/api/) featuring:
  * Great [promise support](http://www.node-tap.org/promises/)
  * Comprehensive [assert library](http://www.node-tap.org/asserts/)
  * Other [advanced stuff](http://www.node-tap.org/advanced/)
  * Mocha-like [BDD DSL](http://www.node-tap.org/mochalike/)
  * [Parallel Testing](http://www.node-tap.org/parallel/)
* [Command-line interface](http://www.node-tap.org/cli/) for running tests
  (whether they use node-tap or not)

See [the changelog](http://www.node-tap.org/changelog/) for recent updates,
or just get started with [the basics](http://www.node-tap.org/basics/).

All this is too much to manage in a single README file, so head over to
[the website](http://www.node-tap.org/) to learn more.

## Why TAP?

Why should you use this thing!?  **LET ME TELL YOU!**

Just kidding.

Most frameworks spend a lot of their documentation telling you why they're
the greatest.  I'm not going to do that.

### tutti i gusti sono gusti

Software testing is a software and user experience design challenge that
balances on the intersection of many conflicting demands.

Node-tap is based on [my](http://izs.me) opinions about how a test
framework should work, and what it should let you do.  I do _not_ have any
opinion about whether or not you share those opinions.  If you do share
them, you will probably enjoy this test library.

1. **Test files should be "normal" programs that can be run directly.**

   That means that it can't require a special runner that puts magic
   functions into a global space.  `node test.js` is a perfectly ok way to
   run a test, and it ought to function exactly the same as when it's run
   by the fancy runner with reporting and such.  JavaScript tests should be
   JavaScript programs; not english-language poems with weird punctuation.

2. **Test output should be connected to the structure of the test file in a
   way that is easy to determine.**

   That means not unnecessarily deferring test functions until `nextTick`,
   because that would shift the order of `console.log` output.  Synchronous
   tests should be synchronous.

3. **Test files should be run in separate processes.**

   That means that it can't use `require()` to load test files.  Doing
   `node ./test.js` must be the exact same sort of environment for the test
   as doing `test-runner ./test.js`.  Doing `node test/1.js; node
   test/2.js` should be equivalent (from the test's point of view) to doing
   `test-runner test/*.js`.  This prevents tests from becoming implicitly
   dependent on one anothers' globals.

4. **Assertions should not normally throw (but throws MUST be handled
   nicely).**

   I frequently write programs that have many hundreds of assertions based
   on some list of test cases.  If the first failure throws, then I don't
   know if I've failed 100 tests or 1, without wrapping everything in a
   try-catch.  Furthermore, I usually want to see some kind of output or
   reporting to verify that each one actually ran.

   Basically, it should be your decision whether you want to throw or not.
   The test framework shouldn't force that on you, and should make either
   case easy.

5. **Test reporting should be separate from the test process, included in
   the framework, and enabled by default for humans.**

   The [raw test output](https://www.node-tap.org/tap-format/) should be
   machine-parseable and human-intelligible, and a separate process should
   consume test output and turn it into a [pretty summarized
   report](https://www.node-tap.org/reporting/).  This means that test data
   can be stored and parsed later, dug into for additional details, and so
   on.  Also: nyan cat.

6. **Writing tests should be easy, maybe even fun.**

   The lower the barrier to entry for writing new tests, the more tests get
   written.  That means that there should be a relatively small vocabulary
   of actions that I need to remember as a test author.  There is no
   benefit to having a distinction between a "suite" and a "subtest".
   Fancy DSLs are pretty, but more to remember.

   That being said, if you return a Promise, or use a DSL that throws a
   decorated error, then the test framework should Just Work in a way that
   helps a human being understand the situation.

7. **Tests should output enough data to diagnose a failure, and no more or
   less.**

   Stack traces pointing at JS internals or the guts of the test framework
   itself are not helpful.  A test framework is a serious UX challenge, and
   should be treated with care.

8. **Test coverage should be included.**

   Running tests with coverage changes the way that you think about your
   programs, and provides much deeper insight.  Node-tap bundles
   [NYC](https://istanbul.js.org/) for this.

   It _does_ necessarily change the nature of the environment a little bit.
   But in this case, it's worth it, and NYC has come a long way towards
   maintaining this promise.

   Coverage _enforcement_ is not on by default, but I strongly encourage
   it.  You can put `"tap":{"check-coverage":true}` in your package.json,
   or pass [`--100`](https://www.node-tap.org/100/) on the command line.
   In a future version, it will likely be enabled by default.

9. **Tests should not require more building than your code.**

   Babel and Webpack are lovely and fine.  But if your code doesn't require
   compilation, then I think your tests shouldn't either.  Tap is extremely
   [promise-aware](https://www.node-tap.org/promises/).  JSX, TypeScript,
   Flow, and ES-Modules are
   [built-in](https://www.node-tap.org/using-with/) when tests are run by
   the tap CLI.

10. **Tests should run as fast as possible, given all the prior
    considerations.**

   As of version 10, tap supports [parallel
   tests](https://www.node-tap.org/parallel/).  As of version 13, the test
   runner defaults to running the same number of parallel tests as there
   are CPUs on the system.

   This makes tests significantly faster in almost every case, on any machine
   with multiple cores.

Software testing should help you build software.  It should be a security
blanket and a quality ratchet, giving you the support to undertake massive
refactoring and fix bugs without worrying.  It shouldn't be a purification
rite or a hazing ritual.

There are many opinions left off of this list!  Reasonable people can
disagree.  But if you find yourself nodding along, [maybe tap is for
you](https://www.node-tap.org/basics/).

license: ISC

repository: Thiruppathi/node-tap

gha_license_id: ISC

repo_name: Thiruppathi/node-tap


text:
---
title: Comment
---

{% since %}v1.9.1{% endsince %}

Allows you to leave un-rendered code inside a Liquid template. Any text within the opening and closing `comment` blocks will not be printed, and any Liquid code within will not be executed.

Input
```liquid
Anything you put between {% comment %} and {% endcomment %} tags
is turned into a comment.
```

Output
```liquid
Anything you put between  tags
is turned into a comment.
```

repository: harttle/liquidjs

gha_language: TypeScript

repo_name: harttle/liquidjs


text:
# Practical introduction to convolutional neural networks (CNNs) in TensorFlow

Hi guys! My name Robert. I'm currently a student at OTH Regensburg. Due to a 2 months project work I had my first hands on experience with python, TensorFlow and convolutional neural networks. The jupyter notebook and the code that goes with it are some results of that work. All of that content is supposed to help sutdents getting started with TensorFlow and give some insights into CNNs.

## What are we going to do?
<> Build a CNN for traffic sign classification with ~ 99.1 % accuracy based on the GTSRB
<> Use TensorFlow and Python to do all the work
<> Get a feeling on how CNNs work
<> What to keep in mind when working with a CNN

## Requirements
<> TensorFlow with GPU support (and a supported GPU!)
<> 16 GB RAM (since we will do all the stuff quick and dirty ;)
<> skimage and OpenCV for python 3.5.x

### Note
The .ipynb-notebook has some images and gifs included which sum up to a total of ~18MB


text:
# BallGame

### Description

A computerized version of French Solitaire Checkers (as according to the game)
box itself.

The controls are a little awkward at this time, but I plan to fix them up and
maybe make a full gui so the game is click-and-drag rather than typing in
commands.

It was also intended to be used to devise a solution to the game itself,
which is still my ultimate goal. Related to such, if there are any
improvements to my code you (yes, I mean you, random internet person)
you can see, please suggest it in the issues section.

### Credits

* Author: Crockeo
* Language: Haskell (http://haskell.org)

repository: crockeo/ballgame

repo_name: crockeo/ballgame


text:
---
id: testing
title: Testing
---
Once you've written you smart contract, it's time to test.  This guide will walk you through how to test your smart contract with NEO•ONE.

In addition, the `yarn neo-one build` command also generates some files for you stored in the `../generated` directory relative to your contract.  The files specific to your contract
will be in the `../generated/<Your Contract Name>` directory.  You can find the generated files for the NEO•ONE Playground [here](https://github.com/neo-one-suite/neo-one-playground/tree/master/one/generated).

The most relevant generated file is the file called `types.ts` which lives your contract's generated directory.  This file serves as the front-end API for your smart contract.  You'll notice two main differences
between your smart contract definition file and the front-end API.
* Smart Contract methods return [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
  * Blockchain is inherently asynchronous as there is a time delay between blocks.
* Some types are converted to their front-end versions.
  * For example, Integers and Fixed point numbers are converted to [BigNumbers](https://github.com/MikeMcl/bignumber.js/).

As a concrete example, take a method which returns a contract's token balance for a given address. In the smart contract definition file, it might look like this:
```ts
import { Address, constant, Integer, SmartContract } from '@neo-one/smart-contract'

export class MyContract extends SmartContract {

  ...

  @constant
  public checkBalance(address: Address): Integer {
    // checks balance
  };

  ...
```
The front-end api will look like this:
```ts
import { AddressString, SmartContract } from '@neo-one/client';
import BigNumber from 'bignumber.js';

export interface MyContractSmartContract extends SmartContract {
  ...

  readonly checkBalance(address: AddressString) => Promise<BigNumber>

  ...
```

This file serves both as a reference for your smart contract's front-end api as well as types you can import to your front-end.

## Testing with Jest
NEO•ONE was built to allow your smart contracts to be tested with the [jest](https://jestjs.io/) testing framework.  In the NEO•ONE Playground, you can find the test files [here](https://github.com/neo-one-suite/neo-one-playground/tree/master/one/tests).
To setup your smart contract test, you will need to import the generated testing helper, `withContracts`:
```ts
import { withContracts } from '../generated/test'
```
This helper resets and redeploys your contracts to a local private network and gives you access to some helpful tools to help you interact with your smart contract and the blockchain in your test:
* yourSmartContract
  * Your smart contract will be available by its name in camel case and gives you full access to your smart contract api.
* client
  * The NEO•ONE client api is your main resource for interfacing with the blockchain.  You can create wallets, scrape blocks, and much more.  Learn about the client api in detail [here](/docs/en/client-api.html).
* developerClient
  * The developerClient allows you to interface with the blockchain in ways that only make sense during development.  You can force consensus, fast forward the network, and much more. Learn about the developer client api in detail [here](/docs/en/developer-client-api.html).
* masterAccountID
  * A master wallet with plenty of NEO and GAS for you to play with.
* networkName
  * The name of the local private network network your contract is deployed on.

To use `withContracts` in your test, simply call it at the top of your test.  Its only argument is an asynchronous callback which forwards all of the above tools.  Then, your test is written like a standard jest test inside of this callback.
To give an example, lets look at how you would write a test to check that `checkBalance` is working.
```ts
import { createPrivateKey } from '@neo-one/client';
import { withContracts } from '../generated/test';

describe('MyContract', () => {
  test('checkBalance', async () => {
    await withContracts(async ({ client, developerClient, myContract, masterAccountID, networkName }) => {

      // use the client to create a new wallet
      const newWallet = await client.providers.memory.keystore.addAccount({
        network: networkName,
        privateKey: createPrivateKey(),
      });

      // use the smart contract api to call checkBalance for the new wallet's address
      const balance = await myContract.checkBalance(newWallet.account.id.address);

      // use matchers to confirm you expect the new wallet's balance to be 0
      expect(balance.toString()).toEqual('0');
    }
  }
}
```

That's it!  The full power of jest is available to you for testing every aspect of your smart contract running on a local private network.

repository: liesunday/neo-one

repo_name: liesunday/neo-one


text:
# Burundiarxiv

Online platform where all the scientific and literary work produced by Burundians or for Burundi can be posted and made available for download to everyone that might need it.

See: https://www.burundiarxiv.org

repository: nijfranck/burundiarxiv

repo_name: nijfranck/burundiarxiv


text:
# OAM_SSO

Easily access pages protected with various SSO implemntations

Simply create an instance of the class and then call the `get()` or `post()` methods. Login is handled for you.

## Example

```python
my_site = AzureSSO(
    sso_credentials=sso_credentials,
    verify=False,
    no_script = [
        'Since your browser does not support JavaScript',
        'Script is disabled. Click Submit to continue'
    ]
)

my_site.post(url, data=data)
```


text:
# devcontainer

## example usage

Below are some example use cases you might want to run from within the
devcontainer (either
[within VSCode locally](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_create-a-devcontainerjson-file)
or in your browser via
[GitHub Codespaces](https://github.com/features/codespaces)).

**Note**: If you want to chose a specific .devcontainer within GitHub codespaces
select "New with options" and you will be able to select any of the pre-defined
devcontainers in this repo.

[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/psf/black:.[jupyter].
[INFO] Initializing environment for https://github.com/pycqa/flake8.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier.
[INFO] Initializing environment for<EMAIL_ADDRESS>[INFO] Initializing environment for local.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-prettier.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
trim trailing whitespace.................................................Passed
check python ast.........................................................Passed
check yaml...............................................................Passed
check json...............................................................Passed
check for case conflicts.................................................Passed
detect private key.......................................................Passed
fix python encoding pragma...............................................Passed
forbid submodules....................................(no files to check)Skipped
mixed line ending........................................................Passed
fix requirements.txt.....................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check BOM - deprecated: use fix-byte-order-marker........................Passed
check for broken symlinks............................(no files to check)Skipped
check for merge conflicts................................................Passed
check for added large files..............................................Passed
fix end of files.........................................................Passed
black-jupyter............................................................Passed
flake8...................................................................Passed
isort....................................................................Passed
prettier.................................................................Passed
Lint website.............................................................Passed
```

### Docker compose

```bash
# build the image
docker compose up --build
```

You should see some docker containers being pulled and activated.

Once you see a line like:

```
open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000
```

you should be able to access that port like below:

this port can then be forwarded to a browser tab like below:

repository: LAION-AI/Open-Assistant

repo_name: LAION-AI/Open-Assistant


text:
!!! note
    Both postponed annotations via the future import and `ForwardRef` require python 3.7+.

Postponed annotations (as described in [PEP563](https://www.python.org/dev/peps/pep-0563/))
"just work".

```py
{!./examples/postponed_annotations.py!}
```
_(This script is complete, it should run "as is")_

Internally *pydantic*  will call a method similar to `typing.get_type_hints` to resolve annotations.

In cases where the referenced type is not yet defined, `ForwardRef` can be used (although referencing the
type directly or by its string is a simpler solution in the case of
[self-referencing models](#self-referencing-models)).

You may need to call `Model.update_forward_refs()` after creating the model,
this is because in the example below `Foo` doesn't exist before it has been created (obviously) so `ForwardRef`
can't initially be resolved. You have to wait until after `Foo` is created, then call `update_forward_refs`
to properly set types before the model can be used.

```py
{!./examples/forward_ref.py!}
```
_(This script is complete, it should run "as is")_

!!! warning
    To resolve strings (type names) into annotations (types) *pydantic* needs a dict to lookup,
    for this it uses `module.__dict__` just as `get_type_hints` does. That means *pydantic* does not play well
    with types not defined in the global scope of a module.

For example, this works fine:

```py
{!./examples/postponed_works.py!}
```

While this will break:

```py
{!./examples/postponed_broken.py!}
```

Resolving this is beyond the call for *pydantic*: either remove the future import or declare the types globally.

## Self-referencing Models

Data structures with self-referencing models are also supported, provided the function
`update_forward_refs()` is called once the model is created (you will be reminded
with a friendly error message if you don't).

Within the model, you can refer to the not-yet-constructed model by a string :

```py
{!./examples/self_referencing_string.py!}
```
_(This script is complete, it should run "as is")_

Since `python 3.7`, You can also refer it by its type, provided you import `annotations` (see
[above](postponed_annotations.md) for support depending on Python
and pydantic versions).

```py
{!./examples/self_referencing_annotations.py!}
```
_(This script is complete, it should run "as is")_

repository: sindhukothe/pydantic

repo_name: sindhukothe/pydantic


text:
## Checklist before I submit this issue report

I confirm that:
- [ ] I have tested this with the latest source code available
- [ ] I have checked existing OPL issues for duplicates and found none @ http://psx-scene.com/forums/official-open-ps2-loader-forum/ & https://github.com/ifcaro/Open-PS2-Loader/issues

## Issue description - Describe the problem you are having

(replace 'FILLIN' with description)

FILLIN

## Expected result

FILLIN

## Actual result

FILLIN

## Steps to reproduce

FILLIN


text:
# chromecast-can-play

Check if a certain media file is supported by Chromecast (requires ffprobe).
This library is work in progress and not on npm yet.
Contributers are welcome.

### Usage

```javascript
var canPlay = require('chromecast-can-play');

canPlay('./myvideo.mp4', function(err, meta) {
  if (meta.canPlay) {
    console.log('file is supported by chromecast');
  } else {
    console.log('file is not supported by chromecast');
  }
});

canPlay('./myvideo.mkv', function(err, meta) {
  if (meta.audioSupported === false) {
    console.log('audio must be converted...');
  }
});
```

## License
MIT

repository: xat/chromecast-can-play

repo_name: xat/chromecast-can-play


text:
# Keyboard Layouts

Everyday we use a keyboard to communicate with our devices. We use them as a mean of communication with our PCs, but also with our smartphones and tablets (through software keyboards). More often than not they are all based on QWERTY, or its derivative, layout.

Throughout the last few decades, there have been attempts to increase the comfort of typing and typing speed, such as 'Dvorak', 'Colemak' or 'Workman'.

In this project, I propose yet another one layout (later on referred to as 'Optimized Layout'). Its aim is not to replace any previously mentioned, but simply to see how it relates to famous QWERTY layout.

# 1. Assumptions

The main assumption here is, that the easiest row to type on is the middle row and the most dominant fingers are index fingers. With these assumptions, we could say that the most comfortable letters to type are 'f' and 'j' (later on 'd' and 'k' etc.). Another assumption that it is easier to type using the top than the bottom row, and our dexterity in fingers decreases going outward (index, middle, ring, pinky). The below figure (Fig. 1.1) Should somehow give the feeling about those assumptions.

![](https://raw.githubusercontent.com/93fk/Optimal_Keyboard_Layout/master/empirical/2_pipeline/2_keyboard_layout/out/keyboard_layout.png)

*Fig. 1. The figure represents arbitrary ease of hitting each key - the darker the key, the easier is to hit.*

The additional assumption is we use the touch typing technique, so we try to position our fingers as in the below picture (Fig. 1.2.).

![](https://upload.wikimedia.org/wikipedia/commons/c/ce/Keyboard_scheme.jpg)
*Fig. 1.2. Touch typing layout.*

We could also build a network (Fig. 1.3.) that would help us to visualize the above assumptions. Notice that connections weights between keys are based on how much certain keys overlap in non-ortholinear keyboards.

![](https://raw.githubusercontent.com/93fk/Optimal_Keyboard_Layout/master/empirical/2_pipeline/2_keyboard_layout/out/keyboard_network.png)

*Fig 1.3. Network based on QWERTY non-ortholinear keyboard. The bigger the circle, the easier certain key is to type. Also the thicker the line that connects two keys, the more those keys overlap on Y or X axis.*

# 2. Method

First, we need some data to figure out how to relabel each key on the keyboard. In order to do this, I parsed 100 English books to find most occurrent letters (unigrams) and letter pairs (bigrams). Unigrams are to serve as analogy to 'the ease' of pressing a certain key - we would like to the most occurrent letter is the easiest to type, and cooccurrence (bigrams) serve as an analogy to key overlapping - it would be nice to have letters that frequently occur in pairs next to each other.

Thanks to the harvested data I was able to produce the below network (Fig 2.1.). Note that the bigger the circle with a certain letter, the more occurrent the letter is in the analyzed books and the thicker the line between letters, the more frequently those letters co-occur in the books' corpora.

![](https://raw.githubusercontent.com/93fk/Optimal_Keyboard_Layout/master/empirical/2_pipeline/3_letters_graph/out/letters_network.png)

*Fig. 2.1. Letters network.*

We can see that the letter 'e' occurs much more frequently than the letter 'j', or that the letter 't' has a high chance to appear next to the letter 'h'.

Now it's time to combine the letters network (Fig. 2.1.) with the keyboard network (Fig. 1.3.). The expected product is the new (remapped) layout.

I started in the order of the easiest keys to type ('f', 'j', 'k' etc. - look at Fig. 1.1.) as they have the biggest weights to them. Now, one-by-one, each key was remapped to the highest scoring letter according to the criterion:

$max(\sum_{letter} \sum_{edge} [KN(key, edge)*LN(letter, edge)] + 3*KN(key)*LN(letter))$

where KN is keyboard network and LN is letters network. In other words we sum all the weights products (edges, connections) between keyboard keys and analogous letters (ie. we multiply the weight of the edge between certain key and its neighbour with the candidate letter and the neighbour), and we add the product between the key's relative importance and the letter's relative frequency with the weight of 3, so the dominant criterion is the frequency, not the 'neighbourhood'.

# 3. Results

The results are satisfactory, as the new layout resembles the one in Fig. 1.1. Nevertheless, there are some differences. First of all the assumed layout doesn't follow the same distribution, as the real-life letters. Second of all certain letters, even with lower relative frequency, may be favoured over those with higher frequency, because they can have high co-occurrence with another letter - see 'r' and 'e' in the optimized layout (Fig. 3.1.).

The below illustration was based on 3 books that weren't used to produce results.

![](https://raw.githubusercontent.com/93fk/Optimal_Keyboard_Layout/master/empirical/2_pipeline/5_layout_comparison/store/Layout.gif)

*Fig. 3.1. Layout comparison.*

As it is in the case of Fig. 1.1. darker keys reflect higher relative frequency in a text corpus.


text:
# ctodo
A simple ncurses-based task list manager

Website: http://ctodo.apakoh.dk

![Screenshot.](http://ctodo.apakoh.dk/screenshot.png)

## License
Copyright (C) 2012 Niels Sonnich Poulsen (http://apakoh.dk)

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

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

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

## Requirements
### Linux
* `ncurses`
* A C-compiler like `gcc`
* `cmake` (not actually necessary)

### Windows
* Windows XP or newer

## Installation
### Linux
* Run cmake:

        cmake .

* Compile:

         make

* Install:

         make install

Alternatively you could just use `gcc` to compile the
single source file:

    gcc -lncurses -o ctodo ctodo.c

### Windows
Run the installer, e.g. `ctodo-1.1-setup.exe`.

## Usage
### Linux
Run from a console using:

    ctodo

This will create a `todo.txt` file in the current
directory or open the file if it exists.

Alternatively you can run ctodo using:

    ctodo someotherfile.txt

Which will open/create `someotherfile.txt` in the current directory.

### Windows
Right click in any directory (or on the desktop) and open the `New`-menu. If ctodo was installed
using the installer, the option `Task List` should be available. Click on it.

This will create an empty task list which you can open with ctodo by double clicking on it
(if you installed using the installer).

##Commands
* Navigation:

  Use `UP` and `DOWN` arrows to move between tasks
  (or `J` and `K`).

  `PAGE UP` moves 5 tasks up and `PAGE DOWN` moves
  5 tasks down.

  `HOME` moves to the top of the list and `END` moves
  to the bottom.

* Managing tasks:

  `SPACE` and `ENTER` checks/unchecks the selected task.

  `D` and `DELETE` deletes the selected task.

  Press `E` to edit the description of the selected task.

  Press `SHIFT-E` to delete the current task description
  and create a new one.

  Press `N` or `INSERT` to create a new task.

* In input-mode:

  Press `ENTER` to save the string.

  Press `CTRL-C` or `CTRL-D` to cancel.

* Managing the task list:

  Press `T` to edit the title of the task list.

  Press `SHIFT-T` to delete the current title
  and create a new one.

  Press `S` to save the list.

  Press `R` to reload the list (discard unsaved data).

  Press `Q` to save the list and quit.

repository: deeice/ctodo

repo_name: deeice/ctodo


text:
# Building a .NET Application Using Azure Cosmos DB

This demo code is used to show how to develop an application that stores its data in Azure Cosmos DB.  Here is a description of the demo components along with instructions in order to run the demos on your machine.

### Domain
Defines the domain objects for the to do project.

### Services
Provides a set of services for working with the to do data.  Be sure to look at the Common class as that is where most of the access to the Azure Cosmos DB database is performed.

### Tutorial
This is a simple ASP.NET Core MVC website that allows a user to view their to do items.

You will need to add the following section to your appsettings.json file:

```
  "CosmosDb": {
    "Account": "<Endpoint URI of your Azure Cosmos account>",
    "Key": "<PRIMARY KEY of your Azure Cosmos account>",
    "DatabaseName": "Tasks",
    "ContainerName": "Item"
  }
```

### ChangeFeedMonitor
This is a set of Azure Functions that perform actions based upon changes within the Azure Cosmos DB database.  Something to note on this project is that we are using dependency injection - this is not done by default.

The *ChangeFeedMonitor* function copies to do items into an Azure Storage account which is used for archival purposes.

The *MetadataChangeFeed* function updates to do items associated to an item status.

In the appsettings.json file, you will need a CosmosConnectionString value with Azure Cosmos DB connection string.

### DemoBuilder
This is a simple console application used to populate the Azure Cosmos DB database with some initial data.

You will need to add a Settings class with the following structure:

```
public static class Settings
{
  public const string CosmosEndpoint = "<Endpoint URI of your Azure Cosmos account>";
  public const string CosmosKey = "<PRIMARY KEY of your Azure Cosmos account>";
  public const string CosmosDatabaseName = "Todo";
  public const string MetadataContainerName = "metadata";

  public const string ItemContainerName = "items";

  public const string StorageAccountName = "<Name of Azure Storage account>";
  public const string StorageAccountKey = "<Key of your Azure Storage account>";
  public const string ArchiveContainerName = "itemarchive";
}
```


text:
---
layout: default
---

# 1994-12-02 - Re: The thread that would not die. (Mandating signatures)

## Header Data

From<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: 30ea9c4a3c3591631119a9b0cf29c5c3bb93e8601a830ff340c47d9a4f0b260c

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1994-12-02 19:02:17 UTC

Raw Date: Fri, 2 Dec 94 11:02:17 PST

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>Date: Fri, 2 Dec 94 11:02:17 PST
To<EMAIL_ADDRESS>Subject: Re: The thread that would not die. (Mandating signatures)
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

-----BEGIN PGP SIGNED MESSAGE-----

In article<EMAIL_ADDRESS>Perry E. Metzger<EMAIL_ADDRESS>wrote:
>
>John Schofield says:
>>     It is silly to talk of someone "owning" the list.  The list is a
>> community.  The only possible owners are the people in the community.  If we
>> all left, Eric would still have control over the list--but the list would be
>> worthless.
>
>It is silly to talk of someone "owning" a restaurant. The restaurant
>is a community. The only possible owners are the people in the
>community. If the patrons all left, Chef Joey would still have control
>over the restaurant -- but the restaurant would be worthless.

You continue to confuse (deliberately?) a community with the place it meets.
"List" is being used in two senses -- and you continue to interpret it only
as the instance of majordomo on toad.com.  That's a worthless interpretation
as nobody disputes that Eric controls that agent.

- --
Todd Masco     | "Roam home to a dome, Where Georgian and Gothic once stood
<EMAIL_ADDRESS>|  Now chemical bonds alone guard our blond(e)s,
<EMAIL_ADDRESS>|  And even the plumbing looks good."  - B Fuller

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQBFAwUBLt9v/CoZzwIn1bdtAQFY6gGA0EVd9/2BIoe5ORzfPePZxxoA7WJs/jkm
PEMkdRGJNpih+x6xLOnlv2+BoBTdEXgj
=Qrv2
-----END PGP SIGNATURE-----

[This message has been signed by an auto-signing service.
 A valid signature means only that it has been received at
 the address belonging to the signature and forwarded.]

{% endraw %}
```

## Thread

+ Return to [December 1994](/archive/1994/12)

+ Return to "[owner-cypherpunks@hks.net](/authors/ownercypherpunks_at_hks_net)"
+ Return to "["Perry E. Metzger" <perry@imsi.com>](/authors/perry_e_metzger_perry_at_imsi_com_)"

+ 1994-12-02 (Fri, 2 Dec 94 11:02:17 PST) - Re: The thread that would not die. (Mandating signatures) -<EMAIL_ADDRESS>  + 1994-12-02 (Fri, 2 Dec 94 11:25:32 PST) - [Re: The thread that would not die. (Mandating signatures)](/archive/1994/12/2fc7593c1b5b3f1a7810a87b02185696d52353738f75cd373482e09fecb93f2b) - _"Perry E. Metzger"<EMAIL_ADDRESS>