text:
## VGA hdDMD PyProcGame Fork

A "VGA hdDMD" fork of PyProcGame.  Traditional DMD support has been
broken in favor of supporting LCD based DMD hardware; 24-bit (RGB)
frames with a resolution that may be set higher than 128x32:
256x128 has been used successfully with dotfilter; I'm using 480x240
currently, but the hardware requirements are non-trivial. You are
strongly recommended to turn off the dotfilter at resolutions higher than
256x256.

NOTE: this relies on PyGame; it will not work with Pyglet.

There are a few ways to pick up performance:
Turn off the dot_filter, turn on the fullscreen, drop the scale factor, and/or
drop the framerate (manually, in two files).

You will need to put the dmdgrid32x32.png file somewhere, and that somewhere
must be specified in the config.yaml file.

You will need to change your config.yaml to include the following lines:

	# all of this is for the hdDMD
	use_virtual_dmd_only: True
	dmd_grid_path: C:\P-ROC\shared\
	dmd_dots_w: 480
	dmd_dots_h: 240
	dmd_dot_filter: False
	dmd_fullscreen: False
	desktop_dmd_scale: 4

## pyprocgame

pyprocgame is a high-level pinball development framework for use with P-ROC (Pinball Remote Operations Controller).  It was written by Adam Preble and Gerry Stellenberg.  More information about P-ROC is available at [pinballcontrollers.com](http://pinballcontrollers.com/).  See the [pyprocgame site](http://pyprocgame.pindev.org/) for the full pyprocgame documentation.

## Prerequisites

pyprocgame requires the following:

- [Python 2.6](http://python.org/)
- [pypinproc](http://github.com/preble/pypinproc) -- native Python extension enabling P-ROC hardware access and native DMD frame manipulation.
- [setuptools](http://pypi.python.org/pypi/setuptools) -- required for procgame script installation.  Also adds easy\_install, a helpful installer tool for popular Python modules.
- [pyyaml](http://pyyaml.org/) -- YAML parsing.
- One of the Python graphics and sound modules:
  - [pyglet](http://www.pyglet.org/)
  - [pygame](http://www.pygame.org/)
- [Python Imaging Library](http://www.pythonware.com/products/pil/) (PIL)

## Installation

To install pyprocgame: (depending on your system configuration you may need to use _sudo_)

	python setup.py install

This will install pyprocgame such that you can import it from any Python script on your system:

	import procgame.game

It will also install the "procgame" command line tool into a system-dependent location.  On Linux and Mac OS X systems this will probably be in your path such that you can type, from the command line:

	procgame

and see a list of available commands.  If it is not in your path you can invoke it directly, or modify your PATH environment variable.  Note that on Windows the procgame script is typically located in C:\Python26\Scripts.

## Documentation

Please see the [pyprocgame Documentation](http://pyprocgame.pindev.org/) site for the pyprocgame Manual and detailed API documentation.

## License

Copyright (c) 2009-2011 Adam Preble and Gerry Stellenberg

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: mjocean/FullColor-hdDMD-pyprocgame

extension: markdown

repo_name: mjocean/FullColor-hdDMD-pyprocgame


text:
# AxSQLServerCe Module

This module enables creating, editing and reading SQL Server CE files.

## Install AxSQLServerCe Module

The module is on the Powershell Gallery and can be installed by running

```Powershell
PS C:\> Install-Module AxSQLServerCe -Scope CurrentUser
```

## Usage instructions

See the integrated help

```Powershell
PS C:\> help Connect-SdfFile
```

## Description

This module is used for creating and using SQL Server CE databases. It facilitates interaction with the sdf file without the need for installing any other tools apart from this module. Often used queries can be saved in different categories and reused. Variables are supported in saved queries.

## AxSQLServerCe Cmdlets

### [Connect-SdfFile](docs/Connect-SdfFile.md)

Connect to a SQL Server CE file.

### [Invoke-SdfCmd](docs/Invoke-SdfCmd.md)

Executes a T-SQL command against a SQL Server CE file

### [New-SdfFile](docs/New-SdfFile.md)

Create a new SQL Server CE Database

### [Set-SavedQuery](docs/Set-SavedQuery.md)

Adds a saved TSQL query to the module. If this module is installed in a global module path, it requires administrator privileges to update queries or the saved queries path. If the module is installed in the current users module path, current access rights suffice.

license: MIT

repository: Agazoth/AxSQLServerCe

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: Agazoth/AxSQLServerCe


text:
## The Problem
A new website allows football fans to watch games online. Users like the service as there is no monthly subscription fees, instead they can pay for just the games they want to watch.

The website owners would like to work out which team each user supports so that they know who to send specific team-based marketing emails to. At present they have a list of games watched for each user like this:

    Manchester Utd v Liverpool
    Liverpool v Southampton
    Liverpool v Stoke
    Chelsea v Liverpool

It is easy for humans to work out the likely team that this user supports - it's probably Liverpool as they feature in every game.

## Task
Write a program that will work out the team most likely supported by the user. An array of games watched has been provided for you in `main.py`

## Extension
Create a text file with the match data instead of using an array. Your program should then read from the file.

Don't forget to change the data in the file to test your program works with different data.


text:
# OpenSource Hardware

## Git Repositories
- [hardware (Schematic, Gerber, CAD, BOM)](https://github.com/ROBOTIS-GIT/XelNetwork_Hardware)

---

## Specification
### SensorXEL
![](_static/sensorxel_rev_f.png)

|Item|Description|
|:-:|:-:|
|MPU | STM32L151C8T6-A|
|Operation Voltage/Current | 12V ~ 24V / MAX 10A|
|I/O Voltage | 3.3V(500mA)|
|Flash | 64KB|
|SRAM | 32KB|
|EEPROM | 4KB|
|Clock | 32MHz|
|USART | 3/3|
|SPI | 1/2|
|I2C | 1/2|
|Debug | SWD, USART|
|Dynamixel Connector | TTL x 2 / RS-485 x 2 (JST)|
|Power | Dynamixel Connector|
|Dimensions | 44mm x 44mm|

### PowerXEL
![](_static/powerxel_rev_f.png)

  - The main function is power management. It is possible to shut off the power of TTL and RS485 by software and monitor the power and current supplied from external power source in 0.01V, 0.1A unit.
  - External power can be connected via SMPS, Terminal Block, and BAT connector. At this time, the recommended maximum voltage is 24V.
  - For immediate power off, Jumper CAP is inserted in 2-pin so that Emergency Switch can be attached. To use the Emergency Switch, you need to provide Jumper CAP and connect it to both pins.

|Item|Description|
|:-:|:-:|
|MPU | STM32L151C8T6-A|
|Operation Voltage/Current | 12V ~ 24V / MAX 10A|
|Flash | 64KB|
|SRAM | 32KB|
|EEPROM | 4KB|
|Clock | 32MHz|
|USART | 2/3|
|Debug | SWD, USART|
|Dynamixel Connector | TTL x 2 / RS-485 x 2 (JST)|
|Power | Dynamixel Connector, SMPS, Terminal block|
|Dimensions | 44mm x 48mm(w/o.USB 44)|

#### CommXEL-W
![](_static/commxel_w_rev_c.png)

  - It is an important part of creating and processing topics from XEL Network to ROS 2, and it features WiFi.

|Item|Description|
|:-:|:-:|
|MPU | [ESP32 WROOM 32D](https://www.espressif.com/en/products/hardware/esp32/overview)|
|Operation Voltage/Current | 12V ~ 24V / MAX 10A|
|Flash | SPI 4MB|
|SRAM | 520KB|
|Clock | 240MHz|
|WiFi | 1/1|
|BLE | 1/1|
|USART | 3/3|
|Debug | USART|
|External I/O | 20/40|
|Dynamixel Connector | TTL x 2 / RS-485 x 2 (JST)|
|Power | Dynamixel Connector|
|Dimensions | 44mm x 45mm(w/o.USB 44)|

#### CommXEL
![](_static/commxel_rev_e.png)
  - It is an important part of creating and processing topics from XEL Network to ROS 2, and it features an Ethernet port and a USB port.

|Item|Description|
|:-:|:-:|
|MPU | STM32F746ZGT6|
|Operation Voltage/Current | 12V ~ 24V / MAX 10A|
|Flash | 1MB|
|SRAM | 320KB|
|Clock | 168Mhz for baudrate (up to 216MHz)|
|ETHERNET | 1/1|
|USB | 1/1|
|USART | 2/4|
|Debug | SWD, USART|
|Dynamixel Connector | TTL x 2 / RS-485 x 2 (JST)|
|Power | Dynamixel Connector|
|Dimensions | 76.7mm x 45mm(w/o.USB 44)|

---

## PinMap

### SensorXEL
![](_static/pinmap_sensorxel_rev_f_1.png)
![](_static/pinmap_sensorxel_rev_f_2.png)

### PowerXel
![](_static/pinmap_powerxel_rev_f.png)

### CommXEL-W
![](_static/pinmap_commxel_w_rev_c.png)

### CommXEL
![](_static/pinmap_commxel_rev_e.png)


text:
---
weight: 24
title: "Servant Register"
---

## Servant Register:
```go
// file: servants/servants.go

package servants

import (
	"github.com/alimy/mir-example/v4/mirc/auto/api"
	"github.com/gin-gonic/gin"
)

// RegisterServants register all the servants to gin.Engine
func RegisterServants(e *gin.Engine) {
	api.RegisterUserServant(e, newUserSrv())

	// TODO: some other servant to register
}
```

repository: alimy/mir

branch_name: refs/heads/main

gha_language: Go

repo_name: alimy/mir


text:
Changelog
=========

# 2.x

## 2.1.x

### 2.1.0

- Now compatible with all versions of Node.js ([PR #22](https://github.com/patrick-steele-idem/child-process-promise/pull/22) by [@olsonpm](https://github.com/olsonpm) with modification)

## 2.0.x

### 2.0.1

- Minor cleanup

### 2.0.0

#### Major changes

- Switched from [q](https://github.com/kriskowal/q) to [native ES2015 promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
- This module now uses various ES2015 functionality only available in Node.js 4.0+
- Despite the major version being incremented, `v2.x` maintains backwards compatibility with `v1.x`

#### Breaking changes

- This library now requires Node.js 4.0+
    - If you are using Node.js <4 you should use<EMAIL_ADDRESS>
# 1.x

- Initial release

gha_language: JavaScript


text:
---
title: Normalization
---

In statistics and applications of statistics, normalization can have a range of meanings.
In the simplest cases, normalization of ratings means adjusting values measured on different scales to a notionally common scale, often prior to averaging.
In more complicated cases, normalization may refer to more sophisticated adjustments where the intention is to bring the entire probability distributions of adjusted values into alignment.

Harp-DAAL currently supports batch mode of normalization for dense input datasets, and it
provides two algorithm kernels.

## Min-max

Min-max normalization is an algorithm to linearly scale the observations by each feature (column) into the range [a, b].

More algorithmic details from Intel DAAL documentation is [here](https://software.intel.com/en-us/daal-programming-guide-min-max).

## Z-score

Z-score normalization is an algorithm to normalize the observations by each feature (column).

More algorithmic details from Intel DAAL documentation is [here](https://software.intel.com/en-us/daal-programming-guide-z-score).

repository: kyhhdm/harp

repo_name: kyhhdm/harp


text:
# TTISS

## List of elements and where they are to be changed

|Element Name | REDCap or Form|
|-------------|---------------|
|Element 1 | Form |
|Element 2 | Form |
|Element 3 | REDCap|


text:
WAT Version 5.0.0

## 15 November 2019:
- Added Official Chagelist

## 16 Novemeber 2019:

- Commit #6efd2386020ef25acd26070fccb5266e37471cc9 - Temp folder is now created per test run

    Temp Folder is now created each time we run the tests. Previously it
    was only created on plugin load which caused some 404 errors. It checks
    now just in case.

- Commit #98cc2de800d64bec389792ee25a25f80149da782 - Add exit codes to CLI

    Previously we were only printing 0 & 1 so it didn't work properly with CI. It should
    work fine now though!

## 17th Novemeber 2019

- commit 5f04ea965083c82681ddb948c332989502566e0f

    Move Call To Quit in CLI.gd

    The CLI's init function was to run and then to quit. This caused issues
    when we yielded because we kept going back to quit before finishing. We've
    moved quit to execute after we handle results.

## 14th December 2019

- Merged https://github.com/CodeDarigan/WAT/pull/47

    Change UI Screen

    UI Panel moved to the bottom panel to help prevent unnecessary context switching.
     To use this
    extend WAT.TestSuite and then create inner classes that extend WATTest / WAT.Test

- Introducing WAT namespace (commit commit 4af35f304d1fff34e735fc3373f230f0a20d6216)

    This allows us to define a central place for tests you
    extend from. Basically you can now "extends WAT.Test"
    rather than "extends WATTest".

    We encourage users to WAT.Test as WATTest will be deprecated
    come version 5.0

### 3.2 Compatability Fixes

- Fix Name Conflict: to_string is no longer valid because of a builtin method in Godot

- Fix Double Writer

- until_signal/timeout now use the CONNECT_DEFERRED flag to avoid locks

## 24th December (Working on Xmas Eve! You better appriciate this!)

 WAT would sometimes crash, as
    in segfault with a core memory dump, on Linux when using test double mechanisims.

    This was largely in part due to how we were handling static data by saving the containers
    as a resource. It seems creating multiple of these caused criss-cross memory issues.

    So now instead we append the container to a const collection on the test double instead. This
    is valid for now but we may have to update it come 4.0 but for now it is okay.

## 27th December

- Add Script Template Generator (commit  219bcb3)

    You can define your own templates in Godot 3.2. WAT now includes a button that will add
    a WAT Template to your script_templates folder (if it isn't already created, WAT will
    create it)

## 28th December

- Refactor Test Doubles to be created in memory instead of saved in the filesystem (commit 266bbd)

    After writing the test double script implementation we now use script.reload() to
    have the implementation loaded into memory. From here we can instance it. So we
    no longer have to rely on the filesystem to create test doubles. This should
    significantly improve performance if you were heavy on test doubles beforehand.

# 20th January

The Holidays are over but friends do I have a gift for you!

- WAT now runs in the scene context!

    Don't worry! As a user you will still be using WAT through the Editor Interface but I did some trickery behind
    the scenes which means when you click run WAT will now run in the Scene context (as if it were a game) instead of
    the Editor context. This is important for two HUGE reasons;

        1. Autoloads do not exist for the editor. Only for the games in Godot! This change now allows the use of autoloads
        within tests. I'll leave it up to you to decide if that's good or not!

        2. You can now debug your tests! If a test is giving you trouble, you can set two breakpoints between the start and end of it
        to thoroughly debug it! Similar to Autoloads previously, you couldn't access debugging features in the tests (you also couldn't
        use methods like get_stack(), print_stack() or print_debug() but you can now). I can't express to you just how excited I am
        about how much more useful this makes WAT.

- Command Line Interface is now a Scene

    With the changes made to WAT on the visual end to run as a scene. I wanted the same ability for the CLI. So I've changed
    it to a scene. You still use it in the exact same way except no need for the prefixed -s and of course .gd becomes .tscn.

    You can debug command line tests by adding in -d option

        .e.g godot -d addons/WAT/cli.tscn -run_script="res://test/unit/mario.jump.test.gd"

- Yields can now be used in all of the virtual methods in test

    The test controller has been reworked into something of a state machine that can be influenced by the yielder. Essentially
    this means you can now yield in start(), pre(), post() and end() as well as test methods. You can also yield as many times
    as you like without issue!

- Added an "Expand Failures" option

    This expands all failure-based methods (right down to their base details) while collpsing all 100% passed tests, so you
    can get straight to the heart of the problem immediatly!

- Renamed TestSuite to TestSuiteOfSuites

    I've been reading a lot of xUnit Test Patterns by Gerard Mezaros. I'm trying to round out WAT's lexicon to be similair so
    this is something of a start. If Godot ever gets namespaces, it would be a lot easier!

- Give ResultsView a Minimum Height

    Mainly so you don't have to keep dragging it up every time you open it.

## UPCOMING RELEASE NOTES BELOW

# 29th January

- Add Go To Method In Results Display

    On the right side of the results display after running a test, you can click a function (fn) icon symbol and it will open the script
    editor to that method (approximately)

- Added Subcall To Doubled Methods

    You can pass in a FuncRef or an object with a call_func method that takes an object and an array of arguments and then pass that in to be subcalled
    when a test doubled method is called. This can be useful if you want to get some indirect access to state or have a tighter control over where you
    want the call branch to go.

# Feb 1st

- Add Links

    Added four links, one that points to documentation (hopefully update), one to post an issue directly to github, another
    to post a doc request to github and finally one to my Ko-Fi if you want to help me improve WAT (to make a living from this, one
    can dream)

# Feb 5th

- Add assert.fail(context = "")

    An assertion that always fail (along with an error message) for non implemented tests.

# Feb 6th

- Yielding now returns an array of six values

    yield(until_signal()) or yield(until_timeout()) now returns an Array of up to 6 values. If you're expecting a single return
    value it is element 0, if you're expecting an array or dictionary return value, it is nested. Any values you're not expecting should
    be defaulted to null.

# Feb 7th

- Add QuickPlay Button

    Add a QuickPlay Button to allow you to run all your tests very quickly

- You can now change the dock position via a list of choices ProjectSettings/WAT/Display that updates in real time

# March 9th 2020

- Add Signal Was Emitted X Times

# March 23 2020

- Users can now double built in classes

    You can now double a built in class by passing in a string of that class name to the first argument of the direct.script()
    method. I don't know if you need this but WAT did for the change below so I got added.

- Double All Nodes In A Scene

    Previously when doubling a scene, I would only double the nodes with a script which caused problems internally when people
    were trying to access methods like is_on_floor on a KinematicBody2D that store its functional code outside of it. Now I double
    everything to make sure this doesn't happen.

# 5th April 2020

- Add Object Assertions

    Add an assertion per boolean method (except can_translate()) in the object API. Likely won't be doing this for other classes.

# 6th April

- Add Assert.That

    I was initially planning on wrapping every single boolean method in Godot but that is honestly just too much. So Instead I've created
    assert that that takes an object, a string method of that object, any additional arguments and tries its best to make a custom assertion on
    command. In addition to this you can add your own custom success and failure messages in it along with the usual context string.

- Remove crash on failure

    I don't think anybody knew this but in older versions of WAT you could intentionally crash scripts if a precondition failed.
    I've removed this for now but it may come back later.

# 7th April 2020

- Added JUnit XML (for the continous integration afficnados)

    Test Results are now saved as JUnit XML which is fairly standard for a number of other testing related software. It can
    be especially useful when using Continous Integration to give a nicer view than WAT's output print.

    You can edit where this is stored in ProjectSettings/WAT/Results_Directory

# 8th April 2020

- Dependencies can now be passed on double

    Instead of passing dependecies when directing a script, you can now pass them in when calling double on a
    director instead. This will only work if you didn't pass them in already.

# 11th April 2020

- Automate Spying On Test Double Methods

    There wasn't any real reason for this to not exist. Users could simply choose to ignore it if they didn't need it
    but it does no harm by existing (and on a personal note it has tidied up core code)

# 15th April 2020

- Fix Parameterized Testing Bug

    Parameterized Tests were broken so that a script with one test didn't work. This has now been fixed.

# 19th April 2020

- Remove More Options From GUI

    Print Stray Nodes wasn't working and we will be adding a WAT Template if it doesn't already exist on PluginLoad.

- Scene/Script Directors now return the same double on call

    Null is bad so this was our second best option. Directors will return the same double if they call double any time after
    the first time they called double)

- GUI now stays on Results Screen

    When using the WAT GUI it now stays on the test results screen instead of being moved to the output panel. You can still move
    out of this manually but it doesn't do it by default anymore

# 24th April 2020

- Add Recorder Object To Test Script

    By passing the object you're tracking along with an array of properties on that Object as a String, you can now record their changes
    once per process call. Obviously this isn't perfect and it can screw with reference or shallow objects (like dictionaries etc)

- Describe Is Now Optional

    Describe is now an optional choice. If you choose not to use it your test will use the method named (formatted to look pretty) instead (and now
    if you forget describe your tests won't crash)

- Assertion Context is Now Optional

    Previously for the GUI to make visual sense you would have to have added a context String to your assertion. No longer. Now you can omit it entirely and assuming
    all of your context strings are blanks for each assertion in that one test your test will be collapsed immediatly.

- Add Tagged Tests

    You can add tags to your tests. When you click on a WAT.Test Script, an inspector plugin should open with the dropdown to "add tag" which chooses from a list of tags
    you've defined in WAT/Settings/Tag. You can run these tags via the tag selector afterwards. The system that uses this is smart so it should be able to track when you moved
    a tagged test script to a different area of the test directory. Meaning that your tests no longer require an obvious filepath

# 25th April

- Tests can be repeated x times

    In both the GUI & CLI you can now repeat the test x times. Everything will loop until done and the results will appear (duplicate tests
    will have duplicate results)

- You can now run single methods

    Add a + option button to the GUI to show a test method selector you can use to now run seperate tests methods

- You can rerun failures

    This will always rerun the very last failures (even inbetween sessions)

repository: paulhocker/WAT

gha_license_id: MIT

repo_name: paulhocker/WAT


text:
# tinyc2-tests
Multiple test/example C++ files for [tinyc2](https://github.com/randygaul/tinyheaders).

## Requirements
* [SFML 2.4.x](https://github.com/sfml/sfml)
* [premake5](https://premake.github.io) (optional)

## How to use
`tinyc2-tests` is using [premake5](https://premake.github.io) to assist the generation of cross platform make/project files. To compile all the tests using `premake5` run the following command:
```sh
premake5 <action> && cd build && make
```
Where `<action>` specifies your build tools (e.g. 'gmake' for Gnu make or 'vs2013' for Visual Studio 2013). For further help on using premake visit the [official documentation](https://github.com/premake/premake-core/wiki/Using-Premake).
After the build has finished, you can find all the binaries inside `build/bin/{Debug/Release}/`.

## Manual installation
As `tinyc2.h` is included with `tinyc2-tests` you only need to install and link against `SFML 2.4.x`. For Linux a simple g++ command should suffice:
```sh
g++ circle/CircleToCircle.cpp -I. -lsfml-graphics -lsfml-window -lsfml-system
```

## Controls
Used `wasd` to move the shape across the screen (not working for `PolygonToX` yet). For `RayToX` tests the ray's direction can be manipulated by moving the mouse.

## License
`tinyc2-tests` uses the same license as `tinyheaders`, the [zlib license](https://www.zlib.net/zlib_license.html).

license: Zlib


text:
# Grav Shortcode Core Plugin

## About

The **Shortcode Core** plugin allow for the development of simple yet powerful shortcode plugins that utilize the common format utilized by **WordPress** and **BBCode**. The core plugin loads the libraries required and fires a new event that other plugins can use.  It also provides a mechanism for adding CSS/JS assets that are cached so that shortcodes can work effectively even when the processed page content is cached.  This ensures that shortcodes are only processed once and will not impact performance by doing unnecessary work on every page.

This plugin uses the [Thunderer Advanced shortcode engine](https://github.com/thunderer/Shortcode). For more information please check out that repo on GitHub.

## Quick Example

```
This is some [u]bb style underline[/u] and not much else

[center]This is centered[/center]

This is [size=30]bigger text[/size] and this is [color=blue]blue text[/color]
```

This example functionality is provided with the **Shortcode Core** plugin to provide some functionality that is not available in traditional markdown but is standard **BBCode** used in many form platforms.  You can see how the syntax is just a simple open and close element using square brackets.

This will render:

![](assets/shortcode-core-1.png)

The core plugin required for any other shortcode specific plugin. Provides some basic BBCode style syntax such as underline, color, center, and size.

## Installation

Typically a plugin should be installed via [GPM](http://learn.getgrav.org/advanced/grav-gpm) (Grav Package Manager):

```
$ bin/gpm install shortcode-core
```

Alternatively it can be installed via the [Admin Plugin](http://learn.getgrav.org/admin-panel/plugins)

> NOTE: If you install a shortcode plugin such as [grav-plugin-shortcode-ui](https://github.com/getgrav/grav-plugin-shortcode-ui) it may have this core plugin configured as a dependency and install it automatically.

## Configuration Defaults

The **Shortcode Core** plugin only has a few options to configure.  The default values are:

```yaml
enabled: true
active: true
active_admin: true
admin_pages_only: true
parser: regular
include_default_shortcodes: true
css:
  notice_enabled: true
custom_shortcodes:
fontawesome:
  load: true
  url: '//maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css'
  v5: false
```

* `enabled: true|false` toggles if the shortcodes plugin is turned on or off
* `active: true|false` toggles if shortcodes will be enabled site-wide or not
* `active_admin: true|false` toggles if shortcodes will be processed in the admin plugin
* `admin_pages_only: true|false` toggles if admin should only process shortcodes for Grav pages
* `parser: wordpress|regex|regular` let's you configure the parser to use
* `include_default_shortcodes: true|false` toggle the inclusion of shortcodes provided by this plugin
* `custom_shortcodes:` the path to a directory where you can put your custom shortcodes (e.g. `/user/custom/shortcodes`)
* `fontawesome.load: true|false` toggles if the fontawesome icon library should be loaded or not
* `fontawesome.url:` the CDN Url to use for fontawesome
* `v5:` Version 5 flag as it requires some additional logic

> NOTE: In previous versions the `wordpress` parser was preferred.  However with version `2.4.0`, the `regex` parser is now default.  If you have saved configuration, you should manually change this to `regex` or you may receive errors or bad output.

## Configuration Modifications

The best approach to make modifications to the core plugin settings is to copy the `shortcode-core.yaml` file from the plugin into your `user/config/plugins/` folder (create it if it doesn't exist).  You can modify the settings there.

> NOTE: If you have the admin plugin installed, you can make modifications to the settings via the **Plugins** page and it will create that overridden file automatically.

## Per-Page Configuration

Sometimes you may want to only enable shortcodes on a _page-by-page_ basis.  To accomplish this set your plugin defaults to:

```yaml
enabled: true
active: false
```

This will ensure the plugin is loaded, but not **active**, then on the page you wish to process shortcodes on simply add this to the page header:

```yaml
shortcode-core:
    active: true
```

This will ensure the shortcodes are processed on this page only.

You can also change the parser on a particular page with the following:

```yaml
shortcode-core:
    parser: regex
```

## Available Shortcodes

The core plugin contains a few simple shortcodes that can be used as basic examples:

#### Underline

Underline a section of text

```
This is some [u]bb style underline[/u] and not much else
```

#### Font Size

Set the size of some text to a specific pixel size

```
This is [size=30]bigger text[/size]
```

#### Left Align

Left align the text between this shortcode

```
[left]This text is left aligned[/left]
```

#### Center Align

Center a selection of text between this shortcode

```
[center]This text is centered[/center]
```

#### Right Align

Right align the text between this shortcode

```
[right]This text is right aligned[/right]
```

#### Div

Allows you to wrap markdown in an HTML `div` tag that supports both `id` and `classes` attributes

```
[div class="text-center"]
This text is **centered** aligned
[/div]
```

or

```
[div class="table table-striped"]
| header 1 | header 2 |
|----------|----------|
| A 1      | B 1      |
| A 2      | B 2      |
| A 3      | B 3      |
[/div]
```

#### Headers

Allows you to add `id` and `class` attributes to HTML `h1` through `h6` tags:

```
[h1 class="major"]This is my title[/h1]
```

#### Span

Allows you to wrap markdown in an HTML `span` tag that supports both `id` and `class` attributes

```
[span class="text-center"]
This text is **centered** aligned
[/span]
```

#### Columns

Take advantage of powerful CSS columns support by using this shortcode

```
[columns]
### Headline

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.
[/columns]
```

Defaults to 2 columns.  You can also explicitly set the number of `columns`, `width`, `gap`, and `rule` styling for the column divider:

```
[columns count=3 width=200px gap=30px rule="1px dotted #930"]
### Headline

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.
[/columns]
```

#### Raw

Do not process the shortcodes between these raw shortcode tags

```
[raw]This is some [u]bb style underline[/u] and not much else[/raw]
```

#### Safe-Email

Encode an email address so that it's not so easily 'scrapable' by nefarious scripts.  This one has a couple of options: `autolink` toggle to turn the email into a link, an `icon` option that lets you pick a font-awesome icon to prefix the email, and a `subject` option that let's you specify the subject line for the user's mail agent to prefill.  All settings are optional.

```
Safe-Email Address: [safe-email autolink="true" icon="envelope-o"<EMAIL_ADDRESS>```

#### Section

The **section** shortcode is a powerful way to encompass some text in your markdown page with a `[section][/section]` tag and then this is cached by Grav so it can be accessed later.  For example you could have a page with a variety of sections described in it that let you create many **chunks** of data. These are then added to Twig as an array of shortcode objects.  An example of this would be the following markdown:

```
[section name="author"]
![](author.jpg?cropResize=100,100&classes=left)
### Johnny Appleseed
Johnny Appleseed was an American pioneer nurseryman who introduced apple trees to large parts of Pennsylvania, Ontario, Ohio, Indiana, and Illinois, as well as the northern counties of present-day West Virginia. He became an American legend while still alive, due to his kind, generous ways, his leadership in conservation, and the symbolic importance he attributed to apples.
[/section]

[section name="quote"]
> Some are born great, some achieve greatness, and some have greatness thrust upon them.
  Read more at http://www.brainyquote.com/quotes/topics/topic_great.html#tdqt3strtEYBCH43.99
> <cite>William Shakespeare</cite>

Regular **Markdown** content that will be output as `page.content`
[/section]
```

This we be removed from the page content and made available in Twig variables so you could insert these into custom HTML structures, for example:

```
<div id="author">{{ shortcode.section.author }}</div>

<div id="article">
    <div class="left">
        {{ page.content|raw }}
    </div>
    <div class="right">
        {{ shortcode.section.quote }}
    </div>
</div>
```

#### Sections from other pages

You can even retrieve a section from another page utilizing the shortcodes as they are stored in the page's `contentMeta` with this syntax:

```
<div id="author">{{ page.find('/my/custom/page').contentMeta.shortcodeMeta.shortcode.section.author }}</div>
```

#### Notice

A useful shortcode that performs a similar job to the [markdown-notices](https://github.com/getgrav/grav-plugin-markdown-notices) plugins, allows you to easily create simple notice blocks as seen on http://learn.getgrav.org and http://getgrav.org.  To use simply use the following syntax:

```
[notice]
Your **Markdown** text that will appear in the notice
[/notice]
```

You can also specifically choose from `note`, `info`, `warning`, `tip` types which provide unique color options:

```
[notice=warning]
Danger Will Robinson! Danger, Will Robinson!
[/notice]
```
#### Figure

Figure elements are the recommended way to add self-contained units of flow content, i.e. images, charts and other visual elements that can be moved away from the main flow of the document without affecting the document's meaning. Figures may include captions through the `caption` attribute. Both `id` and `class` attributes are also available.

```
[figure id="fig1" class="image" caption="**Fig. 1** A beautiful figure."]
![Gorgeous image](image.png)
[/figure]
```

#### Mark

The HTML `<mark></mark>` tag is extremely useful to highlight text in your pages, and serves like a highlighter pen.  However, as we know that markdown inside of HTML is not processed, using this HTML is often not convenient as it means markdown inside will not be processed.

Another important usecase is trying to highlight code in a markdown text block, again the HTML tag doesn't work because the result is escaped and treated like any other code and simply displayed.

The solution is simple, just use the shortcode version instead:

```
This is a sample of text [mark]with this bit **highlighted** with _markdown_ syntax[/mark] and the rest just plain.
```

You can also use the `class` option to specificy a specific a CSS class to add to the `<mark>` HTML tag (useful to color the marked output):

```
This is a sample of text [mark class=blue]with this bit **highlighted** with _markdown_ syntax[/mark] and the rest just plain.
```

It also works great in code blocks:

```
<?php
class Pipeline extends PropertyObject
{
    use AssetUtilsTrait;

    [mark]protected const CSS_ASSET = true;[/mark]
    protected const JS_ASSET = false;

    ...
}
```

You can also pass an option `style` attribute of `block` to get a full lines highlighted:

```
<?php
class Pipeline extends PropertyObject
{
    use AssetUtilsTrait;

    [mark style=block]
    protected const CSS_ASSET = true;
    protected const JS_ASSET = false;
    [/mark]

    ...
}
```

#### Language

Hooks into Grav's multi-language capabilities to allow you to show certain blocks of code only for the current active language.

```
[lang=en]
Or kind rest bred with am shed then.
[/lang]

[lang=fr]
Marche diable ombres net non qui.
[/lang]

[lang=de]
Genie dahin einem ein gib geben allen.
[/lang]
```

#### FontAwesome

[FontAwesome](https://fortawesome.github.io/Font-Awesome/) is a powerful library of font-based icons.  This shortcode makes it simple to add fontawesome icons to your page content without using HTML.

```
[fa=cog /] Simplest Format

[fa=fa-cog /] Format using `fa-` prefix

[fa icon=fa-camera-retro /] Explicit format

[fa icon=fa-grav extras=fab /] Font Awesome 5 format

[fa icon=fa-camera-retro extras=fa-4x /] Explicit format with extras - [See FontAwesome Examples](https://fortawesome.github.io/Font-Awesome/examples/)

[fa icon=fa-circle-o-notch extras=fa-spin,fa-3x,fa-fw,margin-bottom /] The full monty! - [See FontAwesome Examples](https://fortawesome.github.io/Font-Awesome/examples/)
```

#### Details/Summary

The `<details>` element provides a simple show/hide behaviour without JavaScript, and can optionally contain a `<summary>` element that is always shown. Clicking on the summary text toggles the visibility of the content, and when a summary is not provided, it defaults to "Details". The element can be used to provide extra details, or can be combined into an accordion-like structure.

```
[details]
Lorem ipsum dolor sit amet...
[/details]

[details="Summary text"]
Lorem ipsum dolor sit amet...
[/details]

[details summary="Summary text" class="accordion"]
Lorem ipsum dolor sit amet...
[/details]
```

**Note:** The show/hide behaviour is not supported in IE 11 or Edge 18, and the element will be permanently open. You can check the current status of browser compatibility at [Can I Use](https://caniuse.com/#search=details).

#### Lorem Ipsum

Useful for faking content, you can use a shortcode to quickly generate some random "lorem ipsum" text:

**Paragraphs:**
```
[lorem=5 /]

[lorem p=5 tag=div /]
```

**Sentences:**
```
[lorem s=4 /]
```

**Words:**
```
[lorem w=35 /]
```

## Using Shortcodes in Twig

You can now use shortcodes in Twig templates and process them with the `|shortcodes` filter. For example:

```
{% set twig_text = "This is [size=30]bigger text[/size] and this is [color=green]green text[/color]" %}
{{ twig_text|shortcodes }}
```

## Custom Shortcodes

### Simple Way

First, configure a directory from which custom shortcodes are loaded. Edit `user/config/plugins/shortcode-core.yaml` like follows (create it if it does not exist):

```yaml
custom_shortcodes: '/user/custom/shortcodes'
```

To add a custom shortcode, create a PHP file that defines a new shortcode class. For example, to create a shortcode for ~~strikethrough~~ text, save the following code as `user/custom/shortcodes/StrikeShortcode.php`:

```php
<?php
namespace Grav\Plugin\Shortcodes;

use Thunder\Shortcode\Shortcode\ShortcodeInterface;

class StrikeShortcode extends Shortcode
{
    public function init()
    {
        $this->shortcode->getHandlers()->add('strike', function(ShortcodeInterface $sc) {
            return '<del>'.$sc->getContent().'</del>';
        });
    }
}
```

Note that the class name (`StrikeShortcode`) must match the file name for the shortcode to work.

`[strike]text[/strike]` should now produce strikethrough text.

### As a Custom Plugin

The more flexible approach is to create a custom plugin.

The **Shortcode Core** plugin is developed on the back of the [Thunderer Advanced Shortcode Engine](https://github.com/thunderer/Shortcode) and as such loads the libraries and classes required to build third party shortcode plugins.

We introduced a new event called `onShortcodeHandlers()` that allows a 3rd party plugin to create and add their own custom handlers.  These are then all processed by the core plugin in one shot.

```php
    public static function getSubscribedEvents()
    {
        return [
            'onShortcodeHandlers' => ['onShortcodeHandlers', 0]
        ];
    }
```

Then you just need to listen to the event:

```php
    public function onShortcodeHandlers()
    {
        $this->grav['shortcode']->registerAllShortcodes(__DIR__.'/shortcodes');
    }
```

Lastly create your shortcode in the `user/plugins/my-plugin/shortcodes/` folder, in this example we created a simple `[red][/red]` shortcode as `RedShortcode.php`:

```php
<?php
namespace Grav\Plugin\Shortcodes;

use Thunder\Shortcode\Shortcode\ShortcodeInterface;

class RedShortcode extends Shortcode
{
    public function init()
    {
        $this->shortcode->getHandlers()->add('red', function(ShortcodeInterface $sc) {
            return '<span style="color:red;">'.$sc->getContent().'</span>';
        });
    }
}
```

> If you have not already done so, I suggest reading the [Grav Plugin Tutorial](http://learn.getgrav.org/plugins/plugin-tutorial) first to gain a full understanding of what you need to develop a Grav plugin.

The best way to see how to create a new shortcode-based plugins is to look at the **Shortcode UI** plugin that extends the **Shortcode Core** by adding more shortcodes.  It also makes use of Twig to handle processing and has some more advanced shortcode techniques.

* Core Plugin: https://github.com/getgrav/grav-plugin-shortcode-ui/blob/develop/shortcode-ui.php
* Tabs Shortcode Example: https://github.com/getgrav/grav-plugin-shortcode-ui/blob/develop/shortcodes/TabsShortcode.php
* Color Shortcode Example: https://github.com/getgrav/grav-plugin-shortcode-core/blob/develop/shortcodes/ColorShortcode.php
* Section Shortcode Example: https://github.com/getgrav/grav-plugin-shortcode-core/blob/develop/shortcodes/SectionShortcode.php
* Section Prism Highlight Example: https://github.com/trilbymedia/grav-plugin-prism-highlight/blob/develop/shortcodes/PrismShortcode.php

## Processing Shortcodes Before or After Markdown processing

There are basically two ways of processing a shortcode:

1. After markdown is processed
2. Before markdown is processed

These two approaches are important because, for the most part, shortcodes make more sense when they can 'wrap' markdown, so they process **after** markdown.

For example a `[div][/div]` shortcode would be useless if it ran before markdown is processed because it would add the relevant HTML `<div></div>` tags, and then the markdown parser would promptly **skip** all markdown processing between those divs because it won't process markdown **inside** HTML. So this shortcode and most others run after markdown processing has already occurred using this approach:

```php
$this->shortcode->getHandlers()->add('div', function(ShortcodeInterface $sc) { ... }
```
Notice the `getHandlers()` call is the standard way to add a handler.

However, there are situations when you need to process the shortcode **before** the markdown processing to ensure markdown **is skipped**, like in the example of a code block. This is why in the [Prism Highlighter](https://github.com/trilbymedia/grav-plugin-prism-highlight) plugin, we use this approach to defining the shortcode:

```php
$this->shortcode->getRawHandlers()->add('prism', function(ProcessedShortcode $sc) { ... }
```

The difference here is it uses `getRawHandlers()` to ensure the handler is processed to the content in the _raw_ state.

## Display All Shortcodes

You can now display all available shortcodes by using the CLI command:

```shell
bin/plugin shortcode-core display
```

repository: getgrav/grav-plugin-shortcode-core

branch_name: refs/heads/develop

repo_name: getgrav/grav-plugin-shortcode-core


text:
# java.lang.OutOfMemoryError: Java heap space

Run this with `java -Xmx10m -Xms10m OomeBytes` to generate the OutOfMemoryError. If you run without the `-Xmx` and `-Xms` arguments, the program will sleep for 10 seconds so you can capture a heap dump for funsies.

repository: csutherl/support-helpers

repo_name: csutherl/support-helpers


text:
# vega-projection

Projections for cartographic mapping.

This package provides a [projection](#projection) method for managing registered cartographic projections. By default, the projection registry includes all projection types provided by the [d3-geo](https://github.com/d3/d3-geo) module.

## API Reference

#
vega.projection(type[, projection])
[<>](https://github.com/vega/vega/blob/master/packages/vega-projection/src/projections.js "Source")

Registry function for adding and accessing projection constructor functions. The *type* argument is a String indicating the name of the projection type. If the *projection* argument is not specified, this method returns the matching projection constructor in the registry, or `null` if not found. If the *projection* argument is provided, it must be a projection constructor function to add to the registry under the given *type* name.

By default, the projection registry includes entries for all projection types provided by the [d3-geo](https://github.com/d3/d3-geo) module. Projections created using the constructor returned by this method are augmented with the following additional properties:

- `type`: A string value indicating the projection type.
- `path`: A D3 [geoPath](https://github.com/d3/d3-geo#geoPath) instance configured to use the projection. When using this path instance, be sure to set the [path context](https://github.com/d3/d3-geo#path_context) as needed.
- `copy`: A zero-argument function the produces a copy of the projection.

```js
// mercator projection
var mercator = vega.projection('mercator');
var proj = mercator().translate([400, 200]);
scale.type; // 'mercator'
scale([0, 0]); // [400, 200] center point
```

repository: vega/vega

repo_name: vega/vega


text:
A visualization for demonstration and observation of the rotor-router algorithm’s behaviour and properties. The project includes an interactive animation of the algorithm, graph (network) import, export and manipulation, cycle and path finding and drawing. The visualization is written in Javascript and runs in a browser. All external libraries are included.

Author: Anna Kruglaia.

Aalto University, Department of Computer Science.

Supervisers: Jukka Suomela, Przemysław Uznański.

The project is distributed under the MIT License.

Online Demo

repository: simoroshka/vda

repo_name: simoroshka/vda


text:
# TextFieldsFlow
Switch to the next UITextField with a helper class and an extension.

## Description
This small piece of Swift code is a simple utility to switch to the next UITextField by pressing the "Next" button on your keyboard.

## Usage
To enable switching into a given set of fields:

```swift
[field1, field2, field3, field4].setFlowable(true)
```

You can even add a callback to call after a field has left focus:

```swift
field4.onConfirmTapped = {
    print("i'm working")
}
```

## Installation
I don't think this short piece of code is worth making a pod so I'll keep it rough and make you copy-paste some code.
```swift
private var objcKey: UInt8 = 0

/// Extend UITextField in order to add a confirm callback to a specific field
extension UITextField {
    /// Called by the final UITextField of a flowable array of UITextFields
    var onConfirmTapped: (() -> Void)? {
        get {
            return objc_getAssociatedObject(self, &objcKey) as? () -> Void
        }
        set(newValue) {
            objc_setAssociatedObject(self, &objcKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN)
        }
    }
}

extension Array where Element: UITextField {
    /// Sets this array of text fields as flowable by assigning them and index and a delegate
    func setFlowable(_ enabled: Bool) {
        for (index, textField) in enumerated() {
            textField.tag = index
            textField.delegate = enabled ? UITextFieldFlower.shared : nil
        }
    }
}

// Class that handles the fields switching.
// If there's no next field, calls the function associated to the onConfirmTapped callback
class UITextFieldFlower: NSObject, UITextFieldDelegate {
    private override init() {}
    static let shared = UITextFieldFlower()

    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        // Try to find next responder
        if let nextField = textField.superview?.viewWithTag(textField.tag + 1) as? UITextField {
            nextField.becomeFirstResponder()
        } else {
            // else
            textField.resignFirstResponder()
            textField.onConfirmTapped?()
        }
        return false
    }
}
```
## License
Copyright 2018 Mattia Contin<EMAIL_ADDRESS>
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.
 \ No newline at end of file

repository: mcontin/TextFieldsFlow

repo_name: mcontin/TextFieldsFlow


text:
---
layout: post
title:  Insert into DOM fragments
tags:   ['JavaScript', 'HTML', 'Web API', 'Performance', 'Good practice']
---

**TL;DR** The `DocumentFragment` Web API allows us to prepare DOM nodes without paying the price of repeated HTML parsing and page reflow.
``` javascript
// Don't
$el.innerHTML = ('text/html or text/xml')
// Do
const fragment = document.createRange().createContextualFragment('text/html or text/xml')

// Don't
$el.appendChild($newNode)
// Do
const fragment = document.createDocumentFragment()
fragment.appendChild($newNode)
```

<hr>

A `DocumentFragment` is an object meant to contain a DOM Tree but can't itself be part of the DOM. It is used to create or modify parts of the main DOM without triggering page reflows — the process of recalculating and redrawing parts of a webpage.

Creating a fragment is very simple:
```javascript
const fragment = document.createDocumentFragment()
```

A common use case for a `DocumentFragment` would be when we receive JSON data to hydrate our webpage and have to create a series of nodes accordingly:
```javascript
const json = ['foo', 'bar']
json.forEach(text => {
    const li = document.createElement('li')
    li.textContent = text
    fragment.appendChild(li)
})
document.body.appendChild(fragment)
```
Only the last line of this code snippet will trigger a page reflow. In addition, when passing a `DocumentFragment` as an argument to such functions as `.appendChild()`, it's the fragments children that are inserted instead of the fragment itself.

If instead of receiving JSON data, we get a serialized HTML or XML string, we can directly create a `DocumentFragment` *from* this string.
```javascript
const serialized = '<div>foo</div>'
const fragment = document.createRange().createContextualFragment(serialized)
document.body.appendChild(fragment)
```

And since the `DocumentFragment` isn't in the main DOM tree, you can manipulate it, change classes, remove / add nodes... And all that at very little cost.

repository: Sheraff/TIL

repo_name: Sheraff/TIL


text:
edif2qmasm installation
=======================

`edif2qmasm` is written in [Go](https://golang.org/) and therefore depends upon a Go compiler to build.

Note that `edif2qmasm` is of limited use withut a compiler than can produce EDIF netlists and [QMASM](https://github.com/lanl/qmasm), which executes the generated code on a D-Wave system.  To date, `edif2qmasm` has been tested only with the [Yosys Open SYnthesis Suite](http://www.clifford.at/yosys/), but reports of usage with other synthesis tools (successful or not) are welcome.

User builds
-----------

There are two ways to build `edif2qmasm`: the `go get` approach and the `make` approach.

### The `go get` approach

Download, build, and install `edif2qmasm` (into your `$GOPATH/bin/` directory) with
```bash
go get github.com/lanl/edif2qmasm
```

You'll also need to copy `stdcell.qmasm` somewhere, say into `/usr/local/share/edif2qmasm/`.  Optionally, you can install the `edif2qmasm.1` man page, say into `/usr/local/share/man/man1/`.

### The `make` approach

As an alternative installation procedure, one can download the code explicitly and build it using the supplied `Makefile`:
```bash
git clone https://github.com/lanl/edif2qmasm.git
cd edif2qmasm
make
make install
```

This approach is supported because it provides a few extra benefits over the simpler, `go get` approach:

* `make clean` (and `make maintainer-clean`) can be used to clean up the build directory.
* `make install` installs the binary, the standard-cell library (`stdcell.qmasm`), and the Unix man page into their standard locations
* `make install` honors the `DESTDIR`, `prefix`, and similar variables, which can be used to override the default installation directories.

Developer builds
----------------

If you want to modify `edif2qmasm` and rebuild it, you'll need a few additional tools.  The program's build process requires [`goimports`](https://godoc.org/golang.org/x/tools/cmd/goimports), [`stringer`](https://godoc.org/golang.org/x/tools/cmd/stringer), and the [Pigeon parser generator](https://godoc.org/github.com/PuerkitoBio/pigeon).  These can be installed from the command line with
```bash
go get golang.org/x/tools/cmd/goimports
go get golang.org/x/tools/cmd/stringer
go get github.com/PuerkitoBio/pigeon
```
Once these dependencies are satisfied, `edif2qmasm` can be rebuilt with
```bash
go generate
go build
go install
```

or
```bash
make
make install
```

gha_license_id: NOASSERTION


text:
# Cloud Workers

This is a Cloud worker service for Nylas Mail. It provides background workers
to process features such as Reminders, Snooze, and Send Later. It is heavily
reliant on the Metadata services exposed by Cloud API.

For details on how to run Cloud Workers, see the
[cloud-core/README.md](https://github.com/nylas/nylas-mail-all/blob/master/packages/cloud-core/README.md)
and run `npm run start-cloud` from the root of the repository.

repository: Microsoft-Android/nylas-mail

repo_name: Microsoft-Android/nylas-mail


text:
---
name: Get a secret
example: octokit.actions.getSecret({ owner, repo, name })
route: GET /repos/{owner}/{repo}/actions/secrets/{name}
scope: actions
type: API method
---

# Get a secret

Gets a single secret without revealing its encrypted value. Anyone with write access to the repository and an access token with the `repo` scope can use this endpoint. GitHub Apps must have the `secrets` permission to use this endpoint.

```js
octokit.actions.getSecret({
  owner,
  repo,
  name,
});
```

## Parameters

      name
      required
      description

owner	yes

owner parameter

repo	yes

repo parameter

name	yes

name parameter

See also: [GitHub Developer Guide documentation](https://developer.github.com/v3/actions/secrets/#get-a-secret).


text:
# Path Builders

Path builders are used to generate the path the file gets stored under in the storage system.

## Default Path Builder

The library comes with a pretty powerful path builder that allows you to build the path you want from a lot of variables that can be put together in a string template for the files path and variants of the file.

```
$builder = new PathBuilder([
    // Configure your options
]);
```

### Options:

 * **randomPath**: 'sha1'
 * **sanitizeFilename**: true
 * **beautifyFilename**: false
 * **filenameSanitizer**: null|\Phauthentic\Infrastructure\Storage\Utility\FilenameSanitizerInterface
 * **pathTemplate**: '{model}{ds}{randomPath}{ds}{id}'
 * **variantPathTemplate**: '{filename}.{variant}.{extension}'
 * **dateFormat**: Array of [DateTimeInterface::format()](https://www.php.net/manual/en/datetime.format.php) compatible values
   * **year**: 'Y'
   * **month**: 'm'
   * **day**: 'd'
   * **hour**: 'H'
   * **minute**: 'i'
   * **custom**: 'Y-m-d'

### Path Template Placeholders

The placeholders allow you to build your custom path pretty easy.

For example this template string
`{model}{ds}a-fancy-folder-name{ds}{file}.{extension}` will create this path for a file with the model called `user`:
`/user/a-fancy-folder-name/filename.ext`.

 * **{ds}**: Is the directory separator of the system, or the one you configured.
 * **{filename}**: Is the filename.
 * **{hashedFilename}**: A sha1() hashed filename string.
 * **{extension}**: The extension of the filename without the dot.
 * **{id}**: The UUID of the file.
 * **{strippedId}**: The UUID of the file without dashes.
 * **{randomPath}**: A semi-random path to increase the depth and variability of the path. This will avoid running into limitations of some file systems.
 * **{mimeType}**: The mime type of the file. Be aware it *might* include invalid chars for a storage backend!.
 * **{model}**: The model name.
 * **{modelId}**: The id of the models entity.
 * **{collection}**: The collection the file belongs into.
 * **{year}**: Four digits year
 * **{month}**: Two digits month value
 * **{day}**: Two digits day value
 * **{hour}**: Two digits hour value
 * **{minute}**: Two digits minute value
 * **{date}**: Custom date format i.e. '2020-01-03'

The following placeholders are only valid when used in a path for a manipulated file.

 * **{variant}**: The name of the variant
 * **{hashedVariant}**: A hashed and to six chars truncated version of the manipulation name.

### Filename sanitization

This path builder provides a `setFilenameSanitizer()` method that takes an object implementing `Phauthentic\Infrastructure\Storage\Utility\FilenameSanitizerInterface`.

This is an alternative way to provide a sanitizer besides passing it through the configuration array.

## Conditional Path Builder

Add callbacks and path builders to check on the file which of the builders should be used to build the path.

This allows you to use different instances with a different configuration or implementation of path builders for files of different types or in different collections or models.

The example below will use the "other" path builder instance if the model attached to the file called "user". If not it will fall back to the default builder.

```php
use Phauthentic\Infrastructure\Storage\PathBuilder\PathBuilder;
use Phauthentic\Infrastructure\Storage\PathBuilder\ConditionalPathBuilder;
use Phauthentic\Infrastructure\Storage\FileInterface;

$default = new PathBuilder();
$other = new PathBuilder([
    // Configure it differently
]);

$builder = new ConditionalPathBuilder($default);
$builder->addPathBuilder($other, function(FileInterface $file, ?string $manipulation = null) {
    return ($file->model() === 'User' && $file->collection() === 'Avatar');
});
```

## Implementing your own

To implement your own path builder implement the [PathBuilderInterface](../src/PathBuilder/PathBuilderInterface.php).

```php
use Phauthentic\Infrastructure\Storage\FileInterface;
use Phauthentic\Infrastructure\Storage\PathBuilder\PathBuilderInterface;

class MyPathBuilder implements PathBuilderInterface
{
    public function path(FileInterface $file, array $options = []): string
    {
        // Your code...
    }

    public function pathForManipulation(FileInterface $file, string $name, array $options = []): string
    {
        // Your code...
    }

    public function pathForVariant(FileInterface $file, string $name, array $options = []): string
    {
        // Your code
    }
}
```

repository: Phauthentic/file-storage

gha_language: PHP

repo_name: Phauthentic/file-storage


text:
## Last Week's Accomplishments

- This past week, I was able to work on reading up on fingerprint authentication documentation. I was also able to begin working on a Settings UI that I will probably push by the end of today.
- Karthik and I decided that we'll be working on two different aspects of the TouchID feature. I will be working on backwards compatibility for users that either don't have fingerprintID enabled or users that have software versions.
- I've also worked on simulating a fingerprint with the Terminal. This has been an issue for me, a took a bit longer than I expected to learn.
- Completed Settings UI

## This Week's Plan

- This coming week I will contnue to read up on documentation for the fingerprint authentication (backward compatibility)
- I will work on implementing working preferences for settings UI panels
- Continue working of fingerprint simulation
- Begin implementing email for fixx in Settings panel
- I will also possibly work on the UI for the fingerprint authentication screen, since the API that I'm using does not provide its own authentication screen (I didn't get around to doing this the last time)

## Anything Blocking?

- faceID will not be implemented this semester (more of AI component  for Android platform)

## Notes

**SAME AS LAST WEEK*

repository: matildarehm/rcos-status-updates

repo_name: matildarehm/rcos-status-updates


text:
---
title: Apply to Jobs You Don’t Want
cover_image: https://source.unsplash.com/PM7KE-JQANE/900x500
category:
- career
tags:
- apply
- job
- interview
---
When I mentor people trying to land their first few jobs in development, I often encourage them to apply to multiple jobs a week. I’m commonly told there aren’t that many good ones out there.

“What about bad ones,” is my response.

When you look at the sea of jobs that you could qualify for, there are often way more than we consider. While there are plenty of reasons not to work there, there are reasons to apply anyway.

# Securing Interviews

You won’t get an interview if you don’t apply. Pretty obvious, but many people only apply for the jobs they think they want, and that also means they apply to the positions that mean the most to them and when they have the least confidence and practice.

You need to have an application that secures an interview more often than not, and the best way to do that is by applying.

 Something isn’t matching up.

Apply to a job, see if you get an interview, adjust your materials, and repeat.

Get scientific about this. Develop a hypothesis about your resume, test it by applying, and refine it.

You can get your materials dialed into a near 100% interview chance.

# Interviewing Practice

The interview process many developers are put through is brutal, and they often put developers off-balance intentionally. Right off the bat, you’re set up to make mistakes. So, practice by actually interviewing.

If you struggle with questions like, “Where do you see yourself in 5 years,” or “Go ahead and whiteboard a depth-first-search of a binary search tree,” you need to practice.

Some of you might think that at-home study is enough, but the stress, nerves, and abnormal setting are enough to turn all that study to sludge when the moment counts.

Applying for jobs, you don’t want gives you extra practice across a wide range of interview questions and techniques. All that practice gives you a way better chance of nailing that interview for the job you want.

# Confidence

You’re best prepared to get a job when you don’t want it.

Strange as it sounds, there is an element of truth to this funny saying. When you don’t want the job, your mind is a lot sharper and clearer through the whole process. That clarity gives you an edge that nerves would otherwise dull.

That boost of confidence you get when you know you don’t want the job can lead to a lot more offers than when you’re desperate for it. Confidence, while situational, has a certain amount of muscle memory to it.

Stage performers often have horrible nerves the first few times they perform. Over time this turns into energy. Imagine going into an interview with energy instead of dread. Interviewers are unaccustomed to seeing people anything other than nervous. That energy will give you an edge compared to the other candidates who are apprehensive.

# Surprise!

When applying for jobs, we get our information about the job or company from a few sources. It may be a friend, Glassdoor, the description, and the company site. That isn’t a whole lot to go on sometimes.

So when you apply to jobs that you think you don’t want, you have the opportunity to find out if this job might be a welcome surprise. You also get to hone your ability to interview them back, which will tell you a bit more through the process.

Maybe you thought you wanted to work at Google, but after applying ravenously, you find a cool local company with a bright future and loving culture. Would that be so bad of a surprise?

Imagine getting offers all the time and having a pick. The only way to make that happen is to apply. Get methodical, practice, and keep going.

gha_language: HTML


text:
# PyRegMonDaemon for Windows

A Python 3 Windows daemon for monitoring and undoing specific shell icon overlay identifier settings that are made by certain applications which cause overlays for other applications to fail to appear.

## __IMPORTANT__: this modifies your Windows registry - DO NOT USE if you aren't comfortable with backing up and editing your registry!

Note: this must run with admin privileges to work properly. You may want to create a shortcut to this that runs minimised with admin privileges, with a target such as:

`C:\Python39\python.exe X:\tools\pyregmondaemon.py`

or for no console output at all:

`C:\Python39\pythonw.exe X:\tools\pyregmondaemon.py`

(If you don't make python.exe part of the target you may not be able to check the "run as administrator" box. Alternatively you could run this from an admin-elevated command prompt.)

_You got this far: do I need to remind you to back up your registry? Maybe your whole computer? Do it anyway! Read the code too... if nothing else it's interesting how this works._

## Why this exists

Windows only offers about 15 shell icon overlay slots. They are allocated in alphanumeric registry key name order. Programs like TortoiseGit don't force themselves to appear first in the list, but others applications such as Dropbox and OneDrive will prepend spaces to their key names to use up all the initial slots. This breaks TortoiseGit's selective overlays as well as those of other apps. Furthermore, apps that do this often don't allow similarly selective configuration of their overlays so as to allow them to cooperate with other apps that the user would prioritize for overlays.

This daemon will immediately and periodically undo specific unwanted changes to the overlays, preventing such problems in the first place.

Workaround discussions:
 * http://stackoverflow.com/questions/25156238/tortoisegit-not-showing-icon-overlays
 * https://superuser.com/questions/1042865/can-i-prevent-the-change-of-overlay-icons
 * https://cito.github.io/blog/overlay-icon-battle/
 * http://stackoverflow.com/questions/20610005/how-to-watch-the-windows-registry-for-changes-with-python
 * https://www.dropboxforum.com/t5/Installation-and-desktop-app/STOP-OVERWRITING-MY-ICON-OVERLAY-CONFIGURATION/td-p/186023

More info:
 * https://msdn.microsoft.com/en-us/library/windows/desktop/ms724892(v=vs.85).aspx
 * https://msdn.microsoft.com/en-us/library/windows/desktop/ms724878(v=vs.85).aspx
 * http://docs.activestate.com/activepython/3.4/pywin32/win32api.html
 * https://docs.python.org/3.6/library/winreg.html?highlight=winreg#module-winreg

## Notes

This depends on [pywin32](https://github.com/mhammond/pywin32), which uses AppVeyor. Unfortunately AppVeyor doesn't support Python beta versions (e.g., 3.8 beta).

repository: MartyMacGyver/PyRegMonDaemon

repo_name: MartyMacGyver/PyRegMonDaemon


text:
# Air-Traffic-Controller

This Project aims at building a basic air-traffic-controller.This project consist of two different classes where airport is our base class and planes is our derived class.There are 11 different airports and are they are connected to few airports only i.e every airport is not necessarily connected to every other airport. A fixed weight is used between airports to set distance between the two. Each airport having an index and mapped to its name using maps.Flights cost is also mentioned and is directly proportional to distance.Thereby shortest path have the lowest ticket cost.

 - To know the shortest path between our source and destination.
 - To know the minimum ticket price we can get between two places considering shortest path.
 - Number of paths between 2 airports taking no stops into consideration.
 - Reserve and cancellation of seats.

This project helped us to gain in-depth knowledge about various data- structures and their use in real world applications like these.

# Data Structure Used

  * Map
  * Graph
  * Queue
  * Set
  * Vector

repository: iinaimaf/Air-Traffic-Controller

path: /Air Traffic Controller/README.md

repo_name: iinaimaf/Air-Traffic-Controller


text:
# FileBrowser [![Build status](https://ci.appveyor.com/api/projects/status/4b18v9pmgvxtq4fw)](https://ci.appveyor.com/project/Walkman100/filebrowserbasic)
A very simple file browser coded in VB.Net, that is just a list. This shares code with [GitUpdater](https://github.com/Walkman100/GitUpdater)

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Walkman100/Walkman?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Compile requirements
See [CompileInstructions.md](https://github.com/Walkman100/gists/blob/master/CompileInstructions.md)


text:
# Paperclip::Staging

Allow [Paperclip](https://github.com/thoughtbot/paperclip) to pass attachments as data-uri on unsaved records. Useful when dealing with forms and validation errors.

Imagine you have two fields on a model - `name` and `attachment`. Let's say that `name` has a validation. If you edit an object and change both `name` and `attachment`, but the new name doesn't meet the validation, then you lose the new `attachment`.

With paperclip-staging, the attachment is preserved using a hidden field. It is also available with `staged_url(style_name)` (instead of regular `url(style_name)`) calls, using data-uri encoding - which is useful if you want to display current value for the attachment/image.

You can check the [example project](https://github.com/dabroz/paperclip-staging-example).

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'paperclip-staging'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install paperclip-staging

## Usage

1. Add a new hidden field in the form, named `<attachment_name>_staging`.

    `f.hidden_field :file_staging`

    or

    `f.input :file_staging, as: :hidden` for `simple_form`

2. Add this field as a valid form param:

    `attr_accessible :file_staging`

    or

    `params.require(xxx).permit(xxx, :file_staging)` for Rails 4

3. That's it!

## Contributing

1. Fork it ( https://github.com/dabroz/paperclip-staging/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

repository: dabroz/paperclip-staging

repo_name: dabroz/paperclip-staging


text:
# Alarm Off

```text
material-4.0/Action/AlarmOff
```

```text
include('material-4.0/Action/AlarmOff')
```

|icon|element|
|---|---|
|![](AlarmOff.png)|![](AlarmOff.element.png)|

## element
### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://raw.githubusercontent.com/tmorin/plantuml-libs/master/dist"
' loads the library
!include $LIB_BASE_LOCATION/bootstrap.puml
' loads the material-4.0 bootstrap
include('material-4.0/bootstrap')
' loads the AlarmOff element
include('material-4.0/Action/AlarmOff')
AlarmOff('alarm_off', 'Alarm Off', 'an optional tech field')
@enduml
```
### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../.."
' loads the library
!include $LIB_BASE_LOCATION/bootstrap.puml
' loads the material-4.0 bootstrap
include('material-4.0/bootstrap')
' loads the AlarmOff element
include('material-4.0/Action/AlarmOff')
AlarmOff('alarm_off', 'Alarm Off', 'an optional tech field')
@enduml
```

repository: neerajppraveen/plantuml-libs

repo_name: neerajppraveen/plantuml-libs


text:
[![Build Status](https://github.com/k-bx/protocol-buffers/actions/workflows/haskell-ci.yml/badge.svg?branch=master)](https://github.com/k-bx/protocol-buffers/actions/workflows/haskell-ci.yml) Haskell Protocol Buffers
====================================================

This the README file for `protocol-buffers`,
`protocol-buffers-descriptors`, and `hprotoc`. These are three
interdependent Haskell packages originally written by Chris Kuklewicz.

Currently, maintainership was taken by Timo von Holtz. It is
planned to only support GHC 8.6 and newer unless someone explicitly
asks for support of earlier versions.

(Needs check) This README was updated most recently to reflect version
`2.0.7`. This code should be compatible with Google protobuf version
`2.3.0`. Changes to keep up with Google protobuf version `2.4.0` are
being considered.

What is this for? What does it do? Why?
---------------------------------------

It is a pure Haskell re-implementation of the Google code at
https://developers.google.com/protocol-buffers/docs/overview which is
"...a language-neutral, platform-neutral, extensible way of
serializing structured data for use in communications protocols, data
storage, and more."  Google's project produces C++, Java, and Python
code.  This one produces Haskell code.

How well does this Haskell package duplicate Google's project?
--------------------------------------------------------------

- This provides non-mutable messages that ought to be wire-compatible
  with Google.

- These messages support extensions.

- These messages support unknown fields if hprotoc is passed the
  proper flag (-u or --unknown_fields).

- ~~This does not generate anything for Services/Methods.~~

- ~~Adding support for services has not been considered.~~

I think that Google's code checks for some policy violations that are
not well documented enough for me to reverse engineer. Some (all?) of
Google's APIs include the possibility of mutable messages. I suspect
that my message reflection is not as useful at runtime as in some of
Google's APIs.

What is protocol-buffers?
-------------------------

The protocol-buffers part is the main library which has two faces:

1. It provides an external API exported by module
`Text.ProtocolBuffers` for users to read and write the binary format
and manipulate the message data structures created by hprotoc.

2. It provides an internal API for the messages under module
`Text.ProtocolBuffers.Header` to implement their tasks.

What is protocol-buffers-descriptor?
------------------------------------

- It uses the `protocol-buffers` package.

- It provides the code generated by hprotoc from `descriptor.proto`
under module `Text.DescriptorProtos`.

- This supports hprotoc which is used to describe proto files and the
code they will generate.

- It provides `Text.DescriptorProtos.Options` which help in looking up
the new style custom options.

What is hprotoc?
----------------

- It uses `protocol-buffers` and `protocol-buffers-descriptor` above.

- It is a command line tool that reads in `.proto` files and produces
  Haskell source trees like Google's protoc.

- ...and it contains a very nice lexer and parser for the `.proto`
  file...

The hprotoc part is a executable program which reads `.proto` files
and uses the `protocol-buffers` package to produce a tree of Haskell
source files.  The program is called `hprotoc`.  Usage is given by the
program itself, the options themselves are processed in order.  It can
take several input search paths, and allow an additional module
prefix, a selectable output directory, and ends with a list of of
proto file to generate from.

The output has to be a tree of modules since each message is given its
own namespace, and a module is the only partitioning of namespace in
Haskell.  The keys for extension fields are defined alongside the
message whose namespace they share.  Since message names are both a
data type and a namespace the filename and the message name match
(aside from the .hs file extension).

And what are the examples and tests sub-directories?
----------------------------------------------------

The examples sub-directory is for duplicating the `addressbook.proto`
example that Google has with its code.  The `ABF` and `ABF2` file are
included as binary addressbooks.  These can be read by the C++
examples from Google, and vice-versa.

The `tests` sub-directory is where I have written some test code to
drive the `UnittestProto` code generated from Google's
`unittest.proto` (and `unittest_import.proto`) files.  The `patchBoot`
file has the needed file patches to fix up the recursive imports (no
longer needed!).

What do I need to compile the code?
-----------------------------------

1. Install [Haskell Stack Tool](https://github.com/commercialhaskell/stack/)
2. Run `stack build`

Alternatively, go with old-fashioned `cabal build`.

How mature is this code?
------------------------

It can write the wire encoding and read it back.  It has been tested
for interoperability against Google's read/write code with
`addressbook.proto`.

`hprotoc` generates and uses the `Text.DescriptorProtos` tree from
Google `descriptor.proto` file.

`hprotoc` has generated code from `Google/protobuf/unittest.proto` and
`Google/protobuf.unittest_import`. These compile after adding hs-boot
files `TestAllExtensions.hs-boot`, `TestFieldOrderings.hs-boot`, and
`TestMutualRecursionA.hs-boot` to resolve mutual recursion. The
`TestEnumWithDupValue` has duplicated values which cause a compilation
warning.

There has been QuickCheck tests done for
`UnittestProto/TestAllType.hs` and
`UnittestProto/TestAllExtensions.hs` in the tests subdirectory. These
pass as of `2008-09-19` for version `0.2.7`. These test that random
messages can be roundtripped to the wire format without changing —
with the caveat that the new extension keys are read back as raw bytes
but compare equal because of the parsing done by (==).

Mutual recursion is a problem?
------------------------------

Not using ghc.  The haskell-src-exts let me generate code with `{-#
SOURCE #-}` annotated imports.  And `hprotoc` generates the needed
hs-boot files for ghc.  And key import cycles are broken by creating
`Key.hs` files, which users can ignore.

How stable is the API?
----------------------

This is the first working release of the code.  I do not promise to
keep any of the API but I am lazy so most things will not change. The
reflection capabilities may get improved/altered. Stricter warnings
and error detection may be added.  Code will move between
protocol-buffers and hprotoc projects.  The internals of reading from
the wire may be improved.

Where is the API documentation?
-------------------------------

Generate haddock with `stack haddock` command.

You can also view API documentation online at
[Hackage page](https://hackage.haskell.org/package/protocol-buffers).

The imports of `Text.ProtocolBuffers` are the public API. The
generated code's API is `Text.ProtocolBuffers.Header`. The only usage
examples are in the `examples` sub-directory and the `tests`
sub-directory. Since the messages are simply Haskell data types most
of the manipulation should be easy.

The main thing that is weird is that messages with extension ranges
get an ExtField record field that holds ... an internal data
structure.  This is currently a `Map` from field number to a rather
complicated existential + GADT combination that should really only be
touched by the `ExtKey` and `MessageAPI` type class methods. The
`ExtField` data constructor is not hidden, though it could be and
probably ought to be.

Note that extension fields are inherently slower, especially in ghci
(though ghc's `-O2` helps quite a bit).

The entire proto file is stored in the top level module in
wire-encoded form and can be accessed as a `FileDescriptorProto`. The
Haskell code also defines its own reflection data types, with one
stored in each generated module and also in a master data type in the
top level module (via `Show` and `Read`).

Who reads this far?
-------------------

I suspect no one ever will.

Why define your own Haskell reflection types in addition to
`FileDescriptorProto`s types?

This allows for the protocol-buffers library package to not depend on
a single thing defined in the `protocol-buffers-descriptor` package.
This lack of recursion made for much simpler bootstrapping and allows
the `descriptor.proto` generated files to be build separately.

While `descriptor.proto` files are a great fit as output from parsing
a proto file they are not as good a fit for code generation. They mix
fields and extension keys, they have all optional fields even though
some things (especially names) are compulsory. They obscure which
descriptors are groups. They have a nested structure which is useful
when resolving the names but not for iterating over for code
generation.

What are the pieces of protocol-buffers doing?
----------------------------------------------

- `Basic.hs` defines the core data types (that are not already in
  `Prelude`) and many classes.
- `Mergeable.hs` defines the standard instances of `Mergeable` for
  combining types.
- `Default.hs` defines the standard default of the basic data types.
- `Reflections.hs` defines the Haskell reflection data types (stored
  with each generated module).
- `Get.hs` is here because I needed a slightly different style of
  binary `Get` monad (see binary and binary-strict packages). This is
  standalone and could be put into any project. It has long comments
  inside.
- `WireMessage.hs` defines 3 things:
  1. The Wire instances for the basic data types
  2. The API for the generated module to use to define their own Wire
     instances
  3. The API for the user to load and save messages This file would
     not compile with ghc-6.8.3 on a G4 (Mac OS X 10.5.4, XCode 3.1)
     without -fvia-C as the cabal file states.
- `Extensions.hs` is rather large because it add everything needed for
  extension fields (see haddock API docs).  It should not export
  ExtField's constructor, but it currently does.
- `Header.hs` re-exports what is needed for the instance messages.
- `ProtocolBuffer.hs` re-exports what is needed for the user API.

What are the pieces of hprotoc doing?
-------------------------------------

`alex` uses `Lexer.x` to generated `Lexer.hs` which slices up the
`.proto` file into tokens.  The `.proto` layout is well designed,
quite unambiguous, and easy to tokenize.  The lexer also does the jobs
of decoding the backslash escape codes in quotes strings, and
interpreting floating point numbers. Errors and unexpected input are
inserted into the token list, with at least line number level
precision.

The `Parser.hs` file has a `Parsec` parser which are really used as
nested parsers (allowing for the type of the user state to change).
The `.proto` grammar is well designed and the system never needs to
backtrack over tokens. The default values and options' values parsed
according to the expected type, and string default are check for valid
utf8 encoding.  (This also import the `Instances.hs` file)

The `Resolve.hs` has code to resolve all the names to a fully
qualified form, including name mangling where necessary. This includes
code to load and parse all the imported `.proto` files, reusing parses
for efficiency, and detecting import loops. The context built from
each imported file is combined to change the `FileDescriptorProto`
into a modified `FileDescriptorProto`. This stage also determines that
extension keys are in a valid extensions range declaration, and enum
default values exists.

The `MakeReflections.hs` file converts the nested `FileDescriptorProto`
into a flatter Haskell reflection data structure. This includes
parsing the default value stored in the `FileDescriptorProto`.

The `BreakRecursion.hs` file builds graphs describing the imports and
works out whether and how to create hs-boot and `Key.hs` files to allow
allow for warning-free compilation with ghc (as of 6.10.1).

The `Gen.hs` file takes a Haskell data structure from
`MakeReflections` and builds a module syntax data structure.  The
syntax data is quite verbose and several helper functions are used to
help with the composition.  The result is easy to print as a string to
a file.

The `ProtoCompile.hs` file is the Main module which defines the
command line program `hprotoc`.  This manages most of the interaction
with the file system (aside from import loading in Resolve).
Everything that is needed is collected into the Options data type
which is passed to "run". The output style can be tweaked by changing
"style" and "myMode".

New oneof implementation
------------------------

Since `protocol-buffers` version 2.6, the upstream `protocol-buffers`
supports [oneof](https://developers.google.com/protocol-buffers/docs/proto?hl=en#oneof)
keyword, which is a union of different data types.
It is very natural to combine the oneof specification into Haskell
ADT, so we implement the feature.

In `hprotoc/oneoftest`, we have an example for this. `school.proto` defines
a collection of members in a school, which is organized into dormitories.
Each member should have common attributes like `id` and `name`, but there are
attributes only specific to students, faculties or administrators.

Therefore, we define property as a oneof field which is one of student, faculty
and admin type. How it is defined should be easily understood from `school.proto`.

Once `protocol-buffers` is installed, using `hprotoc`, we can generate Haskell
source codes. Assuming we run `hprotoc` on the `oneoftest` directory and generate
source code in `hs` directory:

```
oneoftest> hprotoc --proto_path=. --haskell_out=hs school.proto
```

We will have `School.Member` module which defines `Member` by
(I omit qualifier and strictness annotation here.)
```
data Member = Member { id :: Int32
                     , name :: Utf8
                     , property :: Maybe Property
                     }
```
and `School.Member.Property` module defines `Property` (as `oneof`) by
```
data Property = Prop_student {prop_student :: Student }
              | Prop_faculty {prop_faculty :: Faculty }
              | Prop_admin   {prop_admin   :: Admin   }
```
where `Student`, `Faculty` and `Admin` are defined as ordinary nested message
data types in separate modules, respectively. Therefore, the `oneof` feature
is smoothly matched with Haskell sum types. Note that `Maybe` will be always
present for a `oneof` field in the owner data type definition (Here, `Maybe Property`
in the definition of `Member`). This is because of compatibility with other language
implementations that treat `oneof` as a collection of `optional` fields.

In the `oneoftest` directory, we provides a Haskell example in `hprotoc/oneoftest/hs`,
modification of the previous example using lenses in `hprotoc/oneoftest/hs-lens`
and a C++ example in `hprotoc/oneoftest/cpp` to demonstrate how to use. Each example
has `encode` and `decode`. With `encode`, we start from data in memory and generate
a serialized binary file in wire format. Then,`decode` takes the file and present
some information to prove it successfully decoded the binary. One can encode from
Haskell side and decode on C++ side, or vice versa. For building, simply run
`build.sh` in each of `hs` or `cpp` directories. Example with lenses has a `stack.yml`
in it so it could be easily built with `stack build`. For C++, one must previously
install C++ `protobuf` library and `pkg-config`. We assume that `hprotoc` was already
executed as shown above. The version with lenses requires slightly different command:

```
oneoftest> hprotoc --proto_path=. --haskell_out=hs-lens/src school.proto
```

Here are examples.
```
hs >   ./encode serialized.dat
hs >   cd ../cpp
cpp>   ./decode ../hs/serialized.dat
name: "Gryffindor"
members {
  id: 1
  name: "Albus Dumbledore"
  prop_faculty {
    subject: "allmighty"
    title: "headmaster"
  }
}
members {
  id: 2
  name: "Harry Potter"
  prop_student {
    grade: 5
    specialty: "defense of dark arts"
  }
}
```

```
cpp>   ./encode serialized.dat
cpp>   cd ../hs
hs >   ./decode ../cpp/serialized.dat

Right (Dormitory {name = "Gryffindor", members = fromList [Member {id = 1, name = "Albus Dumbledore", property = Just (Prop_faculty {prop_faculty = Faculty {subject = "allmighty", title = Just "headmaster", duty = fromList []}})},Member {id = 2, name = "Harry Potter", property = Just (Prop_student {prop_student = Student {grade = 5, specialty = Just "defense of dark arts"}})}]},"")
```

New code generation for services
--------------------------------

`protocol-buffers` support the definition and generation of RPC services. Though
without specifying a specific transport mechanism. Meaning only stubs are generated.
True to this motto `hprotoc` generates transport agnostic interfaces for services.

Consider a `Search.proto` definition like the following:

````protobuf
message SearchRequest {
    required string query = 1;
    optional int32 page_number = 2;
    optional int32 result_per_page = 3;
}

message SearchResponse {
    repeated string results = 1;
}

message AutocompleteRequest {
    required string query = 1;
    optional int32 max_results = 2;
}

message AutocompleteResponse {
    repeated string results = 1;
}

service SearchService {
    rpc Search (SearchRequest) returns (SearchResponse);
    rpc Autocomplete(AutocompleteRequest) returns (AutocompleteResponse);
}
````

We define two request-response pairs `SearchRequest`, `SearchResponse` and
`AutocompleteRequest`, `AutocompleteResponse`  and a service definition
`SearchService`. The service has two methods `Search` and `Autocomplete`.
Each taking one of the request-response pair as parameter respectively as
output.

For `SearchService` it generates a module roughly looking like this:
(omitting imports, exports and code for other messages):

````haskell
type SearchService = P'.Service "Search.SearchService" '[Search, Autocomplete]

searchService :: SearchService
searchService = P'.Service

type Search = P'.Method "Search" (P'.Single SearchRequest) (P'.Single SearchResponse)

type Autocomplete = P'.Method "Autocomplete" (P'.Single AutocompleteRequest) (P'.Single AutocompleteResponse)

search :: Search
search = P'.Method

autocomplete :: Autocomplete
autocomplete = P'.Method
````

A translated service consists of a type-level list itself consisting of `Method` types.
Each `Method` is parameterized with its method name as type-level string (via `DataKinds` extension),
its input parameter type and its output parameter type.

For every RPC method there will be one type alias for some parameterized `Method` type. For convenience `hprotoc`
will generate proxy functions (`searchService`, `search` and `autocomplete`) so
users won't have to tinker with proxying their types manually.

As the `protocol-buffer` does not specify any transport mechanism for services implementors
have to build the transports on their own.

repository: k-bx/protocol-buffers

gha_language: Haskell

repo_name: k-bx/protocol-buffers


text:
# Python utilities for Arduboy

For Windows, Linux and OSX

### Dependencies

* Requires Python 3 with PySerial and Pillow installed.

### Installing dependencies

* Download and install python 3 from https://www.python.org/downloads/
* Make sure the option 'Add python.exe to path' is checked on install options (Windows)
* After install run 'python -m pip install pyserial' from command line. For OSX run 'easy_install pyserial' from terminal.
* Also run 'python -m pip install pillow' from command line to install the pillow module. For OSX run 'easy_install pillow' from terminal.

## Uploader
* Requires pySerial: `python -m pip install pyserial`

.Hex file and .Arduboy uploader for Arduboy

* Double click the **uploader-create-send-to-shortcut.vbs** for right click Send to upload option(Windows only)

### Features

* Supports uploading to Arduboy, DevKit, and homemade Arduboys
* Uploads .hex files, .hex files in .zip and .arduboy files
* Protects unprotected bootloaders from being overwritten by large hex files
* Supports on the fly patching for SSD1309 displays
* Supports on the fly RX and TX LED polarity patching for Arduino /Genuino Micro

### Usage:

* Right click a .hex file, .arduboy file or .zip file containing a hex file
  and choose *Send To* Arduboy uploader
* Drag and drop .hex, .zip or .arduboy files on the **uploader.py** file
* Command line: uploader.py [filetoupload]

## SSD1309 display support

To patch Arduboy hex files for use on Homemade Arduboys with SSD1309 displays,
make a copy of **uploader.py** and rename it to **uploader-1309.py** Also make
sure you run the **uploader-create-send-to-shortcut.vbs** again to create a
**Send To** shortcut for it. Files will be patched on fly, original files will not be altered.

## reverse RX and TX LED polarity support

To patch Arduboy hex files for use with Homemade Arduboys based on Arduino / Genuino Micro,
make a copy of **uploader.py** and rename it to **uploader-micro.py** and run the
**uploader-create-send-to-shortcut.vbs** again to create a **Send To** shortcut for it.

## EEPROM backup

You can backup your Arduboys EEPROM by double clicking the **eeprom-backup.py**  python script.
The backup is saved to a time stamped file in the format **eeprom-backup.py-YYYYMMDD-HHMMSS.bin**

## EEPROM restore

You can restore a previously made EEPROM backup simply by dragging the **eeprom-backup.py-YYYYMMDD-HHMMSS.bin** file onto the **eeprom-restore.py** python script

## EEPROM erase

Erases the EEPROM content (An erased EEPROM contains all 0xFF's).

## Erase sketch

Erases the application/sketch startup page to keep the bootloader mode active indefinitely. This solves problematic (time sensitive) uploads using Arduino IDE.

## Flash cart builder

* Requires PILlow: `python -m pip install pillow`

Builds a binary flash image from an index file and supporting resource files (.png images and .hex files).  Use the **flashcart-writer.py** script to write the output to a flash cart.  See the **example-flashcart\flashcart-index.csv** file for example syntax.

example: `python flashcart-builder.py example-flashcart\flashcart-index.csv`

## Flash cart writer

* Requires pySerial: `python -m pip install pyserial`

Writes a binary flash image to external flash memory of Arduboy FX and Arduboy (clones) with added serial flash memory (Cathy3K v1.3+ bootloader required). Use the **flashcart-builder.py** script to build the image.
To automatically apply the SSD1309 patch to the uploaded image, make a copy of **flashcart-writer.py** and rename it to **flashcart-writer-1309.py**.

example: `python flashcart-writer.py example-flashcart\flashcart-image.bin`

For development purposes external program data and save data can be stored at the end of external flash memory using -d and -s switches.

example: `python flashcart-writer.py -d datafile.bin`

## Flash cart backup

* Requires pySerial: `python -m pip install pyserial`

Backup your existing flash cart to a binary image that can later be re-written to the Arduboy using the **flashcart-writer.py** script.
The backup is saved to a time stamped file in the format **flashcart-backup-image-YYYYMMDD-HHMMSS.bin**

example: `python flashcart-backup.py`

## Image Converter

* Requires PILlow: `python -m pip install pillow`

Converts .bmp or .png image files to C++ include file. Image width and height can be any size. Tilesheets and spritesheets with optional spacing can be converted by
specifying the width and height and optional spacing in the filename.
When an image contains transparency information the converted data will include a sprite mask.
Script can convert multiple files in one go by supplying multiple filenames.

example: `python image-converter.py tilesheet_16x16.png`

repository: MrBlinky/Arduboy-Python-Utilities

gha_language: Python

repo_name: MrBlinky/Arduboy-Python-Utilities


text:
# meteor-encryption-demo
This is a demo for the [planifica:encryption](https://github.com/Planifica/encryption) package.
![encryption.meteor.com](https://pbs.twimg.com/media/CO5Sx5ZWsAAxgh7.png:large)