text:
---
layout: post
comments: true
title: Unlinking MKVs on Windows, OSX, and Linux - Native C# Port
categories:
- blog
---

You may have seen my [other post](http://vaughanhilts.me/blog/2015/04/30/unlinking-mkvs-on-windows-osx-linux.html) on unlinking those pesky segmented MKVs that I posted a while back. Lots of users have tried it out and it works pretty well -- however, the original Perl port had a few issues with it. Mainly:

1. It required a lot of dependencies that Windows users weren't used to having, such as "Strawberry Perl" since it's not something that runs on Windows "natively"
2. It had a couple bugs that were hard to fix, since I am not a native Perl programmer. This made it hard to make it work for every release I wanted.
3. It made some assumptions about the process that have since been fixed.

Since I was still getting bug reports well into 2016 about certain MKV files not working with the process and I was having some bugs myself with certain files, I decided to rewrite a quick native port in C#
of the actual merge logic in order to work around these three issues.

# Brute-Force Linear Ordering

The biggest bug I had to deal with was files that looked something like this:

mediainfo file.mkv
Menu
00:00:00.000                             : en:Prologue / en:Opening / en:Ending
00:05:57.019                             : en:Episode
00:22:40.059                             : en:Preview

------------------

MKVUnlink (Perl) was handling these pretty good but would occasionally trip up on these. If you look at the order inside the actual MKV itself, the chapters are presented in sequence but their timecodes are all wrong. I'm not sure if there is something I am not understanding or if this is just a bug in the way they were split out. A lot of media playback software that actually supported segmented playback actually worked find with these files so I was not sure. However, the algorithim I was using and that UnlinkMKV was using simply did not work sometimes for these files.

The solution is to linearize these, you see the implementation online at [Github](https://github.com/hilts-vaughan/UnlinkMKV-GUI/blob/master/UnlinkMKV-GUI/UnlinkMKV-GUI/merge/SegmentTimecodeSelector.cs) but the basic premise is to just take the order the chapters and for each:

1. Measure the duration of the current clip
2. Set the start timecode of the current chapter to the end timecode of the previous
3. Then, make the ending equal to the duration + the start of the old timecode

This will make everything nice and linear. The process only has to be carried out if the sequence is kind of out of order. Either way, this fixes a few issues with a couple MKV files that were giving me grief.

You can download this new release on Github today [here](https://github.com/hilts-vaughan/UnlinkMKV-GUI/releases/tag/0.2.0) which contains quite a few of the bugfixes. I hope in the future, every player can just support the segmented format and we won't have any need for software like this. For now, if you find any bugs please leave an issue open on Github.

To use the new "Native Mode", just tick the "Native Mode" in the GUI.

Any feedback? Experienced a similar issue? Feel free to post about it below in the comments.


text:
# itchy

A super simple version checker for use with [LÖVE](https://love2d.org) games
published on [itch.io](https://itch.io/).

## Installation

Copy `itchy.lua` to where you want in your source. It is recommended that you
install [luajit-request](https://github.com/LPGhatguy/luajit-request) as it
allows for itchy to use HTTPS connections.

luajit-request on Windows requires a libcurl DLL to be alongside the executable
of a fused game, or in the root-level source directory for an unfused game. You
can find them [here](https://curl.haxx.se/download.html). On Mac OS, this should
be already installed, and most Linux distributions have it installed already.
Please tell your Linux users to install libcurl if they do not have it and you
are relying on its functionality.

(I don't remember which of these is which, but I have verified
[this DLL](https://mega.nz/#!EMVA3brL!7D8rycffbEU2qem6N_JTeuZOdwGwOl-zp3Z3wgGpKXQ)
works for 32-bit builds, and
[this DLL](https://mega.nz/#!5Md0jbBK!9KpcPQnN0hVtYd5_OzjNoQWf5wFJ7rG7SfPuSaMMQCU)
is the 64-bit version of it.)

## Usage

Start it as a thread with a configuration table. Wait for "itchy" channel to
respond with a table of version information.

Require itchy, and run `check_version` with a configuration table. Periodically
run `new_version` to see if data has been returned yet.

```lua
local itchy = require "lib.itchy"       -- or wherever you saved it
local game = {
  target = "guard13007/asteroid-dodge", -- target or url must be defined
  version = "1.0.0"                     -- optional, config options listed below
}
itchy:check_version(game)

-- somewhere where this will be called periodically
local data = itchy:new_version(game)  -- passing the game table is not necessary
if data then
  -- easiest usage, just print the message to the user
  love.graphics.print("Version: 1.0.0 Latest: " .. data.message)
end
```

You can cancel it with `itchy:kill_version_checker(game)`, and start a new
version checker with `itchy:check_version({})` any time you like.

### Version Information Example

Returned data example:

```lua
{
  status = 200,                -- nil or status code of an HTTP request
  body = '{"latest":"0.2.0"}', -- raw result body from the HTTP request
  version = "0.2.0",           -- number/string (if body was parsed correctly)
  latest = true,               -- nil/boolean: your version == latest version?
  message = "0.2.0, you have the latest version"   -- an error or status message
}
```

Errors from LuaSocket will be returned as `"socket.http.request error: " .. err`

The library tries to parse a response body for valid JSON of the format
`{"latest":"VERSION"}` (itch.io's format) and will do basic version comparisons
based on this value. If it is unable to extract it or compare, `version` and
`latest` will be `nil`.

If HTTP status 200 (OK) is encountered or a version is successfully parsed from
a response, the script terminates (or moves on to checking on an interval.)
Otherwise, it will keep trying with an exponential back-off starting at a 1
second delay, capped at retrying every 10 minutes.

### Configuration Options

At minimum a `url` or `target` must be specified.

* `url` (string) If you have a different URL to check for the latest version
  from, you can specify it here.
* `target` (string) The target string of your game on itch.io
  (username/game-slug).
* `channel` (string) If you do not specify the channel name to look for on
  itch.io, it will use `osx` for Mac OS / OS X, `win32` for Windows, `linux` for
  Linux, `android` for Android, `ios` for iOS, and if any other OS is returned
  by `love.system.getOS()` it will use that string as-is.
* `version` (string/number) Version of the game running right now.
* `interval` (number) If specified, a check for the latest version will happen
  again every `interval` seconds.
* `luajit_request` (string) luajit-request is checked for in `.` and `lib/.`, if
  you have it elsewhere, specify its location here.

The following options are available, but generally should be left for itchy to
handle itself:

* `proxy` (string) An [HTTP proxy](https://github.com/Guard13007/insecure-proxy)
  is used if luajit-request is unavailable, unless `proxy == false`. By default,
  `http://insecure-proxy.tangentfox.com` is used. You can specify a different
  proxy here.
* `thread_channel` (string) itchy uses a channel named `itchy` for version
  checking. You can call itchy's functions with different data tables and it
  will use different threads & channels for each. You can also specify a channel
  name here.

license: MIT

repository: TangentFoxy/itchy

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: TangentFoxy/itchy


text:
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## unreleased

### Features (User Facing)
* Trying to benchmark evaluated functions will now result in a warning. Thanks [@BrooklinJazz](https://github.com/BrooklinJazz), [@czrpb](https://github.com/czrpb), [@aar2dee2](https://github.com/aar2dee2),[@ReecesPeanutButterCodes](https://github.com/ReecesPeanutButterCodes).

## 1.1.0 (2022-03-08)

Long time, huh? I'm sorry, combination of priorities, difficult to fix bugs, stress and arm problems kept me away too long.
This release brings major features long developed and now finally released (reduction measurements + profiler after run), along with a critical bugfix around measurement accuracy for very fast functions (nanoseconds).

### Features (User Facing)
* Reduction counting/measurements was implemented. Basically, it's a rather stable unit of execution implemented by the BEAM that measures in more abstract manner how much work was done. It's helpful, as it shouldn't be affected by load on the system. Check out [the docs](https://github.com/bencheeorg/benchee#measuring-reductions).
* You can now dive straight into profiling from your benchmarks by using the profiling feature. See [the docs](https://github.com/bencheeorg/benchee#profiling-after-a-run) - thanks [@pablocostass](https://github.com/pablocostass)

### Default Behavior Changes (User Facing)
* measuring function call overhead is now turned off by default, as it only helps with extreme nano benchmarks and has some potential for causing wrong results, so it should only be opt in. We now also print out the measured overhead for vsibility.

### Bugfixes (User Facing)
* Benchee now correctly looks for the time resolution as reported by `:erlang.system_info(:os_monotonic_time_source)` to accommodate when determining if a measurement is "precise" enough. Benche also works around an erlang bug we discovered present in erlang <= 22.2. [Issue for reference](https://github.com/bencheeorg/benchee/issues/313).
* The annoying stacktrace warning has been removed - thanks [@mad42](https://github.com/mad42)

### Noteworthy
* a new dependency `statistex` will show up - it's a part of continued efforts to extract reusable libraries from Benchee.

## 1.0.1 (2019-04-09)

### Bugfixes (User Facing)
* When memory measurements were actually different extended statistics was displayed although the option was not provided. Now correctly only displayed if the option is provided and values actually had variance.

## 1.0.0 (2019-03-28)

It's 0.99.0 without the deprecation warnings. Specifically:

* Old way of passing formatters (`:formatter_options`) vs. new `:formatters` with modules, tuples or functions with one arg
* The configuration needs to be passed as the second argument to `Benchee.run/2`
* `Benchee.collect/1` replaces `Benchee.measure/1`
* `unit_scaling` is a top level configuration option, not for the console formatter
* the warning for memory measurements not working on OTP <= 18 will also be dropped (we already officially dropped OTP 18 support in 0.14.0)

We're aiming to follow Semantic Versioning as we go forward. That means formatters should be safe to use `~> 1.0` (or even `>= 0.99.0 and < 2.0.0`).

## 0.99.0 (2019-03-28)

The "we're almost 1.0!" release - all the last small features, a bag of polish and deprecation warnings. If you run this release successfully without deprecation warnings you should be safe to upgrade to 1.0.0, if not - it's a bug :)

### Breaking Changes (User Facing)
* changed official Elixir compatibility to `~> 1.6`, 1.4+ should still work but aren't guaranteed or tested against.

### Features (User Facing)
* the console comparison now also displays the absolute difference in the average (like +12 ms) so that you have an idea to how much time that translates to in your applications not just that it's 100x faster
* Overhaul of README, documentation, update samples etc. - a whole lot of things have also been marked `@doc false` as they're considered internal

### Bugfixes (User Facing)
* Remove double empty line after configuration display
* Fix some wrong type specs

### Breaking Changes (Plugins)
* `Scenario` made it to the big leagues, it's no longer `Benchee.Benchmark.Scenario` but `Benchee.Scenario` - as it is arguably one of our most important data structures.
* The `Scenario` struct had some keys changed (last time before 2.0 I promise!) - instead of `:run_times`/`:run_time_statistics` you now have one `run_time_data` key that contains `Benchee.CollectionData` which has the keys `:samples` and `:statistics`. Same for `memory_usage`. This was done to be able to handle different kinds of measurements more uniformly as we will add more of them.

### Features (Plugins)
* `Benchee.Statistics` comes with 3 new values: `:relative_more`, `:relative_less`, `:absolute_difference` so that you don't have to calculate these relative values yourself :)

## 0.14.0 (2019-02-10)

Highlights of this release are a new way to specify formatter options closer to the formatters themselves as well as maximum precision measurements.

### Breaking Changes (User Facing)
* dropped support for Erlang 18.x
* Formatters no longer have an `output/1` method, instead use `Formatter.output/3` please
* Usage of `formatter_options` is deprecated, instead please use the new tuple way

### Features (User Facing)
* Benchee now uses the maximum precision available to measure which on Linux and OSX is nanoseconds instead of microseconds. Somewhat surprisingly `:timer.tc/1` always cut down to microseconds although better precision is available.
* The preferred way to specify formatters and their options is to specify them as a tuple `{module, options}` instead of using `formatter_options`.
* New `Formatter.output/1` function that takes a suite and uses all configured formatters to output their results
* Add the concept of a benchmarking title that formatters can pick up
* the displayed percentiles can now be adjusted
* inputs option can now be an ordered list of tuples, this way you can determine their order
* support FreeBSD properly (system metrics) - thanks @[kimshrier](/kimshrier)

### Bugfixes (User Facing)
* Remove extra double quotes in operating system report line - thanks @[kimshrier](/kimshrier)

### Breaking Changes (Plugins)
* all reported times are now in nanoseconds instead of microseconds
* formatter methods `format` and `write` now take 2 arguments each where the additional arguments is the options specified for this formatter so that you have direct access to it without peeling it from the suite
* You can no longer `use Benchee.Formatter` - just adopt the behaviour (no more auto generated `output/1` method, but `Formatter.output/3` takes that responsibility now)

### Features (Plugins)
* An optional title is now available in the suite for you to display
* Scenarios are now sorted already sorted (first by run time, then memory usage) - no need to sort them yourself!
* Add `Scenario.data_processed?/2` to check if either run time or memory data has had statistics generated

## 0.13.2 (2018-08-02)

Mostly fixing memory measurement bugs and delivering them to you asap ;)

### Bugfixes (User Facing)
* Remove race condition that caused us to sometimes miss garbage collection events and hence report even negative or N/A results
* restructure measuring code to produce less overhead (micro memory benchmarks should be much better now)
* make console formatter more resilient to faulty memory measurements aka don't crash

## 0.13.1 (2018-05-02)

Mostly fixing memory measurement bugs and related issues :) Enjoy a better memory measurement experience from now on!

### Bugfixes (User Facing)
* Memory measurements now correctly take the old generation on the heap into account. In reality that means sometimes bigger results and no missing measurements. See [#216](https://github.com/bencheeorg/benchee/pull/216) for details. Thanks to @michalmuskala for providing an interesting sample.
* Formatters are now more robust (aka not crashing) when dealing with partially missing memory measurements. Although it shouldn't happen anymore with the item before fixed, Benchee shouldn't crash on you so we want to be on the safe side.
* It's now possible to run just memory measurements (i.e. `time: 0, warmup: 0, memory_time: 1`)
* even when you already have scenarios tagged with `-2` etc. it still correctly produces `-3`, `-4` etc. when saving again with the same "base tagged name"

## 0.13.0 (2018-04-14)

Memory Measurements are finally here! Please report problems if you experience them.

### Features (User Facing)
* Memory measurements obviously ;) Memory measurement are currently limited to process your function will be run in - memory consumption of other processes will **not** be measured. More information can be found in the [README](https://github.com/bencheeorg/benchee#measuring-memory-consumption). Only usable on OTP 19+. Special thanks go to @devonestes and @michalmuskala
* new `pre_check` configuration option which allows users to add a dry run of all
benchmarks with each input before running the actual suite. This should save
time while actually writing the code for your benchmarks.

### Bugfixes (User Facing)
* Standard Deviation is now calculated correctly for being a sample of the population (divided by `n - 1` and not just `n`)

## 0.12.1 (2018-02-26)

### Bugfixes (User Facing)
* Formatters that use `FileCreation.each` will no longer silently fail on file
creation and now also sanitizes `/` and other file name characters to be `_`.
Thanks @gfvcastro

## 0.12.0 (2018-01-20)

Adds the ability to save benchmarking results and load them again to compare
against. Also fixes a bug for running benchmarks in parallel.

### Breaking Changes (User Facing)
* Dropped Support for elixir 1.3, new support is elixir 1.4+

### Features (User Facing)
* new `save` option specifying a path and a tag to save the results and tag them
(for instance with `"main"`) and a `load` option to load those results again
and compare them against your current results.
* runs warning free with elixir 1.6

### Bugfixes (User Facing)

* If you were running benchmarks in parallel, you would see results for each
parallel process you were running. So, if you were running **two** jobs, and
setting your configuration to `parallel: 2`, you would see **four** results in the
formatter. This is now correctly showing only the **two** jobs.

### Features (Plugins)
* `Scenario` has a new `name` field to be adopted for displaying the scenario names,
as it includes the tag name and potential future additions.

## 0.11.0 (2017-11-30)

A tiny little release with a bugfix and MOARE statistics for the console formatter.

### Bugfixes (User Facing)

* estimated run times should be correct again, they were too high when inputs were used

### Features (User Facing)

* the console formatter accepts a new `extended_statistics` options that shows you additional statistics such as `minimum`, `maximum`, `sample_size` and the `mode`. Thanks `@lwalter`

## 0.10.0 (2017-10-24)

This release focuses on 2 main things: the internal restructuring to use _scenarios_ and the new _hooks_ system. Other than that we also have some nice convenience features and formatters can be generated in parallel now.

### Features (User Facing)
* Hooks system - basically you can now do something before/after a benchmarking scenario or the benchmarking function, too much to explain it in a Changelog, check the [README](https://github.com/bencheeorg/benchee#hooks-setup-teardown-etc)
* Don't show more precision than we have - i.e. 234.00 microseconds (measurements are in microseconds and .00 doesn't gain you anything)
* Limit precision of available memory displayed, you don't need to know 7.45678932 GB. Thanks to `@elpikel`.
* Display the 99th percentile runtime. Thanks to `@wasnotrice`.
* `:unit_scaling` is now a top level configuration option that can now also be used and picked up by formatters, like the HTML formatter
* formatters can now be specified as a module (which should implement the `Benchee.Formatter` behaviour) - this makes specifying them nice and now at least their `format/1` functions can be executed in parallel

### Bugfixes (User Facing)
* Determining CPUs was too strict/too assuming of a specific pattern breaking in certain environments (like Semaphore CI). That is more relaxed now thanks to `@predrag-rakic`!
* Memory is now correctly converted using the binary (1024) interpretation, instead of the decimal one (1000)

### Features (Plugins)
* the statistics now also provide the mode of the samples as well as the 99th percentile
* There is a new `Benchee.Formatter` behaviour to adopt and enforce a uniform format for formatters, best to do `use Benchee.Formatter`

### Breaking Changes (Plugins)
* `:run_times`, `:statistics` and `:jobs` have been removed and folded together into `:scenarios` - a scenario holds the benchmarking function, potentially the input, the raw run times measures and the computed statistics. With this data structure, all the relevant data for one scenario is one place although it takes a lot to change, this seems to be the best way going forward. Huge thanks to `@devonestes`!

## 0.9.0 (2017-06-08)

This release focuses on adding more system specific information like CPU etc. and for better Erlang compatibility if you wanna use Benchee from Erlang. There is an [example project](https://github.com/bencheeorg/benchee_erlang_try) but calling Elixir from Erlang hasn't been as easy as I hoped :)

### Features (User Facing)
* Gather more system data like number of cores, Operating System, memory, cpu speed - thanks @devonestes and @OvermindDL1
* the names for jobs in the map of `Benchee.run/2` or in `Benchee.benchmark/3` may now be given as strings or atoms - atoms will be converted to strings internally though for consistency and avoiding name duplicates
* the names of inputs in the Benchee configuration may now be given as strings or atoms - atoms will be converted to strings internally though for consistency and avoiding name duplicates
* Benchee is now also available _"Erlang Style"_ to be called on an atom like `:benchee.run(_, _)` for better Erlang compatibility

## 0.8.0 (2017-05-07)

Another smaller release that focuses on adding type specs and structs in appropriate places along with fixing a couple of small bugs.

### Features (User Facing)
* Providing an unrecognized configuration option (say `runNtime` instead of `runtime`) will now raise an exception
* Durations in the configuration will now be scaled appropriately (minutes, microseconds etc)
* Major functions are type specced for your viewing pleasure in the docs and your dialyzer pleasure at type check time.

### Bugfixes (User Facing)
* In 0.7.0 statistics generation might time out if Millions of run times were captured so that it takes longer than 5 seconds, this is fixed by waiting infinitely - thanks @devonestes for the [report](https://github.com/bencheeorg/benchee/issues/71).
* Unintended line break in the fast function warning removed
* All necessary dependencies added to `:applications` (deep_merge was missing)

### Breaking Changes (User Facing)
* Dropped support for elixir 1.2, new support is elixir 1.3+
* `Benchee.Config` was renamed to `Benchee.Configuration` (important when you use the more verbose API or used it in a Plugin)

### Features (Plugins)
* Major public interfacing functions are now typespecced!
* A couple of major data structures are now proper structs e.g. `Benchee.Suite`, `Benchee.Configuration`, `Benchee.Statistics`

### Breaking Changes (Plugins)
* The `config` key is now `configuration` to go along with the Configuration name change
* As `Benchee.Configuration` is a proper struct now, arbitrary keys don't end up in it anymore. Custom data for plugins should be passed in through `formatter_options` or `assigns`. Existing plugin keys (`csv`, `json`, `html` and `console`) are automatically put into the `formatter_options` key space for now.

## 0.7.0 (April 23, 2017)

Smaller convenience features in here - the biggest part of work went into breaking reports in [benchee_html](https://github.com/bencheeorg/benchee_html) apart :)

### Features (User Facing)
* the print out of the Erlang version now is less verbose (just major/minor)
* the fast_warning will now also tell you how to disable it
* When `print: [benchmarking: false]` is set, information about which input is being benchmarked at the moment also won't be printed
* generation of statistics parallelized (thanks hh.ex - @nesQuick and @dszam)

### Breaking Changes (User Facing)
* If you use the more verbose interface (`Benchee.init` and friends, e.g. not `Benchee.run`) then you have to insert a `Benchee.system` call before `Benchee.measure` (preferably right after `Benchee.init`)

### Features (Plugins)
* `Benchee.Utility.FileCreation.interleave/2` now also accepts a list of inputs which are then all interleaved in the file name appropriately. See the doctests for more details.

### Breaking Changes (Plugins)
* `Benchee.measure/1` now also needs to have the system information generated by `Benchee.system/1` present if configuration information should be printed.

## 0.6.0 (November 30, 2016)

One of the biggest releases yet. Great stuff in here - more elixir like API for `Benchee.run/2` with the jobs as the primary argument and the optional options as the second argument and now also as the more idiomatic keyword list!

The biggest feature apart from that is the possibility to use multiple inputs - which you all should do now as quite many functions behave differently with bigger, smaller or differently shaped inputs. Apart from that a bulk of work has gone into making and supporting [benchee_html](https://github.com/bencheeorg/benchee_html)!

### Features (User Facing)

* New `:inputs` configuration key that allows you to specify a map from input name to input value so that each defined benchmarking job is then executed with this input. For this to work the benchmarking function is called with the appropriate `input` as an argument. See [`samples/multiple_inputs.exs`](https://github.com/bencheeorg/benchee/blob/main/samples/multiple_inputs.exs) for an example. [#21]( https://github.com/bencheeorg/benchee/issues/21)
* The highlevel `Benchee.run/2` is now more idiomatic elixir and takes the map of jobs as the first argument and a keyword list of options as the second (and last) argument. The old way of passing config as a map as the first argument and the jobs as the second argument still works, **but might be deprecated later on** [#47](https://github.com/bencheeorg/benchee/issues/47)
* Along with that `Benchee.init/1` now also accepts keyword lists of course

### Breaking Changes (User Facing)

* The old way of providing the jobs as a list of tuples now removed, please switch to using a map from string to functions

### Features (Plugins)

* `Benchee.Utility.FileCreation` module to help with creating files from a map of multiple inputs (or other descriptors) mapping to input and an `interleave` function that spits out the correct file names especially if the `:__no_input` marker is used
* `Benchee.System` is available to retrieve Elixir and Erlang versions but it's
also already added to the suite during `Benchee.run/2`

### Breaking Changes (Plugins)

* The structure of the output from `Benchee.Benchmark.measure/1` to `Benchee.Statistics.statistics/1` has changed to accommodate the new inputs feature there is now an additional level where in a map the input name then points to the appropriate results of the jobs. When there were no inputs the key is the value returned by `Benchee.Benchmark.no_input/0`.

### Bugfixes

* prewarming (discarding the first result due to some timer issues) during run time was removed, as it should already happen during the warmup period and would discard actual useful results especially for longer running macro benchmarks.
* when the execution time of the benchmarking job exceeds the given `:time` it will now execute exactly once (used to be 2) [#49](https://github.com/bencheeorg/benchee/issues/49)
* `run_times` are now in the order as recorded (used to be reverse) - important when wants to graph them/look at them to see if there are any anomalies during benchmarking
* Remove elixir 1.4.0-rc.0 warnings

## 0.5.0 (October 13, 2016)

This release focuses on scaling units to more appropriate sizes. Instead of always working with base one for counts and microseconds those values are scaled accordingly to thousands, milliseconds for better readability. This work was mostly done by new contributor @wasnotrice.

### Features (User Facing)

* Console output now scales units to be more friendly. Examples:
    * instead of "44556677" ips, you would see "44.56 M"
    * instead of "44556.77 μs" run time, you would see "44.56 ms"
* Console output for standard deviation omits the parentheses
* Scaling of console output can be configured with the 4 different strategies `:best`, `:largest`, `:smallest` and `:none`. Refer to the documentation for their different properties.
* Shortened the fast function warning and instead [linked to the wiki](https://github.com/bencheeorg/benchee/wiki/Benchee-Warnings#fast-execution-warning)

### Features (Plugins)

* The statistics module now computes the `minimum`, `maximum` and `sample_size` (not yet shown in the console formatter)
* you can rely on `Benchee.Conversion.Duration`, `Benchee.Conversion.Count` and `Benchee.Conversion.DeviationPercent` for help with formatting and scaling units

### Breaking Changes (Plugins)

* The `Benchee.Time`module is gone, if you relied on it for one reason or another it's succeeded by the more powerful `Benchee.Conversion.Duration`

## 0.4.0 (September 11, 2016)

Focuses on making what Benchee print out configurable to make it fit to your preferences :)

### Features (User Facing)
* The configuration now has a `:print` key where it is possible to configure in a map what Benchee prints out during benchmarking. All options are enabled by default (true). Options are:
  * `:benchmarking`  - print when Benchee starts benchmarking a new job (Benchmarking name ..)
  * `:configuration` - a summary of configured benchmarking options including estimated total run time is printed before benchmarking starts
  * `:fast_warning` - warnings are displayed if functions are executed too    fast leading to inaccurate measures
* There is also a new configuration option for the built-in console formatter. Which is also enabled by default:
  * `:comparison` - if the comparison of the different benchmarking jobs (x times slower than) is shown
* The pre-benchmarking output of the configuration now also prints the currently used Erlang and Elixir versions (similar to `elixir -v`)
* Add a space between the benchmarked time and the unit (microseconds)

## 0.3.0 (July 11, 2016)

This release switches internal data structures from lists of tuples to maps, allows the configuration of formatters, aggregates all values and hands them down so formatters can access the whole configuration, prints general configuration information and much more great stuff :)

### Breaking Changes (User Facing)
* The recommended data structure handed to `Benchee.run` was changed from a list of 2-element tuples to a map (`"Name" => benchmark_function`). However, **the old list of tuples still works but may be removed in future releases** (so it's not "breaking" _strictly_ speaking).
* You **can not have benchmark jobs with the same names anymore**, the last one wins here. This was the reason why previously the data structure was a list of tuples. However, having benchmarks with the same name is nonsensical as you can't discern their results in the output any way.

### Breaking Changes (Plugins)
* main data structure to hold benchmarks and results was changed from a list of 2-element tuples to a map (`"Name" => values`). That is for the jobs, the run times as well as the statistics. However, if you used something like `Enum.each(data, fn({name, value}) -> .. end)` you are still fine though, cause Elixir is awesome :)

### Features (User Facing)
* now takes a `parallel: number` configuration option and will then execute each job in parallel in as many parallel processes as specified in `number`. This way you can gather more samples in the same time and also simulate a system more under load. This is tricky, however. One of the use cases is also stress testing a system. Thanks @ldr
* the name column width is now determined based on the longest name. Thanks @alvinlindstam
* Print general configuration information at the start of the benchmark, including warmup, time, parallel and an estimated total run time
* New method `Benchee.Formatters.Console.output/1` that immediately prints to the console
* now takes a `formatters: [&My.Format.function/1, &Benchee.Formatters.console.output/1]` configuration option with which multiple formatters for the same benchmarking run can be configured when using `Benchee.run/2`. E.g. you can print results to the console and create a csv from that same run. Defaults to the builtin Console formatter.

### Features (Plugins)
* All previous configuration options are preserved after `Benchee.Statistics.statistics/1`, meaning there is access to raw run times as well as custom options etc. E.g. you could grab custom options like `%{csv: %{file: "my_file_name.csv"}}` to use.

### Bugfixes
* name columns are no longer truncated after 30 characters. Thanks @alvinlindstam

## 0.2.0 (June 11, 2016)

This release introduces warmup for benchmarks, nicer console output and the new `Benchee.measure` that runs the benchmarks previously defined instead of running them instantly.

### Breaking Changes (User Facing)
* `Benchee.benchmark/3` now doesn't run the benchmark anymore but simply adds it to `:jobs` in the config. The whole benchmark suite is then run via `Benchee.measure/1`. This only affects you if you used the more verbose way of defining benchmarks, `Benchee.run/2` still work as before.

### Breaking Changes (Plugins)
* the defined benchmarking are now preserved after running the benchmark under the `:jobs` key of the suite. Run times are added to the `:run_times` key of the suite (important for alternative statistics implementations)

### Features (User Facing)

* configuring a warmup time to run functions before measurements are taken can be configured via the `warmup` key in the config defaulting to 2 (seconds)

* statistics in console output are aligned right now for better comparisons
* last blank line of console output removed

### Features (Plugins)
* additionally supply the total standard deviation of iterations per second as `std_dev_ips` after `Benchee.Statistics.statistics`

### Bugfixes

* if no time/warmup is specified the function won't be called at all

## 0.1.0 (June 5, 2016)

Initial release

repository: bencheeorg/benchee

branch_name: refs/heads/main

gha_language: Elixir

gha_license_id: MIT

repo_name: bencheeorg/benchee


text:
# ScrollView

A scrollable `View` that provides itegration with the touch-locking "responder"
system. `ScrollView`'s must have a bounded height: either set the height of the
view directly (discouraged) or make sure all parent views have bounded height
(e.g., transfer `{ flex: 1}` down the view stack).

## Props

[...View props](./View.md)

**contentContainerStyle**: style

These styles will be applied to the scroll view content container which wraps
all of the child views.

**horizontal**: bool = false

When true, the scroll view's children are arranged horizontally in a row
instead of vertically in a column.

**keyboardDismissMode**: oneOf('none', 'on-drag') = 'none'

Determines whether the keyboard gets dismissed in response to a scroll drag.

* `none` (the default), drags do not dismiss the keyboard.
* `on-drag`, the keyboard is dismissed when a drag begins.
* `interactive` (not supported on web; same as `none`)

**onContentSizeChange**: function

Called when scrollable content view of the `ScrollView` changes. It's
implemented using the `onLayout` handler attached to the content container
which this `ScrollView` renders.

**onScroll**: function

Fires at most once per frame during scrolling. The frequency of the events can
be contolled using the `scrollEventThrottle` prop.

Invoked on scroll with the following event:

```js
{
  nativeEvent: {
    contentOffset: { x, y },
    contentSize: { height, width },
    layoutMeasurement: { height, width }
  }
}
```

**refreshControl**: element

TODO

A [RefreshControl](../RefreshControl) component, used to provide
pull-to-refresh functionality for the `ScrollView`.

**scrollEnabled**: bool = true

When false, the content does not scroll.

**scrollEventThrottle**: number = 0

This controls how often the scroll event will be fired while scrolling (as a
time interval in ms). A lower number yields better accuracy for code that is
tracking the scroll position, but can lead to scroll performance problems. The
default value is `0`, which means the scroll event will be sent only once each
time the view is scrolled.

## Instance methods

**getInnerViewNode()**: any

Returns a reference to the underlying content container DOM node within the `ScrollView`.

**getScrollableNode()**: any

Returns a reference to the underlying scrollable DOM node.

**getScrollResponder()**: Component

Returns a reference to the underlying scroll responder, which supports
operations like `scrollTo`. All `ScrollView`-like components should implement
this method so that they can be composed while providing access to the
underlying scroll responder's methods.

**scrollTo(options: { x: number = 0; y: number = 0; animated: boolean = true })**

Scrolls to a given `x`, `y` offset (animation is not currently supported).

## Examples

```js
import React, { Component } from 'react'
import { ScrollView, StyleSheet } from 'react-native'
import Item from './Item'

export default class ScrollViewExample extends Component {
  constructor(props, context) {
    super(props, context)
    this.state = {
      items: Array.from(new Array(20)).map((_, i) => ({ id: i }))
    }
  }

  onScroll(e) {
    console.log(e)
  }

  render() {
    return (
      <ScrollView
        children={this.state.items.map((item) => <Item {...item} />)}
        contentContainerStyle={styles.container}
        horizontal
        onScroll={(e) => this.onScroll(e)}
        scrollEventThrottle={100}
        style={styles.root}
      />
    )
  }
}

const styles = StyleSheet.create({
  root: {
    borderWidth: 1
  },
  container: {
    padding: 10
  }
})
```

repository: tuckerconnelly/react-native-web

repo_name: tuckerconnelly/react-native-web


text:
# Casper's based Jaydson's theme

Custom theme for Jaydson's Blog (based on Casper) - [Jaydson Gomes](https://jaydson.com/).

To download, visit the [releases](https://github.com/jaydson/jaydson-ghost-theme) page.

repository: jaydson/jaydson-ghost-theme

repo_name: jaydson/jaydson-ghost-theme


text:
# Ingredient of the Week: The perfect baked potato

Published at: **2019-11-02T00:00:00+00:00**

Author: **Dailyrecord.co.uk**

Original: [dailyrecord](https://www.dailyrecord.co.uk/lifestyle/food-drink/ingredient-week-perfect-baked-potato-20764787)

This weekend will see lots of people heading to Bonfire nights, so it’s the ideal time for friends and family to get together and heat up afterwards with a delicious roasting hot baked potato for tea.
It doesn’t really matter what you fill them with – anything goes really, but for me it is all about the potato itself.
So how do you cook the perfect jacket potato.  Wrap it in foil? Start in the microwave first to give it a head start?
Well I like to jab the potato a few times with a fork or sharp knife, roll in olive oil and coat in a bit of sea salt.
Some people like to spear their potatoes with a metal skewer, as this makes them cook more quickly. Now there is science behind this technique as the metal rapidly conducts heat to the inside of the potato, speeding up the cooking process.
However, you decide to cook them, the most important (and delicious) thing to do is to eat the skin.
The skin not only tastes amazing but is so good for you as it can contain around half of the potato’s fibre and is jam packed with vitamins and nutrients.
All that’s left to do is to fill with your ingredient of choice; baked beans, cheese and tuna are still the traditional classic fillings.
Or why not do as I like to do, and fill with left over chilli, curries and casseroles, the fluffy potatoes soak up all the juices and flavours.
And if you do have any cooked baked potatoes left over - scoop out the fluffy inside as they make the most delicious mash, as there is less moisture absorbed.
But don’t waste the skin – grate some cheese on the top and melt. Delicious.

        Ingredients:

1 pack of Scotty Brand Bakers
Rapeseed or olive oil
Salt and pepper
Butter

        Method:

Preheat the oven to 200C/400F/Gas 6.
Wash the potatoes well, dry them and prick several times with a fork or sharp knife Pour some olive oil into a bowl and roll the potatoes in it until the oil covers all areas of the skin, then sprinkle over some sea salt.
The olive oil should mean the salt sticks to the skin. Coarse salt is best for this. Place directly on the shelf in the oven and bake for 1¼-1½ hours, depending on the size of the potato.
When cooked, the potato should have a deliciously crispy skin with a gorgeous golden colour.
Carefully slice open and place a knob of butter in the middle, which will melt instantly, and the potato can be eaten straight away or served with a filling of your choice.

license: Unlicense

repository: dsadlollioygjmzvcxv/tdc-exported

repo_name: dsadlollioygjmzvcxv/tdc-exported


text:
# ETH Course - Applied Multivariate Statistics

Multivariate statistics analyzes data on several random variables simultaneously. This course introduces the basic concepts and provides an overview of classical and modern methods of multivariate statistics including visualization, dimension reduction, supervised and unsupervised learning for multivariate data. An emphasis is on applications and solving problems with the statistical software R.

## Description

This repository gathers all the assigments done during the exercise sessions.

## Content

* Visualization
* Outliers
* Principal Component Analysis
* Multidimensional Scaling
* Cluster Analysis
* Factor Analysis
* Discriminant Analysis
* Logistic Regression
* Univariate Methods
* Trees & Random Forest
* Models for repeated measures data

## Prerequisites

All the sripts are run in R using R Studio.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgments

Dr. Fabio Sigrist kindly provide us exercise and lectures on this subject.


text:
# ProductImagePopup Panel

Shows an individual product image in the product image popup and the buttons to navigate between the product images.

### Available Variables
|||
|---|---|
| `%%GLOBAL_IMG_PATH%%` |
| `%%GLOBAL_IMG_PATH%%` |
| `%%GLOBAL_ProductName%%` |
| `%%GLOBAL_NavLinkDisplay%%` |
| `%%GLOBAL_DisablePrevLink%%` |
| `%%GLOBAL_DisableNextLink%%` |
| `%%GLOBAL_TotalImages%%` |

repository: hegrec/slate

repo_name: hegrec/slate


text:
# React create app boilerplate

This boilerplate has all the authentication flow implemented.

``` bash
cd good-old-react-authentication-flow
npm install
npm start
```

## Testing the upload feature

In your Strapi project run the following:

```bash
strapi generate:api product
```

then in your `/api/product/model/Product.settings.json` copy-paste the following:

```json
{
  "connection": "default",
  "collectionName": "",
  "info": {
    "name": "product",
    "description": ""
  },
  "attributes": {
    "name": {
      "type": "string"
    },
    "pictures": {
      "collection": "file",
      "via": "related",
      "plugin": "upload"
    }
  }
}
```
Register the admin user in strapi and you're good to go.

repository: ipwnosx/strapi-examples

gha_language: JavaScript

repo_name: ipwnosx/strapi-examples


text:
# Readable Clock

**A Fitbit clock face with readable fonts**

There are some beautiful Fitbit clock faces out there, but I often find that the fonts chosen are too small for me to comfortably read. So I made this clock face with the goal of maximizing the font sizes for readability.

![Screenshot of clock face](Readable-Clock-screenshot.png)

Tap anywhere on the screen to see the progress of all your goals:
![Screenshot of secondary clock face](Readable-Clock-screenshot2.png)

Install it on the [Fitbit Gallery](https://gallery.fitbit.com/details/72882fa2-6aba-4a59-aee7-993dcb7e616d).

## Features

* It uses big fonts!
* The rings fill in as each goal is met.
* Tap the screen to show values of all activities.
* Respects 12 or 24-hour clock display setting.
* Respects metric or US distance setting.
* Compatible with the Versa, Versa 2, and Versa Lite.

## Updates

- **13-May-2021**
    - Instead of cycling through each activity one at a time, tapping the screen now toggles to a screen showing the progress of all activities

- **30-Jan-2021**
    - Distance displays as km or mi depending on your settings.
    - Cycle through activity progress by tapping anywhere on the screen.

## Credits

Activity icons provided by Fitbit in the [SDK Design Assets](https://github.com/Fitbit/sdk-design-assets) repository.


text:
# tt-txrx-demoapp-ios-swift
iOS Swift demo application for Tertium rfid TxRx lowlevel library.

## License
The test application and the library are released under the MIT license. Please see the `LICENSE` file.

## Requirements
Xcode 11.1+

## Installation
To download full source code for the demo application and the TxRxLibrary follow these steps:

- Open a terminal window
- Change current directory to any Xcode source directory you have (f.e. Desktop/coding/)
- type: ```git clone https://github.com/tertiumtechnology/tt-txrx-demoapp-ios-swift --recurse-submodules ```
- Open Xcode
- Search the directory where you downloaded the files and open the project ```tt-txrx-demoapp-ios-swift/RfidTxRxLibDemoAppIosSwift.xcodeproj```
- Select a connected iOS device as build device and press Run

## Troubleshooting
If you have missing files (red filenames in Xcode) you may haven't correctly specified ```--recurse-submodules``` to git clone command. Please ensure option is specified.


text:
# Supplementary GlyphData for Contemporary Rovas (Old Hungarian)

This is a GlyphData.xml file for use with [Glyphs 3](https://glyphsapp.com). It contains the 15 new additions in the Unicode proposal for a Rovas update, a.k.a. ‘Rovás code chart for Contemporary Use Extended Hungarian Alphabet’. For details, see [Rovás kódolási segédlet / Guide to Rovas font encoding](http://rovas.info/rovas-encoding/).

## Installation

* To use in all your files: Move the GlyphData.xml file to `˜/Library/Application Support/Glyphs 3/Info/`.
* To use only in certain files: Move the XML file either in the same folder as the .glyphs file, or in a subfolder called `Info`.

Either way, you may need to restart the app for changes to take effect.

## License

Copyright 2021 Roland Hüse.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use the software provided here except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

See the License file included in this repository for further details.

repository: rolandhuse/ContemporaryRovasGlyphData

repo_name: rolandhuse/ContemporaryRovasGlyphData


text:
# zha-device-exporter
Custom HA component to export ZHA Zigbee devices

# Usage

Run service `zha_device_exporter.export_devices` This will export a JSON file (`zha-devices.json`) to the directory `zha-device-export` in the Home Assistant configuration directory.

repository: dmulcahey/zha-device-exporter

gha_language: Python

repo_name: dmulcahey/zha-device-exporter


text:
---
title: Change disk sleeping on OSX
author: Brad McCormack
type: post
date: 2012-05-15T23:36:12+00:00
url: /operating-systems/change-disk-sleeping-on-osx/
spacious_page_layout:
  - default_layout
dsq_thread_id:
  -<PHONE_NUMBER>
categories:
  - Apple
  - Information Technology
  - Operating Systems

---
I’m still learning OSX each day and this morning I finally had enough of the USB drive spinning up and down. To modify this open up a terminal and type the following

[code language=”bash”]

sudo pmset -a disksleep 0

[/code]

This basically means never put the disk to sleep for all profiles (battery, plugged in etc).

Type

[code language=”bash”]

man pmset

[/code]

to find out more.

repository: bradmccormack/blog

repo_name: bradmccormack/blog


text:
# JavaScript Code Quiz

[Link to finished website](https://lweine01.github.io/code-quiz/)

## Table of Contents
- [Description](#Description)
- [Screenshots](#Screenshots)
- [Usage](#Usage)
- [License](#License)
- [Language](#language)
- [Contact](#Contact)

## Description
In this assignment, I created a simple JavaScript code quiz to test the users knowledge.
The user has 60 seconds to complete the quiz and loses 5 seconds for every wrong answer.
At the end of the quiz they can subit their initials to be logged in the highscores page.
Click retake quiz to start again.

## Screenshots
![Code Quiz Home page screenshot](./assets/images/indexss.png)
![Code Quiz Highscores screenshot](./assets/images/highscoresss.png)

## Usage
This website provides a simple quiz to test the users knowledge of JavaScript.

## License
MIT

## Language
HTML, CSS and Javascript

## Contact
<EMAIL_ADDRESS>


text:
# `migra` is a schema comparison tool for PostgreSQL.

It's a command line tool, and Python library. Find differences in database schemas as easily as running a diff on two text files.

Migra makes schema changes almost automatic. Management of database migration deployments becomes much easier, faster, and more reliable.

Using `migra` is as simple as this:

    $ migra postgresql:///a postgresql:///b
    alter table "public"."book" add column "author" character varying not null;

    alter table "public"."book" alter column "name" set not null;

To get started, hit the [Quickstart guide](/quickstart).

repository: tolmacevalexandr/migra

gha_license_id: Unlicense

repo_name: tolmacevalexandr/migra


text:
**[Back](/README.md/)**

# Arduino

## Tutorials

Arduino is an open-source hardware and software company, project and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices.(ref: Wikipedia)

- [Official Homepage](https://www.arduino.cc/en/Tutorial/HomePage)
- [Official guide](https://www.arduino.cc/en/Guide): A comprehensive guide to Arduino topics.
- [ElectronicsHub](https://www.electronicshub.org/arduino-tutorial/): Example projects and basic Arduino tutorials.
- [Arduino forums](https://forum.arduino.cc/): Official Arduino forums
- [StackExchange](https://arduino.stackexchange.com/) Ask questions and get guidance from a wide community of Arduino enthusiasts.
- [Arduino Projects for Beginners to Advanced](https://create.arduino.cc/projecthub): Provides a list of really cool and fun projects for programmers and engineers of all levels to try.
- [Microcontrollers for Educators](https://app.schoology.com/course/299867764/materials): A link to all the resources used by Sparkfun's 2015 Microcontrollers for Educators workshop.
- [PyDuino Bot - Project](https://www.github.com/Omanshu209/PyDuino_Bot-WiFi): An interesting arduino project which teaches a lot!

## Video Tutorials

- [Arduino course for absolute beginners](https://www.youtube.com/playlist?list=PLYutciIGBqC34bfijBdYch49oyU-B_ttH) For beginners
- [Arduino Lessons](https://www.youtube.com/watch?v=d8_xXNcGYgo&list=PLGs0VKk2DiYx6CMdOQR_hmJ2NbB4mZQn-) Arduino Course
- [Arduino-Tutorials.net](https://arduino-tutorials.net/): 34 video tutorials on Arduino programming, geared towards beginners

## PCB design
- [Eagle tutorials](https://www.jeremyblum.com/category/eagle-tutorials/): An introduction to designing circuit boards (helpful for Arduino work)

repository: zero-to-mastery/resources

gha_language: Shell

repo_name: zero-to-mastery/resources


text:
# StoryboardExample

An example project that accompanies my tutorial on using interface builder within teams. Tutorial: http://blog.pusher.com/interface-builder-teams/

## Getting Started

Clone or download the repo onto your machine and open it in Xcode.
There is no code within this example project or functioning segues, it simply shows how you can hook up segues and use storyboard references.

### Prerequisites

* Xcode 9+

repository: cjbatin/StoryboardExample

gha_language: Swift

repo_name: cjbatin/StoryboardExample


text:
# Stateful Components

Components can tremendously useful when they manage their internal state. This allows for some pieces of the UI to have stateful bevavior without polluting the global Elmish state. For example when you have an accordion component, whether it is collapsed or expanded is a piece of information that might not be relevant to your Elmish models so you keep that information internal to that specific component. Otherwise, if you are "going Elmish all the way", you would to keep track of which accordion is now in it's open state and have messages that are resposible for expanding and collapsing a specific accordion.

State with React components is incorporated using [React Hooks](https://reactjs.org/docs/hooks-intro.html) which allow you to define state variables inside your functional components. A common hook to use with React is the `React.useState` hook.

> It is recommended that you use hooks only inside the defintion of your `[<ReactComponent>]` such that you could distinguish which parts of your application are simple functions and which parts are (stateful) components.

```fsharp:stateful-counter
[<ReactComponent>]
let Stateful() =
    let (count, setCount) = React.useState(0)
    Html.div [
        Html.h1 count
        Html.button [
            prop.text "Increment"
            prop.onClick (fun _ -> setCount(count + 1))
        ]
    ]
```
The hook `React.useState` is one of the most useful hooks which allows you to define a *state variable*. The syntax of `React.useState` follows:
```fs
let (value, setValue) = React.useState (initialValue)
```
where
```fs
val initialValue : 'T
val value : 'T
val setValue : 'T -> unit
```
The `setValue` function is what is called a *setter function* which is why it is common to prefix the function with "set{*Something*}".

When you call that function, the `value` will be updated and the component re-renders using this newly updated `value`.

### Multiple State Variables

A single component can keep track of multiple state variables at the same time. Here is an example
```fsharp:multiple-state-variables
[<ReactComponent>]
let MultipleVariables() =
    let (count, setCount) = React.useState(0)
    let (textColor, setTextColor) = React.useState(color.red)

    Html.div [
        Html.h1 [
            prop.style [ style.color textColor ]
            prop.text count
        ]

        Html.button [
            prop.text "Increment"
            prop.onClick (fun _ -> setCount(count + 1))
        ]

        Html.button [
            prop.text "Red"
            prop.onClick (fun _ -> setTextColor(color.red))
        ]

        Html.button [
            prop.text "Blue"
            prop.onClick (fun _ -> setTextColor(color.blue))
        ]
    ]
```

### Lazy State

React will call the initialization on every rerender, even if it's no longer needed.
In most cases this has no performance impact at all, however, in some cases where the
initial value is very expensive this can cause an application to become unusable.

You can ensure that expensive initialization functions only run once by passing in
an initializer function into `React.useState`:

```fsharp:use-state-lazy
[<ReactComponent>]
let UseStateNormal() =
    let count,setCount = React.useState (sortNumbers())
    Html.div [
        prop.classes [ Bulma.Box ]
        prop.children [
            Html.div [
                prop.text (sprintf "Normal Count: %i" count)
            ]
        ]
    ]

[<ReactComponent>]
let UseStateLazy() =
    let count,setCount = React.useState (fun () -> sortNumbers())
    Html.div [
        prop.classes [ Bulma.Box ]
        prop.children [
            Html.div [
                prop.text (sprintf "Lazy Count: %i" count)
            ]
        ]
    ]
```
### Simplified Model-View-Update components with React.useReducer

You can use the built-in `React.useReducer` hook to build simple model-view-update style components inside your application:
```fsharp:feliz-elmish-counter
type State = { Count : int }

type Msg = Increment | Decrement

let initialState = { Count = 0 }

let update (state: State) = function
    | Increment -> { state with Count = state.Count + 1 }
    | Decrement -> { state with Count = state.Count - 1 }

[<ReactComponent>]
let Counter() =
    let (state, dispatch) = React.useReducer(update, initialState)
    Html.div [
        Html.button [
            prop.onClick (fun _ -> dispatch Increment)
            prop.text "Increment"
        ]

        Html.button [
            prop.onClick (fun _ -> dispatch Decrement)
            prop.text "Decrement"
        ]

        Html.h1 state.Count
    ]
```

repository: Zaid-Ajaj/Feliz

gha_language: F#

repo_name: Zaid-Ajaj/Feliz


text:
# This is the software folder

** please refer to the Wiki for instructions on how to set up the software on the device **

There are multiple versions of the case and hardware for hte camera, and we provide here matching versions of the software for each hardware configuration.

The software for the v1 and v2 camera are in the the `v2_and_v1` folder. This is software for the fully 3D printed camera and the larger (v2) custom CNC'ed polycase enclosure. This runs on Raspbian 'Buster', and uses Picamera

The software for the v3 camera (smaller polycase enclosure) is provided in the `v3` folder. This runs on Raspbian 'Buster', and uses the Picamera library.

repository: UNCG-DAISY/Instagrain

repo_name: UNCG-DAISY/Instagrain


text:
---
layout: default
title: CodeNarc - Logging Rules
---

# Logging Rules  ("*rulesets/logging.xml*")

## LoggerForDifferentClass Rule

*Since CodeNarc 0.12*

Checks for instantiating a logger for a class other than the current class. Checks for logger
instantiations for **Log4J**, **SLF4J**, **Logback**, **Apache Commons Logging** and **Java Logging API
(java.util.logging)**.

This rule contains a parameter `allowDerivedClasses`. When set, a logger may be created about this.getClass().

Limitations:
  * Only checks Loggers instantiated within a class field or property (not variables or expressions within a method)
  * For **Log4J**: Does not catch Logger instantiations if you specify the full package name for the `Logger`
    class: e.g.  `org.apache.log4.Logger.getLogger(..)`
  * For **SLF4J** and **Logback**: Does not catch Log instantiations if you specify the full package name for the
    `LoggerFactory` class: e.g. `org.slf4j.LoggerFactory.getLogger(..)`
  * For **Commons Logging**: Does not catch Log instantiations if you specify the full package name for the
    `LogFactory` class: e.g.  `org.apache.commons.logging.LogFactory.getLog(..)`
  * For **Java Logging API**: Does not catch Logger instantiations if you specify the full package name for the
    `Logger` class: e.g.  `java.util.logging.Logger.getLogger(..)`

Here are examples of **Log4J** or **Java Logging API** code that cause violations:

```
    class MyClass {
        private static final LOG = LoggerFactory.getLogger(SomeOtherClass)  // violation
        def log1 = LoggerFactory.getLogger(SomeOtherClass.class)            // violation
        def log2 = LoggerFactory.getLogger(SomeOtherClass.class.name)       // violation
    }
```

Here are examples of **Commons Logging** code that cause violations:

```
    class MyClass {
        private static final LOG = LogFactory.getLog(SomeOtherClass)    // violation
        Log log1 = LogFactory.getLog(SomeOtherClass.class)              // violation
        def log2 = LogFactory.getLog(SomeOtherClass.class.getName())    // violation
    }
```

Here are examples of code that does NOT cause violations:

```
    // Log4J or Java Logging API

    class MyClass {
        private static final LOG = LoggerFactory.getLogger(MyClass)                    // ok
        def log2 = LoggerFactory.getLogger(MyClass.class)                              // ok
        private static log3 = LoggerFactory.getLogger(MyClass.getClass().getName())    // ok
        private static log4 = LoggerFactory.getLogger(MyClass.getClass().name)         // ok
        private static log5 = LoggerFactory.getLogger(MyClass.class.getName())         // ok
        private static log6 = LoggerFactory.getLogger(MyClass.class.name)              // ok
    }

    // Commons Logging

    class MyClass {
        private static final LOG = LogFactory.getLog(MyClass)                   // ok
        def log2 = LogFactory.getLog(MyClass.class)                             // ok
        private static log3 = LogFactory.getLog(MyClass.getClass().getName())   // ok
        private static log4 = LogFactory.getLog(MyClass.getClass().name)        // ok
        private static log5 = LogFactory.getLog(MyClass.class.getName())        // ok
        private static log6 = LogFactory.getLog(MyClass.class.name)             // ok
    }
```

## LoggingSwallowsStacktrace Rule

*Since CodeNarc 0.12*

If you are logging an exception then the proper API is to call error(Object, Throwable), which will log the message and the exception stack trace. If you call error(Object) then the stacktrace may not be logged.

## LoggerWithWrongModifiers Rule

*Since CodeNarc 0.12*

Logger objects should be declared private, static and final.

This rule has a property: `allowProtectedLogger`, which defaults to false. Set it to true if you believe
subclasses should have access to a Logger in a parent class and that Logger should be declared protected or public.

This rule has a property: `allowNonStaticLogger`, which defaults to false. Set it to true if you believe
a logger should be allowed to be non-static.

## MultipleLoggers Rule

*Since CodeNarc 0.12*

This rule catches classes that have more than one logger object defined. Typically, a class has zero or one logger objects.

## Println Rule

Checks for calls to `this.print()`, `this.println()` or `this.printf()`. Consider using
a standard logging facility instead.

## PrintStackTrace Rule

Checks for calls to `Throwable.printStackTrace()` or `StackTraceUtils.printSanitizedStackTrace(Throwable)`.
Consider using a standard logging facility instead.

## SystemErrPrint Rule

Checks for calls to `System.err.print()`, `System.err.println()` or `System.err.printf()`.
Consider using a standard logging facility instead.

## SystemOutPrint Rule

Checks for calls to `System.out.print()`, `System.out.println()` or `System.out.printf()`.
Consider using a standard logging facility instead.

repository: CodeNarc/CodeNarc

gha_language: Groovy

repo_name: CodeNarc/CodeNarc


text:
Role Name
========

Installs Supervisord via Python pip.
This version is often more up-to-date than what is available via standard package manager repos.

Requirements
------------

Python pip.  Installed on RedHat and Debian if not present.

Role Variables
--------------

The only variable is the default version of supervisord to install, which is 3.0.

From defaults/main.yml

    supervisord_version: 3.0           # Default version to install.

Dependencies
------------

None.

Example Playbook
-------------------------

Here's an example playbook.

    - hosts: servers
      roles:
         - { role: supervisord, supervisord_version: 3.0 }

License
-------

BSD

Author Information
------------------

Daniel McKean

repository: danlmarmot/demo-consul-vagrant

repo_name: danlmarmot/demo-consul-vagrant


text:
---
layout: post
title: The write stuff II
date: '2014-03-05 14:16:46'
---

![the write stuff](/images/2014/May/write_stuff_two.jpg)

Great news. The API team at GitHub have been busy over the last few weeks and have released a whole series of new, more granular oAuth scopes.

What this means is that we don't need to ask for **write** access to your profile in order to use Gitter. Huzah!

For new users, just head on over to **[Gitter](https://gitter.im)** and once you click signup you'll see the new oAuth permission request.

Existing users, just [sign out](https://gitter.im/signout) and then log back in again and you'll see the change to permissions.


text:
# Cinch::Plugins::Logsearch

Cinch Plugin to allow users to search through channel logs, easiest used with cinch-simplelog.

## Installation

Add this line to your application's Gemfile:

    gem 'cinch-logsearch'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install cinch-logsearch

## Usage

Just add the plugin to your list:

    @bot = Cinch::Bot.new do
      configure do |c|
        c.plugins.plugins = [Cinch::Plugins::LogSearch]
      end
    end

If your logs are not in `logs/*.logs` you will need to set a config
value to point to the location of your logs.

    c.plugins.options[Cinch::Plugins::LogSearch][:log_path] = '/var/logs/irc/*.log'

You can also change the number of results returned (Default: 5) by setting an additional config value:

    c.plugins.options[Cinch::Plugins::LogSearch][:max_results] = 10

## Contributing

1. Fork it
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 new Pull Request

repository: bhaberer/cinch-logsearch

repo_name: bhaberer/cinch-logsearch


text:
# WAI Consul Middleware

![TravisCI](https://travis-ci.org/fpco/wai-middleware-consul.svg)
![Hackage](https://img.shields.io/hackage/v/wai-middleware-consul.svg)

This library assists you in monitoring Consul k/v data & with
proxying data to Consul safely from the Internet.  The first use
case is receiving Github 'push' notifications when a repository is
updated and doing a git pull on all webservers to update content.
The [example](./example) app shows GitHub Webhooks working.

          ┌─────────┐      ┌─────────┐
          │ Github  │      │         │
          │  Repo   │─────▶│ AWS ELB │
          │ Webhook │      │         │
          └─────────┘      └─────────┘
                                │
            ┌────────────┬──────┘─ ─ ─
            │                         │
            ▼            ▼            ▼
       ┌─────────┐  ┌─────────┐  ┌─────────┐
       │         │  │         │  │         │
    ┌──│ WAI App │  │ WAI App │  │ WAI App │
    │  │         │  │         │  │         │
    │  └─────────┘  └─────────┘  └─────────┘
    │                    ▲            ▲
    │                    │            │
    │       ┌────────────┴────────────┘
    │       │
    │       │
    │  ┌─────────┐  ┌─────────┐  ┌─────────┐
    │  │         │  │         │  │         │
    └─▶│ Consul  │──│ Consul  │──│ Consul  │
       │         │  │         │  │         │
       └─────────┘  └─────────┘  └─────────┘

## Install

    cabal install wai-middleware-consul

Or if you want to play with the example github webhook web-app:

    cabal install -fexample wai-middleware-consul

## Example

You'll need to launch a small Consul cluster to try the example app.
It's easy to do with Docker.  Please use the following steps:

### Launch 4 containers of Docker w/ Consul running on each

    docker run -d --name node1 -h node1 progrium/consul -server -bootstrap-expect 3
    sleep 10
    JOIN_IP="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' node1)"
    docker run -d --name node2 -h node2 progrium/consul -server -join $JOIN_IP
    docker run -d --name node3 -h node3 progrium/consul -server -join $JOIN_IP
    docker run -d -p 8400:8400 -p 8500:8500 -p 8600:53/udp --name node4 -h node4 progrium/consul -join $JOIN_IP
    sleep 10

1.  Try out all the interfaces of Consul

    1.  Browse the [Web UI Interface](http://localhost:8500/ui/#/dc1/services/consul)

    2.  Query Consul at the command line

            consul members

    3.  Query the HTTP Interface

            curl <IP_ADDRESS>:8500/v1/catalog/nodes

    4.  Query the DNS Interface

            dig @<IP_ADDRESS> -p 8600 node1.node.consul

### Setting up a Github Webhook

First we start \`ngrok\` to proxy HTTP requests from the Internet to
our local machine (most likely behind a firewall).  Then we'll start
the example web application to receive webhooks from Github.

Run the example application (in the root Github directory for
wai-middleware-consul).  We need to be in this directory so our
example app can find/read cabal & Github version status.

    ./.cabal-sandbox/bin/wai-middleware-consul-example

Try navigating to the example app page. <http://<IP_ADDRESS>:8080>

Run ngrok to expose the example application to the Internet:

    ngrok 8080 ;# take note of this public web address for Github

Set up the webhook for the repo on Github. Point it to the ngrok web
address and add the path /github onto that URL ( eg,
<https://be2f75d.ngrok.com/github> ).  This is the specific route in
the example application for Github->Consul data updates.

Now that we have the application running and a proxy to the public
Internet established, we can receive webhook events.

Try pushing to the repository.  You should see notifications that an
event was received in the web application STDOUT log.  The event
should be pushed into Consul also.  The web application will be
listening to events from Consul & this will fire also.  You should
see it try to \`git pull\` the repository & you should see the changes
if you refresh the home page of the example app.

### Cleanup (kill & remove Consul containers)

    for n in $(seq 1 4); do
        docker kill node$n
        docker rm node$n
    done

repository: fpco/wai-middleware-consul

repo_name: fpco/wai-middleware-consul


text:
# Specifications for the Rails Assessment

Specs:
- [x] Using Ruby on Rails for the project
- [x] Include at least one has_many relationship (User has many supplies, category has many supplies)
- [x] Include at least one belongs_to relationship (Supplies belong to Category/user)
- [x] Include at least one has_many through relationship (User has many categories through supplies/ Category has many users through supplies)
- [x] The "through" part of the has_many through includes at least one user submittable attribute (Entire form for creating new supply/ donate towards supply)
- [ ] Include reasonable validations for simple model objects (list of model objects with validations e.g. User, Recipe, Ingredient, Item)
- [ ] Include a class level ActiveRecord scope method (model object & class method name and URL to see the working feature e.g. User.most_recipes URL: /users/most_recipes)
- [x] Include signup (Devise)
- [x] Include login (Devise)
- [x] Include logout (Devise)
- [x] Include third party signup/login (how e.g. Devise/OmniAuth)
- [x] Include nested resource show or index (URL categories/:id/supplies)
- [x] Include nested resource "new" form (can only make new supply/edit supply through categories)
- [x] Include form display of validation errors (form URL e.g. /recipes/new)

Confirm:
- [x] The application is pretty DRY
- [x] Limited logic in controllers
- [x] Views use helper methods if appropriate
- [x] Views use partials if appropriate

repository: paaaarv/tools-for-school

repo_name: paaaarv/tools-for-school


text:
# test-ESXi-Network
Test network connectivity on a new ESXi host- Are the physical NICs patched correctly?

This quick PowerCLI/PowerShell program was written to test connectivity on some new hosts before they were connected to vCenter and Distributed vSwitches setup. Rather than manually creating temporary Standard vSwitches, manually using vmkping, and then tidying up before progressing to the next NIC (and then the other hosts), this automates the testing process.

A blueprint for the expected network connectivity is defined at the top of the code -If I assign THIS IP to a vmk attached to THIS NIC (using THIS SUBNET MASK) I should be able to ping THIS TARGET IP. Any number of NICS to test can be added, the code loops through them in turn and returns an "OK" or "FAIL" message for each ping test.

## Example Output
```Test MyHost1.MyDomain.com vmnic0 OK
Test MyHost1.MyDomain.com vmnic1 OK
Test MyHost1.MyDomain.com vmnic4 OK
Test MyHost1.MyDomain.com vmnic5 OK
```

repository: isjwuk/test-ESXi-Network

repo_name: isjwuk/test-ESXi-Network


text:
{
  "title": "Meet the Sponsors - Binary Noggin",
  "authors": ["sponsorship"],
  "slug": "meet-the-sponsors-binary-noggin",
  "category": "sponsorship",
  "tags": ["sponsorship", "meet-the-sponsors"],
  "datetime": "2022-06-27T22:45:14.580424Z"
}
---
Meet the sponsors - Binary Noggin
---

Welcome to **Meet the Sponsors**, a new blog posts series in which you will learn about our sponsors and why they decide to support this great community. Today we will get to know Binary Noggin.
Enjoy it!

Binary Noggin is a group of dedicated engineers that create customizable solutions. They believe that working in groups is the key to success. As a sample of that, they have great experience in pair programming and testing.

# Why the BEAM

Binary Noggin has been developing software using the BEAM since 2017. The journey began when Amos King, its founder, was working on a secure chat software that was originally written in Java and needed more effective methods and tools.Therefore, they
decided to move the server to Erlang.

In Joe Armstrong's book, Amos found the scalability, speed, simplicity, and resiliency of the new server code. This ignited a passion to learn more about Erlang and the BEAM.

# About sponsoring the foundation

Binary Noggin highlights the importance of spreading the word about the power of the BEAM to support the languages, projects, and the community around it, and that’s why they decided to support our organization. They want to give back to the BEAM community and to get to know their projects as well. That is also why Amos King is the host of [Elixir Outlaws](https://elixiroutlaws.com/), a place to debate about interesting things happening in Elixir.

They would like the whole community to see the support that the foundation provides to open source developers in the BEAM. They believe that having a growing community is the key to continue in this journey.

# A little more about Binary Noggin

Binary Noggin was founded in 2007 by Amos King. He is also the owner of Elixir Outlaw. Amos lives in Kansas City and would love to share street tacos with anyone from the community who comes to town!

For more information, take a look at their [website](https://binarynoggin.com/)

Our foundation is supported by the funding of our sponsors, and it is what allows us to carry out projects, marketing
initiatives, stipends programs, and accomplish the goals that we have established as an organization. So if you are
interested in becoming a sponsor, contact us at
<a href="mailto:sponsorship<EMAIL_ADDRESS>We look forward to hearing from you!

repository: erlef/website

repo_name: erlef/website


text:
#### Name

Linux - Set Agent Log Level to Debug | v1.0 JCCG

#### commandType

linux

#### Command

```
#!/bin/bash

# Check for at command, necessary to schedule the command later
dpkg -l "at" > /dev/null 2>&1
if [ $? = '1' ]; then
    echo "at command could not be found, please install 'at' package"
    exit 1
fi

scriptFile="/var/tmp/jc_setAgent.sh"

# build the script
cat <<'EOF' > $scriptFile
#!/bin/bash

# Set Debug Level | Either "DEBUG" or "TRACE"
setLevel="DEBUG"

# File Locations
logLevelFile="/opt/jc/loglevel.cache"
scriptFile="/var/tmp/jc_setAgent.sh"

# Call LogLevel Function to set log level
if [ ! -f "$logLevelFile" ]; then
printf DEBUG > $logLevelFile
fi

# Restart Agent to start logging with new level
service jcagent restart

# Remove this script
rm -- "$0"
EOF
echo "Setting JumpCloud-Agent Log Level settings"
at now + 1 minutes -f $scriptFile

exit 0
```

#### Description

This command will set the JumpCloud Agent Log Level to Debug level.

#### *Import This Command*

To import this command into your JumpCloud tenant run the below command using the [JumpCloud PowerShell Module](https://github.com/TheJumpCloud/support/wiki/Installing-the-JumpCloud-PowerShell-Module)

```
Import-JCCommand -URL "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Linux%20Commands/Linux%20-%20Set%20Agent%20Log%20Level%20to%20Debug.md"
```

url: https://raw.githubusercontent.com/TheJumpCloud/support/41c5bf9312e580ac94576a4d2237414ea97f9d76/PowerShell/JumpCloud Commands Gallery/Linux Commands/Linux - Set Agent Log Level to Debug.md

repository: TheJumpCloud/support

filename: Linux - Set Agent Log Level to Debug.md

gha_language: PowerShell

repo_name: TheJumpCloud/support


text:
angular-sass-slim-coffeescript-guard-example
============================================

A simple example on how to start a project using AngularJS, SASS, CoffeeScript, Slim, and Guard to auto-compile it all for you.

As a bonus, I included the "Foundation 4" css framework to play with.

1. Clone/fork/download/whatever the project
2. Run `bundle install`
3. Run `guard`
4. Open `public/index.html` in your favorite browser and see if it works
5. Edit to your heart's content!


text:
![gui2go logo](http://2.bp.blogspot.com/-2vq3kNMc8nc/TjJzK2fyJjI/AAAAAAAAGHs/lY2v4tPFJEY/s1600/blog_icon.png)
======

GUI 2 Go allows you to design, edit and build User Interfaces for your Android Apps from anywhere using your Android tablet.

I'm releasing this app as open source because I don't have the time to support it anymore. All improvements are welcome!
Note: The app is stable and working well on 10" tablets but it does not support smaller screens (for now). Also there might be some refactoring needed :)

## Installation

Simply clone the repo and import it to your IDE.

## Features

	* A complete WYSIWYG Android GUI Designer/Builder/Editor
    * Total independence from SDKs, IDEs, etc.
    * Management of your Projects, Activities and Resources
    * Share your design layouts with your friends and co-workers

## License

(The MIT License)

Copyright (c) 20012-2013 Ami Goldenberg<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.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


text:
This is a parser for "Xcruciating Markup Language"[1] writen in TypeScript. I followed [Learning Parser Combinators With Rust](https://bodil.lol/parser-combinators) and used it to learn more about how parsers work and to experiment with TypeScript.

The TypeScript type inference isn't as good as Rust's so there are a lot more explicit type declarations in this version. I've added some type aliases to make function invocations less painful to reason about.

Tests are written with [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) because I had no interest in setting up all of the required infrastructure to write 'proper' tests.

## set up

* Install [NodeJS](https://nodejs.org/en/download/)
* Run `npm install`

## run

* `npm run compile`
* `npm run parse`

[1] https://bodil.lol/parser-combinators/#the-xcruciating-markup-language

repository: seancaffery/ts-parser-combinator

repo_name: seancaffery/ts-parser-combinator


text:
# Hello World

1. In a terminal window on your local machine with Docker installed, run the dockr command to verify that there are no container images stored locally (it is OK if there are, that just means you or someone else has been using Docker locally).

```shell
docker images
```
The output will probably look something like the following:

```shell
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
```

2. Use the Docker `run` command to both pull and run the standard hello world container.

```shell
docker run hello-world
```

The output will look something like the following:
```shell
Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
```

3. Now list the container images again.

```shell
docker images
```

You should see an image in the list from the Repository `hello-world`.  This image was pulled and stored locally so that the container could run and display the output you saw.

4. List the containers on your workstation with:
```shell
docker ps -a
```

The oputput will look something like the following:
```shell
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS                  NAMES
2be3e5c6573f        hello-world         "/hello"                 2 minutes ago       Exited (0) 2 minutes ago                          musing_curran
```

This indicates that a contain was run, and that it exited without error, given the value 0.

5. You can remove this exited container with the `docker rm` command and passing in the name of the container (i.e. `musing_curran`) or the container ID (i.e. `2be3e5c6573f`).

Remove your containerusing either your container id
```shell
docker rm 2be3e5c6573f
```
or the container name.
```shell
docker rm musing_curran
```

----

[Back to Overview](README.md)

repository: IBM-ICP-CoC/container-fundamentals-lab

repo_name: IBM-ICP-CoC/container-fundamentals-lab


text:
---
layout: post
title: Living with Legacy JavaScript - Event Proxies, App Seams, and Chunking Rewrites
tags: [code reading, javascript]
---

Sneak peek of [@talum](https://github.com/talum)'s upcoming talk at [EmpireJS 2018](https://2018.empirejs.org/schedule.html).

### Legacy Code

Learn.co is a really big platform. So many features.

But "old code" isn't necessarily "legacy code".

What is legacy code? Some definitions:

> Code that's "no longer in use" (check stackoverflow)

> Code we've gotten from someone else [Ed. note: But isn't that almost all our code? Not everyone on our team was here when core features were written.]

> Code without tests

Our definition for this talk:

- [X] Technologies no longer supported
- [X] Inherited from someone else
- [X] Untested

### The Story of a Codebase

Context helps you be more forgiving.

The story of learn.co codebase:

| Time     | Technology                   |
|----------|------------------------------|
| Mar 2014 | jQuery                       |
| Jan 2015 | Ember                        |
| May 2015 | Backbone + Marionette        |
| May 2016 | Rm Ember, add React + Alt.js |
| Aug 2017 | Redux                        |

How do we get all of these to play nice together?

1. Build a bridge
2. Look for a seam
3. Rewrite when time is right

### Building a Bridge

Backbone Radio <> Redux proxy: `reduxRadioProxy.js`

### Finding seams

Track nav used to be fully Backbone/Marionette. Now it's one Backbone/Marionette view that mounts and unmounts a React component.

Lots of code behind IDE open button. Could have rewritten, but instead wrote a reverse proxy: `radioReduxProxy`. Redux middleware that triggers Radio event.

Delaying rewrite to allow us to ship features faster.

### Rewrite

Got directive to build a stripped down lesson page. Took the opportunity to rewrite `lesson#show` in React.

Built side-by-side w/ existing system. One route gets React/Redux. One route gets Backbone/Marionette.

But watch out for bugs!

How to mitigate bugs:

1. Write more tests
2. Test all scenarios
3. Remove old code paths ASAP

gha_language: SCSS


text:
## ⬆ Install or Upgrade

Follow the [Flow CLI installation guide](https://docs.onflow.org/flow-cli/install/) for instructions on how to install or upgrade the CLI.

## 💥 Breaking Changes

### Configuration Format

The default configuration format (i.e. the contents of `flow.json`) has been updated.
It is now unified to work with all CLI commands.
The new format is not backwards compatible with the old format.

If needed, you can generate a new configuration file with the `flow init` command.

Read more about the new configuration format in the [documentation](https://docs.onflow.org/flow-cli/configuration).

### Updated: `flow blocks get`

The `--latest`, `--id` and `--height` have been removed.

### Removed: `flow keys decode`

The `flow keys decode` command has been temporarily removed due to a bug that requires further investigation.

### Removed: `flow keys save`

The `flow keys save` command has been removed in favour of an upcoming `flow accounts add` command.

## ⚠ Deprecation Warnings

The following functionality has been deprecated and will be removed in an upcoming release.

**`flow accounts create`, `flow accounts add-contract`, `flow accounts remove-contract`, `flow accounts update-contract`**

- Flag `--results` is deprecated, results are displayed by default.

**`flow accounts get`**

- Flag `--code` is deprecated, use `--contracts` flag instead.

**`flow events get`**

- Flag `--verbose` is deprecated.

**`flow keys generate`**

- Flag `--algo` is deprecated, use flag `--sig-algo`.

**`flow transactions send`**

- Flag `--code` is deprecated, use filename argument instead.
- Flag `--args` is deprecated, use `--arg` or `--args-json` instead.
- Flag `--results` is deprecated, results are displayed by default.

**`flow scripts execute`**

- Flag `--code` is deprecated, use filename argument instead.
- Flag `--args` is deprecated, use `--arg` or `--args-json` instead.

**`flow transactions status`**

- This command has been deprecated in favour of `flow transactions get`.

**`flow project init`**

- This command has been deprecated in favour of `flow init`.

**`flow project start-emulator`**

- This command has been deprecated in favour of `flow emulator`.

**`flow emulator start`**

- This command has been deprecated in favour of `flow emulator`.

## ⭐ Features

### Output

Output format was changed, so it stays consistent between commands. New flags were introduced
that control the output. Let's take a quick look at the new flags, but make sure to read
more about them in the documentation on each command:

- Output: `--output` specify the format of the command results (JSON, inline...),
- Save: `--save` specify the filename where you want the result to be saved,
- Log: `--log` control how much output you want to see during command execution,
- Filter: `--filter` Specify any property name from the result you want to return as the only value.

All the flags and their allowed values are specified
for each command in the [documentation](https://docs.onflow.org/flow-cli/).

Changed output for fetching account.
```
Address  179b6b1cb6755e31
Balance  0
Keys     2

Key 0   Public Key               c8a2a318b9099cc6...a0fe320dba7
        Weight                   1000
        Signature Algorithm      ECDSA_P256
        Hash Algorithm           SHA3_256

Code
         pub contract Foo {
                pub var bar: String

                init() {
                        self.bar = "Hello, World!"
                }
         }
```

Output account result as JSON.

```
{"address":"179b6b1cb6755e31","balance":0,"code":"CnB1YiBj...SIKCX0KfQo=","keys":[{"index":0,"publicKey":{},"sigAlgo":2,"hashAlgo":3,"weight":1000,"sequenceNumber":0,"revoked":false}],"Contracts":null}
```

Improved progress feedback with loaders.
```
Loading 0x1fd892083b3e2a4c...⠼
```

### Shared Library

You can import Flow CLI shared library from the `flowcli` package and use the functionality
from the service layer in your own software. Codebase was divided into two components, first
is the CLI interaction layer, and the second is the shared library component which is meant
to be reused.

### Account Staking Info Command

New command to fetch staking info from the account was added. Read more about it in the
[documentation](https://docs.onflow.org/flow-cli/staking-info).

```shell
> accounts staking-info 535b975637fb6bee --host access.testnet.nodes.onflow.org:9000

Account Staking Info:
ID: 			 "ca00101101010100001011010101010101010101010101011010101010101010"
Initial Weight: 	 100
Networking Address: 	 "ca00101101010100001011010101010101010101010101011010101010101010"
Networking Key: 	 "ca00101101010100001011010101010101010101010101011010101010101010ca00101101010100001011010101010101010101010101011010101010101010"
Role: 			 1
Staking Key: 		 "ca00101101010100001011010101010101010101010101011010101010101010ca00101101010100001011010101010101010101010101011010101010101010ca00101101010100001011010101010101010101010101011010101010101010"
Tokens Committed: 	 0.00000000
Tokens To Unstake: 	 0.00000000
Tokens Rewarded: 	 82627.77000000
Tokens Staked:<PHONE_NUMBER>0000
Tokens Unstaked: 	 0.00000000
Tokens Unstaking: 	 0.00000000
Total Tokens Staked:<PHONE_NUMBER>0000

Account Delegation Info:
ID: 			 7
Tokens Committed: 	 0.00000000
Tokens To Unstake: 	 0.00000000
Tokens Rewarded: 	 30397.81936000
Tokens Staked:<PHONE_NUMBER>0000
Tokens Unstaked: 	 0.00000000
Tokens Unstaking: 	 0.00000000

```

## 🐞 Bug Fixes

### Address 0x prefix

Addresses are not required to be prefixed with `0x` anymore. You can use either format, but
due to consistency we advise using `0x` prefix with addresses represented in `hex` format.

### Project deploy error

Deploying contract provides improved error handling in case something goes wrong you
can now read what the error was right from the commandline.

Example of error output:
```
Deploying 2 contracts for accounts: emulator-account

❌  contract Kibble is already deployed to this account. Use the --update flag to force update
❌  contract KittyItemsMarket is already deployed to this account. Use the --update flag to force update
❌  failed to deploy contracts

❌ Command Error: failed to deploy contracts
```

repository: jrkhan-bot/flow-cli

gha_language: Go

repo_name: jrkhan-bot/flow-cli


text:
# BKPR K8s Resource Policy

Version: 0.1

This document describes the standards and conventions used across our
Kubernetes resources.  It is intended primarily as an internal
reference, but may also be useful or interesting to other audiences.

  They need
to be unique to the set of resources being described.  As a minimum,
set the `name` label to the name (ie: `metadata.name`) of the
resource.

### NetworkPolicy

Must be declared and conservative, even if the underlying platform may
not actually enforce them (eg: minikube).

Specifically, no pod port may be accessible cluster-wide, and
clusterip services must only be accessible where they intend to
provide a cluster-wide service.

## Specific Resources

### PodSpec

#### Node Selectors

Must be set to the architectures supported by the docker image(s) used
in this pod.

#### Ports

Must be set to the list of ports intended to be exposed outside the
pod.  Note that Kubernetes treats this as informative only.

#### ServiceAccountName

Pods in the standard runtime must use an explicit ServiceAccount with
appropriately restricted permissions, *or* they must use
`automountServiceAccountToken: false` (and the `default` service
account).  Pods must not make API calls with the `default` service
account.

#### Liveness/Readiness Probes

All pods must specify a `livenessProbe`.  All pods that provide a
network service must specify a `readinessProbe`.

#### Mounts

Mounts of secrets, configMaps, downwardAPI, and projected volumes must
be explicitly mounted ReadOnly.  Other volumes should be mounted
read-only wherever possible.

repository: Gamingpc/kube-prod-runtime

gha_language: Jsonnet

repo_name: Gamingpc/kube-prod-runtime