text:
---
title: 'Defensive Programming'
dateUpdated: '27-02-2021'
summary: 'About defensive programming and general best programming practices'
tags: ['defensive', 'global', 'destructuring', 'assertions', 'errors', 'linting']
chapter: '3'
---
# 3. Defensive Programming
1. ## The Basics
	1. ### Practice Defensive Coding.
		Write code with an assumption that you and your co-workers will make mistakes. Use approaches that will minimize the chance of such mistakes and will help catch them early when they do occur.
	2. ### Use “The Good Parts.”
		JavaScript has a number of features that make it easy to write error-prone code. Avoid them. Use “the good parts” of JavaScript instead. The idea of focusing on “the good parts” of JavaScript comes from Douglas Crawford’s book JavaScript: The Good Parts. This book is well worth a read.
	3. ### Use Tools.
		When possible, use software to enforce best practices. In particular, make use of strict mode and linting tools.
2. ## Declarations
	1. ### Do Not Use Globals.
		Global symbols (variables and functions) should only be introduced in exceptional circumstances and after much thought.
	2. ### Beware of Unintended Globals.
		All variables should be declared with “const” or “let”, which should be enforced by the linter. All variable and function declarations should be placed either inside a body of a function or in a NodeJS module.
	3. ### Avoid Unnecessary IIFES.
		Immediately-invoked function expressions (IIFEs) used to be common in client-side JavaScript. However, they are needed a lot less frequently with many of the newer approaches to module definition. You rarely need them when working with modern JavaScript. When defining Node modules (ES6 or CommonJS generally), you don’t need to wrap the whole module in an IIFE.
	4. ### Define Variables Up-front.
		Variables should be declared at the top of the function to avoid confusion due to hoisting.
	5. ### Single `let` Per Line.
		Our convention is to use a separate `let` for every variable. This makes diffing easier. If each variable is defined with its own `let`, any declaration can be removed without affecting the other ones. The diffs will only show that line as having been modified.
	6. ### Use Destructuring Where Possible.
		When utilizing a module use destructuring where possible unless there are multiple instances that would collide (example: Apollo `useQuery()`).
	7. ### Avoid Function Declarations in Blocks.
		Do not use function declaration in blocks to avoid confusion due to hoisting. Function expressions in blocks are ok. Functions declared in blocks get hoisted, which can be easy to miss. Consider this example:

		```js
		if (false) {
			function bar() {
				console.log(42);
			}
		}
		bar();
		```

		Here, `bar()` is actually defined even though the condition fails, but this effect may be easy to miss. With a function expression, however, the result is different:

		```js
		let bar;
		if (false) {
		  bar = function bar(){
				console.log(42);
			}
		}
		bar();
		```

		In this case `bar` is actually undefined.
	8. ### Name Your “Anonymous” Functions.
		Using functional expressions does not mean your functions must be anonymous. Naming them will give you better error stack traces and can often be worth it. This is less of a factor when you are assigning the result of a function expression to a variable, since modern JavaScript engines are smart enough to use the name of that variable as the function’s “name”. When you pass the newly minted function as an argument or return it, without first saving it to a variable, your function will stay truly anonymous unless you give it a name. Naming a function created with a function expression does not declare it by this name. Consider the following example:

		```js
		const foo = function bar() {};
		```

		Here, the fact that the function expression specifies a name `bar` does not mean that the function will become available under this name. Calling `bar()` will give us “undefined is not a function”. The JavaScript interpreter does not rely on the presence of name to distinguish between a function declaration and a function expression. It does it based on the context in which they appear. In the example above, it knows that since it’s an expression, a function declaration cannot appear on the right-hand side of an assignment.
3. ## Fail Fast
	1. ### Fail Fast.
		When something goes wrong, make sure you catch it early and either properly handle the situation or throw an error. Code that skips over errors and tries to chug along will likely fail eventually, but in a way that is much harder to debug. Failure to fail can also compromise security.
	2. ### Use Assertions.
		Make assertions to enforce your assumptions. Assertions are commonly used in tests, but this doesn’t mean that this is the only place where they can be useful. _Note: assertions used in production code must satisfy a higher standard of “good errors” than code used in testing._ Meaning they need to be clear about what has been thrown and why. You should use an assertion library that would allow you to customize the error message.
	3. ### Throw Good Errors.
		Throw errors liberally, but make them helpful. Good errors should useful information and should __ALWAYS__ be instances of `Error` or its subclass, since this ensures that they can provide a proper stack trace. Avoid throwing strings like this:

		```js
		throw 'Parameter foo not specified';
		```

		Instead, create a new instance of `Error`:

		```js
		throw new Error('Parameter foo not specified');
		```

		In some cases it may be worth going an extra mile and creating a subclass of `Error`:

		```js
		throw new errors.FormValidationError('Parameter foo not specified');
		```

		_Note: that for this to work you would need to define FormValidationError. Additionally, for this custom class to be most useful, you would usually want to export the error constructors._

		```js
		errors = {
			FormValidationError:
			  createError('FormValidationError'), // define additional errors for this module
			}; // export errors object
		```

		Subclassing Error is tricky in JavaScript, and the task is often made especially hard due to inconsistent browser support. You would probably want to use a library to do this, rather than implementing it yourself. Look at [https://www.npmjs.com/package/error] as a start.
	4. ### Assert Dichotomies.
		If you expect one of two options, consider the case where neither is satisfied. Handle it or throw an error. If you are expecting option A or option B, do not handle them with ```if (A) {...} else {...}``` or with ```if (A) {...} else if (B) {…}```. The first option lumps together B and “neither A nor B”. The second option just lets the “neither” case fall through. What you want is: ```if (A) {...} else if (B) {...} else {...}```. Think of it as the if... else if... oops... structure.
	5. ### Test Your Assumptions
		Is your data coming though in the expected shape? Did a CMS user enter too many or too few data points that your code expects. Always test what you assume for lengths or shapes of objects and have a way to gracefully handle it or fail.
4. ## Use Tools
	1. ### Use `use strict`.
		Put `'use strict';` at the beginning of each JavaScript file. This will keep you honest.
	2. ### Watch Out for Concatenation.
		Do not concatentate strict mode files with non-strict files.
	3. ### Use Linting Tools.
		Use ESLint with our standard settings in your `.jshintrc/.eslintrc` or `package.json`See our Thrillworks NPM module repository for our standard `.jshintrc`.
	4. ### Configure Your Editor to Automatically Run the Linter.
		VSCode has linting plugins.
	5. ### Lint With NPM.
		Configure NPM to run the linter on all of your JavaScript files using: `$ npm run lint`.
	6. ### Run Linting in CI.
		Make sure your continuous integration server runs the linter. The linter fails so does the CI build.
	7. ### Consider Using a Git Pre-Commit Hook
		In the `.git/hooks` directory of your project folder, consider adding a Git pre-commit hook that runs an NPM script to test if your code is linted and well-formatted.  A sample pre-commit file is available in our private “dev” repository. _Note” that the file needs to be named pre-commit for this to work._
5. ## Miscellaneous
	1. ### Semicolons.
		Always use a semicolon at the end of a statement. If you don’t, you are counting on JavaScript’s (dumb) automatic semi-colon insertion to do it for you and you may cause the end of the world.
	2. ### Avoid `==` and `!=`.
		Use `===` and `!==` instead. The “double-equals” version is too forgiving. One legitimate use of `==` and `!=` is to test whether the value is undefined or null before dereferencing a property. This often takes the shape of:```return (null != x) && x.someAttribute;```. Keep in mind, however, that using the same test can be confusing. In most cases, just testing whether `x` is truthy would make the intent clearer: ```return x && x.someAttribute;```.
	3. ### Use Braces With Multiline Blocks.
		Always use `{}` with multiline blocks. If the block is a single line statement braces can be omitted. The opening brace should be at the end of the line. The closing brace should be on a line of its own, indented to match the beginning of the line that contains the opening brace. Skipping braces makes it easy to introduce a mistake when a new statement is added to the block. Where to put the braces is a matter of convention.
	4. ### Avoid `eval`.
		Do not use `eval()`, except for implementing code loaders and REPLs.```EVAL === EVIL```
	5. ### Avoid `with`.
		Do not use with. (If you haven’t heard of with before, you haven’t missed much.)

repository: Thrillworks/tw-standards

gha_language: TypeScript

repo_name: Thrillworks/tw-standards


text:
# Ajax.NET Professional

Ajax.NET Professional (AjaxPro) is one of the first AJAX frameworks available for Microsoft ASP.NET.

The framework will create proxy JavaScript classes that are used on client-side to invoke methods on the web server with full data type support working on all common web browsers including mobile devices. Return your own classes, structures, DataSets, enums,... as you are doing directly in .NET.

# Quick Guide

- Download the latest Ajax.NET Professional
- Add a reference to the AjaxPro.2.dll (for the .NET 1.1 Framework use AjaxPro.dll)
- Add following lines to your web.config

```XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <httpHandlers>
      <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
    </httpHandlers>
    [...]
  </system.web>
</configuration>
```

- Now, you have to mark your .NET methods with an AjaxMethod attribute

```C#
[AjaxPro.AjaxMethod]
public DateTime GetServerTime()
{
  return DateTime.Now;
}
```

- To use the .NET method on the client-side JavaScript you have to register the methods, this will be done to register a complete class to Ajax.NET

```C#
namespace MyDemo
{
  public class DefaultWebPage
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      AjaxPro.Utility.RegisterTypeForAjax(typeof(DefaultWebPage));
    }

    [AjaxPro.AjaxMethod]
    public static DateTime GetServerTime()
    {
      return DateTime.Now;
    }
  }
}
```

- If you start the web page two JavaScript includes are rendered to the HTML source
- To call a .NET method form the client-side JavaScript code you can use following syntax

```JavaScript
function getServerTime() {
  MyDemo.DefaultWebPage.GetServerTime(getServerTime_callback);  // asynchronous call
}

// This method will be called after the method has been executed
// and the result has been sent to the client.
function getServerTime_callback(res) {
  alert(res.value);
}
```

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
Sonos
=====

I was sick of waiting for an official Sonos client app to arrive for Linux, so
I looked around for a reverse engineered version someone might've made. I came
across [the beginnings of just what I wanted](https://github.com/soffes/sonos), but
it was a bit unpolished, and not quite what I wanted - I wanted a socket server I could
query.

So I wrote a small wrapper around [soffes'](https://github.com/soffes) work, and wrote a
little socket server which allows me to integrate sonos into my desktop environment nicely.

Currently only play, pause and now_playing are implemented, although it'd be
trivial to add more functionality that's exposed to us via [soffes' Sonos
gem](https://github.com/soffes/sonos).

Instructions
------------

Install the dependencies with `bundler`:

    bundle install

Run the server in the background:

    ./sonos_server &

Run the client:

    ./sonos now_playing

repository: johnhamelink/sonos

repo_name: johnhamelink/sonos


text:
# lecture-python-programming

Source files for https://python-programming.quantecon.org

For a guide on contributing to this repository click [here](https://quantecon.org/contribute-lectures/)

repository: mtuwei/lecture-python-programming

repo_name: mtuwei/lecture-python-programming


text:
# (-\_-)ゞ゛ Omnesiac

[![npm version](https://badge.fury.io/js/omnesiac.svg)](https://badge.fury.io/js/omnesiac)
[![Build Status](https://travis-ci.org/growombud/omnesiac.svg?branch=master)](https://travis-ci.org/growombud/omnesiac)
[![codecov](https://codecov.io/gh/growombud/omnesiac/branch/master/graph/badge.svg)](https://codecov.io/gh/growombud/omnesiac)

## Overview

A library implementing the marriage of two abstractions:

- Mutual Exclusion
- Memoization w/Time-to-Live

Concretely, this library was built to service two use-cases:

- I need to perform some asynchronous work, **throttled per unique key**, and all subsequent calls using that key will _block and await the result of that asynchronous work_.
- I need to perform some asynchronous work, **throttled per unique key**, and all subsequent calls using that key will _continue without knowing the result of that asynchronous work_.

tldr; a mutex-based throttling mechanism in blocking and non-blocking flavors.

## Installation

Tested with >= Node.js 8.x

`yarn add omnesiac`

## Usage

```javascript
const Omnesiac = require('omnesiac');

async function doPeriodicAsynchronousWork(arg1, arg2) {
  /*
    ...Do the deed...
  */
}

/*
 Memoize the results of this function for 30 seconds, and block subsequent calls while the asynchronous work is in-flight
*/
const throttledFn = Omnesiac(doPeriodicAsynchronousWork, { ttl: 30000, blocking: true });

const param1 = 'firstArgToTargetFunction';
const param2 = 'secondArgToTargetFunction';
const throttleKey = 'anyStringPerhapsAUserId';

/*
  The first call will execute the function. Subsequent calls using the same throttleKey will wait
  for the first call to finish and then resolve with the result of the first call for the next 30 seconds,
  whereupon, the next call will resume blocking until it has resolved, and on...
*/
const results = await throttledFn(throttleKey, param1, param2);
```

## TODO

- Better Documentation
  - Behavior
    - `{ ttl: 0 }` = Never expire / cache forever
    - Resolution order of blocked calls not guaranteed
  - Real-world Use Cases
    - \[Non-Blocking\] Sample data collection, where approximate precision is good-enough
    - \[Blocking\] Cacheing burstable requests against shared resources
- Timeouts on resolution of decorated function calls?
  - Maybe better to leave the onus on the function prior to Omnesiac decoration
  - Might make sense in the blocking scenario
- Many more tests
  - Ensure proper scoping / garbage-collection aspects

## Contributing

1. Fork repo
2. Add / modify tests
3. Add / modify implementation\*
4. Open PR

\* (Optional, but strongly encouraged) Link to your development soundtrack appending this `README.md`

# License

MIT License

Copyright (c) 2020 Ombud

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.

# Soundtrack

If you contribute to this library you are strongly encouraged to append your development soundtrack as a link to this `README.md`. One link per-PR, please, and it should be publicly, freely accessible (Youtube is a good option).

[![Francis Lai (Love Story Soundtrack) - Bozo Barrett](https://i.ytimg.com/vi/-j-KoAUln9U/hqdefault.jpg)](https://www.youtube.com/watch?v=-j-KoAUln9U)

[![Lucio Battisti (Io tu noi tutti) - Amarsi un po'](https://i.ytimg.com/vi/RQ5PdErrCJc/hqdefault.jpg)](https://www.youtube.com/watch?v=RQ5PdErrCJc)

[![Deodato - Also Sprach Zarathustra](https://i.ytimg.com/vi/qJK3eUP5Hvg/hqdefault.jpg)](https://www.youtube.com/watch?v=qJK3eUP5Hvg)

repository: growombud/omnesiac

gha_license_id: MIT

repo_name: growombud/omnesiac


text:
# CSS Only SASS Masonry Mixin

## Demo on codepen.io
http://codepen.io/doptrois/pen/JoyzKw

## Supports gap indication in
 - Pixels
 - Rems
 - Percentages*

*Percent gaps are [not supported by css columns](http://www.w3.org/TR/css3-multicol/#column-gap0) e.g.
```css
columns-gap: 3%
```
The mixin will simulate that behaviour for you.

Some mixins used from [bourbon.io](http://bourbon.io/)

## How To
```scss
your-masonry-container {
    @include masonry(3, 2%, "> *");
}
```
Each variable is optional. Defaults are shown above.

## Note

If you use percentages for columns gaps, it's recommended to not style the direct child elements of 'your-masonry-container' and wrap the content inside with an additional element and style these elements like in the [codepen example](http://codepen.io/doptrois/pen/JoyzKw).

repository: holdicon/SASSMasonryMixin

repo_name: holdicon/SASSMasonryMixin


text:
# swap-keys

`swap-keys` is an Interception Tools plugin that swaps arbitrary pairs of keys.

For more information about the [_Interception Tools_][interception-tools], check
the project's website.

## Build instructions

```bash
mkdir build
cd build
cmake ..
make
```

## Usage

Specify any number of pairs of named keys to swap as command line arguments.

The list of key names can be found in the libevdev source code, look for
constants with the prefix `KEY_`:

- <https://github.com/freedesktop/libevdev/blob/master/include/linux/linux/input-event-codes.h>

A typical use case is to swap WIN and ALT keys. A suggested `udevmon` job
configuration for this is:

```yaml
- JOB: "intercept -g $DEVNODE | swap-keys KEY_LEFTALT KEY_LEFTMETA KEY_RIGHTALT KEY_RIGHTMETA | uinput -d $DEVNODE"
  DEVICE:
    NAME: Apple Inc. Apple Keyboard
    EVENTS:
      EV_KEY: [KEY_LEFTALT, KEY_RIGHTALT, KEY_LEFTMETA, KEY_RIGHTMETA]
```

## License

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

[interception-tools]: https://gitlab.com/interception/linux/tools

repository: amfranz/swap-keys

repo_name: amfranz/swap-keys


text:
---
author: Matt Oswalt
comments: true
date: 2013-07-12 03:43:22+00:00
layout: post
slug: kiclet-ios-network-command-cheating
title: 'KIClet: IOS "network" Command Cheating'
wordpress_id: 4196
categories:
- Networking
tags:
- bad habits
- ccie
- eigrp
- kiclet
- network
- ospf
---

I have always used the "network <IP_ADDRESS> <IP_ADDRESS>" statement to describe "all interfaces" when configuring a routing protocol like EIGRP. I know that it's not correct, but I never stopped to wonder why my bad habit still worked.

Then, I found this [good article by](http://blog.brokennetwork.ca/2011/02/how-ios-cheats-when-using-network.html) [@jdsilva](https://twitter.com/jdsilva) explains this is IOS just assuming you had a "brain fart" and meant to type the proper "network <IP_ADDRESS> <IP_ADDRESS>"

I'm studying for the CCIE and it can be really good to identify these bad habits that, while in real life may not be too bad, especially this kind, where the result is the same, but on exams can mean the difference between failure and success.

By the way, yes, my favorite command in NX-OS is still this:

    cli alias name wr copy run start

extension: markdown

gha_language: HTML


text:
See related [blogpost](https://jappieklooster.nl/reflex-server-side-html-rendering.html).

Reflex:

- core: https://hackage.haskell.org/package/reflex
- DOM: https://hackage.haskell.org/package/reflex-dom-core

CSS:

- Bulma: https://bulma.io/
- Baloon: https://kazzkiq.github.io/balloon.css/

license: Unlicense

repository: hasanalrasyid/hcite

repo_name: hasanalrasyid/hcite


text:
# A Library for parsing search query parameters

[![Build Status](https://travis-ci.org/PHPPlatform/search-query-parser.svg?branch=master)](https://travis-ci.org/PHPPlatform/search-query-parser)

When a Model from [php-platform/persist](https://github.com/PHPPlatform/persist) is exposed as REST Resource ([php-platform/restful](https://github.com/PHPPlatform/restful)), It is required that the REST End point to list all resources must support **filter** , **sort** and **pagination**

Models extending [php-platform/persist](https://github.com/PHPPlatform/persist) supports **filter** , **sort** and **pagination** through arguments to [PhpPlatform\Persist\Model::find($filters,$sort,$pagination,$where)](https://github.com/PHPPlatform/persist/blob/master/src/Persist/Model.php#L324) method

So this library parses query parameters from rest endpoint to method arguments required by `PhpPlatform\Persist\Model::find($filters,$sort,$pagination,$where)`

## How to use

``` php
$searchParams = PhpPlatform\SearchQueryParser\Parser::parse(PhpPlatform\RESTFul\HTTPRequest $request,string $modelClassName, array $excludeFromFullTextSearch);
```

#### where
- **$request** is the HTTPRequest object received in the rest service
- **$modelClassName** is the full name of the Model which is served as REST Resource
- **$excludeFromFullTextSearch** is the array of fields which needs to be excluded from performing full text search

#### returns
An instance of `PhpPlatform\SearchQueryParser\FindParams`

## Parse rules

| Query Param | Method Parameter | Format |
| -----------------|-----------|--------|
| q | $where | `string` for full text search , a complex `$where` expression is formed matching all the `get` fields from the Model , excluding the once mentioned in `$excludeFromFullTextSearch`. *Auto Increment* fields are excluded by default |
| f | $filters | `base64` encoded `json` string representing the `$filters` object |
| s | $sort | `base64` encoded `json` string representing the `$sort` object |
| p | $pagination | `'<pageNumber>-<pageSize>'` |

> Note 1 : This API throws `PhpPlatform\Errors\Exceptions\Http\_4XX\BadRequest` Exception if the query parameters are invalid
> Note 2 : All of the above query parameters are optional

repository: PHPPlatform/search-query-parser

repo_name: PHPPlatform/search-query-parser


text:
# CONTRIBUTING to PHP-SYNC

In context of contributing please keep in mind that there separate layers of the project:

#### Interface layer

This is a top layer and provides just the interfaces for synchronizing parallel tasks. You can also
consider it as a contract, or protocol, which strictly defines the rules. This layer is meant to be
the most stable part and ideally never change, provided that it suits all the needs when speaking about
synchronization. Keep in mind though, that it is an early version now and further adjustments can
certainly take place. Currently, everything under `\PhpSync\Core\` namespace defines this layer.

Contributions to this part may include discussions about what feature should or must be inside these
interfaces.

#### Generic implementation

This layer is just to provide a generic working implementation of the Interface Layer
mentioned above. Currently, everything inside the `\PhpSync\Generic\` namespace define this layer.
Any bugs or improvements to this part of the project are separate from the interface layer.

#### Drivers

Drivers are the "working units" specifically of the Generic Implementation described above.
They are completely separate from the Interface Layer and are meant only to provide concrete
functionality for the Generic layer. Each driver (or set of drivers) should be a
separate package from the one you are currently in. Moreover, it is recommended that each driver lies
inside a separate namespace like `\PhpSync\Driver\<name_here>\`. Have a look at [amegatron\php-sync-fs](https://github.com/Amegatron/php-sync-fs)
package as an example of a specific driver for a Generic layer, based on local file system.

## Contributing

Assuming generic implementation is good enough for you, I encourage everybody to extend the possibilities
of it by implementing and publishing different kinds of Drivers which could involve any underlying
technology to provide the needed functionality, atomicity mainly. Otherwise, you are free to make
your own implementations of the Interface Layer capable of whatever you find useful.

When publishing new drivers, it is highly recommended that you cover them with tests.
For some cases multi-threaded testing is necessary to check locking mechanisms and/or atomicity of
your implementation. You can have a look at the mentioned [amegatron\php-sync-fs](https://github.com/Amegatron/php-sync-fs)
to get an idea about one of the possible ways to achieve that by means of pure PHP (`proc_*` functions).
Though it is recommended that you stick to PHP as much as possible in tests, third-party tools or scripts
MAY still be involved, including, for example, scripts written in GoLang, Python, etc.

repository: Amegatron/php-sync

repo_name: Amegatron/php-sync


text:
# IFTTT Pocket to Slack
Simple IFTTT channel to share articles from **Pocket** to **Slack**. This hack is powered by [webtasks](https://webtask.io/). Based on [If This Then Node.js](https://auth0.com/blog/2015/07/28/if-this-then-node-dot-js-extending-ifttt-with-webtask-dot-io/).

# Setup
First of all you need installed **wt-cli** on your system.

```
$ npm i -g wt-cli
$ wt init
```

After that, you need to setup a new [incoming webhook](https://api.slack.com/incoming-webhooks) into your Slack. To do that, add an application to your team. Then **build** a new one [https://slack.com/apps/build](https://slack.com/apps/build) and select *Something just for my team*. And later, select *Incoming Webhooks*. Select the channel you want to publish your articles and copy the given **webhook url**.
![Incoming Webhook](https://raw.githubusercontent.com/javialgaba/ifttt-pocketToSlack/master/slack-incoming-webhook.png)

Execute the following snippet with your webhook url.

```
wt create --secret SLACK_WEBHOOK_URL={url} ifttt-pocketToSlack.js
```

Finally, we need to setup our custom IFTTT recipe.
Follow this example (If This Then Webtask): [https://auth0.com/blog/2015/07/28/if-this-then-node-dot-js-extending-ifttt-with-webtask-dot-io/](https://auth0.com/blog/2015/07/28/if-this-then-node-dot-js-extending-ifttt-with-webtask-dot-io/)

You should end up having a recipe like the following:

```
{webtaksUrl}/ifttt-pocketToSlack?url={{Url}}&imageURL={{ImageUrl}}&title={{Title}}&excerpt={{Excerpt}}
```
![Recipe](https://raw.githubusercontent.com/javialgaba/ifttt-pocketToSlack/master/ifttt-recipe.png.png)

# LICENSE
The MIT License (MIT)

Copyright (c) 2016 Javier Algaba Borrego

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.

repository: javialgaba/ifttt-pocketToSlack

repo_name: javialgaba/ifttt-pocketToSlack


text:
# Serverless Chaos Engineering Demo

This demo site uses Gunnar Grosch's failure-lambda NPM package (https://github.com/gunnargrosch/failure-lambda) to perform chaos engineering experiments on a serverless environment. More information on installation, configuration and usage at https://github.com/gunnargrosch/serverless-chaos-demo.

## Description

The demo application consists of a simple serverless app containing three different functions behind an API Gateway and a static webpage showing the result of these functions. The functions fetch an url for an image at random from a DynamoDB table. An example can be seen at (https://demo.serverlesschaos.com/). By using the failure-labda NPM package you are able to inject failure to each function and see on the page what happens.

![Serverless Chaos Demo Architecture](client/dist/images/serverless-chaos-demo-architecture.png?raw=true "Serverless Chaos Demo Architecture")

## Videos showing demos

* https://www.youtube.com/watch?v=vKurdrGMFpg
* https://www.youtube.com/watch?v=Cw-JmAJHG-g
* https://www.youtube.com/watch?v=xxogwzUMg7c

## How to install

This is prepared to be installed using the Serverless Framework (https://serverless.com) and the Finch plugin. Make sure to have the Failure Injection Layer installed in your account (https://github.com/adhorn/FailureInjectionLayer) and an S3 bucket dedicated for the static webpage (the plugin will remove all contents before uploading).

1. Clone the repository.
2. Install Serverless Framework (if you don't already have it installed).
```bash
npm install -g serverless
```
3. Deploy the serverless application using Serverless Framework.
```bash
sls deploy --region YOUR_PREFERRED_REGION --stage YOUR_PREFERRED_STAGE
```
4. Create an env.js file in the folder ./client/dist/assets/js/ based on the env.js.template contents (located in the same folder) with the endpoints from sls deploy output.
```bash
//Enter your API Gateway endpoints for each function here
var function1 = "<function1 api gateway endpoint>";
var function2 = "<function2 api gateway endpoint>";
var function3 = "<function3 api gateway endpoint>";
```
5. Deploy the static webpage using Serverless Framework and the Finch plugin.
```bash
sls client deploy --region YOUR_PREFERRED_REGION --stage YOUR_PREFERRED_STAGE
```
6. Create an dynamodb.json file in the root folder based on the dynamodb.json.template contents. Replace YOUR_DYNAMODB_TABLE_NAME with your DynamoDB table name.
```bash
{
    "YOUR_DYNAMODB_TABLE_NAME": [
        {
```
7. Populate the DynamoDB table with data using AWS CLI and the created json file.
```bash
aws dynamodb batch-write-item --request-items file://dynamodb.json
```
8. Try it out!

## Notes

This is still a really early version of the app. Features will be added on a regular basis.

## Changelog

### 2020-02-21 v0.3

* Version for failure-lambda and NodeJS

### 2019-07-16 v0.2

* New UI with more visibility
* AWS X-Ray enabled by default

### 2019-07-10 v0.15

* Variables moved to env.yml (Thanks to Adrian Hornsby)
* Support for the new version of the Failure Injection Layer (Thanks to Adrian Hornsby)

### 2019-07-09 v0.1

* Initial release

## Authors

**Gunnar Grosch** - [GitHub](https://github.com/gunnargrosch) | [Twitter](https://twitter.com/gunnargrosch) | [LinkedIn](https://www.linkedin.com/in/gunnargrosch/)

repository: doytsujin/serverless-chaos-demo-nodejs

repo_name: doytsujin/serverless-chaos-demo-nodejs


text:
Psalm 4 comes with diff mode — where only changed methods and their dependents are analysed — turned on by default.

This means Psalm runs much faster by default (if you prefer to go slow, there’s a new `--no-diff` option).

Psalm’s diff mode isn’t new - we’ve been using it on-and-off at Vimeo for the last four years, but it hasn’t always worked well with Psalm’s other features, in particular unused class and method detection. I’ve done a lot of work in the past year to get everything working well, and everyone can now benefit.

Why has it taken so long? Psalm is a powerful tool, performing a number of different analyses, and Psalm’s diff mode has to be aware of exactly what to cache, and when. The diff mode keeps track of which methods have changed in a given class, and only re-analyses those methods. It also now keeps track of unused classes and methods, so you’ll be alerted quickly when a small change you’ve made renders a whole class unnecessary.

## Where diffing helps

There are three things that happen to every file in Psalm's project directories when you run it for the first time:

_Scanning_

An Abstract Syntax Tree (AST) is generated from its contents

That AST is traversed to disccover all dependencies

_Analysing_

That AST is traversed to find type-related bugs

The aim of diffing is to re-use as much information as possible on subsequent runs.

### Speeding up abstract syntax tree generation

Psalm uses an excellent [AST generator for PHP](https://github.com/nikic/PHP-Parser). That library generates ASTs from large files quickly, but it's even quicker not to use it at all.

The simplest way to avoid regenerating ASTs is to cache them, and invalidate cache when the underlying file changes.

Psalm goes a bit further: if it detects that only part of a file has changed (e.g. renaming a variable inside a method) it only re-generates the AST for the changed parts of the file. This optimisation is most noticeable when making minor changes to very large files.

Once Psalm has an updated the AST, it then compares that AST against the cached one (before the most recent file change) and generates a high-level diff between the two that helps it speed up analysis for later.

### Speeding up analysis

Psalm's analysis is the most computationally-expensive thing it does, so we want to cache as much of it as possible.

When running Psalm in diff mode the difference between the cached AST and the newly-updated one is used to figure out which classes, methods and properties have changed. That allows Psalm to only re-analyse the parts of the AST that have changed.

It also caches issues it discovered in the past, along with where in the code it found them, so it'll report issues it found in a previous run without having to re-analyse methods.

This means that, after a small change to a file, the reported issues for that file can be a mix of both cached and newly-generated issues.

Taken together, these updates help make Psalm’s analysis very fast.

gha_language: JavaScript


text:
---
layout: post
title: AppHarbor, Nancy and the Could not load file or assembly
  'Nancy.ViewEngines.Razor.BuildProviders' error
date: 2013-03-06T10:35:00.000Z
author: Marcus Hammarberg
tags:
  - Marcus private - Nancy
  - Tools
  - .NET
  - ContinuousDelivery
modified_time: 2013-03-06T10:35:19.266Z
thumbnail: >-
  http://4.bp.blogspot.com/-BD7_e-V8lx0/UTb-Sh747XI/AAAAAAAABbs/KZKlNXi6keQ/s72-c/Screen+Shot+2013-03-06+at+09.28.37+.png
blogger_id: tag:blogger.com,1999:blog-36533086.post-2452370248443791950
blogger_orig_url: http://www.marcusoft.net/2013/03/appharbor-nancy-and-could-not-load-file.html
---

I've built a small application. Just something I threw together with a
friend during a hack-session at the client. (It's a [dot
voting](http://martinfowler.com/bliki/DotVoting.html) application and
you can [try it here](http://dotvoter.appharbor.com/), if it's up :))

As we wanted something out there fast we built it with
[NancyFx](http://www.nancyfx.org/) and
[MongoDB](http://www.mongodb.org/) (a first for me) and we host it on
[AppHarbor](https://appharbor.com/) with continuous delivery via
[GitHub](http://support.appharbor.com/kb/getting-started/deploying-your-first-application-using-git).
Since all of these (saved Mongo) has served me well in the past I was
very surprised when we ran into problem.

When a commit is pushed to AppHarbor the application is compiled and the
test (if any) are run. That worked fine for us but then a stage is run
that's called "Site precompilation".

That failed with the following error:

> ```
> error ASPCONFIG: Could not load file or assembly 'Nancy.ViewEngines.Razor.BuildProviders' or one of its dependencies. The system cannot find the file specified.
> ```

This had me for quite awhile when I got a tip on "disabling
precompilation". In fact, the log tells me so also, at the very
bottom:

> ```
> Website precompilation failed with exit code 1. Precompilation can optionally be disabled in application settings
> ```

The only thing was that I didn't understand the log. Hmmm ... haven't I
been here before?

OK, cutting to the chase
here. The last part of the log comes
from [AppHarbor](https://appharbor.com/)  In fact the precompilation is
a [AppHarbor](https://appharbor.com/) thing that can be turned off.
Go to \[your application\]-\>Settings-\>Build and click the "Disable
precompilation"-button. It's enabled by default.

That made my application compile and being deployed. Where back on the
[SuperDuperHappyPath](http://elegantcode.com/2011/11/23/a-year-of-the-super-duper-happy-path/).

That problem cost us a lot of trial and error... and frustration. But
now you don't have to experience the same thing.

branch_name: refs/heads/main


text:
# UML-Alerts
UML-Alerts is a SMS based alert app. Users of the app are able to set a
message to be sent to a list of contact(s) via SMS messaging. Location based
tracking is enabled by default - anytime the app is open, it keeps track
of the user's location and records it for use in sending the alert. The
location is used in the alert - when sending the text message, a Google Maps
URL is added to the bottom of the message with the user's Lat/Long coordinates.
Every alert that is sent also has its date and location recorded to the
internal memory of the user's phone, which is then displayed on a Google Maps
view in the app to show the user where their previous alerts have taken place
and at what time.

The Android Studio project for this app can be found in the "UML-Alerts"
directory.

[A video demo of the app can be found on Youtube.](https://www.youtube.com/watch?v=5rfHz4ow6DI)

This app was originally created by Jason Downing and Udit Bhansali for an
Android Development course at UMass Lowell.

gha_language: Java


text:
# Machine Learning in C#

This repo contains a collection of resources for understanding some basic usage of Machine Learning in C#.

The lessons are in a single solution and take the learner through the usage of different machine learning algorithms.

The solution uses Microsoft Visual Studio 2017.
The solution uses nuget packages:
Newtonsoft.Json
Microsoft.ML
.NET Core 2.X

Steps to understanding this solution.

1. Open Data/NodesWithAlerts.csv - this file is a set of data from a SolarWinds Orion installation. The columns are the default columns with the Nodes table with the addition of the last column "SumTriggers".
This column represents the number of alert triggers that have happened on this specific node.
2. Open Program.cs and try to build the solution. If you can't build then you may need to update your environment to have the latest .net runtimes or other libraries.
3. The Main method in Program.cs has all the code necessary to all the execution already, but with some lines commented out.
4. Data Science Goal: Can we predict Vendor of the Node by the columns: CPUCount, SystemUpTime, SumTriggers, and TotalMemory? We will try to do this via the K-means clustering algorithm.
5. On the first execution, the program reads selected columns and computes some useful statistics about each column.
  - Take some time to understand some of the values that the MetricStatistics calculates for you.
  - What can you conclude when the mean is higher or lower than the median?
  - The GESD Value tells you if you have outliers. Is it greater than 3.0?
6. Uncomment the line of code in Main - FindCorrelations(datasetColumns);
  - Build and run the project again.
  - This line calculates the Pearson Correlation Coefficient between two columns. Closer to 1.0 means a strong positve correlation. Closer to -1.0 means a strong negative correlation. Closer to 0.0 means no correlation between the two values.
  - Often in data science you will not want to use values that are highly correlated as the additional column gives no additional data to the algorithm.
  - Are there any highly correlated columns? The code calculates two comparisons for you, but you can copy the code for additional comparisons.
7. Uncomment the section of code through the line "var model = TrainTheModel();" of try statement in Main.
  - Build and run the project now to engage the ML.NET clustering algorithm.
  - Note at the top of the Program class there is a value - static int NumClusters = 6; -- This value is the target number of clusters we want to get and is the number of unique Vendors in the data file.
  - Notice the ML.NET code outputs: "Automatically adding a MinMax normalization transform"
  - ML.NET noticed that the data needed to be normalized so that one column does not affect the clustering too much.
  - To help understand the results, we select one random node to see what cluster it belongs to.
  - We have 6 clusters of data. Now we need to understand if they have classified what we wanted. Do each of the clusters represent a Vendor? Guesses?
8. Uncomment the last lines of the Main method to evaluate our clusters.
  - Do you notice if we were successful?
  - The evaluation also calculates the MetricStatistics for each column of each cluster. Can you determine what the clustering algorithm used to cluster?
  - Are there any abnormalities in the data. Can you see any "-2" values? In Orion, a -2 means that the value has not been polled. To get rid of these missing values we should clean the data and replace the -2 with the mean of the rest of the values in the column.

The data in this exercise did not answer the target question. What questions could the data answer? Could we predict the number of SumTriggers from other columns? Try adding more columns from the input data to see if you can find clusters that find high alerting nodes vs low alerting nodes.

What if we were to change the number of target clusters? How would we evaluate which clusters are good representations of the data or not?

  - Clustering effectiveness is evaluated based on how tight a cluster is within itself and how far away the cluster is from the other clusters. What happens if you change the number of clusters in this program?

What are some questions that you think this data set could answer?

repository: solarwinds/machine-learning-workshops

repo_name: solarwinds/machine-learning-workshops


text:
---
layout: default
---

# 1996-01-17 - Re: Respect for privacy != Re: exposure=deterence?

## Header Data

From: Brian Davis<EMAIL_ADDRESS>To: Scott Brickner<EMAIL_ADDRESS>Message Hash: 6e8b425617620d452256895754e0f5dd9e8307dccfbb8f6a0dac14a1373b546d

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1996-01-17 14:17:41 UTC

Raw Date: Wed, 17 Jan 1996 22:17:41 +0800

## Raw message

```
{% raw  %}From: Brian Davis<EMAIL_ADDRESS>Date: Wed, 17 Jan 1996 22:17:41 +0800
To: Scott Brickner<EMAIL_ADDRESS>Subject: Re: Respect for privacy != Re: exposure=deterence?
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

On Mon, 15 Jan 1996, Scott Brickner wrote:

><EMAIL_ADDRESS>writes:
> >My apologies for responding to a political post.
> >
> >On Sat, 13 Jan 1996, Charlie Merritt wrote:
> >
> >> I feel that public exposure
> >> is enough to put fear into these anonymous government employees.
> >> You will note that when they get the mad_bomber
> >> some FBI guy jumps right up and takes credit, live, on TV.
> >> But when the Air Force orders a $300 toilet seat NO ONE is credited.
> >
> >It's interesting how we advocate anonymity for ourselves but not for our
> >opponents. Feeling righteous?
>
> I agree with Charlie.  These government employees claim to be working
> for the american taxpayers, of which group I am a member.  Government
> agents must, therefore, expect to be accountable to the citizens, while
                                       ^^^^^^^^^^^

That all depends, of course, by what you mean by "accountable."
And government employees are also taxpayers ...

And what of those using government-funded
scholarships/computers/univerisities/roads & bridges/etc.

Perhaps all should be "accountable."  Wouldn't want to waste bridge use!

> accountability in the other direction is virtually the definition of
> tyranny.
>

EBD

{% endraw %}
```

## Thread

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

+ Return to "[Brian Davis <bdavis@thepoint.net>](/authors/brian_davis_bdavis_at_thepoint_net_)"
+ Return to<EMAIL_ADDRESS>(Charlie Merritt)](/authors/cmerritt_at_intellinet_com_charlie_merritt_)"
+ Return to "["Declan B. McCullagh" <declan+@CMU.EDU>](/authors/declan_b_mccullagh_declan_at_cmu_edu_)"
+ Return to "[Jeff Weinstein <jsw@netscape.com>](/authors/jeff_weinstein_jsw_at_netscape_com_)"
+ Return to "[Rich Graves <llurch@networking.stanford.edu>](/authors/rich_graves_llurch_at_networking_stanford_edu_)"
+ Return to "[s1018954@aix2.uottawa.ca](/authors/s1018954_at_aix2_uottawa_ca)"
+ Return to "[Scott Brickner <sjb@universe.digex.net>](/authors/scott_brickner_sjb_at_universe_digex_net_)"

+ 1996-01-14 (Sat, 13 Jan 96 19:42:10 PST) - [exposure=deterence?](/archive/1996/01/17557fa97de263fc802b1633a677a2ffd65d2e8a148d49a34839c7e92a9f564d) -<EMAIL_ADDRESS>(Charlie Merritt)_
  + 1996-01-14 (Sat, 13 Jan 96 21:04:49 PST) - [Respect for privacy != Re: exposure=deterence?](/archive/1996/01/8f3ad0519cbf45d6fe62d7e9eccaebb2d4e5bd929c103dfba7da9f8623316079) -<EMAIL_ADDRESS>    + 1996-01-16 (Tue, 16 Jan 1996 12:55:21 +0800) - [Re: Respect for privacy != Re: exposure=deterence?](/archive/1996/01/fcec1c02833edd538426b15d3fb1f3a4c7cefe4cc0654ff74710d5bfb1a27270) - _Scott Brickner<EMAIL_ADDRESS>      + 1996-01-16 (Tue, 16 Jan 1996 12:31:54 +0800) - [Re: Respect for privacy != Re: exposure=deterence?](/archive/1996/01/28999856a85095ce697c59e9697dc9a97542d6997e60637fabf29f1ee2ae64fa) -<EMAIL_ADDRESS>      + 1996-01-16 (Tue, 16 Jan 1996 14:03:26 +0800) - [Re: Respect for privacy != Re: exposure=deterence?](/archive/1996/01/dd20557f21a4c1187751e0902647a2c8294b7ad9627a48e9918be0c973be0142) - _Rich Graves<EMAIL_ADDRESS>      + 1996-01-17 (Wed, 17 Jan 1996 22:17:41 +0800) - Re: Respect for privacy != Re: exposure=deterence? - _Brian Davis<EMAIL_ADDRESS>  + 1996-01-14 (Sat, 13 Jan 96 22:22:54 PST) - [Re: Respect for privacy != Re: exposure=deterence?](/archive/1996/01/da601459364176252559cb485a83f74078c6563c51edb3a825f62b3002385cef) - _Jeff Weinstein<EMAIL_ADDRESS>  + 1996-01-14 (Sun, 14 Jan 1996 16:10:27 +0800) - [Re: exposure=deterence?](/archive/1996/01/f3da22dd232ca6924ed2c27a7fe723acc9729520bf0b65aa3026a10ca1fe6ef8) - _"Declan B. McCullagh"<EMAIL_ADDRESS>


text:
# emergency-container-monitor-demo

A usable example/demo on how to monitor containers for items and warn user if they are missing something.
This is a demo, the code quality is not as good as I would like it to be, but you should be able to understand what's going on if you're looking for an example. Or just use it as-is!

![](emergency-container-monitor-demo.png)

### Setup
1. Copy `emergency-container-monitor-demo.json` contents into the clipboard and paste into the programming board
2. Link screen to the programming board
3. Link containers to the programming board
4. Edit container names and the demands list at the top of `unit.start`.

### I don't know what to put into the list of demands!
1. Put the desired item in of the connected containers
2. Activate the programming board
3. Open the chat window, switch to Lua tab, you should see container contents in the chat in JSON format
4. Find your container, find the item `class` name (not `name`!) and use that
![](console-out.png)

repository: CredenceHamby/dual-universe-stuff

repo_name: CredenceHamby/dual-universe-stuff


text:
# UIColor.xyz [![Build Status](https://travis-ci.org/manosim/ui-color.svg?branch=master)](https://travis-ci.org/manosim/ui-color)

Website: [http://www.uicolor.xyz/](http://www.uicolor.xyz/)

UIColor is a website used to convert HEX & RGB colors to **UIColor** for both **Objective-C** and **Swift** featuring a **colorpicker** and **copy to clipboard** functionality making things easier.

### Prerequisites

- AngularJS
- NPM
- Grunt
- Http-Server

### Development

You have to install **http-server** globally and then just watch and serve the files.

    npm install
    npm install http-server -g
    npm start

### License

UIColor is licensed under the MIT Open Source license. For more information, see the LICENSE file in this repository.

repository: forkkit/ui-color

repo_name: forkkit/ui-color


text:
# Nvidia display settings

Ensure force composition pipeline is set to avoid video tearing
This is best done by using the Save to X Configuration File button in the
nvidia-settings GUI interface to ~, then copying it to /etc/X11/xorg.conf

Use xcompmgr (compton is slow as hell.)

repository: mikepjb/sysconf

repo_name: mikepjb/sysconf


text:
# kanka

[![PkgGoDev](https://pkg.go.dev/badge/Henry-Sarabia/kanka)](https://pkg.go.dev/github.com/Henry-Sarabia/kanka?tab=doc) [![Build Status](https://travis-ci.com/Henry-Sarabia/kanka.svg?branch=master)](https://travis-ci.com/Henry-Sarabia/kanka) [![Coverage Status](https://coveralls.io/repos/github/Henry-Sarabia/kanka/badge.svg?branch=master)](https://coveralls.io/github/Henry-Sarabia/kanka?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/Henry-Sarabia/kanka)](https://goreportcard.com/report/github.com/Henry-Sarabia/kanka)

Manage your [Kanka](https://kanka.io/en-US) campaign or build tools for other
creators with the thoroughly tested and documented **kanka** package.

The **kanka** package provides a client to handle all communication with the
[Kanka API](https://kanka.io/en-US/docs/1.0).

The package is structured into convenient and discoverable services for
managing characters, locations, organizations, events, and
[much more](https://kanka.io/en-US/features).

## Installation

If you do not have Go installed yet, you can find installation instructions
[here](https://golang.org/doc/install).

To pull the most recent version of **kanka**, use `go get`.

```
go get github.com/Henry-Sarabia/kanka
```

Then import the package into your project as you normally would.

```go
import "github.com/Henry-Sarabia/kanka"
```

## Usage

### Creating A Client

To use the **kanka** package, you need a Kanka API key. If you do not have a key
yet, you can follow the instructions [here](https://kanka.io/en-US/docs/1.0/setup)
to get one.

Create a client with your API key to start communicating with the Kanka API.

```go
c, err := kanka.NewClient("YOUR_API_KEY", nil)
```

If you need to use a preconfigured HTTP client, simply pass its address to the
`NewClient` function.

```go
c, err := kanka.NewClient("YOUR_API_KEY", &custom)
```

### Services

The client contains a separate service for working with each of the Kanka API
endpoints. Each service has a set of functions to retrieve, list, create, update,
or delete campaign data.

To start communicating with the Kanka API, choose a service and call one of its
functions.

Take the `Campaigns` service for this example.

To retrieve a list of the current user's campaigns, use the `Index` function.

```go
cmps, err := c.Campaigns.Index()
```
You now have access to a list of the user's campaigns via `cmps`.

### Retrieving An Entity

To retrieve a specific entity from a campaign, use the `Get` function.

Take the `Quests` service for example.

For this service, `Get` requires a campaign ID and quest ID.

```go
qst, err := c.Quests.Get(cmpID, qstID)
```

The result is stored in `qst` of type `Quest`.

### Retrieving A List Of Entities

To retrieve a list of a campaign's entities of a certain type, use the `Index` function.

Take `Locations` for example.

For this service, `Index` requires only a campaign ID.

```go
locs, err := c.Locations.Index(cmpID, nil)
```

If you want to limit the results to only the locations that have been updated
since a specific time, provide that time to the `Index` function.

```go
t := time.Date(2019, time.November, 4, 11, 0, 0, 0, time.UTC)

locs, err := c.Locations.Index(cmpID, t)
```
The result is stored in `locs` of type `[]Location`.

### Creating An Entity

To create a new entity, use the `Create` function.

Take `Characters` for example.

For this service, `Create` requires a campaign ID and the data for the new
character in the form of type `SimpleCharacter`.

```go
ch := SimpleCharacter{
    Name: "Daenerys Targaryen",
    Sex: "Female",
    Title: "Mother of Dragons",
}

_, err := c.Characters.Create(cmpID, ch)
```
The `Create` functions return the newly created entity back to the caller.

This example simply discards the value.

### Updating An Entity

To update an existing entity, use the `Update` function.

Take `Items` for example.

For this service, `Update` requires a campaign ID, an item ID, and the data for
the new item in the form of type `SimpleItem`.

```go
item := SimpleItem{
    Name: "Bag of Holding",
    Size: "15 pounds",
    Price: "300 gold",
}

_, err := c.Items.Update(cmpID, item)
```
The `Update` functions return the updated entity back to the caller.

This example simply discards the value.

### Deleting An Entity

To delete an entity, use the `Delete` function.

Take `Journals` for example.

For this service, `Delete` requires a campaign ID and a journal ID.

```go
err := c.Journals.Delete(cmpID, jrnID)
```

### Rate Limits, Errors, And You

The Kanka API is rate limited. For the most accurate and updated information,
please visit the Kanka [documentation](https://kanka.io/en-US/docs/1.0/setup#endpoints).

If one of your requests to the Kanka API fails due to the rate limit or other temporary reason,
the error returned can be asserted for the `Temporary` behavior.

For more information about temporary errors, please visit Dave Cheney's
[blog](https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully).

## Contributions

If you would like to contribute to this project, please adhere to the following
guidelines.

* Submit an issue describing the problem.
* Fork the repo and add your contribution.
* Add appropriate tests.
* Run go fmt, go vet, and golint.
* Prefer idiomatic Go over non-idiomatic code.
* Follow the basic Go conventions found [here](https://github.com/golang/go/wiki/CodeReviewComments).
* If in doubt, try to match your code to the current codebase.
* Create a pull request with a description of your changes.

repository: dolanor-galaxy/kanka

repo_name: dolanor-galaxy/kanka


text:
# Roadmap

## Q42020
Below is a list of work we plan to get done this quarter. Some more details can be found
[in the milestone](https://github.com/FairwindsOps/rbac-manager/milestone/3)

* Update CRD to apiextensions.k8s.io/v1

repository: oxyno-zeta/rbac-manager

gha_language: Go

repo_name: oxyno-zeta/rbac-manager


text:
# Ama Sua

> The best way to get information about peruvian politicians

## Disclaimer: Right now the site has minimal css to get an acceptable expirience in mobile devices.

### Requirements

1. nodeJs 8.x.x
2. npm 6.x.x
3. An [algolia](https://algolia.com) account. It has a free plan.

### Development

1. Install dependencias

```bash
npm i
```

2. Create an index called **prod_politicians** in your algolia account and upload the **politicians.json** file from the example-data folder.

3. Create a .env.local file with the following variables. You must get these values from the algolia dashboard.

```
REACT_APP_ALGOLIA_API_KEY=cf94deedda58dde518d8eca41f5d217c
REACT_APP_ALGOLIA_APP_ID=U7J3TR8BBT
REACT_APP_ALGOLIA_BASE_URL=https://U7J3TR8BBT-dsn.algolia.net
REACT_APP_ALGOLIA_POLITICIANS_URL=1/indexes/prod_politician
```

2. Start the server

```bash
npm start
```

3. That's it, happy coding.

### Testing

WIP, stay tuned!

### Deployment

```bash
npm run build
```

It will generate a **build** folder that you can deploy to any web server. You should use [netlify](https://netlify.com).

repository: eperedo/ama-sua

repo_name: eperedo/ama-sua


text:
# Opps

![Opps Open Source Content Management Platform](docs/source/_static/opps.jpg "Opps Open Source Content Management Platform")

An *Open Source Content Management Platform* for the **magazine** websites and **high-traffic**, using the Django Framework.

[![Build Status](https://drone.io/github.com/opps/opps/status.png)](https://drone.io/github.com/opps/opps/latest)
[![Build Status](https://travis-ci.org/opps/opps.png?branch=master)](https://travis-ci.org/opps/opps "Opps Travis")
[![PyPi version](https://pypip.in/v/opps/badge.png)](https://crate.io/packages/opps/)
[![PyPi downloads](https://pypip.in/d/opps/badge.png)](https://crate.io/packages/opps/)

# Contacts

The place to create issues is [opps's github issues](https://github.com/opps/opps/issues). The more information you send about an issue, the greater the chance it will get fixed fast.

If you are not sure about something, have a doubt or feedback, or just want to ask for a feature, feel free to join our mailing list, or, if you're on Freenode (IRC), you can join the [#opps](http://webchat.freenode.net/?channels=opps) chat.

# Run example

    $ git clone git@github.com:opps/opps.git
    $ cd opps
    $ python setup.py develop
    $ opps-admin.py startproject PROJECT_NAME
    $ cd PROJECT_NAME
    $ python manage.py runserver

# Sponsor

* [YACOWS](http://yacows.com.br/)

# License

Copyright 2013 Opps Project and other contributors.

Licensed under the [`MIT License`](http://www.oppsproject.org/en/latest/#license)

repository: manoelneto/opps

repo_name: manoelneto/opps


text:
[![CircleCI](https://circleci.com/gh/GovWizely/lambda-contractsfinder/tree/master.svg?style=svg)](https://circleci.com/gh/GovWizely/lambda-contractsfinder/tree/master)
[![Maintainability](https://api.codeclimate.com/v1/badges/e050d41793856644c86a/maintainability)](https://codeclimate.com/github/GovWizely/lambda-contractsfinder/maintainability)
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=GovWizely/lambda-contractsfinder)](https://dependabot.com)

# UK Trade Leads Lambda

This is a scraper of [UK Trade Leads](https://www.contractsfinder.service.gov.uk/Search/Results) data that builds
a single JSON document and stores it in S3. The data isn't provided via an API endpoint, so this script pretends to
be a web browser and maintains the cookie needed to get the subsets of data and then reassemble them. The CSV download
functionality only returns ~1000 trade events at a time, and there are generally more than 1000. The approach taken
here is to get as much as possible per batch while moving the time window accordingly. This generates duplicates on the
border dates, so the accrued list of dicts gets de-duped before going to S3.

## Prerequisites

- This project is tested against Python 3.7+ in [CircleCI](https://app.circleci.com/github/GovWizely/lambda-contractsfinder/pipelines).
- Docker

## Getting Started

	git clone git@github.com:GovWizely/lambda-contractsfinder.git
	cd lambda-contractsfinder
	mkvirtualenv -p /usr/local/bin/python3.8 -r requirements-test.txt contractsfinder

If you are using PyCharm, make sure you enable code compatibility inspections for Python 3.7/3.8.

### Tests

```bash
python -m pytest
```

## Configuration

* Define AWS credentials in either `config.yaml` or in the [default] section of `~/.aws/credentials`. To use another profile, you can do something like `export AWS_DEFAULT_PROFILE=govwizely`.
* Edit `config.yaml` if you want to specify a different AWS region, role, and so on.
* Make sure you do not commit the AWS credentials to version control.

## Invocation

	lambda invoke -v

## Deploy

This project uses `MechanicalSoup` to parse XML, which uses `lxml` under the hood. That library must be built with C extensions for `libxml2` and `libxslt` in a way that is compatible with the Amazon Lambda execution environment.

To build the necessary libraries for Amazon's Python 3.8 runtime:

    docker build -t contractsfinder .
    docker run -v $(pwd):/outputs -it contractsfinder pip install --upgrade -r requirements.txt -t /outputs/

To deploy:

	lambda deploy --requirements requirements-dev.txt

Clean up the locally created files and directories:

    git clean -fd

repository: GovWizely/lambda-contractsfinder

gha_language: Python

repo_name: GovWizely/lambda-contractsfinder


text:
# 🌈🦄⚡📱 Mini Workshop 3: Build a Rainbow/Unicorn Mobile App that Lights Up a Particle Photon Device

| **Project Goal**              | Build a NativeScript-Vue mobile app to make a Photon's built-in LED flash different colors based on user selection.                                                                                |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **What you’ll learn**         | How to build a mobile app with NativeScript and Vue.js, how to setup and configure a Particle Photon, and how to connect the two so the app controls the device.                                                                                |
| **Tools you’ll need**         | Access to Wifi

A modern browser like Chrome.

Access to the [NativeScript Playground](http://play.nativescript.org) - consider creating an account in the Playground to keep the versions of your work intact. A mobile phone (iOS or Android) with the NativeScript Playground and Preview apps installed.

The two NativeScript companion apps for the playground (NativeScript Viewer and NativeScript Playground. On Android: [NativeScript Playground](https://play.google.com/store/apps/details?id=org.nativescript.play) and [NativeScript Preview](https://play.google.com/store/apps/details?id=org.nativescript.preview). On iOS: [NativeScript Playground](https://itunes.apple.com/us/app/nativescript-playground/id1263543946) and [NativeScript Preview](https://itunes.apple.com/us/app/nativescript-preview/id1264484702)

A [Particle Photon device](https://store.particle.io/collections/photon). |
| **Time needed to complete**   | 1 hour                                                                                |
| **Just want to try the app?** | [Open this link in the Playground App](https://play.nativescript.org/?template=play-vue&id=E9hBGf&v=21)                                                                                |

# Instructions

## Set Up Your Photon

### 1. Connect the Photon to WiFi:

Unbox the kit that comes with this workshop or use your own device, and plug the mini-USB cord into the Photon and to a USB port on your computer or to any USB-capable charger so the device will have power.

-   Visit the [Photon setup page](https://setup.particle.io/) to set up your device. You will be prompted to login; go ahead and create a Particle account.

-   After you have created your account, you will be redirected to set up the device. Click 'Setup a Photon' and 'next' to begin. If you have all the requirements on the next page, click 'next'. Download the local file that is generated to your computer. Open the `photonsetup.html` file in a browser.

-   Identify your Photon by looking at the back of the Photon's box. You'll find a sticker on the right that lists the device's id. The last six characters of that number match the wifi address that appears on your computer.

![box](./images/box.jpg)

-   Follow the steps listed to connect to the Photon's wifi network. When it connects, it should 'breathe cyan' (the blue light in the center should pulse gently on and off).

![wifi](./images/wifi.png)

Complete the setup of the device by giving it a name. Now, you can start using your device with [Particle Build](http://build.particle.io), the Photon's special IDE where you keep its code.

::: tip 💡
Sometimes students have trouble finding their Photon on Particle Build. If you don't see it in the IDE, add it manually.

-   If the device is not already blinking blue, hold down the setup button on the Photon until the main status LED blinks dark blue. This takes about 3 seconds.

![setup button](./images/setup_button.jpg)

-   Connect to your Photon's wifi following the steps above, and then open a web browser and navigate to: [http://<IP_ADDRESS>/device-id](http://<IP_ADDRESS>/device-id). On that page, you'll see an id like this:

```
{"id":"30003F000347363339343638","c":"1"}
```

-   Make a note of that id, you'll use it later.

-   Navigate to [Particle Build](https://build.particle.io) and click 'Add New Device'.

![Particle Build](./images/device_id.png)

-   Input the Device ID that you notated earlier in the box. Your device should now be ready to use in the IDE.
    :::

### 2. Learn About Particle Build

Since you already created an account for your Photon and should be logged in ([if not, login here](https://login.particle.io/login)) now you can go to [Particle Build](https://build.particle.io/build/new). Click on the third icon from the bottom on the left bar to see your device listed. Make sure that it is starred (click its star, if not) - you are going to flash code to this device over wifi.

Let's take a look at Particle Build. This is a browser-based IDE that allows you to 'flash', or publish, code from the browser to the Photon device selected on the left.

![Particle Build](./images/particle_build.png)

Currently, there is nothing in this new file except a setup() and loop() function. Let's start adding code to this file.

::: tip 💡
Photons are basically wifi-connected Arduinos, so if you have experience in Arduino development, this code will look familiar. Arduino 'sketches', or firmware that is written to a hardware device, are commonly written in C or C++. We're going to write a bit of C++ code to control the central LED light on the device, avoiding any soldering or extra wiring. The Particle kit, however, comes with a few extras, so feel free to explore them more later on!
:::

Right now, your Photon is lit up in the center LED, and should be 'breathing cyan' or pulsing a kind of greenish blue color, if everything is going well. Let's flash some code to it to turn the central light white.

### 3. Flash Some Code

To the right of the Build IDE, you'll see a black window with some lines of code. Inside the loop() function's curly brackets, paste the following code:

```js
RGB.control(true);
//change its color
RGB.color(RGB_COLOR_WHITE);
RGB.control(false);
```

This code uses the Particle API to grab control of the central RGB LED, change its color, then relinquish control.

This new file is considered to be an 'app' in Particle Build. You need to give it a name in the left panel before you can flash your app code to your starred device.

![build](./images/particle_build2.png)

Save your change by clicking the folder icon in the left navigation strip of Particle Build. Above that, click the circled checkmark to 'verify' the code. This basically tests your code to ensure that it can compile. Finally, ensuring that your Photon is starred, click the lightning icon at the top to flash this code to your device. The Photon should update, flashing a few colors for a few seconds, and then the central LED should turn white. It will stay white because we put the code in the loop function.

Tinker a little bit with this snippet. Can you turn the LED red?

### 4. Complete the Photon Code

In our mobile app, we're going to create three 'modes' of LED lights - 'Rainbow Mode' where the LED will flash a rainbow series, 'Unicorn Mode' where the LED flashes alternating blue and white, and a 'stop' mode where the LED stays white.

You might have guessed that we're going to put these routines in the loop() function.

Add a variable at the top of this file, listing the initial light style to be 0:

`int style = 0;`

Then, in the loop() function, overwrite the snippet you just added with the following code:

```js
if (style == 0) {
	RGB.control(true);
	//change its color
	RGB.color(RGB_COLOR_WHITE);
	RGB.control(false);
} else if (style == 1) {
	RGB.control(true);
	//change its color
	RGB.color(RGB_COLOR_RED);
	//delay a second
	delay(500);
	RGB.color(RGB_COLOR_ORANGE);
	delay(500);
	RGB.color(RGB_COLOR_YELLOW);
	delay(500);
	RGB.color(RGB_COLOR_GREEN);
	delay(500);
	RGB.color(RGB_COLOR_BLUE);
	delay(500);
	RGB.color(RGB_COLOR_MAGENTA);
	delay(500);
	// resume normal operation
	RGB.control(false);
} else if (style == 2) {
	RGB.control(true);
	//change its color
	RGB.color(RGB_COLOR_WHITE);
	//delay a second
	delay(500);
	RGB.color(RGB_COLOR_MAGENTA);
	delay(500);
	// resume normal operation
	RGB.control(false);
}
```

Verify this code and flash it to your device. Nothing seems to have changed - and that's because you have your style set to 0, which is still white. Change the integer value to 1, flash it to device, and see what happens. Do you see a rainbow?

Now you can return the style to 0 so the LED will initialize white:

`int style = 0;`

### 5. Get Ready for the Mobile App to use Photon's REST API

Now, we need to use Photon's cool REST API functionality to allow our mobile app to control the Photon. To do this, add this line to the setup() function, between the curly brackets:

`Particle.function("launchMode",launchMode);`

We just added a Particle function called `launchMode` that will be available from the mobile app, and will call a similarly-named function in the Photon's code.

Add that function under the close of the loop() function:

```js
int launchMode(String mode) {
    style = 0;

    if(mode=="rainbow"){
        style = 1;
    }else if(mode=="unicorn"){
        style = 2;
    }
}
```

Now, our mobile app can call the `launchMode` Particle Function which will call the internal `launchMode` function, passing in a string indicating which mode we want to use to control the LED flash style.

Go ahead and save, verify, then flash this code to your device. The LED should return to white.

### 6. Final Photon Code

The final code looks like this:

```js
int style = 0;

void setup(){
    Particle.function("launchMode",launchMode);
}
void loop(){
    if(style == 0){
        RGB.control(true);
        //change its color
        RGB.color(RGB_COLOR_WHITE);
        RGB.control(false);
    }
    else if (style == 1){
        RGB.control(true);
        //change its color
        RGB.color(RGB_COLOR_RED);
        //delay a second
        delay(500);
        RGB.color(RGB_COLOR_ORANGE);
        delay(500);
        RGB.color(RGB_COLOR_YELLOW);
        delay(500);
        RGB.color(RGB_COLOR_GREEN);
        delay(500);
        RGB.color(RGB_COLOR_BLUE);
        delay(500);
        RGB.color(RGB_COLOR_MAGENTA);
        delay(500);
        // resume normal operation
        RGB.control(false);
    }
    else if (style == 2){
        RGB.control(true);
        //change its color
        RGB.color(RGB_COLOR_WHITE);
        //delay a second
        delay(500);
        RGB.color(RGB_COLOR_MAGENTA);
        delay(500);
        // resume normal operation
        RGB.control(false);
    }
}

int launchMode(String mode) {
    style = 0;

    if (mode=="rainbow") {
        style = 1;
    } else if (mode=="unicorn") {
        style = 2;
    }

}
```

## Scaffold your app

Now we are going to build an app with NativeScript, using JavaScript to create a native mobile app. This app will communicate with the Photon via the code you just flashed.

Open the [NativeScript Playground](http://play.nativescript.org) and take a look around. On your first visit, you'll see several 'coach marks' showing where key functionality is kept.

Click 'Play Now' to open the main editor. You'll see a QR code appear - scan that with the NativeScript Play app. This allows your phone to refresh automatically as you code. Now you're ready to scaffold a NativeScript-Vue app!

![playground](./images/playground1.png)

By default, the first playground app is created using Angular. Click 'new' at the top and choose 'NS-Vue' as a template. You'll get another QR code, so scan that one. You'll see your phone refresh and a basic app appear:

![base app](./images/playground2.png)

## Create the Base Markup

We're going to use a bit of XML markup in the `template` to build out a simple layout with an ActionBar, a SegmentedBar for navigation, and a panel that will change when the SegmentedBar is tapped.

::: tip 💡
NativeScript layouts differ from the html you write on the web. You're using NativeScript XML markup, which translates to native UI like GridLayouts and StackLayouts.
:::

Open `app/components/HelloWorld.vue` and delete everything between the template's `<Page>` tags and add the following:

```html
<ActionBar class="action-bar" title="Awesome Photons!"/>
        <StackLayout>
          <SegmentedBar color="white" backgroundColor="blueviolet"
                selectedBackgroundColor="hotpink"  class="bar"
                :items="segmentedBarItems" v-model="selectedBarIndex"
                  />
            <StackLayout height="100%" :class="mode"></StackLayout>
        </StackLayout>
```

The SegmentedBar does not yet appear as the binded values `:items` and the `v-model` have not yet been set. Find the data block (under the template block, within the script block) and add values for a SegmentedBar by overwriting the `data()` method. Also set its default SelectedBarIndex and create a placeholder value for `mode`. The latter will be used to change the UI when the Bar is tapped:

```js
data() {
    return {
      segmentedBarItems: function () {
        var segmentedBarModule = require("ui/segmented-bar");
        let rainbow = new segmentedBarModule.SegmentedBarItem();
        rainbow.title = "Rainbows";
        let unicorn = new segmentedBarModule.SegmentedBarItem();
        unicorn.title = "Unicorns";
        let stop = new segmentedBarModule.SegmentedBarItem();
        stop.title = "Stop!";
        return [rainbow, unicorn, stop];
      }(),
      selectedBarIndex: 2,
      mode: ''
    };
  },
```

Now, you should be able to see the SegmentedBar appear!

## Add some CSS

NativeScript supports a subset of regular CSS and SASS to style UIs. Let's leverage that to improve our UI.

Under the `<script>` tags, you'll find a `<style>` tag. Overwrite the two styles in this block with the following;

```css
.action-bar {
	color: white;
	background-color: blueviolet;
}
.bar {
	margin: 20;
}
.rainbow {
	background: linear-gradient(to bottom, red, orange, yellow, green, blue, purple);
}
.unicorn {
	background-image: url('~/images/unicorn.jpg');
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center;
}
```

We also need to add an image to this project, which will appear when the Unicorn SegmentedBarItem is tapped.

Click on the small `+` next to the word `Explorer` and add a folder titled `images`. Save the file below to your local, and then upload it as a `.jpg` file, using the `Upload resources` utility in the dropdown.

::: tip
Make sure to rename your file `unicorn.jpg` and save it after uploading it.
:::

![A beautiful unicorn!](./images/unicorn.jpg)

## Create A Method (1)

We want the UI to change, depending on whether we tap `Rainbows`, `Unicorns`, or `Stop!`.

Create a `methods` block after the last comma (add the comma if it's not yet there) of the `data` method to manage the behavior of the SegmentedBar:

```js
methods: {
    onSelectedIndexChange(args) {
      let segmentedBarIndex = args.object.selectedIndex;
      if (segmentedBarIndex == 0) {
        this.mode = 'rainbow'
        //this.launchMode(this.mode);
      }
      else if (segmentedBarIndex == 1) {
        this.mode = 'unicorn'
        //this.launchMode(this.mode);
      }
      else {
        this.mode = 'stop'
        //this.launchMode(this.mode);
      }
    }
  }
```

::: tip
Sometimes the NativeScript Playground gets scrambled if you add JavaScript via paste. To fix it, type <command><X> twice.
:::

Then, edit the `<SegmentedBar>` itself to watch for this method: append @selectedIndexChange to the `<SegmentedBar>` markup in `<template>`:

```html
@selectedIndexChange="onSelectedIndexChange($event)"
```

The finished template block now looks like this:

```html
<template>
    <Page>
        <ActionBar class="action-bar" title="Awesome Photons!" />
        <StackLayout>
            <SegmentedBar color="white" backgroundColor="blueviolet"
                selectedBackgroundColor="hotpink" class="bar"
                :items="segmentedBarItems" v-model="selectedBarIndex"
                @selectedIndexChange="onSelectedIndexChange($event)" />
            <StackLayout height="100%" :class="mode"></StackLayout>
        </StackLayout>
    </Page>
</template>
```

Now, when you tap the SegmentedBar, the UI should change.

## Connect Your Photon

Now it's finally time to make the Photon light up when you tap the SegmentedBar.

In the Playground, right underneath `<script>`, set some `const` values.

```js
const http = require('http');
const baseUrl = 'https://api.particle.io/v1/devices/xxxxx';
const token = 'yyyyy';
const endpoint = 'launchMode';
```

Let's walk through these. First, we need to make an http call to Particle's REST API, so we need the `http` module.

Next, you need to tell the REST API which device to call and send it a token. You need to change two values here. Go back to Particle's Build IDE and click on the third icon from the bottom (it looks like a target). Your device ID is here:

![Particle IDE](./images/particle1.png)

Copy that value and change the `xxxxx` value in the baseUrl const to your device ID.

Now you need a token to use the REST API itself. Click the bottom 'gear' icon in Particle Build and copy the Access Token value, replacing 'yyyyy' with your token.

![Particle IDE](./images/particle2.png)

The last value you added is the name of the endpoint you're going to call. Remember that Particle function you set above? This is how the mobile app is going to call it.

## Create a Method (2)

Adding a comma after the closing bracket of the `onSelectedIndexChange` call, append a method to call the REST API and make your Photon change color:

```js
launchMode(mode) {
      http.request({
        url: `${baseUrl}/${endpoint}?access_token=${token}`,
        method: "POST",
        headers: { 'content-type': 'application/json' },
        content: JSON.stringify({
          mode: mode
        })
      }).then((response) => {
        console.log(JSON.stringify(response))
      }, (e) => {
        alert("error")
      });
    }
```

Here, we're making an http request to our baseUrl at the endpoint we set up as a Particle function, passing through a string to tell the function which color sequence to flash.

The final thing we need to do is actually call `launchMode` when the SegmentedBar is tapped. Go ahead and uncomment the `//this.launchMode(this.mode)` code in the `onSelectedIndexChange` method.

The entire HelloWorld.vue file looks like this, with your personal device's id and token input:

```js
<template>
    <Page>
        <ActionBar class="action-bar" title="Awesome Photons!" />
        <StackLayout>
            <SegmentedBar color="white" backgroundColor="blueviolet"
                selectedBackgroundColor="hotpink" class="bar"
                :items="segmentedBarItems" v-model="selectedBarIndex"
                @selectedIndexChange="onSelectedIndexChange($event)" />
            <StackLayout height="100%" :class="mode"></StackLayout>
        </StackLayout>
    </Page>
</template>

<script>
    const http = require("http");
    const baseUrl =
        "https://api.particle.io/v1/devices/<your device id>";
    const token = "<your token>";
    const endpoint = "launchMode";
    export default {
        data() {
            return {
                segmentedBarItems: (function() {
                    var segmentedBarModule = require(
                        "ui/segmented-bar");
                    let rainbow = new segmentedBarModule
                        .SegmentedBarItem();
                    rainbow.title = "Rainbows";
                    let unicorn = new segmentedBarModule
                        .SegmentedBarItem();
                    unicorn.title = "Unicorns";
                    let stop = new segmentedBarModule
                        .SegmentedBarItem();
                    stop.title = "Stop!";
                    return [rainbow, unicorn, stop];
                })(),
                selectedBarIndex: 2,
                mode: ""
            };
        },
        methods: {
            onSelectedIndexChange(args) {
                let segmentedBarIndex = args.object.selectedIndex;
                if (segmentedBarIndex == 0) {
                    this.mode = "rainbow";
                    this.launchMode(this.mode);
                } else if (segmentedBarIndex == 1) {
                    this.mode = "unicorn";
                    this.launchMode(this.mode);
                } else {
                    this.mode = "stop";
                    this.launchMode(this.mode);
                }
            },
            launchMode(mode) {
                http.request({
                    url: `${baseUrl}/${endpoint}?access_token=${token}`,
                    method: "POST",
                    headers: {
                        "content-type": "application/json"
                    },
                    content: JSON.stringify({
                        mode: mode
                    })
                }).then(
                    response => {
                        console.log(JSON.stringify(response));
                    },
                    e => {
                        alert("error");
                    }
                );
            }
        }
    };
</script>

<style scoped>
    .action-bar {
        color: white;
        background-color: blueviolet;
    }

    .bar {
        margin: 20;
    }

    .rainbow {
        background: linear-gradient(to bottom, red, orange, yellow, green, blue, purple);
    }
    .unicorn {
        background-image: url('~/images/unicorn.jpg');
        background-repeat: no-repeat;
        background-size: cover;
        background-position: center;
    }
</style>

```

Now, if you Photon is connected to wifi with the correct code flashed to it, you can see your gestures in the mobile app light up the Photon's center LED!

![rainbows unicorns](./images/rainbows_unicorns.gif)

It's really interesting to build Vue.js apps for mobile devices in the NativeScript Playground. Now that you know how, what else can you build? Could you extend this app to create different lighting modes?

## Author

Made with 📱❤ by Jen Looper


text:
## Sysrepo plugin for interface management

This repository houses a [sysrepo](https://github.com/sysrepo/sysrepo) plugin
which implements (parts of the) [A YANG Data Model for Interface Management ](https://tools.ietf.org/html/rfc7223).

You'll need the ``sysrepo-plugind`` in order to make this work.

### Installation

Build and install ``sysrepo`` and then use a standard CMake setup for this.

When loading and installing modules to sysrepo, e.g.:

 sysrepoctl --install --yang<EMAIL_ADDRESS>
pay attention to proper version of required modules, especially ietf-interfaces is working only with revision 2017-12-16. If you have another revision in your datastore you should uninstall it.


text:
# SpotHero Tools Library for Go

[![GoDoc](https://godoc.org/github.com/spothero/tools?status.svg)](https://godoc.org/github.com/spothero/tools)
[![Build Status](https://travis-ci.org/spothero/tools.svg?branch=master)](https://travis-ci.org/spothero/tools)
[![codecov](https://codecov.io/gh/spothero/tools/branch/master/graph/badge.svg)](https://codecov.io/gh/spothero/tools)
[![Go Report Card](https://goreportcard.com/badge/github.com/spothero/tools)](https://goreportcard.com/report/github.com/spothero/tools)

The SpotHero Tools Library is used internally at SpotHero across our Go programs. This library is a
collection of common utilities and functions that don't yet stand on their own as individual
libraries.

Additionally, an example server, template Makefile, and yeoman project generator are provided as a
convenience for users.

We welcome community usage and collaboration.

#### Running the Example Server

1. Install Golang
    1. `brew install golang`
    2. [Set your `GOPATH` in your `.zshrc`/`.bashrc`/etc](https://github.com/golang/go/wiki/SettingGOPATH)
    3. Add `GOPATH/bin` to your `PATH`
        1. `export PATH=$GOPATH/bin:$PATH`
2. Clone this repository
3. `make`
4. `./example_server`
5. Open your browser to `http://localhost:8080`

#### Overview
This library contains common modules for use in all GoLang projects across SpotHero. To use this
library simply add this as a dependency in your [dep Gopkg.toml](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md) using the latest release.

Currently, this library supports the following features:

* AWS Utilities
* CLI Utilities
* Kafka
  * Support for consuming and producing metrics
  * Support for goroutine-based callback functions where types are automatically deduced and
    unpacked
  * Schema Registry
* Avro Decoding
* HTTP Server with instrumentation
* Prometheus Metrics
* Kubernetes API Listeners
* High-Performance Logging
* Sentry Integration
* OpenTracing/Jaeger Tracing Support

In addition, all the above packages may automatically be integrated with Cobra/Viper CLIs for
12-factor application compatibility via the CLI module.

### Getting Setup

Usage of this library simply requires you to specify this package in your [dep Gopkg.toml](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md).

For example:

```
...
[[constraint]]
  branch = "master"
  name = "github.com/spothero/tools"
```

Then, in your application you can simply do the following:

```go
package coolpkg

import (
  "github.com/spothero/tools"
  ...
)
...
```

### Usage

A simple example is provided under [examples/example_server.go](examples/example_server.go) which shows usage of this
library to create a simple 12-factor Go Web application which has tracing, logging, metrics,
sentry, new relic, and local caching enabled.

For production applications, we recommend separating the Cobra/Viper command portion into its own
`cmd/` directory, and your application logic into a `pkg/` directory as is standard with most Go
applications.

Additionally, the [Makefile](Makefile) for this project is an excellent example which you can (and should)
borrow for your own projects.

### License
Apache 2.0

repository: spotrad/tools

repo_name: spotrad/tools


text:
Motorbike bundle store
==========

MotorbikeBundle used to create and store registered motor bike in database .

## requirements

symfony >= 2.7

php > 5.4

imagick

## installation

	composer require rth/motorbike-bundle "dev-master"

in your AppKernel.php file add following line :

	public function registerBundles()
		{
			$bundles = array(
			.
			.
			.
			.
			new \Rth\MotorbikeBundle\RthMotorbikeBundle(), // Motorbike bundle
			)
		}

now add these lines in app/config.yml

        rth_motorbike:
            general:
                upload_directory: "uploads" # upload directory name
                upload_path: "%kernel.root_dir%/../web/uploads" # upload path will be this. do not change it!
                image_tumbnail_width: 50 # image thumbnail width , imagick resizer
                image_tumbnail_height: 50 # image thumbnail height , imagick resizer
            default:
                motorbikes_per_page: 5
                filters: "color:text"  # example :   color:text,model:text,make:text

update database schema

		doctrine:schema:update --force

## How to use ?

well you must first make your security system config then you need registered user with ROLE_ADMIN to have access
to following admin page to add or list motorbikes .

        example.host/admin/motorbike

public page

        example.host/motorbike

if you wanna add some more filters it's better to take look at config section once again !
we have limit filters and it depends on entity field .

## To Do

adding motorbike edit page .


text:
# kube-dns-sync
`kube-dns-sync` is a Kubernetes Controller that syncs Kubernetes Node IPs to a DNS service.

[![Build Status Widget]][Build Status]
[![Coverage Status Widget]][Coverage Status]
[![Code Climate Widget]][Code Climate]
[![MicroBadger Version Widget]][MicroBadger URL]
[![MicroBadger Image Widget]][MicroBadger URL]

[Build Status]: https://travis-ci.org/wikiwi/kube-dns-sync
[Build Status Widget]: https://travis-ci.org/wikiwi/kube-dns-sync.svg?branch=master
[Coverage Status]: https://coveralls.io/github/wikiwi/kube-dns-sync?branch=master
[Coverage Status Widget]: https://coveralls.io/repos/github/wikiwi/kube-dns-sync/badge.svg?branch=master
[Code Climate]: https://codeclimate.com/github/wikiwi/kube-dns-sync
[Code Climate Widget]: https://codeclimate.com/github/wikiwi/kube-dns-sync/badges/gpa.svg
[MicroBadger URL]: http://microbadger.com/#/images/wikiwi/kube-dns-sync
[MicroBadger Version Widget]: https://images.microbadger.com/badges/version/wikiwi/kube-dns-sync.svg
[MicroBadger Image Widget]: https://images.microbadger.com/badges/image/wikiwi/kube-dns-sync.svg

## Use-Case
- You want to avoid using a load balancer or can't use one to expose your Kubernetes Services.
- You want to expose your Kubernetes Services using `NodePort` and need a way to discover the Nodes.
- You need to access your Nodes using a fixed DNS record.

## How it works
`kube-dns-sync` watches the Kubernetes API for changes in the Node resources and syncs the IP addresses to the DNS zone. When `--apex-address-type` is set, `kube-dns-sync` will sync the IP addresses of specified type from the Nodes to the A Record of the apex zone (root domain). Setting `--address-types` will create a managed A Record for each specifed type e.g. `internalip.example.com.`, `externalip.example.com.` with the addresses from each Node.

## Disadvantages
- `kube-dns-sync` only checks the health of Nodes and is unaware of your application.
- DNS changes are slow to propagate to clients. During this delay your clients might receive DNS records of unhealthy or removed Nodes.

## Supported DNS service
`kube-dns-sync` uses the DNS module of Kubernetes Federation and therefore supports the same DNS services. At the time of writing the supported services are 'google-clouddns' and 'aws-route53'.

## Authorization
The authorization mechanics are the same as for Kubernetes Federation. A link will be put here as soon as Kubernetes releases an official documentation for its Federation Service.

*note:* `google-clouddns` requires the scope `https://www.googleapis.com/auth/ndev.clouddns.readwrite`.
## Example
Adapt and save the manifest below. Create deployment using `kubectl create -f my-deployment.yaml`.

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: kube-dns-sync
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            app: kube-dns-sync
        spec:
          containers:
          - name: kube-dns-sync
            image: wikiwi/kube-dns-sync:0.1.0
            env:
            - name: KDS_ADDRESS_TYPES
              value: internalip
            - name: KDS_APEX_ADDRESS_TYPE
              value: externalip
            - name: KDS_ZONE_NAME
              value: example.io.
            - name: KDS_PROVIDER
              value: google-clouddns
            - name: KDS_SELECTOR
              value: wikiwi.io/dns-sync!=false

## Flags and Environment Variables
    Usage:
      kube-dns-sync [OPTIONS]

    Application Options:
          --dns-provider=[aws-route53|google-clouddns]             DNS provider [$KDS_PROVIDER]
          --dns-provider-config=                                   Path to config file for configuring DNS provider [$KDS_PROVIDER_CONFIG]
          --zone-name=                                             Zone name, like example.com [$KDS_ZONE_NAME]
          --sync-interval=                                         Interval for syncing with the DNS Provider (default: 60s) [$KDS_INTERVAL]
          --ttl=                                                   TTL value of DNS Records (default: 60) [$KDS_TTL]
          --address-types=                                         Comma list of address types to sync [externalip|internalip|legacyhostip] [$KDS_ADDRESS_TYPES]
          --apex-address-type=[externalip|internalip|legacyhostip] Address type that is synced to the Apex Zone [$KDS_APEX_ADDRESS_TYPE]
          --selector=                                              Node selector e.g. 'cloud.google.com/gke-nodepool=default-pool' [$KDS_SELECTOR]
          --verbose                                                Turn on verbose logging
      -v, --version                                                Show version number

    Help Options:
      -h, --help                                                   Show this help message

## Troubleshooting
- DNS zone is not created by the controller, make sure it exists.
- Make sure you use the correct DNS zone name with a dot at the end.

repository: wikiwi/kube-dns-sync

repo_name: wikiwi/kube-dns-sync


text:
# Committing Peer

[WIP]
...coming soon

This topic will explain the peer's runtime and role as a committer for transactions
on a channel.  In the meantime, refer to the [high-level data flow](https://jira.hyperledger.org/browse/FAB-37).


text:
## 0.2.0 (16.03.2023)

* Up minimal PHP to 8.1
* Dev: refactoring structure

## 0.1.2 (12 June 2021)

* `DirectiveWithoutParams`
* `DirectiveSingleParam`
* `DirectiveMultiParams`

## 0.1.1 (12 June 2021)

* #2: `append($item)` methods return `$item` for chains
* #3: the directive name can be NULL (it leads to disable directive)
* #4: don't show the directive comment if the directive is disabled

## 0.1.0 (11 June 2021)

repository: axypro/nginx-config-syntax

repo_name: axypro/nginx-config-syntax