text:
Kaprica Security (KPRCA)

## Description

OTPSim provides a way to simulate an OTP (One Time Pad) code generation with limited sessions. When a client initiates the session with the handshake command, the client can generate up to 3 OTP codes of customizable length, unless the session is extended. The extension resets the counter back to 0, allowing the client to generate 3 more OTP codes. The service also provides a way to verify.

### Feature List

```
- Handshake
- Generate OTP token
- Extend the session
- Reset seed value and index
- Verify token
- Quit
```

## Vulnerability

### Vuln 1
- Extension feature receives random non-null bytes from the client and transmits the same content back (with a null byte prepended, indiciating success).
- The client controls the size field to let the service know how much of random bytes it should expect to read.
- However, the service fails to check if it actually has received said number of bytes -- it reads until a null byte or up to the max stack buffer size (8192).
- So, when a malicious client sets the size large, but sends less data than what it promised, memory beyond the random bytes (from the client) is read from the stack -- which may contain sensitive data.
- Since OTPSim uses secret page to generate token data, a malicious client can force the generation of an OTP token, which fills stack memory with data from secret page.
- Because the stack isn't initialized with the extension function, the memory can be leaked.

#### Generic class of vulnerability

Buffer Over-read

#### CWE classification

CWE-126: Buffer Over-read

#### Challenges

- Handshake involves some bit-arithmetic challenge/response procedure
- Need to realize that the stack memory isn't initialized, and may contain secret page data by forcing the service to generate OTP token
- Although there isn't a memory corruption (at least not intended), it is very real-world (Heartbleed) type of bug.

#### Difficulty

 - **Discovery**: medium
 - **Proving**: hard
 - **Patching**: easy


text:
using System;
using System.Windows.Data;

namespace Csla.Xaml
{
  /// <summary>
  /// Provides the functionality of a WPF
  /// value converter without affecting the
  /// value as it flows to and from the UI.
  /// </summary>
  public class IdentityConverter : IValueConverter
  {
#region IValueConverter Members

    /// <summary>
    /// Returns the unchanged value.
    /// </summary>
    /// <param name="value">Value to be converted.</param>
    /// <param name="targetType">Desired value type.</param>
    /// <param name="parameter">Conversion parameter.</param>
    /// <param name="culture">Conversion culture.</param>
    public object Convert(
      object value, Type targetType,
      object parameter, System.Globalization.CultureInfo culture)
    {
      return value;
    }

    /// <summary>
    /// Returns the unchanged value.
    /// </summary>
    /// <param name="value">Value to be converted.</param>
    /// <param name="targetType">Desired value type.</param>
    /// <param name="parameter">Conversion parameter.</param>
    /// <param name="culture">Conversion culture.</param>
    public object ConvertBack(
      object value, Type targetType,
      object parameter, System.Globalization.CultureInfo culture)
    {
      return value;
    }

#endregion
  }
}
#endif

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace CodelinerTest\CargoBackend\Mock;

use Codeliner\GraphTraversalBackend\Dto\EdgeDto;
use Codeliner\GraphTraversalBackend\Dto\TransitPathDto;
use Codeliner\GraphTraversalBackend\GraphTraversalServiceInterface;

/**
 * Class GraphTraversalServiceMock
 *
 * @package CodelinerTest\CargoBackend\Domain\Mock
 * @author Alexander Miertsch <contact@prooph.de>
 */
class GraphTraversalServiceMock implements GraphTraversalServiceInterface
{
    /**
     * @param string $fromUnLocode
     * @param string $toUnLocode
     * @return TransitPathDto[]
     */
    public function findShortestPath(string $fromUnLocode, string $toUnLocode): array
    {
        $fromDate = new \DateTime('2014-03-29 19:59:23');
        $toDate   = new \DateTime('2014-03-30 21:30:00');

        $edge = new EdgeDto(
            $fromUnLocode,
            $toUnLocode,
            $fromDate->format(\DateTime::ISO8601),
            $toDate->format(\DateTime::ISO8601)
        );

        $transitPath = new TransitPathDto([$edge]);

        return [$transitPath];
    }
}


text:
import { DateTime } from 'luxon';

import { get } from '@waldur/core/api';
import { parseDate } from '@waldur/core/dateUtils';
import { WorkspaceType } from '@waldur/workspace/types';

import { Category } from './CategoryResources';
import { loadMarketplaceCategories } from './marketplace';
import { Quota, Scope, Chart, ChartData } from './types';

interface DailyQuota {
  [key: string]: number[];
}

export interface DateValuePair {
  date: DateTime | string;
  value: number;
}

const getDailyQuotas = (params) =>
  get<DailyQuota>('/daily-quotas/', { params }).then(
    (response) => response.data,
  );

export type ChartLoader = (scope: Scope) => Promise<Chart[]>;

export const getFormatterUnits = (
  chartType: 'filesize' | 'hours',
  value: number,
) => {
  let formatter = (x) => x;
  let units;

  if (chartType === 'filesize') {
    if (value > 1024 * 1024) {
      formatter = (x) => (x / 1024 / 1024).toFixed(1);
      units = 'TB';
    } else if (value > 1024) {
      formatter = (x) => (x / 1024).toFixed(1);
      units = 'GB';
    } else {
      units = 'MB';
    }
  } else if (chartType === 'hours') {
    formatter = (x) => Math.round(x / 60);
    units = 'hours';
  }
  return { formatter, units };
};

export const formatQuotaChart = (quota: Quota, values: number[]): Chart => {
  const maxValue = Math.max(...values);
  const { formatter, units } = getFormatterUnits(quota.type, maxValue);

  const current = formatter(values[values.length - 1]);

  const data: ChartData = values.map((value, index) => {
    const date = DateTime.now()
      .minus({ days: 30 })
      .startOf('day')
      .plus({ days: index });
    const formattedValue = formatter(value);
    return { label: date.toISODate(), value: formattedValue };
  });

  return {
    title: quota.title,
    units,
    current,
    data,
  };
};

export async function getDailyQuotaCharts(
  quotas: Quota[],
  scope: Scope,
): Promise<Chart[]> {
  const names = quotas.map((chart) => chart.quota);
  const start = DateTime.now().minus({ days: 30 }).toISODate();
  const values = await getDailyQuotas({
    scope: scope.url,
    quota_names: names,
    start,
  });
  return quotas.map((quota) => formatQuotaChart(quota, values[quota.quota]));
}

export async function loadCategories(
  workspace: WorkspaceType,
  scope: Scope,
): Promise<Category[]> {
  return await loadMarketplaceCategories(workspace, scope);
}

export const padMissingValues = (items: DateValuePair[], count) => {
  let end = DateTime.now();
  if (items.length > 0) {
    end = parseDate(items[items.length - 1].date);
  }
  while (items.length < count) {
    items.unshift({
      value: 0,
      date: end.minus({ months: 1 }),
    });
  }
  return items;
};


text:
require 'socket'

server = TCPServer.open(3000)

loop do
  client = server.accept
  # client.puts(Time.now.ctime)
  client.puts <<-STR

    #{Time.now.ctime}
  STR
  client.close
end


text:
feature_def (feature definition)
===========

Contains automatic tests on the api definition


text:
require 'test/unit'
require 'yaml'

# ========= modify these to suit your environment =============
WORKING_SERVICE={
  'Service Type' => 'status',
  'Cluster Name' => 'web_fe2',
  'IP Address' => '10.10.10.51',
  'HA Port' => 80,
  'HA Proto' => 'tcp',
  'Forward Mark' => 2130709505,
  'Check URL' => 'http://localhost:9999'
}
WORKING_SERVICE_2={
  'Service Type' => 'status',
  'Cluster Name' => 'web_fe',
  'IP Address' => '10.60.16.60',
  'HA Port' => 80,
  'HA Proto' => 'tcp',
  'Forward Mark' => 2130711553,
  'Check URL' => 'http://localhost:9998'
}
BAD_SERVICE_2={
  'Service Type' => 'status',
  'Cluster Name' => 'web_fe2',
  'IP Address' => '10.10.10.51',
  'HA Port' => 80,
  'HA Proto' => 'tcp',
  'Forward Mark' => 2130709505,
  'Check URL' => 'http://localhost:9991'
}
BAD_SERVICE={
  'Service Type' => 'status',
  'Cluster Name' => 'web_fe',
  'IP Address' => '10.60.16.60',
  'HA Port' => 80,
  'HA Proto' => 'tcp',
  'Forward Mark' => 2130711553,
  'Check URL' => 'http://localhost:9990'
}
WORKING_STATE={
  'Service Type' => 'state',
  'Cluster Name' => 'web_fe2',
  'Forward Mark' => 2130709505,
  'Check URL' => 'http://localhost:9999'
}
BAD_STATE={
  'Service Type' => 'state',
  'Cluster Name' => 'web_fe',
  'Forward Mark' => 2130711553,
  'Check URL' => 'http://localhost:9990'
}
BAD_STATE_2={
  'Service Type' => 'state',
  'Cluster Name' => 'web_fe2',
  'Forward Mark' => 2130709505,
  'Check URL' => 'http://localhost:9990'
}
# WORKING_SERVICE_LINE='web_fe2    10.10.10.51:80/tcp    2130709505    http://localhost:9999'
# WORKING_SERVICE_LINE_2='web_fe    10.60.16.60:80/tcp    2130711553    http://localhost:9998'
# BAD_SERVICE_LINE='web_fe    10.60.16.60:80/tcp    2130711553    http://localhost:9990'
# BAD_SERVICE_LINE_2='web_fe2    10.10.10.51:80/tcp    2130709505    http://localhost:9991'
COMMENT_LINE='### web_fe    10.60.16.60:80/tcp    2130711553    http://localhost:9990'

WORKING_SERVICE_LINE_OLD='http://localhost:9999'
WORKING_SERVICE_LINE_OLD_2='http://localhost:9998'
BAD_SERVICE_LINE_OLD='http://localhost:9990'
BAD_SERVICE_LINE_OLD_2='http://localhost:9991'
SMTP_LINE='smtp://localhost:25'

WORKING_CODE_DIR='/home/user/Code/enki_node_status'
# ======== ENKI status constants =================
APP_DOWN_PATH='/enki/var/run'
SERVICE_DOWN_PATH='/enki/var/tmp/services'
SERVICE_CHECKS_PATH='/etc/enki/configs/node/service.checks'
# =======================================

def main
  if ARGV[0] == '--clear'
    clear_files
    exit
  elsif ARGV[0] == '--make=2good'
    write_service_checks [WORKING_SERVICE, WORKING_SERVICE_2]
    exit
  elsif ARGV[0] == '--make=1good1bad'
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    exit
  elsif ARGV[0] == '--make=1good1badold'
    write_old_service_checks [WORKING_SERVICE_LINE_OLD, BAD_SERVICE_LINE_OLD]
    exit
  elsif ARGV[0] == '--hack'   # put whatever state you now want to check in here...
    clear_files
    write_service_checks [WORKING_STATE, BAD_SERVICE_2]
    exit
  else
    # copy files from working code dir to installation dir and restart nginx
    %x[sudo cp #{WORKING_CODE_DIR}/enki-status.conf /etc/nginx/sites-enabled/enki-status]
    %x[sudo cp #{WORKING_CODE_DIR}/perl/ENKI.pm /usr/local/nginx/perl/ENKI.pm]
    %x[sudo cp #{WORKING_CODE_DIR}/perl/ENKI/Status.pm /usr/local/nginx/perl/ENKI/Status.pm]
    %x[sudo cp #{WORKING_CODE_DIR}/perl/LWP/Protocol/smtp.pm /usr/local/nginx/perl/LWP/Protocol/smtp.pm]
    out = %x[sudo /etc/init.d/nginx restart]
    puts out
    clear_files
    # tests will start now ...
  end
end

def write_service_checks(services)
  File.open(SERVICE_CHECKS_PATH, 'w'){ |f|
    f.write COMMENT_LINE+"\n"
    f.write services.to_yaml
  }
end

def write_old_service_checks(lines)
  File.open(SERVICE_CHECKS_PATH, 'w'){ |f|
    lines.each{ |line|
      f.write "#{line}\n"
    }
    f.write COMMENT_LINE
  }
end

def assert_response_and_health(url_tail, expected_status, no_curl=false)
  output = get_response url_tail, expected_status, no_curl
  assert_health_output output
  output
end
def assert_response_and_no_health(url_tail, expected_status, no_curl=false)
  output = get_response url_tail, expected_status, no_curl
  assert_no_health_output output
  output
end

def get_response(url_tail, expected_status, no_curl=false)
  case expected_status
    when 200
      check_string = '200 OK'
    when 404
      check_string = '404 Not Found'
    when 503
      check_string = '503 Service Temporarily Unavailable'
    else
      check_string = ''
  end
  if not no_curl
    output = %x[curl -i localhost/#{url_tail}]
    assert output.include? check_string
  end
  output = %x[GET -s localhost/#{url_tail}]
  assert output.include? check_string
  output
end

def assert_health_output(output)
  assert output.include? 'Health'
  assert output.include? 'Load'
  assert output.include? 'Memory'
end
def assert_no_health_output(output)
  assert ! output.include?('Health')
  assert ! output.include?('Load')
  assert ! output.include?('Memory')
end

def assert_service_downfile_line(output, cluster_name, filename)
  assert output.include? "Comment: #{cluster_name} service is marked as down by local file: '#{filename}'"
end

def assert_no_service_downfile_line(output, cluster_name, filename)
  assert ! output.include?("Comment: #{cluster_name} service is marked as down by local file: '#{filename}'")
end

def clear_files
  %x[sudo rm #{SERVICE_CHECKS_PATH}] if File.exist?(SERVICE_CHECKS_PATH)
  %x[sudo rm #{SERVICE_CHECKS_PATH}.temp] if File.exist?("#{SERVICE_CHECKS_PATH}.temp")
  %x[sudo rm /Down] if File.exist?('/Down')
  %x[sudo rm #{APP_DOWN_PATH}/Down] if File.exist?("#{APP_DOWN_PATH}/Down")
  Dir.foreach("#{SERVICE_DOWN_PATH}") { |f|
    %x[sudo rm #{SERVICE_DOWN_PATH}/#{f}] if f =~ /down$/i
  }
end

class CnuStatusTest < Test::Unit::TestCase

### Gives wrong behavior for some reason
  # def setup
    # clear_files
  # end
  # def teardown
    # clear_files
  # end

# ============= /services =====================
  def test_service_list
    lines = [WORKING_SERVICE, WORKING_STATE, BAD_SERVICE]
    write_service_checks lines
    output = get_response 'services', 200
    assert output.include? lines.to_yaml
  end

  def test_service_list_old
    lines = [WORKING_SERVICE_LINE_OLD, BAD_SERVICE_LINE_OLD]
    write_old_service_checks lines
    output = get_response 'services', 200
    lines.each{ |line|
      assert output.include? line
    }
  end

  def test_service_list_no_service_checks_file
    lines = [WORKING_SERVICE, BAD_SERVICE]
    write_service_checks lines
    %x[sudo mv #{SERVICE_CHECKS_PATH} #{SERVICE_CHECKS_PATH}.temp]
    output = get_response 'services', 404
    # lines.each{ |line|
      assert ! output.include?(lines.to_yaml)
    # }
    %x[sudo mv #{SERVICE_CHECKS_PATH}.temp #{SERVICE_CHECKS_PATH}]
  end

  def test_service_list_chmod000
    lines = [WORKING_SERVICE, BAD_SERVICE]
    write_service_checks lines
    %x[sudo chmod 000 #{SERVICE_CHECKS_PATH}]
    output = get_response 'services', 404
    # lines.each{ |line|
      assert ! output.include?(lines.to_yaml)
    # }
    %x[sudo chmod 644 #{SERVICE_CHECKS_PATH}]
  end

  def test_service_list_empty_service_checks_file
    write_service_checks []
    get_response 'services', 200
  end
# ======================================

# ============= /status ================
  def test_status_no_service_checks_file
    lines = [WORKING_SERVICE]
    write_service_checks lines
    %x[sudo mv #{SERVICE_CHECKS_PATH} #{SERVICE_CHECKS_PATH}.temp]
    assert_response_and_health 'status', 200
    %x[sudo mv #{SERVICE_CHECKS_PATH}.temp #{SERVICE_CHECKS_PATH}]
  end

  def test_status_both_up
    lines = [WORKING_SERVICE, WORKING_SERVICE_2]
    write_service_checks lines
    output = get_response 'status', 200
    write_service_checks (lines << BAD_STATE)
    output = get_response 'status', 200
  end

  def test_status_one_down
    lines = [WORKING_SERVICE, BAD_SERVICE]
    write_service_checks lines
    output = get_response 'status', 503
  end

  def test_status_old_both_up
    lines = [WORKING_SERVICE_LINE_OLD, WORKING_SERVICE_LINE_OLD_2]
    write_old_service_checks lines
    output = get_response 'status', 200
  end

  def test_status_old_one_down
    lines = [WORKING_SERVICE_LINE_OLD, BAD_SERVICE_LINE_OLD]
    write_old_service_checks lines
    output = get_response 'status', 503
  end

  def test_status_only_states
    lines = [WORKING_STATE, BAD_STATE]
    write_service_checks lines
    output = get_response 'status', 200
  end
# =====================================

# ========= /status/service/<query> ===============
  def test_fwmark
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    assert_response_and_health 'status/service/fwm=2130709505', 200
    get_response 'status/service/fwm=2130711553', 503
  end

  def test_fwmark_with_state
    write_service_checks [WORKING_SERVICE_2, WORKING_STATE]
    assert_response_and_health 'status/service/fwm=2130711553', 200
    write_service_checks [WORKING_SERVICE_2, BAD_STATE]
    output = get_response 'status/service/fwm=2130711553', 503
    assert output.include?(BAD_STATE['Check URL'])
  end

  def test_ip
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    assert_response_and_health 'status/service/10.10.10.51', 200
    get_response 'status/service/10.60.16.60', 503
  end

  def test_ip_partial
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    assert_response_and_health 'status/service/10.11', 200
    assert_response_and_health 'status/service/10.', 200
    get_response 'status/service/10', 404
    get_response 'status/service/38.106', 503
    get_response 'status/service/38.', 503
  end

  def test_ip_port
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    assert_response_and_health 'status/service/10.10.10.51:80', 200
    get_response 'status/service/10.60.16.60:80', 503
  end

  def test_port_proto
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    get_response 'status/service/80/tcp', 503
    write_service_checks [WORKING_SERVICE, WORKING_SERVICE_2]
    get_response 'status/service/80/tcp', 200
  end

  def test_cluster_name
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    assert_response_and_health 'status/service/web_fe2', 200
    get_response 'status/service/web_fe', 503
  end

  def test_cluster_name_partial
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    assert_response_and_health 'status/service/web', 200
    get_response 'status/service/notweb', 503
  end

  def test_full_query
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    assert_response_and_health 'status/service/10.10.10.51:80/tcp/fwm=2130709505/web_fe2', 200
    get_response 'status/service/10.10.10.51:80/tcp/fwm=2130709505/web_fe2xxx', 404
    get_response 'status/service/10.60.16.60:80/tcp/fwm=2130711553/web_fe', 503
  end

  def test_query_no_match
    write_service_checks [WORKING_SERVICE, BAD_SERVICE]
    get_response 'status/service/127.0.0.1', 404
  end

  def test_query_no_service_checks_file
    lines = [WORKING_SERVICE]
    write_service_checks lines
    %x[sudo mv #{SERVICE_CHECKS_PATH} #{SERVICE_CHECKS_PATH}.temp]
    output = get_response 'status/service/10.10.10.51:80', 404
    # lines.each{ |line|
      assert ! output.include?(lines.to_yaml)
    # }
    %x[sudo mv #{SERVICE_CHECKS_PATH}.temp #{SERVICE_CHECKS_PATH}]
  end

# ================================================

# ============== test downfiles ==========================
  def test_status_root_node_down
    %x[sudo touch /Down]
    assert_response_and_health 'status', 503
    %x[sudo rm /Down]
  end

  def test_status_app_path_node_down
    %x[sudo touch #{APP_DOWN_PATH}/Down]
    assert_response_and_health 'status', 503
    %x[sudo rm #{APP_DOWN_PATH}/Down]
  end

  def test_status_one_service_downfile
    lines = [WORKING_SERVICE, WORKING_SERVICE_2]
    write_service_checks lines
    filename = "#{SERVICE_DOWN_PATH}/#{WORKING_SERVICE['Cluster Name']}_Down"
    %x[sudo touch #{filename}]
    output = assert_response_and_health 'status', 503
    assert_service_downfile_line output, WORKING_SERVICE['Cluster Name'], filename
    %x[sudo rm #{filename}]
  end

  def test_services_one_service_downfile
    lines = [WORKING_SERVICE, WORKING_SERVICE_2]
    write_service_checks lines
    filename = "#{SERVICE_DOWN_PATH}/#{WORKING_SERVICE['Cluster Name']}_Down"
    %x[sudo touch #{filename}]
    output = get_response 'services', 200
    assert output.include? lines.to_yaml
    %x[sudo rm #{filename}]
  end

  ### with query #####################
  def test_fwmark_checked_service_downfile
    write_service_checks [WORKING_SERVICE, WORKING_SERVICE_2]
    filename = "#{SERVICE_DOWN_PATH}/#{WORKING_SERVICE['Cluster Name']}_Down"
    %x[sudo touch #{filename}]
    output = assert_response_and_health "status/service/fwm=#{WORKING_SERVICE['Forward Mark']}", 503
    assert_service_downfile_line output, WORKING_SERVICE['Cluster Name'], filename
    %x[sudo rm #{filename}]
  end

  def test_fwmark_checked_service_no_downfile
    write_service_checks [WORKING_SERVICE, WORKING_SERVICE_2]
    filename = "#{SERVICE_DOWN_PATH}/#{WORKING_SERVICE['Cluster Name']}_Down"
    %x[sudo touch #{filename}]
    assert_response_and_health "status/service/fwm=#{WORKING_SERVICE_2['Forward Mark']}", 200
    %x[sudo rm #{filename}]
  end

  def test_match_both_one_service_downfile
    write_service_checks [WORKING_SERVICE, WORKING_SERVICE_2]
    filename = "#{SERVICE_DOWN_PATH}/#{WORKING_SERVICE['Cluster Name']}_Down"
    %x[sudo touch #{filename}]
    output = assert_response_and_health "status/service/tcp", 503
    assert_service_downfile_line output, WORKING_SERVICE['Cluster Name'], filename
    %x[sudo rm #{filename}]
  end

# ======== health =======================
  def test_health
    lines = [WORKING_SERVICE, WORKING_SERVICE_2]
    write_service_checks lines
    output = assert_response_and_health 'status/health', 200
  end

  def test_health_one_down
    lines = [WORKING_SERVICE, BAD_SERVICE]
    write_service_checks lines
    output = assert_response_and_health 'status/health', 200
    assert ! output.include?(lines.to_yaml)
  end

  def test_health_one_service_downfile
    lines = [WORKING_SERVICE, WORKING_SERVICE_2]
    write_service_checks lines
    filename = "#{SERVICE_DOWN_PATH}/#{WORKING_SERVICE['Cluster Name']}_Down"
    %x[sudo touch #{filename}]
    output = assert_response_and_health 'status/health', 200
    assert_no_service_downfile_line output, WORKING_SERVICE['Cluster Name'], filename
    %x[sudo rm #{filename}]
  end

  def test_health_root_node_down
    %x[sudo touch /Down]
    assert_response_and_health 'status/health', 503
    %x[sudo rm /Down]
  end

  def test_health_app_path_node_down
    %x[sudo touch #{APP_DOWN_PATH}/Down]
    assert_response_and_health 'status/health', 503
    %x[sudo rm #{APP_DOWN_PATH}/Down]
  end

# =========== state =======================
  def test_state_simple
    write_service_checks [WORKING_STATE]
    assert_response_and_no_health 'state/service/fwm=2130709505', 200
  end

  def test_state_service_down
    write_service_checks [WORKING_STATE, BAD_SERVICE_2]
    assert_response_and_no_health 'state/service/fwm=2130709505', 200
  end

  def test_state_state_down
    write_service_checks [WORKING_STATE, BAD_STATE_2]
    assert_response_and_no_health 'state/service/fwm=2130709505', 503
  end

# ========== SMTP checks ====================
  def test_status_smtp
    write_old_service_checks [SMTP_LINE]
    assert_response_and_health 'status', 200, true
  end

end

main()


text:
//
//  SMReferralError.h
//  SessionM
//
//  Copyright © 2018 SessionM. All rights reserved.
//

#ifndef __SM_REFERRAL_ERROR__
#define __SM_REFERRAL_ERROR__

#import <Foundation/Foundation.h>
#import "SMError.h"
#import "SMReferral.h"
#import "SMReferralRequest.h"

NS_ASSUME_NONNULL_BEGIN

/*!
 @class SMReferralError
 @abstract Defines the data associated with a registration referral error.
 */
@interface SMReferralError : NSObject

/*!
 @property error
 @abstract Error associated with the invalid referral request.
 */
@property(nonatomic, strong, readonly) SMError           *error;
/*!
 @property referral
 @abstract The invalid referral request data.
 */
@property(nonatomic, strong, readonly) SMReferralRequest *referral;

@end

NS_ASSUME_NONNULL_END

#endif /* __SM_REFERRAL_ERROR__ */


text:
namespace iOS.WebServiceExample.WebAPI.Areas.HelpPage
{
    /// <summary>
    /// Indicates whether the sample is used for request or response
    /// </summary>
    public enum SampleDirection
    {
        Request = 0,
        Response
    }
}


text:
import Component from '@ember/component';
import { alias } from '@ember/object/computed';
import { get, computed } from '@ember/object';

const VISIBLE_USERS_COUNT = 8;

/**
  `project-card/project-users` displays the first 8 contributors to a project
  and some statistics, including total number of contributors and how many
  contributors are not shown on the card, if any.

  ## default usage

  ```handlebars
  {{project-card/project-users projectUsers=projectUsers}}
  ```

  @class project-card/project-users
  @module Component
  @extends Ember.Component
*/

export default Component.extend({
  classNames: ['project-card__project-users'],
  tagName: 'ul',

  /**
    The number of users visible on the project card.

    @property visibleUsers
    @type Number
  */
  visibleUsers: computed('projectUsers', function() {
    return get(this, 'projectUsers').slice(0, VISIBLE_USERS_COUNT);
  }),

  /**
    Total number of contributors to a project.

    @property usersCount
    @type Number
  */
  usersCount: alias('projectUsers.length'),

  /**
    Total number of users not shown on the project card.

    @property hiddenUsersCount
    @type Number
  */
  hiddenUsersCount: computed('usersCount', function() {
    return get(this, 'usersCount') -  VISIBLE_USERS_COUNT;
  }),

  /**
    Determines if there are any hidden users who are not shown on the card.

    @property hiddenUsersExist
    @type Boolean
  */
  hiddenUsersExist: computed('hiddenUsersCount', function() {
    return get(this, 'hiddenUsersCount') > 0;
  })
});


text:
layout: default
---
<link rel="shortcut icon" type="image/png" href="/favicon.png">

  {% for post in site.posts %}

{{ post.title }}

        {{ post.excerpt }}

      Read More

  {% endfor %}


text:
SAT
======
A library performing collision detection of simple 2D shapes with  Separating Axis Theorem.

Simply translated from a [Javascript library](https://github.com/jriecken/sat-js) and reconstructed into a PHP version.

## Requirements
* PHP version 5.3.0 or higher

## Installation
`composer require huzhihao/sat:dev-master` and then require the Composer autoloader from your code.

## Usage
Here are the examples to show how SAT works. To check whether two shapes collide, you can use `SAT\Collision::XXX` functions. And a `Response` object will be given to check whether one shape is completely covered by the other.

```php
<?php
use SAT\Entity\Circle;
use SAT\Entity\Polygon;
use SAT\Entity\Response;
use SAT\Entity\Vector;
use SAT\Collision;

function dumpR(Response $r){
    echo "overlap:{$r->overlap} overlapV:[{$r->overlapV->x},{$r->overlapV->y}] overlapN:[{$r->overlapN->x},{$r->overlapN->y}] aInB:".($r->aInB?1:0)." bInA:".($r->bInA?1:0)."\n";
}

//pointInCircle
$point = new Vector(1, 1);
$circle = new Circle(new Vector(1, 1), 1);
var_dump(Collision::pointInCircle($point, $circle));

$point = new Vector(1, 2.1);
$circle = new Circle(new Vector(1, 1), 1);
var_dump(Collision::pointInCircle($point, $circle));

//pointInPolygon
$point = new Vector(1, 2.1);
$polygon = new Polygon(null, array(new Vector(3,1), new Vector(3,2), new Vector(2,3), new Vector(1,2),new Vector(1,1),new Vector(2,0)));
var_dump(Collision::pointInPolygon($point, $polygon));

$polygon = new Polygon(new Vector(-1,-1),array(new Vector(1,1),new Vector(1.5,1.5),new Vector(2,1),new Vector(2,2),new Vector(3,2),new Vector(1.5,4),new Vector(1,3),new Vector(1.5,3)));
$point = new Vector(1, 2);
var_dump(Collision::pointInPolygon($point, $polygon));
$point = new Vector(1, 2.5);
var_dump(Collision::pointInPolygon($point, $polygon));

//testCircleCircle
$c1 = new Circle(new Vector(1, 1), 1);
$c2 = new Circle(new Vector(2, 2), 1);
$r = new Response();
var_dump(Collision::testCircleCircle($c1, $c2, $r));
dumpR($r);
$c3 = new Circle(new Vector(3, 1), 0.9);
var_dump(Collision::testCircleCircle($c1, $c3, $r));

$c4 = new Circle( new Vector(0.9,1), 0.1);
var_dump(Collision::testCircleCircle($c1, $c4, $r));
dumpR($r);

//testPolygonCircle
$p1 = new Polygon(new Vector(-1, 0), array(new Vector(3,1), new Vector(3,2), new Vector(2,3), new Vector(1,2),new Vector(1,1),new Vector(2,0)));
$c1 = new Circle(new Vector(0,0), 1/sqrt(2));
$r->clear();
var_dump(Collision::testPolygonCircle($p1, $c1, $r));
dumpR($r);

$c2 = new Circle(new Vector(-0.1,0), 1/sqrt(2));
var_dump(Collision::testPolygonCircle($p1, $c2, $r));

$r->clear();
$c3 = new Circle(new Vector(1,1.5), 1);
var_dump(Collision::testPolygonCircle($p1, $c3, $r));
dumpR($r);

//testCirclePolygon
$r->clear();
var_dump(Collision::testCirclePolygon($c1, $p1, $r));
dumpR($r);

$r->clear();
var_dump(Collision::testCirclePolygon($c3, $p1, $r));
dumpR($r);

$c4 = new Circle(new Vector(1, 1.5), 1.5);
$r->clear();
var_dump(Collision::testCirclePolygon($c4, $p1, $r));
dumpR($r);

//testPolygonPolygon
$p1 = new Polygon(new Vector(-1, 0), array(new Vector(3,1), new Vector(3,2), new Vector(2,3), new Vector(1,2),new Vector(1,1),new Vector(2,0)));
$p2 = new Polygon(new Vector(-0.5, 0.5), array(new Vector(3,1), new Vector(3,2), new Vector(2,3), new Vector(1,2),new Vector(1,1),new Vector(2,0)));
$r->clear();
var_dump(Collision::testPolygonPolygon($p1, $p2, $r));
dumpR($r);
```

## P.S.
For more details such as the properties of each class, please read the original Javascript library's [document](https://github.com/jriecken/sat-js).


text:
#include "ion/image/renderutils.h"

#include <memory>

#include "base/integral_types.h"
#include "ion/base/datacontainer.h"
#include "ion/gfx/image.h"
#include "ion/gfx/renderer.h"
#include "ion/gfx/sampler.h"
#include "ion/gfx/tests/fakegraphicsmanager.h"
#include "ion/gfx/tests/traceverifier.h"
#include "ion/portgfx/glcontext.h"
#include "absl/memory/memory.h"
#include "third_party/googletest/googletest/include/gtest/gtest.h"

namespace ion {
namespace image {

using gfx::testing::FakeGlContext;
using gfx::testing::FakeGraphicsManager;

//-----------------------------------------------------------------------------
//
// Test harness that sets up a FakeGraphicsManager, Renderer, and TraceVerifier
// for convenience.
//
//-----------------------------------------------------------------------------

class RenderUtilsTest : public ::testing::Test {
 protected:
  void SetUp() override {
    gl_context_ = FakeGlContext::Create(64, 64);
    portgfx::GlContext::MakeCurrent(gl_context_);
    mgm_.Reset(new FakeGraphicsManager());
    renderer_.Reset(new gfx::Renderer(mgm_));
    tv_ = absl::make_unique<gfx::testing::TraceVerifier>(mgm_.Get());

    // Start with a clear call count.
    FakeGraphicsManager::ResetCallCount();
  }

  void TearDown() override {
    tv_.reset();
    renderer_.Reset(nullptr);
    mgm_.Reset(nullptr);
    gl_context_.Reset(nullptr);
  }

  // Builds a sample valid Texture with a 32x32 image. The contents of the
  // images do not matter because the FakeGraphicsManager is incapable of
  // rendering them anyway.
  const gfx::TexturePtr BuildTexture() {
    gfx::TexturePtr tex(new gfx::Texture());
    tex->SetImage(0U, BuildImage(32, 32));
    tex->SetSampler(BuildSampler());
    return tex;
  }

  // Builds a sample valid CubeMap with 6 32x32 images. The contents of the
  // Image do not matter because the FakeGraphicsManager is incapable of
  // rendering them anyway.
  const gfx::CubeMapTexturePtr BuildCubeMap() {
    gfx::CubeMapTexturePtr cm(new gfx::CubeMapTexture());
    gfx::ImagePtr image = BuildImage(32, 32);
    cm->SetImage(gfx::CubeMapTexture::kNegativeX, 0U, image);
    cm->SetImage(gfx::CubeMapTexture::kNegativeY, 0U, image);
    cm->SetImage(gfx::CubeMapTexture::kNegativeZ, 0U, image);
    cm->SetImage(gfx::CubeMapTexture::kPositiveX, 0U, image);
    cm->SetImage(gfx::CubeMapTexture::kPositiveY, 0U, image);
    cm->SetImage(gfx::CubeMapTexture::kPositiveZ, 0U, image);
    cm->SetSampler(BuildSampler());
    return cm;
  }

  portgfx::GlContextPtr gl_context_;
  gfx::testing::FakeGraphicsManagerPtr mgm_;
  gfx::RendererPtr renderer_;
  std::unique_ptr<gfx::testing::TraceVerifier> tv_;
  base::AllocatorPtr al_;

 private:
  const gfx::ImagePtr BuildImage(uint32 width, uint32 height) {
    gfx::ImagePtr image(new gfx::Image);
    std::vector<uint8> pixels(width * height * 3, 0);
    image->Set(gfx::Image::kRgb888, width, height,
               base::DataContainer::CreateAndCopy<uint8>(
                   &pixels[0], pixels.size(), false, al_));
    return image;
  }

  const gfx::SamplerPtr BuildSampler() {
    gfx::SamplerPtr sampler(new gfx::Sampler);
    return sampler;
  }
};

//-----------------------------------------------------------------------------
//
// RenderTextureImage() Tests.
//
//-----------------------------------------------------------------------------

TEST_F(RenderUtilsTest, RenderTextureImageNullTexture) {
  gfx::ImagePtr image =
      RenderTextureImage(gfx::TexturePtr(), 32, 32, renderer_, al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());
}

TEST_F(RenderUtilsTest, RenderTextureImageNullRenderer) {
  gfx::ImagePtr image =
      RenderTextureImage(BuildTexture(), 32, 32, gfx::RendererPtr(), al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());
}

TEST_F(RenderUtilsTest, RenderTextureImageBadImageSize) {
  gfx::TexturePtr tex = BuildTexture();
  gfx::ImagePtr image = RenderTextureImage(tex, 0, 0, renderer_, al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());

  image = RenderTextureImage(tex, 32, 0, renderer_, al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());

  image = RenderTextureImage(tex, 0, 32, renderer_, al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());
}

// This test relies on trace streams, which are disabled in production builds.
#if !ION_PRODUCTION

TEST_F(RenderUtilsTest, RenderTextureImageValid) {
  gfx::TexturePtr tex = BuildTexture();
  gfx::ImagePtr image = RenderTextureImage(tex, 32, 32, renderer_, al_);
  EXPECT_TRUE(image);
  EXPECT_LT(0, FakeGraphicsManager::GetCallCount());

  // Verify some selected OpenGL calls.
  EXPECT_EQ(2U, tv_->GetCountOf("BindFramebuffer"));
  EXPECT_TRUE(tv_->VerifyCallAt(tv_->GetNthIndexOf(0U, "BindFramebuffer"))
              .HasArg(1, "GL_FRAMEBUFFER")
              .HasArg(2, "0x1"));
  EXPECT_TRUE(tv_->VerifyCallAt(tv_->GetNthIndexOf(1U, "BindFramebuffer"))
              .HasArg(1, "GL_FRAMEBUFFER")
              .HasArg(2, "0x0"));
  EXPECT_EQ(1U, tv_->GetCountOf("Viewport"));
  EXPECT_TRUE(tv_->VerifyCallAt(tv_->GetNthIndexOf(0U, "Viewport"))
              .HasArg(1, "0")     // x
              .HasArg(2, "0")     // y
              .HasArg(3, "32")    // width
              .HasArg(4, "32"));  // height
  EXPECT_EQ(2U, tv_->GetCountOf("CreateShader"));
  EXPECT_EQ(1U, tv_->GetCountOf("UseProgram"));
  EXPECT_EQ(1U, tv_->GetCountOf("TexImage2D"));
  EXPECT_EQ(1U, tv_->GetCountOf("BindSampler"));
  EXPECT_EQ(1U, tv_->GetCountOf("Uniform1i"));
  EXPECT_EQ(1U, tv_->GetCountOf("DrawElements"));
  EXPECT_EQ(1U, tv_->GetCountOf("ReadPixels"));
  EXPECT_TRUE(tv_->VerifyCallAt(tv_->GetNthIndexOf(0U, "ReadPixels"))
              .HasArg(1, "0")                   // x
              .HasArg(2, "0")                   // y
              .HasArg(3, "32")                  // width
              .HasArg(4, "32")                  // height
              .HasArg(5, "GL_RGB")              // format
              .HasArg(6, "GL_UNSIGNED_BYTE"));  // type
}

#endif  // !ION_PRODUCTION

//-----------------------------------------------------------------------------
//
// RenderCubeMapTextureFaceImage() Tests.
//
//-----------------------------------------------------------------------------

TEST_F(RenderUtilsTest, RenderCubeMapTextureFaceImageNullCubeMap) {
  gfx::ImagePtr image = RenderCubeMapTextureFaceImage(
      gfx::CubeMapTexturePtr(), gfx::CubeMapTexture::kPositiveX, 32, 32,
      renderer_, al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());
}

TEST_F(RenderUtilsTest, RenderCubeMapTextureFaceImageNullRenderer) {
  gfx::ImagePtr image = RenderCubeMapTextureFaceImage(
      BuildCubeMap(), gfx::CubeMapTexture::kPositiveX, 32, 32,
      gfx::RendererPtr(), al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());
}

TEST_F(RenderUtilsTest, RenderCubeMapTextureFaceImageBadImageSize) {
  gfx::CubeMapTexturePtr cm = BuildCubeMap();
  gfx::ImagePtr image = RenderCubeMapTextureFaceImage(
      cm, gfx::CubeMapTexture::kPositiveX, 0, 0, renderer_, al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());

  image = RenderCubeMapTextureFaceImage(
      cm, gfx::CubeMapTexture::kPositiveX, 32, 0, renderer_, al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());

  image = RenderCubeMapTextureFaceImage(
      cm, gfx::CubeMapTexture::kPositiveX, 0, 32, renderer_, al_);
  EXPECT_FALSE(image);
  EXPECT_EQ(0, FakeGraphicsManager::GetCallCount());
}

// This test relies on trace streams, which are disabled in production builds.
#if !ION_PRODUCTION

TEST_F(RenderUtilsTest, RenderCubeMapTextureFaceImageValid) {
  gfx::CubeMapTexturePtr cm = BuildCubeMap();
  gfx::ImagePtr image = RenderCubeMapTextureFaceImage(
      cm, gfx::CubeMapTexture::kPositiveY, 32, 32, renderer_,
      base::AllocationManager::GetDefaultAllocatorForLifetime(
          base::kShortTerm));
  EXPECT_TRUE(image);
  EXPECT_LT(0, FakeGraphicsManager::GetCallCount());

  // Verify some selected OpenGL calls.
  EXPECT_EQ(2U, tv_->GetCountOf("BindFramebuffer"));
  EXPECT_TRUE(tv_->VerifyCallAt(tv_->GetNthIndexOf(0U, "BindFramebuffer"))
              .HasArg(1, "GL_FRAMEBUFFER")
              .HasArg(2, "0x1"));
  EXPECT_TRUE(tv_->VerifyCallAt(tv_->GetNthIndexOf(1U, "BindFramebuffer"))
              .HasArg(1, "GL_FRAMEBUFFER")
              .HasArg(2, "0x0"));
  EXPECT_EQ(1U, tv_->GetCountOf("Viewport"));
  EXPECT_TRUE(tv_->VerifyCallAt(tv_->GetNthIndexOf(0U, "Viewport"))
              .HasArg(1, "0")     // x
              .HasArg(2, "0")     // y
              .HasArg(3, "32")    // width
              .HasArg(4, "32"));  // height
  EXPECT_EQ(2U, tv_->GetCountOf("CreateShader"));
  EXPECT_EQ(1U, tv_->GetCountOf("UseProgram"));
  EXPECT_EQ(6U, tv_->GetCountOf("TexImage2D"));
  EXPECT_EQ(1U, tv_->GetCountOf("BindSampler"));
  EXPECT_EQ(2U, tv_->GetCountOf("Uniform1i"));
  EXPECT_EQ(1U, tv_->GetCountOf("DrawElements"));
  EXPECT_EQ(1U, tv_->GetCountOf("ReadPixels"));
  EXPECT_TRUE(tv_->VerifyCallAt(tv_->GetNthIndexOf(0U, "ReadPixels"))
              .HasArg(1, "0")                   // x
              .HasArg(2, "0")                   // y
              .HasArg(3, "32")                  // width
              .HasArg(4, "32")                  // height
              .HasArg(5, "GL_RGB")              // format
              .HasArg(6, "GL_UNSIGNED_BYTE"));  // type
}

#endif  // !ION_PRODUCTION

}  // namespace image
}  // namespace ion


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Annls Sci. Nat. , Bot. , sér. 3 16: 63 (1851)

#### Original name
Ozocladium Mont.

### Remarks
null


text:
from __future__ import print_function

import os

import pyrax
import pyrax.exceptions as exc

pyrax.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
dns = pyrax.cloud_dns

domain_name = "abc.example.edu"
try:
    dom = dns.create(name=domain_name, emailAddress="sample@example.edu",
            ttl=900, comment="sample domain")
except exc.DomainCreationFailed as e:
    print("Domain creation failed:", e)
print("Domain created:", dom)


text:
using System;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;

namespace TheWorld.Models
{
    public class WorldUser : IdentityUser
    {
        public DateTime FirstTrip { get; set; }
    }
}


text:
<component name="ArtifactManager">
  <artifact type="jar" build-on-make="true" name="TrikoTcpSlave:jar">
    <output-path>$PROJECT_DIR$/out/artifacts/TrikoTcpSlave_jar</output-path>
    <root id="archive" name="TrikoTcpSlave.jar">
      <element id="module-output" name="TrikoTcpSlave" />
      <element id="extracted-dir" path="$PROJECT_DIR$/lib/kotlin-runtime.jar" path-in-jar="/" />
      <element id="extracted-dir" path="$PROJECT_DIR$/lib/kotlin-reflect.jar" path-in-jar="/" />
      <element id="extracted-dir" path="$PROJECT_DIR$/lib/TrikKotlin.jar" path-in-jar="/" />
    </root>
  </artifact>
</component>


text:
/*
 * @name Caleidoscopio
 * @description Un caleidoscopio es un instrumento óptico con dos o más superficies reflectantes inclinadas entre sí en ángulo. Este ejemplo intenta replicar el comportamiento de un caleidoscopio. Establezca el número de reflexiones en la variable de simetría y comience a dibujar en la pantalla. Ajuste el tamaño del pincel con la ayuda del control deslizante. La pantalla clara como dice borra la pantalla. El botón Guardar descargará un archivo .jpg del arte que ha creado.
 */
// Simetría correspondiente al número de reflejos.
// Cambia el valor para obtener un número diferente de reflexiones
let symmetry = 6;

let angle = 360 / symmetry;
let saveButton, clearButton, mouseButton, keyboardButton;
let slider;

function setup() {
  createCanvas(710, 710);
  angleMode(DEGREES);
  background(127);

  // Creando el botón para guardar para el archivo
  saveButton = createButton('save');
  saveButton.mousePressed(saveFile);

  // Creando el botón para borrar la pantalla
  clearButton = createButton('clear');
  clearButton.mousePressed(clearScreen);

  // Creando el botón para la pantalla completa
  fullscreenButton = createButton('Full Screen');
  fullscreenButton.mousePressed(screenFull);

  // Configurando el deslizador para el grosor del pincel
  brushSizeSlider = createButton('Brush Size Slider');
  sizeSlider = createSlider(1, 32, 4, 0.1);
}

// Función para guardar el archivo
function saveFile() {
  save('design.jpg');
}

// Función para limpiar la pantalla
function clearScreen() {
  background(127);
}

// Función para pantalla completa
function screenFull() {
  let fs = fullscreen();
  fullscreen(!fs);
}

function draw() {
  translate(width / 2, height / 2);

  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
    let mx = mouseX - width / 2;
    let my = mouseY - height / 2;
    let pmx = pmouseX - width / 2;
    let pmy = pmouseY - height / 2;

    if (mouseIsPressed) {
      for (let i = 0; i < symmetry; i++) {
        rotate(angle);
        let sw = sizeSlider.value();
        strokeWeight(sw);
        line(mx, my, pmx, pmy);
        push();
        scale(1, -1);
        line(mx, my, pmx, pmy);
        pop();
      }
    }
  }
}


text:
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Akka.Configuration;
using Akka.Streams.Dsl;
using Akka.Streams.Kafka.Dsl;
using Akka.Streams.Kafka.Messages;
using Akka.Streams.Kafka.Settings;
using Akka.Streams.TestKit;
using Akka.Streams.Kafka.Helpers;
using Confluent.Kafka;
using Xunit;
using Xunit.Abstractions;
using Config = Akka.Configuration.Config;

namespace Akka.Streams.Kafka.Tests.Integration
{
    public class CommitterFlowIntegrationTests : KafkaIntegrationTests
    {
        public CommitterFlowIntegrationTests(ITestOutputHelper output, KafkaFixture fixture)
            : base(nameof(CommitterFlowIntegrationTests), output, fixture)
        {
        }

        [Theory]
        [InlineData(1)]
        [InlineData(5)]
        public async Task CommitterFlow_commits_offsets_from_CommittableSource(int batchSize)
        {
            var topic1 = CreateTopic(1);
            var topicPartition1 = new TopicPartition(topic1, 0);
            var group1 = CreateGroup(1);

            await GivenInitializedTopic(topicPartition1);

            await Source
                .From(Enumerable.Range(1, 100))
                .Select(elem => new ProducerRecord<Null, string>(topicPartition1, elem.ToString()))
                .RunWith(KafkaProducer.PlainSink(ProducerSettings), Materializer);

            var consumerSettings = CreateConsumerSettings<string>(group1);
            var committedElements = new ConcurrentQueue<string>();
            var committerSettings = CommitterSettings.WithMaxBatch(batchSize);

            var (task, probe1) = KafkaConsumer.CommittableSource(consumerSettings, Subscriptions.Assignment(topicPartition1))
                .WhereNot(c => c.Record.Value == InitialMsg)
                .SelectAsync(10, elem =>
                {
                    committedElements.Enqueue(elem.Record.Value);
                    return Task.FromResult(elem.CommitableOffset as ICommittable);
                })
                .Via(Committer.Flow(committerSettings))
                .ToMaterialized(this.SinkProbe<Done>(), Keep.Both)
                .Run(Materializer);

            probe1.Request(25 / batchSize);

            foreach (var _ in Enumerable.Range(1, 25 / batchSize))
            {
                probe1.ExpectNext(Done.Instance, TimeSpan.FromSeconds(10));
            }

            probe1.Cancel();

            AwaitCondition(() => task.IsShutdown.IsCompletedSuccessfully);

            var probe2 = KafkaConsumer.PlainSource(consumerSettings, Subscriptions.Assignment(new TopicPartition(topic1, 0)))
                .Select(_ => _.Value)
                .RunWith(this.SinkProbe<string>(), Materializer);

            probe2.Request(75);
            foreach (var i in Enumerable.Range(committedElements.Count + 1, 75).Select(c => c.ToString()))
                probe2.ExpectNext(i, TimeSpan.FromSeconds(10));

            probe2.Cancel();
        }
    }
}