text:
# AML Deployment Templates

Machine Learning Operations (MLOps) is based on DevOps principles and practices that increase the efficiency of Machine Learning workflows. It aims to facilitate faster experimentation, development and production deployment of Machine Learning models while ensuring high-quality standards. A standard end-to-end MLOps workflow will consist of model training, registration, deployment and monitoring.

This repository has references to several related MLOps deployment templates built using [Azure Machine Learning](https://docs.microsoft.com/en-us/azure/machine-learning/overview-what-is-azure-ml) and [Azure Pipelines](https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started/what-is-azure-pipelines) (part of Azure DevOps). The templates contain code and DevOps pipeline definitions to automate the end-to-end deployment of a machine learning platform, machine learning models as a web service for real-time inferencing or as a pipeline for batch inferencing using MLOps principles and practices.

These templates include unit tests and code coverage, model training and registration, controlled deployments (via approvals), [web service](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-enable-app-insights) or [pipeline](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-log-pipelines-application-insights) monitoring and data [drift monitoring and detection](https://docs.microsoft.com/en-us/azure/machine-learning/how-to-monitor-datasets).

## Projects

#### [AML Platform Deployment Template](https://github.com/nfmoore/aml-platform-deployment-template)
- Automated deployment of a machine learning platform using Azure DevOps
- The template serves as a foundation for other deployment templates but can also be used independently

#### [AML Real-Time Scoring Deployment Template](https://github.com/nfmoore/aml-real-time-deployment-template)
- Automated end-to-end deployment of machine learning models as a web service for real-time inferencing
- Useful for scenarios where machine learning models are integrated as part of real-time applications or Power BI reports and dashboards

#### [AML Batch Scoring Deployment Template](https://github.com/nfmoore/aml-batch-deployment-template)
- Automated end-to-end deployment of machine learning models as an AML Pipeline for batch inferencing
- Useful for scenarios where machine learning models generate insights at a regular frequency (e.g. every week) or as part of a wider data engineering pipeline (e.g. with [Azure Data Factory](https://docs.microsoft.com/en-us/azure/data-factory/transform-data-machine-learning-service))

## Prerequisites

- Azure subscription (contributor or owner)
- Azure DevOps project
- GitHub account

## References

- [Azure Machine Learning documentation](https://docs.microsoft.com/en-us/azure/machine-learning/)
- [Azure Pipelines documentation](https://docs.microsoft.com/en-us/azure/devops/pipelines/)
- [Azure Machine Learning Python SDK](https://docs.microsoft.com/en-us/python/api/overview/azure/ml/?view=azure-ml-py)
- [Azure Machine Learning CLI](https://docs.microsoft.com/en-us/azure/machine-learning/reference-azure-machine-learning-cli)

repository: salekinmushfik/aml-deployment-templates

repo_name: salekinmushfik/aml-deployment-templates


text:
# BasketballFieldsTurkey
This is an small GIS project which shows you the Basketball Fields of Turkey (only Ankara for now) on the map. You can see field's properties such as closing time, address etc. and it allows you to add new Basketball Field or change the properties of existing one. It also helps you to find Basketball fields around you and gives you directions to find any basketball field that you selected to go.

The FeatureServer of the Baksetball Fields is created by myself using ArcMap 10.5.1 and it is published on ArcGIS Online. Esri's widgets and basemaps are strongly used in this project. To show directions, Google's Directions Service is used.

license: MIT

repository: AkdenizKutayOcal/BasketballFieldsTurkey

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: AkdenizKutayOcal/BasketballFieldsTurkey


text:
---
layout: post
title:  "InsomniHack 2017 - Shobot"
last_modified_at:   2017-01-30 23:12:56 +0100
categories:
- Cybersecurity
---

Last week, InnovHacktion participated in the great InsomniHack CTF. It's easily one of the hardest CTFs I've been to so far, and I can't wait to try it again next year. We placed 76th out of 1000, but out of those 1000 teams only about 350 scored anything at all. So 76/350 if you want to count that way. We were also 11th in France!

Shobot was an odd challenge which included an SQL injection, but the impossibility to use SQLmap due to a "trust" system, on a weird site where you buy sex robots for tens of thousands of dollars. This challenge was worth 200 points, and was only validated by 83 teams.

![Shobot 0]({{ site.url }}/assets/Shobot0.png)

*No, I'm not kidding.*

The website itself seems straightforward: You can buy sexy robots on their online shop, but when you try checking out, the server informs you that it has gained self-awareness and refuses to sell you robots. I guess I'll have to keep using my hand, unless I can get control of the server back...

A look at the home page source code shows us a few interesting things:

![Shobot 1]({{ site.url }}/assets/Shobot1.png)

*Little-known fact: This is how real hackers browse the internet.*

At the top, there's weird "trust" variables with "movement" and "newTrust" fields. Weird... We'll get back to it later. There's also a commented-out admin page. Upon visiting it, we're asked to give a login and password, and the Server then basically tells us that it has changed the admin's password so he can't access the site either. Ok, cool.

So we start poking around, and find out a few interesting things. Everytime we try to SQLi anything, the website tells us we aren't "trusted" enough. We make the connection with the trust parameters in the source code and start experimenting. We soon found out that:

- The website uses a trust system to see which users are "trustworthy". You gain trust by buying items (3 trust for putting something in your cart, 10 for checking out your cart).

- Trustworthy users are allowed to do weird things with URLs, which lets us test things. But this costs a lot, if the website detects that we're doing an SQL injection for example, we lose 75 points.

![Shobot 2]({{ site.url }}/assets/Shobot2.png)

*The message you get if you try anything weird*

So we can't do anything without trust. But we know how to get trust, so let's code up a small script to get infinite trust! We soon found out that we were capped at 150 or so trust, and found the most efficient way to fill that up quickly. Note that we use a trick where you can add a non-existing item to your cart, but just once (id=0 here):

{% highlight python %}
import requests
import time

cookie = 'PHPSESSID=' + 'a95ev8unh160eg6qs9i2oihkn7'

url = 'http://shobot.teaser.insomnihack.ch/?page=article&artid='
buy = '&addToCart'
i = 0
count = 0

while count < 13:
    r = requests.get(url + str(i) + buy, headers={'Cookie' :  cookie})
    if i < 4:
        i = i + 1
    else:
        count = count + 1
        r = requests.get('http://shobot.teaser.insomnihack.ch/?page=cartconfirm', headers={'Cookie' : cookie})
        i = 0
{% endhighlight %}

Using our session ID, we're able to run this script and get enough trust to poke at the site and start breaking things, [our favorite part of any challenge]({{ site.url }}/assets/some_people.jpg). We quickly find a parameter that acts odd: the "artid" (article id) parameter on the online store. There are only 3 articles, 1 to 3. If we enter values like 0 or 1337, the site doesn't 404, it just displays a product page with nothing in it, which already tells us this is probably using a database of some sort:

![Shobot 3]({{ site.url }}/assets/Shobot3.png)

*Yes, you can add it to cart.*

However, I ended up figuring out that one character behaves differently: an apostrophe. One apostrophe displays an empty page, which tells me there was an internal error and the server just stopped rendering the page there. It's probably crying, too. The fact that entering a number and then letters, like "artid=2 I like pancakes" doesn't break and instead displays the page for artid=2 also tells us that this is a MySQL server, which will matter later (MySQL likes to cast things to other things, and in this case, casts strings to ints by removing everything after the first number it finds).

![Shobot 4]({{ site.url }}/assets/Shobot4.png)

*This is what a sad server looks like.*

So after poking at it a bit more, we find that the request expects 5 parameters returned, so our UNION'd SELECT should be something like:

`artid=0' UNION SELECT 1,1,1,1,1; --%20`

Which gives us:
![Shobot 5]({{ site.url }}/assets/Shobot5.png)

*This is the page displaying image 1, title 1, price 1 and description 1, because of our crafty SQL request! nyeh nyeh nyeh*

Now we can replace a 1 by what we want to get. We know it's a MySQL database, so we know how to get table names and the likes, and if we didn't we could go to [this great cheat sheet](http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet) and pretend we knew it all along. After lots of blind poking around, we find that the user table is called `shbt_user`. After a bit more poking around, we find the column names and so the final injection looks like:

`artid=0' UNION SELECT 1,1,shbt_username,1,shbt_userpassword FROM shbt_user; --%20`

And that gives us:

![Shobot 6]({{ site.url }}/assets/Shobot6.png)

And that's it, we get access to the admin panel and get the flag! And that's how I bought my sex robot.

gha_language: HTML

gha_license_id: MIT


text:
# Pleoravenelia hieronymi (Speg.) Long, 1903 SPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bot. Gaz. 35: 127 (1903)

#### Original name
Ravenelia hieronymi Speg., 1881

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Basidiomycota/Pucciniomycetes/Pucciniales/Raveneliaceae/Ravenelia/Ravenelia hieronymi/ Syn. Pleoravenelia hieronymi/README.md

repo_name: mdoering/backbone


text:
## CryptoX

Technology has changed the way people work, communicate, shop, pay and collaborate. One such transformation was the origin of cryptocurrency.

![image](https://user-images.githubusercontent.com/66024577/127145857-aee472c8-89f1-441f-9435-75e75c8402d0.png)

A cryptocurrency is a digital or virtual currency that is meant to be a medium of exchange. It is secured by cryptography, which makes it nearly impossible to counterfeit or double-spend. Many cryptocurrencies are decentralized networks based on blockchain technology. A defining feature of cryptocurrencies is that they are generally not issued by any central authority, rendering them theoretically immune to government interference or manipulation.

This is an iOS application that helps the user to track his/her investments and maintain portfolios.

### Key features:
- [x] Live cryptocurrency data tracking
- [x] Portfolio maintenance
- [x] Graphical representation of coin market
- [x] Realtime searching, sorting and filtering of coins
- [x] Dark mode adaption
- [x] Optimised for enhanced runtime experience

### Technical applications:
- [x] MVVM(Model-View-ViewModel) structural pattern
- [x] SwiftUI framework
- [x] Core Data
- [x] Codable type
- [x] File Manager
- [x] Networking Layer

## Blog

Do checkout this blog : [CryptoX-My take on Cryptocurrency](https://medium.com/@anant4265/cryptox-my-take-on-cryptocurrency-2207fe354932)✍🏻

### Screenshots

## Maintainer

[Anant Kanchan](https://github.com/anantcodes)

## License

[MIT License](https://github.com/anantcodes/CryptoX/blob/master/LICENSE)

repository: TrendingTechnology/CryptoX

repo_name: TrendingTechnology/CryptoX


text:
# serviced/web/ui

The `serviced/web/ui` folder contains the UI code for the serviced.

## Directory structure
The following is a partial illustration of the subdirectory structure for the parent directory `serviced/web`
 ```
 + serviced
   |
   +-- web               REST backend source
   +-- ui                UI source
       |
 	     + static
         |
         +-- build       build results including the full set of files for runtime
         |
         +-- src         UI javascript code
         |
         +-- static      static assets used by the UI including thirdparty libraries
         |
         +-- test        unit-test code for the UI javascript
 ```

## Build Setup
Nothing special is required to build the code in `serviced/web`. The toplevel makefile for serviced calls the `serviced/web/ui/makefile`to build the UI code By default, the `serviced/web/ui/makefile` uses the Docker container `zenoss/serviced-build` defined in `serviced/build/Dockerfile` to launch the UI portion of the build. This image contains all of the tools required to build the UI.

If you have node.js installed locally, then the first time the build is executed a number of additional third-party UI build tools will be automatically downloaded and cached locally. This may take a few minutes. However, after the tools are cached locally, subsequent builds will not repeat those downloads.

If you do not have node.js installed locally, these tools are included in the Docker image `zenoss/serviced-build`.

### Primary make targets
The three primary make targets are `build`, `test`, and `clean`. All of these targets perform the corresponding action on the Javascript code. Developers who want to build/test/clean _only_ the Go code or _only_ the Javascript code should use the native build tools for those languages directly rather than make. For Javascript, the primary build tool is [gulp](http://gulpjs.com/).

### Installing dev tools locally

Do these things and then you'll be able to develop the CC UI app supes fast!

install nodejs 6

    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    sudo apt-get install -y nodejs

make sure you have build tools (for native npm modules)

    sudo apt-get install -y build-essential

install a few global npm packages

    sudo npm install --global gulp jshint babel yarn

navigate to the `web/ui` directory and remove `node_modules` if present

    rm -rf node_modules

install CC UI dev dependencies using yarn

    yarn install --pure-lockfile

use our local npm repo by adding the following line to your `$HOME/.npmrc`:

    registry = http://nexus.zenoss.eng:8081/nexus/content/repositories/npm

And now you're all set to develop the CC UI app locally. The previous steps are all (mostly) one-time setup. To develop the web app, open either Chrome (recommended) or Firefox's dev tools, make sure caching is off (you should be able to specifically disable caching when dev tools is open), and run the following in a terminal:

    gulp watch

Now whenever changes are made to the source html, css, or js, the web app will be rebuilt on the fly. Refresh the page in the browser and you will see your changes right away. Boom! Now learn to use Chrome's dev tools! They're amazing!

NOTE: `gulp watch` will not transpile javascript, which means you need to keep your browser up to date to use this feature. If this is not possible, manually run `gulp` each time a change is made to the javascript source and gulp will build AND transpile the code to work on all supported browsers (IE10+).

### Installing dev tools locally - the longer version
It is recommended (but not required) that developers working on the UI code install the Javascript build tools directly.
The makefile will not use the Docker container `zenoss/serviced-build` if it finds [Node.js](http://nodejs.org)
on the user's path. Therefore, bypassing the Docker container will speed up your local builds a little bit.

If you are building locally, please create (or update) your `$HOME/.nmprc` file to contain the following line:
```
registry = http://nexus.zenoss.eng:8081/nexus/content/repositories/npm
```
This will direct NPM to pull artifacts from the Zenoss-local NPM repo on our
[Nexus server](http://www.sonatype.com/nexus-repository-sonatype) -
http://nexus.zenoss.eng:8081/nexus/#view-repositories

Regardless of whether you are using the `zenoss/serviced-build` container or installing the tools locally, the tool chain for UI builds is divided into two parts:
  * pre-requisite tools
  * all other build-time dependencies

The pre-requisite tools are ones which must be pre-installed. The `zenoss/serviced-build` container includes these tools.
If you want to install them locally, refer to the commands in [`serviced/build/Dockerfile`](../../build/Dockerfile) for the following packages:
  * [Node.js](http://nodejs.org) - a Javascript application platform
  * [npm](https://www.npmjs.com/) - the node package manager. npm is bundled with the Windows and Mac distros of node.js, but has to be installed separately for Linux
  * [yarn](https://yarnpkg.com/) - an alternate package manager that provides reproducible builds and quicker dependency resolution
  * [gulp](http://gulpjs.com/) - a Javascript build tool
  * [babeljs](https://babeljs.io/) - a Javascript transpiler that converts modern js into more broadly compatible js

Once the pre-requisite build tools are installed, all other components of the JS tool chain are downloaded by npm based on the definitions in [`serviced/web/ui/package.json`](./package.json).  If you build with make, this download happens automatically. If you are not building with make, you will need to run the command `yarn install --pure-lockfile` once to download the rest of the tool chain.

**NOTE:** yarn will cache everything it downloads in `serviced/web/ui/node_modules`.  In the unlikely event, you encounter a problem with
incompatible tool versions, you may have to delete this directory and download a fresh set of dependencies by rerunning the make (or running `yarn install --pure-lockfile` if you have installed yarn on your local).

### Updating dev tool versions
To change a version of one of the prerequisite tools (node.js, npm, yarn, gulp or babeljs), you must edit [`serviced/build/Dockerfile`](../../build/Dockerfile) to include the necessary changes.
Be sure that your `$HOME/.npmrc` file is pointed at `http://nexus.zenoss.eng:8081/nexus/content/repositories/npm`
Be sure to test with a clean build, removing `serviced/web/ui/node_modules` just to be safe.

To change a version of one of the other tools, edit [`serviced/web/ui/package.json`](./package.json).

**If a change is made to `serviced/web/ui/package.json`, `yarn.lock` *must* be updated as well.** Use the following procedure to ensure newly installed dependencies are locked down:

```
$ cd web/ui
$ rm -rf node_modules

<< make your changes to package.json >>

$ yarn install

<< build/test with the new changes>>
<< commit changes to package.json and yarn.lock >>
```

Verify a local build works with your changes. Assuming it does, then you need to refresh the `zenoss/serviced-build`
Docker image to include your changes so everyone who does NOT have node.js installed will use them also.

```
$ cd ../..
$ make buildServicedBuildImage
$ make pushServicedBuildImage
```

## Rebuilding thirdparty.js
All of the thirdparty JS libraries used by Control Center are concatenated and minififed into a single file, `serviced/web/ui/static/lib/thirdparty.js`.  Since the concatenation/minification process takes ~10 seconds and the set of third-party libraries does not change very often, the thirdparty.js file is NOT rebuilt as part of the regular build process.
This file must be constructed manually anytime a third-party JS library is added, changed or removed.

```
<< update the library/libraries in serviced/web/ui/static/thirdparty as necessary >>

$ cd web/ui
$ gulp release3rdparty

<< test your changes >>
<< commit the changes to servcied/web/ui/static/thirdparty/* >>
```

## Adding static files to the build image
The JS build stages all necessary runtime files in `serviced/web/ui/build`. Make targets in [`serviced/makefile`](../../makefile) are responsible for copying the entire contents of `serviced/web/ui/build` into the RPM and Debian packages.  If you want to add/change/remove the files delivered in the runtime packages, you must modify the JS build to only stage the files you want. The gulp target `copyStatic` performs the actual copy operation. See the list of files in the variable `staticFiles` defined in [`gulpfile.js`](gulpfile.js).

## Unit-testing
Control Center uses [Jasmine](http://jasmine.github.io/) as the unit-test framework and [Karma](http://karma-runner.github.io/) as the test runner. The Javascript unit-tests are run automatically as part of the CI build (i.e. they are run by `make test`).
To run the tests manually for debugging, use the following steps (all of which assume that the pwd is `serviced/web/ui`)

1. Build your JS changes
The default gulp target will lint, compile and concatenate the code in `serviced/web/ui/src`. The default target will NOT minify the results (`gulp release` includes minification for production builds).

  ```
  $ cd web/ui
  $ gulp
  ```

1. Run the tests

  ```
  gulp test
  ```

1. Launch the unit-tests in a browser for debugging
The `test` target in gulp runs against PhantomJS, a headless webkit browser, which is great for CI builds, but not useful for debugging locally. The following command uses Karma to assemble the necessry test files, and launch them in Chrome for debugging.

  ```
  $ zendev use europa
  $ zendev cd serviced
  $ cd web/ui
  $ ./node_modules/karma/bin/karma start karma.conf.js --browsers Chrome --reporters html --auto-watch
  ```

Once the new browser window is open, click the `DEBUG` button to launch the tests in a new tab. From the new tab, you can open the Developer Tools, set a breakpoint where you like, and refresh the page to rerun the tests.  By specifying, `--auto-watch` on the command line you are telling Karma to watch for file changes, so you can edit your code, save it and refresh the browser to test your latest changes.

To test in Firefox, use the same command but replace "Chrome" with "Firefox".

Here is the command that will run the unit-tests against each of 3 browsers and stop as soon as they are done:

  ```
  $ node_modules/karma/bin/karma start karma.conf.js --browsers Chrome,Firefox,PhantomJS --single-run
  ```

A full explanation of the Karma configuration options is beyond the scope of this README. See the [Karma doc](http://karma-runner.github.io/) for a complete description.

**NOTE:** For Jenkins integration, `gulp test` creates a Junit-style test report in `serviced/web/ui/test/results/results.xml`

## Code Coverage
The default configuration for `gulp test` includes calculation of code coverage statistics. These statistics can be viewed in Jenkins or locally. To view them locally, open the file `serviced/web/ui/test/results/coverage/PhantomJS 1.9.8 (Linux)/index.html`.

The code-coverage configuration includes threshold checking, such that if the coverage falls below certain thresholds, the build will fail.  For the exact threshold values, see the `thresholdReporter` section of [`serviced/web/ui/karma.conf.js`](./karma.conf.js).

**NOTE:** For Jenkins integration, `gulp test` creates a Cobertura-style test report in `serviced/web/ui/test/results/test/results/coverage/PhantomJS 1.9.8 (Linux)/cobertura-coverage.xml`

repository: control-center/serviced

branch_name: refs/heads/develop

gha_language: Go

repo_name: control-center/serviced


text:
*2019-08-06*

After a long while, I just tried running `gulp dev` as usual but got unexpected error
`primordials is not defined in node`.
Fortunately, was able to quickly "fix" this by following https://stackoverflow.com/a/56328843/830737,
basically:

```
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

$ export NVM_DIR="$HOME/.nvm"
$ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
$ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

$ nvm install lts/dubnium
$ nvm use lts/dubnium

$ npm install

$ gulp dev
[15:06:50] Building version 3.8.4
[15:06:50] Using gulpfile ~/github/mmisw/orr-portal/gulpfile.js
[15:06:50] Starting 'webserver'...
[15:06:50] Webserver started at http://localhost:9001
[15:06:50] Finished 'webserver' after 13 ms
[15:06:50] Starting 'dev'...
[15:06:50] Finished 'dev' after 6.3 ms
```

*2016-01-03*

html5Mode

When exercising dispatch from orr-ont and with $locationProvider.html5Mode(true), there was an error
in angular.js:11449 because of access to undefined url parameter.
I included condition:
```js
function trimEmptyHash(url) {
  return url ? url.replace(/(#.+)|#$/, '$1') : url;
}
```

Anyway, seems like $locationProvider.html5Mode(true) (or $locationProvider.html5Mode({ enabled: true, requireBase: false }))
makes the base href to get displayed, that is,
if initially:  http://localhost:8080/orr-ont/api/v0/ont?uri=http://mmisw.org/ont/ooi_epe/instruments
then replaced to: http://localhost:8080/orrportal/

but what I need is to continue showing the {orr-}ont-based URL

So, seems like html5Mode cannot be used in conjunction here.

repository: mmisw/orr-portal

gha_language: JavaScript

repo_name: mmisw/orr-portal


text:
---
layout: post
title: "OCaml Improved"
date: 2021-11-16 21:22
comments: true
tags: [ocaml]
---

In the [last post]({% post_url 2021-11-14-ocaml-dream %}), we played with [Dream](https://aantron.github.io/dream) while doing very basic stuff in [OCaml](https://ocaml.org/). We saw how using Sets vs. Hashtables could make a difference in performance and worked around it to allow solutions using [Sets](https://ocaml.org/api/Set.html) and Hashtables. In this post, we will see how to attain the polymorphic behavior of OCaml programs by using [Modules](https://ocaml.org/learn/tutorials/modules.html).

<!--more-->

# Modules

Coming from Java - mostly - the idea of Modules is something alien to some extent. Especially in the [language's page about them](https://ocaml.org/learn/tutorials/modules.html). The explanation revolves more around how modules help you organize code, open / include them, etc. Then you have [First-Class Modules](https://dev.realworldocaml.org/first-class-modules.html) in Real World OCam that is more or less a punch in the face.

I had to read many times and do some try and error until I managed to get to the state I will share in a second. Although I can't fully explain modules, they are certainly a potent tool of the language, and a good bulk of polymorphism and parametrization will flow through them.

There is even a second level of complexity with the so-called [Functors](https://dev.realworldocaml.org/functors.html) (no, they are not the Haskell [Functors](https://mmhaskell.com/monads/functors) I thought at first).

I will leave the theory and syntax explanation for those links above, and let's see what I got while improving my program.

# The problem

The core piece of the problem from the previous solution is here:

```ocaml
let add achar target =
    let added = CharSet.add achar target in
    target <> added, added

let add_ht c ht =
  let lbefore = Hashtbl.length ht in
  Hashtbl.replace ht c c;
  lbefore < Hashtbl.length ht, ht

let rec solve' word' container add_fn = match word'() with
    Seq.Cons (c, xs) ->
        (match add_fn c container with
          (true, s)  -> solve' xs s add_fn
          | _ -> Some c)
  | _ -> None

let solve word =
  solve' (String.to_seq word) CharSet.empty add

let solve_ht word =
  let size = String.length word and seq = String.to_seq word in
  solve' seq (Hashtbl.create size) add_ht
```

Both `solve` and `solve_ht` (functions respectively called from the request handler for Set based and Hashtable based solutions) need to provide two extra parameters to the `solve'` function. One is the `container` empty instance (Hashtable or Set) and a function that knows how to add elements to the desired containers, provided that the interfaces are different.

The solution works, but it's pretty basic, conceptually speaking. It's more of a [clojure](https://clojure.org/) style of doing things. But how would that look like with modules?

# The Solution

Let's start with the contract, or the signature of what we are trying to generify:

```ocaml
module type CHAR_CONTAINER =
  sig
    type container
    val contains : container -> char -> bool
    val add : container -> char -> container
    val empty : unit -> container
  end
```

To comply with the solution, we needed a way to get an `empty` container, whatever it is. We need a way to `add` elements to it. And, as you will see with the improved logic using pattern matching with guards, we need a way to look up into the container, here represented by `contains`. I know, you Java developer will be thinking: These interfaces are common in the [Collections framework](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Collection.html), why the heck are you creating an interface for it? Well...

Comparisons apart, here is what we call `CHAR_CONTAINER`. It represents something with the provided signature, so our solution function can rely on it instead of forwarded arbitrary functions. How would a conformant implementation for Sets look like? Here we have it:

```ocaml
module SetContainer =
  struct
    module CharSet = Set.Make(Char)
    type container = CharSet.t

    let contains con c = CharSet.find_opt c con |> Option.is_some
    let add con c = CharSet.add c con
    let empty () = CharSet.empty
  end
```

Beautiful, huh? A way to understand the `type container` statement, is similar to define `MyClass<Set>` instance for a `MyClass<T>`, where you parametrize your class with some generics then specify it at creation time. Here we say that this module's `container` type is a `Set` of `Char`.

The implementation for contains wraps the `find_opt` that looks up and return an optional. I'm just converting it to a `bool`. And then `add,` and `empty` follows pretty basically.

The Hashtable version is quite similar. Take a look:

```ocaml
module HashTblContainer =
  struct
    type container = (char, char) Hashtbl.t

    let contains con c = Hashtbl.find_opt con c |> Option.is_some
    let add con c = Hashtbl.replace con c c; con
    let empty () = Hashtbl.create 10
  end
```

The `container` is different. But the rest of the implementation is quite similar. I used a `create 10` as an arbitrary size. We can change `empty` to take a different context, but I intentionally want to live the signatures like this to talk about [Monoids](https://typelevel.org/cats/typeclasses/monoid.html) in future opportunities.

Before we see how we pass the modules to our `solve` function, let's quickly revisit how the new solution looks like:

```ocaml
let solve word (module M : CHAR_CONTAINER) =
  let rec solve' con word' = match word'() with
      Seq.Cons (c, _) when M.contains con c -> Some c
    | Seq.Cons (c, xs) -> solve' (M.add con c) xs
    | Nil -> None in
  let empty = M.empty () and word_seq = String.to_seq word in
  solve' empty word_seq
```

Much shorter and elegant. Given a sequence of chars, the problem it tries to solve is to detect the first repeated letter. The logic now takes a module that conforms with `CHAR_CONTAINER` and the `word` itself. Then starts the `solve'` that will match the `Seq` of `char`, and if the first char is contained in the container, it returns right away. Otherwise, the char is added to the container, and the function is called again. And finally, if the sequence is exhausted (`Nil`) it returns `None`.

The two functions that dispatch to the `solve` function need to do the heavy lift of summoning the appropriate `CHAR_CONTAINER`:

```ocaml
let solve_set word =
  let mySet = (module SetContainer : CHAR_CONTAINER) in
  solve word mySet

let solve_ht word =
  let myHtable = (module HashTblContainer : CHAR_CONTAINER) in
  solve word myHtable
```

They are then conditionally called from the request handler. The interface remains the same, and if you run the code provided in the [post repository](https://github.com/paulosuzart/ocaml-example), you can access `http://localhost:8080/find_repeated?word=BBana` and get back a beautify `Found B`.

# Conclusion

The first conclusion is something that I always say: the more you understand the problem, the more you improve your solution iteratively. The first version uses a convoluted, much more expensive implementation, using `length`, etc. It was also using these arbitrary functions and providing different values as containers to the solving function. Turing its signature much worse.

Using `module`, it was possible to have an algorithm that would rely on a specific interface, and the underlying implementation is a mere detail.

This post makes a good case for talking about Libraries like [Cats](https://typelevel.org/cats/) (*I hope I can stay away from the war going on in the community*), [ScalaZ](https://scalaz.github.io/7/) (always terrible documentation) or Type Classe in [Haskell](http://learnyouahaskell.com/types-and-typeclasses).

Note how uniformizing the way things interact can bring a high degree of reusability and understanding across different domains.

You can clone and run this [repo](https://github.com/paulosuzart/ocaml-example) to play a bit (tests coming soon)!

gha_language: SCSS


text:
---
title: 'Unable to load dynamic library ‘/usr/lib/php5/20090626/sqlite.so’'
author: gjergj.sheldija
layout: post
permalink: /unable-to-load-dynamic-library-usrlibphp520090626sqlite-so/
categories:
  - code
  - linux
  - php
  - ubuntu
tags:
  - php sqlite error 20090626 sqlite.so
comments: true
---
if you happen to have this error with php 5 on ubuntu 11.10

PHP Warning: PHP Startup: Unable to load dynamic library /usr/lib/php5/20090626/sqlite.so - /usr/lib/php5/20090626/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0.
This has occurred because sqlite support was removed, in favour of pure sqlite3. It seems that a config file was left in place.
to fix it, just :

```bash
sudo rm /etc/php5/conf.d/sqlite.ini
```


text:
# Iterm Configuration

1. **Install [Iterm2](https://iterm2.com/)**
2. **Install [oh-my-zsh](https://ohmyz.sh/#install)**
3. **Set Material Design colors from [iterm2-material-design](https://github.com/MartinSeeler/iterm2-material-design)**
4. **Install [powerlevel10k](https://github.com/romkatv/powerlevel10k)**
5. **Set a top-down terminal window accessible via hotkey**

   * In iTerm2 open preferences (or press `⌘` + `,`).
   * Go to the _Keys_ tab and then to the _Hotkey_ tab, inside it click on the _"Create a Dedicated Hotkey Window…"_ button.
   * In the panel that opens up, set _Hotkey_ to `⌃(Ctrl)` + `` ` `` and check the following options:
      * Pin hotkey window (stays open on loss of keyboard focus)
      * Animate showing and hiding
      * Floating window
   * In the _On Dock icon click_ option check _"Don't do anything special"_
   * Click _OK_

   After this the hotkey terminal window can be toggled on and off by pressing `⌃(Ctrl)` + `` ` ``.

   For customizations open preferences, go to the _Profiles_ tab and select the _Hotkey Window_ profile.

repository: gusleindecker/web-development-settings

branch_name: refs/heads/main

repo_name: gusleindecker/web-development-settings


text:
## StructMap

This wraps a structured Map that looks like a JSON document, containing Map, List, and other 'Object's as values.

A key is a String containing branches separated by '.' characters for each sub structure.

It provides a method to collect all value referencing keys in the map structure with full key paths.

It provides a lookup method that takes a full value key path and returns a value.

Note that since this delegates to the wrapped Map the class is also a Map when compiled!

Here is an example (in Groovy) that shows how to lookup and how to use the keys:

    StructMap smap = new StructMap<>(
            [
                    header: [
                            type      : "service",
                            address   : "aps.admin.web",
                            classifier: "public",
                            enabled   : true
                    ],
                    body  : [
                            action: "get-webs"
                    ],
                    reply : [
                            webs: [
                                    [
                                            name: "ConfigAdmin",
                                            url : "http://localhost:8080/aps/ConfigAdminWeb",
                                    ],
                                    [
                                            name: "RemoteServicesAdmin",
                                            url : "https://localhost:8080/aps/RemoteSvcAdmin"
                                    ]
                            ]
                    ]
            ] as Map<String, Object>
    ) as StructMap

    assert smap.lookup( "header.type" ).toString() == "service"
    assert smap.lookup( "header.address" ).toString() == "aps.admin.web"
    assert smap.lookup( "header.classifier" ).toString() == "public"
    assert smap.lookup( "body.action" ).toString() == "get-webs"
    assert smap.lookup( "reply.webs.[0].name") == "ConfigAdmin"
    assert smap.lookup( "reply.webs.[1].name") == "RemoteServicesAdmin"
    assert smap.lookup( "reply.webs.[1].url") == "https://localhost:8080/aps/RemoteSvcAdmin"

    smap.withAllKeys { String key ->
        println "${key}"
    }

    // will produce:
    header.type
    header.address
    header.classifier
    header.enabled
    body.action
    reply.webs.[2].name
    reply.webs.[2].url

Note that the values are API-wise of type Object! This is because it can be anything, like a String, Map,
List, Number (if you stick to JSON formats) or any other type of value you put in there.

Also note the indexes in the keys in the example. It is not "webs\[0\]" but "webs.\[0\]"! The index is a
reference name in itself. The keys returned by getAllKeys() have a number between the '\[' and the '\]' for
List entries. This number is the number of entries in the list. The StructPath class (used by this class)
can be used to provide array size of an array value.

repository: tombensve/APS

gha_language: Java

repo_name: tombensve/APS


text:
# Generating the documentation

## html
Simply type
```
jupyter nbconvert --to html_with_lenvs latex_env_doc.ipynb
```

## latex
For LaTeX, convert and then compile. Here we ask the converter to remove headers. This is useful for including a series of files into a master one. We provide a generic header `header.tex` which is included in documentation.tex. Look at it.

```
jupyter nbconvert --to latex_with_toclenvs --LenvsLatexExporter.removeHeaders=True latex_env_doc.ipynb
xelatex documentation.tex
```

repository: holzschu/Carnets

gha_language: Python

repo_name: holzschu/Carnets


text:
---
title: Home
---

This site is focused on making _persistent memory programming_ easier.
The current focus is on the Linux NVM Library, which is
a library (set of libraries, actually) designed to provide some
useful APIs for server applications wanting to use persistent memory.
You can [read more about the NVM Library](/nvml/) or
[go directly to the source](https://github.com/pmem/nvml/).
Contributions are welcome!

The Linux NVM Library builds on the **Direct Access** (DAX) changes
under development in Linux.  Check out the
[Persistent Memory Wiki](https://nvdimm.wiki.kernel.org) for the link
to the latest snapshot of this work, and for all the other information
related to persistent memory enabling in Linux.

#### What Is It?

For many years computer applications organize their data between two
tiers: memory and storage.  We believe the emerging _persistent memory_
technologies introduce a third tier.  Persistent memory (or _pmem_
for short) is accessed like volatile memory, using processor load
and store instructions, but it retains its contents across power loss
like storage.

This project focuses specifically on how persistent memory is exposed
to server-class applications which will explicitly manage the placement
of data among the three tiers (volatile memory, persistent memory, and
storage).  This project is not looking at client or mobile uses of
persistent memory, which are more likely to be transparent to the
applications (at least, we're not focusing on that yet).  The first
focus is to expose the capabilities of this new technology and provide
software to help applications exploit it.

#### More Information

See our [blog entries](/blog/) for more information, especially
the entry on the
[overall architecture]({% post_url 2014-08-27-crawl-walk-run %})
for persistent memory programming and the entry containing
[references]({% post_url 2014-08-26-references %}) to more information.

Your questions, comments, and contributions are welcome!  Join our
[Google Group](http://groups.google.com/group/pmem) find us on
IRC on the **#pmem** channel on [OFTC](http://www.oftc.net).


text:
---
author: gerolfziegenhain
comments: true
date: 2015-02-08 09:41:08+00:00
layout: post
link: https://gerolfziegenhain.wordpress.com/2015/02/08/connect-morse-key-to-iphone/
slug: connect-morse-key-to-iphone
title: Connect Morse Key to Iphone
wordpress_id: 513
categories:
- Ham Radio
- iOS
- Morse Code
tags:
- Ham Radio
- iOS
- Morse Code
---

How to connect morse key to an iPhone? Using the buttons on the standard headphones does not work, as the apple interface does not provide low-level access to low-level events like button-down. The idea (R1, R2) will be (1) put a signal to one stereo channel (2) receive the same signal on the input channel (small resistor will simulate mic) (3) detect tone level changes for input channel -> real time-morse (4) put side-tone & co to remaining stereo channel.

![Pasted Graphic](pasted-graphic.png)

  * 1(Tip) - Key (Ground)

  * 2 - Ear (Contact)

  * 3 - Ear (Ground)

  * 4(Ground) - R2(46,6k) - Key 1

  * 4(Ground) - R3(22k) - Key 2

  * 4(Ground) - R1(1k) - 3

I got a prototype running with irmc-ios (R4) and the same physical interface also works with iMorsix (R3).
![IMG_0188](img_0188.jpg)

(R1) [Hijacking Power from [...] Audio Interface](https://web.eecs.umich.edu/~prabal/pubs/papers/kuo10hijack.pdf)
(R2) [Sources: hijack-main](https://code.google.com/p/hijack-main/)
(R3) [App: iMorsix](http://www.ilt.ch/108171/index.html)
(R4) [App: irmc-ios](https://github.com/8cH9azbsFifZ/irmc-ios)

extension: markdown


text:
PaginatedRecyclerView
=====================
Customizable pagination in Android RecyclerView.

![demo_list][demo_list] ![demo_grid][demo_grid]

Usage
-----
#### Use `PaginatedRecyclerView`
It has several attributes:
 * `loadingEnabled` - Will enable loading row while paginating, default is true.
 * `loadingThreshold` - Set the offset from the end of the list at which the paginate more event needs to be triggered, default is 5.

```xml
<com.hendraanggrian.widget.PaginatedRecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
```

#### Create `Pagination`
```java
public class PostPagination extends PaginatedRecyclerView.Pagination {
    @Override
    public boolean getPageStart(int page) {
        return 0;
    }

    @Override
    public void onPaginate(int page) {
        if (loadItemSuccess) {
            populateItems(); // add items to adapter
            notifyLoadingCompleted();
        }
        if (reachPageEnd) {
            notifyPaginationFinished();
        }
    }
}
```

#### Attach `Pagination` to `PaginatedRecyclerView`
```java
recyclerView.setLayoutManager(lm)
recyclerView.setAdapter(adapter)
recyclerView.setPagination(pagination)
```

Customization
-------------
#### Use custom loading row
Create custom loading adapter, and supply it to `PaginatedRecyclerView`.
```java
public class CustomLoadingAdapter extends LoadingAdapter {

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        ...
    }
}

CustomLoadingAdapter loadingAdapter = new CustomLoadingAdapter();
recyclerView.setLoadingAdapter(loadingAdapter);
```

Download
--------
```gradle
repositories {
    google()
    jcenter()
}

dependencies {
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.hendraanggrian:recyclerview-paginated:0.6'
}
```

License
-------
    Copyright 2017 Hendra Anggrian

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

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

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

[demo_list]: /art/demo_list.gif
[demo_grid]: /art/demo_grid.gif

repository: griajobag/recyclerview-paginated

repo_name: griajobag/recyclerview-paginated


text:
# PoW Shield

[![nodejs-ci](https://github.com/RuiSiang/PoW-Shield/actions/workflows/nodejs-ci.yml/badge.svg)](https://github.com/RuiSiang/PoW-Shield/actions/workflows/nodejs-ci.yml)
[![njsscan sarif](https://github.com/RuiSiang/PoW-Shield/actions/workflows/njsscan-analysis.yml/badge.svg)](https://github.com/RuiSiang/PoW-Shield/actions/workflows/njsscan-analysis.yml)
[![CodeQL](https://github.com/RuiSiang/PoW-Shield/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/RuiSiang/PoW-Shield/actions/workflows/codeql-analysis.yml)
![GitHub repo size](https://img.shields.io/github/repo-size/ruisiang/pow-shield?color=orange)
[![Docker Image Size (tag)](https://img.shields.io/docker/image-size/ruisiang/pow-shield/latest?label=docker%20image%20size)](https://hub.docker.com/r/ruisiang/pow-shield)
[![](https://images.microbadger.com/badges/version/ruisiang/pow-shield.svg)](https://hub.docker.com/r/ruisiang/pow-shield)

Project dedicated to provide DDoS protection with proof-of-work

![screenshot](https://raw.githubusercontent.com/RuiSiang/PoW-Shield/main/screenshot.jpg)

## Description

PoW Shield provides DDoS protection on OSI application layer by acting as a proxy that utilizes proof of work between the backend service and the end user. This project aims to provide an alternative to general captcha methods such as Google's ReCaptcha that has always been a pain to solve. Accessing a web service protected by PoW Shield has never been easier, simply go to the url, and your browser will do the rest of the verification automatically for you.

PoW Shield aims to provide the following services bundled in a single webapp / docker image:

- proof of work authentication
- ratelimiting and ip blacklisting
- web application firewall

[Story on Medium](https://ruisiang.medium.com/pow-shield-application-layer-proof-of-work-ddos-filter-4fed32465509 'PoW Shield: Application Layer Proof of Work DDoS Filter')

## How it Works

So basically, PoW Shield works as a proxy in front of the actual web app/service. It conducts verification via proof-of-work and only proxies authorized traffic through to the actual server. The proxy is easily installable, and is capable of protecting low security applications with a WAF.

Here’s what happens behind the scenes when a user browses a PoW Shield-protected webservice:

1. The server generates a random hex-encoded “prefix” and sends it along with the PoW Shield page to the client.
2. Browser JavaScript on the client side then attempts to brute-force a “nonce” that when appended with the prefix, can produce a SHA256 hash with the number of leading zero-bits more than the “difficulty” D specified by the server. i.e. SHA256(prefix + nonce)=0…0xxxx (binary, with more than D leading 0s)
3. Client-side JavaScript then sends the calculated nonce to the server for verification, if verification passes, the server generates a cookie for the client to pass authentication.
4. The server starts proxying the now authenticated client traffic to the server with WAF filtering enabled.

## [Usage](https://github.com/RuiSiang/PoW-Shield/blob/main/USAGE.md)

nodejs and docker

## [Configuration](https://github.com/RuiSiang/PoW-Shield/blob/main/CONFIGURE.md)

environment variables

## Features
- Web Service Structure
- Proxy Functionality
- PoW Implementation
- Dockerization
- IP Blacklisting
- Ratelimiting
- Unit Testing
- WAF Implementation
- Multi-Instance Syncing (Redis)

## References
+ Proof-of-work by Fedor Indutny (PoW utility functions)
+ Shadowd by Zesecure (WAF rules)

## License

BSD 3-Clause License

Copyright (c) 2021, RuiSiang
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.


text:
# Learning Management & Others

Under learning management & others, the school administrator can manage the learning modules and exercises, payments and transactions as well as the messaging module available on the portal.

## Learning Management System

Under Learning Management System, the administrator manages all the learning modules available in each class.

![](/images/admin-modules.png)

There are two types of views available to display the modules list.

1. List View
2. Calendar View

The Calendar View is used as a timetable to the students to guide them in preparing for the various class learning sessions.

![](/images/admin-modules-calendar.png)

Adding a module is simple. Just click the **Add New** button and the add modal dialog pop up.

![](/images/admin-modules-add.png)

## Exercises Management

Under Exercises Management, the administrator manages the exercises given in each class. The exercises groups include:

1. Assignments
2. Tests
3. Examinations

![](/images/admin-exercises.png)

## Payments Management

Under Payments Management, the administrator monitors all the payments made through the portal either by students, prospective students or by the parents/guardians on behalf of the wards.

![](/images/admin-payments.png)

## Messaging

Under Messaging, the administrator can receive messages from the user accounts on the portal into his/her inbox.

![](/images/admin-inbox.png)

He/She can also compose messages to be sent to other user accounts on the portal.

![](/images/admin-compose.png)

And finally, he/she can view his/her sent messages for forwarding or recomposing.

![](/images/admin-sent.png)

repository: realvincentuche/prestige-docs

repo_name: realvincentuche/prestige-docs


text:
# vue-churnzero

ChurnZero plugin for Vue

This plugin allows easily to bring ChurnZero script to your Vue application as well as it provides convenient methods to trigger events.

Main features:
* Asynchronous script loading
* Allows loading `appKey`, `accountId` and `contactId` asynchronously
* Automatic router tracking
* Vue directive for events
* No dependencies

## Requirements

Vue ^2.0.0

## Install

```bash
npm install vue-churnzero
```

or

```bash
yarn add vue-churnzero
```

## Getting started

After installing the package you can start using the plugin in your Vue application:

```js
import Vue from 'vue'
import VueChurnZero from 'vue-churnzero';

Vue.use(VueChurnZero, {
    appKey: YOUR_APP_KEY,
    accountId: USER_ACCOUNT_ID,
    contactId: USER_CONTACT_ID,
});
```

_Note:_ `appKey`, `accountId` and `contactId` can be promises. In this case, the plugin will start right after all the promises will be resolved.
In order not to lose users' events in the meantime, the plugin collects users' event to storage and fires them later.

Once you registered the plugin, you can start tracking the events. There are multiple ways how you can do it.

### Using instance method

In the component, you can access `trackEvent` method:

```js
export default {
    name: 'my-component',

    methods: {
        track() {
            this.$cz.trackEvent('event name');
        }
    }
}
```
Please refer to the [official ChurnZero documentation](https://support.churnzero.net/hc/en-us/articles/360004683552-Integrate-ChurnZero-using-Javascript
) on `trackEvent` arguments.
_Note:_ you shouldn't send trackEvent as the first argument. The plugin does it for you. You just need to specify one required field `eventName`.
`description`, `quantity` and `customFields` are all optional.

### Using directive

Alternatively, you can use vue directive to achieve the same effect.

```html
<template>
    <button v-cz="$cz.t(this, 'event name')">
        Click me
    </button>
</template>
```

`t` is a shorthand version of `trackEvent`. It binds trackEvent for you and allows you to save bytes in your components.
Nevertheless, you still can use the full method if you'd like to:

```html
<template>
    <button v-cz="$cz.trackEvent.bind(this, 'event name')">
        Click me
    </button>
</template>
```

### Using commands

If you want to keep all of you tracking methods separately in one place, you can specify commands object while initializing the plugin.

```js
import Vue from 'vue'
import VueChurnZero from 'vue-churnzero';

Vue.use(VueChurnZero, {
    appKey: YOUR_APP_KEY,
    accountId: USER_ACCOUNT_ID,
    contactId: USER_CONTACT_ID,
    commands: {
        trackButtonClick() {
            this.$cz.trackEvent('event name');
        }
    }
});
```

In this case, all you need is to specify the method name when using the directive:

```html
<template>
    <button v-cz="'trackButtonClick'">
        Click me
    </button>
</template>
```

## API

Coming soon


text:
It will try to keep all available cores busy. In the paper you can read about the tradeoff between the overhead of creating a goroutine versus parallel computation. In practice this means you should make sure that this overhead is neglectable compared to the amount of work the goroutine is handling. As a rough heuristic, setting numStrips >= 1e8 should show almost linear scalability.

```
// Estimate Pi with 1e7 trapezoids in the interval [0,1] on the f(x)
pi := integral.Trapezoid(1e7, 0, 1, func(x float64) float64 { return 4.0 / (1.0 + x*x) })
```

## Optimal BST

TODO

repository: evertlammerts/goplay

repo_name: evertlammerts/goplay


text:
# **D'Addario String Data Analysis**

Or: How to find the strings you want for that custom instrument

# Introduction

When I started delving into lutherie for unusual lute-type instruments, I ran into a major issue: "How do I even get strings for this?" For example, my custom-built octave mandolin has a low-C. I wondered about things like:

- Is it OK to take it from a mandocello set and use it?
- How much tension is going through it?
- Will the neck sustain the tension?
- Should I try to find a 070? 072? 074?
- Phosphor bronze or Nickel-plated steel?

This article will hopefully explain some of that for others with the same issue.

# String Tension Physics

I was fortunately able to find some key information and solid empirical data from [this pdf][1] that D'Addario had on their website.

## String Tension Formulas

String Tension is the force that acts along the central axis of the string. In practical terms, the more tension that is applied, the higher the pitch and the harder it will be to deflect. According to the brochure, there are three factors contributing to string tension:

1. Unit Weight - How much the string weighs per unit length
1. Scale Length - The vibrating length of the string, from a nut/zero-fret to the bridge.
1. Desired pitch/frequency - The note that the string will be tuned to.

### Tension Formula

For non-metric, the formula is

T = (UW * (2 * L * F)2) / 386.4

Where:
- T is Tension in pounds-force
- UW is Unit Weight in lb/in
- L is Scale Length in inches
- F is Frequency in Hz (inverse seconds)
- Not explained in the pdf: 386.4 is acceleration due to gravity in in/sec2

For the more scientifically geared folks, in metric, it's:

T = (UW * (2 * L * F)2) / 9.806e6

Where:

- T is Tension in kgf
- UW is Unit Weight in kgf/10cm
- L is Scale Length in cm
- F is Frequency in Hz (inverse seconds)
- 9.806e6 is acceleration due to gravity in m/sec2 times 1000000 to compensate for the conversion of cm and 10cm to standard meters.

## Analyzing the Tables

Taking some samples from the tables, we can tabulate gauge w.r.t. unit weight. For some reason, the pdfs don't list gauge, so we had to look these up or infer them from the item code. (Sometimes they're listed as xxyyy, where xx is the material and yyy is the gauge.) I did this in a Google Sheet:

![][2]

To get the regression curves, I ended up playing with a few of the trend-line regression types, but really, quadratic (x2) makes the most sense here. This is because the string can be modeled as a cylinder, cylinder volumes vary as radius squared, and mass is directly proportional to volume for constant density. The flaw with the model is that it does not account for the thickness of the core vs the windings in wound strings, but the R-squared values are all reasonably close to 1 (> 0.990), so I feel the results are satisfactory.

Really, though we can do a little better (> .995) if we force c to be 0. The Google Sheet Charts don't let us do that with the trendlines, though we can still get it done with the `LINEST()` formula function. Below are the results in order of descending quadratic coefficients.

### Regression formulas (Unit Weight vs Gauge) (JS is required)

| Material Type | Quadratic Coefficient (a) | Linear Coefficient (b) | R-squared |
|:--------------|:--------------------------|:-----------------------|----------:|

### Results

- As expected, the plain steel and nylon strings have very small linear terms due to them being made of uniform material.
- Phosphor bronze and nickel plated seem to behave similarly, but phosphor bronze is slightly denser, which our model agrees with. This means that for the same gauge and pitch, nickel-plated will have lower tension than PB.
- The steel flatwound strangely fits the model the least, though we can get reasonably close with it.

Using this data, we can then create a calculator for string tensions: [Calculator][3].

[1]: https://www.daddario.com/globalassets/pdfs/accessories/tension_chart_13934.pdf
[2]: ./src/RegressionCurves.png
[3]: ./index.html


text:
---
layout: post
title: Meeting for November
comments:
- id: 758
  author: '» Failure Pattern Poker at @AgileIowa AgilityFeat'
  author_email: ''
  author_url: http://blog.agilityfeat.com/2011/12/failure-pattern-poker-at-agileiowa/
  date: '2011-12-05 18:59:39 -0600'
  date_gmt: '2011-12-05 23:59:39 -0600'
  content: '[...] game in a few settings now, first at AgileCville, then at Agile
    Coach Camp on Games Day, and now at Agile Iowa.Â  Each time Iâ€™ve learned something
    and I think that the mechanics of the game itself are getting [...]'
---

Time: Thursday, November 17th from 6:00-8:00 PM

Location: Okoboji Grill in Johnston (large meeting room)

Speaker: Arin Sime, AgilityFeat.com

Topic: Failure Pattern Poker - an Agile Retrospective or Training Game

Failure Pattern poker is a simple and fun way to get your team

discussing how to address common failure patterns in projects, or to

raise specific problems going on in their current projects.  You can

use it as part of a training to help people apply basic agile and

scrum concepts or as a retrospective game to get people talking.

During this session Arin will break the room into a couple of games of

Failure Pattern Poker.  The focus will be on play and discussion

rather than powerpoint.

Arin is an agile coach and owner of AgilityFeat, a consultancy

offering agile training and coaching as well as near shore development

repository: agileiowa/jekyll-web

gha_language: CSS

repo_name: agileiowa/jekyll-web


text:
# Webhose Source

Description
---
This is a Cyber Defense specific batch connector plugin to read data records from a Webhose HTTP endpoint,
and to transform them into structured data flow records.

Webhose is a commercial cloud service that uncovers cyber threats across dark networks and messaging apps.

Configuration
---
Reference Name: Name used to uniquely identify this source for lineage, annotating metadata, etc.

repository: predictiveworks/cdap-connect

repo_name: predictiveworks/cdap-connect


text:
# Constellation_v2
6338 Final Project

The project’s goal is to explore the latent space of knowledge and how we connect different ideas. We often explore topics and ideas in isolation - but it would be of equal interest to see where going down different rabbit holes of linking them leads us.

To keep the scope of the project limited – I worked on a sparse subset of Wikipedia articles. And look at how different topics link to one another and further examine the meta information linking these pages together.

Items of interest were - what is the shortest path of getting from one webpage to another? What page do we traverse most often when we are traversing the web? What is the page that links the greatest number of articles?

gha_language: ShaderLab


text:
# KNOWYOURMOVE

***KnowYourMove*** is a ComputerVision-based business intelligence tool that tracks the **motion** of individual customers from store surveillance camera systems. It analyzes the video and generates the information maps that can provide business owners with valuable insights to understand their customers better (in terms of their shopping routes and aggregated time spent in different areas). The model has been deployed as a web application [<www.knowyourmove.store>](http://www.knowyourmove.store) where a user can upload a surveillance video to generate the reports.

(**NOTE: As of Nov 7, 2019, the AWS instance of KnowYourMove has been temporarily stopped. Please refer to the Jupyter notebooks for the actual usages.**)

The information can be filtered by specific time windows (i.e. morning/afternoon or weekdays/weekends, etc). Such information is expected to provide time-specific customer traffics at a store so as to enable micro-optimization of business operation such as store floor plannings and pricing strategy without breaching customer privacy.

## Web application DEMO

**NOTE**: The current web application is being hosted on ***AWS t2.micro***, setting limitations on uploadable video size and processing time.

**NOTE**: This shows how the first 1 second of the video gets processed for demo purposes.

## Packages

Please run `pip install -r requirements.txt` on your virtual environment to install the required python packages to run KnowYourMove yourself.

## Codes

* Full details of the project can be found in the Jupyter notebook, [HERE](https://github.com/sungsujaing/INSIGHT-project/blob/master/Motion_analyzer.ipynb).
* Full details of the Flask web deployment on AWS can be found [HERE](https://github.com/sungsujaing/INSIGHT-project/tree/master/application/KYM_app_v2).
* For testing purposes, if a YouTube video needs to be downloaded, this notebook can be used, [HERE](https://github.com/sungsujaing/INSIGHT-project/blob/master/download_video.ipynb).

## Repository folder description

* ReadMe_Images
* application - KnowYourMove that is currently hosted on AWS
* archive-youtube_scrap - KnowYourMove that takes Youtube video link as an input
* Motion_analyzer.ipynb - main tutorial notebook for KnowYourMove
* download_video.ipynb - supplementary notebook to download Youtube videos
* requirements.txt

## Model structure

The model is based on:

* SSD (Single shot detector) model
* Centroid tracking algorithm

## Results

As part of the process, a background image is first extracted from the entire video. By using the moving average technique, moving objects in a video get removed while the still background is recovered. This image shows an example of the extracted background and the single frame of the processed video. Video source: [YouTube](https://www.youtube.com/watch?v=KMJS66jBtVQ)

The resulting report includes:

* Trajectory map (color: customers, intensity: time spent)
* Contour map: aggregated time spent by the general population

While tested on rather a short video, it was clearly shown that different distribution of customer traffics were extracted from different time window filters. it would be easy to implement KnowYourMove to a longer video (i.e. a day-long video) to understand how the customer traffics may differ at different time of a day.

## Acknowledgements

* SSD weights were downloaded from *pierluigiferrari*'s [repo](https://github.com/pierluigiferrari/ssd_keras).

repository: concurs-program/INSIGHT-project

repo_name: concurs-program/INSIGHT-project


text:
# react-docgen-typescript-webpack-plugin

Webpack plugin to generate docgen information from Typescript React components.

## Installation

Add the package as a development dependency.

```shell
$ npm install --save-dev react-docgen-typescript-webpack-plugin

or

$ yarn add --dev react-docgen-typescript-webpack-plugin
```

Add the plugin to your Webpack configuration.

```javascript
const path = require("path");
const genDefaultConfig = require("@storybook/react/dist/server/config/defaults/webpack.config.js");
const TSDocgenPlugin = require("react-docgen-typescript-webpack-plugin");

module.exports = (baseConfig, env) => {
  const config = genDefaultConfig(baseConfig);

  config.module.rules.push({
    test: /\.tsx?$/,
    include: path.resolve(__dirname, "../src"),
    loader: require.resolve("ts-loader"),
  });

  config.plugins.push(new TSDocgenPlugin());

  config.resolve.extensions.push(".ts", ".tsx");

  return config;
};
```

## Usage

### Storybook Info Plugin

Include the `withInfo` decorator as normal.

**Special Note:**

The Storybook Info addon will only attempt to read Docgen information when the
story name matches the name of the component. So if you have a component named
`ColorButton`, then you will have to use something like:

`storiesOf("...", module).add("ColorButton", ...)`

---

```javascript
import * as React from "react";
import { storiesOf } from "@storybook/react";
import { withInfo } from "@storybook/addon-info";
import ColorButton from "./ColorButton";

storiesOf("Components", module).add(
  "ColorButton",
  withInfo({ inline: true })(() => (
    <ColorButton color="blue">Color Button</ColorButton>
  )),
);
```

## Experimental

This plugin is mostly a hack job at the moment. It is a work in progress so it
is most likely not suitable for production. Pull requests are most welcome.

## Limitations

This plugin makes use of the great project:
https://github.com/styleguidist/react-docgen-typescript

It is subject to the same limitations. Component docgen information can not be
generated for components who are only exported as default. You can work around
the issue by exporting the component using a named export.

**CURRENT LIMITATION**
The current implementation seems to have trouble with the compiler option `module` being set to `esnext`.

```javascript
import * as React from "react";

interface ColorButtonProps {
  /** Buttons background color */
  color: "blue" | "green";
}

/** A button with a configurable background color. */
export const ColorButton: React.SFC<ColorButtonProps> = props => (
  <button
    style={{
      padding: 40,
      color: "#eee",
      backgroundColor: props.color,
      fontSize: "2rem",
    }}
  >
    {props.children}
  </button>
);

export default ColorButton;
```

## Contributing

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

Please make sure to update tests as appropriate.

## License

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

repository: Holo-Host/hc-react-redux-framework

gha_language: TypeScript

repo_name: Holo-Host/hc-react-redux-framework


text:
# Change Log
This file contains all the notable changes done to the Ballerina JWT package through the releases.

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

## [2.5.0] - 2022-11-29

### Changed
- [API Docs Updated](https://github.com/ballerina-platform/ballerina-standard-library/issues/3463)

## [2.3.0] - 2022-05-30

### Changed
- [Append the scheme of the HTTP client URL (JWKs) based on the client configurations](https://github.com/ballerina-platform/ballerina-standard-library/issues/2816)

## [2.0.0] - 2021-10-10

### Added
- [Add HMAC signature support for JWT](https://github.com/ballerina-platform/ballerina-standard-library/issues/1645)

## [1.1.0-beta2] - 2021-07-06

### Added
- [Improve JWT validation for all the fields of JWT issuer configuration](https://github.com/ballerina-platform/ballerina-standard-library/issues/1240)

## [1.1.0-alpha8] - 2021-04-22

### Changed
- [Improve error messages and log messages](https://github.com/ballerina-platform/ballerina-standard-library/issues/1242)

## [1.1.0-alpha6] - 2021-04-02

### Changed
- Remove usages of `checkpanic` for type narrowing

## [1.1.0-alpha5] - 2021-03-19

### Added
- [Add cert file and mTLS support for JDK11 client](https://github.com/ballerina-platform/ballerina-standard-library/issues/936)
- [Add jti claim as a user input](https://github.com/ballerina-platform/ballerina-standard-library/issues/1210)

### Changed
- [Replace base64 URL encode/decode APIs](https://github.com/ballerina-platform/ballerina-standard-library/issues/1212)
- Update error types and log API
- Update for Time API changes

### Fixed
- Fix nbf/exp claim validation

## [1.1.0-alpha4] - 2021-02-20

### Changed
- [Refactor JWT validating API](https://github.com/ballerina-platform/ballerina-standard-library/issues/1213)
- Refactor JWT issue/validate test cases
- Update for crypto API changes
- [Extend private key/public cert support for JWT signature generation/validation](https://github.com/ballerina-platform/ballerina-standard-library/issues/822)

repository: ballerina-platform/module-ballerina-jwt

gha_language: Ballerina

repo_name: ballerina-platform/module-ballerina-jwt


text:
# HLogger
A simple and extensible logging system

The HLogger system is built around a simple interface, ILogger. It comes equipped with two "proper" logger classes: FileLogger and ConsoleLogger, as well as a suite of intermediary loggers that can be chained together to customize a logging system that works for your project. All of these intermediary loggers make use of the ILogger interface, so they work perfectly fine with custom implementations.

## Logger Types

### ILogger
ILogger is a simple interface consisting of a single method: Log(string, LogLevel). ILogger.cs also defines the LogLevel enum, which has the following values: Debug, Info, Warn, Error, and Critical, in order from least to most dire.

 If created with the parameter 'overwrite' set to false, the FileLogger will continue to append lines to the specified file if it already exists.

### ConsoleLogger
ConsoleLogger is a functional logger that displays messages on the console. Messages are color coded based on severity, and the colors are fully customizable.

### LeveledLogger
LeveledLogger is an intermediary logger that filters out messages based on severity. Messages with severity lower than the LeveledLogger's threshold are filtered out and not recorded by the internal logger.

### MultiLogger
Multilogger is an intermediary logger that forwards messages to any number of internal ILogger objects. A MultiLogger can be used with a FileLogger and a ConsoleLogger, for instance, to record messages both in a file and on screen.

### FormatLogger
FormatLogger is provided as a top-level logger. In addition to formatting messages automatically, it also features convenience wrappers for each severity level.
Though it is intended to function as the top level in a chain of loggers, FormatLogger still implements ILogger, and therefore can be used as an intermediary.

## Recommended Usage
HLogger is a modular system, and most of its customization comes from the structure of intermediary loggers chained together. For example, by using a MultiLogger to split messages between two LeveledLoggers, one of which forwards to a ConsoleLogger and the other to a FileLogger, you can display only warning and error messages on the console, but record debugging information in the log file using the same object. Or, you could have seperate FileLoggers for debug and error information, writing to different files.
You can also write your own implementations for the ILogger interface, either as intermediaries or as functional outputs for your project.

repository: Rhelliom/HLogger

repo_name: Rhelliom/HLogger


text:
---
title: "After the Kodak Moment | The New York Times"
date: 2015-03-25 20:33:32 00:00
permalink: /videos/2487
source: "https://www.youtube.com/watch?v=JDzQ1gx71EI"
featured: false
provider: "YouTube"
thumbnail: "http://i.ytimg.com/vi/JDzQ1gx71EI/hqdefault.jpg"
user:
  id: 1
  username: "sawyer"
  name: "Sawyer Hollenshead"
tags: ["photography","short documentary","nytimes"]
html: "<iframe class=\"embedly-embed\" src=\"//cdn.embedly.com/widgets/media.html?src=http%3A%2F%2Fwww.youtube.com%2Fembed%2FJDzQ1gx71EI%3Fwmode%3Dtransparent%26feature%3Doembed&wmode=transparent&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJDzQ1gx71EI&image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FJDzQ1gx71EI%2Fhqdefault.jpg&key=daaebf4d9cdd46779200162d0ca86e20&type=text%2Fhtml&schema=youtube\" width=\"854\" height=\"480\" scrolling=\"no\" frameborder=\"0\" allowfullscreen></iframe>"
id: 2487
---

Kodak has prioritized its patent portfolio and the Eastman Business Park since it declared bankruptcy in 2012. Despite some success, the company might never live up to the legacy of its own past.

Produced by: Colin Archdeacon and John Woo

Read the story here: http://nyti.ms/1I62hyj

repository: sawyerh/organizedwonder

repo_name: sawyerh/organizedwonder


text:
DATA VISUALIZATION
Sublime Limes' Line Graphs
In this project, you will be acting as a data analyst for an online lime retailer called Sublime Limes. People all over the world can use this product to get the freshest, best-quality limes delivered to their door. One of the product managers at Sublime Limes would like to gain insight into the customers and their sales habits. Using Matplotlib, you’ll create some different line graphs (or maybe, lime graphs) to communicate this information effectively.

If you get stuck during this project or would like to see an experienced developer work through it, click “Get Help“ to see a project walkthrough video.

Understand the data and set up subplots
1.
Add import codecademylib to the top of script.py. This will allow for your plots to render in our browser.

2.
We have provided some data in different lists in script.py. Look through these lists and try to understand what each one represents.

3.
Create a figure of width 12 and height 8.

4.
We are going to make two charts in one figure, laid out side-by-side. In other words, the figure will have one row and two columns, like this:

subplots

Write the command to create the left subplot (the one that would correspond to the plot with a star in our example figure). Save this subplot in a variable called ax1.

5.
Write the command to create the right subplot (the one that would correspond to the plot with a square in our example figure).

Save this subplot in a variable called ax2.

Page visits over time
6.
In the left subplot, we are going to plot the total page visits over the past year as a line.

First, let’s create the list of x-values, which is range(len(months)). Store this in a variable called x_values.

Make sure this happens after the line where you created ax1, but before the line where you’ve created ax2, so that the plot goes in the subplot on the left.

7.
Plot the total page visits against these x_values as a line.

8.
Give the line markers that will help show each month as a distinct value.

9.
Label the x-axis and y-axis with descriptive titles of what they measure.

10.
Set the x-axis ticks to be the x_values.

11.
Label the x-axis tick labels to be the names stored in the months list.

Plotting multiple lime species
12.
In the subplot on the right, we are going to plot three lines on the same set of axes. The x-values for all three lines will correspond to the months, so we can use the list of x_values we used for the last plot.

On one plot, create the three lines:

number of key limes sold vs x_values
number of Persian limes sold vs x_values
number of blood limes sold vs x_values
Make sure this happens after the line where you created ax2, so that it goes in the subplot on the right.

13.
Give each line a specific color of your choosing.

14.
Add a legend to differentiate the lines, labeling each lime species.

15.
Set the x-axis ticks to be the x_values, and the tick labels to be the months list.

Labeling and saving
16.
Add a title to each of the two plots you’ve created, and adjust the margins to make the text you’ve added look better.

17.
Now, save your figure as a png with a descriptive file name.

url: https://raw.githubusercontent.com/BIGG000/Data-Science-Learning-Track/46df939699fd6b2c1ee3ce5d35c51a250faa1bce/Project Code/Visualization/project 1 DATA VISUALIZATION_Sublime Limes' Line Graphs/README.md


text:
# StevenA's fork of st - the suckless terminal

The [suckless terminal (st)](http://st.suckless.org) with patches and tweaks applied

The following patches were applied:
+ Scrollback - allowes scrolling back in the st history using Shift-PgUp/PgDn
+ Scrollback with mousewheel - allows scrolling with Shift-mousewheel
+ Scrollback with mousewheel2 - allows scrolling with just the mousewheel if we are not already in a scrollable window.
+ 10k lines of scrollback - the scrollback patch was modified to allow 10k instead of 2k of line scrolling.

repository: sjatkinson/st

repo_name: sjatkinson/st


text:
# Developer Instructions

We have a devcontainer config in the `.devcontainer/` directory. Visual Studio
Code should offer to open the project in a devcontainer automatically.

We use direnv to automatically export environment variables, so install direnv
and run `direnv allow` (after reading `.envrc` to check you trust it).

## Python Version Testing

We test against supported Python versions by using docker compose to run tests
in containers for every version.

Run all unit tests:

```console
$ docker compose --profile unit_test up
```

Run tests for a specific version:

```console
$ docker compose run test_py3.7
```

Run tests for a specific version with a custom command:

```console
$ docker compose run test_py3.7 poetry run pytest --exitfirst --showlocals
```

Test distribution packages:

(This installs the wheel/source dists into Python containers for each version to
check that the packages work.)

```console
$ poetry build
Building rnginline (0.0.2)
  - Building sdist
  - Built rnginline-0.0.2.tar.gz
  - Building wheel
  - Built rnginline-0.0.2-py3-none-any.whl
direnv: loading /workspaces/rnginline/.envrc
direnv: export +COMPOSE_FILE +RNGINLINE_DEVCONTAINER_VOLUME +RNGINLINE_DISTRIBUTION_FILES
$ echo $RNGINLINE_DISTRIBUTION_FILES
dist/rnginline-0.0.2-py3-none-any.whl
dist/rnginline-0.0.2.tar.gz
$ docker compose --profile distribution_test up
...
```

gha_license_id: NOASSERTION


text:
---
title: "Example Post"
date: "2019-10-16"
author: "Tom Simmons"
tags:
  - tutorials
---

# This is an example Heading

## Welcome to my sub heading

This file is known as a markdown file. They're a nice simple way of doing some pretty decent document formatting. It is:

1. Easier than HTML
2. Less crappy than microsoft word.

[A cheat sheet can be found here](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)

The above picture points to the .jpg file in the same directory. You can use as many pictures as you like. The 'figcaption' is not necessary, although the 'alt' is.

This is a paragraph. No fancy formatting going on here. You can make parts of the paragraph **bold** or _italic_ if you want. URLS are done like [this](https://www.google.com).

At the top of this file you'll see a section that looks like this:

```md
---
title: "Example Post"
date: "2019-10-16"
author: "Tom Simmons"
tags:
  - tutorials
---
```

This is meta data for this file that will not be rendered but is necessary for the website to build correctly. Be sure to fill it in correctly with each post.

repository: tomosim/gatsby-blog

gha_language: Rich Text Format

repo_name: tomosim/gatsby-blog


text:
Videos to Gif
---

### What does it do?

Given any number of video files and matching subtitle files it will generate gifs for every single line of dialogue

### How do I use it?

install pre-reqs on your machine:
* avconv
* imagemagick or graphicsmagick

install requirements:

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

setup your **files.yml** file based on the provided **files.sample.yml** file and keep it in the same directory as videos_to_gif.py

run it:

```
$ python videos_to_gif.py
```

license: Unlicense

repository: LindseyB/videos-to-gif

branch_name: refs/heads/trunk

gha_license_id: Unlicense

repo_name: LindseyB/videos-to-gif


text:
# ed25519-dalek [![](https://img.shields.io/crates/v/ed25519-dalek.svg)](https://crates.io/crates/ed25519-dalek) [![](https://docs.rs/ed25519-dalek/badge.svg)](https://docs.rs/ed25519-dalek) [![](https://travis-ci.org/dalek-cryptography/ed25519-dalek.svg?branch=master)](https://travis-ci.org/dalek-cryptography/ed25519-dalek?branch=master)

Fast and efficient Rust implementation of ed25519 key generation, signing, and
verification in Rust.

# Documentation

Documentation is available [here](https://docs.rs/ed25519-dalek).

# Installation

To install, add the following to your project's `Cargo.toml`:

```toml
[dependencies.ed25519-dalek]
version = "1"
```

# Benchmarks

On an Intel Skylake i9-7900X running at 3.30 GHz, without TurboBoost, this code achieves
the following performance benchmarks:

    ∃!isisⒶmistakenot:(master *=)~/code/rust/ed25519-dalek ∴ cargo bench
       Compiling ed25519-dalek v0.7.0 (file:///home/isis/code/rust/ed25519-dalek)
        Finished release [optimized] target(s) in 3.11s
          Running target/release/deps/ed25519_benchmarks-721332beed423bce

    Ed25519 signing                     time:   [15.617 us 15.630 us 15.647 us]
    Ed25519 signature verification      time:   [45.930 us 45.968 us 46.011 us]
    Ed25519 keypair generation          time:   [15.440 us 15.465 us 15.492 us]

By enabling the avx2 backend (on machines with compatible microarchitectures),
the performance for signature verification is greatly improved:

    ∃!isisⒶmistakenot:(master *=)~/code/rust/ed25519-dalek ∴ export RUSTFLAGS=-Ctarget_cpu=native
    ∃!isisⒶmistakenot:(master *=)~/code/rust/ed25519-dalek ∴ cargo bench --features=avx2_backend
       Compiling ed25519-dalek v0.7.0 (file:///home/isis/code/rust/ed25519-dalek)
        Finished release [optimized] target(s) in 4.28s
          Running target/release/deps/ed25519_benchmarks-e4866664de39c84d
    Ed25519 signing                     time:   [15.923 us 15.945 us 15.967 us]
    Ed25519 signature verification      time:   [33.382 us 33.411 us 33.445 us]
    Ed25519 keypair generation          time:   [15.246 us 15.260 us 15.275 us]

In comparison, the equivalent package in Golang performs as follows:

    ∃!isisⒶmistakenot:(master *=)~/code/go/src/github.com/agl/ed25519 ∴ go test -bench .
    BenchmarkKeyGeneration     30000             47007 ns/op
    BenchmarkSigning           30000             48820 ns/op
    BenchmarkVerification      10000            119701 ns/op
    ok      github.com/agl/ed25519  5.775s

Making key generation and signing a rough average of 2x faster, and
verification 2.5-3x faster depending on the availability of avx2.  Of course, this
is just my machine, and these results—nowhere near rigorous—should be taken
with a handful of salt.

Translating to a rough cycle count: we multiply by a factor of 3.3 to convert
nanoseconds to cycles per second on a 3300 Mhz CPU, that's 110256 cycles for
verification and 52618 for signing, which is competitive with hand-optimised
assembly implementations.

Additionally, if you're using a CSPRNG from the `rand` crate, the `nightly`
feature will enable `u128`/`i128` features there, resulting in potentially
faster performance.

If your protocol or application is able to batch signatures for verification,
the `verify_batch()` function has greatly improved performance.  On the
aforementioned Intel Skylake i9-7900X, verifying a batch of 96 signatures takes
1.7673ms.  That's 18.4094us, or roughly 60750 cycles, per signature verification,
more than double the speed of batch verification given in the original paper
(this is likely not a fair comparison as that was a Nehalem machine).
The numbers after the `/` in the test name refer to the size of the batch:

    ∃!isisⒶmistakenot:(master *=)~/code/rust/ed25519-dalek ∴ export RUSTFLAGS=-Ctarget_cpu=native
    ∃!isisⒶmistakenot:(master *=)~/code/rust/ed25519-dalek ∴ cargo bench --features=avx2_backend batch
       Compiling ed25519-dalek v0.8.0 (file:///home/isis/code/rust/ed25519-dalek)
        Finished release [optimized] target(s) in 34.16s
          Running target/release/deps/ed25519_benchmarks-cf0daf7d68fc71b6
    Ed25519 batch signature verification/4   time:   [105.20 us 106.04 us 106.99 us]
    Ed25519 batch signature verification/8   time:   [178.66 us 179.01 us 179.39 us]
    Ed25519 batch signature verification/16  time:   [325.65 us 326.67 us 327.90 us]
    Ed25519 batch signature verification/32  time:   [617.96 us 620.74 us 624.12 us]
    Ed25519 batch signature verification/64  time:   [1.1862 ms 1.1900 ms 1.1943 ms]
    Ed25519 batch signature verification/96  time:   [1.7611 ms 1.7673 ms 1.7742 ms]
    Ed25519 batch signature verification/128 time:   [2.3320 ms 2.3376 ms 2.3446 ms]
    Ed25519 batch signature verification/256 time:   [5.0124 ms 5.0290 ms 5.0491 ms]

As you can see, there's an optimal batch size for each machine, so you'll likely
want to test the benchmarks on your target CPU to discover the best size.  For
this machine, around 100 signatures per batch is the optimum:

![](https://github.com/dalek-cryptography/ed25519-dalek/blob/master/res/batch-violin-benchmark.svg)

Additionally, thanks to Rust, this implementation has both type and memory
safety.  It's also easily readable by a much larger set of people than those who
can read qhasm, making it more readily and more easily auditable.  We're of
the opinion that, ultimately, these features—combined with speed—are more
valuable than simply cycle counts alone.

# A Note on Signature Malleability

The signatures produced by this library are malleable, as discussed in
[the original paper](https://ed25519.cr.yp.to/ed25519-20110926.pdf):

![](https://github.com/dalek-cryptography/ed25519-dalek/blob/master/res/ed25519-malleability.png)

While the scalar component of our `Signature` struct is strictly *not*
malleable, because reduction checks are put in place upon `Signature`
deserialisation from bytes, for all types of signatures in this crate,
there is still the question of potential malleability due to the group
element components.

We could eliminate the latter malleability property by multiplying by the curve
cofactor, however, this would cause our implementation to *not* match the
behaviour of every other implementation in existence.  As of this writing,
[RFC 8032](https://tools.ietf.org/html/rfc8032), "Edwards-Curve Digital
Signature Algorithm (EdDSA)," advises that the stronger check should be done.
While we agree that the stronger check should be done, it is our opinion that
one shouldn't get to change the definition of "ed25519 verification" a decade
after the fact, breaking compatibility with every other implementation.

However, if you require this, please see the documentation for the
`verify_strict()` function, which does the full checks for the group elements.
This functionality is available by default.

If for some reason—although we strongely advise you not to—you need to conform
to the original specification of ed25519 signatures as in the excerpt from the
paper above, you can disable scalar malleability checking via
`--features='legacy_compatibility'`.  **WE STRONGLY ADVISE AGAINST THIS.**

## The `legacy_compatibility` Feature

By default, this library performs a stricter check for malleability in the
scalar component of a signature, upon signature deserialisation.  This stricter
check, that `s < \ell` where `\ell` is the order of the basepoint, is
[mandated by RFC8032](https://tools.ietf.org/html/rfc8032#section-5.1.7).
However, that RFC was standardised a decade after the original paper, which, as
described above, (usually, falsely) stated that malleability was inconsequential.

Because of this, most ed25519 implementations only perform a limited, hackier
check that the most significant three bits of the scalar are unset.  If you need
compatibility with legacy implementations, including:

* ed25519-donna
* Golang's /x/crypto ed25519
* libsodium (only when built with `-DED25519_COMPAT`)
* NaCl's "ref" implementation
* probably a bunch of others

then enable `ed25519-dalek`'s `legacy_compatibility` feature.  Please note and
be forewarned that doing so allows for signature malleability, meaning that
there may be two different and "valid" signatures with the same key for the same
message, which is obviously incredibly dangerous in a number of contexts,
including—but not limited to—identification protocols and cryptocurrency
transactions.

## The `verify_strict()` Function

The scalar component of a signature is not the only source of signature
malleability, however.  Both the public key used for signature verification and
the group element component of the signature are malleable, as they may contain
a small torsion component as a consquence of the curve25519 group not being of
prime order, but having a small cofactor of 8.

If you wish to also eliminate this source of signature malleability, please
review the
[documentation for the `verify_strict()` function](https://doc.dalek.rs/ed25519_dalek/struct.PublicKey.html#method.verify_strict).

# A Note on Randomness Generation

The original paper's specification and the standarisation of RFC8032 do not
specify precisely how randomness is to be generated, other than using a CSPRNG
(Cryptographically Secure Random Number Generator).  Particularly in the case of
signature verification, where the security proof _relies_ on the uniqueness of
the blinding factors/nonces, it is paramount that these samples of randomness be
unguessable to an adversary.  Because of this, a current growing belief among
cryptographers is that it is safer to prefer _synthetic randomness_.

To explain synthetic randomness, we should first explain how `ed25519-dalek`
handles generation of _deterministic randomness_.  This mode is disabled by
default due to a tiny-but-not-nonexistent chance that this mode will open users
up to fault attacks, wherein an adversary who controls all of the inputs to
batch verification (i.e. the public keys, signatures, and messages) can craft
them in a specialised manner such as to induce a fault (e.g. causing a
mistakenly flipped bit in RAM, overheating a processor, etc.).  In the
deterministic mode, we seed the PRNG which generates our blinding factors/nonces
by creating
[a PRNG based on the Fiat-Shamir transform of the public inputs](https://merlin.cool/transcript/rng.html).
This mode is potentially useful to protocols which require strong auditability
guarantees, as well as those which do not have access to secure system-/chip-
provided randomness.  This feature can be enabled via
`--features='batch_deterministic'`.  Note that we _do not_ support deterministic
signing, due to the numerous pitfalls therein, including a re-used nonce
accidentally revealing the secret key.

In the default mode, we do as above in the fully deterministic mode, but we
ratchet the underlying keccak-f1600 function (used for the provided
transcript-based PRNG) forward additionally based on some system-/chip- provided
randomness.  This provides _synthetic randomness_, that is, randomness based on
both deterministic and undeterinistic data.  The reason for doing this is to
prevent badly seeded system RNGs from ruining the security of the signature
verification scheme.

# Features

## #![no_std]

This library aims to be `#![no_std]` compliant.  If batch verification is
required (`--features='batch'`), please enable either of the `std` or `alloc`
features.

## Nightly Compilers

To cause your application to build `ed25519-dalek` with the nightly feature
enabled by default, instead do:

```toml
[dependencies.ed25519-dalek]
version = "1"
features = ["nightly"]
```

To cause your application to instead build with the nightly feature enabled
when someone builds with `cargo build --features="nightly"` add the following
to the `Cargo.toml`:

```toml
[features]
nightly = ["ed25519-dalek/nightly"]
```

## Serde

To enable [serde](https://serde.rs) support, build `ed25519-dalek` with the
`serde` feature.

## (Micro)Architecture Specific Backends

By default, `ed25519-dalek` builds against `curve25519-dalek`'s `u64_backend`
feature, which uses Rust's `i128` feature to achieve roughly double the speed as
the `u32_backend` feature.  When targetting 32-bit systems, however, you'll
likely want to compile with `cargo build --no-default-features
--features="u32_backend"`.  If you're building for a machine with avx2
instructions, there's also the experimental `simd_backend`s, currently
comprising either avx2 or avx512 backends.  To use them, compile with
`RUSTFLAGS="-C target_cpu=native" cargo build --no-default-features
--features="simd_backend"`

## Batch Signature Verification

The standard variants of batch signature verification (i.e. many signatures made
with potentially many different public keys over potentially many different
message) is available via the `batch` feature.  It uses synthetic randomness, as
noted above.

### Deterministic Batch Signature Verification

The same notion of batch signature verification as above, but with purely
deterministic randomness can be enabled via the `batch_deterministic` feature.

gha_language: C


text:
# Superfluid Vortex Filament Model numerical solver.

This repository consists software for numerical simulation of single superfluid vortex in presence of impurities.
A columnar vortex approximation was assumed. For further details got to .pdf file in `thesis` directory.

# Requirements

The code was tested on Ubuntu 16.04 operational system.

Requirements:
* Python 2.7
* numpy 1.9.1
* scipy 0.19
* FFTW library installed in $PATH.

# Compilation

The code was written in CPython with C extensions.
To compile the extensions go to `python` directory and type:

`python setup.py build_ext`

A result of compilation is a module `cfunctions`, that is providing functions for evaluation of forces acting on a vortex line. The compilation accelerates the bottelneck of the programs simulating dynamics of the vortex line.

# Usage

The compiled module `cfunctions` contains only functions needed to evaluate forces acting on a vortex line, and one have to provide the solver for dynamics of the vortex line.

Examples of usage of the module `cfunctions` are given in the directory `simulations`.

repository: KKobuszewski/svfm

repo_name: KKobuszewski/svfm


text:
---
layout: post
title: "mac auto run tomcat"
date: 2012-04-17 17:22
comments: true
categories: mac
---
* launchd_wrapper.sh

```
#!/bin/bash

# NOTE: this is an OSX launchd wrapper shell script for Tomcat (to be placed in $CATALINA_HOME/bin)

CATALINA_HOME=/Users/username/tomcat

function shutdown() {
    date
    echo "Shutting down Tomcat"
    $CATALINA_HOME/bin/catalina.sh stop
}

date
echo "Starting Tomcat"
export CATALINA_PID=/tmp/$$

# Uncomment to increase Tomcat's maximum heap allocation
# export JAVA_OPTS=-Xmx512M $JAVA_OPTS

. $CATALINA_HOME/bin/catalina.sh start

# Allow any signal which would kill a process to stop Tomcat
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP

echo "Waiting for `cat $CATALINA_PID`"
wait `cat $CATALINA_PID`
```

* org.apache.tomcat.plist

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><!-- NOTE: place this file in /Library/LaunchDaemons -->
    <dict>
        <key>Label</key>
        <string>org.apache.tomcat</string>
        <key>OnDemand</key>
        <false/>
        <key>RunAtLoad</key>
        <true/>
        <key>EnvironmentVariables</key>
        <dict>
            <key>CATALINA_HOME</key>
            <string>/Users/username/tomcat</string>
            <key>JAVA_HOME</key>
            <string>/Library/Java/Home</string>
        </dict>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/username/tomcat/bin/launchd_wrapper.sh</string>
        </array>
        <key>ServiceDescription</key>
        <string>Tomcat</string>
        <key>StandardErrorPath</key>
        <string>/Users/username/tomcat/logs/launchd.stderr</string>
        <key>StandardOutPath</key>
        <string>/Users/username/tomcat/logs/launchd.stdout</string>
        <key>UserName</key>
        <string>root</string><!-- MUST be root in order to run tomcat on port 80 -->
    </dict>
</plist>
```

* tomcat

```
#!/bin/bash

# convenience script for easily starting/stopping tomcat on OSX
# (to be placed in /usr/local/bin. remember to run chmod +x on it)
if [ 'start' = "$1" ]; then
    echo Starting tomcat service...
    COMMAND=load
elif [ 'stop' = "$1" ]; then
    echo Stopping tomcat service...
    COMMAND=unload
fi

if [ 'restart' = "$1" ]; then
    echo Restarting tomcat service...
    sudo launchctl unload -w /Library/LaunchDaemons/org.apache.tomcat.plist
    sudo launchctl load -w /Library/LaunchDaemons/org.apache.tomcat.plist
elif [ -n "$COMMAND" ]; then
    sudo launchctl $COMMAND -w /Library/LaunchDaemons/org.apache.tomcat.plist
fi
```

> 本该淡淡然~~~

branch_name: HEAD


text:
---
layout: post
author: SmartAQnet
title: Citizen compares data from Official Measurement Station
tags: [particulate matter, Augsburg]
---
-----------------------------------------------------------------------------
Physics teacher [Thomas Hecht](https://www.lifeguide-augsburg.de/magazin/feinstaub-augsburg) created an overview on publicly available sensor data.
He also examined what the city of Augsburg can do to prevent air pollution und how every citzen of Augsburg can measure particulate matter.

Even though it is not part of project SmartAQnet, it shows that people are now starting to evaluate their obtained data.