text:
[Source](http://dotnetcodr.com/2013/11/11/introduction-to-asymmetric-encryption-in-net-cryptography/ "Permalink to Introduction to asymmetric encryption in .NET cryptography")

# Introduction to asymmetric encryption in .NET cryptography

**Introduction**

In the previous two blog posts we looked at symmetric encryption in .NET. Recall that it's called "symmetric" as both the receiver and the sender must have access to the same public key. Asymmetric encryption differs in that it involves two complementary keys: a public key and a private key. Asymmetric algorithms are also called Public Key Cryptography.

These algorithms are up to 100-1000 times slower than symmetric ones. They are therefore often used to encrypt small size data such as a symmetric key.

We can graphically show the data flow as follows:

![Asymmetric algorithm flow][1]

If I want to send some secret data to a particular receiver then I'll need their public key. Then I'll do the encryption with that public key which creates the cipher text. When the receiver gets the cipher text they will decrypt it using their private key. So these keys come in pairs in a sense that you encrypt with one and decrypt with the other.

In .NET asymmetric algorithms are represented by the AsymmetricAlgorithm abstract base class. There are a few implementations readily available:

The most common is RSA. DSA and EXDiffieHellman are only used in conjunction with digital signatures.

**The public and private keys are inverses of each other**: a message encrypted with the public key can be decrypted with the private key. Similarly, the same message encrypted with the private key and be decrypted by the public key.

**Demo**

Open Visual Studio and create a new Console application. Insert a new class called AsymmetricAlgoService. RSA is represented by the RSACryptoServiceProvider object so we'll need to create it first for the encryption part. Insert the following method:

    private RSACryptoServiceProvider CreateCipherForEncryption()
    {
    	RSACryptoServiceProvider cipher = new RSACryptoServiceProvider();
    	cipher.FromXmlString(_rsaKeyForEncryption);
    	return cipher;
    }

…where _rsaKeyForEncryption is a private string field with some XML that we'll look at in a second.

There are several ways to generate and store the RSA keys. There's a FromXmlString method which populates the appropriate properties of the RSACryptoServiceProvider object based on an XML string. The XML string is populated from a previously exported set of RSA keys. You can also do this using the CspParameters object as follows:

    CspParameters cspParams = new CspParameters();
    cspParams.KeyContainerName = "RsaKeys";
    cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
    RSACryptoServiceProvider crypto = new RSACryptoServiceProvider(cspParams);

This will use an existing RSA protected key container called RsaKeys. If the container doesn't exist then it auto-generates one. The public-private key pair will be stored in Windows key storage, i.e. on the machine level, hence the selected flag value.

You can use the aspnet_regiis tool to generate and export RSA keys. This tool is usually located in one of these folders:

C:WindowsMicrosoft.NETFrameworkv4.0.30319
C:WindowsMicrosoft.NETFramework64v4.0.30319

Open a Command prompt and navigate to the correct folder. Insert the following command:

aspnet_regiis -pc "MyKeys" -exp

You can specify a different key container name if you want of course. If everything went well then you should see "Creating RSA Key container… Succeeded!" in the command window. The -exp flag means that the key pair can be exported. In order to export the contents of the key container to an xml file you can use the following command:

aspnet_regiis -px "MyKeys" c:tempmykeys.xml -pri

The -pri flag indicates that we want to export the private key as well. We'll only need it in our code, that's not something you want to redistribute.

Check the contents of the XML file. It will have the following elements: modulus, exponent, p, q, dp, dq, inverseq and d. Copy the modulus and exponent elements to the _rsaKeyForEncryption private field mentioned above, so the field should have the following format:

    private const string _rsaKeyForEncryption = @"<RSAKeyValue>
    	<Modulus>blahblah</Modulus>
    	<Exponent>blahblah</Exponent>
    </RSAKeyValue>";

This is the XML that you can distribute to the programmes and partners that need to send encrypted data to your application(s). You can already now create a second private field and assign the full XML to it:

    private const string _rsaKeyForDecryption = @"<RSAKeyValue>
    	<Modulus>blah</Modulus>
    	<Exponent>blah</Exponent>

blah

    	<Q>blah</Q>
    	<DP>blah</DP>
    	<DQ>blah</DQ>
    	<InverseQ>blah</InverseQ>
            <D>blah</D>
    </RSAKeyValue>";

This is only one way to create and export a valid RSA key pair. You can achieve this programmatically as well:

    public void ProgrammaticRsaKeys()
    {
    	RSACryptoServiceProvider myRSA = new RSACryptoServiceProvider();
    	RSAParameters publicKey = myRSA.ExportParameters(false);
    	string xml = myRSA.ToXmlString(true);
    }

This creates a new instance of an RSA algorithm and exports its auto-generated public key to an RSAParameters object. The 'false' parameter sent to ExportParameters method says please don't want to export the private key. Which is fine as the private key should stay by you only. The ToXmlString(true) shows the xml output including the private key. If you set that to false then the XML will only show the Modulus and Exponent elements.

The most interesting sections in the extended version of the XML string are D, Modulus and Exponent. D denotes the private key. Exponent is the short part of the public key whereas Modulus is the long part. You won't need to access the other elements in the XML string.

There's also a distinction between user-level and machine-level keys. A currently logged-on user can access the machine-level keys and those user-level ones that they have generated for themselves. When a different user logs onto the same computer then they won't have access to the user-level keys assigned to other users. However, they will still have access to the machine-level keys. Inspect the CspProviderFlags enumeration mentioned above. You'll see that it includes an option for user-level key storage. You can read more about this distinction on MSDN [here][2].

We can encrypt any string input as follows:

    public string GetCipherText(string plainText)
    {
    	RSACryptoServiceProvider cipher = CreateCipherForEncryption();
    	byte[] data = Encoding.UTF8.GetBytes(plainText);
    	byte[] cipherText = cipher.Encrypt(data, false);
    	return Convert.ToBase64String(cipherText);
    }

For decryption we'll need a cipher that reads the full XML string:

    private RSACryptoServiceProvider CreateCipherForDecryption()
    {
    	RSACryptoServiceProvider cipher = new RSACryptoServiceProvider();
    	cipher.FromXmlString(_rsaKeyForDecryption);
    	return cipher;
    }

The decryption method is the inverse of the one performing the encryption part:

    public string DecryptCipherText(string cipherText)
    {
    	RSACryptoServiceProvider cipher = CreateCipherForDecryption();
    	byte[] original = cipher.Decrypt(Convert.FromBase64String(cipherText), false);
    	return Encoding.UTF8.GetString(original);
    }

You can call these methods from Program.cs as follows:

    AsymmetricAlgoService asymmService = new AsymmetricAlgoService();
    string cipherText = asymmService.GetCipherText("Hello");
    Console.WriteLine(cipherText);
    string original = asymmService.DecryptCipherText(cipherText);
    Console.WriteLine(original);

Run the code and you should see that the translates the string back to its original value. Just for verification purposes modify the CreateCipherForDecryption() method so that the encryption XML is used instead i.e. without the private key:

    cipher.FromXmlString(_rsaKeyForEncryption);

Decryption still succeeds but a cryptographic exception will be thrown within the Decryption method saying that the key does not exist.

**Considerations**

In practice you wouldn't use RSA to encrypt and decrypt arbitrarily long strings. You can encrypt your string using a symmetric algorithm, like AES discussed [here][3] then encrypt the AES secret public key using the RSA public key. The other party will be able to decrypt the secret AES key using the RSA private key. Then using the key they'll be able to decrypt your string. We will build a model application which shows how to do this in a later post.

Often a web site needs sensitive information, such as a bank account number. Normally such data should be encrypted in some way. We could take a symmetric algorithm but if you are familiar with that approach then you know why it's not a good idea – the secret key needs to be shared between the encryption and decryption.

Instead we need to look into what asymmetric encryption has to offer. As we saw before we need to start by generating an RSA key pair and store the public key on the web server. We can share the public key with anyone who needs to send encrypted data to us. We then would need to make sure that the private key is stored safely for the decryption so that no attacker has access to it. The private key could be stored on an internal web server behind a firewall. That web server could be dedicated to data decryption. The public key would then be stored on an "open" web server which hosts your web site. That server could do the encryption and in the absence of the private key would have no possibility to decrypt even the message that it encrypted itself.

Due to the slow speed of asymmetric encryption this approach works well only with small amounts of data – use RSA directly to encrypt and decrypt that small string. As we hinted at at the end of the previous post RSA would rather be used to encrypt a symmetric key and encrypt the actual data using a symmetric algorithm. The symmetric key should be generated on the fly – it is propagated once to the requesting party and never reused. This is a better solution for encrypting and decrypting large amounts of data as symmetric algorithms are a lot faster. Asymmetric algorithms in this case provide a good way around the key-storage problem. Mixing these strategies will provide the advantages of each: speed, safe key storage, maximum message security.

However, you still need to be careful. If you want to send encrypted data to someone then you must be sure that you are encrypting using the correct public key. E.g. if the public key is printed on a blog for everyone to see then an attacker may take over that site and put his/her own public key there instead. In that case you may be sending the secret data to the attacker where they can decrypt it using their private key.

You can view the list of posts on Security and Cryptography [here][4].

### Like this:

Like Loading...

### _Related_

[1]: http://dotnetcodr.files.wordpress.com/2013/11/asymmetricflow.png?w=630
[2]: http://msdn.microsoft.com/en-us/library/f5cs0acs%28v=vs.90%29.aspx "Understanding Machine-Level and User-Level RSA Key Containers"
[3]: http://dotnetcodr.com/2013/11/04/symmetric-encryption-algorithms-in-net-cryptography-part-1/ "Symmetric encryption algorithms in .NET cryptography part 1"
[4]: http://dotnetcodr.com/security-and-cryptography/ "Security and cryptography"

repository: forcewake/articles-for-translation

repo_name: forcewake/articles-for-translation


text:
---
title: Setting in php.ini
tags: [ontowiki, install]
sidebar: ontowiki_sidebar
permalink: /php.html
editme_path: ontowiki/php.ini-recommendations.md
---

You should set up your PHP environment with the following settings in php.ini:

  * `max_execution_time = 120`
  * `memory_limit = 128M`
  * `upload_max_filesize = 16M ; depending on the size of knowledge bases you plan to use`
  * `post_max_size = 16M`
  * `short_open_tag = Off`; if you have this turned on, some features will not work (especially `<?xml` will cause trouble)

To get rid of strict warnings, set the default timezone for your server, e.g.

  * `date.timezone=Europe/Berlin`

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: CSS

gha_license_id: MIT

license_type: permissive


text:
# fast-cache
Simple caching system for PHP applications.

## Installing
Use the following command to install via Composer:
```
composer require lluiscamino/fast-cache
```

## Usage
```php
$cache = new FastCache(21600); // Cache lifetime in seconds
$cache->start();
echo "Hola!"; // Display content
$cache->end();
```

Once a user visits your website for the first time, a cached version of the page will be created and served for the following requests in the specified time.

If for some reason you don't want the current content to be saved, you can finish with `$cache->end(false);` and the content will not be cached.

Apart from time, you can also specify two more parameters in the constructor:
```php
__construct(int $time, string $file = null, string $dir = '')
```
* `string $file`: Name of the (file.php) that identifies the page being cached. Use this option to create different cached versions of the same page. Leave blank to automatically select the file from which the object is being created.
* `string $dir`: Subdirectory where the cache file of the page will be saved.

### Configuration
```php
FastCache::$path = 'custom-dir'; // Cache files directory
FastCache::$announce = false; // Disable "Serving cached file fromServing cached file from..." comment
```

repository: lluiscamino/fast-cache

repo_name: lluiscamino/fast-cache


text:
A-Priory
========

_A project for master studies at ITESM_

[TO DO](todo.md)

Uses [WekaData](https://github.com/fehu/min-dat--weka-data) project.

---

References:
 - [Fast Algorithms for Mining Association Rules](http://rakesh.agrawal-family.com/papers/vldb94apriori.pdf)

repository: fehu/min-dat--a-priori

repo_name: fehu/min-dat--a-priori


text:
# Transaction API

The Transaction API is used to perform interactions at point of sale with the Yoyo platform. It is typically used by retailers EPOS devices.

Documentation is not publicly available

repository: yoyowallet/slate

gha_language: JavaScript

gha_license_id: NOASSERTION

repo_name: yoyowallet/slate


text:
---
title: |
    817. Our Exiled Fathers - Christ in Song
metadata:
    description: |
        Christ in Song 817. Our Exiled Fathers. O God, beneath thy guiding hand, Our exiled fathers cross the sea; And when they trod the wintry strand, With pray'r and psalm they worshiped thee.
    keywords:  |
        Christ in Song, adventhymnals, advent hymnals, Our Exiled Fathers, O God, beneath thy guiding hand.
    author: Brian Onang'o
---

#### Advent Hymnals
## 817. OUR EXILED FATHERS
####  Christ in Song,

```txt
1.
O God, beneath thy guiding hand,
Our exiled fathers cross the sea;
And when they trod the wintry strand,
With pray'r and psalm they worshiped thee.

2.
Truth, freedom, justice, faith in God,
Came with those exiles o'er the waves;
And where their pilgrim feet have trod,
The God they trusted guards their graves.

3.
And here thy name, O God of love,
May we, their children, still adorn,
Till these eternal hills remove,
And spring adorns the earth no more.

```

- |   -  |
-------------|------------|
Title | Our Exiled Fathers |
Key | F Major |
Titles | undefined |
First Line | O God, beneath thy guiding hand |
Author | Rev. Leonard Bacon
Year | 1908
Composer| undefined |
Hymnal|  - |
Tune| HAMBURG |
Metrical pattern | |
# Stanzas |  |
Chorus |  |
Chorus Type |  |
Subjects | Living His Life: Loyalty to Christ |
Texts | undefined |
Print Texts |
Scripture Song |  |

repository: GospelSounders/adventhymnals

repo_name: GospelSounders/adventhymnals


text:
# Milvus Code Review Guide

All PRs are checked in automatically by the sre-robot, with the following conditions:

1. DCO check passed
2. All test passed and code coverage check passed, with a `ci-passed` label
   - Notes: If there is a `[skip e2e]` tag in the commit message, it skips running e2e tests automatically,
     but it still runs UT tests and code checkers.
3. Reviewer passed, with a `/lgtm` label
4. Approver passed, with a `/approve` label

Generally speaking, reviewer is volunteered and can be anyone in the community who is familiar with the packages the PR modifies.
Reviewers are responsible for the logic correctness, error handling, unit test coverage and code readability.
While Approver focuses on overall design, code readability, and ensuring the PR follows code of
conduct(Such as meaningful title and commit message, marked with correct labels, meaningful comments). Currently,
all Approvers are listed under OWNERS_ALIASES file.

## Things to do before review

- Read the title, commit message and related issue of the PR, if it's not easy to understand, ask for improvement

- For a bug fix PR, there should be a detailed bug description in related issue, and make sure the test cases to cover this bug.

- For a function enhancement PR, understand the function use case, make sure the functionality is reasonable.

- For a performance PR, make sure benchmark result is listed in PR.

- Think deeply about why is the solution necessary, any workaround or substitutions?

## Things to check during the review

- Does the code follow style guide?

- Does the code do exactly the same as title and commit message describe?

- Can this function and variable's behavior be inferred by its name?

- Do unit tests cover all the important code branches?

- What about the edge cases and failure handling paths?

- Do we need better layering and abstraction?

- Are there enough comments to understand the intent of the code?

- Are hacks, workarounds and temporary fixes commented?

- If `[skip e2e]` is tagged, is it safe enough to skip running e2e tests?
  - Notes: it skips running e2e tests, if there is a `[skip e2e]` in the commit message.
- Does the code will generate similar logs many times in one second?

## Things to keep in mind when you are writing a review comment

- Be kind to the coder, not to the code.

- Ask questions rather than make statements.

- Treat people who know less than you with respect, deference, and patience.

- Remember to praise when the code quality exceeds your expectation.

- It isn't necessarily wrong if the coder's solution is different with yours.

- Community is not only about the product, it is about person. Help others to improve whenever possible.

## For Approvers

Besides All the reviewer's responsibility listed above, Approvers should also maintain code of conduct.

- Be sure the pr has only one commit, author has to do a squash commit in local REPO

- Commit message starts with a capital letter and does not end with punctuation

- Commit message is clear and meaningful. You can only have title without body if the title is self explained

- PR links to the correct issue, which clearly states the problems to be solved and the planned solution

- PR sets kind label

- The variable names appearing in the source code need to be readable. Comments are necessary if it is an unusual abbreviations

Thanks for [Code Review Guide](https://github.com/pingcap/tidb/blob/master/code_review_guide.md) from Pingcap community.

repository: milvus-io/milvus

gha_language: Go

repo_name: milvus-io/milvus


text:
---
title: "Leetcode: Out of Boundary Paths: Dynamic Programming Solution"
categories:
  - Java
  - leetcode
  - data structure
  - algorithms

tags:
  - dynamic programming
  - depth-first-search
  - DFS
---

## Problem Description

Problem definition is taken from leetcode.
- [Out of Boundary Paths](https://leetcode.com/problems/out-of-boundary-paths/ "Go to leetcode"){:target="_blank" rel="noopener"}

> There is an m by n grid with a ball. Given the start coordinate (i,j) of the ball, you can move the ball to adjacent cell or cross the grid boundary in four directions (up, down, left, right). However, you can at most move N times. Find out the number of paths to move the ball out of grid boundary. The answer may be very large, return it after mod 109 + 7.

Recursive solution is given at [Recursive Solution]({{ site.baseurl }}{% post_url 2020-10-23-leetcode-out-of-boundary-paths-recursive %})

## Solution

If a position is reachable at c moves, then neighbour positions can be reached in c+1 moves. If we keep an (mxn) array where each cell at step c contains number of paths ending in the cell, we can calculate number of paths the neighbour cells have at step c+1.

Two such mxn arrays is used. dp keeps number of paths for each cell at step c. dpNext keeps number of paths for each cell at step c+1. After dpNext is filled, dp and dpNext is swapped and dpNext is reset.

## Implementation

```java
class Solution {
	final int base = (int) Math.pow(10,9)+7;

    public int findPaths(int m, int n, int N, int i, int j) {
		return findPathsDp(m, n, N, i, j);
	}

    public int findPathsDp(int m, int n, int N, int i, int j){
        int[][] dp = new int[m][n];

        dp[i][j]=1;
        int c=1;
        int count=0;
        while(c++<=N){
            int[][] dpNext = new int[m][n];
            for(int ic=0;ic<m;ic++){
                for(int jc=0;jc<n;jc++){

                    if(ic==0){
                        count+=dp[ic][jc];
                        count = count % base;
                    }

                    if(jc==0){
                        count+=dp[ic][jc];
                        count = count % base;
                    }

                    if(ic==m-1){
                        count+=dp[ic][jc];
                        count = count % base;
                    }

                    if(jc==n-1){
                        count+=dp[ic][jc];
                        count = count % base;
                    }

                    if(ic>0){
                        dpNext[ic][jc]+=dp[ic-1][jc];
                        dpNext[ic][jc]=dpNext[ic][jc] % base;
                    }

                    if(jc>0){
                        dpNext[ic][jc]+=dp[ic][jc-1];
                        dpNext[ic][jc]=dpNext[ic][jc] % base;
                    }

                    if(ic<m-1){
                        dpNext[ic][jc]+=dp[ic+1][jc];
                        dpNext[ic][jc]=dpNext[ic][jc] % base;
                    }

                    if(jc<n-1){
                        dpNext[ic][jc]+=dp[ic][jc+1];
                        dpNext[ic][jc]=dpNext[ic][jc] % base;
                    }

                }
            }

            dp=dpNext;
        }

        return count;
    }
}
```

## Complexity

dp array is mxn thus space complexity is O(mn).
Time complexity is O(Nxmxn). dp array is filled N times.

repository: habanoz/habanoz-tech-blog

repo_name: habanoz/habanoz-tech-blog


text:
# jsondiff [![wercker status](https://app.wercker.com/status/cf6fb86dc49eadcac25f466f8df9d05b/s/master "wercker status")](https://app.wercker.com/project/byKey/cf6fb86dc49eadcac25f466f8df9d05b) [![GoDoc](https://godoc.org/github.com/Cside/jsondiff?status.svg)](http://godoc.org/github.com/Cside/jsondiff)

Reports differences between two JSONs

## Example

```go
import (
	"testing"
	"github.com/Cside/jsondiff"
)

a := []byte(`{ "foo":1, "bar":2 }`)
b := []byte(`{ "foo":1, "bar":3 }`)

if diff := jsondiff.Diff(a, b); diff != "" {
	t.Errorf("two jsons are not equal. diff:\n%s", diff)
}
```

output:

```
=== RUN   TestMain
--- FAIL: TestMain (0.00s)
        main_test.go:14: two jsons are not equal. diff:
                  {
                -   "bar": 2,
                +   "bar": 3,
                    "foo": 1
                  }
FAIL
exit status 1
```

## Ignore values

You can ignore some values with specifiying `diffopts.IgnorePath(paths []string)` option.

Target values can be specified with [JSON Pointer](https://tools.ietf.org/html/rfc6901) .

The following test passes.

```go
import (
	"testing"
	"github.com/Cside/jsondiff"
	"github.com/Cside/jsondiff/diffopts"
)

a := []byte(`{ "foo": 1, "createdAt":<PHONE_NUMBER> }`)
b := []byte(`{ "foo": 1, "createdAt":<PHONE_NUMBER> }`)

if diff := jsondiff.Diff(a, b, diffopts.IgnorePaths([]string{"/createdAt"})); diff != "" {
	t.Errorf("two jsons are not equal. diff:\n%s", diff)
}
```

## License

[The MIT License](/LICENSE).

repository: Cside/jsondiff

repo_name: Cside/jsondiff


text:
---
severity: Important
pillar: Security
category: Data protection
resource: API Management
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.APIM.HTTPEndpoint/
---

# Publish APIs through HTTPS connections

## SYNOPSIS

Enforce HTTPS for communication to API clients.

## DESCRIPTION

When an client connects to API Management it can use HTTP or HTTPS.
Each API can be configured to accept connection for HTTP and/ or HTTPS.
When using HTTP, sensitive information may be exposed to an untrusted party.

## RECOMMENDATION

Consider setting the each API to only accept HTTPS connections.
In the portal, this is done by configuring the HTTPS URL scheme.

## LINKS

- [Data encryption in Azure](https://learn.microsoft.com/azure/architecture/framework/security/design-storage-encryption#data-in-transit)
- [Import and publish a back-end API](https://docs.microsoft.com/azure/api-management/import-api-from-oas#-import-and-publish-a-back-end-api)

branch_name: refs/heads/main

gha_language: PowerShell


text:
# geojson-trim-network
Given a GeoJSON LineString network and a Location object, remove unused network areas.

# What?

When given a list of all possible origin / destination locations, trim areas of network that would not logically be traveled.

(A naive approach that only trims with 100% certainty, does not yet take into account segment weight).

## Install

```
npm install geojson-trim-network --save
```

## Usage

```
const fs = require('fs').promises;
const trimNetwork = require('geojson-trim-network');

main();

async function main() {

    const geojson_raw = await fs.readFile('./file.geojson');

    const geojson = JSON.parse(geojson_raw);

    const locations = {
                    "10001": {
                      "lat": 40.7506364,
                      "lng": -73.9971766
                    },
                    "10002": {
                      "lat": 40.7157758,
                      "lng": -73.9862109
                    }
                  };

    const lookup = trimNetwork(geojson, locations);

    // similar geojson network (with fewer segments) is returned

}

```

repository: royhobbstn/geojson-trim-network

repo_name: royhobbstn/geojson-trim-network


text:
## Expected Behavior
What you want

## Actual Behavior
What it does

## Environment details (OS, Python/package versions, any other hardware)
-
-

## Steps to reproduce
1.
2.

gha_language: Python


text:
# Zeppelin Solidity
Zeppelin is a library for writing secure Smart Contracts on Ethereum.

With Zeppelin, you can build distributed applications, protocols and organizations:
- using common contract security patterns (See [Onward with Ethereum Smart Contract Security](https://medium.com/bitcorps-blog/onward-with-ethereum-smart-contract-security-97a827e47702#.y3kvdetbz))
- in the Solidity language.

## Getting Started

Zeppelin integrates with [Truffle](https://github.com/ConsenSys/truffle), an Ethereum development environment. Please [install Truffle](https://github.com/ConsenSys/truffle#install) and initialize your project with `truffle init`.
```sh
sudo npm install -g truffle
mkdir myproject && cd myproject
truffle init
```

To install the Zeppelin library, run:
```sh
npm i zeppelin-solidity
```

After that, you'll get all the library's contracts in the `contracts/zeppelin` folder. You can use the contracts in the library like so:

```js
import "./zeppelin/Rejector.sol";

contract MetaCoin is Rejector {
  ...
}
```

> NOTE: The current distribution channel is npm, which is not ideal. [We're looking into providing a better tool for code distribution](https://github.com/OpenZeppelin/zeppelin-solidity/issues/13), and ideas are welcome.

#### Truffle Beta Support
We also support Truffle Beta npm integration. If you're using Truffle Beta, the contracts in `node_modules` will be enough, so feel free to delete the copies at your `contracts` folder. If you're using Truffle Beta, you can use Zeppelin contracts like so:

```js
import "zeppelin-solidity/contracts/Rejector.sol";

contract MetaCoin is Rejector {
  ...
}
```

For more info see [the Truffle Beta package management tutorial](http://truffleframework.com/tutorials/package-management).

## Security
Zeppelin is meant to provide secure, tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions.

If you find a security issue, please email [security@openzeppelin.org](mailto:security@openzeppelin.org).

## Developer Resources

Building a distributed application, protocol or organization with Zeppelin?

- Ask for help and follow progress at: https://zeppelin-slackin.herokuapp.com/

Interested in contributing to Zeppelin?

- Framework proposal and roadmap: https://medium.com/zeppelin-blog/zeppelin-framework-proposal-and-development-roadmap-fdfa9a3a32ab#.iain47pak
- Issue tracker: https://github.com/OpenZeppelin/zeppelin-solidity/issues
- Contribution guidelines: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/CONTRIBUTING.md

## Projects using Zeppelin
- [Blockparty](https://github.com/makoto/blockparty)

## Contracts
TODO

## License
Code released under the [MIT License](https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/LICENSE).

repository: gleim/zep-solidity

repo_name: gleim/zep-solidity


text:
# openshift-image-promote-ansible-module

This module was originally part of https://github.com/rht-labs/ansible-stacks, but it is no longer used there, so it's been spun out to it's own thing. The idea was to have an ansible module that could move images between projects, right now only with `oc tag`. Sometimes this requires you to what for the image to be built, so the module will poll at defined defaults.

# Running and Writing Units Tests

**The unit tests have the following expectations:**

* `oc` is installed on the host where the tests are running
* `oc login` has been performed with a user that can create projects and objects in those projects
* [pytest is installed](http://doc.pytest.org/en/latest/getting-started.html)
* each unit test cleans up after itself. due to async deletes in OpenShift, you may need to pause between test executions so the cluster can finish deleting resources before you try to recreate them in the test.

**To the run the tests:**
```
$ pytest tests/units
```


text:
![Laravel Crud Generator](https://banners.beyondco.de/Laravel%20CRUD.png?theme=dark&packageManager=composer+require&packageName=ibex%2Fcrud-generator&pattern=architect&style=style_1&description=Laravel+CRUD+Generator&md=1&showWatermark=0&fontSize=100px&images=gift)

![Packagist](https://img.shields.io/badge/Packagist-v1.3.2-green.svg?style=flat-square)
![Licence](https://img.shields.io/badge/Licence-MIT-green.svg?style=flat-square)
![StyleCI](https://img.shields.io/badge/StyleCI-pass-green.svg?style=flat-square)

This Laravel Generator package provides and generate Controller, Model (with eloquent relations) and Views in **Bootstrap** for your development of your applications with single command.

- Will create **Model** with Eloquent relations
- Will create **Controller** with all resources
- Will create **views** in Bootstrap

## Requirements
    Laravel >= 5.5
    PHP >= 7.1

## Installation
1 - Install
```
composer require ibex/crud-generator --dev
```
2- Publish the default package's config
```
php artisan vendor:publish --tag=crud
```

## Usage
```
php artisan make:crud {table_name}

php artisan make:crud banks
```

Add a route in `web.php`
```
Route::resource('banks', 'BankController');
```
Route name in plural slug case.

#### Options
 - Custom Route
```
php artisan make:crud {table_name} --route={route_name}
```

## Example

*Model*
![Model](https://i.imgur.com/zTSoYvJ.png)

*Controller*
![Controller](https://i.imgur.com/G1ytmcL.png)

*Listing*
![Listing](https://i.imgur.com/UH5XGuw.png)

*Form*
![Form](https://i.imgur.com/poRiZRO.png)

## Author

M Awais // [Email<EMAIL_ADDRESS>
[Buy me a Coffee](https://ko-fi.com/C0C8VT1M)

[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/C0C8VT1M)

repository: awais-vteams/laravel-crud-generator

gha_language: PHP

repo_name: awais-vteams/laravel-crud-generator


text:
---
layout: default
---

# 1995-01-12 - Re: CBS/C.Chung Plan Hit Job on Internet? (fwd)

## Header Data

From: Thomas Grant Edwards<EMAIL_ADDRESS>To: Brad Parsons<EMAIL_ADDRESS>Message Hash: 3bc1357f56dad27a8dc1ae3623266bec149b290c9744f70b8adde56b6cfcda65

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1995-01-12 14:20:29 UTC

Raw Date: Thu, 12 Jan 95 06:20:29 PST

## Raw message

```
{% raw  %}From: Thomas Grant Edwards<EMAIL_ADDRESS>Date: Thu, 12 Jan 95 06:20:29 PST
To: Brad Parsons<EMAIL_ADDRESS>Subject: Re: CBS/C.Chung Plan Hit Job on Internet? (fwd)
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

On Thu, 12 Jan 1995, Brad Parsons wrote:

> From: Skip Leuschner<EMAIL_ADDRESS>
> I see C.Chung's program as one of the first vollies in a new phase of a
> TV/print media project.

> Internet and talk radio emerged as political forces in the '94
> election.  If political influence by the media is a zero-sum game, as I
> believe it is, then the TV and print media must look to their own
> survival by trying to discredit or regulate their talk radio/internet
> competition.

Clearly.  I think Time magazine, as they come onto the Internet, is
realizing that the culture here does not take well to bogus and
misleading journalism.  The Time reporter who wrote the article on the
modern militia movement in the US asked on talk.politics.guns what people
thought about his article - oh my, you've never seen such a flamefest!
Not to mention the immense amount of pro-firearm opinions on the Time WWW
talkback area.  For a magazine which has publically announced that they
are anti-RKBA, I think they are viewing all of this with some dismay.

That is only a single issue - I think as more standard media groups come
on-line, they will have to choose either to try to destroy the net
through demonizing it, or change with it into an adaptive reporting
system with traditional journalistic ethics.

-Thomas

{% endraw %}
```

## Thread

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

+ Return to "[Brad Parsons <parsons@bga.com>](/authors/brad_parsons_parsons_at_bga_com_)"
+ Return to "[Thomas Grant Edwards <tedwards@src.umd.edu>](/authors/thomas_grant_edwards_tedwards_at_src_umd_edu_)"

+ 1995-01-12 (Thu, 12 Jan 95 03:52:29 PST) - [Re: CBS/C.Chung Plan Hit Job on Internet? (fwd)](/archive/1995/01/a5a7f24001b41141a6dd92308b284047c978771cd2d33c9b6113f2b1e10cc3ff) - _Brad Parsons<EMAIL_ADDRESS>  + 1995-01-12 (Thu, 12 Jan 95 06:20:29 PST) - Re: CBS/C.Chung Plan Hit Job on Internet? (fwd) - _Thomas Grant Edwards<EMAIL_ADDRESS>


text:
Bullet Train PHP sample
================================================================

An example of a project to take as a proof of concept that helps to integrate the [Bullet Train API](https://github.com/SolidStateGroup/bullet-train-api) with PHP.

This project does not aim to cover best practices for PHP project development as a whole. For example, it does not provide an exhaustive documentation, or unit tests.

However, it provides a good foundation for integrating your developments under the continuous deployment approach, including the implementation of feature flags via [Bullet Train](https://bullet-train.io).

## Getting started

You'll need [docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/).

To work properly, Bullet Train requires a Google Analytics account. For testing purposes, I abandoned this feature by injecting a workaround into the API.

Do not use this in production !

- Create an organization, a project and finally 2 feature flags:

|    ID   |   Description   |    Enabled  |
|---------|-----------------|-------------|
|  login  |  Login feature  | your choice |
| nice_ui | Nice UI feature | your choice |

- Get the environment key for this project (see the `environmentID` value in the `Code example: 2: Initialising your project` section) and save it as your API_KEY in a conf/client.local.php

- Go back to [http://localhost:8080/](http://localhost:8080) and enjoy switching features in [Bullet Train [http://localhost:8082]](http://localhost:8082/).

## Go further

Three fake accounts are available for testing purposes, so you can go further activating features for some users only with Segments and User Traits.

| Login | Password |
|-------|----------|
| callisto | fake1 |
| ganymede | fake2 |
| europa   | fake3 |

repository: joogoo/bullet-train-php-sample

repo_name: joogoo/bullet-train-php-sample


text:
Monitory
=============
[![CircleCI][circleci]][circleci-url]
[![npm][npm]][npm-url]

This project is intended to be a small helper framework for creating dashboards to be used in team areas.
You as a user just need to define two things:
* jobs: node processes, that fetches your data and emits events to the frontend
* dashboards: react components, that subscribes to emitted jobs and show the data.

![Sample 1](docs/screen1.png?raw=true)

![Sample 2](docs/screen2.png?raw=true)

Disclaimer
------------
This is an early version, not so far away from being usable but breaking changes can still occur.

User Manual
===========
Folder Structure
----------------

The default folder structure looks like this:
```
index.js
package.json
dashboards/
├── dashboard1.js
├── dashboard2.js
└── ....
jobs/
├── job1.js
├── job2.js
└── ....
assets/
├── icon.svg
├── foo.jpg
└── ....
```

To start monitory, create an index.js file with the following content
```javascript 1.8
const monitory = require('monitory');

monitory.start();
```
and let it run with `node index.js`. It can be configured as well, the properties and default values are:
```javascript
monitory.start({
  port: 1337,
  dashboards: `${__dirname}/dashboards/*`, //glob for dashboard files
  jobs: `${__dirname}/jobs/*`, //glob for job definition files
  jobsParallelism: Number.MAX_SAFE_INTEGER, // defines how many jobs are executed in parallel
  jsAssetsDir: `${__dirname}/dist`, // path where to serve js assets from
  additionalAssetsDir: `${__dirname}/assets`,// path where to serve additional assets (like soundfiles, icons) from
  startServer: true, // if the script should start the monitory server
  compileAssets: true, //define if the assets should be compiled
  onInit: (server) => {}, // called right after the hapi plugins are initialized, is called with the hapi server instance
  onBeforeStart: (server) => {}// called right before the hapi server is started, is called with the hapi server instance
});
```

If you want to see a full example, go to the example folder in this project.

For windows users: Please use forward slashes for globs as well. The used library uses this as default and maps to the windows file separator (see https://www.npmjs.com/package/glob#windows)

Jobs
------
Jobs are the main processing unit for your data crawling. A job file just exports a map with following values:

**id (string)**
The id of the job to which frontend components can subscribe to.

**interval (number)**
Define the interval, at which the job will be executed. (cannot be applied at the same time with `cron`)

**cron (string)**
Define a cron job at which the job will be executed (cannot be applied at the same time with `interval`)
Under the hood it is using https://www.npmjs.com/package/cron where you can find some nice example here https://github.com/kelektiv/node-cron/tree/master/examples

**job (func)**
A function that defines the job. Do your crawling logic inside here. You can return a value, a promise or even use an async function.

**Example:**
```javascript 1.8
 module.exports = {
  id: 'myJobId2',//
  interval: 5000, // ms
  job: function(){
    return Math.round(Math.random() * 1000)
  }
}

```
```javascript 1.8
 module.exports = {
  id: 'myJobId2',//
  cron: '0/30 * * * * *', //every 30 seconds
  job: function(){
    return Math.round(Math.random() * 1000)
  }
}

```

It is also possible to return and array of jobs in one file, e.g.:

```javascript 1.8
module.exports = [{
  id: 'myJobId2',//
  interval: 5000, // ms
  job: function () {
    return Math.round(Math.random() * 1000)
  }
}, {
  id: 'myJobId2',//
  interval: 5000, // ms
  job: function () {
    return Math.round(Math.random() * 1000)
  },
}];

```

### Clients
There are some clients provided, that helps you fetching data from common sources such as:

#### Teamcity Client
```javascript
const { teamcityClient } = require('monitory')
const client = teamcityClient.create({ url: 'https://teamcity.jetbrains.com' });
```
Provides a method for retrieving failed jobs.
* `client.getFailedJobsFor(<Array of Teamcity Project Ids>)`: Returns an array of the format
  * `name` Job Name with parent project information separated by '/'
  * `assignee`If somebody clicks assign in teamcity, the buildstep will be marked as assigned on the monitor.
 ```
 [{name: <build name>, assignee:<Name of the teamcity user>},...]
 ```

#### ELK Client
```javascript
const { elkClient } = require('monitory');
const client = elkClient.create({ url: 'https://elk.url', alias:'foo' });
```
With the methods:
* `client.getCountFor(queryString,timeSpan)`: Returns the number of hits
  * `queryString` The ElasticSearch querystring you want to count
  * `timespan=now-1h` Date math timespan (see https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math)
* `client.getHistogramFor(queryString,timeSpan=now-1h, interval=30s)`: Returns a series of hits
  * `queryString` The ElasticSearch querystring you want to count
  * `timespan` Date math timespan (see https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math)
  * `interval` duration of "one step" in the time series.

#### Graphite Client
```javascript
const { graphiteClient } = require('monitory');
const client = graphiteClient.create({ url: 'https://elk.url', alias:'foo' });
```
With the methods:
* `client.getHistogramFor(target,from=2h,until=now)`: Returns series of hits
  * `target` graphite target
  * `from` At which point in time it should start
  * `until` At which point in time it should stop

Dashboards
------------
For now, there are some components defined which makes your life easier. You can import them from `monitory/frontend`/
Do not forget to import React! This is needed for jsx transpiling.

An example dashboard with an empty card could look like this:
```javascript 1.7
import React from 'react';
import { Card, Dashboard } from 'monitory/frontend';

export default function () {
  return (
    <Dashboard cols={2} title="Basic Dashboard">
      <Card
        job="myJobId2"
        title="Basic Tile"
      />
    </Dashboard>
  );
}

```

### Developing
When you develop locally, consider setting this environment variable:
```bash
export MONITORY_DEBUG=true
```
This will start webpack in debug mode and dramatically decrease compile time and increase development speed.
Also webpack watch mode will be enabled, which will recompile your dashboards when you change them.

### Dashboard

The basic unit, used as a Wrapper for Cards. It has some layout options:

**cols (number) = 4**
Number that indicates how many columns you want to have in your dashboard.

**rowHeight (number) = 200px**
Define the height of the rows, internally it will set the `grid-auto-rows` options, so you can provide a space separated list
to set the height of rows individually. (e.g. `rowHeight="200px 100px 350px"`)

**title (String)**
If you want to group your dashboards, you can add a title to them.

### Base

All widgets have these properties

**title (string)**
Title to show on the card

**showWhen (function(data, viewValue):Boolean)**
When you only want to show the component when some conditions are met, you can use this hook.
It is called with the current value provided by the job and the derived one provided by value prop.

**color (function(data, viewValue):string | string)**
Define the background color of the card. You can either define it as a String or as a function to return a fitting color.
The font is calculated accordingly (either black or white).

**alert (function(data, viewValue):boolean | boolean)**
Boolean that adds a pulse animation to the card, indicating that the team should focus attention.

**playAudioWhen (function(data, viewValue):string)**
Define a function, which calculates on the current data, if a sound should be played. The logic behaves like this:

You have to return a path, which points to a soundfile. The function is called maybe multiple times but the sound file is only played once.
If the path to the sound file changes and you return another sound file path (or null), then it will play the returned other sound file (or nothing).
When you return the first sound file again, the logic starts over.
Pro-Tip: You can place the sound file in the assets folder that is reachable under `/assets/<your file>`

**rows (function(data, viewValue):Number|Number)**
Define the row span of the card

**cols (function(data, viewValue):Number|Number)**
Define the column span of the card

### Card

A Card that shows just a number from data processed by a job.

Inherits from `Base`.

**job (string)**
Job name, to which this component should subscribe.

**value (function(data, viewValue):Number)**
Function to map the view value from the job data. When the job emits the data, you should here reduce it to a single value which has to be a number.

**graph (boolean | function(data, viewValue):Array[Number])**
Function that maps the job data to an array of numbers to be shown as a line chart in the background.
An Array of `{x,y}` pairs are allowed as well. When providing a boolean, the data is just taken as it is.

**graphOptions (object))**
Options to the line graph object (see https://gionkunz.github.io/chartist-js/api-documentation.html for details)

**graphColor (function(data, viewValue):String)|string**
Define a color for the line chart as a function or directly as a string.

**withTendency (boolean|function(current, viewValue, last, lastViewValue))**
Boolean that indicates if there should be a small arrow shown underneath the value showing the direction compared to the last value.
If you provide a function, you have to return a css rotation attribute, e.g. `45deg` or `0.567rad`, depending on the data you retrieve.

### ~~List~~ (deprecated, please use StatusList instead)

A list widget for failed build jobs.

Inherits from `Base`.

**job (string)**
Job name, to which this component should subscribe.

**value (function(data):Array[String|Number])**
Function to map the view value from the job data. When the job emits the data, you should here reduce it to an array of strings/numbers.
Takes an array of strings as parameter, but can also be an object with an assignee, e.g.
```javascript
["TeamcityBuildJob","TeamcityBuildJob2", "TeamcityBuildJob3"]
or
[
  {name: "TeamcityBuildJob", assignee:"Luke Skywalker"},
  {name: "TeamcityBuildJob2"},
  {name: "TeamcityBuildJob3"},
]
```

### StatusList

A more general list widget containing items reflecting some status. Examples are failing builds, list of code quality criterias
or an application instance health list.

Inherits from `Base`

**job (string)**
Job name, to which this component should subscribe.

**value (function(data):Array[String|Number])**
Function to map the view value from the job data. When the job emits the data, you should here reduce it to the requested format.

#### View value format
This component can deal with list of objects like:
```
{
    "name": "some name",
    "subtitle": "some subtitle",
    "status": "failed"
}
```
whereas `name` and `subtitle` are arbitrary strings.
`status` however needs to match one of the configured status (see below).

#### Status configuration
There is a default status configuration (`defaultStatusConfig`) defined in [ListItem](lib/frontend/widgets/StatusList/Item.jsx) with
predefined status
* check
* failed (default)
* investigated

but if you want to enhance the configuration or override values in existing status use the property `statusConfigExt`.
There is a special but also simple format to this configuration. The example shows how to override `failed`
to not be the default status anymore and add a new `adjusted` status.

```
import { StatusList, themes } from 'monitory/frontend';
import { Adjust } from 'styled-icons/fa-solid/Adjust';

// extends status config for teamcity status list
const teamCityStatusConfigExtension = {
  failed: {
    default: false,
    background: 'yellow',
  },
  adjusted: {
    default: true,
    background: theme => theme.statusAdjustedColor,
    icon: Adjust,
  },
};
// extends themes with new status colors
themes.light.statusAdjustedColor = 'grey';
themes.dark.statusAdjustedColor = 'grey';

...
    <StatusList job="teamcityStatus" title="Teamcity Jobs" rows={2} cols={1} statusConfigExt={teamCityStatusConfigExtension} />
...
```

#### Migrate from List

In case you only use a list of strings like
```javascript
["TeamcityBuildJob","TeamcityBuildJob2", "TeamcityBuildJob3"]
```
you don't need to do anything.

For the other case
```javascript
[
  {name: "TeamcityBuildJob", assignee:"Luke Skywalker"},
  {name: "TeamcityBuildJob2"},
  {name: "TeamcityBuildJob3"},
]
```
use a transform function like
```javascript
import { get, has, map } from 'lodash';
const transformToStatusListData = listData => map(listData, (item) => {
  const { name } = item;
  const subtitle = `${get(item, 'assignee', 'Nobody')}  assigned`;
  const status = (has(item, 'assignee')) ? 'investigated' : 'failed';
  return { name, subtitle, status };
});
```
and migrate from
```javascript
<List job="teamcity" title="Failed Teamcity Jobs" rows={2} cols={1} />
```
to
```javascript
<StatusList job="teamcity" title="Failed Teamcity Jobs" rows={2} cols={1} value={transformToStatusListData} />
```

### ReloadableIframe
Just an Iframe component which reloads itself after an amount of time.

Inherits from `Base`.

**src (String)**
The src for the Iframe.

**interval (Number)**
Define the interval to refresh the iframe.

**zoom (Number)**
Define zoom of the content of the iframe

### ReloadableImg
An Img component which reloads itself after an amount of time. For example for giffy.

Inherits from `Base`.

**src (String)**
The src for the Img.

**interval (Number)**
Define the interval to refresh the img.

Themeing:
---------
You can choose between two themes: light and dark.
Or you can create your own theme by providing an object with the following properties:
```javascript
{
    background: '#ccc',
    fontSize: '100%',
    cardBackgroundColor: 'white',
    cardFontColorBright: 'rgba(255,255,255,1)', // Defines font color, when the background is bright
    cardFontColorBrightLight: 'rgba(255,255,255,0.7)', // Defines title font color, when the background is bright
    cardFontColorDark: 'rgba(0,0,0,1)', // Defines font color, when the background is dark
    cardFontColorLightDark: 'rgba(0,0,0,0.7)', // Defines title font color, when the background is dark
    graphColor: 'rgba(0,0,0,0.3)',
    listAssigneeColor: '#efd700',
    listFailedColor: 'red',
    statusFailedColor: 'red',
    statusCheckColor: 'green',
    statusInvestigatedColor: '#efd700',
    headlineColor: 'black',
    headlineBackground: '#eee',
    customCss: {...} // Provide custom global css
  }

```
and then use it with the theme provider:
```jsx harmony
import { ThemeProvider, themes, Dashboard } from 'monitory/frontend';
export default function () {
  return (
    <ThemeProvider value={themes.dark}>
     <Dashboard>
        ...
     </Dashboard>
    </ThemeProvider>
  );
}
```

Defining the dimensions of the dashboard
----------------------------------------
To control the size of the dashboard, you have basically three dimensions to set:
* **Card height**: Define the `rowHeight` property of the dashboard
* **Card width**: Using `cols` property of the dashboard
* **Font Size**: Using `fontSize` property of the theme. Every font is set with the `rem` relative property
and this will set the root font size (100% = 16px)

Useful Utility methods
----------------------
### Moving Window for tendency
Calculates the moving average of the last `n` values. Because this components has state, you have to initialize it outside of the render method.
```javascript
import { helpers } from 'monitory/frontend';
const lastElementConsidered = 5
const movingAverage = helpers.movingAverage(lastElementConsidered);
...
<Card job="example3" withTendency={movingAverage} />
...
```
### Range method for colors
Use this small helper to easily define ranges to show colors.
Examples:
```javascript
import { helpers } from 'monitory/frontend';
const {colorRange} = helpers;
...
<Card job="example3" color={colorRange(['red', 3000, 'blue', 6000, 'yellow'])} />
...
```
Shows red, when the value is below 3000, blue when the view value is between 3000 and 6000 and yellow when it is above 6000.
If you want to just show the default color, use `null`, you can also omit the left and/or right boundary, e.g
```javascript
<Card job="example3" color={colorRange([ 3000, 'blue', 6000])} />
```

Used Technologies
==========
Frontend
--------
* React - frontend component rendering
* Redux/ Redux Saga - subscribe to websocket events and broadcasting to the dashboards/widgets
* styled components / styled icons - css styling of react components
* react toastify - for showing errors / warnings
* Chartist/React Chartist - responsive background charts
* color - color calculations
* webpack - compile frontend assets

Backend
-------
* Hapi ecosystem - HTTP framework, still the best I know for node!
* Nes - websocket handling
* cron - takes care of cron jobs
* glob - file handling

Motivation
==========
In our team at work, we use a team monitor so if we get asked: does our system has a problem right now? We can soundly say: No, everything is fine.
This monitor had some metrics on the left and some rotating dashboards on the right.
Because we could easily oversee issues with rotating dashboards, we decided to search for alternatives to have a unified view.

Main criteria were:
* Be able to give an overview about business KPIs.
* Be minimalistic; meaning showing only numbers instead of fine grained graphs, so that you can immediately see if errors occur. No need for interpret graphs or thinking too much.
The idea is not to have a highly dynamic dashboard with filters etc.
* Show when errors occur in our application / nightly jobs / pipelines but hide when everything is fine.

We searched for solutions, but for most of them, you have to pay and/or they provide too much functionality and thus complexity.
So I have written something which should be easy to use.

This project is highly inspired by http://dashing.io/ which unfortunately is no longer maintained.

[npm]: https://img.shields.io/npm/v/monitory.svg
[npm-url]: https://npmjs.com/package/monitory

[circleci]: https://img.shields.io/circleci/project/github/partysalat/monitory.svg
[circleci-url]: https://circleci.com/gh/partysalat/monitory/tree/master

repository: partysalat/monitory

gha_language: TypeScript

repo_name: partysalat/monitory


text:
# H7PI_Samples

## Introduction
H7PI Samples

## How to use？

#### How does the bootloader run
bootloader at 0x08000000-->app at 0x90000000(qspi flash)

#### How does the app run
app at 0x90000000-->STM32 HAL Init-->freeRTOS Init-->User's Default Task-->User's Init(Functions,Drivers Init)-->User's Task

#### other samples
wikis，[H7PI WIKI](https://pinno.cc/2020/02/28/H7PI-%E7%AE%80%E4%BB%8B/)


text:
## Vagrant Tutorial

### Lesson 1

_gentle reminder: the directory `/projects/learn-salt` here is a convention only.
you may have placed your repository elsewhere._

Run this lesson on your machine for practice, do not just read it.

The simplest `Vagrantfile` lists only the name of the virtual machine,
and the source of the bootable image. The one for this lesson is...

```Ruby
Vagrant.configure(2) do |config|
  config.vm.define "lesson1" do |quail_config|
    quail_config.vm.box = "boxesio/xenial64-standard"
    quail_config.vm.hostname = "lesson1.test"
  end
end
```

The name of the machine will be "lesson1", and its fully qualified
domain name will be "lesson1.test".

The bootable image will be found in the public repository in a box
named "boxesio/xenial64-standard".

Before starting your first VM, click on the control to start your VirtualBox
(or other VM provider of your option) [manager GUI](empty_VMmgr.png).
It should be empty. You will not use this to add or control machines
(unless one gets out from under Vagrant's control) but it makes a
good display of what Vagrant is doing.

#### Start your first Vagrant VM

```(bash)
cd /projects/learn-salt/lessons/vagrant_basics
ls -al
vagrant up
```

Vagrant will tell you that it is importing your box. Soon you will see
the machine appear in the [GUI window](running_VM.png). Note that the
machine name you supplied ("lesson1") is part of the longer ID that
VirtualBox uses. Clicking on various places on the GUI will show you
several things the Vagrant has prepared for you, including a NAT-enabled
network adapter.

The box was defined with a user named "vagrant" who has
the password "vagrant". The scrolled output from "vagrant up" tells you
that Vagrant defined a local port (2222 probably, YMMV) which will be
forwarded to the guest's port 22. Knowing this, we can connect to our VM.

```(bash)
ssh<EMAIL_ADDRESS>-p 2222
```
Type the password "vagrant" when prompted:

Then try the commands:`hostname`, `hostname --fqdn`, and `ls -al /vagrant`.

```
$ ssh<EMAIL_ADDRESS>-p 2222
<EMAIL_ADDRESS>password:
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-21-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
vagrant@lesson1:~$ hostname
lesson1
vagrant@lesson1:~$ hostname --fqdn
lesson1.test
vagrant@lesson1:~$ ls -al /vagrant
total 264
drwxrwxr-x  1 vagrant vagrant   4096 Oct 30 21:12 .
drwxr-xr-x 23 root    root      4096 Oct 30 20:50 ..
-rw-rw-r--  1 vagrant vagrant   3162 Oct 30 20:09 basics_of_vagrant.md
-rw-rw-r--  1 vagrant vagrant 112757 Oct 30 20:43 empty_VMmgr.png
-rw-rw-r--  1 vagrant vagrant 123045 Oct 30 20:54 running_VM.png
-rw-rw-r--  1 vagrant vagrant   2242 Oct 30 21:12 tutorial.md
drwxrwxr-x  1 vagrant vagrant   4096 Oct 30 20:11 .vagrant
-rw-rw-r--  1 vagrant vagrant    258 Oct 30 20:12 Vagrantfile
vagrant@lesson1:~$
```

The contents of the `/vagrant` directory should look familiar to you.
It is the same directory as `/projects/learn-salt/lessons/vagrant_basics`.
It is not a *copy* of that directory, it is the *same* directory.
Any changes made by one machine are immediatly seen by the other.

This means that you can take full advantage of the high-end IDE
(such as [PyCharm](https://www.jetbrains.com/pycharm/)), running on
your workstation, to maintain code your VM. The professional version
can do line-by-line interactive debugging of a program running on the VM.

Feel free to play around with the VM as much as you wish. We will throw it
away in a few moments.

When you are done, log off the VM using the Lunix `exit` command.  Your terminal
will return to controlling your workstation.

During the "vagrant up" operation, did you notice the references to "insecure key"
and "newly generated keypair"? Vagrant has prepared the guest VM for passwordless
login.  You can check the configuration by:

```bash
vagrant ssh-config
```

Vagrant will print all the details needed to connect to the VM. It can use them for you.
Just type: `vagrant ssh`

That was easy, wasn't it?

To stop your VM, you can either `sudo shutdown -h now` from within the VM, or have Vagrant
do it for you: `vagrant halt`.

Either way, reboot the VM using `vagrant up`.

To maintain the state of the VM, but keep it from using your host's CPU and memory,
use `vagrant suspend`.  Wake it up using `vagrant resume` or our old friend `vagrant up`.

Finally, to remove the VM from your machine, recovering all of the resources,
including its "box" on your hard disk storage, use the command `vagrant destroy`.

After running `vagrant destroy` you will need to download the "box" again (unless you
happened to say `linked_clone = true` in your Vagrantfile.)

### Vagrant Commands for multi-machine Vagrantfiles

A `Vagrantfile` can grow much more complex -- like the one in the top level directory
of this repository. It contains definitions for several different machines. One is
defined as the `primary` and will react the same as the `lesson1` machine here.
The others must be explicitly specified on the Vagrant command line. For example,
to start the machine named "quail16", you type `vagrant up quail16`.

### IP Networks in Vagrant

Vagrant needs to use TCP/IP networking for the host to talk to its guests.
The guest machine needs to be able to reach the Internet and corporate resources.
Guest machines will want to talk to the host, and to other guests.
Lastly, other machines on a corporate network will need access to the guest.
Vagrant uses three different virtual network adapters to meet the different needs.

The default adapter has a [NAT](https://en.wikipedia.org/wiki/Network_address_translation) setup,
and uses the host's interface, and its address, to connect to Internet resources.
Because of NAT, guest packets appear to originate from the host.
This adapter is also used for ssh connections from the host when you use `vagrant ssh`.
Vagrant uses a different small [private network](https://en.wikipedia.org/wiki/Private_network) for each guest.

The second adapter is for what Vagrant calls a 'host only' network.
The host computer acts as a router for traffic among guest machines and itself.
This network must have a unique (among your route) [private network](https://en.wikipedia.org/wiki/Private_network) number.

The third adapter is for a [bridged network](https://en.wikipedia.org/wiki/Bridging_(networking)).
Using a combination of smoke, mirrors, and magical incantations, this virtual interface
makes the network think that your host's physical network adapter is suddenly two adapters.
The virtual adapter has its own [MAC address](https://en.wikipedia.org/wiki/MAC_address)
and, therefore, it gets a unique [IP address](https://en.wikipedia.org/wiki/IP_address).

Due to a nefarious twist in the magic, it often happens that bridged packets cannot travel
between the physical adapter and its virtual adapters.
Therefore you must use the 'host only' network to talk between the host and amoung guests.

For some odd reason, VirtualBox uses the descriptive network name,
rather than the adapter name shown by `ifconfig` (`ipconfig` on Windows),
to describe which network adapter should be used for the bridge interface.
That name is not easy to determine.

The [supplied Vagrantfile](../../Vagrantfile) contains a rather large section of code to try finding the
correct name for the bridge interface.
On Linux, it will probe all of the interface addresses to find one within `BRIDGED_NETWORK_MASK`.
On MacOS, it will try two frequently found Mac interfaces.
On Windows -- you are out of luck.
What you need to do is to use `vboxmanage list bridgedifs` to list the possible bridge interface names.
Then copy the name you found into the constant `INTERFACE_GUESS` list.
Entries in the `INTERFACE_GUESS` list will be used in leu of probing on all operating systems.

repository: vernondcole/learn-salt

repo_name: vernondcole/learn-salt


text:
# Go工具
- [go get](https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/01.3.md#go-get)
- [go intstall](https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/01.3.md#go-install)
- [go generate](https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/01.3.md#go-generate)
- [vendering](https://golang.org/cmd/go/#hdr-Vendor_Directories)
- [交叉编译](https://rakyll.org/cross-compilation/)
- [cgo](https://github.com/golang/go/wiki/cgo)
- [python读取go](https://blog.filippo.io/building-python-modules-with-go-1-5/)
- [ruby读取go](http://c7.se/go-and-ruby-ffi/)
- [swift读取go](https://rakyll.org/swift/)
- [go编译共享库so](https://github.com/jbuberel/buildmodeshared)

repository: ShenHuajie/knowledge

repo_name: ShenHuajie/knowledge


text:
# Document

![MongoDB Project](http://www.jnosql.org/img/logos/mongodb.png)

**Mongodb**: MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas.

To run this project a MongoDB instance is required, so you can use either a local instalation or using Docker.

## Using Docker

![Docker](https://www.docker.com/sites/default/files/horizontal_large.png)

1. Install docker: https://www.docker.com/
1. https://store.docker.com/images/mongo
1. Run docker command
1. Run MondoDB: verify MongoDB image name with the command `docker images`, it can be mongodb or mongo, and then execute this command `docker run -d --name mongodb-instance -p 27017:27017 mongodb`

## Run the code

With a MongoDB instance running go to the class **App** and have fun.


text:
---
layout: post
title: "Exploring the .NET Framework with PowerShell – Garbage Collection (Part 6)"
date: 2009-07-07 06:00
author<EMAIL_ADDRESS>comments: true
categories: [-NET Framework, PowerShell]
tags: []
---

Garbage collection is a process that the .NET Framework (upon which the PowerShell runtime works) uses to manage memory.  The garbage collection (for applications – services are handled a bit differently) process basically covers X steps:

1.  Identify objects that won’t be used
2.  Delete them from memory
3.  Compact the space to make room for new objects

The first step is the critical point for PowerShell users.  You may have noticed how the memory used in a PowerShell session can steadily climb (or suddenly climb if you’re dealing with a large number of objects).  I talked about that in [this tip](/blog/2009/03/tip-free-up-some-memory).  The .NET garbage collector looks for objects that are still in use or could possibly be in use in the near future (this is a gross oversimplification - if you are really interested in a detailed explanation of how garbage collection works in the .NET Framework, check out this article.)

What this means to scripters who are running into memory pressure issues is that the garbage collector will not reclaim any objects you have actively referenced (meaning that you’ve assigned them to a variable) in your current or higher scope.

Since this can sound a bit convoluted let’s look at an example.

I read a large file to parse it and leave the contents of the original stored in a variable

PS> $MyLargeFile =  [Get-Content](http://go.microsoft.com/fwlink/?LinkID=113310) MyLargeFile.txt
PS> Foreach ($line in $MyLargeFile) {
DoSomething $line | [Out-File](http://go.microsoft.com/fwlink/?LinkID=113363) NewUpdatedLargeFile.txt
}

One of the problems with the above pattern is that the original file remains saved in memory and doesn’t get released unless you explicitly remove the reference, either by using [Remove-Variable](http://go.microsoft.com/fwlink/?LinkID=113380) or [Remove-Item](http://go.microsoft.com/fwlink/?LinkID=113373) or by changing what $MyLargeFile points to by assigning another value to it.

This isn’t VBScript where you have to set values to “Nothing”, but you should be aware of what larger object sets you are retaining in memory.

repository: rishimittal/blog

extension: markdown

repo_name: rishimittal/blog


text:
---
layout: resume
---
## Currently

Master Candidate in Data Science in The George Washington University
Member of GW DATA Club
Member of GW Chinese Students and Scholars Association

## Education

__2016 - 2018__
`The George Washington University`
MSc in Data Science

__2012 - 2016__
`Renmin University of China`
Bachelor in Managemenr

## Awards
__2012__

`Third Prize Scholarship`, Renmin University of China

`Scholarship for Honorable Mention of Best Exchange Student`, Renmin University of China

## Projects

__Social Network Analysis__
- Ongoing social network analysis project on R to analysis relationship with cancer and inheritance using Exponential-Family Random Graph Models (ERGMs)
, Click to learn more

__Database and Visualization__
- Transformed Yelp data of JSON format into CSV with Python script and conducted ETL process to build database on PostgreSQL.
- Visualized customer churn to analyzed market saturation on Tableau with Sankey chart based on Sigmoid function.

## Internship

`Mar. 2016 - July 2016`
Data Analyst Intern, __UBER__

- Established probabilistic models of Bernoulli distribution to optimize promotion estimation.
- Built dashboard with advanced formulas (e.g. match, index) on Excel to showcase operation of 18 cities.
- Gathered and analyzed daily operation data of competitors in support of promotion strategy.

`Jan. 2016 - Mar. 2016`
Market Analyst Intern, __Nielsen__

- Proposed the most promising type of customers by analyzing research data of dairy shoppers.
- Computed Brand Evaluation Index of 14 supermarkets from 4 dimensions on SPSS.

## Volunteers

`March 2016 - July 2016`
Project Manager, __SK SUNNY Campus Volunteers__

- Led a team of 11 undergraduates to hold a Green Riding activity.
- Orchestrated three main activities aimed at publicizing pollution abatement


text:
# snyk-test(1) -- test local project for vulnerabilities

## SYNOPSIS

`snyk` `test` \[<OPTIONS>\]

## DESCRIPTION

Test command checks locally installed projects for vulnerabilities. It tries to autodetect supported manifest files with dependencies and test those.

repository: shahinrostami/theme-purple-please

repo_name: shahinrostami/theme-purple-please


text:
# Point Attribute Histogram

This histogram tool shows the distribution of a point attribute in it's full range. This is useful for finding the right maximum and minimum values for remapping attributes to color.

[Download on orbolt](https://www.orbolt.com/asset/ben_Chan::benC_point_attribute_histogram)

![ui](screenshot/ui_screenshot.png)
![preview](screenshot/histogram_breakdown.png)

repository: cmhbenjamin/Houdini-Scripts

repo_name: cmhbenjamin/Houdini-Scripts


text:
# utils/Se
`require("./utils/Settings");`

The Settings Modul reads the settings out of settings.json and provides
this information to the other modules

##Variables

- - -
### abiword
The path of the abiword executable

- - -
### dbSettings
This setting is passed with dbType to ueberDB to set up the database

- - -
### dbType

- - -
### defaultPadText
The default Text of a new pad

- - -
### ip
The IP ep-lite should listen to

- - -
### logHTTP
A flag that shows if http requests should be loged to stdout

- - -
### minify
A flag that shows if minification is enabled or not

- - -
### port
The Port ep-lite should listen to

repository: ardupad/ardupad

repo_name: ardupad/ardupad


text:
---
layout: project
title: Pathways, Desire Lines
summary: Interactive video game
tags:
- Project
---

"Pathways, Desire Lines" represented an attempt to condense some of the core findings and literature of my doctoral thesis into a minimalist and accessible multimedia form, which was presented as an "interactive poster" at the CHASE DTP Encounters conference in 2021.

The project has limitations; it leaves out the conceptual lens of unconditional positive regard, drawn from Carl Rogers' work, which was a core part of the theoretical framework of my project. Communicating this clearly and concisely was ultimately beyond what I was able to achieve in this form, but I am considering the possibilities for expanding the game further in the future.


text:
# Echo-Essentials
Echo Essentials published by Packt.  This repository holds the sample code that
is used within the Echo Essentials book.  The code has been broken down into
per chapter samples, which come directly from the book.

## Usage

The following instructions assume you have downloaded and installed Go, as
well as setup your $GOPATH environment variable.  Instructions for these tasks
are found in the first chapter of the book.

The instructions also assume you know how to use `git` distributed version
control tool.

```bash
mkdir -p $GOPATH/src/github.com/PacktPublishing
cd $GOPATH/src/github.com/PacktPublishing
git clone https://github.com/PacktPublishing/Echo-Essentials
cd Echo-Essentials/
```

These instructions will download all of the sample code, organized by chapter
that is used within the book.  Each chapter directory is a completely
independent Go package, which includes vendor code which is known to work with
the examples.

### Download a free PDF

 If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

 https://packt.link/free-ebook/9781789139433

repository: PacktPublishing/Echo-Essentials

repo_name: PacktPublishing/Echo-Essentials


text:
# Weather Vue

Weather app using Vue.js, Google Maps Geocoding, and Dark Sky.

![alt tag](https://raw.githubusercontent.com/krestaino/weather-vue/master/static/images/og.jpg)

## Getting Started

Rename `.keys.js.example` to `.keys.js` and add your [Google JavaScript API](https://developers.google.com/maps/documentation/javascript/get-api-key) keys. The `prod` key is exposed in your frontend code, so make sure you restrict the HTTP referrer to only allow requests from your production URL. This can be done in the Google API Console. The `dev` key is not included in production code and therefore don't need the same restrictions.

## Prerequisites
The API backend for this project is located [here](https://github.com/krestaino/weather-api). This is required for the project to run. The backend API fetches geolocation data from Google and weather data from Dark Sky and returns it to the Weather Vue app.

## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report
```

For detailed explanation on how things work, checkout the [Vue.js Webpack guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

## Built With
* [Vue.js](https://vuejs.org/)
* [Dark Sky API](https://darksky.net/dev/)
* [Google Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/get-api-key)
* [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/get-api-key)
* [Google Places API](https://developers.google.com/places/web-service/autocomplete)

## License
This project is licensed under the MIT License - see the LICENSE.md file for details


text:
# Bacon and Beans Stew

There is a nice balance of flavors in this stew.  I was surprised by how much liquid the tomatoes provide.  The spaghetti squash worked well, breaking into short strands and filling with flavor.  Haidee liked this even more than the borscht.

Ingredients:

- 1/2 lb bacon, chopped
- 1-2 cups dried black-eyed peas, presoaked
- 1/2 grilled chicken breast, chopped
- 1 Spaghetti Squash, skinned, gutted, and chopped
- 2 jalapeños, chopped
- 2 onions, chopped
- 8 tomatoes, sliced
- 1/2 small can of tomato paste
- 2 sprigs oregano
- 4 springs thyme
- 1 Tbsp white wine vinegar
- salt
- pepper

Directions:

Preheat oven to 400 degrees Fahrenheit.  Brown the bacon in a dutch oven.  Add the rest of the ingredients to the dutch oven, stir well and cook for 60-90 minutes, stirring once or twice if you simply must.

repository: todddeluca/recipes

repo_name: todddeluca/recipes


text:
# pythonbot

A simple IRC bot written in Python 3, using the curio concurrency library.

# Usage

This bot has two parts.

`ircbot.py` is a sort of library allowing you to write your own bot.

You can use it on your channel by modifying the file itself.

# Issues

Found a bug? Want a feature that's not present? Feel free to file a GitHub
issue.
We're very active coders, so it will probably be implemented/fixed rather
quickly.


text:
# Covid19-Research_Project
Project to find the necessary ligands and molecules to kill the active nature of Corona Virus plus test the new drugs coming to the markets .

### Note:
To use the code, download the "experiments" folder from google drive ( ~74 mbs ) (https://drive.google.com/drive/folders/1Mx3EhJb90joKFBsE5gBDocMfhmQ6ozGk?usp=sharing)
and paste the experiments folder in the main directory.

### The Problem Statement:
* https://www.youtube.com/watch?v=1LJgkovowgA ( Taken from Siraj Rawals challenge on How to Treat Corona Virus using State of the Art Deep Learning Techniques "without" knowing too much biology )

### The Solution
* https://www.youtube.com/watch?v=EVoZMRmtBkY ( 6:33 -> end of the video though I suggest watching the entire video ). The solution is given by Matt O Connor is one of the best solutions I found due to it's little dependence on understanding biology and more focus on Chemistry ( ~level is class 11 ). You may need to understand a bit about Recurrent Neural Networks (RNN). It's kind of easy , just your another Mid-Sem like topic. Watch a youtube video or 2.

* Read this paper then : https://onlinelibrary.wiley.com/doi/full/10.1002/minf.201700111 -- Don't get intimidated by the paper, On paper it is really simple. If you don't understand it, call me, I'll explain it.

* Then read the readme of https://github.com/topazape/LSTM_Chem --> This is the implementation of the paper you read/ will read above. Everything is coded, you dont need to code anything, just need to run the code

* After this point , you pretty much have done 80% of the paper

* Now you read the readme of https://github.com/mattroconnor/deep_learning_coronavirus_cure --> This is the link of the code repo of the "Matt O Connor's" implementation of the paper. ( 95% of the code is the same as you read earlier )

* Then you need to see what ligands are... What Docking is.... How to do ligand docking with PyRx ( 1-2 hours of understanding , that's it )

* Now we need to do some changes to make our work look original ( The Hard Part -> You have ~ 1 year for this )

### Some tips
* The main part is to watch the videos and understanding the paper I provided in "The Solution" Above. If you understand the paper and are able to relate to the parts of code related to the paper; it is extremely easy. You dont have to code even a single line of code.

* Mid way you may think it's hard, it's not.

* Major is what you need to worry about, minor is a piece of cake.

* Getting results published in a journal of Deep Learning is way easier with a complicated looking project.


text:
# Generic landing page for a project
Describe what the project does
## Structure
* Electronics contains the schematics and PCB's used by the project
* Software contains the software needed for the project, either embedded or PC side software
* Mechanical contains drawings of casing/mechanisms etc
## Checking out
This project makes extensive use of submodules, use ```git clone --recurse-submodules https://github.com/Squantor/$(PROJECT).git``` to clone the repository and its submodules in one go.


text:
# Contributing

Thank you for your interest in contributing to the project!

To get up and running, follow these steps:
1. Clone the repository
2. Install dependencies: `yarn install`
3. Install dependencies and build the example documentation included in this repository (used for tests): `yarn --cwd example-docs install && yarn --cwd example-docs build`
4. Run tests: `yarn test`

repository: loque/docusaurus-search-local

repo_name: loque/docusaurus-search-local


text:
---
title: "POWERSHELL DECONSTRUCTED"
date: "2017-05-23"
redirect_from : 2017/05/23/powershell-deconstructed
coverImage: ../assets/images/2017/05/images/deconstructed.png
categories:
  - "scripting"
tags:
  - "binary-modules"
  - "decompiler"
  - "powershell"
excerpt: "In this post, I'll outline my own such PowerShell adventure, and show you the tools I used to come out the other side with a working solution. We'll meet in basecamp to prepare ourselves with the needed gear, plan our scaling strategy and climb the crags of an unknown PowerShell module. We'll belay into treacherous canyons, using our torch to reveal the DLLs that make Windows work, then chart new ground using DotPeek and eventually arrive on the summit, victorious and armed with new tools."
---

![DECONSTRUCTED](../assets/images/2017/05/images/deconstructed.png)

We're all adventurers. That's why we wake up in the morning and do what we do in our fields, for that feeling of mastery and uncovering something new. Some of us chart new maps, cross the great outdoors, or [climb mountains](http://outsideinradio.org/shows/episode9).

And some of us explore code.

In this post, I'll outline my own such PowerShell adventure, and show you the tools I used to come out the other side with a working solution. We'll meet in basecamp to prepare ourselves with the needed gear, plan our scaling strategy and climb the crags of an unknown PowerShell module. We'll belay into treacherous canyons, using our torch to reveal the DLLs that make Windows work, then chart new ground using DotPeek and eventually arrive on the summit, victorious and armed with new tools.

_![](../assets/images/2017/05/https://foxdeploy.files.wordpress.com/2017/05/alexander-andrews-247193.jpg)_

#### Basecamp - The Background

I've been working through a **big** MDM roll-out concept for a client recently, looking to use Windows 10's new mobile device management capabilities as an interesting and resilient alternative to tools like ConfigMgr, for a new management scenario.

I needed to script the process of un-enrolling and re-enrolling devices in MDM, because we expect that a small percentage of devices will stop responding after a time, and want to be prepared for that contingency. This is done by removing and reinstalling a Provisioning Package, which is new management artifact available to us in Windows 10.

Windows 10 1703 Release (the Creator's update) conveniently has a nice new PowerShell module full of cmdlets we can use for this task!

![00 module](../assets/images/2017/05/images/00-module.png)

However, we're targeting a different release which doesn't have this module available. When I brought this information to the client, the response was 'we have confidence that you can make this work'. Let's break out the sherpa hats!

First things first, I tried just copying and pasting the module folder, but that didn't work, sadly.

If only there were _some way_ to look inside a cmdlet and see what's going on under the covers....

#### Understanding our Gear

We'll have a few pieces of gear which will be absolutely essential to this expedition.

| Tool | Function |
| --- | --- |
| Get-Command | Retrieves definition of modules and cmdlets |
| DotPeek | Decompiler for binaries |
| Visual Studio Code | Pretty Editor for code screen shots |

### Looking into a Cmdlet the easy way

`Get-Command` is definitely the tried and true method of uncovering what a function does and how it works. Time to break out our handy climbing axe and start picking away here.

![](../assets/images/2017/05/https://foxdeploy.files.wordpress.com/2017/05/jared-erondu-18329.jpg?w=636)

Take your command and run it through `Get-Command <cmdname> | select -Expand Definition`. This will show you the compiled version of the cmdlet, which may have some good clues for us.

Any script cmdlets or functions, like the very useful `Out-Notepad,`will have a field called `Definition` which shows exactly how the cmdlet works. You can pick up some neat tricks this way.

```powershell

gcm Out-Notepad | select -ExpandProperty Definition

#this function is designed to take pipelined input #example: get-process | out-notepad

Begin { #create the FileSystem COM object $fso=new-object -com scripting.filesystemobject $filename=$fso.GetTempName() $tempfile=Join-Path $env:temp $filename

#initialize a placeholder array $data=@() } #end Begin scriptblock

Process { #add pipelined data to $data $data+=$\_ } #end Process scriptblock

End { #write data to the temp file $data | Out-File $tempfile

#open the tempfile in Notepad Notepad $tempfile

#sleep for 5 seconds to give Notepad a chance to open the fi sleep 5

#delete the temp file if it still exists after closing Notepad if (Test-Path $tempfile) {del $tempfile} } #end End scriptblock

```

However in this case with our Provisioning Cmdlets, PowerShell was just NOT giving up any secrets.

```powershell

Get-Command Install-ProvisioningPackage | select -exp Definition

Install-ProvisioningPackage \[-PackagePath\] <string> \[-ForceInstall\] \[-QuietInstall\] \[-LogsDirectoryPath <string>\] \[-WprpFile <string> \] \[-ConnectedDevice\] \[<CommonParameters>\]
```

This will often be the case for binary, or dll-driven cmdlets. We have to climb a little higher to see what's going on here.

### Looking inside a Cmdlet the fun way

When our Command Definition is so terse like that, it's a clue that the actual logic for the cmdlet is defined somewhere else. Running `Get-Command` again, this time we'll return all the properties.

![](../assets/images/2017/05/images/gcmfl.png)

It turns out that the hidden core of this whole Module is this DLL file.

If you've been working around Windows for a while, you have definitely seen a DLL before. You may have even had to register them with `regsvr` but did you ever stop to ask...

### **What the heck** **_is_** **a DLL anyway?**

> DLLs are Microsoft's implementation of a programming concept known as shared libraries.
>
> In shared libraries, common code which might be present in many applications (like dependencies) are instead bundled into a dynamic link library, and loaded into memory once. In this model, many apps can share the same core functionality (like copy and paste) without having to roll their own solution, or needing to reload the same code.
>
> This model allows for smaller, more portable applications while also providing more efficient use of a system's resources.

**TL;DR: if code does contains something really useful that might be needed elsewhere(like procedures, icons, core OS behaviors), store it in a DLL so other things can reference it**

And as it turns out, many PowerShell modules do just this!

We can find the path to this module's DLL by running `Get-Command Get-ProvisioningPackage | Select Dll`

![](../assets/images/2017/05/images/sourcedll.png)

Now, let's open it in my editor of choice, Notepad.

![](../assets/images/2017/05/images/dll-in-notepad.png)

Yeah... we're going to need a different tool.

### Choosing a Decompiler

When it comes to picking a decompiler or text editor, if we're not careful we'll end up looking like this guy:

![I choose mountain climbers because I think their tools look SOO cool. I should buy an ice-axe](../assets/images/2017/05/images/tools.jpg) I choose mountain climbers because I think their tools look SOO cool. I should buy an ice-axe

There are a lot of options, I worked through .net Reflector and Ida pro before finally stopping on [.Peek, by JetBrains. You can download it here.](https://www.jetbrains.com/decompiler/) I chose .Peek because it's free, and not just a free trial like .net Reflector, and it's very up-to-date and designed with .net in mind. IDA Pro does a good job, but I got the impression that it is SO powerful and flexible that it isn't as good as a tailor made .net tool.

DotPeek is free, as in beer, and is an AWESOME tool for digging into DLL files. Install it, then launch it and click Open.

![](../assets/images/2017/05/images/open.png)

Next, paste in the path to our DLL file, then expand the little arrow next to the ProvCmdlets assembly.

![Open DLL](../assets/images/2017/05/images/open-dll.png)

Here's a breakdown of what we're seeing here.

![](../assets/images/2017/05/images/breakdown.png)

Working our way through this, we can see the loaded Assemblies, or DLL files that we are inspecting. If you expand an Assembly, you'll see the NameSpaces and Metadata inside it. We're more concerned with NameSpaces here.

> **Protip**: the References section lists out all of the assemblies (other DLL files) that this assembly references. If you attempt an ill-advised effort to port a module to another version of Windows, you'll need to bring along all of these files (or ensure they're the right version) at a minimum to prevent errors.

Inside of NameSpaces, you can see Class definitions. Most binary cmdlets are built around namespaces, and will often match the format of the cmdlets themselves.

Since I'm interested in seeing what happens when I call the `Install-ProvisioningPackage` I'll take a look at the Class definition for the `InstallProvisioningPackage` Class by clicking the arrow.

![](../assets/images/2017/05/images/cmdlet-breakdown.png)

This shows us the Methods and the Params that the class exposes.

We can also double-click the cmdlet itself to see the full source code, which is shown below. I've highlighted the Action bits down below on line 38.

```csharp
// Decompiled with JetBrains decompiler
// Type: Microsoft.Windows.Provisioning.ProvUtils.Commands.InstallProvisioningPackage
// Assembly: ProvCmdlets, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null
// MVID: 2253B8FF-A698-4DE9-A7F2-E34EDF8A357E
// Assembly location: C:\Windows\System32\WindowsPowerShell\v1.0\Modules\Provisioning\provcmdlets.dll

using Microsoft.Windows.Provisioning.ProvCommon;
using System;
using System.IO;
using System.Management.Automation;

namespace Microsoft.Windows.Provisioning.ProvUtils.Commands
{
[Cmdlet("Install", "ProvisioningPackage")]
public class InstallProvisioningPackage : ProvCmdletBase
{
[Parameter(HelpMessage = "Path to provisioning package", Mandatory = true, Position = 0)]
[Alias(new string[] {"Path"})]
public string PackagePath { get; set; }

[Parameter]
[Alias(new string[] {"Force"})]
public SwitchParameter ForceInstall { get; set; }

[Parameter]
[Alias(new string[] {"Quiet"})]
public SwitchParameter QuietInstall { get; set; }

It feels familiar... it feels just like an Advanced Cmdlet, doesn't it? PowerShell has been sneakily tricking us into becoming Programmers, yet again!

Once we scroll past the param declarations, we can see this cmdlets <code>Initialize()</code> method determines if the user provides a valid package path, then <code>.ProcessRecordVirtual()</code> gets called. protected override void ProcessRecordVirtual() { this.WriteObject((object) PPKGContainer.Install(this.TargetDevice, this.PackagePath, (bool) this.ForceInstall, (bool) this.QuietInstall), true); }
```

This line of code determines which params have been provided, then calls the `PPKGContainer` class to use that class' `Install()` method. Let's right-click on `PPKGContainer` , then 'Go To Declaration' to see how that works!

#### Higher and Higher

The `PPKGContainer` useful class is actually defined in a separate DLL file, `Microsoft.Windows.Provisioning.ProvCommon`, and contains a number of its own methods too. We are concerned with `Install()`.

```csharp
public static ProvPackageMetadata Install(TargetDevice target, string pathToPackage, bool forceInstall, bool quietInstall) { {...} int num = target.InstallPackage(pathToPackage, quietInstall);
```

There's a lot to unpack here. When this method is called, the cmdlet creates a new `TargetDevice` object, and refers to it as `target`, as seen in line 1. Then, down on line 4, we call the `target's` own `InstallPackage()` method.

That means just one more step and we'll finally be there, the summit of this cmdlet. We right-click on `TargetDevice` and then 'Go to implementation' and then hunt for the `InstallPackage()` Method. Here it is y'all, feast your eyes!

![](../assets/images/2017/05/https://foxdeploy.files.wordpress.com/2017/05/install.png?w=636)

Oh man, there's a lot going on here...but if we pare it all away we see that it takes params of a path to the PPKG file, and then a switch of QuietInstall. And then we...resolve the path to PROVTOOL.exe...huh, that's weird.

Next...we build a string with the path to the file...then add's a '`/quiet'` to the string...oh no, I see where this is going. Surely the `RemovePackage` method is more advanced, so let's take a look at that!

![payload](../assets/images/2017/05/images/payload.png)

Double-clicking on `TargetDevice,` we can then scroll down to the `RemovePackage` method to see how this one works.

![digging into uninstall method](../assets/images/2017/05/images/digging-into-uninstall-method.png)

We're so close now guys, I've got a feeling that this will be worth it!

![](../assets/images/2017/05/images/181010-shibainu-bobo-jacket.jpg) The closest thing that I could find to a fox in a winter coat.

## The Summit

What do we actually see at the very top of this module? The true payload, hidden from all eyes until now?

![](../assets/images/2017/05/images/truepayload.png)

That's it? It just calls `ProvTool.exe <pathtoFile.ppkg> /quiet`?

https://giphy.com/gifs/the-office-no-steve-carell-12XMGIWtrHBl5e

I dunno, I expected a little more, something a bit cooler. It's like climbing Mt Fuji to see only this.

![](../assets/images/2017/05/https://foxdeploy.files.wordpress.com/2017/05/lara_view.jpg?w=636) Image Courtesy of WaneringVegans

Well, after hours of work, I certainly had to see what happened if I just ran that exact command line on another machine. What if we just try that on another machine? Only one way to find out.

I ran it and then pulled the Windows EventLogs and...It worked!

![](../assets/images/2017/05/images/wow.png)

That's it kids, the Tooth Fairy ain't real, I'm beginning to have some doubts about Santa, and sometimes deep, deep within a module is just an old unloved orphan .exe file.

Thanks DotPeek, I guess.

### Where do we go from here?

I hope this post helped you! Later on, I'll be looking for other interesting PowerShell modules, and hope to learn about how they work under the covers! If you find anything interesting yourself, be sure to share it here with us too! Thanks for reading!

Want to read more about Climbing Mt. Fuji? Check these out:

- http://zoomingjapan.com/travel/climbing-mount-fuji-in-august/
- https://wanderingvegans.wordpress.com/tag/nokogiri-yama/

gha_language: HTML