text:
# app_modeling

#### Table of contents

1. [Description](#description)
1. [Usage - Example uses of the module](#usage)
1. [Reference - Parameter and arguments](#reference)

## Description

This module contains a collection of Puppet extensions for modeling cross-node applications in Puppet code. Included is a set of types and providers for common capability resources and two functions useful for defining dynamic applications.

## Usage

### Capability resources

This module contains two capability resource types: `http` and `database`. You can use these resource types to *produce* and *consume* resources in application components.

For example, the following code sample shows how you could use this module to create an application component for a web server that consumes a `database` resource and produces an `http` resource.

```puppet
Wordpress_app::Web consumes Database{
  db_host     => $host,
  db_name     => $database,
  db_user     => $user,
  db_password => $password,
}
Wordpress_app::Web produces Http {
  ip   => $interface ? { /\S+/ => $::networking['interfaces'][$interface]['ip'], default => $::ipaddress },
  port => $web_port,
  host => $::hostname,
}
define wordpress_app::web(
  String $db_host,
  String $db_name,
  String $db_user,
  String $db_password,
  String $web_port = '8080',
) {
  # Puppet code to set up this component
}
```

### Dynamic application functions

The functions included in this module make it easier to write dynamic applications where some components are defined in the declaration. For example, you can use the `collect_component_titles` function to determine if a component exists and, if it doesn't, the function will create it.

```puppet
# Create an lb component for each declared load balancer.
$lb_components = collect_component_titles($nodes, Wordpress_app::Lb)
$lb_components.each |$comp_name| {
  wordpress_app::lb { $comp_name:
    balancermembers => $web_https,
    lb_options      => $lb_options,
    ipaddress       => $lb_ipaddress,
    port            => $lb_port,
    balance_mode    => $lb_balance_mode,
    require         => $web_https,
    export          => Http["lb-${name}"],
  }
}
```

## Reference

### Types

#### `data_capability`

The `data_capability` type accepts a single parameter that can be used to pass arbitrary data to other other nodes. There is no availability check. This is useful if you need to pass data between components but don't care if services are running. See [examples/data.pp](https://github.com/puppetlabs/puppetlabs-app_modeling/blob/master/examples/data.pp).

##### Parameters

* `data`: Arbitrary data to produce or consume component information. Usually this should be a hash.

#### `dependency`

The `dependency` type passes no information between nodes and has no availabilty check. This type is useful if you only care about node run order.

#### `http`

The `http` type allows the following parameters and providers:

##### Parameters

* `ip`: The external IP address of the HTTP service (default: `<IP_ADDRESS>`).
* `host`: The hostname of the node where the resource is available (default: `<IP_ADDRESS>`).
* `base_path`: The base path the resource is mounted at (default: `\`).
* `port`: The port where the resource is available (default: `80`).
* `ssl`: Set to true if the HTTP service uses SSL encryption (default: `false`).
* `timeout`: Time before timing out the resource in seconds (default: `60`).
* `ping_interval`: Time between retries in seconds (default: `1`).
* `status_codes`: An array of HTTP status codes that will return success (default: `[200]`).

##### Providers

* `tcp`: This provider attempts to make a TCP connection to the port where the resource is available.

#### `database`

The `database` type allows the following parameters and providers:

##### Parameters

* `database`: The name of the database to connect to.
* `host`: The hostname of the node where the database is available (default: `<IP_ADDRESS>`).
* `port`:  The port where the database is available (default: `5432`).
* `user`: The user that connects to the database.
* `password`: The password used to connect to the database.
* `instance`: The instance of the database to connect to.
* `timeout`: The timeout, in seconds, to use when attempting to check the database (default: `60`).
* `ping_interval`: How long to wait before retrying a connection (default: 1).

##### Providers

* `tcp` - This provider attempts to make a TCP connection to the port.
* `postgres` - This provider connects to a PostgreSQL database.

### Functions

#### `collect_component_titles`

This function searches the node hash of an application for all components of a given type and returns an array of their titles.

```
collect_component_titles($nodes, Wordpress_app::Web)
```

#### `collect_component_nodes`

This function searches the node hash of an application for all nodes that have a given component assigned to them and returns an array of nodes titles.

```
collect_component_nodes($nodes, Wordpress_app::Web)
```

#### `create_component_app`

This function is similiar to normal application declaration syntax, but instead of mapping nodes to component instances, this function maps components to nodes. This makes it easier to use applications defined with `collect_component_titles` if the same components are assigned to many nodes for availability or scale. For example, the following example site blocks create equivalent application declarations:

```puppet
site {
  create_component_app('wordpress::app', 'my_wordpress',
    {'db_password' => 'secret',
     'components' => {
       # These component names must be quoted if defined in puppet code so they parse as strings.
       'Wordpress_app::Database' => ['node1.example.com'],
       'Wordpress_app::Web' => ['node2.example.com', 'node3.example.com', 'node4.example.com'],
       'Wordpress_app::Lb' => ['node4.example.com']
      }
    })
}

site {
  wordpress::app { 'my_wordpress:
    db_password => 'secret',
    nodes => {
      Node['node1.example.com'] => Wordpress_app::Database['my_wordpress-node1.example.com'],
      Node[node2.example.com'] => Wordpress_app::Web['my_wordpress-node2.example.com'],
      Node[node3.example.com'] => Wordpress_app::Web['my_wordpress-node3.example.com'],
      Node[node4.example.com'] => [Wordpress_app::Web['my_wordpress-node4.example.com'],
                                   Wordpress_app::Lb['my_wordpress-node4.example.com']],
    }
  }
}
```

The component instances created are given titles `"${app_instance_name}-${node_name}"`. This works well if the application definition uses `collect_component_titles` to declare components.

#### `create_node_order`

This function can be used in site blocks for applications in which the assigned nodes must run in order. This function accepts a title for the application and a list of node layers. It then creates an instance of `app_modeling::node_order` where the nodes at each layer depend on all the nodes in the previous layer.

The following example creates a dependency between two nodes. Whenever an orchestrator job is run on these nodes, `node1` will always run before `node2`. You can run an orchestrator job on these nodes with `puppet job run --application App_modeling::Node_order['node1-node2']`.

```puppet
site {
  create_node_order('node1-node2', ['node1.example.com', 'node2.example.com'])
}
```

The following example shows a node run order for a three-layer web application (a database, some application servers, and a load balancer).  You can run an orchestrator job to deploy this application with `puppet job run --application App_modeling::Node_order['three_tier']`.

```puppet
site {
  create_node_order('three_tier', ['database.example.com', ['web1.example.com','web2.example.com','web3.example.com'], 'lb.example.com'])
}
```

##### Parameters

* `title` - The title of the application to create.
* `nodes` - An array of node layers to order. A node layer can consist of a single node name or an array of node names.

gha_language: Ruby


text:
# Elliptic curve cryptography (ECC) in Dart ![Pub](https://img.shields.io/pub/v/viz_dart_ecc.svg)
[![Build Status](https://travis-ci.com/VizTower/viz_dart_ecc.svg?branch=master)](https://travis-ci.com/VizTower/viz_dart_ecc)

[[DOC](https://pub.dev/documentation/viz_dart_ecc/latest/) | [issue tracker](https://github.com/VizTower/viz_dart_ecc/issues)]

viz_dart_ecc is cryptography library for simply data encoding and decoding
using VIZ blockchain's ECC cryptography algorithms.

Code for viz_dart_ecc was forked from [eosdart_ecc](https://github.com/primes-network/eosdart_ecc)
but most of it was rewritten for VIZ blockchain.

## Usage

A simple usage example:

```dart
import 'package:viz_dart_ecc/viz_dart_ecc.dart';

void main() {
  VIZPrivateKey privateKey = VIZPrivateKey.fromString(
      '5J2XSYiA62K5s9vLsXXpj9CdoGmWUnohEWnVmg8aJb8D2TYvpbW');

  VIZPublicKey publicKey = privateKey.toPublicKey();
  VIZSignature signature = privateKey.signString('data');

  print('Pub key: ' + publicKey.toString());
  print('Signatured data: ' + signature.toString());
}
```

## Features and bugs

Please file feature requests and bugs at the [issue tracker](https://github.com/VizTower/viz_dart_ecc/issues)

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Beep-Songs

[![GitHub issues](https://img.shields.io/github/issues/adamrees89/Beep-Songs.svg)](https://github.com/adamrees89/Beep-Songs/issues)
[![GitHub forks](https://img.shields.io/github/forks/adamrees89/Beep-Songs.svg)](https://github.com/adamrees89/Beep-Songs/network)
[![GitHub stars](https://img.shields.io/github/stars/adamrees89/Beep-Songs.svg)](https://github.com/adamrees89/Beep-Songs/stargazers)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/adamrees89/Beep-Songs/master/LICENSE)

Song scripts written for the 'beep' software commonly found in Linux

Everyone is welcome to help me improve the package, raise issues using the Issues tab, help write the wiki, or fork the repo and make your own changes to be pulled back in! Sharing is caring!

repository: no-flo/Beep-Songs

repo_name: no-flo/Beep-Songs


text:
[![Build Status][travis-badge]][travis]

[travis-badge]: https://travis-ci.org/mkaczanowski/ompi-mutual-friends.svg?branch=master
[travis]: https://travis-ci.org/mkaczanowski/ompi-mutual-friends/

# Setup
This experiment aims to boost up data processing speed by spreading the workload on a few low-end ARM boards. So, I'd recommend setting up a few Raspberry PIs within the same network pod, but if you can't do that, the OpenMPI framework also allows local execution (handy for testing).

My setup consists of 4x [Odroid U3](https://wiki.odroid.com/old_product/odroid-x_u_q/odroid_u3/odroid-u3) boards connected by a cheap 1 GBps network switch. The eMMC speed is a clear advantage, and since we heavily depend on data access speed, the odroid board sounds like a good fit.

## Accessing Twitter's data
In the real-world big data cluster, the data likely is stored on some distributed filesystem to provide faster access and data redundancy. As an example, the figure below explains how HDFS stores files.

![HDFS data distribution](http://mkaczanowski.com/wp-content/uploads/2015/05/hdfs-data-distribution.png "HDFS data distribution")

Because we operate on low-end ARM devices, we won't use HDFS, but instead, we split the file into N parts and copy them across the nodes.
```
$ wget https://snap.stanford.edu/data/twitter_combined.txt.gz
$ gunzip -d twitter_combined.txt.gz

$ split -l 10000 twitter_combined.txt tsplit
$ mv tsplit* data/
```

## Intermediate storage
The OpenMPI library takes care of message passing but doesn't store the intermediate results of the map-reduce steps; therefore, we need to spawn up some remote database, i.e., Memcache:
```
$ docker run --network host --name my-memcache -d memcached
```

## Building project
Running on multiple machines (via ssh):
```
mpirun --allow-run-as-root -np 16 --host odroid0,odroid1,odroid2,odroid3 MEMCACHED_SERVER=<host> ~/friends ~/data/
```

Testing on a single node:
```
$ mkdir build && cd build
$ cmake ../
$ make

$ MEMCACHED_SERVER=localhost ./friends ../data/twitter_combined.txt
```

The results can be optionally dumped to a file, for example:
```
$ cat output.txt | grep "[17711130, 99712896]"
[17711130, 99712896]: 21447363 22462180 34428380 36475508 43003845 107512718 126391227 222851879 223990701
```

# How does it work?
Map-reduce tutorials are abundant on the internet, so I'll skip the deep-dive and point you to the figure below that briefly explains the overall flow.

![Map Reduce structure](http://mkaczanowski.com/wp-content/uploads/2015/05/MapReduce_Work_Structure.png "Map Reduce structure")

The example run for A & B friends who have D, Z, F, G friends in common:
1. Transform data to form A -> D,Z,E (friend list)
2. Perform a Cartesian product:
```
(A, D) -> D, Z, E
(A, Z) -> D, Z, E
(A, E) -> D, Z, E
```

3. Reduce all tuples to a form (A, D) -> (D,Z,E)(Z,E,F,G)
4. Intersect friends lists (A, D) -> (Z,E)
5. Save output

In comparison to far simpler (IMHO) Hadoop API the OpenMPI adds a few new operations:
* collate - method of a MapReduce object, that aggregates a KeyValue object across processors and converts it into a KeyMultiValue object
* gather - method of a MapReduce object, that collects the key/value pairs of a KeyValue object spread across all processors to form a new KeyValue object on a subset (nprocs) of processors.

# Summary
The OpenMPI version of map-reduce is not as straightforward as using Hadoop, as it requires a few extra steps and a bit of coding work. However, resource-wise, it's a better fit for the cluster of ARM prototype boards.

Here's the results of the test I conducted on 4x odroids U3 (16 nprocs):

![OpenMPI map reduce results](http://mkaczanowski.com/wp-content/uploads/2015/05/openmpi-map-reduce-results1.png "OpenMPI map reduce results")

It took 21.538s to process 421000 tuples on 16 cores (4 machines), where on 1 core it takes 623.784s. Is that satisfactory? To me, yes... somewhat, I expected worse performance.

# Demo
[![](http://mkaczanowski.com/wp-content/uploads/2015/05/5f2c954e910fddownload-1.png)](https://www.youtube.com/watch?v=_u7X21Gj6XE)

repository: mkaczanowski/ompi-mutual-friends

repo_name: mkaczanowski/ompi-mutual-friends


text:
# Eye Exercise
## Project Discription
This project required the use of Javascrip an CSS to create two eyes, with the eye ball moving when you move the computer mouse around the screen.
## Project view
![image](https://user-images.githubusercontent.com/78628198/116325177-86e13480-a78f-11eb-88a0-92eb7d49dbdd.png)
## How to run:
To run this project or view, grab a copy of the Eye Exercise.html into your chrome browser to open.
## Roadmap of future improvement:
For future improvement on this project, i plan to explore different background colors and be creative with different shapes to create more interactive objects.
## License Information:
MIT License

Copyright (c) 2020 John Williams

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.

branch_name: refs/heads/main


text:
# Scaled Project VCS Support

Provides simple VCS integration for [Scaled](https://github.com/scaled/scaled)
[Project](https://github.com/scaled/project-service).

Documentation TBD.

## Distribution

Scaled Project VCS Support is released under the New BSD License. The most recent version of the
code is available at https://github.com/scaled/vcs-project

repository: scaled/vcs-project

repo_name: scaled/vcs-project


text:
# How to Avoid a Climate Disaster

## Bill Gates

This book is Bill Gates' attempt to summarize what he thinks we need to do to
avoid a climate disaster. The book largely follows the biggest sources of
emissions, and gives recommendations for reducing each source. Here is a rough
summary of the key points:

- Electricity: the electricity must be made green through some combination of
  nuclear + renewables. Energy storage is the biggest challenge and needs
  research funding.
- Making things: we need lots of research into how to make things in a way that
  emits less carbon, particularly cement and steel (which are huge emitters
  now).
- Food production: need to produce fertilizer more efficiently, produce less
  meat, and do research into modifying agricultural processes to cut emissions.
- Transportation: we are already close to electric cars being economically
  effective and efficient. Further R&D will help this.
- Heating/cooling: should install heat pumps, and ensure that government
  regulations help make buildings more efficient.
- Governments have a big role to play for regulation and stimulating R&D.

A lot of his recommendations are similar to recommendations which I've seen
elsewhere. That being said, the following opinions in the book stood out to me:

1. Fighting climate change cannot come before improving the living standards of
   poor people. For example, we should not prevent extremely poor countries
   from electrifying just because they cannot do that with capital-intensive
   renewables.
2. It seems unlikely that aviation can be done with renewable energy because
   fossil fuels are so energy dense. It also seems unlikely that we can simply
   give up flying as a society. This will probably be one of the few areas
   where we would keep using fossil fuels and rely on carbon capture.
3. Decarbonizing the economy before 2030 is impossible and we shouldn't make
   this our goal. If we focus too much on 2030 governments may be tempted to
   focus too much on short-term reductions in emissions (e.g. replacing coal
   with natural gas) rather than long-term net zero policies.

Overall I think this book is worth reading if you are concerned about climate
change.

repository: AustinT/book-summaries

repo_name: AustinT/book-summaries


text:
# Imperial Sheets
Imperial Sheets is a character sheet app that can be used for certain d10 + aptitude based tabletop RPGs.
## TODO:
* Better ui scaling for tablets

## Credits:
Code: Sulo Heija
Icon: Topias Kiiskinen

repository: SHeija/imperial-sheets

gha_language: Dart

gha_license_id: MIT

repo_name: SHeija/imperial-sheets


text:
# employee-directory

Search, sort and view employees in React

## Table of Contents

- [employee-directory](#employee-directory)
- [Description](#description)
- [Installation](#installation)
- [Usage](#usage)
- [Licence](#licence)
- [Contributing](#contributing)
- [Questions](#questions)

## Description

![](./assets/images/employee-directory.png)

This is a simple React-based app which uses the Randomuser.me API to generate a list of simulated employees, which one can search and sort by last name.

[Deployed GitHub Pages Site](https://brhestir.github.io/employee-directory/)

[GitHub Repo](https://www.github.com/brhestir/employee-directory)

## Installation

```bash
npm install
```

## Usage

```bash
npm start
```

## Licence

![https://github.com/brhestir/employee-directory/blob/main/LICENSE](https://shields.io/github/license/brhestir/employee-directory)

## Contributing

Clone this repo and create a pull request.

## Questions

Questions/comments/suggestions welcome.

repository: brhestir/employee-directory

gha_language: JavaScript

repo_name: brhestir/employee-directory


text:
# vilain
Mimic fail2ban with pf for OpenBSD.

Inspired from http://www.vincentdelft.be/post/post_20161106

In pf.conf, add according to your configuration :

    table <vilain_bruteforce> persist
    block quick from <vilain_bruteforce>

You might want to add a cron task to remove old banned IP. As example, to ban for one day max :

    pfctl -t vilain_bruteforce -T expire 86400

To see banned IP :

    pfctl -t vilain_bruteforce -T show

repository: kianby/vilain

repo_name: kianby/vilain


text:
rbtrees
=======

An Old C++ Implementation of Red-Black Trees

C++ Implementation of Thread Safe Red-Black Trees that uses no STL, no external dependency at all.

The implementation is generic and highly efficient. insertion of 1 million nodes of int32_t keys takes 521ms and retrieval from 1 Million nodes tree takes 2ms!!

to Compile, checkout and run `make`.

__Note__ You must have gtest installed to run the test suite

repository: AhmedSoliman/rbtrees

repo_name: AhmedSoliman/rbtrees


text:
Added features or bug-fixes can have adverse effects that are hard to find
without a lot of testing, hence the importance of unit testing.

This project uses [PHPUnit](https://github.com/sebastianbergmann/phpunit/) as
its unit testing framework.

The tests all live in `/tests` and each test extends an abstract class
`AbstractKleinTest`

To test the project, simply run `php composer.phar install --dev` to download
a common version of PHPUnit with composer and run the tests from the main
directory with `./vendor/bin/phpunit`


text:
---
layout: plugin

id: fortune
title: OctoPrint-Fortune
description: Gives you a pithy fortune on web login or startup
authors:
- Stephen Berry
license: BSD

date: 2021-06-04

homepage: https://github.com/berrystephenw/OctoPrint-Fortune
source: https://github.com/berrystephenw/OctoPrint-Fortune
archive: https://github.com/berrystephenw/OctoPrint-Fortune/archive/main.zip

tags:
- fortune
- text
- notification

# TODO
screenshots:
- url: /assets/img/plugins/fortune/fortune-1.png
  alt: Fortune message on login
  caption: Your fortune
- url: /assets/img/plugins/fortune/IMG_6255.png
  alt: text fortune
  caption: Fortune sent to OctoText

featuredimage: /assets/img/plugins/fortune/fortune-1

# TODO
# You only need the following if your plugin requires specific OctoPrint versions or
# specific operating systems to function - you can safely remove the whole
# "compatibility" block if this is not the case.

compatibility:

  # List of compatible versions
  #
  # A single version number will be interpretated as a minimum version requirement,
  # e.g. "1.3.1" will show the plugin as compatible to OctoPrint versions 1.3.1 and up.
  # More sophisticated version requirements can be modelled too by using PEP440
  # compatible version specifiers.
  #
  # You can also remove the whole "octoprint" block. Removing it will default to all
  # OctoPrint versions being supported.

  octoprint:
  - 1.4.0

  # List of compatible operating systems
  #
  # Valid values:
  #
  # - windows
  # - linux
  # - macos
  # - freebsd
  #
  # There are also two OS groups defined that get expanded on usage:
  #
  # - posix: linux, macos and freebsd
  # - nix: linux and freebsd
  #
  # You can also remove the whole "os" block. Removing it will default to all
  # operating systems being supported.

  os:
  - linux
  - windows
  - macos
  - freebsd

  # Compatible Python version
  #
  # Plugins should aim for compatibility for Python 2 and 3 for now, in which case the value should be ">=2.7,<4".
  #
  # Plugins that only wish to support Python 3 should set it to ">=3,<4".
  #
  # If your plugin only supports Python 2 (worst case, not recommended for newly developed plugins since Python 2
  # is EOL), leave at ">=2.7,<3" - be aware that your plugin will not be allowed to register on the
  # plugin repository if it only support Python 2.

  python: ">=3,<4"

---

This is an adaptation of the original UNIX fortune program. Fortune will
run on OctoPrint login and popup a quote or saying from a database of stored quotes.

I have not created these quotes or sayings, they are simply provided from the
source given by Brian M. Clapper as a sample set of fortunes.

http://software.clapper.org/fortune/

There is an icon that looks like a book on the navigation bar for those that
would like a more frequent fortune. This can be turned off in the settings page.

## Setup

Install via the bundled [Plugin Manager](https://docs.octoprint.org/en/master/bundledplugins/pluginmanager.html)
or manually using this URL:

    https://github.com/berrystephenw/OctoPrint-Fortune/archive/main.zip

This is a Python 3 or greater plugin!

## Configuration

The only configuration is to enable or disable the icon on the navigation bar, and optionally
to enable sending your fortune to OctoText. [OctoText](https://plugins.octoprint.org/plugins/OctoText/) must be enabled and configured for
this feature to work.

## Copyright

Copyright © 2008-2019 Brian M. Clapper. All rights reserved.

repository: edekeijzer/OctoPrint-Fortune

repo_name: edekeijzer/OctoPrint-Fortune


text:
---
title: "Thirsty For Beer"
date: "2018-01-01T23:12:04.284Z"
description: "Never miss out on the local beer news and happenings!"
featuredImage: https://res.cloudinary.com/dtghgjg3i/image/upload/v1594915406/gatsby-personal-site/portfolio/a_kqy1zn.png
headerImage: https://res.cloudinary.com/dtghgjg3i/image/upload/v1594915406/gatsby-personal-site/portfolio/a_kqy1zn.png
projectLink: https://thirstyfor.beer
type: project
---

<br/>

## About

Beer culture is all the rage! Gone are the days of picking between the top three light lagers, today we have more choices than we could ever imagine.

Thirsty For Beer is a bi-weekly email newsletter tailored to within 20 miles of your geolocation. This newsletter is your dedicated source of local beer news and events happening in your area!

## Stack

**Language:** Ruby

**Framework:** Rails

**Tools:** [Send Grid](https://sendgrid.com/), [Eventbrite API](https://www.eventbrite.com/platform/api), [Heroku](https://heroku.com/)

branch_name: refs/heads/develop


text:
# Wechat::Core 微信核心库

[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/wechat-core/frames)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)

[![Gem Version](https://badge.fury.io/rb/wechat-core.svg)](https://badge.fury.io/rb/wechat-core)
[![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/wechat-core.svg)](https://gemnasium.com/github.com/topbitdu/wechat-core)

The Wechat Core Library is a code base to call the core Wechat APIs, such as fetching Access Token, and fetching Follower Profile. 微信核心库用于调用微信核心API，例如获取访问令牌，获取关注者的信息。

## Recent Update

Check out the [Road Map](ROADMAP.md) to find out what's the next.
Check out the [Change Log](CHANGELOG.md) to find out what's new.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'wechat-core'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install wechat-core

## Usage

### Access Token 访问令牌

[Get the Wechat Access Token 获取微信访问令牌](http://mp.weixin.qq.com/wiki/14/9f9c82c1af308e3b14ba9b973f99a8ba.html)
```ruby
response = Wechat::Core::AccessToken.load Rails.application.secrets.wechat_app_id, Rails.application.secrets.wechat_app_secret
if response.present?
  access_token = response['access_token']
  expires_in   = response['expires_in']
end
```

### Follower 关注者

[Get the Follower List 获取关注者列表](http://mp.weixin.qq.com/wiki/0/d0e07720fc711c02a3eab6ec33054804.html)
```ruby
response = Wechat::Core::Follower.index access_token
if response.present? && 0==response['errcode'].to_i
  total        = response['total']
  count        = response['count']
  next_open_id = response['next_openid']
  data         = response['data']
  data['openid'].each do |open_id|
    # Show open_id
  end
else
  # Show response['errmsg']
end
```

[Get the Follower List with Pagination 分页获取关注者列表](http://mp.weixin.qq.com/wiki/0/d0e07720fc711c02a3eab6ec33054804.html)
```ruby
response = Wechat::Core::Follower.index access_token, next_open_id
if response.present? && 0==response['errcode'].to_i
  total        = response['total']
  count        = response['count']
  next_open_id = response['next_openid']
  data         = response['data']
  data['openid'].each do |open_id|
    # Show open_id
  end
else
  # Show response['errmsg']
end
```

[Get the Follower Profiles by Batch 批量获取关注者轮廓](http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html#.E6.89.B9.E9.87.8F.E8.8E.B7.E5.8F.96.E7.94.A8.E6.88.B7.E5.9F.BA.E6.9C.AC.E4.BF.A1.E6.81.AF)
```ruby
response = Wechat::Core::FollowerProfile.index access_token, [ open_id_1, open_id_2, ... ]
if response.present? && 0==response['errcode'].to_i
  response['user_info_list'].each do |profile|
    subscribed     = profile['subscribe']
    open_id        = profile['openid']
    nick_name      = profile['nickname']
    sex            = profile['sex']
    language       = profile['language']
    city           = profile['city']
    province       = profile['province']
    country        = profile['country']
    portrait_link  = profile['headimgurl']
    subscribe_time = profile['subscribe_time']
    union_id       = profile['unionid']
    remark         = profile['remark']
    group_id       = profile['groupid']
  end
else
  # Show response['errmsg']
end
```

[Get the Follower Profile 获取用户基本信息](http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html#.E8.8E.B7.E5.8F.96.E7.94.A8.E6.88.B7.E5.9F.BA.E6.9C.AC.E4.BF.A1.E6.81.AF.EF.BC.88.E5.8C.85.E6.8B.ACUnionID.E6.9C.BA.E5.88.B6.EF.BC.89)
```ruby
response = Wechat::Core::FollowerProfile.load access_token, open_id
if response.present? && 0==response['errcode'].to_i
  subscribed     = response['subscribe']
  open_id        = response['openid']
  nick_name      = response['nickname']
  sex            = response['sex']
  language       = response['language']
  city           = response['city']
  province       = response['province']
  country        = response['country']
  portrait_link  = response['headimgurl']
  subscribe_time = response['subscribe_time']
  union_id       = response['unionid']
  remark         = response['remark']
  group_id       = response['groupid']
else
  # Show response['errmsg']
end
```

### Server Address 服务器地址

[Get Server Addresses 获取服务器地址](http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html)
```ruby
response = Wechat::Core::ServerAddress.index access_token
if response.present? && 0==response['errcode'].to_i
  response['ip_list'].each do |ip_address|
    # Do something with the IP Address...
  end
else
  # Show response['errmsg']
end
```

### Tiny Link 短链接

[Generate Tiny Link 长链接转短链接接口](http://mp.weixin.qq.com/wiki/10/165c9b15eddcfbd8699ac12b0bd89ae6.html)
```ruby
response = Wechat::Core::TinyLink.create access_token, 'http://product.company.com/promotion/page.html'
if response.present? && 0==response['errcode'].to_i
  tiny_link = response['short_url']
else
  # Show response['errmsg']
end
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/topbitdu/wechat-core. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

repository: topbitdu/wechat-core

repo_name: topbitdu/wechat-core


text:
# Contributing to Sinon.JS

        There are several ways of contributing to Sinon.JS

        * Help [improve the documentation](https://github.com/sinonjs/sinon-docs) published at [the Sinon.JS website](http://sinonjs.org)
        * Help someone understand and use Sinon.JS on [the mailing list](http://groups.google.com/group/sinonjs)
        * Report an issue, please read instructions below
        * Help with triaging the [issues](http://github.com/cjohansen/Sinon.JS/issues). The clearer they are, the more likely they are to be fixed soon.
        * Contribute to the code base.

        ## Reporting an issue

        To save everyone time and make it much more likely for your issue to be understood, worked on and resolved quickly, it would help if you're mindful of [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) when pressing the "Submit new issue" button.

        As a minimum, please report the following:

        * Which environment are you using? Browser? Node? Which version(s)?
        * Which version of SinonJS?
        * How are you loading SinonJS?
        * What other libraries are you using?
        * What you expected to happen
        * What actually happens
        * Describe **with code** how to reproduce the faulty behaviour

        See [our issue template](https://github.com/sinonjs/sinon/blob/master/.github/) for all details.

        ## Contributing to the code base

        Pick [an issue](http://github.com/cjohansen/Sinon.JS/issues) to fix, or pitch
        new features. To avoid wasting your time, please ask for feedback on feature
        suggestions either with [an issue](http://github.com/cjohansen/Sinon.JS/issues/new)
        or on [the mailing list](http://groups.google.com/group/sinonjs).

        ### Making a pull request

        Please try to [write great commit messages](http://chris.beams.io/posts/git-commit/).

        There are numerous benefits to great commit messages

        * They allow Sinon.JS users to easily understand the consequences of updating to a newer version
        * They help contributors understand what is going on with the codebase, allowing features and fixes to be developed faster
        * They save maintainers time when compiling the changelog for a new release

        If you're already a few commits in by the time you read this, you can still [change your commit messages](https://help.github.com/articles/changing-a-commit-message/).

        Also, before making your pull request, consider if your commits make sense on their own (and potentially should be multiple pull requests) or if they can be squashed down to one commit (with a great message). There are no hard and fast rules about this, but being mindful of your readers greatly help you author good commits.

        ### Use EditorConfig

        To save everyone some time, please use [EditorConfig](http://editorconfig.org), so your editor helps make
        sure we all use the same encoding, indentation, line endings, etc.

        ### Installation

        The Sinon.JS developer environment requires Node/NPM. Please make sure you have
        Node installed, and install Sinon's dependencies:

        $ npm install

        This will also install a pre-commit hook, that runs style validation on staged files.

        #### PhantomJS

        In order to run the tests, you'll need a [PhantomJS](http://phantomjs.org) global.

        The test suite runs well with both `1.9.x` and `2.0.0`

        ### Compatibility

        #### ES5.1

        Sinon's source is written as [ES5.1][ES5] and requires no transpiler or polyfills.

        Sinon.JS uses feature detection to support [ES6][ES6] features, but does not rely on any of the new syntax introduced in [ES6][ES6] and remains compatible with [ES5.1][ES5] runtimes.

        #### Runtimes

        Sinon.JS aims at supporting the following runtimes:

        * Firefox 45+
        * Chrome 48+
        * Internet Explorer 11+
        * Edge 14+
        * Safari 9+
        * Node LTS versions

        ### Style

        Sinon.JS uses [ESLint](http://eslint.org) to keep consistent style. You probably want to install a plugin for your editor.

        The ESLint test will be run before unit tests in the CI environment, your build will fail if it doesn't pass the style check.

        ```
        $ npm run lint
        ```

        To ensure consistent reporting of lint warnings, you should use the same version as CI environment (defined in `package.json`)

        ### Run the tests

        Following command runs unit tests in PhantomJS, Node and WebWorker

        $ npm test

        ##### Testing in development

        Sinon.JS uses [Mocha](https://mochajs.org/), please read those docs if you're unfamiliar with it.

        If you're doing more than a one line edit, you'll want to have finer control and less restarting of the Mocha

        To start tests in dev mode run

        $ npm run test-dev

        Dev mode features:
        * [watching related files](https://mochajs.org/#w---watch) to restart tests once changes are made
        * using [Min reporter](https://mochajs.org/#min), which cleans the console each time tests run, so test results are always on top

        Note that in dev mode tests run only in Node. Before creating your PR please ensure tests are passing in Phantom and WebWorker as well. To check this please use [Run the tests](#run-the-tests) instructions.

        ### Compiling a built version

        Build requires Node. Under the hood [Browserify](http://browserify.org/) is used.

        To build simply run

        $ node build.js

        [ES5]: http://www.ecma-international.org/ecma-262/5.1/
        [ES6]: http://www.ecma-international.org/ecma-262/6.0/

repository: michalbluj/CeasarsOffers

repo_name: michalbluj/CeasarsOffers


text:
入侵检测介绍
================

Introducing Intrusion Detection

Have you ever wondered what was happening on your network at any given time?

_在某个时间你是否想过你的网络发生了什么事情。。_

What about the type of traffic trying to get to a server on your network?

_某种特殊的流量试图通过你的网络到达服务器？_

Intrusion detection is the act of detecting events that have been deemed inappropriate or unwelcome by the business,
organizational unit, department, or group.

_入侵检测被商业、机构单位、部门、组织用来检测那些不是很合适或者令人讨厌的行为事件_

This can be anything from the emailing of company
secrets to a competitor, to malicious attacks from a host on the Internet, to the viewing of
inappropriate Web content during your lunch break.

_当然这些行为事件包括很多。从发送商业机密到竞争对手的邮件 到来自互联网主机的破坏攻击,再到在你午休都偷看私人网络内容_

Intrusion detection can be performed manually, by inspecting network traffic and logs from
access resources, or automatically, using tools.

_入侵检测可以手动或者通过工具自动的检测网络流量特性与访问主机而产生的日志文件_

A tools used to automate the processing of intrusion-related information is typically classified as an intrusion detection system (IDS).

_能自动处理与入侵检测相关信息的工具可以称为入侵检测系统_

Before understanding how the Open Source Security (OSSEC) host intrusion detection
system (HIDS) works, we should first review the differences between an HIDS and a network
intrusion detection system (NIDS).

_在了解开源软件主机入侵检测系统(ossec)如何工作之前。我们最好能先来看下 主机入侵检测hids与网络入侵检测nids的区别._

repository: xiyoulaoyuanjia/bookmarkdown

path: /example/OSSEC Host-Based Intrusion Detection Guide/chapters/01.markdown

extension: markdown

repo_name: xiyoulaoyuanjia/bookmarkdown


text:
## Set up dev environment
1. Download [Android Studio](http://developer.android.com/sdk/index.html)
2. Download [Android SDK](http://developer.android.com/sdk/installing/index.html?pkg=studio) and config
3. Get [Additional SDK packages](http://developer.android.com/sdk/installing/adding-packages.html)
4. Set up [Virtual Devices](http://developer.android.com/tools/devices/index.html) / personally I recommend [Genymotion](https://www.genymotion.com/)
5. Or you can use your real device for [test](http://developer.android.com/tools/device.html)

## How to run "Oh My Product Hunt"

### Solution One: For non-git users
1. Download the "Oh My Product Hunt" [zip package](https://github.com/hhua/product-hunt-android/archive/master.zip)
2. Unzip the package
3. Use Android Studio to open the unpackaged folder. Android Studio will build the app for you
4. Create an app on [Product Hunt API console](https://api.producthunt.com/v1/oauth/applications). Keep your API key, API secret and callback url
5. Fill your information [here](https://github.com/hhua/product-hunt-android/blob/master/app/src/main/java/com/hhua/android/producthunt/utils/ApiConfig.java#L5)
6. You also need to update [AndroidManifest](https://github.com/hhua/product-hunt-android/blob/master/app/src/main/AndroidManifest.xml#L39-L41)
7. [Build the app](http://developer.android.com/tools/building/building-studio.html), and you should see app running in either virtual device or your Android phone

### Solution Two: For git users
1. git clone git@github.com:hhua/product-hunt-android.git
3. Use Android Studio to open the downloaded folder. Android Studio will build the app for you.
4. Create an app on [Product Hunt API console](https://api.producthunt.com/v1/oauth/applications). Keep your API key, API secret and callback url
5. Fill your information [here](https://github.com/hhua/product-hunt-android/blob/master/app/src/main/java/com/hhua/android/producthunt/utils/ApiConfig.java#L5)
6. You also need to update [AndroidManifest](https://github.com/hhua/product-hunt-android/blob/master/app/src/main/AndroidManifest.xml#L39-L41)
7. [Build the app](http://developer.android.com/tools/building/building-studio.html), and you should see app running in either virtual device or your Android phone

## Contribute
1. Make a PR against master branch


text:
### Description

Click on a sphere to highlight it. The picked sphere color changes to red, and its EdgeVisibity is On. The example subclasses vtkInteractorStyleTrackballCamera with a local class called **MouseInteractorHighLightActor**. The new interactor overrides the *OnLeftButtonDown* of vtkInteractorStyleTrackballCamera.

!!! seealso
    [HighlightWithSilhouette](../HighlightWithSilhouette) generates a silhouette of the picked actor.

repository: Kitware/vtk-examples

repo_name: Kitware/vtk-examples


text:
---
title: About this blog
slug: about
author: Jérôme Schneider
date: 2014-06-01 12:00
status: publish

image: nose-up-low.jpg
about: [this blog, pulpy]
comments: off
---
Use this post as a way to present yourself to your audience.

**Pulpy** offers a way to define a special **About** page in your blog, simply by creating an **About** post.

To link the **About** button of the theme to this post, you'll have to define the parameter `site.about.slug` to the **slug** of this post (in this example post, the slug is: `about`).

You may mention **Pulpy** in this post, if you want. Should you need it, here's a ready to use informational paragraph about **Pulpy**:

This blog is powered by [**Pulpy**](http://netgusto.com/pulpy), a deliciously simple Markdown blog system, based on Silex.

repository: netgusto/PPSilex

repo_name: netgusto/PPSilex


text:
## Description

Simple quiz made in laravel

## Installation

- Clone repo

### in root folder
- rename .env.example to .env
- DB_PASSWORD:your_password

### in terminal run
- composer install
- npm install
- php artisan key:generate
- php artisan migrate
- php artisan serve

### ASSIGNMENT

-   Controllers
-   Migrations
-   HTTP Tests (on all routes)
-   Laravel Mix
-   Middleware
-   Models (with relationships)
-   Routes (with route model binding)
-   Eloquent
-   Relationships
-   Validation
-   Views (Blade)

### Review by Evelyn
- You could redirect back the _guest_ user that tries to access the `/dashboard` route. Right now it just says "route not defined".
- `web.php:33` You could change `Route::get('quiz/{id}', 'App\Http\Controllers\QuizController@show');` to `Route::get('quiz/{id}', [QuizController::class, 'show');` which is more modern Laravel syntax to call specific methods on the controllers
- You could add PHP CodeSniffer to your project if you want to check the coding standard directly from the command line. Running `./vendor/bin/phpcs` will give you a list of files that need fixing, while `./vendor/bin/phpcbf` fixes some, if not all, those problems for you automatically.
- `Quizz.php` Everything in there could have been stored in the database and passed to your view through a controller.
- Same with `quiz.blade.php` you could have grabed the data from the controller and no need to use `@php`
- Maybe a little navigation to go back to the dashboard if you dont feel like taking a test would be nice
- If I try to create an user with a very short email I cannot register. Make it so that the user can create an account with whatever email length
- Make sure to also send some errors when the user didnt meet the criteria for creating a new account
- `RegisterController` you could use the `Auth()` facade. Even though it works right now, the `login` method appears marked as `undefined method` by VSCode
- `UserScores.php:14` you could change that line to `return $this->belongsTo(User::class);` works the same but its clearer that you are referencing the User model.

## Backlog

- Elaborate testing
- Actually write a quiz(?)
- Write a backlog

repository: emilvictor/Code-Quiz

repo_name: emilvictor/Code-Quiz


text:
PondTunes
=========

PondTunes is a PHP 5.3+ library to query the Apple iTunes Store. It is the successor of
https://github.com/daFish/Zend_Service_Itunes.

This library is still under development but feel free to contribute in any way.

Installation:
-------------

Add PondTunes to your `composer.json`:

```js
{
    "require": {
        "pond/tunes": "*"
    }
}
```

Use PondTunes?
---------------------

Basic example of querying the Apple iTunes Store API:

```php
<?php

use Pond\Tunes\Search;
use Pond\Tunes\Tunes;

$search = new Search();
$search->setTerms('angry birds')
       ->setEntity(array(Tunes::MEDIATYPE_SOFTWARE => 'software'));

$result = $search->request();
```

*$result* contains the result in JSON. You can easily return this result in any AJAX-request.

repository: JMSBot/pondtunes

repo_name: JMSBot/pondtunes


text:
ACR Notifications Plugin for Xamarin and Windows
===

Installation:
---
Install the nuget package in your platform project as well as your shared library.

Send a notification:

    Notifications.Instance.Send("My Title", "My message for the notification");

Send a scheduled notification:

    Notifications.Instance.Send("Happy Birthday", "I sent this a long time ago", when = TimeSpan.FromDays(50));

Cancel all scheduled notifications and clear badge:

    Notifications.Instance.CancelAll();

To set a badge (excluding android):

    Notifications.Instance.Badge = 4; // TODO: 0 clears badge

license: MS-PL

repository: dinhchitrung/notifications

repo_name: dinhchitrung/notifications


text:
## Overview

Created an employee directory with React using components and largely the mdbreact framework.

## User Story

* As a user, I want to be able to view my entire employee directory at once so that I have quick access to their information.

## Business Context

An employee or manager would benefit greatly from being able to view non-sensitive data about other employees. It would be particularly helpful to be able to filter employees by name.

## Screenshot
![screenshot](./screenshot.png)

## Links

* the URL to the deployed application
https://peaceful-shelf-39833.herokuapp.com/

* the URL to the Github repository
https://github.com/Bscott95/employee-directory

## License
Licensed under the MIT License
Copyright 2020 Brandon Scott


text:
## **Intro to CV and Python** [(slides)](/pages/c_01_intro_to_CV_and_Python/class_slides/)

- [Python, Pycharm & packages installation guide](/pages/python_pycharm_installation/python_pycharm_installation/)
- Course details
- What is computer vision (CV)?
- Course outline
- Intro to Python
  - [Basic python tutorial notebook- part 1](/pages/c_01_intro_to_CV_and_Python/basic_python_tutorial_nb/)
  - [Basic python tutorial notebook- part 2](/pages/c_01_intro_to_CV_and_Python/basic_python_tutorial_part_2_nb/)
  - [NumPy tutorial notebook](/pages/c_01_intro_to_CV_and_Python/NumPy_tutorial_nb/)
  - [Matplotlib tutorial notebook](/pages/c_01_intro_to_CV_and_Python/Matplotlib_tutorial_nb/)
  - [OpenCV tutorial notebook](/pages/c_01_intro_to_CV_and_Python/OpenCV_tutorial_nb/)
- [Ex1: basic python, numpy & matplotlib, opencv](/pages/c_01_intro_to_CV_and_Python/ex1/)


text:
# OneTime
Time-based One Time Password (TOTP) generator

Usage
-----

totp = OneTime.new('secret-token').generate

**Constructor's options:**

- length: final password length (int). Default: 6
- encryption: encryption algorithm, supports SSL supported algoritms (string). Default: 'SHA512'
- step: time step for password generation, in seconds (int). Default: 30

Example: totp = OneTime.new('secret-token', length: 10, step: 10, encryption: 'SHA1')

----------------------
**Methods:**

 - generate(time = Time.now, length: self.length, step: self.step, encryption: self.encryption)
    *Generates a password with the given options and stores it in self.password*

 - verify('password to verify', time: Time.now, length: self.length, step: self.step, encryption: self.encryption)
    *Verifies a given password against a newly generated (with options)*

 - call_service(url, user, payload, content_type: 'application/json', accept: '*/*')
    *Sends a request to the specified url, user and payload. If a password wasn't generated previously it generates one using current timestamp.*

repository: fboccacini/OneTime

repo_name: fboccacini/OneTime


text:
---
title: Heraclitus
date: 2020-07-15 04:00
revised: 2020-07-15 04:00
category: Philosophers
tags: [pre-socratic, greek, cosmologist]
---
Born some time around 535 BC.
Died some time around 475 BC (age ~60).

Heraclitus was an Ionian philospher. He was born into wealth and a hereditary political office, but eschewed it to pursue philosophy. He was well known for his depressive, misanthropic character and witty word play.

Heraclitus was the first recorded Greek philosopher to declare that the world is in a state of flux: an ever-changing state of becoming. This idea is captured by his famous quote, "No man ever steps into the same river twice."

Heraclitus also believed in conflict between opposites. However, whereas Anaximander saw conflict between opposites as a destabilizing force, Heraclitus saw it as a healthy state of tension. Heraclitus was the first recorded Greek philsopher to propose the idea of "unity in diversity". Multiple opposing forces balance the world, like the tension in a bow or a lyre. For this reason, Heraclitus declared that the world is ultimately composed of fire, since it best exemplifies this tension: fire needs fuel to burn, but if it burns all of the fuel then it dies. He postulated that the different kinds of observable matter must be the result of different kinds of fires, which balance each other. Thus, while matter may temporarily change, the overall amount of matter is preserved.

Heraclitus' contribution to philosophy is his idea of "unity in diversity". He continued the trend of attempting to relate the popular philosophical speculations of his day to real world experience.


text:
---
layout: post
title: "Bats"
date: 2014-08-02 12:06
comments: true
toc: false
published: true
categories:
  - shell
  - testing
---

Shell scripting is a great tool, but rarely is it tested.  Enter [BATS](https://github.com/sstephenson/bats)!  In this post I will give a quick tutorial on how to use it to test scripts.

```bash
#!/usr/bin/env bats

@test "running a command" {
  run foogrep "bar" foo_file
  [ "$status" -eq 1 ]
  [ "$output" = "1: bar baz" ]
}
```

<!-- more -->

Shameless plug: Before we start, I recommend downloading the language grammar package - [language-bats](https://atom.io/packages/language-bats) for the Atom editor.

If you have never used [RSpec](http://rspec.info) or other testing framework the idea is simple: your code is run against expectations and if those are met then the tests pass.  The framework deals with the heavy lifting of executing the tests, printing the results, and providing to the correct interface to Continuous Integration servers.

BATS is a test runner for Bash scripts.  Before it each run BATS takes the file and splits each test into its own file.  BATS then runs each test file to see if passes or fails.  Anything you can do in Bash you can do in BATS, and if any command fails then the entire test fails.

## A Basic test

BATS syntax for a test is `@test "desc" {}`.  But if you want it to run the file individually you should add the shebang line.  The simplest test looks something like this:

```bash
#!/usr/bin/env bats

@test "something" {
  false
}
```

This isn't very useful, but it will generate a failing test.

### Skipping tests

Simetimes it is a useful to skip a test.  Just add `skip` at the point you want to the test to be skipped.  You can add a description or not.

```bash
@test "just skip" {
  skip
}

@test "skip for a reason" {
  if [ "$x" == "foo"]; then
    skip "Because of foo"
  fi

  # more tests
}
```

### Running a command

Bash doesn't let you return strings from functions, so if you are trying to capture output and status then you have to roll your own, or use `run`.  `run` returns the commands output to `$output`, and its exit code to `$status`.  This makes testing on output and status easier.

```bash
@test "check output and status" {
  run echo_foo
  [ "$status" == "0" ]
  [ "$output" == "foo" ]
}
```

### Hooks

Sometimes multiple tests need to share the same state.  In testing every test should stand on its own and leave no artifacts.  To accomplish this we can use the `setup` and `teardown` hooks.

```bash

setup() {
  mkdir -p /tmp/output
}

teardown() {
  rm -rf /tmp/output
}

@test "writes files" {
  write_files_to "/tmp/output"
  run "ls /tmp/output"
  [ "$output" == "1" ]
}
```

repository: jkamenik/orig-blog

branch_name: refs/heads/draft

repo_name: jkamenik/orig-blog


text:
---
title: getRemoteInfo
sidebar_label: getRemoteInfo
id: version-0.70.7-getRemoteInfo
original_id: getRemoteInfo
---

List a remote servers branches, tags, and capabilities.

| param        | type [= default]             | description                                                                                |
| ------------ | ---------------------------- | ----------------------------------------------------------------------------------------------------------- |
| core         | string = 'default'           | The plugin core identifier to use for plugin injection                                                      |
| **url**      | string                       | The URL of the remote repository. Will be gotten from gitconfig if absent.                                  |
| corsProxy    | string                       | Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.  |
| forPush      | boolean = false              | By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities. |
| noGitSuffix  | boolean = false              | If true, clone will not auto-append a `.git` suffix to the `url`. (**AWS CodeCommit needs this option**)    |
| username     | string                       | See the [Authentication](./authentication.html) documentation                                               |
| password     | string                       | See the [Authentication](./authentication.html) documentation                                               |
| token        | string                       | See the [Authentication](./authentication.html) documentation                                               |
| oauth2format | string                       | See the [Authentication](./authentication.html) documentation                                               |
| headers      | object                       | Additional headers to include in HTTP requests, similar to git's `extraHeader` config                       |
| return       | Promise\<RemoteDescription\> | Resolves successfully with an object listing the branches, tags, and capabilities of the remote.            |

The object returned has the following schema:

```ts
type RemoteDescription = {
  capabilities: Array<string>; // The list of capabilities returned by the server (part of the Git protocol)
  refs: {
    heads: Object<string, string>; // The branches on the remote
    pull: Object<string, string>; // The special branches representing pull requests (non-standard)
    tags: Object<string, string>; // The tags on the remote
  };
}
```

This is a rare command that doesn't require an `fs`, `dir`, or even `gitdir` argument.
It just communicates to a remote git server, using the first step of the `git-upload-pack` handshake, but stopping short of fetching the packfile.

Example Code:

```js live
let info = await git.getRemoteInfo({
  url:
    "$input((https://cors.isomorphic-git.org/github.com/isomorphic-git/isomorphic-git.git))"
});
console.log(info);
```

<script>
(function rewriteEditLink() {
  const el = document.querySelector('a.edit-page-link.button');
  if (el) {
    el.href = 'https://github.com/isomorphic-git/isomorphic-git/edit/main/src/commands/getRemoteInfo.js';
  }
})();
</script>

repository: isomorphic-git/isomorphic-git

repo_name: isomorphic-git/isomorphic-git


text:
---
title: "CS11 Intro C++: Lecture 3"
author: haruair
type: page
date: "2020-05-18T15:24:00"
lang: en
url: /note/cs-11-intro-cpp/lecture-3
linkToParent: true
tags:
  - cs11
---

## File I/O

Use `fstream` like `iostream`.

- `ifstream`: for reading
- `ofstream`: for writing
- `fstream`: for both

```cpp
vector<double> read_data(string filename) {
  ifstream ifs{filename};
  vector<double> data;

  // Make sure the file was opened successfully
  if (!ifs.is_open()) // or if(!ifs)
    throw illegal_argument("Couldn't open file");

  // Read data until we hit EOF
  while (ifs.good()) { // or while(ifs)
    double v;
    ifs >> v;
    data.push_back(v);
  }
  return data;
}
```

Streams can be used in conditional expressions. (Check the comment above.)

`ifstream` destructor will automatically close the file when the `ifs` object goes out of scope. If it need to be closed, there is a member function `close()`.

## Variable Scope

A variable's scope is the part of the program where the variable is _accessible_.

- Narrow the scope as small as possible
  - Declare variables when/where you actually need them
  - Reduce bug, name conflicts, etc.
- When an object variable goes out of scope, its destructor is called automatically (only for non-primitive types)

## Function Arguments

Arguments are **pased by value** as a default. The function receives a copy of the arguments, not the original.

**Passing arguments by references** will be preferred when the data is too big to copy it.

```cpp
// use `&`
double compare_something_heavy(vector<double> &values) {
  //...
```

The function can change the original value when it passed by reference.

It is able to specify that argument's value cannot change by using `const` modifier.

```cpp
double compute_average(const vector<double> &values) {
  // Function signature need to be matched declaration and definition
  //...
```

## Guidelines

- Passing an object
  - Pass by reference and state `const` if there is no modification.
  - Pass by value if the mutation should not affect the caller.
- Passing a primitive
  - Pass by value because it is generally small and fast enough.
  - Pass by reference if it need to be modified.

## `const` and user-defined classes

Define `const` on member functions when the member functions are not mutating any data.

```php
class Point {
  // ...
  double get_x() const; // Accessors
  double get_y() const;
  // ...
}

double Point::get_x() const {
  // ...
}
// ...
```

---

## Coming up next

- [Lecture 4](/note/cs-11-intro-cpp/lecture-4): GNU make, Doxygen


text:
# Talk on Generators

Useful ideas on generators

### Prerequisites

Global installation of Typescript, with `tsc` command.

### Build and Run

```
npm install
npm start
```

**Note:** Nothing useful will happen when you run the code, until you have pasted in the demo code.

## Elements of the Talk

### Generic iteration
```typescript

const gloriousStateful = function*(seed = 10) {
	let state = seed

	while (true) {
		yield ++state
	}
}

	// Using it
	const gen = gloriousStateful()

	for (const i of Iterable.range(0, 4)) {
		const {value, done} = gen.next()
		console.log(`Got value: ${value} done: ${done}`)
	}

```

### Passing Values to the Generator

```typescript
const communicative = function*() {
	let value = 99
	while (true) {
		value = yield value + 10
	}
}

	const gen = communicative()

	for (const i of Iterable.range(0, 4)) {
		const {value, done} = gen.next(i)
		console.log(`Got value: ${value} done: ${done}`)
	}
```

**Issue** Note the inconsitency in the first iteration.
**Issue** Mutable state

### Recursive

```typescript

const recursive = function*(seed = 10) {
	yield seed
	yield* recursive(seed + 1)
}

```

### Spreading finite gen into array

```typescript
const finite = function*(seed = 10) {
	yield seed
	if (seed < 12) {
		yield* finite(seed + 1)
	}
}

	const gen = finite()

	const arr = [...gen]
	console.log(arr)
```

### Iterating in for loop

```typescript
	const gen = finite()

	for (const val of gen) {
		console.log(val)
	}
```

### Using Ixjs to Achieving Gloriousness

```typescript
	const gen = finite()
	const iter = Iterable.from(gen)

	for (const val of iter.filter(x => x > 10).take(1)) {
		console.log(val)
	}

	// Tip: add a log statement to the inner loop of `finite` to see how many times it actually runs.
```

### init.ts - Sagas and Listen

```typescript
	const {store, sagaMiddleware} = setupShop()
	sagaMiddleware.run(greetingLoop)
	const router = createRouter(store)

	listen(app => {
		app.use("/", router)
	})

	// Look at `greetingLoop` for the actual content.
```

## Usage

### CURLing Greets

```
curl -X POST http://<IP_ADDRESS>:3000/greeting --data '{"greeting":"Heisann"}' --header "Content-Type: application/json" -w "\n"
```

repository: tvedtorama/generators-talk

gha_language: TypeScript

repo_name: tvedtorama/generators-talk


text:
# SPARQL-Generate and SPARQL-Template Java API

*This document is for versions 2.x.x onward. For previous versions, check out [the documentation for versions 1.x.x](http://w3id.org/sparql-generate/get-started-v1.html)*

`sparql-generate-jena` is an implementation of SPARQL-Generate and SPARQL-Template over Apache Jena. Its binaries, sources and documentation are available for download at [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Csparql-generate-jena%22). To use it in your Maven project, add the following dependency declaration to your Maven project file ( `*.pom` file):

```xml
<dependency>
    <groupId>fr.emse.ci</groupId>
    <artifactId>sparql-generate</artifactId>
    <version>${sparql-generate.version}</version>
</dependency>
```

Parse a query as follows:

```java
 String queryString = "........";
 SPARQLExtQuery query = (SPARQLExtQuery) QueryFactory.create(queryString, SPARQLExt.SYNTAX);
```

Then, use class `PlanFactory` to instantiate a `RootPlan` for that query.

```java
RootPlan plan = PlanFactory.create(query);
```

Then the `RootPlan` can be executed multiple times against different Datasets and Documentsets.

To instantiate a `Dataset`, one may use:

```java
Dataset dataset = DatasetFactory.create();
```

The engine fetches queries and documents on the Web if no mapping to local files is provided. Such mappings can be created using [Jena's `StreamManager` mechanism](http://jena.apache.org/documentation/io/rdf-input.html#streammanager-and-locationmapper). The following snippet illustrates how this is achieved:

```java
LocatorFileAccept locator = new LocatorFileAccept(new File("directory").toURI().getPath());
LocationMapperAccept mapper = new LocationMapperAccept();
mapper.addAltEntry("http://example.org/file1.json", "local/file/system/file1.json");
mapper.addAltEntry("http://example.org/file2.csv", "local/file/system/file2.csv");
SPARQLExtStreamManager sm = SPARQLExtStreamManager.makeStreamManager(locator, mapper);
```

The `StreamManager` is then used to instantiate the execution `Context`.

```java
// create the query execution context
Context context = SPARQLExt.createContext(sm);
```

Finally, call one of the `exec` methods to trigger the RDF generation, depending on the type of the query.

```java
Model     output = plan.execGenerate(dataset, context);
ResultSet output = plan.execSelect  (dataset, context);
String    output = plan.execTemplate(dataset, context);
```

**Remember:** The [javadoc](http://w3id.org/sparql-generate/apidocs/index.html) contains comprehensive documentations and examples, and the [sources](https://github.com/sparql-generate/sparql-generate) contain unit tests and other examples.

repository: EthanLoveQueen/sparql-generate

repo_name: EthanLoveQueen/sparql-generate


text:
# Reformers - Efficient Transformers

This repository containes implementations of reformers as described in the following paper - [https://openreview.net/pdf?id=rkgNKkHtvB](https://openreview.net/pdf?id=rkgNKkHtvB). The following repository contains implementations of reformers in PyTorch as well as Tensorflow Keras. We will be performing more experiments on these over the course of time.

## Install

clone the repository locally and install dependencies using pip install. The dependencies are present in the `requirements.txt` file.

## Usage

### PyTorch

```python
import torch
from reformers import ReformerLM

model = ReformerLM(
    num_tokens= 20000,
    emb = 512,
    depth = 12,
    max_seq_len = 8192,
    heads = 8,
    lsh_dropout = 0.1,
    causal = True,        # auto-regressive or not
    bucket_size = 64,     # average size of qk per bucket, 64 was recommended in paper
    n_hashes = 4,         # 4 is permissible per author, 8 is the best but slower
    ff_chunks = 200,      # number of chunks for feedforward layer, make higher if there are memory issues
    weight_tie = False,   # tie parameters of each layer for no memory per additional depth
    attn_chunks = 8,        # process lsh attention in chunks, only way for memory to fit when scaling to 16k tokens
    use_full_attn = False   # use full self attention, for comparison
).cuda()

x = torch.randint(0, 20000, (1, 8192)).long().cuda()
y = model(x) # (1, 8192, 20000)
```

```python
import torch
from reformers import Reformer

model = Reformer(
    emb = 512,
    depth = 12,
    max_seq_len = 8192,
    heads = 8,
    lsh_dropout = 0.1,
    causal = True
).cuda()

x = torch.randn(1, 8192, 512).cuda()
y = model(x) # (1, 8192, 512)
```

### Tensorflow

```python
model_tf = TFReformerLM(
    num_tokens= 20000,
    emb = 512,
    depth = 1,
    max_seq_len = 32000,
    heads = 8,
    lsh_dropout = 0.1,
    causal = True,        # auto-regressive or not
    bucket_size = 64,     # average size of qk per bucket, 64 was recommended in paper
    n_hashes = 4,         # 4 is permissible per author, 8 is the best but slower
    ff_chunks = 1600,      # number of chunks for feedforward layer, make higher if there are memory issues
    weight_tie = False,   # tie parameters of each layer for no memory per additional depth
    attn_chunks = 8,        # process lsh attention in chunks, only way for memory to fit when scaling to 16k tokens
    use_full_attn = False   # use full self attention, for comparison
)

model_tf.build(input_shape=(1,32000))
model_tf.summary()

# Model: "tf_reformer_lm"
# _________________________________________________________________
# Layer (type)                 Output Shape              Param #
# =================================================================
# embedding (Embedding)        multiple                  10240000
# _________________________________________________________________
# embedding_1 (Embedding)      multiple                  16384000
# _________________________________________________________________
# tf_reformer (TFReformer)     multiple                  2888704
# _________________________________________________________________
# dense_5 (Dense)              multiple                  10260000
# =================================================================
# Total params: 39,772,704
# Trainable params: 39,772,704
# Non-trainable params: 0
```

Source for PyTorch code - [https://github.com/lucidrains/reformer-pytorch](https://github.com/lucidrains/reformer-pytorch)

repository: tarun-ssharma/ml

path: /midi data/reformers-master/README.md

repo_name: tarun-ssharma/ml


text:
# Overview

Provide a high level overview of CloudState, the concepts, how the proxy communicates with the user function, manages state, associates commands with entities via entity keys, etc.

A general glossary of terms should be introduced, eg, what's a command, entity keys, etc.

@@@ index

* [gRPC descriptors](grpc.md)
* [Event sourcing](eventsourced.md)
* [Conflict-free Replicated Data Types](crdts.md)
* [Forwarding and effects](effects.md)

@@@

repository: shankarshastri/cloudstate

repo_name: shankarshastri/cloudstate


text:
# Projects

If you are conducting research / development and would like to open-source
deep-learning based solutions for problems making use of 3D / computer graphics
techniques, we would love to host your project in TensorFlow Graphics!

If you want your project directly hosted and distributed by TensorFlow Graphics,
you can put your work under **tensorflow_graphics/projects/PROJECT_NAME**. As a
project owner, you set the bar in terms of code quality, style, and tests. The
only requirement is a description of your project and how to use it inside
**tensorflow_graphics/projects/PROJECT_NAME/README.md** and at least one test
that makes sure that your project runs. If your project is linked to a
publication, make sure to also include a link to the paper and a bibtex
describing how to cite your work.

If you have specific needs or requests, feel free to contact us at
<EMAIL_ADDRESS>we would love to work with you to find a
solution that fits your project!

repository: tensorflow/graphics

gha_language: Python

repo_name: tensorflow/graphics


text:
# Python source

## Testing
I want to maximize test coverage,
within reason.
Most functions can be tested easily,
but some have side-effects
that make testing
more difficult and costly
in time and effort.
Testing side-effects
often means
making use of mock implementations.
I tend to put off (for now)
the effort to implement mocks
since I need to research
how best to do that
in Python.
I justify putting off those tests
in part because I feel that the code
gets tested for those side-effects
during real use.
Nonetheless,
I do still want to improve
my test coverage
by eventually adding proper tests
that address those side-effects.
On the other hand,
I do not want that lack of such tests
to skew my test coverage metrics.
The easy solution is to exclude
functions with side-effects
from my test coverage reporting.
However,
the current test coverage configuration
only supports such exclusion
at the granularity of an entire source file.
There probably exists a way to mark
a particular function
as being excluded from test coverage,
but I have not researched that yet.
Therefore,
it is useful to refactor functions
to separate them into source files
that I exclude versus those that I include
in my test coverage.
Some exclusions are likely to be permanent
as I have decided that the side-effects
are not worth the effort to test.
But I do want to eventually
implement tests for many side-effects
that are tractable.

Therefore,
my testing approach
involves separating functions
into three categories:
* functions without side-effects
* functions with side-effects that I will likely never test
* functions with side-effects that I will probably test someday


text:
# Rancher CLI

Rancher cli for managing rancher server from command line
![Alt text](/rancher.png?raw=true "Rancher Logo")

## Installation

## Requirements

## Versioning

repository: dbrosy/rancher-cli

repo_name: dbrosy/rancher-cli


text:
---
layout: post
title:  "Episode Five: Elevator Door Buttons"
date:   2017-07-25 19:00:00 -0700
permalink: '5'
categories: episode
tags: [learning, design, elevators, woodworking]

file: episode-5.mp3
length: 55:11
---

(>\|<) and (<\|>) are universally accepted and totally horrible.

{{ excerpt_separator }}

Mentioned in the show:

* [Imaginary Worlds Podcast][imaginary]
* [Photos of Ben's coffee table][table], with the sanding dust photo included
* [The Physics Girl's presentation of the boat-rock problem][phys-girl-boat]
* [XKCD 1867][phys-conf], an oddly on-topic comic that came out two days after we recorded this.
* [Priming is the effect that can keep you from seeing ambiguous situations as anything but your original impression.][prime]
* [The Underwave off Kanagawa][wave]
* [Paternoster elevators on Wikipedia][paternoster]
* [Frank Drake's AMA][drake]

[table]: http://imgur.com/a/a7X78
[imaginary]: https://www.imaginaryworldspodcast.org/
[phys-girl-boat]: https://www.youtube.com/watch?v=nVT1c0tr8NE
[phys-conf]: https://xkcd.com/1867/
[prime]: https://en.wikipedia.org/wiki/Priming_(psychology)
[wave]: https://www.google.com/culturalinstitute/beta/asset/-/JgEdIdn4pME3Mw?hl=en
[paternoster]: https://www.youtube.com/watch?v=Ro3Fc_yG3p0
[drake]: https://www.reddit.com/r/space/comments/6nifbp/i_am_frank_drake_creator_of_the_drake_equation/


text:
# [Ski Tip](http://alexa.amazon.com/#skills/amzn1.echo-sdk-ams.app.f9919e8a-8ee4-41c5-8b14-4b44da4cbe5a)
![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0

To use the Ski Tip skill, try saying...

* *Alexa, ask ski tip to tell me a ski tip*

* *Alexa, launch ski tip*

* *Alexa, ask ski tip, how about a ski tip*

With this skill you can ask Alexa for a ski tip before hitting the slopes.  She can help get you ready for your lesson, and give you things to think about on your ski day.

***

### Skill Details

* **Invocation Name:** ski tip
* **Category:** null
* **ID:** amzn1.echo-sdk-ams.app.f9919e8a-8ee4-41c5-8b14-4b44da4cbe5a
* **ASIN:** B01HN5GKVC
* **Author:** Sol Art
* **Release Date:** June 30, 2016 @ 06:27:32
* **In-App Purchasing:** No


text:
## kami [![GoDoc](https://godoc.org/github.com/guregu/kami?status.svg)](https://godoc.org/github.com/guregu/kami) [![Coverage](http://gocover.io/_badge/github.com/guregu/kami?0)](http://gocover.io/github.com/guregu/kami)
`import "github.com/guregu/kami"`

kami (神) is a tiny web framework using [x/net/context](https://blog.golang.org/context) for request context, and [HttpRouter](https://github.com/julienschmidt/httprouter) for routing. It includes a simple system for running hierarchical middleware before requests, in addition to log and panic hooks. Graceful restart via einhorn is also supported.

kami is designed to be used as central registration point for your routes, middleware, and context "god object", so kami has no concept of multiple muxes.

You are free to mount `kami.Handler()` wherever you wish, but a helpful `kami.Serve()` function is provided.

Here's a presentation I did related to kami and x/net/context: http://go-talks.appspot.com/github.com/guregu/slides/kami/kami.slide

### Example

```go
package main

import (
	"fmt"
	"net/http"

	"github.com/guregu/kami"
	"golang.org/x/net/context"
)

func hello(ctx context.Context, w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello, %s!", kami.Param(ctx, "name"))
}

func main() {
	kami.Get("/hello/:name", hello)
	kami.Serve()
}
```

### Usage

* Set up routes using `kami.Get("path", kami.HandleFn)`, `kami.Post(...)`, etc. You can use named parameters in URLs like `/hello/:name`, and access them using the context kami gives you: `kami.Param(ctx, "name")`.
* All contexts that kami uses are descended from `kami.Context`: this is the "god object" and the namesake of this project. By default, this is `context.Background()`, but feel free to replace it with a pre-initialized context suitable for your application.
* Add middleware with `kami.Use("path", kami.Middleware)`. More on middleware below.
* You can provide a panic handler by setting `kami.PanicHandler`. When the panic handler is called, you can access the panic error with `kami.Exception(ctx)`.
* You can also provide a `kami.LogHandler` that will wrap every request. `kami.LogHandler` has a different function signature, taking a WriterProxy that has access to the response status code, etc.
* Use `kami.Serve()` to gracefully serve your application, or mount `kami.Handler()` somewhere convenient.

### Middleware
```go
type Middleware func(context.Context, http.ResponseWriter, *http.Request) context.Context
```
Middleware differs from a HandleFn in that it returns a new context. You can take advantage of this to build your context by registering middleware at the approriate paths. As a special case, you may return **nil** to halt execution of the middleware chain.

Middleware is hierarchical. For example, a request for `/hello/greg` will run middleware registered under the following paths, in order:

1. `/`
2. `/hello/`
3. `/hello/greg`

Within a path, middleware is run in the order of registration.

```go
func init() {
	kami.Use("/", Login)
	kami.Use("/private/", LoginRequired)
}

// Login returns a new context with the appropiate user object inside
func Login(ctx context.Context, w http.ResponseWriter, r *http.Request) context.Context {
	if u, err := user.GetByToken(ctx, r.FormValue("auth_token")); err == nil {
		ctx = user.NewContext(ctx, u)
	}
	return ctx
}

// LoginRequired stops the request if we don't have a user object
func LoginRequired(ctx context.Context, w http.ResponseWriter, r *http.Request) context.Context {
	if _, ok := user.FromContext(ctx); !ok {
		return nil
	}
	return ctx
}
```

### License

MIT

### Acknowledgements

* [HttpRouter](https://github.com/julienschmidt/httprouter): router
* [Goji](https://github.com/zenazn/goji): graceful, WriterProxy

repository: shumipro/meetapp

gha_language: HTML

repo_name: shumipro/meetapp


text:
---
id: api-reference
title: API reference
---

### Core

- [`expect(any, options?)`](#expectany-options)

### Validators

- [`toEqual(object)`](#toequalobject)
- [`toLooseEqual(object)`](#tolooseequalobject)
- [`toThrow()`](#tothrow)
- [`toBeRejected()`](#toberejectedobject)
- [`toBeExhausted()`](#tobeexhausted)
- [`toHaveBeenCalledWith(args)`](#tohavebeencalledwithargs)
- [`toHaveBeenCalledExactlyWith(args)`](#tohavebeencalledexactlywithargs)
- [`toMatchSnapshot()`](#tomatchsnapshot)

### Matchers

- [`expect.anything()`](#expectanything)
- [`expect.a(class)`](#expectaclass)
- [`stringMatching(substring | regexp)`](#expectstringmatchingsubstring--regexp)
- [`numberCloseTo(expected: number, { delta: number })`](#expectnumberclosetoexpected-number--delta-number-)
- [`expect.containerWith<T>(...items: T[])`](#expectcontainerwithvalue-t)
- [`expect.arrayWith<T>(...items: T[])`](#expectarraywithvalues-t)
- [`expect.objectWith<T>(item: T)`](#expectobjectwith)

### Modifiers

- [`not`](#not)

### Mocks

- [`mockFn<Args, Return>()`](#mockfnargs-return)
  - [`expectedCall(...args)`](#expectedcallargs)
    - [`returnsOnce(value)`](#executesoncefn)
    - [`returns(value)`](#returnsvalue)
    - [`executesOnce(fn)`](#executesoncefn)
    - [`executes(fn)`](#executesfn)
    - [`throwsOnce(error)`](#throwsonceerror)
    - [`throws(error)`](#throwserror)
    - [`resolvesToOnce(value)`](#resolvestooncevalue)
    - [`resolvesTo(value)`](#resolvestovalue)
    - [`rejectsWithOnce(error)`](#rejectswithonceerror)
    - [`rejectsWith(error)`](#rejectswitherror)
    - [`given(args)`](#givenargs)

## Reference

### Core

#### expect(any, options?)

`options.extraMessage` - provide extra message to make it easier to understand
when your assertion fails

### Validators

#### toEqual(object)

Performs deep equality check, ensures type equality, supports matchers.

#### toLooseEqual(object)

Using less strict equality algorithm then `toEqual`: when two object values have
same fields and values but different prototype they will be considered equal
with `toLooseEqual`. Further more it lacks type safety as expected and actual
value types doesn't have to match.

#### toThrow()

Checks if any error was thrown. Requires checked value to be a parameterless
function.

#### toThrow(errorString)

Checks if error with a matching message was thrown. Requires checked value to be
a parameterless function. `errorString` can be a matcher (for example
[stringMatcher](/api/api-reference#expectstringmatchingsubstring--regexp))

#### toThrow(errorClass, errorString?)

Checks if error matching errorClass and optionally errorString was thrown.
Requires checked value to be a parameterless function. `errorString` can be a
matcher (for example
[stringMatcher](/api/api-reference#expectstringmatchingsubstring--regexp))

#### toBeRejected()

Checks if a promise was rejected with any error. It returns a promise so you
need to await whole expectation.

#### toBeRejected(errorString)

Checks if a promise was rejected with error with a matching error string. It
returns a promise so you need to await whole expectation. `errorString` can be a
matcher (for example
[stringMatcher](/api/api-reference#expectstringmatchingsubstring--regexp))

#### toBeRejected(errorClass, errorString)

Checks if a promise was rejected with error matching error class and optionally
error string. It returns a promise so you need to await whole expectation.
`errorString` can be a matcher (for example
[stringMatcher](/api/api-reference#expectstringmatchingsubstring--regexp))

#### toBeExhausted()

Checks if a given mock is exhausted (has next value).

#### toHaveBeenCalledWith(args)

Checks if mock was called with a given arguments. Order of calls doesn't matter.
`args` is an array of arguments, argument can be a matcher.

#### toHaveBeenCalledExactlyWith(args)

Checks if mock was called with all given arguments. Order of calls matter.
`args` is an array of array of arguments, argument can be a matcher.

#### toMatchSnapshot()

Match actual value to a snapshot. The name of the snapshot is derived from the
suite and test case names. A snapshot will be created under `__snapshot__`
folder.

Set `UPDATE_SNAPSHOTS=true` environment variable to update snapshots.

Requires [test runner integration](/guides/test-runner-integration.md).

### Matchers

#### expect.anything()

Matches anything.

#### expect.a(class)

Matches any instance of a class. Works as expected with primitives like String,
Number etc.

**Note**: it doesn't work with TypeScript types because they are erased from the
output - you need a JS class.

##### Examples

```typescript
expect(something).toEqual(expect.a(String)) // matches any string
expect(something).toEqual(expect.a(Object)) // matches any object (not null)
```

#### expect.stringMatching(substring | regexp)

Matches any string containing given substring or matching given pattern.

#### expect.numberCloseTo(expected: number, { delta: number })

Matches any number within proximity of expected number.

The range is <expected - delta, expected + delta> (inclusive).

#### expect.containerWith(value: T)

Matches a iterable (array / set etc.) containing value

#### expect.arrayWith(...values: T)

Matches an array containing expected value or values.

#### expect.objectWith(value: T)

Matches an object containing given key-value pairs.

### Modifiers

#### not

Makes expectation fail when it should succeed and succeed when it should fail.

### Mocks

#### mockFn<ARGS, RETURN>()

#### mockFn<FUNCTION_SIGNATURE>()

Create a mock conforming to a given signature.

##### Example:

```typescript
const mock = mockFn<[string], number>()
```

#### returnsOnce(value)

Return a given value once.

#### returns(value)

Return a given value indefinitely.

#### executesOnce(fn)

Execute a given code one.

#### executes(fn)

Execute a given code indefinitely.

#### throwsOnce(error)

Throw a given error once.

#### throws(error)

Throw a given error indefinitely.

#### resolvesToOnce(value)

Same as `returnsOnce(Promise.resolve(value))`

#### resolvesTo(value)

Same as `returns(Promise.resolve(value))`

#### rejectsWithOnce(error)

Same as `returnsOnce(Promise.reject(error))`

#### rejectsWith(error)

Same as `returns(Promise.reject(error))`

#### given(args)

Specify a different behavior when called with given arguments. Given returns an
object that allows to customize behaviour with any of the following methods:
`returnsOnce`, `executesOnce`, `throwsOnce`, `resolvesToOnce`,
`rejectsWithOnce`.


text:
# legends_fc

A  Flutter application  with power of widgets for flutter create.
My task is to create simple app with widgets but define beauty while running it.

## Flutter Create
My task is to create simple app with widgets but define beauty while running it and while
scrolling horizontal user feel its opening a door or it can fell transformation of page .
So,I use a pageview and transform widget with help of NotificationListener .
Image inside a stack  change  within seconds which i felt user can interact with one page and reveal
them more information in one page with help of animation controller & animation.

Happy learning. :+1:
If you found this project useful, then please consider giving it a :star: on Github and sharing it with your friends via social media.
### Show some :heart: and star the repo to support the project
if you like my work support me
## Project Created & Maintained By

### divyam joshi
# Donate

> If you found this project helpful or you learned something from the source code and want to appreciate
>
> - [PayPal](https://paypal.me/divyamjoshi)

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.io/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

The MIT License

Copyright (c) 2019 Divyam Joshi

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.


text:
##### USAGE #####
To begin to work:
- launch: yarn install or npm install
- link: yarn link or npm link
- link JHipster: yarn link generator-jhipster or npm link generator-jhipster
- test your module in a JHipster project:
    - create a new directory and go into it
    - link the blueprint: yarn link generator-jhipster-modular-monolith or npm link generator-jhipster-modular-monolith
    - launch JHipster with flags: jhipster --blueprint modular-monolith
- then, come back here, and begin to code!


text:
---
author: dealingwith
date: '2006-02-24 10:50:00'
layout: post
slug: words-of-the-day-6
status: publish
title: words of the day
wordpress_id: '1041'
categories:
 - word of the day
---

[typo-squat][1]

[lossy][2] (not new, but fun to use in contexts other than digital data
compression)

   [1]: http://mezzoblue.com/archives/2006/02/22/homage_and_o/

   [2]: http://dictionary.reference.com/search?q=lossy

repository: dealingwith/poole

gha_language: CSS

repo_name: dealingwith/poole


text:
# PicoCam
## A 3D Camera Library for Pico8

### Example

```lua
function _init()
  camera = cameralib.new()
end

function _draw()
  camera:point( {0.5,0.5,0.5} )
  camera:line( {1,1,1}, {-1,-1,-1} )
end
```

### Credits

Library & demo by [josefnpat](https://twitter.com/josefnpat)
[Orignal tech demo](http://www.lexaloffle.com/bbs/?pid=27375) by [jdan](https://twitter.com/jdan)

### License

This work is under the [CC0](https://creativecommons.org/publicdomain/zero/1.0/) license.


text:
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S3 |
| ----------------- | -------- | -------- | -------- | -------- | -------- |

# BLE Multi Adv Example

(See the README.md file in the upper level 'examples' directory for more information about examples.)

This example support legacy as well as extended advertisement for all phy. For multi advertising, random addresses are generated for each instance.

It starts 4 types of advertising:
* Non connectable extended
* Connectable extended
* Scannable legacy
* Legacy withe specified duration(5 sec)

## How to Use Example

Before project configuration and build, be sure to set the correct chip target using:

```bash
idf.py set-target <chip_name>
```

### Configure the Project

Open the project configuration menu:
```
idf.py menuconfig
```

To configure number of advertising instances:

* Component config → Bluetooth → NimBLE Options → Enable BLE 5 feature → Maximum number of extended advertising instances

### Hardware Required

* A development board with ESP32-C3 SoC,ESP32-S3/ESP32-H2/ESP32-C2 SoC and BLE5.0 supported chips (e.g., ESP32-C3-DevKitC, etc.)
* A USB cable for Power supply and programming

See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it.

### Build and Flash

Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.

(To exit the serial monitor, type ``Ctrl-]``.)

See the [Getting Started Guide](https://idf.espressif.com/) for full steps to configure and use ESP-IDF to build projects.

## Example Output

```
I (404) NimBLE_MULTI_ADV: BLE Host Task Started

I (414) NimBLE_MULTI_ADV: Instance 0 started
I (414) NimBLE_MULTI_ADV: Instance 1 started
I (434) NimBLE_MULTI_ADV: Instance 2 started
I (444) NimBLE_MULTI_ADV: Instance 3 started

I (454) main_task: Returned from app_main()
I (5404) NimBLE: advertise complete; reason=13
I (5404) NimBLE_MULTI_ADV: In ble_legacy_duration_cb, instance = 3

I (5404) NimBLE_MULTI_ADV: Instance 3 started
I (10384) NimBLE: advertise complete; reason=13
I (10384) NimBLE_MULTI_ADV: In ble_legacy_duration_cb, instance = 3

I (10394) NimBLE_MULTI_ADV: Instance 3 started

```
## Troubleshooting

For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.

repository: KollarRichard/esp-idf

repo_name: KollarRichard/esp-idf


text:
---
title:  "AdaBoost, Simplest Example"
date:   2019-07-01 17:00:00
categories: [boosting-algorithms]
tags: [boosting-algorithms]
description: A video tutorial showing how adaboost algorithm works from scratch.
---

AdaBoost is one of those machine learning methods that seems so much more confusing than it really is. It's really just a simple twist on decision trees. In this video, I will try to explain this complex algorithm in a very simplified way!

## To view the video
* [Click here](https://youtu.be/9CPsYsB4OLI){:target="_blank"}
* Click on the image below

[![AdaBoost, Simplest Example](http://img.youtube.com/vi/9CPsYsB4OLI/0.jpg)](http://www.youtube.com/watch?v=9CPsYsB4OLI){:target="_blank"}

### Want to know more about me?
## Follow Me


text:
# Image Catalyst v2.4

> **Note!**
> I'm not the author of this project. And upload it here only for for convenience.

> * **Author of project - lorents and res2001.**
> * Consulting - x128.
> * Translating to english and uploading to GitHub - macik.

>  For latest version link see http://x128.ho.ua/update.ini
>  See http://rghost.ru/51256939 - for version 2.3 from 28.12.2014
>  This utils pack distributed AS IS. To see certain licenses or manuals see utilities official sites.

Pack of Windows utils to optimize (lossless compression) graphic files (JPEG and PNG formats).
Using it is as good practice if you work with web page graphics (sprites and stand alone files).

Special thanks:

 * x128 - for stand alone app – JType;
 * madmasles - for DlgMsgBox util;
 * Andrey Chernomyrdin - for porting jpegrescan.pl for Windows;

Authors not responsible for any thing.
Use it for your own risk.

Making backup is strongly recommended.

Read this instructions.

Tools for PNG optimizing:
--------------------------

  - AdvDef (from AdvanceComp 1.19);
  - DeflOpt 2.07 from 05.09.2007;
  - Defluff 0.3.2 from 07.04.2011;
  - PNGWolf from 11.03.2011 / 28.05.2013;
  - TruePNG <IP_ADDRESS>.

Tools for JPG optimizing:
-------------------------

  - JPEGinfo от 16.03.2014;
  - JPEGstripper от 16.03.2014;
  - MozJPEGTran (from MozJPEG 1.0.1 bundle).

Addition software:
------------------

  - DlgMsgBox from 29.02.2012;

All util files packed with UPX.

Manual:
=======

 - You can add files for optimization queue this ways:
    * start "Image Catalyst.bat" and with «File browser» dialog choose graphic files;
    * drag`n`drop selected files and/or folders on "Image Catalyst.bat" shortcut;
    * run "Image Catalyst.bat" with full path folder with graphic files (by default program process all sub-folders).
 - Then select output folder for optimized files (program retain existing folder structure).
 You can use «overwrite» mode by pressing Cancel button in «Output folder selection» dialog
 (in this case all original files will be overwritten with optimized ones).
 - By default for PNG optimization multithreading is used (see `config.ini` to change this).
 - You can change base setting of project by edit `Tools\config.ini` file with any text editor.
 - You can not use special symbols like `&`, `^`, `%` `(`, `)`, `!` in file names or paths.

Types of PNG files:
-------------------

  - Non-interlaced - standard mode.
  - Interlaced - interlacing is a trade-off: it dramatically speeds up early rendering of large
  files (improves latency), but may increase file size (decrease throughput) for little gain,
  particularly for small files.

Optimization modes for PNG:
---------------------------

  - Non-interlaced - standard mode. Continuous PNG loading;
  - Interlaced - uses «progressive loading» mode. And better user experience on slow connection or big data;
  - Default - optimized file and leave original mode intact.

Structure of PNG:
-----------------

	http://libpng.org/pub/png/spec/1.2/PNG-Chunks.html
	http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html

Types of JPEG files:
--------------------

  - Optimize - better optimized JPEG file. Browsers loading it continuously, while loading.
  - Progressive - format, in which data is compressed in multiple passes of progressively higher
	detail. This is ideal for large images that will be displayed while downloading over a slow
	connection, allowing a reasonable preview after receiving only a portion of the data.

Optimization modes for JPEG:
----------------------------

  - Optimize - using Optimize mode;
  - Progressive - using Progressive mode;
  - Maximum - both optimize and progressive had made and used smaller one;
  - Default - optimize size but leave intact original image mode.

Structure of JPEG files:
------------------------

	http://www.0x99.ru/Pages/jpeg/content/cnt-05.aspx (in Russian)
	http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html


text:
---
slug: /events/ExploreML
name: ExploreML
date: 2020-02-22
location: IS LAB V, Room 219, 2nd Floor, SCEM
cover: './cover.png'
link: http://bit.ly/sosc-exploreml
feedback_link: http://bit.ly/sosc-exploreml-feedback
---
## Explore ML
If you've wondered what is the buzz with '**ML**' 🤔 ? How to start learning ML? Where to begin 😕?

Explore ML is an introductory workshop for **ML** and **Neural Networks** organized by Developer Student Club, Sahyadri. Come along and lets explore a bit of ML concepts 😁.

## Time: 1:15 PM IST

## Topics Covered

### Session 1: (1:15 PM to 1:55 PM)

- Introduction to ML
- Traditional Programming vs ML
- Explore Machine Learning is an introductory Workshop for ML and Neural Networks.
- What can ML do? 🤖

### Session 2: (2:00 PM to 2:40 PM)
- Neural Nets
- Tensorflow Playground
- Teachable Machine and Limits of Neural Nets

### Session 3: (2:45 PM to 3:15 PM)
- Group Activity

## This is a BYOC event 💻
- Laptop with Internet Connectivity

## Prerequisites
- Chrome/Firefox browser
- Internet Connectivity
- A willingness to learn 💚!

## Trainers and Mentors
- [Suhan Acharya](https://github.com/suhanacharya), ExploreML Facilitator - DSC
- [Akshay Ram Bhat](https://github.com/akshayrb22), Lead - DSC
- [Afroz](https://github.com/coderhawk999), PWA Lead - DSC
- [Akashdeep Bhagat](https://github.com/akashdeepb), Android Lead - DSC

repository: so-sc/sosc-website

repo_name: so-sc/sosc-website


text:
# Extension module: `templating-pebble`

This templating module uses the Pebble templating implementation.

See https://pebbletemplates.io for documentation on Pebble templating syntax.

## Setup

Import the following dependency:

```xml

<dependency>
    <groupId>org.dotwebstack.framework</groupId>
    <artifactId>templating-pebble</artifactId>
</dependency>
```

## Template file location

In order to create your own template files, create these in `config/templates/`.

## Template file variable references

For this implementation, we have prefixed different values regarding the source of the values.

- Values that are part of the result fields of the GraphQL query, are prefixed with: `fields.`
- Values that are part of the input arguments of the GraphQL query, are prefixed with: `args.` (by default, the request
  URI is available as `args.requestUri`)
- Values that are part of the environment variables, are prefixed with: `env.`

For example, in the example project we are referring to breweries. The name of the brewery is part of the result fields,
as key `name`. In order to use this in the pebble template, we need to use `{{ fields.name }}`.

## Custom filter

In order to create a custom Pebble filter, refer to: https://pebbletemplates.io/wiki/guide/extending-pebble.

## RDF4J integration

For integration of RDF4J with Pebble templating, an additional module is provided:

```xml

<dependency>
    <groupId>org.dotwebstack.framework</groupId>
    <artifactId>templating-pebble-rdf4j</artifactId>
</dependency>
```

### Filter `jsonld`

In order to encode an RDF4J model as a JSON-LD document, use the `jsonld` filter.

For example, to encode the value of the `fields` variable as a JSON-LD document, use:

```html
{% block script %}
<script type="application/ld+json">{ fields | jsonld | raw }}</script>
{% endblock %}
```

The addition `raw` makes sure the result is not encoded.

repository: dotwebstack/dotwebstack-framework

gha_language: Java

repo_name: dotwebstack/dotwebstack-framework