text:
+++
title = "azurerm_security_center_policy resource"
draft = false
platform = "azure"

[menu]
  [menu.inspec]
    title = "azurerm_security_center_policy"
    identifier = "inspec/resources/azure/azurerm_security_center_policy.md azurerm_security_center_policy resource"
    parent = "inspec/resources/azure"
+++

[\[edit on GitHub\]](https://github.com/inspec/inspec/blob/master/docs-chef-io/content/inspec/resources/azurerm_security_center_policy.md)

Use the `azurerm_security_center_policy` InSpec audit resource to test properties
of the `default` Security Center Policy. Azure currently only supports looking
up the `default` policy via their Rest API. If you attempt to look up a
different Security Policy you will receive an error.

An Azure Security Center Policy defines a set of controls recommended for
resources within this subscription. These settings will generate alerts if
something is found to violate the recommendations. This resource allows you to
inspect what alerts you have configured for your account.

## Azure REST API Version

This resource interacts with version `2015-06-01-Preview` of the Azure
Management API. For more information see the [official Azure documentation](https://docs.microsoft.com/en-us/previous-versions/azure/reference/mt704062%28v%3dazure.100%29).

At the moment, there doesn't appear to be a way to select the version of the
Azure API docs. If you notice a newer version being referenced in the official
documentation please open an issue or submit a pull request using the updated
version.

## Availability

### Installation

This resource is available in the `inspec-azure` [resource
pack](/inspec/glossary/#resource-pack). To use it, add the
following to your `inspec.yml` in your top-level profile:

    depends:
      - name: inspec-azure
        git: https://github.com/inspec/inspec-azure.git

You'll also need to setup your Azure credentials; see the resource pack
[README](https://github.com/inspec/inspec-azure#inspec-for-azure).

### Version

This resource first became available in 1.0.0 of the inspec-azure resource pack.

## Syntax

An `azurerm_security_center_policy` resource block identifies a Security Center
Policy by name. In the current Rest API you may only lookup a `default` policy.
If no policy is given the default one will be used.

    describe azurerm_security_center_policy(name: 'default') do
      ...
    end

## Examples

### Assert that the default Security Center Policy exists

    describe azurerm_security_center_policy(name: 'default') do
      it { should exist }
    end

### Assert that the default Security Center Policy has log collection enabled

    describe azurerm_security_center_policy(name: 'default') do
      its('log_collection') { should eq('On') }
    end

### A non default policy may not be searched

    describe azurerm_security_center_policy(name: 'NonDefaultPolicy') do
      it { should_not exist }
    end

## Parameters

- `name`

## Parameter Examples

The name of the Security Center Policy. It must be `default`. If no name is given then it
will search for the `default` Security Center Policy (Optional).

    describe azurerm_security_center_policy(name: 'default') do
      its('log_collection') { should eq('On') }
    end

## Attributes

- `id`
- `name`
- `log_collection`
- `patch`
- `baseline`
- `anti_malware`
- `disk_encryption`
- `network_security_groups`
- `web_application_firewall`
- `next_generation_firewall`
- `vulnerability_assessment`
- `storage_encryption`
- `just_in_time_network_access`
- `app_whitelisting`
- `sql_auditing`
- `sql_transparent_data_encryption`
- `notifications_enabled`,
- `send_security_email_to_admin`
- `contact_emails`
- `contact_phone`
- `pricing_tier`

### id

The id of the Security Center
Policy.

    its('id') { should eq('/subscriptions/<SUBSCRIPTION_ID>/providers/Microsoft.Security/policies/default') }

### name

The name of the Security Center Policy.

    its('name') { should eq('default') }

### log_collection

Log collection indicates if the monitoring agent will collect security data (`On`|`Off`).

    its('log_collection') { should eq('On') }

### pricing_tier

Cost/Feature Model under which the subscription is operating (`Standard`|`Free`).

    its('pricing_tier') { should eq('Standard') }

### patch

Patch indicates if system updates should be enabled for virtual machines (`On`|`Off`).

    its('patch') { should eq('On') }

### baseline

Baseline indicates if OS vulnerabilities recommendations for virtual machines are enabled
(`On`|`Off`).

    its('baseline') { should eq('On') }

### anti_malware

Anti-Malware indicates if endpoint protection recommendations for virtual machines are
enabled (`On`|`Off`).

    its('anti_malware') { should eq('On') }

### disk_encryption

Disk Encryption indicates if recommendations for virtual machines are enabled
(`On`|`Off`).

    its('disk_encryption') { should eq('On') }

### network_security_groups

Network security groups indicates if recommendations for virtual machines are enabled
(`On`|`Off`).

    its('network_security_groups') { should eq('On') }

### web_application_firewall

Web application firewall indicates if recommendations for virtual machines are enabled
(`On`|`Off`).

    its('web_application_firewall') { should eq('On') }

### next_generation_firewall

Next generation firewall indicates if recommendations for virtual machines are enabled
(`On`|`Off`).

    its('next_generation_firewall') { should eq('On') }

### vulnerability_assessment

Vulnerability assessment indicates if recommendations for virtual machines are enabled
(`On`|`Off`).

    its('vulnerability_assessment') { should eq('On') }

### storage_encryption

Storage Encryption indicates if new data in Azure Blobs and Files will be encrypted by default (`On`|`Off`).

    its('storage_encryption') { should eq('On') }

### just_in_time_network_access

Just in time network access indicates if recommendations for virtual machines are enabled
(`On`|`Off`).

    its('just_in_time_network_access') { should eq('On') }

### app_whitelisting

App whitelisting indicates if adaptive application controls are enabled (`On`|`Off`).

    its('app_whitelisting') { should eq('On') }

### sql_auditing

SQL auditing indicates if auditing and threat detection recommendations are enabled
(`On`|`Off`).

    its('sql_auditing') { should eq('On') }

### sql_transparent_data_encryption

SQL transparent data encryption indicates if recommendations are enabled (`On`|`Off`).

    its('sql_transparent_data_encryption') { should eq('On') }

### notifications_enabled

Notifications enabled indicates if security alerts are emailed to the security contact
(`true`|`false`).

    its('notifications_enabled') { should eq(true) }

### send_security_email_to_admin

Send security email to admin indicates if the subscription admin will receive security
alerts (`true`|`false`).

    its('send_security_email_to_admin') { should eq(true) }

### contact_emails

Contact emails contains a list of security email addresses.

    its('contact_emails') { should<EMAIL_ADDRESS>}

### contact_phone

Contact phone contains the security contact phone number.

    its('contact_phone') { should eq('1-111-111-1111') }

### Other Attributes

There are additional attributes that may be accessed that we have not
documented. Please take a look at the [Azure documentation](#azure-rest-api-version).
Any attribute in the response may be accessed with the key names separated by
dots (`.`).

The API may not always return keys that do not have any associated data. There
may be cases where the deeply nested property may not have the desired
attribute along your call chain. If you find yourself writing tests against
properties that may be nil, fork this resource pack and add an accessor to the
resource. Within that accessor you'll be able to guard against nil keys. Pull
requests are always welcome.

## Matchers

This InSpec audit resource has the following special matchers. For a full list of
available matchers, please visit our [Universal Matchers
page](/inspec/matchers/).

### exists

The control will pass if the resource returns a result. Use `should_not` if you expect
zero matches.

    # default should always exist
    describe azurerm_security_center_policy(name: 'default') do
      it { should exist }
    end

    # this security center policy should not exist
    describe azurerm_security_center_policy(name: 'DoesNotExist') do
      it { should_not exist }
    end

## Azure Permissions

Your [Service
Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal)
must be setup with a `contributor` role on the subscription you wish to test.


text:
# grunt-vash v0.1.0 [![Build Status: Linux](https://api.travis-ci.org/MoLow/grunt-vash.svg)](https://travis-ci.org/MoLow/grunt-vash)

> Compile Vash templates

## Getting Started
This plugin requires Grunt `>=0.4.0`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-vash --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-vash');
```

## Vash task
_Run this task with the `grunt Vash` command._

Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
### Options

#### process
Type: `Function`
Default: null

Process the output of a compiled vash template.

#### model
Type: `Object`

Sets the model passed to Vash during template compilation. Any data can be passed to the template.

#### dest
Type: `String`

Sets the destination where to save compiled vash template.

### Usage Examples

```js
vash: {
    compile: {
        files: {
            'test/fixtures/unit.vash': {
                dest: 'tmp/vash.html',
                model: {
                    theme: 'theme1', name: 'fixtures'
                }
            },
        },
        options:{
            process: function(content, path){
                return content.replace(/<!---->/gi, '');
            }
        }
    },
}
```

if you ar intreastead in multiple destenations for a single vash file:

```js
vash: {
    compile: {
        files: {
            'test/fixtures/unit.vash': {
                'theme1':{
                    dest: 'tmp/vash.html',
                    model: {
                        theme: 'theme1', name: 'fixtures'
                    }
                },
                'theme2':{
                    dest: 'tmp/vash.html',
                    model: {
                        theme: 'theme2', name: 'bob'
                    }
                },
            },
        },
        options:{
            process: function(content, path){
                return content.replace(/<!---->/gi, '');
            }
        }
    },
}
```

license: MIT

repository: MoLow/grunt-vash

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: MoLow/grunt-vash


text:
# Escrow

This is an example of an escrow holder with vesting schedule. Any given tokens can be transferred in,
and the contract will hold them until vesting is invoked, distributing the percentage back that is owed to the user.

## Steps

1. compile contract `npm run compile` or `npm run compile:docker`

1. create account for `eosio.token`

1. deploy contracdt for `eosio.token`

1. create account for `escrow`

1. deploy contract under `escrow` account

1. Create user `user1`

1. Create `eosio.token` and issue some to `escrow` with `user1` as the `memo`

1. Now you can see the user balance via `cleos get currency balance escrow user1` (leveraging the fact that `cleos get currency balance` will look for a table `account` scoped to the user's `name`, with a primary key of the given `symbol`).

1. Add a period (3/4 of vesting by Jan 1 of 2019) `cleos push action escrow addperiod '["JAYS",<PHONE_NUMBER>000, 3, 4]' -p escrow`
   ( 2018 is `1514764800000`)

1. Invoke `vest`

repository: jjgonecrypto/eos-contracts

repo_name: jjgonecrypto/eos-contracts


text:
# TDD Lab Exercise 3

Exercises for http://sch3lp.github.io/tdd-course

## Technology

Preferably Java. Test Harnass with [JUnit5](https://junit.org/junit5/docs/current/user-guide/#writing-tests). Assertions with [AssertJ](http://joel-costigliola.github.io/assertj/).

## Assignment

We're going to be implementing a simplistic spreadsheet program.

Finish one story at a time and always apply Test First!

Make at least one commit per story!

### Unit tests

We did not supply **any tests** so you'll have to do your very best...

**Ok but what do I test exactly?**

![](test-all-the-things.jpg)

Happy path, edge cases, logic, ...

### Story 1: Simple spreadsheet

- A spreadsheet is identified by an unlimited amount of rows and columns
- A Row is identified with a number from 1 onwards...
- A Column is identified with a letter: A -> Z, AA -> ZZ, ...
- Cells are empty by default (`""`, not `null` or `undefined`)
- Cells should be able to store text
- A Cell can be identified by the combination of a column and a row.
- You should be able to read a cell's contents

### Story 2: Numerical & literal values

- Cells with numerical content are evaluated automatically:
- Text `"  124  "` (with spaces) becomes the number `124` (without spaces)
- You should be able to read the literal contents of a cell
- Cell with text `"  124  "` has a literal value of `"  124  "` and value of `124`

### Story 3: Formulas

- `"=234"` is a formula, `" =234"` (space) is plain text
- The value of formula `"=234"` is the number `234`. Its literal value is the formula itself
- Kinds:
    - Constants `=124`
    - Wrapped with braces `=((124))`
    - Simple calculations `=3+5`, `=5-3`, `=4*2`
    - Complex calculations `=7*(2+3)*((((2+1))))`

Tip: don't try to evaluate the calculations above by yourself. You can use Java's _Nashorn JS_:

```java
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("nashorn");
engine.eval('4 + 5');
```

In Javascript it's simply a matter of using `eval()`.

### Story 4: Catching formula errors

When a formula contains an error, the value of the cell should be `**#ERROR**`.

### Story 5: References

When cell `A1` has a literal value of `=A2`:

- The value should be the value that is pointed to.
- When the value in A2 changes, the value in A1 changes as well.
- References to references should be possible! A1 -> A2 -> A3
- Circular references are impossible and should have `**#CIRCULAR**` as value.

### Story 6: Functions

For example: `=SUM(A1:A6)`.

- Provide a summing function that can be called with `SUM(RANGE)` as a literal value
- Provide an averaging function that can be called with `AVERAGE(RANGE)` as a literal value


text:
## Machine_Learning-Specialization-UW
**1/4 in Machine_Learning-Specialization————A Case Study Approach**

---
### Course-Content 学习内容
--
* **结合现实存在的公司来谈机器学习在商业的核心应用形式**

Combine the reality of the company to talk about machine learning in the commercial core application form

* **了解回归，分类，深度学习以及推荐系统的基本原理和应用领域**

Understand the basic principles and applications of regression, classification, depth learning and recommendation system

* **结合python和grahplab完成在“回归，分类，深度学习以及推荐系统”等5个方面的机器学习应用**

Combine python and grahplab to complete machine learning applications in the five areas of "regression, classification, depth learning and recommendation system"

* For more information：go https://www.coursera.org/learn/ml-foundations

## Author
[MingJun Li](https://github.com/littlewizardLI)

## License
[MIT license](https://github.com/littlewizardLI/LICENSE)


text:
Laravel-SeaweedFS
================

A Laravel integration of [seaweedfs-client](https://github.com/tystuyfzand/seaweedfs-client) with implementations making it useful for file storage, and using Laravel's own cache/database functionality for caching and mapping.

This package is pretty much untested and might not be production ready.

Configuration
-------------

All configuration options can be found in `config/seaweedfs.php` after publishing the vendor config:

```
php artisan vendor:publish --provider="SeaweedFS\Laravel\SeaweedFSProvider"
```

Required keys for a connection are `master`, optional are `cache`, `cache_store`, and `scheme`.

Storage Mapping
---------------

As mentioned in [flysystem-seaweedfs](https://github.com/tystuyfzand/flysystem-seaweedfs), this flysystem implementation uses a Mapping class that does **NOT** use the SeaweedFS Filer.

That being said, any read/write operations can use paths that map to a seaweedfs file, and URLs to the files may be generated using the `Storage::url()` method.

license: ISC

repository: tystuyfzand/laravel-seaweedfs

repo_name: tystuyfzand/laravel-seaweedfs


text:
# Hotel Management

This little gem is a simple application to manage a hotel by checking in/checking out guests.

## Purpose

This application is mainly used as an experiment to test out the [dry-monads](https://dry-rb.org/gems/dry-monads/) and [dry-validation](https://dry-rb.org/gems/dry-validation/) libraries from [https://dry-rb.org/](https://dry-rb.org/). They allow for easier control flow through a variety of clean, functional steps that can each produce an error. Inspired by [railway-oriented-programming](https://fsharpforfunandprofit.com/rop/) from the F# community.

## Example usage:

```ruby
hotel = Hotel.new
room_manager = RoomManager.new

# create a guest and try to check them in
guest = { name: "Jan Hrach", rooms: [18, 19, 20]}

# check in a guest
# check_in_result is either a Success or Failure monad
check_in_result = CheckInGuest.new(room_manager: room_manager).call(guest)

# check out the guest
# result is either a Success or Failure monad
check_out_result = CheckOutGuest.new(room_manager: room_manager).call(guest)
```

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

repository: Macavirus/hotel-management-dry-rb

repo_name: Macavirus/hotel-management-dry-rb


text:
# Split Second

## Setup

This was a web challenge that involved exploiting a couple of bugs within a [Node.js](https://nodejs.org/en/) web [server](./server.js).

The server source can be pulled down with a request to the `/source` endpoint, as noted when viewing source of the site's index page.

It is immediately obvious that the goal is to somehow request the `/flag` endpoint from localhost, as this allows us to pass a payload to the [Pug templating engine](https://pugjs.org). Pug is no different than most other server-side templating engines in that reaching code execution through them is fairly trivial.

## Request Splitting

To request the `/flag` endpoint from localhost, we will need some kind of SSRF. The comment indicating the Node version of 8.12.0 (which is quite old) at the top of the [`server.js`](./server.js) file is a give away as to where to begin the search.

Some basic [OSINT](https://hackerone.com/reports/409943) gives us what we are looking for: an [HTTP request splitting vulnerability](https://twitter.com/YShahinzadeh/status/1039396394195451904) for this version of Node. [Node Version Manager](https://github.com/nvm-sh/nvm) is an amazing project that let me set up a matching environment quickly to confirm that this vulnerability applied.

With a SSRF path in hand, we just needed to send a Pug payload. Fortunately, the [`tplmap` project](https://github.com/epinna/tplmap) already has [one](https://github.com/epinna/tplmap/blob/749807616ab1b173827913b325c5974e8f77f3d8/plugins/engines/pug.py#L57).

## Payload Encoding

However, the Pug payload header blacklists all lowercase characters. There is also a blacklist earlier on in the server's request-handling flow to disallow the main keywords (and `!` symbol) that would be used in a typical Pug payload.

To bypass these, I used a [jsfuck](http://www.jsfuck.com/)-inspired set of primitives (neatly organized in [a table on Wikipedia](https://en.wikipedia.org/wiki/JSFuck#Example:_Creating_the_letter_%22a%22)). This gist of the Pug payload is to build up references to the [`String.fromCharCode`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) function (for encoding the shell exec Pug payload) and [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) constructor (for creating and executing a function from a string).

A full solution script is available [here](./solve.py).

repository: welchbj/ctf

gha_language: Python

gha_license_id: MIT

repo_name: welchbj/ctf


text:
---
layout: post
title: Debugging the .NET Framework Library Source Code
date: '2008-01-18 00:06:22 -05:00'
---

A while ago, I [talked]({% post_url /2007/2007-10-05-.NET-Framework-Library-Source-Code %}) about Microsoft releasing the source code for the .NET Framework in order for you to debug it through Visual Studio 2008. Just a few days ago, it was finally released. [Shawn Burke](http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx) has an excellent and detailed post explaining how to set this up and also has a trouble shooting section.

Currently, the following libraries have been released:

*   NET Base Class Libraries (including System, System.CodeDom, System.Collections, System.ComponentModel, System.Diagnostics, System.Drawing, System.Globalization, System.IO, System.Net, System.Reflection, System.Runtime, System.Security, System.Text, System.Threading, etc).
*   ASP.NET (System.Web, System.Web.Extensions)
*   Windows Forms (System.Windows.Forms)
*   Windows Presentation Foundation (System.Windows)
*   ADO.NET and XML (System.Data and System.Xml)

I have set this up on one of my development systems and it works well. I'll like it better when I can download all of the symbols in one shot, but this works for now.


text:
# Decentralized (Parallel) Computing
The goal here is to calculate an arbitrarially large set of prime numbers in such a way that the task can be broken up into smaller packets and sent off to other computers and then merged back in.

|Test Description | Time|Multiplicative|
|-----------------:|:---------------:|:---------------:|
|[1 computer benchmark](https://github.com/jojo2357/Prime-Number-Library) (10k primes) | ~450ms| 1|
|1 computer optimal result (10k primes) | ~950ms|2.11|
|1 computer bogorder (10k primes) | ~1600ms|3.56|


text:
# Releasing next version

## pypirc
create `.pypirc` file with account configuration

```
[distutils]
index-servers =
  pypi
  pypitest

[pypi]
repository=https://pypi.python.org/pypi
username=<username>
password=<password_here>

[pypitest]
repository=https://testpypi.python.org/pypi
username=<username>
password=<password>

```

## setup.py

Example `setup.py` file

```python
from setuptools import setup, find_packages
from os import path
from codecs import open

here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='um',
    version='1.3.0',  # development release
    description='Package with utilities',
    long_description=long_description,  # read this form README.rst
    url='https://github.com/umatbro/u-utils',
    author='umat',
<EMAIL_ADDRESS>    license='MIT',
    classifiers=[
        'License :: OSI Approved :: MIT License',
        'Intended Audience :: Developers',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Utilities',
    ],
    keywords='utils',
    packages=find_packages(exclude=['docs']),
    install_requires=[],
    python_requires='>=3',
    entry_points={
        'console_scripts': []
    }
)
```

Before release remember to update `version`.

`install_requires` - dependencies needed to run the project

## Packaging the project

### wheel

Before you can build wheels for your project, you’ll need to install the `wheel` package:

```
pip install wheel
```

To build the wheel:

```
python setup.py bdist_wheel
```

## Uploading project to PyPi

When package distribution is created in `dist/` directory it is time to upload files.

```
twine upload dist/*
```

## Other

Remember to also keep track with your releases with git tags. To add git tag:

```
git tag 1.4.0
```

To push tag to remote:

```
git push origin <tag_name>
```

Command to push **all** tags (not recommended)

```
git push --tags
```

repository: umatbro/u-utils

repo_name: umatbro/u-utils


text:
[![npm version](https://badge.fury.io/js/rohr.svg)](https://www.npmjs.com/package/rohr)
[![](https://travis-ci.org/AlexanderDzhoganov/rohr.js.svg?branch=master)](https://travis-ci.org/AlexanderDzhoganov/rohr.js)
[![codecov.io](https://codecov.io/github/AlexanderDzhoganov/rohr.js/coverage.svg?branch=master)](https://codecov.io/github/AlexanderDzhoganov/rohr.js?branch=master)
[![](https://david-dm.org/AlexanderDzhoganov/rohr.js.svg)](https://david-dm.org/AlexanderDzhoganov/rohr.js)

# rohr.js - validation & transformation library

#### Rohr helps you to:
- Reliably extract data from complex hierarchies
- Validate JSON requests in your API server
- Freely mix synchronous and asynchronous transformations on your data
- Integrate APIs together
- Easily bring in legacy data

### Installation

```
npm install rohr
```

Running the tests:
```
npm install
npm test
```

### Basic example

Rohr is under active development and some of the documentation may be lacking or obsolete. [See the test suite for up-to-date examples](https://github.com/AlexanderDzhoganov/rohr.js/blob/master/test/rohr.spec.js).

```es6
var rohr = require('rohr');

var input = {
    "foo": "42"
};

rohr(input)

.prop('foo').isString().castTo('integer').transform(function(val) {
    return val * 2;
})

.toPromise().then(function(object) {
    console.log(object);
});

```

Result:
```json
{
    "foo": 84
}
```

## Handling errors

Rohr does not stop when it encounters an error but instead logs it and continues processing the rest of the data.
The list of errors can be obtained by calling `.error(callback)` where `callback` is of type `function (errors) {}`.
Each error objects contains information about where the error occured as well as an error type. If using `.toPromise()`, any encountered errors during processing will cause the promise to be rejected. This behavior can be overriden by calling `.toPromise(true)` instead and using `.error()` to handle errors.

Error type               | Description
------------------------ | -----------------------------------------------------------------
UndefinedProperty        | A property selected with `.prop()` was not found in the input data. Error data contains `property` which is the property name and `scope` which is the scope where the error occured.
InvalidScopeToNonObject  | When calling `.scope()` on a non-object.
TransformPromiseRejected | A promise returned by a `.transform()` call was rejected, the rejection error can be found in the `err` property.
InvalidPropertyType      | A type check (e.g. `isString()`, `isNumber()`) failed. Error data: `property`, `expectedType`, `actualType`, `scope`
LookupFailed             | A `lookup()` call failed to find a match for the selected property. Error data: `property`, `key`, `scope`
MapOverNonArray          | When calling `.map()` on a non-array type.
ValidationError          | When `validate()` fails by either the callback returning `false` or a rejected promise. In the case of a promise the rejection error will be in the `err` property of the error object.

## API

Method                          | Description
------------------------------- | ---------------------------------------------------------------------------------------
prop(propertyName)              | Selects a property in the current scope, adds a validation error if the property is `null` or `undefined`.
optional(propertyName)          | Selects a property in the current scope, no validation if performed if the property exists. Any further chained methods for this property will be ignored if its value is `null` or `undefined`.
set(propertyName, [value/fn])   | Sets the value for a property, value can be a value or a function returning a value/ promise resolving to a value.
value([value/fn])               | Sets the value of the currently selected property (by using `prop()` or `optional()`). Single argument is a value or a function returning a value or a promise resolving to a value.
nuke()                          | Removes the selected property from the object.
scope()                         | Enters the scope of the currently selected property. Only valid if property is an object.
scopeBack()                     | Brings you back to the previous scope.
rootScope()                     | Brings you back to the root scope.
castTo(typeName)                | Casts the currently selected property to a specific type given by `typeName`. Allowed values are: `integer`, `float`, `string`, `date`.
transform(fn)                   | Transforms the currently selected property with a function of the type `function (value, [scope], [rootScope]) {}`. The function can return a new value or a promise resolving to the new value.
isString()                      | Ensures the currently selected property is of type `String`, adds a validation error otherwise.
isNumber()                      | Ensures the currently selected property is of type `Number`, adds a validation error otherwise.
isBoolean()                      | Ensures the currently selected property is of type `Boolean`, adds a validation error otherwise.
isDate()                        | Ensures the currently selected property is of type `Date`, adds a validation error otherwise.
isArray()                       | Ensures the currently selected property is of type `Array`, adds a validation error otherwise.
isObject()                      | Ensures the currently selected property is of type `Object`, adds a validation error otherwise.
lookup([array/object], optional:key)     | Performs a look-up for the currently selected property in an array or an object. `key` tells the library which key to look for in the objects if an `array` is passed as the first argument.
map(fn)                         | Maps every object of the currently selected `array` property using a function of the type `function (value) {}`. The function can return a new value for each item in the array or a promise resolving to the new value or a mix of those.
rename(propertyName)            | Renames the currently selected property.
rescope(propertyPath)           | Moves the currently selected property to a new scope. The path starts from the root of the object and accepts dots `.` (e.g. `foo.bar`). Any non-existing properties are created automatically, existing properties are overwritten.
broadcast([propertyName/array]) | Broadcasts the value of the currently selected property to one or more other properties. Single argument is either a string or an array of strings.
validate(fn)                    | Validates the value of the currently selected property using `fn` which is a `function (value) {}` which returns a boolean or a promise. A resolved promise means the validation is successful and no further action is taken, a rejected promise will result in a `ValidationError`, the rejection error can be found in the `err` property of the error object.
ifEquals([value/fn])                  | Opens a matching scope where any calls before `endIf()` will be ignored if argument value is `false` or if the passed function returns false or a promise resolving to `false`.
endIf()                         | Closes a matching scope opened by `ifEquals`.
toPromise(ignoreErrors)         | Returns a promise that resolves to the transformed object, or is rejected with a list of errors
resolve()                       |
object()                        |
error()                         |


text:
# FreeCodeCamp React Project 4: Build a Roguelike Dungeon Crawler Game

## [Instructions on FreeCodeCamp](https://www.freecodecamp.org/challenges/build-a-roguelike-dungeon-crawler-game)

## [FreeCodeCamp's version](https://codepen.io/FreeCodeCamp/full/PNJRyd/)

## [My Version hosted on CodePen](https://codepen.io/leonard92/pen/aYbpGK)


text:
# Testing Kured

To do a manual test connect to a node using these [instructions](https://learn.microsoft.com/en-us/azure/aks/node-access) and create a file on the node itself.
```
sudo touch /var/run/reboot-required
```
Reboot will occur.

By default the kured daemon set checks the nodes if they need restarted once every hour.

repository: hmcts/cnp-flux-config

gha_language: Shell

repo_name: hmcts/cnp-flux-config


text:
[![GitHub issues](https://img.shields.io/github/issues/TrainingByPackt/Introduction-to-Site-Reliability-Engineering.svg)](https://github.com/TrainingByPackt/Introduction-to-Site-Reliability-Engineering/issues)
[![GitHub forks](https://img.shields.io/github/forks/TrainingByPackt/Introduction-to-Site-Reliability-Engineering.svg)](https://github.com/TrainingByPackt/Introduction-to-Site-Reliability-Engineering/network)
[![GitHub stars](https://img.shields.io/github/stars/TrainingByPackt/Introduction-to-Site-Reliability-Engineering.svg)](https://github.com/TrainingByPackt/Introduction-to-Site-Reliability-Engineering/stargazers)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/TrainingByPackt/Introduction-to-Site-Reliability-Engineering/pulls)

# Introduction to Site Reliability Engineering

Code bundles for Introduction to Site Reliability Engineering authored by Gabriel Abinante, Seth Curry and published by Packt.

The course showcases...

## What you will learn
*	Design highly reliable application architectures
*	Understand core cloud services and Infrastructure as a Service concepts
*	Create functional security perimeters for web applications
*	Create software to reduce the amount of work required to maintain a system
*	Understand and create complex deployment systems, such as orchestrated multi-datacenter or canaried rollouts
*	Implement scalable design  and resilient microservices
*	mplement the role of a Site Reliability Engineer within the greater context of a company

### Hardware requirements
For an optimal student experience, we recommend the following hardware configuration:
* **Processor**: Intel Core i3 or equivalent
* **Memory**: 3GB RAM
* **Hard disk**: 35GB or more
* An Internet connection

### Software requirements
You’ll also need the following software installed in advance:
* Operating System: TBD
* Browser: Google Chrome or Mozilla Firefox (with the latest updates installed)
* TBD Latest Version
* TBD, Latest Version


text:
# DiscoGAN implementation in Tensorflow

As part of the implementation series of [Joseph Lim's group at USC](http://csail.mit.edu/~lim), our motivation is to accelerate (or sometimes delay) research in the AI community by promoting open-source projects. To this end, we implement state-of-the-art research papers, and publicly share them with concise reports. Please visit our [group github site](https://github.com/gitlimlab) for other projects.

This project is implemented by [Jiayuan Mao](https://github.com/vacancy) and reviewed by [Shao-hua Sun](https://github.com/shaohua0116).

## Descriptions

This repo is a [Tensorflow](https://www.tensorflow.org/) implementation of DiscoGAN on Pix2Pix datasets: [Learning to Discover Cross-Domain Relations with Generative Adversarial Networks](https://arxiv.org/abs/1703.05192).

This paper introduced an awesome framework for finding one-to-one mapping between two domains in an unsupervised way.
The high-level idea is the joint training of two GAN model G1 and G2 in parallel (one for A->B and the other one for B->A).
Besides the adversarial loss, there is also reconstruction loss to ensure the consistency.
Specifically, we restrict that G2(G1(A)) = A and G1(G2(B)) = B.

## Requirements

- Python 3.5
- [Tensorflow](https://www.tensorflow.org/)
- [Pillow](https://pillow.readthedocs.io/en/4.0.x/)
- [tqdm](https://github.com/tqdm/tqdm)
- [lmdb](https://lmdb.readthedocs.io)
- [zmq](http://pyzmq.readthedocs.io)
- opencv

## Usage

Clone the whole repo with

    $ git clone --recursive https://github.com/gitlimlab/DiscoGAN-Tensorflow

This implementation is based on a third-party neural network library for Tensorflow: TensorArtist.

We have included one TensorArtist version in the repo. For simplicity, first setup your environment by

	$ source activate.sh

This will export some environment variables. In particular, this allows you to run `tart` command.

Download the dataset with the scripts in `dataset-tools` directory. The detail usage is contained inside the README file inside the directory. After downloading the datasets, you need to move the LMDB generated to data/Pix2Pix directory. For `edges2shoes` dataset, put two lmdbs in `data/Pix2Pix/edges2shoes/` directory.

Download the dataset edges2shoes with the script `dataset-tool/gen-lmdb-pair.py`. And the two downloaded folder into the directory `./data/Pix2Pix/edges2shoes`.

For the training, simply run

    $ tart-train desc_discogan_edges2shoes_cnn.py -d gpu0

After the training procedure, demonstrate your result using

    $ tart-demo desc_discogan_edges2shoes_cnn.py -d gpu0 -e last

## Results on edges2shoes dataset

The left part of the image is edges -> shoes mapping (the odd columns are the edges and even columns are the shoes) the right part,
while the right part is shoes -> edges mapping.

**The result shown here is not the final result, but results at an early stage (@epoch 30).**

Demonstration of training losses.

## FAQ

Q: How to use multiple gpus or cpu for training?

A: Try the following command `tart-train desc_***.py -d gpu0 gpu1` or `tart-train desc_***.py -d 0 1` or `tart-train desc_***.py -d cpu`.

Q: How can I get the trained model?

A: All training results will be put in your `dump` directory. Inside the `snapshots` directory are the snapshot for models after every epoch.
The models can be simply loaded with a python `pickle` package. And all weights/biases are stored as `numpy` arrays in the `pickle` file.

Q: How to restore a training?

A: Try `tart-train desc_***.py -d gpu0 --continue` (continue from last snapshot) or `tart-train desc_***.py -d gpu0 --continue-from 10` (continue from the snapshot for the 10th epoch).

Q: How can I use Tensorboard to visualize the training?

A: After the training started, it will automatically open a tensorboard application listening on a random port. You can find the port on the log message.
An alternative way is to open a tensorboard yourself by find the directory named `tensorboard` in your `dump` directory, which is the log directory.

Q: How to demonstrate the result for intermediate epochs?

A: All snapshots can be found in the `dump/***/snapshots` directory. You can run the demo with `tart-demo desc_***.py -d gpu0 -e 10` (the 10th snapshot), or `tart-demo desc_***.py -d gpu0 -w dump/***/snapshots/***.snapshot.pkl` (custom snapshot file).

Q: How to run experients based on your code?

A: Note that when you start a new training using the same description file (`desc_***.py`), it will OVERWRITE your previous training. So the suggested way is to copy the old description file to a new one with different name (so that they will not be dumped into the same directory) and make your modification.

repository: clvrai/DiscoGAN-Tensorflow

repo_name: clvrai/DiscoGAN-Tensorflow


text:
# Selenium Automation: Adding Cisco Meraki VPN exclusion rules

In the sample, you can see how we automatically add (from the list) VPN exclusion rules after running the script.

[Selenium](https://www.selenium.dev/) is an open-source tool that automates web browsers. It provides a single interface that lets testers automate user actions using multiple programming languages such as Ruby, Java, NodeJS, PHP, Perl, Python, and C#. But what if we try to automate some tasks that we can do only by using Web GUI interfaces/Dashboard?

### Requirements
You can deploy app using [Python](https://www.python.org/downloads/)

Download the latest Firefox driver [here](https://github.com/mozilla/geckodriver/releases/tag/v0.30.0)
Add Firefox driver in `/usr/local/bin/geckodriver` or edit path in `fillLocalInternetBreakout.py` [file](fillLocalInternetBreakout.py#L28)

### Clone and open project

```
git clone https://github.com/oborys/Selenium_automation_Adding_Cisco_Meraki_VPN_exclusion_rules.git
cd Selenium_automation_Adding_Cisco_Meraki_VPN_exclusion_rules
```

Open files `cred` and paste your variable that you use to access the Cisco Meraki dashboard `email`, `dashboardPass`, and 'url_sd_wan_and_traffic_rules' as URL for access SD-WAN and Traffic rules setting.

![img](img/selenium_demo.png)

**For Windows:**

CLICK ME

Install pip

Pip (Python Package Installer), the official documentation for [pip](https://pip.pypa.io/en/stable/installation/).

Usually Python3 comes with pip preinstalled. If you get an error "pip command not found", use the following command to install pip:

Download [get-pip.py](https://pip.pypa.io/en/stable/installation/), make sure you're saving the file to Desktop

In your Command Prompt, navigate to Desktop.
```
cd Desktop
```
Execute get-pip.py
```
python get-pip.py
```
Now pip should work system-wide.

virtualenv

In your Command Prompt, enter:
```
pip install virtualenv
```
Launch virtualenv

In your Command Prompt navigate to your project:
```
cd Meraki_Network_Objects_automation
```
Within your project:
```
virtualenv env
```
Activate your virtualenv:

on Windows, virtualenv creates a batch file
```
\env\Scripts\activate.bat
```
to activate virtualenv on Windows, activate script is in the Scripts folder :

\path\to\env\Scripts\activate

Example:
```
C:\Users\'Username'\venv\Scripts\activate.bat
```
Another way to install pip

Save the "ez_setup.py" file to your desktop form https://bootstrap.pypa.io/ez_setup.py

In your Command Prompt navigate to Desktop:
```
cd Desktop
```
Execute ez_setup.py:
```
python ez_setup.py
```
install pip:
```
easy_install pip
```
Install dependencies
```
pip install -r requirements.txt
```
Run the app
```
set FLASK_APP=hello
flask run
```

```
python3 -m venv venv
```

Activate your venv

```
source venv/bin/activate
```

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

```
export FLASK_APP=meraki_automation.py
```
Run the app
```
python fillLocalInternetBreakout.py
```

branch_name: refs/heads/main


text:
---
name: Enhancement suggestion
about: A single, discrete feature addition to the website
---

### Description

<!--
Short description of the enhancement:
Describe the desired behavior
Add related issues
-->

**Why this is valuable:**

<!-- Who will this help? How? -->

### Acceptance Criteria

<!-- What do you expect to happen? -->
<!-- ie. "Link to Register opens in a new tab" -->

- [ ] Expectation 1
- [ ] Expectation 2

### Resources

<!-- Link to any helpful resources, tutorials, or tools we might use to complete this enhancement. -->

branch_name: refs/heads/production

gha_language: JavaScript


text:
[![CircleCI](https://circleci.com/gh/f-scratch/circleci-danger.svg?style=svg)](https://circleci.com/gh/f-scratch/circleci-danger)
[![](https://images.microbadger.com/badges/version/fromscratch/circleci-danger.svg)](https://microbadger.com/images/fromscratch/circleci-danger "Get your own version badge on microbadger.com")
[![](https://images.microbadger.com/badges/image/fromscratch/circleci-danger.svg)](https://microbadger.com/images/fromscratch/circleci-danger "Get your own image badge on microbadger.com")
[![](https://images.microbadger.com/badges/commit/fromscratch/circleci-danger.svg)](https://microbadger.com/images/fromscratch/circleci-danger "Get your own commit badge on microbadger.com")

# circleci-danger

for circleci danger

## Requirements

ruby:2.3.1-alpine

Cannot build with
- ruby:2.4.*
- ruby:2.5.*

## Docker pull

```
docker pull fromscratch/circleci-danger
```

## Getting Started for CircleCI's setting

1. Setting up for danger to use
https://danger.systems/guides/getting_started.html#setting-up-an-access-token
2. Setting up Contexts or Project's Environments of CircleCI for danger
https://circleci.com/docs/2.0/contexts/
3. Add danger job to `.circleci/config.yml`

```
## Example of .circleci/config.yml

version: 2

jobs:
  danger:
    docker:
      - image: fromscratch/circleci-danger
    steps:
      - checkout
      - run: cp ~/danger/Dangerfile .
      - run: bundle exec danger --fail-on-errors=true

workflows:
  version: 2
  danger:
    jobs:
      - danger:
        # When you use contexts
          context: danger

  # Execute periodically to update PR status
  scheduled-workflow:
    triggers:
      - schedule:
          cron: "0 18 * * *"
          filters:
            branches:
              ignore:
                - master
    jobs:
      - danger:
          # When you use contexts
          context: danger
```

repository: f-scratch/circleci-danger

gha_language: Ruby

repo_name: f-scratch/circleci-danger


text:
[![R build status](https://github.com/mrc-ide/malariasimulation/workflows/R-CMD-check/badge.svg)](https://github.com/mrc-ide/malariasimulation/actions)
[![codecov](https://codecov.io/github/mrc-ide/malariasimulation/branch/master/graphs/badge.svg)](https://codecov.io/github/mrc-ide/malariasimulation)

# malariasimulation

Imperial College London's next malaria simulation. The main goals are make an
extensible, maintainable and fast simulation to evaluate and report on malaria
intervention strategies.

The model is defined in this package, whereas the simulation is executed using
the [individual](https://github.com/mrc-ide/individual) package.

## Installation

Please note, malariasimulation is only compatible with R >= 4.0.0

You can install the binary package on Windows and Mac using the following
command:

```R
# Enable this universe
options(repos = c(
    mrcide = 'https://mrc-ide.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'))

# Install some packages
install.packages('malariasimulation')
```

The package can also be installed from github using the "remotes" library. Note, this
method requires [RBuildTools](https://cran.r-project.org/bin/windows/Rtools/)

```R
library('remotes')
install_github('mrc-ide/malariasimulation')
```

For development it is most convenient to run the code from source. You can
install the dependencies in RStudio by opening the project and selecting "Build" >
"Install and Restart"

Command line users can execute:

```R
library('remotes')
install_deps('.', dependencies = TRUE)
```

Docker users can achieve the same with one line

```bash
docker build . -f docker/Dockerfile.dev -t [your image name]
```

## Usage

To run the malaria simulation with the default parameters for 100 timesteps, you
can execute the following code:

```R
library('malariasimulation')

output <- run_simulation(100)
```

Please see [vignettes](https://mrc-ide.github.io/malariasimulation/articles/Model.html) for more detailed use.

## Code organisation

*model.R* - is the entry point for the model. It creates the different
components and passes them to the `individual` package for simulation.

*variables.R* - contains the specific variables we track for each individual.

*processes.R* - defines the changes in individuals over time. It collects
process functions from "infection.R", "mosquito_emergence.R" and "mortality.R"

*tests* - are divided into unit and integration tests. Integration tests are
strongly recommended for large process functions and unit tests for model
calculations.

## Contributing

Pull requests are welcome. For major changes, please open an issue first to
discuss what you would like to change.

Please make sure to update tests and documentation as appropriate.

Code reviews will be carried out in-line with RESIDE-IC's [review
process](https://reside-ic.github.io/articles/pull-requests/)

## License
[MIT](https://choosealicense.com/licenses/mit/)

repository: mrc-ide/malariasimulation

gha_language: R

gha_license_id: NOASSERTION

repo_name: mrc-ide/malariasimulation


text:
---
title:  "Repository Pattern C#"
description: "A Repository mediates between the domain and data mapping layers. Repository Pattern in C# supports the objective of achieving a clean separation and one-way dependency between the domain and data mapping layers."
image: "/images/repository-pattern-csharp.jpg"
date: Sun Jun 30 14:00:06 2019
last_modified_at: Sun Nov 24 17:06:50 2019
categories: [Design Pattern, C#]
author: shadman_kudchikar
comments: true
---

![Repository Pattern C#][post-image]

## Contents
- [What Is Repository Pattern C\# ?](#what-is-repository-pattern-csharp)
- [Why Repository Pattern C\# ?](#why-repository-pattern-csharp)
- [Entity Framework Repository Pattern C\#](#entity-framework-repository-pattern-csharp)
- [Generic Repository Pattern C\#](#generic-repository-pattern-csharp)
- [Unit Of Work Pattern C\#](#unit-of-work-pattern-csharp)
- [Repository Pattern C\# MVC](#repository-pattern-csharp-mvc)
- [Further Reading](#further-reading)
- [References](#references)

## What Is Repository Pattern C\# ? {#what-is-repository-pattern-csharp}

A Repository mediates between the domain and data mapping layers (like [Entity Framework](https://docs.microsoft.com/en-us/ef/ef6/)). It allows you to pull a record or number of records out of datasets, and then have those records to work on acting like an in-memory domain object collection, and you can also update or delete records within those data set, and the mapping code encapsulated by the Repository will carry out the appropriate operations behind the scenes.

<!--more-->

Repository pattern is a way to implement data access by encapsulating the set of objects persisted in a data store and the operations performed over them, providing a more object-oriented view of the persistence layer.

Repository pattern also supports the objective of achieving a clean separation and one-way dependency between the domain and data mapping layers.

Repository pattern is mostly used where we need to modify the data before passing to the next stage.

here’s an awesome graph that illustrates the idea:

![Repository Pattern Structure Diagram][repository-pattern-image]

## Why Repository Pattern C\# ? {#why-repository-pattern-csharp}

- **Increase testability**: Repository systems are good for testing. One reason being that you can use Dependency Injection. Basically, you create an interface for your repository, and you reference the interface for it when you are making the object. Then you can later make a fake object (using [moq](https://github.com/moq/moq4) for instance) which implements that interface. Using something like [StructureMap](https://structuremap.github.io/) you can then bind the proper type to that interface. Boom you've just taken a dependence out of the equation and replaced it with something testable.

- **Easily swapped out with various data stores without changing the API**: For example, in one instance, you may need to retrieve data from the database, in other cases you may need to retrieve something from a third-party API, or perhaps there’s some other place from which you need to retrieve data. Regardless, the idea behind the repository pattern is that whatever sits behind it doesn’t matter so long as the API it provides works for the layer of the application calling into it.

## Entity Framework Repository Pattern C\# {#entity-framework-repository-pattern-csharp}

Entity Framework (EF) itself implements Unit of work pattern and somewhat loosely implements Repository pattern. With EF you can retrieve a set of records from the database in POCO models. Also, EF keeps track of changes for you within these models and save these changes on single `SaveChanges` method call.

Let's see how to create a repository using EF, let say you have customer entity in your application, then this is how your customer repository interface will look like:

```csharp
public interface ICustomerRepository:IDisposable
{
    IEnumerable GetCustomers();
    Customer GetCustomerByID(int customerId);
    void InsertCustomer(Customer customer);
    void DeleteCustomer(int customerId);
    void UpdateCustomer(Customer customer);
    void Save();
}
```

And the implementation of the above interface with EF looks like this:

```csharp
public class CustomerRepository:ICustomerRepository
{
    private ApplicationContext context;

    public CustomerRepository(ApplicationContext context)
    {
        this.context = context;
    }

    public IEnumerable<Customer> GetCustomers()
    {
        return context.Customers.ToList();
    }
    public Customer GetCustomerByID(int customerId)
    {
        return context.Customers.Find(customerId);
    }

    public void InsertCustomer(Customer customer)
    {
        context.Customers.Add(customer);
    }

    public void DeleteCustomer(int customerId)
    {
        Customer customer = context.Customers.Find(customerId);
        context.Customers.Remove(customer);
    }

    public void UpdateCustomer(Customer customer)
    {
        context.Entry(customer).State = EntityState.Modified;
    }

    public void Save()
    {
        context.SaveChanges();
    }

    private bool disposed = false;

    protected virtual void Dispose(bool disposing)
    {
        if (!this.disposed)
        {
            if (disposing)
            {
                context.Dispose();
            }
        }
        this.disposed = true;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
}
```

Usually, people argue on using repository pattern over EF as it restricts EF uses by returning IEnumnerable instead of IQueryable from the repository. You can learn more about it [here](https://softwareengineering.stackexchange.com/questions/192044/should-repositories-return-iqueryable).

## Generic Repository Pattern C\# {#generic-repository-pattern-csharp}

Creating a repository class for each entity type could result in a lot of repetitive code. Generic repository pattern is a way to minimize this repetition and have single base repository work for all type of data.

Let's see the interface for the generic repository,

```cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

public interface IRepository<TEntity> where TEntity :class
{
    void Delete(TEntity entityToDelete);
    void Delete(object id);
    IEnumerable<TEntity> Get(
        Expression<Func<TEntity, bool>> filter = null,
        Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
        string includeProperties = "");
    TEntity GetByID(object id);
    IEnumerable<TEntity> GetWithRawSql(string query,
        params object[] parameters);
    void Insert(TEntity entity);
    void Update(TEntity entityToUpdate);
}
```

And the implementation of the above interface with EF looks like this:

```csharp
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

class BaseRepository<TEntity> : IRepository <TEntity> where TEntity : class
{
    internal ApplicationContext context;
    internal DbSet<TEntity> dbSet;

    public BaseRepository(ApplicationContext context)
    {
        this.context = context;
        this.dbSet = context.Set<TEntity>();
    }

    public virtual IEnumerable<TEntity> GetWithRawSql(string query,
        params object[] parameters)
    {
        return dbSet.SqlQuery(query, parameters).ToList();
    }

    public virtual IEnumerable<TEntity> Get(
        Expression<Func<TEntity, bool>> filter = null,
        Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
        string includeProperties = "")
    {
        IQueryable<TEntity> query = dbSet;

        if (filter != null)
        {
            query = query.Where(filter);
        }

        if (includeProperties != null)
        {
            foreach (var includeProperty in includeProperties.Split
            (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
            {
                query = query.Include(includeProperty);
            }
        }

        if (orderBy != null)
        {
            return orderBy(query).ToList();
        }
        else
        {
            return query.ToList();
        }
    }

    public virtual TEntity GetByID(object id)
    {
        return dbSet.Find(id);
    }

    public virtual void Insert(TEntity entity)
    {
        dbSet.Add(entity);
    }

    public virtual void Delete(object id)
    {
        TEntity entityToDelete = dbSet.Find(id);
        Delete(entityToDelete);
    }

    public virtual void Delete(TEntity entityToDelete)
    {
        if (context.Entry(entityToDelete).State == EntityState.Detached)
        {
            dbSet.Attach(entityToDelete);
        }
        dbSet.Remove(entityToDelete);
    }

    public virtual void Update(TEntity entityToUpdate)
    {
        dbSet.Attach(entityToUpdate);
        context.Entry(entityToUpdate).State = EntityState.Modified;
    }
}
```

The above generic repository defines core operations. You can extend this class and interface base on business requirement and can inherit in your custom repository.

## Unit Of Work Pattern C\# {#unit-of-work-pattern-csharp}

Use of separate repository for a single transaction could result in partial updates. For example, suppose you have to update two different entity types as part of the same transaction. If each uses a separate database context instance, one might succeed and the other might fail, and one way to ensure that all repositories use the same database context (and thus coordinate all updates) is to use a unit of work class.

Unit of work pattern is easy to implement with the use of a generic repository. Let's see an example,

```csharp
using System;
using System.Collections.Generic;

public interface IUnitOfWork
{
    IRepository<Customer> Customers { get; }
    IRepository<Order> Orders { get; }
    void Commit();
}
```

Below is the code of how the implementation of above `IUnitOfWork` will look like,

```csharp
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class UnitOfWork : IUnitOfWork
{

    private ApplicationContext _dbContext;
    private BaseRepository<Customer> _customers;
    private BaseRepository<Order> _orders;

    public UnitOfWork(ApplicationContext dbContext)
    {
        _dbContext = dbContext;
    }

    public IRepository<Customer> Customers
    {
        get
        {
            return _customers ??
                (_customers=new BaseRepository<Customer>(_dbContext));
        }
    }

    public IRepository<Order> Orders
    {
        get
        {
            return _orders ??
                (_orders=new BaseRepository<Order>(_dbContext));
        }
    }

    public void Commit()
    {
        _dbContext.SaveChanges();
    }
}
```

Unit of Work is the concept related to the effective implementation of the repository pattern, whether its non-generic repository pattern or generic repository pattern.

Unit of Work is referred to as a single transaction that involves multiple operations of insert/update/delete and so on. You can learn more about Unit of Work from this awesome [post](https://www.c-sharpcorner.com/UploadFile/b1df45/unit-of-work-in-repository-pattern/).

## Repository Pattern C\# MVC {#repository-pattern-csharp-mvc}

Let's see now how our controller code will look like after using repository pattern along with unit of work:

```csharp
public class CustomerController : Controller
{
  private UnitOfWork unitOfWork = new UnitOfWork();

  // GET: /Customer/

  public ViewResult Index()
  {
     var Customers = unitOfWork.CustomerRepository.Get();
     return View(Customers.ToList());
  }

  // GET: /Customer/Details/5

  public ViewResult Details(int id)
  {
     Customer Customer = unitOfWork.CustomerRepository.GetByID(id);
     return View(Customer);
  }

  // GET: /Customer/Create

  public ActionResult Create()
  {
     return View();
  }

  [HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Create(Customer Customer)
  {
     try
     {
        if (ModelState.IsValid)
        {
           unitOfWork.CustomerRepository.Insert(Customer);
           unitOfWork.Save();
           return RedirectToAction("Index");
        }
     }
     catch (DataException)
     {
        ModelState.AddModelError("", "Unable to save changes.");
     }
     return View(Customer);
  }

  public ActionResult Edit(int id)
  {
     Customer Customer = unitOfWork.CustomerRepository.GetByID(id);
     return View(Customer);
  }

  [HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Edit(
     Customer Customer)
  {
     try
     {
        if (ModelState.IsValid)
        {
           unitOfWork.CustomerRepository.Update(Customer);
           unitOfWork.Save();
           return RedirectToAction("Index");
        }
     }
     catch (DataException)
     {
        ModelState.AddModelError("", "Unable to save changes.");
     }
     return View(Customer);
  }

  // GET: /Customer/Delete/5

  public ActionResult Delete(int id)
  {
     Customer Customer = unitOfWork.CustomerRepository.GetByID(id);
     return View(Customer);
  }

  // POST: /Customer/Delete/5

  [HttpPost, ActionName("Delete")]
  [ValidateAntiForgeryToken]
  public ActionResult DeleteConfirmed(int id)
  {
     Customer Customer = unitOfWork.CustomerRepository.GetByID(id);
     unitOfWork.CustomerRepository.Delete(id);
     unitOfWork.Save();
     return RedirectToAction("Index");
  }

  protected override void Dispose(bool disposing)
  {
     unitOfWork.Dispose();
     base.Dispose(disposing);
  }
}
```
In the above code we directly initialized unitOfWork variable. Like this,

```csharp
private UnitOfWork unitOfWork = new UnitOfWork();
```
However to truly use the power of repository pattern and make the above controller testable we need to use `IUnitOfWork` instead of `UnitOfWork` for our `unitOfWork` variable data type, and also we have to initialize it using Dependency Injection (DI) technique.

Assuming you’re starting with a new ASP.NET MVC 5 application, the easiest way to get StructureMap is using Nuget package StructureMap.MVC5.

After installing StructureMap, from solution explorer we can notice that Dependency Resolution folder has been added, also StructuremapMVC.cs file in App_Start folder.

The important file which is needed is the DefaultRegistry.cs. In Default Registry class, we are going configure StructureMap container. Let's see how:

```csharp
public class DefaultRegistry : Registry
{
    #region Constructors and Destructors

    public DefaultRegistry()
    {
        Scan(
            scan => {
                scan.TheCallingAssembly();
                scan.WithDefaultConventions();

                //This line of code is just directions telling StructureMap
                //where to look for DAL models.
                //Typically, my DAL code lives in different class library
                scan.AssemblyContainingType<ApplicationDbContext>();

                //To connect implementations to our open generic type of IRepository,
                //we use the ConnectImplementationsToTypesClosing method.
                scan.ConnectImplementationsToTypesClosing(typeof(IRepository<>));
            });
        //For<IExample>().Use<Example>();

        //Here we resolve object instances of our DbContext and IRepository
        For<DbContext>().Use(ctx => new ApplicationDbContext());
        For(typeof(IRepository<>)).Use(typeof(BaseRepository<>));
    }

    #endregion
}
```

After configuring DefaultRegistry replace your CustomerController unitOfWork initialization code with the below code:
```csharp
public class CustomerController : Controller
{
  private readonly IUnitOfWork unitOfWork;

  public CustomerController (IUnitOfWork unitOfWork)
  {
      this.unitOfWork = unitOfWork;
  }

}
```

You can now start writing your unit tests for your controller classes from this base. Learn more about unit testing and how to use Moq library for mocking from this great [article](https://techbrij.com/unit-testing-asp-net-mvc-controller-service).

## Further Reading {#further-reading}
- [4 Common Mistakes with the Repository Pattern](https://programmingwithmosh.com/net/common-mistakes-with-the-repository-pattern/) by [Mosh Hamedani](https://programmingwithmosh.com/about/) - People tend to make some common mistakes while creating a repository in C#. For example, repositories that return view models/DTOs. In this article you can learn more about this kind of mistakes and why you should avoid them.

- [Creating a Repository Pattern without an ORM](https://www.danylkoweb.com/Blog/creating-a-repository-pattern-without-an-orm-A9) by [Jonathan Danylko](https://www.danylkoweb.com/About) - If you don't feel like using an ORM, like Entity Framework, you can build your own data layer. In this post, Jonathan talk about a different way to pull data from a database using a strategy pattern.

- [Introducing the CachedRepository Pattern](https://ardalis.com/introducing-the-cachedrepository-pattern) by [Steve Smith](https://ardalis.com/) - In this first part of a series on adding support for caching to the Repository Pattern, Steve show how to very simply control whether or not caching is performed on a per-repository basis through the use of an Inversion of Control Container.

## References {#references}
- [https://docs.microsoft.com/en-us/ef/ef6/](https://docs.microsoft.com/en-us/ef/ef6/)
- [https://softwareengineering.stackexchange.com/questions/192044/should-repositories-return-iqueryable](https://softwareengineering.stackexchange.com/questions/192044/should-repositories-return-iqueryable)
- [https://stackoverflow.com/questions/33755499/entity-framework-repository-pattern-why-not-return-iqueryable](https://stackoverflow.com/questions/33755499/entity-framework-repository-pattern-why-not-return-iqueryable)
- [https://programmingwithmosh.com/net/common-mistakes-with-the-repository-pattern/](https://programmingwithmosh.com/net/common-mistakes-with-the-repository-pattern/)
- [https://blogs.msdn.microsoft.com/diego/2010/10/05/self-tracking-entities-applychanges-and-duplicate-entities/](https://blogs.msdn.microsoft.com/diego/2010/10/05/self-tracking-entities-applychanges-and-duplicate-entities/)
- [https://stackoverflow.com/questions/10430880/managing-connections-with-generic-repository-pattern](https://stackoverflow.com/questions/10430880/managing-connections-with-generic-repository-pattern)
- [https://stackoverflow.com/questions/2025712/extract-sql-query-from-linq-expressions](https://stackoverflow.com/questions/2025712/extract-sql-query-from-linq-expressions)
- [https://6figuredev.com/podcast/episode-029-generic-repository-repository-pattern/](https://6figuredev.com/podcast/episode-029-generic-repository-repository-pattern/)
- [https://www.danylkoweb.com/Blog/creating-a-repository-pattern-without-an-orm-A9](https://www.danylkoweb.com/Blog/creating-a-repository-pattern-without-an-orm-A9)
- [https://www.danylkoweb.com/Blog/enhancing-the-ado-repository-with-crud-functionality-CD](https://www.danylkoweb.com/Blog/enhancing-the-ado-repository-with-crud-functionality-CD)
- [https://ardalis.com/resolving-dependencies-in-asp-net-mvc-5-with-structuremap](https://ardalis.com/resolving-dependencies-in-asp-net-mvc-5-with-structuremap)

[post-image]: /images/repository-pattern-csharp.jpg "Repository Pattern C#"
[repository-pattern-image]: /images/repository-pattern-csharp_structure.png "Repository Pattern Structure Diagram"

gha_language: HTML


text:
# Install charts

```
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
helm repo add l7mp https://l7mp.io/charts
helm install l7mp/l7mp-ingress --generate-name
```

The first command installs helm.  The second one adds the l7mp chart
repository.  Finally, the third one installs a helm _release_ into the
kubernetes cluster.

# Build charts

Hopefully, someday this will be automatic (issue #86), but for now you
can update the charts with:

```
helm package l7mp-operator l7mp-ingress
helm repo index .
cp ./index.yaml *.tgz ~/src/l7mp.io/charts
```

And then push the changes in the l7mp.io repo.

# Warning: Security hazard

This helm chart will (1) deploy the l7mp proxy in the host namespace of all your Kubernetes nodes
and (2) open up two HTTP ports (the controller port 1234 and the Prometheus scraping port 8080) for
unrestricted external access on each of your nodes. If your nodes are available externally, this
will allow unauthorized access to the ingress gateways of your cluster.

Before installing this helm chart, make sure that you filter port 1234 and 8080 on your cloud
cloud load-balancer. Use this chart only for testing, never deploy in production unless you know
the potential security implications.


text:
# Tobie Booth
## DevOps Engineer

> [Download PDF](TobieBoothResume.pdf)
> [resume<EMAIL_ADDRESS>
><PHONE_NUMBER>

------

### Profile {#profile}

Conscientious and driven professional with a broad skill set that likes to get things done. Strong attention to detail. Able to multitask and bring multiple projects to light at once. Always ahead of the game and always up for learning new things.

------

### Skills {#skills}

* Web Development
  : Adept at creation of robust web applications and APIs written in PHP 5.3+ using frameworks such as Laravel or Symfony connected to both SQL and NoSQL databases. Experienced in frontends written in HTML5/CSS3/Javascript. Previous experience using AngularJS, NodeJS, and Rails.

* Network Administration
  : Ability to configure and manage network switches, appliances, and other devices. Previous experience with HP, Brocade, and Vyatta routers. Previous experience with Aerohive, Ubiquity, and Miraki wireless AP's. Familiar with Fluke network testing equipment.

* System Administration
  : Skillful in the management of Linux based servers (Debian, Ubuntu, CentOS, Arch). Knowledgable in the configuration and tweaking of Apache, Nginx, PHP-FPM, HAProxy, MySQL, and PostgreSQL. Also skilled in the configuration of VoIP phone and PBX systems including SNOM, Bluebox, and Kazoo

-------

### Technical {#technical}

1. HTML
2. CSS
3. PHP
4. Javascript
5. JQuery
6. AngularJS
7. NodeJS
8. MySQL
9. PostgreSQL
10. MongoDB
11. Nginx
12. Apache
13. Linux
14. OSX
15. Windows

------

### Experience {#experience}

NOC Innovations
: *Director of Operations*
  __2012-2014__
  Leading the DevOps of a business class VoIP based phone system. Using technology like Kamailio and Freeswitch to handle SIP switching and media services. All services answer to a NodeJS backend with a PHP frontend written on the Laravel framework.

DNT Media
: *Director of Technology*
  __2013-2014__
  Managed a staging and production server infrastructure and internal Meraki based network. Setup and managed local NAS systems using FreeNAS.
  Lead the development of client sites, web applications, and mobile applications using PHP, Laravel, AngularJS, and Phonegap.

Self Employed; Various Clients
: *DevOps Engineer*
  __2012-2013__
  Developed third party logistics warehouse management system that tracks the locations of pallets, when they expire, how to bill customers for space used, and more. Setup and managed staging and production environments for servers running Nginx, PHP-FPM, and PostgreSQL.

  Developed several applications for a K12 school district including but not limited to: An asset management system, professional development scheduling and tracking application, student scheduling system, and a custom Wowza and High School Cube API frontend. Setup and managed staging and production environments for servers running Nginx, PHP-FPM, MySQL, and Wowza.

Schwartz Networks
: *Network Administrator*
  __2010-2012__
  Managed Debian based Xen and Citrix servers and client networks. Created in house billing and VM management system in PHP using the lib-virt extension and the Codeigniter framework. Handled acquisition and building of client servers.

------

### Footer {#footer}

Tobie Booth -- [resume<EMAIL_ADDRESS>--<PHONE_NUMBER>
P.S: This resume is open source! If you have any comments or suggestions feel free to submit an issue or pull request on [GitHub](http://github.com/tobiebooth/resume).

------

repository: tobiebooth/resume

repo_name: tobiebooth/resume


text:
# TodoCLI

A CLI program for managing to do tasks with the ability to sincronize with Trello.

## Installation

Install it yourself as:

    $ gem install todo-fede

## Usage

This is a CLI program so you need to open a terminal in order to run it. This CLI comes with two set of features. The first set is related to CRUD operations over todo items, and the second is a set of operations related to synchronizing the todos with [Trello](trello.com).

#### Crud operations
- To **add** a new todo type  `$ todo add An easy todo`
- To **list** all your todo items type `$ todo list`
- To mark a todo as **done** type `todo done` followed by the ID number of your todo item, e.g. `$ todo done 1`.
- To **delete** a todo type `todo delete` followed by the ID number of your todo item, e.g. `$ todo delete 1`.

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests and `rake linter` to run rubocop. You can also run `bin/console` for an interactive prompt that will allow you to experiment with the existent code (under the lib folder).

You can execute the program by running `bin/todo` at the root of the project, be aware that you need to give execution permissions to the file, you can use `chmod +x bin/todo` for that purposes.

Alternatively, you can install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/wyeworks/todo-fede.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

repository: fede-moya/todo-app

repo_name: fede-moya/todo-app


text:
---
layout: post
comments: true
title: DML Analysis Part 34
tags: virginica MBDSeq IGV
---

## Even more troubleshooting with IGV

### Gene background issues

Before I could proceed with a gene enrichment, I needed to sort through my [gene background issues](https://yaaminiv.github.io/DML-Analysis-Part27/). The gene background consists of all loci with 5x coverage in my dataset. Previously, my gene background was "hot flaming garbage" when I looked at it in IGV. Assuming that the gene background was working correctly in `methylKit`, I [returned to my R Markdown file](https://github.com/fish546-2018/yaamini-virginica/blob/master/analyses/2018-10-25-MethylKit/2018-10-25-MethylKit.Rmd) to see if the gene background issues were a result of the way I exported the file.

Looking at the gene background, I noticed that there were columns with coverage metrics, as well as the number of cytosines and thymines at each locus. The start and stop position for each locus was the same, which could be affecting how the visualization occurs in IGV.

![Screen Shot 2019-05-15 at 1 56 52 PM](https://user-images.githubusercontent.com/22335838/57808904-4d859a80-7719-11e9-95aa-f7ab6b49a327.png)

**Figure 1**. Gene background information in `methylKit`.

I decided to subset the first four columns for exporting: chromosome (`chr`), start position (`start`), stop position (`stop`), and strand (`strand`). I did this by creating a new dataframe. I also subtracted 1 from each start position to visualize the data. Finally, I exported the gene background as a BEDfile and looked at it in IGV.

`````
methylationInformationFilteredCov5DestrandReduced <- data.frame("chr" = methylationInformationFilteredCov5Destrand$chr,
                                                                "start" = methylationInformationFilteredCov5Destrand$start,
                                                                "stop" = methylationInformationFilteredCov5Destrand$end,
                                                                "strand" = methylationInformationFilteredCov5Destrand$strand) #Subset data
methylationInformationFilteredCov5DestrandReduced$start <- (methylationInformationFilteredCov5DestrandReduced$start - 1) #Subtract 1 from the start position for visualization
write_delim(methylationInformationFilteredCov5DestrandReduced, "2019-05-14-Methylation-Information-Filtered-Destrand-Cov5.bed", delim = "\t", col_names = FALSE) #Write out all methylation information as a background to be used for gene enrichment analyses.
`````

I opened [this IGV session](https://github.com/fish546-2018/yaamini-virginica/blob/master/analyses/2019-03-07-IGV-Verification/2019-03-07-DML-and-DMR-Visualization.xml), which had my previous gene background file in it. I added the new file and compared the two versions:

![Screen Shot 2019-05-14 at 2 20 13 PM](https://user-images.githubusercontent.com/22335838/57807019-33e25400-7715-11e9-94c4-64844d4ba312.png)

![Screen Shot 2019-05-14 at 2 21 09 PM](https://user-images.githubusercontent.com/22335838/57807020-33e25400-7715-11e9-95b3-4551781f98d3.png)

![Screen Shot 2019-05-14 at 2 22 43 PM](https://user-images.githubusercontent.com/22335838/57807021-33e25400-7715-11e9-9b0a-df8b9616e891.png)

**Figures 2-4**. Gene background visualization in IGV.

Looking at different sections, I found that the gene background aligned with CG motifs and various DML instead of looking like large regions of information! I feel confident with this new version of the gene background and think I could use it for gene enrichment.

### Difference between gene and mRNA tracks

During lab meeting, I pointed out that there were coding sequences included in genes that were not part of the mRNA track. These coding sequences had defined exons. Kaitlyn pointed out that the exons are the elements retained in mRNA, but the exons in coding sequence (CDS) are the parts that get translated. That clears up the question I posed in [this issue](https://github.com/RobertsLab/resources/issues/692).

### Refining the intron track

Based on this information, I decided to use `subtractBed` with the gene ane exon tracks to create my intron track. When I looked through that track in IGV, I found that there were some areas where the intron track looked good. Introns from coding sequences were included (unlike the one I generated using mRNA), and the first bp in every exon sequence was no longer being included in the intron track.

![Screen Shot 2019-05-15 at 3 23 05 PM](https://user-images.githubusercontent.com/22335838/57814173-abb97a00-7727-11e9-8c70-81ead5848bf8.png)

**Figure 5** Example of introns generated from the gene and exon tracks that are not included in the intron track I generated from mRNA or the intron track I downloaded from the [Genomic Resources wiki](https://github.com/RobertsLab/resources/wiki/Genomic-Resources#genome-feature-tracks-1).

![Screen Shot 2019-05-15 at 3 22 40 PM](https://user-images.githubusercontent.com/22335838/57814174-abb97a00-7727-11e9-8bd5-e26b7f0aba9e.png)

![Screen Shot 2019-05-15 at 3 21 51 PM](https://user-images.githubusercontent.com/22335838/57814175-ac521080-7727-11e9-9084-4f8df5212aa0.png)

**Figure 6-7**. Instances were the intron track from the [Genomic Resources wiki](https://github.com/RobertsLab/resources/wiki/Genomic-Resources#genome-feature-tracks-1) includes the first bp of each exon, but the intron track I generated does not.

However, there were instances of the intron track I generated still including exons:

![Screen Shot 2019-05-15 at 3 28 58 PM](https://user-images.githubusercontent.com/22335838/57814344-41550980-7728-11e9-8d8c-27ef37e4f4ee.png)

![Screen Shot 2019-05-15 at 3 25 57 PM](https://user-images.githubusercontent.com/22335838/57814345-41550980-7728-11e9-8ed9-256b37297e07.png)

**Figures 8-9**. Areas where the intron track still contained exons.

I posted my findings in [this comment](https://github.com/RobertsLab/resources/issues/692#issuecomment-492849768) and asked if it was an artifact of enforcing same strandedness with `-s`, or if it was worth using `subtractBed` on the intron and exon tracks to get rid of the overlaps. Since exons and introns are on the same strand, I don't think `-s` is the issue, but perhaps there's a different way I need to code it.

## Hypermethylated vs. hypomethylated DML

One thing I’ve been meaning to do for a while is characterize location differences between hypermethylated and hypomethylated DML. While I did [just generate genome feature tracks myself](https://yaaminiv.github.io/DML-Analysis-Part33/), I decided to use the pre-made tracks I downloaded to complete this analysis so I know the code works. I can always revise the paths to the tracks later once my tracks are finalized.

### Characterizing locations of hypermethylated and hypomethylated DML

I returned to [this Jupyter notebook](https://github.com/fish546-2018/yaamini-virginica/blob/master/notebooks/2018-11-01-DML-and-DMR-Analysis.ipynb) to use `intersectBed` and get locations of hypermethylated and hypomethylated DML. There are 310 hypermethylated and 288 hypomethylated DML. I was curious if one type of DML would be more dominant in exons or introns. The only pattern that jumped out to me was the difference in hypermethylated vs. hypomethylated DML in putative promoter regions (44+/23-).

**Table 1**. Genomic locations of hypermethylated and hypomethylated DML

|       **Genomic Feature**       | **Hypermethylated** | **Hypomethylated** |
|:———————————————:|:—————————:|:—————————:|
|         **Unique mRNA**         |         761         |         792        |
|            **Exons**            |         190         |         178        |
|           **Introns**           |          99         |         92         |
| **Transposable Elements (All)** |          26         |         31         |
|      **Putative Promoters**     |          44         |         23         |
|            **Other**            |          13         |          7         |

### Going forward

1. Finalize the intron track
2. Conduct a gene enrichment for DML
3. Figure out what's going on with DMR
4. Work through gene-level analysis
5. Update paper repository
6. Update methods and results
7. Start writing the discussion

{% if page.comments %}

Please enable JavaScript to view the comments powered by Disqus.

{% endif %}

gha_language: CSS


text:
# xatlas for Unity
Originally forked from:https://github.com/guycalledfrank/xatlasLib
Used by Bakery (https://geom.io/bakery/wiki/index.php?title=Bakery_-_GPU_Lightmapper)

This is a simple DLL interface for xatlas: https://github.com/jpcy/xatlas

Additionally it also adds a "singleChart" option to AddUvMesh to allow packing existing UV layouts without re-arranging them.

YOU CAN FIND THE C++ SOURCE OF THE MANAGED XATLAS DLL IN THE SOURCE BRANCH.

<h1>NOTICE: SUPPORT FOR THIS HAS BEEN DROPPED IN FAVOR OF OUR CUSTOM UV PACKER: https://github.com/kitbashery/Kitbashery-Improved-Mesh-Combiner </h1>

repository: TolinSimpson/xatlas-for-Unity

repo_name: TolinSimpson/xatlas-for-Unity


text:
# Web

This is a simple frontend web server that simulates a hard dependency on another
service. It grabs a description from the `describer` service and formats it into
a web page.

repository: xenoscopic/depends-on-condition

repo_name: xenoscopic/depends-on-condition


text:
---
title: Coronavirus Command-Line Tracker
repo: ahmadawais/corona-cli
twitter: MrAhmadAwais
type:
  - CLI
language:
  - JavaScript
format:
  - N/A
license:
  - MIT
description: Track the Coronavirus disease (COVID-19) or the Novel Coronavirus Strain.

---

- 🚀 Get worldwide Coronavirus disease (COVID-19) reporting
- 🤯 Active daily reporting of your country's COVID-19 statistics
- 🇺🇸 Get US States data for Coronavirus disease reports across the US
- 🗃 Data: Country, Cases, Deaths, Recovered, Active, Critical, Per Million
- 📟 Sort: `cases`, `cases-today`, `deaths`, `deaths-today`, `recovered`, `active`, `critical`, `per-million`


text:
# Node.js *for Java developers*

This is a short presentation aimed to introduce [node.js](https://nodejs.org/en/) to Java developers. It is more focused on the architectural part and so much on showing code.

It was made with [reveal.js](https://github.com/hakimel/reveal.js). You can view it [here](https://chechtalks.github.io/presentations/nodejs/).

repository: chechtalks/presentations

repo_name: chechtalks/presentations


text:
# migl-pool

Micro Game Library : Object pool

The main use of the object pool pattern in javascript is to reduce the number of garbage collection by enforcing object reuse.
Garbage collection can be quite taxing for real time application such as games and cause dropped frames (jank).
This particular implementation of the object pool doesn't have a fixed size, new instances are dynamically added to the pool when needed.

For further information, check [gameprogrammingpatterns.com](http://gameprogrammingpatterns.com/object-pool.html) and [html5rocks.com](http://www.html5rocks.com/en/tutorials/speed/static-mem-pools/))

## Features

 * Doesn't force a specific interface onto the pooled objects.
 * Lightweight and simple.

## Basic example

### Pool creation for object literals :

```js
var pool = require('migl-pool');

var literalPool = pool.create({
	allocationNumber: 5,
	firstAllocationNumber: 10,
	factory: function literalPoolFactory () {
		return {
			value: 0,
			printValue: function () {
				console.log(this.value);
			}
		};
	},
	initialize: function literalPoolInitialize (element, options) {
		element.value = options.value;
	}
});

var element = literalPool.get({ value: 2 });
element.printValue();
```

### Pool creation for classic prototype-based objects :

```js
var MyObject = function () {};

MyObject.prototype.value = null;

MyObject.prototype.printValue = function () {
	console.log(this.value);
};

var pool = require('migl-pool');

var myObjectPool = pool.create({
	allocationNumber: 5,
	firstAllocationNumber: 10,
	factory: function myObjectPoolFactory () {
		return new MyObject();
	},
	initialize: function myObjectPoolInitialize (element, options) {
		element.value = options.value;
	}
});

var element = myObjectPool.get({ value: 2 });
element.printValue();
```

### General pool usage :

```js
// where somePool is an instance of Pool

var element = somePool.get({});
somePool.free(element); // place an element back into the pool of available instances

console.log(somePool.toString()); // retrieve information about the pool, useful for debugging purpose

somePool.clear(); //remove all the object from the pool
```

## Roadmap

* Make unit tests.
* Better doc.

repository: kchapelier/migl-pool

repo_name: kchapelier/migl-pool


text:
TernarySearchTree
====================
Building with AppVeyor: [![Build status](https://ci.appveyor.com/api/projects/status/udg77gq0810e37es?svg=true)](https://ci.appveyor.com/project/DanielSLima/ternarysearchtree)

Building with Travis: [![Build Status](https://www.travis-ci.com/danielScLima/TernarySearchTree.svg?branch=master)](https://www.travis-ci.com/danielScLima/TernarySearchTree)

This repository has a project with the implementation of a TernarySearchTree.

It is written in C++.

The code of the TernarySearchTree is independent of platform.

Is has two possible main files:

* [Codes](#markdown-header)
	* [A main that triggers unit test;](#markdown-header-emphasis)

	* [A Qt project to manage the TernarySearchTree (With Gui).](#markdown-header-strikethrough)

The library used to make the Unit Test is the Catch v2.12.3. The code is already in this repository.

The Qt project generates images of the TernarySearchTree, using the lib Graphviz.
Install this lib in your computer for you to be able to create such images.

The code was written containing the Doxygen documentation.

- - -

You have several options to build the project:
====================

* [Build tools](#markdown-header)
	* [Makefile (using the file named MakefileGeneral);](#markdown-header-emphasis)
	* [CMake.](#markdown-header-emphasis)
	* [Qt Project (With QMake).](#markdown-header-emphasis)

The project has no leaks (Fully tested with Valgrind).

All the unit tests are ok.

- - -

The functionalities available are:
====================

* [Functionalities](#markdown-header)
	* [Insert;](#markdown-header-emphasis)
	* [Search;](#markdown-header-emphasis)
	* [Remove.](#markdown-header-emphasis)

- - -

Sample images:
====================

## This is a image of a tree.

![Alt text](images/sample.png)

Qt gui project:
====================
The qt gui application gui is shown below:

![Alt text](images/guisample.png)

Insertion steps:
====================

## Initial:

![Alt text](images/insertion/0.png)

## Inserting "home":

![Alt text](images/insertion/1.png)

## Inserting "homeless":

![Alt text](images/insertion/2.png)

## Inserting "love":

![Alt text](images/insertion/3.png)

## Inserting "hi":

![Alt text](images/insertion/4.png)

Removing samples:
====================

## Initial:

![Alt text](images/remove/0.png)

## Removing "hi":

![Alt text](images/remove/1.png)

## Removing "love":

![Alt text](images/remove/2.png)

## Removing "home":

![Alt text](images/remove/3.png)

## Removing "homeless":

![Alt text](images/remove/4.png)

repository: danielScLima/TernarySearchTree

repo_name: danielScLima/TernarySearchTree


text:
---
title: "New Functionality: Find Marker Genes"
tags: gf-icf marker-genes DE-genes
sidebar:
  nav: docs-en
---

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-144257957-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-144257957-1');
</script>

## Embed new cells in an already existing space
GFICF package try to identify marker genes across clusters performing [Mann-Whitney U test with continuity correction](https://jeky82.github.io/2019/08/20/MannWhitney.html){:target="_blank"}. Briefly differentially expressed (DE) genes of each cluster are identified comparing the expression of each gene in each cluster versus the all the others. [See the example here](https://jeky82.github.io/gficf_example.html#find-marker-genes) about this new functionality.


text:
# slack-profile

A slack app that can be used to munge slack profiles so they show up specific ways in our partner channels. For now "certain ways" means with the users' company names appended to their profile names.

## todos
* Slack workspaces can be set up to use "display names" or "full names" for members. The Partner workspace is set to use full names. This will need to be changed to "display name." This makes more sense: that we will be editing display names instead of messing with users' real names.
* Add more events (user join... others?)

## Installation
1. Follow the steps for installing slacks apps, found here: https://api.slack.com/apps. You will need to use a "user token" for now. When slack stabilizes workspace tokens in the future they would be the way to go. The user who installs the app needs to be at a higher security level than the users they will be editing.

2. On "OAuth & Permissions", add the `users.profile:write` and `users:read.email` scopes.

3. Enable event subscriptions, subscribe to the `user_change` event. Enter the base URL for this app as the Request URL (e.g., https://profile-monger.cfapps.io/).

4. Edit the manifest to include your slack oauth and validation tokens

5. Build and push the app to a PCF that has a legit non-self-signed cert or slack will reject it (PWS is a good choice). Currently it is running here:
```
api endpoint:   https://api.run.pivotal.io
api version:    2.116.0
user<EMAIL_ADDRESS>org:            platform-eng
space:          jgordon
profile-monger       started           1/1         1G       1G     profile-monger.cfapps.io
```

## How to test it
Tests are ignored. To run them, add your tokens to the test application.properties file, and remove the @ignore tags on the tests.

## How to use it
Once deployed the app will watch for profile updates in the workplace where it is installed. If a profile is updated it will check the user's display name and update it as configured by the application.

### see the suggested names
browse to https://profile-monger.cfapps.io/suggestions?token=verifcation_token

### to do a bulk upload
1. pull down and save the suggested names

```
curl 'https://profile-monger.cfapps.io/suggestions?token=verifcation_token' > names.json
```

2. review the names, looks good?

3. if so post the list

```
curl -d<EMAIL_ADDRESS>-H "Content-Type: application/json" -X POST 'https://profile-monger.cfapps.io/bulkUpdate?token=your-token&name_source=suggestedDisplayName' > results.json
```

4. review the results

5. no good? to rollback:

```
curl -d<EMAIL_ADDRESS>-H "Content-Type: application/json" -X POST 'https://profile-monger.cfapps.io/bulkUpdate?token=your-token&name_source=display_name' > results.json
```

repository: vmware-archive/slack-profile

repo_name: vmware-archive/slack-profile


text:
# Paper implementations

You can find relevant paper implementations in **Papers with Code.**

{% embed url="https://paperswithcode.com" %}

**lucidrains** implements tranformer related papers

{% embed url="https://github.com/lucidrains" %}

repository: juanpablordz/ai-maker

repo_name: juanpablordz/ai-maker


text:
# Examples

## Load an XML File

Basic XML file loading.

The basic syntax to load an XML file from
disk and check for an error. (ErrorID()
will return 0 for no error.)

```cpp
int example_1()
{
    XMLDocument doc;
    doc.LoadFile( "resources/dream.xml" );
    return doc.ErrorID();
}
```

## Parse an XML from char buffer

Basic XML string parsing.

The basic syntax to parse an XML for
a char* and check for an error. (ErrorID()
will return 0 for no error.)

```cpp
int example_2()
{
    static const char* xml = "<element/>";
    XMLDocument doc;
    doc.Parse( xml );
    return doc.ErrorID();
}
```

## Get information out of XML

In this example, we navigate a simple XML
file, and read some interesting text. Note
that this example doesn't use error
checking; working code should check for null
pointers when walking an XML tree, or use
XMLHandle.

(The XML is an excerpt from "dream.xml").

```xml
<?xml version=\"1.0\"?>
<!DOCTYPE PLAY SYSTEM \"play.dtd\">
<PLAY>
  <TITLE>A Midsummer Night's Dream</TITLE>
</PLAY>;
```

The structure of the XML file is:

(declaration)

(dtd stuff)

Element "PLAY"

Element "TITLE"

Text "A Midsummer Night's Dream"

For this example, we want to print out the
title of the play. The text of the title (what
we want) is child of the "TITLE" element which
is a child of the "PLAY" element.

We want to skip the declaration and dtd, so the
method FirstChildElement() is a good choice. The
FirstChildElement() of the Document is the "PLAY"
Element, the FirstChildElement() of the "PLAY" Element
is the "TITLE" Element.

```cpp
XMLDocument doc;
doc.Parse( xml );
XMLElement* titleElement = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" );
```

We can then use the convenience function GetText()
to get the title of the play.

```cpp
const char* title = titleElement->GetText();
printf( "Name of play (1): %s\n", title );
```

Text is just another Node in the XML DOM. And in
fact you should be a little cautious with it, as
text nodes can contain elements.

```html
Consider: A Midsummer Night's <b>Dream</b>
```

It is more correct to actually query the Text Node
if in doubt:

```cpp
XMLText* textNode = titleElement->FirstChild()->ToText();
title = textNode->Value();
printf( "Name of play (2): %s\n", title );
```

Noting that here we use FirstChild() since we are
looking for XMLText, not an element, and ToText()
is a cast from a Node to a XMLText.

## Read attributes and text information.

There are fundamentally 2 ways of writing a key-value
pair into an XML file. (Something that's always annoyed
me about XML.) Either by using attributes, or by writing
the key name into an element and the value into
the text node wrapped by the element. Both approaches
are illustrated in this example, which shows two ways
to encode the value "2" into the key "v":

```cpp
bool example_4()
{
    static const char* xml =
        "<information>"
        "   <attributeApproach v='2' />"
        "   <textApproach>"
        "       <v>2</v>"
        "   </textApproach>"
        "</information>";

```

TinyXML-2 has accessors for both approaches.

When using an attribute, you navigate to the XMLElement
with that attribute and use the QueryIntAttribute()
group of methods. (Also QueryFloatAttribute(), etc.)

```cpp
XMLElement* attributeApproachElement = doc.FirstChildElement()->FirstChildElement( "attributeApproach" );
attributeApproachElement->QueryIntAttribute( "v", &v0 );
```

When using the text approach, you need to navigate
down one more step to the XMLElement that contains
the text. Note the extra FirstChildElement( "v" )
in the code below. The value of the text can then
be safely queried with the QueryIntText() group
of methods. (Also QueryFloatText(), etc.)

```cpp
XMLElement* textApproachElement = doc.FirstChildElement()->FirstChildElement( "textApproach" );
textApproachElement->FirstChildElement( "v" )->QueryIntText( &v1 );
```

license: Zlib