text:
### Aleksei � Matiushkin

## Sniffing Around

- 🐦 https://twitter.com/mudasobwa
- 📒 https://stackoverflow.com/users/2035262/aleksei-matiushkin?tab=topactivity
- ✍ https://rocket-science.ru
- 📫<EMAIL_ADDRESS>- 🏢 @kantox
- 🗓 October, 0 (aka September, 30)
- ⚡ I’m still more functional than object oriented

## The Summing Up

![AM@GH](https://github-readme-stats.vercel.app/api/?username=am-kantox&show_icons=true&title_color=fff&icon_color=35a8df&text_color=9f9f9f&bg_color=151515)

## 🚧 Projects & Libraries

### ⚔ Battle-tested

▶ [elixir-iteraptor](https://github.com/am-kantox/elixir-iteraptor)
⤷ Handy enumerable operations implementation
⤷ elixir, iteration, mapreduce

▶ [envio](https://github.com/am-kantox/envio)
⤷ Application-wide registry with handy helpers to ease dispatching
⤷ elixir, registry, messaging

▶ [tyyppi](https://github.com/am-kantox/tyyppi)
⤷ Library bringing erlang typespecs to runtime
⤷ elixir, guards, validation

▶ [tempus](https://github.com/am-kantox/tempus)
⤷ Easy handling of time periods aka slots, like business days, holidays, etc
⤷ elixir, time, validation

▶ [cloister](https://github.com/am-kantox/cloister)
⤷ The helper application to manage cluster of nodes
⤷ elixir, distributed, clustering

▶ [rambla](https://github.com/am-kantox/rambla)
⤷ Easy publishing to many different targets
⤷ elixir, publishing

▶ [exvalibur](https://github.com/am-kantox/exvalibur)
⤷ Elixir Validator Generator
⤷ elixir, guards, validation

▶ [ack](https://github.com/am-kantox/ack)
⤷ Tiny drop-in for painless acknowledgements across different applications
⤷ elixir, acknowledgements

▶ [camarero](https://github.com/am-kantox/camarero)
⤷ Semi-static JSON API Scaffold for Elixir
⤷ elixir, webserver, json-api, api-server

▶ [pyc](https://github.com/am-kantox/pyc)
⤷ Set of additional functionality for structs
⤷ elixir, structs

▶ [tarearbol](https://github.com/am-kantox/tarearbol)
⤷ More handy task runner, allowing retries, callbacks, assurance that the task succeeded, and more
⤷ elixir, concurrency, task, job

▶ [peluquero](https://github.com/am-kantox/peluquero)
⤷ RabbitMQ “middleware” that allows to act as a plug consuming many input exchanges, publishing to many outputs
⤷ elixir, rabbitmq

▶ [dry-behaviour](https://github.com/am-kantox/dry-behaviour)
⤷ Tiny library inspired by Elixir protocol pattern
⤷ ruby, protocol, behaviour, delegate

▶ [iteraptor](https://github.com/am-kantox/iteraptor)
⤷ Set of deep iteration helpers
⤷ ruby, iteration, hash, array, helper, enumeration

▶ [see_as_vee](https://github.com/am-kantox/see_as_vee)
⤷ Easy CSV import/export
⤷ ruby

▶ [lib_lat_lon](https://github.com/amotion-city/lib_lat_lon)
⤷ Handy geo coding against different providers
⤷ elixir

### 🛡 Used In Prod, Retired

▶ [transdeal](https://github.com/am-kantox/transdeal)
⤷ Helper library allowing to tackle with `ActiveRecord` transactions partial rollback
⤷ ruby

▶ [kantox-chronoscope](https://github.com/am-kantox/kantox-chronoscope)
⤷ Handy [semi-]automated profiler for ruby. Allows to easy and quick profile method calls during rspec execution. Supports profiling by “newly committed to git,” “last two month,” etc.
⤷ ruby

▶ [formulae](https://github.com/am-kantox/formulae)
⤷ A set of function to deal with analytical formulae
⤷ elixir, math

▶ [mutations-validate-outcome](https://github.com/am-kantox/mutations-validate-outcome)
⤷ Mixin to add an outcome validation to mutations gem
⤷ ruby

▶ [rspec-benchmarks](https://github.com/am-kantox/rspec-benchmarks)
⤷ Handy measures for rspec tests. SQL/View/Controller separated reports. Sophisticated SQL analysis
⤷ ruby

### 😜 Fun

▶ [string_naming](https://github.com/am-kantox/string_naming)
⤷ Compiled support for the whole UTF8 symbols by their names
⤷ elixir

▶ [translator-ruby-bot](https://github.com/am-kantox/translator-ruby-bot)
⤷ Slack bot translating words between different languages
⤷ ruby

▶ [emphatis](https://github.com/amotion-city/emphatis)
⤷ Tiny library that helps to convert the text to italic/bold.mono using unicode fontfaces
⤷ elixir

### 👻 Experiments

▶ [agentex](https://github.com/am-kantox/agentex)
⤷ Elixir distributed agent implementation on top of Mnesia
⤷ elixir, mnesia, agent, genserver

▶ [test_cluster_task](https://github.com/am-kantox/test_cluster_task)
⤷ Run tests in a distributed environment (cluster with several nodes)
⤷ elixir, test, mix

▶ [atadura](https://github.com/am-kantox/atadura)
⤷ Helper tiny module to provide easy binding support as bind_quoted does for quote-do
⤷ elixir

▶ [tubo](https://github.com/am-kantox/tubo)
⤷ Tiny module providing a wrapper functionality for functions to easy chain those into pipelines
⤷ elixir, pipeline, pipe

▶ [workflow-join](https://github.com/am-kantox/workflow-join)
⤷ Workflow extension that allows to fork workflows with other workflows and join them at specific states
⤷ ruby

▶ [kungfuig](https://github.com/am-kantox/kungfuig)
⤷ Config on steroids
⤷ ruby

▶ [issuer](https://github.com/am-kantox/issuer)
⤷ Adds `mix` tasks to easily issue (publish) new versions to `hex`
⤷ elixir

▶ [emiler](https://github.com/am-kantox/emiler)
⤷ Calculates the Jaro-Winkler like distance between two emails
⤷ ruby

▶ [rails_panel](https://github.com/am-kantox/rails_panel)
⤷ Forked from dejan/rails_panel
⤷ Chrome extension for Rails development
⤷ ruby

▶ [μ-vault](https://github.com/am-kantox/mu-vault)
⤷ Elixir binding / client library for Vault https://www.vaultproject.io/
⤷ elixir

▶ [kantox-branchester](https://github.com/am-kantox/kantox-branchester)
⤷ This app assures that my git branch has no merge conflicts with others in the repo
⤷ ruby

▶ [bloomit](https://github.com/am-kantox/bloomit)
⤷ Mixin to colorize everything basing on it’s name/properties
⤷ ruby

▶ [forkforge](https://github.com/am-kantox/forkforge)
⤷ Unicode handling library
⤷ ruby

## Projects I Contributed To

▶ [elixir](https://github.com/elixir-lang/elixir)
⤷ Forked from `elixir-lang/elixir`
⤷ dynamic, functional language designed for building scalable and maintainable applications
⤷ elixir

▶ [nimble_csv](https://github.com/plataformatec/nimble_csv)
⤷ Forked from `plataformatec/nimble_csv`
⤷ A simple and fast CSV parsing and dumping library for Elixir
⤷ elixir

▶ [scenic](https://github.com/boydm/scenic)
⤷ Forked from `boydm/scenic`
⤷ client application library written directly on the Elixir/Erlang/OTP stack
⤷ elixir

▶ [scribe](https://github.com/codedge-llc/scribe)
⤷ Forked from `codedge-llc/scribe`
⤷ Pretty print tables of Elixir structs and maps
⤷ elixir

▶ [ets](https://github.com/TheFirstAvenger/ets)
⤷ Forked from `TheFirstAvenger/ets`
⤷ `:ets`, the Elixir way
⤷ elixir

▶ [xml_builder](https://github.com/joshnuss/xml_builder)
⤷ Forked from `joshnuss/xml_builder`
⤷ library for generating XML
⤷ elixir

▶ [recase](https://github.com/sobolevn/recase)
⤷ Forked from `sobolevn/recase`
⤷ ♻ Convert strings to any case
⤷ elixir

▶ [geocoder](https://github.com/knrz/geocoder)
⤷ Forked from `knrz/geocoder`
⤷ An elixir Geocoder/Reverse Geocoder
⤷ elixir

▶ [exexif](https://github.com/pragdave/exexif)
⤷ Forked from `pragdave/exexif`
⤷ Pure elixir library to extract tiff and exif metadata from jpeg files
⤷ elixir

▶ [sobelow](https://github.com/nccgroup/sobelow)
⤷ Forked from `nccgroup/sobelow`
⤷ Security-focused static analysis for the Phoenix Framework
⤷ elixir

## Selected SO Answers

- [How to get list of registered custom elements](https://stackoverflow.com/questions/27334365/how-to-get-list-of-registered-custom-elements/28210364#28210364)
- [Finding the cause of a memory leak in Ruby](https://stackoverflow.com/questions/20385767/finding-the-cause-of-a-memory-leak-in-ruby/20608455#20608455)
- [Remove `nil` from list](https://stackoverflow.com/questions/46339815/elixir-remove-nil-from-list/46339957#46339957)
- [Is there an equivalent to __MODULE__ for named functions in Elixir/ Erlang?](https://stackoverflow.com/questions/47281111/is-there-an-equivalent-to-module-for-named-functions-in-elixir-erlang/47281157#47281157)
- [Concise way to run code 0 to N times in Elixir](https://stackoverflow.com/questions/47818241/concise-way-to-run-code-0-to-n-times-in-elixir/47818344#47818344)

repository: versilov/am-kantox

repo_name: versilov/am-kantox


text:
# .$
[![Build Status](https://travis-ci.org/Dot-money/dot-money.svg?branch=master)](https://travis-ci.org/Dot-money/dot-money)

###  dot-money is an app to keep track of your capital gains when trading cryptocurrencies.

How to use:
To set-up an account:

http POST :3000/api/v1/signup username=karen<EMAIL_ADDRESS>password=test
Success will create a passwordHash and will send back a authorization token.

To sign in to existing an account:

http POST :3000/api/v1/signin username=karen password=test.
Success will create a passwordHash and will send back a authorization token.

To look at historical data from third party API:

http GET :3000/api/v1/price (optional date='2/12/2018')
If the date is included, the date in UTC, the ethereum value on that date and the UnixTimeStamp are returned.
If no date is included, the same data is returned for all the dates since July 31, 2015.

To set-up a wallet:

http POST :3000/api/v1/wallet wallet=API_KEY 'Authorization:Bearer TOKEN'
where API_KEY is an key for the currency and TOKEN is a JSON web token of the form header.payload.signature like 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbiI6ImFhYTM5MGQzZDhjNGU3MzYyYzliOTZlNmM5NDI2ZTE5YTM5N2Y3NDk4MDhkNjY4YzY3Yjc1MWE1NTA5ZWIxZGIiLCJpYXQiOjE1MTgwNTEwMjV9.mu5pXtewHlxiq3Sx1YCcgBkbHaQp1JNCxmrld0CL4Sg'.

 ```POST```
request add tracker of a wallet id to user’s account.
```(http POST localhost:8080/api/v1/c2/ walletid=‘0xF8EE57337d4fDB76260C29a8873e87bb30F53a8a’  tokenid=‘sample-token’)```
   - Should return status code ```201 user was created```

```GET```
request pulls the most up to date information of the user’s account

 ```(http GET localhost:8080/api/v1/c2/ tokenid=“sample-token”)```

    - Should return a JSON file containing the following:

  ```{"blockNumber":"4763872",
"timeStamp":"1513748174",
"transactionIndex":"31",
"from":"0x2a65aca4d5fc5b5c859090a6c34d164135398226",
"to":"0xc1a30fd9f85d48c38a8f8733d450d059b7bba1b5",
"value":"76551230000000000",
"confirmations":"311274",
"dollarValue":""
},
```
```PUT```
we can use it to refresh after a transaction was performed (updates database)
            -```http PUT localhost://8080/api/v1/c2/ tokenid=‘sample-token’```
            - also for every time user uses refresh or application updates (we save resources by only updating when user requests)

``` DELETE ```
will be used when a user stops tracking a wallet
                  -```http DELETE localhost://8080/api/v1/c2/ tokenid=‘sample-token’ walletid=‘0xF8EE57337d4fDB76260C29a8873e87bb30F53a8a’```

This is the flow:

- Server pings Ethereum API blockchain for the list of transactions for existing account

- Api returns a JSON file with list of transactions to server

- You then request the historic price data for the date of each transaction

- We then POST it to the user’s account

### TESTS:
- Wallet Validation
- Verify Balance againt API
- Check Time-stamp calculation to default to 12:01am
- Test Route Requests
- Error Handler
- Test Server
- User validation

//work in progress, will add some graphics

//dont forget: npm install get-csv
=======
Schemas

Auth
--compareHash(string, unique true)
--username(string)
--email(string)
--password(string)
--wallets(connects to wallet schema)
--timestamp(true)

Wallet
--walletId(string,unique true)
--capital gains(string)
--transactions(json)

Historical Data
--timestamp(usd)
--usd(number)
--Ethereum(float)

tuesday/2/13/18
//we added get-csv package

license: MIT

repository: nzytag/dot-money

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: nzytag/dot-money


text:
# tinspin-hdf5

HDF5 file reader for the TinSpin project.

The aim of this project is to provide a simple Java reader for [HDF5 files](https://www.hdfgroup.org/HDF5/) in order to extract coordinates for the TinSpin test framework. The aim is _not_ to provide a full fledged reader for all data associated with coordinates.

The main goal is to import [HDF5 v1 files](https://support.hdfgroup.org/HDF5/doc/H5.format.html) as provided by the [erikbern/ann-benchmarks](https://github.com/erikbern/ann-benchmarks/blob/master/README.md) project.

License: Apache Public License 2.0

Maintainer: Tilmann Zäschke

repository: tzaeschke/TinSpin

gha_language: Java

repo_name: tzaeschke/TinSpin


text:
### [CVE-2020-9816](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-9816)
![](https://img.shields.io/static/v1?label=Product&message=iOS&color=blue)
![](https://img.shields.io/static/v1?label=Product&message=macOS&color=blue)
![](https://img.shields.io/static/v1?label=Product&message=tvOS&color=blue)
![](https://img.shields.io/static/v1?label=Product&message=watchOS&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=%3C%20iOS%2013.5%20and%20iPadOS%2013.5%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Version&message=%3C%20macOS%20Catalina%2010.15.5%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Version&message=%3C%20tvOS%2013.4.5%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Version&message=%3C%20watchOS%206.2.5%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Vulnerability&message=Opening%20a%20maliciously%20crafted%20PDF%20file%20may%20lead%20to%20an%20unexpected%20application%20termination%20or%20arbitrary%20code%20execution&color=brighgreen)

### Description

An out-of-bounds write issue was addressed with improved bounds checking. This issue is fixed in iOS 13.5 and iPadOS 13.5, macOS Catalina 10.15.5, tvOS 13.4.5, watchOS 6.2.5. Opening a maliciously crafted PDF file may lead to an unexpected application termination or arbitrary code execution.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/0xCyberY/CVE-T4PDF
- https://github.com/ARPSyndicate/cvemon

repository: trickest/cve

branch_name: refs/heads/main

gha_language: HTML

gha_license_id: MIT

repo_name: trickest/cve


text:
# Writing Migration and Post Deployment Scripts
In Drift, Migration and Post Deployment scripts are special Javascript files that export an `exec` function. These scripts are used to perform more complex actions on the database. These scripts are run against all providers unlike the object related SQL scripts that are only run against a specific provider.

## Table of Contents

- [What are Migrations?](#what-are-migrations)
- [What are Post Deployment Scripts](#what-are-post-deployment-scripts)
- [Creating Scripts](#creating-scripts)
- [Writing Scripts](#writing-scripts)
  - [Exec Function Arguments](#exec-function-arguments)
  - [DbContext Overview](#dbcontext-overview)
- [Tips](#tips)

## What are Migrations?
Migration scripts are run at the very beginning of the publish process and are only apply to a databaes one time. Once a migration has been successfully applied to a database, it will not be run again. Migrations are best used for:

- Creating schemas, tables or indexes
- Changing existing tables, columns or indexes
- Renaming tables or columns
- Dropping schemas, tables, columns or indexes

## What are Post Deployment Scripts?
Post Deployment scripts are run at the very end of the publish process. Unlike Migrations, Post Deployment scripts are run on every publish. Post Deployment scripts are best used for:

- Seeding data
- Ensuring database roles and permissions are defined

## Creating Scripts
Migration and Post Deployment scripts are created using the `create migration` and `create postDeploy` commands respectively. These commands will generate a Javascript file with a template for the script.

```bash
# Creates a migration script
$ drift create migration my-first-migration
Created file: E:/repos/drift-test/.drift/migrations/1554380701490-my-first-migration.js

# Create a post deployment script
$ drift create postDeploy my-first-post-deploy
Created file: E:/repos/drift-test/.drift/postDeploy/1554380701500-my-first-post-deploy.js
```

## Writing Scripts
These scripts will export an `exec` function that will be used to apply the script. The following is an example of templated file generated by running one of the create commands.

```javascript
/******************************************************************************
 * {scriptType}: {timestamp}-{scriptName}
 *****************************************************************************/
async function exec(context, Sequelize, provider, replacements) {

}

exports.exec = exec
```

### Exec Function Arguments
Drift will provide the `exec` function with the following arguments.

- **context** - [DbContext](#dbcontext-overview) object with methods for manipulating the data structure
- **Sequelize** - Reference to the static instance of Sequelize. Primarily for getting access to defining data types
- **provider** - String indicating database provider the publish is being run against. For example: 'mssql' or 'postgres'
- **replacements** - Map object of standard and custom replacement values available for the publish
  - Standard Replacements
    - *DatabaseName* = Name of the database that is being published
    - *Provider* = String indicating the database provider being published
    - *PublisherUsername* = Name of the user that is publishing the database

### DbContext Overview
The *DbContext* object provided by the `context` provides a wrapper around the Sequelize Query Interface and ensures that the publish transaction is applied to each command that is executed. These are the helper methods provided to you by the *DbContext*:

- **addColumn** - Adds a column to an existing table
  - `(tableName: string | { tableName?: string; schema?: string }, key: string, attribute: ModelAttributeColumnOptions | DataType): Promise<void>`
- **addIndex** - Adds an index to an existing table
  - `(tableName: string, attributes: string[], rawTablename?: string): Promise<void>`
- **changeColumn** - Alter the definition of an exsting column
  - `(tableName: string | { schema?: string; tableName?: string }, attributeName: string, dataTypeOrOptions?: DataType | ModelAttributeColumnOptions): Promise<void>`
- **createSchema** - Creates a new schema
  - `(schema?: string): Promise<void>`
- **createTable** - Creates a new table
  - `(tableName: string | { schema?: string; tableName?: string }, attributes: ModelAttributes): Promise<void>`
- **dropSchema** - Drops an existing schema
  - `(schema?: string): Promise<void>`
- **dropTable** - Drops an existing table
  - `(tableName: string): Promise<void>`
- **removeColumn** - Drops an existing column from a table
  - `(tableName: string | { tableName?: string; schema?: string }, attribute: string): Promise<void>`
- **removeIndex** - Drops an existing index from a table
  - `(tableName: string, indexName: string): Promise<void>`
- **renameColumn** - Renames an exsting column on a table
  - `(tableName: string | { schema?: string; tableName?: string }, attrNameBefore: string, attrNameAfter: string): Promise<void>`
- **renameTable** - Renames an existing table
  - `(before: string, after: string): Promise<void>`
- **runRawQuery** - Executes the provided query text against the database.
  - `(queryText: string): Promise<any>`

## Tips
- Only use the `context` to interact with the database
- Make sure to await promises and not resolve the exec function before it has completed
- Be careful using `context.runRawQuery` the provided text is directly executed against the database
- Generally, Post Deployment scripts will only use `context.runRawQuery`

repository: gatewayapps/drift

gha_language: TypeScript

repo_name: gatewayapps/drift


text:
Title: Postfix: Using Gmail as a Relay Host
Date: 2012-07-06 19:08
Category: Linux
Tags: Gmail, Linux, Postfix, Ubuntu
Slug: postfix-using-gmail-as-a-relay-host
Author: Chris Kankiewicz

I maintain several Linux servers at any given moment. Every server has postfix
installed for sending emails, usually notifications or warning messages of some
sort and most of these servers are professionally hosted allowing outbound
emails with little to no configuration beyond installing postfix.  However, my
home server lies behind my ISP and they block all outbound emails citing SPAM as
the reason.  Regardless of their reasoning I had to find a workaround to allow
me to send email notifications from behind my ISP.  Well, it turns out this is
rather painless with postfix and a Gmail account.

First, set up a [Gmail](https://www.gmail.com) account, note the user name and
password for later.

### Install postfix

    :::bash
    $ sudo apt-get install postfix

### Add the following to /etc/postfix/main.cnf

    :::text
    # Forward mail through Gmail
    relayhost = [smtp.gmail.com]:587
    smtp_use_tls = yes
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    smtp_tls_CAfile = /etc/ssl/certs/Equifax_Secure_CA.pem

### Create the file /etc/postfix/sasl_passwd and add the following:

    :::text
    [smtp.gmail.com]:587 [username]@gmail.com:[password]

Be sure to replace `[username]` and `[password]` with your account user name and
password.

### Modify file permissions and generate sasl_passwd.db

    :::bash
    $ cd /etc/postfix
    $ postmap sasl_passwd
    $ chmod 600 sasl_passwd sasl_passwd.db

### Restart postfix service

    :::bash
    $ sudo service postfix restart

### Send a test email

    :::bash
    $ sudo apt-get install mailutils
    $ echo 'Success!' | mailx -s 'Test Message' [email_address]

Replace `[email_address]` with your email address to receive a test message.


text:
---
layout: post
title: Amazon Cellphone Review Sentiment with PySpark
---

# Amazon Cellphone Review Sentiment with PySpark
Here I'm going to be using PySpark to create a sentiment model for amazon review data using Logistic Regression. The dataset was collected from [Professor Julian McAuley's Amazon product dataset](https://jmcauley.ucsd.edu/data/amazon/). I will be using a subset of the data titled "Cell Phones and Accessories", just to keep to a specific sentiment domain.

First, we need to import some necessary libraries for constructing the model, preprocessing the data, and evaluating the results.

## Setting up Spark session
```python
from pyspark.sql import SparkSession, SQLContext
```

And now we can build our spark session:

```python
spark = SparkSession.builder.master("local[*]") \
                            .config('spark.driver.memory', '15g') \
                            .appName('amazon_phones').getOrCreate()
sc = spark.sparkContext
```

## Loading review data

Now we need to load the data in. We can load it directly from the link given above with the following function:

```python
import json
import urllib.request
import gzip

def load_amazon_cellphones(num_examples):
    link = "http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/reviews_Cell_Phones_and_Accessories_5.json.gz"
    stream = urllib.request.urlopen(link)
    file = gzip.open(stream)
    lines = []
    if num_examples == -1:
        for i, line in enumerate(file):
            lines.append(json.loads(line))
    else:
        for i, line in enumerate(file):
            lines.append(json.loads(line))
            if i == num_examples - 1:
                break
    return lines
```

This function locates and unzips the date directly from the source, and allows for you to paritally load the whole dataset in. For example, if you only wanted to load in 100 examples, you could run

```python
dataset = load_amazon_cellphones(100)
```
I found this to be really helpful when troubleshooting and testing the code. For this article, we're going to use every row, meaning we have to run the following line:

```python
dataset = load_amazon_cellphones(-1)
```

After loading in the data, we can look at an example row:

```
{'asin': '120401325X',
 'helpful': [0, 0],
 'overall': 4.0,
 'reviewText': "They look good and stick good! I just don't like the rounded shape because I was always bumping it and Siri kept popping up and it was irritating. I just won't buy a product like this again",
 'reviewTime': '05 21, 2014',
 'reviewerID': 'A30TL5EWN6DFXT',
 'reviewerName': 'christina',
 'summary': 'Looks Good',
 'unixReviewTime':<PHONE_NUMBER>}
```

We're only concerned with the actual review, `reviewText`, and the corresponding label, `overall`.
## Preprocessing and Parallelizing

The data is currently labeled on a 1-to-5 rating scale. To simplify things, I'm going to remove neutral labels (this is done later) and map these labels to a binary classification problem with the following function:

```python
def create_categories(x):
  if x >= 4.0:
    return 1.0
  else:
    return 0.0
```

The problem has now become "can we predict if a user really liked a product?" Anything less than a score of 4.0 means that a user is either just O.K. with, or really dislikes, a product.

Now we need to create a method for preprocessing our data:

```python
import re
from nltk.corpus import stopwords
from string import punctuation

def clean(review):
  #removing numbers
  review = re.sub('[0-9]', '', review).lower()
  #removing punctuation
  review = review.translate(str.maketrans('', '', punctuation))
  return review
```

Now let's only get the useful columns from our data, which are `reviewText` and `overall`.

```python
relevant_info = [(line['reviewText'],
                 line['overall'])
                 for line in dataset]
```

And finally, we can get to parallelizing and preprocessing:

```python
#convert data to rdd
rdd = sc.parallelize(relevant_info)
#remove neutral reviews
rdd = rdd.filter(lambda x: x[1] != 3.0)
#map categories to binary labels
rdd = rdd.map(lambda x: (x[0], create_categories(x[1])))
#clean reviews
rdd = rdd.map(lambda x: (clean(x[0]), x[1]))
#remove empty rows
rdd = rdd.filter(lambda x: x[0] != '')
```
Now we can convert the RDD to a DataFrame object:

```python
schema = ['review', 'label']
data = rdd.toDF(schema = schema)
data.show()
```

You should get something like this:

```
+--------------------+-----+
|              review|label|
+--------------------+-----+
|they look good an...|  1.0|
|these stickers wo...|  1.0|
|these are awesome...|  1.0|
+--------------------+-----+
```

Now we can view the schema of the resulting dataframe and also check how many rows the data consists of:

```python
data.printSchema()
data.groupBy('label').count().distinct().show()
```

```
root
 |-- review: string (nullable = true)
 |-- label: double (nullable = true)

+-----+------+
|label| count|
+-----+------+
|  0.0| 24328|
|  1.0|148575|
+-----+------+
```

## Dealing with imbalanced data
After removing neutral reviews and preprocessing, we're left with 172,903 reviews. As shown by the counts of unique labels, the dataseat is heavily imbalanced towards positive labels. We need to account for this in the training and evaluation stages.

First, we can calculate class weights for our sentiment model. Spark has no built-in function to calculate these weights, but [this awesome article by Dan Vatterott] shows how you can implement this feature.

Here is the code for implementing class weights in pyspark, adopted from the above article:

```python
def get_class_weights(dataframe, labelCol):
    label_collect = dataframe.select(labelCol).groupby(labelCol).count().collect()
    unique_labels = [x['label'] for x in label_collect]
    bin_count = [x['count'] for x in label_collect]
    total_labels = sum(bin_count)
    unique_label_count = len(label_collect)
    class_weights = {i: ii for i, ii in zip(unique_labels, total_labels / (unique_label_count * np.array(bin_count)))}
    mapping_expr = F.create_map([F.lit(x) for x in chain(*class_weights.items())])
    dataframe = dataframe.withColumn('weight', mapping_expr.getItem(F.col(labelCol)))
    return dataframe
```

Now, we can simply run the line to calculate the class weights:

```python
data = get_class_weights(data, labelCol = 'label')
```

The resulting dataframe should now look like this, with a new `weight` column appended.

```
+--------------------+-----+------------------+
|              review|label|            weight|
+--------------------+-----+------------------+
|they look good an...|  1.0|0.5818711088675753|
|these stickers wo...|  1.0|0.5818711088675753|
|these are awesome...|  1.0|0.5818711088675753|
|item arrived in g...|  1.0|0.5818711088675753|
|awesome stays on ...|  1.0|0.5818711088675753|
|came just as desc...|  1.0|0.5818711088675753|
|it worked for the...|  0.0| 3.553580236764222|
|good case solid b...|  1.0|0.5818711088675753|
|this is a fantast...|  1.0|0.5818711088675753|
|this case fits pe...|  1.0|0.5818711088675753|
|this is the first...|  1.0|0.5818711088675753|
|performs exactly ...|  1.0|0.5818711088675753|
|unlike most of th...|  1.0|0.5818711088675753|
|just what i neede...|  1.0|0.5818711088675753|
|when there is no ...|  1.0|0.5818711088675753|
|it works great do...|  1.0|0.5818711088675753|
|surprisingly this...|  1.0|0.5818711088675753|
|i have tested thi...|  1.0|0.5818711088675753|
|it worked great f...|  0.0| 3.553580236764222|
|i love that it ha...|  1.0|0.5818711088675753|
+--------------------+-----+------------------+
```

Now we can start constructing our sentiment model. We are going to construct a pipeline that includes our preprocessing steps and our logistic regression model.

At this stage, we are going to word-tokenize the reviews, remove stopwords, and then convert them to a bag-of-words representation. We're going to prune all words that show up less than 5 times in the dataset, and also cap the vocabulary size at 10,000 words to reduce model complexity. This is shown in the following code:

## Creating the model

```python
from pyspark.ml.feature import RegexTokenizer, StopWordsRemover, CountVectorizer
from pyspark.ml.classification import LogisticRegression
from pyspark.ml import Pipeline
from pyspark.sql.functions import col
import nltk

nltk.download('stopwords')
sw = list(set(stopwords.words('english')))

#tokenize reviews
regexTokenizer = RegexTokenizer(inputCol = 'review',
                                outputCol = 'tokenized',
                                pattern = "\\W")

stopwordsRemover = StopWordsRemover(inputCol = 'tokenized',
                                    outputCol = 'removed_sw').setStopWords(sw)

#convert to BoW representation
countVectorizer = CountVectorizer(inputCol = "removed_sw",
                               outputCol = "features",
                               vocabSize = 10000,
                               minDF = 5)

#weightCol takes in the resulting class weights calculated earlier
lr = LogisticRegression(featuresCol = 'features',
                        labelCol = 'label',
                        weightCol = 'weight')

pipeline = Pipeline(stages = [regexTokenizer, stopwordsRemover, countVectorizer, lr])
```

Now that our pipeline has been created, we can split the data into training and testing partitions and train the model:

```python
train_data, test_data = data.randomSplit([0.9, 0.1])

pipelineFit = pipeline.fit(train_data)
```

## Evaluation

Now it's time to evaluate our model. Since our data are pretty imbalanced, we should probably avoid using simpler metrics like accuracy. Instead we'll calculate "Area under ROC" to determine how well the model descriminates between positive and negative reviews.
```python
from pyspark.mllib.evaluation import BinaryClassificationMetrics

metrics = BinaryClassificationMetrics(test_predictions.select('prediction', 'label').rdd)

auroc = metrics.areaUnderROC

print('Area under ROC: {}'.format(auroc))
```

This cell returns the following result:

```
Area under ROC: 0.839271845861672
```

which is pretty good for a simple Logistic Regression model with a BoW representation!

The source code for this article can be found [here](https://github.com/dbragdon1/spark_projects/blob/master/classification/logistic_regression_sentiment_weighted.py). It is slightly altered for use on the command line.


text:
# Lorem Ipsum 2017 - a Sketch plugin

This is a plugin for [Sketch](https://www.sketchapp.com).

It generates "lorem ipsum" filler content for text fields.

## Why did you make this?

I tried another plugin, and it didn't work for the latest version of Sketch. This one should work.

## Keyboard shortcut

To trigger the plugin, you can use this keyboard shortcut:

`Shift + Ctrl + L`


text:
---
title: Brief introduction to scope hoisting in Webpack
excerpt: On its third major release, Webpack introduced a new feature, scope hoisting. Many developers are already exposing data showing great positive impacts on the initial execution time of their bundles.
host: webpack publication
host_url: //medium.com/webpack
external_url: //medium.com/webpack/brief-introduction-to-scope-hoisting-in-webpack-8435084c171f
---

But what is it, and how it works? To answer this questions we first need to understand what happens with our code when we bundle it.

## Your bundles, under the hood

While modules make their way to be natively supported, bundlers like Webpack transform our import and export statements into valid JavaScript code that can run in browsers today.

Here is a quick example of this transformation:

```js
import action from './other-module.js';

var value = action();

export default value;
```

… which turns into this:

```js
(function (module, exports, WEBPACK_REQUIRE_METHOD) {
  'use strict';

  var action = WEBPACK_REQUIRE_METHOD(1);
  var value = action();

  exports.default = value;
});
```

Here is a simplified version of it.

```js
(function (modules) {
  var installedModules = {};

  function WEBPACK_REQUIRE_METHOD(id) {
    // if module was already imported, return its exports
    if (installedModules[id]) {
      return installedModules[id].exports;
    }

    // create module object and cache it
    var module = (installedModules[id] = {
      id: id,
      exports: {}
    });

    // call module’s function wrapper
    modules[id](module, module.exports, WEBPACK_REQUIRE_METHOD);
  }

  // kick off by calling entry module
  WEBPACK_REQUIRE_METHOD(0);
})([
  /* 0 module */
  function () {},
  /* 1 module */
  function () {},
  /* n module */
  function () {}
]);
```

_A lot it’s happening here. Let’s break it down!_

First, an object is created to save the result from already accessed modules.

Below, the method which replaces import statements gets declared. This method calls the function wrapping the module and populates the exports object, or returns its cached value if it was already required.

At the end, this method is called again, but this time with our entry point module index to kick off our application.

### Experience and tradeoffs

Imagine a situation where a module imports a method, which needs to import another method from another module… and so on.

In our bundle, each import translates into an extra function call and a property access to the modules array as Webpack gets to the end of this import chain.

These constraints have been meassured in the past, like Sam Saccone detecting [400ms were spent only in Browserify module require in Tumblr](//docs.google.com/document/d/1E2w0UQ4RhId5cMYsDcdcNwsgL0gP_S6SDv27yi1mCEY) or Nolan Lawson [exposing brenchmarks on different bundlers](//nolanlawson.com/2016/08/15/the-cost-of-small-modules).

But we still need modules. On big projects **performance** is a price we pay in exchange for better codebase scalability and encapsulation.

## What is scope hoisting?

This new feature was introduced to detect where these _import_ chaining can be flatten and converted into one inlined function without compromising our code.

Let’s picture the previously described situation where a method needs to import another.

```js
(function () {
  'use strict';

  var helper = WEBPACK_REQUIRE_METHOD(0);

  var action = function () {
    var value = helper();
    return value;
  };

  exports.action = action;
});
```

If scope hoisting is enabled, Webpack here will see the opportunity to save one require method call by inlining the helper method like this:

```js
(function () {
  'use strict';

  function helper() {
    /* inlined function from module */
  }

  var action = function () {
    var value = helper();
    return value;
  };

  exports.action = action;
});
```

_No call to Webpack’s require function, no access to the modules array… Faster!_

We not only save an extra function call, but also an access to the modules array, so our code runs faster than before.

## How to enable scope hoisting

To use this feature you will need the latest _webpack_ package version and add the **ModuleConcatenationPlugin** to your config.

```js
var webpack = require('webpack');

module.exports = {
  // your config
  plugins: [new webpack.optimize.ModuleConcatenationPlugin()]
};
```

This optimising technique might break in some edge cases, that’s why webpack did a major release.

Make sure to run some tests and share the results with the webpack team, they will love your feedback!

repository: jeremenichelli/personal-site

gha_language: JavaScript

repo_name: jeremenichelli/personal-site


text:
---
layout: post
title: "APPLY for Fall Apprenticeships!"
featureImg: videography.jpg
teaser: "If you or someone you know is interested in a paid Fall Apprenticeship with St. Louis ArtWorks, NOW is the time to apply! Click \"APPLY\" above for more information!"
homepage: true
---

**UPDATE: Fall 2015 Apprentice positions have been filled. THANK YOU for your interest, and check back in November for Spring Applications!**

If you or a St. Louis teen you know are interested in a **FALL APPRENTICESHIP** with St. Louis ArtWorks, ***NOW*** is the time to apply!

Visit [stlartworks.org/apply/](http://stlartworks.org/apply/) to submit your application today!

**Paid Art Apprenticeships for Teens, Fall 2015:** Painting ~ Videography~ Graphic Design

APPLY NOW if you are 14-18 years old and interested in getting paid to create art:

~Receive training in different art mediums, especially videography and painting ~ Gain confidence, work experience & valuable life skills

(APPLICANTS MUST BE 14 YEARS OLD BY JANUARY 1, 2015) Sessions will take place at **[our new studio at 5959 Delmar](https://www.google.com/maps/place/5959+Delmar+Blvd,+St+Louis,+MO+63112/@38.6548341,-90.2927678,17z/data=!4m2!3m1!1s0x87df4aacff16250b:0xef4a139e5304dde7)**

**:::FALL SESSION SCHEDULE:::** *Videography/Graphic Design:* Saturdays 10am-3pm *Painting: Tuesdays/Thursdays* 3:30pm-6pm

Interviews will be conducted on **Saturday, August 29**.

**You will be contacted via email if you have been selected to interview.**

If you have other questions about the program, please contact the ArtWorks Program Manager at: [program.manager@stlartworks.org](javascript:void(location.href=) or<PHONE_NUMBER>.


text:
# Quickstart Intro

The following is a quick how-to-use guide on using the cluster api on a vCenter infrastructure.  Before beginning, make sure you have the following requirements:

1. vCenter 6.5+ cluster or ESXi 6.5+
    - You will need to gather some information about the cluster, described below.
    - [ESXi provisioning](./esx_provisioning.md) should be used for development purposes only.
2. golang 1.12+
3. a type 2 desktop hypervisor (Vmware Fusion/Workstation or VirtualBox)
4. GOPATH environment set
5. dep installed (https://github.com/golang/dep)
6. kustomize V2 installed (https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md)
7. kubebuilder installed (https://book.kubebuilder.io/quick_start.html)

**Be aware, the current repo supports deploying Kubernetes 1.11.x and above.**

### Decide on whether to use minikube or kind as your bootstrapper

In the self-service workflow, clusterctl will create a bootstrap cluster to kick off the process.  You have two options for bootstrappers: minikube or kind.  Kind is a relatively new project that starts a cluster within Docker on your local machine.  This removes the need to have a desktop hypervisor installed on your local machine.  If you intend to use the kind bootstrapper, you may skip the next section on Fusion and minikube.

### Preparing Vmware Fusion/Workstation for minikube

1. Download a release build from the [minikube release page](https://github.com/kubernetes/minikube/releases)
2. Install docker-machine driver for vmware (shown below)
```
$> curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.33.1/minikube-darwin-amd64 && chmod +x minikube && sudo cp minikube /usr/local/bin/ && rm minikube

$> export LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' https://github.com/machine-drivers/docker-machine-driver-vmware/releases/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') \
   && curl -L -o docker-machine-driver-vmware https://github.com/machine-drivers/docker-machine-driver-vmware/releases/download/$LATEST_VERSION/docker-machine-driver-vmware_darwin_amd64 \
   && chmod +x docker-machine-driver-vmware \
   && sudo mv docker-machine-driver-vmware /usr/local/bin/
```

### Prepare kind

To install kind, simply tell Go to download and build it.

```
$> go get sigs.k8s.io/kind
```

### Building clusterctl

To run clusterctl on vCenter, you must build the CLI from this repo.  The following instruction assumes $GOPATH is defined and $GOPATH/bin is in your current path.

```
$> go get sigs.k8s.io/cluster-api-provider-vsphere
$> cd $GOPATH/src/sigs.k8s.io/cluster-api-provider-vsphere/cmd/clusterctl
$> go build && go install
```

### Prepare your vCenter

The current cluster api components and clusterctl CLI assumes two preconditions:

1. Clusters are created inside a resource pool.  Create one if you do not already have a resource pool.
2. A template of a linux distro with cloud init exist on your vCenter
    - download https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64.ova
    - deploy the ova
    - create a template for this vm

### Prepare cluster definition files

In *$GOPATH/src/sigs.k8s.io/cluster-api-provider-vsphere*, the makefile has targets to create base definition files, build the controller container, and push the container up to a repo.  For this example, use the production controller containers that have already been built.  For developers that want to modify the controller, there is a section below on makefile targets.  For now, follow the following commands:
```
$> make prod-yaml
```

Once that command has been executed, there should now be an `out/` folder in the repo's root path.  This folder should now contain 4 base yaml files, provider-components.yaml, machines.yaml, cluster.yaml, addons.yaml.

In cluster.yaml, update the name of the cluster and the providerSpec section with your vCenter auth data. Below is an example.
```
apiVersion: "cluster.k8s.io/v1alpha1"
kind: Cluster
metadata:
  name: test1
spec:
    clusterNetwork:
        services:
            cidrBlocks: ["<IP_ADDRESS>/12"]
        pods:
            cidrBlocks: ["<IP_ADDRESS>/16"]
        serviceDomain: "cluster.local"
    providerSpec:
      value:
        apiVersion: "vsphereproviderconfig/v1alpha1"
        kind: "VsphereClusterProviderConfig"
        vsphereUser<EMAIL_ADDRESS>        vspherePassword: "xxxx"
        vsphereServer: "mycluster.mycompany.com"
```

The machines.yaml file defines the master nodes of your cluster, and the machineset.yaml defines the worker nodes of your cluster.  Edit the providerSpec section of both files.  Below is an example of a modified providerSpec section.
```
items:
- apiVersion: "cluster.k8s.io/v1alpha1"
  kind: Machine
  metadata:
    generateName: vs-master-
    labels:
      cluster.k8s.io/cluster-name: test1
      set: master
  spec:
      providerSpec:
        value:
          apiVersion: "vsphereproviderconfig/v1alpha1"
          kind: "VsphereMachineProviderConfig"
        machineSpec:
          datacenter: "mydc"
          datastore: "mydatastore"
          resourcePool: "my-resource-pool"
          networks:
          - networkName: "VM Network"
            ipConfig:
              networkType: static
              ip: ""
              netmask: ""
              gateway: ""
              dns:
              - xxxx
              - yyyy
          numCPUs: 2
          memoryMB: 2048
          template: "xenial-server-cloudimg-amd64"
          disks:
          - diskLabel: "Hard disk 1"
            diskSizeGB: 20
          preloaded: false
          trustedCerts:
          - zzzz
          - aaaa
    versions:
      kubelet: 1.11.1
      controlPlane: 1.11.1
    roles:
    - Master
```

Note, the disk size above in this example needs to be 15GB or higher.  Also note, the machine yaml allow the network to be setup to use either DHCP or static IP.  However, for the machine to be created to use static IP, the VM template used must be derived from a custom cloud init image with the Guestinfo Datasource installed.  The instructions for creating such an image can be found [here](cloud_init_with_guestinfo_datasource.md).

### Create a *target cluster*

The most basic workflow for creating a cluster using *clusterctl* actually ends up creating two clusters.  The first is called the **bootstrap** cluster.  This cluster is created using minikube.  The cluster api components are installed on this cluster.  *Clusterctl* then uses the cluster api server on the bootstrap cluster to create the **target** cluster.  Once the target cluster has been created, *clusterctl* will cleanup by deleting the bootstrap cluster.  There are other workflows to create the target cluster, but for this intro, the most basic workflow is used.  The command is shown below.  Once the CLI has finished, it will put the kubeconfig file for your target cluster in your current folder.  You can use that kubeconfig file to access your new cluster.

  Now, create the worker nodes for the cluster.  For this, you will use kubectl.

```
$> kubectl --kubeconfig ./kubeconfig create -f ./machineset.yaml
$> kubectl --kubeconfig ./kubeconfig get no -w
```

Creating the worker nodes will take some time.  The second command above will monitor the nodes getting created.

### Create a *Target Cluster* using an initial *existing cluster*

The clusterctl CLI has an ability to create a cluster **without** creating a bootstrap cluster.  If there is an existing cluster that can serve as the bootstrap cluster, it is possible to provide clusterctl with it's kubeconfig file.  The following example uses minikube to create a kubernetes cluster and then use clusterctl with the `-e` option to let the CLI know about this cluster.

```
// Create a minikube cluster with control plane 1.11.3
$> minikube start --bootstrapper=kubeadm --vm-driver=vmware --kubernetes-version=v1.11.3

// Create a cluster using the kubeconfig created by minikube above
$> clusterctl create cluster -c cluster.yaml -m machines.yaml -p provider-components.yaml --provider vsphere -e $HOME/.kube/config
```

Notice in the example above, the `-e` option was used and the `--vm-driver` option was left out.  Recall, that option is only used to create a bootstrap cluster, and there is no need to create a bootstrap cluster in this example.  Also, notice above, minikube was instructed to install kubernetes 1.11.3.

### Delete the cluster

`Clusterctl delete cluster` currently is unable to delete the cluster.  To delete a cluster created using the above instructions, use kubectl and perform the steps in reverse.  For this to work, the workflow to create a cluster using an existing cluster must be used as this step requires a cluster containing the api objects backing the target cluster.

```
$> minikube start --bootstrapper=kubeadm --vm-driver=vmware --kubernetes-version=v1.11.3
$> clusterctl create cluster -e <existing cluster kubeconfig> ...

...

$> kubectl delete -f machineset.yaml
$> kubectl delete -f machines.yaml
$> kubectl delete -f cluster.yaml
```

### Makefile targets

The makefile in the repo contains a few useful targets described below.

| Target | Description |
| --- | --- |
| make manager | builds the controller binary in cmd/manager.  This target is useful to test building the controller code without the lengthy build process to create the container version. |
| make clusterctl | builds the clusterctl binary cmd/clusterctl.  Like the above, this is useful to test building the code but does not install the binary. |
| make prod-build | builds the container version of the controller.  This target really isn't meant for users or devs who do not have access to the production container's registry. |
| make prod-push | pushes the container version of the container to the production registry. |
| make prod-yaml | creates the base yaml files. |
| make ci-build | used in CI to build the container version of the controller.  This target isn't meant for users.  It is used only by the CI system. |
| make ci-push | used in CI to push the container version of the controller to a registry that the CI uses for testing. |
| make ci-yaml | creates the base yaml files. |
| make dev-build | *used by developers to create their own container version of the controller. |
| make dev-push | *used by developers to push their own container version of the controller. |
| make dev-yaml | *creates the base yaml files. |

Note, for developers who want to test their changes, use the dev targets.  Use the build targets before the yaml targets.  Also, modify the makefile and update the DEV_IMG with the desired registry and container name.

```
# Image URL to use all building/pushing image targets
PRODUCTION_IMG ?= gcr.io/cnx-cluster-api/vsphere-cluster-api-provider:latest
CI_IMG ?= gcr.io/cnx-cluster-api/vsphere-cluster-api-provider
DEV_IMG ?= # <== NOTE:  outside dev, change this!!!
```

During the build targets, the necessary config file gets updated with this image name.  Then once the yaml targets are use, provider-components.yaml will contain the desired controller container image.


text:
We had a lot to absorb:

Object Literals
- a place to store function or data to be called upon at a later time
- all content goes within curly braces
- all proto information is created by javascript
- can include objects within objects!  Be careful how much information you have in an object
- can include arrays as well
- stick with notations to make it easier and simpler for yourself
- .push() will add to an array.  Can access arrays like you would normally.
- X.Y will call out object properties; continue dot notation to get more information
	- no shortcuts
- bracket notations.  Be sure to include quotes
- add property by doing something like: object.new value = new value  IE - "wolf.tagged = true"
- delete by delete object.property IE - "delete wolf.tagged"
- {} can create an object; anything can be an object

This
-  keyword, this version of this object: this is my computer

DOM tree
- nodes related to each other: parent, child, granchild, etc.
- global attributes and class attributes and how they interact with each other
- pinpoint specific attributes in html
- browser goes through a lot of process before a webpage is displayed
	- we need to understand how it works and what is going on with the browser
- DOM transversal = move around the DOM tree.  document in console
- DOM manipulation
- native code = native to the built
- getElementById creates into an object
- getters = pulling information already in the DOM  IE - h1El.id
- setters = changes the content to different value in the element IE - h1El.textContent = "something clever"
	- will not stay if you refresh; will go back to the hardcoded DOM tree

It was good to go over the content we had to read.  The reading was a bit confusing, but now it makes more sense.  Hopefully more will be clarified in the lab tomorrow.

repository: pdkim/learning-journal

repo_name: pdkim/learning-journal


text:
---
layout: default
---
## Welcome!

Members of the CodeGuild have been hard at work, making fun and very interactive games for the BBC micro:bit. This website documents their work.

You'll find links and descriptions for all of the games that the CodeGuild have created. As well as blog posts on how it was all acheived.

If you'd like to jump right in and start playing a game visit the [list page](/list/) and follow the instructions.

If you'd like to browse the code and see what's what, you'll find everything in our [GitHub repo](https://github.com/CodeGuild-co/adventure-bit).

If you'd like to download the code then you can grab everything in one go using the download links at the top of the page. Or download each game individually from its page.

repository: RobRussmann/adventure-bit

gha_language: Python

repo_name: RobRussmann/adventure-bit


text:
# React Native Biometric Auth

React native biometric Auth is a bridge to Android/iOS for biometric authentication.

## Feature List

1. Check if Biometric authentication enabled on the device.
2. Authenticate user using Biometric with a fallback mechanism to passcode or device password.
3. Supported on both Android and iOS.

### How to use

#### Installation
`npm i rn-biometric-authentication`

### Link / AutoLinking

On React Native 0.60+ the [CLI autolink feature](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) links the module while building the app.

## Additional configuration

#### iOS

This package requires an iOS target SDK version of iOS 10 or higher

Ensure that you have the `NSFaceIDUsageDescription` entry set in your react native iOS project, or Face ID will not work properly.  This description will be will be presented to the user the first time a biometrics action is taken, and the user will be asked if they want to allow the app to use Face ID.  If the user declines the usage of face id for the app, the `isSensorAvailable` function will indicate biometrics is unavailable until the face id permission is specifically allowed for the app by the user.

#### Android

This package requires a compiled SDK version of 29 (Android 10.0) or higher

## Methods

### isSensorAvailable()

Detects what type of biometric sensor is available.  Returns a `Promise` that resolves to an object with details about biometrics availability

__Result Object__

| Property | Type | Description |
| --- | --- | --- |
| available | bool | A boolean indicating if biometrics is available or not |
| biometryType | string | A string indicating what type of biometrics is available. `TouchID`(iOS), `FaceID`(iOS), `Biometrics`(Android), or `undefined` if biometrics is not available. |
| error | string | An error message indicating why biometrics may not be available. `undefined` if there is no error. |

__Example__

```js
import ReactNativeBiometricAuth from 'rn-biometric-authentication'

ReactNativeBiometricAuth.isSensorAvailable()
  .then((resultObject) => {
    const { available, biometryType } = resultObject

    if (available && biometryType === ReactNativeBiometrics.TouchID) {
      console.log('ReactNativeBiometricAuth', 'TouchID is supported')
    } else if (available && biometryType === ReactNativeBiometrics.FaceID) {
      console.log('ReactNativeBiometricAuth', 'FaceID is supported')
    } else if (available && biometryType === ReactNativeBiometrics.Biometrics) {
      console.log('ReactNativeBiometricAuth', 'Biometrics is supported')
    } else {
      console.log('ReactNativeBiometricAuth', 'Biometrics not supported')
    }
  })
```

### simplePrompt(options)

Prompts the user for their fingerprint or face id. Returns a `Promise` that resolves if the user provides a valid biometrics or cancel the prompt, otherwise the promise rejects.

__Options Object__

| Parameter | Type | Description | iOS | Android |
| --- | --- | --- | --- | --- |
| promptMessage | string | Message that will be displayed in the biometrics prompt | ✔ | ✔ |
| cancelButtonText | string | Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` | ✖ | ✔ |
| isDeviceAuthEnabled | boolean | Enable fallback to device credential for authentication. | ✖ | ✔ |
| fallbackText | string | Fallback text to be displayed for passcode if `TouchID` or `FaceID` authentication failed. | ✔ | ✖ |

__Result Object__

| Property | Type | Description |
| --- | --- | --- |
| success | bool | A boolean indicating if the biometric prompt succeeded, `false` if the users cancels the biometrics prompt |
| error | string | An error message indicating why the biometric prompt failed. `undefined` if there is no error. |

__Example__

```js
import ReactNativeBiometricAuth from 'rn-biometric-authentication'

ReactNativeBiometricAuth.simplePrompt({promptMessage: 'Authenticate'})
  .then((resultObject) => {
    const { success } = resultObject

    if (success) {
      console.log('ReactNativeBiometricAuth', 'Success')
    } else {
      console.log('ReactNativeBiometricAuth', 'Cancelled')
    }
  })
  .catch(() => {
    console.log('ReactNativeBiometricAuth', 'Failed')
  })
```

### Inspiration
This library uses some code from [react-native-biometrics](https://github.com/SelfLender/react-native-biometrics). Added options to fallback to the device credentials for authentication.
Removed some feature to make it simple to use for authentication purpose only.

repository: acampuzanoo/react-native-biometric-auth

repo_name: acampuzanoo/react-native-biometric-auth


text:
[![Build Status](https://secure.travis-ci.org/Appendium/flatpack.png?branch=master)](http://travis-ci.org/Appendium/flatpack) [![Stories in Ready](https://badge.waffle.io/Appendium/flatpack.png?label=ready)](https://waffle.io/Appendium/flatpack) [![Quality Gate](https://sonarcloud.io/api/badges/gate?key=net.sf.flatpack:flatpack-parent)](https://sonarcloud.io/dashboard/index/net.sf.flatpack:flatpack-parent)

flatpack
========

CSV/Tab Delimited and Fixed Length Parser and Writer

FlatPack on SourceForge: a Java (1.5+) flat file parser that handles CSV,
fixed length and custom delimiters. The formats are configured in XML, it is fast
and released under Apache license 2.0.


text:
# any-nlp
This is a step by step guide how to approach any Natural Language Processing (NLP) problem using Keras, Tensorflow, and Glove Vectors.

This provided me a nice framework to do machine learning problems in the future.

## Table of Contents
- [Description](#description)
- [Functionality](#functionality)
- [Technology](#technology)
- [License](#license)

## Description
For a competitive Kaggle challenge I used this notebook to put together and track my submissions.

This was hosted at DS12 Whiskey Multiclass Classification problem

(0, 1, 2) Classify the whiskey based on the the text description
- Excellent 0
- Good 1
- Bad 2

### Important directories
- working (this is where the notebook is located, also where you need to download the glove vector text file to)
- input (this is the directory with the data)
- submission (this directory holds some of the submissions that I uploaded to the Kaggle Competition)
- first-attempt (this directory holds my first attempts at solving the problem)

## Functionality
In order to run the notebooks and follow along you will need to download the Glove Vectors, for this competition I used the glove.840B.300d.txt file this can be found on the github stanfordnlp page listed below. You will need to unzip the file in the same directory as the notebook in order to follow along. I did not include in this repository due to the large file size.

https://github.com/stanfordnlp/GloVe

http://nlp.stanford.edu/data/wordvecs/glove.840B.300d.zip

## Technology
What are the technologies used?

- Natural Language Processing
- Keras preprocessing
- Keras LSTM, MaxPooling1d,
- Stanford glove vectors
- Pandas
- Numpy
- Scikit-Learn train+test+split

## License
[![license](https://img.shields.io/github/license/DAVFoundation/captain-n3m0.svg?style=flat-square)](https://github.com/Mark-McAdam/any-nlp/blob/master/LICENSE)

Special thanks to Kaggle User Abhishek for the inspiration on how to apply NLP to various problems
https://www.kaggle.com/abhishek/approaching-almost-any-nlp-problem-on-kaggle

more work to come soon

repository: Mark-McAdam/any-nlp

gha_language: Jupyter Notebook

repo_name: Mark-McAdam/any-nlp


text:
# ExpAnn (Expiration Annotation)
**Annotate code with an expiration date, and get a warning when it expires**

Code is not meant to live forever, unless it goes interstellar like Voyager 1, because there's always a better alternative that comes along and deprecates old code. Code, just like most products, should have an expiration date; Rewrites of an expired module are inevitable, but the timeline of such process is rarely declared in advance; Code expiration date should be explicitly declared when adding code for the following purposes (to name a few):
* temporary workarounds (e.g., until the next release of a library provides the missing feature)
* creating a feature that will be A/B-tested; it may not stick around
* building a minimum viable product
* beta APIs

Shipping perishable code without an expiration detection mechanism is a recipe for software development bloat; expired code that doesn't get exercised in the real world is a nest for undetected bugs; maintaining expired code is a tax that no one should pay.

One approach to declare expiration date of a program element is a TODO to remove it later, but it looks informal and it's hard to check at build-time; Annotations, on the other hand, provide a formal mechanism to achieve better results. ExpAnn (Expiration Annotation) allows you to annotate code with an expiration date, and produces a warning when it expires; it provides Java developers an annotation that:
* provides a declarable expiration date that's checked at build-time, and triggers a mandatory warning when the annotated code expires
* declares owners who are responsible for deprecating the expired code
* could be extended and/or processed differently (e.g., send an email to owners when the annotated code expires)
* has a precise target: CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, and TYPE
* could be reflectively accessed at runtime
* shows up in javadoc

Here's an example of how to use ExpAnn:

```java
@Expiration(year = 2015, month = Month.APRIL, dayOfMonth = 22, owners = "elgeish")
class Perishable {
...
```

The following is the respective warning:
```bash
Warning:(12, 1) java: Perishable expired: [Expiration date: 2015-04-22, owners: [elgeish]]
```

The Java compiler should auto-discover the ExpAnn annotation processor, or you can configure it using its fully-qualified name: com.expann.annotation.processing.ExpirationProcessor

repository: elgeish/ExpAnn

repo_name: elgeish/ExpAnn


text:
# easy_required

An extremely simply way for a client-side form protection.
This script is dev in VanillJS and has an hight browser support.

Guide:

Just insert:

```
// insert the script
<script src="easy_required.js"></script>

// and call
easy_required("#myform");
```

and set the parameter:

```
// this is an example of required field:
<input class="easy_required" data-message="Name" type="text" />

//You need this element for the popup:
<div class="popup">
  <div class="error"></div>
  <div class="close">
    <p>x</p>
  </div>
</div>
```

Field support: all input and checkbox.

Note: you can change the popup style or anithing else with your own CSS.

# MIT License

Copyright (c) 2017 Eugenio Segala

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

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

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


text:
Display Classes
==============

Note: This doc is pretty much superseded by Google''s listing of devices, physical size, density, etc. at https://design.google.com/devices/

My little attempt to catalog device sizes, display classes, and related critical graphics detail for Android and iOS apps.

# Android

Android [defines](http://developer.android.com/guide/practices/screens_support.html#range)
a set of six generalized densities:

- ldpi (low) ~120dpi
- mdpi (medium) ~160dpi
- hdpi (high) ~240dpi
- xhdpi (extra-high) ~320dpi
- xxhdpi (extra-extra-high) ~480dpi
- xxxhdpi (extra-extra-extra-high) ~640dpi

## Android device details

If you have real devices please check numbers using utils like [ScreenInfo](https://github.com/mportuesisf/ScreenInfo)

|Brand / Device  |Class|PPI|logical Density Factor |platform Height|platform Width|
|-------|---|-----------|----|------------------|----|
|Google Nexus One  |hdpi  |252| | | |
|Google Nexus S  |hdpi  |233| | | |
|Google Nexus 6 [\[1\]](#footnote1) |xxxhdpi  |560| |1440 |2560 |
|Google Nexus 7 2012  |mdpi|213|1.331250072|1205|800|
|Google Nexus 7 2013  |xhdpi  |323|2 |1920 |1104 |
|Google Nexus 4  |xhdpi  |318| | | |
|Google Nexus 9 [\[1\]](#footnote1) |xhdpi  |288| |2048 |1536 |
|Google Nexus 10  |xhdpi  |299| | | |
|HTC Wildfire  |mdpi  |125| | | |
|HTC Desire  |hdpi  |252| | | |
|HTC Desire S  |hdpi  |252| | | |
|HTC Sensation  |hdpi  |256| | | |
|HTC Desire X  |hdpi  |233| | | |
|HTC One S  |hdpi  |256| | | |
|HTC One V  |hdpi  |252|1.5|800|480|
|HTC Nexus One  |hdpi  |252| | | |
|HTC One X  |Xhdpi  |312| | | |
|HTC One  |xxhdpi  |469| | | |
|HTC One X+  |xhdpi  |312| | | |
|HTC One M8  |xxhdpi  |441| | | |
|LG Optimus one  |mdpi  |180| | | |
|LG Optimus S    |mdpi  |180| | | |
|LG Optimus V   |mdpi  |180| | | |
|LG F70  |mdpi  |199| | | |
|LG G2 mini  |hdpi  |234| | | |
|LG L90  |hdpi  |234| | | |
|LG G Pad  |hdpi  |273| | | |
|LG Nexus 4  |xhdpi  |318| | | |
|LG Nexus 5  |xxhdpi  |455| 3|1794 |1080 |
|LG G2 mini  |hdpi  |234| | | |
|Micromax Canvas 2 A110  |hdpi  |196| | | |
|Micromax Canvas Doodle A111  |hdpi  |185| | | |
|Micromax Canvas 2 + A110Q  |hdpi  |196| | | |
|Micromax Canvas HD A116  |xhdpi  |294| | | |
|Micromax Canvas 4 A210  |xhdpi  |294| | | |
|Micromax Canvas Magnus A117  |xhdpi  |294| | | |
|Micromax Canvas Turbo  |xxhdpi  |441| | | |
|Nokia N1||326 ||2048|1536|
|OnePlus One|xxhdpi|480|3|1920|1080|
|Samsung Galaxy Y  |ldpi| |0.75 | | |
|Samsung Galaxy Ace  |mdpi  |165| | | |
|Samsung Galaxy S  |hdpi  |233| 1.5|800 |480 |
|Samsung Galaxy S2  |hdpi  |240|1.5 |800 |480 |
|Samsung Galaxy S3  |xhdpi  |320|2 |1280|720 |
|Samsung Galaxy S4  |xxhdpi  |440|3|1920|1080|
|Samsung Galaxy S5  |xxhdpi  |432|3| 1920|1080 |
|Samsung Galaxy S6  |  |577| | 2560|1440 |
|Samsung Galaxy Nexus  |xhdpi  |316|2| | |
|Samsung Galaxy Tab 10  |mdpi  |149|1 |1280 |800 |
|Samsung Galaxy Tab 2 10  |mdpi  |149| | | |
|Samsung Galaxy Tab 4 10.1  |mdpi  |149 | |1280 |800 |
|Samsung Galaxy Tab Pro 8.4   |  |359 | |2560 |1600 |
|Samsung Galaxy Tab Pro 10.1  |  |299 | |2560 |1600 |
|Samsung Galaxy Tab Pro 12.2  |  |247 | |2560 |1600 |
|Samsung Galaxy Tab S 8.4   |  |359 | |2560 |1600 |
|Samsung Galaxy Tab S 10.5  |xhdpi  |288 | |2560 |1600 |
|Samsung Nexus 10 inch tablet  |xhdpi  |299| | | |
|Samsung Note  |xhdpi  |285| |1280 |800 |
|Samsung Note 2  |xhdpi  |267| |1280 |720 |
|Samsung Note 3  |  |388 | |1920 |1080 |
|Samsung Note 4  |  |515 | |2560 |1440 |
|Sony Xperia mini    |mdpi  |192| | | |
|Sony Xperia P  |hdpi  |275| | | |
|Sony Xperia S  |xhdpi  |342| | | |
|Sony Xperia J  |hdpi  |245| | | |
|Sony Xperia Arc  |hdpi  |233| | | |
|Sony Xperia Pro  |hdpi  |265| | | |
|Sony Xperia Z  |xxhdpi  |441| | | |
|Sony Xperia Z2  |xxhdpi  |424| | | |
|Motorola Droid  |mdpi  |265| | | |
|Motorola Defy  |hdpi  |265| | | |
|Motorola Razr XT910  |hdpi  |256| | | |
|Motorola Moto G  |xhdpi  |326| | | |
|Motorola Moto X  |xhdpi  |312| | | |

  [1]: <http://android-developers.blogspot.com/2014/10/getting-your-apps-ready-for-nexus-6-and.html>

### Notes:

 * Ti.Platform.displayCaps.dpi represents Androids densityDpi which corresponds to the theoretical resolutions of the various density classes (low, medium, high, etc.). In other words, this value doesn't represent a device's true DPI. For that, look to Ti.Platform.displayCaps.xdpi and ydpi.
 * Ti.Platform.displayCaps.platformHeight does not include the height of the ActionBar.

### Android app icons

[Android](http://developer.android.com/design/style/iconography.html) says

> Launcher icons on a mobile device must be 48x48 dp.

That means to look good on all devices, you must prepare 5 icons with 1, 1.5x, 2x, 3x, and 4x scales as follows. These are placed in the res/drawable-DPICLASS folders.

* 48 × 48 pixels (mdpi)
* 72 × 72 pixels (hdpi)
* 96 × 96 pixels (xhdpi)
* 144 × 144 pixels (xxhdpi)
* 192 × 192 pixels (xxxhdpi)

See <http://iconhandbook.co.uk/reference/chart/android/> and also <https://github.com/google/material-design-icons>.

# iOS

iOS doesn't use display classes in the same way as Android. But it does have a similar notion of display independent pixels (called points) and pixel multipliers (that @2x/@3x suffix).

## Device details
|Device  |Class|PPI|Pixel multiplier |height (points)|width (points)|height (pixels)|width (pixels)|
|-------|---|-----------|----|------------------|----|----|----|
|iPhone 3/3GS  |low  |163|@1x |480 |320 |480 |320|
|iPhone 4/4s  |high  |326(1)|@2x |480 |320 |960 |640 |
|iPhone 5/5c/5S  |high  |326|@2x |568 |320 |1136 |640 |
|iPhone 6  |??  |326|@2x |667 |375 |1334 |750 |
|iPhone 6+(2) |??  |401|@3x |736 |414 |2208 |1242 |
|iPad 1-3  |low  | |@1x |1024 |768 |1024 |768 |
|iPad 4, Air  |high  |264 |@2x |1024 |768 |2048 |1536 |
|iPad Mini    |low  |163 |@1x |1024 |768 |1024 |768 |
|iPad Mini 2,3|high |326 |@2x |1024 |768 |2048 |1536 |
|iPad Pro(3)| ?? | 264 |@2x |? |? |2732 |2048 |

(1) some references say the iPhone 3 - 6 all have a 163 PPI display, while other sources give the data above.

(2) actual display is downsampled to 1080 x 1920, see http://www.paintcodeapp.com/news/iphone-6-screens-demystified for more info

(3) iPad Pro specs from http://www.imore.com/ipad-pro-specs The pixel multiplier is just my guess based on the PPI.

# Generating more data

Please help generate data for this table. Fork the repo, determine your device specifics, make your change, and submit a PR.

### Appcelerator Titanium

```js
// FOR ANDROID drop this into your app/alloy.js file or Resources/app.js
// while it will work for iOS, it doesn't output all the necessary
// info for the above table
Ti.API.info('displayCaps: '+JSON.stringify(Ti.Platform.displayCaps));

// or more to get just the info as in the table here:
var densities = {
  low: 'ldpi',
  medium: 'mdpi',
  high: 'hdpi',
  xhigh: 'xhdpi',
  xxhigh: 'xxhdpi',
  xxxhigh: 'xxxhdpi'
};
Ti.API.info('Density class: ' + densities[Ti.Platform.displayCaps.density]);
if(Ti.Platform.osname == 'iphone') {
  Ti.API.info('Density: ' + Ti.Platform.displayCaps.density);
} else {
  Ti.API.info('Logical density factor: ' + Ti.Platform.displayCaps.logicalDensityFactor);
}
Ti.API.info('DPI: ' + Ti.Platform.displayCaps.dpi);
Ti.API.info('Height: ' + Ti.Platform.displayCaps.platformHeight);
Ti.API.info('Width: ' + Ti.Platform.displayCaps.platformWidth);
// ready for cutting and pasting into your fork/PR of this repo
Ti.API.info('|model_name|' +
	 (Ti.Platform.displayCaps.logicalDensityFactor || Ti.Platform.displayCaps.density) + '|' +
	 densities[Ti.Platform.displayCaps.density] + '|' +
	 Ti.Platform.displayCaps.dpi + '|' +
	 Ti.Platform.displayCaps.platformHeight + '|' +
	 Ti.Platform.displayCaps.platformWidth + '|'
);
```

# Acknowledgments

The seed of the idea and the starting point data for this came from http://qualitytestingtips.blogspot.com/2013/08/ldpi-mdpi-hdpi-xhdpi-xxhdpi.html with additional data from the Titans, particularly https://gist.github.com/iotashan/4a6a347547a9c49a3a68

Many thanks to @paulvi for his help in adding details and clarity to this reference.

License: MIT

(it's just facts, so can't be copyrighted or protected really, not that I want to. so have at it, do what you want with it.)

repository: skypanther/displayclasses

repo_name: skypanther/displayclasses


text:
## Probability of the Loan Defaulters

we will be exploring the publicly available data from LendingClub.com.
Lending Club connects people who need money (borrowers) with people who have money (investors).
As an investor one would want to invest in people who showed a profile of having a high probability of paying the amount back.

### Problem Statement

What is the probability that the borrower paid back their loan in full?

### The Dataset

Feature 	         -    Description

customer.id 	     -   ID of the customer

credit.policy 	   -  If the customer meets the credit underwriting criteria of LendingClub.com or not

purpose 	         - The purpose of the loan(takes values :"creditcard", "debtconsolidation", "educational", "majorpurchase", "smallbusiness", and "all_other").

int.rate 	         - The interest rate of the loan

installment 	     - The monthly installments owed by the borrower if the loan is funded

log.annual.inc 	   - The natural log of the self-reported annual income of the borrower

dti 	             - The debt-to-income ratio of the borrower (amount of debt divided by annual income)

fico 	             - The FICO credit score of the borrower

days.with.cr.line  - The number of days the borrower has had a credit line.

revol.bal 	       - The borrower's revolving balance (amount unpaid at the end of the credit card billing cycle)

revol.util 	       -  The borrower's revolving line utilization rate (the amount of the credit line used relative to total credit available)

pub.rec 	         -  The borrower's number of derogatory public records (bankruptcy filings, tax liens, or judgments)

inq.last.6mths 	   -  The borrower's number of inquiries by creditors in the last 6 months

delinq.2yrs 	     -  The number of times the borrower had been 30+ days past due on a payment in the past 2 years

paid.back.loan 	   -  Whether the user has paid back loan

### Outcomes

In this project, I have applied the following concepts:

    Independency check
    Bayes theorem
    Visualizing discrete variable
    Visualizing continuous variable

After completing this project, I have a better understanding of probability.


text:
# Icons and tiles generator - Universal Windows Platform
The ambition is to follow [Microsofts guidelines for icons and tiles] (https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets). Microsoft already has a solution for [Photoshop users] (https://blogs.msdn.microsoft.com/madenwal/2015/11/24/generating-your-tileicon-image-assets-for-windows-10-uwp-using-photoshop-actions/) and this is basically a rip off of that :).

## How to use it

Open the seven SVG-files in Inkscape and replace the existing logo with your apps logo. Each SVG-file has guides rules to show the margins from the guidelines. In most cases you should keep your logo in the center four boxes. If some part of your logo is outside these boxes, try to keep it inside the blue rectangles.

If you are using a monochrome icon you can keep your logo black. This is changed to white when the actual bitmaps are generated.
The seven SVG-files are used like this:

*	**[Logo-AppList] (Source/Logo-AppList.svg)** - Used for icons for the start menu/app list.
*	**[Logo-NoMargins] (Source/Logo-NoMargins.svg)** - Used for icons for the task bar. By default the icons are "unplated". Read more about this below.
*	**[Logo-TileLargeMedium] (Source/Logo-TileLargeMedium.svg)** - Used for icons for medium and large tiles.
*	**[Logo-TileSmall] (Source/Logo-TileSmall.svg)** - Used for icons for small tiles.
*	**[Logo-TileWide] (Source/Logo-TileWide.svg)** - Used for icons for wide tiles.
*	**[SplashScreen] (Source/SplashScreen.svg)** - Used for splash screen.
*	**[StoreLogo] (Source/StoreLogo.svg)** - Used for icons in the Windows Store.

Open [IconAndTileGenerator.ibp] (Source/IconAndTileGenerator.ibp) in Inkscape batch. This is a basic script file and if you are lucky you don’t need to change anything. But there are a few things to be aware of:

* The script by default replaces black with white. If you don’t want this remove lines like this: `Replace fill:#000000;fill-opacity:1; fill:#FFFFFF;fill-opacity:1;`
* The script by default makes the guides transparent (the blue rectangles). This is done by making them transparent. If you have problems with this remove lines like this: `Replace fill:#1ba1e2;fill-opacity:1 fill:#FFFFFF;fill-opacity:0`
* The script generates some files with the suffix altform-unplated by default. Read more about plated and unplated icons in the [guide lines] (https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets#Target-based_assets).
* In many cases **Logo-TileWide** and **SplashScreen** will have the same image but with a different scaling. If that’s the case, you can remove one of these file and change in `IconAndTileGenerator.ibp` to use the file you kept.

Press Start batch converter in Inkscape batch and wait a few seconds. Put the generated bitmaps in the assets folder of you project and you’re done. You may need to open `Package.appxmanifest` to ensure that all images are used.

## References
* [Guidelines for tile and icon assets] (https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets)
* [Generating your tile/icon image assets for Windows 10 UWP using Photoshop Actions] (https://blogs.msdn.microsoft.com/madenwal/2015/11/24/generating-your-tileicon-image-assets-for-windows-10-uwp-using-photoshop-actions/)

repository: pekspro/Icons-and-tiles-generator

repo_name: pekspro/Icons-and-tiles-generator


text:
# Simulation Design Final
### Max Smith, James Rumsey, Braeden Ward

## Team Roles and Responsibilities

 * Max Smith - Visualization and Configuration

 * James Rumsey - Simulation and Configuration

 * Braeden Ward - Simulation and Configuration

## Design goals
Our major design goals were to make the project flexible to additions with regards to new simulations as well as new features to
the GUI. The simulation class holds concrete implementations of an abstract cell object. These concrete implementations
which define the abstract methods associated with each cell define how these cells interact (mainly how neighbor states affect
cell updates) and are the core functionality behind new simulation types.

Additionally, the GUI leverages the JavaFX BorderPane funcitonality to allow for easy implementation of new features (e.g.
the chart was trivial to add to the top portion of the layout pane).

#### What Features are Easy to Add
As mentioned above, it is trivial to add new simulation types (strictly cells) as well as new features to the GUI layout.
Addtionally, it is easy to add new level generators (through an impelemntation of the grid generator abstract class). Additionally,
the Visualization can support any type of Cell modification (through the getters and setters in each concrete cell class implementation).

## High-level Design
At a high level, we have a configuraiton that creates a simulation object and passes it to the visualizaiton.
Then, on each step the visualzition calls for a cell update (when applicable given toggle button settings) and updates
the simulation accordingly. The full visualization and controller functionality operates through the visualization class.

#### Core Classes
The core classes in the program are the reflection core namings in each packege (e.g. Visualizaiton, Configuraiton, and Simulation).
Each core class holds the majority of the relevent objects. As a design feature, we encapsulated fucntionality when possible.

## Assumptions that Affect the Design
One key assumption we made is that the grid can be represented as a list of lists. This assumption
does indeed hold for triangle and hexagonal shapes given careful algebraic manipulations (e.g. in
a hexagon, skip the first cell every other row, and skip the last cell every other row). In hindsight,
our design could have been greatly improved by implementing the grid as a single class
with getters and setters that were configured based on the grid design. This would have hidden the specific
grid implementation and decreased dependendices in respective visualization and configuration classes on the
grid representation as a 2D collection.

#### Features Affected by Assumptions

## New Features HowTo
Additional features should be added to the package they most pertain to, with additional modificaitons
to any dependencies on said package.

#### Easy to Add Features
One easy set of features to add are new simulation types and new neighborhood types. For new cell types, a new implementation
of the abstract cell class must be created which handles cell updates based on a given state and neighbor states. For new neighborhoods,
all that needs to be added is a single switch case condition in the configuration stage with appropriate neighbor pairs
for said neighborhood.

#### Other Features not yet Done
Some features not yet done are different types of simulation component shapes (e.g. hexagonal and triangular)
as well as customizable visualizations (e.g. background, grid ouutlines, etc.
.

To incoroporate new types of simluations (shapes of objects), the grid should be encapsulated within a singular object
with appropriate getters and setters to eliminate this dependency within the visualziation and simulation classes. Additionally,
the visualizaiton regions should take on the desired shape (e.g. triangle or hexagon). Regarding visualization customization,
there would need to be an added layer to containerize the visualization, as well as a refactoring to contain a visualization
constructor. This design, along with a splash screen, would allow a singular visualizaiton with one simulation to be created
with all necessary objects, with a single set of controls per simulation. This comes with the
assumption that each simulation would require a single set of controls, which we believe is a reasonable assumption.


text:
---
title: Workshop Title
layout: workshop
---

# REDCap Database Management with Steve & Sophie!

---------

Please have a REDCap account.  [Login here](https://edc.camhx.ca/redcap/).

---------

Please download the [data set](http://bit.ly/2glNU24) we will be working with today.


text:
# Use meshes in Unity UI

This component scales meshes so that they fit into a UI Rect. Canvas render mode can't be ScreenSpaceOverlay and the set-up should be like this:

* GameObject (has the CanvasElement3D component, the UI Rect defines the scale)
  * Scaler (empty GameObject (this is so that the 3D Element can be made up of multiple meshes))
    * Actual Meshes (the Meshes that should be scaled, drag all the meshes that should be considered into the rendersToScale property on the CanvasElement3D)

## License
Licensed under a MIT-License.


text:
# OP.MagicTrie

## Persisted Trie generic container

The goal of project to give C++ developers fast key-value container based on [Trie](https://en.wikipedia.org/wiki/Trie). Disk storage allows you organize petabytes of information.
One of the wonderful thing about Trie that complexity of main operations are simple. Find, insert, erase and update are estimated as constantn `O(c)`, but varies of length of used key.
The library gives a choice for developer between transactional or non-transactional storage.
# Target platforms
The project uses C++17 standart template library (STL) and [Boost.Interprocess](http://www.boost.org/doc/libs/develop/doc/html/interprocess.html). This restricts supported
platforms. So see Boost support [list](https://www.boost.org/doc/libs/1_74_0/libs/compatibility/index.html):

# Planned features:
- Nearest release 0.1 to introduce Trie container;
- Series of articles with common title "Magic of Trie" to explain different techniques and algorithms to process big amount of information with help of Tries.

# Build & Setup
Project depends on [Boost.Interprocess](http://www.boost.org/doc/libs/develop/doc/html/interprocess.html) to manage trie persistence. No additional compilation is needed.
Project uses only include files. If your project doesn't explictly linking Boost.DateTime then linker may generate the error about missing Boost.DateTime library. Then follow Boost documentation:

>       Boost.Interprocess depends on Boost.DateTime, which needs separate compilation. However,
>       the subset used by Boost.Interprocess does not need any separate compilation so the user
>       can define BOOST_DATE_TIME_NO_LIB to avoid Boost from trying to automatically link the Boost.DateTime
See example in $/tests/CMakeLists.txt for `add_definitions(-DBOOST_DATE_TIME_NO_LIB)`

#OP.Trie
## Transaction management
Trie is highly customizable template based implementation. All storage implementation is delegated to template parameter `TSegmentManager` in:
```c++
        template <class TSegmentManager, class Payload, std::uint32_t initial_node_count = 1024>
        struct Trie : public std::enable_shared_from_this< Trie<TSegmentManager, Payload, initial_node_count> >

```
Vanila `OP::trie::SegmentManager` provides immediate exchange with disk by memory mapping. As an alternative you can use OP::trie::TransactedSegmentManager.
This class provides:

* Isolation level: ["Read Committed"](https://en.wikipedia.org/wiki/Isolation_(database_systems)#Read_committed)
* Multiple transactions initiate read-lock on the same memory region
* Only single transaction can lock a memory region for the write

Implementation is based on creating of shadow-buffers that aggregate changes in memory and on commit flushes to the result virtual memory


text:
# Krypto Karteira Backend

> This is a practical project for an application to Android Software
Engineer position. Check all details below

## Why

Seeking for a company where technology
**really matters** and people **really cares** about Software Engineering and
the product ...

The challenge itself **does not demand** a *Back-end for Front-end
implementation* as a mandatory requirement.

However, we should do things the right way : this BFF
abstracts **all the bussiness rules** away from the mobile client, since this is
the right way to go when designing roles between front-ends and back-ends.

You may check the API documentation [here](https://kryptokarteira.herokuapp.com/).

## How

This is a small [Spark](http://sparkjava.com/) application. It abstracts
away from clients the data sources to Bitcoin an USD prices for broking purposes,
and enforce rules for virtual wallet resources used by the mobile app.

As well, it provides a single home screen resource that simplifies
the mobile development (one single GET instead of three).

This solution relies on following approaches and technologies

- 100% written in Kotlin
- OO design powered by Clean Architecture
- Robust test coverage at application core
- Dependency Injection with [KodeIn](https://github.com/SalomonBrys/Kodein)
- Application data hosted at [restdb.io](https://restdb.io/)
- Hosted at Heroku for fun and profit

## Setup

For local development, you will need
- IntellijIDEA / Gradle (recommended)
- A [restdb.io](https://restdb.io/) project, with related `X-APIKEY`
- A `resources/private.config.properties` file with both keys used by this app
- **Or**, alternatively, you can set up the proper env vars

## Building and running tests

You can build this project and run all the unit tests with the straightfoward

```
./gradlew build
```

In order to build the output `.jar` file required by Heroku, we leverage a custom
`stage` task, powered by the [shadowJar](https://github.com/johnrengelman/shadow)
Gradle plugin to assemble an *uber-jar*:

```
./gradlew stage
```

## TODO

- Add acceptance tests (RestAssured + Betamax)

## License

```
The MIT License (MIT)

Copyright (c) 2017 Ubiratan Soares

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

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

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

repository: ubiratansoares/kryptokarteira-backend

repo_name: ubiratansoares/kryptokarteira-backend


text:
# Aws Serverless Skeleton

![License](https://img.shields.io/badge/license-MIT-green.svg)
[![Coverage Status](https://coveralls.io/repos/github/alhazmy13/aws-serverless-skeleton/badge.svg?branch=master)](https://coveralls.io/github/alhazmy13/aws-serverless-skeleton?branch=master)
[![Build Status](https://travis-ci.com/alhazmy13/aws-serverless-skeleton.svg?branch=master)](https://travis-ci.com/alhazmy13/aws-serverless-skeleton)
![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?longCache=true)
![Python Versions](https://img.shields.io/badge/python-3.5%20%7C%203.6%20%7C%203.7-blue.svg)

# Overview

*Aws Serverless Skeleton* is built on top of AWS (Amazon Web Service) using multiple services :

* **API Gateway**
* **DynamoDB**
* **DynamoDB Streams**
* **S3**
* **Lambda**
* **Cognito**
* **ES (Elasticsearch Service)**
* **CloudFormation**
* **CloudWatch**

*Note*: This project may be edited directly in the browser using the gitpod application which is provides a full blown IDE.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io#https://github.com/alhazmy13/aws-serverless-skeleton)

## Contents

* [Requirements](#requirements)
* [Installing](#installing)
* [Setup AWS](#setup-aws)
* [Deploy to AWS](#deploy-to-aws)
* [Run it locally](#run-it-locally)
* [Trying the service with Postman](#trying-the-service-with-postman)
* [Configuration](#configuration)
    + [Authorization](#authorization)
        + [Over lambda function](#over-lambda-function)
        + [Over Cognito](#over-cognito)
    + [Cognito](#cognito)
    + [DynamoDB](#dynamodb)
    + [ElasticSearch](#elastic-search)
    + [S3](#s3)
    + [VPC](#vpc)
* [Structure](#structure)
  + [Lambda Function](#lambda-function)
  + [App Service](#app-service)
* [Seeds](#seeds)
* [Testing](#testing)

## Requirements

* `python` (Python 3.x)
* `pip` (python package manager)
* `npm` (node.js package manager)
* `serverless` (serverless Framework ) https://github.com/serverless/serverless

## Installing
in order to start running the *Skeleton* on your AWS account you need to install some requirements before starting with :

install *python3* is via `brew`:
```
brew install python3
```

install *npm* is via `brew`:
```
brew install node
```

install *serverless* is via `npm`:

```
npm install -g serverless
```

install serverless plugins:

```
cd aws-serverless-skeleton (you have to be in the repo root directory)
npm install
```

## Setup AWS
You need to configure AWS with your own credentials. You need to install aws cli. In your python3 virtualenv, do:
```
pip3 install awscli
```
Then configure it:
```
aws configure
```
you will be asked to provide your AWS Access Key ID, AWS Secret Access Key and region (eu-west-1) and default output format (json).
once you are done, make sure the configuration is working:

```
aws sts get-caller-identity
aws iam list-users --output table
```
if all is well, then you are good to go!

## Deploy to AWS
by simple command from terminal:

```js
npm run deploy-dev
// for prod env
npm run deploy-prod
```

also you could deploy the function changed , Use this to quickly upload and overwrite your AWS Lambda code on AWS, allowing you to develop faster.

```
sls deploy function -f #function_name# --stage #stage_name#
```

## Run it locally

* first of all you need to install all python and npm requirements:

```
pip3 install -r requirements.txt
npm install
```
* Install dynamodb-local:

```
npm run dynamo-install
```

* install elasticsearch:

The below command will install elastic search in ~/sources/

```commandline
npm run elasticsearch-install
```

* Start serverless-offline, dynamodb-local and elasticsearch. Make sure above command is executed before this.

```
npm run start
```

By default you can send your requests to ```http://localhost:3000/``` or ```http://localhost:8000/shell``` to access the web shell for dynamodb-local or ```http://localhost:9200``` for elasticsearch.

**Please note that:**

* You'll need to restart the plugin if you modify your serverless.yml or any of the default  template files.
* The event object passed to your λs has one extra key: { isOffline: true }. Also, process.env.IS_OFFLINE is true.
* Seed config for dynamodb-local is enabled, that's mean each table will be seeded automatically on startup from JSON files. You can start the server with fresh table by this command: ``` npm run dynamo-start ```

## Trying the service with Postman:
To install Postman, go to the apps page and click Download for Mac / Windows / Linux depending on your platform.
[Download](https://www.getpostman.com/docs/postman/launching_postman/installation_and_updates)

after downloading *Postman* you need to add the collection of endpoint of the services to be called from [collections](https://raw.githubusercontent.com/alhazmy13/aws-serverless-skeleton/master/postman/aws-serverless-skeleton.postman_collection.json)

1. from import button, choose import from url and paste the url above.
2. right click on the collection "posts", choose edit, and then choose variables tab.
3. add key = BASE_URL and value is either: *YOUR_BASE_URL* or [local](http://localhost:3000/)
4. to run any of the requests, just select it and hit run ( to test, choose post and then "get all posts" )

## Configuration

You will find a folder `config` that have a separate file for each environment (`dev`, `prod` and `local`) each file has
* `environment` for environment values like DynamoDB table names or elastic search endpoint.
* `custom` to modify and update the resource configuration, for example from `custom` you can change the elastic search instance type.
* `functions` for a list of lambda function to deploy in environment.
* `authorizer` For more information please [read this section](#authorization)

`resourse` folder that contains a bunch of files to deploy the required resources in the `CloudFormation` stack, you can enable or disable any resource from `serverless.yml` file.

### Authorization

#### Over lambda function

We have a dummy function `AuthorizerService` to authorize the request, you can update it with any authorizer you like.

For this approach, you need to append below code in your env (`dev-env.yml` or `prod-env.yml`) file.

```yaml
authorizer:
  name: auth_authorizer
  resultTtlInSeconds: 0
  type: token
```

#### Over Cognito

Please read more about this in [Cognito Section](#cognito)

### Cognito

In this skeleton, We are counting on Cognito with Authorization and Authentication process, and there are two ways to apply cognito.

#### First approach

Separate cognito in a different stack or do it manually and then append `Pool ARN` to your environment.
if you are following this approach then you need to update `POOL_ARN` value in your env file (`dev-env.yml` or `prod-env.yml`) with your user pool ARN like so:

```yaml
environment:
  POOL_ARN: 'arn:aws:cognito-idp:{REGION}:{ACCOUNT_NUMBER}:userpool/{REGION}_{USER_POOL_ID}'

```

And in your env file just change the `authorizer` to :

```yaml
authorizer:
  name: authorizer
  arn: ${self:provider.environment.POOL_ARN}

```

After deploying the stack, just go to your user pool and enable `PostConfirmation` trigger with `auth_post` function.

***NOTE*** make sure to remove cognito recourse form `serverless.yml` file.

#### Second approach

Deploying the user pool resource within the same stack by appending `${file(config/resource/cognito.yml)}` under `resources` in `serverless.yml` file.

```yaml
resources:
  - ${file(config/resource/cognito.yml)}
```

Go to `lambda_functions/aut/functions.yml` and change:

```yaml
auth_post:
  handler: lambda_functions/auth/auth.post_auth
```

To:

```yaml
auth_post:
  handler: lambda_functions/auth/auth.post_auth
  events:
    - cognitoUserPool:
        pool:
          Ref: CognitoUserPool
        trigger: PostConfirmation
 ```

In your env file just change the `authorizer` to :

```yaml
authorizer:
  type: COGNITO_USER_POOLS
  authorizerId:
    Ref: ApiGatewayAuthorizer
```

### DynamoDB

Working on it.

### Elastic Search

Working on it.

### S3

Working on it.

### VPC

We assume that you already you have a VPC with in your AWS region, so there's no recourse to deploy a VPC with in the same stack however to deploy the lambda functions into a non-default VPC you need to update three values in (`dev-env.yml` or `prod-env.yml`) file.

```yaml
environment:
  VPC_SECURITY_GROUP: "VPC_SECURITY_GROUP"
  VPC_SUBNET_PUBLIC_1: "VPC_SUBNET_PUBLIC_1"
  VPC_SUBNET_PUBLIC_2: "VPC_SUBNET_PUBLIC_2"
```

**NOTE** to deploy the lambda functions with default VPC just remove `vpc` value from `serverless.yml` file.

```yaml
provider:
  vpc:
      securityGroupIds:
        - ${self:provider.environment.VPC_SECURITY_GROUP}
      subnetIds:
        - ${self:provider.environment.VPC_SUBNET_PUBLIC_1}
        - ${self:provider.environment.VPC_SUBNET_PUBLIC_2}
```

## Structure

In this skeleton, you will find that we separate the lambda function handler from the business logic itself, for too many reasons.

### Lambda Function

It contains a list of folders, each folder for only one route and each folder contains only two files.

* `route_name.py` with a list of lambda function handler that returns the service response.
* `functions.yml` with a list of lambda function recourse name and the configuration for each function, for example `events` type, `http` method or the `path` for the route.

### App Service

This folder (`src`) contains all our business logic
* `app package` has a list of packages, each package has the name for the route with a list of services that represent our `CRUD` and `model` class
* `common` contains a list of helper classes.

## Seeds

we inject some seed data into our tables with local env, this helped us with test our application, to change the data just update any `json` file from `seed` folder.

## Testing

The project contains a set of unit and integration tests but before all make sure you follow this [instruction](#installing) before run test commands.

You need to install `tox` tool:

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

Make sure all the services are ruining on your device:

```
npm run start
```

To install dev requirements and test this project against Python3.6, just type:

```
tox
```

repository: Thiqah-Lab/aws-serverless-skeleton

repo_name: Thiqah-Lab/aws-serverless-skeleton