text:
test_description='git commit'
. ./test-lib.sh
. "$TEST_DIRECTORY/diff-lib.sh"

author='The Real Author <someguy@his.email.org>'

test_tick

test_expect_success 'initial status' '
	echo bongo bongo >file &&
	git add file &&
	git status >actual &&
	test_i18ngrep "No commits yet" actual
'

test_expect_success 'fail initial amend' '
	test_must_fail git commit --amend
'

test_expect_success 'setup: initial commit' '
	git commit -m initial
'

test_expect_success '-m and -F do not mix' '
	git checkout HEAD file && echo >>file && git add file &&
	test_must_fail git commit -m foo -m bar -F file
'

test_expect_success '-m and -C do not mix' '
	git checkout HEAD file && echo >>file && git add file &&
	test_must_fail git commit -C HEAD -m illegal
'

test_expect_success 'paths and -a do not mix' '
	echo King of the bongo >file &&
	test_must_fail git commit -m foo -a file
'

test_expect_success PERL 'can use paths with --interactive' '
	echo bong-o-bong >file &&
	# 2: update, 1:st path, that is all, 7: quit
	( echo 2; echo 1; echo; echo 7 ) |
	git commit -m foo --interactive file &&
	git reset --hard HEAD^
'

test_expect_success 'using invalid commit with -C' '
	test_must_fail git commit --allow-empty -C bogus
'

test_expect_success 'nothing to commit' '
	git reset --hard &&
	test_must_fail git commit -m initial
'

test_expect_success '--dry-run fails with nothing to commit' '
	test_must_fail git commit -m initial --dry-run
'

test_expect_success '--short fails with nothing to commit' '
	test_must_fail git commit -m initial --short
'

test_expect_success '--porcelain fails with nothing to commit' '
	test_must_fail git commit -m initial --porcelain
'

test_expect_success '--long fails with nothing to commit' '
	test_must_fail git commit -m initial --long
'

test_expect_success 'setup: non-initial commit' '
	echo bongo bongo bongo >file &&
	git commit -m next -a
'

test_expect_success '--dry-run with stuff to commit returns ok' '
	echo bongo bongo bongo >>file &&
	git commit -m next -a --dry-run
'

test_expect_failure '--short with stuff to commit returns ok' '
	echo bongo bongo bongo >>file &&
	git commit -m next -a --short
'

test_expect_failure '--porcelain with stuff to commit returns ok' '
	echo bongo bongo bongo >>file &&
	git commit -m next -a --porcelain
'

test_expect_success '--long with stuff to commit returns ok' '
	echo bongo bongo bongo >>file &&
	git commit -m next -a --long
'

test_expect_success 'commit message from non-existing file' '
	echo more bongo: bongo bongo bongo bongo >file &&
	test_must_fail git commit -F gah -a
'

test_expect_success 'empty commit message' '
	# Empty except stray tabs and spaces on a few lines.
	sed -e "s/@//g" >msg <<-\EOF &&
		@		@
		@@
		@  @
		@Signed-off-by: hula@
	EOF
	test_must_fail git commit -F msg -a
'

test_expect_success 'template "emptyness" check does not kick in with -F' '
	git checkout HEAD file && echo >>file && git add file &&
	git commit -t file -F file
'

test_expect_success 'template "emptyness" check' '
	git checkout HEAD file && echo >>file && git add file &&
	test_must_fail git commit -t file 2>err &&
	test_i18ngrep "did not edit" err
'

test_expect_success 'setup: commit message from file' '
	git checkout HEAD file && echo >>file && git add file &&
	echo this is the commit message, coming from a file >msg &&
	git commit -F msg -a
'

test_expect_success 'amend commit' '
	cat >editor <<-\EOF &&
	#!/bin/sh
	sed -e "s/a file/an amend commit/g" < "$1" > "$1-"
	mv "$1-" "$1"
	EOF
	chmod 755 editor &&
	EDITOR=./editor git commit --amend
'

test_expect_success 'amend --only ignores staged contents' '
	cp file file.expect &&
	echo changed >file &&
	git add file &&
	git commit --no-edit --amend --only &&
	git cat-file blob HEAD:file >file.actual &&
	test_cmp file.expect file.actual &&
	git diff --exit-code
'

test_expect_success 'allow-empty --only ignores staged contents' '
	echo changed-again >file &&
	git add file &&
	git commit --allow-empty --only -m "empty" &&
	git cat-file blob HEAD:file >file.actual &&
	test_cmp file.expect file.actual &&
	git diff --exit-code
'

test_expect_success 'set up editor' '
	cat >editor <<-\EOF &&
	#!/bin/sh
	sed -e "s/unamended/amended/g" <"$1" >"$1-"
	mv "$1-" "$1"
	EOF
	chmod 755 editor
'

test_expect_success 'amend without launching editor' '
	echo unamended >expect &&
	git commit --allow-empty -m "unamended" &&
	echo needs more bongo >file &&
	git add file &&
	EDITOR=./editor git commit --no-edit --amend &&
	git diff --exit-code HEAD -- file &&
	git diff-tree -s --format=%s HEAD >msg &&
	test_cmp expect msg
'

test_expect_success '--amend --edit' '
	echo amended >expect &&
	git commit --allow-empty -m "unamended" &&
	echo bongo again >file &&
	git add file &&
	EDITOR=./editor git commit --edit --amend &&
	git diff-tree -s --format=%s HEAD >msg &&
	test_cmp expect msg
'

test_expect_success '--amend --edit of empty message' '
	cat >replace <<-\EOF &&
	#!/bin/sh
	echo "amended" >"$1"
	EOF
	chmod 755 replace &&
	git commit --allow-empty --allow-empty-message -m "" &&
	echo more bongo >file &&
	git add file &&
	EDITOR=./replace git commit --edit --amend &&
	git diff-tree -s --format=%s HEAD >msg &&
	./replace expect &&
	test_cmp expect msg
'

test_expect_success '--amend to set message to empty' '
	echo bata >file &&
	git add file &&
	git commit -m "unamended" &&
	git commit --amend --allow-empty-message -m "" &&
	git diff-tree -s --format=%s HEAD >msg &&
	echo "" >expect &&
	test_cmp expect msg
'

test_expect_success '--amend to set empty message needs --allow-empty-message' '
	echo conga >file &&
	git add file &&
	git commit -m "unamended" &&
	test_must_fail git commit --amend -m "" &&
	git diff-tree -s --format=%s HEAD >msg &&
	echo "unamended" >expect &&
	test_cmp expect msg
'

test_expect_success '-m --edit' '
	echo amended >expect &&
	git commit --allow-empty -m buffer &&
	echo bongo bongo >file &&
	git add file &&
	EDITOR=./editor git commit -m unamended --edit &&
	git diff-tree -s  --format=%s HEAD >msg &&
	test_cmp expect msg
'

test_expect_success '-m and -F do not mix' '
	echo enough with the bongos >file &&
	test_must_fail git commit -F msg -m amending .
'

test_expect_success 'using message from other commit' '
	git commit -C HEAD^ .
'

test_expect_success 'editing message from other commit' '
	cat >editor <<-\EOF &&
	#!/bin/sh
	sed -e "s/amend/older/g"  < "$1" > "$1-"
	mv "$1-" "$1"
	EOF
	chmod 755 editor &&
	echo hula hula >file &&
	EDITOR=./editor git commit -c HEAD^ -a
'

test_expect_success 'message from stdin' '
	echo silly new contents >file &&
	echo commit message from stdin |
	git commit -F - -a
'

test_expect_success 'overriding author from command line' '
	echo gak >file &&
	git commit -m author \
		--author "Rubber Duck <rduck@convoy.org>" -a >output 2>&1 &&
	grep Rubber.Duck output
'

test_expect_success PERL 'interactive add' '
	echo 7 |
	git commit --interactive |
	grep "What now"
'

test_expect_success PERL "commit --interactive doesn't change index if editor aborts" '
	echo zoo >file &&
	test_must_fail git diff --exit-code >diff1 &&
	(echo u ; echo "*" ; echo q) |
	(
		EDITOR=: &&
		export EDITOR &&
		test_must_fail git commit --interactive
	) &&
	git diff >diff2 &&
	compare_diff_patch diff1 diff2
'

test_expect_success 'editor not invoked if -F is given' '
	cat >editor <<-\EOF &&
	#!/bin/sh
	sed -e s/good/bad/g <"$1" >"$1-"
	mv "$1-" "$1"
	EOF
	chmod 755 editor &&

	echo A good commit message. >msg &&
	echo moo >file &&

	EDITOR=./editor git commit -a -F msg &&
	git show -s --pretty=format:%s >subject &&
	grep -q good subject &&

	echo quack >file &&
	echo Another good message. |
	EDITOR=./editor git commit -a -F - &&
	git show -s --pretty=format:%s >subject &&
	grep -q good subject
'

test_expect_success 'partial commit that involves removal (1)' '

	git rm --cached file &&
	mv file elif &&
	git add elif &&
	git commit -m "Partial: add elif" elif &&
	git diff-tree --name-status HEAD^ HEAD >current &&
	echo "A	elif" >expected &&
	test_cmp expected current

'

test_expect_success 'partial commit that involves removal (2)' '

	git commit -m "Partial: remove file" file &&
	git diff-tree --name-status HEAD^ HEAD >current &&
	echo "D	file" >expected &&
	test_cmp expected current

'

test_expect_success 'partial commit that involves removal (3)' '

	git rm --cached elif &&
	echo elif >elif &&
	git commit -m "Partial: modify elif" elif &&
	git diff-tree --name-status HEAD^ HEAD >current &&
	echo "M	elif" >expected &&
	test_cmp expected current

'

test_expect_success 'amend commit to fix author' '

	oldtick=$GIT_AUTHOR_DATE &&
	test_tick &&
	git reset --hard &&
	git cat-file -p HEAD |
	sed -e "s/author.*/author $author $oldtick/" \
		-e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \
		expected &&
	git commit --amend --author="$author" &&
	git cat-file -p HEAD > current &&
	test_cmp expected current

'

test_expect_success 'amend commit to fix date' '

	test_tick &&
	newtick=$GIT_AUTHOR_DATE &&
	git reset --hard &&
	git cat-file -p HEAD |
	sed -e "s/author.*/author $author $newtick/" \
		-e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \
		expected &&
	git commit --amend --date="$newtick" &&
	git cat-file -p HEAD > current &&
	test_cmp expected current

'

test_expect_success 'commit mentions forced date in output' '
	git commit --amend --date=2010-01-02T03:04:05 >output &&
	grep "Date: *Sat Jan 2 03:04:05 2010" output
'

test_expect_success 'commit complains about completely bogus dates' '
	test_must_fail git commit --amend --date=seventeen
'

test_expect_success 'commit --date allows approxidate' '
	git commit --amend \
		--date="midnight the 12th of october, anno domini 1979" &&
	echo "Fri Oct 12 00:00:00 1979 +0000" >expect &&
	git log -1 --format=%ad >actual &&
	test_cmp expect actual
'

test_expect_success 'sign off (1)' '

	echo 1 >positive &&
	git add positive &&
	git commit -s -m "thank you" &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
	(
		echo thank you
		echo
		git var GIT_COMMITTER_IDENT |
		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
	) >expected &&
	test_cmp expected actual

'

test_expect_success 'sign off (2)' '

	echo 2 >positive &&
	git add positive &&
	existing="Signed-off-by: Watch This <watchthis@example.com>" &&
	git commit -s -m "thank you

$existing" &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
	(
		echo thank you
		echo
		echo $existing
		git var GIT_COMMITTER_IDENT |
		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
	) >expected &&
	test_cmp expected actual

'

test_expect_success 'signoff gap' '

	echo 3 >positive &&
	git add positive &&
	alt="Alt-RFC-822-Header: Value" &&
	git commit -s -m "welcome

$alt" &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
	(
		echo welcome
		echo
		echo $alt
		git var GIT_COMMITTER_IDENT |
		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
	) >expected &&
	test_cmp expected actual
'

test_expect_success 'signoff gap 2' '

	echo 4 >positive &&
	git add positive &&
	alt="fixed: 34" &&
	git commit -s -m "welcome

We have now
$alt" &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
	(
		echo welcome
		echo
		echo We have now
		echo $alt
		echo
		git var GIT_COMMITTER_IDENT |
		sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"
	) >expected &&
	test_cmp expected actual
'

test_expect_success 'signoff respects trailer config' '

	echo 5 >positive &&
	git add positive &&
	git commit -s -m "subject

non-trailer line
Myfooter: x" &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
	(
		echo subject
		echo
		echo non-trailer line
		echo Myfooter: x
		echo
		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
	) >expected &&
	test_cmp expected actual &&

	echo 6 >positive &&
	git add positive &&
	git -c "trailer.Myfooter.ifexists=add" commit -s -m "subject

non-trailer line
Myfooter: x" &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
	(
		echo subject
		echo
		echo non-trailer line
		echo Myfooter: x
		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
	) >expected &&
	test_cmp expected actual
'

test_expect_success 'multiple -m' '

	>negative &&
	git add negative &&
	git commit -m "one" -m "two" -m "three" &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
	(
		echo one
		echo
		echo two
		echo
		echo three
	) >expected &&
	test_cmp expected actual

'

test_expect_success 'amend commit to fix author' '

	oldtick=$GIT_AUTHOR_DATE &&
	test_tick &&
	git reset --hard &&
	git cat-file -p HEAD |
	sed -e "s/author.*/author $author $oldtick/" \
		-e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \
		expected &&
	git commit --amend --author="$author" &&
	git cat-file -p HEAD > current &&
	test_cmp expected current

'

test_expect_success 'git commit <file> with dirty index' '
	echo tacocat > elif &&
	echo tehlulz > chz &&
	git add chz &&
	git commit elif -m "tacocat is a palindrome" &&
	git show --stat | grep elif &&
	git diff --cached | grep chz
'

test_expect_success 'same tree (single parent)' '

	git reset --hard &&
	test_must_fail git commit -m empty

'

test_expect_success 'same tree (single parent) --allow-empty' '

	git commit --allow-empty -m "forced empty" &&
	git cat-file commit HEAD | grep forced

'

test_expect_success 'same tree (merge and amend merge)' '

	git checkout -b side HEAD^ &&
	echo zero >zero &&
	git add zero &&
	git commit -m "add zero" &&
	git checkout master &&

	git merge -s ours side -m "empty ok" &&
	git diff HEAD^ HEAD >actual &&
	: >expected &&
	test_cmp expected actual &&

	git commit --amend -m "empty really ok" &&
	git diff HEAD^ HEAD >actual &&
	: >expected &&
	test_cmp expected actual

'

test_expect_success 'amend using the message from another commit' '

	git reset --hard &&
	test_tick &&
	git commit --allow-empty -m "old commit" &&
	old=$(git rev-parse --verify HEAD) &&
	test_tick &&
	git commit --allow-empty -m "new commit" &&
	new=$(git rev-parse --verify HEAD) &&
	test_tick &&
	git commit --allow-empty --amend -C "$old" &&
	git show --pretty="format:%ad %s" "$old" >expected &&
	git show --pretty="format:%ad %s" HEAD >actual &&
	test_cmp expected actual

'

test_expect_success 'amend using the message from a commit named with tag' '

	git reset --hard &&
	test_tick &&
	git commit --allow-empty -m "old commit" &&
	old=$(git rev-parse --verify HEAD) &&
	git tag -a -m "tag on old" tagged-old HEAD &&
	test_tick &&
	git commit --allow-empty -m "new commit" &&
	new=$(git rev-parse --verify HEAD) &&
	test_tick &&
	git commit --allow-empty --amend -C tagged-old &&
	git show --pretty="format:%ad %s" "$old" >expected &&
	git show --pretty="format:%ad %s" HEAD >actual &&
	test_cmp expected actual

'

test_expect_success 'amend can copy notes' '

	git config notes.rewrite.amend true &&
	git config notes.rewriteRef "refs/notes/*" &&
	test_commit foo &&
	git notes add -m"a note" &&
	test_tick &&
	git commit --amend -m"new foo" &&
	test "$(git notes show)" = "a note"

'

test_expect_success 'commit a file whose name is a dash' '
	git reset --hard &&
	for i in 1 2 3 4 5
	do
		echo $i
	done >./- &&
	git add ./- &&
	test_tick &&
	git commit -m "add dash" >output </dev/null &&
	test_i18ngrep " changed, 5 insertions" output
'

test_expect_success '--only works on to-be-born branch' '
	# This test relies on having something in the index, as it
	# would not otherwise actually prove much.  So check this.
	test -n "$(git ls-files)" &&
	git checkout --orphan orphan &&
	echo foo >newfile &&
	git add newfile &&
	git commit --only newfile -m"--only on unborn branch" &&
	echo newfile >expected &&
	git ls-tree -r --name-only HEAD >actual &&
	test_cmp expected actual
'

test_expect_success '--dry-run with conflicts fixed from a merge' '
	# setup two branches with conflicting information
	# in the same file, resolve the conflict,
	# call commit with --dry-run
	echo "Initial contents, unimportant" >test-file &&
	git add test-file &&
	git commit -m "Initial commit" &&
	echo "commit-1-state" >test-file &&
	git commit -m "commit 1" -i test-file &&
	git tag commit-1 &&
	git checkout -b branch-2 HEAD^1 &&
	echo "commit-2-state" >test-file &&
	git commit -m "commit 2" -i test-file &&
	! $(git merge --no-commit commit-1) &&
	echo "commit-2-state" >test-file &&
	git add test-file &&
	git commit --dry-run &&
	git commit -m "conflicts fixed from merge."
'

test_done


text:
DROP TABLE IF EXISTS dispensers;
CREATE TABLE dispensers (
    tx_index          INTEGER UNSIGNED,
    -- tx_hash        TEXT,
    tx_hash_id        INTEGER UNSIGNED, -- id of record in index_transactions
    block_index       INTEGER UNSIGNED,
    -- source         TEXT,
    source_id         INTEGER UNSIGNED, -- id of record in index_addresses
    -- asset          TEXT,
    asset_id          INTEGER UNSIGNED, -- id of record in assets table
    give_quantity     BIGINT, -- Tokens to vend per dispense
    escrow_quantity   BIGINT, -- Tokens to escrow in dispenser
    satoshirate       BIGINT, -- Bitcoin satoshis required per dispense
    give_remaining    BIGINT,
    oracle_address_id INTEGER UNSIGNED, -- id of record in index_addresses table
    status            TEXT
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE UNIQUE INDEX tx_index          ON dispensers (tx_index);
CREATE        INDEX tx_hash_id        ON dispensers (tx_hash_id);
CREATE        INDEX block_index       ON dispensers (block_index);
CREATE        INDEX source_id         ON dispensers (source_id);
CREATE        INDEX asset_id          ON dispensers (asset_id);
CREATE        INDEX oracle_address_id ON dispensers (oracle_address_id);

redpajama_set_name: RedPajamaGithub


text:
package com.google.gerrit.server.restapi.project;

import com.google.common.base.CaseFormat;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.TreeMap;

public class RepositoryStatistics extends TreeMap<String, Object> {
  private static final long serialVersionUID = 1L;

  RepositoryStatistics(Properties p) {
    for (Entry<Object, Object> e : p.entrySet()) {
      put(
          CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, e.getKey().toString()),
          e.getValue());
    }
  }
}


text:
import requests
import time
import os
import argparse
from requests_toolbelt.multipart.encoder import MultipartEncoderMonitor
from tqdm import tqdm

flush_time = 2  # this delay avoids sending a file that is not yet fully written

try:
    from urllib.parse import quote
except ImportError:
    from urllib import quote

cache = {}
upload_schedule = []

def progress(bytes_read, pbar):
    chunk_len = bytes_read - progress.last_len
    pbar.update(chunk_len)
    progress.last_len = bytes_read

def send_file(name, size):
    try:
        encoder = MultipartEncoderMonitor.from_fields(
            fields={'file': (name, open(os.path.join(args.directory_path, name), 'rb'))}
        )

        progress.last_len = 0
        pbar = tqdm(total=encoder.len, leave=True, unit_scale=True, unit='B', miniters=1, desc='sending {}'.format(name))
        monitor = MultipartEncoderMonitor(encoder, lambda monitor: progress(monitor.bytes_read, pbar))

        r = requests.post(upload_url, data=monitor, headers={'Content-Type': monitor.content_type})
        progress(size, pbar)
        if 'Success' not in r.text:
            print(r.text)
        else:
            print('done.\a')  # \a = audio signal

    except UnicodeDecodeError:
        exit('Oops, unicode filenames are not yet supported, please delete the file "{}" and try again. :('.format(name))

def get_remote_list():
    result = {}
    r = requests.get('{}/command.cgi?op=100&DIR=/'.format(url))
    for line in list(r.text.strip().split('\r\n'))[1:]:
        parts = line.split(',')
        name = parts[1]
        size = int(parts[2])
        attr = int(parts[3])

        if not attr & 16:  # not a directory
            result[name] = size

    return result

def remove_file(name):
    print('removing {}'.format(name))
    delete_url = '{}?DEL={}'.format(upload_url, quote(name))
    r = requests.get(delete_url)
    if 'SUCCESS' not in r.text:
        print(r.text)
    else:
        print('done.\a')  # \a = audio signal

def check_dir():
    if not hasattr(check_dir, 'first_run'):
        check_dir.first_run = True

    files = []
    for name in os.listdir(args.directory_path):
        file_path = os.path.join(args.directory_path, name)

        if os.path.isfile(file_path):
            extension = os.path.splitext(file_path)[1]

            if args.file_extensions is None or extension in args.file_extensions:
                files.append(name)
                stat = os.stat(file_path)

                if check_dir.first_run:
                    if args.initial_sync:
                        # file is not on card or has different size
                        if name not in initial_remote_list or initial_remote_list[name] != stat.st_size:
                            send_file(name, stat.st_size)

                    cache[name] = stat.st_mtime

                else:
                    # file is new or has changed
                    if name not in cache or cache[name] < stat.st_mtime - flush_time:
                        send_file(name, stat.st_size)
                        cache[name] = stat.st_mtime

    # check for deleted files
    for name in list(cache.keys()):
        if name not in files:
            remove_file(name)
            del cache[name]

    # check for remote files that are not in the current directory and delete them
    if check_dir.first_run and args.initial_sync:
        for name, size in initial_remote_list.items():
            if name not in cache:
                remove_file(name)

    check_dir.first_run = False

parser = argparse.ArgumentParser(description='Watch a directory for change/delete events to files and sync to flashair card (not recursive!).')
parser.add_argument('directory_path', help='The directory to watch for changes.')
parser.add_argument('flashair_address', help='The address of your flashair card, eg. "192.168.178.41"')
parser.add_argument('file_extensions', nargs='+', default=None, help='Only files that match one of these extensions get monitored.')
parser.add_argument('-p', '--poll_interval', type=float, default=1, help='How many seconds between directory polls (default is 1).')
parser.add_argument('-i', '--initial_sync', action='store_true', default=False, help='Copy all files that are new or changed to the card on program start, also delete all files on the card which are not in the current directory. Without this switch only files that are new/modified/deleted after the program start are synced.')
args = parser.parse_args()

if args.file_extensions is not None:
    args.file_extensions = ['.{}'.format(extension) for extension in args.file_extensions]

url = 'http://{}'.format(args.flashair_address)
upload_url = '{}/upload.cgi'.format(url)

if args.initial_sync:
    initial_remote_list = get_remote_list()

while True:
    check_dir()
    time.sleep(args.poll_interval)


text:
<?php

require_once realpath(__DIR__ . '/../../../bootstrap.php');

require_once $centreon_path . 'www/modules/centreon-open-tickets/class/request.php';
require_once $centreon_path . 'www/modules/centreon-open-tickets/class/rule.php';
require_once $centreon_path . 'www/modules/centreon-open-tickets/class/centreonDBManager.class.php';
require_once $centreon_path . 'www/modules/centreon-open-tickets/providers/register.php';


text:
import { ObjectType } from "../../common/ObjectType";
/**
 * Many-to-many is a type of relationship when Entity1 can have multiple instances of Entity2, and Entity2 can have
 * multiple instances of Entity1. To achieve it, this type of relation creates a junction table, where it storage
 * entity1 and entity2 ids. This is owner side of the relationship.
 */
export declare function ManyToMany<T>(typeFunction: (type?: any) => ObjectType<T>, options?: {
    cascadeInsert?: boolean;
    cascadeUpdate?: boolean;
    lazy?: boolean;
    eager?: boolean;
}): Function;
/**
 * Many-to-many is a type of relationship when Entity1 can have multiple instances of Entity2, and Entity2 can have
 * multiple instances of Entity1. To achieve it, this type of relation creates a junction table, where it storage
 * entity1 and entity2 ids. This is owner side of the relationship.
 */
export declare function ManyToMany<T>(typeFunction: (type?: any) => ObjectType<T>, inverseSide?: string | ((object: T) => any), options?: {
    cascadeInsert?: boolean;
    cascadeUpdate?: boolean;
    lazy?: boolean;
    eager?: boolean;
}): Function;


text:
@implementation KSAppDelegate

#pragma mark - IBActions

- (IBAction)authorizeUsername:(id)sender
{
    [self.authorizeProgress startAnimation:self];

    NSString *username = self.usernameField.stringValue;
    NSString *password = self.passwordField.stringValue;

    [[KSInstapaperAPI sharedClient] authorizeUsername:username
                                          andPassword:password
                                      withReturnBlock:^(BOOL authorized, NSError *error)
    {
        [self.authorizeProgress stopAnimation:self];

        if (authorized) {
            NSLog(@"Authorized Username");
        } else {
            NSLog(@"Failed to authorize username: %@", error);

            if (error.code == KSInstapaperInvalidCredentials) {
                NSLog(@"Invalid credentials");
            }

            [[NSAlert alertWithError:error] runModal];
        }
    }];
}

- (IBAction)sendURL:(id)sender
{
    NSURL *url = [NSURL URLWithString:self.urlField.stringValue];
    NSString *title = self.titleField.stringValue;
    NSString *selection = self.selectionField.stringValue;

    [self.sendProgress startAnimation:self];

    [[KSInstapaperAPI sharedClient] sendInstapaperURL:url
                                                title:title
                                            selection:selection
                                      withReturnBlock:^(BOOL sent, NSError *error)
    {
        [self.sendProgress stopAnimation:self];

        if (sent) {
            NSLog(@"Sent URL successfully");
        } else {
            if (error.code == KSInstapaperUnreachableURLQueued) {
                NSLog(@"Queued URL");
            }

            NSLog(@"Failed to save URL: %@", error);
            [[NSAlert alertWithError:error] runModal];
        }
    }];
}

#pragma mark - NSApplicationDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
    [[KSInstapaperAPI sharedClient] sendQueuedURLsToInstapaper];
}

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
    return true;
}

@end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ca.ualberta.papaya.fixtures</title>
<meta name="date" content="2016-03-14">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

ca.ualberta.papaya.fixtures

Enums

Country

Province


text:
require 'hurley'

module Google
  module Apis
    module Core
      # Part of a multipart request for holding JSON data
      #
      # @private
      class JsonPart
        include Hurley::Multipart::Part

        # @return [Fixnum]
        #   Length of part
        attr_reader :length

        # @param [String] boundary
        #   Multipart boundary
        # @param [String] value
        #   JSON content
        def initialize(boundary, value)
          @part = build_part(boundary, value)
          @length = @part.bytesize
          @io = StringIO.new(@part)
        end

        private

        # Format the part
        #
        # @param [String] boundary
        #   Multipart boundary
        # @param [String] value
        #   JSON content
        # @return [String]
        def build_part(boundary, value)
          part = ''
          part << "--#{boundary}\r\n"
          part << "Content-Type: application/json\r\n"
          part << "\r\n"
          part << "#{value}\r\n"
        end
      end

      # Part of a multipart request for holding arbitrary content. Modified
      # from Hurley::Multipart::FilePart to remove Content-Disposition
      #
      # @private
      class FilePart
        include Hurley::Multipart::Part

        # @return [Fixnum]
        #   Length of part
        attr_reader :length

        # @param [String] boundary
        #   Multipart boundary
        # @param [Google::Apis::Core::UploadIO] io
        #   IO stream
        # @param [Hash] header
        #   Additional headers
        def initialize(boundary, io, header = {})
          file_length = io.respond_to?(:length) ? io.length : File.size(io.local_path)

          @head = build_head(boundary, io.content_type, file_length,
                             io.respond_to?(:opts) ? io.opts.merge(header) : header)

          @length = @head.bytesize + file_length + FOOT.length
          @io = Hurley::CompositeReadIO.new(@length, StringIO.new(@head), io, StringIO.new(FOOT))
        end

        private

        # Construct the header for the part
        #
        # @param [String] boundary
        #  Multipart boundary
        # @param [String] type
        #  Content type for the part
        # @param [Fixnum] content_len
        #  Length of the part
        # @param [Hash] header
        #  Headers for the part
        def build_head(boundary, type, content_len, header)
          sprintf(HEAD_FORMAT,
                  boundary,
                  content_len.to_i,
                  header[:content_type] || type,
                  header[:content_transfer_encoding] || DEFAULT_TR_ENCODING)
        end

        DEFAULT_TR_ENCODING = 'binary'.freeze
        FOOT = "\r\n".freeze
        HEAD_FORMAT = <<-END
--%s\r
Content-Length: %d\r
Content-Type: %s\r
Content-Transfer-Encoding: %s\r
\r
        END
      end

      # Helper for building multipart requests
      class Multipart
        MULTIPART_RELATED = 'multipart/related'
        DEFAULT_BOUNDARY = 'RubyApiClientMultiPart'

        # @return [String]
        #  Content type header
        attr_reader :content_type

        # @param [String] content_type
        #  Content type for the multipart request
        # @param [String] boundary
        #  Part delimiter

        def initialize(content_type: MULTIPART_RELATED, boundary: nil)
          @parts = []
          @boundary = boundary || DEFAULT_BOUNDARY
          @content_type = "#{content_type}; boundary=#{boundary}"
        end

        # Append JSON data part
        #
        # @param [String] body
        #   JSON text
        # @return [self]
        def add_json(body)
          @parts << Google::Apis::Core::JsonPart.new(@boundary, body)
          self
        end

        # Append arbitrary data as a part
        #
        # @param [Google::Apis::Core::UploadIO] upload_io
        #   IO stream
        # @return [self]
        def add_upload(upload_io)
          @parts << Google::Apis::Core::FilePart.new(@boundary, upload_io)
          self
        end

        # Assemble the multipart requests
        #
        # @return [IO]
        #  IO stream
        def assemble
          @parts << Hurley::Multipart::EpiloguePart.new(@boundary)
          ios = []
          len = 0
          @parts.each do |part|
            len += part.length
            ios << part.to_io
          end
          Hurley::CompositeReadIO.new(len, *ios)
        end
      end
    end
  end
end


text:
abstract Node

type ScalarNode <: Node
    tag::AbstractString
    value::AbstractString
    start_mark::(@compat Union{Mark, Void})
    end_mark::(@compat Union{Mark, Void})
    style::(@compat Union{Char, Void})
end

type SequenceNode <: Node
    tag::AbstractString
    value::Vector
    start_mark::(@compat Union{Mark, Void})
    end_mark::(@compat Union{Mark, Void})
    flow_style::Bool
end

type MappingNode <: Node
    tag::AbstractString
    value::Vector
    start_mark::(@compat Union{Mark, Void})
    end_mark::(@compat Union{Mark, Void})
    flow_style::Bool
end


text:
var common = require('../common');
var assert = require('assert');
var http = require('http');
var util = require('util');

var Duplex = require('stream').Duplex;

function FakeAgent() {
  http.Agent.call(this);

  this.createConnection = FakeAgent.prototype.createConnection;
}
util.inherits(FakeAgent, http.Agent);

FakeAgent.prototype.createConnection = function createConnection() {
  var s = new Duplex();

  function ondata(str)  {
    var buf = new Buffer(str);
    s.ondata(buf, 0, buf.length);
  }

  Object.defineProperty(s, 'ondata', {
    configurable: true,
    set: function(value) {
      Object.defineProperty(s, 'ondata', { value: value });

      process.nextTick(function() {
        ondata('HTTP/1.1 200 Ok\r\nTransfer-Encoding: chunked\r\n\r\n');

        s.readable = false;
        ondata('b\r\nhello world\r\n');
        ondata('b\r\n ohai world\r\n');
        ondata('0\r\n\r\n');
      });
    }
  });

  // Blackhole
  s._write = function write(data, enc, cb) {
    cb();
  };

  s.destroy = s.destroySoon = function destroy() {
    this.writable = false;
  };

  return s;
};

var received = '';
var ended = 0;
var response;

var req = http.request({
  agent: new FakeAgent()
}, function(res) {
  response = res;

  res.on('readable', function() {
    var chunk = res.read();
    if (chunk !== null)
      received += chunk;
  });

  res.on('end', function() {
    ended++;
  });
});
req.end();

process.on('exit', function() {
  assert.equal(received, 'hello world ohai world');
  assert.equal(ended, 1);
});


text:
(function() {
  var srcs = [
      "\js-read-only\goog\base.js",
      "\js-read-only\goog\string\stringbuffer.js",
      "\js-read-only\goog\dom\nodetype.js",
      "\js-read-only\goog\debug\error.js",
      "\js-read-only\goog\string\string.js",
      "\js-read-only\goog\asserts\asserts.js",
      "\js-read-only\goog\string\typedstring.js",
      "\js-read-only\goog\string\const.js",
      "\js-read-only\goog\fs\url.js",
      "\js-read-only\goog\i18n\bidi.js",
      "\js-read-only\goog\html\safeurl.js",
      "\js-read-only\goog\array\array.js",
      "\js-read-only\goog\html\safestyle.js",
      "\js-read-only\goog\html\safescript.js",
      "\js-read-only\goog\html\trustedresourceurl.js",
      "\js-read-only\goog\html\safestylesheet.js",
      "\js-read-only\goog\object\object.js",
      "\js-read-only\goog\dom\tags.js",
      "\js-read-only\goog\dom\tagname.js",
      "\js-read-only\goog\labs\useragent\util.js",
      "\js-read-only\goog\labs\useragent\browser.js",
      "\js-read-only\goog\html\safehtml.js",
      "\js-read-only\goog\html\uncheckedconversions.js",
      "\js-read-only\goog\soy\data.js",
      "\js-read-only\goog\labs\useragent\platform.js",
      "\js-read-only\goog\labs\useragent\engine.js",
      "\js-read-only\goog\useragent\useragent.js",
      "\js-read-only\goog\math\size.js",
      "\js-read-only\goog\dom\safe.js",
      "\js-read-only\goog\dom\browserfeature.js",
      "\js-read-only\goog\math\math.js",
      "\js-read-only\goog\math\coordinate.js",
      "\js-read-only\goog\dom\dom.js",
      "\js-read-only\goog\soy\soy.js",
      "\js-read-only\goog\structs\inversionmap.js",
      "\js-read-only\goog\i18n\graphemebreak.js",
      "\js-read-only\goog\format\format.js",
      "\js-read-only\goog\html\legacyconversions.js",
      "\js-read-only\goog\i18n\bidiformatter.js",
      "\js-read-only\soyutils_usegoog.js",
      "\generated\en\soy.js",
      "\maze\generated\en\soy.js",
      "\js-read-only\blockly\core\names.js",
      "\js-read-only\blockly\core\workspace.js",
      "\js-read-only\goog\math\box.js",
      "\js-read-only\goog\math\rect.js",
      "\js-read-only\goog\reflect\reflect.js",
      "\js-read-only\goog\dom\vendor.js",
      "\js-read-only\goog\style\style.js",
      "\js-read-only\blockly\core\field.js",
      "\js-read-only\blockly\core\procedures.js",
      "\js-read-only\blockly\core\msg.js",
      "\js-read-only\blockly\core\field_textinput.js",
      "\js-read-only\goog\events\eventid.js",
      "\js-read-only\goog\events\listenable.js",
      "\js-read-only\goog\events\listener.js",
      "\js-read-only\goog\events\listenermap.js",
      "\js-read-only\goog\events\browserfeature.js",
      "\js-read-only\goog\debug\entrypointregistry.js",
      "\js-read-only\goog\events\eventtype.js",
      "\js-read-only\goog\disposable\idisposable.js",
      "\js-read-only\goog\disposable\disposable.js",
      "\js-read-only\goog\events\event.js",
      "\js-read-only\goog\events\browserevent.js",
      "\js-read-only\goog\events\events.js",
      "\js-read-only\goog\events\eventhandler.js",
      "\js-read-only\goog\ui\idgenerator.js",
      "\js-read-only\goog\events\eventtarget.js",
      "\js-read-only\goog\ui\component.js",
      "\js-read-only\goog\dom\classlist.js",
      "\js-read-only\goog\ui\registry.js",
      "\js-read-only\goog\ui\decorate.js",
      "\js-read-only\goog\a11y\aria\attributes.js",
      "\js-read-only\goog\a11y\aria\datatables.js",
      "\js-read-only\goog\a11y\aria\roles.js",
      "\js-read-only\goog\a11y\aria\aria.js",
      "\js-read-only\goog\ui\controlrenderer.js",
      "\js-read-only\goog\ui\controlcontent.js",
      "\js-read-only\goog\events\keycodes.js",
      "\js-read-only\goog\events\keyhandler.js",
      "\js-read-only\goog\ui\control.js",
      "\js-read-only\goog\ui\menuitemrenderer.js",
      "\js-read-only\goog\ui\menuitem.js",
      "\js-read-only\goog\ui\containerrenderer.js",
      "\js-read-only\goog\ui\menuseparatorrenderer.js",
      "\js-read-only\goog\ui\separator.js",
      "\js-read-only\goog\ui\menurenderer.js",
      "\js-read-only\goog\ui\menuseparator.js",
      "\js-read-only\goog\ui\container.js",
      "\js-read-only\goog\ui\menuheaderrenderer.js",
      "\js-read-only\goog\ui\menuheader.js",
      "\js-read-only\goog\ui\menu.js",
      "\js-read-only\blockly\core\field_dropdown.js",
      "\js-read-only\blockly\core\variables.js",
      "\js-read-only\blockly\core\field_variable.js",
      "\js-read-only\blockly\core\xml.js",
      "\js-read-only\blockly\core\bubble.js",
      "\js-read-only\goog\promise\resolver.js",
      "\js-read-only\goog\async\freelist.js",
      "\js-read-only\goog\async\workqueue.js",
      "\js-read-only\goog\functions\functions.js",
      "\js-read-only\goog\async\nexttick.js",
      "\js-read-only\goog\async\run.js",
      "\js-read-only\goog\promise\thenable.js",
      "\js-read-only\goog\promise\promise.js",
      "\js-read-only\goog\timer\timer.js",
      "\js-read-only\blockly\core\trashcan.js",
      "\js-read-only\blockly\core\scrollbar.js",
      "\js-read-only\blockly\core\zoom_controls.js",
      "\js-read-only\blockly\core\workspace_svg.js",
      "\js-read-only\blockly\core\icon.js",
      "\js-read-only\blockly\core\mutator.js",
      "\js-read-only\blockly\core\connection.js",
      "\js-read-only\blockly\core\blocks.js",
      "\js-read-only\blockly\core\comment.js",
      "\js-read-only\blockly\core\tooltip.js",
      "\js-read-only\blockly\core\field_label.js",
      "\js-read-only\blockly\core\input.js",
      "\js-read-only\blockly\core\warning.js",
      "\js-read-only\blockly\core\block.js",
      "\js-read-only\blockly\core\generator.js",
      "\js-read-only\blockly\core\contextmenu.js",
      "\js-read-only\blockly\core\block_svg.js",
      "\js-read-only\blockly\core\utils.js",
      "\js-read-only\blockly\core\css.js",
      "\js-read-only\blockly\core\inject.js",
      "\js-read-only\blockly\core\field_angle.js",
      "\js-read-only\goog\ui\tree\basenode.js",
      "\js-read-only\goog\ui\tree\treenode.js",
      "\js-read-only\blockly\core\flyout.js",
      "\js-read-only\goog\structs\structs.js",
      "\js-read-only\goog\structs\trie.js",
      "\js-read-only\goog\ui\tree\typeahead.js",
      "\js-read-only\goog\structs\collection.js",
      "\js-read-only\goog\iter\iter.js",
      "\js-read-only\goog\structs\map.js",
      "\js-read-only\goog\structs\set.js",
      "\js-read-only\goog\debug\debug.js",
      "\js-read-only\goog\debug\logrecord.js",
      "\js-read-only\goog\debug\logbuffer.js",
      "\js-read-only\goog\debug\logger.js",
      "\js-read-only\goog\log\log.js",
      "\js-read-only\goog\events\focushandler.js",
      "\js-read-only\goog\ui\tree\treecontrol.js",
      "\js-read-only\blockly\core\toolbox.js",
      "\js-read-only\blockly\core\widgetdiv.js",
      "\js-read-only\goog\color\names.js",
      "\js-read-only\goog\color\color.js",
      "\js-read-only\blockly\core\field_image.js",
      "\js-read-only\blockly\core\field_checkbox.js",
      "\js-read-only\goog\ui\selectionmodel.js",
      "\js-read-only\goog\dom\tagiterator.js",
      "\js-read-only\goog\dom\nodeiterator.js",
      "\js-read-only\goog\ui\paletterenderer.js",
      "\js-read-only\goog\ui\palette.js",
      "\js-read-only\goog\ui\colorpalette.js",
      "\js-read-only\goog\ui\colorpicker.js",
      "\js-read-only\blockly\core\field_colour.js",
      "\js-read-only\blockly\core\blockly.js",
      "\js-read-only\blockly\msg-js\en.js",
      "\maze\generated\en\msg.js",
      "\js-read-only\goog\dom\classes.js",
      "\js\lib-games.js",
      "\js\lib-interface.js",
      "\js\lib-dialogs.js",
      "\js-read-only\blockly\generators\python.js",
      "\js-read-only\blockly\generators\javascript.js",
      "\maze\js\blocks.js",
      "\maze\js\maze.js"
  ];
  function loadScript() {
    var src = srcs.shift();
    if (src) {
      var script = document.createElement('script');
      script.src = src;
      script.type = 'text/javascript';
      script.onload = loadScript;
      document.head.appendChild(script);
    }
  }
  loadScript();
})();


text:
npm install -g grunt
npm install -g gulp
npm install -g bower
npm install -g eslint


text:
<?php

namespace Composer\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

class ScriptAliasCommand extends BaseCommand
{
private $script;

public function __construct($script)
{
$this->script = $script;

parent::__construct();
}

protected function configure()
{
$this
->setName($this->script)
->setDescription('Run the '.$this->script.' script as defined in composer.json.')
->setDefinition(array(
new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
))
->setHelp(<<<EOT
The <info>run-script</info> command runs scripts defined in composer.json:

<info>php composer.phar run-script post-update-cmd</info>
EOT
)
;
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer();

$args = $input->getArguments();

return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
}
}


text:
/*
 * Do not modify this file. This file is generated from the ssm-2014-11-06.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;

using Amazon.SimpleSystemsManagement.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;

namespace Amazon.SimpleSystemsManagement.Model.Internal.MarshallTransformations
{
    /// <summary>
    /// DescribeInstanceInformation Request Marshaller
    /// </summary>
    public class DescribeInstanceInformationRequestMarshaller : IMarshaller<IRequest, DescribeInstanceInformationRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
    {
        /// <summary>
        /// Marshaller the request object to the HTTP request.
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public IRequest Marshall(AmazonWebServiceRequest input)
        {
            return this.Marshall((DescribeInstanceInformationRequest)input);
        }

        /// <summary>
        /// Marshaller the request object to the HTTP request.
        /// </summary>
        /// <param name="publicRequest"></param>
        /// <returns></returns>
        public IRequest Marshall(DescribeInstanceInformationRequest publicRequest)
        {
            IRequest request = new DefaultRequest(publicRequest, "Amazon.SimpleSystemsManagement");
            string target = "AmazonSSM.DescribeInstanceInformation";
            request.Headers["X-Amz-Target"] = target;
            request.Headers["Content-Type"] = "application/x-amz-json-1.1";
            request.HttpMethod = "POST";

            string uriResourcePath = "/";
            request.ResourcePath = uriResourcePath;
            using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
            {
                JsonWriter writer = new JsonWriter(stringWriter);
                writer.WriteObjectStart();
                var context = new JsonMarshallerContext(request, writer);
                if(publicRequest.IsSetInstanceInformationFilterList())
                {
                    context.Writer.WritePropertyName("InstanceInformationFilterList");
                    context.Writer.WriteArrayStart();
                    foreach(var publicRequestInstanceInformationFilterListListValue in publicRequest.InstanceInformationFilterList)
                    {
                        context.Writer.WriteObjectStart();

                        var marshaller = InstanceInformationFilterMarshaller.Instance;
                        marshaller.Marshall(publicRequestInstanceInformationFilterListListValue, context);

                        context.Writer.WriteObjectEnd();
                    }
                    context.Writer.WriteArrayEnd();
                }

                if(publicRequest.IsSetMaxResults())
                {
                    context.Writer.WritePropertyName("MaxResults");
                    context.Writer.Write(publicRequest.MaxResults);
                }

                if(publicRequest.IsSetNextToken())
                {
                    context.Writer.WritePropertyName("NextToken");
                    context.Writer.Write(publicRequest.NextToken);
                }

                writer.WriteObjectEnd();
                string snippet = stringWriter.ToString();
                request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
            }

            return request;
        }

    }
}


text: A HIDReportIdTest is a test class for testing the behavior of HIDReportId


text:
// Vaca - Visual Application Components Abstraction
// Copyright (c) 2005-2010 David Capello
//
// This file is distributed under the terms of the MIT license,
// please read LICENSE.txt for more information.

#ifndef VACA_IMAGEPIXELS_H
#define VACA_IMAGEPIXELS_H

#include <vector>
#include <algorithm>

#include "vaca/base.h"
#include "vaca/Size.h"
#include "vaca/Point.h"
#include "vaca/SharedPtr.h"

namespace vaca {

class ImagePixelsHandle : public Referenceable
{
public:
  typedef UINT32 pixel_type;

private:
  int m_width;
  int m_height;
  int m_scanline;
  std::vector<pixel_type> m_buffer;

public:
  ImagePixelsHandle() { init(0, 0); }
  ImagePixelsHandle(int w, int h) { init(w, h); }
  ImagePixelsHandle(const Size& sz) { init(sz.w, sz.h); }
  virtual ~ImagePixelsHandle() { }

  Size getSize() const { return Size(m_width, m_height); }
  int getWidth() const { return m_width; }
  int getHeight() const { return m_height; }
  int getScanlineSize() const { return m_scanline; }

  const pixel_type& operator[](size_t index) const {
    assert(index >= 0 && index < m_buffer.size());
    return m_buffer[index];
  }

  pixel_type& operator[](size_t index) {
    assert(index >= 0 && index < m_buffer.size());
    return m_buffer[index];
  }

  pixel_type getPixel(int x, int y) const {
    assert(x >= 0 && y >= 0 && x < m_width && y < m_height);
    return m_buffer[y*m_scanline + x];
  }

  void setPixel(int x, int y, pixel_type color) {
    assert(x >= 0 && y >= 0 && x < m_width && y < m_height);
    m_buffer[y*m_scanline + x] = color;
  }

  void invertScanlines()
  {
    std::vector<pixel_type> scanline(m_scanline);
    int top = 0;
    int bottom = (m_height-1)*m_scanline;
    for (int y=0; y<m_height/2; ++y) {
      // Top to temporary buffer
      std::copy(m_buffer.begin()+top, m_buffer.begin()+top+m_scanline, scanline.begin());

      // Bottom to top
      std::copy(m_buffer.begin()+bottom, m_buffer.begin()+bottom+m_scanline, m_buffer.begin()+top);

      // Temporary to bottom
      std::copy(scanline.begin(), scanline.end(), m_buffer.begin()+bottom);

      top += m_scanline;
      bottom -= m_scanline;
    }
  }

  void copyTo(ImagePixelsHandle& other) const
  {
    std::copy(m_buffer.begin(), m_buffer.begin(), other.m_buffer.begin());
  }

private:
  void init(int w, int h)
  {
    m_width = w;
    m_scanline = w;
    m_height = h;
    m_buffer.resize(m_scanline * m_height);
  }
};

/**
   A set of pixels obtained from a Image.

   Each pixel has four channels: RGBA. This class is useful to
   manipulate image pixels directly.
*/
class ImagePixels : private SharedPtr<ImagePixelsHandle>
{
public:
  typedef ImagePixelsHandle::pixel_type pixel_type;

  ImagePixels()
    : SharedPtr<ImagePixelsHandle>(new ImagePixelsHandle())
  {
  }

  ImagePixels(int w, int h)
    : SharedPtr<ImagePixelsHandle>(new ImagePixelsHandle(w, h))
  {
  }

  ImagePixels(const Size& sz)
    : SharedPtr<ImagePixelsHandle>(new ImagePixelsHandle(sz))
  {
  }

  virtual ~ImagePixels()
  {
  }

  ImagePixels clone() const
  {
    ImagePixels copy(getSize());
    get()->copyTo(*copy.get());
    return copy;
  }

  Size getSize() const { return get()->getSize(); }
  int getWidth() const { return get()->getWidth(); }
  int getHeight() const { return get()->getHeight(); }
  int getScanlineSize() const { return get()->getScanlineSize(); }

  const pixel_type& operator[](int index) const {
    return get()->operator[](index);
  }

  pixel_type& operator[](int index) {
    return get()->operator[](index);
  }

  pixel_type getPixel(int x, int y) const {
    return get()->getPixel(x, y);
  }

  void setPixel(int x, int y, pixel_type color) {
    get()->setPixel(x, y, color);
  }

  void invertScanlines() {
    get()->invertScanlines();
  }

  static int getR(pixel_type color) { return (color & 0x00ff0000) >> 16; }
  static int getG(pixel_type color) { return (color & 0x0000ff00) >> 8; }
  static int getB(pixel_type color) { return (color & 0x000000ff); }
  static int getA(pixel_type color) { return (color & 0xff000000) >> 24; }

  static pixel_type makePixel(int r, int g, int b, int a) {
    return
      ((a & 0xff) << 24) |
      ((r & 0xff) << 16) |
      ((g & 0xff) << 8) |
      ((b & 0xff));
  }

};

} // namespace vaca

#endif // VACA_IMAGEPIXELS_H


text:
package au.com.codeka.rps;

import android.content.Intent;

import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.WearableListenerService;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;

import au.com.codeka.rps.game.StateManager;

public class NotificationUpdateService extends WearableListenerService {
    @Override
    public void onMessageReceived(MessageEvent msgEvent) {
        if (msgEvent.getPath().equals("/rps/StartGame")) {
            Intent startIntent = new Intent(this, GameActivity.class);
            startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(startIntent);
        } else if (msgEvent.getPath().equals("/rps/StateChange")) {
            String newStateName = null;
            try {
                newStateName = new String(msgEvent.getData(), "utf-8");
            } catch (UnsupportedEncodingException e) {
            }

            StateManager.i.enterState(newStateName);
        } else if (msgEvent.getPath().equals("/rps/FinalResult")) {
            String str = null;
            try {
                str = new String(msgEvent.getData(), "utf-8");
            } catch (UnsupportedEncodingException e) {
            }

            try {
                JSONObject json = new JSONObject(str);
                StateManager.i.onFinalResult(json);
            } catch (JSONException e) {
            }
        }
    }
}


text:
A new project required Enterprise distribution, so, we need to do some research.

_c.f._

 * https://developer.apple.com/enterprise/integrate/
 * [WWDC 2014 - Session 705](https://developer.apple.com/videos/play/wwdc2014/705/) Building Enterprise Apps for In-House Distribution
 * [WWDC 2012 - Session 311](https://developer.apple.com/videos/play/enterprise/311/) Building and Distributing Custom B2B Apps for iOS

 [Code Signing](https://blog.xamarin.com/easy-ios-app-provisioning-fastlane-visual-studio-mac/  )