text:
---
layout: post
title: Using C#6.0 in Unity 5
tag: [Programming]
thumb:
  start: /rsc/thumbs/csharp-thumb.png
  hover: /rsc/thumbs/csharp-hover.png
---

C#6 presents a score of new and delicious syntax sugars,
and can be compiled into .NET 2.0-compliant bytecode.
This means it has implications for Unity Developers,
and the overall health and wellbeing of their code.

A few of the fancy features are unusable, but on the whole, it works well.
In fact, my game engine, [`PathwaysEngine`][pathways], uses it pretty heavily,
and I haven't seen any code-related issues when using it,
aside from a few features which don't work, but also don't cause bugs.

Alex Zhdankin's [repository][] holds a template project / installer for his custom C#6.0 compiler.
Instructions can be found there.
Once installed, any `*.cs` file in the project will be able to make use of the fancy new syntax sugars present in the C#6.0 spec.

Two of the listed features of C#6.0 cannot be used in Unity as of `2015-01-29`.
Primary constructors cannot be used either, as they were not included in the final language spec.

Secondly, the `using static MyNamespace.MyClass` syntax cannot be used on any attachable scripts.
Ordinarily, it would allow the compiler to import the `static` methods and properties from another source file, and it does achieve this!
It works fine in management scripts, and in runtime classes which do not need to be attached to any in-scene `GameObject`s.
However, using it will break Unity's classname checker if used on an attachable script.

The rest of the tasty, delicious features can be used as follows.

---

## Null-Conditional Operator ##

As with any language, `NullReferenceException`s are the bane of every Unity programmer's existence.
However, the null-conditional operator can both prevent `NullReferenceException`s from occurring, and also clean up what would otherwise be very messy `null` checks.

A shining example of how useful this is in Unity programming is such:

```csharp
    var audio = GetComponent<AudioSource>();
    if (audio==null) audio.Play(); // whoops!
```

How often do we have to poke around looking for `Component`s, and how often do they not exist, or exist somewhere else we didn't expect?
Almost all the time.
With C#6, this whole mess can be rewritten as such:

~~~csharp
    GetComponent<AudioSource>()?.Play();
~~~

Presuming that we don't actually need the reference for later, this works fine, and also avoids a nasty `NullReferenceException` in the event that we forgot to add an `AudioSource` to the `GameObject`.

While I don't frequently use built-in arrays anymore, if I did, I'd use this operator to ensure I didn't try to index into something that turns out to be `null`.

~~~csharp
    int[] arr; //= new int[3];  // whoops!
    int? n = arr?[2];
~~~

Sure, `n` will be `null` too, but it's still helpful.
I would argue that the best usage of this operator is when writing `delegate`s.
It's used in my source code.
In prior versions of C#, there was no way to safely invoke a `delegate` without writing a null-check first. Now, it can be written as such:

~~~csharp
    OnMyEventChange?.Invoke(this, EventArgs.Empty, value);
    // or whatever arguments match the delegate
~~~

The Unity Editor's UI *only* allows built-in arrays to be assigned to from the editor.
When other `Component`s need to be added in the editor, the forward-thinking programmer has to copy them into dynamic `List<T>`s, but what if the editor assigns something to null, or some designer decides to change the length?
Both of these scenarios happen all the time.
However, this nice little operator can prevent bad things from happening when they do.

---

## Expression-Bodied Functions & Properties ##

This is my favourite.
It allows simple methods and get-only properties to be written with the effortless wave of an arrow.
These are particularly nice when writing lots of tiny things for the `MonoBehaviour` event callbacks like `Update()` or `OnTriggerEnter()`.

Additionally, I love using properties because C# allows them to be declared in `interface`s, which is super powerful.
Expression-bodied functions have almost the same syntax as anonymous functions do, but are explicitly bound to the class they're defined in (unlike anonymous functions).

In my command-driven event system, I have defined a number of verbs, and all the classes which can have those verbs done to them inherit an interface to allow them to do so.
If a class inherits from `IReadable`, for example, it can be read by the user.

~~~csharp
    public bool Read(lit::IReadable o) => o.Read();
~~~

Due to the nature of these verb-events, I often end up with lots of simple functions like this, which simply pass along commands from the `Player` to `IReadable` instances nearby.

A more complicated example would be the `Person.GetNearby<T>()` method.

~~~csharp
    public static List<T> GetNearby<T>(
                    Person person,
                    string filter,
                    ref List<T> list)
                        where T : Thing =>
        GetNearby<T>(filter, ref list,
            GetNearby<T>(
                person.Radius,
                person.Position));
~~~

Especially with recursive or multiply-overloaded calls like this, this syntax is pretty tasty.

Even tastier are get-only properties, which can be included in `interface`s.
Here's another example from `Person`.

~~~csharp
    public override Vector3 Position => motor.Position;
~~~

Here, `Person` simply forwards its `motor`'s `Position` to the outside world.
`Person` could easily inherit from `IMotor`, and could then be manipulated and dealt with by other code without having to typecast or having to pass around a reference to its `motor`.

---

### String Interpolation ###

Finally, C#6 has a syntax feature called string interpolation.
This allows for in-scope variables and references to be used directly in a `string` template, without having to go through the awful business of using `string.Format` for the same task.

There are honestly things I've been able to do with string interpolation that I wouldn't have been feasible without a whole lot of awful hacks.
String interpolation makes all of these things a breeze.

I use these heavily in the `Literature` namespace, which deals with text input and display.
Here's and example from `Description`:

~~~csharp
public virtual string Template => $@"
    ### {Name} ###
    {init}{raw}

    {Help}";
~~~

This uses string interpolation to make a `*.md` template for the description.
A special formatter elsewhere renders it into the Unity RTF subset.

In the same file, I have a `Nouns` property, a `Regex` which matches whatever it's assigned to, and also the exact name of the instance, just in case the user decides to type it all out.

~~~csharp
    public Regex Nouns {
        get { return nouns; }
        set { nouns = new Regex((Name!=null)
            ?$"({Name})|{value}":$"{value}"); }
    } Regex nouns;
~~~
This way, the `Regex` matches both the full name, and all the assigned nouns (only if the name is defined!).

---

[pathways]: <https://github.com/evan-erdos/PathwaysEngine>

[repository]: <https://bitbucket.org/alexzzzz/unity-c-5.0-and-6.0-integration/src>


text:
# Subtle Brackets

![Logo](https://raw.githubusercontent.com/rafamel/subtle-brackets/master/images/icon_128.png)

_Underlined matching brackets and more for Visual Studio Code._

[Subtle Brackets @ Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=rafamel.subtle-brackets)

---

_Subtle Brackets_ allows custom styling of matching brackets as VSCode currently [boxes them](https://github.com/Microsoft/vscode/issues/23606), [impairing visibility](https://github.com/Microsoft/vscode/issues/19534). By default, it applies a subtle light/dark underline to the bracket next to the cursor and its matching pair:

![After](https://raw.githubusercontent.com/rafamel/subtle-brackets/master/images/example.png)

You can also customize the style applied to matching brackets.

<!-- ![Settings](https://raw.githubusercontent.com/rafamel/subtle-brackets/master/images/rundown.gif) -->

## Extension Settings

| Setting                          | Default                                                                                | Description                                                                                |
| -------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **subtleBrackets.disableNative** | `true`                                                                                | _Subtle Brackets_ permanently disables the native `matchBrackets` by default. Turn to `false` to prevent this behavior.                                                                                |
| **subtleBrackets.parse**         | `true`                                                                                | If `true`, documents will be properly parsed via [Prism](http://prismjs.com/), whenever possible, so brackets within strings and comments don't trigger the decoration. There are [some edge cases](http://prismjs.com/examples.html#failures). |
| **subtleBrackets.style**         | `{ "borderWidth": "1px", "borderStyle": "none none solid none" }`                               | Change the default style applied to matching brackets. The default is a light/dark underline (depending on your current theme).                                                                                |
| **subtleBrackets.pairs**         | `[{ "open": "(", "close": ")" }, { "open": "[", "close": "]" }, { "open": "{", "close": "}" }]` | An array of objects defining the bracket pairs to match. They can also define specific styles and whether to take parsing into account for each specific pair.                                                                                |

### Pairs

Each pair definitition **must** have the `open` and `close` keys, and **can** optionally take custom `style` and `parse` keys for the pair.

As an example, here's how you would disable parsing for the `()` bracket pair, and set a red underline for `{}`.

```javascript
"subtleBrackets.pairs" : [
  {
    "open": "(",
    "close": ")",
    "parse": false
  },
  {
    "open": "[",
    "close": "]"
  },
  {
    "open": "{",
    "close": "}",
    "style": { "borderColor": "red" }
  }
]
```

### Style

If you wish, you can change the default style applied to matching brackets by modifying the **subtleBrackets.style** property. For a list of allowed styles check [DecorationRenderOptions](https://code.visualstudio.com/docs/extensionAPI/vscode-api#DecorationRenderOptions).

As an example, here's how you would set a 2px blue underline default style:

```javascript
"subtleBrackets.style": {
  "borderColor": "blue",
  "borderWidth": "2px"
}
```

You can also target a specific bracket pair by setting a `style` key within its definition. As an example, here's how we'd assign a white font over red a background to the `"[]"` pair.

```javascript
"subtleBrackets.pairs" : [
  {
    "open": "(",
    "close": ")"
  },
  {
    "open": "[",
    "close": "]",
    "style": {
      "color": "white",
      "backgroundColor": "red",
      "borderStyle": "none"
    }
  },
  {
    "open": "{",
    "close": "}"
  }
]
```

license: MIT

repository: charygao/subtle-brackets

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: charygao/subtle-brackets


text:
---
layout: posts
title: "No matching adjacent chars"
date: "2021-02-28"
type: "baked"
---

**This may or may not be the optimal solution, DO NOT blindly memorize my solutions**

From [Cassidy's](https://twitter.com/cassidoo) weekly [newsletter](https://buttondown.email/cassidoo/archive/2c66408b-dffb-4767-b754-0aad2d289226).

Target audience: beginners in js (please feedback!)

> Given a string str containing only the characters x and y, change it into a string such that there are no matching adjacent characters. You’re allowed to delete zero or more characters in the string. Find the minimum number of required deletions.

Example:
```js
$ everyOther('xxyxxy')
$ 2 // str becomes ‘xyxy’

$ everyOther('yyyyy')
$ 4 // str becomes ‘y’
```

This one came to me very quick. I would think that a optimal solution would not be any faster than O(n). If we look at the problem, we notice that essentially, the `matching adjacent characters` would mean looking at both side of all the characters. eg. in `123` we would look at the right of `1`, check that `2` is not the same and then do the same for `2`. We don't have to check `2` back with `1` again as that would be a double count. This means that every character needs to be accessed at least once.

Let's write a loop, were we start from 0 and end at str.length - 2

```js
const everyOther = (str) => {
  for (let i = 0; i < str.length - 1; i++) {
  }
};
```

we then need to check the current letter with the next

```js
const everyOther = (str) => {
  for (let i = 0; i < str.length - 1; i++) {
    const curr = str[i];
    const next = str[i + 1];
    if (curr === next) {
      // do something here
    }
  }
};
```

And if we look at the question again, notice that it only asks for a count, not the string after we're done with it. So let's add a counter.

```js
const everyOther = (str) => {
  let count = 0;
  for (let i = 0; i < str.length - 1; i++) {
    const curr = str[i];
    const next = str[i + 1];
    if (curr === next) {
      count++;
    }
  }
  return count;
};
```

And that's it! Short one this week, but there's no short of amazing solutions, particularly [the one by Sophie](https://twitter.com/sophiebits/status/1363939556119048192) stands out to me, I never would have thought of using regex, and there are plenty of interesting solutions which actually make use of the fact that the question specified that the entire expected input is only 2 different types of characters. It's interesting to look at all the different ways people "brand" their code in in [the thread](https://twitter.com/cassidoo/status/1363745457361592320).

gha_language: HTML

gha_license_id: MIT


text:
Dullard [![NPM Version](https://img.shields.io/npm/v/dullard.svg)](https://www.npmjs.com/package/dullard) [![NPM License](https://img.shields.io/npm/l/dullard.svg)](https://www.npmjs.com/package/dullard)
=======
[![NPM Downloads](https://img.shields.io/npm/dm/dullard.svg)](https://www.npmjs.com/package/dullard)
[![Build Status](https://img.shields.io/travis/tivac/dullard.svg)](https://travis-ci.org/tivac/dullard)
[![Dependency Status](https://img.shields.io/david/tivac/dullard.svg)](https://david-dm.org/tivac/dullard)
[![devDependency Status](https://img.shields.io/david/dev/tivac/dullard.svg)](https://david-dm.org/tivac/dullard#info=devDependencies)

> "I have made this longer than usual because I have not had time to make it shorter." - Blaise Pascal

Dullard is a simple NodeJS-powered task runner. It exists because doing the same thing repeatedly is boring. Much better to let the computer do it instead.

**Table of Contents**

- [Usage](#usage)
- [Config](#config)
    - [Examples](#examples)
        - [JSON](#json)
        - [Javascript](#javascript)
    - [Properties](#properties)
        - [dirs](#dirs)
        - [steps](#steps)
        - [includes](#includes)
    - [Customizing Config Values](#customizing-config-values)
- [Tasks](#tasks)
    - [Sync Tasks](#sync-tasks)
    - [Async Tasks](#async-tasks)
    - [Logging in a task](#logging-in-a-task)
- [Install](#install)
- [Develop](#develop)

## Usage ##

```
$ dullard --help

  Let the computers do the boring stuff.

  Usage
      $ dullard <options> <task>, ..., <taskN>

  Options
      --help         Show this help
      --dirs,    -d  Specify directories to load tasks from
      --list,    -l  Show a list of available tasks
      --config,  -c  Output final assembled config for debugging
      --silent,  -s  No output
      --verbose, -v  Verbose logging
      --silly,   -y  REALLY verbose logging
      --log,     -g  Specify log level, one of silly, verbose, info, warn, error, & silent
```

## Config ##

Dullard will look for a file named `.dullfile` in the current directory or any parent directories & merge it with the CLI options. It will merge all found results in the current branch of the directory tree with precedence being: `CLI > Local > Parent > ... > Root`.

### Examples ###

#### JSON ####

```javascript
{
    "dirs" : [
        "../../../tasks-a"
    ],

    "steps" : [
        "fooga"
    ]
}
```

#### Javascript ####

```javascript
module.exports = {
    "dirs" : [
        "../../tasks-a"
    ],

    "steps" : {
        main : [
            "fooga"
        ],

        finish : [
            "wooga"
        ],

        default : [
            "main",
            "finish"
        ]
    }
};
```

### Properties ###

#### dirs ####
`dirs` is an array of directories to load tasks from. Paths are relative to the `.dullfile`.

#### steps ####
`steps` defines the order of build steps to run. It supports two different formats.

* an array of strings/functions
* an object containing named step collections that are each an array of strings/functions.

Task names are the names of files in the task directories stripped of their extension or the name of a step collection.

#### includes ###
`includes` is an array of paths to other `.dullfile`s that will be included & merged into the existing config. Paths are relative to the `.dullfile`.

```javascript
{
    ...
    "includes" : [
        "../fooga/wooga/.dullfile"
    ]
}
```

### Customizing Config Values ###

Dullard tries hard to accept whatever & turn it into something useful. To this end the results of parsing the CLI with [`optimist`](https://github.com/substack/node-optimist) are merged into the config object after all the `.dullfile`s. This allows you to run builds with environment-specific settings easily, as you can override any settings via CLI args.

For example, given the following `.dullfile` and CLI args

```javascript
{
    "env" : "dev",
    ...
}
```

invoking dullard using the command `dullard --env=live` will set the `env` value to `"live"` instead of `"dev"`.

Thanks to `optimist`'s ability to handle [dot-notation](https://github.com/substack/node-optimist#dot-notation) for arguments you can also set nested object arguments.

`dullard --env=live --cdn.static=http://www.cdn.com` with the same `.dullfile` as above gives you a `config` object like this

```javascript
{
    "env" : "dev",
    "cdn" : {
        "static" : "http://www.cdn.com"
    }
    ...
}
```

#### Warning ####
This only works for values that are __not__ one of Dullard's [CLI options](#usage).

## Tasks ##

Tasks are modules that export a single function. There's no wrapper around `fs`, no streams support baked-in, they're a function that can do some stuff. Every task will be passed a shared `config` object that represents the state of dullard & the tasks to be run. For async tasks you can also accept a second argument that can be used as a callback function following the normal node-style error-first pattern.

### Sync Tasks ###

```javascript
// Passing tasks
function exampleTaskSync(config) {
    // ...
}

function exampleTaskSync(config) {
    // ...

    return undefined;
}

// Failing tasks
function exampleTaskFailureSync(config) {
    throw new Error("Task failed");
}
```

### Async tasks ###

Tasks can do async work in two different ways. Either by accepting a second callback argument, or returning a promise.

```javascript
// Passing task
function exampleTaskAsyncCallback(config, done) {
    setTimeout(done, 10);
}

function exampleTaskAsyncPromise(config) {
    return new Promise(function(reject, resolve) {
        // ...
        resolve();
    });
}

// Failing task
function exampleTaskFailureAsync(config, done) {
    done("Task Failed");
}

function exampleTaskFailureAsyncPromise(config) {
    return new Promise(function(reject, resolve) {
        // ...
        reject();
    });
}
```

### Logging in a task ###

Dullard makes a `log` function available to tasks via `config.log`, this is a reference to [`npmlog.log()`](https://github.com/npm/npmlog#basic-usage) and you may use it accordingly. It respects log level values passed via the CLI, either via `--log=<level>` or the shorthand `--verbose` argument.

## Install ##

1. `npm i -g dullard`

## Develop ##

1. `git clone git://github.com/tivac/dullard.git`
1. `npm i`
1. Make changes
1. `npm test`

repository: tivac/dullard

gha_language: JavaScript

repo_name: tivac/dullard


text:
## CNN-Based Hyperspectral image classification

### Description

This is a TensorFlow implementation of fixed size kernels network described in this paper.

Figure 1. Hyperspectral image cube

Figure 2. Our fixed size kernel network
### General Guidance

#### Setup
1. Python3.5+
2. TensorFlow 1.10
3. Dependencies listed in requirement.txt
4. (Optional) CUDA v9.0 and cuDNN v7.0

We recommend you to create a Python Virtual environment and issue the following command in your command prompt/terminal to install dependencies.
```
pip install -r requirement.txt
```

#### Acquire the data and train the model

##### Hyperspectral dataset

Several hyperspectral datasets are available on the UPV/EHU wiki. The default dataset folder is `data`.

In  our paper, we have used the following dataset

- Indian Pines
- Salinas
- Kennedy Space Centre
- Botswana

##### CPU configuration
If you choose to run the run the model on CPU, you can run this script to download and preprocess the dataset.
```buildoutcfg
python preprocess.py --data Indian_pines --train_ratio 0.15 --validation_ratio 0.05
```
- `--data` to select which dataset to process (e.g. 'Indian_pines','Salinas', 'KSC', 'Botswana'')
- `--train_ratio` to configure the percentage of samples use in training.
- `--validation_ratio` to configure the percentage of samples use in validation.

To train the model, run this script
```buildoutcfg
python network.py --data Indian_pines --epochs 650
```
- `--data` to select which dataset to train
- `--epochs` to specify number of iterations in training

##### GPU Configuration
If you have CUDA or GPU configurations which TensorFlow supports. The convergence of training can be accelerated. However, the optimization requires different arrangement.

To reconfigure the dataset, set the `--channel_first` tag to `True`

Example:
```buildoutcfg
python preprocess.py --channel_first True --data Indian_pines --train_ratio 0.15 --validation_ratio 0.05
```

and run the special script for GPU
```buildoutcfg
python network.py --data Indian_pines --epochs 650
```

If you enjoyed our paper, you could cite it via this bibtex
```

@inproceedings{arc19liu,
  author    = {Shuanglong Liu and Ringo S.W. Chu and Xiwen Wang and Wayne Luk},
  title     = {Optimizing CNN-based Hyperspectral ImageClassification on FPGAs},
  booktitle = {{ARC}},
  year      = {2019}
}
```


text:
+++
title = "What I read this week (November 22 - 28)"
date = 2020-11-28
categories = ["what I read"]
draft = false
+++

On quirks in Ruby, leaving code better than you found it, VS Code shortcuts, and graph neural networks. Happy Thanksgiving, for those in the US!

<!--more-->

**[1.5 is the midpoint between 0 and infinity in Ruby](https://blog.peterzhu.ca/ruby-range-bsearch/)** by Peter Zhu talks about a curious artifact in Ruby; that when binary searching from 0 to infinity, the first value checked is ... 1.5.
This happens because of everyone's favorite IEEE-754 floating point standard.

These steps:
 - taking 0 and infinity as floating point numbers
 - reading those bits as integers
 - taking the midpoint of those integers
 - taking that as bits
 - reading those bits as a float

lead you to 1.5. Love it.

---

**[Always leave the code better than you found it](https://letterstoanewdeveloper.com/2020/11/23/always-leave-the-code-better-than-you-found-it/)** from the Letters to a New Developer blog makes the case for *improving code* when you fix bugs or answer questions.
Document what something is doing; write or improve a test; refactor *if* you feel comfortable enough.

> All of these actions not only help others because they improve the quality of the code, they also provide examples to other developers on how to do so. For example, it is far easier to write the second test in a suite than the first. You can cut and paste a lot of the setup code and tweak only what is different. The first bit of documentation will inspire more.

The [comments on Reddit](https://old.reddit.com/r/programming/comments/k2cbtb/always_leave_the_code_better_than_you_found_it/) were pretty polarized. A lot of folks disagreed, saying that changes that didn't immediately address a bug should be left to a separate PR.
I love the idealism, but in my experience that would mean the changes simply never get made.

---

**[Learning all VSCode shortcuts evolved my developing habits](https://tkainrad.dev/posts/learning-all-vscode-shortcuts-evolved-my-developing-habits/)** by Thomas Kainrad recounts the author's experience learning *all* 149 documented keyboard shortcuts in VS Code. Oh my!

> Often keyboard shortcuts are seen as a way to do things faster, compared to using the mouse. While that is true, I think there is an even more [important?] aspect to shortcut usage in IDEs: Many features are not used at all, if you don’t know the shortcut!

I love the spirit of the post---that learning your tools well is important---though learning all 149 shortcuts seems impractical. Learning how to use Sublime, back when I used it a lot, made me more productive with it. These days, I use Sublime shortcuts in VS Code instead of the native ones. I think I'll make more of an effort to learn more now.

---

**[Deep learning on graphs: successes, challenges, and next steps](https://towardsdatascience.com/deep-learning-on-graphs-successes-challenges-and-next-steps-7d9ec220ba8)** by Michael Bronstein gives a nice overview of the state of graph deep learning and what the future looks like.

> We have not witnessed so far anything close to the smashing success convolutional networks have had in computer vision.

Why not?
 - no standardized benchmarks, like ImageNet for computer vision
- lack of software libraries for GNNs; PyTorch Geometric and Deep Graph Library exist, but aren't near as popular as PyTorch itself or TensorFlow
 - scalability is challenging (and dedicated hardware doesn't exist; see {{< ref "papers/hardware_lottery_hooker.md" >}})
 - dynamic graphs that evolve in real time are really hard
 - higher order structure, beyond nodes & edges, are not yet incorporated into graph neural network models
 - GNNs are not well understood theoretically

This is a great example of how a blog post can be useful academic output. Sure, with more depth and rigor this could have been published as a survey paper, but this reaches an entirely new audience in a far more accessible way.


text:
---
title: "sn_ti.stix.max_payload_size"
description: "Property"
---

Description: The maximum payload size (in MB) for a STIX attachment that can be parsed. Default value is 0 MB and indicates no limit.

Value: `0`

repository: ASHISH-SERVICENOW/sn

repo_name: ASHISH-SERVICENOW/sn


text:
# Shopify Netlify Serverless App

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/mindofjonas/shopify-netlify-serverless)

Simple proof of concept on hosting a Shopify Saas app on Netlify using Netlify Functions for OAuth and the app's API. Feel free to fork/improve.

Functionality:

- `simple-oauth2` for handling Oauth flow
- JWT stored in token to store shop name for API calls
- Netlify Functions for hosting
- React/Redux frontend app hosted on Netlify with protected and public routes
- PostgreSQL for database. (See `./migrations` for knex schema)

Required Environment Variables:

```
SHOPIFY_API_KEY = "Shopify API Key"
SHOPIFY_API_SECRET = "Shopify API Secret"
APP_URL = "Public (https) Netlify URL of the app. Must match url in Shopify app settings"
APP_SECRET = "Secret for signing JWT"
DATABASE_URL = "Postgres database URL"
```

**Important:** Add `APP_URL/.netlify/functions/shopify-auth-callback` to the list of whitelisted redirection URL(s) for the Shopify app.

Next Steps:

- Use [Shopify Polaris](https://polaris.shopify.com) for frontend app UI
- Look into using [Shopify App Bridge](https://help.shopify.com/en/api/embedded-apps/app-bridge) to embedded app in Shopify admin
- Add Netlify Functions endpoints for handling Shopify webhooks

Thanks to @DavidWells for providing the original inspiration for this project with his [Netlify + Intercom Oauth ](https://github.com/DavidWells/intercom-netlify-oauth) project.

repository: mindofjonas/shopify-netlify-serverless

repo_name: mindofjonas/shopify-netlify-serverless


text:
# Unconditional Generation Code

This is the implementaition for Unconditional Generation Task.

## Quick Links
- [Unconditional Generation Code](#unconditional-generation-code)
  - [Quick Links](#quick-links)
  - [Environment](#environment)
  - [Quick Start](#quick-start)
  - [Use with your own data](#use-with-your-own-data)
  - [Acknowledgement](#acknowledgement)

## Environment
To run our code, please install all the dependency packages by using the following command under python 3.6 (recommend):

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

## Quick Start
After the environment setup, you can simply run the following command:
  ```shell
  CUDA_VISIBLE_DEVICES=<GPU_ID> bash train.sh
  ```

Or you can run the commends as following:

   ```shell
   mkdir results
   CUDA_VISIBLE_DEVICES=<GPU_ID> python train.py --data_path data/MS_COCO --maxlen 15 --save ./results/coco_result \
  --batch_size 256 --niters_gan_d 1 --niters_gan_ae 1 --lr_gan_g 4e-04 --lr_ae 0.12 \
  --add_noise --gan_d_local --enhance_dec
   ```
`GPU_ID=0/1/2/... the GPU you want to use`

You can simply add arguments `--add_noise` , `--gan_d_local` and `--enhance_dec` to test the variants of our model.

## Use with your own data
Our code allows you to do unconditional generation tasks, for example, generate fluent sentences from scratch.
In this section, we provide instructions about how to run our code with your dataset.

* Training
  * Input:
    * raw text file, one sentence per line. For example,
    ```
    a bicycle replica with a clock as the front wheel
    a black honda motorcycle parked in front of a garage
    ```
  * Output:
    * the program will save the trained model automatically
    * a generation file predicted by generator, namely `<EPOCH>_examplar_gen`, e.g., `054_examplar_gen`
    ```angular2html
    a car is sitting on a red fire hydrant
    two people are standing on a train
    a bathroom with a toilet and a sink
    ```
    * reconstruction file predicted by autoencoder, namely `autoencoder.txt`
    * print out `epoch`, `learning rate`, `loss`, `perplexity`, `accuracy` like below:
    ```angular2html
    | epoch   6 |     0/  453 batches | lr 0.000000 | ms/batch  1.36 | loss  0.02 | ppl     1.02 | acc     0.38 | train_ae_norm     1.00
    [6/100][199/453] Loss_D: 1.33532667 (Loss_D_real: 0.66654706 Loss_D_fake: 0.66877961) Loss_G: 0.00273732 Loss_Enh_Dec: -0.00751842
    | epoch   6 |   200/  453 batches | lr 0.000000 | ms/batch 765.74 | loss  3.66 | ppl    38.99 | acc     0.39 | train_ae_norm     1.00
    [6/100][399/453] Loss_D: 1.34199166 (Loss_D_real: 0.67177409 Loss_D_fake: 0.67021751) Loss_G: -0.00233009 Loss_Enh_Dec: -0.00531169
    | epoch   6 |   400/  453 batches | lr 0.000000 | ms/batch 777.91 | loss  3.67 | ppl    39.16 | acc     0.39 | train_ae_norm     1.00
    | end of epoch   6 | time: 359.45s | test loss  3.65 | test ppl 38.61 | acc 0.393
    ```
* Inference:
  * Step 1: train your own model and obtain `model.pt` and other related files under `results/coco_result2021-xx-xx-xx-xx-xx` (example for coco dataset)
  * Step 2: run `inference.py` with same model arguments(add noise/gan_d_local/...) as your training.
  * Input: generate noise by `fixed_noise = Variable(torch.ones(args.eval_batch_size, args.z_size).normal_(0, 1).to(device))`
  * Call the function `gen_fixed_noise(fixed_noise, gen_text_savepath)` defined in `train.py`
  * Output: a generation file predicted by generator, namely `inference_result` under your model dir `results/coco_result2021-xx-xx-xx-xx-xx` (example for coco dataset)
  * Example Command for coco dataset
  ```python
  # Train
  python train.py --data_path data/MS_COCO --maxlen 15 --save ./results/coco_result \
  --batch_size 256 --niters_gan_d 1 --niters_gan_ae 1 --lr_gan_g 4e-04 --lr_ae 0.12 \
  --add_noise --gan_d_local --enhance_dec
  # Infer
  python inference.py --save results/coco_result2021-xx-xx-xx-xx --data_path data/MS_COCO --add_noise --gan_d_local --enhance_dec
  ```
  * Example Output
  ```angular2html
  a car is sitting on a red fire hydrant
  two people are standing on a train
  a bathroom with a toilet and a sink
  ```

## Acknowledgement
Thanks to the source code provider [ARAE](https://openreview.net/forum?id=BkM3ibZRW)

repository: HKUST-MLResearch/TILGAN

branch_name: refs/heads/main

repo_name: HKUST-MLResearch/TILGAN


text:
# Bazel plugin for Visual Studio Code

[![Build Status](https://badge.buildkite.com/ecab448484315779ec28a95f8501b7f77a9a2abfc787037d5e.svg?branch=master)](https://buildkite.com/bazel/vscode-bazel-vs-bazel)

This extension provides support for Bazel in Visual Studio.

## Features

- Syntax highlighting
- **Bazel Build Targets** tree displays the build packages/targets in your
  workspace
- **CodeLens** links in BUILD files to directly launch a build or test by simply
  clicking on the targets
- **Buildifier** integration to lint and format your Bazel files (requires that
  [Buildifier](https://github.com/bazelbuild/buildtools/releases) be installed)
- Debug Starlark code in your `.bzl` files during a build (set breakpoints, step
  through code, inspect variables, etc.)

## Configuring the Extension

This extension adds a **Bazel** section to the extension settings in Visual
Studio Code. If you have Bazel installed in a location that is not on your
system path or if you wish to use a different version in the IDE, you should
set the **Bazel: Executable** setting to the location of the Bazel executable.

Similarly, the **Bazel: Buildifier Executable** setting can be configured if
you install Buildifier in a location that is not on your system path.

When Buildifier is installed, the **Format Document** command in Visual Studio
code will reformat `BUILD`, `WORKSPACE`, `.bzl`, and `.sky` files using the
tool and will display lint warnings from those files as you type. By default,
this extension does not automatically _fix_ lint warnings during formatting,
but you can opt into this by enabling the **Bazel: Buildifier Fix on Format**
setting.

## Using the Starlark Debugger

Currently, the Starlark Debugger can be used by right-clicking a build target in
the **Bazel Build Targets** view and selecting "Build Target with Starlark
Debugger". This will start the build inside the Visual Studio Code debugger
(output will be redirected to the Debug Console pane) and it will pause on any
breakpoints hit during execution.

When a Bazel thread is paused, you can step through Starlark code, add watch
expressions, and execute arbitrary statements by typing them in the input area
of the Debug Console.

Clicking the "Stop" button in the debugger will kill the Bazel process being
debugger, allowing you to halt the current build. The Bazel server, however,
will continue running.

## Contributing

If you would like to contribute to the Bazel Visual Studio extension, please
refer to the [contribution guidelines](CONTRIBUTING.md) for information about
our patch acceptance process and setting up your development environment.

repository: bazelbuild/vscode-bazel

gha_language: TypeScript

repo_name: bazelbuild/vscode-bazel


text:
# FlappyBird
A simple yet very enjoyable android game.

Hey there,

This game (android app) is my approach to build the famous Flappy Bird game.
I've used libGDX to do so.

Note: The game is working fine and can be used, however I just have to clean and organize the main code which will be done soon.

## ScreenShot

## License

MIT License


text:
---
title: Texting Is A Distraction
author: bsoist
layout: post
dsq_thread_id:
  - 87949163
categories:
  - family
  - fun
tags:
  - chat
  - im
  - iphone
  - phone
  - sms
  - tech
  - teen
  - teenager
  - text
  - texting
---
New research reveals some very interesting facts about text messaging among teens in the U.S. and some of the numbers are staggering. According to the [study by the Pew Internet and American Life Project][1], the average girl sends 80 texts per day (30 for boys) and 87% of teens say they sleep with or near their cell phones.

All of this texting certainly raises serious concerns. [Texting and driving][2], [sexting][3], [texting during class][4], the [invasion of texting into academic work][5], and [the complete destruction of the English language][6] are certainly legitimate concerns (though that last one is [an exaggeration][7] in my opinion), but I am concerned about a couple of other issues. I want to write about one of those issues today.

## The Myth of Multi-Tasking {#the_myth_of_multi_tasking}

If you are like me you have grown very attached to at least one personal computing device. These devices – computers, smartphones, even our televisions – have the ability to do more than one thing at a time. They are literally “wired” to work that way.

Unfortunately, our minds [do not appear to be wired that way][8]. I’m sure the subconscious mind has a way of thinking of solutions to problems while we focus on other things which is probably why people have learned to “sleep on” things, but I am referring to something else. Most of us have tried to imitate computers by attempting to focus on more than one task at a time. This, I think, is a huge mistake.

Others have [written about][9] and [discussed][10] this [subject][11], but the point I’d like to make today is that texting is another attempt to multi-task (in some cases). There is nothing wrong with having a conversation with someone via texting but it is another thing to send and respond to text messages all day long while attempting to focus on other things.

Frankly, the sheer amount of time spent texting scares me a little. Many of us don’t realize how much of our time is wasted in the physical act of stopping to text, followed by texting itself, followed by switching back to what we were doing – just in time to receive a reply. Sending 80 texts per day is bound to consume more time than it is worth.

More importantly, we are constantly drawing our attention away from something else we should be doing. It is not so much about which task is more important. I have no doubt that sometimes the thing I should be doing is texting but sometimes I should be doing something else – and NOT texting (or doing anything else). While trying to write this very short piece I was distracted by text messages more than a dozen times.

 [1]: http://www.reuters.com/article/idUSTRE63J0K220100420
 [2]: http://www.google.com/news/search?aq=f&pz=1&cf=all&ned=us&hl=en&q=texting+while+driving
 [3]: http://voices.washingtonpost.com/parenting/2008/12/sexting.html
 [4]: http://www.google.com/search?q=texting+in+school
 [5]: http://seattletimes.nwsource.com/html/living/2011602956_slang14.html
 [6]: http://www.google.com/search?hl=en&q=texting+and+the+english+language
 [7]: http://www.dailycardinal.com/opinion/texts-and-tweets-unlikely-to-be-our-demise-1.1306479
 [8]: http://www.scientificamerican.com/podcast/episode.cfm?id=the-myth-of-multitasking-09-07-15
 [9]: http://www.amazon.com/gp/product/0307353133?ie=UTF8&tag=weifyoasme-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0307353133
 [10]: http://www.npr.org/templates/story/story.php?storyId=112334449
 [11]: http://inboxzero.com/


text:
The following fruits are included:
Apples (different varieties: Golden, Golden-Red, Granny Smith, Red, Red Delicious), Apricot, Avocado, Avocado ripe, Banana (Yellow, Red), Cactus fruit, Cantaloupe (2 varieties), Carambula, Cherry (different varieties, Rainier), Cherry Wax (Yellow, Red, Black), Clementine, Cocos, Dates, Granadilla, Grape (Pink, White, White2), Grapefruit (Pink, White), Guava, Huckleberry, Kiwi, Kaki, Kumsquats, Lemon (normal, Meyer), Lime, Lychee, Mandarine, Mango, Maracuja, Melon Piel de Sapo, Mulberry, Nectarine, Orange, Papaya, Passion fruit, Peach, Pepino, Pear (different varieties, Abate, Monster, Williams), Physalis (normal, with Husk), Pineapple (normal, Mini), Pitahaya Red, Plum, Pomegranate, Quince, Rambutan, Raspberry, Salak, Strawberry (normal, Wedge), Tamarillo, Tangelo, Walnut.

## Dataset properties ##

Total number of images: 50590.

Training set size: 37836 images (one fruit per image).

Test set size: 12709 images (one fruit per image).

Multi-fruits set size: 45 images (more than one fruit (or fruit class) per image)

Number of classes: 75 (fruits).

Image size: 100x100 pixels.

Filename format: image_index_100.jpg (e.g. 32_100.jpg) or r_image_index_100.jpg (e.g. r_32_100.jpg) or r2_image_index_100.jpg. "r" stands for rotated fruit. "r2" means that the fruit was rotated around the 3rd axis. "100" comes from image size (100x100 pixels).

Different varieties of the same fruit (apple for instance) are stored as belonging to different classes.

## Repository structure ##

Folders [Training](Training) and [Test](Test) contain all images used for training and testing.

Folder [test-multiple_fruits](test-multiple_fruits) contains images with multiple fruits. Some of them are partially covered by other fruits. Also, they were captured in different lighting conditions compared to the fruits from Training and Test folder. This is an excelent test for real-world detection.

## How to cite ##

Horea Muresan, [Mihai Oltean](https://mihaioltean.github.io), Fruit recognition from images using deep learning, Acta Univ. Sapientiae, Informatica Vol. 10, Issue 1, pp. 26-42, 2018.

## How we created the dataset ##

Fruits were planted in the shaft of a low speed motor (3 rpm) and a short movie of 20 seconds was recorded.

A Logitech C920 camera was used for filming the fruits. This is one of the best webcams available.

Behind the fruits we placed a white sheet of paper as background.

However due to the variations in the lighting conditions, the background was not uniform and we wrote a dedicated algorithm which extract the fruit from the background. This algorithm is of flood fill type:
we start from each edge of the image and we mark all pixels there, then we mark all pixels found in the neighborhood of the already marked pixels for which the distance between colors is less than a prescribed value. We repeat the previous step until no more pixels can be marked.

All marked pixels are considered as being background (which is then filled with white) and the rest of pixels are considered as belonging to the object.

The maximum value for the distance between 2 neighbor pixels is a parameter of the algorithm and is set (by trial and error) for each movie.

## History ##

Fruits were filmed at the dates given below (YYYY.MM.DD):

2017.02.25 - Apple (golden).

2017.02.28 - Apple (red-yellow, red, golden2), Kiwi, Pear, Grapefruit, Lemon, Orange, Strawberry.

2017.03.05 - Apple (golden3, Braeburn, Granny Smith, red2).

2017.03.07 - Apple (red3).

2017.05.10 - Plum, Peach, Peach flat, Apricot, Nectarine, Pomegranate.

2017.05.27 - Avocado, Papaya, Grape, Cherrie.

2017.12.25 - Carambula, Cactus fruit, Granadilla, Kaki, Kumsquats, Passion fruit, Avocado ripe, Quince.

2017.12.28 - Clementine, Cocos, Mango, Lime, Lychee.

2017.12.31 - Apple Red Delicious, Pear Monster, Grape White.

2018.01.14 - Banana, Grapefruit Pink, Mandarine, Pineapple, Tangelo.

2018.01.19 - Huckleberry, Raspberry.

2018.01.26 - Dates, Maracuja, Salak, Tamarillo.

2018.02.05 - Guava, Grape White 2, Lemon Meyer

2018.02.07 - Banana Red, Pepino, Pitahaya Red.

2018.02.08 - Pear Abate, Pear Williams.

2018.05.22 - Lemon rotated, Pomegranate rotated

2018.05.24 - Cherry Rainier, Cherry 2, Strawberry Wedge.

2018.05.26 - Cantaloupe (2 varieties).

2018.05.31 - Melon Piel de Sapo.

2018.06.05 - Pineapple Mini, Physalis, Physalis with Husk, Rambutan.

2018.06.08 - Mulberry.

2018.06.16 - Walnut.

2018.06.17 - Cherry Wax (Yellow, Red, Black).

## License ##

MIT License

Copyright (c) 2017-2018 [Mihai Oltean](https://mihaioltean.github.io), Horea Muresan

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

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

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

gha_language: Jupyter Notebook


text:
---
title: Getting Started
---

## Our first query

Let's create our first query with `graphql-ppx`. In this case we will write a
query to fetch the current user. We can create a query with the following code.

```reason
[%graphql {|
  query UserQuery {
    user {
      id
      name
    }
  }
|}];
```

This is quite similar to how we could define a query in JavaScript. Depending on
the client, in JavaScript we usually do something like this:

```js
let query = gql`
  query UserQuery {
    user {
      id
      name
    }
  }
`;
```

However, the ReasonML code does much more. It will not only create a query that
you can pass to the client. It will also generate the types of the data that we
get back from the GraphQL server.

The shape of the data that we get back from the server has the type
`UserQuery.Raw.t`. This represents the data exactly like the response type. The
type that is being generated by `graphql-ppx` is:

```reason
module Raw = {
  type t_user = {
    id: string,
    name: Js.Nullable.t(string)
  };
  type t = {
    user: t_user
  };
}
```

So once we successfully get data back from the server it is of type `Js.Json.t`.
To work with it we can typecast it into `UserQuery.Raw.t`.

```reason
let typedData = UserQuery.unsafe_fromJson(data)
```

`UserQuery.unsafe_fromJson` is a helper function that will cast a Js.Json.t to
the GraphQL `Raw` type. In JavaScript this will not generate any code, it will
just tell the compiler to cast it into the `Raw` type. With GraphQL we know that
if we get a response that this conforms to the shape of our query. This allows
us to convert the generic `Js.Json.t` to richer and more specific type. To get
the user's id, we can get it like we are used to in ReasonML:

```reason
let userName = typedData.user.id
```

As it is a normal ReasonML value now, we can do everything we want with it, like
for instance pattern matching.

```reason
let userName = switch(user) {
  | {user: {id}} => id
}
```

## Parsing data

However it's not perfect. In this example it would be nice if the user's name
could be converted to a more idiomatic ReasonML data structure like an `option`
type. This is exactly what parse does.

```reason
let parsedData = UserQuery.parse(typedData)
```

With parse the data is converted into idiomatic ReasonML data types. In this
case the name is converted from `Js.Nullable.t(string)` to simply
`option(string)`. This means we can write the following code:

```reason
let name = switch(parsedData) {
  | {user: {name: Some(name)}} => name
  /* the user's name is null */
  | _ => "Anonymous"
}
```

Also in some cases the JSON data can not be directly represented by a ReasonML
type. For instance in case of a union, ReasonML doesn't allow arrays to contain
values with different types, so it cannot be directly mapped. In those cases the
raw type will be an _opaque_ type[^1]. When the raw result is parsed it is
converted to a list of a variant.

Usually you will not be working with the raw type. This is an implementation
detail that is normally only used inside of the GraphQL client. In most cases
the parsed result will be what you get back from the library.

## Fragments

## Using a client

[^1]:

An opaque type is essentially a value that you can't access directly. So the
value is _opaque_ to the user

repository: dune-universe/dune-universe

repo_name: dune-universe/dune-universe


text:
Netbox to DNS
=============

Ansible role to generate DNS zone files out of Netbox.

Requirements
------------

This role needs the Python package `netaddr` installed on the Ansible Controlnode.
Additional one need to define a handler called `restart nameserver` which will be executed when a zone file changes.

Role Variables
--------------

You need to set the folllowing variables. For more configuration see `default/main.yml`.

```yaml
# Default domain, used for autogenerate missing domain names
nbdns_default_domain: example.com

# List of nameservers for the DNS zones. Used to generate the 'NS' records
nbdns_nameserver:
- ns.example.com

# Email address for 'SOA' entry. The '@' will be replaced by '.' automatically.
nbdns_email<EMAIL_ADDRESS>
# Folder for placing the zone files. Folder shoud be already present.
nbdns_zones_path: /etc/bind

# List of the DNS zones. Define 'subnet' if it is a reverse zone. 'entries' allows to specify additional records.
nbdns_zones:
- domain: example.com
  entries:
  - name: www.example.com
    type: CNAME
    value: host01.example.com.
- domain: 2.0.192.in-addr.arpa
  subnet: <IP_ADDRESS>/24

# URL to the Netbox API
nbdns_netbox_api_url: https://netbox.example.com/api

# Token to authenticate against the Netbox API
nbdns_netbox_token:<PHONE_NUMBER>abcdef0123456789abcdef01234567
```

Example Playbook
----------------

```yaml
- hosts: nameservers
  handlers:
  - name: restart nameserver
    service:
      name: ...
      state: restarted
    become: yes
  roles:
  - role: netbox-to-dns
```

License
-------

BSD-2-Clause

repository: kb-light/netbox-to-dns

repo_name: kb-light/netbox-to-dns


text:
Android AvatarView
===================
A circular ImageView or TextView with colorful background for showing avatar.

This is based on [CircleImageView from hdodenhof](https://github.com/hdodenhof/CircleImageView) and [FitTextView from SUKOHI](https://github.com/SUKOHI/FitTextView)

![AvatarView](https://raw.github.com/teejoe/AvatarView/master/demo.png)

Features
==============

* Display circular image / text.
* Text auto fitting in circle.
* Display colorful background for different text.
* Customize background color generator.

Gradle integration
==================

Minimum code for Gradle integration, place code in your `build.gradle`

```
dependencies {
    compile 'com.m2x:AvatarView:1.0.1'
}
```

Usage
============

* Add code in your layout.xml:

    ```
    <com.m2x.avatarview.AvatarView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_margin="10dp"
        android:padding="5dp"
        app:avtv_fit_text_length="5"
        app:avtv_random_fill_color="true"
        app:avtv_text="text1"
        app:avtv_text_size="40sp"/>
    ```

* Customize backgounrd color generator

    You can override computeFillColor() to make you own background color generator. Currently its based on the text content:

    ```
    protected int computeFillColor() {
        if (mText == null) {
            return mFillColor;
        }

        int length = ((mText.length() > 10) ? 10 : mText.length());

        int value = 0;
        for (int i = 0; i < length; i++) {
            value += mText.charAt(i);
        }
        value *= 12345;

        int red = 100 + ((value & 0x00ff0000) >> 17);
        int green = 100 + ((value & 0x0000ff00) >> 9);
        int blue = 100 + ((value & 0x000000ff) >> 1);

        return Color.argb(255, red, green, blue);
    }
    ```

License
============

    Copyright 2014-2016 M2X

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

repository: teejoe/AvatarView

repo_name: teejoe/AvatarView


text:
# How to use

## 1. Bundle

Run

```sh
deno run --unstable -A 'https://deno.land/x/bundler/spa_server_cli.ts' src/index.html
```

## 2. Serve

files are served to `http://<IP_ADDRESS>:8000`

repository: pettijohn/Bundler

repo_name: pettijohn/Bundler


text:
---
layout: post
date: 2016-06-14
title: "Bill Levkoff Bridesmaid Dress Style 162 Sleeveless Floor-Length Empire"
category: Bill Levkoff
tags: [Bill Levkoff ,Bill Levkoff,Empire,Sweetheart,Floor-Length,Sleeveless]
---
### Bill Levkoff Bridesmaid Dress Style 162
Just **$249.99**
###   Sleeveless Floor-Length Empire

BRANDS	Bill Levkoff

Silhouette	Empire

Neckline	Sweetheart

Hemline/Train	Floor-Length

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/bill-levkoff-bridesmaid-dresses-bl-collection/14980-bill-levkoff-bridesmaid-dress-style-162.html](https://www.readybrides.com/en/bill-levkoff-bridesmaid-dresses-bl-collection/14980-bill-levkoff-bridesmaid-dress-style-162.html)


text:
# Bottom Sheet

[![Build Status](https://shields.io/github/workflow/status/surfstudio/flutter-bottom-sheet/build?logo=github&logoColor=white)](https://github.com/surfstudio/flutter-bottom-sheet)
[![Coverage Status](https://img.shields.io/codecov/c/github/surfstudio/flutter-bottom-sheet?logo=codecov&logoColor=white)](https://codecov.io/gh/surfstudio/flutter-bottom-sheet)
[![Pub Version](https://img.shields.io/pub/v/bottom_sheet?logo=dart&logoColor=white)](https://pub.dev/packages/bottom_sheet)
[![Pub Likes](https://badgen.net/pub/likes/bottom_sheet)](https://pub.dev/packages/bottom_sheet)
[![Pub popularity](https://badgen.net/pub/popularity/bottom_sheet)](https://pub.dev/packages/bottom_sheet/score)
![Flutter Platform](https://badgen.net/pub/flutter-platform/bottom_sheet)

This package is part of the [SurfGear](https://github.com/surfstudio/SurfGear) toolkit made by [Surf](https://surf.ru).

## About

Custom bottom sheet widget that can be resized in response to drag gestures and then scrolled.

## Usage

Main classes:

1. [FlexibleBottomSheet](lib/src/flexible_bottom_sheet.dart)
2. [BottomSheetRoute and showing methods](lib/src/flexible_bottom_sheet_route.dart)

Flexible and scrollable bottom sheet.

All you have to do is call `showFlexibleBottomSheet()` and you'll get a popup that looks like a modal bottom sheet and can be resized by dragging it up and down and scrolled when expanded.

There are 2 types of BottomSheets:

1. BottomSheet
2. StickyBottomSheet

#### Simple BottomSheet

![](media/open_bottom_sheet.gif)

To show bottomSheet, use :

```dart
showFlexibleBottomSheet(
  minHeight: 0,
  initHeight: 0.5,
  maxHeight: 1,
  context: context,
  builder: _buildBottomSheet,
  anchors: [0, 0.5, 1],
);

Widget _buildBottomSheet(
    BuildContext context,
    ScrollController scrollController,
    double bottomSheetOffset,
  ) {
    return SafeArea(
      child: Material(
        child: Container(
          child: ListView(
            ...
          ),
        ),
      ),
    );
  }
```

#### Sticky BottomSheet

![](media/open_stiky_bottom_sheet.gif)

To show sticky BottomSheet, use:
**You have to return SliverChildListDelegate from builder !!!**

```dart
showStickyFlexibleBottomSheet(
      minHeight: 0,
      initHeight: 0.5,
      maxHeight: 1,
      headerHeight: 200,
      context: context,
      backgroundColor: Colors.white,
      headerBuilder: (BuildContext context, double offset) {
        return Container(
          ...
        );
      },
      builder: (BuildContext context, double offset) {
        return SliverChildListDelegate(
          <Widget>[...],
        );
      },
      anchors: [0, 0.5, 1],
    );
```

## Installation

Add `bottom_sheet` to your `pubspec.yaml` file:

```yaml
dependencies:
  bottom_sheet: ^1.0.0
```

You can use both `stable` and `dev` versions of the package listed above in the badges bar.

## Changelog

All notable changes to this project will be documented in [this file](./CHANGELOG.md).

## Issues

To report your issues,  submit them directly in the [Issues](https://github.com/surfstudio/flutter-bottom-sheet/issues) section.

## Contribute

If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our [contribution guide](./CONTRIBUTING.md) first and send us your pull request.

Your PRs are always welcome.

## How to reach us

Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.

[![Telegram](https://img.shields.io/badge/chat-on%20Telegram-blue.svg)](https://t.me/SurfGear)

## License

[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)

repository: awaik/flutter-bottom-sheet

repo_name: awaik/flutter-bottom-sheet


text:
## Install
Check if pkg-config is able to find the right libvips include:
```
pkg-config --cflags --libs vips
```

Package 'libffi', required by 'gobject-2.0', not found
```
# optional, use you libffi lib path
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
```

Per the security update https://groups.google.com/forum/#!topic/golang-announce/X7N1mvntnoU you may need whitelist the -Xpreprocessor flag in your environment.
```
export CGO_CFLAGS_ALLOW='-Xpreprocessor'
```

## examples
```golang
func main() {
	img := vips.NewFromFile("./images/Landscape_2.jpg")
	wm := vips.NewFromFile("./images/away.webp")

	err := wm.ThumbnailImage(200)
	if err != nil {
		panic(err)
	}

	err = wm.Resize(float64(img.Width()) / float64(wm.Width()))
	if err != nil {
		panic(err)
	}

	err = wm.Rotate(30)
	if err != nil {
		panic(err)
	}

	err = wm.Replicate(img.Width()/wm.Width()+1, img.Height()/wm.Height()+1)
	if err != nil {
		panic(err)
	}
	img.Replicate(2, 2)

	fmt.Println(img.Height(), img.Width())

	imgCopy, err := img.Copy()
	if err != nil {
		panic(err)
	}
	fmt.Println(imgCopy.Width())

	err = img.Save2file("out.png")
	if err != nil {
		panic(err)
	}
}
```

## Features
### conversion
- Copy: Copy an image, optionally modifying the header.
- Replicate: repeats an image many times.
- Gravity: place in within an image of size width by height at a certain gravity.
- Composite2: composite overlay on top of base with mode .
- GetAngle: examine the metadata on im and return the VipsAngle
- AutoRot: look at the image metadata and rotate the image to make it upright.
- Embed: Embed *Image within an image of size width by height at position x , y .
- ExtractArea: extract an area from an image. The area must fit within *Image.
- Crop: Crop a synonym for ExtractArea
- Flip: Flip an image left-right or up-down.
- Grid: Grid chop a tall thin image up into a set of tiles, lay the tiles out in a grid.
- Scale: Scale search the image for the maximum and minimum value
- SubSample: SubSample an image by an integer fraction. This is fast, nearest-neighbour shrink.
- Zoom: Zoom an image by repeating pixels. This is fast nearest-neighbour zoom.
- Wrap: Wrap slice an image up and move the segments
- ExtractBand: SmartCrop crop an image down to a specified width and height by removing boring parts.
### create
- Black: Black make a black unsigned char image of a specified size.
- Xyz: Xyz Create a two-band uint32 image where the elements in the first band have the value of their x coordinate and elements in the second band have their y coordinate.
- Grey: Grey create a one-band float image with the left-most column zero and the right-most 1.
- GaussMat: GaussMat Creates a circularly symmetric Gaussian image of radius sigma.
- LogMat: LogMat creates a circularly symmetric Laplacian of Gaussian mask of radius sigma.
- Text: Text draw the string text to an image.
- GaussNoise: GaussNoise make a one band float image of gaussian noise with the specified distribution.
- Eye: Eye create a test pattern with increasing spatial frequence in X and amplitude in Y.
- Sines: Sines creates a float one band image of the a sine waveform in two dimensions.
- Zone: Zone create a one-band image of a zone plate.
- Identity: Identity creates an identity lookup table.
- BuildLut: BuildLut this operation builds a lookup table from a set of points.
- InvertLut: InvertLut given a mask of target values and real values, generate a LUT which will map reals to targets.
- ToneLut: ToneLut generates a tone curve for the adjustment of image levels.
- MaskIdeal: MaskIdeal Make an ideal high- or low-pass filter.
- MaskIdealRing: MaskIdealRing make an ideal ring-pass or ring-reject filter.
- MaskIdealBand: MaskIdealBand make an ideal band-pass or band-reject filter.
- MaskButterWorth: MaskButterWorth make an butterworth high- or low-pass filter.
- MaskButterWorthRing: MaskButterWorthRing Make a butterworth ring-pass or ring-reject filter.
- MaskButterWorthBand: MaskButterWorthBand make an butterworth band-pass or band-reject filter
- MaskGaussian: MaskGaussian Make a gaussian high- or low-pass filter.
- MaskGaussianRing: MaskGaussianRing Make a gaussian ring-pass or ring-reject filter.
- MaskGaussianBand: MaskGaussianBand Make a gaussian band-pass or band-reject filter.
- MaskFractal: MaskFractal operation should be used to create fractal images by filtering the power spectrum of Gaussian white noise
- FractSurf: FractSurf Generate an image of size width by height and fractal dimension fractalDimension.
- Worley: Worley create a one-band float image of Worley noise.
- Perlin: Perlin create a one-band float image of Perlin noise.
### draw
- DrawRect: DrawRect paint pixels within left , top , width , height in image with ink.
- DrawRect1: DrawRect1 as DrawRect, but just take a single float64 for ink.
- DrawPoint: DrawPoint draw a single pixel at x, y.
- DrawPoint1: DrawPoint1 as DrawPoint, but just take a single float64 for ink.
- DrawImage: DrawImage draw sub on top of image at position x, y.
- DrawMask: DrawMask draw mask on the image. mask is a monochrome 8-bit image with 0/255 for transparent or ink coloured points.
- DrawMask1: DrawMask1 as DrawMask, but just take a single float64 for ink.
- DrawLine: DrawLine draws a 1-pixel-wide line on an image.
- DrawLine1: DrawLine1 as DrawLine, but just take a single double for ink.
- DrawCircle: DrawCircle Draws a circle on image.
- DrawCircle1: DrawCircle1 as DrawCircle, but just take a single double for ink.
- DrawFlood: DrawFlood flood-fill image with ink, starting at position x , y.
- DrawFlood1: DrawFlood1 as DrawFlood, but just take a single double for ink.
- DrawSmudge: DrawSmudge smudge a section of image.
### foreign_save

### freqfilt
- FwFFT: FwFFT transform an image to Fourier space.
- InvFFT: InvFFT transform an image from Fourier space to real space.
- FreqMult: FreqMult transformed to Fourier space, multipled with mask.
- Spectrum: Spectrum make a displayable (ie. 8-bit unsigned int) power spectrum.
- Phasecor: Phasecor convert the two input images to Fourier space, calculate phase-correlation, back to real space.
### header
### mosaicing
- Merge: Merge joins two images left-right (with ref on the left)  or up-down (with ref above) with a smooth seam.
- Mosaic: Mosaic joins two images left-right (with ref on the left) or top-bottom (with ref above) given an approximate overlap.
- Mosaic1: Mosaic1 This operation joins two images top-bottom (with sec on the right) or left-right (with sec at the bottom) given an approximate pair of tie-points.
- Match: Match scale, rotate and translate sec so that the tie-points line up.
- GlobalBalance: GlobalBalance can be used to remove contrast differences in an assembled mosaic.
- ReMosaic: ReMosaic takes apart the mosaiced image in and rebuilds it, substituting images.
### resample
- Resize:  Resize image
- Rotate: Rotate image
- Thumbnail: Thumbnail Make a thumbnail from a file
- ThumbnailBuffer: ThumbnailBuffer Make a thumbnail from []byte
- ThumbnailImage: ThumbnailImage Make a thumbnail from *Image
### vip
- DefaultInit: DefaultInit init vips by default
- Init: Init starts up libvips
- Shutdown: Shutdown drop caches and close plugins. Run with "--vips-leak" to do a leak check too.
- LeakSet: LeakSet turn on or off vips leak checking
- VersionString: VersionString get the VIPS version as a static string, including a build date and time.
- Version: Version get the major, minor or micro library version, with flag values 0, 1 and 2.
- Error: Error Get a pointer to the start of the error buffer as a C string.
### vipsimage
- New: New empty VipsImage
- NewMemory: NewMemory creates a new VipsImage.
- NewFromFile: NewFromFile opens filename for reading.
- NewFromBuffer: NewFromBuffer loads an image from the formatted area of memory buf.
- Height: Height return image height
- Width:  Width return image width
- ProgressSet: ProgressSet ff set, vips will print messages about the progress of computation to stdout.
- ImageSetProgress: ImageSetProgress vips signals evaluation progress via the “preeval”

## Contributing
We appreciate your help!

repository: vipsimage/vipsimage

gha_language: Go

repo_name: vipsimage/vipsimage


text:
# Tool Parameters and Filters

Every tool has a set of options on the left-hand panel. Switch between your projects using the dropdown at the top.

### Project Switcher

Switch between different projects while keeping the rest of the parameters the same. This can help you compare results between different datasets.

### Data Filtering

On-demand filters are accessible via a dropdown menu for any tool. These filters allow you to exclude outliers or remove any data you don't want to see in the visualization or feature selection result.

#### OTU Filtering

{% hint style="info" %}
OTU filtering is automatically applied on feature selection tools to improve performance
{% endhint %}

* Low-expression OTUs can be automatically filtered out using the count and prevalence threshold
  * Count Threshold: OTUs are only kept if their total count across all samples is greater than or equal to this number
  * Prevalence Threshold: OTUs are only kept if they occur with a non-zero count across all samples with this percentage or greater.
* OTU filtering
  * Use this to filter out specific OTUs or taxonomic groups. Supports "include all but this" or "exclude all but this"

#### Sample filtering

* Remove specific sample IDs by choosing the "Sample IDs" option
* Remove entire sample groups by filtering by a categorical metadata variable \(eg. remove the entire control group to assess how the correlation changes\)

![](.gitbook/assets/image%20%2812%29.png)


text:
# What is Elixir?

** Erlang VM **
** Less code **
** More fun **

Commentary:
Elixir has a property that people who start using it feel an unexplained sense of joy and pleasure. Programmers that come from Ruby describe this feeling as similar to the one they had when first started using Ruby.
Dave Thomas

Elixir has drawn some inspiration for its syntax from Ruby. But don't let that mislead you: Elixir is nothing like Ruby when it comes to semantics.

---

# In a nutshell

* Functional
* Immutable data
* Builtin concurrency
* Easily distributed

---

# What's inside?

* Erlang VM (Commentary: VM vs the language, not the same thing)
* Modern syntax
* Protocols (runtime polymorphism)
* Macros

---

# Erlang VM

   +--------+   +--------+
   | Erlang |   | Elixir |
   +--------+   +--------+
       ||           ||
       \/           \/
     +-----------------+
     | .beam byte code |
     +-----------------+
             ||
             \/
+---------------------------+
| BEAM emulator (Erlang VM) |
+---------------------------+

* Same byte code
* Same VM
* Same runtime environment
* Seamless interoperability

---

# Why Elixir?

* No repetitive boilerplate (thanks to macros)

* No duplicate APIs (thanks to protocols)

* DSLs

---

** Elixir == PRODUCTIVITY **

---

# Why Elixir?

* User friendly (syntax; exceptions; REPL)

* Tools (mix, ExUnit, EEx)

* New standard library (with awesome features)

* Enthusiastic community

---

** Elixir == FUN ***

---

# What does it look like?

*** Demo time! ***

    Create a new project with Mix.

    Show 'mix test'.

    Add HTTPotion.

    Show HTTP request with 'mix run'.

    *OR*

    Add jazz.

    Encode and decode some JSON.

---

# What just happened

** Easy to start: mix to the rescue **

** jazz: simple API **

** jazz: extensible API **

---

# What Elixir is good for?

## Everything Erlang can do, Elixir can do too

* Concurrent
* Highly reliable
* Soft-realtime (== low latency)
* Distributed

---

# What Elixir is good for?

*** Web apps ***

---

# What Elixir is good for?

*** Distributed computing ***

---

# What Elixir is good for?

*** Compilers ***

---

# Who is using Elixir?

** SoundCould **

---

# Getting started

* http://elixir-lang.org/getting_started/1.html
* Programming Elixir by PragProg
* Elixir Programming by O'Reilly
* Meet Elixir at peepcode.com
* Wiki

---

# Status & the future

* lots of things are already there
* lots more to come (depends on YOUR interest!)

---

# There is a ton of things I haven't told you about

---

# If you're an Erlanger, you'll want to take a closer look

# I'm available for workshops :)

---

# Thanks!

---

# Bonus: Brief history of Elixir

---

# Bonus: Code samples

* pattern matching
* macros
* acces protocol
* Enum, Stream


text:
# Data description:

### Attribute: Attribute Range
- symboling: -3, -2, -1, 0, 1, 2, 3
(Cars are initially assigned a risk factor symbol associated with its price. Then, if it is more risky (or less), this symbol is adjusted by moving it up (or down) the scale. Actuarians call this process "symboling". A value of +3 indicates that the auto is risky, -3 that it is probably pretty safe.)
- make: alfa-romero, audi, bmw, chevrolet, dodge, honda, isuzu, jaguar, mazda, mercedes- benz, mercury, mitsubishi, nissan, peugot, plymouth, porsche, renault, saab, subaru, toyota, volkswagen, volvo
- fuel-type: diesel, gas.
- aspiration: std, turbo.
- num-of-doors: four, two.
- body-style: hardtop, wagon, sedan, hatchback, convertible.
- drive-wheels: 4wd, fwd, rwd.
- engine-location: front, rear.
- wheel-base: continuous from 86.6 120.9.
- length: continuous from 141.1 to 208.1. 11 width: continuous from 60.3 to 72.3.
- height: continuous from 47.8 to 59.8.
- curb-weight: continuous from 1488 to 4066.
- engine-type: dohc, dohcv, l, ohc, ohcf, ohcv, rotor.
- num-of-cylinders: eight, five, four, six, three, twelve, two.
- engine-size: continuous from 61 to 326.
- fuel-system: 1bbl, 2bbl, 4bbl, idi, mfi, mpfi, spdi, spfi.
- bore: continuous from 2.54 to 3.94.
- stroke: continuous from 2.07 to 4.17.
- compression-ratio: continuous from 7 to 23.
- horsepower: continuous from 48 to 288.
- peak-rpm: continuous from 4150 to 6600.
- city-mpg: continuous from 13 to 49.
- highway-mpg: continuous from 16 to 54.
- price: continuous from 5118 to

repository: CERTOS/Automobile-price-prediction

path: /Data description.md

filename: Data description.md

repo_name: CERTOS/Automobile-price-prediction


text:
# SES Woomera

Notify intended recipients that AWS's Simple Email Service attempted to send an email to them, but the email exceeded SES's size limits and instead offering recipients a way to recover the email.

----

## Our Problem:
- We use Sendmail on Amazon Linux EC2 Instances, which communicates to Amazon's Simple Email Service (SES) to send emails.
- SES has a hard limit of 10MB. If we try to send any emails over 10MB, SES refuses to send it.
- Emails then get lost, floating in limbo between SES and our instances with no way to recover it.
- That's where this comes in...

## What does it do?
Before we progress, some legwork has to be implemented before this can work. Including:

- A way to archive emails that sendmail sends to SES
   - We used ['copymail.m4'](http://serverfault.com/questions/229029/configuring-sendmail-to-archive-a-copy-of-any-outgoing-message), taken from [alvosu](http://serverfault.com/users/68346/alvosu) at [serverfault.com](https://serverfault.com)
- A way to store those emails in S3
  - We used logrotate + a script utilising formail based off an [answer on StackOverflow](http://stackoverflow.com/questions/11281893/how-to-split-mailbox-into-single-file-per-message) from [Igor Chubin](http://stackoverflow.com/users/1458569/igor-chubin)

Once you've got emails split into multiple files and stored in S3, this script does the following:
  - Scans S3 and finds emails over 10MB (which wouldn't have been sent due to SES's 10MB limit)
  - If it finds anything, it generates a signed URL to that file and extracts key information from the email (incl. To/From/CC/Reply-To/Subject)
  - Sends a *new* email to the intended recipients, stating that their message has been stored in S3 temporarily, and to download it using the signed URL.
  - Once execution is complete, sends an email to a predetermined address with statistics (emails sent, etc). This is optional.

In addition to the script, this repository contains a Data Pipeline Definition, which can automate the process.

**The Data Pipeline (data-pipeline/):**

Contains a Data Pipeline Definition (pipeline-definition.json.default) which
- Downloads and runs a Bash Script (ses-woomera-pipeline.sh) which...
- Downloads and runs the Python Script (ses-woomera.py)

## How to use it:
**Prerequesites:**
- [An AWS Account](http://aws.amazon.com/getting-started/)
- [AWS CLI Installed](http://aws.amazon.com/cli/)
- Python (Written using Python 2.7.8)

**The Script:**

```
usage: ses-woomera.py [-h] --bucket BUCKET --prefix PREFIX --region REGION --processedEmails PROCESSEDEMAILS --adminEmail ADMINEMAIL

arguments:
  -h, --help            show this help message and exit
  --bucket BUCKET, -b BUCKET
                        Bucket Name (e.g. "blinkmobile-logs")
  --prefix PREFIX, -p PREFIX
                        S3 prefix to emails thatshould be processed (e.g. "emails")
  --region REGION, -r REGION
                        AWS region (e.g. "us-west-1")
  --processedEmails PROCESSEDEMAILS, -e PROCESSEDEMAILS
                        S3 prefix to processed emails JSON file (e.g.emails/_PROCESSING/processedEmails.json)
  --adminEmail ADMINEMAIL, -a ADMINEMAIL
                        (OPTIONAL) An SES Verified Email Address to send statistics to after completion
<EMAIL_ADDRESS>```

- Example: ```python ses-woomera.py -b blinkmobile-emails -p 2015/msg -r us-east-1 -e 2015/processed-emails.json -a<EMAIL_ADDRESS>```

**The Pipeline:**
- Create a new Pipeline in AWS
- Import the JSON Definition located at data-pipeline/pipeline-definition.json.default
- Change Variables (anything marked with ```${TEXT}```)
- Run Pipeline.

## Documentation:
Some documentation is present in the code itself. It should be all straight-forward anyway.

## Contributions:
Contributions are more than welcome. Send a pull request and we'll go from there.

## Licences:
This project uses the Simplified BSD Licence. More information can be found inside [LICENCE](LICENCE)

repository: oneblink/ses-woomera

repo_name: oneblink/ses-woomera


text:
# Title: Super Galactic Age Calculator
####
#### Project initiated:
#### By Saoud Rana
## Project Description
Super Galactic Age Calculator
A solar year lasts 365 days on planet Earth. However, the length of a solar year varies from planet to planet. For instance, a solar year on Mercury lasts 88 days. Write an application that determines a user's age based on a planet's solar years.

Take a person's age in years and create a class that does the following:

* Returns their age in Mercury years. (A Mercury year is .24 Earth years.)
* Returns their age in Venus years. (A Venus year is .62 Earth years.)
* Returns their age in Mars years. (A Mars year is 1.88 Earth years.)
* Returns their age in Jupiter years. (A Jupiter year is 11.86 Earth years.)
* Determines how many years a user has left to live on each planet… (yikes!) To do this, the application will have to calculate the user's life expectancy. You can determine average life expectancy as you see fit. A simple way to do this would be to have the user input the average life expectancy for their demographic. A more involved way to do this would be to collect other information from the user (e.g. lifestyle, country of residence, activity level, etc.) to determine their life expectancy.
* If a user has already surpassed the average life expectancy, return the number of years they have lived past the life expectancy.
## Technologies Used
* HTML5
* Javascript ES6
* CSS
* css-loader 3.2.0
* JQuery 3.5.1
* Babel/core 7.6.4
* Babel/plugin-transform-modules-commonjs 7.6.0
* clean-webpack-plugin 3.0.0
* eslint 6.3.0
* eslint-loader 3.0.0
* Jest 24.9.0
* Node Package Manager 6.14.9
* webpack 4.39.3

## Set up / Installation requirements
* Open the terminal in your machine
* Navigate to the directory where you would like to save this project
* Clone the project with $ git clone https://github.com/saoud/Project-5-Super-Galactic-Age-Calculator.git
* Recreate this project's environment with $ `npm install`
* Create production environment with terminal command $ `npm run build`
* Run the tests to see functionality $ `npm test`

## Known Bugs
* No known bugs

## Notes

## License
* [MIT](https://github.com/saoud/html-template/blob/main/LICENSE)
* Copyright 2021 Saoud Rana
## Contact
Saoud Rana<EMAIL_ADDRESS>


text:
# QRedis

A [Python](http://www.python.org/), [Qt](http://www.qt.io/)
based [Redis](http://redis.io) client user interface.

![screenshot](doc/screen1.png)

## Help wanted

Open to people who want to colaborate.

- Would like to know which features you would like to have
- Pull requests are welcome
- You can always open an issue saying you want to be part of the team

## Installation

```console
$ pip install qredis
```

## Requirements

- Python >= 3.5
- [PyQt](http://riverbankcomputing.com/software/pyqt) 5
  (or in the future PySide)
- [redis-py](https://github.com/andymccurdy/redis-py)

## Usage

```console
$ qredis with no DB loaded on startup
$ qredis

$ connect to localhost:6379, db=0
$ qredis -p 6379

$ connect with unix socket, db=5
$ qredis -s /tmp/redis.sock -n 5
```

## Alternatives

* [RESP.app (Formerly RedisDesktopManager)](https://github.com/uglide/RedisDesktopManager)
* [dbgate](https://github.com/dbgate/dbgate)
* [RedisInsight](https://github.com/RedisInsight/RedisInsight)
* [redis-commander](https://github.com/joeferner/redis-commander)

An updated list can be found [here](https://redis.io/docs/tools/#gui)

**That's all folks!**

repository: tiagocoutinho/qredis

gha_language: Python

repo_name: tiagocoutinho/qredis


text:
# localStorage and sessionStorage
---

`localStorage` and `sessionStorage`, part of the web storage API, are two great tools to save key/value pairs locally.

---

## localStorage vs sessionStorage

`localStorage` and `sessionStorage` accomplish the exact same thing and have the same API, but with `sessionStorage` the data is persisted only until the window or tab is closed, while with `localStorage` the data is persisted until the user manually clears the browser cache or until your web app clears the data.

---

## Creating Entries

Create key/value pair entries with `localStorage.setItem`, providing a key and a value:

```js
let key = 'Item 1';
localStorage.setItem(key, 'Value');
```
---

## Reading Entries

Read entries with `localStorage.getItem`:

```js
let myItem = localStorage.getItem(key);
```
---

## Updating Entries

Update an entry just as you would create a new one with setItem, but with a key that already exists:

```js
localStorage.setItem(key, 'New Value');
```

---

## Deleting Entries

Delete an entry with the removeItem method:

```js
localStorage.removeItem(key);
```

---

## Clearing Everything

Here’s how to clear everything that’s stored in `localStorage`:

```js
localStorage.clear();
```

---

## Storing Json Objects

Only strings can be stored with `localStorage` or `sessionStorage`, but you can use `JSON.stringify` to store more complex objects and JSON.parse to read them:

```js
// Create item:
let myObj = { name: 'Skip', breed: 'Labrador' };
localStorage.setItem(key, JSON.stringify(myObj));

// Read item:
let item = JSON.parse(localStorage.getItem(key));
```

---

## Checking for Items

Here’s how you can test for the presence of items in the `localStorage`:

```js
if (localStorage.length > 0) {
  // We have items
} else {
  // No items
}
```

---

## Checking for Support

Test for `localStorage` support by checking if it’s available on the window object:

```js
if (window.localStorage) {
  // localStorage supported
}
```

---

## Iterating Over Items

`localStorage` or `sessionStorage` don’t have a forEach method, but you can iterate over the items with a good old for loop:

```js
for (let i = 0; i < localStorage.length; i++){
  let key = localStorage.key(i);
  let value = localStorage.getItem(key);
  console.log(key, value);
}
```

---

# References

- https://alligator.io/js/introduction-localstorage-sessionstorage/

gha_language: Java


text:
# Changelog

The format is based on [Keep a Changelog].

[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [Unreleased]
- Migrated to 2021 edition, enforcing MSRV of `1.56.1`. [#601](https://github.com/paritytech/parity-common/pull/601)

## [0.3.0] - 2021-01-05
### Breaking
- Updated `rlp` to 0.5. [#463](https://github.com/paritytech/parity-common/pull/463)

repository: paritytech/parity-common

gha_language: Rust

repo_name: paritytech/parity-common


text:
---
section: exercises
description: Auth0 digital identity Lab 2, Exercise 1: Consuming APIs
topics:
  - digital identity
  - OIDC
  - OpenId Connect
  - OAuth2
contentType:
    - index
    - concept
---
# Lab 2, Exercise 1: Consuming APIs

::: warning
If you came to this page directly, go to the [first page of this lab](/identity-labs/02-calling-an-api) and read through the instructions before getting started.
:::

After learning how to secure your web application with Auth0 in [lab 1](/identity-labs/01-web-sign-in), you will now learn how to make this application consume APIs on behalf of your users. You will start by running an unsecured API and a web application to see both working together, and then you will secure your API with Auth0.

          Video Tutorial

          Lab

1. Open a new terminal and browse to `/lab-02/begin/api` in your locally-cloned copy of the [identity exercise repo](https://github.com/auth0/identity-102-exercises/). This is where the code for your API resides. The API is an Express backend that contains a single endpoint. This endpoint (served under the root path) returns expenses, which are data that belong to each user (though they are static and the same for all).

<%= include('../_includes/_git-clone-note') %>

2. Install the dependencies using npm:

```bash
# Make sure we're in the right directory
❯ pwd
/Users/username/identity-102-exercises/lab-02/begin/api

❯ npm install
# Ignore any warnings

added XX packages in X.XXs
```

3. Next, copy `.env-sample` to `.env` and start the API:

```bash
❯ cp .env-sample .env
❯ npm start

listening on http://localhost:3001
```

::: note
If you see a message like *Error: listen EADDRINUSE :::3001* in your terminal after starting the application, this means that port 3001 is in use somewhere. Change the `PORT` value in your `.env` file to "3002" and try again.
:::

4. In a new terminal window or tab, navigate to the `/lab-02/begin/webapp` directory and install the dependencies using npm:

```bash
# Navigating from the previous directory
❯ cd ../webapp

# Make sure we're in the right directory
❯ pwd
/Users/username/identity-102-exercises/lab-02/begin/webapp

❯ npm install
# Ignore any warnings

added XX packages in X.XXs
```

5. Once again, copy the `.env-sample` to `.env` for the web application:

```bash
❯ cp .env-sample .env
```

6. Update the web application `.env` file you just created with the same values as you used in lab 1. If you did not do lab 1 first, follow steps 9 through 15 [on this page](/identity-labs/01-web-sign-in/exercise-01) to create and configure an application with Auth0 and update the `.env` file.

```text
ISSUER_BASE_URL=https://YOUR_DOMAIN
CLIENT_ID=YOUR_CLIENT_ID
API_URL=http://localhost:3001
PORT=3000
APP_SESSION_SECRET=LONG_RANDOM_STRING
```

::: note
If you changed the port for the API above, make sure to update the `API_URL` with this new value.
:::

7. Start the web application using npm:

```bash
❯ npm start

listening on http://localhost:3000
```

8. Open [localhost:3000](http://localhost:3000) in your browser. There, you will see the homepage of the web application and, if you log in, you will be able to access the expenses report. The page might look similar to the Lab 1 solution, however, the difference is that an external API provides the Expenses information instead of being hard-coded in the Web app.

![First page of the starter application](/media/articles/identity-labs/lab-02-starter-app-rendered.png)

Right now, even though the application requires authentication, the API does not. That is, you are calling the API from the Web app, without any authentication information. If you browse to the API's URL at [localhost:3001](http://localhost:3001) without logging in, you will see the expenses. In the following steps, you will update your application to call the API with a token.

9. Open `webapp/server.js` in your code editor and make the following change:

```js
// webapp/server.js

app.use(auth({
  required: false,
  auth0Logout: true,
  baseURL: appUrl,

  // Add the additional configuration keys below 👇
  appSessionSecret: false,
  authorizationParams: {
    response_type: 'code id_token',
    response_mode: 'form_post',
    audience: process.env.API_AUDIENCE,
    scope: 'openid profile email read:reports'
  },
  handleCallback: async function (req, res, next) {
    req.session.openidTokens = req.openidTokens;
    req.session.userIdentity = req.openidTokens.claims();
    next();
  },
  getUser: async function (req) {
    return req.session.userIdentity;
  }
  // 👆

}));
```

This change updates the configuration object passed to `auth()` and defines how you want the `express-openid-connect` library to behave. In this case, you configured the library with a new property called `authorizationParams` and passed in an object with three properties:

- `response_type` - setting this field to `code id_token` indicates that you no longer want the middleware to fetch just an ID token (which is the default behavior for this package). Instead, you are specifying that you want an ID token *and* an authorization code. When you configure the `express-openid-connect` library to fetch an authorization code, the middleware automatically exchanges this code for an access token (this process is known as the Authorization Code Grant flow). Later, you will use the access token to call the API.
- `response_mode` - This is the same mode used in lab 1, a POST request from the authorization server to the application.
- `audience` - this tells the middleware that you want access tokens valid for a specific resource server (your API, in this case). As you will see soon, you will configure an `API_AUDIENCE` environment variable to point to the identifier of an API that you will register with Auth0.
- `scope` - securing your API uses a delegated authorization mechanism where an application (your web app) requests access to resources controlled by the user (the resource owner) and hosted by an API (the resource server). Scopes, in this case, are the permissions that the access token grants to the application on behalf of the user. In your case, you are defining four scopes: the first three (`openid`, `profile`, and `email`) are scopes related to the user profile (part of OpenID Connect specification). The last one, `read:reports`, is a custom scope that will be used to determine whether the caller is authorized to retrieve the expenses report from the API on behalf of a user.

The `appSessionSecret`, `handleCallback`, and `getUser` additions change how the user session is handled and stores the incoming access and refresh tokens somewhere we can access later.

10. Back in the `webapp/server.js` file, find the `/expenses` endpoint definition. In this code, you are making a request to the API, without any authorization information, to get a JSON resource. Note the use of the `requiresAuth()` middleware. This will enforce authentication for all requests to this endpoint.

11. Update the endpoint definition to include authorization information in the request:

```js
// webapp/server.js

app.get('/expenses', requiresAuth(), async (req, res, next) => {
  try {

    // Replace this code ❌
    /*
    const expenses = await request(process.env.API_URL, {
      json: true
    });
    */

    // ... with the code below 👇
    let tokenSet = req.openid.makeTokenSet(req.session.openidTokens);
    const expenses = await request(process.env.API_URL, {
      headers: { authorization: "Bearer " + tokenSet.access_token },
      json: true
    });

    // ... keep the rest
  }
  // ...
});
```

In the new version of this endpoint, you are sending the access token in an `Authorization` header when sending requests to the API. By doing so, the web application consumes the API on behalf of the logged in user.

12. Add the following two environment variables to the `webapp/.env` file:

```text
API_AUDIENCE=https://expenses-api
CLIENT_SECRET=YOUR_APPLICATION_CLIENT_SECRET
```

The `API_AUDIENCE` value is the identifier for the API that will be created in the following exercise. To get your Client Secret, go to your Application settings page in the Auth0 Dashboard:

![Application client secret field](/media/articles/identity-labs/lab-02-client-secret-config.png)

**And that's it!** You have just configured your web application to consume the API on behalf of the logged in user.

If you restart the application in your terminal, logout, and try to log back in, you will see an error because no resource server with the identifier `https://expenses-api` has been registered yet. In the next exercise, you will learn how to create and secure APIs with Auth0, and this request will begin to work.

Next →


text:
Interoperability Challenge - OSIC Participation
===============================================

This repository contain the details from environment creation to test case
execution for OSIC OpenStack Interoperability Challenge participation.

About the [OpenStack Interoperability Challenge](https://wiki.openstack.org/wiki/Interop_Challenge)

About the [Interop Working Group a.k.a. Defcore](https://wiki.openstack.org/wiki/Governance/DefCoreCommittee)

About [RefStack Tools](https://wiki.openstack.org/wiki/RefStack)

THE WORKLOADS
---------

**LAMP Stack**
**********

**Details:**

1. Tool: Ansible
2. Repo: http://git.openstack.org/cgit/openstack/osops-tools-contrib/tree/ansible/lampstack
3. Start Ansible from osops-tools-contrib/ansible/lampstack folder

   ```
   ansible-playbook site.yml -e "action=apply env=osic username=$OS_USERNAME password=$OS_PASSWORD project=$OS_PROJECT_NAME"
   ```

4. Workload Creation Flow:

   * Provision 4 nodes
   * Create security group
   * Add security rules to allow ping, ssh, mysql and nfs access
   * Create a cinder volume
   * Attach the cinder volume to database node for wordpress database and content
   * Setup NFS on database node, so that web servers can share the cinder
     volume space, all wordpress content will be saved on cinder volume.
     This is to ensure that the multiple web servers will represent same
     content.
   * Setup mysql to use the space provided by cinder volume
   * Configure and initialize wordpress
   * Install and activte a wordpress theme specified by configuration file
   * Install wordpress importer plugin
   * Import sample word press content
   * Remove not needed floating IPs from servers which do not need them.

**Docker Swarm**
**********

**Details:**

1. Tool: Ansible
2. Repo: http://git.openstack.org/cgit/openstack/osops-tools-contrib/tree/ansible/dockerswarm
3. Start Ansible from osops-tools-contrib/ansible/dockerswarm folder

   ```
   ansible-playbook site.yml -e "action=apply env=osic username=$OS_USERNAME password=$OS_PASSWORD project=$OS_PROJECT_NAME"
   ```

4. Workload Creation Flow:
   * Provision 3 coreos nodes on your cloud
   * Create security group
   * Add security rules to allow ping, ssh, docker access
   * Setup ssl keys, certificates
   * Display a set of environment variables that you can use to run docker commands

**Deployer VM Pre-Requisites:**
**********

One deployer to run them all -- Use a disposable VM to fire the workloads (cloud VM, vagrant, virtualbox).

Use this repo to install required packages:

```
# If disposable VM available, get deployer_novenv.sh or deployer_venv.sh
wget https://raw.githubusercontent.com/osic/interop_challenge/master/deployer_novenv.sh
./deployer_novenv.sh

# If using virtual box - Use our Vagrantfile
git clone https://github.com/osic/interop_challenge.git
cd interop_challenge
vagrant up
vagrant ssh

# Source openrc.sh to set $OS_ environment variables
source openrc.sh
```

1. Required Packages Installed by deployer_noenv.sh:
    * Install development packages
    * [Install Ansible](http://docs.ansible.com/ansible/intro_installation.html)
    * [Install openstack shade] (http://docs.openstack.org/infra/shade/installation.html)
    * Clone  http://git.openstack.org/cgit/openstack/osops-tools-contrib repo
    * Create key-pair
    * Create OSIC cloud1 Cloud Details:
       * osops-tools-contrib/ansible/lampstack/vars/cloud1
       * osops-tools-contrib/ansible/dockerswarm/vars/cloud1
    * Install docker client
        * apt-get -y install docker.io
        * ln -sf /usr/bin/docker.io /usr/local/bin/docker
    * Disable strict host key checks:
        * echo "StrictHostKeyChecking no" to /etc/ssh/ssh_config under "Hosts *"
    * [Install RefStack client](https://github.com/openstack/refstack-client)

2. Make sure there are images available on your cloud:
    * An Ubuntu cloud image.
    * An OpenStack coreos image.

**NOTE:** Refer to the osops-tools-contrib repo for further details.

RESULTS
--------

* Interop Challenge Results [email report](http://lists.openstack.org/pipermail/defcore-committee/2016-October/001286.html)
* RefStack Results:
    * [Against Defcore Guideline 2016.01](https://refstack.openstack.org/#/results/c66d2ded-7b26-4e0e-8efa-dbbcd5a1526b)
    * [Against Defcore Guideline 2016.08](https://refstack.openstack.org/#/results/a25bb6b0-82f7-4102-9eb0-dcb86b876cf8)


text:
# Use in Java

There's experimental support for reading FlatBuffers in Java. Generate code
for Java with the `-j` option to `flatc`.

See `javaTest.java` for an example. Essentially, you read a FlatBuffer binary
file into a `byte[]`, which you then turn into a `ByteBuffer`, which you pass to
the `getRootAsMonster` function:

    ByteBuffer bb = ByteBuffer.wrap(data);
    Monster monster = Monster.getRootAsMonster(bb);

Now you can access values much like C++:

    short hp = monster.hp();
    Vec3 pos = monster.pos();

Note that whenever you access a new object like in the `pos` example above,
a new temporary accessor object gets created. If your code is very performance
sensitive (you iterate through a lot of objects), there's a second `pos()`
method to which you can pass a `Vec3` object you've already created. This allows
you to reuse it across many calls and reduce the amount of object allocation (and
thus garbage collection) your program does.

Java does not support unsigned scalars. This means that any unsigned types you
use in your schema will actually be represented as a signed value. This means
all bits are still present, but may represent a negative value when used.
For example, to read a `byte b` as an unsigned number, you can do:
`(short)(b & 0xFF)`

Sadly the string accessors currently always create a new string when accessed,
since FlatBuffer's UTF-8 strings can't be read in-place by Java.

Vector access is also a bit different from C++: you pass an extra index
to the vector field accessor. Then a second method with the same name
suffixed by `_length` let's you know the number of elements you can access:

    for (int i = 0; i < monster.inventory_length(); i++)
        monster.inventory(i); // do something here

You can also construct these buffers in Java using the static methods found
in the generated code, and the FlatBufferBuilder class:

    FlatBufferBuilder fbb = new FlatBufferBuilder();

Create strings:

    int str = fbb.createString("MyMonster");

Create a table with a struct contained therein:

    Monster.startMonster(fbb);
    Monster.addPos(fbb, Vec3.createVec3(fbb, 1.0f, 2.0f, 3.0f, 3.0, (byte)4, (short)5, (byte)6));
    Monster.addHp(fbb, (short)80);
    Monster.addName(fbb, str);
    Monster.addInventory(fbb, inv);
    Monster.addTest_type(fbb, (byte)1);
    Monster.addTest(fbb, mon2);
    Monster.addTest4(fbb, test4s);
    int mon = Monster.endMonster(fbb);

As you can see, the Java code for tables does not use a convenient
`createMonster` call like the C++ code. This is to create the buffer without
using temporary object allocation (since the `Vec3` is an inline component of
`Monster`, it has to be created right where it is added, whereas the name and
the inventory are not inline).
Structs do have convenient methods that even have arguments for nested structs.

Vectors also use this start/end pattern to allow vectors of both scalar types
and structs:

    Monster.startInventoryVector(fbb, 5);
    for (byte i = 4; i >=0; i--) fbb.addByte(i);
    int inv = fbb.endVector();

You can use the generated method `startInventoryVector` to conveniently call
`startVector` with the right element size. You pass the number of
elements you want to write. You write the elements backwards since the buffer
is being constructed back to front.

There are `add` functions for all the scalar types. You use `addOffset` for
any previously constructed objects (such as other tables, strings, vectors).
For structs, you use the appropriate `create` function in-line, as shown
above in the `Monster` example.

## Text Parsing

There currently is no support for parsing text (Schema's and JSON) directly
from Java, though you could use the C++ parser through JNI. Please see the
C++ documentation for more on text parsing.

repository: AlexStocks/flatbuffers

repo_name: AlexStocks/flatbuffers