text:
# Icinga Knowledge Base - IWKB000004

## Short Message

Use-Icinga : The 'Use-Icinga' command was found in the module 'icinga-powershell-framework', but the module could not be loaded. For more information, run 'Import-Module icinga-powershell-framework'

## Example Exception

Use-Icinga : The 'Use-Icinga' command was found in the module 'icinga-powershell-framework', but the module could not be loaded. For more information, run 'Import-Module icinga-powershell-framework'.

At line:1 char:1 + Use-Icinga; exit Invoke-IcingaCheckMemory -CriticalPercent 99 -Warnin ... + ~~~~~~~~~~

\+ CategoryInfo : ObjectNotFound:
(Use-Icinga:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule Invoke-IcingaCheckMemory : The term 'Invoke-IcingaCheckMemory' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:18 + Use-Icinga; exit Invoke-IcingaCheckMemory -CriticalPercent 99 -Warnin ... + ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Invoke-IcingaCheckMemory:String ) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

## Reason

This error can have multiple reasons and different solutions. Most of the time this issue is caused either by `Execution Policies` and/or PowerShell files being blocked on the system. It does how ever mean the installation of the specific PowerShell module itself is fine and just some smaller tweaks are required.

## Solutions

### Import the Module

Sometimes this issue can already be resolved by simply importing the module once with a user. In that case, all files are properly read and the module is available on the system. The corresponding module is always named within the exception messages. In this example, it is the `icinga-powershell-framework`. To import this module we simply run

```powershell
Import-Module 'icinga-powershell-framework';
```

In case no error occurs, we can continue this step for all affected modules and check if Icinga can now execute the commands. If not, please read on.

### Unblock PowerShell Files

Sometimes even with proper defined `Execution Policies` the execution of plugins or commands could fail. To resolve this, you can simply unblock the files of a specific folder. In this example we will assume that that modules are installed into `C:\Program Files\WindowsPowerShell\Modules` and our module name is `icinga-powershell-framework`.

```powershell
Get-ChildItem `
    -Path 'C:\Program Files\WindowsPowershell\Modules\icinga-powershell-framework' `
    -Recurse | Unblock-File
```

Repeat this for all affected modules and try again to execute plugins by Icinga. If the issue is not resolved, please read on

### Configure Execution Policies

Within the [Microsoft Docs](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy) there is a very detailed article on how `Execution Policies` work. In general these policies define on how PowerShell scripts and modules are being handled and if they can be executed by users.

Before doing any modifications on `Execution Policies`, please check your internal security guidelines which rules should apply.

To check on how the current `Execution Policies` are configured on the host, you can run this:

```powershell
Get-ExecutionPolicy -List
```

There are different scopes available to set policies for:

* **MachinePolicy**: Set by a Group Policy for all users of the computer
* **UserPolicy**: Set by a Group Policy for the current user of the computer
* **Process**: Affects only the current PowerShell session
* **CurrentUser**: Affects only the current user
* **LocalMachine**: Default scope that affects all users of the computer

For each scope, you can define a policy on how modules and scripts are checked and possibly blocked:

* **AllSigned**: Requires that all scripts and configuration files are signed by a trusted publisher, including scripts written on the local computer
* **Bypass**: Nothing is blocked and there are no warnings or prompts
* **Default**: Sets the default execution policy. Restricted for Windows clients or RemoteSigned for Windows servers
* **RemoteSigned**: Requires that all scripts and configuration files downloaded from the Internet are signed by a trusted publisher. The default execution policy for Windows server computers
* **Restricted**: Doesn't load configuration files or run scripts. The default execution policy Windows client computers
* **Undefined**: No execution policy is set for the scope. Removes an assigned execution policy from a scope that is not set by a Group Policy. If the execution policy in all scopes is Undefined, the effective execution policy is Restricted
* **Unrestricted**: Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet, you are prompted for permission before it runs

In case your internal security policy defines that PowerShell scripts and modules require being **RemoteSigned**, you can do this for yourself as Icinga is not shipping signed modules. To do so, please have a look on the [Microsoft Docs About Signing](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_signing).

To modify the `Execution Policies`, you have to run the PowerShell as Administrator and provide the `Scope` as well as the `Execution Policy`:

```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
```

Once applied, you can try to use `Import-Module` again for the affected PowerShell module and checking your Icinga again if checks are now properly executed.

repository: Icinga/icinga-powershell-framework

gha_language: PowerShell

repo_name: Icinga/icinga-powershell-framework


text:
---
title: "PowerShell Easy Caching"
date: "2021-03-01"
redirect_from : 2021/03/01/powershell-easy-caching
coverImage: ..\assets\images\2021\Caching-For-Speed.webp
categories:
  - "scripting"
tags:
  - "caching"
  - "powershell"
excerpt: "The other day I answered a question on StackOverflow about how to cache the results of slow running operations easily in PowerShell.  I thought it had the makings of a good blog post so here we go!"
---

## PowerShell Easy Caching

![](..\assets\images\2021\Caching-For-Speed.webp)

The other day I [answered a question on StackOverflow](https://stackoverflow.com/questions/65959734/i-want-to-implement-a-cache-storage-on-my-powershell-for-quicker-runtime-on-next/65960196#65960196) about how to cache the results of slow running operations easily in PowerShell.

In answering it, I was reminded that this problem occurs all the time in automation, like when you:

* need to work with a big dataset
* have a very slow external dependency
* your queries impact the environment
* have a rapid automation task which can still function with semi-stale data

As always, we will approach this with Progressive Automation, step-by-step adding complexity and features till we get something we're really proud about.  So first we'll look at Caching calls just for this instance of PowerShell.   Then we'll build in complexity and add a more persistent cache.

One new thing: I'm going to try to start sprinkling in some more deliberate career / workplace advice throughout my posts, hope you like it.  If you hate it, feel free to contact me for a refund.

*Outline*

* Question Background
* Identify key places to add caching
* Add a soft-cache (memory caching)
* Generalize to be used anywhere
* A Great Use for PowerShell Classes is found!
* Upgrade to disk backed cache

## Question Background

[For the question on Stack](https://stackoverflow.com/questions/65959734/i-want-to-implement-a-cache-storage-on-my-powershell-for-quicker-runtime-on-next/65960196#65960196), the user wanted to cache a call to Get-ADGroup for some automation at her workplace.  Also, it was good enough to cache the membership when PowerShell opened up.  So we started with looking at her code.

She already had a function called `Get-AdUsers`, which wrapped around the normal `Get-AdGroup` and `Get-AdUser` cmdlets, I'll post a snippet here.   The gist of this function was to retrieve all nested group members from a parent group.

```powershell
function Get-ADUsers {
    param (
        [Parameter(ValuefromPipeline = $true, mandatory = $true)][String] $GroupName
    )
    [int]$circular = $null

    # result holder
    $resultHolder = @()
        $table = $null
        $nestedmembers = $null
        $adgroupname = $null

        # get members of the group and member of
        $ADGroupname = get-adgroup $groupname -properties memberof, members

        # list all members as list (no headers) and save to var
        $memberof = $adgroupname | select -expand memberof

        if ($adgroupname) {
            if ($circular) {
                $nestedMembers = Get-ADGroupMember -Identity $GroupName -recursive
                $circular = $null
            }
            else {
                $nestedMembers = Get-ADGroupMember -Identity $GroupName | sort objectclass -Descending
            }
        }
        #...code continued...
```

She was looking for some place to cache hits to LDAP.  Two lines jumped out at me.

```powershell
13: $ADGroupname = get-adgroup $groupname -properties memberof, members
20: $nestedMembers = Get-ADGroupMember -Identity $GroupName -recursive
```

The top line is good to cache if we want this cmdlet to be fast when someone looks at multiple groups in a session.
The bottom line is good to cache when we want fast results when the parent group often contains the same nested groups.

## Business Moment: Coding for Impact

You might wonder at this point

> why bother analyzing the problem, I wanna code!

This sort of analysis is good to perform before you just start coding. Ideally, our work should be done as part of a team, identifying pain-points and spending our efforts meaningfully.

You want at the end of the week, month and year to have a list of your achievements, and speeding up or improving the performance of something critical and meaningful will help you give your boss the ammo she needs to argue for a higher raise or promotion for you.

BusinessImpact image

TL/DR: Don't waste engineering hours automating something painless or that no one cares about.  Your efforts should be apparent and yell from the roof top "Yo, this Engineer is AWESOME, give him a raise!"

### InMemory : Good Enough Caching

We will begin by caching the nested hits, line 20.  Most organizations go BONKERS nesting groups inside groups inside groups, so if we can mitigate some of those greedy LDAP hits to use our speedy, snappy cache will have an immediate speed boost.

```powershell
20:  $nestedMembers = Get-ADGroupMember -Identity $GroupName -recursive
```

We'll do this by replacing this function call with another call.  We'll name this `Get-CachedADGroupMember`

```powershell
function Get-CachedADGroupMember($groupname){
   $groupName = "cached_member_$($groupName)"
   $cachedResults = Get-Variable -Scope Global -Name $groupName -ErrorAction SilentlyContinue
   if($null -ne $cachedResults){
    "found cached result"
    return $cachedResults
   }
   else{
    "need to cache"
    $results = get-adgroup $groupname -properties memberof, members
    Set-CachedGroupMembership -groupName $groupName -value $results
   }
}
```

This is pretty straightforward.  The code builds the name of a variable and then checks the environment to see if it exists.  If it does, that variable is returned.  If not, then we execute the operation and hand off the results to another cmdlet just to store the results.  The storage command is very simple.  (Hint: it will become less simple once we add storage to disk!)

```powershell
Function Set-CachedGroupMembership($groupName,$value){
    Set-Variable -Scope Global -Name $groupName -Value $value
    return $value
}
```

Already, this will become noticably faster because of all the cache hits. However, what if our cache becomes stale and we need to update it?

We can provide this feature by just passing a $boolean value of -Update in, by adding this to our cmds params.

```powershell
function Get-CachedADGroupMember([string]$groupname, [switch]$update){
   #...
   if(($update) -and ($null -ne $cachedResults)){

```

Then, to force an update of the Cache, we simply append `-Update` to our function.

Easy peasey!

## Work.Select(x=>x.Specialize.Generalize())

Time to modify this function and remove the inherent AD Based focus, and turn it into a modular tool that could work to cache *anything*.

Some small edits is all we need!

```powershell
function Get-CachedOperation([String]$Name, [ScriptBlock]$command, [Switch]$Force){
   $CommandName = "cached_$($Name)"
   $cachedResults = Get-Variable -Scope Global -Name $CommandName -ErrorAction SilentlyContinue
   if($force -or $null -eq $cachedResults ){
    "need to cache, evaluating..."
    $results = $command.Invoke()

    New-Variable -Scope Global -Name $CommandName -value $results -Force
   }
   else{

    "found cached result"
    return $cachedResults
   }
}
```

To actually use it, we use the following

```powershell
>Get-CachedOperation -Name SlowCommand -command ([ScriptBlock]::Create({start-sleep 2;return 5}) ) | tee-object -var result

>$result.Value
5
```

One downside to our code as written is that there is no logic to rerun if the results get too stale

## Always Fresh PowerShell

To add time awareness, the quickest way is to make a custom type that has the command name, scriptblock, results and an automatic timestamp.  This is actually a perfect use case for PowerShell classes, which past me from like four years ago completely couldn't understand.  Aww, see how cute I was?

Link to my old post

So, here's the class.  We could make a new one if we wanted by running the bottom line.

```powershell
class CachedOperation
{
   # Automatic TimeStamp
   [DateTime] $TimeStamp;

   # Command Nickname
   [string] $Name;

   # Command Instructions
   [ScriptBlock] $Command;

   # Output, whatever it is
   [psCustomObject] $Value;

   #Constructor
   CachedOperation ([string] $name, [ScriptBlock]$scriptblock)
   {
       $this.TimeStamp = [DateTime]::UtcNow
       $this.Name = $name;
       $this.Command = $scriptblock
       $this.Value= $scriptblock.Invoke()
   }

}
```

Now to modify the function to work with this class.

```powershell
function Get-CachedOperation([String]$Name, [ScriptBlock]$Command, [Switch]$Force){
   $CommandName = "cached_$($Name)"
   $cachedResults = Get-Variable -Scope Global -Name $CommandName -ErrorAction SilentlyContinue | Select -ExpandProperty Value
   if($force -or $null -eq $cachedResults ){
        Write-Verbose "need to cache, evaluating..."
        $CachedOperation = [CachedOperation]::new($Name, $command)
        New-Variable -Scope Global -Name $CommandName -value $CachedOperation -Force
        $cachedResults = $CachedOperation
   }
   else{
        Write-Verbose "found cached result"
   }
   return $cachedResults.Value
}
```
And in action:

```

Get-CachedOperation -Name MySlowCommand -command ([ScriptBlock]::Create({start-sleep 1;return 6}) )
VERBOSE: need to cache, evaluating...
6

PS C:\Users\Stephen> Get-CachedOperation -Name MySlowCommand -command ([ScriptBlock]::Create({start-sleep 1;return 6}) )
VERBOSE: found cached result
6
```
So in the last step, no value was created.  We were merely setting up the scaffolding for the next, actually cool step.

Seems silly to have intermediate steps but in the real world, you'll probably be following a flow like this, creating the scaffolding and supporting functions and then submitting them with their unit tests.  Then once that passes muster, you introduce the small feature flag PR that flips things around and starts using that new code.

## Adding Staleness Check

To actually do something useful, let's add the time check to see how old the results are.

This is pretty easily done, when we retrieve a cached result, we'll check to see how old it is and if more than 30 minutes, we'll rerun the operation.
```

function Get-CachedOperation([String]$Name, [ScriptBlock]$Command, [Switch]$Force){
   $CommandName = "cached_$($Name)"
   $cachedResults = Get-Variable -Scope Global -Name $CommandName -ErrorAction SilentlyContinue | Select -ExpandProperty Value

   if($force -or $null -eq $cachedResults -or ($cachedResults.TimeStamp -le [DateTime]::UtcNow.AddMinutes(-2))){
        if($cachedResults.TimeStamp -le [DateTime]::UtcNow.AddMinutes(-2)){
            Write-Verbose "Results are too old, reevaluating..."
        }
        else{
            Write-Verbose "need to cache, evaluating..."
        }
        $CachedOperation = [CachedOperation]::new($Name, $command)
        New-Variable -Scope Global -Name $CommandName -value $CachedOperation -Force
        $cachedResults = $CachedOperation
   }
   else{
        Write-Verbose "found cached result"
   }
   return $cachedResults.Value
}

```

## To Disk, and Beyond*

<Sad Buzz Lightyard>

*We will not actually be going beyond in this post

Like this post?  Great!  Join us next time where we'll persist the results to disk!

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive


text:
# Webpack

**Bundler, tusk-manager, transpiler for React-projects by Nodejs**.

* [Webpack official docs](https://webpack.js.org/)

repository: EvgenyLeukhin/js-book

repo_name: EvgenyLeukhin/js-book


text:
---
title: Setup Firefox OS
---

## Automatic Install

There is no automatic setup available for Firefox OS.

## Manual Install

No additional tools to build for Firefox OS.

To test an application in the Firefox OS Simulator, or to push an application to a device, you must install the [Firefox OS App Manager](https://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/) as an extension to a standard Firefox browser desktop install.

You can find more information about working with the App Manager [here](https://developer.mozilla.org/en-US/Firefox_OS/Using_the_App_Manager).

## Forums

If you encounter problems setting up Lime to compile for Firefox OS, please visit the [forums](http://community.openfl.org/c/help).


text:
# Holidays Recipes (MIT License)

## Classes

* Holiday Chef: Any registered user that uses the site and wishes to share their recipes
* Holiday: A cultural celebration that occurs in a specific time period
* Recipe: A particular set of instructions that needs ingredients
* Cultural ingredient: A particular ingredient that is not locally available.
* Cultural Ingredient Supplier: A supplier that is able to provide the specific cultural ingredient specified in the recipe
* Culture of the Recipe: A combination of the recipe country of origin and the current chef origin.

## References
* 3rd Party APIs
* Google MAPs API
* Facebook API
* Spring MVC
* Spring Security
* Spring Boot
* Spring Data
* jQuery
* Bootstrap

Thymeleaf: http://www.thymeleaf.org/documentation.html
Spring Boot: http://docs.spring.io/autorepo/docs/spring-boot/1.2.0.M2/reference/htmlsingle/
Spring Data: http://docs.spring.io/spring-data/jpa/docs/current/reference/html/
Spring MVC: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html
Spring Security: https://docs.spring.io/spring-security/site/docs/3.0.x/reference/springsecurity.html
Spring Boot examples: https://github.com/spring-projects/spring-boot/
Facebook API:
https://developers.facebook.com/
Google Map API:
https://developers.google.com/maps/documentation/javascript/

repository: tamutamu-archive/holidays-recipes

repo_name: tamutamu-archive/holidays-recipes


text:
+++ Ceen.PaaS : A platform for building websites +++

Building a fully feature website has numerous parts that need to work in tandem to get security, features and performance in just the right mix.

With the Ceen.PaaS module you get a number of these features pre-built. This includes:

* Users with roles, admin is built-in
* User account management, secure password storage
  * Create user
  * Verify email
  * Reset password
* Locally stored and resized images
* Markdown based rendering to html (and plaintext)
* Email transmission and retries using Sparkpost
* ToS and privacy documents from Markdown
* Login checks, including Admin checks
  * Fully featured XSRF protection
* Locale support for localized messages/pages
* Admin access to monitor queues, signups, emails and http requests

Where as Ceen is generally written to be flexible and fit many different approaches, the PaaS module has some choices that are not configureable. It is however possible simply avoid some of the features if they are not relevant, while still maintaining the remaining functionality.

To configure the PaaS module, load it from you application and then use a configuration similar to this:

```
httpport 12345
httpaddress loopback

# Setup loggers
logger Ceen.Httpd.Logging.StdOutErrors
logger Ceen.Extras.LogModule

# Run the modules
module Ceen.Extras.MemCache

module Ceen.Extras.QueueModule "emailqueue"
set ratelimit 4/s
set ConnectionString "queues.sqlite"

# The main database
module Ceen.PaaS.DatabaseInstance
set ConnectionString "Ceen.PaaS.sqlite"

# The short and long-term tokens
module Ceen.Security.Login.DatabaseStorageModule true true false

# Custom logout feature
handler "/api/v1/logout" Ceen.Security.Login.LogoutHandler
set ResultStatusCode 200
set ResultStatusMessage OK
set RedirectUrl ""

# Require XSRF on all API calls
handler "/api/*" Ceen.Security.Login.XSRFTokenRequiredHandler
handler "/api/v1/login" Ceen.Security.Login.LoginHandler

# Attach user information to later handlers
handler "/api/*" Ceen.PaaS.Services.LoginChecker

# Admin stuff needs admin access
handler "/api/v1/admin/*" Ceen.PaaS.Services.AdminRequiredHandler

# Generate XSRF tokens for non-api pages
handler "" Ceen.Security.Login.XSRFTokenGeneratorHandler

# Wire up the API
route Ceen.PaaS

# Anything not caught by the API gives 404
handler "/api/*" Ceen.Httpd.Handler.StaticHandler
set StatusCode 404

handler "/tos" Ceen.PaaS.Services.TermsOfService
handler "/privacy" Ceen.PaaS.Services.PrivacyPolicy
```

Further, to avoid leaking various sensitive information, the PaaS module expects a file named `secrets.txt` to be placed in the folder where Ceen is running from. Inside this file can be any number of `key=value` items, that are readable from the `Ceen.PaaS.SecretsManager` class.

You can add any items specific to your application, but you need to set up the Sparkpost API key and the default admin user to get started. Example `secrets.txt` file:
```
SPARKPOST_KEY =<PHONE_NUMBER>

<EMAIL_ADDRESS>DEFAULT_ADMIN_PASSWORD=examplepassword
```

repository: kenkendk/ceenhttpd

gha_language: C#

repo_name: kenkendk/ceenhttpd


text:
Foot Contact Switch v1
=======================

Description
------------

weight 10g / weight of the lower leg structure
12 elastic silicone elements / 6 on each side
pin prevents rotation

3.3V supply
0V-3V analog Signal
2ms reponse time - measured 8cm drop with respect to ATI sensor 1kHz data rate
Red/Green LED on each side outer side of the boards
Comperator 2V trigger level
For verification of the sensor working
Foot deflects up to 2mm
270 degree angular sensing range

No load - 3V output - foot leds red
Contact - 0V output - foot leds green

Sensitivity can be adjusted to the application
by number of elements / diameter / wall thickness / length / material / diameter aperture
distance between emitter and receiver and emitter led brightness

Off-the-shelf-Parts
--------------------

Silicone tube - outer diameter 6mm / inner diameter 4mm / length 3mm

Pin 1,5mm x 12mm

Bicycle trire bonded with Loctite 404

Machined Parts
---------------

3D Printed Parts
-----------------

Foot structure with 1,5mm hole in the center

Sensor characteristics
------------------------

x - axis vertical force [N] measured with ATI Sensor
y - sensor ouput signal inverted!
0-1 corresponds to 0V to 3.3V range
64.000 resolution on microcontroller???

Next Steps / Future Work
------------------------

3d print elastic elements
Reduce weight of traction element on the foot
Reduce signal noise

Authors
--------
Felix Grimminger
Joshi Walzog

License
-------
BSD 3-Clause License

Copyright
-----------
Copyright (c) 2019, Max Planck Gesellschaft, New York University

More Information
----------------
[Open Dynamic Robot Initiative](https://open-dynamic-robot-initiative.github.io)
[Hardware Overview](../../README.md)
[Software Overview](https://github.com/open-dynamic-robot-initiative/open-dynamic-robot-initiative.github.io/wiki/Open-Dynamic-Robot-Initiative-Documentation)


text:
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [4.10.3](https://github.com/appcelerator/docs-devkit/compare/v4.10.2...v4.10.3) (2021-03-09)

### Bug Fixes

* **docgen:** clean up extra __version field after typescript generator runs ([e52f63a](https://github.com/appcelerator/docs-devkit/commit/e52f63ae0c592a80d003d1330ee549c755480daa))
* **docgen:** fix html and typescript format outputs, refactor generation code ([1f3ff62](https://github.com/appcelerator/docs-devkit/commit/1f3ff628bd268e4f6c47693ed59a8dca2bb64ac5))

## [4.10.2](https://github.com/appcelerator/docs-devkit/compare/v4.10.1...v4.10.2) (2021-03-09)

### Bug Fixes

* dont pretty print the jsca file ([701d298](https://github.com/appcelerator/docs-devkit/commit/701d298d870a42922620e9055a9b728e6b819c74))

## [4.10.1](https://github.com/appcelerator/docs-devkit/compare/v4.10.0...v4.10.1) (2021-01-12)

### Bug Fixes

* **docgen:** guard createable property for generated methods properly ([04a29be](https://github.com/appcelerator/docs-devkit/commit/04a29be2447cb233423153bc66903bdbbbcec750))

# [4.10.0](https://github.com/appcelerator/docs-devkit/compare/v4.9.3...v4.10.0) (2020-11-19)

### Bug Fixes

* **docgen:** output optional/repeatable when true for method parameters in json-raw format ([217c50f](https://github.com/appcelerator/docs-devkit/commit/217c50ff37ee1c1286c5fd8ca82cc1445f5896ac))

### Features

* **docgen:** support 'any' type ([2f52fc3](https://github.com/appcelerator/docs-devkit/commit/2f52fc3a080612651b9ca43dae518b1aa678dfd2)), closes [#103](https://github.com/appcelerator/docs-devkit/issues/103)

## [4.9.3](https://github.com/appcelerator/docs-devkit/compare/v4.9.2...v4.9.3) (2020-11-19)

### Bug Fixes

* **docgen:** support references to builtin types when validating class names ([9600a9f](https://github.com/appcelerator/docs-devkit/commit/9600a9f87f61f1be226363137a14476c346455cf))

## [4.9.2](https://github.com/appcelerator/docs-devkit/compare/v4.9.1...v4.9.2) (2020-11-18)

### Bug Fixes

* **docgen:** skip Node.js shim docs for typescript generation ([d0955fa](https://github.com/appcelerator/docs-devkit/commit/d0955fadbaaf866c0961e67e11fe7400fe77f9dc))

## [4.9.1](https://github.com/appcelerator/docs-devkit/compare/v4.9.0...v4.9.1) (2020-11-12)

### Bug Fixes

* **docgen:** assertObjectKey needs to guard for null object ([8b5f51d](https://github.com/appcelerator/docs-devkit/commit/8b5f51d9b7f5b1ac923b44c45932cc93269ff94c))

# [4.9.0](https://github.com/appcelerator/docs-devkit/compare/v4.8.3...v4.9.0) (2020-11-10)

### Bug Fixes

* properly handle falsy default values ([9485406](https://github.com/appcelerator/docs-devkit/commit/94854061a73857cb602d206529b9346a5aeb0b74))

## [4.8.3](https://github.com/appcelerator/docs-devkit/compare/v4.8.2...v4.8.3) (2020-10-21)

**Note:** Version bump only for package titanium-docgen

## [4.8.2](https://github.com/appcelerator/docs-devkit/compare/v4.8.1...v4.8.2) (2020-10-19)

### Bug Fixes

* **apidocs:** show property default value and related constants ([b73996a](https://github.com/appcelerator/docs-devkit/commit/b73996a))

## [4.8.1](https://github.com/appcelerator/docs-devkit/compare/v4.8.0...v4.8.1) (2020-10-08)

### Bug Fixes

* **docgen:** better match git repo URIs, report bad via console ([444d94f](https://github.com/appcelerator/docs-devkit/commit/444d94f))

# [4.8.0](https://github.com/appcelerator/docs-devkit/compare/v4.7.0...v4.8.0) (2020-10-08)

### Bug Fixes

* **ts:** exclude global types ([#45](https://github.com/appcelerator/docs-devkit/issues/45)) ([a4e5814](https://github.com/appcelerator/docs-devkit/commit/a4e5814))

### Features

* **titanium-docgen:** include editUrl in json-raw output for types ([5b0890c](https://github.com/appcelerator/docs-devkit/commit/5b0890c))

# [4.7.0](https://github.com/appcelerator/docs-devkit/compare/v4.6.1...v4.7.0) (2020-08-28)

### Features

* support macos ([bc3462f](https://github.com/appcelerator/docs-devkit/commit/bc3462f))
* **docgen:** Add more validations for since/deprecated, duplicated platform listings ([b28357b](https://github.com/appcelerator/docs-devkit/commit/b28357b))

# [4.6.0](https://github.com/appcelerator/docs-devkit/compare/v4.5.2...v4.6.0) (2020-07-21)

### Features

* **docgen:** support es6+ JS builtins ([#41](https://github.com/appcelerator/docs-devkit/issues/41)) ([d405ab4](https://github.com/appcelerator/docs-devkit/commit/d405ab4))

## [4.5.1](https://github.com/appcelerator/docs-devkit/compare/v4.5.0...v4.5.1) (2020-06-19)

### Performance Improvements

* **docgen:** don't include filename properties in json-raw output ([#36](https://github.com/appcelerator/docs-devkit/issues/36)) ([0eca516](https://github.com/appcelerator/docs-devkit/commit/0eca516))
* **docgen:** don't include pretty_name in json-raw output ([#34](https://github.com/appcelerator/docs-devkit/issues/34)) ([7e5decd](https://github.com/appcelerator/docs-devkit/commit/7e5decd))

# [4.4.0](https://github.com/appcelerator/docs-devkit/compare/v4.3.1...v4.4.0) (2020-06-12)

### Bug Fixes

* **docgen:** avoid outputting null and empty array values to shrink output json ([3908195](https://github.com/appcelerator/docs-devkit/commit/3908195))

### Features

* **validate:** warning for misxed case event names, split String vs ASCII validation ([ed21978](https://github.com/appcelerator/docs-devkit/commit/ed21978))

## [4.3.1](https://github.com/appcelerator/docs-devkit/compare/v4.3.0...v4.3.1) (2020-04-17)

### Bug Fixes

* **docgen:** allow unknown properties on ListDataItem ([774051d](https://github.com/appcelerator/docs-devkit/commit/774051d))

# [4.3.0](https://github.com/appcelerator/docs-devkit/compare/v4.2.0...v4.3.0) (2020-03-05)

### Bug Fixes

* **docgen:** build correct path ([#27](https://github.com/appcelerator/docs-devkit/issues/27)) ([2f085f0](https://github.com/appcelerator/docs-devkit/commit/2f085f0))
* **docgen:** ts definition for Ti.Android.R ([#31](https://github.com/appcelerator/docs-devkit/issues/31)) ([388df48](https://github.com/appcelerator/docs-devkit/commit/388df48))
* **docgen:** use correct include syntax for ejs3 ([e4dde5d](https://github.com/appcelerator/docs-devkit/commit/e4dde5d))
* **docgen/modulehtml:** correct require path ([e00f175](https://github.com/appcelerator/docs-devkit/commit/e00f175))

### Features

* **docgen:** improve typescript generator ([#25](https://github.com/appcelerator/docs-devkit/issues/25)) ([34f07c5](https://github.com/appcelerator/docs-devkit/commit/34f07c5))
* **docgen:** improved accessors deprecation generation ([#24](https://github.com/appcelerator/docs-devkit/issues/24)) ([5981029](https://github.com/appcelerator/docs-devkit/commit/5981029))

# [4.2.0](https://github.com/appcelerator/docs-devkit/compare/v4.1.0...v4.2.0) (2020-02-05)

### Features

* **docgen:** accept whitelist of constants references to skip ([#26](https://github.com/appcelerator/docs-devkit/issues/26)) ([3b1c537](https://github.com/appcelerator/docs-devkit/commit/3b1c537))

# [4.1.0](https://github.com/appcelerator/docs-devkit/compare/v4.0.1...v4.1.0) (2019-12-12)

### Features

* **docgen:** improve validation to include warnings ([#21](https://github.com/appcelerator/docs-devkit/issues/21)) ([efe2aca](https://github.com/appcelerator/docs-devkit/commit/efe2aca))

## [4.0.1](https://github.com/appcelerator/docs-devkit/compare/v4.0.0...v4.0.1) (2019-12-11)

**Note:** Version bump only for package titanium-docgen

# 4.0.0 (2019-12-02) [YANKED]

# 3.0.0 (2019-12-02) [YANKED]

# 2.0.0 (2019-12-02) [YANKED]

# 1.0.0 (2019-12-02)

### Bug Fixes

* **docgen:** add missing typescript generator changes ([22d0779](https://github.com/appcelerator/docs-devkit/commit/22d0779))
* **docgen:** add missing validate command ([807f211](https://github.com/appcelerator/docs-devkit/commit/807f211))
* **docgen:** allow Error and RegExp as predefined types ([#10](https://github.com/appcelerator/docs-devkit/issues/10)) ([428aedd](https://github.com/appcelerator/docs-devkit/commit/428aedd))
* **docgen:** correctly handle array syntax in callbacks ([#3](https://github.com/appcelerator/docs-devkit/issues/3)) ([eb43ad5](https://github.com/appcelerator/docs-devkit/commit/eb43ad5))

### Features

* **docgen:** copy over images from any of the input paths for html output ([7fd48b6](https://github.com/appcelerator/docs-devkit/commit/7fd48b6))
* **docgen:** make it work as an independent module ([4ca640a](https://github.com/appcelerator/docs-devkit/commit/4ca640a))
* **docgen:** reference free-form text content from other files ([7eae53f](https://github.com/appcelerator/docs-devkit/commit/7eae53f))
* **validate:** add ability to whitelist types ([#5](https://github.com/appcelerator/docs-devkit/issues/5)) ([44d893b](https://github.com/appcelerator/docs-devkit/commit/44d893b))
* **validate:** more strict checks on event properties ([ca8c76f](https://github.com/appcelerator/docs-devkit/commit/ca8c76f))

### BREAKING CHANGES

* **validate:** All documented event properties need to have a type

# [0.2.0](https://github.com/appcelerator/docs-devkit/compare/v0.1.5...v0.2.0) (2019-09-09)

### Features

* **docgen:** copy over images from any of the input paths for html output ([7fd48b6](https://github.com/appcelerator/docs-devkit/commit/7fd48b6))
* **validate:** add ability to whitelist types ([#5](https://github.com/appcelerator/docs-devkit/issues/5)) ([44d893b](https://github.com/appcelerator/docs-devkit/commit/44d893b))

## [0.1.5](https://github.com/appcelerator/docs-devkit/compare/v0.1.4...v0.1.5) (2019-08-07)

### Bug Fixes

* **docgen:** correctly handle array syntax in callbacks ([#3](https://github.com/appcelerator/docs-devkit/issues/3)) ([eb43ad5](https://github.com/appcelerator/docs-devkit/commit/eb43ad5))

## [0.1.4](https://github.com/appcelerator/docs-devkit/compare/v0.1.3...v0.1.4) (2019-07-30)

### Bug Fixes

* **docgen:** add missing validate command ([807f211](https://github.com/appcelerator/docs-devkit/commit/807f211))

# 0.1.0 (2019-07-27)

### Bug Fixes

* **docgen:** add missing typescript generator changes ([22d0779](https://github.com/appcelerator/docs-devkit/commit/22d0779))

### Features

* **docgen:** make it work as an independent module ([4ca640a](https://github.com/appcelerator/docs-devkit/commit/4ca640a))
* **docgen:** reference free-form text content from other files ([7eae53f](https://github.com/appcelerator/docs-devkit/commit/7eae53f))

repository: kirinnee/docs-devkit

repo_name: kirinnee/docs-devkit


text:
---
title: "Traffic Management"
date: 2018-11-13T21:49:32+09:00
weight: 50
draft: false
---

## Create the default destination rules

Deploying a microservice-based application in an Istio service mesh allows one to externally control service monitoring and tracing, request (version) routing, resiliency testing, security and policy enforcement, and more in a consistent manner across the services, and the application.

Before you can use Istio to control the Bookinfo version routing, you'll need to define the available versions, called [**subsets**](https://istio.io/docs/reference/config/networking/destination-rule/#Subset).

In a continuous deployment scenario, for a given service, there can be distinct subsets of instances running different variants of the application binary. These variants are not necessarily different API versions. They could be iterative changes to the same service, deployed in different environments (prod, staging, dev, etc.). Common scenarios where this occurs include A/B testing, canary rollouts, etc. The choice of a particular version can be decided based on various criterion (headers, url, etc.) and/or by weights assigned to each version. Each service has a default version consisting of all its instances.

```bash
kubectl -n bookinfo apply \
  -f ${HOME}/environment/istio-${ISTIO_VERSION}/samples/bookinfo/networking/destination-rule-all.yaml
```

We can display the destination rules with the following command.

```bash
kubectl -n bookinfo get destinationrules -o yaml
```

## Route traffic to one version of a service

To route to one version only, we apply virtual services that set the default version for the microservices. In this case, the virtual services will route all traffic to `reviews:v1` of the microservice.

```bash
kubectl -n bookinfo \
  apply -f ${HOME}/environment/istio-${ISTIO_VERSION}/samples/bookinfo/networking/virtual-service-all-v1.yaml
```

We can display the virtual service with the following command.

```bash
kubectl -n bookinfo get virtualservices bookinfo -o yaml
```

The subset is set to v1 for all reviews request.

{{< output >}}
spec:
  hosts:
  - reviews
  http:
  - route:
    - destination:
        host: reviews
        subset: v1
{{< /output >}}

Try now to reload the page multiple times, and note how only version 1 of reviews is displayed each time.

## Route based on user identity

Next, we'll change the route configuration so that all traffic from a specific user is routed to a specific service version.

In this case, all traffic from a user named *Jason* will be routed to the service `reviews:v2`.

```bash
kubectl -n bookinfo \
  apply -f ${HOME}/environment/istio-${ISTIO_VERSION}/samples/bookinfo/networking/virtual-service-reviews-test-v2.yaml
```

We can display the updated virtual service with the following command.

```bash
kubectl -n bookinfo get virtualservices reviews -o yaml
```

The subset is set to v1 in default and route v2 if the logged user is match with 'jason' for reviews request.

{{< output >}}
spec:
  hosts:
  - reviews
  http:
  - match:
    - headers:
        end-user:
          exact: jason
    route:
    - destination:
        host: reviews
        subset: v2
  - route:
    - destination:
        host: reviews
        subset: v1
{{< /output >}}

To test:

- Click **Sign in** from the top right corner of the page.
- Log in using **jason** as user name with a blank password.

You will only see `reviews:v2` all the time. Others will see `reviews:v1`.

## Injecting an HTTP delay fault

To test for resiliency, inject a 7s delay between the `reviews:v2` and ratings microservices for user **jason**. This test will uncover a bug that was intentionally introduced into the Bookinfo app.

```bash
kubectl -n bookinfo \
  apply -f ${HOME}/environment/istio-${ISTIO_VERSION}/samples/bookinfo/networking/virtual-service-ratings-test-delay.yaml
```

We can display the updated virtual service with the following command.

```bash
kubectl -n bookinfo get virtualservice ratings -o yaml
```

The subset is set to v1 in default and added 7s delay for all the request if the logged user is match with 'jason' for ratings.

{{< output >}}
spec:
  hosts:
  - ratings
  http:
  - fault:
      delay:
        fixedDelay: 7s
        percent: 100
    match:
    - headers:
        end-user:
          exact: jason
    route:
    - destination:
        host: ratings
        subset: v1
  - route:
    - destination:
        host: ratings
        subset: v1
{{< /output >}}

Logout, then click **Sign in** from the top right corner of the page, using **jason** as the user name with a blank password. You will see the delays and it ends up display error for reviews. Others will see reviews without error.

![istio timeout error](/images/istio/istio_bookinfo_timeout_error.png)

The timeout between the `productpage` and the reviews service is 6 seconds - coded as 3s + 1 retry for 6s total.

To test for another resiliency, we will introduce an HTTP abort to the ratings microservices for the test user jason. The page will immediately display the “*Ratings service is currently unavailable*”

```bash
kubectl -n bookinfo \
  apply -f ${HOME}/environment/istio-${ISTIO_VERSION}/samples/bookinfo/networking/virtual-service-ratings-test-abort.yaml
```

We can display the updated virtual service with the following command.

```bash
kubectl -n bookinfo get virtualservice ratings -o yaml
```

The subset is set to v1 and by default returns an error message of "Ratings service is currently unavailable" below the reviewer name if the logged username matches 'jason'.

{{< output >}}
spec:
  hosts:
  - ratings
  http:
  - fault:
      abort:
        httpStatus: 500
        percent: 100
    match:
    - headers:
        end-user:
          exact: jason
    route:
    - destination:
        host: ratings
        subset: v1
  - route:
    - destination:
        host: ratings
        subset: v1
{{< /output >}}

To test, click **Sign in** from the top right corner of the page and login using **jason** for the user name with a blank password. As **jason** you will see the error message.

![istio timeout error 2](/images/istio/istio_bookinfo_timeout_error2.png)

Others (not logged in as **jason**) will see no error message.

![istio timeout no error](/images/istio/istio_bookinfo_timeout_no_error.png)

## Traffic Shifting

Next, we'll demonstrate how to gradually migrate traffic from one version of a microservice to another. In our example, we'll send 50% of traffic to reviews:v1 and 50% to reviews:v3.

To get started, run this command to route all traffic to the v1 version of each microservice.

```bash
kubectl -n bookinfo \
  apply -f ${HOME}/environment/istio-${ISTIO_VERSION}/samples/bookinfo/networking/virtual-service-all-v1.yaml
```

Open the `Bookinfo `site in your browser. Notice that the reviews part of the page displays with no rating stars, no matter how many times you refresh.

We can now transfer 50% of the traffic from `reviews:v1` to `reviews:v3`

```bash
kubectl -n bookinfo \
  apply -f ${HOME}/environment/istio-${ISTIO_VERSION}/samples/bookinfo/networking/virtual-service-reviews-50-v3.yaml
```

```bash
kubectl -n bookinfo get virtualservice reviews -o yaml
```

The subset is set to 50% of traffic to v1 and 50% of traffic to v3 for all reviews request.

{{< output >}}
spec:
  hosts:
  - reviews
  http:
  - route:
    - destination:
        host: reviews
        subset: v1
      weight: 50
    - destination:
        host: reviews
        subset: v3
      weight: 50
{{< /output >}}

To test it, refresh your browser over and over, and you'll see only reviews:v1 and reviews:v3.

Assuming you decide tat the `reviews:v3` microservice is stable, you can route 100% of the traffic to it

```bash
kubectl -n bookinfo apply -f ${HOME}/environment/istio-${ISTIO_VERSION}/samples/bookinfo/networking/virtual-service-reviews-v3.yaml
```

Now when you refresh the `/productpage` you will always see `reviews:v3` (red colored star ratings).

repository: webbhlin/eks-workshop

branch_name: refs/heads/main

gha_language: CSS

gha_license_id: NOASSERTION

repo_name: webbhlin/eks-workshop


text:
# Lab: Class 06 - Class 09 Greed Game

## Overview
This project is a command line version of the dice game *Greed* using core Python tools and understanding of the basics of the language. The game is also known as Ten Thousand, Zilch, or Foo.

## Feature Tasks and Requirements
### Class 06 Greed Part 1
- Today is all about assessing the highest risk features and formulating a plan.
- The features we will focus on are game logic and the tracking points.
    - [x] Define a GameLogic class to calculate score for a dice roll.
        - [x] add `calculate_score` static method.
        - [x] The input to `calculate_score` is a tuple of integers that represents a dice roll.
        - [x] The output from `calculate_score` is an integer representing the roll's score according to rules of game.
        - There are a lot of rules, write tests for different "kinds" of roles
            - This will require skill in determining how many tests are enough.
            - If you tried to test every scenario the number of tests would be massive.
    - Handling rolling dice
      - [x] Add `roll_dice` static method to GameLogic class.
      - [x] The input to `roll_dice` is an integer between 1 and 6.
      - [x] The output of `roll_dice` is a tuple with random values between 1 and 6.
      - [x] The length of tuple must match the argument given to `roll_dice` method.
    - Handle banking points
      - [x] Define a Banker class
      - [x] Add a `shelf` instance method
        - [x] Input to `shelf` is the amount of points(integer) to add to shelf.
        - [x] `shelf` should temporarily store unbanked points.
      - [x] Add a `bank` instance method
        - [x] `bank` should add any points on the shelf to total and reset shelf to 0
        - [x] `bank` output should be the amount of points added to total from shelf
      - [x] Add a `clear_shelf` instance method
        - [x] `clear_shelf` should remove all unbanked points.

### Class 07 Greed Part 2
- Extend Game of Greed to get the game in a playable state.
- [x] Application should implement all features from previous version
- [x] Application should simulate rolling between 1 and 6 dice
- [x] Application should allow user to set aside dice each roll
- [x] Application should allow "banking" current score or rolling again
- [x] Application should keep track of total score
- [x] Application should keep track of current round
- [x] Application should have automated tests to ensure proper operation

### Class 08 Greed Part 3
- Extend Game of Greed to get the game in a playable state.
- [x] Should handle when cheating occurs.
- [x] Should allow user to continue rolling with 6 new dice when all dice have scored in current turn.
- [x] Handle zilch
  - No points for the round, and the round is over.

## User Acceptance Tests
- [x] Convert required features into suite of passing unit tests
  - Example Given: `test_roll`:
    - doing a roll with x number of dice should return a sequence of x length random integers between 1 and 6 inclusive.
- [x] Use an automated tool to ensure correct behavior from end user's perspective.

### Testing - Roll Dice
- [x] When rolling 1 to 6 dice ensure:
  - [x] A sequence of correct length is returned
  - [x] Each item in sequence is an integer with value between 1 and 6

### Testing - Calculate Score
- [x] `test_zilch` - non scoring roll should return 0
- [x] `test_ones` - rolls with various number of 1s should return correct score
- [x] `test_twos` - rolls with various number of 2s should return correct score
- [x] `test_threes` - rolls with various number of 3s should return correct score
- [x] `test_fours` - rolls with various number of 4s should return correct score
- [x] `test_fives` - rolls with various number of 5s should return correct score
- [x] `test_sixes` - rolls with various number of 6s should return correct score
- [x] `test_straight` - 1,2,3,4,5,6 should return correct score
- [x] `test_three_pairs` - 3 pairs should return correct score
- [x] `test_two_trios` - 2 sets of 3 should return correct score
- [x] `test_leftover_ones` - 1s not used in set of 3 (or greater) should return correct score
- [x] `test_leftover_fives` - 5s not used in set of 3 (or greater) should return correct score

### Testing - Banker
- [x] `bank` method
    - [x] should properly add *shelved* points to total and return the deposited amount.
- [x] `shelf` method
  - [x] should properly track *shelved* points
- [x] `clear_shelf` method
  - [x] should remove any *shelved* points, resetting to 0
  - [x] should not affect previously banked points.

## Dependencies
- poetry
- python
- pyenv

## Authors  / Collaborators
- Software Developer: Corey Marchand
  - [Official Github](https://github.com/corey-marchand)
- Software Developer: Haley Griffin
  - [Official Github](https://github.com/h-griffin)
- Software Developer: Joseph Lee
  - [Official Github](https://github.com/josephlee3454)
- Software Developer: Joseph Zabaleta
  - [Official Github](https://github.com/joseph-zabaleta)

## License
This project is under the MIT License.

## Acknowledgements / Resources
- Review [rules of the game](https://en.wikipedia.org/wiki/Dice_10000)
- Play game [online](http://www.playonlinedicegames.com/farkle)

## Version History
- 1.0.0 20200518 0900
  - Initial file structure built.
- 1.0.1 20200518 1230
  - Created a production branch for lab06 work day.
  - All work done in VScode LiveShare under Griffin's Computer.
  - Added key features of todays labs
- 1.0.2 20200519 1330
  - Created lab07 branch for working on next set of features.
  - Collaborated on VSCode via LiveShare.
  - Created Game Class
  - Created methods for game class to make game playable.
- 1.0.3 20200520 1230
  - Created lab08 branch for working on next set of features.
  - Collaborated on VSCode via LiveShare.
  - Created cheat_fix function
  - Created hot_dice function
  - Created Zilch function
  - All features, unit tests, and automated tests are working.

gha_language: Python


text:
# Consuming and validating GSuites Audit Push notification on AppEngine

Google Cloud's primary identity-of-record is google-based.  That is, either @gmail or gsuites logins are used in the Authentication step and is the
basis for GCP's IAM systems.

For Enterprise Gsuites-GCP customers, its  necessary to track gsuites user events such as group membership changes for individual users and possibly
apply remediations if the change is against policy.  This is quite important with GCP where IAM roles can be assigned to group and carries permissions to
resources that are assigned.  For example, if i'm the owner of a group that currently has IAM access to a resource, I can add Alice to it that unilaterally and
thereby give access.

It would be nice to have a rules-based workflow that prevents arbitrary mutating group memebership and users.  While there are tools like [Forseti Security](https://forsetisecurity.org/docs/howto/configure/gsuite-group-collection.html), it periodically scans and applies policies.  Essentially, this is polling.

WHat if we could setup webhooks for these events?

Well, you can configure GSuites to emmit activity changes to a webhook destination in response to any group/user or gsuites object mutation.  This repo is a sample GAE app which accepts audit changes on a given gsuites domain via webhook notificaiton.  The sample app also tries to independently verify the provided webhook changes by running a query againts the actual suties domain.

The steps outlined below trace setting up the webhook notificaiton for GSuites changes into a GAE (Google AppEngine) application.  The AppEngine application inturn can check the validity of the webhook call by independently making another API call ..(afater that, it can) apply GSuites polcicies if it needs to get corrected)

## Outline

The procedure here is extensive so I've provided an outline of what steps this article describes.

You need to be the Gsuites Domain Admin for this to work since we need to enable notification and registration of the webhook callback.

The overall steps described here:

* Enable webhook callback URL (Domain Verification)

* GSuites
  * Register WebHook callback URL
  * Configure API access and scope for GAE's ClientID

* Configure GAE
  * Enable "domain wide delegation" for  GAE service Account
  * Determine ClientID for GAE service account
  * Set Service Account Token IAM role to GAE's service Account

## Prerequsites

You should setup the following prior to attempting this procedure:

- Python on local workstation (with ```virtualenv```)
- Gsuites Domain Admin: you should be the GSuites domain admin.
- [WebMaster tools](https://www.google.com/webmasters/tools/home): you should have access to the WebMaster tools for the domain

## References

Some additional resources to consider:

- [Google Cloud Identity](https://support.google.com/cloudidentity/answer/7319251?hl=en)
- [Forset Security](https://forsetisecurity.org/docs/howto/configure/gsuite-group-collection.html)
- [Directory API Domain-wide Delegation](https://developers.google.com/admin-sdk/directory/v1/guides/delegation)
- [Admin SDK QuickStart](https://developers.google.com/admin-sdk/reports/v1/quickstart/python)
- [Admin SDK Push Notification](https://developers.google.com/admin-sdk/reports/v1/guides/push)
- [Admin SDK Activies Endpoint](https://developers.google.com/admin-sdk/reports/v1/reference/activities/list)
- [GSuites Domain-wide Delegation](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority)
- [Using serviceAccountActor IAM role for account impersonation](https://medium.com/google-cloud/using-serviceaccountactor-iam-role-for-account-impersonation-on-google-cloud-platform-a9e7118480ed)

---

## 1 Webhook callback

The first step is to setup the webhook callback url to a GAE endpoint.  TO do this step, you need to be the GSuites Admin and have access
to webmaster tools.  I used the same login for both in the procedure below so the flow became a lot easier.

The specs that I've registered here is:
- GCP ProjectiD: ```fabled-ray-104117```
- Push Notification URL: ```https://fabled-ray-104117.appspot.com/push```
- GSuites Domain: ```esodemoapp2.com```
- GAE Service Account<EMAIL_ADDRESS>  - Service Account ClientiD: ```101056962207198773698```

### 1.1 WebMaster tools

First step is to verify you're the domain admin and setup Web Master tools to point to an App Engine URL.  As the domain admin, goto

- [https://www.google.com/webmasters/verification/details](https://www.google.com/webmasters/verification/details)
- - or if you have the projectID: ```https://www.google.com/webmasters/verification/details?hl=en&theme=wmt&siteUrl=https://YOUR_APP_ID.appspot.com```

now Register Domain
```https://fabled-ray-104117.appspot.com/```

WMT may ask you to pick a verification mechanism.  The easiest would be to download a verificaiton file.  In the example here, my verification file is:
 -  ```google1a34ceec516c662e.html```

### 1.2 Deploy GAE application to verify domain

Now that we've got the verificaito file, we can upload it as a static file to GAE as verification.
The easiest is to deploy a test applicaiton with one modification:  set a static file handler:

So,
- download the sample 'hello-world' python GAE App here:
  - [https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/standard/hello_world](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/appengine/standard/hello_world)
- Copy the downloaded static file to the root of the ```hello-world``` application
- set a handler in ```app.yaml```:
    ```yaml
    handlers:
    - url: /google1a34ceec516c662e.html
      static_files: google1a34ceec516c662e.html
      upload: google1a34ceec516c662e.html
    ```
(ofcourse your static html file will be something different!)

- Deploy the GAE application:
  -  ```gcloud app deploy app.yaml --version 1 ```

- Click ```Verify``` in WebMaster tools.
  WMT will attempt to contact ```https://yourappID.appspot.com/yourverificaitonfile.html``` to check for that file signature

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

### 1.3 GCP Cloud Console

You need to select a GCP project to enable webhook callbacks and to deploy the GAE applicaiton.

On that project, navigate to the [Domain Verificaiton](https://console.cloud.google.com/apis/credentials/domainverification) page and register
```yourProjectID.appspot.com``` (no ```https://``` or trailing ```/```).

At this point, you should see:

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

You should also enable ```iam``` and ```appengine``` for this project:
```
$ gcloud services enable iam.googleapis.com
$ gcloud services enable appengine.googleapis.com
```

## 2 Configure Deploy GAE to make GSuites Admin API calls

Now that we've registeed the callback url, we need to configure GAE to allow it to make GSuites API calls.

### 2.1 Setup Service Account Token Creator IAM role

Normally, Google Compute Engine and AppEngine generates its own identity tokens.  This particular token has predefined and static
[scopes](https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances#changeserviceaccountandscopes) you can
set which does _NOT_ include the ones needed for GSuites [directory_v1](https://developers.google.com/apis-explorer/#search/watch/m/admin/directory_v1/directory.users.watch) or [reports_v1](https://developers.google.com/apis-explorer/#p/admin/reports_v1).  Moreover, the ```directory_v1``` requires a spcecific format for its token
that allows for delegation as described :
- [delegating authority](https://developers.google.com/api-client-library/python/auth/service-accounts#delegatingauthority)
- [directory API](https://developers.google.com/admin-sdk/directory/v1/quickstart/python)

We need to find an alternative mechanism to acquire an appropriate token from Appengine.  The specific trick we can emply here is to allow GAE's service
account to _self-delegate_ itself to mint a new token.  What?  Well, GCP allows users and other service accounts to act on its own behalf to do certain.  The specific capability we will employ here is [Service Account Token Creator](https://cloud.google.com/iam/docs/service-accounts#the_service_account_token_creator_role) which allows a service account A to impersonate B.

However, what we are doing here is allowing GAE's service account to impersonate itself. (why?)...We are doing that here since we now have the capability to
mint a **NEW** ```access_token``` for GAE that is unrestricted.  That is, we will use GAE's service account and force it to invoke [.signJWT](https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/signJwt) to get a new token.

If you are interested in this, see [Using serviceAccountActor IAM role for account impersonation on Google Cloud Platform](https://medium.com/google-cloud/using-serviceaccountactor-iam-role-for-account-impersonation-on-google-cloud-platform-a9e7118480ed)

Ok, with that background, lets set this up.

- Navigate to the GCP project hosting GAE and go to
  [IAM & Admin >> Service Account](https://console.cloud.google.com/iam-admin/serviceaccounts/project)
- Select the GAE Service account
<EMAIL_ADDRESS>- Select ```Permission``` section at the top of the screen
- In the ```Add Members``` section, paste in GAE's service account Name
- In the ```Roles``` drop-down, select ```Service Account Token Creator```
- Click Apply/Save

At this moment GAE is setup to mint new tokens for itself.

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

### 2.2 Enable Domain-wide Delegation

Select the GAE service account again and in the right-hand side options, select ```Edit``` and then check ```Enable G Suite Domain-wide Delegation ```.

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

### 2.3 GAE Service Account ClientID

Now select the ```View ClientID``` section and note down the numeric value:

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

## 3 Configure Gsuites

Now that we have setup GAE, we're ready to enable Gsuites to allow recieving API calls from GAE's ClientID.

### 3.1 Enable scope access for GAE

On the Gsuites Admin console, navigate to

```Security > Advanced Configuraiton > Manage API client access```

(```https://admin.google.com/<YOUR_APPS_DOMAIN>.com/ManageOauthClients?chromeless=1#```)

Then set the numeric ```ClientID``` and set the ClientID and scopes (ofcourse your values will be different:

- ClientID: ```101056962207198773698```
- Scopes:   https://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com/auth/admin.reports.audit.readonly

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

### 3.2 Find Gsuites CustomerID

- CustomerID: get customerID:  https://admin.google.com/<YOUR_APPS_DOMAIN>/AdminHome?fral=1#SecuritySettings:flyout=sso

- - Look for the SSO URL, it will look something like ```https://accounts.google.com/o/saml2/idp?idpid=C023zw3x8```
- - the customerID is the ```idpid``` value...in my case its ```C023zw3x8```

## 4. Register WebHook

Gsuite Admins can use the ```reports_v1``` API endpoint to setup watch requests:
- [Making Watch Requests](https://developers.google.com/admin-sdk/reports/v1/guides/push#making-watch-requests)

AFAIK, there is no UI and this needs to get setup using an API call.  This repo contains a simple discovery client
under [util/util.py](util/util.py) to help with this and invoke the

```https://developers.google.com/admin-sdk/reports/v1/reference/activities/watch``` endpoint:

To run:

```
 virtualenv env
 source env/bin/activate
 pip install -r requirements.txt  -t lib
```

Then edit ```util.py``` and set
- ```WEBHOOK_URL```
- ```WEBHOOK_ID```

values (the ID can be any uuid).

The webhook channel will expire in 6 hours (the maximum allowd channel lifetime as set by Gsuites API)
    ```WEBHOOK_EXPIRATION = str(int(round(time.time() * 1000)) + (1000 * 60 * 60 * 6))```
What that means is you need to periodically refresh this channel for continous use.

The bash script below will prompt you for a one-time login oauth2 flow and then save the credentials file in ```creds.dat```

To use this script, you first need to downlaod a ```client_secrets.json``` file from your GCP cloud project.
TO do this, goto ```APIs & Services >> Credentials```, then ```Create Credentials```, then select ```"other"```.  Save this file to the
```/util/``` folder as ```client_secrets.json```

```bash

$ python register_web_hook.py
goto the following url https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadmin.reports.audit.readonly&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=248066739582-01hpsr7fesvlg1jemhdrlej2k5an26cn.apps.googleusercontent.com&access_type=offline
Enter token:  <redacted>
```

```json
{
  "resourceUri": "https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/admin?alt=json&alt=json",
  "kind": "api#channel",
  "resourceId": "9-6O7XiWk9XykW0l0o7UTnMqL8o",
  "token": "target=channelToken",
  "expiration": "1525127664000",
  "id": "72064707-f035-4192-aeb5-badf61c3b81b"
}
```

## 5 Deploy GAE Application

Now that we've setup the webhook channel and Gsuites API access, we can now deploy the GAE app

First edit [gae_app/default.py](gae_app/default.py) and set the default values:

```
PROJECT_ID = 'fabled-ray-104117'
GAE_SVC_ACCOUNT =<EMAIL_ADDRESS>GSUITES_CUSTOMER_ID = 'C023zw3x8'
GSUITES_DOMAIN = 'esodemoapp2.com'
CREATE_DELEGATED_SUB =<EMAIL_ADDRESS>Channel_Token_value = 'target=channelToken'
Channel_Id_value = '72064707-f035-4192-aeb5-badf61c3b81b'
```

now prepare the deployment
```
cd /gae_app
virtualenv env
source env/bin/activate
pip install -r requirements.txt -t lib
deactivate
rm -rf env
```

```
gcloud app deploy app.yaml --version 1  -q
```

### 5.1 Verify GAE can use Admin API

the ```/list_users``` endpoint on the GAE app attemps to acquire an ```access_token``` and list all domain users.  Basically runs this API:

- [SDK Activities.list](https://developers.google.com/admin-sdk/reports/v1/reference/activities/list)

If you see  a list of users, then we're good:  GAE is all setup

## 6 Verify WebHook callback

Now we're ready finally, lets change add or remove a user from any group in GSuites via the Admin Console:

Once you do that, give it a couple of seconds and then check the AppEngine logs for calls to the ```/push``` endpoint.

You should see a message with a similar header and post payload as shown here:

- Headers

```json
{
  "Content_Length": "681",
  "X-Goog-Resource-Id": "9-6O7XiWk9XykW0l0o7UTnMqL8o",
  "X-Goog-Channel-Id": "72064707-f035-4192-aeb5-badf61c3b81b",
  "X-Goog-Message-Number": "2227980",
  "X-Goog-Resource-State": "REMOVE_GROUP_MEMBER",
  "X-Goog-Resource-Uri": "https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/admin?alt=json&alt=json",
  "Content-Length": "681",
  "Accept": "*/*",
  "User-Agent": "APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)",
  "Accept-Charset": "UTF-8",
  "Host": "fabled-ray-104117.appspot.com",
  "X-Goog-Channel-Expiration": "Mon, 30 Apr 2018 22:34:24 GMT",
  "Content_Type": "application/json; charset=UTF-8",
  "X-Cloud-Trace-Context": "3b1f53d217f68f8cafa689bf8c128a11/9376293703967646318;o=1",
  "X-Goog-Channel-Token": "target=channelToken",
  "Content-Type": "application/json; charset=utf-8",
  "X-Appengine-Country": "ZZ"
}
```

- Payload

```json
{
  "kind": "admin#reports#activity",
  "id": {
    "time": "2018-04-30T17:11:32.870Z",
    "uniqueQualifier": "-5978355481608895050",
    "applicationName": "admin",
    "customerId": "C023zw3x8"
  },
  "etag": "QNNojSN613EjCqWMovWbEZj8Fik/oSIWv_kUtE0OjLfs6ZtqXtpXJfk",
  "actor": {
    "callerType": "USER",
    "email"<EMAIL_ADDRESS>    "profileId": "111461344714442243090"
  },
  "ipAddress": "<IP_ADDRESS>",
  "events": [
    {
      "type": "GROUP_SETTINGS",
      "name": "REMOVE_GROUP_MEMBER",
      "parameters": [
        {
          "name": "USER_EMAIL",
          "value"<EMAIL_ADDRESS>        },
        {
          "name": "GROUP_EMAIL",
          "value"<EMAIL_ADDRESS>        }
      ]
    }
  ]
}
```

What that shows is the event that took place.

## 7 Use Reports_v1 API to verify push notification

Ok, so we' recieved an event, now lets check if we can verify that inbound request legitmate.

While, the API push carries some bits of information you can use to derive authenticity since the endpoint is unrestricted to the itnernet.
Specifically, the value of ```X-Goog-Channel-Token``` can be checked against the value you setup earlier.

As an additional check,  use the GSuites Admin API one again when we get a webhook to call the ```reports_v1``` API and attempt to recall the
specific eventID we just go.  If we can confirm that the event we got from webhook is legitmate, then we can proceed with whatever remediation we had intended
(all I do in this sample is log it).

Here is the equivalent API i call to verify:

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

The ```/push``` endpoint usually responds back with just an ```ok``` back to GCP but this script validates the request and prints a dict object detailing its
outcome incase you want to do something else with it:

for example, here is an event log on appengine for removing a user:

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

```json
[
  {
    "uniqueQualifier": "-7789345054348156904",
    "type": "GROUP_SETTINGS",
    "name": "REMOVE_GROUP_MEMBER",
    "startTime": "2018-05-02T00:37:29.139Z"
  },
  {
    "uniqueQualifier": "-7789345054348156904",
    "type": "GROUP_SETTINGS",
    "name": "REMOVE_GROUP_MEMBER",
    "startTime": "2018-05-02T00:37:29.139Z"
  }
]
```
(i'm displaying two events here since i got two parameters in the response; i really should do a different validaton check)

> NOTE: These Webhook calls may fail or get delivered multiple times.  It is highly recommend to consider this as you use this technique.

You can also persist the events to a storage system (eg BigTable, BQ etc) and then later reconcile what events you got here with what is provided by the
Gsuites [Activity Reports](https://support.google.com/a/answer/4580176?hl=en)

## Alternative push endpoints.

You dont' have to emit events from Gsuites to GAE...i just picked that here out of simplicity.

Depending on what you need, you can:
* emit events to Cloud Functions
* emit events to your own App
* webhook to GCF and remit to pubsub (to convolute even further, to Dataflow)
* many others

It'd be very nice if Gsuites can emit events directly to PubSub targets on GCP...then the major part of this article would be obsolete.

## Conclusion

Hope this procedure explains one technique to get events from Gsuite updates in more 'realtime'. As mentioned, assessing security or policy vulerabilites quick is very important and any bit faster response here helps.


text:
---
layout: default
---
# Enumeration Handling in Cougar

As mentioned when we talked about how to [define your service interface in BSIDL](Defining_Your_Service_in_BSIDL_for_Cougar.html),
parameters or simple types for which there are `validValues` elements defined are generated as Java enumerations in
the generated binding code.

However, since we do not wish the addition of a new enumerated value to instantly break all clients, the enum is generated
with an additional value of UNRECOGNIZED_VALUE which is used when the passed enumeration value is not recognised. This enum
soft failure handling is enabled by default in generated Cougar clients and disabled by default in Cougar servers.

## Configuration

You can change this behaviour by changing the following properties (varies by underlying protocol) for the client and server:

* `cougar.socket.enums.hardFailure` - defaults to `true`
* `cougar.http.enums.hardFailure` - defaults to `true`
* `cougar.client.socket.enums.hardFailure` - defaults to `false`
* `cougar.client.http.enums.hardFailure` - defaults to `false`

## Obtaining the raw value

In the case that an enumerated type is used within a more complex data type then the raw value of the enumerated type
will be available in a `raw<paramName>Value` field within that complex type. If the enumerated type is returned
directly from an operation call then it will be wrapped in an EnumWrapper in the generated client interface, from which
can be obtained the raw value.

The raw value will always contain exactly what was passed in, and so care should be taken since this is a possible source
of an injection attack.

repository: betfair/cougar-documentation

repo_name: betfair/cougar-documentation


text:
# AsposePdfCloud::WrapMode
Defines word wrapping strategies

## Enum
Name | Type | Value | Description
------------ | ------------- | ------------- | -------------
**NO_WRAP** | **String** | 'NoWrap' | No wrapping is performed
**BY_WORDS** | **String** | 'ByWords' | Word wrapping only wraps complete words. If the complete word cannot be wrapped, attempts to use discretionary hyphenation
**DISCRETIONARY_HYPHENATION** | **String** | 'DiscretionaryHyphenation' | Discretionary hyphenation is performed. Allows breaking words in the middle.

license: MIT,Ruby

repository: aspose-pdf-cloud/aspose-pdf-cloud-ruby

detected_licenses: MIT Ruby

gha_language: Ruby

repo_name: aspose-pdf-cloud/aspose-pdf-cloud-ruby


text:
- [IPLD Big Picture](./big-picture.md)
- [Nodes](./nodes.md)
	- [Node interface overview](./nodes.md#the-node-interface)
	- [Node implementation diversity](./nodes.md#node-implementations)
	- [how to use NodeBuilder](./nodes.md#using-nodebuilder)
	- [intro to typed nodes](./nodes.md#typed-nodes)
- [using the fluent API](./fluent.md)
- operationals
	- focus & paths
	- traverse & selectors
	- transform
	- constructing other operations
- storing, loading, and linking
	- encoding
		- (this covers only cbor and json builtins)
		- (brief description of how to build-your-own (either with refmt tokens or nodewalking))
	- cids are links
	- linkloader and linkbuilder
	- automatical link loading in operationals
- [IPLD Schemas](./schema.md)
	- [Goals](./schema.md#goals)
	- [Features](./schema.md#features)
	- [Implementation](./schema.md#implementation)
	- [Migration Techniques](./schema.md#schemas-and-migration)
- [Advanced Data Layouts](./advLayout.md)

---

- [Development notes: on Node implementations](./dev/node-implementations.md)

gha_language: Go


text:
# 7zip

7-Zip is a file archiver with a high compression ratio.

## Maintainers

The Habitat Maintainers<EMAIL_ADDRESS>
## Type of Package

Binary package

## Usage

Install the package and execute 7zip.

On windows, `binlink` is not supported, so you can execute directly from the package:

```
hab pkg install core/7zip
hab pkg exec core/7zip 7z --help
```

On Linux you can do the same, or binlink and use the command directly:

```
hab pkg install core/7zip --binlink
7z --help
```

## Tests

### Linux

To run tests of an already built package in a new studio instance:

```bash
source results/last_build.env
hab studio run "./7zip/tests/test.sh $pkg_ident"
```

Sample output:

```bash
➜  core-plans git:(7zip) ✗ hab studio run "./7zip/tests/test.sh $pkg_ident"
   hab-studio: Importing 'core' secret origin key
» Importing origin key from standard input
★ Imported secret origin key core-20190311142149.
   hab-studio: Importing 'core' public origin key
» Importing origin key from standard input
★ Imported public origin key core-20190311142149.
   hab-studio: Exported: HAB_ORIGIN=core
» Installing core/bats
☁ Determining latest version of core/bats in the 'stable' channel
☛ Verifying core/bats/0.4.0/20190115015448
...
✓ Installed core/bats/0.4.0/20190115015448
★ Install of core/bats/0.4.0/20190115015448 complete with 1 new packages installed.
» Binlinking bats from core/bats/0.4.0/20190115015448 into /bin
★ Binlinked bats from core/bats/0.4.0/20190115015448 to /bin/bats
» Installing core/7zip/16.02/20190513161338
☛ Verifying core/7zip/16.02/20190513161338
...
✓ Installed core/7zip/16.02/20190513161338
★ Install of core/7zip/16.02/20190513161338 complete with 1 new packages installed.
1..5
ok 1 package directory for package ident core/7zip/16.02/20190513161338 exists
ok 2 7z exe runs
ok 3 7z exe output mentions expected version 16.02
ok 4 7za exe runs
ok 5 7za exe output mentions expected version 16.02
```

### Windows

To run tests of an already built package in a new studio instance:

```powershell
. .\results\last_build.ps1
hab studio run "& ./7zip/tests/test.ps1 $pkg_ident"
```

Sample output:

```powershell
PS C:\projects\core-plans> hab studio run "& ./7zip/tests/test.ps1 $pkg_ident"

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
1      Job1            BackgroundJob   Running       True            localhost            Microsoft.PowerShell.M...
core/7zip/16.04/20190513101258
» Installing core/7zip/16.04/20190513101258
→ Using core/7zip/16.04/20190513101258
≡ Install of core/7zip/16.04/20190513101258 complete with 0 new packages installed.
Executing all tests in 'C:\projects\core-plans\7zip\tests/test.pester.ps1'

Executing script C:\projects\core-plans\7zip\tests/test.pester.ps1

  Describing The 7z bin

    Context 7z invoked without options
      [+] Runs and exits successfully 278ms
      [+] Mentions the expected version number on stdout 207ms
Tests completed in 1.03s
Tests Passed: 2, Failed: 0, Skipped: 0, Pending: 0, Inconclusive: 0

```

repository: lhasadreams/core-plans

gha_language: Shell

repo_name: lhasadreams/core-plans


text:
---
title: "Physical Medium"
date: 2021-07-09T11:01:56-07:00
definition: "A physical material or carrier. Examples include paper, canvas, or DVD."
draft: false
---

## Guidelines

Use this property to describe the medium of the original physical resource from which the digital resource was derived, if applicable.

- NOT to be used to describe the file format of a digitized or born-digital resource.
  - If a resource is born-digital, leave this property blank.

## Examples
- silver gelatin print
- microfiche
- tempera on canvas

filename: physical medium.md


text:
---
title: "Dockerized Dev Services with Vagrant"
categories: development
tags: Docker, Vagrant, Grunt, NodeJS
enableChat: false
---

![Happy Developers](https://raw.githubusercontent.com/sabhiram/public-images/master/sabhiram.github.io/docker_vagrant.png)

Lets say you are building a nifty little service, and all of a sudden you want a MongoDB instance to do some testing. Our typical work-flow will have us throw up a Mongo instance on whatever dev box we are developing on, and carefully co-ordinate when and how things are launched.

One, perhaps slightly saner approach, would be to `Dockerize` the service and run an image of the MongoDB service on your dev box. This is pretty cool because it allows us to isolate this instance of Mongo, which is much better than hammering your production DB server for some testing / bring up.

The only problem with `Docker` is that we need to ensure that the host machine is correctly configured and running the Docker daemon. This can also affect portability as Docker does not support a Windows client (yet).

Enter `Vagrant`, which allows us to define, provision and manage VMs which can in-turn consistently host our `Docker` image(s).

In this post, I will explore one such method of organization within a simple NodeJS project. This can obviously extend to just about any environment just as long as you have `Vagrant` installed on your dev box(es). I have just choosen NodeJS as my medium of expression since there are a lot of support modules to make my life easier (Grunt, et al), but the general principle will hold true for just about any language which can invoke a shell command.

### What are we trying to build?

```
+---------- Dev Box -----------\
|                              |
|  +-------- Vagrant VM -----\ |
|  |                         | |
|  |  +-- Docker Service --\ | |
|  |  |  MongoDB - 0       | | |
|  |  \--------------------/ | |
|  |                         | |
|  |  +-- Docker Service --\ | |
|  |  | Some other service | | |
|  |  \--------------------/ | |
\------------------------------/
```

The above image shows the intended nesting of our service within our dev box. First there is the dev itself. The dev box then runs a `Vagrant` VM which is capable of hosting the `Docker` daemon. Within said `Vagrant` VM, we spin up various images related to the given service.

We will discuss how to manage the spinning up of said services a bit later. First let us get some pre-requisites out of the way.

### Requirements

A dev box (I am using a Mac Book Pro running OSX 10.9 for reference).

Vagrant installed on said Dev box. Please check out [this page](https://www.vagrantup.com/downloads.html) for an up-to-date binary installer for your OS of choice.

The next few things are just so we can test our service and make sure things are working as expected. For this, we will be using `NodeJS` + `Grunt`.

To install `Grunt`, just run `npm install grunt-cli -g`.

### Sample Project Layout

Lets assume that we want to build a small NodeJS app which interfaces with an instance of MongoDB which we are trying to Dockerize within a Vagrant VM. Our folder structure would look something like this:

```
+ Parent Dir
|-- package.json
|-- Gruntfile.js
|-- server.js
|-+ services
  |-+ mongodb
    |-- Vagrantfile
    |-- Dockerfile
    |-- init.sh
```

In our parent folder we have:

| File | Usage |
| ---- | ----- |
| package.json | This just tells npm how to install / configure our application |
| Gruntfile.js | This file tells Grunt what jobs to process and automate |
| server.js | This is our simple App to talk to the MongoDB instance |
| services | This is a folder containing various services we wish to spin up |
|---- | ----- |

And within the `services\mongodb` folder we have:

| File | Usage |
| ---- | ----- |
| Vagrantfile | This tells vagrant what type of VM to spin up and how to provision it |
| Dockerfile | This describes to the Docker client, how to image and run this service |
| init.sh | A provisioning script, which will build our docker image, and run it on our fresh new VM |
|---- | ----- |

The code for the above mock project can be found here: [`dockerized-mongo-service`](https://github.com/sabhiram/dockerized-mongo-service).


text:
# Trello Calendar

### Description

### Dependencies

You must run the following to develop for trello-calendar. (If you just want to run it, the files you need are in the build folder)

`npm install`

This will install all dependencies. trello-calendar builds with [GulpJS](http://gulpjs.com/) and uses [Express](http://expressjs.com/) for its development server.
Simply run

`gulp`

to start develpment server and script combining.

repository: YourCreativePeople/trello-calendar

repo_name: YourCreativePeople/trello-calendar


text:
---
title: "Download Ek Paheli Leela (2015) Hindi Movie Bluray || 720p [1.2GB] || 1080p [2.4GB] ||"
date: "2020-05-02"
---

Download **Ek Paheli Leela** (2015) Hindi Movie in [1080p](https://1moviesflix.com/1080p-movies/), [**720p**](https://1moviesflix.com/720p-movies/) . This is a Bollywood Hindi movie and available in 1080p, 720p quality. This is a **Mystery, Romance, Thriller**  based movie. This movie is released in **2015** in the Hindi language**.** Click on the Download button below to download this movie. This is the Latest **Bluray Print** with **Hindi audio**.

**TheMoviesFlix.in** is one of the Best Websites/Platform For Bollywood and Indian Movies and Series. We also provide south movies like Tamil, Telugu and Malayalam movies, and also Bengali, Punjabi, and other local movies. We Provide Direct Fast Google Drive Download Links For Secure Downloading. Just Click On Download Button And Follow Steps To Download And Watch Movies Online For Free.

[![](https://m.media-amazon.com/images/M/MV5BMDNjODIzYTQtMjY0MC00NmJjLWE3NGQtZDExZjZhYTJhNzdkXkEyXkFqcGdeQXVyNjQ2MjQ5NzM@._V1_SX300.jpg)](https://www.imdb.com/title/tt4500734/ "Ek Paheli Leela")

Ek Paheli Leela (2015)

3.7**Rating:** 3.7 / 10 from 1,652 users**Metascore:** N/A

Two lovers, having been denied true love 300 years ago, are reincarnated in order to correct that wrong.

### Download Ek Paheli Leela 2015 1080p, 720p  – Full Hindi Movie

### Movie Info:

- **Full Name:** Ek Paheli Leela
- **Language:** Hindi
- **Release Year:** 2015
- **Size:** 1.2GB & 2.4GB
- **Quality:**  720p & 1080p
- **Format:** Mkv
- **Director:** Bobby Khan
- **Writers:** Bobby Khan
- **Stars:** Sunny Leone, Rahul Dev, Mohit Ahlawat

## Storyline:

The movie starts with Karan (Jay Bhanushali) moving to a new house in Mumbai along with his friends. Karan is a singer and musician who often helps his sister Radhika with music for her fashion shows. Radhika (Shivani Tanksale), is a fashion photographer who wants to get Meera (Sunny Leone) for her shows with the help of her friend Andy (VJ Andy). They both discover that Meera is afraid of traveling in an airplane, but take her to India by airplane by making her drink. Meera discovers the truth and gets angry. Meanwhile, her mood changes as she sees Rajasthani girls playing a traditional game and starts to play with them.

Meanwhile, in Mumbai, Karan has persistent dreams of someone whipping him. In an attempt to figure why, his friend takes him to a Pandit (Naadi palm leaf reader) who tells him that his pain is rooted in his past life.

While in India, Meera meets Ranveer Singh (Mohit Ahlawat), a Rajput prince, in Rajasthan. The two eventually fall in love and get married. Ranveer is in middle of a property dispute with his cousin Bikram Singh (Jas Arora).

* * *

* * *

.button { color: white; padding: 8px 6px; text-align: center; text-decoration: none; display: inline-block; font-size: 14px; margin: 2px 1px; -webkit-transition-duration: 0.4s; /\* Safari \*/ transition-duration: 0.4s; cursor: pointer; } .button5 { background-color: #555555; color: white; border: 1px solid #e7e7e7; border-radius: 4px; } .button5:hover { background-color: #e7e7e7; border: 2px solid #555555; color: black; }

[Join Our Telegram](http://gdrivepro.xyz/join.php) [Hollywood](https://moviesverse.com/) [AnimeFlix](https://animeflix.in/) [Download PC Games](https://gamesflix.net/)

* * *

* * *

Please Do Not Use VPN for Downloading Movies From Our Site.

Click On The Above **Download Button** to Download File.

If You Find Any Broken Link Then **Report** To Us.

**Comment** Your Queries And Requests Below In The Comment Box.

* * *


text:
## Hinduves JavaScript Sandbox

A sandbox for JavaScript expirementation and learning.

### Getting Started

At this time there is no specific recommendation on how to clone, install, and build code in the repository. Check back later for future additions as this repository matures.

### Contributing

To learn more about how you can contribute to this repoistory check out our [contribution guidlines](https://github.com/hinduves/js-sandbox/blob/master/CONTRIBUTING.md).

license: Unlicense

repository: hinduves/js-sandbox

gha_license_id: Unlicense

repo_name: hinduves/js-sandbox


text:
# Contributing to Hazelcast

> **WARNING: Minimum Node version for development is 14.14.**

Hazelcast Node.js client is Open Source software, and licensed under the [Apache 2.0. license](LICENSE).
The main benefit of Open Source is that you don't need to wait for a vendor to provide a fix or a feature.
If you've got the skills (and the will), it's already at your fingertips.

There are multiple ways to contribute:

1. [Reporting an issue](#issue-reports)
2. [Sending a pull request](#pull-requests).
Note that you don't need to be a developer to help us.
Contributions that improve the documentation are always appreciated.

If you feel yourself in need of assistance, please reach us directly via [Slack](https://slack.hazelcast.com/).
We have a separate [channel](https://hazelcastcommunity.slack.com/archives/C01PP55A667) for the Node.js client.

## Issue Reports

Thanks for reporting your issue.
To help us resolve your issue quickly and efficiently, we need as much data for diagnostics as possible.
Please share with us the following information:

1. Exact Node.js client version that you use (_e.g._ `4.1.0`).
2. Exact Hazelcast version that you use (_e.g._ `4.0.1`, also whether it is a minor release, or the latest snapshot).
3. Cluster size, _i.e._ the number of Hazelcast cluster members.
4. Number of clients.
5. Java version. It is also helpful to mention the JVM parameters.
6. Operating system. If it is Linux, kernel version is helpful.
7. Logs and stack traces, if available.
8. Detailed description of the steps to reproduce your issue.

## Pull requests

Thanks a lot for creating your <abbr title="Pull Request">PR</abbr>!

A PR can target many subjects:

* [Documentation](https://github.com/hazelcast/hazelcast-nodejs-client/blob/master/DOCUMENTATION.md):
either fix typos or improve the documentation as a whole
* Fix a bug
* Add a feature
* Add additional tests to improve the test coverage, or fix flaky tests
* Anything else that makes Node.js client better!

All PRs follow the same process:

1. Contributions are submitted, reviewed, and accepted using the PR system on GitHub.
2. For first time contributors, our bot will automatically ask you to sign the Hazelcast Contributor Agreement on the PR.
3. The latest changes are in the `master` branch.
4. Make sure to design clean commits that are easily readable.
That includes descriptive commit messages.
5. Please keep your PRs as small as possible, _i.e._ if you plan to perform a huge change,
do not submit a single and large PR for it. For an enhancement or larger feature, you can create a GitHub issue first to discuss.
6. Before you push, you can run these commands in your terminal to check if there are any errors:
    * `npm install`: Installs dependencies
    * `npm run compile`: Compiles TypeScript into JavaScript, checking for any errors along the way
    * `npm run lint`: Runs linting to find stylistic/structural errors in the code and markdown files
    * `npm run validate-user-code`: Checks the validity of generated TypeScript type declaration files
    * `npm run check-markdown-links <FILE>`: Checks for broken links in a markdown.
    Example usage: `npm run check-markdown-links DOCUMENTATION.md`
    * `npm run test:unit`: Runs unit tests against the generated JavaScript code (the generated code is in `lib/` folder)
    * `npm run test:integration`(SLOW): Runs integration tests against the generated JavaScript code
    (the generated code is in `lib/` folder)
Push your PR once it is free of errors.
7. If you submit a PR as the solution to a specific issue, please mention the issue number either in the PR description
or commit message.

repository: hazelcast/hazelcast-nodejs-client

gha_language: TypeScript

repo_name: hazelcast/hazelcast-nodejs-client


text:
---
title:  "Webpack: Paths and Naming"
date:   2017-04-22 13:42:00
category: til
tags: [webpack, javascript]
---

TIL the difference between `path` and `publicPath` in webpack, and how the `output.filename` property can be used to assign files to sub-directories in the path.

We have been using webpack's filesystem watcher at work to re-bundle our files on-save during development. I've been doing some prototyping work of our UI against a new version of an API we use, and I wanted to use `webpack-dev-server` (hereby referred to as `WDS`) to proxy requests to this new API while avoiding any cross origin request issues in the browser. Using WDS would require some retooling and rethinking of how our development process works.

To say it up front, I found setting up `WDS` to be an enormous pain: the amount of configuration necessary to set up webpack in general is intimidating, and the documentation is notoriously poor. I'll be referencing the webpack config below for the rest of this blog post. **NOTE: I am using [webpack 2][wp2]{:target="_blank"} so the config might look slightly different if you're used to webpack 1 config.**

{% gist 4d3ebacd263661aa96bdf10140aaf1b7 %}

## `path` vs. `publicPath`

The bulk of my misunderstanding came from the differences between [`path`][path]{:target="_blank"} and [`publicPath`][publicPath]{:target="_blank"} in webpack.

`path` represents the **absolute path** for webpack file output in the file system. In other words: `path` is the physical location on disk where webpack will write the bundled files.

`publicPath` represents **the path from which bundled files should be accessed by the browser.** In other words: `publicPath` is an alias for files located at `path`, and if specified, files are accessible from the `publicPath` in the browser.

In the example config above, `path` is set to `path.join(__dirname, '/build/')` in the output key. This means the files will be saved to disk at the absolute path `/Users/username/prototype/build/`.

The `publicPath` is configured to `/assets/`. This makes my bundled files accessible from `http://localhost:3000/assets/`.

I chose the public path `/assets/` because that is where we are expecting files to exist in our `index.html` page. Using `publicPath`, I can match the static resource pathnames already being requested in my `index.html`, and **I don't need to worry about adding any conditionals to load assets at different paths based on environment** (i.e. dev vs prod).

## Naming of bundled assets

I specified the name of the bundled files to be `'js/[name].min.js'` in the `output.filename` key. The code is not minified in development, but we minify for production and use the `.min.js` convention to name our minified files. By naming our bundled output with the `.min.js` postfix for development, we again don't need to perform any environment checks in our index.html file (to point to the right file names), which is great.

By prepending js/ to the filename in `output.filename`, webpack will write bundled files to a js sub-directory in the `output.path`. **This allows you to organize files of a particular type in appropriately named sub-directories.**

Webpack also honors these sub-directories at the `publicPath`: for example, the bundle named `js/bundle.min.js` above would also be available at `localhost:3000/assets/js/bundle.min.js`.

`[name]` is a webpack convention that substitutes the bundle's name in the `output.filename` when it creates a bundle. In this case, the file's name is actually 'bundle' (which is configured in the entry key) so the resulting name would be `'js/bundle.min.js'`. Webpack also honors two other substitutions during naming: `[hash]` and `[id]`

I learned a lot more about webpack while setting up the webpack dev server, including about CommonChunksPlugin for dealing with vendor bundles, ExtractTextPlugin for pulling CSS out of the main bundles and in to their own side bundles, as well as some webpack dev server lessons which I will discuss in future TILs.

[Edit: find the next post on webpack-dev-server configuration here!][next]

[wp2]: https://webpack.js.org/
[publicPath]: https://webpack.js.org/configuration/output/#output-publicpath
[path]: https://webpack.js.org/configuration/output/#output-path
[next]: /til/2017-04-23-webpack-pt-2/


text:
---
layout: posts
permalink: /projects/
author_profile: true
---

Update: (2021)

I have not been updating this page recently, so feel free to reach out to me on [LinkedIn](https://linkedin.com/in/vikramriyer) or [Twitter](https://twitter.com/vikramriyer) to know more about what I am doing and what are my interests in terms of work.

# Deep Learning
[Teach A Car To Drive Using Deep Learning](https://github.com/vikramriyer/Teach_A_Car_To_Drive_Using_Deep_Learning)

_In this project, we will use a deep neural network to teach itself to drive by watching us drive. This tasks is also referred to as behavioural cloning._

[German Traffic Sign Classifier using Keras](https://github.com/vikramriyer/Traffic_Sign_Classifier_Keras_Deep_Learning)

_Using Keras and slight modifications to LeNet, we will create a classifier that can classify between different traffic signs._

[Neural Network from Scratch using Numpy](https://github.com/vikramriyer/Neural_Network_from_Scratch_Numpy)

_Implementing a 2 layered neural network from scratch using numpy. We will use the Bike Share dataset from UCLI repository to solve a regression problem and test out neural network._

# Computer Vision for Self Driving Cars
[Finding Lane Lines Using Advanced Computer Vision](https://github.com/vikramriyer/Drive_A_Car_Using_Advanced_Computer_Vision)

_In this project, our goal is to write a software pipeline to identify the lane boundaries in a video using Gradient Color Spaces and some Perspective Transforms._

[Finding Lane Lines Using Basic Computer Vision](https://github.com/vikramriyer/Drive_A_Car_Using_Basic_Computer_Vision)

_In this project, our goal is to write a software pipeline to identify the lane boundaries in a video using Edge Detections and Hough Transforms and some Extrapolation techniques._

# Traditional Machine Learning
[Spam (binary) classification using Machine Learning](https://github.com/vikramriyer/enron_email_fraud)

_The Enron email dataset contains approximately 500,000 emails generated by employees of the Enron Corporation. It was obtained by the Federal Energy Regulatory Commission during its investigation of Enron's collapse. Our aim is to predict whether a given person is s person of interest, by using machine learning models._

# Data Analysis
[Exploratory Analysis using R](https://github.com/vikramriyer/Exploratory_Data_Analysis_with_R)

_Exploratory Data Analysis is an immensely powerful way to visualize data and head in the correct direction to make insights out of it. We will look at different ways in which data can be analyzed before its taken forward for prediction with various algorithms._

[Data Wrangling of OpenStreetMap Data](https://github.com/vikramriyer/Data_Wrangling_Cleaning_of_OpenStreetMap_using_MySQL)

_By using the data obtained from open street map, we will first clean it for some obvious errors and then dump into a mysql database to draw meaningful insights about people in a particular city; Pune, India._

[A/B Testing for Ecommerce website](https://github.com/vikramriyer/Analyze-AB-test-Results/blob/master/README.md)

_E-Commerce Website A/B testing: Recommend which of two landing pages to keep based on A/B testing to determine user engagement._

gha_language: JavaScript


text:
# mayfly-nlp
NLU Tool for Bots and AI

# Installing MITIE Java jar

You need to compile MITIE and generate Java jar dependecies, Java MITIE is like a wrapper that calls C implementation. Follow this steps:

* Install CMAKE (www.cmake.org);
* Install a BLAS Framework for better performance (I recommend Intel® Math Kernel Library);
* Clone or Download MITIE repository (https://github.com/mit-nlp/MITIE);
*

repository: fabiocmazzo/mayfly-nlp

repo_name: fabiocmazzo/mayfly-nlp


text:
# redux-persist-typed
An example of how one might approach enforcing version bumps when your Redux store changes its type signature ✅

## How to use

To understand what this demo is attempting, clone the repo, install the dependencies and run the test:

```
git clone git@github.com:Desarol/redux-persist-typed.git
npm i
npm test
```

You should see that the test passes and says it will check the version number is bumped every time the type for the RootReducer is changed.

Now update the `types.ts` file and run the test again.

```
echo "type NewType = { stuff: string }" >> types.ts
npm test
```

You should see the test fail as you will need to copy in the new MD5 hash of the file
and with that you should also bump the version number.

## Limitations

In practise, a typical implementation of Redux might have scattered type definitions across multiple files. In this case, the test should be updated to reflect which particular files the Redux reducer depends upon.

Importing a file into your `types.ts` file will cause an initial change in the hash but subsequent changes to that imported file will no longer flag as requiring a version bump! To get around this we again need to explicitly include these dependencies.

repository: Desarol/redux-persist-typed

repo_name: Desarol/redux-persist-typed


text:
## TODO
### Known bugs
* Trailing space in the form is not trimmed
* Word-wrapping works when calculating font size, not when drawing(!!!)

### For feature-completeness

* Allow to POST a yaml template, validate it, save it for later reuse
* Add a url handler for templates, not gifs
* Add a way to list and visualize templates

### Future enhancements

* Don't normalize the image
* Profile the code to speed up larger gifs

repository: lavagetto/memeoid

repo_name: lavagetto/memeoid