text:
Coingate Node.js API Client
==============================
A Nodejs wrapper for making requests to [Coingate's API](https://developer.coingate.com/docs/getting-started)

It allows you to perform the following actions
* Create Order
* Get Order Details
* Get Order List

## Get Started
Install using [Node Package Manager](https://www.npmjs.org/).
```
~$ npm install coingate
```

## Usage

After installing, import coingate

```
var coingate = require('coingate');
```

### Configure
create API keys for testing from [coingate sandbox](https://sandbox.coingate.com/)
or for a live app from [coingate](https://www.coingate.com/)

configure client with parameters (mode,api_key, api_secret, app_id)
```
coingate.configure({
 mode: 'sandbox',
 app_id: '832',
 api_key: '818x8038aaiehca3qidaf',
 api_secret: '9adij3289adjksafduiaiolsdaf'
})
```

### Create Order
A payment url will be return in response after successfully creating
an order. Check [coingate documentation](https://developer.coingate.com/docs/create-order)
for required and optional parameters and example response
```
var params = {
 order_id:         'ORDER-1412759367',
 price:            1050.99,
 currency:         'USD',
 receive_currency: 'EUR',
 callback_url:     'https://example.com/payments/callback?token=6tCENGUYI62ojkuzDPX7Jg',
 cancel_url:       'https://example.com/cart',
 success_url:      'https://example.com/account/orders',
 description:      'Apple Iphone 10'
};
coingate.createOrder(params, function (err, res, body) {
 if (err) {
     console.log(err);
 } else {
     console.log('order created successfully');
     console.log(res.body);
 }
});
```

### Get Order Details
Details for a single order will be returned in response. Check [coingate documentation](https://developer.coingate.com/docs/get-order) for
example response. Required parameter is the Order ID.

```
var orderID = 3421;
coingate.getOrder(orderID, function (err, res, body) {
 if (err) {
     console.log(err);
 } else {
     console.log('get order request successful');
     console.log(res);
 }
});
```

### List Orders
All created orders will be returned in response. Check [coingate documentation](https://developer.coingate.com/docs/list-orders) for
example response and more details about parameters.
```
var params = {
per_page: 50,
page: 1,
sort: 'created_at_desc'
};
coingate.listOrders(params, function (err, res, body) {
  if (err) {
      console.log(err);
  } else {
      console.log('order listed successfully');
      console.log(res.body);
  }
});
```

## Contributing
If you would like to contribute, please fork the repo, make your changes and create a pull request.

## License
This library was released under MIT License

## Reference

[Coingate API Documentation](https://developer.coingate.com/docs)

## Authors
* [Osho Emmanuel](https://github.com/oshorefueled)

repository: oshorefueled/node-coingate-client

repo_name: oshorefueled/node-coingate-client


text:
Final Exam Review
===

Note: This focuses more on the latest material; please also review the material for the midterm. Also, solutions are not necessarily unique; there are several variations you could do, and many small differences (static, public vs protected vs private ...).

We covered solutions in the May 2nd [lecture](https://youtu.be/7MSgLYNeixg)

1. Write a class called Fraction with the following methods/constructor:

    * A constructor that takes two int parameters, the numerator and denominator, respectively
    * a method called getNumerator, that returns an int, the numerator
    * a method called getDenominator, that returns an int, the denominator
    * a method called toDouble, that returns a double, the equivalent decimal to the fraction.
```java
	static class Fraction {
		private int numerator, denominator;
		public Fraction(int numerator, int denominator){
			this.numerator=numerator;
			this.denominator=denominator;
		}

		public int getNumerator(){
			return numerator;
		}

		public int getDenominator(){return denominator;}
		public double toDouble(){return numerator/(double)denominator;}
	}
```

2. Given the following interface:
```java
interface Product {
    public String getName();
    public String getType();
    public double getPrice();
}
```
Create a class Book that implements the Product interface; it should return "Book" for getType(), and have a constructor taking the other two fields.

```java
	class Book implements Product {
		String name;
		double price;

		public Book(String name, double price) {
			this.name=name;
			this.price=price;
		}

		public String getName(){return name;}
		public String getType(){return "Book";}
		public double getPrice(){return price;}
	}
```
3. Write a Java code fragment to create a variable called b1, of type Book (defined above) and assign it to a Book instance with name "Catch 22" and price 7.95
```java
	Book b1=new Book("Catch 22",7.95);
```

4. Given the Product interface above, write a function called AveragePrice, that takes an array of Product, and returns a double, the average price of the product.
```java
 	public static double AveragePrice(Product[] products) {
 		double sum=0;
 		for(Product p : products) {
 			sum+=p.getPrice();
 		}
 		return  sum/products.length;
 	}
```

5. Given the Product interface above, write a function called HighestPricedProduct, that takes a List of Product, and returns a Product, the product with the highest price.
```java
 	public static Product HighestPricedProduct(List<Product>products){
 		Product high=products.get(0);
 		for(Product p : products) {
 			if(p.getPrice() > high.getPrice())
 				high=p;
 		}

 		return high;
 	}
```

6. Java has an Integer class, with a static method parseInt, that takes a string and returns an int.
This function throws a NumberFormatException if the string does not represent a valid int. Write a static function called parseInt, which takes two arguments, a String and an int (the int represents the default value), and returns an int. This function calls Integer.parseInt, and handles the exception so that, if parseInt raises a NumberFormatException the function would return the default value.
```java
 	static int parseInt(String in, int defVal){
 		try {
 			return Integer.parseInt(in);
 		} catch(Exception e) {
 			return defVal;
 		}
 	}
```

7. Given the Fraction class you created above, write a static createFraction method, that takes two integers, the numerator and denominator, and returns a Fraction with that numerator and denominator; however, if the denominator is zero, the function will throw an IllegalArgumentException (this class is defined by java and has a constructor with no arguments and one which takes a String argument for an error message, if you prefer).
```java
 	static Fraction createFraction(int numerator,int denominator) throws IllegalArgumentException {
 		if(denominator==0)
 			throw new IllegalArgumentException("Denominator cannot be 0");
 		return new Fraction(numerator,denominator);
 	}
```

8. Write a function called ArrayFrequencies, that takes a List of Strings, and returns a Map of String to Int. The function maps every String in the array to its frequency (so if the string appears 3 times, it would be in the map paired with a value of 3).
Hint- HashMap is the standard class for Maps. Map has methods containsKey, put and get.
```java
 	static Map<String,Integer> ArrayFrequencies(List<String> words) {
 		Map<String,Integer> frequencies=new HashMap<String,Integer>();
 		for(String word:words) {
 			if(!frequencies.containsKey(word))
 				frequencies.put(word, 1);
 			else
 				frequencies.put(word, frequencies.get(word)+1);
 		}

 		return frequencies;
 	}
```

9. Write a function called MostCommonWord, that takes a List of Strings and returns the String which occurs more frequently in the list. You can assume the array contains no null values.
Hint-Can call function above. Map also has methods keySet and entrySet which may be useful. EntrySet returns a Collection of Map.Entry ; Map.Entry has getKey() and getValue().
```java
 	static String MostCommonWord(List<String> words) {
 		Map<String,Integer> frequencies=ArrayFrequencies(words);
 		int highFreq=0;
 		String high="";
 		for(Map.Entry<String, Integer> entry : frequencies.entrySet()) {
 			if(entry.getValue()>highFreq) {
 				highFreq=entry.getValue();
 				high=entry.getKey();
 			}
 		}
 		return high;
 	}
```

license: Unlicense

repository: okaram/IntroJava

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: okaram/IntroJava


text:
# story-json-to-video

Compile [story-json](https://github.com/micnews/story-json) documents into videos.

*Note*: Not all features of `story-json` format are supported at the moment. Open an issue if you need something that isn't supported yet. PRs are always welcome too.

<img src="https://user-images.githubusercontent.com/6034700/36316418-40c3cc3e-1308-11e8-98e9-27f98247cfa4.gif" width="200">

## Installation

This package requires [node.js](https://nodejs.org) version 8 or later.

This package uses `ffmpeg` to process videos, which needs to be installed in your `PATH` directory.

This package depends on [node-canvas](https://github.com/Automattic/node-canvas), which requires Cairo, Pango, libpng, libjpeg, giflib and librsvg to be installed on the system. librsvg is optional for svg rendering. See https://github.com/Automattic/node-canvas#installation.

Example for macOS:

```
brew install ffmpeg
brew install pkg-config cairo pango libpng jpeg giflib librsvg
PKG_CONFIG_PATH=/usr/local/opt/zlib/lib/pkgconfig npm install story-json-to-video -g
```

This package also depends on [yoga](https://github.com/facebook/yoga), targeting the node.js platform:

```
npm config set yoga-layout:platform node -g
```

*Remove `-g` from the commands if you're cloning and installing this module locally.*

## Usage

To compile `story.json` into video, run:

```
story-json-to-video story.json
```

If everything works, the program will create `story.mp4` in the same directory.

To list additional options:

```
story-json-to-video --help
```

### Options

Use `--font` option to provide custom fonts, e.g. `--font MyFont=./my-font.otf`.

This uses [registerFont](https://github.com/Automattic/node-canvas#registerfont-for-bundled-fonts) from `node-canvas`.

## License

MIT

license: MIT

repository: pietrop/story-json-to-video

branch_name: refs/heads/master

repo_name: pietrop/story-json-to-video


text:
---
title: Writing a DSL parser using PegJS
published: true
description: Write a simple parser using PegJS
tags: dsl, experiments
cover_image: /images/write-a-dsl-in-pegjs.png
---

In the [previous article](/blog/write-dsls-and-code-faster/) I wrote about Domain Specific Languages (DSLs) and how useful they are, but I didn't get into the details of parsing them, that's where this article comes in.

Previously we made this DSL:
```javascript
User.ScheduleAppointment has {
  a UserId userId
  an AppointmentDatetime appointmentDatetime
  a Location location from {
    a LocationName locationName from location
    a Latitude latitude
    a Longitude longitude
  }
}
```

We want to take the above, and parse it. That means turning the text into an Abstract Syntax Tree (AST). An AST is a tree structure that's easy to navigate and interpret. Once we have an AST, we can interpret it.

To do this, we're going to use [PegJS](http://pegjs.org/), a Parsing Expression Grammar (PEG) parser written in Javascript. PegJS (like most parsers) is based on regular expressions, they allow you to build named regexes (rules) that you combine together to form a tree. The results of your rules can be turned into data structures, letting you build up your AST.

# The AST
The first thing we need to do is design our AST, as we need to know what the end result looks like. Once we know this, we can reverse engineer the rules.

So in our perfect world, we want to take the DSL above and turn it into the following.
```json
{
   "entity": "User",
   "command": "ScheduleAppointment",
   "values": [
      {
         "class": "UserId",
         "param": "userId",
         "alias": null,
         "type": "value"
      },
      {
         "class": "AppointmentDatetime",
         "param": "appointmentDatetime",
         "alias": null,
         "type": "value"
      },
      {
         "class": "Location",
         "param": "location",
         "type": "composite",
         "values": [
            {
               "class": "LocationName",
               "param": "locationName",
               "alias": "location",
               "type": "value"
            },
            {
               "class": "Latitude",
               "param": "latitude",
               "alias": null,
               "type": "value"
            },
            {
               "class": "Longitude",
               "param": "longitude",
               "alias": null,
               "type": "value"
            }
         ]
      }
   ]
}
```
This structure is easy to navigate and interpret, so it's a great end goal for our parser. Now we know what we want, let's figure out how to get there.

# Writing a PEG
PEGs (and most parsers) work via regular expressions (regexes). If you're like me, then your regex-fu is probably a bit weak, so writing a parser can seem like a daunting task. Thankfully, there are easy ways to learn regexes. I'd recommend playing this [regex crossword game](https://regexcrossword.com/). Once you've completed the "experienced" level crossword, you'll understand regexes well enough that you'll be able to write a parser without looking up regex documentation. I'd highly recommend this game to anyone that wants to learn regexes.

Assuming we understand Regular Expressions, here's an example of single simple rule.

## Sample PegJS rule
```javascript
Var = name:[A-Za-z0-9_]*
  {
    return name.join("");
  }
```

The above is a PegJS rule that matches variable names like the following "positionId", "canidateId", "variable_name", etc... .
It then returns the result as a string. Here this is defined as a "rule" called `Var` that can be reused throughout the parser, that way we don't have to repeat code, making the parser easier to read and use.

## The rules
A PegJS parser is made up of rules. Our goal is to take the above DSL and figure out the rules for each type of AST structure. Rules are composable, so once we have a few basic rules, we can start building more complex ones.

1. Whitespace (_): match all the spaces, newlines and tabs, usually ignored
1. Var: match valid variable names
1. Alias: An alias (Var) for a request parameter, optional
1. Value: A composite of a class (Var), a param name (Var) and an optional alias (Var)
1. CompositeValue: A composite of a class (Var), a param name (Var) and a collection of values
1. Values: a collection of Values and CompositeValues
1. Command: a composite of an entity (Var), a command (Var) and a collection of values (Values)

Now we know what the object types are, we can write the PEGJs rules to parse the DSL and create the AST.

# The full PEG

```javascript
/**********
 Starting rule, our entry point to the parser.
 The first part of the PEG extracts the entity name as a string,
 and makes the "entity" accessible in the JS below, allowing us to the AST and return it.
 It matches certain expected keywords, eg. "has", but does nothing with them.
 Finally it extracts the values, which have already been turned into a Values AST.
 You'll see the "_" rule used here, this means "accept/skip whitespace", it's defined below.
**********/
Command = entity:Var "." command:Var _ "has" _ "nothing"* _ values:Values* _
  {
    // Handle case that there are no values
    values = values.length === 0 ? [] : values[0];

    // Return the matched results with this object structure
    return {
      entity: entity,
      command: command,
      values: values
    }
  }

/**********
 Matches a collection of inputs, 0 to many, that are wrapped in parentheses
**********/
Values = "{" _ values:(CompositeValue/Value)* _ "}"
  {
    return values;
  }

/**********
 Value and CompositeValues always have the same initial shape, so I extracted
 this into a partial result that is extended by both Value and Composite
**********/
ValuePartial = _ "a" [n]? _ cls:Var _ name:Var _
  {
    return {
      class: cls,
      param: name
    }
  }

Value = value:ValuePartial alias:(Alias)? _
  {
    value.requestParam = (alias) ? alias: value.param;
    value.type = 'value';
    return value;
  }

/**********
 Extract the alias value, ignore the "from" string
**********/
Alias = _ "from" _ alias:Var
  {
    return alias;
  }

CompositeValue = value:ValuePartial "from" _ values:Values
  {
  	value.type = 'composite';
    value.values = values;
    return value;
  }

Var = name:[A-Za-z0-9_]*
  {
    return name.join("");
  }

/**********
 Match any sequence of "whitespace" characters
**********/
_ = [ \t\n\r]*
```

That's the full parser. The above will turn our DSL into the AST above.
You can check this out yourself. Simply go to the PegJS, open their [online editor](http://pegjs.org/online) and paste the above DSL and parser in. You'll see the results straight away.

As a side note, we're using a PegJS extension that outputs a PHP version of the parser, so we can use the same parser on the server as well as the client.

## Conclusion
As you can see writing a parser isn't that hard. Using that simple parser grammar, I'm able to automate part of my teams workload, ie, writing boilerplate (and error prone) adapters that turns HTTP requests into commands. These simple DSLs make that trivial.

After seeing the above in action, I hope you're thinking of all the things you could define and automate with a DSL. So why not write a simple DSL and parser, and try it out?

gha_language: PHP

gha_license_id: MIT


text:
# Interview technical questions collection
## Programming
1. 4 principles of OOP
```
- Bao đóng (encapsulation)
- Trừu tượng (abstraction)
- Kế thừa (inheritance)
- Đa hình (polymorphism)
```

## Web
1. Phân biệt khái niệm client side/server side,
```
- Client-side means that the action takes place on the user’s (the client’s) computer.
- Server-side means that the action takes place on a web server.
```

2. Phân biệt cookie/session
```
Cookies and Sessions are used to store information. Cookies are only stored on the client-side machine, while sessions get stored on the client as well as a server.
- Session:
    * A session creates a file in a temporary directory on the server where registered session variables and their values are stored. This data will be available to all pages on the site during that visit.
    * A session ends when the user closes the browser or after leaving the site, the server will terminate the session after a predetermined period of time, commonly 30 minutes duration.
- Cookies:
    * Cookies are text files stored on the client computer and they are kept of use tracking purpose. Server script sends a set of cookies to the browser. For example name, age, or identification number etc. The browser stores this information on a local machine for future use.
    * When next time browser sends any request to web server then it sends those cookies information to the server and server uses that information to identify the user.
```

## Algorithm
1. Các khái niệm nối chuỗi, cộng chuỗi, nổi bọt, sắp xếp các mảng
2. Tìm số lớn nhất trong một mảng, lớn thứ 2 trong mảng trong trường hợp có nhiều phần tử trùng lặp

## JavaScript
1. Các hàm Call, Bind, Apply trong JavaScript

## Database
1. Phân biệt các khái niệm MySQL/SQL, primary key/foreign key, having/where, char/varchar


text:
# Bitmap Index

## Use cases

Bitmap Index is used for filtering data read from ORC files and is used only by the **worker** nodes

- If this index exists on a column which is part of a predicate in the query, the performance may be improved while reading the ORC files.

For example, if an index exists on column `country` and the query is

``` sql
select * from table where country="China"
```

- This index works best if the column's values are not too distinct (e.g. country) and are distributed.

For example, assume that the table stores information about where users are from and the table data is in 10 files. There maybe be several users from a particular country, so each file will have some users from the country. If we create a bitmap index on the country column, we can perform filtering early on while reading the data files. i.e. the predicate is pushed down to the reading of the file. Without this index, all the data files will need to be read into memory as Pages and then the filtering would happen. With the index, we can ensure that the Pages already only contain the rows matching the predicate. This can help reduce the memory and CPU usage and can result in improved performance when many concurrent queries are running.


text:
# bs-chalk

[![version](https://img.shields.io/npm/v/bs-chalk.svg)](http://npm.im/bs-chalk)
[![downloads](https://img.shields.io/npm/dt/bs-chalk.svg)](http://npm.im/bs-chalk)
[![license](https://img.shields.io/npm/l/express.svg)](LICENSE)

BuckleScript tools for working with the Node [chalk](https://www.npmjs.com/package/chalk) library.

## Example

```reason
Js.log(
  Chalk.red("Express listen error: ")
  ++ Js.Option.getWithDefault("(no message)", Js.Exn.message(err))
)
```

## License

[BSD 2-Clause](LICENSE)

repository: ecliptic/bucklescript-tools

branch_name: refs/heads/develop

gha_language: OCaml

repo_name: ecliptic/bucklescript-tools


text:
## Integration guide: Using Airship with Vue
This guide will lead you through the process of integrating Airship with [Vue](https://vuejs.org/).

### Including Styles
Airship styles need to be globally included within our Vue application, so that we can use styles everywhere instead of including them inside any component scope. We are going to import them in the application's entry point via npm.

```
npm i @carto/airship-style
```

To import the styles, we need to include `airship.css` in the file:
```js
import<EMAIL_ADDRESS>```

If you are not using Vue CLI, you will need to include `css` webpack loader to be able to parse and include styles within your bundle as long as you have not had them installed yet.

To install CSS loader:
```
npm i css-loader style-loader -D
```

You will need to tell Webpack to use these loaders by changing the configuration file:
```js
{
  test: /\.css$/,
  use: [ 'style-loader', 'css-loader' ]
}
```

### Integrating Web Components
On top of adding Airship styles, we need to load our components into your application. You can do it below our styles import in the main entry point of the application.

First, we need to tell Vue to ignore elements starting with `as-`, which are our Airship components. We do not want Vue to raise an error everytime an Airship component is included in a template.

```js
import Vue from 'vue';

Vue.config.ignoredElements = [/as-\w+/];
```

Second, we need to import and define our Airship components. As we did before with Airship styles, we import them from npm, and then we need to execute `defineCustomElements` function.

```js
import { defineCustomElements } from '@carto/airship-components/dist/loader';

defineCustomElements(window);
```

#### Using Web Components in templates
To add a Web Component to a Vue template you just need to use the HTML syntax that is provided in the reference.

Although Web Components are supported in Vue, there is one caveat when it comes to injecting data into the component. The only properties that can be passed via attributes are text and number properties, whether via direct text or injecting the property in the template.

```html
<as-category-widget
  heading="Business Volume"
  description={widgetDescription}>
</as-category-widget>
```

To pass complex properties such as Objects and Arrays or listen to component events, you need to do it via Vue element reference or creating a mirror component.

##### Managing component with element reference
There are some properties that we cannot pass or events that we cannot listen to in the example above, such as category property or categoriesSelected event.

To get the element reference, we need to set `ref` property in the component template node.

```html
<template>
  <as-category-widget
    ref="categoryWidget"
    heading="Business Volume"
    description={widgetDescription}>
  </as-category-widget>
</template>
```

Element's reference will be in our Vue component's `refs` property, hence we will have full access to our Airship component.

##### Listening to component events
The best way to listen to component events is in `mounted` function in your desired component.

```js
export default {
  name: 'MyComponent',
  mounted: function () {
    this.categoryWidget = this.$refs.categoryWidget;

    this.categoryWidget.addEventListener('categoriesSelected', (event) => {
      console.log('Selected Categories', event.detail);
    });
  }
}
```

We create an easy-to-use reference to the widget so that we can reuse it in other parts of our component. Then, we listen to `categoriesSelected` event where you can put your own custom code to perform the action that you want.

It will only listen once to component event and it will not create multiple unneeded event listeners by doing it in `mounted` callback.

##### Passing complex properties to component
The way to pass complex properties to the component is very similar to listening to events.

To make the component react to property changes we need to create a watch over the property that holds our data. Once `watch` is ready, we need to set the new value of the property to the desired property in the component, like:

```js
export default {
  name: 'MyComponent',
  watch: {
    categories: function (newValue) {
      this.categoryWidget.categories = newValue;
    }
  }
}
```

###### Invoking component methods
To invoke a component method, we need to create a mirror method in our Vue component that executes the original method.

```js
export default {
  name: 'MyComponent',
  methods: {
    async getSelectedCategories: function () {
      return await this.categoryWidget.getSelectedCategories();
    },
    async clearSelection: function () {
      return await this.categoryWidget.clearSelection();
    }
  }
}
```

#### Mirroring Web Components with Vue component
Mirroring one Airship Component with a Vue component is pretty much like doing the same things as above but encapsulated within a single component.

To mirror the Airship Component, we need to create a new Vue component like this:

```html
<template>
  <as-category-widget
    heading={heading}
    description={description}
    show-clear-button={showClearButton}
    defaultBarColor={defaultBarColor}>
  </as-category-widget>
</template>

<script>
  export default {
    name: 'CategoryWidget',
    properties: {
      heading: String,
      description: String,
      showClearButton: Boolean,
      defaultBarColor: String,
      categories: Object
    },
    mounted: function () {
      this.categoryWidget = this.$refs.categoryWidget;
      this.categoryWidget.categories = this.categories;

      this.categoryWidget.addEventListener('categoriesSelected', (event) => {
        console.log('Selected Categories', event.detail);
      });
    },
    methods: {
      async getSelectedCategories: function () {
        return await this.categoryWidget.getSelectedCategories();
      },
      async clearSelection: function () {
        return await this.categoryWidget.clearSelection();
      }
    },
    watch: {
      categories: function (newValue) {
        this.categoryWidget.categories = newValue;
      }
    }
  }
</script>
```

It includes all the logic management encapsulated in one component. You do not have to mimick all component's properties or events either, only the ones that you are going to use.

And then, you will use that component as you would do with your other Vue components.

```html
<template>
  <CategoryWidget
    heading={heading}
    description={description}
    categories={categories} />
</template>

<script>
import CategoryWidget from './components/CategoryWidget.vue';

export default {
  name: 'app',
  components: {
    CategoryWidget
  },
  data: function () {
    return {
      heading: 'Business Volume',
      description: 'Description',
      categories: [
        { name: 'Category 1', value: 1000 }
        { name: 'Category 2', value: 500 }
      ]
    };
  }
}
</script>
```

repository: VinayaSathyanarayana/airship

repo_name: VinayaSathyanarayana/airship


text:
### Speech to Draw
Let's draw Balls and Triangles on p5 canvas using voice recognition 🗣

### Voice Control
- say `ball` to draw a 🔴
- say `triangle` to draw a ◣

### Libraries
- [p5.js](https://p5js.org/)
- [p5.Speech](https://idmnyu.github.io/p5.js-speech/)

### Live Demo
https://www.zulhilmi.id/speech-to-draw/

repository: HilmiZul/speech-to-draw

repo_name: HilmiZul/speech-to-draw


text:
# Solutions for Human Resource Machine
[**human-resource-machine-solutions**](human-resource-machine-solutions) has all my solutions to the puzzle game "[Human Resource Machine](http://tomorrowcorporation.com/humanresourcemachine)". To my understanding, "Human Resource Machine" is a fun game simulating assembly programming. I really enjoy seeing how it works, knowing the restricted set of command and optimizing solutions for speed and/or size. Here, I record my exciting journey.

This collection is just my own solutions, not necessarily the best. For the best and the most comprehensive collection of solutions, I would go to [this repo](https://github.com/atesgoral/hrm-solutions) and [its website](http://atesgoral.github.io/hrm-solutions/).
### Notes:
1. Two interesting ideas/concepts I've learned from others:
   * "[Loop unrolling](https://en.wikipedia.org/wiki/Loop_unrolling)": a space-time tradeoff which optimize speed at the expense of size. Learned from the [Steam forum](https://steamcommunity.com/app/375820/discussions/0/483367798502748659/) and used in the [solution for year 2](human-resource-machine-solutions/02-Busy-Mail-Room-5.25.txt)
   * Optimize speed by jumping back (save one jump step) and skipping the first output: learned from [another solution](https://github.com/atesgoral/hrm-solutions/blob/master/solutions/09-Zero-Preservation-Initiative-5.25/5.25-nanashi-juanto.asm) and used in solutions for [year 9](human-resource-machine-solutions/09-Zero-Preservation-Initiative-5.25.txt), [year 13](human-resource-machine-solutions/13-Equalization-Room-9.27.txt) and [year 16](human-resource-machine-solutions/16-Absolute-Positivity-8.34.txt). To understand the difference, compare the following two:
      * Straightforward code

            a:
            b:
                INBOX
                JUMPZ    c
                JUMP     b
            c:
                OUTBOX
                JUMP     a
      * Optimized code

               JUMP     b
            a:
                OUTBOX
            b:
            c:
                INBOX
                JUMPZ    a
                JUMP     c
        For each run, optimized code has one more `JUMP` than straightforward code. However, for each zero output, optimized code saves one `JUMP` by jumping up back directly. Therefore, as long as there is one zero output, optimized code won't be worse than straightforward code.
1. Selected interesting challenges

|Challenges|Notes|
|---|---|
|[Year 28 - size](human-resource-machine-solutions/28-Three-Sort-34.98.txt)|Pair-wise comparison for every new number; use the storage without swapping numbers.|
|[Year 40](human-resource-machine-solutions/40-Prime-Factory-27.355.txt)|Initialize a slot with "1" for odd number sequence after processing "2".|
|[Year 41](human-resource-machine-solutions/41-Sorting-Floor-27.714.txt)|Pair-wise comparison for every new number|

repository: yunhailuo/miscellaneous

repo_name: yunhailuo/miscellaneous


text:
## Schema Introspection

> [Specification](https://facebook.github.io/graphql/June2018/#sec-Schema-Introspection)

Introspecting a schema produces an executable schema. Queries can be executed against this schema normally.

Create and introspect a schema

```csharp
#include::xref://tests:GraphQL.Tests/Introspection/IntrospectSchemaFacts.cs?s=Tanka.GraphQL.Tests.Introspection.IntrospectSchemaFacts.IntrospectSchemaFacts
```

Combination of the source schema and the introspection schema can be used to provide the normal executable schema with introspection support.

### Type Kinds

Scalar

```csharp
#include::xref://tests:GraphQL.Tests/Introspection/IntrospectSchemaFacts.cs?s=Tanka.GraphQL.Tests.Introspection.IntrospectSchemaFacts.Type_ScalarType
```

Object type

```csharp
#include::xref://tests:GraphQL.Tests/Introspection/IntrospectSchemaFacts.cs?s=Tanka.GraphQL.Tests.Introspection.IntrospectSchemaFacts.Type_ObjectType
```

Union type

```csharp
#include::xref://tests:GraphQL.Tests/Introspection/IntrospectSchemaFacts.cs?s=Tanka.GraphQL.Tests.Introspection.IntrospectSchemaFacts.Type_UnionType
```

Interface type

```csharp
#include::xref://tests:GraphQL.Tests/Introspection/IntrospectSchemaFacts.cs?s=Tanka.GraphQL.Tests.Introspection.IntrospectSchemaFacts.Type_InterfaceType
```

Enum type

```csharp
#include::xref://tests:GraphQL.Tests/Introspection/IntrospectSchemaFacts.cs?s=Tanka.GraphQL.Tests.Introspection.IntrospectSchemaFacts.Type_EnumType
```

Input object

```csharp
#include::xref://tests:GraphQL.Tests/Introspection/IntrospectSchemaFacts.cs?s=Tanka.GraphQL.Tests.Introspection.IntrospectSchemaFacts.Type_InputObjectType
```

repository: pekkah/tanka-graphql

gha_language: C#

repo_name: pekkah/tanka-graphql


text:
# ![alt text](https://avatars2.githubusercontent.com/u/1263946?v=3&s=84 "KBase") [KBase SDK](../README.md)

1. [Install SDK Dependencies](kb_sdk_dependencies.md)
2. [Install and Build SDK](kb_sdk_install_and_build.md)
3. [Create Module](kb_sdk_create_module.md)
4. [Edit Module and Method(s)](kb_sdk_edit_module.md)
5. **Locally Test Module and Method(s)**
6. [Register Module](kb_sdk_register_module.md)
7. [Test in KBase](kb_sdk_test_in_kbase.md)
8. [Complete Module Info](kb_sdk_complete_module_info.md)
9. [Deploy](kb_sdk_deploy.md)

### 5. Locally Test Module and Method(s)

#### 5A. Edit Dockerfile

The base KBase Docker image contains a KBase Ubuntu image, but not much else.  You will need to add whatever dependencies, including the installation of whatever tool you are wrapping, to the Dockerfile that is executed to build a custom Docker image that can run your Module.

For example:

```
RUN \
  git clone https://github.com/voutcn/megahit.git && \
  cd megahit && \
  git checkout tags/v1.0.3 && \
  make
```

Note: you do not have to add any lines to the Dockerfile for installing your SDK Module code, as this will happen automatically.  The contents of your SDK Module git repo will be added at /kb/module.

It is also important to note that layers in the Docker image are generated by each command in the Dockerfile.  For a streamline Docker image which will deploy on a worker node more quickly and make cycles of Docker image builds faster, it is best to remove any large, extraneous files, such as a tarball from which you installed a tool.

RUN rm -rf tarball.tgz
```

because the latter does not remove the previous bloating layers, despite the "rm" command.

#### 5B. Build tests of your methods

Edit the local test config file (`test_local/test.cfg`) with a KBase user account name and password (note that this directory is in .gitignore so will not be copied to github.  You're safe!):

    test_user = TEST_USER_NAME
    test_password = TEST_PASSWORD

*In the Docker shell*, run tests:

    cd test_local
    kb-sdk test

This will build your Docker container, run the method implementation running in the Docker container that fetches example ContigSet data from the KBase CI database and generates output.

Inspect the Docker container, such as seeing whether your wrapped tool was installed properly, by dropping into a bash console and poke around.  From the `test_local` directory:

    ./run_bash.sh

Unfortunately, you will have to rebuild the Docker image each time you change your module code (e.g. KIDL \<MyModule\>.spec, \<MyModule\>Impl.py, and your testing code) but this happens automatically for you when you run *kb-sdk test*, so it just slows you down rather than add any extra effort.  However, if you change the KIDL \<MyModule\>.spec file, you will have to rerun *make* to propagate those changes to the \<MyModule\>Client and \<MyModule\>Impl code (and likely will have some tweaks to apply to the Impl code to match the spec changes).  Happy debugging!

**(don't forget to *git commit* and *git push* your edits to your github repo)**

[\[Back to top\]](#top)

[\[Back to steps\]](../README.md#steps)

gha_language: Java


text:
# Azure Networking - Private Link

- [Private Endpoint Overview](#private-endpoint-overview)
- [Limitations](#limitations)
  - [Routing](#routing)
  - [NSG](#nsg)
  - [UDR](#udr)
- [Network architecture design with Azure Firewall](#network-architecture-design-with-azure-firewall)
- [DNS resolution](#dns-resolution)
  - [DNS integration at scale](#dns-integration-at-scale)
  - [Pitfall - Resolve PaaS endpoint in other tenants](#pitfall---resolve-paas-endpoint-in-other-tenants)
  - [Subresources and DNS zone group](#subresources-and-dns-zone-group)
- [Multi-region scenarios](#multi-region-scenarios)
  - [Use of Azure Private Link / SDN](#use-of-azure-private-link--sdn)
  - [Inter-region failover](#inter-region-failover)
  - [Hybrid private link connectivity](#hybrid-private-link-connectivity)
- [CLI example](#cli-example)
- [Private Link](#private-link)
- [Quick Recipes](#quick-recipes)

## Private Endpoint Overview

In the above diagram:

* **Azure Private Endpoint**: a special network interface for an Azure service in your vNet, it gets an IP from the address range of a subnet
* Applications in the vNet can connect to the service over the private endpoint seamlessly, **using the same connection string and authorization mechanisms that they would use otherwise**;
* The Storage account **DOESN'T** need a network rule to allow traffic from the private endpoint, the network rules only control access through the public endpoint. Private endpoints instead rely on the consent flow for granting subnet access.

Notes

- A read-only network interface is created alongside a private endpoint
- Connections can only be initiated in one direction: from client to the endpoint
- **Outbound NSG rules do not affect PE connectivity, you could set a Deny-all outbound rule on the NSG, a PE could still connect to its service**
- For some service, you need separate private endpoints for each sub-resource, for a RA-GRS storage account, there are sub-resources like `blob`, `blob_secondary`, `file`, `file_secondary`, ...
- Private endpoints **DO NOT** restrict public network access to services, except **Azure App Service** and **Azure Functions**, they become inaccessible publicly when they are associated with a private endpoint. Other PaaS services may have additional access control. (*such as the `publicNetworkAccess` property, this property is not always visible in the Portal*)
- The connected private link resource could be in a different region
- To allow automatic approval for private endpoints, you need this permission on the private-link resource: `Microsoft.<Provider>/<resource_type>/privateEndpointConnectionsApproval/action`

## Limitations

See: https://docs.microsoft.com/en-us/azure/private-link/private-endpoint-overview#limitations

Private endpoint is a **special** network interface, works differently to VM NICs

### Routing

![Private link routing](./images/azure_private-link-routing.drawio.svg)

In the scenario above, you might expect the data packet goes from VM in West Europe to PEP in East US, then back to the storage account. But in reality, Azure SDN does some intelligent optimization, the PEP is bypassed, the packet stays in the same region, goes to the storage account directly.

- This applies to connection from on-prem as well.
- If any NSG applies to the PEP, it's still checked.
- If there is an NVA/Firewall in between, and traffic routes through it, then the optimization won't apply.
- This explains the unusual behaviors (comparing to VM NICs) of PEPs regarding NSG and UDR.

### NSG

- Effective routes and security rules won't be displayed for the private endpoint NIC in the Azure portal, making debugging hard.
- **NSG flow logs** (Traffic Analytics as well) are not supported.
- NSG only apply when `PrivateEndpointNetworkPolicies` property on the containing subnet is "Enabled".
  - By default,
      - if creating a subnet in Portal, this property is `Disabled`
      - if creating with Terraform `azurerm_subnet` resource,
        - `private_endpoint_network_policies_enabled` attribute defaults to `true`, which sets this property to `Enabled`
        - the old `enforce_private_link_endpoint_network_policies` attribute works the other way, if it's `true`, the property will be `Disabled`
  - With CLI or Terraform, you can only set it to be `Enabled` or `Disabled`
  - In the Portal, you could enable only NSG or UDR, then the value would be `NetworkSecurityGroupEnabled` or `RouteTableEnabled`
- Source port is interpreted as `*`
- Rules with multiple port ranges may not work as expected (see the doc)
- No need for outbound deny rules on a private endpoint, as it can't initiate traffic

### UDR

- When you add a private endpoint, Azure would add a route to ***all the route tables in the hosting and any peered vnets***, so all traffic to the private endpoint from these vnets goes directly, bypassing NVA:

    | Source  | State  | Address Prefixes | Next Hop Type     | Next Hop IP Addres |
    | ------- | ------ | ---------------- | ----------------- | ------------------ |
    | Default | Active | <IP_ADDRESS>/32      | InterfaceEndpoint |                    |

  To overwrite this `/32` route, when `PrivateEndpointNetworkPolicies` property (of the hosting subnet, not client vnets)
    - is "Enabled", you could use a shorter prefix to overwrite it, so you won't running into the limit of 400 routes per table, in the following table, *a UDR with a shorter `/16` prefix overwrites a `/32` private endpoint route, this is an exception to the general precedence order*

      | Source  | State   | Address Prefixes | Next Hop Type     | Next Hop IP Addres |
      | ------- | ------- | ---------------- | ----------------- | ------------------ |
      | User    | Active  | **<IP_ADDRESS>/16**  | Virtual appliance | <IP_ADDRESS>           | my-custom-route |
      | Default | Invalid | <IP_ADDRESS>/32      | InterfaceEndpoint |                    |

    - is "Disabled", you need to add another route with the same `/32` prefix(on client subnet's UDR), you could easily hit the 400 routes per table limit if there are a lot of PEs

      | Source  | State   | Address Prefixes | Next Hop Type     | Next Hop IP Addres |
      | ------- | ------- | ---------------- | ----------------- | ------------------ |
      | User    | Active  | **<IP_ADDRESS>/32**  | Virtual appliance | <IP_ADDRESS>           | my-custom-route |
      | Default | Invalid | <IP_ADDRESS>/32      | InterfaceEndpoint |                    |

- Even `PrivateEndpointNetworkPolicies` is "Enabled", return traffic from PEs always go back to the source IP directly, **UDRs do not apply**, the return traffic could be asymmetric, bypassing NVA.
  - To mitigate this, use SNAT at the NVA, then the private endpoint see the NVA IP as source IP, this ensures symmetric routing
  - But there are exceptions (https://github.com/MicrosoftDocs/azure-docs/issues/69403), in the following cases, the return traffic does go through NVA, SNAT is not required:
    - Connecting to a storage PE (tested `blob`, not sure about other services)
    - Connecting via VPN
    - **Source and NVA are in different VNETs** (no matter whether source and PE are in the same VNET or not), this seems to be the best way to handle it, keeping NVA in the hub vnet, workload and PEs in spoke vnets

## Network architecture design with Azure Firewall

See: https://docs.microsoft.com/en-us/azure/private-link/inspect-traffic-with-azure-firewall

- Hub and spoke - Dedicated VNET for PEs

  ![Dedicated VNET for PEs](images/azure_private-endpoint-hub-and-spoke.png)

  *This was recommended to avoid the 400 route limit, but now if you enable `PrivateEndpointNetworkPolicies` on the PE subnet, you probably won't need to worry about this limit anymore. So this design is similar to the one below.*

- Hub and spoke - Shared

  ![Shared VNET for PEs](images/azure_private-endpoint-shared-spoke.png)

  *If you enable `PrivateEndpointNetworkPolicies` on the PE subnet, you don't need the overwrite with `/32` route anymore, you could overwrite with a shorter prefix , such as `/16`*

## DNS resolution

Microsoft documentation: https://docs.microsoft.com/en-us/azure/private-link/private-endpoint-dns#azure-services-dns-zone-configuration

**There are many pitfalls/challenges regarding private endpoint DNS resolution (and network routing), see:**
- https://github.com/dmauser/PrivateLink
- https://journeyofthegeek.com/2020/03/06/azure-private-link-and-dns-part-2/

Let's say you have a blob endpoint at `garystoryagefoo.blob.core.windows.net`, after you add a private endpoint, the FQDN would be a CNAME to `garystoryagefoo.privatelink.blob.core.windows.net.` (CNAME insertion only happens when the **PE is in "Approved", not if "Rejected"**)

- For external users, it should resolve to a public IP
- For internal users, it should resolve to a private IP (by Azure Private DNS Zone or your own DNS server)

Before private endpoint (Internal or external):

```sh
garystoryagefoo.blob.core.windows.net. 78 IN CNAME blob.syd26prdstr02a.store.core.windows.net.
blob.syd26prdstr02a.store.core.windows.net. 75 IN A <IP_ADDRESS>
```

After:

  - External:

    ```sh
    # after
    garystoryagefoo.blob.core.windows.net. 120 IN CNAME garystoryagefoo.privatelink.blob.core.windows.net.
    garystoryagefoo.privatelink.blob.core.windows.net. 119 IN CNAME blob.syd26prdstr02a.store.core.windows.net.
    blob.syd26prdstr02a.store.core.windows.net. 119 IN A <IP_ADDRESS>
    ```

  - Internal (private DNS auto configured):

    ```sh
    # this is by Azure provided DNS (<IP_ADDRESS>)
    # if you have private DNS Zone "privatelink.blob.core.windows.net." linked to the same vnet, it would consult the zone
    garystoryagefoo.blob.core.windows.net. 60 IN CNAME garystoryagefoo.privatelink.blob.core.windows.net.
    # this is the record in the private DNS Zone
    garystoryagefoo.privatelink.blob.core.windows.net. 9 IN A <IP_ADDRESS>
    ```

On the client side, you must use the PasS service public FQDN, this is to ensure SNI (Service Name Indication) on TLS still works (see https://github.com/dmauser/PrivateLink/tree/master/DNS-Integration-Scenarios#74-server-name-indication-sni-on-tls-request-client-hello).

For example, when you access the data in the storage account from an Azure VM, **the Portal always loads data from `garystoryagefoo.blob.core.windows.net`, depending on your VM's DNS setting, it could be resolved to either a public IP or a private one**

For a web app, there will be two endpoints: `my-webapp.azurewebsites.net`, `my-webapp.scm.azurewebsites.net` pointing to the same IP, when enabling private endpoints, you only need one private DNS zone `privatelink.azurewebsites.net`, with two record sets in it like the following

```
my-webapp         <IP_ADDRESS>
my-webapp.scm     <IP_ADDRESS>
```

A few scenarios for DNS resolution:

- Single vNet without custom DNS server

  ![Private endpoint DNS in single vnet](images/azure_private-endpoint-single-vnet-azure-dns.png)

- Hub-spoke vnets without custom custom DNS server

  ![Private endpoint DNS in hub-spoke vnets](images/azure_private-endpoint-hub-and-spoke-azure-dns.png)

- Use a DNS forwarder

  ![Private endpoint DNS with a DNS forwarder](images/azure_private-endpoint-dns-forwarder.png)

  A Domain Controller integrated DNS Server as a DNS forwarder:

  ![Private endpoint DNS with DC integrated DNS](images/azure_dns-resolution.drawio.svg)

- Using Active Directory (see https://github.com/dmauser/PrivateLink/tree/master/DNS-Scenario-Using-AD)

  The key here is to setup **different AD DNS Application Partitions**, one for Azure, one for on-prem

  ![DC integrated DNS](images/azure_private-link-ad-scenario.png)

### DNS integration at scale

See: https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/private-link-and-dns-integration-at-scale

With hub-spoke network architecture in an Enterprise landing zone scenario, you would like to
  - put all private DNS zones for private link endpoints in the connectivity subscription
  - allow each application team to create private endpoint, and have A records added to the central private DNS zones automatically (without help from the central IT team)

You could achieve this by using Azure Policy (assigned to landingzone subscriptions, not the connectivity subscription):
  - (Optional) `Deny` public endpoint for PaaS services
  - `Deny` creating of a private DNS zone with `privatelink` prefix
  - `DeployIfNotExists` policy to automatically create `privateDnsZoneGroups`, which associate private endpoints to private DNS zones in the connectivity subscription, the managed identity needs two permissions:
    - `Network Contributor` for the private endpoint to add `privateDnsZoneGroups` to the PE
    - `Private DNS Zone Contributor` for the private DNS zones to add 'A' records

### Pitfall - Resolve PaaS endpoint in other tenants

See: https://github.com/dmauser/PrivateLink/tree/master/Issue-Customer-Unable-to-Access-PaaS-AfterPrivateLink

There is a gotcha in all the above scenarios:

  - Company A access its KV `kv-a.vault.azure.net` through a private endpoint, it also access a KV in company B's tenant, `kv-b.vault.azure.net` through a public endpoint (resolves to a public IP).
  - Company B enables private endpoint for `kv-b.vault.azure.net`
  - Now company A can't resolve `kv-b.vault.azure.net`, since now it CNAME to `kv-b.privatelink.vaultcore.azure.net`, Azure provided DNS consults the linked private DNS zone, which doesn't have a record for `kv-b`

To remediate this, you could
  - (**recommended**) create a private endpoint in Company A's vnet to `kv-b.vault.azure.net` (need approval from Company B's side)
  - in your custom DNS server, conditionally forward `kv-b.vault.azure.net` to an Internet DNS resolver
  - (**not recommended**) on client VMs, use dnsmasq for Linux or NRPT (Name Resolution Policy Table) feature for Windows (see: https://github.com/dmauser/PrivateLink/tree/master/DNS-Client-Configuration-Options)

### Subresources and DNS zone group

- Subresources

  - Some services have multiple subresources, eg. A storage account could have endpoints for `blob`, `blob_secondary`, `file`, `file_secondary`, ..., one private endpoint supports **ONLY ONE** subresource

  - Some subresources could have multiple DNS records, using the **same IP**, eg. an Azure Web Apps endpoint have two DNS records:
    - `app-xxx.privatelink.azurewebsites.net`
    - `app-xxx.scm.privatelink.azurewebsites.net`

  - Some subresources could have multiple DNS records, each with a **different IP**, eg. ACR `registry`, Azure File Sync `afs`, AKS `management`, Cosmos DB `Sql`, this could be configured in Terraform like this:

    ```terraform
    resource "azurerm_private_endpoint" "cosmos" {

      ...

      ip_configuration {
        name               = "ip-config-01"
        private_ip_address = "<IP_ADDRESS>"
        subresource_name   = "Sql"
        member_name        = "cosmos-db-001"
      }

      ip_configuration {
        name               = "ip-config-02"
        private_ip_address = "<IP_ADDRESS>"
        subresource_name   = "Sql"
        member_name        = "cosmos-db-001-australiaeast"
      }

      ...

    }
    ```

- DNS zone group
  - A private endpoint can only have none or one private DNS zone group
  - A DNS zone group support up to 5 DNS zones, which means the same records could be added to multiple DNS zones

## Multi-region scenarios

See: https://github.com/adstuart/azure-privatelink-multiregion

When designing for multi-region deployment, BCDR scenarios, there are two options for private endpoint DNS zones, you could have:

1. Private DNS zone per region: a PaaS service could have a separate endpoint in each region, same FQDN with different IP in each zone
2. Shared private DNS zone: one zone, one IP, one active endpoint

Each option has its advantage and disadvantages.

### Use of Azure Private Link / SDN

![Private DNS zones inter region transit](./images/azure_private-dns-zone-multi-region-datapath.drawio.svg)

- **Zone per region**: Optimal, each region has its own private endpoint to the same PaaS services, ingress to private link close to source, inter-region routing transit handled by Azure. *(in the corresponding zone, they have same FQDN, but a different IP)*
- **Shared zone**: Non-optimal, inter-region data path relies on customer's inter-region routing solution *(you can only have one record for a PaaS service instance in a shared zone)*

###  Inter-region failover

![Private DNS zones inter region failover](./images/azure_private-dns-zone-multi-region-failover.drawio.svg)

*We use storage account as example above, because it's GRS, data is replicated to paired region automatically, after failover, the one in the failover region is effectively an LRS account*

- **Zone per region**: Optimal, no manual intervention needed (same as using the PaaS public endpoint)
- **Shared zone**: Upon failover, need user-intervention in the shared zone to point FQDN to IP of the private endpoint in the failover region

Actually, there are different scenarios for different PaaS services, if the PaaS service use the same FQDN for regional replicas, then you need user-intervention during failover if using a shared zone

| Service   | FQDN                                                                                | How to replicate                                           | Failover simulation ? |
| --------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | --------------------- |
| Key Vault | Only one                                                                                | KeyVault data is automatically replicated to paired region | No                    |
| Storage   | Only one (a read-only secondary one for RA-GRS, RA-GZRS)                                                       | GRS, GZRS, RA-GRS, RA-GZRS                                 | Yes                   |
| Cosmos DB | `cosmon-demo.mongo.cosmos.azure.com` (global FQDN)
-> `cosmon-demo.privatelink.`
-> regional endpoints | Multi-region support                                       | Yes                   |

Some PaaS services have a global alias, and different FQDNs for regional replicas, you could add both to the shared zone, so you may not need any user-intervention during failover

For example, PaaS SQL instance in East US (`sql-demo-eus`) is replicated to West US as `sql-demo-wus`, you could add both to a shared private DNS zone `privatelink.database.windows.net`

They are in one failover group `fog-demo`, usually it points to `sql-demo-eus`, after failover, it points to `sql-demo-wus`

| Service               | FQDN                                                                                | How to replicate                                     | Failover simulation ? |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | --------------------- |
| SQL                   | `fog-demo.database.windows.net` (failover group)
-> `sql-demo-eus`, `sql-demo-wus` (regional)
-> privatelink FQDN                   | Failover group (one PaaS instance in each region)    | Yes                   |
| Event Hub/Service Bus | `evhns-alias-demo.servicebus.windows.net` (alias)
 -> `evhns-demo-eus`, `evhns-demo-wus` (regional)
 -> privatelink FQDN      | Namespace pairing (one PaaS instance in each region) | Yes                   |

### Hybrid private link connectivity

See https://github.com/adstuart/azure-privatelink-multiregion#6-appendix-a---hybrid-forwarding-and-multi-region-private-link-considerations-when-accessing-from-on-premises

- **Zone per region**: could be a problem, depending on-prem DNS software used (BIND v9, Infoblox)
- **Shared zone**: no issues

## CLI example

```sh
# get the resource id of the storage account
id=$(az storage account show \
      -g default-rg \
      -n garystoryagefoo \
      --query '[id]' \
      -o tsv
    )

# the `PrivateEndpointNetworkPolicies` controls whether NSG and UDR are applied to private endpoints
# this step is not required, see notes above about NSG limitations
az network vnet subnet update \
    --name default \
    --resource-group default-rg \
    --vnet-name default-vnet \
    --disable-private-endpoint-network-policies true

# create private endpoint in a vnet
az network private-endpoint create \
      --name myPrivateEndpoint \
      -g default-rg \
      --vnet-name default-vnet \
      --subnet default \
      --private-connection-resource-id $id \
      --group-id blob \
      --connection-name myConnection

# create a private dns zone
az network private-dns zone create \
    --name "privatelink.blob.core.windows.net"

# link the private dns to a vnet
az network private-dns link vnet create \
    --zone-name "privatelink.blob.core.windows.net" \
    --name MyDNSLink \
    --virtual-network default-vnet \
    --registration-enabled false

# register the private endpoint in the private dns
az network private-endpoint dns-zone-group create \
   --endpoint-name myPrivateEndpoint \
   --private-dns-zone "privatelink.blob.core.windows.net" \
   --name MyZoneGroup \
   --zone-name storage
```

## Private Link

Connection between the private endpoint and the storage service uses a **private link**, which traverses only Microsoft backbone network

- A Private Link can connect to Azure PaaS services, Azure hosted customer-owned/partner services.
- A Private Link service receives connections from multiple private endpoints. A private endpoint connects to one Private Link service.
- Private Link works across Azure AD tenants
- No gateways, NAT devices, ExpressRoute or VPN connections, or public IP addresses are needed.
- **Azure App Service** and **Azure Functions** become inaccessible publicly when they are associated with a private endpoint, other Azure services require additional access controls.
- To make your service private to consumers in Azure, place your service behind a standard Azure Load Balancer, then you can create a Private Link Service referencing the load balancer.
  - Choose a subnet for NAT IP addresses
  - You need disable `privateLinkServiceNetworkPolicies` on this subnet, only applies to the NAT IP you chose, NSG still applies to other resources in the subnet

    ```sh
    az network vnet subnet update \
      --name default \
      --resource-group myResourceGroup \
      --vnet-name myVirtualNetwork \
      --disable-private-link-service-network-policies true
    ```

  - All consumer traffic will appear to originate from this pool of private IP addresses (<IP_ADDRESS> in the diagram below) to the service provider.

  ![Private link service](images/azure_private-link-service.png)

## Quick Recipes

- List private endpoints with linked private DNS zones

  **NOTE**: A private endpoint could have an empty private DNS zone group, then the built-in private DNS zone group policies can't catch it, because it's compliant.

  The following script could help find endpoints that don't have a DNS zone group or have an empty one.

  ```sh
  #!/bin/env bash

  # get PE name and resource group in a file
  az network private-endpoint list --query "[].[name, resourceGroup]"  -otsv > "pe-name-rg-list.txt"

  readarray rows < pe-name-rg-list.txt

  for row in "${rows[@]}";do
    row_array=(${row})
    name=${row_array[0]}
    rg=${row_array[1]}

    # an endpoint can only have one DNS zone group
    DNS_ZONE_ID=$(az network private-endpoint dns-zone-group list --endpoint-name $name -g $rg --query "[0].privateDnsZoneConfigs[0].privateDnsZoneId" -otsv)

    echo ${name} - ${DNS_ZONE_ID}
  done
  ```

- Re-enable a private endpoint

  Seems like you cannot approve a "Rejected" private endpoint in the Portal, it could be done via CLI:

  ```sh
  az network private-endpoint-connection approve \
    -g rg-test \
    -n pe-test \
    --resource-name kv-test \
    --type Microsoft.Keyvault/vaults \
    --description "Re-enable the endpoint"
  ```

repository: garylirocks/quickrefs

extension: markdown

repo_name: garylirocks/quickrefs


text:
---
title: Observers
---

Observers are the elements within an Arez application that react to changes. Observers are about
initiating effects. Each observer is associated with a tracked function. When the function executes,
Arez tracks which [observables](observables.md) and [computed values](computed_values.md) are accessed
within the scope of the function and these elements are recorded as dependencies of the observer. Any
time a dependency is changed, Arez will re-schedule the observer. There are three types of observer
supported within Arez; **Autorun** observers, **Tracker** observers and **When** observers.

## Autorun Observers

The Arez scheduler is responsible for scheduling the tracked function for autorun observers. Normally when
an autorun observer is defined, the tracked function will be triggered once immediately and then once again
any time the dependencies change. The Arez scheduler is also responsible for wrapping the tracked function in a
tracking transaction.

There are several low-level {@api_url: ArezContext.autorun(*)::ArezContext::autorun(arez.Procedure)}
methods that can be used to create autorun observers, however most users will use more high-level APIs such as
the [@Autorun](at_autorun.md) annotation.

An example of a basic autorun observer:

{@file_content: file=arez/doc/examples/autorun/AutorunExample.java "start_line=^  {" "end_line=^  }" include_start_line=false include_end_line=false strip_block=true}

An example of an autorun observer that is explicitly named, uses a read-only transaction and returns a value:

{@file_content: file=arez/doc/examples/autorun/AutorunExample2.java "start_line=^  {" "end_line=^  }" include_start_line=false include_end_line=false strip_block=true}

## Tracker Observers

Tracker observers separate the tracked function from the callback that is scheduled when the dependencies
change. This type of observer is used when you need to integrate into a framework that has it's own scheduler
or when you need to take more control of the scheduling of observers (i.e. to debounce changes or limit the
invocation of the tracked function to at most once per second).

A tracker observer is more complex than autorun observers within Arez. The developer must explicitly create
the observer via {@api_url: ArezContext.tracker(*)::ArezContext::tracker(arez.Procedure)}
invocation.

{@file_content: file=arez/doc/examples/tracker/TrackerExample.java "start_line=^  {" "end_line=^  }" include_start_line=false include_end_line=false strip_block=true}

As with Autorun observers these primitive APIs are unlikely to be directly used by the user but it is more likely
that they will be used indirectly by high-level apis such as the [@Track](at_track.md) annotation.

## When Observers

When observers contain two functions; the condition function and the effect callback. The condition function
is the tracked function that re-executes anytime a dependency changes and returns a boolean value. When the
condition callback returns true, the observer invokes the effect function as an action and disposes itself.
i.e. "When" observers are used when the developer needs to perform an action when a condition is true.

A when observer is more complex than other observers within Arez. The when observer is actually composed of
an autorun observer, a computed property and an action. There are several low-level
{@api_url: ArezContext.when(*)::ArezContext::when(arez.SafeFunction,arez.SafeProcedure)} methods that can be
used to create when observers.

An example of a basic autorun observer:

{@file_content: file=arez/doc/examples/when/WhenExample.java "start_line=^  {" "end_line=^  }" include_start_line=false include_end_line=false strip_block=true}

## Error Handling

Exceptions thrown in an autorun observers's tracked function or a tracker observer's schedule callback are caught by
the Arez scheduler and passed to an error handler. This is to make sure that an exception in one observer does not
prevent the scheduled execution of other observers. This also allows observers to recover from exceptions; throwing
an exception does not break the tracking done by Arez, so a subsequent scheduling of an observer will complete
normally again if the cause for the exception is removed.

The error handlers are added and removed from the `ArezContext` by way of the {@api_url: ArezContext.addObserverErrorHandler(ObserverErrorHandler)::ArezContext::addObserverErrorHandler(arez.ObserverErrorHandler)}
and {@api_url: ArezContext.removeObserverErrorHandler(ObserverErrorHandler)::ArezContext::removeObserverErrorHandler(arez.ObserverErrorHandler)}
methods. A simple example that emits errors to the browsers console in a browser environment follows:

{@file_content: file=arez/doc/examples/observer_error/ObserverErrorHandlerExample.java "start_line=^  {" "end_line=^  }" include_start_line=false include_end_line=false strip_block=true}


text:
# nodejs-mqtt-data-logger
**THIS IS A WORK IN PROGRESS**

It's far from complete and this far not usable at all.

## What is this?
I was looking for a decent way to long-term log my energy usage for some outlets. Charting wasn't the most important part, but seeing exact values of kWh used per month several years back was important. Since I didn't find a complete solution for that I started writing this.

This should run as a daemon and will then read data from a MQTT Broker to which energy usage is sent. The read data will then be stored into a database (SQLite). Only changes will be written and on an hourly basis it will aggregate energy usage into daily values. Detailed (raw) data entries will be deleted after a defined number of days.

# TODO list
- [x] Log data to SQLite.
- [x] Handle counters from hardware that resets the value from time to time (Shelly for example).
- [x] Add HTTP support to view the data.
- [x] Aggregate hourly data into another database table.
- [x] Aggregate daily data into another database table.
- [x] Remove detailed (raw) data after X number of days.
- [ ] Remove data from hourly/daily as well.
- [ ] Get all last values on startup instead.
- [ ] Add daily data chart
- [ ] Add real-time chart using table raw_data.

## Dependencies
* [mqtt](https://www.npmjs.com/package/mqtt)
* [mqtt-match](https://www.npmjs.com/package/mqtt-match)
* [sqlite3](https://www.npmjs.com/package/sqlite3)
* [node-schedule](https://www.npmjs.com/package/node-schedule)
* [highcharts](https://www.npmjs.com/package/highcharts)


text:
![image](https://user-images.githubusercontent.com/68574177/126581945-2c884173-0c04-4aca-8865-03cbf1cd2ddf.png)

CalenDOC is an app created for a user to manage all his or her medical appointments, with date and physician details. The user can also leave a review to help other users make the right choice before scheduling an appointment.

## Installation

Start this application by running:

1. `bundle`
2. `rake db:migrate`
3. `rails s`
4. Open localhost:3000 in your browser and test it out!

## License

MIT License


text:
# Argser
Argser is a library to handle Inputs/Configuration for Programs

## Structure
### argser
The actual Library/Crate that will be consumed in the End

### argser-macros
This provides the proc-macros that are provided by the crate


text:
# deleteFilesAfterNDays

This script deletes all files that are older n days. You can set the days in the script. It uses the creation date that is in the filename.

## Structure of the Filename (Examples):
```
ftp_20180410_172342.mp4
MDalarm_20180410_202829.mkv
```
The script extracts the creation date (filename) and compares it to the actual date.

## Author
Christian Högerle

## Licensing
The code in this project is licensed under MIT license.

gha_language: Python


text:
---
id: upgrade
title: Upgrading a Scala Application
---
Scala 2 is binary compatible with Scala 3. It means that you can migrate your application one module at a time. It also means that you can try those exciting new features without blocking anyone.

Prior to this you have to configure your build tool to handle several Scala versions. Sbt, Mill and other build tools can do that but not all of them. Otherwise you have to migrate the entire application all at once.

## How to?

Lunatech ["Moving from Scala 2 to Scala 3"](https://github.com/lunatech-labs/lunatech-scala-2-to-scala3-course) course is a good way to get started. It guides you through the migration of a single module Akka Typed sudoku solver project and it demonstrates various of the new features of the langugage.

## Additional Resources

- [Dotty Getting Started](https://dotty.epfl.ch/docs/usage/getting-started.html)
- [Scala Blog Post: The Road to Scala 3](https://www.scala-lang.org/2019/12/18/road-to-scala-3.html#how-can-i-contribute)


text:
# Tutorial 3 - Symbol Editing and Transient Simulations
- Repo Author: R.J. Weld
- Institution: Rowan University
- Course: VLSI
- Professor: Dr. Shin
- Lab Instructor: Adam Fifth

Setup
-----
1. Have Python 3.5.x installed
    - Probably works with other 3.x versions but not tested
2. Within lab 3 folder in terminal run...
```bash
pip3 install -r requirements.txt
```

Scope
-----
Oscillator simulation output points, in CSV file, are input to *lab3_analysis.py* to
calculate the rise time, fall time and propogation delays of the oscillator. Plots are then
output for some of the traces and all data is saved in JSON format.

Editing Script Parameteres
--------------------------
1. Top of script after imports
    - Input CSV filename can be changed
        1. Time and input column names should then be changed to correlate with input CSV
    - Top trigger for rise/fall calculations (Default 80%)
    - Bottom trigger for rise/fall calculations (Default 20%)

2. Bottom of script within _if \_\_name\_\_ == '\_\_main\_\_'_ statement
    - Plot outputs can be toggled on/off
    - JSON output filename can be changed or turned off


text:
# TraceEvent Samples

To run the demos you simply launch `TraceEvent.sln` in Visual Studio and hit
<kbd>F5</kbd>.

## More Information

The samples are all under the `TraceEvent` project in your solution and
there is a file for each sample of the form `NN_<SampleName>.cs`. The samples
have detailed comments that tell what they do as well as `WriteLine` statements
that also indicate what is going on.

So you can either simply run all the samples, or take a look at the comments
in each one to see which one is most appropriate for your needs. Each sample
has a `Run` method that is is main entry point, so it is easy to run just
one of the samples. For example

    TraceEventSamples.SimpleEventSourceMonitor.Run();

Will run just the `SimpleEventSourceMonitor` sample.

By default the output goes to `Console.Out` but you can redirect it to another
`TextWriter` by setting `AllSamples.Out`. This is useful for GUI Apps.

## User Guide

This sample also includes a [user guide](docs/TraceEvent.md) which is worth
reading.

A useful technique is to copy & paste some of the sample code to your own code.

repository: microsoft/dotnet-samples

repo_name: microsoft/dotnet-samples


text:
---
layout:     post
title:      Into the Breach Announcement Trailer
date:       2017-02-20
categories: featured-video video
embed:      https://player.vimeo.com/video/203014674
videoimg:   /images/posts/2017/IntoTheBreach.jpg
type:       Game Trailer
---

Use your mechs to defend the last cities on earth from being destroyed by giant monsters in this turn-based tactics game by the makers of FTL.

### Credits

_Edit_ - [Marlon Wiebe](http://mwiebe.com)
_Game_ - [Subset Games](http://ftlgame.com)
_Music_ - [Ben Prunty](https://benprunty.com)
_Audio_ - [Power Up Audio](http://powerupaudio.com)

### Making Of

Because of all the unique interactions between the environment and the characters in this game and the way they are shown in game, we knew that we wanted to let the game show off as much as possible and not try to overcomplicate the trailer.  I really wanted to avoid the trap of using too much text in a trailer, and that was possible as the devs made everything have great visual feedback to your actions.

![Holoball Camera Rig]({{ site.baseurl }}/images/posts/2017/IntoTheBreach.gif){: .col-12 }
_A sample of some of the great interactions in the game._{: .image-comment }

It's great to be working with Ben Prunty as well, he's incredibly talented composer and allowed me to chop up one of his original songs to fit the trailer layout and he was able to send it back with my incredibly rough edits smoothed out.   I often edit music and shorten or jam together parts of the song that don't necessarily follow the original melody or structure in order to follow what's going on in the trailer.

![Holoball Camera Rig]({{ site.baseurl }}/images/posts/2017/IntoTheBreach.png){: .col-12 }
_The initial trailer layout with music edits in green._{: .image-comment }

After the song and the gameplay were in, Power Up Audio's [Joey Goddard](http://powerupaudio.com/team#joey) took the mix and made sure that any missing sound effects were added back in and that the whole mix sounded crisp.  They make audio seem easy!  (hint: it's not)

For more info check out the official announcement page on [Subset Games' Website](http://ftlgame.com/itb.html) and GET HYPED!


text:
---
layout: kanji-remain
v4: 2045
kanji: 砦
keyword: fort
strokes: 11
on-yomi: サイ
permalink: /rtk/砦/
---

## Koohii stories:

1) [astridtops] 11-8-2006(87): Stop and sit down to listen to the tour guide's story. "These stones down there used to be a fort, but the enemy came and tore the place down. It has never been rebuild".

2) [enryu] 24-8-2009(22): (Grammar and story adjustment from astridtops story) You STOP AND SIT DOWN to listen to the tour guides story. "These STONES are remnants of what used to be a fort long ago, but the enemy came and tore the place down. It has never been rebuilt".

3) [delbertmon] 28-1-2010(3): In a European fortress you stop and sit down on stone floors. This is different from Japanese in which you would rest on the tatami floors.

4) [KristinHolly] 4-1-2009(3): This here rock right below us is all that remains of the mighty fort.

5) [Christoph] 11-3-2007(3): "You'll never get into this fort!!" the massive stones that surround it will stop you and force you to sit helplessly outside!


text:
# Enforce use of WHERE condition when using UPDATE

## Rule Details

This rule enforces the use of a WHERE condition in UPDATE statements.

Examples of **incorrect** code for this rule:

```tsql
UPDATE mytable
SET CreatedOn = GETDATE()
FROM dbo.MyTable AS mytable;
```

Examples of **correct** code for this rule:

```tsql
UPDATE mytable
SET CreatedOn = GETDATE()
FROM dbo.MyTable AS mytable
WHERE CreatedOn IS NULL;
```

repository: tsqllint/tsqllint

repo_name: tsqllint/tsqllint


text:
# SpeechRecognizingAutoScroll
Voice recognition-enabled Google Chrome Extension to automatically scroll your web pages.

Press on image to see demo video!

[![](https://img.youtube.com/vi/M938BKixRu4/0.jpg)](https://www.youtube.com/watch?v=M938BKixRu4)

I hope that this Chrome extension will help you to automatically scroll your web pages by using only your voice.

The usage is very very simple.

Just say:

'Scroll Up' - to scroll up;
'Scroll Down' - to scroll down;
'Be Fast' and 'Be Slow' - to adjust speed of scrolling;
'Stop' - to stop scrolling;

You can download this extension from Chrome Web Store:

https://chrome.google.com/webstore/detail/speech-recognition-for-au/jidbhlmffnlfikblembnphamjkjnjenl

Built with the help of  Web Speech API.

repository: MadinaB/SpeechRecognizingAutoScroll

gha_language: JavaScript

repo_name: MadinaB/SpeechRecognizingAutoScroll


text:
## Valid Mountain Array
---
Given an array of integers `arr`, return *`true`* if and only if it is a valid mountain array.

Recall that arr is a mountain array if and only if:

* arr.length >= 3
* There exists some `i` with `0 < i < arr.length - 1 `such that:
  * `arr[0] < arr[1] < ... < arr[i - 1] < arr[i]`
  * `arr[i] > arr[i + 1] > ... > arr[arr.length - 1]`

#### Example 1:
```
Input: arr = [2,1]
Output: false
```
#### Example 2:
```
Input: arr = [3,5,5]
Output: false
```
#### Example 3:
```
Input: arr = [0,3,2,1]
Output: true
```

#### Constraints:

* `1 <= arr.length <= 104`
* `0 <= arr[i] <= 104`

repository: nmpegetis/Code-Challenges

repo_name: nmpegetis/Code-Challenges


text:
# Usage

The package offer two type of modes for running it, *Basic* and *Advanced*.

## Basic

This mode will run with mostly predefined settings, saving checkpoints is not recommended in this mode.
The model is run by using the `fit` method, with a minimal requirements of the `Data` and `α` concentration parameter. when `prior` is not supplied, it will automatically use a weak `NIW` prior.
```@meta
CurrentModule = DPMMSubClusters
```

```@docs
fit(all_data::AbstractArray{Float32,2},local_hyper_params::distribution_hyper_params,α_param::Float32;
        iters::Int64 = 100, init_clusters::Int64 = 1,seed = nothing, verbose = true, save_model = false, burnout = 20, gt = nothing)
fit(all_data::AbstractArray{Float32,2},α_param::Float32;
        iters::Int64 = 100, init_clusters::Int64 = 1,seed = nothing, verbose = true, save_model = false,burnout = 20, gt = nothing)
```

## Advanced

This mode allows greater flexibility, and required a `Parameters` file (see below).
It is run by the function `dp_parallel`.
```@docs
dp_parallel(model_params::String; verbose = true, save_model = true,burnout = 5, gt = nothing)
```

In addition, you may restart a previously saved checkpoint:
```@docs
run_model_from_checkpoint(filename)
```

Note that that data is read from a `npy` file, and unlike the previous `fit` function, should be of `Samples X Dimensions`.

### Parameter File

For running the advanced mode you need to specify a parameters file, it is a `Julia` file, of the following struct:

```julia
#Data Loading specifics
data_path = "/path/to/data/"
data_prefix = "data_prefix"  #If the data file name is bob.npy, this should be 'bob'

#Model Parameters
iterations = 100
hard_clustering = false  #Soft or hard assignments
initial_clusters = 1
argmax_sample_stop = 0 #Change to hard assignment from soft at iterations - argmax_sample_stop
split_stop  = 0 #Stop split/merge moves at  iterations - split_stop

random_seed = nothing #When nothing, a random seed will be used.

max_split_iter = 20
burnout_period = 20

#Model hyperparams
α = 10.0 #Concetration Parameter
hyper_params = DPMMSubClusters.niw_hyperparams(1.0,
    zeros(Float32,2),
    5,
    Matrix{Float32}(I, 2, 2)*1.0)

#Saving specifics:
enable_saving = true
model_save_interval = 1000
save_path = "/path/to/save/dir/"
overwrite_prec = false
save_file_prefix = "checkpoint_"
```

gha_language: Julia


text:
# Security Policy

## Supported Versions

All users of CLOVER are recommended to transfer over to a version greater than, or equal to, `v5.0.x`. Older versions will not be maintained or supported.

| Version | Supported          |
| ------- | ------------------ |
| 5.1.x   | :heavy_check_mark: |
| 5.0.x   | :heavy_check_mark: |
| 4.0.x   | :x:                |
| < 4.0   | :x:                |

## Reporting a Vulnerability

If you discover a vulnerability in CLOVER, report it to the development team within the [CLOVER-energy organisation](https://github.com/CLOVER-energy).

repository: CLOVER-energy/CLOVER

repo_name: CLOVER-energy/CLOVER


text:
---
title: Release Notes for Cloud Manager 2023.4.0 in Adobe Experience Manager as a Cloud Service
description: Release notes for Cloud Manager 2023.4.0 in AEM as a Cloud Service.
feature: Release Information
exl-id: f2264e9f-7cf1-4a91-8383-2e08a93dea27
---
# Release Notes for Cloud Manager 2023.4.0 in Adobe Experience Manager as a Cloud Service {#release-notes}

This page documents the release notes for Cloud Manager release 2023.4.0 in AEM as a Cloud Service.

>[!NOTE]
>
>See [this page](/help/release-notes/release-notes-cloud/release-notes-current.md) for the current release notes for Adobe Experience Manager as a Cloud Service.

## Release Date {#release-date}

The release date for Cloud Manager release 2023.4.0 in AEM as a Cloud Service is 13 April 2023. The next release is planned for 11 May 2023.

## What's New {#what-is-new}

* [The AEM Project Archetype](https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html) has been updated to version 41.

## Bug Fixes {#bug-fixes}

* When a [certificate](/help/implementing/cloud-manager/managing-ssl-certifications/introduction.md) expires, [domain names](/help/implementing/cloud-manager/custom-domain-names/introduction.md) and [IP allow lists](/help/implementing/cloud-manager/ip-allow-lists/introduction.md) associated with the certificate are no longer be removed from the CDN. In such cases, the site remains reachable.
* The Cloud Manager user interface provides more visible warnings that the [SSL certificate](/help/implementing/cloud-manager/managing-ssl-certifications/introduction.md) is about to expire.
* A rare situation was fixed where customers were unable to create an environment or delete an environment.

gha_language: SCSS


text:
---
title: API Reference

language_tabs:
  - JSON

toc_footers:
  - Documentation Powered by Slate

includes:
  - Session
  - User
  - Password
  - Team
  - TeamCrypto
  - TeamMember
  - Workspace
  - Participant
  - Stream
  - Storage
  - Crypto
  - Notification
  - Channel
  - UploadFile
  - BaseTypes
  - errors

search: true
---

# Introduction

Welcome to the StrongBox API! Here you can learn how to work with StrongBox endpoint. We have examples in JSON, you can view it in the dark area on the right. All requests are works with socket, except [file uploading](#upload-file), this is a multipart form data HTTP request.

# Request

> Request Example

```json
    {
      "id": "2561B039-1E94-49B9-9A63-6F364E8C7A8E",
      "req": "USER.SESSION#CREATE",
      "args": {
        "login": "pupkin",
        "password": "qwert",
        "ttl": 0,
      }
    }
```

### Request Structure

| Parameter |  Type     |             Description |
|------|---------|----------------------------------|
| id   |  String |  Request UUID                    |
| req  |  String |  Request URL                     |
| args |  JSON   |  Request Parameters, can be empty |

# Response

> Success Response Example

```json
    {
      "rep": "2561B039-1E94-49B9-9A63-6F364E8C7A8E",
      "data": {
          "pin_code": "Lgi7TtJn5Jo1f5aWf66vMQ",
          "salt": "y1H3gF0ZraklErj683dbpA",
          "session_id": "SAvsVn1WoKtucoR188GOug",
          "user_id": "pupkin",
          "ttl": 0,
      },
      "err": null
    }
```

> Error Response Example

```json
    {
      "rep": "787357F1-E3F4-4BFB-90B4-8978FE87C9EE",
      "err": {
        "code": "ERR:INVALID_CREDENTIALS",
        "msg": "Error",
      }
    }
```

### Response Structure

| Parameter |  Type     |             Description |
|------|---------|----------------------------------|
| rep  |  String |  Request UUID for this response  |
| data |  JSON   |  Response data, can be empty     |
| err  |  JSON   |  Error data, can be empty        |

repository: sergiikostanian/slate

repo_name: sergiikostanian/slate


text:
You want to get across campus while avoiding all
obstacles and moving people. How does your wheelchair do this autonomously? How
does your wheelchair a) know where you want to go and confirm where it's going
and b) go there without having you to labourously avoid obstacles?

I feel real-time stategy games have a good answer. A bird's eye view map of the
area on a tablet, where the user can click on the map to tell the wheelchair
where to go. If the user wants to go somewhere else, they can click elsewhere.
Setting waypoints (shift-clicking in Starcraft) could be a feature. This is good
because the user can tell the wheelchair exactly where it wants to go, and let
the wheelchair take care of avoiding obstacles, streetlights, etc.

## Game Path Planning
Some initial research on how games like starcraft implement path planning.

- [Starcraft path finding hack](http://www.codeofhonor.com/blog/the-starcraft-path-finding-hack): they
  made SCVs float to avoid having to do path planning all the time.
- [Stackoverflow on Starcraft path planning](http://gamedev.stackexchange.com/questions/62881/how-to-do-starcraft-pathfinding)
- [Programming Game AI By Example]({{ site.url }}/assets/posts/2014-10-09-programming-game-ai-by-example-mat-buckland.pdf).
- [Starcraft 2 Pathfinding](http://www.gamedev.net/topic/648438-how-to-do-starcraft-2-pathfinding/):
  Starcraft II uses a constrained Delaunay triangulation of the map terrain and
  buildings to produce a navmesh; A star with a funnel filter is used to path along
  this mesh, taking into account unit radii; then local steering and collision
  avoidance layers are added on top of that

## Predicting

Input: Perfect tracks of past performance
Output: Predicted tracks

[walker2014patch]({{ site.url }}/assets/papers/walker2014patch.pdf):

- predict movements from images
- builds on 'mid-level elements' [3]
- previous methods: optical flow or point objects

## Ideas

- Use an updating A star search with costs around predicted locations for moving
  targets as really high.


text:
## 0.6.1

* new progress API (#90)
* The console and plot pane now have customisable toolbars

## v0.5.1

* Support for ANSI colour codes in console output

## 0.5.0

* Improved tree-view performance
* Console supports custom `eval` handler on a per-input basis
* Composable progress meter
* A "stepper" designed for use in debugging UIs
* Workspace UI
* Autocompletions in the console

## 0.4.0

* Console history improvements
* Support for block / underline results
* Basic plotting pane

## 0.3.0

* Various console improvements, including history support

## 0.2.0

* Improved scrolling for inline results
* Support for inter-file links
* Console stream output is buffered by default
* Support for highlighting a set of lines from a stack trace

## 0.1.0 - First Release
* Every feature added
* Every bug fixed

repository: JunoLab/atom-ink

repo_name: JunoLab/atom-ink


text:
---
name: "🐛 Bug Report"
about: 'Report a general issue.'
---

# Bug Report
<!--- Before you open an issue, please check if the issue already has been reported. --->

## Issue Description
<!--- Provide a more detailed introduction to the issue itself. -->

## Preconditions
<!--- Please provide as detailed information about your environment as possible. -->

## Actual Result
<!--- Tell us what happens instead.-->

## Expected Result
<!--- Tell us what should happen. -->

repository: codenteq/laerx

repo_name: codenteq/laerx


text:
[![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://mschauer.github.io/CausalInference.jl/latest/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1005091.svg)](https://doi.org/10.5281/zenodo.1005091)

# Causalinference.jl

Julia package for causal inference, graphical models and structure learning.

This package contains code for the PC algorithm and the extended FCI algorithm, the score based greedy equivalence search (GES) algorithm and adjustment set search.

See the [documentation](https://mschauer.github.io/CausalInference.jl/latest/) for implemented functionality and [issue #1 (Roadmap/Contribution)](https://github.com/mschauer/CausalInference.jl/issues/1) for coordination of the development.

![Example output of PC algorithm](assets/pc_graph_linear.png)

gha_license_id: NOASSERTION


text:
---
date: 2023-06-19
layout: rafaga
rafagas:
- desc: Canada geography game based on 2021 census data where you have to guess the
    name of the municipality or cities
  keyw: canada
  link: https://awmcphee.ca/game/
  microlink:
    desc: A fun Canadian geography game you can play in the browser
    image: https://awmcphee.ca/headshot.jpg
    logo: https://awmcphee.ca/icons/icon-512x512.png?v=054dc731b57a5925221a885c1d1a58b1
    title: Alex’s Census Game
- desc: A global sound map dedicated to field recording, phonography and the art of
    listening that connects sound recordings with their places of origin in order
    to create a collaborative sound cartography
  keyw: sound
  link: https://aporee.org/maps/
  microlink:
    desc: 'radio aporee ::: maps is a global soundmap dedicated to field recording,
      phonography and the art of listening.'
    logo: https://aporee.org/favicon.ico
    title: 'radio aporee ::: maps - sounds of the world'
- desc: MapFight is a web application to help visualize the size of a geographic area
    that allows you to compare the surfaces of certain areas, countries and cities
  keyw: sizes
  link: https://mapfight.xyz/
  microlink:
    desc: FEATURED
    image: https://mapfight.xyz/tr-quake.svg
    logo: https://mapfight.xyz/apple-touch-icon.png
    title: MapFight - Compare the size of countries, regions and cities.
rid: 2089
---

repository: geoinquiets/rafagas

branch_name: refs/heads/gh-pages

repo_name: geoinquiets/rafagas


text:
---
title: Georg Wilhelm Friedrich Hegel
date: 2020-05-06T17:12:36.315Z
summary: >
  Georg Wilhelm Friedrich Hegel (1770-1831) is one of the greatest systematic
  thinkers in the history of Western philosophy. In addition to epitomizing
  German idealist philosophy, Hegel boldly claimed that his own system of
  philosophy represented an historical culmination of all previous philosophical
  thought.
tags:
  - all
  - post
  - philosophy
  - encyclopedia
  - hegel
  - german philosophy
  - history
---
Georg Wilhelm Friedrich Hegel (1770-1831) is one of the greatest systematic thinkers in the history of Western philosophy. In addition to epitomizing German idealist philosophy, Hegel boldly claimed that his own system of philosophy represented an historical culmination of all previous philosophical thought.

Hegel’s overall encyclopedic system is divided into the science of Logic, the philosophy of Nature, and the philosophy of Spirit. Of most enduring interest are his views on history, society, and the state, which fall within the realm of Objective Spirit.

Some have considered Hegel to be a nationalistic apologist for the Prussian State of the early 19th century, but his significance has been much broader, and there is no doubt that Hegel himself considered his work to be an expression of the self-consciousness of the World Spirit of his time.

At the core of Hegel’s social and political thought are the concepts of freedom, reason, self-consciousness, and recognition. There are important connections between the metaphysical or speculative articulation of these ideas and their application to social and political reality, and one could say that the full meaning of these ideas can be grasped only with a comprehension of their social and historical embodiment.

The work that explicates this concretizing of ideas, and which has perhaps stimulated as much controversy as interest, is the Philosophy of Right (Philosophie des Rechts), which will be a main focus of this essay.

_To learn more, check out the article on [The Internet Encyclopedia of Philosophy](https://www.iep.utm.edu/hegelsoc/)_

repository: batmanwgd/kaska

gha_language: HTML

repo_name: batmanwgd/kaska


text:
---
layout: post
title: "A Strong and Robust Baseline for Text-Image Matching"
date: 2019-06-04 05:42:58
categories: arXiv_CV
tags: arXiv_CV Review Embedding Inference
author: Fangyu Liu, Rongtian Ye
mathjax: true
---

* content
{:toc}

##### Abstract
We review the current schemes of text-image matching models and propose improvements for both training and inference. First, we empirically show limitations of two popular loss (sum and max-margin loss) widely used in training text-image embeddings and propose a trade-off: a kNN-margin loss which 1) utilizes information from hard negatives and 2) is robust to noise as all $K$-most hardest samples are taken into account, tolerating \emph{pseudo} negatives and outliers. Second, we advocate the use of Inverted Softmax (\textsc{Is}) and Cross-modal Local Scaling (\textsc{Csls}) during inference to mitigate the so-called hubness problem in high-dimensional embedding space, enhancing scores of all metrics by a large margin.

##### Abstract (translated by Google)

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

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


text:
ITKModuleTemplate
=================

[![][gha-img]][gha-link]

[gha-img]: https://github.com/InsightSoftwareConsortium/ITKModuleTemplate/actions/workflows/build-test-package.yml/badge.svg
[gha-link]: https://github.com/InsightSoftwareConsortium/ITKModuleTemplate/actions/workflows/build-test-package.yml

Overview
--------

This is a module for the [Insight Toolkit (ITK)](https://itk.org) for
segmentation and registration. It is designed to work with the ITK
modular system.

This module is a template to be used as a starting point for a new ITK
module.

Getting Started
---------------

The following will get an external module started in a new repository:

    python -m pip install cookiecutter
    python -m cookiecutter gh:InsightSoftwareConsortium/ITKModuleTemplate
    # Fill in the information requested at the prompts

Reasonable defaults will be provided for all of the parameters. The
parameters are:

full_name

Your full name.

email

Your email.

project_name

This is a name for the project, which is ITK followed by the module
name, by convention. Examples include ITKIsotropicWavelets or
ITKBoneMorphometry.

module_name

This is the name of the module. Since this is an external module, it
does not start with the ITK prefix. It is in CamelCase, by convention.
Examples include IsotropicWavelets and BoneMorphometry.

filter_name

The skeleton of an itk::ImageToImageFilter will be created by default.
Optionally specify this value, if you will be adding an
itk::ImageToImageFilter to your module.

python_package_name

This is the name of the Python package that will be created from the
module. By convention, this is itk-<project_name in lower case>
For example, itk-isotropicwavelets or itk-bonemorphometry.

download_url

This is the download url added to the Python package metadata. This can
be the GitHub repository URL.

project_short_description

A short description to use in the project README, module Doxygen
documentation, and Python package documentation.

project_long_description

A long description to use in the project README, module Doxygen
documentation, and Python package documentation.

The output of the cookiecutter is a buildable ITK external module with
example classes. Remove or replace the classes with your new classes.
Push your new module to GitHub, and enable builds on
[CircleCI](https://circleci.com/), [TravisCI](https://travis-ci.org/),
and [AppVeyor](https://www.appveyor.com/).

Documentation on [how to populate the
module](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.html#x50-1430009)
can be found in the [ITK Software
Guide](https://itk.org/ITKSoftwareGuide/html/).

To improve the discoverability of your module on GitHub, first push the
associated repository, then add
[itk-module](https://github.com/topics/itk-module) to the project's
[GitHub Topics](https://help.github.com/articles/about-topics/) .

Remote Module
-------------

After an [Insight Journal](https://www.insight-journal.org/) article has
been submitted, the module can be included in ITK as a [remote
module](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.html#x55-1640009.7).
Add a file in "ITK/Modules/Remote" called "YourModule.remote.cmake", for
this module it would be "ExternalExample.remote.cmake" with the
followlowing contents:

    itk_fetch_module(MyModule
      "A description of the a module."
      GIT_REPOSITORY https://github.com/myuser/ITKMyModule.git
      GIT_TAG abcdef012345
      )

CI Testing and Python Packages
------------------------------

Continuous integration service configurations are included to build
and test the C++ core of packages across platforms and build binary
Python packages for Linux, macOS, and Windows. These packages can be
[downloaded](https://itkpythonpackage.readthedocs.io/en/master/Build_ITK_Module_Python_packages.html#github-automated-ci-package-builds)
and [uploaded to the Python Package Index
(PyPI)](https://itkpythonpackage.readthedocs.io/en/master/Build_ITK_Module_Python_packages.html#upload-the-packages-to-pypi).

ITKv4 Branch
------------

In the transition to the major release of ITKv5 your module might want
to be compatible with both versions: ITKv4 and ITKv5. In order to do
that, keep the master branch for development with ITKv5, and create
another branch, named `ITKv4`, or `release`, that is compatible with the
version 4.13 of ITK. For examples and updated information on how to do
this: please [check the discourse
conversation](https://discourse.itk.org/t/itk-external-module-github-builds-for-4-x-and-5-x/900).

License
-------

This software is distributed under the Apache 2.0 license. Please see
the *LICENSE* file for details.

Authors
-------

-   Bradley Lowekamp
-   Matt McCormick
-   Jean-Baptiste VIMORT