text:
Django Async is an asynchronous execution queue for Django with proper database transaction management.

Building a database backed task queue is a fairly trivial thing, but getting the database transactions exactly right is no simple matter.

# Using Django Async #

Installation is very simple, just add the `async` application to your Django applications in `settings.py`.

To run a job asynchronously just use the `schedule` function:

    from async import schedule
    schedule('my.function', args=(1, 2, 3), kwargs=dict(key='value'))

Tasks can be run by executing the management command `flush_queue`:

    python manage.py flush_queue

`flush_queue` will run once through the jobs that are scheduled to run at that time, but will exit early if any job throws an exception. Normally you would use it from an external script that simply keeps re-running the command.

    while [ true ] ; do ( python manage.py flush_queue && sleep 10 ) ; done

Jobs are executed in priority order first (higher numbers execute earlier), then by the scheduled time (unscheduled jobs will go last, but of course only jobs whose scheduled time has arrived will run) and finally by their ID order (which should be the order they were added). A failed task will be re-scheduled for later execution.

##`async.schedule`##

    schedule(function, args = None, kwargs = None, run_after= None, meta = None, priority = 5)

Returns a Job instance that is used to record the task in the database. The job has a method `execute` which will attempt to run the job. **Don't do this directly until you've fully understood how transactions are handled**

* _function_ Either the fully qualified name of the function that is to be run, or the function itself.
* _args_ A tuple or list of arguments to be given to the function.
* _kwargs_ A dict containing key word arguments to be passed to the function.
* _run_after_ The earliest time that the function should be run.
* _meta_ Parameters for controlling how the function is to be executed.
* _priority_ Jobs with higher numbers are always executed before jobs with lower numbers.

##`async.api.deschedule`##

    deschedule(function, args = None, kwargs = None)

Marks all jobs in the queue that match the given function _and arguments_ as executed.

De-scheduling does not guarantee that the de-scheduled tasks will never run unless the de-scheduling is done within a task executed in the job queue. This is because the task might have already started executing within the queue whilst it is de-scheduled from outside the queue.

##`async.api.health`##

    info = health()

Returns a `dict` containing basic information about the queue which can be used for monitoring.

# Transaction handling #

Database transactions are hard to get right, and unfortunately Django doesn't make them much easier. Firstly, you really want to be using a proper transactional database system.

Django has two major flaws when it comes to transaction handling:

1. The Django transaction functionality fails to create composable transactions.
2. The [https://docs.djangoproject.com/en/dev/topics/db/transactions/](Django documentation) makes a very poor recommendation about where to put the `django.middleware.transaction.TransactionMiddleware`.

The first problem is not going to get fixed in Django, but the second can be handled by putting the middleware in the right place -- that is, as early as possible. The only middleware that should run before the transaction middleware is any whose functionality relies on it being first.

Within the async task execution each task is executed decorated by `django.db.transaction.commit_on_success`. _This means that you cannot execute a task directly from within a page request if you are using the transaction middleware._

# Doing development #

_This project uses git flow. Don't forget to do `git flow init -d`_

To create virtual environments for running the tests you can execute `test-projects/make-virtual-environments`. To run the tests execute `runtests`.

repository: numegil/django-async

extension: markdown

repo_name: numegil/django-async


text:
# PingIT

**A simple Android app to streamline helpdesk interactions**

[//]: # (![Status](https://www.dropbox.com/s/vmmlgcykl2wvbim/pingitstatus.png?dl=1))

Built from the ground up, this project aims to better connect students and helpdesk staff, providing a 1-on-1 chat service, equipment repair notifications, and FAQ database.

[The Ping.IT app is complemented by its helpdesk web interface](https://github.com/CDMayberry/PingITWeb)

###Development Prerequisites
* JDK 1.7+
* Android Studio
  * API 21 or above
  * Android Support Library 23.1.1
  * Android Build Tools 23.0.2
* Fabric Intellij Plugin

###Setup
1. Clone this repo via the url

  ```
  git clone http://github.com/stuartsoft/pingit.git
  ```
2. Open the project in Android Studio, and allow gradle to build the project. Optionally, you may start a Gradle Sync/Build through the menu

  ```
  Tools > Android > Sync Project with Gradle Files
  ```
3. To deploy a development build to an emulator or Android device, select

  ```
  Run > Run 'app'
  ```

###Team City Build Server Setup
  **Default Branch**
  ```
  refs/heads/master
  ```
  **Branch Specification**
  ```
  +:refs/heads/master
  +:refs/heads/dev
  ```
  **Build Trigger**
  ```
  VCS Trigger     Branch filter: +:*
  ```
  **Build Artifact Paths**
  ```
  app/build/outputs/apk/app-debug.apk
  app/build/outputs/lint-results.html => quality/lint
  app/build/outputs/lint-results_files => quality/lint/lint-results_files
  app/build/reports/androidTests/connected => quality/tests
  ```
  **Build Parameters**
  ```
  env.ANDROID_HOME = ~/Android/Sdk
  ```
  **Build Steps**
  ```
  Gradle
      clean build - use wrapper
      Execute: If all previous steps finished successfully
  Instrumented tests
      Custom script:
        #Check connected devices
        adb devices
        #Wake devices
        /home/stuart/.BuildServer/wakeDevices.sh
        #run connected Android Tests
        chmod +x ./gradlew
        ./gradlew cAT
      Execute: If all previous steps finished successfully
  Mirror Build Status Badge
      Custom script: ~/.BuildServer/MirrorBuildStatusWrapper.sh
      Execute: Even if some of the previous steps failed
  ```
###License
```
The MIT License (MIT)

Copyright (c) 2016 Grove City College

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.
```

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Social Media Profile Crawlers

[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](hhttps://github.com/shaikhsajid1111/social-media-profile-scrapers/graphs/commit-activity)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

## Available Social Media
- Twitter :+1:
- Facebook :+1:
- Instagram :+1:
- Reddit :+1:
- tiktok :+1:
- Medium :+1:
- Quora :+1:
- Linkedin :+1:
- Pinterest :+1:
- Github :+1:

![Screenshot](screenshots/screenshot1.PNG)

## Installation
1. You need person's social media username to fetch detail
1. Install dependencies mentioned inside [requirement.txt](requirement.txt) by entering command ```pip install -r requirement.txt``` from project's directory
1. There are 2 ways to input username
    - Edit source code of the script and pass username as a constructor's parameter
    - Pass username from command line  . See [demo](screenshots/demo.gif)
        - Open terminal in project's directory and type command ```python SCRIPT_NAME USERNAME```
1. Some scripts use chromdriver, install chromedriver from [here](https://chromedriver.chromium.org/downloads). Chrome browser's version must be same as chromedriver's version

- If server stop responding because of too much request, so try modifying requests.get() with below given code:
    - ```requests.get(URL,headers = headers,proxies={"http": "http://<IP_ADDRESS>:1234"})```
                                or
    - ```requests.get(URL,headers = headers,verify = False)```
                                or
    - ```requests.get(URL,headers = headers,timeout = 5)```
                                or
    -  Import [proxies](proxies.py) and use random proxies everytime you make a request

## LICENSE

### Apache License 2.0

**If You have suggestions for more social media.Let me know :wink:**

repository: sentecode/social-media-profile-scrapers

repo_name: sentecode/social-media-profile-scrapers


text:
# OperatorHub.io Bundles

This document contains information on how to update and release new versions of the operator
that will be made available in OperatorHub through OLM.

## Process to release a bundle

1. Fork and clone the [OperatorHub.io](https://github.com/k8s-operatorhub/community-operators) repository
2. Navigate to _/operators/application-services-metering-operator_
3. Copy the previous version directory and paste it to the same place with a name for the new version
4. Update the version across all files in the directory
5. After `spec`.`version`, update the `replaces` key (or add if first update) with the version of the operator that will be replaceable with this update.
6. Update the operator deployment in the CSV, or other manifest files, as needed based on any changes in the released Kubernetes.yml files of the operator release.
7. Following the [verification instructions](VERIFICATION.md#operatorhub) to ensure nothing is obviously broken.
8. If the descriptions were updated, ensure they look ok with the [preview tool](https://operatorhub.io/preview).
9. Open a PR against the repo, following the PR checklist.

Additional documentation on this process can be found [here](https://k8s-operatorhub.github.io/community-operators/).

Once this PR is merged, do the same for the [OperatorHub packaged in OpenShift and OKD](https://github.com/redhat-openshift-ecosystem/community-operators-prod) repository.

branch_name: refs/heads/main


text:
[![Build Status](https://github.com/jauderho/dockerfiles/workflows/dsq/badge.svg)](https://github.com/jauderho/dockerfiles/actions)
[![Version](https://img.shields.io/docker/v/jauderho/dsq/latest)](https://github.com/multiprocessio/dsq)
[![Docker Pulls](https://img.shields.io/docker/pulls/jauderho/dsq)](https://hub.docker.com/r/jauderho/dsq/)
[![Image Size](https://img.shields.io/docker/image-size/jauderho/dsq/latest)](https://hub.docker.com/r/jauderho/dsq/)

Up to date multi-platform images are built an hour after upstream release and rebuilt at least once a week.

repository: jauderho/dockerfiles

gha_language: Dockerfile

repo_name: jauderho/dockerfiles


text:
CreateReadUpdateDelete.js
=========================

CreateReadUpdateDelete.js aims to bring you a tiny footprint, platform independent ORM/ActiveRecord implementation for Javascript that works flawlessly on SQLite / WebSQL databases,
or any flavor of remote database you can think of via serverside JSON API

Written in Plain Old JavaScript without any framework dependencies, you can use this with AngularJS, React, Jquery, Mootools, Zepto, Ember, or whatever your framework drug of choice is.

ActiveRecord? Orm?
==================

*Active Record*
From Wikipedia:

> In software engineering, the active record pattern is an architectural pattern found in software that stores in-memory object data in relational databases. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture.[1] The interface of an object conforming to this pattern would include functions such as Insert, Update, and Delete, plus properties that correspond more or less directly to the columns in the underlying database table.

> The active record pattern is an approach to accessing data in a database. A database table or view is wrapped into a class. Thus, an object instance is tied to a single row in the table. After creation of an object, a new row is added to the table upon save. Any object loaded gets its information from the database. When an object is updated the corresponding row in the table is also updated. The wrapper class implements accessor methods or properties for each column in the table or view.

> This pattern is commonly used by object persistence tools, and in object-relational mapping (ORM). Typically, foreign key relationships will be exposed as an object instance of the appropriate type via a property.

*ORM*
(Loosely) From [service-architecture.com](http://www.service-architecture.com/articles/object-relational-mapping/object-relational_mapping_or_mapping_definition.html)
> Object-relational mapping (OR mapping) products integrate object programming language capabilities with relational databases. Database objects appear as programming language objects. Often, the interface for object-relational mapping products is the same as the interface for object databases.

Features
========

- Simple access to WebSQL database rows as if they're plain javascript objects
- Supports 1:1, 1:many, many:1 and many:many relations
- Support for indexes, fixtures and migrations
- Completely promise-based. (Use promise.js for browsers that don't have a native Promise object)
- A simplified query language, but the freedom to execute plain SQL
- Works on any browser that supports WebSQL (yes, also on mobile)
- Works even without [schema-defined foreign keys](https://www.sqlite.org/foreignkeys.html) by just matching primary keys
- Built-in caching / entity manager layer makes sure you'll get a handle to the same entity when it's fetched again
- Auto-generates findBy<property> and findOneBy<property> methods

Examples
========

Create
------

```javascript
var serie = new Serie();
serie.name = 'Arrow';
serie.TVDB_ID = '257655';
serie.actors = [
	"Stephen Amell (Oliver Queen / Arrow)",
	"Katie Cassidy (Laurel Lance)",
	"Paul Blackthorne (Detective Quentin Lance)",
	"David Ramsey (John Diggle)",
	"Willa Holland (Thea Queen)",
	"Emily Bett Rickards (Felicity Smoak)",
	"John Barrowman (Malcolm Merlyn)"
];

serie.Persist().then(function(result) {
	console.log("Serie persisted! ", result);
});
```

Read
----

```javascript
/**
 * CRUD.Find returns a promise that receives an array with results
 */
CRUD.Find(Serie, { name: 'Arrow' }).then(function(series) {
	console.log("Found results: ", series);
});

/**
 * CRUD.FindOne returns a promise that receives a single instance of an entity or null
 */
CRUD.FindOne(Serie, { name: 'Arrow' }).then(function(serie) {
	console.log("Found one result: ", serie);
});

/**
 * You can pass an array instead of mapped object to add custom SQL
 */
CRUD.Find(Serie, ['name like "%Arr%"']).then(function(series) {
	console.log("Found wildcard results: ", series);
});
```

Update
------
```javascript
CRUD.FindOne(Serie, {name: 'Arrow'}).then(function(arrow) {
	arrow.overview = [
		"Oliver Queen and his father are lost at sea when their luxury yacht sinks.",
		"His father doesn't survive. Oliver survives on an uncharted island for five years learning to fight,",
		"but also learning about his father's corruption and unscrupulous business dealings.",
		"He returns to civilization a changed man, determined to put things right.",
		"He disguises himself with the hood of one of his mysterious island mentors,",
		"arms himself with a bow and sets about hunting down the men and women who have corrupted his city."
	].join(' ');
	return arrow.Persist();
}).then(function(result) {
	console.log("Arrow update persisted!", result);
});
```

Delete
------
```javascript
CRUD.FindOne(Serie, {name: 'Arrow'}).then(function(arrow) {
	return arrow.Delete();
}).then(function(result) {
	console.log("Arrow deleted!");
});
```

JSFiddle live demo: [CreateReadUpdateDelete : basic setup of an entity](http://jsfiddle.net/SchizoDuckie/1fwntkhr/)

Documentation and howto
=======================

- [CRUD.define: Introduction and conventions](#cruddefine-introduction-and-conventions)
- [CRUD.define: Setting up a basic entity](#cruddefine-setting-up-a-basic-entity)
- [CRUD.define: 1:1 relation](#cruddefine-11-relation)
- [CRUD.define: 1:many and many:1 relation](#cruddefine-1many-or-many1-relation)
- [CRUD.define: many:many relation](#cruddefine-manymany-relation)
- [CRUD.define: Default orderBy property and orderBy direction](#cruddefine-default-orderby-property-and-orderby-direction)
- [CRUD.define: Custom orderBy clause](#cruddefine-custom-orderby-clause)
- [CRUD.define: Defining fixtures](#cruddefine-defining-fixtures)
- [CRUD.define: Indexes](#cruddefine-indexes)
- [CRUD.define: Migrations](#cruddefine-migrations)
- [Usage: Opening a database connection](#usage-opening-a-database-connection)
- [Usage: Using CRUD.Find and CRUD.FindOne](#usage-using-crudfind-and-crudfindone)
- [Usage: Using Find on an entity instance to fetch related entities](#usage-using-find-on-an-entity-instance-to-fetch-related-entities)
- [Usage: Using FindOne](#usage-using-findone)
- [Usage: Save changes to an entity to the database](#usage-save-changes-to-an-entity-to-the-database)
- [Usage: Deleting an entity](#usage-deleting-an-entity)
- [Usage: Connecting entities](#usage-connecting-entities)
- [Advanced: Deep filters on related records using CRUD.Find](#advanced-deep-filters-on-related-records-using-crudfind)
- [Advanced: Using CRUD.fromCache to convert a plain JavaScript Object into a CRUD Entity](#advanced-using-crudfromcache-to-convert-a-plain-javascript-object-into-a-crud-entity)
- [Advanced: Loading data from JSON and inserting it into the database](#advanced-loading-data-from-json-and-inserting-it-into-the-database)
- [Advanced: Using CRUD.executeQuery](#advanced-using-crudexecutequery)
- [Advanced: Active Query Monitor using Object.observe](#advanced-active-query-monitor-using-objectobserve)
- [Advanced: CRUD.EntityManager ensures you have handle to the same record in different contexts](#advanced-crudentitymanager-ensures-you-have-a-handle-to-the-same-record-in-different-contexts)
- [Advanced: Using REPLACE INTO instead of the default INSERT INTO](#advanced-using-replace-into-instead-of-the-default-insert-into)
- [Advanced: Migrations in WebSQL: Adding a column to the database](#advanced-migrations-in-websql-adding-a-column-to-the-database)
- [Advanced: Interacting with a Select2 via JQuery](#advanced-interacting-with-a-select2-via-jquery)
- [Advanced: Browse the JSDocs](http://schizoduckie.github.io/CreateReadUpdateDelete/docs/)

CRUD.define: Introduction and conventions
=========================================

Conventions
-----------
- Always create an Integer AUTO_INCREMENT primary key on your tables. This library doesn't support compound keys.
- If you create a foreign key in a table, name it the same as the primary key of the table you're referring to.

Introduction
------------

CRUD.define registers your entities in the EntityManager.

The Entity Manager performs the following tasks as soon as it's connected to a database:

- Fetch a list of all tables and indexes
- Verify that all tables for registered entities exist.
- Execute createStatements for entities if they haven't been created.
- Execute any migrations in sequence if the table version is smaller than the highest migration number
- Compare the list of indexes in the database to the ones defined and create the ones that don't exist
- Insert fixtures for tables that have been freshly created

To connect to a database, feed a new instance of a CRUD.SqliteAdapter to CRUD.setAdapter.
This returns a promise that is resolved when all the setup steps are done, and after that you can use your entities.

```javascript
// initialize WebSQL database connection
CRUD.setAdapter(new CRUD.SQLiteAdapter('createreadupdatedelete', {
    estimatedSize: 25 * 1024 * 1024
})).then(function() {
	// do stuff with your CRUD entities here.
});
```

CRUD.define signature and parameters
------------------------------------

```javascript
/**
 * @param  {Function} namedFunction Named Function to register with the entity manager
 * @param  {object} properties entity config properties like table, primary, fields, createStatement
 * @param  {object} methods prototype methods to register on the entity instance
 * @return {Function} namedFunction enriched with CRUD methods and prototype methods
 */
CRUD.define = function(namedFunction, properties, methods) {};
```

 CRUD.define forwards registration of an entity to CRUD.EntityManager.

 Parameters passed to 'properties' should be at least:
 - `createStatement` : String, Full CREATE TABLE SQL statement
 - `table` : String, Table name used by createStatement
 - `primary` : String, Primary key property
 - `fields` : All properties (including primary key) created by the createStatement

  Optional properties can be:

 - `indexes` : Array, List of fields to create indexes on.
 - `relations` : Array, List of (String) Entity names and CRUD.RELATION_* types
 - `autoSerialize` : Array, properties to auto json_encode / json_decode on fetch/persist
 - `defaultValues` : Object, property -> default value list
 - `orderProperty` : String, default orderBy propery to append to CRUD.Find queries
 - `orderDirection` : String, default orderBy direction to append to CRUD.Find queries
 - `migrations` : Object, with numeric keys and array of raw sql migrations to run in sequence when current version doesn't match lastest.

CRUD.define: Setting up a basic entity
======================================

Make sure you define your entities before opening the database connection using CRUD.setAdapter.
The setup phase only runs on creating a connection. Defining new entities after the database is connected is not supported.

```javascript
/**
 * Create a nice Named Function that calls the CRUD.Entity constructor
 * The Named function will make sure that we can do console.log and see a Serie object instead of CRUD.Entity
 * Adding ``CRUD.Entity.call(this)`` is mandatory and makes sure that the proper setup is performed when creating a new instance of the object.
 */
function Serie() {
    CRUD.Entity.call(this);
}

/**
 * Extend the Named Function with CRUD definitions and register it in the CRUD.EntityManager
 */
CRUD.define(Serie, {
    table: 'Series', // Database table this entity is bound to
    primary: 'ID_Serie', // Primary key. Make sure to use uniquely named keys, don't use 'id' on every table and refer to 'id_something'
    fields: [ // List all individual properties including primary key. Accessors will be auto-created (but can be overwritten)
        'ID_Serie',
        'name',
        'banner',
        'overview',
        'TVDB_ID',
        'actors'
    ],
    createStatement: 'CREATE TABLE Series (ID_Serie INTEGER PRIMARY KEY NOT NULL, name VARCHAR(250) DEFAULT(NULL), banner VARCHAR(1024) DEFAULT(NULL), overview TEXT DEFAULT(NULL), TVDB_ID INTEGER UNIQUE NOT NULL, actors VARCHAR(1024) DEFAULT(NULL))',
});
```

CRUD.define: 1:1 relation
=========================

To define a 1:1 relation, use the CRUD.RELATION_SINGLE relation type.
Simply define the fact that a relationship exists, CreateReadUpdateDelete will automatically deduct that the primary key from table A exists in table B and vice versa.

Consider this fictional scenario where every actor in the world can only play one role, ever.

```javascript

function Role() {
    CRUD.Entity.call(this);
}

function Actor() {
    CRUD.Entity.call(this);
}

CRUD.define(Role, {
    table: 'Roles',
    primary: 'ID_Role',
    fields: ['ID_Role', 'name', 'ID_Actor'],
    relations: {
        	'Actor' : CRUD.RELATION_SINGLE
    },
    createStatement: 'CREATE TABLE Roles (ID_Role INTEGER PRIMARY KEY NOT NULL, name VARCHAR(250) DEFAULT(NULL), ID_Actor INTEGER NULL)'
});

CRUD.define(Actor, {
    table: 'Actors',
    primary: 'ID_Actor',
    fields: ['ID_Actor', 'firstname', 'lastname', 'gender', 'ID_Role'],
    relations: {
        	'Role' : CRUD.RELATION_SINGLE
    },
    createStatement: 'CREATE TABLE Actors (ID_Actor INTEGER PRIMARY KEY NOT NULL, firstname VARCHAR(250) DEFAULT(NULL), lastname VARCHAR(250) DEFAULT(NULL), gender VARCHAR(1) DEFAULT(NULL), ID_Role INTEGER NULL)'
});

// initialize WebSQL database connection
CRUD.setAdapter(new CRUD.SQLiteAdapter('createreadupdatedelete_single', {
    estimatedSize: 25 * 1024 * 1024
})).then(function() { // Promise resolves when all database setup is done

	// create a new role
	var cptn = new Role();
	cptn.name = 'Captain Jack Sparrow';

	// create a new actor
	var actor = new Actor();
	actor.firstname = 'Johnny';
	actor.lastname = 'Depp';
	actor.gender = 'm';

	// connect Actor to Role. Note that both will be auto-persisted at this point!
	// both entities will also have an update-query executed to set the 1:1 relation.
	cptn.Connect(actor);

	// the other way around also works.
	// role.Connect(actor);
})

```
JSFiddle live demo: [CreateReadUpdateDelete : Defining a 1:1 relation](http://jsfiddle.net/SchizoDuckie/0LuLe1sr)

CRUD.define: 1:many or many:1 relation
============================

To define a 1:many or many:1 relation, use the CRUD.RELATION_FOREIGN relation type.
Simply define the fact that a relationship exists, CreateReadUpdateDelete will automatically determine that the primary key from table A exists in table B or a primary key from table B exists in table A.
CreateReadUpdateDelete.js automatically makes sure that you can use this relationship from both sides.

Consider this more realistic scenario where one actor can play many roles over a lifetime.

```javascript

function Role() {
    CRUD.Entity.call(this);
}

function Actor() {
    CRUD.Entity.call(this);
}

CRUD.define(Role, {
    table: 'Roles',
    primary: 'ID_Role',
    fields: ['ID_Role', 'name', 'ID_Actor'],
    relations: {
        	'Actor' : CRUD.RELATION_FOREIGN
    },
    createStatement: 'CREATE TABLE Roles (ID_Role INTEGER PRIMARY KEY NOT NULL, name VARCHAR(250) DEFAULT(NULL), ID_Actor INTEGER NULL)'
});

CRUD.define(Actor, {
    table: 'Actors',
    primary: 'ID_Actor',
    fields: ['ID_Actor', 'firstname', 'lastname', 'gender'],
    relations: {
        	'Role' : CRUD.RELATION_FOREIGN
    },
    createStatement: 'CREATE TABLE Actors (ID_Actor INTEGER PRIMARY KEY NOT NULL, firstname VARCHAR(250) DEFAULT(NULL), lastname VARCHAR(250) DEFAULT(NULL), gender VARCHAR(1) DEFAULT(NULL), ID_Role INTEGER NULL)'
});

// initialize WebSQL database connection
CRUD.setAdapter(new CRUD.SQLiteAdapter('createreadupdatedelete_foreign', {
    estimatedSize: 25 * 1024 * 1024
})).then(function() { // Promise resolves when all database setup is done

	// create a new role
	var cptn = new Role();
	cptn.name = 'Captain Jack Sparrow';

	// create a new actor
	var actor = new Actor();
	actor.firstname = 'Johnny';
	actor.lastname = 'Depp';
	actor.gender = 'm';

	// connect Actor to Role. Note that both will be auto-persisted at this point!
	// role will be updated as well to set the Actor_ID
	actor.Connect(role);

	// the other way around also works.
	// role.Connect(actor);
});
```
JSFiddle live demo: [CreateReadUpdateDelete : Defining a 1:many or many:1 relation](http://jsfiddle.net/SchizoDuckie/0LuLe1sr)

CRUD.define: many:many relation
===============================

Many to many relations in CreateReadUpdateDelete.js require that you create an entity for the connecting table as well.
This connecting entity has to have at least 2 foreign keys, (one for each side of the relation) and a primary key.
Connector tables with only a combined primary key are NOT supported! Since it's a full CreateReadUpdateDelete.js entity,
it needs an AUTO_INCREMENT numeric primary key just as any other CreateReadUpdateDelete.js entity.

Consider this real-world scenario where multiple roles can be played by multiple actors

```javascript

function Serie() {
	CRUD.Entity.call(this);
}

function Role() {
    CRUD.Entity.call(this);
}

function Actor() {
    CRUD.Entity.call(this);
}

function Actor_Role() {
	CRUD.Entity.call(this);
}

CRUD.define(Serie, {
    table: 'Series',
    primary: 'ID_Serie',
    fields: ['ID_Serie', 'name', 'TVDB_ID'],
    relations: {
        'Role': CRUD.RELATION_FOREIGN
    },
    createStatement: 'CREATE TABLE Series (ID_Serie INTEGER PRIMARY KEY NOT NULL, name VARCHAR(250) DEFAULT(NULL), TVDB_ID INTEGER UNIQUE NOT NULL)',
});

CRUD.define(Role, {
    table: 'Roles',
    primary: 'ID_Role',
    fields: ['ID_Role', 'name'],
    relations: {
		'Actor' : CRUD.RELATION_MANY
    },
    connectors: {
    	'Actor': 'Actor_Role'
    },
    createStatement: 'CREATE TABLE Roles (ID_Role INTEGER PRIMARY KEY NOT NULL, name VARCHAR(250) DEFAULT(NULL))'
});

CRUD.define(Actor, {
    table: 'Actors',
    primary: 'ID_Actor',
    fields: ['ID_Actor', 'firstname', 'lastname', 'gender'],
    relations: {
        'Role' : CRUD.RELATION_MANY
    },
    connectors: {
    	'Role' : 'Actor_Role'
	},
    createStatement: 'CREATE TABLE Actors (ID_Actor INTEGER PRIMARY KEY NOT NULL, firstname VARCHAR(250) DEFAULT(NULL), lastname VARCHAR(250) DEFAULT(NULL), gender VARCHAR(1) DEFAULT(NULL))'
});

CRUD.define('Actor_Role', {
	table: 'Actors_Roles',
	primary: 'ID_Actor_Role',
	fields: ['ID_Actor_Role', 'ID_Actor', 'ID_Role'],
	relations: {
		'Actor': CRUD.RELATION_FOREIGN,
		'Role': CRUD.RELATION_FOREIGN
	},
	createStatement: 'CREATE TABLE Actors_Roles (ID_Actor_Role INTEGER PRIMARY KEY NOT NULL, ID_Actor INTEGER DEFAULT(NULL), ID_Role INTEGER DEFAULT(NULL))'
});

// initialize WebSQL database connection
CRUD.setAdapter(new CRUD.SQLiteAdapter('createreadupdatedelete_many', {
    estimatedSize: 25 * 1024 * 1024
})).then(function() { // Promise resolves when all database setup is done

	var doctorwho = new Serie();
	doctorwho.name = 'Doctor Who';
	doctorwho.TVDB_ID = 78804;

	var thedoctor = new Role();
	thedoctor.name = 'The Doctor';

	var twelve = new Actor();
	twelve.firstname ='Peter';
	twelve.lastname = 'Capaldi';

	var eleven = new Actor();
	eleven.firstname = 'Matt';
	eleven.lastname = 'Smith';

	var ten = new Actor();
	ten.firstname = 'David';
	ten.lastname = 'Tennant';

	doctorwho.connect(thedoctor);
	thedoctor.connect(ten);
	// this also works
	twelve.connect(thedoctor);
	eleven.connect(thedoctor);
});

```

JSFiddle live demo: [CreateReadUpdateDelete : Defining a many:many relation](http://jsfiddle.net/SchizoDuckie/pghy3kn4/)

CRUD.define: Default orderBy property and orderBy direction
===========================================================

```javascript
CRUD.define(Actor, {
    table: 'Actors',
    primary: 'ID_Actor',
    fields: ['ID_Actor', 'firstname', 'lastname', 'gender'],
    orderProperty: 'lastname',
    orderDirection: 'ASC',
    relations: {
        'Role' : CRUD.RELATION_MANY
    },
    connectors: {
    	'Role' : 'Actor_Role'
	},
    createStatement: 'CREATE TABLE Actors (ID_Actor INTEGER PRIMARY KEY NOT NULL, firstname VARCHAR(250) DEFAULT(NULL), lastname VARCHAR(250) DEFAULT(NULL), gender VARCHAR(1) DEFAULT(NULL))'
});
```

CRUD.define: Custom orderBy clause
==================================

```javascript
CRUD.define(Actor, {
    table: 'Actors',
    primary: 'ID_Actor',
    fields: ['ID_Actor', 'firstname', 'lastname', 'gender'],
    orderBy: 'lastname ASC, firstname DESC'
    relations: {
        'Role' : CRUD.RELATION_MANY
    },
    connectors: {
    	'Role' : 'Actor_Role'
	},
    createStatement: 'CREATE TABLE Actors (ID_Actor INTEGER PRIMARY KEY NOT NULL, firstname VARCHAR(250) DEFAULT(NULL), lastname VARCHAR(250) DEFAULT(NULL), gender VARCHAR(1) DEFAULT(NULL))'
});
```

CRUD.define: Defining fixtures
==============================

```javascript
CRUD.define(Actor, {
    table: 'Actors',
    primary: 'ID_Actor',
    fields: ['ID_Actor', 'firstname', 'lastname', 'gender'],
    orderBy: 'lastname ASC, firstname DESC'
    relations: {
        'Role' : CRUD.RELATION_MANY
    },
    connectors: {
    	'Role' : 'Actor_Role'
	},
    createStatement: 'CREATE TABLE Actors (ID_Actor INTEGER PRIMARY KEY NOT NULL, firstname VARCHAR(250) DEFAULT(NULL), lastname VARCHAR(250) DEFAULT(NULL), gender VARCHAR(1) DEFAULT(NULL))'
	fixtures: [
		{ firstname: 'Peter', lastname: 'Capaldi', gender: 'm' },
		{ firstname: 'Matt', lastname: 'Smith', gender: 'm' },
		{ firstname: 'David', 'lastname': 'Tennant', gender: 'm' }
	],
});
```

CRUD.define: Indexes
====================

```javascript
CRUD.define(Actor, {
    table: 'Actors',
    primary: 'ID_Actor',
    fields: ['ID_Actor', 'firstname', 'lastname', 'gender'],
    createStatement: 'CREATE TABLE Actors (ID_Actor INTEGER PRIMARY KEY NOT NULL, firstname VARCHAR(250) DEFAULT(NULL), lastname VARCHAR(250) DEFAULT(NULL), gender VARCHAR(1) DEFAULT(NULL))'
    indexes: ['firstname','lastname', 'gender'],
});
```

CRUD.define: Migrations
=======================

Usage: Opening a database connection
====================================

```javascript
// initialize WebSQL database connection
CRUD.setAdapter(new CRUD.SQLiteAdapter('createreadupdatedelete_foreign', {
    estimatedSize: 25 * 1024 * 1024
})).then(function() { // Promise resolves when all database setup is done

	// do stuff here
});
```

Usage: Using CRUD.Find and CRUD.FindOne
=======================================

Find returns an array:
```javascript
CRUD.Find(Serie, { name: 'Arrow'}).then(function(results) {
	// do something with results
});
```

FindOne returns a single entity
```javascript
CRUD.FindOne(Serie, { name: 'Arrow'}).then(function(results) {
	// do something with results
});
```

Usage: Using FindOne
====================

```javascript
CRUD.FindOne(Serie, { name: 'Arrow'}).then(function(arrow) {
	// do something with Arrow.
});
```

Find the first serie in the database that has an episode with seasonNumber 4

```javascript
CRUD.FindOne(Serie, { Episode: { seasonNumber: 4 }}).then(function(results) {
	//
});
```

Usage: Using Find on an entity instance to fetch related entities
=================================================================

This auto creates a join where needed and executes [these] queries

```javascript
CRUD.FindOne(Serie, { name: 'Arrow'}).then(function(arrow) {
	arrow.Find('Episode', { seasonNumber: 1 }).then(function(episodes) {
		// do something with episodes
	});
});
```

Usage: Save changes to an entity to the database
================================================

```javascript
var serie = new Serie();
serie.name = 'Arrow';
serie.TVDB_ID = '257655';
serie.actors = [
	"Stephen Amell (Oliver Queen / Arrow)",
	"Katie Cassidy (Laurel Lance)",
	"Paul Blackthorne (Detective Quentin Lance)",
	"David Ramsey (John Diggle)",
	"Willa Holland (Thea Queen)",
	"Emily Bett Rickards (Felicity Smoak)",
	"John Barrowman (Malcolm Merlyn)"
];

serie.Persist().then(function(result) {
	console.log("Serie persisted! ", result);
});
```

Or, on an existing entity:

```javascript
CRUD.FindOne(Serie, { name: 'Arrow' }).then(function(serie) {

	serie.name = 'Arrow';
	serie.TVDB_ID = '257655';
	serie.actors = [];

	serie.Persist().then(function(result) {
		console.log("Serie actors were emptied! ", result);
	});
});
```

Usage: Deleting an entity
=========================

```javascript
CRUD.FindOne(Serie, { name: 'Arrow' }).then(function(serie) {

	serie.Delete().then(function(result) {
		console.log("Arrow was deleted. ", result);
	});
});
```

Usage: Connecting entities
==========================

```javascript
var doctorwho = new Serie();
	doctorwho.name = 'Doctor Who';
	doctorwho.TVDB_ID = 78804;

	var thedoctor = new Role();
	thedoctor.name = 'The Doctor';

	var twelve = new Actor();
	twelve.firstname ='Peter';
	twelve.lastname = 'Capaldi';

	var eleven = new Actor();
	eleven.firstname = 'Matt';
	eleven.lastname = 'Smith';

	var ten = new Actor();
	ten.firstname = 'David';
	ten.lastname = 'Tennant';

	doctorwho.connect(thedoctor);
	thedoctor.connect(ten);
	// this also works
	twelve.connect(thedoctor);
	eleven.connect(thedoctor);
```

Advanced: Deep filters on related records using CRUD.Find
=========================================================

```javascript
CRUD.Find(Episode, { Serie: { name:'Doctor Who'}, Season: { 'seasonNumber > 2' }, 'name like "%angels%"'})
```

Advanced: Using CRUD.fromCache to convert a plain JavaScript Object into a CRUD Entity
======================================================================================

```javascript

var fixtures = [
	{ ID_Actor: 1, firstname: 'Peter', lastname: 'Capaldi', gender: 'm' },
	{ ID_Actor: 2, firstname: 'Matt', lastname: 'Smith', gender: 'm' },
	{ ID_Actor: 3, firstname: 'David', 'lastname': 'Tennant', gender: 'm' }
];

fixtures.map(function(fixture) {
	var entity = CRUD.fromCache(Actor, fixture);
	entity.Persist(true);
});
```

Advanced: Loading data from JSON and inserting it into the database
===================================================================

Advanced: Using CRUD.executeQuery
=================================

Advanced: Active Query Monitor using Object.observe
===================================================

CreateReadUpdateDelete.js automatically monitors how many insert queries it still has outstanding. With this, you can observe changes to this object and show a progress indicator of all outstanding write operations.

```javascript
var progress = document.getElementById('progress'),
    writesQueued = document.getElementById('writesQueued'),
    writesExecuted = document.getElementById('writesExecuted');

Object.observe(CRUD.stats, function() {
   progress.innerHTML = Math.floor((CRUD.stats.writesExecuted / CRUD.stats.writesQueued) * 100);
   writesQueued.innerHTML = CRUD.stats.writesQueued;
   writesExecuted.innerHTML = CRUD.stats.writesExecuted;
});

// now execute some insert queries and see the magic happen.
```

JSFiddle live demo: [CreateReadUpdateDelete : CRUD.stats monitoring via Object.observe](http://jsfiddle.net/SchizoDuckie/p7kta1mv/)

Advanced: CRUD.EntityManager ensures you have a handle to the same record in different contexts
===============================================================================================

Advanced: Migrations in WebSQL: Adding a column to the database
===============================================================

Advanced: Interacting with a Select2 via JQuery
===============================================

Advanced: Storing images as base64 data into the database
=========================================================

JSFiddle live demo: [CreateReadUpdateDelete : Store an image in the database](http://jsfiddle.net/SchizoDuckie/y7f3t65w/)

gha_language: JavaScript


text:
## Redirects

Redirects are nothing more than a status code in the [`3XX`](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3)
range combined with a `Location` header.

If you are concerned with SEO, please read about to the status codes to figure out which one to use.

{toc}

### router

You can use the router to perform redirects:

```js
index.routes = {
  match: location => {
    if (location.pathname === '/old-path') {
      return { status: 301, headers: { Location: '/new-path' } }
    }
  )
}

export default function index() {
  ...
}
```

### express middleware

In some cases you do not need server-side rendering, but you do need redirects. In this case you
could configure middleware to perform the redirect:

```js
module.exports = {
  kaliber: {
    serveMiddleware: [
      '/old-path',
      (req, res) => { res.status(301).set({ Location: '/new-path' }).send() }
    ]
  }
}
```

repository: kaliberjs/build

gha_license_id: MIT

repo_name: kaliberjs/build


text:
---
layout: page
title: About
permalink: /about/
---

Economist, financial analyst and trying to be a data scientist soon!

### More Information

9 years of experience in the banking sector, which 5 are in the financial management and price structuring of personal and corporate loans and services.

► In the last 3 years I worked directly with pricing and price management of a number of credit lines for the agriculture and real estate loans, besides being part of the team assigned to evaluate the impacts of the IFRS 9 framework at the price management area.

► Previously, I was a member of the team responsible for pricing the interest rates offered to personal and car loans as well as evaluating the acquisition of credit assets from other financial institutions.

► Bachelor’s degree in economics at the University of Brasilia (UnB), master in economics and graduate studies in in econometry and quantitative economy at the Catholic University of Brasilia (UCB) and graduate studies in controlling and finance at the Brazilian Institute of Capital Markets (Ibmec).

### Contact me

[email@domain.com](mailto:danielhn@gmail.com)


text:
Homebrew Tap
============

[![Build Status](https://github.com/manicmaniac/homebrew-tap/workflows/Test/badge.svg)](https://github.com/manicmaniac/homebrew-tap/actions)

This is the repository for my personal packages.

To install a package:

    brew tap manicmaniac/tap
    brew install PACKAGE_NAME

License
-------

This repository itself is licensed under the MIT license.
See LICENSE for details.

repository: manicmaniac/homebrew-tap

gha_language: Ruby

repo_name: manicmaniac/homebrew-tap


text:
# Teensy Fan Controller

A PC fan controller with temperature sensor input, for **[Teensy](https://www.pjrc.com/teensy/index.html) 3.x** USB Development Board\(s\).

Supports up to 6 fans \(4pin/PWM\), and up to 5 temperature sensors \(thermistors\). Each fan may individually operate in PID, temperature-percent table, or fixed-percent control modes.

Designed to control radiator fans on a PC water cooling loop \(to maintain supply water temperature\), but may be configured for other purposes \(for example, see [Demo/Router Cooling Demo](demo/router-cooling-demo.md)\).

![Simple 001 PCB in a Raspberry Pi 3 case](images/simple001.photo.2.png)

## Releases

- v0.1.0
  - [Firmware (Teensy 3.2, 3.5)](https://github.com/mstrthealias/TeensyFanController/releases/tag/v0.1.0)
  - [Configuration UI (Windows 10)](https://github.com/mstrthealias/TFC-ui/releases/tag/v0.1.0)

## Hardware

The following hardware has been used with Teensy Fan Controller:

* [Prototype - Simple PCB](hardware/simple-pcb.md): requires PCB fabrication \(gerber files provided\) and through-hole soldering
* [Breadboard](hardware/breadboard.md): breadboard example with a single fan/single sensor
* [Prototype - Hand-made \(Schmart Board based\)](hardware/prototype.md): uses over-the-shelf components

Related files are available in the [TeensyFanController/Hardware](https://github.com/mstrthealias/TeensyFanController/tree/master/Hardware) folder.

### Hardware Interface

The Teensy Micro USB port is used to configure and monitor the fan controller.

{% hint style="info" %}
It is possible to connect the Micro USB port to an internal motherboard USB 1.1/2.0 header, by making a custom cable, or purchasing a _Micro USB 5pin Male to 1x 5Pin Female 0.1" USB Header PCB Motherboard Cable_.
{% endhint %}

## Software

### Qt UI

[Teensy Fan Controller UI \(Qt5\)](https://github.com/mstrthealias/TFC-ui): provides a user interface to configure or monitor the fan controller (only needed for initial configuration).

### Linux Kernel module \(hwmon\)

[Fork of liquidtux](https://github.com/mstrthealias/liquidtux): Linux kernel module for reading temperatures and fan RPMs using *lm-sensors* or *psensor*.  Tested on Ubuntu 18.04.

repository: lattic/TeensyFanController

repo_name: lattic/TeensyFanController


text:
# McUtils.Zachary.Taylor.FiniteDifferenceFunction

Provides a general, convenient FiniteDifferenceFunction class to handle all of our difference FD imps

### Members:

  - [FiniteDifferenceFunction](FiniteDifferenceFunction/FiniteDifferenceFunction.md)
  - [FiniteDifferenceError](FiniteDifferenceFunction/FiniteDifferenceError.md)
  - [finite_difference](FiniteDifferenceFunction/finite_difference.md)
  - [FiniteDifference1D](FiniteDifferenceFunction/FiniteDifference1D.md)
  - [RegularGridFiniteDifference](FiniteDifferenceFunction/RegularGridFiniteDifference.md)
  - [IrregularGridFiniteDifference](FiniteDifferenceFunction/IrregularGridFiniteDifference.md)
  - [FiniteDifferenceData](FiniteDifferenceFunction/FiniteDifferenceData.md)
  - [FiniteDifferenceMatrix](FiniteDifferenceFunction/FiniteDifferenceMatrix.md)

### Examples:

___

[Edit Examples](https://github.com/McCoyGroup/References/edit/gh-pages/Documentation/examples/McUtils/Zachary/Taylor/FiniteDifferenceFunction.md) or
[Create New Examples](https://github.com/McCoyGroup/References/new/gh-pages/?filename=Documentation/examples/McUtils/Zachary/Taylor/FiniteDifferenceFunction.md)

[Edit Template](https://github.com/McCoyGroup/References/edit/gh-pages/Documentation/templates/McUtils/Zachary/Taylor/FiniteDifferenceFunction.md) or
[Create New Template](https://github.com/McCoyGroup/References/new/gh-pages/?filename=Documentation/templates/McUtils/Zachary/Taylor/FiniteDifferenceFunction.md)

[Edit Docstrings](https://github.com/McCoyGroup/McUtils/edit/master/Zachary/Taylor/FiniteDifferenceFunction/__init__.py?message=Update%20Docs)

repository: McCoyGroup/McUtils

gha_language: Python

repo_name: McCoyGroup/McUtils


text:
# auto-committer
 Tired of writing message for commits and pushing to repository by yourself? Deploy this life changing tool now!

## Preview
![cluster-ipc-logger](https://github.com/scrwdrv/auto-committer/blob/master/preview.jpg?raw=true)

## Installation
```sh
npm i -g auto-committer
```

## Usage
```sh
cd ./your/git/repo
auto-committer
```

### Watch Mode
```sh
auto-committer --watch
# or           -w
# default check interval: 60 seconds
```
```sh
auto-committer --watch 300
# check every 300 seconds
```

repository: scrwdrv/auto-committer

repo_name: scrwdrv/auto-committer


text:
[![GoDoc](https://godoc.org/github.com/kelindar/rand?status.svg)](http://godoc.org/github.com/kelindar/rand)
[![Go Report](https://goreportcard.com/badge/github.com/kelindar/rand)](https://goreportcard.com/report/github.com/kelindar/rand)

# Rand

A simple thread-safe API for a Go implementation of Melissa O'Neill's excellent PCG pseudorandom number generator, which is well-studied, excellent, and fast both to create and in execution. This repository contains a fork of [MichaelTJones/pcg](https://github.com/MichaelTJones/pcg) code and adds a pooling of random number generators.

⚠ **Alternative**: Scalable, hash-based alternative can be found in [kelindar/xxrand](https://github.com/kelindar/xxrand).

# Features

- Optimized for speed.
- Performance scales on multiple CPUs.

# Benchmark results

```
BenchmarkRand/Uint32-8         	566756457	         2.02 ns/op	       0 B/op	       0 allocs/op
BenchmarkRand/Uint32n-8        	478460296	         2.56 ns/op	       0 B/op	       0 allocs/op
BenchmarkRand/Float32-8        	406576479	         2.98 ns/op	       0 B/op	       0 allocs/op
BenchmarkRand/Uint64-8         	469784265	         2.71 ns/op	       0 B/op	       0 allocs/op
BenchmarkRand/Uint64n-8        	273879046	         4.50 ns/op	       0 B/op	       0 allocs/op
BenchmarkRand/Float64-8        	396292614	         3.10 ns/op	       0 B/op	       0 allocs/op
BenchmarkMathRandInt31n-8   	29865824	        40.2 ns/op	       0 B/op	       0 allocs/op
```

repository: kelindar/rand

repo_name: kelindar/rand


text:
# NLP and Deep Learning
### Python code and Notebooks of NLP practices

[BERT_Word_Embeddings](BERT_Word_Embeddings.ipynb): Explain what is [google BERT](https://github.com/google-research/bert), what is the difference between [BERT Embedding](https://github.com/google-research/bert) and Word2Vec-embedding, step by step to transform data, tokenizer and build the word vector from hidden layers and compute cosine similarity between 2 sentences containing the same word

[Advanced NLP with spaCy](https://course.spacy.io/)
- [chapter 1](spacy_chapter1.ipynb): Introduce you to the basics of text processing with spaCy: data structures, statistical models, and how to use them to predict linguistic features in your text.
- [chapter 2](spaCy_chapter2.ipynb): Extract specific information from large volumes of text, to make the most of spaCy's data structures and to combine statistical and rule-based approaches for text analysis.

- [Named Entity Recognition](NER.ipynb): Apply Named Entity Recoginiton and spaCy pretrained model on finance news.
- Conversation AI: [Rasa Open Source](https://rasa.com)
- NLP/NLU Open Souce: [SpaCy](https://spacy.io), [Element AI](https://www.expert.ai/products/nl-api)

- Text processing : [TextHero](https://texthero.org)
- Text similarity calculation: [FuzzyWuzzy](https://github.com/seatgeek/fuzzywuzzy)

repository: diem-ai/natural-language-processing

repo_name: diem-ai/natural-language-processing


text:
The repository for https://johannesstern.github.io/, the academic website for Johannes Stern

Created with [wowchemy for hugo](https://wowchemy.com/)

# How to use:

Getting started
- Just download the repository from github.

A number of hugo commands are run from the terminal.
- Open terminal
- Locate to folder, e.g., `cd Documents/GitHub/johannes-website`. You can then run `cd ..` to return to the "GitHub" folder to then "cd" into the truthandsemantics-website.

To run hugo server which builds a local version of the site:
- In terminal run `hugo server`
- then it will give you the url to locate the website.

To create a new page:
- In terminal run `hugo new publication/name-of-publication`, or as appropriate.
- You can modify the archetype to change what's created by default. Duplicate file, e.g, `themes/academic/archetypes/publication/index.md` to `archetypes/publication/index.md` and modify.

Editing content:
- I suggest using atom editor.
- Most content is located in `content` folder. Some settings are in `config` folder.
- Don't edit files in `themes\academic`. To modify the theme create a \`local\` version of the folder from `themes\academic`. E.g. in `layouts` there's code that overwrites the theme.

To deploy, simply push changes to the master branch using GitHub desktop.
- For truthandsemantics website, this will then trigger Netlify to automatically do it.
- For johannes-website, it is running a github action, see `gh-pages.yml`

To update
- See https://wowchemy.com/docs/hugo-tutorials/update/
- Update `hugo-version` in `gh-pages.yml` for johannes-website.

----------
Troubleshooting

`Error: from config: failed to resolve output format "headers" from site config`
In the terminal type `open $TMPDIR`.
Simply delete the folder called `hugo_cache`
Then all should be fixed and you shoud be able to run `hugo server` now without problems.
See https://wowchemy.com/docs/hugo-tutorials/troubleshooting/#error-failed-to-resolve-output-format

repository: catrincm/johannes-website

repo_name: catrincm/johannes-website


text:
---
title: Neural Networks for Babies
emoji: 🧠
metaDescription: Introduction to neural networks for babies co-authored with Chris Ferrie.
date: 2019-01-01T00:00:00.000Z
summary: Introduction to neural networks for babies co-authored with Chris Ferrie.
image: /static/img/nn-babies.jpg
external-url: https://www.amazon.com/gp/product/B086T76TBY/
tags:
  - publication
  - book
  - education
  - kids
  - publication
---

### Summary

Neural Networks for Babies is a colorfully simple introduction to the study of how machines and computing systems are created in a way that was inspired by the biological neural networks in animal and human brains. With scientific and mathematical information from an expert, this installment of the Baby University board book series is the perfect book for enlightening the next generation of geniuses. After all, it's never too early to become a scientist!

### Where to buy

- [Amazon](https://www.amazon.com/Sarah-Kaiser/e/B07H4VDXW5/)
- [Barnes and Noble](https://www.barnesandnoble.com/w/neural-networks-for-babies-chris-ferrie/1128189925)
- Most other large book stores:)


text:
---
templateKey: blog-post
title: Scaling an old monolithic Django web app
date: 2020-09-10T15:04:10.000Z
description: Monolithic apps could be a challenge to scale, especially one that's ladden with technical debt. This is how we did it!
featuredpost: false
featuredimage: /img/pipeline1.png
tags:
  - devops
---
Written by Cho-Nan Tsai. Special thanks to Ben Limpanukorn.

## The problem of growth

One of the biggest challenges of maintaining a tech stack is to ensure that tech debt is kept to the minimum so that it doesn't get in the way of new feature development. At Camino Financial, we are heavily invested in Python. We have software written in Python in the following areas: backend, serverless and data analytics. Our very first project was written using the Django framework and has grown large over the course of several years. Django is a nice framework to help get things started and to iterate versions quickly. We did exactly that the first year or two. However, the software evolved to become a monolithic application. While we found pockets of time to decouple modules and clean up tech debt, we are simply too busy with shipping new features.

The problem became a lot more pronounced when we started adding more users and asynchronous tasks to our system. Things got so bad when the system average load started looking ridiculous:

![Average System Load](/img/avg-load.png)

Since all initial setup was in 1 AWS VM, this led to Nginx timeouts and high latency on page loads.

## Brainstorming

We discussed a few possible approaches to this problem. Initially, we toyed with extracting some of the more heavy-duty modules and converting them to serverless (Serverless Framework). That was proven to be too difficult since some of the modules were very tightly coupled. Similarly, we thought a microservice solution would be great but again -- the modules were too tightly coupled.

We also discussed the possibility of using a load balancer in front of the VMs to distribute the load. However, this got shot down as well since with our set-up this would lead to a database race condition.

At the end, we decided to have 2 servers, one (Back Office) for handling user requests and the other for handling asynchronous tasks (Async Server). This post talks about our solution discovery journey.

## Version 1.0

Our initial version involves expanding our current CICD pipeline to trigger the building of the Docker containers for each of the servers and then deploying them to our AWS VM. At the high-level, we are still leveraging automated tests to run with manual approval before deploying to production. On top of that, we are also modifying the source code before deploying for the asynchronous task server (bo-common), setting Elastic IP address and then terminating the old stack. Sounds terrific, right? No, absolutely disastrous.

![First version of CICD pipeline](/img/pipeline1.png)

The problem with the set-up is that it tries to do too much in the deployment process and it has interfered with our production server on several occasions. The main points of failures included:
Duplicated Django configurations in both VM instances, which becomes confusing for developers.
Multiple lambda serverless end points trying to keep things in sync. This ran into synchronization issues when developers committed code in close successions.
Implementing auto approve and manual approve creates confusion for developers
Spinning up new stacks and assigning elastic IP was not a good approach (load balancer would have been better).
Maintaining 2 repositories that are almost identical.
Sometimes old servers do not get terminated, leading to waste and unnecessary tasks running in parallel.
Almost identical repos (one for the main server and the other for the async task server) being synchronized by lambda.

However, when things are working, it does what it is supposed to do -- relieving the load on the main server when things are running asynchronously. However, we decide to iterate on this to make things simpler.

## Version 2.0

Eventually, we decide to address the issues by having another iteration with our CICD pipeline design. First, we revert to the original pipeline which is a lot cleaner and straightforward. Then we make a key change to preserve the code but introduce a mini fork in our prod CICD pipeline, one for Back Office and another for Async Server. The nice thing about this approach is that we longer need multiple lambda functions for code synching and deployment. Everything is triggered from the top when the repository is updated. The only thing that’s different between the code deployed in each VM is the configuration file. This makes things a lot easier to manage for developers.

![Improved version - forked CICD pipeline](/img/pipeline2.png)

## Conclusion

It’s been months since we deployed this new set up. Fortunately, things have been fairly stable. We have deprecated some of the lambda functions that are no longer needed and killed the ‘identical’ repo. For future improvements, we are contemplating introducing priority queues within the Async Server set-up so that tasks can be processed according to the priority assigned.


text:
---
# Documentation: https://sourcethemes.com/academic/docs/managing-content/

title: "A proposed data standard for breath sample data and metadata"
authors: ["Bo Zhao", "Dahlia Salman", "Michael Wilde", "Rebecca Cordell", "Luke Bryant", "Dorota Ruszkiewicz", "Wadah Ibrahim W", "Amisha Singapuri", "Christopher Brightling", "Salman Siddiqui", "Paul Thomas", "Robert C. Free"]
date: 2019-09-20T16:42:42+01:00
doi: ""

# Schedule page publish date (NOT publication's date).
publishDate: 2019-09-20T16:42:42+01:00

# Publication type.
# Legend: 0 = Uncategorized; 1 = Conference paper; 2 = Journal article;
# 3 = Preprint / Working Paper; 4 = Report; 5 = Book; 6 = Book section;
# 7 = Thesis; 8 = Patent
publication_types: ["1"]

# Publication name and optional abbreviated publication name.
publication: "International Association of Breath Research Meeting 2019"
publication_short: "iabr2019"

abstract: "
Background
Data management in breath research is underdeveloped. While general metabolomics data standards exist, these do not include detailed individual sample provenance and quality assurance: something which is particularly important in the breathomics field. To facilitate quality control and data sharing, we propose a new data standard including sample specific metadata as a key component.
Methods
The proposed standard extends the ISATAB data archive standard with support for sample specific metadata/reports describing individual sample processing, provenance and quality. An informatics platform was developed to facilitate straightforward data archive creation, management, sample report generation and data sharing. Re-usable flexible scaffolds and templates were used to handle different equipment and processes, and could be adopted by any study requiring consistent metadata collection.
Results
To demonstrate the applicability of the proposed standard and the informatics platform we used breath sample data collected during the East Midlands Breathomics Pathology Node project. Collaborating researchers employed a pre-defined scaffold to integrate their existing data files into a template, with which they produced outputs including: a data archive (containing data and meta-data), and ‘data header’ PDF reports pertaining to individual samples. The latter were uploaded to a local repository.
Conclusions
The proposed data standard and informatics platform simplified the metadata collection and reporting process. Easily shareable PDF-based data headers allowed researchers to understand each step the sample had gone through and repeat relevant analytical processes. Furthermore, the ISATAB-compatible data archive supports uploading to existing data repositories, while including the provision for reporting individual sample meta-data.
"

# Summary. An optional shortened abstract.
summary: ""

tags: []
categories: []
featured: false

# Custom links (optional).
#   Uncomment and edit lines below to show custom links.
# links:
# - name: Follow
#   url: https://twitter.com
#   icon_pack: fab
#   icon: twitter

url_pdf:
url_code:
url_dataset:
url_poster:
url_project:
url_slides: "iabr_seminar_2019.pdf"
url_source:
url_video:

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
  caption: ""
  focal_point: ""
  preview_only: false

# Associated Projects (optional).
#   Associate this publication with one or more of your projects.
#   Simply enter your project's folder or file name without extension.
#   E.g. `internal-project` references `content/project/internal-project/index.md`.
#   Otherwise, set `projects: []`.
projects: ["qisa"]

# Slides (optional).
#   Associate this publication with Markdown slides.
#   Simply enter your slide deck's filename without extension.
#   E.g. `slides: "example"` references `content/slides/example/index.md`.
#   Otherwise, set `slides: ""`.
slides: ""
---


text:
# Style DSL
kMD2PDF introduces a DSL for creating custom styles for the exported PDFs. The DSL is inspired by the TornadoFX
[Type Safe CSS DSL.](https://github.com/edvin/tornadofx/wiki/Type-Safe-CSS)

The DSL aims to be as close to CSS as possible so that it is intuitive.

If there isn't a specific configuration available for your customization needs, you can use a
[custom selector.](StyleDSL.md?id=custom-selectors)

## Getting started
Styles are configured within the `markdownConverter` block using the `style` block.

```kotlin
val converter = markdownConverter {
  style { }
}
```

## Global settings
Global settings are configured using the `settings` block in the `markdownConverter` block.

```kotlin
markdownConverter {
  settings { }
}
```

**Note:** The `settings` block must come before the `style` block, otherwise, the global settings will not apply.

The following settings are available for configuration.

### Font size
Headers are scaled in relation to the global font size, following [these](https://www.w3schools.com/tags/tag_hn.asp)
constants.

**Default:** `16.0.px`
```kotlin
settings {
  fontSize = 16.0.px
}
```

### Font family
**Default:** `FontFamily(FontFamily.BaseFontFamily.SANS_SERIF)`

```kotlin
settings {
  font = FontFamily("Roboto", "Lato")
}
```

### Monospace font
**Default:** `FontFamily(FontFamily.BaseFontFamily.MONOSPACE)`

```kotlin
settings {
  monospaceFont = FontFamily("Fira Code")
}
```

### Theme
**Default:** `Settings.Theme.LIGHT`

```kotlin
settings {
  theme = Settings.Theme.DARK
}
```

## Elements
Each element can be configured through a method call corresponding to the element name used in HTML with some minor
exceptions that will be specified later on.

All the elements available to be customised can be found
[here.](https://github.com/woojiahao/kMD2PDF/tree/documentation/src/main/kotlin/com/github/woojiahao/style/elements)

For instance, to configure the `Paragraph` element, invoke the `Style#p` method within the DSL.

```kotlin
style {
  p {
    // Configuration for Paragraph goes here
  }
}
```

**Note:** To customize the table specific elements like `th` and `tr`, they must be done within the `table` method call.
```kotlin
table {
  th {
    // Configuration for th goes here
  }
}
```

## Themes
0.2.0 introduced [theming](Changelog.md?id=Themes) and with that, a new set of classes `CssProperty` has been created
as delegated properties to manage the configuration of settings depending on the theme of the document.

```kotlin
val textColor by CssProperty(c("21"), c("EE"))
```

In this instance, if the theme is `DARK`, the text color used will be `#EEEEEE` and if the theme is `LIGHT`, the text
color used will be `#212121`.

Some elements will have specified different colors to use depending on theme such as tables, code blocks and text
colors.

## Common Configurations
This section covers the shared configuration settings available to all element types. The examples will be using
applying the styles to the `Paragraph` element, but these configurations can be applied to any other element.

The table summarizes all the common configurations available:

| Configuration   | Data Type              | Light                    | Dark      |
| --------------- | ---------------------- | ------------------------ | --------- |
| fontSize        | Double                 | `16.0.px`                | Same      |
| fontFamily      | FontFamily             | `FontFamily(SANS_SERIF)` | Same      |
| textColor       | Color?                 | `#212121`                | `#EEEEEE` |
| backgroundColor | Color?                 | `null`                   | Same      |
| fontWeight      | Element.FontWeight     | `null`                   | Same      |
| textDecoration  | Element.TextDecoration | `null`                   | Same      |
| border          | BorderBox              | `BorderBox(Border())`    | Same      |
| borderRadius    | Box<Double>            | `Box(0.0.px)`            | Same      |
| padding         | Box<Double>?           | `null`                   | Same      |
| margin          | Box<Double>?           | `null`                   | Same      |

### Font Size
```kotlin
p {
  fontSize = 12.0.px
}
```

### Font Family
```kotlin
p {
  fontFamily {
    +"Roboto"
    +"Lato"
  }
}
```

### Text Color
Colors can be retrieved using the function `StyleUtility#c`.

```kotlin
p {
  textColor = c("D32F2F")
}
```

### Background Color
Colors can be retrieved using the function `StyleUtility#c`.

```kotlin
p {
  backgroundColor = c("1976D2")
}
```

### Font Weight
The enumeration constants can be found [here.](https://github.com/woojiahao/kMD2PDF/blob/documentation/src/main/kotlin/com/github/woojiahao/style/elements/Element.kt)

```kotlin
p {
  fontWeight = Element.FontWeight.NORMAL
}
```

### Text Decoration
The enumeration constants can be found [here.](https://github.com/woojiahao/kMD2PDF/blob/documentation/src/main/kotlin/com/github/woojiahao/style/elements/Element.kt)

```kotlin
p {
  textDecoration = Element.TextDecoration.UNDERLINE
}
```

### Border
Border is stored as a `BorderBox` so you can customise the border on each side of the element.

The example below sets the border of all paragraphs to be `2.0px dashed rgb(0, 255, 0)` on all sides, then overrides
the left border to be `4.0px dotted rgb(255, 0, 0)`.

```kotlin
p {
  border {
    all(2.0.px dashed Color.GREEN)

    left(4.0.px dotted Color.RED)
  }
}
```

### Border Radius
To configure the border radius, a `Box` object is used. More about this object can be found [here.](AboutBox.md)

The CSS equivalent of the example below is: `border-radius: 4.0px 3.0px 10.0px 2.0px`.

```kotlin
p {
  borderRadius = Box(4.0.px, 3.0.px, 10.0.px, 2.0.px)
}
```

### Padding
The example below sets the padding on all sides of the paragraph element to 10.0px. More on the `Box` object can be
found [here.](AboutBox.md)

```kotlin
p {
  padding = Box(10.0.px)
}
```

### Margin
The example below sets the margin on all sides of the paragraph element to 10.0px. More on the `Box` object can be
found [here.](AboutBox.md)

```kotlin
p {
  margin = Box(10.0.px)
}
```

## Unordered And Ordered List Configurations
These are configurations only accessible when customizing `UnorderedList` and `OrderedList`.

| Configuration     | Data Type              | Default Value                    |
| ----------------- | ---------------------- | -------------------------------- |
| listStyleType     | List.ListStyleType     | `List.ListStyleType.CIRCLE`      |
| listStylePosition | List.ListStylePosition | `List.ListStylePosition.OUTSIDE` |

### List Style Type
```kotlin
ol {
  listStyleType = List.ListStyleType.HEBREW
}

ul {
  listStyleType = List.ListStyleType.SQUARE
}
```

### List Style Position
```kotlin
ul {
  listStylePosition = List.ListStylePosition.INSIDE
}
```

### List Style Images
```koltin
ul {
  listStyleImage = "https://via.placeholder.com/150"
}
```

## Table Configurations
These are configurations only accessible when customizing `Table`. As specified above, to access and customize
table-specific elements, they have to be done within a `table` method call:

```kotlin
table {
  thead { }
  tbody { }
  th { }
  tr { }
  td { }
}
```

`Table` also introduces a new configuration setting:

| Configuration  | Data Type            | Default Value                   |
| -------------- | -------------------- | ------------------------------- |
| borderCollpase | Table.BorderCollapse | `Table.BorderCollapse.COLLAPSE` |

### Border Collapse
**Note:** The typo is based on an actual typo in the codebase, this will be fixed in the next mini release.

```kotlin
table {
  borderCollpase = Table.BorderCollpase.SEPARATE
}
```

## Custom Selectors
Custom selectors are loaded to the bottom of the style sheet. Within the selector, assign CSS attributes using the
following pattern:

```
<attribute_name :: String> to <attribute_value :: String>
```

For example, this selector creates a striped pattern for tables.

```kotlin
createStyle {
  selector("tr:nth-child(even)") {
    "background-color" to "#f2f2f2"
  }
}
```

gha_language: Kotlin


text:
# Lessons from Zero-Defect Software

## Jason R. Coombs

Note: Welcome to (conference, forum)... My name is Jason and I'll be talking today about engineering zero-defect software.

...

## Intro and Background

- Computer Science
- Scheme (functional programming)
- Cleanroom development
- Passion for:
 - reliability
 - re-use
 - sophistication

Note:
- A bit about me - I began early with computer programming in undergraduate studies in CS and math. My first formal programming language was Scheme, a Lisp-based functional programming language that was foundational in framing how programs are modeled. I also took a course called Zero-defect software in which we studied cleanroom development.
- My passion is to write code that is reliable, reusable, and sophisticated. I hate repeating myself. After several decades of hacking and seeking a greater capability for programming, I've encountered lessons and accumulated patterns that work well for me. Inspired by a tweet a few years ago, I reflected on the foundations of my technique that have led to an ability to rapidly develop robust software. I distilled the inspiration into three key areas.

---

## Refactoring

...

## Functional Programming

...

## Cleanroom Development

...

## Refactoring
## Functional Programming
## Cleanroom Development

Note: These three aspects form the foundation for my approach to reliable yet sophisticated software development.

---

# Refactoring

...

![](https://images-na.ssl-images-amazon.com/images/I/51K-M5hR8qL._SX392_BO1,204,203,200_.jpg)

_The single book that most influenced my programming for the better_

Note: My introduction to refactoring was through book by Martin Fowler, which describes in detail the aspects of refactoring on which I'll touch briefly today. The person who referred me to this book described it as the single book that most influenced their programming for the better, and I can echo that sentiment.

...

## Implementation as Spec

- Inherited
- Best source of truth
- Assumptions baked-in
- Latent institutional knowledge
- Legacy behaviors

Note: Often, when approaching a piece of code, it's inherited from another author or team or company (or several) in which you have no spec and so the implementation _is_ the spec. You have to assume the implementation is correct unless proven otherwise. The code often contains latent institutional knowledge and even legacy behaviors, sometimes just enough to ship the product or not even that. Refactoring empowers you to safely restructure the code into a format that's easier to understand and test.

...

## DRY

- Factor the code
- Essential functionality

Notes: What does "factor" mean? It's a piece of behavior, an aspect of the program. It may be a semantic construct like a interface or a concrete one like an object or function. "Essential" - what it's intended to do and not more (constraints and limits can empower) and without repeating yourself. Refactoring differs from basic editing in that you use proven operations, many of which can be mechanized.

...

## Tools & Techniques

- Eclipse IDE
- JetBrains/PyCharm
- Manual
- Consider committing each stable change

Notes:
  There are a host of tools and IDEs that can perform mechanized refactoring operations safely. One of the first I experienced was Eclipse, which could perform many refactoring operations not just on a single file, but on a whole codebase. Java and other strongly-typed languages are more amenable to automated refactoring tools due to the constraints those languages demand. JetBrains later proved with PyCharm that similar operations could be performed on the less-strongly-typed Python language and still add immense value.
  Of course, it's possible to manually refactor code, to apply the transforms manually, taking care to apply them independently of other changes. I recommend commiting each refactoring operation, describing the intended change and providing a checkpoint before and after the change.

...

## Refactor to

- Learn a new codebase
- Reshape to match conceptual needs
- Keep functions small

Notes: For learning a new codebase, make safe operations as you mold the codebase to your expertise (esp. if you're sole maintainer). For small functions, if it can fit on the screen, it might fit in your mind.

...

## Code Examples

- Dredged my [first production code](https://github.com/jaraco/esdsort/commit/0e69e0f6687648cb61f50840e25c81e6f57cca61) (c. 1992)
- C [ported to Python](https://github.com/jaraco/esdsort/commit/1e7d063ff1101d9d3b91d861f5a1a0a5efde51e3)

Note: fun fact - the code from many examples in this presentation taken from the very first commercial code I produced as a high school student. I've taken the C code and translated it as directly as I could to Python 3 code to illustrate some truly legacy operations. This code is linked in this presentation, which is available online.

...

## Example

- Consider [this extract function](https://github.com/jaraco/esdsort/commit/5825ebbf4a81a84bcd1b28cabd2a5cf76ea4ad5d) operation
- one else block, 150 lines
- → 1 function

---

# Functional Programming

...

## What is functional programming?

- Not what you were taught
- Not a set of instructions
- Expressions over statements
- All state is localized

...

## Benefits

- Stateless
  - no side effects
  - no interactions except at input/output
- Focus on what machines do best
  - perform an operation over a (possibly unlimited) number of inputs
- Generalizable abstraction
  - simple concepts are more scalable
  - map/reduce forms foundation of Hadoop

...

## For / Append

```python
items = []
for item in inputs:
    items.append(handle(item))
```

Note: Consider this very common pattern, the for/append.

...

## Comprehensions

Operate on expressions:

```python
items = [handle(item) for item in inputs]
```

Note: This syntax is shorter, but that's not it's key benefit. The key benefit is that the syntax is mainly one expression applied to an iterable. This code communicates explicitly that there's no manipulation of inputs and exactly one operation on each item. It further reduces the temptation to inject such complicating behaviors (for the same reasons you'd avoid "goto"). "handle" might be arbitrarily complex, but that complexity is encapsulated by its signature.

...

## Keep Functions Simple

- One output parameter
- Few input parameters (ideally one)
- Rely on exceptions for handling exceptional conditions
- Prefer single-word actions
  - `string.lower(input)` > `string.string_lowercase_input(input)`
  - `dedent(lstrip(input))` > `dedent_and_lstrip(input)`

Note: Here's where Python really shines - there's (preferably) one outcome from a function (its prime directive). Languages like Go require exceptional conditions to be handled in-band. Java features like ".." require each and every exception to be handled explicitly. Many functions can be represented with single word actions. If there are multiple words, especially if the words combine more than a single concern, suggests the function may be doing too much (or unintentionally dragging in the parent scope or parameters).

...

## Primitives

- `map`
- `reduce`
- `compose`
- `partial`

Note: Functional paradigm brings several primitive concepts that apply to many use cases, including map, reduce, compose, and partial.

...

## Mapping and Reduction

- Map
 - operation on a series of inputs producing series of outputs
- Reduce
 - given a series of inputs, aggregate into a single output

Note: map is perhaps the most essential computatal operation

...

## Char to Integer

```
def atoi(s):
    """
    Convert list of characters s to integer value
    """
    n = 0
    i = 0

    while s[i] >= '0' and s[i] <= '9':
        n = 10*n + ord(s[i]) - ord('0')
        i += 1

    return n
```

Note: This code while simple has a demonstrates a lot of interactions between the various stages (initialization, looping, computation, index tracking). Consider instead this implementation.

...

## Char to Integer (functional)

```
def atoi(s):
    """
    Convert list of characters s to integer value
    """
    digits = get_digits(s)
    ordinals = map(ord_zero, digits)
    return functools.reduce(ten_x, ordinals, 0)
```

([full implementation](https://github.com/jaraco/esdsort/commit/221a884b5a9d04c4cb7d742bc9fd08f10fa53d9f))

Note: This approach, in contrast, breaks down the conceptual steps into discrete steps, each of which can be implemented and tested independently, but which together produce the desired behavior.

## Composition

Given two or more functions, produce a new function that takes the result from one function as the input to the other. Consider f(x) = x2 + 1, decomposes to

- f1(x) = x + 1
- f2(x) = x2

`f(x) = f2(f1(x))` or `f(x) = f2∘f1(x)`

...

## Composition (Python)

```python
def f1(x):
    return x + 1

def f2(x):
    return x ** 2

from jaraco.functools import compose

f = compose(f2, f1)
```

Note: Now f1 and f2 can be independently verified and tested, perhaps used separately elsewhere, and the composition of those two is "f". Pragmatically, you probably wouldn't do this for a simple mathematical function as illustrated here (especially if you're using CPython which has high function call overhead).

...

## Partial

```python
def add_n(x, n):
    return x + n

f1 = partial(add_n, n=1)
```

Note: The last powerful primitive that I'll cover is the "partial", a way of binding state to a function.

...

## Boolean Parameters

```python
def read_file(filename, use_bytes=True):
    if use_bytes:
        with open(filename, 'rb') as reader:
            return reader.read()
    else:
        with open(filename, 'r') as reader:
            return reader.read()
```

Note: If you have a function accepting a boolean parameter, especially if that boolean parameter is only observed at the beginning or end of the function or if the boolean parameter selects behavior for the entire body of the call, it's probably better factored out into separate functions.

...

## Boolean Parameters (separate functions)

```python
def read_text(filename):
    with open(filename, 'r') as reader:
        return reader.read()

def read_bytes(filename):
    with open(filename, 'rb') as reader:
        return reader.read()
```

...

## Deduplicate

```python
def read_text(filename):
    return read(filename, 'r')

def read_bytes(filename):
    return read(filename, 'rb')

def read(filename, mode):
    with open(filename, mode) as reader:
        return reader.read()
```

Note: Now that we've extracted the duplicating code, we observe that filename and mode are passed directly into another function - another bad smell. Instead, it would be better to rely on the canonical interface.

...

## Simplified

```python
def read(stream):
    """
    To read text, ``read(open(filename, 'r'))``
    """
    with stream:
        return stream.read()
```

Note: Rely on canonical interfaces wherever possible. Avoid passing parameters through.

---

# Cleanroom Development

Note: The key contributor to the zero-defect software approach is the cleanroom development, based on research from world-class firms including IBM.

...

## Levels of Rigor

- Mathematically provable
  - brute force
  - property-based testing
- Verifiably correct code
- Code written for verifiability

...

## Theory

- Careful specification of functions, components, and control constructs
  - clarity
  - precision
  - completeness
- Catch many errors before compile/execution time
- Understand the program thoroughly
- Rigorous reviews

...

## Practice

- Only the most simple code is mathematically provable
- Only simple code is verifiable
- Limit relevant state, interactions
- Declare and enforce constraints (inputs, outputs)
- Use refactoring, functional programming to safely simplify the code

...

## Legacy code

- Code is the spec

Note: Often with legacy code, there is no specification. The code is the spec. Derive a spec.

...

## Expectations

- Slower time to initial release
  - faster (or comparable) development lifecycle
- Low level of defects during testing
- Few defects in production

Note: A high level of defects during testing indicates failure in the process. Revisit and bolster the review process.

...

## Limiting State

- Avoid `if` statements and other branching logic
- `if` is the new `goto`
  - avoid them; there's probably a better way
  - [code smell](https://www.pyohio.org/2019/presentations/74)

Note: Limiting branching logic reduces the number of states the subprogram can be in and thus the number of combinations that need to be considered. Later this afternoon, Aly Sivji will go into more detail on why if statements are a code smell.

...

## Examples

```python
def main():
    # ... (no branches)
    try:
        open("esdsort.dat", 'w')
    except Exception:
        pass
    # ...
```

- infer the purpose
- derive a spec
- extract a function

...

## Truncate output file

```python

OUTPUT_FILENAME = "esdsort.dat"

def truncate(filename):
    """
    Unconditionally ensure the named file exists and is truncated.
    """
    try:
        open(filename, 'w')
    except Exception:
        pass

def main():
    # ... (no branches)
    truncate(OUTPUT_FILENAME)
    # ...
```

Notes: In this change, I've now made explicit and apparent the purpose of that segment of code. This change also makes more explicit the specification that the output file will be truncated during startup. The code is still the spec, but it reads more like a spec. I've also extracted a variable for the output filename, an operation that probably should be done in a separate commit and affecting all hard-coded usages of that name. Now we can perform a rigorous review of this new truncate behavior. Can you imagine any improvements to the truncate function?

...

## Optimize

```python

def truncate(filename):
    """
    Unconditionally ensure the named file exists and is truncated.
    """
    open(filename, 'w').close()
```

Note: Now that we have a spec (which doesn't say anything about suppressing errors), optimize the function to follow best practices for Python, namely let exceptions bubble up and close file handles.

---

# Conclusions

Refactoring, Functional Programming, Cleanroom Development

- Reduce interactions
- Reduce complexity
- Elegance begets simplicity
- Python shines
  - functional, OO, imperative where appropriate
  - robust patterns for exception handling
- Zero-Defect

Note: All together, these approaches reduce interactions, thereby reducing complexity.

...

## Honorable Mentions

- Object-oriented Programming
- Test/Documentation/Behavior-Driven-Development
- Static analysis tools
- Agile (fail fast)
- Performance

Note: Static analysis tools (linters, style checkers, IDEs) are a powerful way to avoid common mistakes before even saving a file. In this talk, I'll be focused on optimizing for correctness of design and disregarding the impact of performance. Often this tradeoff is a good one to make in practice too, as readability matters and premature optimization is a fools errand.

...

# Q&A

- Twitter/Github: @jaraco
- Slides: bit.ly/zero-defect-19

repository: jaraco/zero-defect-lessons

repo_name: jaraco/zero-defect-lessons


text:
# Audio Generator

This is a demo showing how one can generate and
play audio samples from GDScript.
It plays a simple 440 Hz sine wave at 22050 Hz.

Language: GDScript

Renderer: GLES 2

Check out this demo on the asset library: https://godotengine.org/asset-library/asset/526

## How does it work?

It uses the `push_frame()` method on an [`AudioStreamGeneratorPlayback`](https://docs.godotengine.org/en/latest/classes/class_audiostreamgeneratorplayback.html)
object, which is inside of an
[`AudioStreamPlayer`](https://docs.godotengine.org/en/latest/classes/class_audiostreamplayer.html)
node, to generate audio frame-by-frame based on `pulse_hz`.

repository: godotengine/godot-demo-projects

gha_language: GDScript

repo_name: godotengine/godot-demo-projects


text:
# GoodWe
[![PyPi](https://img.shields.io/pypi/v/goodwe.svg)](https://pypi.python.org/pypi/goodwe/)
[![Python Versions](https://img.shields.io/pypi/pyversions/goodwe.svg)](https://github.com/marcelblijleven/goodwe/)
[![Build Status](https://github.com/marcelblijleven/goodwe/actions/workflows/publish.yaml/badge.svg)](https://github.com/marcelblijleven/goodwe/actions/workflows/publish.yaml)
![License](https://img.shields.io/github/license/marcelblijleven/goodwe.svg)

Library for connecting to GoodWe inverter over local network and retrieving runtime sensor values and configuration parameters.

It has been reported to work on GoodWe ET, EH, BT, BH, ES, EM, DT, D-NS, XS and BP families of inverters.
It may work on other inverters as well, as long as they listen on UDP port 8899 and respond to one of supported communication protocols.

(If you can't communicate with the inverter despite your model is listed above, it is possible you have old ARM firmware version.
Usually the ARM firmware (not inverter firmware) has to be >=13. You should ask manufacturer support to upgrade your ARM firmware to be able to communicate with inveter via UDP.)

## Usage
1. Install this package `pip install goodwe`
2. Write down your GoodWe inverter's IP address (or invoke `goodwe.search_inverters()`)
3. Connect to inverter and read all runtime data, example below

```python
import asyncio
import goodwe

async def get_runtime_data():
    ip_address = '<IP_ADDRESS>'

    inverter = await goodwe.connect(ip_address)
    runtime_data = await inverter.read_runtime_data()

    for sensor in inverter.sensors():
        if sensor.id_ in runtime_data:
            print(f"{sensor.id_}: \t\t {sensor.name} = {runtime_data[sensor.id_]} {sensor.unit}")

asyncio.run(get_runtime_data())
```
or the old way (for XS inverters only), create a processor and inverter instance:
```python
import asyncio
from goodwe import GoodWeInverter, GoodWeXSProcessor

async def get_data():
    ip_address = '<IP_ADDRESS>'
    processor = GoodWeXSProcessor()
    inverter = GoodWeInverter(inverter_address=(ip_address, 8899), processor=processor)
    data = await inverter.request_data()
    print(f'power is {data.power} at {data.date:%H:%M:%S}')

asyncio.run(get_data())
```
## References and useful links

- https://github.com/mletenay/home-assistant-goodwe-inverter
- https://github.com/tkubec/GoodWe
- https://github.com/yasko-pv/modbus-log
- https://github.com/MiG-41/Modbus-GoodWe-DT
- https://github.com/OpenEMS/openems


text:
# Aragonite-validator

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/leojavier/aragonite-validator/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
[![npm version](https://badge.fury.io/js/aragonite-form-validator.svg)](https://badge.fury.io/js/aragonite-form-validator)
[![David](https://david-dm.org/leojavier/aragonite-validator.svg)]()
[![Build Status](https://travis-ci.org/leojavier/aragonite-validator.svg?branch=master)](https://travis-ci.org/leojavier/aragonite-validator)
[![DUB](https://img.shields.io/dub/l/vibe-d.svg)](https://opensource.org/licenses/MIT)

### What is Aragonite?
Is a lightweight and onobstrusive field validator that helps you validate any kind of
data before submiting to your server.
___

### Table of Contents
- [1. Getting Started](#getting-started)
- [2. Load the plugin in your page ](#load-the-plugin-in-your-page)
- [3. Initialize the plugin ](#initialize-the-plugin)
- [4. Customizations](#customizations)
    * [4.1. Adding a custom CSS className](#adding-a-custom-classname)
    * [4.2. Adding custom Validation](#adding-custom-validation)
    * [4.3.  Adding custom error messages](#adding-custom-error-messages)
- [5. Data Type Options ](#data-type-options)
- [6. License agreement ](#license-mit)
- [7. ChangeLog](https://github.com/leojavier/aragonite-validator/tree/master/changeLog)

### Getting Started
**Npm:** `npm install aragonite-form-validator`

**Bower:** `bower install aragonite-form-validator`

### Load the plugin in your page

```HTML
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>

    <!-- Loading the file aragonite-style-base.css is optional The the only functionality of this
    file is to add some CSS properties to the [.required] className that Aragonite will add to the
    HTML field when something data is not valid
    -->
    <link rel="stylesheet" type="text/css" href="dist/css/aragonite-style-base.css">

</head>
<body>
    <h1>Sample page</h1>
    <form id="demo-form" class="how-form" action="#">
            <input type="text" data-type="email" placeholder="Type an Email address" />
        <input type="text" data-type="string" placeholder="Type any string" />
        <input type="text" data-type="phone" placeholder="Type a phone number" />
    </form>
    <script src="dist/js/aragonite.min.js"></script>
</body>
</html>
```
>Note: *The form must have an `ID` attribute, in this case `demo-form`*. In every field you must specify what kind of **`data-type`** you need to validate

### Initialize the plugin

```javascript
<script type="text/javascript">
    aragonite.init('demo-form');
</script>
```
---
### Customizations

##### Adding a custom className
By default Aragonite will add a class attribute to your HTML field when something is wrong. This className is call
'required'. However... you might have another `CSS` class already using that name in your project. If that's the case... you can always overwrite Aragonite's default behavior and pass a custom class name.

```javascript
//className
<script type="text/javascript">
    aragonite.init('demo-form', {
        className: 'myCustomClass'
    });
</script>
```
>Note: *In thi example when the field is invalid, it will add the CSS Class `myCustomClass`  to the HTML element instead of 'required'*

___

##### Adding custom validation
Below you will find a set of options that you can use to validate your forms. I will be adding more options "every week".
In case you need to use a custom validation you can always pass it as an argument and then use it on your form.

```
 <form id="demo-form" class="how-form" action="#">
    <input type="text" data-type="capital" placeholder="Type any string" />
    <input type="text" data-type="seven" placeholder="Type a phone number" />
</form>
```
```javascript
<script type="text/javascript">
    aragonite.init('demo-form', {
    regex: [
        { name: 'capital', regex: /^[A-Z][a-z0-9_-]{3,19}$/ }, //Will be valid only if the first character is UPPERCASE
        { name: 'seven', regex: /^[a-zA-Z]{7}$/ }  // Will be valid only if the length of the string is 7 characters
    ]
    });
</script>
```

>Note: You pass the property `name` of these regex through your `data-type` attribute and Aragonite will do the rest for you. You can pass as many regex as you want*.

___

##### Adding custom error messages
Aragonite wire the error messages automatically for you. You just need to create a **`label`** element and set the `for` attribute of the label to the `inputName-error`. The following example shows you how to wire a simple Email input field.

```html
<label for="email-error"></label>
<input type="text" name="email" value="" data-type="email" placeholder="Type an Email address" />
```
>Note: You pass the property `name` of the targeted field in this case `email` an then the `error` keyword separated by a dash. `email-error`*.

```html
<form id="demo-form-custom-labels" class="how-form" action="#">
   <label for="email">E-mail</label>
   <label for="email-error" class="aragonite-error-message"></label>
   <input type="text" name="email" value="" data-type="email" placeholder="Type an Email address" />
   <label for="string">First name</label>
   <label for="string-error" class="aragonite-error-message"></label>
   <input type="text" name="string" value="" data-type="string" placeholder="Type any string" />
   <label for="phone">Phone number</label>
   <label for="phone-error" class="aragonite-error-message"></label>
   <input type="text" name="phone" value="" data-type="phone" placeholder="Type a phone number" />
</form>
```

```javascript
<script type="text/javascript">
aragonite.init('demo-form-custom-labels');
</script>
```

>Note: You pass the property `name` of these regex through your `data-type` attribute and Aragonite will do the rest for you. You can pass as many regex as you want*.

___

### Data type Options

Option  | Behavior
------------- | -------------
`string` | Validate if the content submited by the user is a string. It doesn't accept numbers or special characters.
`alphaNumeric`  | This option will accept letters, numbers , - and _.
`phone`  | This option accept only numbers, not special characters. A minimum of 10 characters and a maximum of 15.
`visa`  | All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
`mastercard`  | All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
`amex`  | American Express card numbers start with 34 or 37 and have 15 digits.
`discover`  | Discover card numbers begin with 6011 or 65. All have 16 digits.
`cvv`  | Credit cards security code. from 3 to 4 digits(Amex)

### License MIT
The MIT License (MIT)
Copyright (c) 2015 [Leo Javier]()

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: leojavier/aragonite-validator

repo_name: leojavier/aragonite-validator


text:
# PascalBrainFuck
A dumb basic Brainfuck Interpreter that will convert Brainfuck Code into Pascal code then compile said code in theory works on Mac and Linux have not tested

Compile with fpc -S2 UnbrainFuck.pas

Type -k to keep the Genrated File
Example: UnbrainFuck -k text.b

Type -na to change the name of the output file
Example: UnbrainFuck -na cool nice.b = output File cool

Type -l to change the langure p for pascal Defualt and c for c
Example: UnbrainFuck -l c nice.b

repository: sardap/PascalBrainFuck

repo_name: sardap/PascalBrainFuck


text:
---
title:        "Matthew 1:1-4:25"
date:         2021-10-08 12:00:00 +0500
keywords:
- Christianity
- Bible
- Christian
- Matthew
- Reading
- Bible Reading
- Scripture
- Sacred
mp3-url:      "/assets/audio/broken_link.mp3"
episode-type: full # or "trailer"
explicit:     "no"
block:        "no" # no means it is published
layout: podcast
excerpt_separator: <!--more-->
---
The Gospel of Matthew Chapters 1 through 4
<!--more-->
Reading taken from the NRSV, or New Revised Standard Version.
[Scripture quotations are from] Common Bible: New Revised Standard Version Bible, copyright © 1989 National Council of the Churches of Christ in the United States of America. Used by permission. All rights reserved worldwide.

repository: thejettanderson/example-podcast-page

repo_name: thejettanderson/example-podcast-page


text:
# keyBoardButton

[![CI Status](https://img.shields.io/travis/shrutiP1/keyBoardButton.svg?style=flat)](https://travis-ci.org/shrutiP1/keyBoardButton)
[![Version](https://img.shields.io/cocoapods/v/keyBoardButton.svg?style=flat)](https://cocoapods.org/pods/keyBoardButton)
[![License](https://img.shields.io/cocoapods/l/keyBoardButton.svg?style=flat)](https://cocoapods.org/pods/keyBoardButton)
[![Platform](https://img.shields.io/cocoapods/p/keyBoardButton.svg?style=flat)](https://cocoapods.org/pods/keyBoardButton)

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements

## Installation

keyBoardButton is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'keyBoardButton'
```

## Author

shrutiP1<EMAIL_ADDRESS>
## License

keyBoardButton is available under the MIT license. See the LICENSE file for more info.