text:
---
layout: post
title: Week 11
---

## Progress on team projects since last week:
**Overall/Team Update:** As a team, we have continued to make progress on individual/pair contributions to Jupyter Notebook; Rosa & Dana began working on a documentation issue, and a PR that Ashley created to was merged. The cookie issue that Rosa & I worked on is complete - our [PR was merged](https://github.com/jupyter/notebook/pull/3511). We have found a larger issue that we can work on as a team (the file size issue described below). Additionally, the accessibility PR that Ashley and I worked on needed a bit extra work, so to make it a team effort, Rosa & Dana will be making contributions to that as well.

**My contributions:**
- Cookie Issue (Merged):
  - Fixed automatically stripped whitespace
  - Warning dialog needed adjustment - specifically, I removed the "OK" button as asked, since it served no real purpose
  - Added link on enabling cookies to dialog
  - [View PR](https://github.com/jupyter/notebook/pull/3511)
- File size Issue (in Progress):
  - Edited so that:
    - file size is an optional property
    - file size is only calculated for files and Notebooks, not directories
  - [View commits on branch](https://github.com/nyu-ossd-s18/notebook/commits/filesize)
- Cache Issue (Merged):
  - Set "Cache-Control" header in respond_zip function as requested in PR comments
  - [View PR](https://github.com/jupyter/notebook/pull/3484)


text:
---
layout: default
---

# 1994-02-02 - Re: system logging

## Header Data

From<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: f14997050b15b06dae2b050bfffeb6b7abb60cb8631aa9a2588c807a9fbcf2f5

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1994-02-02 20:21:02 UTC

Raw Date: Wed, 2 Feb 94 12:21:02 PST

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>Date: Wed, 2 Feb 94 12:21:02 PST
To<EMAIL_ADDRESS>Subject: Re: system logging
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

PGP Slave,

Could you please announce my full name, phone number, address, visa card
number, a giff of my signature, height, weight and driver's licence number
not only to the Cypherpunks mailing list but to many usenet groups as well,
since you obviously feel I no longer wish to be known to the masses as
Xenon, and I instead want them to start calling me and postal mailing me
asking for copies of PGP.  I thought the people on this
list were concerned with privacy, but I was wrong. I mention Xenon in
my personal .plan, but I ask people to let me keep the small amount of
extra privacy I still retain.

You wrote,
"qwerty account or not, the public logs on netcom show more than enough
info to trivially track people down."

Trivial? And so you hack out the info that a message went from remailer
A through qwerty and on to remailer B, at a certain time. You haven't
tracked down anyone my friend.

-Xenon

{% endraw %}
```

## Thread

+ Return to [February 1994](/archive/1994/02)

+ Return to "[Kirk Sheppard <kshep@netcom.com>](/authors/kirk_sheppard_kshep_at_netcom_com_)"
+ Return to "[nobody@qwerty.org](/authors/nobody_at_qwerty_org)"

+ 1994-02-02 (Wed, 2 Feb 94 12:21:02 PST) - Re: system logging -<EMAIL_ADDRESS>  + 1994-02-03 (Wed, 2 Feb 94 16:15:32 PST) - [Re: List Scum and Other Dross (was: system logging)](/archive/1994/02/ef8ccf8cfb9a59a0fe41d099a4b2b68fcb50bd2c9c62b7ecc0727c9471d656ef) - _Kirk Sheppard<EMAIL_ADDRESS>

license: MIT

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive


text:
# [Method tightens nullness annotation on parameter](https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html#NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION)

        A method should always implement the contract of a method it overrides. Thus, if a method takes a parameter
    that is marked as @Nullable, you shouldn't override that method in a subclass with a method where that parameter is @Nonnull.
    Doing so violates the contract that the method should handle a null parameter.

repository: codacy/codacy-spotbugs

gha_language: Scala

gha_license_id: NOASSERTION

repo_name: codacy/codacy-spotbugs


text:
+++
title = "CFP 2018"

draft = false

[menu.workshop]
  parent = "bai2018"
  weight = 1

# Optional featured image (relative to `static/img` folder).
[header]
image = "convention.jpg"
caption = "Palais des Congrès de Montréal (Montreal Convention Centre)"
+++

The second Black in AI event will be co-located with [NIPS 2018](https://nips.cc/) at the [Palais des Congrès de Montréal (Montreal Convention Centre)](https://congresmtl.com/)  in Montréal CANADA on December 7th from 9:00 am to 5:30 pm. The workshop will feature invited talks from prominent researchers and practitioners, oral presentations, and a poster session. There will also be socials to facilitate networking, discussion of different career opportunities in AI, and sharing of ideas to increase participation of Black researchers in the field. We invite all members of the AI community to attend the workshop. The early registration deadline for the conference is October 24, 2018. We strongly encourage workshop attendees to register for the workshops as early as possible. The registration can be found [here](https://nips.cc/accounts/login/?next=/Profile).

## Important Dates
- **~~August 24th, 2018: Travel grant application deadline~~**
- **~~August 30th, 2018: Abstract submission deadline~~**
- **~~October 1st, 2018: Notification of travel grant acceptance~~**
- **~~September 30th, 2018: Notification of submission acceptance~~**
- **~~October 24th, 2018: NIPS early registration deadline~~**
- December 7th, 2018: Workshop

repository: blackinai/bai-website

gha_language: HTML

repo_name: blackinai/bai-website


text:
# PyAN
A simple Python interface for the AnimeNfo website.
Requires Python 3.5+

F12 to lock the commandline to prevent listening of global input.
This is a bug right now that occurs in Windows where input is received from global input.
So a lock option is provided.

## Setup Files
In order for the program to work, the user needs to provide a username, dev key, and write key.
Create a file named token.txt and write the following:
```
[Settings]
USR=username
DEV=developer_key
API=api_key
```

Replace username, developer_key, and api_key with your username and keys generated under account settngs on AnimeNfo.

repository: ProgrammingIncluded/PyAN

repo_name: ProgrammingIncluded/PyAN


text:
# Money Transfer API

REST API used to transfer a given amount of money between two accounts (only supports GBP currency).

## Summary

Written in Java 8 and [Ratpack](https://ratpack.io) with:
- Lombok for awesomeness
- Uses JUnit and Ratpack Test for testing
- Uses ConcurrentUnit for concurrency tests via JUnit
- Uses basic in-memory data structures for persistence
- Uses Hibernate validator for JSR-303 validations on requests

## Build

If you want to build the application, please run:

```bash
mvn clean install
```

## Run tests

If you want to execute the tests, please run:

```bash
mvn clean verify
```

## Run app

You can run the app by:
- Running the main class from your IDE
- Building the app via Maven and running the generated uber jar from the target folder.
- Downloading the JAR from the [releases page](https://github.com/paul-pop/money-transfer-api/releases) and executing:

```bash
java -jar money-transfer-api-1.0-SNAPSHOT.jar
```

## Usage

A [swagger.yml](./swagger.yml) file has been provided that can be imported into [https://editor.swagger.io](https://editor.swagger.io),
unfortunately Ratpack doesn't offer a nice way of doing this inside the app.

When using the editor, it will call your localhost so make sure the app is started.

repository: paul-pop/money-transfer-api

gha_language: Java

repo_name: paul-pop/money-transfer-api


text:
[More on 15May87 page 5AH and 25Aug87 page 1AH.]

Newspapers: **Miami Morning News or The Miami Herald**

Page: **11**, Section: **A**


text:
# Cucumber/C++
Cucumber/C++ is an editor of Cucumber/Gherkin, a language of specification by example in the BDD world.
C++ step implementation is simple and straight forward.

# Screen shot
![sceen shot](https://github.com/bzquan/CucumberCpp/blob/master/CucumberC%2B%2B.jpg)

# Features
1. Keywords highlight
2. Pretty formatting
3. Generation of C++ Gherkin implementation skeleton.

# Building Cucumber/C++
1. Install Qt5.6
2. Setup C++14 compiler, eg. Visual Studio 2015, gcc5.2.
3. Optional: Bison is needed if you want to change Gherkin parser grammer, gherkin.y.
3. Configure Qt projects, CucumberCpp.pro and GherkinParser.pro.
4. CucumberCpp is GUI projects which depends on GherkinParser.

# Examples
[Simple string calculator](https://github.com/bzquan/CucumberCpp/blob/master/Example/SimpleStringCalculator.md)
[How to use mock object](https://github.com/bzquan/CucumberCpp/blob/master/Example/SimpleStringCalculatorMock.md)

# Limitations
It only supports English Keywords of Gherkin. However you can use any languages to write specification by example in Gherkin.

# Memo
[Markdown help from stackoverflow](http://stackoverflow.com/editing-help)

repository: bzquan/CucumberCpp

repo_name: bzquan/CucumberCpp


text:
## $5 Tech Unlocked 2021!
[Buy and download this product for only $5 on PacktPub.com](https://www.packtpub.com/)
-----
*The $5 campaign         runs from __December 15th 2020__ to __January 13th 2021.__*

Building an RPG with Unity 5.x [Video]

This is the code repository for Building an RPG with Unity 5.x [Video], published by Packt. It contains all the supporting project files necessary to work through the video course from start to finish.

About the Video Course

Unity is one of the most cutting-edge game engines in the world. Developers are looking for the best ways to create games of any genre in the engine. This comprehensive course on building an RPG with Unity teaches you high-end techniques currently used in developing modern games—tips, tricks, and techniques that can be applied to your own role RPG.

We begin with an introduction to and the fundamentals of RPG games. Moving further, you will learn the necessary parts of building an RPG, such as structuring the game environment, customizing characters, controlling the camera, and designing other attributes such as inventory, weapons, and so on.

We’ll also explore designing levels of the game, adding more features to it, and making the game more interesting. You will see how to get around the obstacle of networking in Unity and be able to implement Multi-Player mode for your RPG games.By the end of the video, you will be able to build upon core the RPG framework elements to create your own game experience.

What You Will Learn

Construct a framework for inventory, equipment, characters, enemies, quests, and game events
 See how to load and unload scenes and assets
Create multiplayer game settings for our RPG
Design a UI for user input and feedback
Enhance Game Master to handle all aspects of the RPG

Instructions and Navigation

Assumed Knowledge

This course has the following software requirements:

Related Products

[Creating Smart Web Apps with Django [Video]]](https://www.packtpub.com/application-development/creating-smart-web-apps-django-video)

Python Django Dev To Deployment [Video]

[Learning Angular for Django Developers [Video]]](https://www.packtpub.com/web-development/learning-angular-django-developers-video)


text:
# minimal hotline setup

This is an example of a minimal [yate](https://docs.yate.ro/wiki/Main_Page) setup, which registers via an upstream SIP trunk and answers all calls with script.

## How to

### get the source

``` sh
git clone https://github.com/eventphone/hotline
cd hotline
git submodule update --init --recursive
```

### modify SIP settings

Update [accfile.conf](config/accfile.conf) with your SIP Account credentials. If you don't have a SIP Account, you may use an [EPVPN Account](https://eventphone.de/doku/epvpn) for __testing__ purposes.

### script your hotline

We've currently 4 example hotlines:

- [hotline.tcl](hotline/hotline.tcl) - the famous PoC Service Hotline as heard on many CCC Events
- [corona.tcl](hotline/corona.tcl) - the latest version of the gemeinschaft.online hotline
  - ask for zipcode (via DTMF)
  - ask for topic (via DTMF)
  - send HTTP API Request with caller number, zip code and topic to REST Endpoint
  - if anything goes wrong save the request to the filesystem for manual inspection
- [corona.py](hotline/corona.py) - python version of the gemeinschaft.online hotline
- [api.tcl](hotline/api.tcl) - minimal HTTP API Example, which sends the caller number to an HTTP endpoint and plays success or failed messages

More examples can be found in the [yate-tcl](https://github.com/bef/yate-tcl) repository.

If you want to use custom audio files, place them in the [sounds](sounds) directory

### convert your audio files

You can use the following sox command to convert your mp3 or wav files to slin:

```sh
sox input.mp3 -t raw -r 8000 -c 1 output.slin
```

You may need to install the sox format handler:

```sh
apt install libsox-fmt-mp3
```

### configure your hotline

Update [regexroute.conf](config/regexroute.conf) to point to your custom hotline script. You can also route to different scripts depending on the caller or dialed number. Details can be found in the [Yate WIKI](https://docs.yate.ro/wiki/Regular_expressions#The_regexroute_configuration_file).

### build your custom docker container

``` sh
docker build -t your_fancy_hotline .
```

### run

``` sh
docker run -it your_fancy_hotline
```

## Help

If you need any additional help, you may contact us via our [support](https://guru3.eventphone.de/support/).

repository: eventphone/hotline

gha_language: Tcl

repo_name: eventphone/hotline


text:
## 2.8 2018-02-01 <dave at tiredofit dot ca>

* Pull sources from Github instead of mainwebsite
* Compile auth-ldap plugin

## 2.7 2018-02-01 <dave at tiredofit dot ca>

* Rebase

## 2.6 2017-10-05 <dave at tiredofit dot ca>

* Fix Broken Detection of new install

## 2.5 2017-08-29 <dave at tiredofit dot ca>

* Image Cleanup

## 2.4 2017-07-06 <dave at tiredofit dot ca>

* Added PHP_TIMEOUT

## 2.3 2017-07-03 <dave at tiredofit dot ca>

* Added PHP7-IMAP

## 2.2 2017-07-02 <dave at tiredofit dot ca>

* Build PHP7 Memcached Extension

## 2.1 2017-07-02 <dave at tiredofit dot ca>

* Sanity Checks in init scripts

## 2017-06-17 2.0 <dave at tiredofit dot ca>

* Rebase with nginx-php-fpm:7.0 with s6

## 2017-05-27 1.0 <dave at tiredofit dot ca>

* Production Stable
* Memcached Capable for Sessions
* Reset Admin Password if ENV Set upon Bootup

## 2017-05-27 0.9 <dave at tiredofit dot ca>

* Initial Release
* OSTicket 1.10
* Alpine:3.5
* PHP7
* Zabbix

repository: ertomas/docker-osticket

repo_name: ertomas/docker-osticket


text:
# pug-phalcon
Pug Template Engine for Phalcon

To use Pug with your Phalcon application, just add to composer.json, in the require section:

```json
"pug-php/pug-phalcon": "^1.0"
```

Or use the command line:
```sh
composer require pug-php/pug-phalcon
```

Then register the template:

```php
require '../vendor/autoload.php';

// ...
$di = new FactoryDefault();

// Setting up the view component
$di['view'] = function() {
    $view = new View();
    $view->setViewsDir('../app/views/');
    $view->registerEngines(array(
        ".pug" => function($view, $di) {
            return new \Phalcon\Mvc\View\Engine\Pug($view, $di, array(
                'cache' => '/tmp/myproject/pug',
                'prettyprint' => APP_ENV == 'development',
            ));
        }
    ));

    return $view;
};
```

Now you can add pug files in the views directory:

app/views/index.pug:

```pug
doctype html
html
  head
    title pug-phalcon
  body
    p Generetad with pug-phalcon
```

repository: pug-php/pug-phalcon

repo_name: pug-php/pug-phalcon


text:
# "===" and "!==" should be used instead of "==" and "!="

> The `==` and `!=` operators do type coercion before comparing values. This is bad because it can mask type errors. For example, it evaluates ' `\t\r\n' == 0` as `true`.

> It is best to always use the side-effect-less `===` and `!==` operators instead. (Karşılaştırma operatörlerinden kullanımı en uygun olan `===` ve `==!` şeklindedir.)

### Noncompliant Code Example (Uygunsuz Kod Örneği) :

```javascript
if (variable == 'ahmet') {...} // Noncompliant
```

### Compliant Solution (Uygun Kod Örneği) :

```javascript
if (variable === 'ahmet') {...}
```

### Exceptions (İstisnalar) :

> Even if testing the equality of a variable against null doesn't do exactly what most JavaScript developers believe, usage of `==` or `!=` is tolerated in such context. In the following case, if variable hasn't been initialized, its default value is not null but undefined. Nevertheless `undefined == null`, so JavaScript developers get the expected behavior.

```javascript
if(variable == null) {...}
```


text:
---
sidebar_position: 2
---

# Markdown Features

Docusaurus supports **[Markdown](https://daringfireball.net/projects/markdown/syntax)** and a few **additional features**.

## Front Matter

Markdown documents have metadata at the top called [Front Matter](https://jekyllrb.com/docs/front-matter/):

```text title="my-doc.md"
// highlight-start
---
id: my-doc-id
title: My document title
description: My document description
slug: /my-custom-url
---
// highlight-end

## Markdown heading

Markdown text with [links](./hello.md)
```

## Links

Regular Markdown links are supported, using url paths or relative file paths.

```md
Let's see how to [Create a page](/markdown-features).
```

```md
Let's see how to [Create a page](./markdown-features.md).
```

**Result:** Let's see how to [Create a page](./markdown-features.md).

## Images

Regular Markdown images are supported.

Add an image at `static/img/logo.svg` and display it in Markdown:

```md
![Docusaurus logo](/img/logo.svg)
```

![Docusaurus logo](/img/logo.svg)

## Code Blocks

Markdown code blocks are supported with Syntax highlighting.

    ```jsx title="src/components/HelloDocusaurus.js"
    function HelloDocusaurus() {
        return (
            <h1>Hello, Docusaurus!</h1>
        )
    }
    ```

```jsx title="src/components/HelloDocusaurus.js"
function HelloDocusaurus() {
  return <h1>Hello, Docusaurus!</h1>;
}
```

## Admonitions

Docusaurus has a special syntax to create admonitions and callouts:

    :::note

    The content and title *can* include markdown.

    :::

    :::tip You can specify an optional title

    Heads up! Here's a pro-tip.

    :::

    :::info

    Useful information.

    :::

    :::caution

    Warning! You better pay attention!

    :::

    :::danger

    Danger danger, mayday!

    :::

:::note

The content and title *can* include markdown.

:::

:::tip You can specify an optional title

Heads up! Here's a pro-tip.

:::

:::info

Useful information.

:::

:::caution

Warning! You better pay attention!

:::

:::danger

Danger danger, mayday!

:::

## MDX and React Components

[MDX](https://mdxjs.com/) can make your documentation more **interactive** and allows using any **React components inside Markdown**:

```jsx
export const Highlight = ({children, color}) => (
  <span
    style={{
      backgroundColor: color,
      borderRadius: '20px',
      color: '#fff',
      padding: '10px',
      cursor: 'pointer',
    }}
    onClick={() => {
      alert(`You clicked the color ${color} with label ${children}`)
    }}>
    {children}
  </span>
);

This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !

This is <Highlight color="#1877F2">Facebook blue</Highlight> !
```

export const Highlight = ({children, color}) => (
  <span
    style={{
      backgroundColor: color,
      borderRadius: '20px',
      color: '#fff',
      padding: '10px',
      cursor: 'pointer',
    }}
    onClick={() => {
      alert(`You clicked the color ${color} with label ${children}`);
    }}>
    {children}
  </span>
);

This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !

This is <Highlight color="#1877F2">Facebook blue</Highlight> !

repository: jacobkearin/iota-wiki

branch_name: refs/heads/develop

repo_name: jacobkearin/iota-wiki


text:
# Subset Sum Algorithm

Implements the *Subset Sum Problem* using recursive backtracking. Implementation is provided as `SubsetSum` class contained in the package `io.gitbub.thehappybug.Algorithms`.

## Compiling

The project can be compiled using `make` tool:

```
$ make
javac io/github/thehappybug/Algorithms/SubsetSum.java
```

## Running

Run the class `SubsetSum`'s `main` method using:

```
$ java io.github.thehappybug.Algorithms.SubsetSum
[-7, -3, -2, -1, 5, 8]
[-7, -3, 10]
[-7, -2, -1, 10]
[-7, -2, 9]
[-7, -1, 8]
[-3, -2, 5]
```

The program requires no arguments.

## Documentation of `SubsetSum` (Public)

**`public class SubsetSum`**

Algorithm to generate all subsets of the current set that sum to zero.

**`public static void main(String[] args)`**

Main program to to generate all subsets of the current set that sum to zero.

 * **Parameters:** `args` — No argument required

**`public SubsetSum(int[] numbers)`**

Create a subset sum algorithm bound to this set.

 * **Parameters:** `numbers` — List

**`public ArrayList<ArrayList<Integer>> run()`**

Run the subset sum algorithm.

 * **Returns:** List of all eligible subsets

repository: thehappybug/subset-sum

repo_name: thehappybug/subset-sum


text:
# gpn18-binja-plugin-development
Slides from my talk at the Gulasch Programming Night 18 about developing Binary Ninja plugins. The idea was to supply everything that is needed to quickly get started with writing new plugins. Recording at: https://www.youtube.com/watch?v=L2xYV9WLVoE (Sorry german only for now. I initially wanted to give the talk in english but didn't feel well enough in the end. Might redo it again in englich soonish. Also sorry for the bad prepared example section at the end).

<!-- $theme: default -->
<!-- footer: Benedikt Schmotzle -- Binary Ninja Plugin Development -- GPN18 -->

Binary Ninja Plugin Development
===

---

# Binary Ninja

https://binary.ninja/

* Cross platform reversing: Linux, OSX, Windows
* Supported architectures: X86/ARM/MIPS/...
* Intermediate Languages (low, medium, ...)
* GUI / (headless)
* cheaper than IDA :)
* nice Python API

---

# API

https://api.binary.ninja/

https://github.com/Vector35/binaryninja-api

https://github.com/Vector35/community-plugins/tree/master/plugins

---

# Plugin paths

* Windows
	* %APPDATA%/Binary Ninja/plugins
* Linux
	* $HOME/.binaryninja/plugins
* OSX
	* ~/Library/Application Support/Binary Ninja/plugins
---

# Better debugging using EPDB

## Linux

From BinaryNinja shell
```bash
import pip; pip.main(['install', 'epdb']);
import epdb; epdb.serve()
```

From Python shell
```python
import epdb; epdb.connect()
```

## Windows

working on porting epdb

---

# API Basics

```python
here # get address at cursor

print(hex(here)) # print address in hex
```

---

# Binary Views

```python
bv = BinaryViewType['ELF'].open("/bin/ls")
```

---

# Sections

```python
bv.sections.keys()
# ['.dynstr', '.text', ...]

bv.sections['.text']
# <section .text: 0x402a00-0x413c59>

bv.sections['.text'].start
# 4205056L

bv.sections['.text'].end
# 4275289L
```
---

# Symbols

```python
bv.symbols
# {...'puts@GOT': <SymbolType.ImportAddressSymbol:
#            "puts@GOT" @ 0x804a010>, ... }

bv.get_symbol_at(0x804a010)
# <SymbolType.ImportAddressSymbol: "puts@GOT" @ 0x804a010>

bv.get_symbol_by_raw_name('puts')
# <SymbolType.ImportedFunctionSymbol: "puts" @ 0x8048330>
```

---

# Architecture

```python
bv.arch
# <arch: x86_64>

bv.arch.endianness
# <Endianness.LittleEndian: 0>

bv.arch.address_size
# 8L
bv.arch.calling_conventions
# { 'win64': <calling convention: x86_64 win64>,
#   'sysv': <calling convention: x86_64 sysv>,
#'linux-syscall': <calling convention: x86_64 linux-syscall>}

bv.arch.calling_conventions['sysv'].int_arg_regs
# ['rdi', 'rsi', 'rdx', 'rcx', 'r8', 'r9']

bv.arch.calling_conventions['sysv'].int_return_reg
# 'rax'
```

---

# (Dis)assembling

```python
bv.get_disassembly(t.start)
# 'push    r15'

bv.arch.assemble("push r15")
# ('AW', ''))

```

---

# Functions

```python
bv.functions
# [<func: x86_64@0x4022b8>, ..., <func: x86_64@0x413c5c>]

# Get function at address
bv.get_functions_containing(0x413871)[0]
# <func: x86_64@0x413b9c>

bv.functions[0].name
# "_init"

bv.functions[0].vars
# [<var void var_8>, ...]

bv.functions[0].basic_blocks
# [<block: x86_64@0x4022b8-0x4022c8>, ... ]
```
---

# Making comments

```python
f0 = bv.functions[0]

# set_comment_at(address, comment)
f0.set_comment_at(f.start, "beginning of function")

f0.comments
# {4203192L: 'beginning of function'}
```
---

# Basic blocks

```python
b2 = f0.basic_blocks[2]

b2.outgoing_edges
# [<UnconditionalBranch: x86_64@0x4022cd>]

b2.incoming_edges
# [<FalseBranch: x86_64@0x4022c8>]

b2.set_user_highlight(
	HighlightStandardColor.BlueHighlightColor)
```

---

# Instructions

```python
bb.disassembly_text
# [<0x406d60: sub_406d60:>,
# <0x406d60: push    r15 {var_8}>,
# ...]

bb.disassembly_text[1].tokens
# ['push', '    ', 'r15', ' {', 'var_8', '}']

f0.set_user_instr_highlight(f0.start,
    highlight.HighlightColor(red=0xff, blue=0xff, green=0))
```

---

# Binary Ninja Intermediate Languages

* Human readable
* Computer understandable (SSA)
* Easy to lift
* Easy to translate

---

# Low level Intermediate Language (LLIL)

https://docs.binary.ninja/dev/bnil-llil/

* Close to asm
* Eliminate side effects
* Eliminate nops

---
```
0   0x4005c7    push rbp
1   0x4005c8    mov rbp, rsp
2   0x4005cb    sub rsp, 0x20
3   0x4005cf    mov dword [rbp-0x14], edi
4   0x4005d2    mov qword [rbp-0x20], rsi
5   0x4005d6    rax = [rbp - 0x20 {var_28}].q
6   0x4005da    mov rdi, rax
7   0x4005dd    call atoi
8   0x4005e2    mov dword [rbp-0x4], eax
...
```

```
0   0x4005c7    push(rbp)
1   0x4005c8    rbp = rsp {__saved_rbp}
2   0x4005cb    rsp = rsp - 0x20
3   0x4005cf    [rbp - 0x14 {var_1c}].d = edi
4   0x4005d2    [rbp - 0x20 {var_28}].q = rsi
5   0x4005d6    rax = [rbp - 0x20 {var_28}].q
6   0x4005da    rdi = rax
7   0x4005dd    call(atoi) ## 0x4004a0
8   0x4005e2    [rbp - 4 {var_c}].d = eax
...
```
---

```python
f1.get_regs_written_by(f1.low_level_il[7].address)
# ['rax', 'rcx', 'rdx', 'rsi', 'rdi', 'r8', 'r9', 'r10',
# 'r11', 'xmm0', 'xmm1', 'xmm2', 'xmm3', 'xmm4', 'xmm5',
# 'xmm6', 'xmm7', 'xmm8', 'xmm9', 'xmm10', 'xmm11', 'xmm12',
# 'xmm13', 'xmm14', 'xmm15']
```

---

# Working with LLIL

```python
f1.low_level_il[2]
# <il: r14d = r8d>

f1.low_level_il[2].operation
# <LowLevelILOperation.LLIL_SET_REG: 1>
```

---

# LLIL Operands

```python
f1.low_level_il[2].operands
# [r14d, <il: r8d>]

f1.low_level_il[2].operands[0].info
# <reg: size 4, offset 0 in r14, zero extend>

f1.low_level_il[2].operands[1].operation
# <LowLevelILOperation.LLIL_REG: 10>

f1.low_level_il[2].operands[1].possible_values
# <unsigned ranges: [<range: 0x0 to 0xffffffff>]>

bv.arch.get_low_level_il_from_bytes("\x90\x90", 0x0)
# <il: nop>
```

---

Some LLIL instruction types..

Name | Description
------------ | -------------
LLIL_CALL | Call to function
LLIL_CMP_E, LLIL_CMP_NE	 | (non) Equality comparison
LLIL_CMP_SGE | Signed greater or equal comparison
LLIL_CMP_UGT | Unsigned greater than comparison
LLIL_SET_REG | LLIL register assignment
LLIL_PUSH | LLIL push to stack
LLIL_POP | LLIL pop from stack

Full list at: https://api.binary.ninja/binaryninja.enums.LowLevelILOperation.html?highlight=lowleveliloperation

---

# Medium level Intermediate Language (MLIL)

Stack usage resolved
Types added

```python
f1.medium_level_il[3]
# <il: if (rax.eax == 0) then 4 @ 0x8fd else 5 @ 0x8e5>

f1.medium_level_il[0].dest.type
#<type: int32_t, 0% confidence>
```

---

MLIL instruction mostly equal to LLIL

Name | Description
------------ | -------------
MLIL_IF | if condition
MLIL_SYSCALL | syscall instruction

Full list at: https://api.binary.ninja/binaryninja.enums-module.html?highlight=mlil#binaryninja.enums.MediumLevelILOperation

---

---

# Crossreferences

```python
# Get address of strcpy
a = bv.get_symbols_by_name("strcpy")[0].address

# Search xrefs
bv.get_code_refs(a)
# [<ref: x86_64@0x406e51>, ...]

# Map xref to function
r1 = bv.get_code_refs(a)[0]
bv.get_functions_containing(r1.address)[0].name
# sub_406d60

```

---

# Background tasks

```python
class DoSomethingAs(BackgroundTaskThread):
      def __init__(self, view):
        BackgroundTaskThread.__init__(self, "", True)
        self.progress = "Doing something..."
        self.view = view

      def doSomething():
        ...
```

---

## plugin.json

```json

{
	"plugin": {
		"name": "msdn",
		"type": ["ui"],
		"api": "python2",
		"description": "Search MSDN api reference",
		"longdescription": "...",
		"license": {
			"name": "MIT"
		},
		"version": "0.0.1",
		"author": "Benedikt Schmotzle"
	}
}
```

---

## __init__.py

```python
from binaryninja import *

def search_and_render(bv):
	...

def search_and_render_addr(bv, address):
	...

# register plugin
PluginCommand.register("Search MSDN",
"Searches the MSDN Api and ...",
search_and_render)

PluginCommand.register_for_address(
'Search MSDN from instruction',
'Search MSDN for call from instruction',
search_and_render_addr)
```

---

## UI

```python

c = ChoiceField('Do it?', ['Yes', 'No'])
a = AddressField('Enter address')
get_form_input([c, a], "Window title")

print(c.result)
print(a.result)

```

```python
show_message_box(
 "BoxTitle",
 "BoxMessage"
)
```

---

# Other fields

https://api.binary.ninja/binaryninja.interaction-module.html

Name |
------------ |
DirectoryNameField |
IntegerField |
OpenFileNameField |
LineField |
MultilineField |
SaveFileNameField |

---

---

# Example: Dangerous functions plugin (aka Hello World)

---

# Further reading

https://binary.ninja/2017/04/17/BNIL-Series-Part-1.html
https://www.sophia.re/Binary-Rockstar/index.html
https://blog.trailofbits.com/2018/04/04/vulnerability-modeling-with-binary-ninja/

---

# Questions?

---

# Thank you

---


text:
# Productive twitter

> Twitter theme to increase productivity as per changes in July 2019.

![Screenshot](https://s3-us-west-2.amazonaws.com/s.cdpn.io/28963/Screen%20Shot%202019-07-20%20at%2012.48.58%20PM.png)

This version of twitter is very hard to override, so this extension is opinionated. You'll get the best results if you're using dim mode with pink (go into the more section of the left sidebar, click display, check DIM and pink).

If you don't want pink, no problem! You might want to fork this and change line 90 of `override.css` to the color of your choice. That's really the only thing that's pink.

_Fair warning: I don't have a lot of time to maintain this and am not really taking feature requests- it's something I made in one sitting that I use, and people asked me to open source. Please feel free to enjoy it and fork it for your own tweaks! You can always ask for bug fixes and features, but I'm not likely to work on them unless I really want the change, too. All that said, please enjoy! 🍻_

repository: Roninii/productive-twitter

repo_name: Roninii/productive-twitter


text:
# How to contribute to mathlib

Principally mathlib uses the fork-and-branch workflow. See
https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/
for a good introduction.

Here are some tips and tricks
to make the process of contributing as smooth as possible.

1. Use Zulip: https://leanprover.zulipchat.com/
   Discuss your contribution while you are working on it.
2. Adhere to the guidelines:
   - The [style guide](/docs/style.md) for contributors.
   - The explanation of [naming conventions](/docs/naming.md).
   - The [git commit conventions](https://github.com/leanprover/lean/blob/master/doc/commit_convention.md).
3. Create a pull request from a feature branch on your personal fork,
   as explained in the link above, or from a branch of the main repository if you have commit access (you can ask for access on Zulip).

## The nursery

Finally, https://github.com/leanprover-community/mathlib-nursery
makes it possible to have early access to work in progress.
See [its README](https://github.com/leanprover-community/mathlib-nursery/blob/master/README.md)
for more details.

## Caching compilation

In the `mathlib` git repository, run the following in a terminal:

```sh
$ scripts/setup-dev-scripts.sh
$ source ~/.profile
$ setup-lean-git-hooks
```

It will install scripts including `update-mathlib` and `cache-olean`
and setup git hooks that will call `cache-olean` when making a commit
and `cache-olean --fetch` and `update-mathlib` when checking out a
branch. `update-mathlib` will fetch a compiled version of `mathlib`
and `cache-olean` will store and fetch the compiled binaries of the
branches you work.

repository: fpvandoorn/mathlib

gha_language: Lean

repo_name: fpvandoorn/mathlib


text:
# Checkout API

These endpoints will allow you to go through the order checkout from the admin perspective. It can be useful for integrations with tools like `Twillo <https://www.twilio.com/docs/>`_ or an inspiration for your custom Shop API.
Base URI is `/api/v1/checkouts/`.

After you create a cart (an empty order) and add some items to it, you can start the checkout via API.
This basically means updating the order with concrete information, step by step, in a correct order.

Sylius checkout flow is built from 4 steps, which have to be done in a certain order (unless you will customize it).

```text
+------------+---------------------------------------------------------+
| Step       | Description                                             |
+============+=========================================================+
| addressing | Shipping and billing addresses are assigned to the cart |
+------------+---------------------------------------------------------+
| shipping   | Choosing a shipping method from the available ones      |
+------------+---------------------------------------------------------+
| payment    | Choosing a payment method from the available ones       |
+------------+---------------------------------------------------------+
| finalize   | The order is built and its data can be confirmed        |
+------------+---------------------------------------------------------+
```

### **Tip**

If you are not familiar with the concept of checkout in Sylius, please carefully read [This article](https://docs.sylius.com/en/latest/book/orders/checkout.html) first.

### **Note**

We do not present the order serialization in this chapter, because it is the same order serialization as described in [the article about orders](https://docs.sylius.com/en/latest/api/admin_api/orders.html).

# Addressing step

After you added some items to the cart, to start the checkout you simply need to provide a shipping address. You can also specify a different billing address if needed.

## Definition

```text
PUT /api/v1/checkouts/addressing/{id}
```

```text
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| Parameter                    | Parameter type | Description                                                                                |
+==============================+================+=====================================================================================================+
| Authorization                | header         | Token received during authentication                                                                |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| id                           | url attribute  | Id of the requested cart                                                                            |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| differentBillingAddress      | request        | If false, the billing address fields are not required and data from the shipping address is copied  |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| shippingAddress[firstName]   | request        | First name for the shipping address                                                                 |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| shippingAddress[lastName]    | request        | Last name for the shipping address                                                                  |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| shippingAddress[city]        | request        | City name                                                                                |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| shippingAddress[postcode]    | request        | Postcode                                                                                |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| shippingAddress[street]      | request        | Street                                                                                |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| shippingAddress[country]     | request        | Id of the country                                                                                |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| shippingAddress[province]    | request        | *(optional)* Id of the province                                                                     |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| billingAddress[firstName]    | request        | *(optional)* First name for the billing address                                                     |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| billingAddress[lastName]     | request        | *(optional)* Last name for the billing address                                                      |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| billingAddress[city]         | request        | *(optional)* City name                                                                              |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| billingAddress[postcode]     | request        | *(optional)* Postcode                                                                               |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| billingAddress[street]       | request        | *(optional)* Street                                                                                |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| billingAddress[country]      | request        | *(optional)* Id of the country                                                                      |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
| billingAddress[province]     | request        | *(optional)* Id of the province                                                                     |
+------------------------------+----------------+-----------------------------------------------------------------------------------------------------+
```

### **Note**

Remember a cart with `id = 21` for the [Cart API documentation](https://docs.sylius.com/en/latest/api/admin_api/carts.html)? We will take the same cart as an exemplary cart for checkout process.

## Example

To address the cart for a user that lives in ``Los Angeles`` in the United States, the following snippet can be used:

```bash
curl http://demo.sylius.com/api/v1/checkouts/addressing/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json" \
    -X PUT \
    --data '
        {
            "shippingAddress": {
                "firstName": "Elon",
                "lastName": "Musk",
                "street": "10941 Savona Rd",
                "countryCode": "US",
                "city": "’Los Angeles",
                "postcode": "CA 90077"
            },
            "differentBillingAddress": false
        }
    '
```

## Exemplary Response

```text
STATUS: 204 No Content
```

Now you can check the state of the order, by asking for the checkout summary:

## Example

To check the checkout process state for the cart with `id = 21`, we need to execute this command:

```bash
curl http://demo.sylius.com/api/v1/checkouts/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Accept: application/json"
```

## Exemplary Response

```text
STATUS: 200 OK
```

```json
{
    "id":21,
    "items":[
        {
            "id":74,
            "quantity":1,
            "unitPrice":100000,
            "total":100000,
            "units":[
                {
                    "id":228,
                    "adjustments":[
                    ],
                    "adjustmentsTotal":0
                }
            ],
            "unitsTotal":100000,
            "adjustments":[
            ],
            "adjustmentsTotal":0,
            "variant":{
                "id":331,
                "code":"MEDIUM_MUG_CUP",
                "optionValues":[
                    {
                        "code":"mug_type_medium"
                    }
                ],
                "position":2,
                "translations":{
                    "en_US":{
                    }
                },
                "onHold":0,
                "onHand":10,
                "tracked":false,
                "channelPricings":{
                    "US_WEB":{
                        "channelCode": "US_WEB",
                        "price":100000
                    }
                }
            },
            "_links":{
                "product":{
                    "href":"\/api\/v1\/products\/5"
                },
                "variant":{
                    "href":"\/api\/v1\/products\/5\/variants\/331"
                }
            }
        }
    ],
    "itemsTotal":100000,
    "adjustments":[
        {
            "id":249,
            "type":"shipping",
            "label":"UPS",
            "amount":8787
        }
    ],
    "adjustmentsTotal":8787,
    "total":108787,
    "state":"cart",
    "customer":{
        "id":1,
<EMAIL_ADDRESS><EMAIL_ADDRESS>        "firstName":"John",
        "lastName":"Doe",
        "gender":"u",
        "user":{
            "id":1,
<EMAIL_ADDRESS><EMAIL_ADDRESS>            "roles":[
                "ROLE_USER"
            ],
            "enabled":true
        },
        "_links":{
            "self":{
                "href":"\/api\/v1\/customers\/1"
            }
        }
    },
    "channel":{
        "id":1,
        "code":"US_WEB",
        "name":"US Web Store",
        "hostname":"localhost",
        "color":"MediumPurple",
        "createdAt":"2017-02-14T11:10:02+0100",
        "updatedAt":"2017-02-14T11:10:02+0100",
        "enabled":true,
        "taxCalculationStrategy":"order_items_based",
        "_links":{
            "self":{
                "href":"\/api\/v1\/channels\/1"
            }
        }
    },
    "shippingAddress":{
        "firstName":"Elon",
        "lastName":"Musk",
        "countryCode":"US",
        "street":"10941 Savona Rd",
        "city":"\u2019Los Angeles",
        "postcode":"CA 90077"
    },
    "billingAddress":{
        "firstName":"Elon",
        "lastName":"Musk",
        "countryCode":"US",
        "street":"10941 Savona Rd",
        "city":"\u2019Los Angeles",
        "postcode":"CA 90077"
    },
    "payments":[
        {
            "id":21,
            "method":{
                "id":1,
                "code":"cash_on_delivery"
            },
            "amount":108787,
            "state":"cart"
        }
    ],
    "shipments":[
        {
            "id":21,
            "state":"cart",
            "method":{
                "code":"ups",
                "enabled":true
            }
        }
    ],
    "currencyCode":"USD",
    "localeCode":"en_US",
    "checkoutState":"addressed"
}
```

Of course, you can specify different shipping and billing addresses. If our user Elon would like to send a gift to the NASA administrator, Frederick D. Gregory, he could send the following request:

```bash
curl http://demo.sylius.com/api/v1/checkouts/addressing/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json" \
    -X PUT \
    --data '
        {
            "shippingAddress": {
                "firstName": " Frederick D.",
                "lastName": "Gregory",
                "street": "300 E St SW",
                "countryCode": "US",
                "city": "’Washington",
                "postcode": "DC 20546"
            },
            "differentBillingAddress": true,
            "billingAddress": {
                "firstName": "Elon",
                "lastName": "Musk",
                "street": "10941 Savona Rd",
                "countryCode": "US",
                "city": "’Los Angeles",
                "postcode": "CA 90077"
            }
        }
    '
```

## Exemplary Response

```text
STATUS: 204 No Content
```

# Shipping step

When the order contains the address information, we are able to determine the available shipping methods.
First, we need to get the available shipping methods to have our choice list:

## Definition

```text
GET /api/v1/checkouts/select-shipping/{id}
```

```text
+---------------+----------------+--------------------------------------+
| Parameter     | Parameter type | Description                          |
+===============+================+======================================+
| Authorization | header         | Token received during authentication |
+---------------+----------------+--------------------------------------+
| id            | url attribute  | Id of the requested cart             |
+---------------+----------------+--------------------------------------+
```

## Example

To check available shipping methods for the previously addressed cart, you can use the following command:

```bash
curl http://demo.sylius.com/api/v1/checkouts/select-shipping/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json"
```

```text
STATUS: 200 OK
```

```json
{
    "shipments":[
        {
            "methods":[
                {
                    "id":1,
                    "code":"ups",
                    "name":"UPS",
                    "description":"Dolorem consequatur itaque neque non voluptas dolor.",
                    "price":8787
                },
                {
                    "id":2,
                    "code":"dhl_express",
                    "name":"DHL Express",
                    "description":"Voluptatem ipsum dolor vitae corrupti eum repellat.",
                    "price":3549
                },
                {
                    "id":3,
                    "code":"fedex",
                    "name":"FedEx",
                    "description":"Qui nostrum minus accusantium molestiae voluptatem eaque.",
                    "price":3775
                }
            ]
        }
    ]
}
```

The response contains proposed shipments and for each of them, it has a list of the available shipping methods alongside their calculated prices.

### **Warning**

Because of the custom calculation logic, the regular rules of overriding do not apply for this endpoint.
In order to have a different response, you have to provide a custom controller and build the message on your own.
Exemplary implementation can be found [here](https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/AdminApiBundle/Controller/ShowAvailableShippingMethodsController.php).

Next step is updating the order with the types of shipping methods that have been selected. A PUT request has to be send for each available shipment.

## Definition

```text
PUT /api/v1/checkouts/select-shipping/{id}
```

```text
+------------------------+----------------+----------------------------------------------------------------------------------------------+
| Parameter              | Parameter type | Description                                                                                |
+========================+================+==============================================================================================+
| Authorization          | header         | Token received during authentication                                                         |
+------------------------+----------------+----------------------------------------------------------------------------------------------+
| id                     | url attribute  | Id of the requested cart                                                                     |
+------------------------+----------------+----------------------------------------------------------------------------------------------+
| shipments[X]['method'] | request        | Code of the chosen shipping method (Where X is the number of shipment in the returned array) |
+------------------------+----------------+----------------------------------------------------------------------------------------------+
```

## Example

To choose the `DHL Express` method for our shipment (the cheapest one), we can use the following snippet:

```bash
curl http://demo.sylius.com/api/v1/checkouts/select-shipping/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json" \
    -X PUT \
    --data '
        {
            "shipments": [
                {
                    "method": "dhl_express"
                }
            ]
        }
    '
```

## Exemplary Response

```text
STATUS: 204 No Content
```

While checking for the checkout process state of the cart with `id = 21`, you will get the following response:

## Exemplary Response

```text
STATUS: 200 OK
```

```json
{
    "id":21,
    "items":[
        {
            "id":74,
            "quantity":1,
            "unitPrice":100000,
            "total":100000,
            "units":[
                {
                    "id":228,
                    "adjustments":[
                    ],
                    "adjustmentsTotal":0
                }
            ],
            "unitsTotal":100000,
            "adjustments":[
            ],
            "adjustmentsTotal":0,
            "variant":{
                "id":331,
                "code":"MEDIUM_MUG_CUP",
                "optionValues":[
                    {
                        "code":"mug_type_medium"
                    }
                ],
                "position":2,
                "translations":{
                    "en_US":{
                    }
                },
                "onHold":0,
                "onHand":10,
                "tracked":false,
                "channelPricings":{
                    "US_WEB":{
                        "channelCode": "US_WEB",
                        "price":100000
                    }
                }
            },
            "_links":{
                "product":{
                    "href":"\/api\/v1\/products\/5"
                },
                "variant":{
                    "href":"\/api\/v1\/products\/5\/variants\/331"
                }
            }
        }
    ],
    "itemsTotal":100000,
    "adjustments":[
        {
            "id":251,
            "type":"shipping",
            "label":"DHL Express",
            "amount":3549
        }
    ],
    "adjustmentsTotal":3549,
    "total":103549,
    "state":"cart",
    "customer":{
        "id":1,
<EMAIL_ADDRESS><EMAIL_ADDRESS>        "firstName":"John",
        "lastName":"Doe",
        "gender":"u",
        "user":{
            "id":1,
<EMAIL_ADDRESS><EMAIL_ADDRESS>            "roles":[
                "ROLE_USER"
            ],
            "enabled":true
        },
        "_links":{
            "self":{
                "href":"\/api\/v1\/customers\/1"
            }
        }
    },
    "channel":{
        "id":1,
        "code":"US_WEB",
        "name":"US Web Store",
        "hostname":"localhost",
        "color":"MediumPurple",
        "createdAt":"2017-02-14T11:10:02+0100",
        "updatedAt":"2017-02-14T11:10:02+0100",
        "enabled":true,
        "taxCalculationStrategy":"order_items_based",
        "_links":{
            "self":{
                "href":"\/api\/v1\/channels\/1"
            }
        }
    },
    "shippingAddress":{
        "firstName":"Frederick D.",
        "lastName":"Gregory",
        "countryCode":"US",
        "street":"300 E St SW",
        "city":"\u2019Washington",
        "postcode":"DC 20546"
    },
    "billingAddress":{
        "firstName":"Frederick D.",
        "lastName":"Gregory",
        "countryCode":"US",
        "street":"300 E St SW",
        "city":"\u2019Washington",
        "postcode":"DC 20546"
    },
    "payments":[
        {
            "id":21,
            "method":{
                "id":1,
                "code":"cash_on_delivery"
            },
            "amount":103549,
            "state":"cart"
        }
    ],
    "shipments":[
        {
            "id":21,
            "state":"cart",
            "method":{
                "code":"dhl_express",
                "enabled":true
            }
        }
    ],
    "currencyCode":"USD",
    "localeCode":"en_US",
    "checkoutState":"shipping_selected"
}
```

# Payment step

When we are done with shipping choices and we know the final price of an order, we can select a payment method.

## Definition

```text
GET /api/v1/checkouts/select-payment/{id}
```

```text
+---------------+----------------+--------------------------------------+
| Parameter     | Parameter type | Description                          |
+===============+================+======================================+
| Authorization | header         | Token received during authentication |
+---------------+----------------+--------------------------------------+
| id            | url attribute  | Id of the requested cart             |
+---------------+----------------+--------------------------------------+
```

### **Warning**

Similar to the shipping step, this one has its own controller, which has to be replaced if you want to make some changes. Exemplary implementation can be found `here <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/AdminApiBundle/Controller/ShowAvailablePaymentMethodsController.php>`__

## Example

To check available payment methods for the cart that has a shipping methods assigned, we need to execute this curl command:

```bash
curl http://demo.sylius.com/api/v1/checkouts/select-payment/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json"
```

```text
STATUS: 200 OK
```

```json
{
    "payments":[
        {
            "methods":[
                {
                    "id":1,
                    "code":"cash_on_delivery",
                    "name":"Cash on delivery",
                    "description":"Ipsum dolor non esse quia sit."
                },
                {
                    "id":2,
                    "code":"bank_transfer",
                    "name":"Bank transfer",
                    "description":"Perspiciatis itaque earum quisquam ut dolor."
                }
            ]
        }
    ]
}
```

With that information, another ``PUT`` request with the id of payment method is enough to proceed:

## Definition

```text
PUT /api/v1/checkouts/select-payment/{id}
```

```text
+----------------------+----------------+--------------------------------------+
| Parameter            | Parameter type | Description                          |
+======================+================+======================================+
| Authorization        | header         | Token received during authentication |
+----------------------+----------------+--------------------------------------+
| id                   | url attribute  | Id of the requested cart             |
+----------------------+----------------+--------------------------------------+
| payment[X]['method'] | request        | Code of chosen payment method        |
+----------------------+----------------+--------------------------------------+
```

## Example

To choose the ``Bank transfer`` method for our shipment, simply use the following code:

```bash
curl http://demo.sylius.com/api/v1/checkouts/select-payment/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json" \
    -X PUT \
    --data '
        {
            "payments": [
                {
                    "method": "bank_transfer"
                }
            ]
        }
    '
```

## Exemplary Response

```text
STATUS: 204 No Content
```

# Finalize step

After choosing the payment method we are ready to finalize the cart and make an order. Now, you can get its snapshot by calling a ``GET`` request:

### **Tip**

The same definition has been used over this chapter, to see the current state of the order.

## Definition

```text
GET /api/v1/checkouts/{id}
```

```text
+---------------+----------------+--------------------------------------+
| Parameter     | Parameter type | Description                          |
+===============+================+======================================+
| Authorization | header         | Token received during authentication |
+---------------+----------------+--------------------------------------+
| id            | url attribute  | Id of the requested cart             |
+---------------+----------------+--------------------------------------+
```

## Example

To check the fully constructed cart with `id = 21`, use the following command:

```bash
curl http://demo.sylius.com/api/v1/checkouts/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json"
```

```text
STATUS: 200 OK
```

```json
{
    "id":21,
    "items":[
        {
            "id":74,
            "quantity":1,
            "unitPrice":100000,
            "total":100000,
            "units":[
                {
                    "id":228,
                    "adjustments":[
                    ],
                    "adjustmentsTotal":0
                }
            ],
            "unitsTotal":100000,
            "adjustments":[
            ],
            "adjustmentsTotal":0,
            "variant":{
                "id":331,
                "code":"MEDIUM_MUG_CUP",
                "optionValues":[
                    {
                        "code":"mug_type_medium"
                    }
                ],
                "position":2,
                "translations":{
                    "en_US":{
                    }
                },
                "onHold":0,
                "onHand":10,
                "tracked":false,
                "channelPricings":{
                    "US_WEB":{
                        "channelCode":"US_WEB",
                        "price":100000
                    }
                }
            },
            "_links":{
                "product":{
                    "href":"\/api\/v1\/products\/5"
                },
                "variant":{
                    "href":"\/api\/v1\/products\/5\/variants\/331"
                }
            }
        }
    ],
    "itemsTotal":100000,
    "adjustments":[
        {
            "id":252,
            "type":"shipping",
            "label":"DHL Express",
            "amount":3549
        }
    ],
    "adjustmentsTotal":3549,
    "total":103549,
    "state":"cart",
    "customer":{
        "id":1,
<EMAIL_ADDRESS><EMAIL_ADDRESS>        "firstName":"John",
        "lastName":"Doe",
        "gender":"u",
        "user":{
            "id":1,
<EMAIL_ADDRESS><EMAIL_ADDRESS>            "roles":[
                "ROLE_USER"
            ],
            "enabled":true
        },
        "_links":{
            "self":{
                "href":"\/api\/v1\/customers\/1"
            }
        }
    },
    "channel":{
        "id":1,
        "code":"US_WEB",
        "name":"US Web Store",
        "hostname":"localhost",
        "color":"MediumPurple",
        "createdAt":"2017-02-14T11:10:02+0100",
        "updatedAt":"2017-02-14T11:10:02+0100",
        "enabled":true,
        "taxCalculationStrategy":"order_items_based",
        "_links":{
            "self":{
                "href":"\/api\/v1\/channels\/1"
            }
        }
    },
    "shippingAddress":{
        "firstName":"Frederick D.",
        "lastName":"Gregory",
        "countryCode":"US",
        "street":"300 E St SW",
        "city":"\u2019Washington",
        "postcode":"DC 20546"
    },
    "billingAddress":{
        "firstName":"Frederick D.",
        "lastName":"Gregory",
        "countryCode":"US",
        "street":"300 E St SW",
        "city":"\u2019Washington",
        "postcode":"DC 20546"
    },
    "payments":[
        {
            "id":21,
            "method":{
                "id":2,
                "code":"bank_transfer"
            },
            "amount":103549,
            "state":"cart"
        }
    ],
    "shipments":[
        {
            "id":21,
            "state":"cart",
            "method":{
                "code":"dhl_express",
                "enabled":true
            }
        }
    ],
    "currencyCode":"USD",
    "localeCode":"en_US",
    "checkoutState":"payment_selected"
}
```

This is how your final order will look like. If you are satisfied with that response, simply call another ``PUT`` request to confirm the checkout, which will become a real order and appear in the backend.

## Definition

```text
PUT /api/v1/checkouts/complete/{id}
```

```text
+---------------+----------------+---------------------------------------------------------+
| Parameter     | Parameter type | Description                                             |
+===============+================+=========================================================+
| Authorization | header         | Token received during authentication                    |
+---------------+----------------+---------------------------------------------------------+
| id            | url attribute  | Id of the requested cart                                |
+---------------+----------------+---------------------------------------------------------+
| notes         | request        | *(optional)* Notes that should be attached to the order |
+---------------+----------------+---------------------------------------------------------+
```

## Example

To finalize the previously built order, execute the following command:

```bash
curl http://demo.sylius.com/api/v1/checkouts/complete/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json" \
    -X PUT
```

## Exemplary Response

```text
STATUS: 204 No Content
```

The order has been placed, from now on you can manage it only via orders endpoint.

Of course the same result can be achieved when the order will be completed with some additional notes:

## Example

To finalize  the previously built order (assuming that, the previous example has not been executed), try the following command:

```bash
curl http://demo.sylius.com/api/v1/checkouts/complete/21 \
    -H "Authorization: Bearer SampleToken" \
    -H "Content-Type: application/json" \
    -X PUT \
    --data '
        {
            "notes": "Please, call me before delivery"
        }
    '
```

## Exemplary Response

```text
STATUS: 204 No Content
```

repository: Sylius/SyliusAdminApiBundle

branch_name: refs/heads/main

gha_language: PHP

repo_name: Sylius/SyliusAdminApiBundle


text:
;;
;; Licensed to the Apache Software Foundation (ASF) under one
;; or more contributor license agreements.  See the NOTICE file
;; distributed with this work for additional information
;; regarding copyright ownership.  The ASF licenses this file
;; to you under the Apache License, Version 2.0 (the
;; "License"); you may not use this file except in compliance
;; with the License.  You may obtain a copy of the License at
;;
;;   http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing,
;; software distributed under the License is distributed on an
;; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
;; KIND, either express or implied.  See the License for the
;; specific language governing permissions and limitations
;; under the License.
;;

# Qpid Interop Test 0.3.0

Qpid Interop Test is a suite of AMQP interoperability tests.  More
about [Qpid Interop
Test]({{site_url}}/components/interop-test/index.html).

For a detailed list of the changes in this release, see the [release
notes](release-notes.html).

## Downloads

It's important to [verify the
integrity]({{site_url}}/download.html#verify-what-you-download) of
the files you download.

| Content | Download | Verify |
|---------|----------|--------|
| Interop Test | [qpid-interop-test-0.3.0.tar.gz](https://archive.apache.org/dist/qpid/interop-test/0.3.0/qpid-interop-test-0.3.0.tar.gz) | [ASC](https://archive.apache.org/dist/qpid/interop-test/0.3.0/qpid-interop-test-0.3.0.tar.gz.asc), [SHA512](https://archive.apache.org/dist/qpid/interop-test/0.3.0/qpid-interop-test-0.3.0.tar.gz.sha512)|

## Documentation

 - [Quickstart guide](QUICKSTART.html)
 - [User guide](USERSGUIDE.html)
 - [Developer overview](https://gitbox.apache.org/repos/asf?p=qpid-interop-test.git;a=blob_plain;f=docs/qpid-interop-test-devel-overview.txt;hb=0.3.0)
 - [Test HOWTO](https://gitbox.apache.org/repos/asf?p=qpid-interop-test.git;a=blob_plain;f=docs/Test_HOWTO.txt;hb=0.3.0)
 - [Shim HOWTO](https://gitbox.apache.org/repos/asf?p=qpid-interop-test.git;a=blob_plain;f=docs/Shim_HOWTO.txt;hb=0.3.0)

## More information

 - [All release artefacts](https://archive.apache.org/dist/qpid/interop-test/0.3.0)
 - [Resolved issues in JIRA](https://issues.apache.org/jira/issues/?jql=project+%3D+QPIDIT+AND+fixVersion+%3D+%270.3.0%27+AND+resolution+%3D+%27fixed%27+ORDER+BY+priority+DESC)
 - [Source repository tag](https://gitbox.apache.org/repos/asf/qpid-interop-test.git/tree/refs/tags/0.3.0)

<script type="text/javascript">
  _deferredFunctions.push(function() {
      if ("0.3.0" === "{{current_interop_test_release}}") {
          _modifyCurrentReleaseLinks();
      }
  });
</script>

repository: apache/qpid-site

branch_name: refs/heads/asf-site

repo_name: apache/qpid-site


text:
# CleanPy
Organizes files in folders and helps you to clean your PC

- Join our Telegram group via the link given [below](#community)
- Read about it on my [blog](https://prashants.in/blog/cleanpy-python-script-to-organize-your-files/)

## How to use
- `git clone https://github.com/prashantsengar/CleanPy.git`
- `cd CleanPy`
- `python main.py`
- `python webapp.py` # for the web interface
  * requires to install Flask for web interface. use `pip install flask`

## What it does
Organizes the files based on their extensions in folders.

- Additional features (to be added)

It notifies about Battery Status giving you it's stats along with a csv file in which usage stats are also recorded. The Time Notifier file notifies you to take breaks for every 20 minutes based on 20-20-20 rule by displaying a tkinter window box for 20 seconds with other options too along with displaying a quote.

### Features
Currently it has 2 modes

- Easy mode: Organzises files in the current directory
- Hard mode: Organizes files in the current directory and its subdirectories

## What's next

### Make it a complete cleaning suite by adding these features
- Add a feature to walk through the PC and get info about large files
- Find duplicate files in PC

### Make a complete PC suite by integrating other features
- Feature to notify the user to take breaks
- Notify about battery percentage as in this [repo](https://github.com/prashantsengar/BatteryNotifier)
- Get info about PC health

## Community

Read the [contributing guide](./CONTRIBUTING.md)

Join the Telegram group for support and contributing. If you want to contribute, joining the group helps us all a lot because you can get instant feedback.

[<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Telegram_logo.svg/1024px-Telegram_logo.svg.png" alt="mTracker Telegram Group" width="150" height="150">](https://t.me/joinchat/INDdLlDf-SFDPURESGgdrQ)

repository: devsTudu/CleanPy

repo_name: devsTudu/CleanPy


text:
Pattern: Invalid custom check

Issue: -

## Description

It is possible to specify an ID of checks, so that it can be leveraged by the SuppressWarningsFilter to skip validations. The following examples show how to skip validations near code that has `@SuppressWarnings("checkstyle:<ID>"`) or just `@SuppressWarnings("<ID>")` annotation, where ID is the ID of checks you want to suppress.

## Examples

Example of Checkstyle check configuration:

```xml
<module name="RegexpSinglelineJava">
  <property name="id" value="systemout"/>
  <property name="format" value="^.*System\.(out|err).*$"/>
  <property name="message"
    value="Don't use System.out/err, use SLF4J instead."/>
</module>
```

## Further Reading

* [checkstyle - Filters](https://checkstyle.sourceforge.io/filters/suppresswarningsfilter.html)

repository: Adroiti/docs-for-code-review-tools

repo_name: Adroiti/docs-for-code-review-tools


text:
# OneBusAway Phone and SMS

OneBusAway supports phone interactive voice response (IVR) and SMS functionality, allowing users to call in or send a
text with a plain-old cellphone to get real-time transit information on their phone.  Users can access real-time transit
arrival information by entering  their stop code for a particular stop:

<img src="StopNumber.jpg" />

Additional features include:

* bookmarking frequently access stops for quick access
* search for stop by route when stop codes aren't available


text:
{{{
  "title": "The 5 minute guide to free your mind",
  "tags": ["tavel", "stress", "sports"],
  "category": "life",
  "date": "Sat, 28 Sep 2013 18:11:06 GMT",
  "color":"blue"
}}}

As we live now, we have to deal with vast variety of thoughts throughout our daily routine. It does not really matter if those are thoughts about how to solve a problem in your job or private life, the list of items you are putting on your imaginary shopping list, or just random thoughts that come to your mind and take down your productivity or even your wellbeing. Read on to find out how I try to cope with this mind clutter and go about to clean my mind.
<!--more-->
In the past years I often came to the point where my head was so full with different thoughts, which made it impossible to concentrate on a single one. I knew that I had to change something.

As I began my research, I found a ton of information of how people were dealing with their stressful environment. Things like making a time table to plan your day, or divide your day into chunks where you deal with different problems. I tested these methods and found that they made my day even more stressful as I now not only had to think about the thoughts in my head but also about the time slots and chunks that I divided my day into.

This is why I wanted to get down to the basics of avoiding and relieving stress and a cluttered mind.

## Deal with distractions

In my daily work I am being approached by different people throughout the day. People that need information about the current status of my work, asking for help or just want to chat. However little these distractions might be, they disrupt the flow of thought and therefore cripple your productivity.

Here are a few tips how you can avoid those distractions:

*   **Use Headphones**
You should wear headphones, even if you do not listen to music, people will
think twice before talking to you. Headphones are an obvious sign that you do
not want to be disturbed. If possible try to get noise cancelling ones, they
even reduce the interference of noises around you.
*   **Avoid your desk**
If you cannot be found at your usual spot, people will also think twice before
interrupting you. You can try to ask for a place at a client, or use otherwise
unoccupied working places.
*   **Turn off E-Mail notifications**
You should disable all kinds of notifications that will try to get your
attention away from your task. You can always go back and check on messages in
a break.

Avoiding
distractions will make it much easier for you to focus and consolidate your
tasks. You will see that you can get things done!

## Relax and recharge

Once every
now and then your mind needs some time to relax in order to function
efficiently, even more so if you are under constant stress. Unfortunately there
is no universal recipe to regain your energy and you will have to find out what
works best for yourself. I can just give you pointers what works for me:

*   **Sports**
A few months ago I stumbled across [an
article](http://well.blogs.nytimes.com/2013/05/09/the-scientific-7-minute-workout/?smid=fb-share) on the so called 7 minute workout. Since I did not have a lot of
time to spare and still wanted to get some exercise, I included those 7 painful
minutes into my schedule for every other day. It turned out to be a very good
compensation to my work in front of the computer and I felt better and better
after every set. When I felt all those nice benefits I moved from the 2 day
schedule to a daily one.
*   **Hiking** ![Hiking in Norway](http://images.supnig.com/media/pictures/trekking.jpg)
From all the travels I did so far, I found the trekking trips to be the most rewarding in
terms of relaxing and recharging your mind. After one or two days of constant
physical exhaustion I get to this point where there a no thoughts in my head
and I am just enjoying the moment. If you can maintain this state for a few
days, you will see your head and mind relax and full of energy once you are back
from your trip.
*   **Cooking**
Preparing fresh food is one of the most relaxing things in my daily routine. I really like to
cook and it does not really matter if it is just for myself or for a bunch of
people. All the different tastes and smells are making it easy to just concentrate
on the process of creation and the outcome is just as much rewarding.
*   **Meditation**
After I started the workout I described above, I wanted to also try other ways of recharging my
mind and started to meditate two times a week. I found it very hard at first
and I let myself be distracted too often. I then switched to yoga, which
combines meditation with physical exercise and I got much better results. I am
now feeling rejuvenated after every yoga session.

It is also very important to keep your recharging schedule. Do not become sloppy and find
excuses to not do your exercise or your run. Now you can go out and find the
perfect source of relaxation and energy for yourself.

I would love to hear what you do to get a free
mind and regain your energy. Describe your way in the comments below!


text:
---
title: API Parameters
---

# Inlined CSV

When you are not able to automatically extract an API parameter definition you can use
the `api-parameters` fence plugin to manually document them.

    ```api-parameters
    firstName, String, description with *markdown* support
    score, Integer, another description line with *markdown* support
    ```

```api-parameters
firstName, String, description with *markdown* support
score, Integer, another description line with *markdown* support
```

# Nested

Use `parent.children` syntax to define nested objects like this:

    ```api-parameters
    sessionId, Integer, session Id
    person, Person, person to login with
    person.firstName, String, first name of the person
    person.lastName, String, last name of the person
    roles, List<Role>, list of authorized roles
    roles.id, String, role id
    roles.description, String, role description
    ```

Note: when using this approach it is necessary to explicitly define a `root` entry, such as `person` in this example.

```api-parameters
sessionId, Integer, session Id
person, Person, person to login with
person.firstName, String, first name of the person
person.lastName, String, last name of the person
roles, List<Role>, list of authorized roles
roles.id, String, role id
roles.description, String, role description
```

Note: if a parameter name actually contains a period ("."), you can prevent this nesting behavior by putting the parameter name in single quotes, e.g. 'person.firstName'

# Title

Use the `title` parameter to specify a title.

    ```api-parameters {title: "Person Definition"}
    firstName, String, description with *markdown* support
    score, Integer, another description line with *markdown* support
    ```

```api-parameters {title: "Person Definition"}
firstName, String, description with *markdown* support
score, Integer, another description line with *markdown* support
```

# External JSON File

Instead of hardcoding your parameters inside markdown files, you can specify an external JSON file.
JSON could be generated based on the data you have. Some of the examples:
* build time annotation processor
* test time command line parameters generation

:include-json: api-parameters.json {title: "api-parameters.json"}

Given the above file, use

    :include-api-parameters: api-parameters.json {title: "Person Definition"}

to display it as API Parameters

:include-api-parameters: api-parameters.json {title: "Person Definition"}

Note: `description` field in JSON file is treated as Markdown

repository: vladimiratwork/znai

repo_name: vladimiratwork/znai


text:
---
layout: page
title: About
permalink: /about/
---

This website is meant to help people to reach me directly. I always look for some open source work in my free time.
If you would like to have me on your team, here is my [resume](/resume)  :bowtie:.
This site is hosted on github [here](https://github.com/gupta-shantanu/gupta-shantanu.github.io) and was originally forked from this awesome [jekyll now repository](https://github.com/barryclark/jekyll-now).

### More Information

I am a final year Computer Science & Engineering student at [BIET, Jhansi](http://bietjhs.ac.in). My home town is Lucknow, India. You may contact me using any of the following ways.

### Contact me
:telephone_receiver: [+91<PHONE_NUMBER>](tel:+918765453565)
:email: [shantanugupta.sg<EMAIL_ADDRESS>     *(personal)*
:e-mail: [shantanu<EMAIL_ADDRESS>*(discuss bugs/issues)*


text:
# twsh

[![Logo](https://i.imgur.com/Yu0lJ1E.png)](https://github.com/azawakh/twsh)

You can enjoy twitter on your cli.

[![npm version](https://badge.fury.io/js/twsh.svg)](https://badge.fury.io/js/twsh)
[![Build Status](https://travis-ci.org/azawakh/twsh.svg?branch=master)](https://travis-ci.org/azawakh/twsh)
[![Maintainability](https://api.codeclimate.com/v1/badges/6f4cd6a0e7feafbdade1/maintainability)](https://codeclimate.com/github/azawakh/twsh/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/6f4cd6a0e7feafbdade1/test_coverage)](https://codeclimate.com/github/azawakh/twsh/test_coverage)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)

## Installation

You can install the `twsh` command using npm:

```
$ npm install -g twsh
```
You must allow twsh to post tweet by authentication.

## Usage

```
$ twsh auth
```

Then, you can enjoy twitter on your cli.

```
$ twsh post
```

If you want to use twsh by another account, you must do authtication and change account.

```
$ twsh auth
$ twsh change_user
```

## License

MIT @hagevvashi

repository: hagevvashi/twsh

repo_name: hagevvashi/twsh


text:
# Using R for stats

The main performance issue for most websites is the network - i.e. number of requests, large files, slow connection, etc.

However the time it takes to create the HTML is also a factor (ideally less than 100ms).

For example, I create websites that manage customer records, orders, reports, etc. So I need to make sure the server does not take several seconds to create the HTML.

So I've set up my servers to record how long this takes, then I use R to analyse those log files on a weekly basis.

This allows me to:

1. Ensure I don't have any requests that take longer than 1 second to process.
2. Summarise the pages that take longer than 100ms, and how often they are used.
3. See how performance is affected over time (e.g. when the backups run).
4. Show how changes to the website affects performance.

You can also see individual requests that took much longer than expected, for example:

1. When using a domain name to connect to the database, the DNS lookup can take a few seconds.
2. When using PHP sessions, a slow response can affect other requests as well (due to the session lock).
3. When checking if email addresses include a valid domain name, it can take a few seconds for a response.
4. When using a third party API, a timeout might not work as you expect (e.g. [fsockopen](https://php.net/fsockopen) vs [stream_set_timeout](https://php.net/stream_set_timeout)).
5. Hard drives can start having problems, or the CPU may be busy on other things (especially on a virtual machine).

And while not strictly related to performance, you can also see:

1. General stats, like the number of requests over time.
2. A list of [404](https://en.wikipedia.org/wiki/HTTP_404) errors.
3. How often customers have problems filling out a form (error message could use a [200](https://en.wikipedia.org/wiki/HTTP_200) response, success a [302](https://en.wikipedia.org/wiki/HTTP_302)).
4. How many times the admin log in (i.e. a POST to the login form, with a 302 or a 200 response).
5. Search terms being used by customers, and how effective the results are (i.e. looking at the referrer).

All you need to do is record the time it takes to create the response, then load the log file into R with:

	data = read.table("/path/to/access_log", sep=" ");

My full notes on how to cleanup the data, and create tables and graphs can be seen at:

[https://github.com/craigfrancis/r-stats/](https://github.com/craigfrancis/r-stats/)

repository: craigfrancis/r-stats

repo_name: craigfrancis/r-stats


text:
# stackexchange-quickcomment2

This is a tool for Stack Exchange users that allows you to use automatic keyboard-only snippets while typing a comment.

Simply press the hotkey (Alt+X by default), type in the name (or a substring of the name) of the snippet you wish to use (such as "welcome" or "linkonly"), and hit enter.

## Usage instructions

1. Install userscript (in Chrome, type `chrome://extensions` in the URL bar and
   drag'n'drop the qc2.user.js file into the page)
2. Visit a Stack Exchange site and start writing a comment
3. Press Alt+X, enjoy

## Screenshots

![](img/shot1.png)

![](img/shot2.png)

## Demo GIFs

My recording program managed to mangle the colors so badly that some of the
text isn't even visible. Sorry about that :/

### Inserting an autocomment

![](img/demo1.gif)

### Changing the hotkey

![](img/demo2.gif)

### Other settings (editing an autocomment)

![](img/demo3.gif)

### Narrowing down via typing substrings

![](img/demo4.gif)


text:
### WillowTree is Hiring!

Want to write Go for mobile applications? Want to write anything else for mobile
applications? [Check out our openings!](http://willowtreeapps.com/careers/)

# Acorn

Generate all the things!

Blog post coming soon!

## Installation

```
go get github.com/willowtreeapps/acorn
```

repository: willowtreeapps/acorn

repo_name: willowtreeapps/acorn


text:
```tut:invisible
type XOR[A, B] = Either[A, B]
type AND[A, B] = (A, B)

trait Zip[F[_], G[_, _]]{
  def zip[A, B](a: F[A], b: F[B]): F[G[A, B]]
}
implicit def zipListTuple2: Zip[List, Tuple2] = new Zip[List, Tuple2]{
  override def zip[A, B](a: List[A], b: List[B]): List[(A, B)] = a.zip(b)
}
implicit def zip[F[_], G[_, _], A, B](implicit F: Zip[F, G], a: F[A], b: F[B]): F[G[A, B]] =
  F.zip(a, b)

implicit def a: List[Int] = List(1)
implicit def b: List[String] = List("2")
implicit def c: List[Double] = List(3.0)
implicit def d: List[Long] = List(4L)
implicit def e: List[Char] = List('5')

type Tree1 = List[((Char, Int), (String, Double))]
type Tree2 = List[((Int, (Char, String)), (Long, Double))]
val tree1 = implicitly[Tree1]
val tree2 = implicitly[Tree2]

trait TreeId[T]{
  def id: Int
}
trait TreeProcessor[Tree]{
  def process(in: Tree): Unit
}

trait Application[Id, Tree]{
  def process(id: Int): Either[String, Int]
}
object Application{
  implicit def process[Id, Tree](implicit treeId: TreeId[Id], tree: Tree, tProc: TreeProcessor[Tree]): Application[Id, Tree] =
    new Application[Id, Tree]{
      override def process(id: Int): Either[String, Int] = {
        if(id == treeId.id){
          tProc.process(tree)
          Right(id)
        }else{
          Left(treeId.id.toString)
        }
      }
    }

  implicit def processCoproduct[Id1, Id2, Tree1, Tree2](implicit
    app1: Application[Id1, Tree1],
    app2: Application[Id2, Tree2]): Application[Id1 XOR Id2, Tree1 XOR Tree2] =
    new Application[Id1 XOR Id2, Tree1 XOR Tree2]{
      override def process(id: Int): Either[String, Int] = {
        app1.process(id) match{
          case Right(_) => Right(id)
          case Left(a) => app2.process(id) match{
            case Right(_) => Right(id)
            case Left(b) => Left(a + ", " + b)
          }
        }
      }
    }
  implicit def processProduct[Id, Tree1, Tree2](implicit
    app1: Application[Id, Tree1],
    app2: Application[Id, Tree2]): Application[Id, Tree1 AND Tree2] =
    new Application[Id, Tree1 AND Tree2]{
      override def process(id: Int): Either[String, Int] = {
        def wrong(id: String) = Left(id)
        def right = Right(id)
        (app1.process(id), app2.process(id)) match{
          case (Right(_), Right(_)) => right
          case (Right(_), Left(id)) => wrong(id)
          case (Left(id), Right(_)) => wrong(id)
          case (Left(id), _) => wrong(id)
        }
      }
    }
}
```

# Previous Exercises
## Write three trees and make them into a single product Application.
Recall our two trees
```tut:book
implicit def a: List[Int] = List(1)
implicit def b: List[String] = List("2")
implicit def c: List[Double] = List(3.0)
implicit def d: List[Long] = List(4L)
implicit def e: List[Char] = List('5')

type Tree1 = List[((Char, Int), (String, Double))]
type Tree2 = List[((Int, (Char, String)), (Long, Double))]
val tree1 = implicitly[Tree1]
val tree2 = implicitly[Tree2]
```
Let's make a third
```tut:book
type Tree3 = List[(Int, (String, (Double, (Long, Char))))]
val tree3 = implicitly[Tree3]
```
We also need ids. First for convenience
```tut:book
object TreeId{
  def create[T](_id: Int): TreeId[T] = new TreeId[T]{
    override def id: Int = _id
  }
}
```
And the IDs for our trees
```tut:book
trait One
implicit def id1: TreeId[One] = TreeId.create[One](1)
```
Finally, the `TreeProcessor` instances for which we will add a convenience constructor
```tut:book
object TreeProcessor{
  def create[T](f: T => Unit): TreeProcessor[T] = new TreeProcessor[T]{
    override def process(in: T): Unit = f(in)
  }
}

implicit def processor1 = TreeProcessor.create[Tree1](println)
implicit def processor2 = TreeProcessor.create[Tree2](println)
implicit def processor3 = TreeProcessor.create[Tree3](println)
```
Now, that we have all our pieces, we can build our `Application`s and combine them
```tut:book
import Application._
type App1 = Tree1 AND Tree2 AND Tree3

implicit val app1 = implicitly[Application[One, Tree1]]
implicit val app2 = implicitly[Application[One, Tree2]]
implicit val app3 = implicitly[Application[One, Tree3]]

implicit val app = implicitly[Application[One, App1]]
```

## Write two more Product trees.
Following the same pattern. First we need our `Tree`s
```tut:book
type Tree21 = List[(Int, (String, (Double, (Char, Long))))]
type Tree22 = List[((Int, String), (Double, (Long, Char)))]
type Tree23 = List[((Int, (String, Double)), (Long, Char))]
implicit val tree21 = implicitly[Tree21]
implicit val tree22 = implicitly[Tree22]
implicit val tree23 = implicitly[Tree23]

type Tree31 = List[(Char, (Long, (Double, (String, Int))))]
type Tree32 = List[((((Char, Long), Double), String), Int)]
type Tree33 = List[(((Char, Long), Double), (String, Int))]
implicit val tree31 = implicitly[Tree31]
implicit val tree32 = implicitly[Tree32]
implicit val tree33 = implicitly[Tree33]
```
Then `TreeId`s
```tut:book
trait Two
implicit def id2: TreeId[Two] = TreeId.create[Two](2)
trait Three
implicit def id3: TreeId[Three] = TreeId.create[Three](3)
```
`TreeProcessor` instances
```tut:book
implicit val processor21 = TreeProcessor.create[Tree21](println)
implicit val processor22 = TreeProcessor.create[Tree22](println)
implicit val processor23 = TreeProcessor.create[Tree23](println)
implicit val processor31 = TreeProcessor.create[Tree31](println)
implicit val processor32 = TreeProcessor.create[Tree32](println)
implicit val processor33 = TreeProcessor.create[Tree33](println)
```
Finally, we put all the pieces together
```tut:book
type App2 = Tree21 AND Tree22 AND Tree23
type App3 = Tree31 AND Tree32 AND Tree33

implicit val app21 = implicitly[Application[Two, Tree21]]
implicit val app22 = implicitly[Application[Two, Tree22]]
implicit val app23 = implicitly[Application[Two, Tree23]]
implicit val app31 = implicitly[Application[Three, Tree31]]
implicit val app32 = implicitly[Application[Three, Tree32]]
implicit val app33 = implicitly[Application[Three, Tree33]]

implicit val app2 = implicitly[Application[Two, App2]]
implicit val app3 = implicitly[Application[Three, App3]]
```

## Write a Coproduct tree from the 3 Product trees in the previous exercises.
After the other two parts, this falls out pretty quickly.
```tut:book
val application =
  implicitly[Application[One XOR Two XOR Three, App1 XOR App2 XOR App3]]
```

# Making Changes
These Applications are super simple.
All computation needs to happen in a single `TreeProcessor`.
This is fine for sufficiently simple use cases but as the business grows,
this library will be outgrown with it.
Let's add a `Write` step to our `Application`s.

First, we need to make the `TreeProcessor` produce an output.
```tut:book
trait TreeProcessor[Tree]{
  type Out
  def process(in: Tree): Out
}
object TreeProcessor{
  type Aux[T, O] = TreeProcessor[T]{type Out = O}
}
```

- Note On The Aux Pattern: On the JVM, parameterized types are not reified (type erasure). The Aux Pattern allows us to use a type member as a type parameter. This gives us the ability to reference the type far after erasure would have occurred while holding onto the familiar type parameter syntax. Commonly, if a type is in covariant position, it is provided as a type member rather than type parameter.

Now, we need a new type class for our `Write` step.
```tut:book
trait Write[ToWrite]{
  def write(toWrite: ToWrite): Unit
}
```
And, our Application needs to be rewritten to take advantage of the updated `TreeProcessor` and new `Write` type classes.
```tut:book
trait Application[Id, Tree, Out]{
  def process(id: Int): Either[String, Int]
}
```

# Exercises
1. Rewrite the `Application` object to produce values of the new and improved type classes.
2. Add a `QA` type class to check the input of the `TreeProcessor` before processing and the output of the `TreeProcessor` after processing.
3. Rewrite the `Application` trait and object to take advantage of `QA`.


text:
---
layout: post
title: The Elements of Style in Ruby
category: posts
---

[Bozhidar Batsov][] has a great blog series about [The Elements of Style in
Ruby][]. Check every single one of them. They are all a great read.

Good stuff!

[Bozhidar Batsov]: https://github.com/bbatsov
[The Elements of Style in Ruby]: http://batsov.com/articles/categories/style/

extension: markdown

gha_language: CSS


text:
ServiceStack.Api.Postman [![Build status](https://ci.appveyor.com/api/projects/status/bwmnwyilk3eupiwd)](https://ci.appveyor.com/project/jarroda/servicestack-api-postman)
========================
[Postman](http://www.getpostman.com/) is a HTTP client designed to help test web services, and I have found it to be extremely helpful when developing REST based APIs.  One of its nicest features is the ability to save requests into '[collections](http://www.getpostman.com/docs/collections)', and the ability to import and export these collections for sharing with others.  I have written a simple ServiceStack plugin to enable the automatic generation of these collections.

## Installation

Install the NuGet package (https://www.nuget.org/packages/ServiceStack.Api.Postman/) or reference the library directly.

Enable Postman plugin in AppHost.cs with:

```csharp
    public override void Configure(Container container)
    {
        ...
        Plugins.Add(new PostmanFeature());

        // Add the CORS feature to allow direct import from the Postman app.
        Plugins.Add(new CorsFeature());
        ...
    }
```

Compile it. Now you can access the Postman endpoint at:
(Assuming service hosted at /api)

http://localhost:port/api/postman

Use this url when importing the collection into Postman.
## Configuration

By default, the postman service is only available when running locally.  To enable access from remote machines, turn off the LocalOnly flag.

```csharp
    public override void Configure(Container container)
    {
        ...
        Plugins.Add(new PostmanFeature { LocalOnly = false });
        ...
    }
```
#### Custom Labels
The generated label for the postman request can be customized using a format string with {type} and {route} placeholders.  These placeholders will be replaced with the request type and route and all other characters willl be left as-is.  The label format can be set either on the postman endpoint: `/postman?label={type}+{route}` or the `PostmanFeature`:

```csharp
    public override void Configure(Container container)
    {
        ...
        Plugins.Add(new PostmanFeature { DefaultLabel = "{type} {route}" });
        ...
    }
```
#### Custom Headers
Like custom labels, custom headers can be supplied for all postman requests.  By default, `Accept: text/json` is set on all requests, but this can be overridden on the postman endpoint or the `PostmanFeature`:

```csharp
    public override void Configure(Container container)
    {
        ...
        Plugins.Add(new PostmanFeature
        {
    	    DefaultHeaders = new[] { "Accept: text/json", "Authorization: Basic eDpwYXNzd29yZA==" },
        });
        ...
    }
```
or

    /postman?headers=Accept:+text/json,Authorization:+Basic+eDpwYXNzd29yZA==

gha_language: C#