text:
---
layout: post
title: "Make Delegated Methods Private in Rails"
date:  2019-02-07 18:00:00
categories:
  - ruby
  - rails
---

Recently,
I came across some of my old code
that uses Rails'
[`delegate` method](https://api.rubyonrails.org/classes/Module.html#method-i-delegate).
Take a look at the following example,
where I'm delegating a couple of methods
to an instance variable,
but want to make them private.

```ruby
class UserDecorator
  def initialize(user)
    @user = user
  end

  def full_name
    "#{first_name} #{last_name}"
  end

  private

  delegate :first_name, :last_name, to: :@user
end
```

My intention was to make the `first_name` and `last_name` methods private.
Only `full_name` was supposed to be public here.
Let's see if this works as intended.

```ruby
user = User.new(first_name: 'John', last_name: 'Doe')
decorated_user = UserDecorator.new(user)

decorated_user.full_name #=> John Doe
decorated_user.first_name #=> John
decorated_user.last_name #=> Doe

decorated_user.methods - Object.instance_methods
#=> [:full_name, :last_name, :first_name]
```

As you can see,
we can call both the delegated methods.
They were supposed to be private!
What happened here?

The problem is that
putting `delegate` under the `private` scope
has no effect.
**Methods in Ruby
have no way of knowing
that the `private` visibility scope is set
when they are called from within a class.**
`delegate` uses `module_eval` to define
new methods with these names,
but it doesn't know
that it must make these methods private.

So what do we do
if we wish to delegate a method
without making it a part of the class' public interface?
Let's dig into how `delegate` works.
In cases like this,
I like to use the
[pry console](https://github.com/pry/pry)
to interactively inspect the behavior of the class.

```ruby
pry> cd UserDecorator
# This pry command puts us within the scope of the UserDecorator class.

pry> delegate :first_name, :last_name, to: :@user
#=> [:first_name, :last_name]

pry> instance_methods
#=> [:full_name, :last_name, :first_name]

pry> private :first_name, :last_name

pry> instance_methods
#=> [:full_name]
```

`delegate` returns the list of the delegated method names.
We can call `private` with the method names
to make them private.
This means we can explicitly make the methods private like this:

```ruby
class UserDecorator
  # def initialize...

  delegate :first_name, :last_name, to: :@user
  private :first_name, :last_name
end
```

Now, how can we avoid duplicating the list of method names?
Since `delegate` returns the list of method names,
we can pass the list to `private`
using the splat operator.

```ruby
class UserDecorator
  # def initialize...

  private *delegate(:first_name, :last_name, to: :@user)
end
```

Although this prevents duplication,
I don't find this syntax particularly intuitive.
Luckily,
Rails 6 is introducing
a new `private: true` keyword argument
to give us a cleaner syntax.

```ruby
# Rails 6+
delegate :first_name, :last_name, to: :@user, private: true
```

However,
as I write this post,
Rails 6 isn't out yet.
If you're on Rails 5.2 or below,
you'll have to use
the `private *delegate(...)` syntax for now.

### Links

- Rails PR:
  [delegate to, with `private: true` option](https://github.com/rails/rails/pull/31944)

gha_language: HTML


text:
# B::enchmark [![Build Status](https://travis-ci.org/busyloop/b.png?branch=master)](https://travis-ci.org/busyloop/b) [![Gem Version](https://badge.fury.io/rb/b.svg)](https://badge.fury.io/rb/b)

A small, convenient benchmark-library.

## Features

* Displays relative performance; "B was 1.4x slower than A"

* Returns benchmark-results as Array of Hashes (for easy integration with your unit-tests or CI)

* Output can be customized with a simple Plugin-API (ships with plugins for TSV and HTML)

* High precision (via [hitimes](https://github.com/copiousfreetime/hitimes))

## Installation

`gem install b`

## Example

```ruby
#!/usr/bin/env ruby

require 'b'

B.enchmark('Sleep "performance"', :rounds => 10, :compare => :mean) do
  job '300ms' do
    sleep 0.3
  end

  job '100ms' do
    sleep 0.1
  end

  job '200ms' do
    sleep 0.2
  end
end
```

### Output:

```
-- Sleep "performance" ---------------------------------------------------------------
        rounds         r/s        mean         max         min    ± stddev      x mean
100ms       10        9.99      100.13      100.17      100.11        0.02        1.00
200ms       10        5.00      200.14      200.17      200.11        0.02        2.00
300ms       10        3.33      300.13      300.18      300.11        0.02        3.00
```

## Getting started

For advanced usage beyond the above example please look at the included demos:

1. Run `ruby -r b/demo -e0`
2. [demo.rb](https://github.com/busyloop/b/blob/master/lib/b/demo.rb)

## License (MIT)

Copyright (c) 2013<EMAIL_ADDRESS>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

license: MIT

repository: busyloop/b

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: busyloop/b


text:
# Change Log

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.0.3](https://github.com/sumcumo/vue-history/compare/v1.0.2...v1.0.3) (2019-05-09)

### Bug Fixes

* set correct reference to "types" in package.json ([598da76](https://github.com/sumcumo/vue-history/commit/598da76))

## [1.0.2](https://github.com/sumcumo/vue-history/compare/v1.0.1...v1.0.2) (2019-04-17)

* docs: add example link to README.md
* docs: update canonical name VueHistory -> Vue History

## [1.0.1](https://github.com/sumcumo/vue-history/compare/v1.0.0...v1.0.1) (2019-04-08)

### Bug Fixes

* do not send filtered events to feed ([0c67bd8](https://github.com/sumcumo/vue-history/commit/0c67bd8))
* lint spec files excluded by tsconfig ([75fca61](https://github.com/sumcumo/vue-history/commit/75fca61))

# 1.0.0 (2019-04-05)

repository: sumcumo/vue-history

gha_language: TypeScript

repo_name: sumcumo/vue-history


text:
# Streaming Tweets with AWS Kinesis

The code sample (in Python) demonstrates how you can deliver Tweets to S3 in [Amazon Web Services (AWS) S3](https://aws.amazon.com) using the [sampled stream endpoint](https://developer.twitter.com/en/docs/twitter-api/tweets/volume-streams/introduction) that is part of the new Twitter API.

## Demo Features

This code sample demonstrates:

- Use of the Twitter API v2
- Use of [AWS Kinesis Data Firehose delivery streams](https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html)

## How does it work

When you add the appropriate keys as your environment variables (steps shown in sections below) and run the `kinesis_demo.py` script, you will connect to the [sampled stream endpoint](https://developer.twitter.com/en/docs/twitter-api/tweets/volume-streams/introduction) in the new Twitter API, receive Tweets which you can deliver to S3 buckets using Amazon Kinesis Data Firehose delivery streams.

## Setting up a Twitter App

- You must have an approved developer account, and have activated the [new developer portal experience](https://developer.twitter.com/en/portal/opt-in.html). Access is available with active keys and tokens for a developer App that is attached to a [Project](https://developer.twitter.com/en/docs/projects.html) created in the [developer portal](https://developer.twitter.com/en/docs/developer-portal.html).
- A bearer token from your App in the [Twitter developer portal](https://developer.twitter.com/en/docs/developer-portal/overview).
- Copy the bearer token from your app as shown above and export it as an environment variable as shown below:

```sh
export 'bearer_token'='<your_bearer_token>'
```

Be sure to replace `<your_bearer_token>` with your own bearer token without the `< >`

## Obtaining your AWS keys

- In order to write the file with Tweets to AWS, you will need a valid [Amazon developer account](https://aws.amazon.com/free).
- You will need to sign in to your [AWS developer console](https://console.aws.amazon.com/) and obtain your AWS access key ID and secret access key. Copy these and set them as environment variables by running the following in a terminal:

```sh
export 'aws_access_key_id'='<your_aws_access_key_id>'
export 'aws_secret_access_key'='<your_aws_secret_access_key>'
```

Be sure to replace `<your_aws_access_key_id>` and `<your_aws_secret_access_key>` with your own credentials without the `< >`

- Remember to set the AWS region name as an environment variable by running:

```sh
export 'aws_region'='<your_aws_region>'
```

Be sure to replace `<your_aws_region>` with your own AWS region value without the `< >`

## Setting up an Amazon Kinesis Data Firehose delivery stream

- In order to create a Kinesis delivery stream, go to the [AWS developer console](https://console.aws.amazon.com) and click on 'Services' and select Kinesis.
- Next Click on Create delivery stream
- Give your delivery stream a name
- Under Choose a source, select the Direct PUT or other sources and click next
- Select the default values (disabled on this screen, unless you wish to convert record format, transform source records etc.) and click next
- Next, for 'Choose a destination', select 'Amazon S3'. Then, next to S3 bucket, click create new and create a new S3 bucket in which you want the Tweets to be sent to, and click next.
- Then, in the Configure settings window, under S3 buffer conditions, select the conditions on which you want the Tweets to be written to the S3 bucket. You can either choose the buffer size or interval for this.
- Finally, click next and on the next screen Review your configurations and click 'Create delivery stream'
- Make sure to add the name of this delivery stream to the [kinesis_demo.py](kniesis_demo.py) file.

## Running this script

- Download this project
- Make sure that you have added the correct Twitter bearer token and the AWS keys and region as environment variables, as shown in the steps above.
- Install dependencies specified in the [requirements.txt](https://github.com/twitterdev/twitter-aws-samples/blob/master/requirements.txt) file by running:

```sh
pip3 install -r requirements.txt
```

- Run the `kinesis_demo.py` file by running the following command in the terminal:

```sh
python3 kinesis_demo.py
```

repository: ZadeFrontier/AWS-twitter-samples

repo_name: ZadeFrontier/AWS-twitter-samples


text:
# SugarCube #
[SugarCube](http://www.motoslave.net/sugarcube/ "http://www.motoslave.net/sugarcube/") is a free (gratis and libre) story format for [Twine/Twee](http://twinery.org/ "http://twinery.org/").

By: @tmedwards.  Contributions by: @hogart and @klembot.

Downloads and documentation may be found at [SugarCube's website](http://www.motoslave.net/sugarcube/ "http://www.motoslave.net/sugarcube/").

## REQUIREMENTS ##

SugarCube's sole requirement is a modern web browser, and by *modern* I mean one released within the last several years (you do not need the absolute latest and greatest shiny).

**Caveat for Internet Explorer:** SugarCube only supports versions of IE ≥ 9.  Users of Windows XP (who are limited to IE8) will not be able to play/view stories built with SugarCube with their version of IE.  They would either have to use a different browser (e.g. Chrome or Firefox) or upgrade to a less obsolescent version of Windows (Microsoft ended public support for Windows XP in April, 2014).

## GETTING THE SOURCE ##

You may get SugarCube's source in one of two ways, by downloading a specific tagged release or by cloning the repository.  If you only wish to build the latest release in the v1 or v2 series, then the former option is probably easiest.  If you wish to hack on SugarCube at all, then the latter option is probably best.

### Downloading a specific tagged release ###

From the main repository's *Downloads* page, go to the *Tags* tab and download only the specific release you're interested in.

### Cloning the repository ###

This requires you to have the [Mercurial (`hg`)](http://mercurial.selenic.com/ "http://mercurial.selenic.com/") source control management tool installed (knowing how to use it also helps).  If you go this route, know that there are several active branches, so be sure to update your local clone to the branch you wish to work on by issuing the appropriate `hg update` command.  The current permanent branches are:

- `default`: The v2 development branch
- `v2-release`: The v2 release branch
- `v1-devel`: The v1 development branch
- `v1-release`: The v1 release branch

## BUILDING ##

If you want to build SugarCube from scratch, rather than grabbing one of the pre-built packages off of its website, then these instructions are for you.

SugarCube uses Node.js as the core of its build system, so the first thing you need to do is to install it if you don't already have it.

- [Node.js website: `http://nodejs.org/`](http://nodejs.org/ "http://nodejs.org/")

After downloading and installing a recent version of Node.js (≥ `v6`), change to the root of the `sugarcube` project directory.  You'll now need to download and install dependencies required by the build script, `build.js`, which you do by running the following command:

```
npm install
```

Dependencies will be installed to the root of the `sugarcube` project directory, nothing will be installed elsewhere on your computer.  Assuming that completes with no errors, run the following command to build the story format:

```
node build.js
```

If you're running this from a UNIX-style shell, simply running `build.js` should also work as it's shebanged.

If there were no errors, the story format, in both Twine 1 and Twine 2 flavors, will be output to the `dist` directory.  Congratulations!

**NOTE:** SugarCube's development dependencies are occasionally updated (last updated on: Feb 12, 2017).  If you receive errors when attempting to build, then you probably need to update your cached dependencies.  You may do this via the `npm update` command or, in extreme cases, by deleting the local `node_modules` directory and rerunning `npm install`.

----

If you'd like additional options when building (debug builds, limiting the build to a particular version of Twine, etc.), you may request help from `build.js` by running the following command:

```
node build.js -h
```


text:
# learn-laravel-2020
I am learning Laravel, and will be using this project to experiment.

I will be using composer to install Laravel with the following command:
composer create-project laravel/laravel learn-laravel-2020

I will be using laravel ui for the front-end with bootstrap:
composer require laravel/ui
bootstrap: php artisan ui bootstrap --auth
note: Since I will be taking advantage of the auth option, I will be installing bootstrap with the command above.
Now to install the bootstrap package and the related front-end dependencies, we will run the following:
npm install
Once that is complete, we need to run the command:
npm run dev
If we make any changes to any of these files, we will need to run npm run dev again.

branch_name: refs/heads/main


text:
---
templateKey: blog-post
tags: ['python', 'kedro', 'data']
title: Minimal Kedro Pipeline
date: 2021-01-20T00:00:00
status: published

---

How small can a minimum kedro pipeline ready to package be?  I made one within 4 files that you can pip install.  It's only a total of 35 lines of python, 8 in `setup.py` and 27 in `mini_kedro_pipeline.py`.

# Minimal Kedro Pipeline

I have everything for this post hosted in this [gihub repo](https://github.com/WaylonWalker/mini-kedro-pipeline), you can fork it, clone it, or just follow along.

## Installation

``` bash
pip install git+https://github.com/WaylonWalker/mini-kedro-pipeline
```

## Caveats

This repo represents the minimal amount of structure to build a kedro pipeline that can be shared across projects.  Its installable, and drops right into your `hooks.py` or `run.py` modules.  It is not a runnable pipeline.  At this point
I think the config loader requires to have a logging config file.

This is a sharable pipeline that can be used across many different projects.

## Usage

``` python
# hooks.py

import mini_kedro_project as mkp

class ProjectHooks:
    @hook_impl
    def register_pipelines(self) -> Dict[str, Pipeline]:
        """Register the project's pipeline.

        Returns:
            A mapping from a pipeline name to a ``Pipeline`` object.

        """

        return {"__default__": Pipeline([]), "mkp": mkp.pipeline}
```

## Implemantation

This builds on another post that I made about creating the minimal python package.  I am not sure if it should be called a package, it's a module, but what do you call it after you build it and host it on pypi?

https://waylonwalker.com/minimal-python-package/

## Directory structure

``` bash
.
├── .gitignore
├── README.md
├── setup.py
└── my_pipeline.py
```

## setup.py

This is a very minimal `setup.py`.  This is enough to get you started with a package that you can share across your team.  In practice, there is a bit more that you might want to include as your project grows.

``` python
from setuptools import setup

setup(
    name="MiniKedroPipeline",
    version="0.1.0",
    py_modules=["mini_kedro_pipeline"],
    install_requires=["kedro"],
)
```

## mini_kedro_pipeline.py

The mini kedro pipeline looks like any set of nodes in your project.  Many projects will separate nodes and functions, I prefer to keep them close together.  The default recommendation is also to have a `create_pipelines` function that returns the pipeline.

This pattern creates a singleton, if you were to reference the same pipeline in multiple places within the same running interpreter and modify the one you would run into issues.  I don't foresee myself running into this issue, but maybe as more features become available I will change my mind.

``` python
"""
An example of a minimal kedro pipeline project
"""
from kedro.pipeline import Pipeline, node

__version__ = "0.1.0"
__author__ = "Waylon S. Walker"

nodes = []

def create_data():
    "creates a dictionary of sample data"
    return {"beans": range(10)}

nodes.append(node(create_data, None, "raw_data", name="create_raw_data"))

def mult_data(data):
    "multiplies each record of each item by 100"
    return {item: [i * 100 for i in data[item]] for item in data}

nodes.append(node(mult_data, "raw_data", "mult_data", name="create_mult_data"))

pipeline = Pipeline(nodes)
```

## Share your pipelines

Go forth and share your pipelines across projects.  Let me know, do you share pipelines or catalogs across projects?

gha_license_id: MIT


text:
calfin
======

*calfin* is the proposal of an accounting system for personal use which is entirely based on a calendar.

Design goals
------------
* It's not about professional bookkeeping, sloppy use is allowed
* The protocol is defined independently from the software to allow various implementations
* It can manage multiple accounts (like bank account, credit card and cash)
* The system only knows about accounts and transactions. Every transaction is connected to a point in time and thus can be stored as a calendar event
* Good support of recurring events
* The protocol is an extension to the popular iCalendar format. This comes with various benefits
  * We get a mature definition and implementation of recurring events
  * We get a ready synchronization protocol, CalDAV, which is based on WebDav
  * We get third-party libraries for the two things mentioned above, which saves us huge complexity

Open Questions
--------------
* How to store finance-specific data
  * JSON formatted in the description of calendar events, which would be more compatible with existing sync servers
  * In custom ``X-CALFIN-`` prefixed fields of the iCalendar events, which would be a more tidy

repository: raphaelm/calfin

repo_name: raphaelm/calfin


text:
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
<!-- A clear and concise description of what the bug is. -->

**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->

**Logs**
<!-- Create a [GIST](https://gist.github.com) which is a paste of your _full_ Liman logs, and link them here.
Do _NOT_ paste your full Liman logs here, as it will make this issue very long and hard to read! -->

**Your environment**
<!-- * version of liman
* version of docker
* which os and its version -->

**Additional context**
<!-- Add any other context about the problem here. -->

repository: lukaspj/liman

repo_name: lukaspj/liman


text:
---
layout: post
title: "C++ exception handling"
excerpt: ""
categories: cpp
tags: [C++]
comments: true
share: true
author: chungyu
---

> Code and text copied/summarized from C++ How to program 9 ed by Paul Deitel, Harvey Deitel

# Basics

* The fundamental idea is to separate **detection** of an error (which should be done in a called function) from the **handling** of an error (which should be done in the calling function) while **ensuring that a detected error cannot be ignored**

* The basic idea is that if a function finds an error that it cannot handle, it does not **return** normally; instead, it **throws** an exception indicating what went wrong. Any direct or indirect caller can **catch** the exception.

* `error()` is supposed to terminate the program after getting its message written.

* A typical exception class that derives from the runtime_error class **defines only a constructor** that passes an error-message string to the base-class runtime_error constructor.

* Exceptions may surface through explicitly mentioned code in a try block,
  through calls to other functions and through deeply nested function calls
  initiated by code in a try block.
* An exception parameter should always be declared as **a reference to the type of `exception`** the catch handler can process
  * prevents copying the exception object when it’s caught
  * allows a catch handler to properly catch derived-class exceptions.
* The operand of a `throw` can be of any type (but it must be copy constructable)
  * `throw x > 5`, `throw 5` is valid!
* Exception handling is not designed to process errors associated with asynchronous events

```cpp
// DivideByZeroException.h
#include <stdexcept> // stdexcept header contains runtime_error

class DivideByZeroException : public std::runtime_error {
public:
   // constructor specifies default error message
   DivideByZeroException()
      : std::runtime_error("attempted to divide by zero") {}
};
```

# Stack unwinding
Unwinding the function call stack means that the function in which the exception was not caught terminates, all local variables that have completed intitialization in that function are destroyed and control returns to the statement that originally invoked that function. If a try block encloses that statement, an attempt is made to catch the exception. If a try block does not enclose that statement, stack unwinding occurs again.

# Rethrowing
 An exception handler, upon receiving an exception, can release the resource then notify its caller than an exception occurred by rethrowing the exception via the statement `throw;`

```cpp
try
{
   cout << "  Function throwException throws an exception\n";
   throw exception(); // generate exception
} // end try
catch ( exception & ) // handle exception
{
   cout << "  Exception handled in function throwException"
      << "\n  Function throwException rethrows exception";
   throw; // rethrow exception for further processing
} // end catch
```

# Exceptions and inheritance
* If a catch handler catches a reference to an exception object of a base-class type, it also can catch a reference to all objects of classes publicly derived from that base class
* catch pointers or references to **base-class** exception objects
* catching pointers or references to de- rived-class exception objects individually is error prone

# [c++11] `noexcept`
* if a function does not throw any exceptions and does not call any functions that throw exceptions, you should explicitly state that.
  * add `noexcept` to the right of the function’s parameter list in both the prototype and the definition.
  * For a const member function, place `noexcept` after `const`.
* If a function that’s declared noexcept calls another function that throws an exception or executes a throw statement, the program terminates.

# Constructor, destructor
* Before an exception is thrown by a constructor, destructors are called for any member objects whose constructors have run to completion as part of the object being constructed.
* When an exception is thrown from the constructor for an object that’s created in a new expression, the dynamically allocated memory for that object is released.

# Potential resource leak
* An exception could preclude the operation of code that would normally release a resource (such as memory or a file), thus causing a resource leak that prevents other programs from acquiring the resource.
* initialize a local object to acquire the resource. When an exception occurs, the destructor for that object will be invoked and can free the resource.

# Handling `new` Failures Using Function set_new_handler

```cpp
#include <iostream>
#include <new> // set_new_handler function prototype
#include <cstdlib> // abort function prototype
using namespace std;

// handle memory allocation failure
void customNewHandler()
{
   cerr << "customNewHandler was called";
   abort();
} // end function customNewHandler

// using set_new_handler to handle failed memory allocation
int main()
{
   double *ptr[ 50 ];

   // specify that customNewHandler should be called on
   // memory allocation failure
   set_new_handler( customNewHandler );

   // aim each ptr[i] at a big block of memory; customNewHandler will be
   // called on failed memory allocation
   for ( int i = 0; i < 50; ++i )
   {
      ptr[ i ] = new double[ 50000000 ]; // may throw exception
      cout << "ptr[" << i << "] points to 50,000,000 new doubles\n";
   } // end for
}  // end main
```

# [c++11] `unique_ptr`
* If an exception occurs after successful memory allocation but before the delete statement executes, a memory leak could occur.
* Class template `unique_pt`r provides overloaded operators `*` and `->` so that a `unique_ptr` object can be used just as a regular pointer variable is.
* The class is called unique_ptr because only one unique_ptr at a time can own a dynami- cally allocated object. By using its overloaded assignment operator or copy constructor, a unique_ptr can transfer ownership of the dynamic memory it manages.

```cpp
// Demonstrating unique_ptr.
#include <iostream>
#include <memory> // for unique_ptr
#include "Integer.h"
using namespace std;

// use unique_ptr to manipulate Integer object
int main()
{
   cout << "Creating a unique_ptr object that points to an Integer\n";

   // "aim" unique_ptr at Integer object
   unique_ptr< Integer > ptrToInteger( new Integer( 7 ) );

   cout << "\nUsing the unique_ptr to manipulate the Integer\n";
   ptrToInteger->setInteger( 99 ); // use unique_ptr to set Integer value

   // use unique_ptr to get Integer value
   cout << "Integer after setInteger: " << ( *ptrToInteger ).getInteger()
      << "\n\nTerminating program" << endl;
}  // end main

```

# Standard Library Exception Hierarchy
![stdexcept]({{site.url}}/images/cpp/stdexcept.png)
* The standard exception hierarchy is a good starting point for creating exceptions. You can build programs that can throw standard exceptions, throw exceptions derived from the standard exceptions or throw your own exceptions not derived from the standard exceptions.


text:
# talk-plugin-pride
Pride Reaction for Comments

## Installation
Add `talk-plugin-pride` to the `plugins.json` on both `server` and `client`.

## Configuration
No configuration needed

## How does this work?
This reaction uses Talk friendly API to add a new reaction for the comments. Similar to `talk-plugin-like`, `talk-plugin-respect`. Feel free to check the code and if you have any feedback, please let us know.

Enjoy! 🌈

## License

talk-plugin-pride is released under the [Apache License, v2.0](/LICENSE).

repository: coralproject/talk-plugin-pride

repo_name: coralproject/talk-plugin-pride


text:
![alt text](./assets/yarn_banner.png)

## Yarn official website

## Installing Yarn

### Intall npm package manager

#### You get npm by installing Node.js

##### Install Node.js accessing the following link:

##### In terminal, check the Node.js and npm version to verify if they were installed correctly:

~~~Bash
$ node -v
~~~

~~~Bash
$ npm -v
~~~

* If the terminal doesn't returned any error, the installation was successfully.

### Now install Yarn using the following command:

~~~Bash
$ npm install --global yarn
~~~

#### In terminal, check the yarn version to verify if it was installed correctly:

~~~Bash
$ yarn --version
~~~

* If the terminal doesn't returned any error, the installation was successfully.

## Getting started

### To add Yarn to a project, go to the project folder and run the following command:

~~~Bash
$ yarn init
~~~

#### Answer the following questions:

~~~Bash
question name ():
question version (1.0.0):
question description:
question entry point (index.js):
question repository url:
question author:
question license (MIT):
question private:
~~~

#### If Yarn was successfully added to the project, it'll return the following message:

~~~Bash
success Saved package.json
~~~

#### A configuration file called package.json was created at the project root. This file is responsible for storage Yarn general configurations.

## Managing dependencies

### You can search for dependencies in the following website:

#### [Check for dependencies](https://classic.yarnpkg.com/en/packages)

### You can add a dependency using the following commands:

~~~Bash
$ yarn add [package]
$ yarn add [package]@[version]
$ yarn add [package]@[tag]
~~~

### You can add dependencies to different categories of dependencies using the following commands:

~~~Bash
$ yarn add [package] --dev
$ yarn add [package] --peer
$ yarn add [package] --optional
~~~

### You can upgrade a dependency using the following commands:

~~~Bash
$ yarn upgrade [package]
$ yarn upgrade [package]@[version]
$ yarn upgrade [package]@[tag]
~~~

### You can remove a dependency using the following command:

~~~Bash
$ yarn remove [package]
~~~

### You can install all dependencies of a project using the following commands:

~~~Bash
$ yarn
~~~
or
~~~Bash
$ yarn install
~~~

### All dependencies will be installed in a folder called node_modules, at the project root. They will be ready to be used.


text:
## Auth-oath

Auth-oath is a simple server/client architecture that validates TOPT pins based on a database.

It is using `oath-toolkit` which is widely available on linux/osx.

### Features:

  - Plug and play for OpenVPN
  - Retain succesful pin for 1 day so you can save it locally
  - Easy database JSON format
  - client/server through unix socket
  - Totp 30 sec/sha512/8 digits
  - Keys in base32

### Examples:

Example database:

```
[
  { "user": "blih",
    "key": "5YVZEIH5DNSA7SYPZ5KA===="
  }
]
```

To start the server -- `root`:

```
./auth-oathd -config ./config.json -socket /tmp/blih.sock
```

Authorize clients -- `openvpn`:

```
username=blih password=12345678 ./auth-oath -socket /tmp/blih.sock
```

Then copy this into your totp software and select 8 digits/sha512.

### Help:

Auth-oathd:

```
Usage of ./auth-oathd:
  -config string
    	Path to the user json file
  -group string
    	Set group name on the socket file
  -socket string
    	Path to the socket file
  -user string
    	Set user name on the socket file
```

Auth-oath:

```
Usage of ./auth-oath:
  -socket string
    	Path to the socket file
```

### Todo:

server:
- CRUD user endpoint
- remove base32

client:
- CRUD user API
- qrencode display

### Future:

If this project is useful for people I will make the following features available:

  - Add hashed password for users so it is `password | pin`
  - Set expiration time per user
  - Native TOTP
  - Add CLI to manage database
  - Reload database
  - add --daemon flag
  - add --log flag
  - encrypt client/server for extra security

repository: tehmoon/auth-oath

gha_language: Go

repo_name: tehmoon/auth-oath


text:
# Reactive Foundation

## Tentitive Agenda

Date: July 30, 2020

Location: Virtual Zoom

1. Call to Order
    1. Approval of the Agenda
    1. Approval of [Minutes from June 25, 2020](https://github.com/reactivefoundation/foundation/blob/master/meetings/2020-06-25/minutes.md)
1. Reports
    1. GM Report ( Alexy )
    1. Treasurer's Report ( Vaughn )
    1. TOC Report ( Ryland )
    1. Marketing Commitee Report ( Kathleen )
1. Old Business
    1. Allowing Twitter to join under old payment schedule provided payment is recieved in 30 days (Note: This offer has expired.)
    1. Monthly operating budget (for tools eg. GSuite )
1. New Business
    1. Reactive Summit CFP [Form](https://forms.gle/fMUL2A1cA962PgyVA) Closes Aug 15th
        1. How to Evaluate Entries?
        1. Reactive Summit Marketing
            1. How to expose this?
    1. Recruiting Potential Members
    1. Advisory Council
    1. Confirm the new charter as presented by the Linux Foundation [Charter](https://docs.google.com/document/d/1OvIdmkdLcz38eLq89dwuByzIi19WGMEH-cwo2c_zy6s/edit?ts=5ef3a3c1#)
    1. Deadline of August 31st to get the new agreements signed (Todd Benzies - Linux Foundation)
    1. Discussion on the Foundation Road Map
1. Comments and Announcements
1. Adjournment

### Next Meeting
August 27th, 2020

repository: reactivefoundation/foundation

repo_name: reactivefoundation/foundation


text:
# Dynamic-Trees [![](http://cf.way2muchnoise.eu/full_dynamictrees_downloads.svg)](https://minecraft.curseforge.com/projects/dynamictrees/)

Minecraft Forge mod providing dynamic trees that progressively grow from seed to maturity.

![Logo](./header.png)

This branch is for the 1.12.2 version of Minecraft.

### Links
- [Downloads](https://minecraft.curseforge.com/projects/dynamictrees/files)

### Compiling
* Clone the repository
* Open a command prompt/terminal to the repository directory
* run 'gradlew build'
* The built jar file will be in build/libs/

repository: Alatyami/DynamicTrees

gha_language: Java

repo_name: Alatyami/DynamicTrees


text:
# TheBankster

TheBankster is a personal fincance monitoring tool, aimed to give you an overview over your various accounts and what you're spending your money on.

The principle is simple:

* you set up all your bank accounts
* you create categories for your income and spending habits
* you define rules how transactions should be categorized
* you gain invaluable insights (aka. pretty graphs) about yourself and your finances

![Screenshot](screenshot.png)

## Installation and Setup

**DO NOT INSTALL THIS ON A SERVER ON THE INTERNET!** Seriously. This is meant to be used as a personal tool. There is absolutely no concept of user accounts, logins or any other safety stuff. Put this on a Raspberry at your home, but do **not** make it available from the Internet. You have been warned.

The tool requires PHP 7+ with the PDO and PDO SQLite extensions.

To install simply clone this repository and run [composer](https://getcomposer.org/) in the main directory. Point your Apache webserver to the `public` directory and you're ready to go. (If you're not using Apache you might need to fiddle with the [URL rewriting](https://www.slimframework.com/docs/start/web-servers.html), I don't know).

### Accounts

Use the webinterface to set up your bank accounts. There are currenly 4 backends supported:

**FinTS** - The HBCI/FinTS banking standard common in Germany (and Europe). Most major banks support this. Try [this site](https://www.hbci-zka.de/institute/institut_select.php) for figuring out if your bank does.

**Paypal** - You need to create an [API access user](https://www.paypal.com/de/cgi-bin/webscr?cmd=_profile-api-add-direct-access-show) at Paypal to fetch your transactions. Be sure to create a rule to skip bank statements of money moving to or from paypal to avoid double tracking.

**GoogleSheets** - This allows you to import expenses from a [Google Sheets](https://docs.google.com/spreadsheets/) spreadsheet. The sheet has to be made readable for everyone with the link. Check out [TheCashster](https://github.com/splitbrain/TheCashster) for an Android Expense tracker working with Google Sheets.

**TargoBank** - My credit card's bank does not support FinTS so I wrote this backend to fetch the data from their online banking site. This is the most hacky backend but might give you an idea how to add your own backend. It can only download transactions of the current month.

**AmazonMail** - This is another weird one. Because Amazon has no proper API, but I buy a lot of stuff from them. This logs into an IMAP mail account and looks for order confirmation and confirmed refund emails from Amazon. This information is then used to create transactions based on your Amazon purchases. When using this, you should create a rule to skip Amazon transactions in your bank account to avoid tracking spendings twice (assign to category `-/-`).

 Please note: this currently only supports Amazon.de with E-Mails in German. Please also note: I do not handle things you buy with vouchers, eg. the transaction will use the full item price. See it that way: if Grandma had given you cash instead of a voucher you'd want to track what you buy for as an expense, too. But maybe manually add received vouchers as income somewhere?

.

If you add your own backend, feel free to send a pull request.

A note about security: the credentials you provide are stored in plain text in the sqlite data base. You have to ensure you keep your installation safe and out of reach of prying eyes. Again: do not install this on a public server.

### Importing

Once your accounts are set up, it's time to import the transactions. To do so simply run the import script:

    ./bin/import.php --loglevel debug

This will start to import all transactions for the current year. Follow up calls will try to only download transactions since the last run (if your backend supports it). Don't worry, TheBankster will ignore duplicate transactions.

The above command uses the `--loglevel` argument for full verbosity. Once you're confident everything is working fine, you can use a different level.

To be useful, transactions need to be imported on a regular basis. To do so a cron job running the import once or twice a day is recommended.

### Categories

While your transactions are importing, it's time to think about categories. Categories tell you where your money goes.

Categories have two levels: a top level and the category itself. All categories with the same top level will be grouped together in the `Charts` view. Because trees in relational databases are complicated and I was really lazy, this hierarchy is implemented in the most simple, lazy way possible: You have to type the same top level for the various categories. No dropdown, no autocomplete, no nothing. Just remember the name and type it. Sorry.

Note: After setup there will be one special category name `-/-` already. This category is used to ignore certain transactions that do not influence your overall financial status. Eg. transferring money from one of your accounts to another, currency conversions on Paypal, etc.

### Rules

Once accounts are set up, categories created and transactions imported it's time to categorize the latter. You can of course manually assign a category (see below) but for all reoccuring transactions it's more sensible to define rules.

A rule tells TheBankster that when a transaction matches the rule, the associated category shall be assigned. Rules match the following things against the transaction details:

* account - only aply this rule to transactions of a single account
* spending/income - only match one of these (both is default)
* description - find the given string in the description
* issuer name - find the given string in the issuer's name
* issuer bank - find the given string in the issuer's bank
* issuer account - find the given string in the issuer's account

When saving a rule TheBankster will give you a preview of matching transactions. Once you're satisfied, activate it and all matching transactions will be associated with the category.

In general you should try to make your rules as specific as possible, to avoid haveing multiple rules matching the same transaction (behaviour is undefined then - one rule will "win").

Rules will automatically be applied to every new transaction when the import runs.

## Usage

It's not rocket science, you will probably figure it out yourself. But here are a few hints.

### Charts

The Charts feature gives you bar charts on your categories as well as recent transactions for those. Important thing to know: **the charts are clickable!**

Click the legend items to dig down deeper into the category levels. When you click a bar instead, the selected month will be applied to the shown transactions. This way you can easily figure out what exactly you spent your money on in a certain month.

Hint: keep an eye on the sum line on the top level chart. It should stay above zero as much as possible. If it's going below zero too often, you might be living beyond your means.

### Uncategorized

This view should help you with setting up more rules. It shows all transactions that have not category, yet. You should try to reduce this number as much as possible.

You can easily create a new rule from any transaction by clicking the `*` symbol. It will prefill a new rule form with the transaction details. You should shorten it down to the relevant bits before saving.

You can also manually assign a category to a transaction using the `↻` symbol. A little popup will ask you for the category and you can continue.

Note: because I'm lazy, the new manually assigned category will only show up after a page reload. Sorry. Maybe send a pull request if you think it's important.

### Amazon.de Support

Okay, so I mentioned that I buy a lot of my stuff at Amazon. So next to the weird IMAP based backend, TheBankster also automatically links Amazon order numbers to their respective order overview at Amazon.de. Watch out for the `🔍` symbol in the transaction description.

Yes, Amazon.de only. Because I can't really test anything else. Pull Request?

## Miscellaneous

### Currency Support

TheBankster assumes that all your accounts are using the same currency. That currency is set in the `config.yaml` and defaults to `EUR`.

This doesn't really matter for most of the things that TheBankster does. It only deals in amounts and does not display currencies anywhere.

The one exception is the Paypal backend. Paypal manages different currencies separately until you withdraw money to your account. Because we're not interested in the currency conversion transaction but the actual spending an income transactions, the Paypal backend will convert all non-main-currency transactions to an approximation in the main currency. In real life this means it converts USD to EUR.

This is not exact, and the exchange rate will differ from what Paypal uses. But it should be good enough for the purposes of this application.

If you need different currencies you need to add their exchange rates in the `CurrencyConvert` class.

### Other stuff

* I wrote this to scratch my own itch, don't expect a lot of support
* I'm happy about pull requests
* Did I mention that this is not supposed to be exposed to the Internet? Yes. Yes, I did
* TheBankster is meant for your own personal finance overview only. It might work for a couple with shared finances, too.
* TheBankster gives you information about how your income and spending is distributed. It does not tell you your actual balance on any of your accounts. That's kinda by design. It would also be really hard to do.
* Even if you don't use this, check out the cool libraries I used in the `composer.json` file, you might find a gem you didn't know. (If you're into PHP that is)
* There are a few more command line tools in the `bin` directory. I used them during development before the web interface existed. Call them with `--help` to see what they do. But the web interface is probably better now.

### License (MIT)

Copyright 2017 [Andreas Gohr](https://www.splitbrain.org)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

repository: splitbrain/TheBankster

gha_language: PHP

repo_name: splitbrain/TheBankster


text:
# Lightspinner

_Learn radiative transfer like it's 1992!_

It is, in essence, a stripped down version of [Lightweaver](https://github.com/Goobley/Lightweaver) with the aim of teaching the methods used in optically thick RT and making them more accessible.

It uses the full preconditioning method of Rybicki & Hummer (1992) with the ability to handle overlapping transitions, but under the assumption of complete redistribution.
The formal solver is currently using simple piecewise linear short characteristics due to its simplicity and the pedagogic benefits thereof.

The slides for the associated talk are in the Slides directory.

In the file `response_fn.py` there is a simple example of computing the NLTE response function for CaII 8542, admittedly in a very crude and slow way (it will take multiple minutes to run). I recommend just running the synthesis in `example.py` first for familiarity with the code.

### DIY

If you want to have a go at implementing the MALI method, then the `formal_sol_gamma_matrices` and `uv` functions in `rh_method.py` have been left documented but not complete on the `DIY` branch. It would also be an interesting exercise to extend the formal solver to use the monotonic piecewise parabolic method of Auer & Paletou (1994).

### Setup

Requires python 3.7+.
For those that use `conda` the `environment.yml` can be used to create a Lightspinner environment complete with all necessary packages with `conda env create -f environment.yml`.
This can then be activated with `conda activate Lightspinner`.
This environment should then be ready for action and you should be able to easily produce the spectrum of Ca II in a FALC atmosphere with `ipython -i test.py`. It should look like this:

![Spectrum of CaII](CaII.png)

### References

##### Everything
- [HM] Hubeny, Ivan & Mihalas, Dimitri (2015). _Theory of Stellar Atmospheres: An Introduction to Astrophysical Non-equilibrium Quantitive Spectroscopic Analysis_. Princeton University Press. ISBN:<PHONE_NUMBER>291.

##### MALI Methods
- [[RH91] Rybicki, G. B.; Hummer D. G. (1991). A&A, **245**, 171-181](https://ui.adsabs.harvard.edu/abs/1991A%26A...245..171R)
- [[RH92] Rybicki, G. B.; Hummer D. G. (1992). A&A, **262**, 209-215](https://ui.adsabs.harvard.edu/abs/1992A%26A...262..209R)
- [[U01] Uitenbroek, H. (2001). ApJ, **557**, 389-398](https://ui.adsabs.harvard.edu/abs/2001ApJ...557..389U)

##### Short Characteristic Formal Solvers
- [Kunasz, P.; Auer L. H. (1988). JQSRT, **39**, 67-79](https://ui.adsabs.harvard.edu/abs/1988JQSRT..39...67K)
- [Auer, L. H.; Paletou F. (1994). A&A, **285**, 675-686](https://ui.adsabs.harvard.edu/abs/1994A%26A...285..675A)

### Acknowledgements
- The [python implementation](https://github.com/jaimedelacruz/witt) of the Wittmann equation of state kindly provided J. de la Cruz Rodriguez.
- Many methods are inspired by approaches taken in the [RH](https://github.com/ITA-Solar/rh) code by H. Uitenbroek [U01] (linked version is the 1.5D version described in [Pereira & Uitenbroek (2015)](https://ui.adsabs.harvard.edu/abs/2015A%26A...574A...3P))
- Many thanks to Ivan Milić for all his help getting this stuff into my head!

repository: Goobley/Lightspinner

repo_name: Goobley/Lightspinner


text:
# Heat Your System

This is a Python Script which heats upon your Computer/Laptop by running up all the CPU Cores. This is a potentially malicious script
as it might drain all of the system charge in quick time. The user must restrain caution while executing the code.

![image](https://github.com/HarshCasper/Rotten-Scripts/blob/master/Heat-Your-System/carbon.png)


text:
---
title: Lift Expectations
author: Becky Bayliss
type: Post
date: 2020-07-18
description: Dear Schindler, -1,0,3,4,9? ‘Er'‘Er'?! I'm no expert in lift design, but I usually know how to use one.
hero: "./hero.png"
tags: ['UX', "real world"]
---

I moved into a block of flats last year, and until very recently, the lift (elevator if you're American) was broken. The building is 4 floors and a basement, -1, 0, 1, 2, 3. So you can imagine my reaction and the many questions I had when I used the lift for the first time.

    "How do I use this?"

 "Why a 0-9 keypad? There are only 5 different floors."

 "Why capacitive buttons? – will it work when I have cold hands or gloves?"

 "Why '.'?"

 "What happens if you press 9?"

 "Is there a hidden Batman cave under my building on -6?"

 "Is this actually Willy Wonkers glass elevator?"

And on and on…

On a serious note though generally as best practice for physical products 'form ever follows function' - coined by the American architect, [Louis Sullivan](https://en.wikipedia.org/wiki/Louis_Sullivan#:~:text=Louis%20Henry%20Sullivan%20%28September%203%2C%201856%20%E2%80%93%20April,the%20%22father%20of%20skyscrapers%22%20and%20%22father%20of%20modernism%22.). Although there is an argument that this is not true for digital products, e.g. smartphones, because they have so many functions. In this case, I think I am safe to say it counts… Unless you are designing a [Memphis style](https://en.wikipedia.org/wiki/Memphis_Group) lift.

The building was built in 2004, and the lift is original. After a quick internet search, it turns out the lift is the [Schindler Smart002 MRL](https://elevation.fandom.com/wiki/SchindlerSmart_MRL) which was discontinued in mid-2000.

My internal UX voice is going 'great, so they are no longer in use, but how did Schindlers get to this design in the first place?'

Perhaps it was a way of reducing costs and customisation for each building? By providing a 0-9 number pad with '–'and '.' you have a one size fit's all buildings. Still not sure what the '.' is for though… But is it worth it at the cost of creating a solution that has a bad user experience?

Let's break this down into people who could use the lift, places they are returning from and going to, emotions and actions;

To narrow this a little I am assuming the lift is the lift in my small block of flats.

In only one of these scenarios should you expect the lift user to want to think about how to use the lift, the maintenance person in the lift, working with a neutral emotion or maybe still confused?

I think that was what really got to me, I have never had to think about using a lift unless it's which floor do I need. Why fix what isn't broken? So what is it about this lift that makes the user experience worse than others? And why does this design seem like an afterthought?

via GIPHY

Audible, physical and visual feedback and affordances.
The majority of lifts have mechanical buttons, including a variation of this lift design. When you see a mechanical button you know to press it, that's because of the affordances and signifiers considered in the design are doing their job. The button then moves and gives you visual, physical and audible ('ding') feedback that it has been pressed.

When you see the numbers on the smart002 panel, you also know to press them. However, you get no physical or visual feedback as it's a capacitive button, not a 'touch screen'. There is a delay to the screen showing the floor number and to the audible feedback. This usually ends with me pressing the button too many times and cancelling out the request. As you can see in this video;

[Capacitive](https://en.wikipedia.org/wiki/Capacitive_sensing) buttons. (I'm not 100% sure which type of touch technology the lift uses, my assumption is it's a capacitive technology.)  As well as having no visual feedback in the smart002 design, there are other usability issues too, some of them I wouldn't have really considered until COVID-19. You have to use something that conducts electricity to use the button, usually a hand. Think of the potential spread. Actually here's an article – [Asymptomatic woman infects 71 people after using her apartment lift](https://metro.co.uk/2020/07/13/asymptomatic-woman-infects-71-people-using-apartment-lift-12983273/). Also when It's cold outside do you really want to take off your gloves?

Too many buttons for the number of floors. For anyone who is not familiar with the building, for any floor that does not exist the small 2 digit screen shows ‘Er'. This could miss lead you into thinking the lift is broken.

The smart002 lift design was discontinued in mid-2000, and replaced with [Schindler 3300](https://www.schindler.com/e-brochure/uk/3300/controls.html) in 2005. What did Schindler do to improve the UX of the lift?

Just like a physical button if you think back to the days of Windows 98 or XP, we used [skeuomorphism](https://www.interaction-design.org/literature/topics/skeuomorphism) to indicate you should press a button and when that button was pressed. We graduated to flat UI design which is much more subtle but still gives you that visual feedback (affordances). The 3300 follows this pattern. When you press the capacitive button, it turns the floor number from blue to red and makes that familiar 'ding'. This gives you audible and visual feedback as long as you're not colour blind. So a step in the right direction but it's been 15 years, please fix this [accessibility issue](https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0&currentsidebar=%23col_customize&tags=color)!

I forget that we have so many advantages as UX designers of app's and websites. Our agile process allows us to fix and continuously improve the experience we have when it's hardware; you only get one shot.

To conclude the rant. Thou shalt always take a human-centred approach, even when it's a UI in a physical product. (Why do they always seem like an afterthought?) One size fit's all sounds great, but is it worth it?

I'll leave you with this; the [Paternoster](https://en.wikipedia.org/wiki/Paternoster_lift) arguably the worst and scarest lift design of them all!

All writing is my own opinion and not associated with my employer or companies linked to and mentioned in this article.

repository: samueltambun/designrant-app

repo_name: samueltambun/designrant-app


text:
### VIM as IDE

Install + clone latest plugins with the following script (root privileges needed to install packages with apt-get).

Remove or rename your old `.vim` and `.vimrc` before running installation script, otherwise they will be renamed to `.vim(rc)_XXXX`.

```
git clone https://github.com/dalibor-drgon/vim-ide ~/.vim --depth=1
cd ~/.vim && chmod +x ./installVim.sh && ./installVim.sh
```

Some plugins require Source Code Pro font installed in order to correctly
display the interface. Pleace make sure you have installed this font -
https://github.com/powerline/fonts/tree/master/SourceCodePro

![img1](https://i.imgur.com/RCkThOZ.png)
![img2](https://i.imgur.com/WfooTHC.png)

repository: dalibor-drgon/vim-ide

repo_name: dalibor-drgon/vim-ide


text:
[Home](./index.md) > [@anglr/error-handling](./error-handling.md) > [NoConnectionInterceptor](./error-handling.noconnectioninterceptor.md)

## NoConnectionInterceptor class

NoConnectionInterceptor used for intercepting http responses and handling 0 statuses

Signature:

```typescript
export declare class NoConnectionInterceptor implements HttpInterceptor
```
Implements: HttpInterceptor

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)(\_options, \_ignoredInterceptorsService, \_injector)](./error-handling.noconnectioninterceptor._constructor_.md) |  | Constructs a new instance of the NoConnectionInterceptor class |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [intercept(req, next)](./error-handling.noconnectioninterceptor.intercept.md) |  | Intercepts http request |


text:
# lattpy

| Master | Dev  |
|:-------|:-----|
| [![codecov](https://codecov.io/gh/dylanljones/lattpy/branch/master/graph/badge.svg?token=P61R3IQKXC)](https://codecov.io/gh/dylanljones/lattpy) | [![codecov](https://codecov.io/gh/dylanljones/lattpy/branch/dev/graph/badge.svg?token=P61R3IQKXC)](https://codecov.io/gh/dylanljones/lattpy) |

`lattpy` is a python package for modeling bravais lattices and constructing (finite) lattice structures.

NOTE: This project is still under development and may change significantly!

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

Install via pip
````commandline
pip install lattpy
````
or by downloading from GitHub and running
````commandline
python setup.py install
````

Usage
=====

Before accessing the attributes of the `Lattice`-model the lattice has to be configured

Configuration
-------------

A new instance of a lattice model is initialized using the unit-vectors of the Bravais lattice.
After the initialization the atoms of the unit-cell need to be added. To finish the configuration
the connections between the atoms in the lattice have to be set. This can either be done for
each atom-pair individually by calling ``add_connection`` or for all possible pairs at once by
callling ``add_connections``. The argument is the number of unique
distances of neighbors. Setting a value of ``1`` will compute only the nearest
neighbors of the atom.
````python
import numpy as np
from lattpy import Lattice

latt = Lattice(np.eye(2))                 # Construct a Bravais lattice with square unit-vectors
latt.add_atom(pos=[0.0, 0.0])             # Add an Atom to the unit cell of the lattice
latt.add_connections(1)                   # Set the maximum number of distances between all atoms

latt = Lattice(np.eye(2))                 # Construct a Bravais lattice with square unit-vectors
latt.add_atom(pos=[0.0, 0.0], atom="A")   # Add an Atom to the unit cell of the lattice
latt.add_atom(pos=[0.5, 0.5], atom="B")   # Add an Atom to the unit cell of the lattice
latt.add_connection("A", "A", 1)          # Set the max number of distances between A and A
latt.add_connection("A", "B", 1)          # Set the max number of distances between A and B
latt.add_connection("B", "B", 1)          # Set the max number of distances between B and B
latt.analyze()
````

Configuring all connections using the ``add_connections``-method will call the ``analyze``-method
directly. Otherwise this has to be called at the end of the lattice setup or by using
``analyze=True`` in the last call of ``add_connection``. This will compute the number of neighbors,
their distances and their positions for each atom in the unitcell.

To speed up the configuration prefabs of common lattices are included. The previous lattice
can also be created with
````python
from lattpy import simple_square

latt = simple_square(a=1.0, neighbors=1)  # Initializes a square lattice with one atom in the unit-cell
````

So far only the lattice structure has been configured. To actually construct a (finite) model of the lattice
the model has to be built:
````python
latt.build(shape=(5, 3))
````
This will compute the indices and neighbors of all sites in the given shape and store the data.

After building the lattice periodic boundary conditions can be set along one or multiple axes:
````python
latt.set_periodic(axis=0)
````

To view the built lattice the `plot`-method can be used:
````python
from lattpy import simple_square

latt = simple_square(a=1.0, neighbors=1)
latt.build((5, 3), periodic=0)
latt.plot()
````

General lattice attributes
--------------------------

After configuring the lattice the attributes are available.
Even without building a (finite) lattice structure all attributes can be computed on the fly for a given lattice vector,
consisting of the translation vector `n` and the atom index `alpha`. For computing the (translated) atom positions
the `get_position` method is used. Also, the neighbors and the vectors to these neighbors can be calculated.
The `dist_idx`-parameter specifies the distance of the neighbors (0 for nearest neighbors, 1 for next nearest neighbors, ...):
````python
from lattpy import simple_square

latt = simple_square()

# Get position of atom alpha=0 in the translated unit-cell
positions = latt.get_position(n=[0, 0], alpha=0)

# Get lattice-indices of the nearest neighbors of atom alpha=0 in the translated unit-cell
neighbor_indices = latt.get_neighbors(n=[0, 0], alpha=0, distidx=0)

# Get vectors to the nearest neighbors of atom alpha=0 in the translated unit-cell
neighbor_vectors = latt.get_neighbor_vectors(alpha=0, distidx=0)
````

Also, the reciprocal lattice vectors can be computed
````python
rvecs = latt.reciprocal_vectors()
````

or used to construct the reciprocal lattice:
````python
rlatt = latt.reciprocal_lattice()
````

The 1. Brillouin zone is the Wigner-Seitz cell of the reciprocal lattice:
````python
bz = rlatt.wigner_seitz_cell()
````

The 1.BZ can also be obtained by calling the explicit method of the direct lattice:
````python
bz = latt.brillouin_zone()
````

Finite lattice data
-------------------

If the lattice has been built the needed data is cached. The lattice sites of the
structure then can be accessed by a simple index `i`. The syntax is the same as before,
just without the `get_` prefix:

````python
from lattpy import simple_square

latt = simple_square()
latt.build((5, 2))
idx = 2

# Get position of the atom with index i=2
positions = latt.position(idx)

# Get the atom indices of the nearest neighbors of the atom with index i=2
neighbor_indices = latt.neighbors(idx, distidx=0)

# the nearest neighbors can also be found by calling (equivalent to dist_idx=0)
neighbor_indices = latt.nearest_neighbors(idx)

````

Performance
===========

Even though `lattpy` is written in pure python, it achieves high performance and
a low memory footprint by making heavy use of numpy's vectorized operations.
As an example the build-times of a square lattice for different number of sites
are shown in the following plot:

Note that the overhead of the multi-thread neighbor search results in a slight
increase of the build time for small systems. By using `num_jobs=1` in the `build`-method
this overhead can be eliminated for small systems. By passing `num_jobs=-1` all cores
of the system is used.

Examples
========

Using the (built) lattice model it is easy to construct the (tight-binding)
Hamiltonian of a non-interacting model:

````python
import numpy as np
from lattpy import simple_chain

# Initializes a 1D lattice chain with a length of 5 atoms.
latt = simple_chain(a=1.0)
latt.build(shape=4)
n = latt.num_sites

# Construct the non-interacting (kinetic) Hamiltonian-matrix
eps, t = 0., 1.
ham = np.zeros((n, n))
for i in range(n):
    ham[i, i] = eps
    for j in latt.nearest_neighbors(i):
        ham[i, j] = t
````

Since we loop over all sites of the lattice the construction of the hamiltonian is slow.
An alternative way of mapping the lattice data to the hamiltonian is using the `DataMap`
object returned by the `map()` method of the lattice data. This stores the atom-types,
neighbor-pairs and corresponding distances of the lattice sites. Using the built-in
masks the construction of the hamiltonian-data can be vectorized:
````python
import numpy as np
from scipy import sparse
from lattpy import simple_chain

# Initializes a 1D lattice chain with a length of 5 atoms.
latt = simple_chain(a=1.0)
latt.build(shape=4)

# Vectorized construction of the hamiltonian
eps, t = 0., 1.
dmap = latt.data.map()               # Build datamap
values = np.zeros(dmap.size)         # Initialize array for data of H
values[dmap.onsite(alpha=0)] = eps   # Map onsite-energies to array
values[dmap.hopping(distidx=0)] = t  # Map hopping-energies to array

# The indices and data array can be used to construct a sparse matrix
ham_s = sparse.csr_matrix((values, dmap.indices))
ham = ham_s.toarray()
````

Both construction methods will create the following Hamiltonian-matrix:
````
[[0. 1. 0. 0. 0.]
 [1. 0. 1. 0. 0.]
 [0. 1. 0. 1. 0.]
 [0. 0. 1. 0. 1.]
 [0. 0. 0. 1. 0.]]
````

If periodic boundary conditions are set (along axis 0) the output is:
````
[[0. 1. 0. 0. 1.]
 [1. 0. 1. 0. 0.]
 [0. 1. 0. 1. 0.]
 [0. 0. 1. 0. 1.]
 [1. 0. 0. 1. 0.]]
````


text:
# Microbotryum kuehneanum (R. Wolff) Vánky, 1998 SPECIES

#### Status
ACCEPTED

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

#### Published in
Mycotaxon 67: 45 (1998)

#### Original name
Ustilago kuehneana R. Wolff, 1874

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# Ochoko

## Kanpai!

A bilingual (English/Japanese) Ruby on Rails web app for tracking and rating your favorite Japanese sakes. It also serves as an English and Japanese database of Japanese sakes.

Try out the app here: https://ochoko.herokuapp.com/

## Features

- Data entered in both Japanese and English
- App can be used in either Japanese or English
- Sign up (Facebook or email/password) and add tasting notes for the sakes you've drank

* The ['ajax' branch](https://github.com/morinoko/ochoko/tree/ajax) demonstrates using AJAX calls to load and post data asynchronously (for brewery resource only).

## Features to add in the future

- Search for sakes and breweries
- Auto-complete form for selecting sakes or breweries when adding new ones
- Ability to upload images
- User following feature (maybe?)
- Tests!

## Getting started

### Prerequisites

- Ruby
- Rails 5+
- PostgreSQL database

### Set up

1. Fork the repository and clone it.
2. Run `bundle install` to install gems (If you don't have bundler, first run `gem install bundler`)
3. Set up the database with `rake db:create` and `rake db:migrate`.
4. The app uses the dotenv gem for environment variables (currently only for Oauth through Facebook). Create a `.env` file in the root of the app and add `FACEBOOK_KEY=your_key` and `FACEBOOK_SECRET=your_secret`. You will need to set up a Facebook developer account to get these keys.
5. Run `rails server` and navigate to `http://localhost:3000`.

### Seed data

Seed data for Japanese prefectures and all breweries in Nagano currently available. Add the data to your database by running:

```ruby
rake db:seed
```

## Contributing

You can make a request or report a bug by creating an issue. Or write your own code an submit a pull request:

1. Fork and clone the repository, following the steps below.
2. Create a branch named after the feature or bug. For example: `git checkout -b feature/new-feature` or `git checkout -b bug/bug-fix`.
3.
4. Push to the branch with `git push origin feature/new-feature`.
5. Create a pull request: Explain the reason for the change, why the code was written the way it was, etc.

## License

Licensed under the [MIT License](https://opensource.org/licenses/MIT).

repository: morinoko/ochoko

gha_language: Ruby

repo_name: morinoko/ochoko


text:
# Changelog

- please enter new entries in format

```
- <description> (#<PR_number>, kudos to @<author>)
```

## master

repository: dothanthitiendiettiende/Reqres

repo_name: dothanthitiendiettiende/Reqres


text:
---
date: 2019-11-22T00:00:00+00:00
title: Modular Triggers and Actions
episode: 98
tags:
- Twitch
github: https://github.com/sorskoot/rosiebot
---

During this stream, we made some progress on Rosie our Twitch hat bot. We are rebuilding the old node.js one in Vue, Vuex, and Electron. Today we looked into Vue Plugins to create modularity in Triggers and Actions.

{{< youtube TjZf8fMm5eA >}}

<!--more-->

---

## Announcements

- [x] !discord
- [x] !git
- [x] !merch

---

## Project working on today

- [x] Getting the Trigger <- -> Action to work

## Next Steps

- [ ] implementing the plugin architecture

---

## Things we learned

-  st3ven89 talks about https://zap.works/webar/, they do 360 pictures as well

---

## Todays stream brought to you by

All the wonderful people that hung out with us in chat!

repository: sorskoot/sorskoot-website

gha_language: SCSS

repo_name: sorskoot/sorskoot-website


text:
# Sample Project Name  <img src='https://img.shields.io/badge/license-MIT-black'/>

## Description
Sample project description

## Table of Contents

* [Installation](#installation)
* [Usage](#usage)
* [License](#license)
* [Contribution](#contribution)
* [Tests](#tests)
* [Questions](#questions)

## Installation
To install dependencies, use

```
npm i
```

## Usage
Sample usage instructions

## License
This application is covered under MIT licensing

## Contribution
To contribute to the repository, sample contribution instructions

## Tests
To run tests input:

```
npm test
```

## Questions
For any questions, please contact me via<EMAIL_ADDRESS>or find me on github @SampleUsername


text:
This repo explores the uses for [ink](https://github.com/vadimdemedes/ink), a library for building command-line interfaces with React.

The sample application grabs the temperature of a given location from DuckDuckGo and displays it.

Run with `docker-compose run app` or `npm install; npm start`.

repository: DailyNodeModule/ink

repo_name: DailyNodeModule/ink


text:
# CorDapp Template with Sampler

Welcome to the Kotlin CorDapp with Sampler template. The CorDapp template is extended from [CorDapp Template - Kotlin](https://github.com/corda/cordapp-template-kotlin) to demonstrate how to integrate a sampler module into your CorDapp project.

# Pre-Requisites

## Corda Performance Test Suite
The development of CorDapp and sampler itself does not require Corda Performance Test Suite, but you will need it to create and execute test plans. If you are not familiar with Corda Performance Test Suite or how to implement JMeter sampler, please refer to the [Corda documentation](https://docs.corda.net/docs/corda-enterprise/4.8/performance-testing/toc-tree.html).

# Usage

## Build the sampler

You can build the sampler by simply execute build task in Gradle.

```

./gradlew jmeter-sampler:build

```
This will generate the output of the build under `jmeter-sampler/build/`, just like other CorDapp modules.

## Deploy the sampler
In `jmeter-sampler/build.gradle` a `deploySampler` task is defined. This task basically syncs up a deploy folder with the sampler and worflow jar files (as in most cases the sampler has dependencies on workflows of the CorDapp). By default, the deploy folder is `jmeter-sampler/extlibs/`. You can specify a different location by changing the value of `samplerDeployPath` property in [gradle.properties](https://github.com/davidleesbir3/cordapp-template-with-sampler/blob/with-sampler/gradle.properties) file.

For example, if you have Test Suite installed in `~/Corda-Test-Suite/`, then you might want to set the deploy folder to `~/Corda-Test-Suite/extlibs`. Then run the following command to deploy the sampler:

```
./gradlew jmeter-sampler:deploySampler
```
or simply

```
./gradlew deploySampler
```

Once it's delpoyed successfully, you should see two jar files in the deploy folder:

* jmeter-sampler-1.0.jar
* workflows-0.1.jar

## Running Corda Performance Test Suite
Test Suite comes with a command line argument `-XadditionalSearchPaths` to specify paths for jar files containing classes that need to be loaded. For example, if your JMeter test plan will invoke a class in your sampler, you would need your sampler jar file to be loaded. Assuming Test Suite JAR file is installed in `~/Corda-Test-Suite/`, and sampler deploy folder is `~/Corda-Test-Suite/extlibs/`, you can start up Test Suite GUI by executing the following command

```
cd ~/Corda-Test-Suite/

java -jar jmeter-corda.jar -XadditionalSearchPaths="./extlibs/" -XjmeterProperties ./jmeter.properties
```

Performance Test Suite should be started with the sampler and its dependencies loaded. Note that you can specify multiple paths in the `-XadditionalSearchPaths` properties by separating them with semicolon.

For more information on available arguments of Peformance Test Suite, please refer to [Corda documentation](https://docs.corda.net/docs/corda-enterprise/4.8/performance-testing/running-jmeter-corda.html#jmeter-corda-wrapper-arguments).


text:
---
layout: projects
title: 350ppm.co
image: /images/projects/350ppm.png
categories: projects
description: "A website for an environmentally focused clothing brand."
language: html/css
github: https://github.com/350partspermillion/350ppm
---
[350ppm.co]: http://350ppm.co/

Built [350ppm.co], a clothing brand's website, from scratch based on a sketch provided by the brand's owner.

The site is built on [Jekyll](http://jekyllrb.com/), a Ruby static site generator, and uses
[Skeleton](http://getskeleton.com/) as its CSS framework.


text:
# Rotten Oranges - A React TMDb Client

This is one of my weekend projects to practice React Hook API. It is originally inspired by [reactjs-tmdb-app](https://github.com/SKempin/reactjs-tmdb-app) by Stephen Kempin.

Technologies used:

- Backend (Data Source)
  - [The TMDb API](https://www.themoviedb.org/documentation/api)
- Frontend
  - [React Material UI](https://material-ui.com/)

## Authentication

Before you start, you __must__ provide information for TMDb to recognize your application.

TMDb application level authentication is controlled by one of either a single query parameter, `api_key`, or by using your v4 access token as a `Bearer` token. This project use the latter by setting `ENV.bearerToken` in `environment.js`.

You can request an API key by [logging in to your account](https://www.themoviedb.org/login) or [sign up if you do not have one](https://www.themoviedb.org/signup) on TMDb, then clicking the `API` link in the left hand side bar of your account page.

## Get Started

```bash
git clone https://github.com/bonniss/rotten-oranges.git
cd rotten-oranges
```

-  Install dependencies

```bash
npm install
```

- Run dev server: `npm start`, default port `8001`

```bash
npm start
```

- Build project, output folder `dist`

```bash
npm run build
```

## Screenshots

## Todo

- Search TV Shows, Actors, Directors
- Random Movie Suggestion
- Favorite List

repository: bonniss/rotten-oranges

repo_name: bonniss/rotten-oranges


text:
---
layout: post
title: "A GPU implementation of the harmonic sum algorithm"
date: 2018-12-06 16:32:19
categories: arXiv_CV
tags: arXiv_CV
author: Karel Adámek, Wesley Armour
mathjax: true
---

* content
{:toc}

##### Abstract
Time-domain radio astronomy utilizes a harmonic sum algorithm as part of the Fourier domain periodicity search, this type of search is used to discover single pulsars. The harmonic sum algorithm is also used as part of the Fourier domain acceleration search which aims to discover pulsars that are locked in orbit around another pulsar or compact object. However porting the harmonic sum to many-core architectures like GPUs is not a straightforward task. The main problem that must be overcome is the very unfavourable memory access pattern, which gets worse as the dimensionality of the harmonic sum increases. We present a set of algorithms for calculating the harmonic sum that are more suited to many-core architectures such as GPUs. We present an evaluation of the sensitivity of these different approaches, and their performance. This work forms part of the AstroAccelerate project which is a GPU accelerated software package for processing time-domain radio astronomy data.

##### Abstract (translated by Google)

##### URL
[https://arxiv.org/abs/1812.02647](https://arxiv.org/abs/1812.02647)

##### PDF
[https://arxiv.org/pdf/1812.02647](https://arxiv.org/pdf/1812.02647)