text:
type_info
=========

Cool C++ Single-Header Type Info Implementation For Fun and Profit

Abstract
--------
It is not uncommon to encounter C++ projects with turned off RTTI.
In general, turning RTTI off is non-standard, however, sometimes reality makes us
give up RTTI knowingly.

In most cases, a choice to disable RTTI is made because it conflicts
with the main C++ idea of "You only pay for what you use.", since RTTI is added to every
polymorphic type, whether or not it is ever used.

Motivation
----------
Provide a simple solution using standard C++, implementing most of the
functionality given by the built in C++ RTTI implementation, for RTTI disabled projects,
in a way that generates extra information for a class on demand, per the user's request.

Contents
--------

* Enables dynamic casting using `dyn_cast<Destination>(Source)` similar to dynamic_cast.
* Generates unique id for every type using `type_id<Type>()`.
* Obtain the type id of the dynamic type of an object using `type_id(Expression)`.
* Sibling casts are supported.
* Casts from a virtual base to derived are supported.

Example
-------

```cpp
#include "type_info.h"

void foo()
{
    class a
    {
    public:
        using zpp_bases = zpp::make_zpp_bases<>;
        virtual zpp::dynamic_type zpp_dynamic_type() const { return *this; }
        virtual ~a() = default;

    private:
        int value = 0x11111111;
    };

    class b
    {
    public:
        using zpp_bases = zpp::make_zpp_bases<>;
        virtual zpp::dynamic_type zpp_dynamic_type() const { return *this; }
        virtual ~b() = default;

    private:
        int value = 0x22222222;
    };

    class c : public a, public b
    {
    public:
        using zpp_bases = zpp::make_zpp_bases<a, b>;
        virtual zpp::dynamic_type zpp_dynamic_type() const override { return *this; }
        virtual ~c() = default;

    private:
        int value = 0x33333333;
    };

    auto object = std::make_unique<c>();
    c * pc = object.get();
    a * pa = pc;
    b * pb = pc;

    auto dyn_a_from_b = zpp::dyn_cast<a *>(pb);
    auto dyn_b_from_a = zpp::dyn_cast<b *>(pa);
    auto dyn_c_from_a = zpp::dyn_cast<c *>(pa);
    auto dyn_c_from_b = zpp::dyn_cast<c *>(pb);

    auto dyn_void_from_a = zpp::dyn_cast<void *>(pa);
    auto dyn_void_from_b = zpp::dyn_cast<void *>(pb);
    auto dyn_void_from_c = zpp::dyn_cast<void *>(pc);

    std::cout << "a: " << pa << ", dyn_a_from_b: " << dyn_a_from_b << '\n';
    std::cout << "b: " << pb << ", dyn_b_from_a: " << dyn_b_from_a << '\n';
    std::cout << "c: " << pc << ", dyn_c_from_a: " << dyn_c_from_a << '\n';
    std::cout << "c: " << pc << ", dyn_c_from_b: " << dyn_c_from_b << '\n';

    std::cout << "a: " << pa << ", dyn_void_from_a: " << dyn_void_from_a << '\n';
    std::cout << "b: " << pb << ", dyn_void_from_b: " << dyn_void_from_b << '\n';
    std::cout << "c: " << pc << ", dyn_void_from_c: " << dyn_void_from_c << '\n';

    std::cout << "type_id<a>(): " << zpp::type_id<a>() << '\n';
    std::cout << "type_id<b>(): " << zpp::type_id<b>() << '\n';
    std::cout << "type_id<c>(): " << zpp::type_id<c>() << '\n';

    std::cout << "type_id(*pa): " << zpp::type_id(*pa) << '\n';
    std::cout << "type_id(*pb): " << zpp::type_id(*pb) << '\n';
    std::cout << "type_id(*pc): " << zpp::type_id(*pc) << '\n';
}
```

Disclaimer
----------
1. Performance of virtual base to derived and cross casts have a significant performance impact in comparison
to simple down casts. There is much room for optimization however, feel free to share your implementation.
2. Almost no tests were performed.
3. Inaccessible base classes do not work in the current implementation, however it is fairly easy to implement.
4. I did not implement dynamic cast for reference types, this is also left as a challenge to the reader.
5. The current implementation does not attempt to deal with the case where
the dynamic type of the object has two base class subobjects of the same type. The solution may be simple,
but involves substantial performance impact.

Final Words
-----------
I have implemented this utility mostly for fun, I did not measure whether it is better or worse than the
built in C++ RTTI.

I imagine some projects with turned off RTTI can use this on a small subset of their types
without having their entire project configured for RTTI.

Feel free to report issues or submit your own improvements via pull requests.


text:
Depman
=====

Dependency management helper for Golang packages. Supports versioned dependencies, using standard Golang imports.

Copyright 2013 Vubeology, Inc.

Installation
----------------

	git clone git@github.com:vube/depman.git $GOPATH/src/vube/depman
	go install github.com/vube/depman

Usage
---------

Run `depman` in the directory with your `deps.json`, or use the `--path` argument to specify the directory where `deps.json` is located.

### Commands

#### init
Create an empty deps.json

#### add
Add a dependency (interactive)

#### install
Install all the dependencies listed in deps.json (default)

#### update [nickname] [branch]
Update [nickname] to use the latest commit in [branch]

#### show-frozen
Show dependencies as resolved to commit IDs.
##### Options
* `--recursive`: Descend into dependencies depth-first.

#### help
Display help message

### Options
* `--clean=false`: Remove changes to code in dependencies
* `--debug=false`: Display debug messages. Implies --verbose
* `--help=false`: Display help
* `--no-colors`=false: Disable colors
* `--path="./":` Directory or full path to .deps.json
* `--silent=false`: Don't display normal output. Overrides --debug and --verbose
* `--verbose=false`: Display commands as they are run, and other informative messages
* `--version=false`: Display version number

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

* Shall not require any external dependencies for normal operation
* Testing dependencies shall be installed through depman
* `go vet` shall not indicate any problems
* `golint` (github.com/golang/lint) shall not indicate any problems

Testing
-----------

	# Setup
	cd $GOPATH/github.com/vube/depman
	git pull
	go install
	depman install

	# Test
	go test -i ./...
	go test ./...

	# Coverage
	gocov test ./... | gocov report

	# Vet
	go vet ./...

	# Lint
	golint .

Basic Algorithm
-----------------------

1. For each dependency:
	1. Use `go get` to download the dependency
	2. Checkout the specified version
	3. Look in the dependency's directory for a `deps.json`
		1. Recursively install those dependencies as well
	4. If the dependency type is `git-clone` then manually run `git clone`, `git fetch`, etc as needed

### Duplicates
Duplicated dependencies (anywhere in the tree) with _identical_ versions will be skipped (this just saves some time and prevents infinite recursion). Duplicated dependencies with _different_ versions cause a fatal error and must be fixed by the developer.

### Non Go-Getable Repos
Some repositories (private bitbucket repos for example), are not supported by `go get`.
To include those repositories in depman:

1. Change the type to `git-clone` (hg and bzr are not yet supported)
2. Change the `repo` to a full git url (include everything necessary for `git clone`)
3. Add an `alias` section to specify a directory in which to clone, the path is rooted at `$GOPATH/src/`
See the example below or the included `deps.json` file.

JSON Structure
----------------------

[The file must be named `deps.json`]

	{
		"shortname":{
			"repo":"url/to/package, just like in import",
			"version":"commit, tag, or branch",
			"type": "one of 'git', 'bzr', 'hg'"
		},
		"not go getable":{
			"repo":"full git repo url, just like git clone"
			"version":"commit, tag, or branch",
			"type": "git-clone",
			"alias": "target directory to clone into, (optional for every type other than 'git-clone')"
		}
	}

### Example
	{
		"gocheck": {
			"repo": "launchpad.net/gocheck",
			"version": "85",
			"type": "bzr"
		},
		"gocov": {
			"repo": "github.com/axw/gocov/gocov",
			"version": "90c9390",
			"type": "git"
		},
		"gocov-html": {
			"repo": "https://github.com/matm/gocov-html.git",
			"version": "f83448b",
			"type": "git-clone",
			"alias": "github.com/matm/gocov-html"
		},
		"golint": {
			"repo": "github.com/golang/lint",
			"version": "22f4d5e",
			"type": "git"
		}
	}

TODO
--------

* Support manually cloning `hg` or `bzr` repositories (add types `hg-clone`, and `bzr-clone`)

license: MIT

repository: liamzdenek/depman

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: liamzdenek/depman


text:
---
name: graphql-kotlin
description: A set of libraries for running GraphQL client and server in Kotlin.
url: https://github.com/ExpediaGroup/graphql-kotlin/
github: ExpediaGroup/graphql-kotlin
---

GraphQL Kotlin provides a set of lightweight type-safe GraphQL HTTP clients. The library provides Ktor HTTP client and Spring WebClient based reference implementations as well as allows for custom implementations using other engines. Jackson and kotlinx-serialization type-safe data models are generated at build time by the provided Gradle and Maven plugins.

To generate Jackson models that will be used with GraphQL Kotlin Spring WebClient, add following to your Gradle build file:

```kotlin
// build.gradle.kts
import com.expediagroup.graphql.plugin.gradle.graphql

plugins {
    id("com.expediagroup.graphql") version $latestGraphQLKotlinVersion
}

dependencies {
  implementation("com.expediagroup:graphql-kotlin-spring-client:$latestGraphQLKotlinVersion")
}

graphql {
    client {
        // target GraphQL endpoint
        endpoint = "http://localhost:8080/graphql"
        // package for generated client code
        packageName = "com.example.generated"
    }
}
```

By default, GraphQL Kotlin plugins will look for query files under `src/main/resources`. Given `HelloWorldQuery.graphql` sample query:

```graphql
query HelloWorldQuery {
  helloWorld
}
```

Plugin will generate classes that are simple POJOs implementing GraphQLClientRequest interface and represent a GraphQL request.

```kotlin
package com.example.generated

import com.expediagroup.graphql.client.types.GraphQLClientRequest
import kotlin.String
import kotlin.reflect.KClass

const val HELLO_WORLD_QUERY: String = "query HelloWorldQuery {\n    helloWorld\n}"

class HelloWorldQuery: GraphQLClientRequest<HelloWorldQuery.Result> {
    override val query: String = HELLO_WORLD_QUERY

    override val operationName: String = "HelloWorldQuery"

    override fun responseType(): KClass<HelloWorldQuery.Result> = HelloWorldQuery.Result::class

    data class Result(
        val helloWorld: String
    }
}
```

We can then execute our queries using target client.

```kotlin
package com.example.client

import com.expediagroup.graphql.client.spring.GraphQLWebClient
import com.expediagroup.graphql.generated.HelloWorldQuery
import kotlinx.coroutines.runBlocking

fun main() {
    val client = GraphQLWebClient(url = "http://localhost:8080/graphql")
    runBlocking {
        val helloWorldQuery = HelloWorldQuery()
        val result = client.execute(helloWorldQuery)
        println("hello world query result: ${result.data?.helloWorld}")
    }
}
```

See [graphql-kotlin client docs](https://opensource.expediagroup.com/graphql-kotlin/docs/client/client-overview) for additional details.

branch_name: refs/heads/source

gha_language: TypeScript

gha_license_id: MIT


text:
# webexe
web interface to run a shell program

## sub projects

### api
It provides RESTful APIs, socket.io, and graphQL interfaces which allows the clients from browser, native apps, and other services, to run some programs originally written for CLI locally.
It uses a "webexe.py" module to convert the stdout and stderr of the native executables to JSON objects and send them as response of http to clients.

### frontend
it provides a simple html interface if users just want to call the service directly. It allows user to upload the source file, set parameters, and download result in a GUI. this sub project is not a neccesary part to run this service.

## dependencies
It uses JWT to verify the user permissions. cailab-auth is needed unless the "localMode" switch is on
It uses some conf.json

This is a developing project for building a chromsome on webpages by dragging and dropping features blocks.

this service uses cailab-conf project(private) to generate conf.json and .env files, however handwriting conf.json is also OK according conf.default.json

## Run projects by Docker

### `docker-compose up --build -d`

when all container starts successfully, goto the address you set in conf.json (http://localhost:10301 by default) to access the website

## Run projects indivisually in production

### frontend
```
cd frontend
yarn install
yarn run build
```
html and javascript files are built and generated in build folder, then use nginx or other software to deploy it.

### api
```
cd api
yarn install
yarn run production
```

the node.js server will listen on the port (default 10302), is OK to use nginx as reverse proxy if SSL is required.

## debug projects

### frontend
```
cd frontend
yarn install
yarn start
```

### api
```
cd api
yarn install
yarn run dev
```

repository: IsaacLuo/webexe

repo_name: IsaacLuo/webexe


text:
# Cov32 Data

This is a data collection of [Covid19 Exposure Notification Protocol](https://en.wikipedia.org/wiki/Exposure_Notification) data, collected in Berlin subway between mid November 2020 to early January 2021.

Information about the collection process is documented [in our blog](https://zerforschung.org/posts/auf-der-suche-nach-corona-im-berliner-untergrund/) (currently only in German). This article also contains some analytics and information about data quality. The source code of both sensor and server can be found in the [Covid32Counter repo](https://github.com/zerforschung/Covid32Counter).

## Data format

The dataset contains an array of frames. Each frame represents a mesurement of Exposure Notification Beacons. Mesurements were taken for 2 seconds every minute. There are exceptions in this interval, when we detected, that the train was parked in a tunnel or depot. We also collected BSSIDs of wifi networks to calculate locations of the mesurements. For privacy reasons, we don't publish the BSSIDs but the calculated geolocations. For the same reason we don't publish the received beacon data but the result of the key matching, including the associated metadata of a positive keymatch. The frame also contains the total number of beacons in this mesurement. We added an ID to the positive frames metadata, so they can associated with each other when they derivate from the same day key.

Example frame:

```
{
  "id": 195605, // uniqe id of the frame
  "client_id": 46, // id of the sensor
  "timestamp": "2020-12-28T11:44:55Z", // timestamp in UTC
  "beacon_count": 3, // number of total Exposure Notification Beacons received in this mesurement
  "lat": 52.5149664, // geocoordinates in WGS84, where available
  "lng": 13.4183284,
  "positives": 1, // number of beacons later identified as covid19 positive in the key matching process
  "positive_key_infos": [ // metadata from the positive beacons
    {
      "key_published": "2020-12-30", // Date when this key was published on the RKI keyserver
      "rssi": -92, // signal strength of the BLE beacon
      "risk_level": 7,
      "days_since_onset_of_symptoms": 1,
      "keyid": 40 // ID of the day key which matched the beacon
    }
  ]
}
 ```

## Data Quality

As decripted in the article the data has some major flaws:

* It's not enough data / sensors
* The app install base is likely to be unevenly distributed across the population
* December was not an ideal time to collect data, because of holidays, change of lockdown rules, low PCR-Test coverage during a high covid incidence period
* Sensors were not evenly distributed over the subway routes of Berlin
* Opening of a new subway line extension during this period
* Sensors were placed in different locations in the trains, also because of different types of trains

branch_name: refs/heads/main


text:
Addon author instructions
================

This file contains instructions and explanations for you.
Bug reports are welcome, if you find errors in this template, or stuff doesn't work as expected.

These instructions are in part building upon the info to be found at http://ofxaddons.com/howto, so it's probably best if you go there and take a look first.

Addon name
----------
By convention, addons for openFrameworks begin with `ofx`, and follow camel-case capitalization, e.g. `myAwesomeNewAddon`.

Folder structure
----------------
The folder structure for an addon looks like this:

    of_preRelease/
      addons/
        addons_config.mk
        ofxMyAddon/
          docs/
              Doxyfile
              ...
          test/
              ...
          src/
            ofxMyAddon.h
            ofxMyAddon.cpp
            ...
          libs/
            necessaryLib/
              src/
                lib_implementation.h
                lib_implementation.cpp
                ...
              includes/
                libwhatever.h
                ...
              lib/
                osx/
                  static_libwhatever.a
                linux/
                  static_libwhatever.a
                ... //other platforms
          example_anExample/
            src/
              main.cpp
              testApp.h
              testApp.cpp
              ... //other source
            MyAddonExample.xcodeproj
            ... //other project files for other platforms
          bin/
            data/
              necessaryAsset.txt

Examples must have the string "example" in their folder name.
The OS folder names in `libs/necessaryLib/lib/` must not be changed.

Git repository
--------------
Probably the first thing you will want to do after downloading the template is rename the folder to your addon's name.
Then enter the folder, and create a git repository, e.g. by saying `git init` on the command line.

This template already contains a pre-made .gitignore file.
This file contains ignore patterns to prevent improper/irrelevant files from being
committed to your git repository.

Since git does not keep track of empty directories, there are '.gitkeep' files in empty folders.
You can safely remove them while developing your addon.

ofxaddons.com
-------------
At http://ofxaddons.com/ you will find a mostly automatically generated list of addons. When you publish your addon to Github, it will show up at this webpage after a couple of days or so.

Links
-----
Find more info on openframeworks at http://www.openframeworks.cc/

repository: openframeworks/ofxAddonTemplate

repo_name: openframeworks/ofxAddonTemplate


text:
LuaLoader for Windows - Examples
=====================

More documentation and FAQ are at http://benlo.com/esp8266

LuaLoader is a Windows program for uploading files to the ESP8266 and working with the Lua serial interface. It is compatible with all versions of Windows from Windows 95 to Windows 10.

The examples in this folder were all tested with versions of nodeMCU that were current at the time.

But, be aware that as the nodeMCU Lua interpreter has "improved", sometimes it breaks the examples.

For more up-to-date examples, the best repository is the one updated by the nodeMCU team at

https://github.com/NodeUSB/lua-examples/tree/master/codes

repository: isnadh/LuaLoader

repo_name: isnadh/LuaLoader


text:
# ArcBlock Engineering Weekly Digest (01-13 ~ 01-19)

> Generated on 2019-01-22 06:20

## Summary

* Pushed **188** commits to master branch
* Created **81** pull requests, merged **79**
* Resolved and closed **115** issues
* Crafted and deployed **19** internal releases

## Repo Details

| Repo Name                    | Commits | Pull Requests            | Issues    | Releases                      |
| ---------------------------- | ------- | ------------------------ | --------- | ----------------------------- |
| ArcBlock/forge               | 43      | 38 (38 merged, 0 active) | closed 63 | published 10 , latest v0.11.0 |
| ArcBlock/forge-js            | 88      | 17 (17 merged, 0 active) | closed 21 | -                             |
| ArcBlock/GitCMS              | 6       | 6 (6 merged, 0 active)   | closed 6  | -                             |
| ArcBlock/accelerator         | 12      | 5 (5 merged, 0 active)   | closed 5  | published 3 , latest v0.49.5  |
| ArcBlock/quickbook-ios       | 25      | 5 (5 merged, 0 active)   | closed 8  | -                             |
| ArcBlock/arc-wallet-android  | 3       | 3 (3 merged, 0 active)   | closed 5  | published 3 , latest v0.2.8   |
| ArcBlock/forge-python-sdk    | 5       | 2 (2 merged, 0 active)   | closed 4  | published 1 , latest v        |
| ArcBlock/ocap-javascript-sdk | 4       | 2 (1 merged, 1 active)   | closed 1  | -                             |
| ArcBlock/arc-infra-staging   | 1       | 1 (1 merged, 0 active)   | closed 1  | published 1 , latest v0.26.2  |
| ArcBlock/dapp-token-flow     | 1       | 1 (1 merged, 0 active)   | closed 1  | published 1 , latest v0.7.2   |
| ArcBlock/arc-scraper         | 0       | 1 (0 merged, 1 active)   | closed 0  | -                             |

**Notice: we have removed changes by line of code because GitHub API is not returning correct data**

## Activity Details

### Merged Pull Requests

- [forge] upgrade tm to 0.28.1(#211) 01-19
- [forge] fix get_unconfirmed_txs failed occasionally(#207) 01-19
- [forge] support simulator release and make simulator more usable.(#206) 01-19
- [forge] Properly close db when abci server crash(#201) 01-19
- [forge] modify typeurl to use urn format.(#200) 01-19
- [forge] Cache for get tx and block from consensus(#199) 01-19
- [forge] decipher IP info for peers(#198) 01-19
- [forge] Fixed bug for start cache(#197) 01-18
- [forge] forge_release.toml shall not contain the validator.(#196) 01-18
- [forge] Fix ubuntu build issue(#192) 01-18
- [forge] support unstake tx(#187) 01-18
- [forge] Add app cache as forge's dependency in order to include it in the Erlang release(#184) 01-18
- [forge] Cache state db for mpt(#180) 01-18
- [forge] support unconfirmed_txs net_info and validator rpc(#178) 01-18
- [forge] Fix build issue for build-local and docker(#177) 01-17
- [forge] fix travis won't build for ubuntu(#176) 01-17
- [forge] add more tunable fields in config.(#174) 01-17
- [forge] supportdeclare node rpc to make user easily add a node into a chain(#168) 01-17
- [forge] Refactor states to use StateContext(#165) 01-17
- [forge] Fetch application info when connect to the application.(#162) 01-17
- [forge] use circular queue to replace existing channel state waiting and other list(#161) 01-17
- [forge] Check hash on executable before they got started(#160) 01-17
- [forge] Cache model and forge wallet cache(#158) 01-17
- [forge] Docker support(#157) 01-15
- [forge] update queue pop and length logic(#154) 01-15
- [forge] Add total_txs for get_block/1 and get_chain_info/0(#153) 01-15
- [forge] chore: use consistent field name for all `ResponseXXX` types (#142)(#150) 01-15
- [forge] Fix ranch warning(#145) 01-15
- [forge] support stake tx(#144) 01-17
- [forge] Add strategy for restart resource in manager(#143) 01-14
- [forge] output stderr to given error logfile for daemon manager using erlexec(#141) 01-14
- [forge] fix display for account_migrate_tx in forge_sdk(#140) 01-14
- [forge] release 0.10(#135) 01-14
- [forge] fix two type of tendermint crash.(#134) 01-14
- [forge] fix: kv store example config(#132) 01-14
- [forge] update spec for account migrate itx(#131) 01-14
- [forge] disable distillery tarball build. close: #126.(#129) 01-13
- [forge] improve codegen task for node.js and tweak kvstore app(#124) 01-13
- [forge-js] chore: upgrade forge-proto to align with forge@v0.10.15(#51) 01-19
- [forge-js] tweak cli: see commit history and change log(#39) 01-18
- [forge-js] improve cli(#28) 01-18
- [forge-js] improve forge-cli(#25) 01-18
- [forge-js] feat: support sign and send tx(#24) 01-17
- [forge-js] feat: support forge ps command(#23) 01-17
- [forge-js] add account clis(#22) 01-17
- [forge-js] support ensure wallet on forge-cli startup(#21) 01-17
- [forge-js] support shortcut tx methods(#20) 01-17
- [forge-js] forge node related commands(#19) 01-16
- [forge-js] finish create wallet(#18) 01-17
- [forge-js] import forge-cli package and rename forge-node => forge-sdk(#14) 01-15
- [forge-js] feat: support faking message and generate request/response example(#12) 01-15
- [forge-js] chore: use consistent field name for all `ResponseXXX`(#11) 01-15
- [forge-js] better message encoding and server handler attach support(#10) 01-14
- [forge-js] support formatMessage(#8) 01-14
- [forge-js] chore: make example apps work(#7) 01-14
- [GitCMS] add the Chinese version of November Monthly Report(#203) 01-18
- [GitCMS] December Monthly Report(#202) 01-18
- [GitCMS] 20190117 Q&A bilingual script(#201) 01-18
- [GitCMS] techqanda01162019(#200) 01-18
- [GitCMS] Orangepaper interview(#199) 01-16
- [GitCMS] Digita lCommerce Chamber Partnership Announcement(#198) 01-16
- [accelerator] add 0117 all hands product slides(#177) 01-18
- [accelerator] Create 01-17-2019.md(#176) 01-17
- [accelerator] Adding SSI slides(#175) 01-17
- [accelerator] Add bbl crypto(#174) 01-16
- [accelerator] move videos files into markdown(#173) 01-15
- [quickbook-ios] update empty view and add onboarding pages(#40) 01-18
- [quickbook-ios] fix issues and layout bugs(#39) 01-17
- [quickbook-ios] implement date picker and group filter(#38) 01-16
- [quickbook-ios] implement filter page(#32) 01-14
- [quickbook-ios] handle interaction on tag and address(#28) 01-13
- [arc-wallet-android] update empty view(#97) 01-18
- [arc-wallet-android] fixed filter parameters(#96) 01-17
- [arc-wallet-android] Support change host, fixed #88, fixed #90(#92) 01-15
- [forge-python-sdk] Add rpc function annotations(#6) 01-15
- [forge-python-sdk] read user-provided config or fetch from local(#4) 01-15
- [ocap-javascript-sdk] update schema(#73) 01-13
- [arc-infra-staging] Resize the eth data scanner(#73) 01-15
- [dapp-token-flow] upgrade ocap sdk(#82) 01-13

### Closed Issues

- [forge] upgrade tm to 0.28.1(#211) 01-19
- [forge] upgrade tendermint to 0.28.1(#210) 01-19
- [forge] fix get_unconfirmed_txs failed occasionally(#207) 01-19
- [forge] support simulator release and make simulator more usable.(#206) 01-19
- [forge] release simulator in every forge release(#205) 01-19
- [forge] Support update_asset tx(#204) 01-19
- [forge] Properly close db when abci server crash(#201) 01-19
- [forge] modify typeurl to use urn format.(#200) 01-19
- [forge] Cache for get tx and block from consensus(#199) 01-19
- [forge] decipher IP info for peers(#198) 01-19
- [forge] Fixed bug for start cache(#197) 01-18
- [forge] forge_release.toml shall not contain the validator.(#196) 01-18
- [forge] Please check why this test would fail from time to time(#194) 01-19
- [forge] Improve ForgeSdk RPC(#193) 01-18
- [forge] Fix ubuntu build issue(#192) 01-18
- [forge] Change type_url to urn style(#190) 01-19
- [forge] Currently the web build missing static files and digest(#189) 01-19
- [forge] support unstake tx(#187) 01-18
- [forge] Stake Tx Code review issues(#186) 01-19
- [forge] Add app cache as forge's dependency in order to include it in the Erlang release(#184) 01-18
- [forge] support unstake transaction(#183) 01-19
- [forge] Cache state db for mpt(#180) 01-18
- [forge] support unconfirmed_txs net_info and validator rpc(#178) 01-18
- [forge] Fix build issue for build-local and docker(#177) 01-17
- [forge] fix travis won't build for ubuntu(#176) 01-17
- [forge] add more tunable fields in config.(#174) 01-17
- [forge] supportdeclare node rpc to make user easily add a node into a chain(#168) 01-17
- [forge] Need to provide a declare_node rpc to use `declare` tx to make the node stakable(#166) 01-17
- [forge] Refactor states to use StateContext(#165) 01-17
- [forge] shall properly close db if abci server crashed(#163) 01-19
- [forge] Fetch application info when connect to the application.(#162) 01-17
- [forge] use circular queue to replace existing channel state waiting and other list(#161) 01-17
- [forge] Check hash on executable before they got started(#160) 01-17
- [forge] Forge log showed a great amount of "mempool is full"(#159) 01-19
- [forge] Cache model and forge wallet cache(#158) 01-17
- [forge] Docker support(#157) 01-15
- [forge] update queue pop and length logic(#154) 01-15
- [forge] Add total_txs for get_block/1 and get_chain_info/0(#153) 01-15
- [forge] add unconfirmed_txs, net_info, validators RPC support(#152) 01-18
- [forge] RPC create_wallet fails occasionally (#151) 01-17
- [forge] chore: use consistent field name for all `ResponseXXX` types (#142)(#150) 01-15
- [forge] Forge crashed (log included)(#148) 01-19
- [forge] Get total_tx for ForgeSdk.get_chain_info/0(#147) 01-15
- [forge] setup a seed node(#146) 01-19
- [forge] Fix ranch warning(#145) 01-15
- [forge] support stake tx(#144) 01-17
- [forge] Add strategy for restart resource in manager(#143) 01-14
- [forge] should use consistent field name for all `ResponseXXX` types(#142) 01-15
- [forge] output stderr to given error logfile for daemon manager using erlexec(#141) 01-14
- [forge] fix display for account_migrate_tx in forge_sdk(#140) 01-14
- [forge] Use circular queue to replace existing channel state waiting list and other list(#136) 01-17
- [forge] release 0.10(#135) 01-14
- [forge] fix two type of tendermint crash.(#134) 01-14
- [forge] Forge crash upon sync and cannot be recovered(#133) 01-14
- [forge] fix: kv store example config(#132) 01-14
- [forge] update spec for account migrate itx(#131) 01-14
- [forge] disable distillery tarball build. close: #126.(#129) 01-13
- [forge] Fix ranch complain(#128) 01-15
- [forge] Forge run with many logs when the configuration file is missing. (#127) 01-14
- [forge] Forge build for ubuntu / centos missed several apps(#126) 01-13
- [forge] Stress testing: sending big volume of tx from a non validator node(#125) 01-17
- [forge] improve codegen task for node.js and tweak kvstore app(#124) 01-13
- [forge] Should support stderr redirect to the log file as file(#115) 01-17
- [forge-js] chore: upgrade forge-proto to align with forge@v0.10.15(#51) 01-19
- [forge-js] tweak cli: see commit history and change log(#39) 01-18
- [forge-js] [forge-sdk] improve streaming request for rpc call(#36) 01-18
- [forge-js] improve cli(#28) 01-18
- [forge-js] [forge-sdk] support `info` method in tcp app server(#27) 01-18
- [forge-js] improve forge-cli(#25) 01-18
- [forge-js] feat: support sign and send tx(#24) 01-17
- [forge-js] feat: support forge ps command(#23) 01-17
- [forge-js] add account clis(#22) 01-17
- [forge-js] support ensure wallet on forge-cli startup(#21) 01-17
- [forge-js] support shortcut tx methods(#20) 01-17
- [forge-js] forge node related commands(#19) 01-16
- [forge-js] finish create wallet(#18) 01-17
- [forge-js] support shortcut method to sign and send a transaction(#15) 01-18
- [forge-js] import forge-cli package and rename forge-node => forge-sdk(#14) 01-15
- [forge-js] feat: support faking message and generate request/response example(#12) 01-15
- [forge-js] chore: use consistent field name for all `ResponseXXX`(#11) 01-15
- [forge-js] better message encoding and server handler attach support(#10) 01-14
- [forge-js] support formatMessage(#8) 01-14
- [forge-js] chore: make example apps work(#7) 01-14
- [forge-js] support bigint encoding and decoing(#5) 01-15
- [GitCMS] add the Chinese version of November Monthly Report(#203) 01-18
- [GitCMS] December Monthly Report(#202) 01-18
- [GitCMS] 20190117 Q&A bilingual script(#201) 01-18
- [GitCMS] techqanda01162019(#200) 01-18
- [GitCMS] Orangepaper interview(#199) 01-16
- [GitCMS] Digita lCommerce Chamber Partnership Announcement(#198) 01-16
- [accelerator] add 0117 all hands product slides(#177) 01-18
- [accelerator] Create 01-17-2019.md(#176) 01-17
- [accelerator] Adding SSI slides(#175) 01-17
- [accelerator] Add bbl crypto(#174) 01-16
- [accelerator] move videos files into markdown(#173) 01-15
- [quickbook-ios] update empty view and add onboarding pages(#40) 01-18
- [quickbook-ios] fix issues and layout bugs(#39) 01-17
- [quickbook-ios] implement date picker and group filter(#38) 01-16
- [quickbook-ios] TX list for a "tag" is not the full list, and the behavior is different with Android. (#33) 01-17
- [quickbook-ios] implement filter page(#32) 01-14
- [quickbook-ios] Should remove “add address” screen, simply put 2 button on home page(#30) 01-17
- [quickbook-ios] handle interaction on tag and address(#28) 01-13
- [quickbook-ios] Should display eth address in the home page card (or at least start, end chars)(#13) 01-17
- [arc-wallet-android] update empty view(#97) 01-18
- [arc-wallet-android] fixed filter parameters(#96) 01-17
- [arc-wallet-android] Support change host, fixed #88, fixed #90(#92) 01-15
- [arc-wallet-android] After add  comment to a TX, it won’t change to edit(#90) 01-15
- [arc-wallet-android] Asset Tx detail page fiat is 0(#88) 01-15
- [forge-python-sdk] RequestSendTx with empty itx should return error message(#10) 01-19
- [forge-python-sdk] Add rpc function annotations(#6) 01-15
- [forge-python-sdk] read user-provided config or fetch from local(#4) 01-15
- [forge-python-sdk] Fetch customized config settings(#2) 01-15
- [ocap-javascript-sdk] update schema(#73) 01-13
- [arc-infra-staging] Resize the eth data scanner(#73) 01-15
- [dapp-token-flow] upgrade ocap sdk(#82) 01-13

repository: ArcBlock/weekly-digest

repo_name: ArcBlock/weekly-digest


text:
# pybacktest
Simple yet powerful backtesting framework in python/pandas.

Currently I don't plan to continue working on this project.

### About
It allows user to specify trading strategies using full power of pandas, at the same time hiding all boring things like manually calculating trades, equity, performance statistics and creating visualizations. Resulting strategy code is usable both in research and production setting.

Strategies could be defined as simple this:
```python
ms = pandas.rolling_mean(ohlc.C, 50)
ml = pandas.rolling_mean(ohlc.C, 100)
buy = cover = (ms > ml) & (ms.shift() < ml.shift())
sell = short = (ms < ml) & (ms.shift() > ml.shift())
```

And then tested like this:
`pybacktest.Backtest(locals())`

We use it in our research and production operations.

## Installation
```
pip install git+https://github.com/ematvey/pybacktest.git
```
If you don't install it in virtualenv, you might need to prepend last line with sudo.

## Tutorial
Tutorials are provided as ipython notebooks in folder *examples*. You run it from cloned repo or [watch via nbviewer](http://nbviewer.ipython.org/urls/raw.github.com/ematvey/pybacktest/master/examples/tutorial.ipynb).

## Status
Single-security backtester is ready. Multi-security testing could be implemented by running single-sec backtests and then combining equity. Later we will add easier way.


text:
## Integration Testing
<!-- .slide: data-background="#FF7733" -->

Writing integration style tests with tremor

>>>

### Create a test directory structure for our tests

```shell
$ mkdir tests
$ mkdir tests/integration
$ echo '[ "integration" ]' > tests/integration/tags.json
$ echo '[ "all" ]' > tests/tags.json
cat <<DATA
{
    "kind": "Integration",
    "includes": "integration-test-*"
}
DATA > tests/integration/meta.json
```

<div style='font-size: 20px'>
We can create tags files in any directory called `tags.json` that
are a list of strings that we can use to include or exclude tests
from the test search path.  The `meta.json` file instructs tremor
that the directory structure is for an integration style test.
</div>

---

#### Verify:  `trecker test /pwd/tests`

![Verify test hierarchy](./assets/test-integration-01.gif)

```shell
$ tremor test integration tests
```

>>>

### Add a folder to contain our integration test

```shell
$ mkdir tests/integration/integration-test-01
```

>>>

### Add main trickle file for test

Add a main trickle query file for the system under test

```trickle
# File: tests/integration/integration-test-01/passthrough.trickle

select event from in into out;

```

>>>

### Config: `config.yaml` source

```yaml
# File: tests/integration/integration-test-01/config.yaml
onramp:
  - id: in
    type: file
    config:
      source: "in.json.xz"
      close_on_done: true
      sleep_on_done: 1000
```

---

### Config: `config.yaml` sink

```yaml
# File: tests/integration/integration-test-01/config.yaml
offramp:
  - id: out
    type: file
    config:
      file: "events.log"
```

---

### Config: `binding` event routes

```yaml
# File: tests/integration/integration-test-01/config.yaml
binding:
  - id: test
    links:
      "/onramp/in/{instance}/out": ["/pipeline/passthrough/{instance}/in"]
      "/pipeline/passthrough/{instance}/out": ["/offramp/out/{instance}/in"]
```

---

### Config: Instances via `mapping`

```yaml
# File: tests/integration/integration-test-01/config.yaml
mapping:
  /binding/test/1:
    instance: "1"
```

>>>

### Test Data: Record `in.json.xz`

```shell
$ cd tests/integration/integration-test-01/
$ echo '{ "snot": "badger"} ' >> in.json
echo '"tremolo" ' >> in.json
echo '1234.56 ' >> in.json
xz in.json
```

---

#### Verify: Manual test invocation

![Verify test hierarchy](./assets/test-integration-02.gif)

```shell
$ TREMOR_PATH=/path/to/tremor-script/lib tremor test integration tests
```

---

### Verify: Equivalent manual invocation

```shell
$ cd tests/integration/integration-test-01
$ tremor server run -f config.yaml passthrough.trickle
tremor version: 0.9.0
tremor instance: tremor
rd_kafka version: 0x000000ff, 1.5.0
allocator: snmalloc
Listening at: http://<IP_ADDRESS>:9898
```

---

### Test Data: Sanity check output

```shell
$ cd tests/integration/integration-test-01
$ cat events.log
{"snot":"badger"}
"tremolo"
1234.56
$ cp events.log expected.txt # if ok, use for assertions
```

>>>

### Assertions: Add `assert.yaml`

```yaml
status: 0
name: Query passthrough  assertions
asserts:
  - source: events.log # generated during run
    equals_file: expected.txt # hand crafted
    contains: # selective
      -  "snot"
      - badger
      - tremolo
      - 1234.56
```

---

### Run integration test again

![Verify assertions](./assets/test-integration-03.gif)

>>>

### Optionally execute processes before

```json
{
  "run": "tests/integration/ws/before",
  "cmd": "tremor",
  "args": [
    "server", "run",
    "-p", "before.pid",
    "-n", "-f",
    "before/ws.trickle",
    "before/config.yaml",
    "before/server.yaml"
  ],
  "await": { "port-open": [ "4242" ] },
  "max-await-secs": 15
}
```

---

### Requires a `before` sub folder for test

```shell
$ tree tests/integration/integration-test-01/before
./tests/integration/integration-test-01/before
├── config.yaml
├── server.yaml
└── ws.trickle
```

---

### Before: `config.yaml`

```yaml
onramp:
  - id: ws-in
    type: ws
    codec: json
    config:
      host: <IP_ADDRESS>
      port: 4242

offramp:
  - id: out
    type: file
    codec: json
    config:
      file: "gen.log"
  - id: exit
    type: exit

binding:
  - id: main
    links:
      "/onramp/ws-in/{instance}/out": ["/pipeline/ws/{instance}/in"]
      "/pipeline/ws/{instance}/out": ["/offramp/out/{instance}/in" ]
      "/pipeline/ws/{instance}/exit": ["/offramp/exit/{instance}/in" ]
```

---

### Before: `server.yaml`

```yaml
mapping:
  /binding/main/1:
    instance: "1"
```

---

### Before: `ws.trickle`

```trickle
create stream quit;

select event from in
where event != "quit" into out;

select { "done": true } from in
where event == "quit" into out;

select { "exit": 0, "delay": 10000 } from in
where event == "quit" into out/exit;
```

>>>

### Optionally execute processes after

```json
{
  "run": "tests/integration/integration-test-01/after",
  "cmd": "bash",
  "args": [
    "./after/stop.sh"
  ]
}
```

---

### Requires an `after` sub-folder

```shell
$ tree tests/integration/integration-test-01/after
./tests/integration/integration-test-01/after
└── stop.sh
```

---

### After: `stop.sh`

```bash
#!/bin/bash

echo "Stopping WS by sending quit json string to port 4242"
for i in {1..5};
do
  if ! $(nc -zv  localhost 4242); then
    echo '"quit"' | websocat ws://localhost:4242
  else
    echo "Killing it softly at attempt ${i}"
    break;
  fi
done;

echo "If a pid file exists, hard kill"
if test -f before.pid; then
    kill -9 $( cat before.pid )
    # Remove pid file
    rm -f before.pid
fi
```

>>>

### Tags

Use the `-i` and `-e` flags to `tremor test`

- Given: `-i foo bar`
 - Any `foo` or `bar` tagged tests

- Given: `-i foo bar -e baz bogo`
 - Any `foo` or `bar` tagged tests
 - Excluding `baz` and `bogo`

---

```shell [1-2|3-4|5-6|7-8]
# include `foo`, exclude `bar` unit tests
$ tremor test unit tests -i foo -e bar
# include `bar`, exclude `foo` unit tests
$ tremor test unit tests -i bar -e foo
# include `all` unit tests
$tremor test unit tests
# include `all` tests of all kinds
$ tremor test all tests
```

>>>

### Further reading

* [`tremor test ...`](https://docs.tremor.rs/operations/cli/#test)
* [Github - Tremor Integration tests](https://github.com/tremor-rs/tremor-runtime/tree/main/tremor-cli/tests/integration)

>>>
### End of `integration test` guide
<!-- .slide: data-background="#33FF77" -->

This is the end of the integration test getting started guide

Note: This will only appear in speaker notes window

repository: tremor-rs/tremor-www-docs

gha_language: JavaScript

repo_name: tremor-rs/tremor-www-docs


text:
# Designing and Developing Databases - National Fitness Challenge
## Problem Statement

![Healthy365-app](https://user-images.githubusercontent.com/45563371/89202582-c22a4a80-d5e5-11ea-83ae-84731d1a9c6b.jpg)

The Ministry of Healthy Lifestyle (MHL) has tasked your team to design and develop a database solution to store information about their national fitness challenge, which is facilitated through the mobile app “Fitness 365”. The Ministry hopes that the database will improve their ability to understand citizens’ (about 5 million citizens) activeness and lifestyle. Since MHL will be promoting the app with incentivized campaigns, citizens are expected to use the app frequently for a prolonged period (i.e., 1 year). App usage is expected to be highly intensive during weekends and weekday evenings, while usage is expected to be sparse during daytime in weekdays.

## The Ministry’s requirements include:

(1)	User login

(2)	User profile

(3)	Tracking of user running/ jogging activities

(4)	Twitter-style social media (i.e., a user is following someone and/or a user is being followed by someone)

(5)	Posting of tracked activities with (optional) comments and photos

(6)	Giving Kudos and comments on posting

(7)	Running clubs

(8)	Weekly leaderboard

(9)	Personal best

## A.1 Relational database implementation

![704114-637286243838226002-16x9](https://user-images.githubusercontent.com/45563371/89556488-0c106c00-d844-11ea-8618-5a514bdb63ea.jpg)

### The specific deliverables are:

-	Instructions on deploying the relational database (i.e., steps to import the .sql package)

-	The relational database must include dummy data (the amount of dummy data must be adequate to perform queries listed below)

-	SQL statements (with expected outputs) for queries (i.e., in a sql or text file) as follows:

    -	Generate a list of male users who are >= 21 years old

    -	Generate a list of male users who are following more female users than male users

    -	Generate a list of female users who are followed by only male users

    -	Generate a list of users who are following each other mutually. For example, A is following B and B is following B (in other words, A is following B and A is also followed by B)

    -	Generate activeness insight, i.e., a list of users who have exercised (i) less than 30 minutes per week, (ii) between 30 minutes and 60 minutes, (iii) between 60 minutes and 120 minutes, and (iv) more than 120 minutes

    -	Based on the above (activeness insight), generate age-based activeness insight, i.e., (i) below 21 years old, (ii) between 21 and 35 years old, (iii) between 35 and 50 years old, and (iv) above 50 years old

    -	Enrich the above (age-based activeness insight) with genders (i.e., provides age-based activeness insight for each gender)

    -	Generate a list of users who have received > 5 Kudos in average for each activity

    -	Compute monthly active social networks, i.e., for each user, list out his/her followers, who have given him/her >=5 Kudos for each month’s activities

    -	Conduct social comparison analysis, i.e., for each user, list out his or her weekly average activity distance and weekly average activity duration. Additionally, compute the weekly averages for his social networks (i.e., followed by the user)

## A.2 Nonrelational database implementation

![types-of-nosql-datastores](https://user-images.githubusercontent.com/45563371/89556681-54c82500-d844-11ea-86ac-e40f71d07f83.png)

### A nonrelational database shall be implemented. You may develop the nonrelational database using MongoDB or Neo4j. You are recommended to develop the nonrelational database design based on that in A.1.

The specific deliverables are:

-	Instructions on deploying the nonrelational database

-	The nonrelational database must include dummy data (consistent with that in A.1)

-	noSQL / Cypher statements (with expected outputs) for queries (i.e., in a text file) as depicted in A1 above.


text:
Via
===

Trivial proxy objects for common lisp.

We dont have interfaces and some types are not extendable so couldnt implement an interface anyway. We can use proxy objects instead.

A proxy object is an struct that references an object and the functions needed to forfill the proxies' specification.

You can pass around the proxy object and call the methods which will call the target.

When provided, `via` will write type declaration in the functions to help your compiler generate fast code.

Proxies. Not the prettiest solution to a problem, but they'll do.

repository: cbaggers/via

repo_name: cbaggers/via


text:
# airflow-deployments

Two different methods to deploy airflow:

- minikube (local development)
- google cloud platform (gcp)

(not yet) - Amazon Web Services (aws)

Each deployment prefers a managed service over a custom built image,
so you'll find managed services over docker/k8s/ecr run services.

This basically means it deploys CloudSQL, MySQL RDS, Redis Elasticache
over mysql/postgres/redis docker containers.

Minikube is considered for local development only. Another way to run
a local development environment is through docker compose, based off
the puckel/airflow repository.

repository: gtoonstra/airflow-deployments

repo_name: gtoonstra/airflow-deployments


text:
---
layout: post
title: The Weekly Mini-Challenges
date: 2019-03-05 07:10
permalink: /weekly-challenge/
author: Kevin Olega
---
My suggestion, print out four copies of this guide and post one on the wall next to your bed, one next to your computer, take one with you all the time and the other is a backup copy.

## Here are the mini-challenges
*(you do not have to do all of these, just pick one per week):*

### 1. Adding healthy habits:

- Order food in English.
- Study one website post.
- Listen to one podcast.
- Write a comment on the website or Facebook page in English
- Send me a message with a list of questions.
- Buy an English book.
- Start Journalling in English
- Write down your Five Year Plan in English.
- Implement an English Only Policy at Home
- Take notes of lessons from the website and facebook page.
- Join me on my Facebook live.
- Spend time with an English Speaking Friend.
- Join an English Speaking Bible Study Group
- Listen to the podcast, "Let's Know Things" by Colin Wright, Freakonomics and Hardcore History.
- Read the ZenHabits.net blog and Lifehacker.com
- Pray everyday.

### 2. Changing your approach:

- Speak English whenever you're ordering food.
- Read the lessons on my website instead of scrolling Facebook and Instagram Feed.
- Identify friends who speak in English and ask for help.
- Write in English every day.
- List down 10 ideas on how to improve your life every day.
- Write down your blessings.
- Write down the skills that you want to learn.
- Write down your biggest problems on your journal.
- Write down 10 solutions to each of your problems.
- Write down your daily expenses.
- Write down your Wishlist of things that you want to buy.
- Write down the characteristics of friends you want in your life.
- Write down the positive traits you want to have.
- Write down accomplishments that you want to achieve.
- Write down your biggest fears.
- Write down what's bothering you.
- Write down what failure looks like for you.
- Write down questions that you are interested in knowing the answer to.
- Start doing push-ups, air squats and burpees. Start with 10/day.
- Pray in English.

### 3. Cutting out unhealthy habits (look at what you do now, and set a target that’s lower):

- Watch lessons of Alan Watts and Jordan Peterson on YouTube instead of watching Tagalog Shows.
- Write down the characteristics of people you want to avoid.

- Stop talking to people who gossip.
- Stop talking to people who smoke and drink alcohol.
- Stop watching Tagalog movies.
- Stop talking about your goals and your plans. Write them down instead.
- Switch from eating sweets and carbs to eating more beef.
- Stop scrolling facebook and start reading books instead.

- Switch from processed meats (sausages, bacon, etc.) to real meat, or fish.

### 4. Hardcore stuff (a few people asked for some suggestions):

- Try eating one meal a day with only meat.
- Volunteer to be a moderator on my facebook group
- Volunteer to be a writer for my facebook page. Write down lessons that helped you and share them with other readers.
- Start applying in a call center to test your capability.
- Write down your goals and plans for 1 year, 3 years, 5 years, 10 years and 20 years.

If it sounds easy and you’re already used to speaking in English, try the 7-Day English Only Challenge.

Not every change listed above for everyone.

Find changes that feel right to you, as I know not everyone agrees with everything I’ve listed.

What is healthy for you will be different than what is healthy for me.

I believe in a Carnivore diet (out of compassion for humans) and try to eat whole foods as much as I can (but not religiously).

That doesn’t mean you have to do that.

The one thing I believe is in trying to get foods that are full of nutrients — beef, lamb, organ meats and eat less of the foods that are mostly empty of nutrients (processed foods, white bread , and sugar, fried foods).

repository: kevinolega/callcentertrainingtips

repo_name: kevinolega/callcentertrainingtips


text:
# lin
lin is a stack-based language that aims to be as straightforward and simple as possible.

## Normal Installation

    npm i -g linlang

## Manual Installation
`git clone` this repo, `cd` into it, `npm install`, and `npm ln`.

## Language Specs
CLI Usage:

    lin program.lin

For more options, run `lin -h`.

To get an idea of the language syntax, see `examples/` and `docs/`.

### Program Execution
The parsing is extremely basic. The code is parsed line-by-line; numbers match the pattern `[0-9]*\.?[0-9]+|[0-9]+\.?`, keywords match the pattern `[^0-9. ]+`, and spaces are ignored. This means that a valid lin snippet is really just a series of numbers and keywords.

By default, only the first line is parsed and interpreted. It is possible to execute other lines through functions.

### Special Syntax
Any keyword with a `\` in front of it will push the rest of the keyword (excluding the leading `\`) onto the stack. Any keyword with `#` in front of it will be ignored or treated as an ID. Other than that, numbers get pushed to the stack, and keywords are executed as commands.

### Commands
See `docs/commands.md`. Concepts and terms in that file are explained in the other files of `docs/`.


text:
# Series Canvas Heatmap

Demonstrates rendering a heat map from a static data set using Canvas rendering.

N.B. This example must be run via a web server in order for the data file to
be served, this can be done by running `npm start` from the project root.

gha_language: HTML


text:
---
layout: page
title: About the Theme
tags:
- about
- Jekyll
- theme
- JBlog
date: 2016-03-21 00:00:00 +0000
---
![jekyll Image](http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2015/02/1424055625jekyll.png)
{: .image-pull-right}

JBlog is a simple jekyll theme.

## Now Imporved

I have used this theme in my own php and ruby blogs. And there are some shortcomings. If something looks extremely ugly and you can't resist to fix it, just send me a PR. I will be grateful.

If you like this theme or using it, please give a **star** for motivation.

You want to **use it?**

[Install JBlog](https://github.com/alperenbozkurt/JBlog){: .btn .btn-info}

repository: Duckunt/test-jkl

repo_name: Duckunt/test-jkl


text:
---
title: MySqlBulkLoader.TableName property
---

# MySqlBulkLoader.TableName property

The name of the table to load into. If this is a reserved word or contains spaces, it must be quoted.

```csharp
public string? TableName { get; set; }
```

## See Also

* class [MySqlBulkLoader](../../MySqlBulkLoaderType/)
* namespace [MySqlConnector](../../MySqlBulkLoaderType/)
* assembly [MySqlConnector](../../../MySqlConnectorAssembly/)

<!-- DO NOT EDIT: generated by xmldocmd for MySqlConnector.dll -->

repository: mysql-net/MySqlConnector

gha_language: C#

repo_name: mysql-net/MySqlConnector


text:
#Duel_DDQN V0.3

based on **Dueling Network Architectures for Deep Reinforcement Learning**
*Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, Nando de Freitas*
<http://arxiv.org/abs/1511.06581>

run
```
python duel.py CartPole-v0 --no_display --episodes 200 --replay_start_size 0 --gym_record ../th
```
results / Params
- v0.2 <https://gym.openai.com/algorithms/alg_zy3YHp0RTVOq6VXpocB20g>
- v0.3 <https://gist.github.com/Sohojoe/125a08076cec47c50dcbbfd530c810b4>

**note - in progress; I branched @tambetm's gist; I've fixed some issues and trying to get it closer to the paper. Pull request / help is welcome!!**

**Orginally gist on:- **
https://gist.github.com/tambetm/0bd29b14d76b85946422b79f3a87df70 - https://gym.openai.com/evaluations/eval_sOUmkzSy26GIWJ5IIQeA#reproducibility


text:
# Validating a Schema against an Ontology

The OGIT ontology is a well-defined set of attributes and entities and possible connections between them all. Our schema defines much the same sort of data.

It would be easy to reference an attribute that doesn't exist or is forbidden on an entity, or to not add one that is required by OGIT.

Therefore there is a tool installed by default alongside this package to validate such.

## Usage `npm run validate`

`npm run validate <mappings module> <OGIT ontology location>`

 - **`<mappings module>`** should be the path to a module that exports a mapping for us to validate.
 - **`<OGIT ontology location>`** should be the path to a single YAML file (like the `graphit-ontology.yaml` distributed with GraphIT) or a directory structure like [the OGIT repo](https://github.com/arago/OGIT).

The response will be either:

```javascript
{
    errors: 0,
    detail: {}
}
```

Which is what you want or:

```javascript
{
    errors: n,
    detail: {
        EntityName: [
            "some error",
            "another error"
            ...
        ],
        ...
    }
}
```

Which you don't want. The error messages are pretty verbose and should help you sort out any issues.

repository: KristjanLiiva/hiro-graph-js

repo_name: KristjanLiiva/hiro-graph-js


text:
---
author: Jens-Christian Fischer
categories: ["musings"]
comments: true
date: 2008-03-01 23:37:32+00:00
layout: post
link: https://invisible.ch/2008/03/02/the-flow-2002-03-02/
slug: the-flow-2002-03-02
tags: ["blog"]
title: The Flow (2008-03-02)
type: post
wordpress_id: 644
---

Not really getting much done at the moment, but busy nonetheless. Here's what crossed my newsreader:

try-ing made easy
-----------------

Did you ever write this in your Ruby or Rails code?

    person.name rescue ""

wouldn't it be nicer to try to to it easier?

    person.try(:name)

[Chris][1] thinks so too....

I improved on this (spectacularly) and now try supports fail:

    person.try(:name, :fail => "no person")

The extension is trivial:

    class Object
      def try(method, options = {})
        {:fail => nil }.merge(options)
        if respond_to? method
          send(method)
        else
          options[:fail]
        end
      end
    end

Deploy to Heroku from Git
-------------------------

[Heroku][2] allows you to write Rails applications in the browser and deploy to EC2. Now they nice peoble of Heroku have released [Heroku API][3] that allows you to use Git. Now this looks even more interesting than before.

Rails Undo / Redo
-----------------

Do you want to implement Undo/Redo functionality into your Rails applications? Look no further: [RUR][4]

[1]: https://ozmm.org/posts/try.html
[2]: https://heroku.com/
[3]: https://heroku.com/docs/api/
[4]: https://blog.nanorails.com/rails-undo-redo

Technorati Tags: [rails](https://www.technorati.com/tag/rails), [ruby](https://www.technorati.com/tag/ruby)


text:
---
id: 1843
title: 'How To Talk To People Who Aren’t Your Advisor About Your Thesis'
date: 2015-11-22T11:30:06+00:00
author: admin
layout: post
guid: http://emilyesten.com/words/?p=1843
permalink: /undergraduate/thesis/how-to-talk-to-people-who-arent-your-advisor-about-your-thesis/
original_post_id:
  - "1843"
  - "1843"
categories:
  - Thesis
period: undergraduate
---
By “who aren’t your advisor,” I really mean “people who have no idea about academia.” I’m still trying to nail down the best way to sum up my research without sounding like a walking thesaurus. I feel like each week there’s some new element I want to add or a new source takes me in a totally direction. I also feel like I have to give each person the background on my topic before I actually explain what it is.

The most recent conversation happened when my roommate’s family came to visit for the weekend:

> Roommate’s Parents: So what are you working on?
>
> Me: Oh, I’m writing my thesis proposal.
>
> Roommate’s Parents: Oh, what’s it on?
>
> Me: Well, I’m looking into this women’s organization called the Ladies’ Branch of the New Bedford Port Society and their reform efforts  to impose moral order on the transient seamen, within a gendered and racialized and class-related context … y’know, within a rapidly urbanizing whaling environment…

At that moment, I realized I had been talking very quickly and kinda rambling and that my roommate’s parents were probably not that interested in my thesis and were probably making small talk, so I kinda just let my sentence die out.

But trying to shorten my thesis into “I’m investigating women in whaling” doesn’t feel accurate, nor does saying “women in New Bedford” or “investigating social stratification in Jacksonian New England,” all of which are being addressed in this thesis but aren’t really the subject of what I’m looking at. Saying “I’m looking into the Ladies’ Branch for the New Bedford Port Society” usually just gives people blank stares, but feels less accurate.

I think I did a pretty good job in this blog post summarizing myself:

> My argument is that wealthy, Quaker women who participated in the organization used it as a way to contribute to their rapidly changing urban landscape by imposing moral standards on the transient seamen.

To make it even simpler, I’ve been following one of my favorite blogs, @lolmythesis, in hopes I can think of a clever answer. If you can get your thesis into something as short and concise as that, I’d be impressed – it’s pretty difficult.

I guess what I can recommend is that simple is best. Yes, you are very excited about your thesis – it’s basically dominating your academic life at this point. But channeling that excitement into a simple sentence makes your goal a lot clearer – and makes conversations a little bit easier to have with people who aren’t grading you.

gha_license_id: NOASSERTION


text:
Requirements
------------
Java application
Oracle DB

buy products, stock it in a container and sell it to clients
BDD used to :
	1 trace all buy and sell
	2 show current capacity/possiblity and stock

Supplier
--------
a supplier is identified by name and described by adress and phone number
a supplier can sell multiple products which are identified by their name

Product
-------
the same product can be sold by two wholesalers
a product has a fixed price that can be negociated

Client
------
same as a supplier
can has multiple shipping adresses different from their main adress

Wholesaler
----------
sell:
	- clothes described by color and size
	- food described by the peremption date
		- some has to be freezed at some temperature

Product
-------
many are identified by group number attribued by the supplier
each supplier has unique group number on every of his group but 2 suppliers can have the same groupe number
wholesaler must follow the group number from buy to sell

Repository
----------
identified by adress
can store multiple types of products
has a capacity and possibility storage
many has cold chamber

Wholesaler command
------------------
a wholesaler to the unique supplier
can be on multiple products
described by product :
	- quantity
	- negociated price
has a unique number in the account book of the supplier

Client command
--------------
has the shipping adress
identified by a number which is unique in all clients commands


text:
---
title: 1. Setup the system - proxmox
summary: How to setup the hardware and proxmox and your hass VM.
authors:
    - Tomas Hellström (@helto4real)
---

# Setup the system
I use an Intel NUC as my device setting upp the system.
## Hardware
- Intel NUC with at least 8 Gig memory plus VM mem size, I use 32 Gig but 16 would be enough
- Make sure you have enough harddrive space. I use 256 gig SSD.
- Bios boot and hit F2 (NUC) to enter. Look for boot order and boot devices. Make sure USB boot is prio. Make sure you enabled virtualization features of the processor.
## Prepare install
- Download the proxmox image at [this site](https://www.proxmox.com/en/downloads/category/iso-images-pve)
- Get a USB stick with at least 1 gig memory
- Prepare the stick, I used [rufus download](https://rufus.ie/)
- Use the settings like below, specifically I used the DD mode (not ISO) to make the usb boot.

![rufus](img/proxmox/rufus_settings_1.jpg)

Set the DD setting (Pardon the Swedish) and press OK.
![rufus](img/proxmox/rufus_settings_2.jpg)
## Install
- Put the usb in the NUC and reboot. Make sure you made hardware and bios correctly
- Set the admin/root password (DONT LOSE IT!)
- Choose harddrive where you install proxmox on
- Select correct country, keyboard layout and time-zone
- Install and reboot after install is done
- Test install by login to proxmox web interface wich are https://yourip:8006. Login with root/yourpassword
## Configure before creating first VM
### Add the No-Subscription Repository
In order to get new images you need a repository. Give you have no subscription we have to add the correct repository. Add the pev-no-sybscription between the main contrib and security updates in the file:

`/etc/apt/sources.list`
```
deb http://ftp.debian.org/debian stretch main contrib

# PVE pve-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
deb http://download.proxmox.com/debian/pve stretch pve-no-subscription

# security updates
deb http://security.debian.org stretch/updates main contrib
```
### Remove the enterprise subscription
Comment out the line `deb https://enterprise.proxmox.com/debian/pve stretch pve-enterprise` in the file `/etc/apt/sources.list.d/pve-enterprise.list` if you are not planning to get a subscription or you will get errors on `apt-get update`.

### Network
For home users the default bridged network makes most sense so not extra network is configured. Multiple bridges can be created. For improved security, vlans can be setup. I might do this in a test environmet but will not use VLAN for now.

### Certificates
I will use lets encrypt for certificate management.
Todo: document this

## Add VM for Hassio
Creating the virtual machine. Default values apply if not specified in the instructions or on image.

### Upload the ISO
Download debian or what ever operating system you prefere. I use net install image of Debian 9. [download here](https://www.debian.org/CD/netinst/). Select amd64 CD or torrent if you prefer.

![upload](img/proxmox/upload_iso.jpg)

Then select your ISO file and press `Upload`

![upload](img/proxmox/upload_iso_debian.jpg)

### Add the VM
**General**
- Name: HASSIO
- No resource pool

![general](img/proxmox/1-create-vm-general.jpg)

**OS**
- select your isofile and use rest default

![general](img/proxmox/create-vm-deb.jpg)

**Hard disk**
I used 20 Gig as start disk, remember that the whole disk wont be allocated at once. This is the max size.

**CPU**
- 1 socket, 2 cores should be sufficent (I have 4 cores total)

**Memory**
- 2368 MiB should be sufficient for HASSIO and docker containers

**Network**

Default settings

Create the VM by select the start the installation after created checkbox and press "Finish"

### Setup Debian
#### Installation
For other operating systems please see other.
- double click on new host to get to screen
- Install Debian with default settings. I used swedish as language and sweden as location
- Choose host name, I use hassio
- Set the root password
- Set the non root name and username
- Use whole disk and standard settings for partitioning
- Use standard settings util you are at the software selection
- Unselect debian environment and print server
- Select "SSH" server, I am sure you want to connect remote to the machine
- Install rest as default and reboot

Screens from setup. (Sorry for Swedish):

![general](img/proxmox/debian_start.jpg)
![general](img/proxmox/debian_language.jpg)
![general](img/proxmox/debian_host.jpg)
![general](img/proxmox/debian_software.jpg)

#### Install sudo
Depending on your configuration you might need to install sudo.

Enter su using `$ su` and enter password.
Install sudo and add your user (the one you provided in installtime) and exit from su.
```
$ apt-get install sudo
$ adduser username sudo
$ usermod -aG sudo youruser
$ exit
```
and the exit.
Now you can use sudo for admin.

if you get problems you might need to add the user in the sudoers file.

```
$ su
$ nano /etc/sudoers
$ exit
```
put the `youruser   ALL=(ALL:ALL) ALL` after root

#### IP configuration
If you want the default DHCP IP just skip this step

```
# Log in as root or su to root then
nano /etc/network/interfaces
# Should look like this:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
```
then change to :

```
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address <IP_ADDRESS>
        netmask <IP_ADDRESS>
        gateway <IP_ADDRESS>
```
Make sure your settings are correct. In an VM the eth0 is probable something else. To list network interfaces write `ip link show` to get the correct one. You need to select the ethernet interface.

#### Finalizing the setup
Now it is a good time to make a snapshot. A snapshot is a point in time to restart from.
- First make sure the latest updates and uppgrades are on the base operating syste before making snapshot.

```
$ sudo apt-get update
$ sudo apt-get upgrade
$ exit
```

go to the proxmox web interface and select your host ant then select "snapshot".
Create the snapshot. Call it "Fresh". Now we always can start fresh after installing hassio and all other stuff.

# Proxmox backup
One of the best features running virtual environments is the possibility to backup entire machine really easy. Here is docs about how that's done.
## Use usb disk
### Mount the USB drive
If you are running a windows system, the drive is probably a NTFS drive. This guide assumes this but there are basically very few difference with other format types.

For full descriptions go to [this url](https://linuxconfig.org/howto-mount-usb-drive-in-linux)

1. `$ fdisk -l` lists your disks, make sure you can see your drive. Take not of drive path i.e. `/dev/?`
2. `$ mkdir /media/usb-drive` makes mount point
3. `$ mount /dev/sdc1 /media/usb-drive/` (sdc1 will probably be another device id for you), check #1
4. `$ mount | grep sdc1`, to check if mount went ok

if you later want to unmount the usb, the command is `umount /media/usb-drive`.

To PERMANENTLY MAKE MOUNT AVAILABLE ATT BOOT then do following.

1. `$ blkid -t TYPE=ntfs -sUUID` Check your unique id of drive. The type can be `vfat` if not windows formatted.
2. In the file `/etc/fstab` add the following `UUID=702432D524329DD2 /media/usb-drive ntfs defaults 0 0` REMEMBER TO USER YOUR OWN UUID and other type than ntfs if your drive is formatted non ntfs!

**Please be VERY CAREFUL to make sure everything is correct. This is why you should try mount manually first**

### Add drive to Proxmox
1. In datacenter view, select `Storage`
2. Click, "Add->Directory" set your settings and Save

![directory](img/proxmox/storage_create_directory.jpg)

Now you can use the drive as target disk making backups in proxmox!.

## Schedule backups
1. In datacenter view, select `Backup`
2. Add a backupscheme and select your new backupdisk

![backup](img/proxmox/add_backup.jpg)

## ZFS
I am using the system setup as NAS. 4 identical disks 2xstripe mirrored. This is at good alternative for speed and safety. Find other options for disk configurations online. I have on-line backup of my NAS this is why I dont use a "safer" configturation.

### Find the disks

`$ ls /dev/disk/by-id`

Copy the result and remove all lines with -partx. You will have the list of the unique id:s of the disks

### Create the zfs pool
First I make one mirrored with two disks.Then I make a second stripe mirrored disk. Remember to use your ID:s of the disks you got from result above. I also default use compression on the pool.

```
$ zpool create storage -m /mnt/storage mirror ata-WDC_WD40EFRX-68N32N0_WD-WCC7K0PN86VX ata-WDC_WD40EFRX-68N32N0_WD-WCC7K1TVP925
$ zpool add storage mirror ata-WDC_WD40EFRX-68N32N0_WD-WCC7K2ES2RH7 ata-WDC_WD40EFRX-68N32N0_WD-WCC7K6CZH2D3
$ zfs set compression=on storage
$ zpool status
```

status should be something like this.

```
  pool: storage
 state: ONLINE
  scan: none requested
config:

        NAME                                          STATE     READ WRITE CKSUM
        storage                                       ONLINE       0     0     0
          mirror-0                                    ONLINE       0     0     0
            ata-WDC_WD40EFRX-68N32N0_WD-WCC7K0PN86VX  ONLINE       0     0     0
            ata-WDC_WD40EFRX-68N32N0_WD-WCC7K1TVP925  ONLINE       0     0     0
          mirror-1                                    ONLINE       0     0     0
            ata-WDC_WD40EFRX-68N32N0_WD-WCC7K2ES2RH7  ONLINE       0     0     0
            ata-WDC_WD40EFRX-68N32N0_WD-WCC7K6CZH2D3  ONLINE       0     0     0
```

### Create more datasets

Use the zfs create command to create the datasets. Example:

`$ zfs create storage/media`

### Expose datasets trough LXC container turnkey.fileserver
I choose to expose smb/NFS through easy admin turnkey fileserver. Update and check available. Use the current version of fileserver, please check when running available command.

```
$ pveam update
$ pveam available
$ pveam download debian-9-turnkey-fileserver_15.0-1_amd64.tar.gz
```
#### Create LCX
Create LCX container with following properties:

---------------
| Property  |  Value  |
|----------|:-------------|
| Host | fileserver (or your name)  |
| Unpriveleged | Should be "unselected"  |
| Password | passwd (your pswd)  |
| template | Name of your turnkey image downloaded    |
| memory | 800 |
| IPv4 | Select static or DHCP and your settings     |

#### Bind ZFS datatset to LCX container
Edit the `/etc/pve/lxc/100.conf` file (the 100 should be replaced with the id of your container/VM)
Add the line:
`mp0: /mnt/storage/media,mp=/mnt/storage/media`

This will bind the /mnt/storage/media dataset to a mount inside the container with the same path.

#### Configure the container (fileserver)

Follow the instructions for first time use.
1. Login using SSH using the root and password provided when you created the container. Use putty or any favourite client
2. Install

From a browser, enter configuration using

https://ip_of_your_container:12321

Search turnkey fileserver for information about configure the smb/NFS stuff. I use `/mnt/storage/media` as smb for example since i bound the zfs dataset to it.

gha_language: Python


text:
# EverydayAtCoder

## Description

Visualize rating changes on [AtCoder](https://atcoder.jp/)'s virtual contests inspired by [Codeforces Anytime](https://codeforces-anytime.firebaseapp.com/).

***DEMO***

- Comming soon.

## Features

- Rating system using virtual contest result(s).

## Getting started

- Comming soon.

### Usage

- Comming soon.

## How to clone the repository

Paste the following commands at a Terminal prompt.

```terminal
$ mkdir hoge
$ cd hoge
$ git clone git@github.com:KATO-Hiro/EverydayAtCoder.git
```

### Set up [Firebase](https://firebase.google.com/) in local env

1. Sign into your Firebase account, and create a project for staging environment.

2. In the Firebase console, open your staging project, navigate to the "Service accounts" tab, and click "Generate new private key" to download your admin SDK keys.

Note: Your private key (in your service account key file) gives access to your project's Firebase services. Keep it confidential and never store it in a this repository.

3. Create .env files in frontend.

```terminal
cd frontend
$ touch .env
```

Open your editor, filling in your Firebase keys like below.

```
# .env
# == Firebase app keys (staging) ==
FIREBASE_API_KEY=■■■■■■■■-■■■■■■■■
FIREBASE_AUTH_DOMAIN=■■■■■■■■.firebaseapp.com
FIREBASE_DATABASE_URL=https://■■■■■■■■.firebaseio.com
FIREBASE_PROJECT_ID=■■■■■■■■
FIREBASE_STORAGE_BUCKET=■■■■■■■■.appspot.com
FIREBASE_MESSAGING_SENDER_ID=■■■■■■■■
FIREBASE_APP_ID=1:■■■■■■■■:web:■■■■■■■■
FIREBASE_MEASUREMENT_ID=G-■■■■■■■■
```

Note that .env* files are in the project's .gitignore, so they won't be checked into this repository.

Paste the following commands at a Terminal prompt.

```terminal
$ npm install

$ cd frontend
$ yarn firebase login
```

#### See

> https://github.com/benzguo/nextjs-now-firebase

### Debug in your local env

Paste the following commands at a Terminal prompt in your cloned directory.

```terminal
$ cd frontend
$ yarn dev
```

Open http://localhost:3000 in your browser.

## Requirement

- Docker Desktop 19+

### Backend

- Comming soon.

### Frontend

- Node.js 14.0.0
- [Next.js](https://nextjs.org/) 9.4.x
- [React](https://reactjs.org/) 16.13.x
- [TypeScript](https://www.typescriptlang.org/) 3.9.x

- [Firebase](https://firebase.google.com/)
  - Authentication

### Hosting

- [Vercel Now](https://vercel.com/)

### Optional

- [VS Code Remote Development](https://code.visualstudio.com/docs/remote/containers)

## Links

[AtCoder](https://atcoder.jp/)

[Readme Driven Development; RDD](https://qiita.com/b4b4r07/items/c80d53db9a0fd59086ec)

## Related projects

[Codeforces Anytime](https://codeforces-anytime.firebaseapp.com/): Visualize rating changes on Codeforces' virtual contests.

[AtCoder Charts](https://atcoder-charts.netlify.com/#/): Show a graph of AtCoder's rating and performance.

## Author

[@KATO-Hiro](https://twitter.com/k_hiro1818)

## License

[MIT](http://KATO-Hiro.mit-license.org)

repository: KATO-Hiro/EverydayAtCoder

repo_name: KATO-Hiro/EverydayAtCoder


text:
ELF
========

_work in progress_

Notes on RISC-V ELF mapping (unofficial).

## ELF Headers

The following is a list of ELF header fields and potential RISC-V mappings.

### e_ident[EI_DATA]

Enum | Name                        | RISC-V Description
:--- | :---                        | :---
0    | `ELFDATANONE`               |
1    | `ELFDATA2LSB`               | RISC-V little-endian
2    | `ELFDATA2MSB`               |

### e_ident[EI_VERSION]

Enum | Name
:--- | :---
1    | `EV_CURRENT`

### e_ident[EI_OSABI]

Enum | Name                        | RISC-V Description
:--- | :---                        | :---
0    | `ELFOSABI_SYSV`             | e.g. `riscv64-unknown-elf`
3    | `ELFOSABI_LINUX`            | e.g. `riscv64-linux-gnu`
9    | `ELFOSABI_FREEBSD`          | e.g. `riscv64-generic-freebsd`

_Note: Host triples are in the form:_ `machine-vendor-operatingsystem`

### e_ident[EI_ABIVERSION]

Enum | Name
:--- | :---
0    | `ELFABIVERSION_NONE`

### e_flags

Enum | Name                        | RISC-V Description
:--- | :---                        | :---
1    | `EF_RISCV_RVC`              | RVC Compression
2    | `EF_RISCV_FLOAT_ABI_SINGLE` | Single-precision float ABI
4    | `EF_RISCV_FLOAT_ABI_DOUBLE` | Double-precision float ABI
6    | `EF_RISCV_FLOAT_ABI_QUAD`   | Quad-precision float ABI
8    | `EF_RISCV_RVE`              |

### e_version

Enum | Name                        | RISC-V Description
:--- | :---                        | :---
1    | `EV_CURRENT`                | (same as `e_ident[EI_VERSION]`)

# Relocations

The following table provides details of the RISC-V ELF relocations:

Enum | ELF Reloc Type       | Description                         | Details
:--- | :------------------  | :---------------                    | :-----------
0    | R_RISCV_NONE         | None                                |
1    | R_RISCV_32           | Runtime relocation                  | word32 = S + A
2    | R_RISCV_64           | Runtime relocation                  | word64 = S + A
3    | R_RISCV_RELATIVE     | Runtime relocation                  | word32,64 = B + A
4    | R_RISCV_COPY         | Runtime relocation                  | must be in executable. not allowed in shared library
5    | R_RISCV_JUMP_SLOT    | Runtime relocation                  | word32,64 = S ;handled by PLT unless LD_BIND_NOW
6    | R_RISCV_TLS_DTPMOD32 | TLS relocation                      | word32 = S->TLSINDEX
7    | R_RISCV_TLS_DTPMOD64 | TLS relocation                      | word64 = S->TLSINDEX
8    | R_RISCV_TLS_DTPREL32 | TLS relocation                      | word32 = TLS + S + A - TLS_TP_OFFSET
9    | R_RISCV_TLS_DTPREL64 | TLS relocation                      | word64 = TLS + S + A - TLS_TP_OFFSET
10   | R_RISCV_TLS_TPREL32  | TLS relocation                      | word32 = TLS + S + A + S_TLS_OFFSET - TLS_DTV_OFFSET
11   | R_RISCV_TLS_TPREL64  | TLS relocation                      | word64 = TLS + S + A + S_TLS_OFFSET - TLS_DTV_OFFSET
16   | R_RISCV_BRANCH       | PC-relative branch offset           | SB-Type
17   | R_RISCV_JAL          | PC-relative jump offset             | UJ-Type
18   | R_RISCV_CALL         | PC-relative function call           | MACRO call,tail (auipc+jalr pair)
19   | R_RISCV_CALL_PLT     | PC-relative function call           | MACRO call,tail (auipc+jalr pair) PIC
20   | R_RISCV_GOT_HI20     | PC-relative GOT offset              | MACRO la
21   | R_RISCV_TLS_GOT_HI20 | PC-relative TLS IE GOT reference    | MACRO la.tls.ie %tls_ie_pcrel_hi(x)
22   | R_RISCV_TLS_GD_HI20  | PC-relative TLS GD GOT reference    | MACRO la.tls.gd %tls_gd_pcrel_hi(x)
23   | R_RISCV_PCREL_HI20   | PC-relative reference  (U-Type)     | %pcrel_hi(symbol)
24   | R_RISCV_PCREL_LO12_I | PC-relative reference (I-Type)      | %pcrel_lo(symbol)
25   | R_RISCV_PCREL_LO12_S | PC-relative reference (S-Type)      | %pcrel_lo(symbol)
26   | R_RISCV_HI20         | Absolute address (U-Type)           | %hi(symbol)
27   | R_RISCV_LO12_I       | Absolute address (I-Type)           | %lo(symbol)
28   | R_RISCV_LO12_S       | Absolute address (S-Type)           | %lo(symbol)
29   | R_RISCV_TPREL_HI20   | TLS LE thread offset (U-Type)       | %tprel_hi(symbol)
30   | R_RISCV_TPREL_LO12_I | TLS LE thread offset (I-Type)       | %tprel_lo(symbol)
31   | R_RISCV_TPREL_LO12_S | TLS LE thread offset (S-Type)       | %tprel_lo(symbol)
32   | R_RISCV_TPREL_ADD    | TLS LE thread usage                 | %tprel_add(symbol)
33   | R_RISCV_ADD8         | 8-bit label addition                | word8 = S + A
34   | R_RISCV_ADD16        | 16-bit label addition               | word16 = S + A
35   | R_RISCV_ADD32        | 32-bit label addition               | word32 = S + A
36   | R_RISCV_ADD64        | 64-bit label addition               | word64 = S + A
37   | R_RISCV_SUB8         | 8-bit label subtraction             | word8 = S - A
38   | R_RISCV_SUB16        | 16-bit label subtraction            | word16 = S - A
39   | R_RISCV_SUB32        | 32-bit label subtraction            | word32 = S - A
40   | R_RISCV_SUB64        | 64-bit label subtraction            | word64 = S - A
41   | R_RISCV_GNU_VTINHERIT| GNU C++ vtable hierarchy            |
42   | R_RISCV_GNU_VTENTRY  | GNU C++ vtable member usage         |
43   | R_RISCV_ALIGN        | Alignment statement                 |
44   | R_RISCV_RVC_BRANCH   | PC-relative branch offset (CB-Type) |
45   | R_RISCV_RVC_JUMP     | PC-relative jump offset (CJ-Type)   |
46   | R_RISCV_RVC_LUI      | Absolute address (CI-Type)          |
47   | R_RISCV_GPREL_I      | GP-relative reference (I-Type)      |
48   | R_RISCV_GPREL_S      | GP-relative reference (S-Type)      |
49   | R_RISCV_TPREL_I      | TP-relative TLS LE load (I-Type)    |
50   | R_RISCV_TPREL_S      | TP-relative TLS LE store (S-Type)   |
51   | R_RISCV_RELAX        | Instruction pair can be relaxed     | (auipc+jalr pair)
52   | R_RISCV_SUB6         | Local label subtraction             |
53   | R_RISCV_SET6         | Local label subtraction             |
54   | R_RISCV_SET8         | Local label subtraction             |
55   | R_RISCV_SET16        | Local label subtraction             |
56   | R_RISCV_SET32        | Local label subtraction             |

The following table provides details on the variables used in address calculation:

Variable       | Description
:------------- | :----------------
A              | Addend field in the relocation entry associated with the symbol
B              | Base address of a shared object loaded into memory
G              | Offset of the symbol into the GOT (Global Offset Table)
S              | Value of the symbol in the symbol table
GP             | Global Pointer register (x3)

While the linker can make relocations on arbitrary memory locations, many
relocations are designed for use with specific instructions or instruction
sequences. For clarity, the description of those relocations assumes they
are used in the intended context.

### Absolute Addresses

32-bit absolute addresses in position dependent code are loaded with a pair
of instructions which have an associated pair of relocations:
`R_RISCV_HI20` plus `R_RISCV_LO12_I` or `R_RISCV_LO12_S`.

The `R_RISCV_HI20` refers to an `LUI` instruction containing the high
20-bits to be relocated to an absolute symbol address. The `LUI` instruction
is followed by an I-Type instruction (add immediate or load) with an
`R_RISCV_LO12_I` relocation or an S-Type instruction (store) and an
`R_RISCV_LO12_S` relocation. The addresses for pair of relocations are
calculated like this:

 - `hi20 = ((symbol_address + 0x800) >> 12);`
 - `lo12 = symbol_address - hi20;`

### Global Offset Table

For position independent code in dynamically linked objects, each shared
object contains a GOT (Global Offset Table) which contains addresses of
global symbols (objects and functions) referred to by the dynamically
linked shared object.

...

### Program Linkage Table

The PLT (Program Linkage Table) exists to allow function calls between
dynamically linked shared objects. Each dynamic object has its own
GOT (Global Offset Table) and PLT (Program Linkage Table).

The first entry of a shared objects PLT is a special entry that calls
`_dl_runtime_resolve` to resolve the GOT offset for the called function.
The ``_dl_runtime_resolve` function in the dynamic loader resolves the
GOT offsets lazily on the first call to the function except when
`LD_BIND_NOW` is set in which case the GOT entries are populated by the
dynamic linker before the exutable is started. Lazy resolution of GOT
entries is intended to speed up program loading by deferring the symbol
resolution to the first time the function is called. The first entry in
the PLT which corresponds to an unpopulated GOT entry for the symbol is
a resolver stub entry which takes up 32 bytes (two 16 byte entries):

```
1:   auipc  t2, %pcrel_hi(.got.plt)
     sub    t1, t1, t3               # shifted .got.plt offset + hdr size + 12
     l[w|d] t3, %pcrel_lo(1b)(t2)    # _dl_runtime_resolve
     addi   t1, t1, -(hdr size + 12) # shifted .got.plt offset
     addi   t0, t2, %lo(.got.plt)    # &.got.plt
     srli   t1, t1, log2(16/PTRSIZE) # .got.plt offset
     l[w|d] t0, PTRSIZE(t0)          # link map
     jr     t3
```

Subsequent function entry stubs in the PLT take up 16 bytes and load
the function pointer from the GOT. On first call the GOT entry is zero
and the first PLT entry is called which calls `_dl_runtime_resolve`
and fills in the GOT entry for subsequent calls to the function:

```
1:  auipc   t3<EMAIL_ADDRESS>    l[w|d]  t3, %pcrel_lo(1b)(t3)
    jalr    t1, t3
    nop
```

### Procedure Calls

`R_RISCV_CALL` or `R_RISCV_CALL_PLT` and `R_RISCV_RELAX` relocations are
associated with pairs of instructions (`AUIPC+JALR`) generated by the `CALL`
or `TAIL` pseudo instructions.

In position dependent code (`-fno-pic`) the `AUIPC` instruction in the
`AUIPC+JALR` pair has both a `R_RISCV_CALL` relocation and a `R_RISCV_RELAX`
relocation indicating the instruction sequence can be relaxed during linking.

In position independent code (`-fPIC`, `-fpic` or `-fpie`) the `AUIPC`
instruction in the `AUIPC+JALR` pair has both a `R_RISCV_CALL_PLT` relocation
and a `R_RISCV_RELAX` relocation indicating the instruction sequence can be
relaxed during linking.

Procedure call linker relaxation allows the `AUIPC+JALR` pair to be relaxed
to the `JAL` instruction when the prodecure or PLT entry is within (-2MiB to
+2MiB-1) of the instruction pair.

### PC-Relative Jumps and Branches

Unconditional jump (UJ-Type) instructions have a `R_RISCV_JAL` relocation
that can represent an even signed 21-bit offset (-2MiB to +2MiB-1).

Branch (SB-Type) instructions have a `R_RISCV_BRANCH` relocation that
can represent an even signed 13-bit offset (-4096 to +4095).

### PC-Relative Symbol Addresses

32-bit PC-relative relocations for symbol addresses on sequences of
instructions such as the `AUIPC+ADDI` instruction pair expanded from
the `la` pseudo-instruction, in position independent code typically
have an associated pair of relocations: `R_RISCV_PCREL_HI20` plus
`R_RISCV_PCREL_LO12_I` or `R_RISCV_PCREL_LO12_S`.

The `R_RISCV_PCREL_HI20` relocation refers to an `AUIPC` instruction
containing the high 20-bits to be relocated to a symbol relative to the
program counter address of the `AUIPC` instruction. The `AUIPC`
instruction is followed by an I-Type instruction (add immediate or load)
with an `R_RISCV_PCREL_LO12_I` relocation or an S-Type instruction (store)
and an `R_RISCV_PCREL_LO12_S` relocation.

The `R_RISCV_PCREL_LO12_I` or `R_RISCV_PCREL_LO12_S` relocations contain
a label pointing to an instruction with a `R_RISCV_PCREL_HI20` relocation
entry that points to the target symbol:

 - At label: `R_RISCV_PCREL_HI20` relocation entry ⟶ symbol
 - `R_RISCV_PCREL_LO12_I` relocation entry ⟶ label

To get the symbol address to perform the calculation to fill the 12-bit
immediate on the add, load or store instruction the linker finds the
`R_RISCV_PCREL_HI20` relocation entry associated with the `AUIPC`
instruction. The addresses for pair of relocations are calculated like this:

 - `hi20 = ((symbol_address - hi20_reloc_offset + 0x800) >> 12);`
 - `lo12 = symbol_address - hi20_reloc_offset - hi20;`

The successive instruction has a signed 12-bit immediate so the value of the
preceding high 20-bit relocation may have 1 added to it.

Note the compiler emitted instructions for PC-relative symbol addresses are
not necessarily sequential or in pairs. There is a constraint is that the
instruction with the `RISCV_R_PCREL_LO12_I` or `RISCV_R_PCREL_LO12_S`
relocation label points to a valid HI20 PC-relative relocation pointing to
the symbol. e.g.

```
label:
   auipc t0, %pcrel_hi(sym)      # t0 := label + (sym - label + 0x800)[31:12]
   lui t1, 1
   lw t2, t0, %pcrel_lo(label)   # t0 := t0 + (sym - label)[11:0]
   add t2, t2, t1
   sw t2, t0, %pcrel_lo(label)   # t0 := t0 + (sym - label)[11:0]
```

## Thread Local Storage

RISC-V adopts the ELF Thread Local Storage Model in which ELF objects define
`.tbss` and `.tdata` sections and `PT_TLS` program headers that contain the
TLS "initialization images" for new threads. The `.tbss` and `.tdata` sections
are not referenced directly like regular segments, rather they are copied or
allocated to the thread local storage space of newly created threads.
See [https://www.akkadia.org/drepper/tls.pdf](https://www.akkadia.org/drepper/tls.pdf).

In The ELF Thread Local Storage Model, TLS offsets are used instead of pointers.
The ELF TLS sections are initialization images for the thread local variables of
each new thread. A TLS offset defines an offset into the dynamic thread vector
which is pointed to by the TCB (Thread Control Block) held in the `tp` register.

There are various thread local storage models for statically allocated or
dynamically allocated thread local storage. The following table lists the
thread local storage models:

Mnemonic | Model          | Compiler flags
:------- | :---------     | :-------------------
TLS LE   | Local Exec     | `-ftls-model=local-exec`
TLS IE   | Initial Exec   | `-ftls-model=initial-exec`
TLS LD   | Local Dynamic  | `-ftls-model=local-dynamic`
TLS GD   | Global Dynamic | `-ftls-model=global-dynamic`

The program linker in the case of static TLS or the dynamic linker in the case
of dynamic TLS allocate TLS offsets for storage of thread local variables.

### Local Exec

Local exec is a form of static thread local storage. This model is used
when static linking as the TLS offsets are resolved during program linking.

- Compiler flag `-ftls-model=local-exec`
- Variable attribute: `__thread int i __attribute__((tls_model("local-exec")));`

Example assembler load and store of a thread local variable `i` using the
`%tprel_hi`, `%tprel_add` and `%tprel_lo` assembler functions. The emitted
relocations are in comments.

```
  lui  a5,%tprel_hi(i)         # R_RISCV_TPREL_HI20
  add  a5,a5,tp,%tprel_add(i)  # R_RISCV_TPREL_ADD
  lw   t0,%tprel_lo(i)(a5)     # R_RISCV_TPREL_LO12_I
  addi t0,a0,1
  sw   t0,%tprel_lo(i)(a5)     # R_RISCV_TPREL_LO12_S
```

The `%tprel_add` assembler function does not return a value and is used purely
to associate the `R_RISCV_TPREL_ADD` relocation with the `add` instruction.

### Initial Exec

Initial exec is is a form of static thread local storage that can be used in
shared libraries that use thread local storage. TLS relocations are performed
at load time. `dlopen` calls to libraries that use thread local storage may fail
when using the initial exec thread local storage model as TLS offsets must all
be resolved at load time. This model uses the GOT to resolve TLS offsets.

- Compiler flag `-ftls-model=initial-exec`
- Variable attribute: `__thread int i __attribute__((tls_model("initial-exec")));`
- ELF flags: DF_STATIC_TLS

Example assembler load and store of a thread local variable `i` using the
`la.tls.ie` psuedo-instruction, with the emitted TLS relocations in comments:

```
  la.tls.ie a5,i    # auipc+{ld,lw}  R_RISCV_TLS_GOT_HI20, R_RISCV_PCREL_LO12_I
  add  a5,a5,tp
  lw   t0,0(a5)
  addi t0,a0,1
  sw   t0,0(a5)
```

### Global Dynamic

RISC-V local dynamic and global dynamic TLS models generate equivalent object code.
The Global dynamic thread local storage model is used for PIC Shared libraries and
handles the case where more than one library uses thread local variables, and
additionally allows libraries may be loaded and unloaded at runtime using `dlopen`.
In the global dynamic model, application code calls the dynamic linker function
`__tls_get_addr` to locate TLS offsets into the dynamic thread vector at runtime.

- Compiler flag `-ftls-model=global-dynamic`
- Variable attribute: `__thread int i __attribute__((tls_model("global-dynamic")));`

Example assembler load and store of a thread local variable `i` using the
`la.tls.gd` pseudo-instruction, with the emitted TLS relocations in comments:

```
  la.tls.gd a0,i    # auipc+addi  R_RISCV_TLS_GD_HI20,  R_RISCV_PCREL_LO12_I
  call  __tls_get_addr@plt
  mv   a5,a0
  lw   t0,0(a5)
  addi t0,a0,1
  sw   t0,0(a5)
```

In the Global Dynamic model, the runtime library provides the `__tls_get_addr` function:

```
extern void *__tls_get_addr (tls_index *ti);
```

where the type tls index are defined as:

```
typedef struct
{
  unsigned long int ti_module;
  unsigned long int ti_offset;
} tls_index;
```

## References

- TIS Portable Formats Specification, Version 1.1 ELF: Executable and Linkable Format
- ELF-64 Object File Format, Version 1.5 Draft 2
- System V Application Binary Interface AMD64 Architecture Processor Supplement Draft 0.99.6
- ELF Handling for Thread-Local Storage

repository: brucehoult/riscv-meta

repo_name: brucehoult/riscv-meta