text
stringlengths 27
775k
|
|---|
require "date"
require "eph_jcg/version"
require "eph_jcg/argument"
require "eph_jcg/coeffs"
require "eph_jcg/constants"
require "eph_jcg/ephemeris"
require "eph_jcg/time_calculator"
module EphJcg
def self.new(arg = ARGV[0])
arg ||= Time.now.strftime("%Y%m%d")
jst = EphJcg::Argument.new(arg).get_jst
return if jst == 0
return EphJcg::Ephemeris.new(jst)
end
end
|
//entry point of index.html
//in charge of rendering the game scene
import 'dart:html';
import 'package:SocketTile/common.dart';
import 'package:SocketTile/socketgame.dart';
void main() {
querySelector('#connect').onClick.listen(connect);
}
void connect(MouseEvent event) {
String ip=(querySelector('#ip') as InputElement).value;
String port=(querySelector('#port')as InputElement).value;
String server='ws://$ip:$port$gameReq';
querySelector('#game').style.display="block";
bool offline=(querySelector('#offline')as InputElement).checked;
if (offline) new SocketGame();
else new SocketGame(server);
}
|
package test.api.route;
import javastrava.api.API;
import javastrava.model.StravaRoute;
import test.api.APIGetTest;
import test.api.callback.APIGetCallback;
import test.service.standardtests.data.RouteDataUtils;
/**
* <p>
* Tests for {@link API#getRoute(Integer)} methods
* </p>
*
* @author Dan Shannon
*
*/
public class GetRouteTest extends APIGetTest<StravaRoute, Integer> {
@Override
protected APIGetCallback<StravaRoute, Integer> getter() {
return ((api, id) -> api.getRoute(id));
}
@Override
protected Integer invalidId() {
return RouteDataUtils.ROUTE_INVALID_ID;
}
@Override
protected Integer privateId() {
return null;
}
@Override
protected Integer privateIdBelongsToOtherUser() {
return null;
}
@Override
protected void validate(StravaRoute result) throws Exception {
RouteDataUtils.validateRoute(result);
}
@Override
protected Integer validId() {
return RouteDataUtils.ROUTE_VALID_ID;
}
@Override
protected Integer validIdBelongsToOtherUser() {
return null;
}
}
|
import _Pagination from './Pagination';
import './style/index.js';
export type { PaginationProps } from './Pagination';
export * from './type';
export const Pagination = _Pagination;
export default Pagination;
|
/*
* The MIT License (MIT)
* Copyright (c) 2016 DataRank, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
package com.simplymeasured.elasticsearch.plugins.tempest
import org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner
import org.elasticsearch.common.settings.Settings
import org.junit.After
import org.junit.Before
import org.junit.Test
/**
* Created by awhite on 4/15/16.
*/
class TempestShardsAllocatorITests {
private val runner = ElasticsearchClusterRunner()
@Before
@Throws(Exception::class)
fun setUp() {
runner.onBuild { index, settingsBuilder ->
settingsBuilder.put("logger.com.simplymeasured.elasticsearch.plugins.tempest", "DEBUG")
settingsBuilder.put("logger.org.elasticsearch.cluster.routing.allocation", "DEBUG")
settingsBuilder.put("tempest.balancer.groupingPatterns", "index-\\w+,index-\\w+-\\d+")
settingsBuilder.put("plugin.types", "com.simplymeasured.elasticsearch.plugins.tempest.TempestPlugin")
settingsBuilder.put("cluster.routing.allocation.type", "tempest")
settingsBuilder.put("cluster.routing.allocation.same_shard.host", false)
settingsBuilder.put("http.cors.enabled", true)
settingsBuilder.put("http.cors.allow-origin", "*")
settingsBuilder.putArray("discovery.zen.ping.unicast.hosts", "localhost:9301-9305")
settingsBuilder.put("cluster.routing.allocation.disk.watermark.low", "95%")
settingsBuilder.put("cluster.routing.allocation.disk.watermark.high", "99%")
}.build(ElasticsearchClusterRunner.newConfigs().numOfNode(5))
runner.ensureGreen()
}
@After
fun tearDown() {
runner.close()
runner.clean()
}
@Test
@Throws(Exception::class)
fun testTempestShardsAllocator() {
runner.createIndex("index-a", Settings.settingsBuilder().put("index.number_of_replicas", "2").build())
runner.createIndex("index-b", Settings.settingsBuilder().put("index.number_of_replicas", "2").build())
runner.createIndex("index-c-123", Settings.settingsBuilder().put("index.number_of_replicas", "2").build())
while (true) {
}
}
}
|
import React from "react";
import styled from "styled-components";
import behance from "../assets/images/behance_white.png";
import github from "../assets/images/github_white.png";
import linkedin from "../assets/images/linkedin_white.png";
//footer is another component that will be used in all screens - it will imported by DefaultTemplate
const FooterWrapper = styled.footer`
display: flex;
flex-wrap: wrap;
width: 100%;
height: auto;
padding: 1% 2%;
background-color: var(--black);
color: var(--lg-color);
@media (max-width: 800px) {
display: block;
}
`;
const ContentItem = styled.div`
flex: 1 0 350px;
margin: 5px;
& h5 {
letter-spacing: 2px;
}
& p {
font-size: 12px;
}
@media (max-width: 800px) {
margin-bottom: 10px;
& p {
font-weight: 300;
}
}
`;
const Icon = styled.img`
width: 24px;
height: auto;
margin: 0;
`;
const Copyright = styled.p`
@media (max-width: 800px) {
font-size: 10px;
}
`;
function Footer() {
return (
<FooterWrapper>
<ContentItem>
<h5>WHO IS THAT GIRL?</h5>
<p>Jennifer Magpantay</p>
<p>
IT graduated, lifelong learner, food lover & crazy cat lady. And
proud.
</p>
<p>Currently based in Dublin, IRL</p>
</ContentItem>
<ContentItem>
<h5>RESOURCES</h5>
<p>
<a href="https://www.youtube.com/channel/UCqrILQNl5Ed9Dz6CGMyvMTQ">
Clever Programmer
</a>
</p>
<p>
<a href="https://firebase.google.com/">Firebase</a>
|
<a href="https://flatuicolors.com/">Flat UI Colors</a>
</p>
<p>
<a href="https://www.canva.com/">Canva</a> |
<a href="https://www.themoviedb.org/">TMDb</a>
</p>
</ContentItem>
<ContentItem>
<h5>LET'S STAY CONNECTED</h5>
<p>
<a href="mailto:jennifer.magpantay@gmail.com">popme@message.com</a>
</p>
<ul>
<li>
<a href="https://www.linkedin.com/in/jennifermagpantay/">
<Icon src={linkedin} alt="Linkedin Profile" />
</a>
</li>
<li>
<a href="https://github.com/jennifer-magpantay">
<Icon src={github} alt="Github Repositories" />
</a>
</li>
<li>
<a href="https://www.behance.net/jennifer_magpantay">
<Icon src={behance} alt="Behance Projects" />
</a>
</li>
</ul>
</ContentItem>
<hr />
<ContentItem>
<Copyright>
Copyright © 2020 Developed by Jennifer Magpantay using HTML5,
CSS3 & React | Clever Programmer
</Copyright>
</ContentItem>
</FooterWrapper>
);
}
export default Footer;
|
import 'package:vector_math/vector_math.dart';
import '../../../engine/collision/collider.dart';
import '../../../engine/collision/collider_circle.dart';
import '../../../renderer/shapes/shape.dart';
import '../../../renderer/shapes/shape_circle.dart';
import '../entities/entity.dart';
import '../obstacles/obstacle.dart';
import '../units/unit.dart';
import 'projectile.dart';
class ProjectileBig extends Projectile {
int radius = 10;
int damage = 3;
ProjectileBig(Vector2 position, Vector2 velocity, Team team)
: super(position, velocity, team);
@override
void resolveCollisions() {
for (Unit unit in stage.units) {
if (unit.team != team && unit.collider.intersectsCircle(collider)) {
unit.damage(damage);
this.destroy();
}
}
for (Entity entity in stage.entities) {
if (entity.collider != null) {
if (entity.collider.intersectsCircle(collider)) {
this.destroy();
}
}
}
for (Obstacle obstacle in stage.obstacles) {
if (obstacle.collider != null) {
if (obstacle.collider.intersectsCircle(collider)) {
this.destroy();
}
}
}
for (Projectile projectile in stage.projectiles) {
if (projectile == this) {
continue;
}
if (projectile.collider.intersectsCircle(collider)) {
projectile.destroy();
this.destroy();
}
}
}
@override
void destroy() {
stage.removeProjectile(this);
}
@override
List<Shape> get renderShapes {
if (team == Team.Friendly) {
return [ShapeCircle(this, radius, "#000000")];
} else {
return [ShapeCircle(this, radius, "#880e4f")];
}
}
@override
Collider get collider {
return ColliderCircle(this, radius);
}
}
|
# Attendence
___
___
CRUD for user's tasks with auth.
Used stack is Mongo+Express+React+Node, also custom CSS and Semantic UI React.
## Work flow
Users are registered and authorized.
In main section (`Home`) there is list of tasks and small form for creating a new one.
Tasks are shown for all users, but current user can edit and delete only tasks created by current user.
Editing of task is made in the separate small modal window.
## Scripts
Run from the project's folder:
### `npm i`
Install modules
### `npm run dev`
Start the app in dev mode at [http://localhost:3000](http://localhost:3000).
### `npm run build`
Build project into `build` folder.
|
/*
* This header is generated by classdump-dyld 1.0
* on Saturday, June 1, 2019 at 6:49:02 PM Mountain Standard Time
* Operating System: Version 12.1.1 (Build 16C5050a)
* Image Source: /System/Library/PrivateFrameworks/MediaSocial.framework/MediaSocial
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <StoreServices/SSVComplexOperation.h>
@class MSCLAccount, SKUIMediaSocialAuthor, SSVMediaSocialPostExternalDestination, NSLock;
@interface MSCLAccountTokenRegisterOperation : SSVComplexOperation {
MSCLAccount* _account;
SKUIMediaSocialAuthor* _author;
SSVMediaSocialPostExternalDestination* _externalDestination;
NSLock* _lock;
/*^block*/id _outputBlock;
}
@property (copy) id outputBlock;
-(void)setOutputBlock:(id)arg1 ;
-(id)outputBlock;
-(id)_requestWithURL:(id)arg1 ;
-(id)_queryItems;
-(id)_componentsWithURL:(id)arg1 ;
-(id)initWithAuthor:(id)arg1 externalDestination:(id)arg2 account:(id)arg3 ;
-(void)main;
@end
|
package com.pax.market.android.app.sdk.dto;
import android.os.Parcel;
import android.os.Parcelable;
import com.pax.market.android.app.sdk.util.StringUtils;
/**
* Created by fojut on 2019/1/7.
*/
public class StoreProxyInfo implements Parcelable {
private int type; //0:DIRECT, 1:HTTP, 2:SOCKS
private String host;
private int port;
private String authorization;
private String username;
private char[] password;
public StoreProxyInfo() {
}
protected StoreProxyInfo(Parcel in) {
type = in.readInt();
host = in.readString();
port = in.readInt();
authorization = in.readString();
username = in.readString();
password = in.createCharArray();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(type);
dest.writeString(host);
dest.writeInt(port);
dest.writeString(authorization);
dest.writeString(username);
dest.writeCharArray(password);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<StoreProxyInfo> CREATOR = new Creator<StoreProxyInfo>() {
@Override
public StoreProxyInfo createFromParcel(Parcel in) {
return new StoreProxyInfo(in);
}
@Override
public StoreProxyInfo[] newArray(int size) {
return new StoreProxyInfo[size];
}
};
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getAuthorization() {
return authorization;
}
public void setAuthorization(String authorization) {
this.authorization = authorization;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public char[] getPassword() {
return password;
}
public void setPassword(char[] password) {
this.password = password;
}
public String getPasswordString() {
if (password == null) {
return null;
}
return String.valueOf(password);
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof StoreProxyInfo))
return false;
StoreProxyInfo c = (StoreProxyInfo) obj;
if (type != c.getType()) {
return false;
}
if (!StringUtils.equals(host, c.getHost())) {
return false;
}
if (port != c.getPort()) {
return false;
}
if (!StringUtils.equals(authorization, c.getAuthorization())) {
return false;
}
if (!StringUtils.equals(username, c.getUsername())) {
return false;
}
if (StringUtils.equals(getPasswordString(), c.getPasswordString())) {
return false;
}
return true;
}
}
|
package javassist.bytecode.annotation;
import java.io.IOException;
import java.lang.reflect.Method;
import javassist.ClassPool;
import javassist.bytecode.ConstPool;
import javassist.bytecode.Descriptor;
public class EnumMemberValue extends MemberValue {
int typeIndex;
int valueIndex;
public EnumMemberValue(int type, int value, ConstPool cp) {
super('e', cp);
this.typeIndex = type;
this.valueIndex = value;
}
public EnumMemberValue(ConstPool cp) {
super('e', cp);
this.typeIndex = this.valueIndex = 0;
}
Object getValue(ClassLoader cl, ClassPool cp, Method m) throws ClassNotFoundException {
try {
return this.getType(cl).getField(this.getValue()).get((Object)null);
} catch (NoSuchFieldException var5) {
throw new ClassNotFoundException(this.getType() + "." + this.getValue());
} catch (IllegalAccessException var6) {
throw new ClassNotFoundException(this.getType() + "." + this.getValue());
}
}
Class getType(ClassLoader cl) throws ClassNotFoundException {
return loadClass(cl, this.getType());
}
public String getType() {
return Descriptor.toClassName(this.cp.getUtf8Info(this.typeIndex));
}
public void setType(String typename) {
this.typeIndex = this.cp.addUtf8Info(Descriptor.of(typename));
}
public String getValue() {
return this.cp.getUtf8Info(this.valueIndex);
}
public void setValue(String name) {
this.valueIndex = this.cp.addUtf8Info(name);
}
public String toString() {
return this.getType() + "." + this.getValue();
}
public void write(AnnotationsWriter writer) throws IOException {
writer.enumConstValue(this.cp.getUtf8Info(this.typeIndex), this.getValue());
}
public void accept(MemberValueVisitor visitor) {
visitor.visitEnumMemberValue(this);
}
}
|
package automaton.constructor.utils
import javafx.beans.binding.Binding
import javafx.geometry.Point2D
import javafx.scene.Group
import javafx.scene.shape.Line
import tornadofx.*
class Arrow(
val line: Line,
val length: Double,
val width: Double
) : Group() {
val normalizedVectorBinding: Binding<Point2D> = nonNullObjectBinding(
line.startXProperty(), line.startYProperty(),
line.endXProperty(), line.endYProperty()
) {
Vector2D(line.startX - line.endX, line.startY - line.endY).normalize()
}
val normalizedVector: Vector2D by normalizedVectorBinding
val arrowPart1 = line {
fillProperty().bind(line.fillProperty())
startXProperty().bind(doubleBinding(line.endXProperty(), normalizedVectorBinding) {
value + normalizedVector.x * length - normalizedVector.y * width
})
startYProperty().bind(doubleBinding(line.endYProperty(), normalizedVectorBinding) {
value + normalizedVector.y * length + normalizedVector.x * width
})
endXProperty().bind(line.endXProperty())
endYProperty().bind(line.endYProperty())
}
val arrowPart2 = line {
fillProperty().bind(line.fillProperty())
startXProperty().bind(doubleBinding(line.endXProperty(), normalizedVectorBinding) {
value + normalizedVector.x * length + normalizedVector.y * width
})
startYProperty().bind(doubleBinding(line.endYProperty(), normalizedVectorBinding) {
value + normalizedVector.y * length - normalizedVector.x * width
})
endXProperty().bind(line.endXProperty())
endYProperty().bind(line.endYProperty())
}
init {
add(line)
}
}
|
#!/usr/bin/env bash
# This script is meant for the EnterprisePharo book. You can use it for other projects
# Exit immediately if a command exits with a non-zero status
set -e
LATEX_COMPILER="pdflatex"
# LATEX_COMPILER="lualatex"
PILLAR_COMMAND="./pillar"
if hash "pillar" 2>/dev/null; then
PILLAR_COMMAND="pillar"
fi
function pillar_all() {
$PILLAR_COMMAND export --to='LaTeX whole book'
$PILLAR_COMMAND export --to='LaTeX by chapter'
$PILLAR_COMMAND export --to='HTML by chapter'
$PILLAR_COMMAND export --to='Markdown by chapter'
}
function pillar_one() {
input="$1"
$PILLAR_COMMAND export --to='LaTeX by chapter' "$input"
$PILLAR_COMMAND export --to='HTML by chapter' "$input"
$PILLAR_COMMAND export --to='Markdown by chapter' "$input"
}
function mypdflatex() {
pillar_file="$1"
echo "Compiling PDF from $pillar_file..."
${LATEX_COMPILER} -halt-on-error -file-line-error -interaction batchmode "$pillar_file" 2>&1 1>/dev/null
ret=$?
if [[ $ret -ne 0 ]]; then
cat $pillar_file.log
echo "Can't generate the PDF!"
exit 1
fi
}
function produce_pdf() {
dir="$1"
pillar_file="$2"
cd "$dir" # e.g., cd Zinc/
mypdflatex "$pillar_file" && mypdflatex "$pillar_file"
cd ..
}
function compile_chapters() {
chapters=$($PILLAR_COMMAND show inputFiles 2>/dev/null)
for chapter in $chapters; do
echo =========================================================
echo COMPILING $chapter
echo =========================================================
# e.g., chapter = Zinc/Zinc.pillar
pillar_file=$(basename $chapter) # e.g., Zinc.pillar
dir=$(dirname $chapter) # e.g., Zinc
produce_pdf "${dir}" "${pillar_file}"
done
}
function compile_latex_book() {
echo =========================================================
echo COMPILING Book
echo =========================================================
cd book-result
produce_pdf . Book
}
function latex_enabled() {
hash ${LATEX_COMPILER} 2>/dev/null
}
if [[ $# -eq 1 ]]; then
echo "Generating files based on $1"
dir=$(dirname "$1") # e.g., Zinc
pillar_file=$(basename "$1") # e.g., Zinc.pillar
pillar_one "$1"
if latex_enabled; then
produce_pdf "${dir}" "${pillar_file}"
fi
else
echo 'Generating files for all chapters'
mkdir -p book-result
pillar_all
if latex_enabled; then
compile_chapters
compile_latex_book
fi
fi
echo 'Done'
|
/*
Copyright 2020 The Qmgo Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package qmgo
// CollectionI
// 集合操作接口
//type CollectionI interface {
// Find(filter interface{}) QueryI
// InsertOne(doc interface{}) (*mongo.InsertOneResult, error)
// InsertMany(docs ...interface{}) (*mongo.InsertManyResult, error)
// Upsert(filter interface{}, replacement interface{}) (*mongo.UpdateResult, error)
// UpdateOne(filter interface{}, update interface{}) error
// UpdateAll(filter interface{}, update interface{}) (*mongo.UpdateResult, error)
// DeleteOne(filter interface{}) error
// RemoveAll(selector interface{}) (*mongo.DeleteResult, error)
// EnsureIndex(indexes []string, isUnique bool)
// EnsureIndexes(uniques []string, indexes []string)
//}
// Change holds fields for running a findAndModify command via the Query.Apply method.
type Change struct {
Update interface{} // update/replace document
Replace bool // Whether to replace the document rather than updating
Remove bool // Whether to remove the document found rather than updating
Upsert bool // Whether to insert in case the document isn't found, take effect when Remove is false
ReturnNew bool // Should the modified document be returned rather than the old one, take effect when Remove is false
}
// CursorI Cursor interface
type CursorI interface {
Next(result interface{}) bool
Close() error
Err() error
All(results interface{}) error
//ID() int64
}
// QueryI Query interface
type QueryI interface {
Sort(fields ...string) QueryI
Select(selector interface{}) QueryI
Skip(n int64) QueryI
Limit(n int64) QueryI
One(result interface{}) error
All(result interface{}) error
Count() (n int64, err error)
Distinct(key string, result interface{}) error
Cursor() CursorI
Apply(change Change, result interface{}) error
Hint(hint interface{}) QueryI
}
// AggregateI define the interface of aggregate
type AggregateI interface {
All(results interface{}) error
One(result interface{}) error
Iter() CursorI
}
|
module TestConstraintZeroOne
using Test
using VecMathOptInterface
const MOI = VecMathOptInterface
function runtests()
for name in names(@__MODULE__; all = true)
if startswith("$(name)", "test_")
@testset "$(name)" begin
getfield(@__MODULE__, name)()
end
end
end
return
end
include("../utilities.jl")
function test_ZeroOne()
mock = MOI.Utilities.MockOptimizer(
MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()),
)
config = MOI.Test.Config()
bridged_mock = MOI.Bridges.Constraint.ZeroOne{Float64}(mock)
bridge_type = MOI.Bridges.Constraint.ZeroOneBridge{Float64}
@test MOI.supports_constraint(bridge_type, MOI.VariableIndex, MOI.ZeroOne)
@test MOI.Bridges.Constraint.concrete_bridge_type(
bridge_type,
MOI.VariableIndex,
MOI.ZeroOne,
) == bridge_type
MOI.Test.test_basic_VariableIndex_ZeroOne(bridged_mock, config)
MOI.empty!(bridged_mock)
MOI.Utilities.set_mock_optimize!(
mock,
(mock::MOI.Utilities.MockOptimizer) ->
MOI.Utilities.mock_optimize!(mock, [1, 0, 0, 1, 1]),
)
MOI.Test.test_linear_integer_knapsack(bridged_mock, config)
ci = first(
MOI.get(
bridged_mock,
MOI.ListOfConstraintIndices{MOI.VariableIndex,MOI.ZeroOne}(),
),
)
@test MOI.get(bridged_mock, MOI.ConstraintPrimal(), ci) == 1
_test_delete_bridge(
bridged_mock,
ci,
5,
(
(MOI.VariableIndex, MOI.Integer, 0),
(MOI.VariableIndex, MOI.Interval{Float64}, 0),
),
num_bridged = 5,
)
MOI.empty!(bridged_mock)
MOI.Utilities.set_mock_optimize!(
mock,
(mock::MOI.Utilities.MockOptimizer) -> begin
MOI.set(mock, MOI.ObjectiveBound(), 20.0)
MOI.Utilities.mock_optimize!(mock, [4, 5, 1])
end,
)
MOI.Test.test_linear_integer_integration(bridged_mock, config)
MOI.empty!(bridged_mock)
MOI.Utilities.set_mock_optimize!(
mock,
(mock::MOI.Utilities.MockOptimizer) ->
MOI.Utilities.mock_optimize!(mock, [1.0; zeros(10)]),
)
MOI.Test.test_linear_integer_solve_twice(bridged_mock, config)
ci = first(
MOI.get(
bridged_mock,
MOI.ListOfConstraintIndices{MOI.VariableIndex,MOI.ZeroOne}(),
),
)
s = """
variables: x, y
y == 1.0
x in ZeroOne()
minobjective: x
"""
model = MOI.Utilities.Model{Float64}()
MOI.Utilities.loadfromstring!(model, s)
sb = """
variables: x, y
y == 1.0
x in Integer()
x in Interval(0.0,1.0)
minobjective: x
"""
modelb = MOI.Utilities.Model{Float64}()
MOI.Utilities.loadfromstring!(modelb, sb)
MOI.empty!(bridged_mock)
@test MOI.is_empty(bridged_mock)
MOI.Utilities.loadfromstring!(bridged_mock, s)
MOI.Test.util_test_models_equal(
bridged_mock,
model,
["x", "y"],
String[],
[("y", MOI.EqualTo{Float64}(1.0)), ("x", MOI.ZeroOne())],
)
MOI.Test.util_test_models_equal(
mock,
modelb,
["x", "y"],
String[],
[
("y", MOI.EqualTo{Float64}(1.0)),
("x", MOI.Integer()),
("x", MOI.Interval{Float64}(0.0, 1.0)),
],
)
return
end
end # module
TestConstraintZeroOne.runtests()
|
# Blue
Blue is a user configuration module based on [Kohana Red](https://github.com/davidstutz/kohana-red).
|
# 1. 工厂的创建方法
可以创建一个具体产品(无形参),也可创建一个抽象产品的具体产品(有形参)
```c++
Product *Factory::create(){// 无形参,只能创建一个固定的对象
return new Product;
}
Product *Factory::create(string name){// 根据形参,创建不同具体对象
if(name=="pro1"){
return new Pro1;
}else if(name=="pro2"){
return new Pro2;
}else{
...
}
}
```
# 2. 抽象
具象是不同层次上的抽象
苹果是红富士苹果、嘎啦苹果的抽象;红富士苹果是红富士甜苹果、红富士酸苹果的抽象;红富士甜苹果是红富士小甜苹果、红富士大甜苹果
的抽象。抽象可无限向下分割。
工厂可无限向下分割。
# 3. 封装
可以将变化封装到类中、函数中、变量中。抽象的对象可以变化,变化就是抽象。
|
<?php
namespace Database\Seeders;
use Carbon\Carbon;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class NewsLettersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//Empty the table first
DB::statement('SET FOREIGN_KEY_CHECKS=0');
DB::table('newsletter')->truncate();
DB::statement('SET FOREIGN_KEY_CHECKS=1');
//Fill data
DB::table('newsletter')->insert([
[
'created_at' => Carbon::now(),
'updated_at' => null,
'email' => 'radad19998@gmail.com',
],
[
'created_at' => Carbon::now(),
'updated_at' => null,
'email' => 'sarah4020@gmail.com',
],
]);
}
}
|
//! ASN.1 `ANY` type.
use crate::{
asn1::*, ByteSlice, Choice, Decodable, DecodeValue, Decoder, Encodable, EncodeValue, Encoder,
Error, ErrorKind, Header, Length, Result, Tag, Tagged,
};
use core::convert::{TryFrom, TryInto};
#[cfg(feature = "oid")]
use crate::asn1::ObjectIdentifier;
/// ASN.1 `ANY`: represents any explicitly tagged ASN.1 value.
///
/// Technically `ANY` hasn't been a recommended part of ASN.1 since the X.209
/// revision from 1988. It was deprecated and replaced by Information Object
/// Classes in X.680 in 1994, and X.690 no longer refers to it whatsoever.
///
/// Nevertheless, this crate defines an [`Any`] type as it remains a familiar
/// and useful concept which is still extensively used in things like
/// PKI-related RFCs.
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
pub struct Any<'a> {
/// Tag representing the type of the encoded value.
tag: Tag,
/// Inner value encoded as bytes.
value: ByteSlice<'a>,
}
impl<'a> Any<'a> {
/// Create a new [`Any`] from the provided [`Tag`] and byte slice.
pub fn new(tag: Tag, bytes: &'a [u8]) -> Result<Self> {
let value = ByteSlice::new(bytes).map_err(|_| ErrorKind::Length { tag })?;
Ok(Self { tag, value })
}
/// Infallible creation of an [`Any`] from a [`ByteSlice`].
pub(crate) fn from_tag_and_value(tag: Tag, value: ByteSlice<'a>) -> Self {
Self { tag, value }
}
/// Get the tag for this [`Any`] type.
pub fn tag(self) -> Tag {
self.tag
}
/// Get the raw value for this [`Any`] type as a byte slice.
pub fn value(self) -> &'a [u8] {
self.value.as_bytes()
}
/// Attempt to decode this [`Any`] type into the inner value.
pub fn decode_into<T>(self) -> Result<T>
where
T: DecodeValue<'a> + Tagged,
{
self.tag.assert_eq(T::TAG)?;
let mut decoder = Decoder::new(self.value());
let result = T::decode_value(&mut decoder, self.value.len())?;
decoder.finish(result)
}
/// Is this value an ASN.1 NULL value?
pub fn is_null(self) -> bool {
Null::try_from(self).is_ok()
}
/// Attempt to decode an ASN.1 `BIT STRING`.
pub fn bit_string(self) -> Result<BitString<'a>> {
self.try_into()
}
/// Attempt to decode an ASN.1 `CONTEXT-SPECIFIC` field.
pub fn context_specific<T>(self) -> Result<ContextSpecific<T>>
where
T: Decodable<'a>,
{
self.try_into()
}
/// Attempt to decode an ASN.1 `GeneralizedTime`.
pub fn generalized_time(self) -> Result<GeneralizedTime> {
self.try_into()
}
/// Attempt to decode an ASN.1 `IA5String`.
pub fn ia5_string(self) -> Result<Ia5String<'a>> {
self.try_into()
}
/// Attempt to decode an ASN.1 `OCTET STRING`.
pub fn octet_string(self) -> Result<OctetString<'a>> {
self.try_into()
}
/// Attempt to decode an ASN.1 `OBJECT IDENTIFIER`.
#[cfg(feature = "oid")]
#[cfg_attr(docsrs, doc(cfg(feature = "oid")))]
pub fn oid(self) -> Result<ObjectIdentifier> {
self.try_into()
}
/// Attempt to decode an ASN.1 `OPTIONAL` value.
pub fn optional<T>(self) -> Result<Option<T>>
where
T: Choice<'a> + TryFrom<Self, Error = Error>,
{
if T::can_decode(self.tag) {
T::try_from(self).map(Some)
} else {
Ok(None)
}
}
/// Attempt to decode an ASN.1 `PrintableString`.
pub fn printable_string(self) -> Result<PrintableString<'a>> {
self.try_into()
}
/// Attempt to decode this value an ASN.1 `SEQUENCE`, creating a new
/// nested [`Decoder`] and calling the provided argument with it.
pub fn sequence<F, T>(self, f: F) -> Result<T>
where
F: FnOnce(&mut Decoder<'a>) -> Result<T>,
{
Sequence::try_from(self)?.decode_nested(f)
}
/// Attempt to decode an ASN.1 `UTCTime`.
pub fn utc_time(self) -> Result<UtcTime> {
self.try_into()
}
/// Attempt to decode an ASN.1 `UTF8String`.
pub fn utf8_string(self) -> Result<Utf8String<'a>> {
self.try_into()
}
}
impl<'a> Choice<'a> for Any<'a> {
fn can_decode(_: Tag) -> bool {
true
}
}
impl<'a> Decodable<'a> for Any<'a> {
fn decode(decoder: &mut Decoder<'a>) -> Result<Any<'a>> {
let header = Header::decode(decoder)?;
let tag = header.tag;
let value = ByteSlice::decode_value(decoder, header.length)?;
Ok(Self { tag, value })
}
}
impl<'a> Encodable for Any<'a> {
fn encoded_len(&self) -> Result<Length> {
self.value.len().for_tlv()
}
fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()> {
Header::new(self.tag, self.value.len())?.encode(encoder)?;
self.encode_value(encoder)
}
}
impl<'a> EncodeValue for Any<'a> {
fn value_len(&self) -> Result<Length> {
Ok(self.value.len())
}
fn encode_value(&self, encoder: &mut Encoder<'_>) -> Result<()> {
encoder.bytes(self.value())
}
}
impl<'a> From<Any<'a>> for ByteSlice<'a> {
fn from(any: Any<'a>) -> ByteSlice<'a> {
any.value
}
}
impl<'a> TryFrom<&'a [u8]> for Any<'a> {
type Error = Error;
fn try_from(bytes: &'a [u8]) -> Result<Any<'a>> {
Any::from_der(bytes)
}
}
|
package pkg
import (
"fmt"
"strconv"
"strings"
)
type Coordinate struct {
X int
Y int
}
type Direction int
func (c Coordinate) Plus(c2 Coordinate) Coordinate {
return Coordinate{c.X + c2.X, c.Y + c2.Y}
}
const (
LEFT Direction = iota
RIGHT
UP
DOWN
)
func (d Direction) String() string {
switch d {
case LEFT:
return "<"
case DOWN:
return "v"
case RIGHT:
return ">"
case UP:
return "^"
}
panic("No representation")
}
func (d Direction) TurnRight() Direction {
switch d {
case DOWN:
return LEFT
case LEFT:
return UP
case UP:
return RIGHT
case RIGHT:
return DOWN
}
panic("Can't turn")
}
func (d Direction) TurnLeft() Direction {
switch d {
case DOWN:
return RIGHT
case RIGHT:
return UP
case UP:
return LEFT
case LEFT:
return DOWN
}
panic("Can't turn")
}
func (c Coordinate) String() string {
return fmt.Sprintf("(%v,%v)", c.X, c.Y)
}
func (c Coordinate) Left() Coordinate {
return Coordinate{c.X - 1, c.Y}
}
func (c Coordinate) Right() Coordinate {
return Coordinate{c.X + 1, c.Y}
}
func (c Coordinate) Up() Coordinate {
return Coordinate{c.X, c.Y - 1}
}
func (c Coordinate) Down() Coordinate {
return Coordinate{c.X, c.Y + 1}
}
func (c Coordinate) Move(direction Direction) Coordinate {
switch direction {
case DOWN:
return c.Down()
case UP:
return c.Up()
case RIGHT:
return c.Right()
case LEFT:
return c.Left()
}
panic(fmt.Sprintf("Fail invalid direction %v", direction))
}
func ManhattanDistance(c1 Coordinate, c2 Coordinate) int {
return Abs(c1.X-c2.X) + Abs(c1.Y-c2.Y)
}
func GetNeighbours(c Coordinate) (Coordinate, Coordinate, Coordinate, Coordinate) {
c1 := Coordinate{X: c.X + 1, Y: c.Y}
c2 := Coordinate{X: c.X - 1, Y: c.Y}
c3 := Coordinate{X: c.X, Y: c.Y + 1}
c4 := Coordinate{X: c.X, Y: c.Y - 1}
return c1, c2, c3, c4
}
func GetNeighboursSlice(c Coordinate) []Coordinate {
c1, c2, c3, c4 := GetNeighbours(c)
return []Coordinate{c1, c2, c3, c4}
}
func ParseCoordinate(s string) Coordinate {
components := strings.Split(s, ",")
x, _ := strconv.Atoi(components[0])
y, _ := strconv.Atoi(strings.TrimSpace(components[1]))
return Coordinate{X: x, Y: y}
}
|
#!/bin/bash
DOTFILES_DIR="$HOME/.dotfiles"
change_to_zsh() {
if [ "$(echo "$SHELL" | grep -c "zsh")" -eq "0" ]; then
echo "Setting shell to zsh"
chsh -s "$(which zsh)"
else
echo "zsh is already the default shell"
fi
}
create_ssh() {
mkdir -p "$HOME"/.ssh
chmod 0700 "$HOME"/.ssh
}
fonts_install() {
echo "Installing fonts..."
if ! [ -d ~/.local/share/fonts ]; then
"$DOTFILES_DIR"/fonts/install.sh
else
echo "Fonts already installed"
fi
echo "Finished fonts"
}
local_install() {
echo "Installing local packages..."
if [ "$(uname)" = "Linux" ]; then
"$DOTFILES_DIR"/scripts/apt_setup.sh
else
echo "No local packages to install..."
fi
echo "Finished installing local packages"
}
install() {
fonts_install
local_install
}
create_ssh
change_to_zsh
install
|
#!/bin/bash
## Vincent Major
## Created September 25 2017
## Last modified September 26 2017
## This script will take a raw xml file of pubmed articles,
## extract their pmids, years, titles and abstracts using R, and
## process the text and combine with manual labels using python.
## expecting one argument, remove the extension
BASEFILE=$(echo $1 | cut -f 1 -d '.')
INTERMEDIATE="$BASEFILE"_intermediate.xml
echo $INTERMEDIATE
#OUTFILE="$BASEFILE"_extracted.txt
OUTFILE=$2
echo $OUTFILE
## remove artifacts from pasting many xmls together
head -3 $1 | sed '2d' > $INTERMEDIATE
## inverse grep i.e. remove matching rows - act as OR
grep -v -e 'DOCTYPE' -e '<?xml version="1.0" ?>' -e '<PubmedArticleSet>' $1 >> $INTERMEDIATE
## matching does not match the last line which is simply "</PubmedArticleSet>"
## second, extract from the cleaned up XML
Rscript src/1_extract_id_year_title_abstract_from_raw_xml.R $INTERMEDIATE $OUTFILE
## which should create a file called $OUTFILE
echo "Done!"
|
<?php
class Mail {
private $error;
public function sendMailWithNativeMailFunction() {
return false;
}
public function sendMailWithSwiftMailer() {
return false;
}
public function sendMailWithPHPMailer($user_email, $from_email, $from_name, $subject, $body) {
$mail = new PHPMailer;
if (Config::get('EMAIL_USE_SMTP')) {
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = Config::get('EMAIL_SMTP_AUTH');
if (Config::get('EMAIL_SMTP_ENCRYPTION')) {
$mail->SMTPSecure = Config::get('EMAIL_SMTP_ENCRYPTION');
}
$mail->Host = Config::get('EMAIL_SMTP_HOST');
$mail->Username = Config::get('EMAIL_SMTP_USERNAME');
$mail->Password = Config::get('EMAIL_SMTP_PASSWORD');
$mail->Port = Config::get('EMAIL_SMTP_PORT');
} else {
$mail->IsMail();
}
$mail->From = $from_email;
$mail->FromName = $from_name;
$mail->AddAddress($user_email);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->isHTML(true);
$mail->CharSet = 'UTF-8';
$wasSendingSuccessful = $mail->Send();
if ($wasSendingSuccessful) {
return true;
} else {
$this->error = $mail->ErrorInfo;
return false;
}
}
public function sendMail($user_email, $from_email, $from_name, $subject, $body) {
if (Config::get('EMAIL_USED_MAILER') == "phpmailer") {
return $this->sendMailWithPHPMailer($user_email, $from_email, $from_name, $subject, $body);
}
if (Config::get('EMAIL_USED_MAILER') == "swiftmailer") {
return $this->sendMailWithSwiftMailer();
}
if (Config::get('EMAIL_USED_MAILER') == "native") {
return $this->sendMailWithNativeMailFunction();
}
}
public function getError() {
return $this->error;
}
}
|
require_relative './exceptions'
ERRORS_BY_STATUS = {
'400' => FastTrack::BadRequestException,
'401' => FastTrack::UnauthorizedException,
'404' => FastTrack::NotFoundException,
'405' => FastTrack::MethodNotAllowedException,
'406' => FastTrack::NotAcceptableException,
'429' => FastTrack::TooManyRequestsException
}
ERRORS_BY_ERROR_CODE = {
'1' => FastTrack::VersionRequiredException,
'2' => FastTrack::NoResultException,
'3' => FastTrack::BadParametersException,
'4' => FastTrack::InvalidVersionException
}
def exception_for_response(status, errorCode)
fast_track_error = nil
if errorCode != nil
fast_track_error = ERRORS_BY_ERROR_CODE[errorCode]
end
if fast_track_error == nil && status != nil
fast_track_error = ERRORS_BY_STATUS[status.to_s]
if status >= 500 && status < 600
fast_track_error = FastTrack::InternalServerException
end
end
if fast_track_error == nil
fast_track_error = Exception
end
return fast_track_error
end
|
# #!/bin/bash
### install metax
wget https://greenhosting.am:444/db/get/metax_1.2.13.zip?id=1452a7fb-0af2-4f66-865a-2d684894b7bf -O metax.zip
unzip metax.zip
sudo rm metax.zip
sudo rm -rf /opt/metax
sudo mv metax /opt/
cd /opt/metax/
sudo apt-get install g++ make pkg-config libssl-dev
sudo apt autoremove
make -j8
### install poco
wget https://pocoproject.org/releases/poco-1.8.1/poco-1.8.1-all.tar.bz2
tar xvf poco-1.8.1-all.tar.bz2
sudo apt-get install libpoco-dev
cd poco-1.8.1-all/
sudo make -j8 install
./configure --no-tests --no-samples --omit=CppUnit,Data,MongoDB,PageCompiler,Redis,Zip
sudo make install
make
cd ..
make setup
make
## run metax
### ./bin/metax_web_api -f config.xml
echo "now run <./build_term.sh>"
|
require 'spec_helper'
require 'cleaner/whitespace_cleaner'
describe WhitespaceCleaner do
include_context "shared cleaner"
subject { WhitespaceCleaner }
let(:data) { {a: " Test", b: "Double test "} }
# let!(:original_value) { data.first.last.clone }
# it "downcases an array of objects" do
#expect( modified_value ).to match /^[^\s].+[^\s]$/
# end
end
|
/// <reference path="../../../globals.d.ts"/>
/// <reference path="./component.d.ts"/>
/// <reference path="./containerrenderer.d.ts"/>
/// <reference path="../dom/dom.d.ts"/>
/// <reference path="../events/keyhandler.d.ts"/>
/// <reference path="./control.d.ts"/>
/// <reference path="../events/event.d.ts"/>
/// <reference path="../events/browserevent.d.ts"/>
declare module 'goog:goog.ui.Container' {
import alias = goog.ui.Container;
export default alias;
}
declare module 'goog:goog.ui.Container.Orientation' {
import alias = goog.ui.Container.Orientation;
export default alias;
}
declare module 'goog:goog.ui.Container.EventType' {
import alias = goog.ui.Container.EventType;
export default alias;
}
declare namespace goog.ui {
/**
* Base class for containers. Extends {@link goog.ui.Component} by adding
* the following:
* <ul>
* <li>a {@link goog.events.KeyHandler}, to simplify keyboard handling,
* <li>a pluggable <em>renderer</em> framework, to simplify the creation of
* containers without the need to subclass this class,
* <li>methods to manage child controls hosted in the container,
* <li>default mouse and keyboard event handling methods.
* </ul>
* @extends {goog.ui.Component}
*/
class Container extends __Container {}
abstract class __Container extends goog.ui.__Component {
/**
* @param {?goog.ui.Container.Orientation=} opt_orientation Container
* orientation; defaults to `VERTICAL`.
* @param {goog.ui.ContainerRenderer=} opt_renderer Renderer used to render or
* decorate the container; defaults to {@link goog.ui.ContainerRenderer}.
* @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for document
* interaction.
*/
constructor(
opt_orientation?: goog.ui.Container.Orientation|null,
opt_renderer?: goog.ui.ContainerRenderer,
opt_domHelper?: goog.dom.DomHelper
);
/**
* Allows an alternative element to be set to receive key events, otherwise
* defers to the renderer's element choice.
* @type {Element|undefined}
* @private
*/
private keyEventTarget_: Element|undefined;
/**
* Keyboard event handler.
* @type {goog.events.KeyHandler?}
* @private
*/
private keyHandler_: goog.events.KeyHandler|null;
/**
* Renderer for the container. Defaults to {@link goog.ui.ContainerRenderer}.
* @type {goog.ui.ContainerRenderer?}
* @private
*/
private renderer_: goog.ui.ContainerRenderer|null;
/**
* Container orientation; determines layout and default keyboard navigation.
* @type {?goog.ui.Container.Orientation}
* @private
*/
private orientation_: goog.ui.Container.Orientation|null;
/**
* Whether the container is set to be visible. Defaults to true.
* @type {boolean}
* @private
*/
private visible_: boolean;
/**
* Whether the container is enabled and reacting to keyboard and mouse events.
* Defaults to true.
* @type {boolean}
* @private
*/
private enabled_: boolean;
/**
* Whether the container supports keyboard focus. Defaults to true. Focusable
* containers have a `tabIndex` and can be navigated to via the keyboard.
* @type {boolean}
* @private
*/
private focusable_: boolean;
/**
* The 0-based index of the currently highlighted control in the container
* (-1 if none).
* @type {number}
* @private
*/
private highlightedIndex_: number;
/**
* The currently open (expanded) control in the container (null if none).
* @type {goog.ui.Control?}
* @private
*/
private openItem_: goog.ui.Control|null;
/**
* Whether the mouse button is held down. Defaults to false. This flag is set
* when the user mouses down over the container, and remains set until they
* release the mouse button.
* @type {boolean}
* @private
*/
private mouseButtonPressed_: boolean;
/**
* Whether focus of child components should be allowed. Only effective if
* focusable_ is set to false.
* @type {boolean}
* @private
*/
private allowFocusableChildren_: boolean;
/**
* Whether highlighting a child component should also open it.
* @type {boolean}
* @private
*/
private openFollowsHighlight_: boolean;
/**
* Map of DOM IDs to child controls. Each key is the DOM ID of a child
* control's root element; each value is a reference to the child control
* itself. Used for looking up the child control corresponding to a DOM
* node in O(1) time.
* @type {Object}
* @private
*/
private childElementIdMap_: Object;
/**
* Returns the DOM element on which the container is listening for keyboard
* events (null if none).
* @return {Element} Element on which the container is listening for key
* events.
*/
getKeyEventTarget(): Element;
/**
* Attaches an element on which to listen for key events.
* @param {Element|undefined} element The element to attach, or null/undefined
* to attach to the default element.
*/
setKeyEventTarget(element: Element|undefined): void;
/**
* Returns the keyboard event handler for this container, lazily created the
* first time this method is called. The keyboard event handler listens for
* keyboard events on the container's key event target, as determined by its
* renderer.
* @return {!goog.events.KeyHandler} Keyboard event handler for this container.
*/
getKeyHandler(): goog.events.KeyHandler;
/**
* Returns the renderer used by this container to render itself or to decorate
* an existing element.
* @return {goog.ui.ContainerRenderer} Renderer used by the container.
*/
getRenderer(): goog.ui.ContainerRenderer;
/**
* Registers the given renderer with the container. Changing renderers after
* the container has already been rendered or decorated is an error.
* @param {goog.ui.ContainerRenderer} renderer Renderer used by the container.
*/
setRenderer(renderer: goog.ui.ContainerRenderer): void;
/**
* Sets up listening for events applicable to focusable containers.
* @param {boolean} enable Whether to enable or disable focus handling.
* @private
*/
private enableFocusHandling_(enable: boolean): void;
/**
* Handles ENTER events raised by child controls when they are navigated to.
* @param {goog.events.Event} e ENTER event to handle.
* @return {boolean} Whether to prevent handleMouseOver from handling
* the event.
*/
handleEnterItem(e: goog.events.Event): boolean;
/**
* Handles HIGHLIGHT events dispatched by items in the container when
* they are highlighted.
* @param {goog.events.Event} e Highlight event to handle.
*/
handleHighlightItem(e: goog.events.Event): void;
/**
* Handles UNHIGHLIGHT events dispatched by items in the container when
* they are unhighlighted.
* @param {goog.events.Event} e Unhighlight event to handle.
*/
handleUnHighlightItem(e: goog.events.Event): void;
/**
* Handles OPEN events dispatched by items in the container when they are
* opened.
* @param {goog.events.Event} e Open event to handle.
*/
handleOpenItem(e: goog.events.Event): void;
/**
* Handles CLOSE events dispatched by items in the container when they are
* closed.
* @param {goog.events.Event} e Close event to handle.
*/
handleCloseItem(e: goog.events.Event): void;
/**
* Handles mousedown events over the container. The default implementation
* sets the "mouse button pressed" flag and, if the container is focusable,
* grabs keyboard focus.
* @param {goog.events.BrowserEvent} e Mousedown event to handle.
*/
handleMouseDown(e: goog.events.BrowserEvent): void;
/**
* Handles mouseup events over the document. The default implementation
* clears the "mouse button pressed" flag.
* @param {goog.events.BrowserEvent} e Mouseup event to handle.
*/
handleDocumentMouseUp(e: goog.events.BrowserEvent): void;
/**
* Handles mouse events originating from nodes belonging to the controls hosted
* in the container. Locates the child control based on the DOM node that
* dispatched the event, and forwards the event to the control for handling.
* @param {goog.events.BrowserEvent} e Mouse event to handle.
*/
handleChildMouseEvents(e: goog.events.BrowserEvent): void;
/**
* Returns the child control that owns the given DOM node, or null if no such
* control is found.
* @param {Node} node DOM node whose owner is to be returned.
* @return {goog.ui.Control?} Control hosted in the container to which the node
* belongs (if found).
* @protected
*/
protected getOwnerControl(node: Node): goog.ui.Control|null;
/**
* Handles focus events raised when the container's key event target receives
* keyboard focus.
* @param {goog.events.BrowserEvent} e Focus event to handle.
*/
handleFocus(e: goog.events.BrowserEvent): void;
/**
* Handles blur events raised when the container's key event target loses
* keyboard focus. The default implementation clears the highlight index.
* @param {goog.events.BrowserEvent} e Blur event to handle.
*/
handleBlur(e: goog.events.BrowserEvent): void;
/**
* Attempts to handle a keyboard event, if the control is enabled, by calling
* {@link handleKeyEventInternal}. Considered protected; should only be used
* within this package and by subclasses.
* @param {goog.events.KeyEvent} e Key event to handle.
* @return {boolean} Whether the key event was handled.
*/
handleKeyEvent(e: goog.events.KeyEvent): boolean;
/**
* Attempts to handle a keyboard event; returns true if the event was handled,
* false otherwise. If the container is enabled, and a child is highlighted,
* calls the child control's `handleKeyEvent` method to give the control
* a chance to handle the event first.
* @param {goog.events.KeyEvent} e Key event to handle.
* @return {boolean} Whether the event was handled by the container (or one of
* its children).
*/
handleKeyEventInternal(e: goog.events.KeyEvent): boolean;
/**
* Creates a DOM ID for the child control and registers it to an internal
* hash table to be able to find it fast by id.
* @param {goog.ui.Component} child The child control. Its root element has
* to be created yet.
* @private
*/
private registerChildId_(child: goog.ui.Component): void;
/**
* Updates the highlighted index when children are added or moved.
* @param {number} fromIndex Index of the child before it was moved, or -1 if
* the child was added.
* @param {number} toIndex Index of the child after it was moved or added.
* @private
*/
private updateHighlightedIndex_(fromIndex: number, toIndex: number): void;
/**
* Returns the container's orientation.
* @return {?goog.ui.Container.Orientation} Container orientation.
*/
getOrientation(): goog.ui.Container.Orientation|null;
/**
* Sets the container's orientation.
* @param {goog.ui.Container.Orientation} orientation Container orientation.
*/
setOrientation(orientation: goog.ui.Container.Orientation): void;
/**
* Returns true if the container's visibility is set to visible, false if
* it is set to hidden. A container that is set to hidden is guaranteed
* to be hidden from the user, but the reverse isn't necessarily true.
* A container may be set to visible but can otherwise be obscured by another
* element, rendered off-screen, or hidden using direct CSS manipulation.
* @return {boolean} Whether the container is set to be visible.
*/
isVisible(): boolean;
/**
* Shows or hides the container. Does nothing if the container already has
* the requested visibility. Otherwise, dispatches a SHOW or HIDE event as
* appropriate, giving listeners a chance to prevent the visibility change.
* @param {boolean} visible Whether to show or hide the container.
* @param {boolean=} opt_force If true, doesn't check whether the container
* already has the requested visibility, and doesn't dispatch any events.
* @return {boolean} Whether the visibility was changed.
*/
setVisible(visible: boolean, opt_force?: boolean): boolean;
/**
* Returns true if the container is enabled, false otherwise.
* @return {boolean} Whether the container is enabled.
*/
isEnabled(): boolean;
/**
* Enables/disables the container based on the `enable` argument.
* Dispatches an `ENABLED` or `DISABLED` event prior to changing
* the container's state, which may be caught and canceled to prevent the
* container from changing state. Also enables/disables child controls.
* @param {boolean} enable Whether to enable or disable the container.
*/
setEnabled(enable: boolean): void;
/**
* Returns true if the container is focusable, false otherwise. The default
* is true. Focusable containers always have a tab index and allocate a key
* handler to handle keyboard events while focused.
* @return {boolean} Whether the component is focusable.
*/
isFocusable(): boolean;
/**
* Sets whether the container is focusable. The default is true. Focusable
* containers always have a tab index and allocate a key handler to handle
* keyboard events while focused.
* @param {boolean} focusable Whether the component is to be focusable.
*/
setFocusable(focusable: boolean): void;
/**
* Returns true if the container allows children to be focusable, false
* otherwise. Only effective if the container is not focusable.
* @return {boolean} Whether children should be focusable.
*/
isFocusableChildrenAllowed(): boolean;
/**
* Sets whether the container allows children to be focusable, false
* otherwise. Only effective if the container is not focusable.
* @param {boolean} focusable Whether the children should be focusable.
*/
setFocusableChildrenAllowed(focusable: boolean): void;
/**
* @return {boolean} Whether highlighting a child component should also open it.
*/
isOpenFollowsHighlight(): boolean;
/**
* Sets whether highlighting a child component should also open it.
* @param {boolean} follow Whether highlighting a child component also opens it.
*/
setOpenFollowsHighlight(follow: boolean): void;
/**
* Returns the index of the currently highlighted item (-1 if none).
* @return {number} Index of the currently highlighted item.
*/
getHighlightedIndex(): number;
/**
* Highlights the item at the given 0-based index (if any). If another item
* was previously highlighted, it is un-highlighted.
* @param {number} index Index of item to highlight (-1 removes the current
* highlight).
*/
setHighlightedIndex(index: number): void;
/**
* Highlights the given item if it exists and is a child of the container;
* otherwise un-highlights the currently highlighted item.
* @param {goog.ui.Control} item Item to highlight.
*/
setHighlighted(item: goog.ui.Control): void;
/**
* Returns the currently highlighted item (if any).
* @return {goog.ui.Control?} Highlighted item (null if none).
*/
getHighlighted(): goog.ui.Control|null;
/**
* Highlights the first highlightable item in the container
*/
highlightFirst(): void;
/**
* Highlights the last highlightable item in the container.
*/
highlightLast(): void;
/**
* Highlights the next highlightable item (or the first if nothing is currently
* highlighted).
*/
highlightNext(): void;
/**
* Highlights the previous highlightable item (or the last if nothing is
* currently highlighted).
*/
highlightPrevious(): void;
/**
* Helper function that manages the details of moving the highlight among
* child controls in response to keyboard events.
* @param {function(this: goog.ui.Container, number, number) : number} fn
* Function that accepts the current and maximum indices, and returns the
* next index to check.
* @param {number} startIndex Start index.
* @return {boolean} Whether the highlight has changed.
* @protected
*/
protected highlightHelper(fn: (this: goog.ui.Container, _0: number, _1: number) => number, startIndex: number):
boolean;
/**
* Returns whether the given item can be highlighted.
* @param {goog.ui.Control} item The item to check.
* @return {boolean} Whether the item can be highlighted.
* @protected
*/
protected canHighlightItem(item: goog.ui.Control): boolean;
/**
* Helper method that sets the highlighted index to the given index in response
* to a keyboard event. The base class implementation simply calls the
* {@link #setHighlightedIndex} method, but subclasses can override this
* behavior as needed.
* @param {number} index Index of item to highlight.
* @protected
*/
protected setHighlightedIndexFromKeyEvent(index: number): void;
/**
* Returns the currently open (expanded) control in the container (null if
* none).
* @return {goog.ui.Control?} The currently open control.
*/
getOpenItem(): goog.ui.Control|null;
/**
* Returns true if the mouse button is pressed, false otherwise.
* @return {boolean} Whether the mouse button is pressed.
*/
isMouseButtonPressed(): boolean;
/**
* Sets or clears the "mouse button pressed" flag.
* @param {boolean} pressed Whether the mouse button is presed.
*/
setMouseButtonPressed(pressed: boolean): void;
}
}
declare namespace goog.ui.Container {
/**
* Container-specific events.
* @enum {string}
*/
enum EventType { AFTER_SHOW, AFTER_HIDE }
/**
* Container orientation constants.
* @enum {string}
*/
enum Orientation { HORIZONTAL, VERTICAL }
}
|
---
layout: docs
title: Deployment methods
permalink: /docs/deployment-methods/
---
tbd
|
module PagesCore
class AdminMenuItem
attr_reader :label, :path, :group, :options
class << self
def items
return [] unless @menu_items
@menu_items.map { |_, v| v }
end
def register(label, path, group = :custom, options = {})
entry = new(label, path, group, options)
@menu_items ||= {}
@menu_items[[group, label]] = entry
end
end
def initialize(label, path, group = :custom, options = {})
@label = label
@path = path
@group = group
@options = options
end
def ==(other)
other &&
other.label == label &&
other.path == path &&
other.group == group &&
other.options == options
end
end
end
|
module.exports = {
friendlyName: 'View query detail',
description: 'Display "Query detail" page.',
inputs: {
slug: { type: 'string', required: true, description: 'A slug uniquely identifying this query in the library.', example: 'get-macos-disk-free-space-percentage' },
},
exits: {
success: { viewTemplatePath: 'pages/query-detail' },
notFound: { responseType: 'notFound' },
badConfig: { responseType: 'badConfig' },
},
fn: async function ({ slug }) {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.queries)) {
throw {badConfig: 'builtStaticContent.queries'};
} else if (!_.isString(sails.config.builtStaticContent.queryLibraryYmlRepoPath)) {
throw {badConfig: 'builtStaticContent.queryLibraryYmlRepoPath'};
}
// Serve appropriate content for query.
// > Inspired by https://github.com/sailshq/sailsjs.com/blob/b53c6e6a90c9afdf89e5cae00b9c9dd3f391b0e7/api/controllers/documentation/view-documentation.js
let query = _.find(sails.config.builtStaticContent.queries, { slug: slug });
if (!query) {
throw 'notFound';
}
// Setting the meta title and description of this page using the query object, and falling back to a generic title or description if query.name or query.description are missing.
let pageTitleForMeta = query.name ? query.name + ' | Query details' : 'Query details | Fleet for osquery';
let pageDescriptionForMeta = query.description ? query.description : 'View more information about a query in Fleet\'s standard query library';
// Respond with view.
return {
query,
queryLibraryYmlRepoPath: sails.config.builtStaticContent.queryLibraryYmlRepoPath,
pageTitleForMeta,
pageDescriptionForMeta,
};
}
};
|
use crate::cfg;
use crate::cmtp::{
AiOption, Ammo, Character, Equipment, Item, ItemKind, LogMessage, MapObject, Player,
PlayerAction, PlayerState, Slot, Symbol,
};
use crate::engine;
use crate::engine::game;
pub fn update(world: &mut game::World) {
if world.player.state != PlayerState::MakingTurn {
return;
}
if (world.player.action != PlayerAction::InteractWithMap) || !world.player_is_alive() {
return;
}
let player_symbol = world.player_sym();
let player_pos = (player_symbol.x, player_symbol.y);
// pick up an item or go to next level
let item_id = world
.item_iter()
.find(|(_, sym, map_obj, ..)| ((sym.x, sym.y) == player_pos) && !map_obj.hidden)
.map(|(id, ..)| id);
let player_on_stairs = world
.map_obj_iter()
.any(|(_, sym, map_obj, ..)| ((sym.x, sym.y) == player_pos) && (map_obj.name == "stairs"));
if let Some(item_id) = item_id {
let maybe_existing_ammo = get_existing_ammo(item_id, world);
if let Some(existing_ammo_id) = maybe_existing_ammo {
add_ammo_to_existing(existing_ammo_id, item_id, world);
} else {
pick_item_up(item_id, world);
}
} else if player_on_stairs {
next_level(world);
};
}
/// add to the player's inventory and remove from the map
fn pick_item_up(object_id: u32, world: &mut game::World) {
let name = world.get_item(object_id).unwrap().1.name.clone();
let inventory_len = world
.items
.iter()
.filter(|&item| item.owner == world.player.id)
.count();
if inventory_len >= 35 {
world.add_log(
cfg::COLOR_DARK_RED,
format!("Your inventory is full, cannot pick up {}.", name),
);
} else {
world.add_log(cfg::COLOR_GREEN, format!("You picked up a {}!", name));
let player_id = world.player.id;
let (_, map_obj, item, eqp, _) = world.get_item_mut(object_id).unwrap();
item.owner = player_id;
map_obj.hidden = true;
// automatically equip, if the corresponding equipment slot is unused
if let Some(&mut Equipment { slot, .. }) = eqp {
if (slot != Slot::Ammo) && world.get_equipped_in_slot(slot).is_none() {
engine::equip(object_id, world);
}
}
}
}
fn get_existing_ammo(unknown_item_id: u32, world: &game::World) -> Option<u32> {
let player_id = world.player.id;
let item_name = &world.get_item(unknown_item_id).unwrap().1.name;
let maybe_ammo = world
.get_item(unknown_item_id)
.and_then(|(.., ammo)| ammo)
.map(|ammo| (item_name, ammo.kind));
if let Some(new_ammo) = maybe_ammo {
world
.item_iter()
.filter(|&(.., item, _, _)| (item.kind == ItemKind::Ammo) && (item.owner == player_id))
.map(|(id, _, map_obj, .., ammo)| (id, (&map_obj.name, ammo.unwrap().kind)))
.map(|(id, existing_ammo)| (id, existing_ammo, new_ammo))
.find(|&(_, existing_ammo, new_ammo)| existing_ammo == new_ammo)
.map(|(id, ..)| id)
} else {
None
}
}
fn add_ammo_to_existing(existing_ammo_id: u32, new_ammo_id: u32, world: &mut game::World) {
let name = world.get_item(new_ammo_id).unwrap().1.name.clone();
let count_of_new = world.get_item(new_ammo_id).unwrap().4.unwrap().count;
let mut existing_ammo = world.get_item_mut(existing_ammo_id).unwrap().4.unwrap();
existing_ammo.count += count_of_new;
world.entity_indexes.remove(&new_ammo_id);
world.add_log(cfg::COLOR_GREEN, format!("You picked up a {}!", name));
}
/// Advance to the next level
fn next_level(world: &mut game::World) {
clear_dungeon(world);
world.add_log(
cfg::COLOR_GREEN,
"You take a moment to rest, and recover your strength.",
);
let heal_hp = world.max_hp(world.player.id) / 2;
heal(world.player.id, heal_hp, world);
world.add_log(
cfg::COLOR_ORANGE,
"After a rare moment of peace, you descend deeper into \
the heart of the mine...",
);
world.player.dungeon_level += 1;
}
fn clear_dungeon(world: &mut game::World) {
// create new world for storing entities that should be saved
let mut temp_world = game::World::default();
temp_world.id_count = world.id_count;
//copy player
let player = &world.player;
temp_world.player = Player {
id: player.id,
dungeon_level: player.dungeon_level,
state: player.state,
action: player.action,
looking_at: None,
previous_player_position: player.previous_player_position,
};
// move player entity if exist
if let Some(indexes) = world.entity_indexes.remove(&world.player.id) {
let symbol = Symbol {
x: world.symbols[indexes.symbol.unwrap()].x,
y: world.symbols[indexes.symbol.unwrap()].y,
glyph: world.symbols[indexes.symbol.unwrap()].glyph,
color: world.symbols[indexes.symbol.unwrap()].color,
};
let map_object = MapObject {
name: world.map_objects[indexes.map_object.unwrap()].name.clone(),
block: world.map_objects[indexes.map_object.unwrap()].block,
always_visible: world.map_objects[indexes.map_object.unwrap()].always_visible,
hidden: world.map_objects[indexes.map_object.unwrap()].hidden,
};
let character = Character {
alive: world.characters[indexes.character.unwrap()].alive,
level: world.characters[indexes.character.unwrap()].level,
hp: world.characters[indexes.character.unwrap()].hp,
base_max_hp: world.characters[indexes.character.unwrap()].base_max_hp,
base_defense: world.characters[indexes.character.unwrap()].base_defense,
base_power: world.characters[indexes.character.unwrap()].base_power,
xp: world.characters[indexes.character.unwrap()].xp,
on_death: world.characters[indexes.character.unwrap()].on_death,
looking_right: world.characters[indexes.character.unwrap()].looking_right,
};
temp_world.player.id = game::new_entity()
.add_symbol(symbol)
.add_map_object(map_object)
.add_character(character)
.add_ai(AiOption { option: None })
.create(&mut temp_world);
}
// copy inventory
let inventory = world
.item_iter()
.filter(|(.., item, _, _)| item.owner == world.player.id);
for (_, sym, map_obj, item, equipment, ammo) in inventory {
let symbol = Symbol {
x: sym.x,
y: sym.y,
glyph: sym.glyph,
color: sym.color,
};
let map_object = MapObject {
name: map_obj.name.clone(),
block: map_obj.block,
always_visible: map_obj.always_visible,
hidden: map_obj.hidden,
};
let item = Item {
kind: item.kind,
owner: temp_world.player.id,
};
let equipment = equipment.map(|equipment| Equipment {
slot: equipment.slot,
equipped: equipment.equipped,
max_hp_bonus: equipment.max_hp_bonus,
defense_bonus: equipment.defense_bonus,
power_bonus: equipment.power_bonus,
});
let ammo = ammo.map(|ammo| Ammo {
kind: ammo.kind,
count: ammo.count,
});
game::new_entity()
.add_symbol(symbol)
.add_map_object(map_object)
.add_item(item)
.add_equipment(equipment)
.add_ammo(ammo)
.create(&mut temp_world);
}
// copy logs
let logs = world
.entity_indexes
.values()
.filter(|indexes| indexes.log_message.is_some());
for indexes in logs {
let log_message = LogMessage(
world.log[indexes.log_message.unwrap()].0.clone(),
world.log[indexes.log_message.unwrap()].1,
);
game::new_entity()
.add_log_message(log_message)
.create(&mut temp_world);
}
*world = temp_world;
}
/// heal by the given amount, without going over the maximum
fn heal(id: u32, amount: i32, world: &mut game::World) {
let max_hp = world.max_hp(id);
let character = world.get_character_mut(id).unwrap().2;
character.hp += amount;
if character.hp > max_hp {
character.hp = max_hp;
}
}
|
import 'package:flutter/material.dart';
import 'package:dynamic_theme/dynamic_theme.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
class ThemeHelper {
List<Color> myGradientList = [
Colors.pink[300],
Colors.pink[400],
Colors.pink,
Colors.pink[600],
Colors.pink[700],
Colors.red[300],
Colors.red[400],
Colors.red,
Colors.red[600],
Colors.red[700],
Colors.deepOrange[300],
Colors.deepOrange[400],
Colors.deepOrange,
Colors.deepOrange[600],
Colors.deepOrange[700],
Colors.orange[300],
Colors.orange[400],
Colors.orange,
Colors.orange[600],
Colors.orange[700],
Colors.orange[800],
Colors.amber[300],
Colors.amber[400],
Colors.amber,
Colors.amber[600],
Colors.amber[700],
Colors.yellow[300],
Colors.yellow[400],
Colors.yellow,
Colors.yellow[600],
Colors.yellow[700],
Colors.lime[300],
Colors.lime[400],
Colors.lime,
Colors.lime[600],
Colors.lime[700],
Colors.lightGreen[300],
Colors.lightGreen[400],
Colors.lightGreen,
Colors.lightGreen[600],
Colors.lightGreen[700],
Colors.green[300],
Colors.green[400],
Colors.green,
Colors.green[600],
Colors.green[700],
Colors.teal[200],
Colors.teal[300],
Colors.teal[400],
Colors.teal,
Colors.teal[600],
Colors.teal[700],
Colors.cyan[300],
Colors.cyan[400],
Colors.cyan,
Colors.cyan[600],
Colors.cyan[700],
Colors.lightBlue[300],
Colors.lightBlue[400],
Colors.lightBlue,
Colors.lightBlue[600],
Colors.lightBlue[700],
Colors.blue[300],
Colors.blue[400],
Colors.blue,
Colors.blue[600],
Colors.blue[700],
Colors.indigo[300],
Colors.indigo[400],
Colors.indigo,
Colors.indigo[600],
Colors.indigo[700],
Colors.purple[300],
Colors.purple[400],
Colors.purple,
Colors.purple[600],
Colors.purple[700],
Colors.deepPurple[300],
Colors.deepPurple[400],
Colors.deepPurple,
Colors.deepPurple[600],
Colors.deepPurple[700],
];
ThemeData getTheme(brightness) {
if (brightness == Brightness.dark) {
Crashlytics.instance.setString("Theme", "Dark");
} else {
Crashlytics.instance.setString("Theme", "Bright");
}
if (brightness == Brightness.dark) {
return new ThemeData(
pageTransitionsTheme: PageTransitionsTheme(
builders: {
TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
TargetPlatform.iOS: FadeUpwardsPageTransitionsBuilder(),
},
),
sliderTheme: SliderThemeData(
activeTickMarkColor: Colors.orange,
valueIndicatorColor: Colors.black,
overlayColor: Colors.orange,
thumbColor: Colors.black,
activeTrackColor: Colors.orange,
valueIndicatorTextStyle: TextStyle(color: Colors.orange)),
dividerColor: Colors.orange,
textTheme: TextTheme(
subtitle1: TextStyle(color: Colors.orange),
headline6: TextStyle(color: Colors.black)),
buttonTheme: ButtonThemeData(
buttonColor: Colors.orange,
),
backgroundColor: Colors.black,
primarySwatch: Colors.orange,
primaryColor: Colors.orange,
brightness: Brightness.dark,
colorScheme: ColorScheme.dark(),
hintColor: Colors.red,
inputDecorationTheme: InputDecorationTheme(
labelStyle: TextStyle(
color: Colors.black,
),
fillColor: Colors.black,
hintStyle: TextStyle(color: Colors.orange),
focusColor: Colors.orange,
));
} else {
return new ThemeData(
pageTransitionsTheme: PageTransitionsTheme(
builders: {
TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
TargetPlatform.iOS: FadeUpwardsPageTransitionsBuilder(),
},
),
sliderTheme: SliderThemeData(
activeTickMarkColor: Colors.black,
valueIndicatorColor: Colors.black,
overlayColor: Colors.black,
thumbColor: Colors.black,
activeTrackColor: Colors.black,
valueIndicatorTextStyle: TextStyle(color: Colors.white)),
dividerColor: Colors.black,
textTheme: TextTheme(
subtitle1: TextStyle(color: Colors.black),
headline6: TextStyle(color: Colors.black)),
brightness: Brightness.light,
primarySwatch: Colors.lightBlue,
buttonTheme: ButtonThemeData(
buttonColor: Colors.lightBlueAccent,
),
primaryColor: Colors.lightBlueAccent,
backgroundColor: Colors.white,
fontFamily: 'Nunito',
colorScheme: ColorScheme.light(),
hintColor: Colors.lightBlue,
inputDecorationTheme: InputDecorationTheme(
labelStyle: TextStyle(
color: Colors.blueAccent,
),
fillColor: Colors.black,
hintStyle: TextStyle(color: Colors.black),
focusColor: Colors.orange,
));
}
}
void changeBrightness(var context, brightness) {
DynamicTheme.of(context).setBrightness(brightness);
}
Color stringToColor(String input) {
switch (input) {
case "Red":
return Colors.red;
break;
case "Green":
return Colors.green;
break;
case "lightGreenAccent400":
return Colors.lightGreenAccent[400];
break;
case "Lime":
return Colors.lime;
break;
case "Blue":
return Colors.blue;
break;
case "LightBlue":
return Colors.lightBlue;
break;
case "Teal":
return Colors.teal;
break;
case "Indigo":
return Colors.indigo;
break;
case "Yellow":
return Colors.yellow;
break;
case "Orange":
return Colors.orange;
break;
case "DeepOrange":
return Colors.deepOrange;
break;
case "Pink":
return Colors.pink;
break;
case "Purple":
return Colors.purple;
break;
case "LightPink":
return Colors.pink[300];
break;
default:
return Colors.transparent;
break;
}
}
}
|
<?php
namespace JouwWeb\DocData\Model;
interface PaymentStatusUpdateInterface
{
/**
* Set payment
*
* @param PaymentInterface $payment
*
* @return $this
*/
public function setPayment(PaymentInterface $payment);
/**
* Get payment
*
* @return PaymentInterface
*/
public function getPayment();
/**
* @param int $status
*/
public function setStatus($status);
/**
* @return int
*/
public function getStatus();
}
|
package com.mob.lee.fastair.io.http
import com.mob.lee.fastair.io.socket.Writer
import kotlinx.coroutines.channels.Channel
import java.nio.ByteBuffer
import java.nio.channels.SocketChannel
interface Handler {
fun canHandleIt(request: Request):Boolean
suspend fun handle(request: Request,channel:SocketChannel):Writer
}
|
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace teste_tria.Models
{
public class ClienteEmpresa
{
[Key]
public long Id { get; set; }
[Required]
[DisplayName("ID Cliente")]
public long ClienteID { get; set; }
public Cliente Cliente { get; set; }
[Required]
[DisplayName("ID Empresa")]
public long EmpresaID { get; set; }
public Empresa Empresa { get; set; }
}
}
|
import { LitElement, html, css } from 'lit-element';
import styles from '../styles/ApiTemplateStyle';
export class ApiTemplate extends LitElement {
static get styles() {
return [styles];
}
render() {
return html`
<div class="container">
<h1>The <strong class="title">Rick and Morty</strong> API</h1>
<p class="title">LitElement</p>
</div>
`;
}
}
customElements.define('api-template', ApiTemplate);
|
function Sync-CloudflareITGlueFlexibleAssets {
param(
[string]$FlexAssetType = 'Cloudflare DNS'
)
$Progress = 0
$ZoneDataArray = Get-CloudflareZoneDataArray
$FlexAssetTypeId = New-ITGlueWebRequest -Endpoint 'flexible_asset_types' -Method 'GET' | ForEach-Object data | Where-Object {$_.attributes.name -eq $FlexAssetType} | ForEach-Object id
foreach ($ZoneData in $ZoneDataArray) {
Write-Progress -Activity 'ITGlueAPI' -Status 'Syncing Flexible Assets' -CurrentOperation $ZoneData.name -PercentComplete ($Progress / ($ZoneDataArray | Measure-Object | foreach-object count) * 100) -Id 2
$TempFile = New-TemporaryFile
$ZoneData.ZoneFileData | Out-file $TempFile -Force -Encoding utf8
$Base64ZoneFile = ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($TempFile)))
Remove-Item $TempFile -Force
$Body = @{
data = @{
'type' = 'flexible-assets'
'attributes' = @{
'organization-id' = $ZoneData.ITGOrg
'flexible-asset-type-id' = $FlexAssetTypeId
'traits' = @{
'name' = $ZoneData.Name
'last-sync' = $ZoneData.SyncDate
'nameservers' = $ZoneData.CfNameServers -join '<br>'
'status' = $ZoneData.Status
'zone-file' = @{
'content' = $Base64ZoneFile
'file_name' = "$($ZoneData.Name).txt"
}
'dns-records' = $ZoneData.RecordsHtml
'domain-tracker' = $ZoneData.DomainTracker
}
}
}
}
$Body = $Body | ConvertTo-Json -Depth 4
$FlexAssets = New-ITGlueWebRequest -Endpoint "flexible_assets?filter[flexible_asset_type_id]=$FlexAssetTypeId&filter[organization_id]=$($ZoneData.ITGOrg)" -Method 'GET' | ForEach-Object data
$PatchId = $null
foreach ($FlexAsset in $FlexAssets) {
if ($FlexAsset.attributes.traits.name -eq $ZoneData.name) {
$PatchId = $FlexAsset.id
}
}
if ($PatchId) {
New-ITGlueWebRequest -Endpoint "flexible_assets/$PatchId" -Method 'PATCH' -Body $Body
}
else {
New-ITGlueWebRequest -Endpoint 'flexible_assets' -Method 'POST' -Body $Body
}
$Progress++
}
Write-Progress -Activity 'ITGlueAPI' -Status 'Syncing Flexible Assets' -PercentComplete 100 -Id 2
}
|
<?php
namespace web\widgets\user;
use \common\models\User;
class Photo extends \web\ext\Widget
{
/**
* Photo
* @var User\Photo
*/
public $photo;
/**
* Run widget
*/
public function run()
{
// Define photo URL
if ($this->photo !== null) {
$photoUrl = $this->createUrl('/user/photo', array('id' => $this->photo->_id));
} else {
$photoUrl = \yii::app()->theme->baseUrl . '/images/user/photo-256.png';
}
// Render view
$this->render('photo', array(
'photoUrl' => $photoUrl,
));
}
}
|
---
name: Question
about: Any questions/anything else that does not fit into a bug or feature request
---
<!-- A clear and concise description of what your question is.-->
|
package minq
import (
"fmt"
"io"
"io/ioutil"
"testing"
"time"
)
type testPacket struct {
b []byte
}
type testTransportPipe struct {
in []*testPacket
out []*testPacket
autoFlush bool
}
func newTestTransportPipe(autoFlush bool) *testTransportPipe {
return &testTransportPipe{
make([]*testPacket, 0),
make([]*testPacket, 0),
autoFlush,
}
}
func (t *testTransportPipe) Send(p *testPacket) {
if !t.autoFlush {
t.in = append(t.in, p)
} else {
t.out = append(t.out, p)
}
}
func (t *testTransportPipe) Recv() *testPacket {
if len(t.out) == 0 {
return nil
}
p := t.out[0]
t.out = t.out[1:]
return p
}
func (t *testTransportPipe) Flush() {
t.out = append(t.out, t.in...)
t.in = make([]*testPacket, 0)
}
type testTransport struct {
r *testTransportPipe
w *testTransportPipe
}
func (t *testTransport) Send(p []byte) error {
t.w.Send(&testPacket{p})
return nil
}
func (t *testTransport) Recv() ([]byte, error) {
p := t.r.Recv()
if p == nil {
return nil, ErrorWouldBlock
}
return p.b, nil
}
func newTestTransportPair(autoFlush bool) (a, b *testTransport) {
a2b := newTestTransportPipe(autoFlush)
b2a := newTestTransportPipe(autoFlush)
a = &testTransport{b2a, a2b}
b = &testTransport{a2b, b2a}
return
}
func inputAll(c *Connection) error {
t := c.transport.(*testTransport)
for {
p, err := t.Recv()
if err != nil && err != ErrorWouldBlock {
return err
}
if p == nil {
return nil
}
err = c.Input(p)
if err != nil {
return err
}
}
}
func inputAllCapture(c *Connection) ([][]byte, error) {
ret := make([][]byte, 0)
t := c.transport.(*testTransport)
for {
p, err := t.Recv()
if err != nil && err != ErrorWouldBlock {
return ret, err
}
if p == nil {
return ret, nil
}
ret = append(ret, p)
err = c.Input(p)
if err != nil {
return ret, err
}
}
}
func testTlsConfig() *TlsConfig {
t := NewTlsConfig("localhost")
return &t
}
type csPair struct {
client *Connection
server *Connection
}
func newCsPair(t *testing.T) *csPair {
cTrans, sTrans := newTestTransportPair(true)
client := NewConnection(cTrans, RoleClient, testTlsConfig(), nil)
assertNotNil(t, client, "Couldn't make client")
server := NewConnection(sTrans, RoleServer, testTlsConfig(), nil)
assertNotNil(t, server, "Couldn't make server")
return &csPair{
client,
server,
}
}
func (pair *csPair) handshake(t *testing.T) {
err := pair.client.sendClientInitial()
assertNotError(t, err, "Couldn't send client initial packet")
for pair.client.state != StateEstablished || pair.server.state != StateEstablished {
err = inputAll(pair.server)
assertNotError(t, err, "Error processing CI")
err = inputAll(pair.client)
assertNotError(t, err, "Error processing SH")
}
}
func TestSendCI(t *testing.T) {
cTrans, _ := newTestTransportPair(true)
client := NewConnection(cTrans, RoleClient, testTlsConfig(), nil)
assertNotNil(t, client, "Couldn't make client")
err := client.sendClientInitial()
assertNotError(t, err, "Couldn't send client initial packet")
}
func TestSendReceiveCIOnly(t *testing.T) {
cTrans, sTrans := newTestTransportPair(true)
client := NewConnection(cTrans, RoleClient, testTlsConfig(), nil)
assertNotNil(t, client, "Couldn't make client")
server := NewConnection(sTrans, RoleServer, testTlsConfig(), nil)
assertNotNil(t, server, "Couldn't make server")
err := client.sendClientInitial()
assertNotError(t, err, "Couldn't send client initial packet")
err = inputAll(server)
assertNotError(t, err, "Error processing CI")
}
func TestSendReceiveDupCI(t *testing.T) {
cTrans, sTrans := newTestTransportPair(true)
client := NewConnection(cTrans, RoleClient, testTlsConfig(), nil)
assertNotNil(t, client, "Couldn't make client")
server := NewConnection(sTrans, RoleServer, testTlsConfig(), nil)
assertNotNil(t, server, "Couldn't make server")
err := client.sendClientInitial()
assertNotError(t, err, "Couldn't send client initial packet")
err = inputAll(server)
assertNotError(t, err, "Error processing CI")
n, err := client.CheckTimer()
assertNotError(t, err, "Couldn't check timer on client")
assertEquals(t, n, 1)
err = inputAll(server)
assertNotError(t, err, "Error processing second CI")
}
func TestSendReceiveCISI(t *testing.T) {
cTrans, sTrans := newTestTransportPair(true)
client := NewConnection(cTrans, RoleClient, testTlsConfig(), nil)
assertNotNil(t, client, "Couldn't make client")
server := NewConnection(sTrans, RoleServer, testTlsConfig(), nil)
assertNotNil(t, server, "Couldn't make server")
err := client.sendClientInitial()
assertNotError(t, err, "Couldn't send client initial packet")
err = inputAll(server)
assertNotError(t, err, "Error processing CI")
err = inputAll(client)
assertNotError(t, err, "Error processing SH")
err = inputAll(server)
assertNotError(t, err, "Error processing CFIN")
fmt.Println("Handshake should be complete")
err = inputAll(client)
assertNotError(t, err, "Error processing NST")
err = inputAll(server)
assertNotError(t, err, "Error processing CFIN")
fmt.Println("Checking client state")
assertEquals(t, client.state, StateEstablished)
fmt.Println("Checking server state")
assertEquals(t, server.state, StateEstablished)
// All the server's and client's data should be acked.
n := server.outstandingQueuedBytes()
assertEquals(t, 0, n)
// But the client still has-unacked-data
n = client.outstandingQueuedBytes()
assertEquals(t, 0, n)
// Run the client's checkTimer, which shouldn't do
// anything because you don't ACK acks.
n, err = client.CheckTimer()
assertNotError(t, err, "Couldn't run client timer")
assertEquals(t, 0, n)
n, err = server.CheckTimer()
assertNotError(t, err, "Couldn't run server timer")
assertEquals(t, 0, n)
}
func drain(t *testing.T, c *Connection) {
// Reach into the connection and frob the timer so that we don't have to wait.
c.closingEnd = time.Now().Add(-1 * time.Microsecond)
_, err := c.CheckTimer()
assertEquals(t, err, ErrorConnIsClosed)
assertEquals(t, c.GetState(), StateClosed)
}
func TestSendReceiveData(t *testing.T) {
testString := []byte("abcdef")
pair := newCsPair(t)
pair.handshake(t)
// Force the client to get the ACK from the server
pair.server.CheckTimer()
err := inputAll(pair.client)
// Write data C->S
cs := pair.client.CreateStream()
assertNotNil(t, cs, "Failed to create a stream")
cs.Write(testString)
// Read data C->S
err = inputAll(pair.server)
assertNotError(t, err, "Couldn't read input packets")
ss := pair.server.GetStream(4)
b, err := ioutil.ReadAll(ss)
assertEquals(t, ErrorWouldBlock, err)
assertNotNil(t, b, "Read data from server")
assertByteEquals(t, []byte(testString), b)
// Write data S->C
for i := range b {
b[i] ^= 0xff
}
ss.Write(b)
// Read data C->S
err = inputAll(pair.client)
b2, err := ioutil.ReadAll(cs)
assertEquals(t, ErrorWouldBlock, err)
assertNotNil(t, b2, "Read data from client")
assertByteEquals(t, b, b2)
// Check that we only create streams in one direction
cs = pair.client.CreateStream()
assertEquals(t, uint64(8), cs.Id())
assertNotNil(t, pair.client.GetStream(8), "Stream 8 should exist")
assertX(t, pair.client.GetStream(2) == nil, "Stream 2 should not exist")
// Close the client.
pair.client.Close()
assertEquals(t, pair.client.GetState(), StateClosing)
// Read the close.
err = inputAll(pair.server)
assertNotError(t, err, "Read close")
assertEquals(t, pair.server.GetState(), StateClosing)
drain(t, pair.client)
drain(t, pair.server)
}
type testReceiveHandler struct {
t *testing.T
buf []byte
done bool
}
var _ ConnectionHandler = &testReceiveHandler{}
func newTestReceiveHandler(t *testing.T) *testReceiveHandler {
return &testReceiveHandler{t: t}
}
func (h *testReceiveHandler) StateChanged(s State) {
}
func (h *testReceiveHandler) NewStream(s Stream) {
}
func (h *testReceiveHandler) NewRecvStream(s RecvStream) {
}
func (h *testReceiveHandler) StreamReadable(s RecvStream) {
for {
b := make([]byte, 1024)
n, err := s.Read(b)
switch err {
case nil:
break
case ErrorWouldBlock:
return
case ErrorStreamIsClosed, ErrorConnIsClosed, io.EOF:
h.done = true
return
default:
assertX(h.t, false, "Unknown error")
return
}
b = b[:n]
h.buf = append(h.buf, b...)
}
}
func TestSendReceiveBigData(t *testing.T) {
pair := newCsPair(t)
pair.handshake(t)
buf := make([]byte, 100000)
for i, _ := range buf {
buf[i] = byte(i & 0xff)
}
handler := newTestReceiveHandler(t)
pair.server.SetHandler(handler)
// Write data C->S
cs := pair.client.CreateStream()
cs.Write(buf)
cs.Close()
for !handler.done {
inputAll(pair.server)
inputAll(pair.client)
inputAll(pair.server)
inputAll(pair.client)
}
assertByteEquals(t, buf, handler.buf)
}
func TestSendReceiveRetransmit(t *testing.T) {
testString := []byte("abcdef")
pair := newCsPair(t)
pair.handshake(t)
// Force the client to get the ACK from the server
pair.server.CheckTimer()
err := inputAll(pair.client)
// Write data C->S
cs := pair.client.CreateStream()
assertNotNil(t, cs, "Failed to create a stream")
cs.Write(testString)
// Check the timer (forcing retransmit)
pair.client.CheckTimer()
pair.client.CheckTimer()
// Read data C->S
err = inputAll(pair.server)
assertNotError(t, err, "Couldn't read input packets")
ss := pair.server.GetStream(4)
b := make([]byte, 1024)
n, err := ss.Read(b)
assertNotError(t, err, "Error reading")
b = b[:n]
assertByteEquals(t, []byte(testString), b)
// Write data S->C
for i, _ := range b {
b[i] ^= 0xff
}
ss.Write(b)
// Force potential retransmit.
pair.server.CheckTimer()
// Now read the data
b2 := make([]byte, 1024)
err = inputAll(pair.client)
assertNotError(t, err, "Couldn't read input packets")
n, err = cs.Read(b2)
assertNotError(t, err, "Error reading")
b2 = b2[:n]
assertByteEquals(t, b2, b)
}
func TestSendReceiveStreamFin(t *testing.T) {
testString := []byte("abcdef")
pair := newCsPair(t)
pair.handshake(t)
// Force the client to get the ACK from the server
pair.server.CheckTimer()
err := inputAll(pair.client)
// Write data C->S
cs := pair.client.CreateStream()
assertNotNil(t, cs, "Failed to create a stream")
cs.Write(testString)
// Now close the stream.
cs.Close()
// Verify that we cannot write.
n, err := cs.Write(testString)
assertEquals(t, ErrorStreamIsClosed, err)
assertEquals(t, 0, n)
// Read data C->S
err = inputAll(pair.server)
assertNotError(t, err, "Couldn't read input packets")
ss := pair.server.GetStream(4)
b := make([]byte, 1024)
n, err = ss.Read(b)
assertNotError(t, err, "Couldn't read from client")
b = b[:n]
assertByteEquals(t, []byte(testString), b)
b = make([]byte, 1024)
n, err = ss.Read(b)
assertEquals(t, err, io.EOF)
assertEquals(t, 0, n)
}
func TestSendReceiveStreamRst(t *testing.T) {
testString := []byte("abcdef")
pair := newCsPair(t)
pair.handshake(t)
// Force the client to get the ACK from the server
pair.server.CheckTimer()
err := inputAll(pair.client)
// Write data C->S
cs := pair.client.CreateStream()
assertNotNil(t, cs, "Failed to create a stream")
cs.Write(testString)
// Now reset the stream.
cs.Reset(kQuicErrorNoError)
// Verify that we cannot write.
n, err := cs.Write(testString)
assertEquals(t, ErrorStreamIsClosed, err)
assertEquals(t, 0, n)
// Read data C->S. Should result in no data.
err = inputAll(pair.server)
assertNotError(t, err, "Couldn't read input packets")
ss := pair.server.GetStream(4)
b := make([]byte, 1024)
n, err = ss.Read(b)
assertEquals(t, err, io.EOF)
assertEquals(t, 0, n)
}
func TestVersionNegotiationPacket(t *testing.T) {
cTrans, sTrans := newTestTransportPair(true)
client := NewConnection(cTrans, RoleClient, testTlsConfig(), nil)
assertNotNil(t, client, "Couldn't make client")
// Set the client version to something bogus.
client.version = kQuicGreaseVersion2
server := NewConnection(sTrans, RoleServer, testTlsConfig(), nil)
assertNotNil(t, server, "Couldn't make server")
err := client.sendClientInitial()
assertNotError(t, err, "Couldn't send client initial packet")
err = inputAll(server)
assertError(t, err, "Expected version negotiation error")
assertEquals(t, err, ErrorDestroyConnection)
cap, err := inputAllCapture(client)
assertError(t, err, "Expected version negotiation error")
assertEquals(t, err, ErrorReceivedVersionNegotiation)
var hdr packetHeader
_, err = decode(&hdr, cap[0])
assertNotError(t, err, "Couldn't decode VN")
// Check the error.
assertEquals(t, hdr.Version, VersionNumber(0))
assertEquals(t, hdr.ConnectionID, client.clientConnId)
}
func TestCantMakeRemoteStreams(t *testing.T) {
cTrans, _ := newTestTransportPair(true)
client := NewConnection(cTrans, RoleClient, testTlsConfig(), nil)
send := client.ensureSendStream(3) // 3 is a RecvStream for the client
assertEquals(t, nil, send)
recv := client.ensureRecvStream(2) // 2 is a SendStream for the client
assertEquals(t, nil, recv)
}
func TestStatelessRetry(t *testing.T) {
cTrans, sTrans := newTestTransportPair(true)
client := NewConnection(cTrans, RoleClient, testTlsConfig(), nil)
assertNotNil(t, client, "Couldn't make client")
hrrConfig := *testTlsConfig()
hrrConfig.ForceHrr = true
server := NewConnection(sTrans, RoleServer, &hrrConfig, nil)
assertNotNil(t, server, "Couldn't make server")
err := client.sendClientInitial()
assertNotError(t, err, "Couldn't send client initial packet")
// Send the Stateless Retry
err = inputAll(server)
assertNotError(t, err, "Error processing CI")
// Process SR, send CI
err = inputAll(client)
assertNotError(t, err, "Error processing SR")
// Send the Stateless Retry
err = inputAll(server)
assertNotError(t, err, "Error processing CI")
// Process server flight
err = inputAll(client)
assertNotError(t, err, "Error processing SH...FIN")
// Process CFIN
err = inputAll(server)
assertNotError(t, err, "Error processing CFIN")
assertEquals(t, StateEstablished, client.state)
assertEquals(t, StateEstablished, server.state)
}
func TestSessionResumption(t *testing.T) {
cTrans, sTrans := newTestTransportPair(true)
cconf := testTlsConfig()
client := NewConnection(cTrans, RoleClient, cconf, nil)
assertNotNil(t, client, "Couldn't make client")
sconf := testTlsConfig()
server := NewConnection(sTrans, RoleServer, sconf, nil)
assertNotNil(t, server, "Couldn't make server")
pair := csPair{client, server}
pair.handshake(t)
// Consume NST.
err := inputAll(pair.client)
assertNotError(t, err, "Couldn't read NST")
/*
// Now rehandshake.
client = NewConnection(cTrans, RoleClient, cconf, nil)
assertNotNil(t, client, "Couldn't make client")
server = NewConnection(sTrans, RoleServer, sconf, nil)
assertNotNil(t, server, "Couldn't make server")
pair = csPair{client, server}
pair.handshake(t)
*/
}
type streamCatcher struct {
lastStream Stream
lastRecv RecvStream
}
var _ ConnectionHandler = &streamCatcher{}
func (sc *streamCatcher) StateChanged(s State) {}
func (sc *streamCatcher) StreamReadable(s RecvStream) {}
func (sc *streamCatcher) NewStream(s Stream) {
sc.lastStream = s
}
func (sc *streamCatcher) NewRecvStream(s RecvStream) {
sc.lastRecv = s
}
func TestUnidirectionalStream(t *testing.T) {
cTrans, sTrans := newTestTransportPair(true)
cconf := testTlsConfig()
client := NewConnection(cTrans, RoleClient, cconf, nil)
assertNotNil(t, client, "Couldn't make client")
var catcher streamCatcher
sconf := testTlsConfig()
server := NewConnection(sTrans, RoleServer, sconf, &catcher)
assertNotNil(t, server, "Couldn't make server")
pair := csPair{client, server}
pair.handshake(t)
testString := []byte("abcdef")
cstream := client.CreateSendStream()
assertEquals(t, cstream, client.GetSendStream(2))
n, err := cstream.Write(testString)
assertNotError(t, err, "write should work")
assertEquals(t, n, len(testString))
err = inputAll(server)
assertNotError(t, err, "packets should be OK")
sstream := catcher.lastRecv
assertEquals(t, sstream, server.GetRecvStream(cstream.Id()))
d, err := ioutil.ReadAll(sstream)
assertEquals(t, ErrorWouldBlock, err)
assertNotNil(t, d, "Read data from client")
assertByteEquals(t, d, testString)
err = cstream.Close()
assertNotError(t, err, "close just works")
err = cstream.Close()
assertNotError(t, err, "close is idempotent")
err = inputAll(server)
assertNotError(t, err, "packets should be OK")
n, err = sstream.Read(d)
assertEquals(t, err, io.EOF)
assertEquals(t, n, 0)
assertEquals(t, sstream.RecvState(), RecvStreamStateDataRead)
}
func TestUnidirectionalStreamRst(t *testing.T) {
cTrans, sTrans := newTestTransportPair(true)
var catcher streamCatcher
cconf := testTlsConfig()
client := NewConnection(cTrans, RoleClient, cconf, &catcher)
assertNotNil(t, client, "Couldn't make client")
sconf := testTlsConfig()
server := NewConnection(sTrans, RoleServer, sconf, nil)
assertNotNil(t, server, "Couldn't make server")
pair := csPair{client, server}
pair.handshake(t)
testString := []byte("abcdef")
sstream := server.CreateSendStream()
assertEquals(t, sstream, server.GetSendStream(3))
n, err := sstream.Write(testString)
assertNotError(t, err, "write should work")
assertEquals(t, n, len(testString))
err = inputAll(client)
assertNotError(t, err, "packets should be OK")
cstream := catcher.lastRecv
assertEquals(t, cstream, client.GetRecvStream(sstream.Id()))
d, err := ioutil.ReadAll(cstream)
assertEquals(t, ErrorWouldBlock, err)
assertNotNil(t, d, "Read data from server")
assertByteEquals(t, d, testString)
err = sstream.Reset(kQuicErrorNoError)
assertNotError(t, err, "reset works")
err = inputAll(client)
assertNotError(t, err, "packets should be OK")
n, err = cstream.Read(d)
assertEquals(t, err, io.EOF)
assertEquals(t, n, 0)
assertEquals(t, cstream.RecvState(), RecvStreamStateResetRecvd)
}
func TestUnidirectionalStreamRstImmediate(t *testing.T) {
pair := newCsPair(t)
pair.handshake(t)
sstream := pair.server.CreateSendStream()
err := sstream.Reset(kQuicErrorNoError)
assertNotError(t, err, "reset works")
err = inputAll(pair.client)
assertNotError(t, err, "packets should be OK")
cstream := pair.client.GetRecvStream(sstream.Id())
var d [3]byte
n, err := cstream.Read(d[:])
assertEquals(t, err, io.EOF)
assertEquals(t, n, 0)
assertEquals(t, cstream.RecvState(), RecvStreamStateResetRecvd)
}
func TestUnidirectionalStopSending(t *testing.T) {
pair := newCsPair(t)
pair.handshake(t)
testString := []byte("abcdef")
cstream := pair.client.CreateSendStream()
n, err := cstream.Write(testString)
assertNotError(t, err, "write should work")
assertEquals(t, n, len(testString))
err = inputAll(pair.server)
assertNotError(t, err, "packets should be OK")
sstream := pair.server.GetRecvStream(cstream.Id())
d, err := ioutil.ReadAll(sstream)
assertEquals(t, ErrorWouldBlock, err)
assertNotNil(t, d, "Read data from client")
assertByteEquals(t, d, testString)
err = sstream.StopSending(kQuicErrorNoError)
assertNotError(t, err, "stop sending just works")
err = inputAll(pair.client)
assertNotError(t, err, "packets should be OK")
assertEquals(t, cstream.SendState(), SendStreamStateResetSent)
err = inputAll(pair.server)
assertNotError(t, err, "packets should be OK")
n, err = sstream.Read(d)
assertEquals(t, err, io.EOF)
assertEquals(t, n, 0)
assertEquals(t, sstream.RecvState(), RecvStreamStateResetRecvd)
}
func TestBidirectionalStopSending(t *testing.T) {
pair := newCsPair(t)
pair.handshake(t)
// Open a stream at the client and start using it (until it is used, it can't
// exist at the server).
testString := []byte("abcdef")
cstream := pair.client.CreateStream()
n, err := cstream.Write(testString)
assertNotError(t, err, "write should work")
assertEquals(t, n, len(testString))
// Feed packets to the server.
err = inputAll(pair.server)
assertNotError(t, err, "packets should be OK")
// The server then reads from the stream.
sstream := pair.server.GetStream(cstream.Id())
d, err := ioutil.ReadAll(sstream)
assertEquals(t, err, ErrorWouldBlock)
assertNotNil(t, d, "Read data from client")
assertByteEquals(t, d, testString)
// Now to test. The server sends STOP_SENDING.
testString2 := []byte("zyxwvut")
err = sstream.StopSending(kQuicErrorNoError)
assertNotError(t, err, "stop sending just works")
assertEquals(t, sstream.RecvState(), RecvStreamStateRecv) // no change
// But it also continues to write to the stream.
n, err = sstream.Write(testString2)
assertNotError(t, err, "write should work")
assertEquals(t, n, len(testString2))
assertEquals(t, sstream.SendState(), SendStreamStateSend) // no change
// After reading, the client should have responded to STOP_SENDING with RST_STREAM.
err = inputAll(pair.client)
assertNotError(t, err, "packets should be OK")
assertEquals(t, cstream.SendState(), SendStreamStateResetSent)
assertEquals(t, cstream.RecvState(), RecvStreamStateRecv)
// Writing at the client now fails.
n, err = cstream.Write(testString)
assertEquals(t, err, ErrorStreamIsClosed)
assertEquals(t, n, 0)
// Reading can continue.
d, err = ioutil.ReadAll(cstream)
assertEquals(t, err, ErrorWouldBlock)
assertByteEquals(t, d, testString2)
assertEquals(t, sstream.RecvState(), RecvStreamStateRecv)
sstream.Close()
err = inputAll(pair.client)
assertNotError(t, err, "packets should be OK")
n, err = cstream.Read(d)
assertEquals(t, err, io.EOF)
assertEquals(t, n, 0)
assertEquals(t, cstream.RecvState(), RecvStreamStateDataRead)
}
func TestStreamIdBlocked(t *testing.T) {
pair := newCsPair(t)
pair.handshake(t)
for i := 0; i < kConcurrentStreamsBidi; i++ {
assertNotNil(t, pair.server.CreateStream(),
"create and discard a bidirectional stream")
}
assertEquals(t, nil, pair.server.CreateStream())
for i := 0; i < kConcurrentStreamsUni; i++ {
assertNotNil(t, pair.client.CreateSendStream(),
"create and discard a unidirectional stream")
}
assertEquals(t, nil, pair.client.CreateSendStream())
// TODO: check that both sides send STREAM_ID_BLOCKED
}
|
#### Classes included
- org.apache.commons.fileupload.disk.DiskFileItemFactory
- org.apache.commons.fileupload.FileItem
- org.apache.commons.fileupload.FileItemFactory
- org.apache.commons.fileupload.FileItemHeadersSupport
- org.apache.commons.fileupload.FileItemIterator
- org.apache.commons.fileupload.FileItemStream
- org.apache.commons.fileupload.FileUpload
- org.apache.commons.fileupload.FileUploadBase
- org.apache.commons.fileupload.FileUploadException
- org.apache.commons.fileupload.ProgressListener
- org.apache.commons.fileupload.RequestContext
|
package im.conversations.compliance.xrd;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "XRD")
public class ExtensibleResourceDescriptor {
static final String NAMESPACE = "http://docs.oasis-open.org/ns/xri/xrd-1.0";
@XmlElement(name = "Link")
private List<Link> links = null;
public List<Link> getLinks(String... rel) {
List<String> list = Arrays.asList(rel);
return getLinks(list);
}
public List<Link> getLinks(List<String> rels) {
return getLinks().stream()
.filter(l -> rels.stream().anyMatch(r -> r.equals(l.getRel())))
.collect(Collectors.toList());
}
private List<Link> getLinks() {
return links == null ? Collections.emptyList() : links;
}
}
|
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using Microsoft.WindowsAzure.Commands.Tools.Common.General;
using Microsoft.WindowsAzure.Commands.Tools.Vhd.Model.Persistence;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
namespace Microsoft.WindowsAzure.Commands.Tools.Vhd.Model
{
[Flags]
public enum VhdValidationType
{
None,
IsVhd,
FixedDisk,
}
public class VhdValidator
{
public static IList<VhdValidationResult> Validate(VhdValidationType validation, string path)
{
var fileFactory = new VhdFileFactory();
VhdFile vhdFile = null;
Exception exception = null;
try
{
vhdFile = fileFactory.Create(path);
}
catch (VhdParsingException e)
{
exception = e;
}
return DoValidate(validation, vhdFile, exception);
}
public static IList<VhdValidationResult> Validate(VhdValidationType validation, Stream vhdStream)
{
var fileFactory = new VhdFileFactory();
VhdFile vhdFile = null;
Exception exception = null;
try
{
vhdFile = fileFactory.Create(vhdStream);
}
catch (VhdParsingException e)
{
exception = e;
}
return DoValidate(validation, vhdFile, exception);
}
private static IList<VhdValidationResult> DoValidate(VhdValidationType validation, VhdFile vhdFile, Exception exception)
{
var result = new List<VhdValidationResult>();
if ((validation & VhdValidationType.IsVhd) == VhdValidationType.IsVhd)
{
var validationResult = new VhdValidationResult
{
ValidationType = VhdValidationType.IsVhd
};
if (vhdFile == null)
{
validationResult.ErrorCode = 1000;
validationResult.Error = exception;
}
result.Add(validationResult);
}
if ((validation & VhdValidationType.FixedDisk) == VhdValidationType.FixedDisk)
{
var validationResult = new VhdValidationResult
{
ValidationType = VhdValidationType.FixedDisk
};
if (vhdFile == null || vhdFile.Footer.DiskType != DiskType.Fixed)
{
validationResult.ErrorCode = 1001;
}
result.Add(validationResult);
}
return result;
}
public static IAsyncResult BeginValidate(VhdValidationType validation, Stream vhdStream, AsyncCallback callback, object state)
{
return AsyncMachine<IList<VhdValidationResult>>.BeginAsyncMachine(ValidateAsync, validation, vhdStream, callback, state);
}
public static IList<VhdValidationResult> EndValidate(IAsyncResult result)
{
return AsyncMachine<IList<VhdValidationResult>>.EndAsyncMachine(result);
}
private static IEnumerable<CompletionPort> ValidateAsync(AsyncMachine<IList<VhdValidationResult>> machine, VhdValidationType validation, Stream vhdStream)
{
var result = new List<VhdValidationResult>();
var fileFactory = new VhdFileFactory();
fileFactory.BeginCreate(vhdStream, machine.CompletionCallback, null);
yield return CompletionPort.SingleOperation;
VhdFile vhdFile = null;
Exception exception = null;
try
{
vhdFile = fileFactory.EndCreate(machine.CompletionResult);
}
catch (VhdParsingException e)
{
exception = e;
}
machine.ParameterValue = DoValidate(validation, vhdFile, exception);
}
}
public class VhdValidationResult
{
public int ErrorCode { get; set; }
public VhdValidationType ValidationType { get; set; }
public Exception Error { get; set; }
}
[Serializable]
public class VhdParsingException : Exception
{
public VhdParsingException()
{
}
public VhdParsingException(string message) : base(message)
{
}
public VhdParsingException(string message, Exception innerException) : base(message, innerException)
{
}
protected VhdParsingException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
|
package p1001
import (
"reflect"
"testing"
)
func runSample(t *testing.T, N int, lamps [][]int, queries [][]int, expect []int) {
res := gridIllumination(N, lamps, queries)
if !reflect.DeepEqual(res, expect) {
t.Errorf("Sample %d %v %v, expect %v, but got %v", N, lamps, queries, expect, res)
}
}
func TestSample1(t *testing.T) {
N := 5
lamps := [][]int{{0, 0}, {4, 4}}
quries := [][]int{{1, 1}, {1, 0}}
expect := []int{1, 0}
runSample(t, N, lamps, quries, expect)
}
func TestSample2(t *testing.T) {
N := 10
lamps := [][]int{{3, 4}, {6, 6}, {1, 8}, {4, 5}, {8, 7}, {0, 6}, {5, 2}, {1, 9}}
quries := [][]int{{7, 9}, {2, 8}, {8, 6}, {6, 8}, {2, 8}}
expect := []int{1, 1, 1, 1, 1}
runSample(t, N, lamps, quries, expect)
}
|
---
title: deepfates log 2020-02-11
layout: post
toc: true
comments: false
search_exclude: false
hide: true
categories: [tweets]
---
#### <a href = "https://twitter.com/deepfates/status/1227470735276433411">*22:53:23*</a>
<font size="5">lmao someone reinvented the toaster</font>
🗨️ 0 ♺ 1 🤍 2
---
#### <a href = "https://twitter.com/deepfates/status/1227476695311097859">*23:17:04*</a>
<font size="5">get this politics shit off my feed</font>
🗨️ 0 ♺ 0 🤍 0
---
|
#!/usr/bin/env bash
DATASET=$1
if [ "$DATASET" == "kinetics400" ] || [ "$1" == "kinetics600" ] || [ "$1" == "kinetics700" ]; then
echo "We are processing $DATASET"
else
echo "Bad Argument, we only support kinetics400, kinetics600 or kinetics700"
exit 0
fi
cd ../../../
PYTHONPATH=. python tools/data/build_file_list.py ${DATASET} data/${DATASET}/videos_train/ --level 2 --format videos --num-split 1 --subset train --shuffle
echo "Train filelist for video generated."
PYTHONPATH=. python tools/data/build_file_list.py ${DATASET} data/${DATASET}/videos_val/ --level 2 --format videos --num-split 1 --subset val --shuffle
echo "Val filelist for video generated."
cd tools/data/kinetics/
|
"""import cv2
scale = 30
cv2.namedWindow("preview")
vc = cv2.VideoCapture('http://192.168.1.155:5555/video')
rval, frame = vc.read()
width = int(frame.shape[1] * scale / 100)
height = int(frame.shape[0] * scale / 100)
dim = (width, height)
print(dim)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))
while True:
rval, frame = vc.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
#gray = cv2.resize(gray, dim)
out.write(gray)
cv2.imshow("preview", gray)
key = cv2.waitKey(20)
if key == 27: # exit on ESC
break
vc.release()
out.release()
cv2.destroyAllWindows()"""
import time
import numpy as np
import cv2
scale = 30
cap = cv2.VideoCapture('boar_trim.avi')#'http://192.168.1.155:8080/video')
#fourcc = cv2.VideoWriter_fourcc(*'XVID')
#out = cv2.VideoWriter('boar.avi',fourcc, 20.0, (640,480), 0)
while(True):
ret, frame = cap.read()
time.sleep(.03)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
#out.write(gray)
viewer = cv2.resize(gray, (1280, 720))
cv2.imshow('frame',viewer)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
#out.release()
cv2.destroyAllWindows()
import numpy as np
import cv2
scale = 30
cap = cv2.VideoCapture('http://192.168.1.155:8080/video')
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('boar.avi',fourcc, 20.0, (640,480), 0)
while(True):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
out.write(gray)
viewer = cv2.resize(gray, (1280, 720))
cv2.imshow('frame',viewer)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
out.release()
cv2.destroyAllWindows()
|
namespace FortnoxNET.Constants.Search
{
public enum VoucherSearchParameters
{
CostCenter,
LastModified,
FinancialYear,
FinancialYearDate,
FromDate,
ToDate
}
}
|
import * as React from 'react';
import { createRenderer, describeConformance } from 'test/utils';
import CardActions, { cardActionsClasses as classes } from '@mui/material/CardActions';
describe('<CardActions />', () => {
const { render } = createRenderer();
describeConformance(<CardActions />, () => ({
classes,
inheritComponent: 'div',
render,
refInstanceof: window.HTMLDivElement,
muiName: 'MuiCardActions',
testVariantProps: { disableSpacing: true },
skip: ['componentProp', 'componentsProp'],
}));
});
|
function swal_show(result) {
swal({
title: result['title'],
text: result['message'],
timer: 1500,
buttons: false,
dangerMode: false,
icon: result['type']
});
}
function swal_alert(title, msg, icon) {
swal({
title: title,
text: msg,
timer: 1500,
buttons: false,
dangerMode: false,
icon: icon
});
}
function swal_confirm_ok(result) {
swal({
title: result['title'],
text: result['message'],
icon: result['type']
}).then((value) => {
setTimeout("window.open(self.location, '_self');", 1500);
});
}
//
function swal_warning(result) {
swal({
title: result['message'],
text: result['message'],
timer: 1500,
buttons: false,
dangerMode: false,
icon: result['type']
});
}
function swal_error(result) {
swal({
title: result['message'],
text: result['message'],
timer: 1500,
buttons: false,
dangerMode: false,
icon: result['type']
});
}
|
export default ({ title }) =>
<header className='page-header'>
<h1>{title}</h1>
<i />
</header>
|
module Main where
import Chapter23
data CoordCheck
= Valid
| NotValid
deriving (Show, Read, Eq)
main :: IO ()
main = do
putStrLn "Enter Top Left Coordinate (x,y)"
coord1 <- fmap readCoord getLine
putStrLn "Enter Bottom Right Coordinate (x,y)"
coord2 <- fmap readCoord getLine
putStrLn "Please chose a start State (1-3)"
let coordValid = checkCoords coord1 coord2
case coordValid of
NotValid ->
putStrLn
"left coordinate must have smaller x and y values than right coordinate"
Valid -> do
option <- getLine
let selection = lookup option startoptions
case selection of
Nothing -> do
putStrLn "Not a valid selection"
Just startState -> animateGrid coord1 coord2 startState
checkCoords :: Coord -> Coord -> CoordCheck
checkCoords (x1, y1) (x2, y2)
| x1 <= x2 && y1 <= y2 = Valid
| otherwise = NotValid
readCoord :: String -> Coord
readCoord = read
|
<?php
/**
* Copyright 2013 François Kooman <fkooman@tuxed.net>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace fkooman\OAuth\ResourceServer;
class ResourceServer
{
/* @var \Guzzle\Http\Client */
private $httpClient;
/* @var string|null */
private $authorizationHeader;
/* @var string|null */
private $accessTokenQueryParameter;
/**
* @param \Guzzle\Http\Client $httpClient
* the client pointing to the introspection endpoint
*/
public function __construct(\Guzzle\Http\Client $httpClient)
{
$this->httpClient = $httpClient;
$this->authorizationHeader = null;
$this->accessTokenQueryParameter = null;
}
public function setAuthorizationHeader($authorizationHeader)
{
// must be string
if (!is_string($authorizationHeader)) {
return;
}
// string should have at least length 8
if (7 >= strlen($authorizationHeader)) {
return;
}
// string should start with "Bearer "
if (0 !== stripos($authorizationHeader, "Bearer ")) {
return;
}
$this->authorizationHeader = substr($authorizationHeader, 7);
}
public function setAccessTokenQueryParameter($accessTokenQueryParameter)
{
// must be string
if (!is_string($accessTokenQueryParameter)) {
return;
}
// string should have at least length 1
if (0 >= strlen($accessTokenQueryParameter)) {
return;
}
$this->accessTokenQueryParameter = $accessTokenQueryParameter;
}
public function verifyToken()
{
// one type should at least be set
if (null === $this->authorizationHeader && null === $this->accessTokenQueryParameter) {
throw new ResourceServerException("no_token", "missing token");
}
// but not both
if (null !== $this->authorizationHeader && null !== $this->accessTokenQueryParameter) {
throw new ResourceServerException(
"invalid_request",
"more than one method for including an access token used"
);
}
if (null !== $this->authorizationHeader) {
$bearerToken = $this->authorizationHeader;
} else {
$bearerToken = $this->accessTokenQueryParameter;
}
$this->validateTokenSyntax($bearerToken);
try {
$request = $this->httpClient->get();
$request->getQuery()->add("token", $bearerToken);
$response = $request->send();
$responseData = $response->json();
if (!is_array($responseData)) {
throw new ResourceServerException(
"internal_server_error",
"malformed response data from introspection endpoint"
);
}
$tokenIntrospection = new TokenIntrospection($responseData);
// check if the token was active
if (!$tokenIntrospection->getActive()) {
throw new ResourceServerException("invalid_token", "the access token is not active");
}
// check if it was not expired
if (false !== $tokenIntrospection->getExpiresAt()) {
if (time() > $tokenIntrospection->getExpiresAt()) {
throw new ResourceServerException("invalid_token", "the access token expired");
}
}
return $tokenIntrospection;
} catch (\Guzzle\Common\Exception\RuntimeException $e) {
// error when contacting endpoint, or no JSON data returned
throw new ResourceServerException(
"internal_server_error",
"unable to contact introspection endpoint or malformed response data"
);
}
}
private function validateTokenSyntax($token)
{
// b64token = 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"="
if (1 !== preg_match('|^[[:alpha:][:digit:]-._~+/]+=*$|', $token)) {
throw new ResourceServerException(
"invalid_token",
"the access token is not a valid b64token"
);
}
}
}
|
// Copyright Camille Gillot 2012 - 2015.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef RTTI_MMETHOD_HASH_FETCH_POLE_HPP
#define RTTI_MMETHOD_HASH_FETCH_POLE_HPP
#include "mmethod/config.hpp"
#include "mmethod/export/table/table.hpp"
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace rtti {
namespace hash {
namespace detail {
// is to be invoked without a mutex
extern value_type
do_fetch_pole(
hash_map const&
, rtti_hierarchy rt0
) BOOST_NOEXCEPT_OR_NOTHROW;
inline value_type
MMETHOD_ATTRIBUTE_PURE
fetch_pole(
hash_map const& map
, rtti_hierarchy rt
) BOOST_NOEXCEPT_OR_NOTHROW {
const rtti_type id0 = rtti_get_id(rt);
hash_map::iterator const it0 = map.find(id0);
if(BOOST_LIKELY( it0->key() == id0 )) {
return it0->value();
}
return do_fetch_pole(map, rt);
}
} // namespace detail
} // namespace hash
} // namespace rtti
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif
|
process.env.NODE_ENV = "test";
let mongoose = require("mongoose");
let Marker = require("../models/markers");
let chai = require("chai");
let chaiHttp = require("chai-http");
let server = require("../app");
let should = chai.should();
chai.use(chaiHttp);
/*
* Test the /GET route (Get all makers)
*/
describe("/GET markers", () => {
it("it should GET all markers", done => {
chai
.request(server)
.get("/markers")
.end((err, res) => {
res.should.have.status(200);
res.body.should.be.a("array");
/* res.body.length.should.be.eql(5); */
done();
});
});
});
/*
* Test the /POST route (Create a marker)
*/
describe("/POST /markers", () => {
it("it should create a new marker", done => {
let marker = {
lat: "12",
lng: "24",
markerInfo: "Test Marker"
};
chai
.request(server)
.post("/markers")
.send(marker)
.end((err, res) => {
res.should.have.status(200);
res.body.should.be.a("object");
done();
});
});
});
/*
* Test the /GET/:id route (Get a marker)
*/
describe("/GET/:id marker", () => {
it("it should GET a marker by the given id", done => {
let marker_id = "5d05bd07082e263e6e3d78cf";
chai
.request(server)
.get("/markers/" + marker_id)
.end((err, res) => {
res.should.have.status(200);
done();
});
});
});
/*
* Test the /PUT/:id route
*/
describe("/PUT/:id markers", () => {
it("it should UPDATE a maker given the id", done => {
let marker = new Marker({
lat: "123123",
lng: "123123",
markerInfo: "POPO"
});
marker.save((err, marker) => {
chai
.request(server)
.put("/markers/" + marker.id)
.send({ lat: "345345", lng: "123123", markerInfo: "POPO" })
.end((err, res) => {
res.should.have.status(200);
done();
});
});
});
});
/*
* Test the /DELETE/:id route
*/
describe("/DELETE/:id markers", () => {
it("it should DELETE a marker given the id", done => {
let marker = new Marker({
lat: "123123",
lng: "123123",
markerInfo: "POPO"
});
marker.save((err, marker) => {
chai
.request(server)
.delete("/markers/" + marker.id)
.end((err, res) => {
res.should.have.status(200);
done();
});
});
});
});
|
//+build integration
package netfilter
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/mdlayher/netlink"
)
var (
badGroup = []NetlinkGroup{255}
)
func TestConnIntegrationJoinLeaveGroup(t *testing.T) {
c, err := Dial(nil)
require.NoError(t, err, "opening Conn")
// Join all Conntrack event groups, as an example.
err = c.JoinGroups(GroupsCT)
require.NoError(t, err, "JoinGroup")
err = c.LeaveGroups(GroupsCT)
require.NoError(t, err, "LeaveGroup")
err = c.Close()
require.NoError(t, err, "closing Conn")
}
func TestConnIntegrationBadGroups(t *testing.T) {
c, err := Dial(nil)
require.NoError(t, err, "opening Conn")
err = c.JoinGroups(badGroup)
require.EqualError(t, err, "netlink join-group: setsockopt: invalid argument")
err = c.LeaveGroups(badGroup)
require.EqualError(t, err, "netlink leave-group: setsockopt: invalid argument")
err = c.Close()
require.NoError(t, err, "closing Conn")
}
func TestConnIntegrationSetOption(t *testing.T) {
c, err := Dial(nil)
require.NoError(t, err, "opening Conn")
err = c.SetOption(netlink.ListenAllNSID, true)
require.NoError(t, err, "setting SockOption")
err = c.Close()
require.NoError(t, err, "closing Conn")
}
|
import {Store} from "@ngxs/store";
import {Injectable} from "@angular/core";
import {map, Observable} from "rxjs";
import {ThemeOptions} from "../themes/theme";
import {SharedStateStore} from "../shared.state";
import {LIGHT_THEME} from "../themes/light.theme";
import {DARK_THEME} from "../themes/dark.theme";
@Injectable({
providedIn: "root"
})
export class ThemeService {
/**
* Theme styles in the application.
* @private
*/
private static readonly THEME_STYLES = [
LIGHT_THEME, DARK_THEME
];
constructor(private store$: Store) { }
getThemeStyle(): Observable<ThemeOptions> {
return this.store$.select(SharedStateStore.theme).pipe(
map(name => ThemeService.THEME_STYLES.find(style => style.name === name) ?? LIGHT_THEME),
);
}
}
export function isPreferDarkMode(): boolean {
return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
}
|
import { EditorProps } from '@edtr-io/core'
import { RendererProps } from '@edtr-io/renderer'
import { storiesOf } from '@storybook/react'
import * as React from 'react'
import { EditorStory, RendererStory } from './container'
export function addStory(
name: string,
props: {
defaultPlugin?: EditorProps['defaultPlugin']
theme?: RendererProps['theme']
state: RendererProps['state']
}
) {
const stories = storiesOf(name, module)
stories.add('Editor', () => {
return <EditorStory initialState={props.state} {...props} />
})
stories.add('Renderer', () => {
return <RendererStory {...props} />
})
}
|
<?php
namespace Phpactor\Extension\Rpc\Tests\Unit\RequestHandler;
use PHPUnit\Framework\TestCase;
use Phpactor\Extension\Rpc\RequestHandler;
use Phpactor\Extension\Rpc\RequestHandler\ExceptionCatchingHandler;
use Phpactor\Extension\Rpc\Request;
use Phpactor\Extension\Rpc\Response;
use Prophecy\Prophecy\ObjectProphecy;
use Phpactor\Extension\Rpc\Response\ErrorResponse;
use Psr\Log\LoggerInterface;
use Phpactor\Extension\Rpc\RequestHandler\LoggingHandler;
use Psr\Log\LogLevel;
use Prophecy\PhpUnit\ProphecyTrait;
class LoggingHandlerTest extends TestCase
{
use ProphecyTrait;
/**
* @var ObjectProphecy
*/
private $innerHandler;
/**
* @var ExceptionCatchingHandler
*/
private $loggingHandler;
/**
* @var ObjectProphecy
*/
private $response;
/**
* @var ObjectProphecy
*/
private $request;
/**
* @var ObjectProphecy
*/
private $logger;
public function setUp(): void
{
$this->logger = $this->prophesize(LoggerInterface::class);
$this->innerHandler = $this->prophesize(RequestHandler::class);
$this->loggingHandler = new LoggingHandler($this->innerHandler->reveal(), $this->logger->reveal());
$this->response = $this->prophesize(Response::class);
$this->request = $this->prophesize(Request::class);
$this->request->name()->willReturn('req-name');
$this->request->parameters()->willReturn(['p1' => 'v1' ]);
$this->response->name()->willReturn('res-name');
$this->response->parameters()->willReturn(['p1' => 'v1' ]);
$this->expectedRequestData = [ 'action' => 'req-name', 'parameters' => [ 'p1' => 'v1' ] ];
$this->expectedResponseData = [ 'action' => 'res-name', 'parameters' => [ 'p1' => 'v1' ] ];
}
public function testLogging(): void
{
$this->innerHandler->handle($this->request->reveal())->willReturn($this->response->reveal());
$response = $this->loggingHandler->handle($this->request->reveal());
$this->assertSame(
$this->response->reveal(),
$response
);
$this->logger->debug('REQUEST', $this->expectedRequestData)->shouldHaveBeenCalled();
$this->logger->log(LogLevel::DEBUG, 'RESPONSE', $this->expectedResponseData)->shouldHaveBeenCalled();
}
public function testLoggingWithError(): void
{
$response = ErrorResponse::fromMessageAndDetails('foobar', 'barfoo');
$expected = [
'action' => $response->name(),
'parameters' => $response->parameters()
];
$this->innerHandler->handle($this->request->reveal())->willReturn($response);
$response = $this->loggingHandler->handle($this->request->reveal());
$this->logger->log(LogLevel::ERROR, 'RESPONSE', $expected)->shouldHaveBeenCalled();
}
}
|
#!/bin/bash
force_scale=1.0
julia Data_NNPlatePull.jl 100 $force_scale 2 2 &
julia Data_NNPlatePull.jl 101 $force_scale 2 2 &
julia Data_NNPlatePull.jl 102 $force_scale 2 2 &
julia Data_NNPlatePull.jl 103 $force_scale 2 2 &
julia Data_NNPlatePull.jl 104 $force_scale 2 2 &
julia Data_NNPlatePull.jl 105 $force_scale 2 2 &
julia Data_NNPlatePull.jl 106 $force_scale 2 2 &
julia Data_NNPlatePull.jl 200 $force_scale 2 2 &
julia Data_NNPlatePull.jl 201 $force_scale 2 2 &
julia Data_NNPlatePull.jl 202 $force_scale 2 2 &
julia Data_NNPlatePull.jl 203 $force_scale 2 2 &
julia Data_NNPlatePull.jl 204 $force_scale 2 2 &
julia Data_NNPlatePull.jl 205 $force_scale 2 2 &
julia Data_NNPlatePull.jl 206 $force_scale 2 2 &
julia Data_NNPlatePull.jl 300 $force_scale 2 2 &
wait
|
import { IBlock, ILocationResponseBlockConfig } from '../..';
export interface ILocationResponseBlock extends IBlock<ILocationResponseBlockConfig> {
}
//# sourceMappingURL=ILocationResponseBlock.d.ts.map
|
// Copyright 2019 Zachary Bush.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate diesel;
pub mod error;
pub mod models;
pub mod schema;
use {
diesel::{
pg::PgConnection,
r2d2::{ConnectionManager, Pool, PooledConnection},
},
dotenv::dotenv,
lazy_static::lazy_static,
std::env,
};
lazy_static! {
static ref CONNECTION_POOL: Pool<ConnectionManager<PgConnection>> = {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
Pool::builder()
.build(ConnectionManager::new(database_url))
.expect("Unable to create db connection pool")
};
}
pub fn db() -> Result<PooledConnection<ConnectionManager<PgConnection>>, r2d2::Error> {
CONNECTION_POOL.get()
}
|
using Revise
using JDF
using CSV, DataFrames, Blosc, JLSO, Base.GC
# use 12 threads
Blosc.set_num_threads(6)
@time a = CSV.read("C:/data/Performance_All/Performance_2010Q3.txt", delim = '|', header = false);
strs = "id".*string.(rand(UInt16, 100_000_000));
# write randomstring to io
strs = coalesce.(Array(a[:Column3]), "")
io = open("c:/data/string.jdf", "w")
@time string_byte_sizes = write.(Ref(io), strs);
close(io)
load_str(file, string_byte_sizes) = begin
io = open(file, "r")
tot_strings_in_bytes = sum(string_byte_sizes)
strings_in_bytes = Vector{UInt8}(undef, tot_strings_in_bytes)
@time read!(io, strings_in_bytes)
close(io)
i = 1
j = 0
ptr_to_string_in_bytes = pointer(strings_in_bytes)
@time reconstituted_strings = String[" "^s for s in string_byte_sizes]
@time for string_byte_size in string_byte_sizes
#global i, j, reconstituted_strings
#reconstituted_strings[i] = unsafe_string(ptr_to_string_in_bytes+j, string_byte_size)
unsafe_copyto!(
reconstituted_strings[i] |> pointer,
ptr_to_string_in_bytes + j,
string_byte_size)
i += 1
j += string_byte_size
end
reconstituted_strings
end
@time reconstituted_strings = load_str("c:/data/string.jdf", string_byte_sizes);
all(reconstituted_strings .== strs) # true: works but FAST
@time metadata = compress_then_write(a, "c:/data/string.jdf");
x = "abc"
xp = pointer(x)
unsafe_load(xp-8)
unsafe_pointer_to_objref(pointer(UInt8[3, 0, 0, 0, 0, 0, 0, 0, 63, 63, 63]))
unsafe_pointer_to_objref(xp-8)
y = unsafe_string(xp)
yp = pointer(y)
yp == xp # false
reinterpret(8, UInt8)
pointer(8)
unsafe_pointer_to_objref(pointer(UInt8[0,0,0,0, 0,0,0,2, 64, 65]))
|
# Fighting Novel Coronavirus COVID-19 with Data Science & Machine Learning
Fighting Novel Coronavirus COVID-19 with Data Science & Machine Learning. (Underdevelopment Project)
## Overview
- Find Answers by Analysing & Visualising Data.
- Test Hypothesis.
- Figure The Right Model For Predication.
## Methodology
- Intel DS https://software.intel.com/en-us/download/intel-data-analytics-acceleration-library-developer-guide
- IBM CRISP-DM https://www.ibm.com/support/knowledgecenter/SS3RA7_15.0.0/com.ibm.spss.crispdm.help/crisp_overview.htm
## Technologies
- Code in the Cloud (Intel DevCloud) - (One API) with High-Performance Python & Data Analytics Library (Intel DAAL)
- Anaconda Python,jupyter notebook/lab.
## Dataset Source/s & information related
- https://en.wikipedia.org/wiki/Coronavirus_disease_2019
- https://www.who.int/emergencies/diseases/novel-coronavirus-2019
- https://www.cdc.gov/coronavirus/2019-ncov/index.html
- https://www.ecdc.europa.eu/en/novel-coronavirus-china
- https://www.ecdc.europa.eu/en/publications-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide
- https://www.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6
- https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series
|
// MIT License
// Copyright (c) 2021 Tree Xie
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
package store
import (
"context"
"fmt"
"net/url"
"strconv"
"strings"
"time"
"github.com/go-redis/redis/v8"
"github.com/vicanso/pike/log"
"go.uber.org/zap"
)
type redisStore struct {
client redis.UniversalClient
// timeout 超时设置
timeout time.Duration
// prefix key的前缀
prefix string
}
type redisLogger struct{}
func (rl *redisLogger) Printf(ctx context.Context, format string, v ...interface{}) {
log.Default().Info(fmt.Sprintf(format, v...),
zap.String("category", "redisLogger"),
)
}
func init() {
redis.SetLogger(&redisLogger{})
}
func newRedisStore(connectionURI string) (store Store, err error) {
urlInfo, err := url.Parse(connectionURI)
if err != nil {
return
}
user := ""
password := ""
if urlInfo.User != nil {
user = urlInfo.User.Username()
password, _ = urlInfo.User.Password()
}
// redis选择的db
db, _ := strconv.Atoi(urlInfo.Query().Get("db"))
// 设置的超时,如 3s
timeout, _ := time.ParseDuration(urlInfo.Query().Get("timeout"))
// 保存的key的前缀
prefix := urlInfo.Query().Get("prefix")
addrs := strings.Split(urlInfo.Host, ",")
master := urlInfo.Query().Get("master")
client := redis.NewUniversalClient(&redis.UniversalOptions{
Addrs: addrs,
Username: user,
Password: password,
DB: db,
SentinelPassword: password,
MasterName: master,
})
// 默认3秒超时
if timeout == 0 {
timeout = 3 * time.Second
}
store = &redisStore{
client: client,
timeout: timeout,
prefix: prefix,
}
return
}
func (rs *redisStore) getKey(key []byte) string {
return rs.prefix + string(key)
}
// Get get data from redis
func (rs *redisStore) Get(key []byte) (data []byte, err error) {
ctx, cancel := context.WithTimeout(context.Background(), rs.timeout)
defer cancel()
k := rs.getKey(key)
cmd := rs.client.Get(ctx, k)
data, err = cmd.Bytes()
if err != nil {
if err == redis.Nil {
err = ErrNotFound
}
return
}
return
}
// Set set data to redis
func (rs *redisStore) Set(key []byte, data []byte, ttl time.Duration) (err error) {
ctx, cancel := context.WithTimeout(context.Background(), rs.timeout)
defer cancel()
k := rs.getKey(key)
cmd := rs.client.Set(ctx, k, data, ttl)
return cmd.Err()
}
// Delete delete date from redis
func (rs *redisStore) Delete(key []byte) (err error) {
ctx, cancel := context.WithTimeout(context.Background(), rs.timeout)
defer cancel()
k := rs.getKey(key)
cmd := rs.client.Del(ctx, k)
return cmd.Err()
}
// Close close redis
func (rs *redisStore) Close() error {
return rs.client.Close()
}
|
<<м҃д ѡ҆б.: 88>>
*Въ понедѣ́льникъ в҃-ѧ седми́цы а҆нтїпа́схи на ᲂу҆́трени.*
*Повнегда̀ сотвори́ти і҆ере́ю нача́ло,* ~Сла́ва ст҃ѣ́й: *Глаго́лемъ:*
~Хрⷭ҇то́съ воскре́се *три́жды, ти́химъ гла́сомъ.*
*Сїе́ бо глаго́лемъ нача́ло:* ~Хрⷭ҇то́съ воскре́се: *въ часѣ́хъ, и҆ вече́рнѧхъ,
и҆ повече́рїѧхъ, ѿ сеѧ̀ ᲂу҆́трени недѣ́ли а҆нтїпа́схи, да́же и҆ до вознесе́нїѧ
гдⷭ҇нѧ. [Ка́кѡ ᲂу҆́бѡ не и҆звѣсти́сѧ ѡ҆ полꙋ́нощницѣ, ꙗ҆́вѣ ꙗ҆́кѡ въ ке́ллїахъ
мню̀ се́й бы́ти пѣва́емѣй, поне́же ᲂу҆́бѡ и҆ та́мѡ си́це нача́ло быва́етъ.]*
*И҆ а҆́бїе по* ~Хрⷭ҇то́съ воскре́се: *Сла́ва въ вы́шнихъ бг҃ꙋ, и҆ на землѝ
ми́ръ: И҆ ѻ҆бы́чное шестоѱа́лмїе. є҆ктенїа̀ вели́каѧ. Та́же,* ~Бг҃ъ гдⷭ҇ь: *во
гла́съ з҃. Тропа́рь пра́здникꙋ:* ~Запеча́танꙋ гро́бꙋ: *три́жды.* [зрѝ] *Се́й
тропа́рь глаго́летсѧ чрез̾ всю̀ седми́цꙋ. И҆ стїхосло́вимъ каѳі́смы двѣ̀, а҆
тре́тїѧ рѧдова́ѧ на вече́рни: И҆ та́кѡ пое́мъ ѱалти́рь до к҃а септе́мврїа.*
*По а҃-мъ стїхосло́вїи сѣда́ленъ воскре́сенъ, гла́съ а҃:*
~Гро́бъ тво́й сп҃се, во́ини стрегꙋ́щїи, ме́ртви ѿ ѡ҆блиста́нїѧ ꙗ҆́вльшагѡсѧ
а҆́гг҃ла бы́ша, проповѣ́дающа жена́мъ воскресе́нїе: тебѐ сла́вимъ тлѝ
потреби́телѧ, тебѣ̀ припа́даемъ воскре́сшемꙋ и҆з̾ гро́ба, и҆ є҆ди́номꙋ бг҃ꙋ
на́шемꙋ.
*Сті́хъ:* ~Гдⷭ҇и, да не ꙗ҆́ростїю твое́ю ѡ҆бличи́ши менѐ, нижѐ гнѣ́вомъ твои́мъ
нака́жеши менѐ.
*Оу҆мили́тельный:* ~Въ беззако́нїихъ зача́тъ є҆́смь а҆́зъ блꙋ́дный, не смѣ́ю
воззрѣ́ти на высотꙋ̀ нбⷭ҇нꙋю, но дерза́ѧ на чл҃вѣколю́бїе твоѐ зовꙋ̀: бж҃е
ѡ҆чи́сти мѧ̀ грѣ́шнаго, и҆ спаси́ мѧ.
*Сті́хъ:* ~Ди́венъ бг҃ъ во ст҃ы́хъ свои́хъ, бг҃ъ і҆и҃левъ. <<м҃є: 89>>
*Мꙋ́чениченъ:* ~Страда́нїѧ похвало́ю, и҆ вѣнцє́въ досто́инствомъ, сла́внїи
страстоте́рпцы ѡ҆дѣ́ѧшасѧ тобо́ю гдⷭ҇и: терпѣ́нїемъ бо ра̑нъ беззакѡ́нныѧ
побѣди́ша, и҆ си́лою бж҃е́ственною съ нб҃сѐ побѣ́дꙋ прїѧ́ша. тѣ́хъ моли́твами
свободѝ ѿ неви́димагѡ врага̀ сп҃се, и҆ спаси́ мѧ.
*Сла́ва, и҆ ны́нѣ: бг҃оро́диченъ:*
~Чꙋ́до чꙋде́съ бл҃года́тнаѧ, въ тебѣ̀ зрѧ́щи тва́рь ра́дꙋетсѧ: зачала́ бо є҆сѝ
безсѣ́меннѡ, и҆ родила̀ є҆сѝ неизрече́ннѡ, є҆го́же чинонача̑лїѧ а҆́гг҃лѡвъ
ви́дѣти не мо́гꙋтъ: того̀ ꙗ҆́кѡ бг҃а молѝ ѡ҆ дꙋша́хъ на́шихъ.
*Та́же чте́нїе въ толкова́нїи і҆ѡа́нна є҆ѵⷢ҇лїа.*
*По в҃-мъ стїхосло́вїи сѣда́ленъ, гла́съ а҃.*
*Подо́бенъ:* ~Гро́бъ тво́й:
~Прикоснꙋ́выйсѧ рꙋко́ю ре́брѡмъ нестерпи́мымъ близне́цъ ѳѡма̀, не ѡ҆пали́сѧ
прикоснове́нїемъ, но пребы́сть ꙗ҆́звы ѡ҆сѧза́ѧ и҆звѣ́стнѣе, и҆ вѣща́ѧ на́съ
ра́ди прободе́нномꙋ: ты̀ мо́й гдⷭ҇ь и҆ бг҃ъ мо́й є҆сѝ, а҆́ще и҆ стра́сть
претерпѣ́лъ є҆сѝ.
*Сла́ва, и҆ ны́нѣ: то́йже. И҆ чте́нїе.*
*Та́же, Воскрⷭ҇нїе хрⷭ҇то́во ви́дѣвше: є҆ди́ножды, и҆ ѱало́мъ н҃.*
[зрѝ] *Си́це бо твори́мъ до вознесе́нїѧ гдⷭ҇нѧ, нижѐ* ~Гдⷭ҇ви пое́мъ:
*глаго́лемъ, но глаго́лемъ ꙗ҆́коже написа́сѧ во і҆рмоло́гїахъ. Нача́ло же
твори́мъ ѿ і҆рмосѡ́въ, и҆̀хже и҆ повторѧ́емъ, пою́ще и҆ тропарѝ на ѕ҃. И҆
ст҃а́гѡ мине́и на д҃. По г҃-й пѣ́сни конда́къ, и҆ сѣда́ленъ ст҃а́гѡ. Сла́ва, и҆
ны́нѣ: сѣда́ленъ пра́здникꙋ. По ѕ҃-й пѣ́сни конда́къ пра́здникꙋ, и҆ і҆́косъ. И҆
стїхосло́вимъ* ~Честнѣ́йшꙋю. *По ѳ҃-й пѣ́сни є҆ѯапостїла́рїй пра́здникꙋ,
два́жды. Сла́ва: ст҃а́гѡ, а҆́ще є҆́сть. И҆ ны́нѣ: пра́здника, дрꙋгі́й
свѣти́ленъ.* <<м҃є ѡ҆б.: 90>>
*На __хвали́техъ__ поста́вимъ стїхи̑ры г҃ ѻ҆смогла́сника, на д҃. Гла́съ а҃:*
~Пое́мъ твою̀ хрⷭ҇тѐ спаси́тельнꙋю стра́сть, и҆ сла́вимъ твоѐ воскрⷭ҇нїе.
*[Два́жды.]*
*Оу҆мили́тельный:* ~И҆ны́й тебѐ мі́ръ дꙋшѐ ѡ҆жида́етъ, и҆ сꙋдїѧ̀ хо́щетъ твоѧ̑
ѡ҆бличи́ти та̑йнаѧ и҆ лю̑таѧ. не пребꙋ́ди ᲂу҆́бѡ въ здѣ́шнихъ, но предварѝ
вопїю́щи сꙋдїѝ: бж҃е, ѡ҆чи́сти мѧ̀, и҆ спаси́ мѧ.
*Мꙋ́чениченъ:* ~Страстоте́рпцы хрⷭ҇тѡ́вы, прїиди́те лю́дїе, всѝ почти́мъ
пѣ́сньми и҆ пѣ́нїи дх҃о́вными, свѣти̑ла мі́ра, и҆ проповѣ́дники вѣ́ры,
и҆сто́чникъ приснотекꙋ́щїй, и҆з̾ негѡ́же и҆стека́ютъ вѣ̑рнымъ и҆сцѣлє́нїѧ. тѣ́хъ
моли́твами, хрⷭ҇тѐ бж҃е на́шъ, ми́ръ да́рꙋй мі́рови, и҆ дꙋша́мъ на́шымъ ве́лїю
ми́лость.
*Сла́ва, и҆ ны́нѣ: гла́съ а҃:*
~Ѳѡма̀ глаго́лемый близне́цъ не бѣ̀ съ ни́ми, є҆гда̀ вше́лъ є҆сѝ хрⷭ҇тѐ
заключє́ннымъ, две́ремъ, тѣ́мже и҆ не вѣ́роваше речє́ннымъ є҆мꙋ̀, ѿ невѣ́рїѧ въ
вѣ́рꙋ и҆звѣствꙋ́ѧ: не несподо́билъ же є҆сѝ бл҃же, показа́ти є҆мꙋ̀ пречⷭ҇тое
ребро̀ твоѐ, и҆ рꙋкꙋ̀ и҆ нѡгꙋ̀ ꙗ҆́звы. ѻ҆́нъ же ѡ҆сѧза́въ и҆ ви́дѣвъ, и҆сповѣ́да
тѧ̀ бы́ти бг҃а не на́га, и҆ человѣ́ка не про́ста, и҆ вопїѧ́ше: гдⷭ҇ь мо́й и҆
бг҃ъ мо́й, сла́ва тебѣ̀!
*Та́же:* ~Сла́ва тебѣ̀ показа́вшемꙋ на́мъ свѣ́тъ: *И҆ є҆ктенїа̀:* ~И҆спо́лнимъ
ᲂу҆́треннюю моли́твꙋ на́шꙋ:
*На __стїхо́внѣ__ стїхи̑ры гла́съ в҃.*
*Подо́бенъ:* ~До́ме є҆ѵфра́ѳовъ:
~Оу҆стна́ми чи́стыми по́йте, со а҆́гг҃лы человѣ́цы, воскре́сшаго тридне́внѡ
и҆з̾ гро́ба, и҆ мі́ръ совоздви́гшаго. <<м҃ѕ: 91>>
*Сті́хъ:* ~Похвалѝ і҆ерꙋсали́ме гдⷭ҇а, хвалѝ бг҃а твоего̀ сїѡ́не.
~Ꙗ҆ви́лсѧ є҆сѝ сщ҃є́ннымъ твои̑мъ сп҃се а҆пⷭ҇лѡмъ, две́ремъ заключє́ннымъ,
тѣ́ми ѡ҆бновлѧ́ѧ на́мъ бжⷭ҇твенный дх҃ъ тво́й.
*Сті́хъ:* ~Ꙗ҆́кѡ ᲂу҆крѣпѝ верєѝ вра́тъ твои́хъ, и҆ бл҃гословѝ сы́ны твоѧ̑ въ
тебѣ̀.
~Ны́нѣ тѧ̀ всецр҃ю̀, ви́дѣвше не ѻ҆чи́ма, но серде́чною любо́вїю бг҃а
вѣ́ровавше, въ пѣ́нїихъ велича́емъ.
*Сла́ва: ст҃а́гѡ, а҆́ще є҆́сть. И҆ ны́нѣ: гла́съ а҃:*
~Оу҆ч҃нкѡ́мъ сомнѧ́щымсѧ, во ѻ҆смы́й де́нь предста̀ сп҃съ, и҆дѣ́же бѧ́хꙋ
со́брани, и҆ ми́ръ да́въ, ѳѡмѣ̀ возопѝ: прїидѝ а҆пⷭ҇ле, ѡ҆сѧжѝ дла̑ни, въ ни́хже
гвѡ́здїѧ вонзо́ша. ѽ до́брое невѣ́рїе ѳѡмино̀, вѣ́рныхъ сердца̀ въ позна́нїе
приведѐ, и҆ со стра́хомъ возопѝ: гдⷭ҇ь мо́й и҆ бг҃ъ мо́й, сла́ва тебѣ̀!
*Тропа́рь пра́здника:* ~Запеча́танꙋ гро́бꙋ: *Та́же є҆ктенїа̀:* ~Поми́лꙋй на́съ
бж҃е: *Посе́мъ і҆ере́й:* ~Сы́й бл҃гослове́нъ хрⷭ҇то́съ бг҃ъ на́шъ: *Ли́къ:*
~Оу҆твердѝ бж҃е: *И҆ а҆́бїе совокꙋплѧ́емъ ча́съ пе́рвый триѱа́лмный, по
ѻ҆бы́чаю. Тропа́рь и҆ конда́къ пра́здника, и҆ ст҃а́гѡ. А҆́ще же ст҃а́гѡ на д҃,
конда́къ глаго́летсѧ пра́здника непремѣ́ннѡ: а҆ ст҃а́гѡ конда́къ не глаго́летсѧ.
И҆ быва́етъ соверше́нный ѿпꙋ́стъ. И҆ ѻ҆бы́чнаѧ лїті́а въ притво́рѣ.*
[зрѝ] *Начина́емъ же ѿ дне́сь и҆ междоча̑сїѧ часѡ́въ, по послѣ́довавшемꙋ
ᲂу҆ста́вꙋ. Подоба́етъ же вѣ́дати, ꙗ҆́коже написа́сѧ здѣ̀ вослѣ́дованїе въ
недѣ́лю ве́чера во свѣти́льничномъ, и҆ въ понедѣ́льникъ во ᲂу҆́трени: си́це да
быва́етъ во всѣ́хъ седми́цахъ до вознесе́нїѧ гдⷭ҇нѧ, и҆змѣнѧ́ємымъ стїхи́рамъ
ѻ҆смогла́сника, и҆ сѣда́льнѡмъ по ѻ҆бы́чаю.* <<м҃ѕ ѡ҆б.: 92>>
*На лїтꙋргі́и: бл҃жє́нна трїѡ́ди, пѣ́снь а҃ пра́здника, на ѕ҃. И҆ ѿ сегѡ̀ днѐ
во всю̀ пѧтдесѧ́тницꙋ. По вхо́дѣ тропа́рь пра́здника:* ~Запеча́танꙋ гро́бꙋ: и҆
хра́ма бцⷣы, и҆ хра́ма ст҃а́гѡ. *Посе́мъ настоѧ́щагѡ ст҃а́гѡ, а҆́ще є҆́сть.
Та́же конда́къ хра́ма ст҃а́гѡ. Сла́ва: ст҃а́гѡ: И҆ ны́нѣ: пра́здника:*
~Любопы́тною десни́цею: *Хра́ма же хрⷭ҇то́ва, и҆ бцⷣы конда́къ, во всю̀
пѧтдесѧ́тницꙋ не глаго́лемъ. Прокі́менъ а҆пⷭ҇ла, гла́съ г҃:* ~Ве́лїй гдⷭ҇ь
на́шъ, и҆ ве́лїѧ крѣ́пость є҆гѡ̀, и҆ ра́зꙋма є҆гѡ̀ нѣ́сть числа̀. *Сті́хъ:*
~Хвали́те гдⷭ҇а ꙗ҆́кѡ бл҃гъ: *А҆пⷭ҇лъ дѣѧ́нїй, зача́ло ѳ҃:* ~Речѐ пе́тръ къ
лю́демъ: пока́йтесѧ: *А҆ллилꙋ́їа, гла́съ и҃:* ~Прїиди́те, возра́дꙋемсѧ гдⷭ҇ви:
*Сті́хъ:* ~Ꙗ҆́кѡ бг҃ъ ве́лїй гдⷭ҇ь, и҆ цр҃ь ве́лїй по все́й землѝ. *Є҆ѵⷢ҇лїе
і҆ѡа́нна, зача́ло ѕ҃:* ~Бра́къ бы́сть въ ка́нѣ галїле́йстѣй: *Прича́стенъ:*
~Похвалѝ і҆ерꙋсали́ме гдⷭ҇а:
*И҆ во всю̀ седми́цꙋ та́кѡ твори́мъ, и҆ во всю̀ пѧтдесѧ́тницꙋ во всѧ̑ недѣ̑ли.
И҆ про́чее послѣ́дованїе лїтꙋргі́и. И҆ ѿпꙋ́стъ.*
*Въ понедѣ́льникъ ве́чера,*
*на* ~Гдⷭ҇и воззва́хъ: *поста́вимъ стїхѡ́въ ѕ҃, и҆ пое́мъ стїхи̑ры подѡ́бны,
гла́съ д҃. Подо́бенъ:* ~Ꙗ҆́кѡ до́блѧ:
~Воскре́съ и҆з̾ гро́ба, заключє́ннымъ две́ремъ, предста́лъ є҆сѝ дрꙋгѡ́мъ
твои̑мъ всеси́льне, и҆ ѳѡмѣ̀ невѣ́ровавшꙋ, гвозде́й показа́лъ є҆сѝ ꙗ҆́звы, и҆
ребра̀ є҆́же ѿ копїѧ̀ прободе́нїе, ᲂу҆твержда́ѧ и҆ ᲂу҆вѣрѧ́ѧ того̀ сло́ве, ꙗ҆́кѡ
<<м҃з: 93>> ты̀ са́мъ є҆сѝ, за милосе́рдїе претерпѣ́вый спаси́тєльныѧ стра́сти.
~За мно́гое снизхожде́нїе, и҆ милосе́рдїе безмѣ́рное, моѐ зрѧ̀ и҆стоща́нїе не
ᲂу҆сꙋмни́сѧ, но ᲂу҆вѣ́рисѧ бли́знче, гдⷭ҇ь речѐ: ꙗ҆́кѡ са́мъ є҆́смь а҆́зъ
пострада́вый, и҆ тридне́венъ и҆з̾ гро́ба воскресы́й, и҆ а҆́дова сокрѡ́вища
и҆стощи́вый, и҆ ѡ҆живи́вый ѿ вѣ́ка ᲂу҆ме́ршыѧ.
~Оу҆диви́всѧ ꙗ҆́кѡ ᲂу҆зрѣ̀ ѳѡма̀ возопѝ, є҆гда̀ ви́дѣ тѧ̀ всеси́льне: ты̀ є҆сѝ
бг҃ъ мо́й и҆ гдⷭ҇ь, вѣ́рꙋю чл҃вѣколю́бче, ꙗ҆́кѡ са́мъ є҆сѝ пострада́вый, и҆
стра̑сти и҆сцѣлѧ́ѧй дꙋ́шъ на́шихъ. кла́нѧюсѧ твое́й держа́вѣ, и҆ мі́рови
возвѣща́ю стра́шное твоѐ и҆ всеси́льное воста́нїе.
*И҆ мине́и г҃. Сла́ва, и҆ ны́нѣ: гла́съ а҃:*
~Оу҆ченикѡ́мъ сомнѧ́щымсѧ, во ѻ҆смы́й де́нь предста̀ сп҃съ, и҆дѣ́же бѧ́хꙋ
со́брани, и҆ ми́ръ да́въ, ѳѡмѣ̀ возопѝ: прїидѝ а҆пⷭ҇ле, ѡ҆сѧжѝ дла̑ни, въ ни́хже
гвѡ́здїѧ вонзо́ша. ѽ до́брое невѣ́рїе ѳѡмино̀, вѣ́рныхъ сердца̀ въ позна́нїе
приведѐ и҆ со стра́хомъ возопѝ: гдⷭ҇ь мо́й и҆ бг҃ъ мо́й, сла́ва тебѣ̀.
*Свѣ́те ти́хїй:*
*На __стїхо́внѣ__ стїхи̑ры, гла́съ а҃:*
~Ѡ҆быди́те лю́дїе сїѡ́нъ, и҆ ѡ҆б̾ими́те є҆го̀, и҆ дади́те сла́вꙋ въ не́мъ
воскре́сшемꙋ и҆з̾ ме́ртвыхъ: ꙗ҆́кѡ то́й є҆́сть бг҃ъ на́шъ, и҆збавле́й на́съ ѿ
беззако́нїй на́шихъ.
*Сті́хъ:* ~Къ тебѣ̀ воздвиго́хъ ѻ҆́чи моѝ.
~Ꙗ҆́кѡ помышле́нїи лꙋка́выми, и҆ дѣ́лы ѡ҆сꙋди́хсѧ сп҃се, мы́сль мнѣ̀ да́рꙋй
ѡ҆браще́нїѧ бж҃е, да зовꙋ̀: спаси́ мѧ бл҃годѣ́телю бл҃гі́й, и҆ поми́лꙋй мѧ̀.
<<м҃з ѡ҆б.: 94>>
*Сті́хъ:* ~Поми́лꙋй на́съ гдⷭ҇и, поми́лꙋй на́съ:
*Мꙋ́чениченъ:*
~Є҆́же на сꙋди́щи ва́ше и҆сповѣ́данїе ст҃і́и, де́мѡнѡвъ ѡ҆плева̀ си́лꙋ, и҆ ѿ
пре́лести человѣ́ки свободѝ. тѣ́мже и҆ глава́мъ ᲂу҆сѣка́ємымъ, взыва́сте: да
бꙋ́детъ, гдⷭ҇и, же́ртва дꙋ́шъ на́шихъ бл҃гопрїѧ́тна пред̾ тобо́ю, ꙗ҆́кѡ тебѐ
возлюби́вше неради́хомъ ѡ҆ вре́менной жи́зни, чл҃вѣколю́бче.
*Сла́ва, и҆ ны́нѣ: гла́съ в҃:*
~По воста́нїи твое́мъ гдⷭ҇и, собра̑ннымъ ᲂу҆ченикѡ́мъ твои́мъ, и҆ две́ремъ
заключє́ннымъ, посредѣ̀ ста́лъ є҆сѝ, ми́ръ подаѧ̀ и҆̀мъ: вѣ́ровавъ же и҆ ѳѡма̀,
зрѣ́нїемъ рꙋкꙋ̀ и҆ ре́бръ твои́хъ, гдⷭ҇а и҆ бг҃а тѧ̀ и҆сповѣ́да, спаса́ющаго
ᲂу҆пова́ющыѧ на тѧ̀, чл҃вѣколю́бче.
~Ны́нѣ ѿпꙋща́еши: *Тропа́рь пра́здника:* ~Запеча́танꙋ гро́бꙋ: *И҆ ѿпꙋ́стъ.*
*Во вто́рникъ вторы́ѧ седми́цы, на ᲂу҆́трени,*
*на* ~Бг҃ъ гдⷭ҇ь: *тропа́рь пра́здника, три́жды.*
*По а҃-мъ стїхосло́вїи, сѣда́ленъ, гла́съ а҃.*
*Подо́бенъ:* ~Ка́мени запеча́танꙋ:
~Жєны̀ ко гро́бꙋ прїидо́ша ᲂу҆ра́ншыѧ, и҆ а҆́гг҃льское ꙗ҆вле́нїе ви́дѣвшыѧ
трепета́хꙋ: гро́бъ ѡ҆блиста̀ жи́знь, чꙋ́до ᲂу҆дивлѧ́ше ѧ҆̀. сегѡ̀ ра́ди ше́дшыѧ,
ᲂу҆ченикѡ́мъ проповѣ́дахꙋ воста́нїе: а҆́дъ плѣнѝ хрⷭ҇то́съ, ꙗ҆́кѡ є҆ди́нъ
крѣ́покъ и҆ си́ленъ, и҆ и҆стлѣ́вшыѧ всѧ̑ совоздви́же, ѡ҆сꙋжде́нїѧ стра́хъ
разрꙋши́въ крⷭ҇то́мъ. <<м҃и: 95>>
*Сті́хъ:* ~Гдⷭ҇и да не ꙗ҆́ростїю твое́ю ѡ҆бличи́ши менѐ, нижѐ гнѣ́вомъ твои́мъ
нака́жеши менѐ.
~А҆́ще пра́ведникъ є҆два̀ спаса́етсѧ, а҆́зъ грѣ́шный гдѣ̀ ꙗ҆влю́сѧ, тѧготы̀ и҆
ва́ра дневна́гѡ не поне́сшїй; но съ нае́мники є҆динонадесѧ́тагѡ часа̀ причти́ мѧ
бж҃е, и҆ спаси́ мѧ.
*Сті́хъ:* ~Ди́венъ бг҃ъ во ст҃ы́хъ свои́хъ, бг҃ъ і҆и҃левъ.
*Мꙋ́чениченъ:* ~Ꙗ҆́кѡ до́брїи во́ини є҆диномꙋ́дреннѡ вѣ́ровавше, преще́нїѧ
мꙋчи́телей не ᲂу҆боѧ́вшесѧ ст҃і́и, прїидо́сте ᲂу҆се́рднѡ ко хрⷭ҇тꙋ̀, взе́мше
честны́й крⷭ҇тъ, и҆ сконча́вше тече́нїе, съ нб҃сѐ побѣ́дꙋ прїѧ́сте. сла́ва
ᲂу҆крѣ́пльшемꙋ вы̀: сла́ва вѣнча́вшемꙋ вы̀: сла́ва дѣ́йствꙋющемꙋ ва́ми всѣ̑мъ
и҆сцѣлє́нїѧ.
*Сла́ва, и҆ ны́нѣ: бг҃оро́диченъ:*
~Нерꙋши́мꙋю стѣ́нꙋ и҆мꙋ́ще вѣ́рнїи бцⷣꙋ мр҃і́ю, прїиди́те поклони́мсѧ, и҆
припаде́мъ є҆́й: дерзнове́нїе бо и҆́мать къ ро́ждшемꙋсѧ и҆з̾ неѧ̀, и҆ моли́ти,
и҆ спаса́ти ѿ гнѣ́ва и҆ сме́рти дꙋ́шы на́шѧ.
*По в҃-мъ стїхосло́вїи сѣда́ленъ, гла́съ є҃.*
*Подо́бенъ:* ~Собезнача́льное сло́во:
~А҆пⷭ҇ла всѝ и҆ ᲂу҆ченика̀ хрⷭ҇то́ва восхва́лимъ пѣ́сньми въ па́мѧть є҆гѡ̀:
бг҃олѣ́пнѡ бо на́шѧ помышлє́нїѧ, то́й ꙗ҆́звы гвозде́й ѡ҆сѧза́въ, и҆звѣ́стнꙋ
вѣ́рꙋ и҆зыска́въ,ᲂу҆твердѝ въ мі́рѣ, и҆ мо́литъ сп҃са, поми́ловатисѧ дꙋша́мъ
на́шымъ.
*Сла́ва и҆ ны́нѣ: то́йже.* <<м҃и ѡ҆б.: 96>>
*Та́же,* ~Воскрⷭ҇нїе хрⷭ҇то́во: *Ѱало́мъ н҃. Канѡ́нъ пра́здника со і҆рмосы̀ на
и҃: и҆ мине́и на д҃. По г҃-й пѣ́сни, сѣда́ленъ мине́и. Конда́къ и҆
є҆ѯапостїла́рїй пра́здника.*
*На __хвали́техъ__, стїхи̑ры на д҃, гла́съ а҃:*
~Крⷭ҇тъ претерпѣ́вый, и҆ сме́рть ᲂу҆праздни́вый, и҆ воскресы́й и҆з̾ ме́ртвыхъ,
ᲂу҆мирѝ на́шꙋ жи́знь гдⷭ҇и, ꙗ҆́кѡ є҆ди́нъ всеси́ленъ. *[Два́жды.]*
~Не пренебрезѝ менѐ сп҃се мо́й, лѣ́ностїю грѣхо́вною содержи́ма: воздви́гни моѐ
помышле́нїе къ покаѧ́нїю, и҆ твоегѡ̀ вїногра́да дѣ́лателѧ и҆скꙋ́сна покажи́ мѧ,
да́рꙋѧ мѝ є҆динонадесѧ́тагѡ часа̀ мздꙋ̀, и҆ ве́лїю ми́лость.
*Мꙋ́чениченъ:* ~Сі́и во́ини цр҃ѧ̀ вели́кагѡ, сопроти́вишасѧ повелѣ́нїємъ
мꙋчи́телей до́блественнѡ, небрего́ша ѡ҆ мꙋ́кахъ, и҆ пре́лесть всю̀ попра́вше,
досто́йнѡ вѣнча́ни бы́вше, про́сѧтъ ᲂу҆ сп҃са ми́ра, и҆ ве́лїѧ ми́лости.
*Сла́ва, и҆ ны́нѣ: гла́съ в҃:*
~Две́ремъ заключє́ннымъ, предста́въ сп҃съ ᲂу҆ченикѡ́мъ, безстра́шїе и҆ ми́ръ
даѧ́ше. та́же глаго́летъ ѳѡмѣ̀: что̀ мнѣ̀ не вѣ́рꙋеши, ꙗ҆́кѡ воскресо́хъ и҆з̾
ме́ртвыхъ; принесѝ сѣ́мѡ рꙋ́кꙋ твою̀, и҆ вложѝ въ ре́бра моѧ̑, и҆ ви́ждь. тебѣ́
бо невѣ́рꙋющꙋ, всѝ навыко́ша стрⷭ҇ти и҆ воскресе́нїе моѐ зва́ти съ тобо́ю: гдⷭ҇ь
мо́й и҆ бг҃ъ мо́й, сла́ва тебѣ̀.
*На __стїхо́внѣ__ стїхи̑ры пра́здника, гла́съ в҃.*
*Подо́бенъ:* ~До́ме є҆ѵфра́ѳовъ:
~Воспои́мъ вѣ́рнїи, непреста́ннѡ со а҆́гг҃лы, хрⷭ҇та̀ воскре́сшаго, тридне́вна
и҆з̾ гро́ба, и҆ мі́ръ совоздви́гшаго. <<м҃ѳ: 97>>
*Сті́хъ:* ~Во всю̀ зе́млю и҆зы́де вѣща́нїе и҆́хъ, и҆ въ концы̀ вселе́нныѧ
глаго́лы и҆́хъ.
~Ѳѡма̀ твоѧ̑ ре́бра, бл҃гоꙋтро́бне, ѡ҆сѧза́въ, къ вѣ́рѣ взы́де: и҆ мы̀ тѣ́мъ
тѧ̀ бг҃а про́чее позна́хомъ.
*Сті́хъ:* ~Небеса̀ повѣ́даютъ сла́вꙋ бж҃їю, творе́нїе же рꙋкꙋ̀ є҆гѡ̀
возвѣща́етъ тве́рдь.
~Подае́ши ѽ и҆зба́вителю, ми́ръ лю́демъ твои̑мъ воскре́съ и҆з̾ гро́ба, и҆ мі́ръ
совоздви́гнꙋвый ѿ а҆́да, всеси́льне.
*Сла́ва, и҆ ны́нѣ: гла́съ ѕ҃. І҆ѡа́нна мона́ха:*
~Две́ремъ заключє́ннымъ, прише́лъ є҆сѝ хрⷭ҇тѐ ко ᲂу҆ченикѡ́мъ, тогда̀ ѳѡма̀
смотри́тельнѡ не ѡ҆брѣ́тесѧ съ ни́ми. глаго́лаше бо: не и҆мꙋ̀ вѣ́ры, а҆́ще не
ᲂу҆ви́ждꙋ и҆ а҆́зъ влⷣки. ᲂу҆ви́ждꙋ ребро̀, ѿѻнꙋ́дꙋже и҆зы́де кро́вь, вода̀,
кр҃ще́нїе: ᲂу҆ви́ждꙋ ꙗ҆́звꙋ, ѿ неѧ́же и҆сцѣлѣ̀ вели́кїй стрꙋ́пъ человѣ́ческїй:
ᲂу҆ви́ждꙋ, ка́кѡ не бѣ̀ ꙗ҆́коже дꙋ́хъ, но пло́ть и҆ кѡ́сти. сме́рть попра́вый,
и҆ ѳѡмꙋ̀ ᲂу҆вѣ́ривый, гдⷭ҇и сла́ва тебѣ̀.
*Ѿпꙋсти́тельный тропа́рь, и҆ ѿпꙋ́стъ.*
*Во вто́рникъ ве́чера,*
*на* ~Гдⷭ҇и воззва́хъ: *поста́вимъ стїхѡ́въ ѕ҃, и҆ пое́мъ стїхи̑ры, гла́съ а҃.*
*Подо́бенъ:* ~Прехва́льнїи мꙋ́чєницы:
~Ѡ҆сѧжѝ, глаго́летъ ѳѡмѣ̀, и҆з̾ ме́ртвыхъ тридне́венъ воскресы́й
чл҃вѣколю́бецъ, и҆ ви́ждь рꙋкꙋ̀ мое́ю и҆ нѡгꙋ̀ ꙗ҆́звы, и҆ ре́бръ прободе́нїе: и҆
позна́й мѧ̀ бг҃а непремѣ́нна, <<м҃ѳ ѡ҆б.: 98>> земны́мъ смѣше́нїемъ по сꙋществꙋ̀
воѡбраже́нна и҆ стра́сть въ не́мъ прїе́мша.
~Недоꙋмѣва́шесѧ близне́цъ, ꙗ҆́звы зрѧ̀ ножны̑ѧ, и҆ рꙋчна̑ѧ вонзє́нїѧ, и҆ бѧ́ше
ᲂу҆жаса́емь стра́шнымъ чꙋ́домъ: и҆ рꙋко́ю пречи́стое ребро̀ и҆ ѡ҆сѧза́ѧ и҆
ви́дѧ, и҆з̾ ни́хже показа̀ несꙋмнѣ́нное ꙗ҆зы́кѡмъ, є҆́же и҆з̾ гро́ба тридне́вное
воста́нїе.
~Прїе́млю превели́кое ра́дованїе, твоѐ сп҃се мо́й воста́нїе и҆звѣствꙋ́емое
ви́дѧ: ѿ ни́хже сподо́бисѧ де́рзѡстнымъ ве́щемъ ѳѡма̀ прикоснꙋ́тисѧ. тѣ́мже тѧ̀
про́ста проповѣ́дꙋемъ бг҃а и҆ человѣ́ка, дѣ̑йства два̀ носѧ́ща сꙋ́ществєнна, ѿ
ни́хже сложи́лсѧ є҆сѝ.
*И҆ мине́и, г҃. Сла́ва, и҆ ны́нѣ: гла́съ д҃:*
~Гдⷭ҇и, нестерпи́мымъ твоегѡ̀ бжⷭ҇тва̀ блиста́нїемъ, две́ремъ прише́лъ є҆сѝ
сꙋ́щымъ заключє́ннымъ, и҆ ста́въ посредѣ̀ ᲂу҆ченикѡ́въ, ребро̀ ѡ҆бнажи́лъ є҆сѝ,
и҆ ꙗ҆́звъ твое́ю рꙋкꙋ̀ и҆ нѡгꙋ̀ стрꙋ́пы ꙗ҆влѧ́ѧ, печа́ль же и҆ ско́рбь
разрѣша́ѧ, ꙗ҆́вѣ возгласи́лъ є҆сѝ: и҆́мже ѻ҆́бразомъ во мнѣ̀ ви́дите, ѽ дрꙋ́зи,
пло́ти прїѧ́тїе, не дꙋ́ха ношꙋ̀ є҆стество̀. сомнѧ́щемꙋ же сѧ ᲂу҆ченикꙋ̀
повелѣва́лъ є҆сѝ ѡ҆сѧза́ти тре́петнѡ, ре́къ: и҆спыта́въ всѧ̑, грѧдѝ про́чее не
сꙋмни́сѧ. ѻ҆́нъ же ѡ҆щꙋща́ѧ рꙋко́ю твоѐ сꙋгꙋ́бое сꙋщество̀, со стра́хомъ
вопїѧ́ше вѣ́рнѡ, вѣ́рою влеко́мь: гдⷭ҇ь мо́й и҆ бг҃ъ мо́й сла́ва тебѣ̀.
*Свѣ́те ти́хїй:*
*На __стїхо́внѣ__ стїхи́ра крⷭ҇тна, гла́съ а҃:*
~Крⷭ҇тъ водрꙋзи́сѧ на ло́бнѣмъ, и҆ процвѣтѐ на́мъ безсме́ртїе ѿ и҆сто́чника
приснотекꙋ́щагѡ ребра̀ сп҃сова. <<н҃: 99>>
*Сті́хъ:* ~Къ тебѣ̀ возведо́хъ ѻ҆́чи моѝ:
~Прїиди́те лю́дїе воспои́мъ, и҆ поклони́мсѧ хрⷭ҇тꙋ̀, сла́вѧще є҆гѡ̀ є҆́же и҆з̾
ме́ртвыхъ воскресе́нїе, ꙗ҆́кѡ то́й є҆́сть бг҃ъ на́шъ, ѿ пре́лести вра́жїѧ мі́ръ
и҆збавле́й.
*Сті́хъ:* ~Поми́лꙋй на́съ гдⷭ҇и, поми́лꙋй на́съ:
*Мꙋ́чениченъ: Ѽ* до́брыѧ кꙋ́пли ва́шеѧ ст҃і́и! ꙗ҆́кѡ крѡ́ви да́сте, и҆ нб҃са̀
наслѣ́довасте, и҆ привре́меннѡ и҆скꙋси́вшесѧ, вѣ́чнѡ веселите́сѧ. вои́стиннꙋ
добра̀ ва́ша кꙋ́плѧ: тлѣ̑ннаѧ бо ѡ҆ста́вльше, нетлѣ̑ннаѧ воспрїѧ́сте, и҆ со
а҆́гг҃лы ликꙋ́юще, пое́те непреста́ннѡ трⷪ҇цꙋ є҆диносꙋ́щнꙋю.
*Сла́ва, и҆ ны́нѣ: гла́съ и҃:*
~Прикосни́сѧ ѳѡмо̀ рꙋко́ю ре́брѡмъ, глаго́летъ хрⷭ҇то́съ, и҆ ꙗ҆́звы гвозде́й
прїидѝ ѡ҆сѧжѝ: вѣ́рою и҆спыта́й, и҆ бꙋ́ди мѝ вѣ́ренъ, и҆ не бꙋ́ди невѣ́ренъ.
ѳѡма́ же пе́рстомъ ꙗ҆́кѡ прикоснꙋ́сѧ влⷣцѣ, вельмѝ возопѝ: ты̀ мо́й бг҃ъ и҆
гдⷭ҇ь, бл҃гоꙋтро́бне сла́ва тебѣ̀.
*Та́же,* ~Ны́нѣ ѿпꙋща́еши: *Ѿпꙋсти́тельный тропа́рь:* ~Запеча́танꙋ гро́бꙋ:
*Є҆ктенїа̀ и҆ ѿпꙋ́стъ.*
[зрѝ] *Вѣ́стно бꙋ́ди, ꙗ҆́кѡ въ сре́ды и҆ пѧткѝ предварѧ́ютъ стїхи̑ры крє́стныѧ,
та́кожде и҆ сѣда́льны воскре́сны: зане́же гдⷭ҇ь на́шъ пе́рвѣе распѧ́сѧ, посе́мъ
же воскре́се и҆з̾ ме́ртвыхъ.*
~Въ сре́дꙋ вторы́ѧ седми́цы на ᲂу҆́трени.
*На* ~Бг҃ъ гдⷭ҇ь: *тропа́рь пра́здника.три́жды.По а҃- мъ стїхосло́вїи,
сѣда́ленъ кре́стный, гла́съ а҃:*
~Распе́ншꙋсѧ тебѣ̀ хрⷭ҇тѐ, поги́бе мꙋчи́тельство, попра́на бы́сть си́ла
вра́жїѧ: ниже́ бо а҆́гг҃лъ, ни человѣ́къ, но са́мъ гдⷭ҇и спа́слъ є҆сѝ ны̀,
сла́ва тебѣ̀. <<н҃ ѡ҆б.: 100>>
*Сті́хъ:* ~Возноси́те гдⷭ҇а бг҃а на́шего, и҆ покланѧ́йтесѧ подно́жїю но́гꙋ
є҆гѡ̀, ꙗ҆́кѡ ст҃о є҆́сть.
~І҆саа́къ на хо́лмъ возведе́нъ бы́сть, і҆ѡ́на во глꙋбинꙋ̀ низведе́сѧ, и҆ ѻ҆́ба
стрⷭ҇ть твою̀ сп҃се ѡ҆бразова́ста. ѻ҆́въ ᲂу҆́бѡ ᲂу҆́зы и҆ заколе́нїе: ѻ҆́въ же
погребе́нїе, и҆ жи́знь пресла́внагѡ воста́нїѧ твоегѡ̀. гдⷭ҇и сла́ва тебѣ̀.
*Сті́хъ:* ~Ди́венъ бг҃ъ во ст҃ы́хъ свои́хъ, бг҃ъ і҆и҃левъ.
~Болѣ́зньми ст҃ы́хъ, и҆́миже ѡ҆ тебѣ̀ пострада́ша, ᲂу҆моле́нъ бꙋ́ди гдⷭ҇и, и҆
всѧ̑ на́шѧ болѣ̑зни и҆сцѣлѝ, чл҃вѣколю́бче, мо́лимсѧ.
*Сла́ва, и҆ ны́нѣ:* ~крⷭ҇тобг҃оро́диченъ:
~Твоѐ предста́тельство и҆мꙋ́ще пречⷭ҇таѧ, и҆ твои́ми мл҃твами лю́тыхъ
и҆збавлѧ́еми, крⷭ҇то́мъ сн҃а твоегѡ̀ вездѣ̀ соблюда́еми, по до́лгꙋ тѧ̀ всѝ
бл҃гоче́стнѡ велича́емъ.
*По в҃-мъ стїхосло́вїи, сѣда́ленъ, гла́съ а҃.*
*Подо́бенъ:* ~Гро́бъ тво́й сп҃се:
~Прикоснꙋ́выйсѧ рꙋко́ю ре́брѡмъ нестерпи̑мымъ близне́цъ ѳѡма̀, не ѡ҆пали́сѧ
прикоснꙋ́тїемъ: но пребы́сть ꙗ҆́звы ѡ҆сѧза́ѧ и҆звѣ́стнѣе, и҆ вѣща́ѧ на́съ ра́ди
прободе́нномꙋ: ты̀ мо́й гдⷭ҇ь, ты̀ и҆ бг҃ъ мо́й є҆сѝ, а҆́ще и҆ стрⷭ҇ть
претерпѣ́лъ є҆сѝ.
*Сла́ва, и҆ ны́нѣ: то́йже.*
~Воскрⷭ҇нїе хрⷭ҇то́во ви́дѣвше: *Ѱало́мъ н҃. Канѡ́нъ пра́здника, со і҆рмосо́мъ,
на и҃: и҆ мине́и на д҃. По г҃- й пѣ́сни, сѣда́ленъ мине́и, и҆ є҆ѯапостїла́рїй
пра́здника.*
*На __хвали́техъ__ настоѧ́щыѧ стїхи̑ры крє́стныѧ, на д҃. гла́съ а҃:*
~Тебѐ на дре́вѣ пригво́ждьшагосѧ, и҆ живо́тъ на́мъ пода́вшаго, ꙗ҆́кѡ сп҃са и҆
влⷣкꙋ пое́мъ непреста́ннѡ. *[Два́жды.]* <<н҃а: 101>>
~А҆́да плѣни́вый, и҆ человѣ́ка воскреси́вый, воскрⷭ҇нїемъ твои́мъ хрⷭ҇тѐ,
сподо́би на́съ чи́стымъ срⷣцемъ тебѐ пѣ́ти и҆ сла́вити.
*Мꙋ́чениченъ:* ~Ва́съ всехва́льнїи мꙋ́чєницы, ни скѡ́рби, ни тѣснота̀, ни
гла́дъ, ни гоне́нїе, нижѐ ра̑ны, ни ꙗ҆́рость ѕвѣре́й, ни ме́чь, нижѐ ѻ҆́гнь
претѧ́щїй, разлꙋчи́ти ѿ бг҃а возмого́ша: любо́вїю же па́че къ немꙋ̀, ꙗ҆́кѡ въ
чꙋжди́хъ подви́гшесѧ тѣлесѣ́хъ, є҆стество̀ забы́сте, сме́рть презрѣ́вше: тѣ́мже
и҆ по достоѧ́нїю трꙋдѡ́въ ва́шихъ мздꙋ̀ прїѧ́сте, нбⷭ҇нагѡ црⷭ҇твїѧ наслѣ̑дницы
бы́сте. и҆мꙋ́ще дерзнове́нїе къ чл҃вѣколю́бцꙋ бг҃ꙋ, мі́рови ми́ръ и҆спроси́те,
и҆ дꙋша́мъ на́шымъ ве́лїю млⷭ҇ть.
*Сла́ва и҆ ны́нѣ: гла́съ и҃:*
~Две́ремъ заключє́ннымъ, ᲂу҆ченикѡ́мъ собра̑ннымъ, предста̀ сп҃съ, и҆дѣ́же
бѧ́хꙋ со́брани, и҆ ста́въ посредѣ̀ и҆̀хъ, глаго́летъ ѳѡмѣ̀: прїидѝ, ѡ҆сѧжѝ, и҆
ви́ждь ѻ҆́бразы гвозде́й. прострѝ рꙋ́кꙋ твою̀, и҆ косни́сѧ ребрꙋ̀ моемꙋ̀, и҆ не
бꙋ́ди невѣ́ренъ, но вѣ́рою проповѣ́ждь є҆́же и҆з̾ ме́ртвыхъ моѐ воскресе́нїе.
*На __стїхо́внѣ__ стїхи̑ры, гла́съ в҃.*
*Подо́бенъ:* ~До́ме є҆ѵфра́ѳовъ:
*Ѽ* чꙋдесѐ но́вагѡ! ꙳ ѽ пресла́внагѡ ѻ҆́браза! ꙳ ка́кѡ трава̀ не ѡ҆пали́сѧ, ꙳
рꙋка̀ а҆пⷭ҇лова ѻ҆гне́мъ бжⷭ҇тва̀;
*Сті́хъ:* ~Во всю̀ зе́млю и҆зы́де:
~Потщи́мсѧ и҆ мы̀ ꙳ рꙋ́ки ѡ҆ст҃и́ти, страсте́й ᲂу҆пражне́нїемъ, ꙳ и҆ та́кѡ
влⷣчнимъ ꙳ ре́брѡмъ прико́снемсѧ.
*Сті́хъ:* ~Небеса̀ повѣ́даютъ сла́вꙋ бж҃їю: <<н҃а ѡ҆б.: 102>>
~Ѡ҆бновѝ дꙋшѐ, всѧ̑ твоѧ̑ чꙋ̑вства къ бжⷭ҇твенномꙋ зрѣ́нїю: хрⷭ҇то́съ бо си́це
хо́щетъ соверша́тисѧ ѡ҆бновле́нїємъ.
*Сла́ва, и҆ ны́нѣ: бг҃оро́диченъ, подо́бенъ:*
~Ви́ждь мѝ ᲂу҆́мнѡ, премѣне́нїе мі́ра, и҆ ᲂу҆красѝ ꙗ҆̀же внꙋ́трь,
добродѣ́тельми ꙗ҆́кѡ ли́ствїемъ дꙋшѐ, и҆ ᲂу҆краси́шисѧ.
*Та́же,* ~Бл҃го є҆́сть: *Ча́съ а҃. И҆ ѿпꙋ́стъ.*
*Въ сре́дꙋ вторы́ѧ седми́цы ве́чера,*
*на* ~Гдⷭ҇и воззва́хъ *поста́вимъ стїхѡ́въ ѕ҃. И҆ пое́мъ стїхи̑ры подо́бны,
гла́съ в҃. Подо́бенъ:* ~Є҆гда̀ ѿ дре́ва:
~Нѣ́дръ не ѡ҆ста́вль ѻ҆ч҃ескихъ, ꙗ҆ви́лсѧ є҆сѝ на землѝ плотоно́сецъ, за
бл҃гоꙋтро́бїе хрⷭ҇тѐ, стрⷭ҇ть же и҆ сме́рть прїи́мъ, воскре́слъ є҆сѝ
тридне́венъ: две́ремъ заключє́ннымъ внꙋ́трь вше́лъ є҆сѝ, ꙗ҆́кѡ всеси́ленъ.
тѣ́мже ребро̀ твоѐ бж҃е́ственное ра́дꙋѧсѧ ѳѡма̀ ѡ҆сѧза́въ, гдⷭ҇а и҆ зижди́телѧ
тѧ̀ просла́ви.
~Гвоздьмѝ пригвозди́лсѧ є҆сѝ на крⷭ҇тѣ̀, копїе́мъ въ ре́бра прободе́нъ є҆сѝ,
же́лчи вкꙋси́лъ є҆сѝ хрⷭ҇тѐ, сме́рть претерпѣ́лъ є҆сѝ, во гро́бѣ положе́нъ бы́въ
ꙗ҆́кѡ ме́ртвъ, ꙗ҆́кѡ бг҃ъ же сокрꙋши́лъ є҆сѝ ᲂу҆́зы а҆́дѡвы, и҆ совоскреси́лъ
є҆сѝ ꙗ҆̀же ѿ вѣ́ка мє́ртвыѧ. тѣ́мже печа́ти не разрꙋши́въ, твои̑мъ ᲂу҆ченикѡ́мъ
ꙗ҆ви́лсѧ є҆сѝ, твоѐ воскресе́нїе ᲂу҆вѣрѧ́ѧ.
~Па́сха настоѧ́щїй пра́здникъ: па́сха та́йнаѧ: па́сха <<н҃в: 103>>
бж҃е́ственнаѧ: па́сха сп҃си́тельнаѧ: па́сха къ безсме́ртной жи́зни преводѧ́щаѧ
на́съ: па́сха всѧ́кꙋю ско́рбь ѿе́млющаѧ ѿ среды̀: па́сха весе́лꙋю блгⷣть даю́щаѧ
ᲂу҆ченикѡ́мъ. тѣ́мже ѳѡма̀ вопїѧ́ше: гдⷭ҇ь бг҃ъ мо́й є҆сѝ, плѣни́вый а҆́дова
ца̑рствїѧ.
*И҆ мине́и, г҃. Сла́ва и҆ ны́нѣ: гла́съ д҃:*
*Ѽ* пресла́внагѡ чꙋдесѐ! невѣ́рїе вѣ́рꙋ и҆звѣ́стнꙋю родѝ: ре́клъ бо ѳѡма̀:
а҆́ще не ви́ждꙋ, не и҆мꙋ̀ вѣ́ры. ѡ҆сѧза́въ же ре́бра, бг҃осло́витъ
воплоти́вшагосѧ, того́жде сн҃а бж҃їѧ позна̀, ꙗ҆́кѡ пострада́вша пло́тїю:
проповѣ́да воскре́сшаго бг҃а, и҆ возопѝ свѣ́тлымъ гла́сомъ: гдⷭ҇ь мо́й и҆ бг҃ъ
мо́й, сла́ва тебѣ̀.
*На __стїхо́внѣ__, стїхи́ра воскре́снаѧ, гла́съ а҃:*
~Стра́стїю твое́ю хрⷭ҇тѐ, ѿ страсте́й свободи́хомсѧ, и҆ воскрⷭ҇нїемъ твои́мъ
и҆з̾ и҆стлѣ́нїѧ и҆зба́вихомсѧ: гдⷭ҇и сла́ва тебѣ̀.
*Сті́хъ:* ~Къ тебѣ̀ возведо́хъ ѻ҆́чи моѝ:
~А҆пⷭ҇льскаѧ всесли́чнаѧ цѣвни́ца, ст҃ы́мъ дх҃омъ дви́жимаѧ, безстꙋ́дныхъ
бѣсѡ́въ трє́бища ᲂу҆праздни́ла є҆́сть: и҆ є҆ди́наго гдⷭ҇а проповѣ́давши, ꙗ҆зы́ки
и҆зба́ви ѿ пре́лести і҆́дѡльскїѧ, и҆ поклонѧ́тисѧ наꙋчѝ трⷪ҇цѣ є҆диносꙋ́щнѣй.
*Сті́хъ:* ~Поми́лꙋй на́съ гдⷭ҇и, поми́лꙋй на́съ:
*Мꙋ́чениченъ:* ~Всехва́льнїи мꙋ́чєницы, ва́съ ни землѧ̀ потаи́ла є҆́сть, но
нб҃о прїѧ́тъ: ѿверзо́шасѧ ва́мъ ра́йскаѧ врата̀, и҆ внꙋ́трь бы́вше дре́ва
живо́тнагѡ наслажда́етесѧ: хрⷭ҇то́ви моли́тесѧ, дарова́ти дꙋша́мъ на́шымъ ми́ръ
и҆ ве́лїю ми́лость. <<н҃в ѡ҆б.: 104>>
*Сла́ва, и҆ ны́нѣ: гла́съ д҃:*
*Ѽ* пресла́внагѡ чꙋдесѐ! ѻ҆гню̀ трава̀ коснꙋ́вшаѧсѧ спасе́сѧ: вложи́въ бо ѳѡма̀
во ѻ҆́гненнаѧ ре́бра рꙋ́кꙋ і҆и҃са хрⷭ҇та̀ бг҃а, не ѡ҆пали́сѧ ѡ҆сѧза́нїемъ. дꙋши́
бо ѕловѣ́рство преложѝ на благовѣ́рїе, те́плѣ возопѝ ѿ глꙋбины̀ дꙋше́вныѧ: влⷣка
ты̀ мо́й є҆сѝ и҆ бг҃ъ, и҆з̾ ме́ртвыхъ воскресы́й, сла́ва тебѣ̀.
*Та́же,* ~Ны́нѣ ѿпꙋща́еши: *Трист҃о́е: и҆ по* ~Ѻ҆́ч҃е на́шъ: *тропа́рь
пра́здника, и҆ ѿпꙋ́стъ.*
*Въ четверто́къ вторы́ѧ седми́цы на ᲂу҆́трени,*
*на* ~Бг҃ъ гдⷭ҇ь: *тропа́рь пра́здника, три́жды.*
*По а҃-мъ стїхосло́вїи, сѣда́ленъ, гла́съ а҃.*
*Подо́бенъ:* ~Ка́мени запеча́танꙋ:
~На крⷭ҇тѣ̀ пригвозди́лсѧ є҆сѝ животѐ всѣ́хъ, и҆ въ ме́ртвыхъ вмѣни́лсѧ є҆сѝ,
безсме́ртный гдⷭ҇и: воскре́слъ є҆сѝ тридне́венъ сп҃се, совоздви́гъ а҆да́ма ѿ
тлѣ́нїѧ. сегѡ̀ ра́ди си̑лы нбⷭ҇ныѧ вопїѧ́хꙋ тебѣ̀ жизнода́вче: сла́ва
бж҃е́ственной стра́сти твое́й хрⷭ҇тѐ: сла́ва воскрⷭ҇нїю твоемꙋ̀: сла́ва
снизхожде́нїю твоемꙋ̀, є҆ди́не чл҃вѣколю́бче
*Сті́хъ:* ~Во всю̀ зе́млю и҆зы́де вѣща́нїе и҆́хъ:
~Премꙋ́дрїи вселе́нныѧ ловцы̀, ѿ бг҃а прїе́мше ми́лостивное, моли́тесѧ и҆ ны́нѣ
ѡ҆ на́съ вопїю́щихъ: гдⷭ҇и, спасѝ лю́ди твоѧ̀, и҆ гра́дъ тво́й, и҆ ѿ
содержа́щихъ лю́тыхъ свободѝ а҆по́столми дꙋ́шы на́шѧ.
*Сті́хъ:* ~Ди́венъ бг҃ъ во ст҃ы́хъ свои́хъ: <<н҃г: 105>>
*Мꙋ́чениченъ: Подо́бенъ:* ~Гро́бъ:
~Мꙋ́ченики хрⷭ҇тѡ́вы мо́лимъ всѝ, ті́и бо ѡ҆ на́шемъ спасе́нїи про́сѧтъ, и҆ всѝ
пристꙋ́пимъ къ ни́мъ съ вѣ́рою. сі́и и҆сточа́ютъ и҆сцѣле́нїй бл҃года́ть, сі́и
полкѝ ѿгонѧ́ютъ де́мѡнскїѧ, ꙗ҆́кѡ храни́телїе вѣ́ры.
*Сла́ва, и҆ ны́нѣ: бг҃оро́диченъ:*
~Проро́цы тѧ̀ ꙗ҆́вственнѡ предвозвѣсти́ша ѻ҆трокови́це мт҃рь бж҃їю, и҆ а҆пⷭ҇ли
бж҃е́ственнїи въ мі́рѣ проповѣ́даша, мы̀ вѣ́ровахомъ. тѣ́мже всѝ
бл҃гочестномꙋ́дреннѡ почита́юще воспѣва́емъ тѧ̀, и҆ бцⷣꙋ гдⷭ҇ьственнѡ при́снѡ
и҆менꙋ́емъ.
*По в҃-мъ стїхосло́вїи, сѣда́ленъ, гла́съ а҃.*
*Подо́бенъ:* ~Гро́бъ тво́й сп҃се:
~Ви́дѣвъ моѧ̑ ре́бра, не невѣ́рꙋй мѝ бо́лѣе, сло́во ѳѡмѣ̀ невѣ́рꙋющемꙋ
вопїѧ́ше, пе́рстомъ мѧ̀ ѡ҆сѧжѝ, и҆ рꙋко́ю и҆спыта́й: и҆ ᲂу҆вѣ́дѣвъ мои́хъ ꙗ҆́звъ
зна́мєнїѧ, мі́рови проповѣ́ждь живоно́сное моѐ сїѐ є҆́же и҆з̾ гро́ба воскрⷭ҇нїе.
*Сла́ва, и҆ ны́нѣ, то́йже.* ~Воскрⷭ҇нїе хрⷭ҇то́во: *Ѱало́мъ н҃. Канѡ́нъ
пра́здника, со і҆рмосы̀ на и҃: и҆ мине́и на д҃. По г҃-й пѣ́сни, сѣда́ленъ
мине́и. Конда́къ, и҆ є҆ѯапостїла́рїй пра́здника.*
*На __хвали́техъ__ стїхи̑ры, на д҃, гла́съ а҃.*
*Воскре́сна:*
~Бг҃олѣ́пное твоѐ снизхожде́нїе сла́вѧще, пое́мъ тѧ̀ хрⷭ҇тѐ, роди́лсѧ є҆сѝ ѿ
дв҃ы, и҆ неразлꙋче́нъ бы́лъ є҆сѝ ѿ ѻ҆ц҃а̀, пострада́лъ є҆сѝ ꙗ҆́кѡ человѣ́къ, и҆
во́лею претерпѣ́лъ є҆сѝ кре́стъ, воскре́слъ є҆сѝ ѿ гро́ба, ꙗ҆́кѡ ѿ черто́га
произше́дъ, да спасе́ши мі́ръ, гдⷭ҇и сла́ва тебѣ̀. *[Два́жды.]* <<н҃г ѡ҆б.:
106>>
~Петра̀ и҆ па́ѵла, согла́снѡ восхва́лимъ, лꙋкꙋ̀, матѳе́а, ма́рка, і҆ѡа́нна,
а҆ндре́а, ѳѡмꙋ̀, варѳоломе́а, сі́мѡна канані́та, і҆а́кѡва, фїлі́ппа: и҆ всѐ
собра́нїе ᲂу҆ченикѡ́въ досто́йнѡ да благопохва́лимъ.
*Мꙋ́чениченъ:* ~Ра́дꙋйтесѧ мꙋ́ченицы ѡ҆ гдⷭ҇ѣ, ꙗ҆́кѡ по́двигомъ до́брымъ
подвиза́стесѧ, сопроти́вистесѧ царє́мъ, и҆ мꙋчи́тели побѣди́сте, ѻ҆гнѧ̀ и҆ меча̀
не ᲂу҆боѧ́стесѧ, ѕвѣрє́мъ ди́вїимъ снѣда́ющымъ тѣлеса̀ ва̑ша, хрⷭ҇тꙋ̀ со
а҆́гг҃лы пѣ́нїе возсыла́юще, ꙗ҆̀же ѿ нб҃съ вѣнцы̀ прїѧ́сте, проси́те ми́ръ
мі́рови дарова́ти, и҆ дꙋша́мъ на́шымъ ве́лїю млⷭ҇ть.
*Сла́ва, и҆ ны́нѣ: гла́съ д҃:*
*Ѽ* пресла́внагѡ чꙋдесѐ! і҆ѡа́ннъ на пе́рси сло́ва возлежѐ, ѳѡма́ же ре́бра
ѡ҆сѧза́ти сподо́бисѧ. но ѻ҆́въ ᲂу҆́бѡ ѿѻнꙋ́дꙋ стра́шнѡ, бг҃осло́вїѧ глꙋбо́кое
и҆звлечѐ смотре́нїе: ѻ҆́въ же сподо́бисѧ тайноꙋчи́ти на́съ, представлѧ́етъ
показа́нїе ꙗ҆́снѡ воста́нїѧ є҆гѡ̀, вопїѧ̀: гдⷭ҇ь мо́й и҆ бг҃ъ мо́й, сла́ва
тебѣ̀.
*На __стїхо́внѣ__ стїхи̑ры, гла́съ в҃.*
*Подо́бенъ:* ~До́ме є҆ѵфра́ѳовъ:
~Печа́ль страсте́й, и҆ помышле́нїй бꙋ́рѧ, дале́че да ѿжене́тсѧ, и҆ та́кѡ
процвѣте́тъ весна̀ вѣ́ры.
*Сті́хъ:* ~Во всю̀ зе́млю и҆зы́де вѣща́нїе и҆́хъ:
~Ꙗ҆ви́лсѧ є҆сѝ сп҃се, сщ҃є́ннымъ твои́мъ а҆пⷭ҇лѡмъ, две́ремъ заключє́ннымъ,
тѣ́ми ѡ҆бновлѧ́ѧ на́мъ бж҃е́ственный дх҃ъ дне́сь.
*Сті́хъ:* ~Нб҃са̀ повѣ́даютъ сла́вꙋ бж҃їю: <<н҃д: 107>>
~Ны́нѣ тѧ̀ всецр҃ю̀, ви́дѣвше не ѻ҆чи́ма, но серде́чною любо́вїю, бг҃а
вѣ́ровавше пѣ́сньми велича́емъ.
*Сла́ва, и҆ ны́нѣ, гла́съ ѕ҃:*
~По дне́хъ ѻ҆сми́хъ воста́нїѧ твоегѡ̀, і҆и҃се цр҃ю̀, є҆диноро́дный сло́ве
ѻ҆́ч҃їй, ꙗ҆ви́лсѧ є҆сѝ ᲂу҆ч҃нкѡ́мъ твои̑мъ, заключє́ннымъ две́ремъ, ми́ръ тво́й
подаѧ̀. и҆ невѣ́рꙋющемꙋ ᲂу҆ченикꙋ̀ зна́мєнїѧ показа́лъ є҆сѝ: прїидѝ, и҆ ѡ҆сѧжѝ
рꙋ́цѣ и҆ но́зѣ, и҆ нетлѣ̑ннаѧ моѧ̑ ре́бра. ѻ҆́нъ же вѣ́ровавъ, вопїѧ́ше тебѣ̀:
гдⷭ҇ь мо́й и҆ бг҃ъ мо́й, сла́ва тебѣ̀.
*Ча́съ а҃-й. И҆ ѿпꙋ́стъ.*
*Въ четверто́къ вторы́ѧ седми́цы ве́чера,*
*на* ~Гдⷭ҇и воззва́хъ: *поста́вимъ стїхѡ́въ ѕ҃. И҆ пое́мъ стїхи̑ры подо́бны,
гла́съ а҃.*
*Подо́бенъ:* ~Нбⷭ҇ныхъ чинѡ́въ:
~Пра́вды ѻ҆де́ждею ѡ҆бложе́ни бѣ́лою па́че снѣ́га, въ настоѧ́щїй па́схи де́нь
возвесели́мсѧ, во́ньже хрⷭ҇то́съ ꙗ҆́кѡ пра́вды сл҃нце, ѿ ме́ртвыхъ возсїѧ́въ,
всѣ́хъ на́съ нетлѣ́нїемъ ᲂу҆ѧснѝ.
~Цр҃ь и҆ гдⷭ҇ь, пра́здникѡвъ пра́здникъ ны́нѣшнїй є҆́сть де́нь, є҆го́же
вои́стиннꙋ сотворѝ гдⷭ҇ь: во́нь, ꙗ҆́коже пое́тъ дв҃дъ, та́инственнѡ
возвесели́мсѧ лю́дїе, две́ремъ бо заключє́ннымъ, ᲂу҆ченикѡ́мъ ми́ръ дарова̀.
~Ѳѡмино̀ невѣ́рїе, мїроспаси́тельное бг҃очеловѣ́ка сло́ва, є҆́же ѿ а҆́довы
темни́цы воста́нїе ᲂу҆вѣрѧ́етъ, ꙗ҆́звы рꙋ́къ <<н҃д ѡ҆б.: 108>> и҆ но́гъ
де́рзостнѣе ѡ҆сѧза́вшее, ко ᲂу҆вѣре́нїю мїрско́мꙋ, десни́цею любопы́тною.
*И҆ мине́и, г҃. Сла́ва, и҆ ны́нѣ: гла́съ в҃:*
~Две́ремъ заключє́ннымъ, предста́въ і҆и҃съ ᲂу҆ченикѡ́мъ, безстра́шїе и҆ ми́ръ
даѧ́ше. та́же глаго́летъ ѳѡмѣ̀: почто̀ мѝ не вѣ́рꙋеши, ꙗ҆́кѡ воскресо́хъ и҆з̾
ме́ртвыхъ; принесѝ сѣ́мѡ рꙋ́кꙋ твою̀, и҆ вложѝ въ ре́бра моѧ̑, и҆ ви́ждь: тебѣ́
бо невѣ́рꙋющꙋ, всѝ навыко́ша стра́сти и҆ воскресе́нїе моѐ зва́ти съ тобо́ю:
гдⷭ҇ь мо́й и҆ бг҃ъ мо́й, сла́ва тебѣ̀.
*Свѣ́те ти́хїй: На __стїхо́внѣ__ стїхи̑ры, гла́съ а҃.*
*Крⷭ҇тнаѧ:* ~Неразрꙋши́маѧ стѣна̀ на́мъ є҆́сть честны́й крⷭ҇тъ сп҃совъ: на́нь
бо надѣ́ющесѧ, спаса́емсѧ, всѝ.
*Сті́хъ:* ~Къ тебѣ̀ возведо́хъ ѻ҆́чи моѝ:
*Воскре́сна:* ~Вечє́рнїѧ на́шѧ моли̑твы прїимѝ ст҃ы́й гдⷭ҇и, и҆ пода́ждь на́мъ
ѡ҆ставле́нїе грѣхѡ́въ, ꙗ҆́кѡ є҆ди́нъ є҆сѝ ꙗ҆вле́й въ мі́рѣ воскрⷭ҇нїе.
*Сті́хъ:* ~Поми́лꙋй на́съ гдⷭ҇и, поми́лꙋй на́съ:
*Мꙋ́чениченъ:* ~Моли́твами гдⷭ҇и всѣ́хъ ст҃ы́хъ и҆ бцⷣы, тво́й ми́ръ да́ждь
на́мъ, и҆ поми́лꙋй на́съ, ꙗ҆́кѡ є҆ди́нъ ще́дръ.
*Сла́ва и҆ ны́нѣ: гла́съ и҃:*
~Прикосни́сѧ ѳѡмо̀ ребрꙋ̀ рꙋко́ю, глаго́летъ хрⷭ҇то́съ, и҆ ѻ҆́бразы гвозде́й
прїидѝ ѡ҆сѧжѝ, вѣ́рою и҆спыта́й, и҆ бꙋ́ди мѝ вѣ́ренъ, и҆ не бꙋ́ди невѣ́ренъ.
ѳѡма́ же пе́рстомъ ꙗ҆́кѡ прикоснꙋ́сѧ влⷣцѣ, вельмѝ возопѝ: ты̀ мо́й бг҃ъ и҆
гдⷭ҇ь, бл҃гоꙋтро́бне, сла́ва тебѣ̀.
*Та́же,* ~Ны́нѣ ѿпꙋща́еши: *И҆ про́чее ѻ҆бы́чно, ꙗ҆́коже пред̾ꙋказа́сѧ.* <<н҃є:
109>>
*Въ пѧто́къ вторы́ѧ седми́цы на ᲂу҆́трени,*
*на* ~Бг҃ъ гдⷭ҇ь, *тропа́рь пра́здника, три́жды. По а҃-мъ стїхосло́вїи
сѣда́ленъ, гла́съ а҃. Подо́бенъ:* ~Ка́мени запеча́танꙋ:
~Крⷭ҇та̀ твоегѡ̀ дре́вꙋ покланѧ́емсѧ чл҃вѣколю́бче, ꙗ҆́кѡ на не́мъ
пригвозди́лсѧ є҆сѝ животѐ всѣ́хъ. ра́й ѿве́рзлъ є҆сѝ сп҃се, вѣ́рою прише́дшемꙋ
къ тебѣ̀ разбо́йникꙋ, и҆ сла́дости сподо́бисѧ, и҆сповѣ́даѧ тѧ̀: помѧни́ мѧ
гдⷭ҇и. прїимѝ ꙗ҆́коже ѻ҆́наго, и҆ на́съ зовꙋ́щихъ: согрѣши́хомъ всѝ,
бл҃гоꙋтро́бїемъ твои́мъ не пре́зри на́съ.
*Сті́хъ:* ~Возноси́те гдⷭ҇а бг҃а на́шего, и҆ покланѧ́йтесѧ подно́жїю нѡ́гꙋ
є҆гѡ̀, ꙗ҆́кѡ ст҃о є҆́сть.
*Воскре́сна:* ~Гро́бъ тво́й, сп҃се, во́ини стрегꙋ́щїи, ме́ртви ѿ ѡ҆блиста́нїѧ
ꙗ҆́вльшагѡсѧ а҆́гг҃ла бы́ша, проповѣ́дающагѡ жена́мъ воскрⷭ҇нїе. тебѐ сла́вимъ
тлѝ потреби́телѧ, тебѣ̀ припа́даемъ воскре́сшемꙋ и҆з̾ гро́ба, и҆ є҆ди́номꙋ бг҃ꙋ
на́шемꙋ.
*Сті́хъ:* ~Ди́венъ бг҃ъ во ст҃ы́хъ свои́хъ бг҃ъ і҆и҃левъ.
*Мꙋ́чениченъ:* ~Страда́нїѧ похвало́ю, и҆ вѣне́чною по́честїю, сла́внїи
страстоте́рпцы ѡ҆дѣ́ѧшасѧ тобо́ю гдⷭ҇и. терпѣ́нїемъ бо ра́нъ беззако́нныхъ
побѣди́ша, си́лою же бж҃їею ѿ нб҃съ побѣ́дꙋ прїѧ́ша. тѣ́хъ моли́твами, хрⷭ҇тѐ
бж҃е, да́рꙋй на́мъ ве́лїю твою̀ ми́лость.
*Сла́ва, и҆ ны́нѣ: крⷭ҇тобг҃оро́диченъ. Подо́бенъ:* ~Гро́бъ тво́й:
~Нескве́рнаѧ а҆́гница, а҆́гнца и҆ па́стырѧ ви́сима ме́ртва на дре́вѣ ви́дѧщи,
рыда́ющи вѣща́ше, мт҃рски крича́щи: ка́кѡ претерплю̀ твоѐ є҆́же па́че сло́ва,
сн҃е мо́й, снизхожде́нїе, и҆ вѡ́льнаѧ страда̑нїѧ, бж҃е пребл҃гі́й; <<н҃є ѡ҆б.:
110>>
*По в҃-мъ стїхосло́вїи сѣда́ленъ, гла́съ а҃. Подо́бенъ:* ~Гро́бъ тво́й:
~Бл҃же́нъ є҆сѝ ты̀, ꙗ҆́звы ѡ҆сѧза́вый лꙋ́чшагѡ ребра̀: сїѐ велича́йшее чꙋ́до
а҆да́ма и҆сцѣли́вшее, и҆ на́мъ вѣ́ровавшымъ неги́блемое блаже́нство
и҆схода́таившее, самѣ́ми рече́ньми чⷭ҇тны́хъ а҆пⷭ҇лѡвъ, є҆гѡ̀ воскресе́нїе.
*Сла́ва, и҆ ны́нѣ: то́йже.*
*Та́же,* ~Воскресе́нїе хрⷭ҇то́во *ви́дѣвше: Ѱало́мъ н҃.*
*Канѡ́нъ пра́здника, со і҆рмосы̀, на и҃: и҆ мине́и, на д҃. По г҃-й пѣ́сни,
сѣда́ленъ мине́и. Конда́къ и҆ є҆ѯапостїла́рїй пра́здника.*
*На __хвали́техъ__ стїхи̑ры на д҃, гла́съ а҃.*
*Кре́стнаѧ:* ~Крⷭ҇то́мъ твои́мъ хрⷭ҇тѐ, є҆ди́но ста́до бы́сть а҆́гг҃лъ и҆
человѣ̑къ, и҆ є҆ди́на цр҃ковь, нб҃о и҆ землѧ̀ весели́тсѧ, гдⷭ҇и сла́ва тебѣ̀.
*[Два́жды.]*
*Воскре́сна:* ~Пое́мъ твою̀, хрⷭ҇тѐ, сп҃си́тельнꙋю стра́сть, и҆ сла́вимъ твоѐ
воскрⷭ҇нїе.
*Мꙋ́чениченъ:* ~Страстоте́рпцы хрⷭ҇тѡ́вы, прїиди́те лю́дїе всѝ почти́мъ
пѣ́сньми и҆ пѣ́нїи дх҃о́вными, свѣти̑ла мі́ра, и҆ проповѣ́дники вѣ́ры,
и҆сто́чникъ приснотекꙋ́щїй, и҆з̾ негѡ́же и҆стека́ютъ вѣ̑рнымъ и҆сцѣлє́нїѧ. тѣ́хъ
моли́твами хрⷭ҇тѐ бж҃е на́шъ, ми́ръ да́рꙋй мі́рови, и҆ дꙋша́мъ на́шымъ ве́лїю
ми́лость.
*Сла́ва, и҆ ны́нѣ: гла́съ и҃. А҆нато́лїа:*
~Две́ремъ заключє́ннымъ, ᲂу҆ченикѡ́мъ собра̑ннымъ, предста̀ сп҃съ, и҆дѣ́же
бѧ́хꙋ со́брани, и҆ ста́въ посредѣ̀ и҆̀хъ, глаго́летъ ѳѡмѣ̀: прїидѝ ѡ҆сѧжѝ, и҆
ви́ждь ѻ҆́бразы гвозде́й, прострѝ рꙋ́кꙋ твою̀, и҆ косни́сѧ ребрꙋ̀ моемꙋ̀, и҆ не
бꙋ́ди невѣ́ренъ, но вѣ́рою проповѣ́ждь, є҆́же и҆з̾ ме́ртвыхъ моѐ воскресе́нїе.
<<н҃ѕ: 111>>
*На __стїхо́внѣ__ стїхи̑ры пра́здника, гла́съ д҃.*
*Подо́бенъ:* ~Ꙗ҆́кѡ до́блѧ:
~Распе́нсѧ, ра́й человѣ́кѡмъ ѿве́рзлъ є҆сѝ, и҆ мє́ртвыѧ совоздви́глъ є҆сѝ
животѐ на́шъ, и҆ воскре́слъ є҆сѝ, и҆ сме́рть плѣни́въ си́лою твое́ю, и҆
совокꙋпи́въ нбⷭ҇нымъ вои́стиннꙋ земна̑ѧ, и҆спо́лнилъ є҆сѝ весе́лїѧ
безчи́сленнагѡ, бж҃їй сло́ве, ли́къ а҆пⷭ҇льскїй, си̑мъ ми́ръ вѣща́вый.
*Сті́хъ:* ~Во всю̀ зе́млю и҆зы́де вѣща́нїе и҆́хъ, и҆ въ концы̀ вселе́нныѧ
глаго́лы и҆́хъ.
~Тлѣ́нїе и҆спрове́ржесѧ, нетлѣ́нїе процвѣтѐ, сою́зъ вре́менный разрѣши́сѧ:
нб҃са̀ да веселѧ́тсѧ, землѧ̀ и҆ подзє́мнаѧ: воскре́се бо хрⷭ҇то́съ, плѣни́сѧ
сме́рть, весе́лый ꙗ҆ви́сѧ де́нь, заключє́ннымъ две́ремъ, внꙋ́трь вше́лъ є҆сѝ
жизнода́вче и҆ гдⷭ҇и.
*Сті́хъ:* ~Нб҃са̀ повѣ́даютъ сла́вꙋ бж҃їю, творе́нїе же рꙋкꙋ̀ є҆гѡ̀ возвѣща́етъ
тве́рдь.
~Въ де́нь, є҆го́же сотворѝ гдⷭ҇ь дне́сь, возра́дꙋемсѧ веселѧ́щесѧ, жизнода́вецъ
воста́лъ є҆́сть, а҆́дъ плѣне́нъ бы́сть, а҆пⷭ҇льскїй ли́къ ра́дость слы́шитъ:
ѡ҆сѧза́лъ є҆́сть ре́бра влⷣчнѧ невѣ́ровавый ѳѡма̀, и҆ ѡ҆сѧза́въ, сꙋгꙋ́бое
сꙋщество̀ проповѣ́да.
*Сла́ва, и҆ ны́нѣ, гла́съ и҃:*
~Прикосни́сѧ ѳѡмо̀ ребрꙋ̀ рꙋко́ю, глаго́летъ хрⷭ҇то́съ, и҆ ѻ҆́бразы гвозде́й
прїидѝ ѡ҆сѧжѝ, вѣ́рою и҆спытꙋ́й, и҆ бꙋ́ди мѝ вѣ́ренъ, и҆ не бꙋ́ди невѣ́ренъ.
ѳѡма́ же пе́рстомъ ꙗ҆́кѡ прикоснꙋ́сѧ влⷣцѣ, вельмѝ возопѝ: ты̀ мо́й бг҃ъ и҆
гдⷭ҇ь, бл҃гоꙋтро́бне, сла́ва тебѣ̀.
*Та́же,* ~Бл҃го є҆́сть и҆сповѣ́датисѧ гдⷭ҇ви: *Ча́съ а҃- й. И҆ ѿпꙋ́стъ.* <<н҃ѕ
ѡ҆б.: 112>>
*Въ пѧто́къ вторы́ѧ седми́цы по па́сцѣ ве́чера,*
*ѻ҆бы́чнаѧ каѳі́сма.*
*На* ~Гдⷭ҇и воззва́хъ: *стїхи̑ры самогла́сны, гла́съ а҃:*
~Две́ремъ заключє́ннымъ, ᲂу҆ченикѡ́мъ собра̑ннымъ, вше́лъ є҆сѝ внеза́пꙋ
всеси́льне і҆и҃се бж҃е на́шъ: и҆ ста́въ посредѣ̀ и҆̀хъ, ми́ръ да́въ, и҆спо́лнилъ
є҆сѝ ст҃а́гѡ дх҃а: жда́ти же повелѣ́лъ є҆сѝ, и҆ ника́коже разлꙋча́тисѧ ѿ
і҆ерꙋсали́ма, до́ндеже ѡ҆блекꙋ́тсѧ є҆́же съ высоты̀ си́лою. тѣ́мже вопїе́мъ тѝ:
просвѣще́нїе, и҆ воскресе́нїе и҆ ми́ре на́шъ, сла́ва тебѣ̀.
~По дне́хъ ѻ҆сми́хъ воста́нїѧ твоегѡ̀ гдⷭ҇и, ꙗ҆ви́лсѧ є҆сѝ ᲂу҆ченикѡ́мъ твои́мъ
на мѣ́стѣ, и҆дѣ́же бѧ́хꙋ со́брани, и҆ возгласи́въ и҆̀мъ: ми́ръ ва́мъ,
невѣ́рꙋющемꙋ ᲂу҆ченикꙋ̀ рꙋ́цѣ показа́лъ є҆сѝ, и҆ пречи́стое ребро̀. ѻ҆́нъ же
вѣ́ровавъ вопїѧ́ше тебѣ̀: гдⷭ҇ь мо́й и҆ бг҃ъ мо́й, сла́ва тебѣ̀.
~Ѳѡма̀ глаго́лемый близне́цъ, не бѣ̀ съ ни́ми, є҆гда̀ вше́лъ є҆сѝ хрⷭ҇тѐ
заключє́ннымъ две́ремъ. тѣ́мже и҆ не вѣ́роваше речє́ннымъ є҆мꙋ̀, ѿ невѣ́рїѧ въ
вѣ́рꙋ и҆звѣствꙋ́ѧ: не несподо́билъ же є҆сѝ бл҃же, показа́ти є҆мꙋ̀ пречи́стое
ребро̀ твоѐ, и҆ рꙋкꙋ̀ и҆ ногꙋ̀ ꙗ҆́звы. ѻ҆́нъ же ѡ҆сѧза́въ и҆ ви́дѣвъ, и҆сповѣ́да
тебѐ бы́ти бг҃а не на́га, и҆ человѣ́ка не про́ста, и҆ вопїѧ́ше: гдⷭ҇ь мо́й и҆
бг҃ъ мо́й, сла́ва тебѣ̀.
*Та́же мине́и, г҃. Сла́ва: гла́съ ѕ҃:*
~Две́ремъ заключє́ннымъ, прише́лъ є҆сѝ хрⷭ҇тѐ ко ᲂу҆ченикѡ́мъ, тогда̀ ѳѡма̀
смотри́тельнѡ не ѡ҆брѣ́тесѧ съ <<н҃з: 113>> ни́ми. глаго́лаше бо: не и҆мꙋ̀
вѣ́ры, а҆́ще не ᲂу҆ви́ждꙋ и҆ а҆́зъ влⷣки. ᲂу҆ви́ждꙋ ребро̀, ѿѻнꙋ́дꙋже и҆зы́де
кро́вь, вода̀, креще́нїе: ᲂу҆ви́ждꙋ ꙗ҆́звꙋ, ѿ неѧ́же и҆сцѣлѣ̀ вели́кїй стрꙋ́пъ
человѣ́ческїй: ᲂу҆ви́ждꙋ, ка́кѡ не бѣ̀ ꙗ҆́коже дꙋ́хъ, но пло́ть и҆ кѡ́сти.
сме́рть попра́вый, и҆ ѳѡмꙋ̀ ᲂу҆вѣ́ривый, гдⷭ҇и сла́ва тебѣ̀.
*И҆ ны́нѣ: бг҃оро́диченъ, гла́съ а҃:*
~Всемі́рнꙋю сла́вꙋ ѿ человѣ̑къ прозѧ́бшꙋю, и҆ влⷣкꙋ ро́ждшꙋю, нбⷭ҇нꙋю две́рь
воспои́мъ марі́ю дв҃ꙋ, безпло́тныхъ пѣ́снь и҆ вѣ́рныхъ ᲂу҆добре́нїе. сїѧ́ бо
ꙗ҆ви́сѧ нб҃о, и҆ хра́мъ бж҃ества̀: сїѧ̀ прегражде́нїе вражды̀ разрꙋши́вши, ми́ръ
введѐ, и҆ црⷭ҇твїе ѿве́рзе. сїю̀ ᲂу҆́бѡ и҆мꙋ́ще вѣ́ры ᲂу҆твержде́нїе, побо́рника
и҆́мамы и҆з̾ неѧ̀ ро́ждшагосѧ гдⷭ҇а. дерза́йте ᲂу҆̀бо, дерза́йте лю́дїе бж҃їи,
и҆́бо то́й побѣди́тъ врагѝ ꙗ҆́кѡ всеси́ленъ.
*Свѣ́те ти́хїй:* ~Прокі́менъ днѐ.
*На __стїхо́внѣ__ стїхи̑ры воскре́сныѧ, гла́съ а҃:*
~Вечє́рнїѧ на́шѧ мл҃твы, прїимѝ ст҃ы́й гдⷭ҇и, и҆ пода́ждь на́мъ ѡ҆ставле́нїе
грѣхѡ́въ, ꙗ҆́кѡ є҆ди́нъ є҆сѝ ꙗ҆вле́й въ мі́рѣ воскрⷭ҇нїе.
*Сті́хъ:* ~Гдⷭ҇ь воцари́сѧ, въ лѣ́потꙋ ѡ҆блече́сѧ.
~Ѡ҆быди́те лю́дїе сїѡ́нъ, и҆ ѡ҆б̾ими́те є҆го̀, и҆ дади́те сла́вꙋ въ не́мъ,
воскре́сшемꙋ и҆з̾ ме́ртвыхъ: ꙗ҆́кѡ то́й є҆́сть бг҃ъ на́шъ, и҆збавле́й на́съ ѿ
беззако́нїй на́шихъ.
*Сті́хъ:* ~И҆́бо ᲂу҆твердѝ вселе́ннꙋю, ꙗ҆́же не подви́житсѧ.
~Прїиди́те лю́дїе воспои́мъ, и҆ поклони́мсѧ хрⷭ҇тꙋ̀, сла́вѧще є҆гѡ̀ и҆з̾
ме́ртвыхъ воскресе́нїе, ꙗ҆́кѡ то́й є҆́сть бг҃ъ на́шъ, ѿ пре́лести вра́жїѧ мі́ръ
и҆збавле́й. <<н҃з ѡ҆б.: 114>>
*Сті́хъ:* ~До́мꙋ твоемꙋ̀ подоба́етъ ст҃ы́нѧ гдⷭ҇и, въ долготꙋ̀ дні́й.
~Стра́стїю твое́ю хрⷭ҇тѐ, ѿ страсте́й свободи́хомсѧ, и҆ воскрⷭ҇нїемъ твои́мъ
и҆з̾ и҆стлѣ́нїѧ и҆зба́вихомсѧ, гдⷭ҇и сла́ва тебѣ̀.
*Сла́ва, и҆ ны́нѣ: гла́съ є҃:*
~Чл҃вѣколю́бче, ве́лїе и҆ безприкла́дное мно́жество щедро́тъ твои́хъ, ꙗ҆́кѡ
долготерпѣ́лъ є҆сѝ, ѿ і҆ꙋдє́й заꙋша́емь, ѿ а҆пⷭ҇ла ѡ҆сѧза́емь, и҆ ѿ ѿмета́ющихсѧ
тебѐ многоиспытꙋ́емь. ка́кѡ воплоти́лсѧ є҆сѝ: ка́кѡ распѧ́лсѧ є҆сѝ безгрѣ́шне;
но вразꙋмѝ на́съ, ꙗ҆́кѡ ѳѡмꙋ̀, вопи́ти тебѣ̀: гдⷭ҇ь мо́й, и҆ бг҃ъ мо́й, сла́ва
тебѣ̀.
*Та́же:* ~Ны́нѣ ѿпꙋща́еши: *Тропа́рь:* ~Запеча́танꙋ гро́бꙋ:
*Є҆ктенїа̀, и҆ ѿпꙋ́стъ.*
[зрѝ] *И҆звѣ́стно же бꙋ́ди, ꙗ҆́кѡ канѡ́ны ѡ҆ ᲂу҆со́пшихъ ѻ҆ктѡ́иха настоѧ́щагѡ
гла́са, по всѧ̀ сꙋббѡ́ты въ пѧтдесѧ́тницѣ до́лжни сꙋ́ть пѣ́тисѧ, въ пѧтка́хъ
ве́чера, на повече́рїахъ.*
*Въ сꙋббѡ́тꙋ в҃-ѧ седми́цы по па́сцѣ на ᲂу҆́трени*
*на* ~Бг҃ъ гдⷭ҇ь: *тропа́рь пра́здника, три́жды.*
*По а҃-мъ стїхосло́вїи сѣда́ленъ, гла́съ а҃:*
~Гро́бъ тво́й сп҃се во́ини стрегꙋ́щїи, ме́ртви ѿ ѡ҆блиста́нїѧ ꙗ҆́вльшагѡсѧ
а҆́гг҃ла бы́ша, проповѣ́дающагѡ жена́мъ воскрⷭ҇нїе. тебѐ сла́вимъ тлѝ
потреби́телѧ, тебѣ̀ припа́даемъ воскрⷭ҇шемꙋ и҆з̾ гро́ба, и҆ є҆ди́номꙋ бг҃ꙋ
на́шемꙋ.
*Гла́съ то́йже. Подо́бенъ:* ~Ка́мени запеча́танꙋ:
~Жєны̀ ко гро́бꙋ прїидо́ша ᲂу҆ра́ншыѧ, и҆ а҆́гг҃льское <<н҃и: 115>> ꙗ҆вле́нїе
ви́дѣвшыѧ трепета́хꙋ: гро́бъ ѡ҆блиста̀ жи́знь, чꙋ́до ᲂу҆дивлѧ́ше ѧ҆̀. сегѡ̀
ра́ди ше́дшыѧ ᲂу҆ченикѡ́мъ проповѣ́дахꙋ воста́нїе: а҆́да плѣнѝ хрⷭ҇то́съ, ꙗ҆́кѡ
є҆ди́нъ крѣ́покъ и҆ си́ленъ, и҆ и҆стлѣ́вшыѧ совоздви́же всѧ̑, ѡ҆сꙋжде́нїѧ
стра́хъ разрꙋши́въ си́лою крⷭ҇та̀.
*Сла́ва, и҆ ны́нѣ: бг҃оро́диченъ:*
~Гаврїи́лꙋ вѣща́вшꙋ тебѣ̀ дв҃о, ра́дꙋйсѧ, со гла́сомъ воплоща́шесѧ всѣ́хъ влⷣка
въ тебѣ̀ ст҃ѣ́мъ кївѡ́тѣ, ꙗ҆́коже речѐ пра́ведный дв҃дъ: ꙗ҆ви́ласѧ є҆сѝ ши́ршаѧ
нб҃съ, поноси́вши зижди́телѧ твоего̀. сла́ва все́льшемꙋсѧ въ тѧ̀, сла́ва
проше́дшемꙋ и҆з̾ тебѐ, сла́ва свободи́вшемꙋ на́съ ржⷭ҇тво́мъ твои́мъ.
*По в҃-мъ стїхосло́вїи сѣда́ленъ, гла́съ а҃.*
*Подо́бенъ:* ~Ка́мени запеча́танꙋ:
~Стра́ха ра́ди і҆ꙋде́йска, сокровє́ннымъ ᲂу҆ч҃нкѡ́мъ, и҆ въ сїѡ́нѣ сѡ́браннымъ,
вше́лъ є҆сѝ къ ни̑мъ бл҃же, и҆ ста́лъ є҆сѝ посредѣ̀ и҆̀хъ, две́ремъ
заключє́ннымъ, радостотворѧ́й: и҆ показа́лъ є҆сѝ и҆̀мъ рꙋ́цѣ, и҆ пречⷭ҇тыхъ
твои́хъ ре́бръ ꙗ҆́звы, глаго́лѧ невѣ́рꙋющемꙋ ᲂу҆ченикꙋ̀: принесѝ рꙋ́кꙋ твою̀ и҆
и҆спыта́й, ꙗ҆́кѡ са́мъ а҆́зъ є҆́смь, тебѐ ра́ди пострада́вый.
*И҆ чте́нїе. Та́же:* ~Воскресе́нїе хрⷭ҇то́во ви́дѣвше: *Ѱало́мъ н҃.*
*Канѡ́нъ пра́здника, со і҆рмосы̀, на ѕ҃: и҆ ст҃а́гѡ, є҆гѡ́же є҆́сть хра́мъ, на
д҃: и҆ мине́и, на д҃. По г҃-й пѣ́сни конда́къ, и҆ сѣда́ленъ мине́и. Сла́ва и҆
ны́нѣ: пра́здника. По ѕ҃-й пѣ́сни конда́къ пра́здникꙋ, и҆ і҆́косъ. По ѳ҃-й
пѣ́сни є҆ѯапостїла́рїй пра́здникꙋ.*
*На __хвали́техъ__ стїхи̑ры воскрє́сны, на д҃, гла́съ а҃:*
~Пое́мъ твою̀ хрⷭ҇тѐ спаси́тельнꙋю стра́сть, и҆ сла́вимъ твоѐ воскрⷭ҇нїе. <<н҃и
ѡ҆б.: 116>>
~Крⷭ҇тъ претерпѣ́вый, и҆ сме́рть ᲂу҆праздни́вый, и҆ воскресы́й и҆з̾ ме́ртвыхъ,
ᲂу҆мирѝ на́шꙋ жи́знь гдⷭ҇и, ꙗ҆́кѡ є҆ди́нъ всеси́ленъ.
~А҆́да плѣни́вый, и҆ человѣ́ка воскреси́вый воскрⷭ҇нїемъ твои́мъ хрⷭ҇тѐ,
сподо́би ны̀ чⷭ҇тымъ срⷣцемъ тебѐ пѣ́ти и҆ сла́вити.
~Бг҃олѣ́пное твоѐ снисхожде́нїе сла́вѧще, пое́мъ тѧ̀ хрⷭ҇тѐ: роди́лсѧ є҆сѝ ѿ
дв҃ы, и҆ неразлꙋче́нъ бы́лъ є҆сѝ ѿ ѻ҆ц҃а̀: пострада́лъ є҆сѝ ꙗ҆́кѡ чл҃вѣ́къ, и҆
во́лею претерпѣ́лъ є҆сѝ крⷭ҇тъ. воскре́слъ є҆сѝ ѿ гро́ба, ꙗ҆́кѡ ѿ черто́га
произше́дъ, да спасе́ши мі́ръ: гдⷭ҇и сла́ва тебѣ̀.
*Сла́ва, и҆ ны́нѣ: гла́съ ѕ҃:*
~По дне́хъ ѻ҆сми́хъ воста́нїѧ твоегѡ̀, і҆и҃се цр҃ю̀, є҆диноро́дный сло́ве
ѻ҆́ч҃їй, ꙗ҆ви́лсѧ є҆сѝ ᲂу҆ч҃нкѡ́мъ твои̑мъ, заключє́ннымъ две́ремъ, ми́ръ тво́й
подаѧ̀, и҆ невѣ́рꙋющемꙋ ᲂу҆ченикꙋ̀ зна́мєнїѧ показа́лъ є҆сѝ: прїидѝ, ѡ҆сѧжѝ
рꙋ́цѣ и҆ но́зѣ, и҆ нетлѣ̑нныѧ моѧ̑ ре́бра. ѻ҆́нъ же вѣ́ровавъ, вопїѧ́ше тебѣ̀:
гдⷭ҇ь мо́й, и҆ бг҃ъ мо́й, сла́ва тебѣ̀.
*На __стїхо́внѣ__ стїхи̑ры пра́здникꙋ, гла́съ а҃.*
*Подо́бенъ:* ~Прехва́льнїи мꙋ́чєницы:
~По є҆́же и҆з̾ гро́ба твое́мъ стра́шномъ жизнода́вче воста́нїи, ꙗ҆́коже
печа́тей не разрꙋши́лъ є҆сѝ хрⷭ҇тѐ гро́бныхъ, та́кѡ заключє́ннымъ две́ремъ,
вше́лъ є҆сѝ къ пресла̑внымъ а҆пⷭ҇лѡмъ твои̑мъ, радостотворѧ̀ и҆̀мъ, и҆ пра́вый
тво́й дх҃ъ подаѧ̀ и҆̀мъ, за безмѣ́рнꙋю твою̀ ми́лость.
*Сті́хъ:* ~Во всю̀ зе́млю и҆зы́де вѣща́нїе и҆́хъ, и҆ въ концы̀ вселе́нныѧ
глаго́лы и҆́хъ.
~Ѳѡма̀ и҆́же и҆ близне́цъ не бѣ̀ прише́лъ, є҆гда̀ ты̀ <<н҃ѳ: 117>> ᲂу҆ч҃нкѡ́мъ
ꙗ҆ви́лсѧ є҆сѝ гдⷭ҇и: тѣ́мже не вѣ́рова твоемꙋ̀ воскресе́нїю, и҆ ви́дѣвшымъ тѧ̀
вопїѧ́ше: а҆́ще не вложꙋ̀ пе́рста въ ре́бра є҆гѡ̀ и҆ гвозде́й ꙗ҆́звы, не вѣ́рꙋю,
ꙗ҆́кѡ воста́лъ є҆́сть.
*Сті́хъ:* ~Нб҃са̀ повѣ́даютъ сла́вꙋ бж҃їю, творе́нїе же рꙋкꙋ̀ є҆гѡ̀ возвѣща́етъ
тве́рдь.
~Ꙗ҆́коже хо́щеши ѡ҆сѧжѝ, хрⷭ҇то́съ ѳѡмѣ̀ вопїѧ́ше, вложѝ рꙋ́кꙋ, и҆ позна́й мѧ̀
кѡ́сти и҆мꙋ́ща, и҆ земно́е тѣ́ло, и҆ не бꙋ́ди невѣ́ренъ, ра́внѡ же со и҆ны́ми
ᲂу҆вѣ́рисѧ. ѻ҆́нъ же возопѝ: бг҃ъ мо́й и҆ гдⷭ҇ь ты̀ є҆сѝ, сла́ва воста́нїю
твоемꙋ̀.
*Сла́ва, и҆ ны́нѣ: гла́съ то́йже:*
~Оу҆ченикѡ́мъ сомнѧ́щымсѧ, во ѻ҆смы́й де́нь предста̀ сп҃съ, и҆дѣ́же бѧ́хꙋ
со́брани, и҆ ми́ръ да́въ, ѳѡмѣ̀ возопѝ: прїидѝ а҆пⷭ҇ле, ѡ҆сѧжѝ дла̑ни, въ ни́хже
гвѡ́здїѧ вонзо́ша. ѽ до́брое невѣ́рїе ѳѡмино̀, вѣ́рныхъ сердца̀ въ позна́нїе
приведѐ! и҆ со стра́хомъ возопѝ: гдⷭ҇ь мо́й и҆ бг҃ъ мо́й, сла́ва тебѣ̀.
*И҆ про́чее ᲂу҆́трени. Тропа́рь:* ~Запеча́танꙋ гро́бꙋ: *Є҆ктенїа̀, и҆ ча́съ
пе́рвый, и҆ ѿпꙋ́стъ, и҆ ѻ҆бы́чнаѧ лїті́а въ притво́рѣ.*
*На __лїтꙋргі́и__ и҆з̾ѡбрази́тєльнаѧ, и҆ ѿ канѡ́на пра́здника, пѣ́снь ѳ҃, на
ѕ҃. Прокі́менъ, гла́съ г҃:* ~Ве́лїй гдⷭ҇ь на́шъ, и҆ ве́лїѧ крѣ́пость є҆гѡ̀, и҆
ра́зꙋма є҆гѡ̀ нѣ́сть числа̀. *Сті́хъ:* ~Хвали́те гдⷭ҇а, ꙗ҆́кѡ бл҃гъ: *А҆пⷭ҇лъ
дѣѧ́нїй, зача́ло є҃і:* ~Слы́шавше а҆пⷭ҇ли: *А҆ллилꙋ́їа, гла́съ и҃:* ~Прїиди́те
возра́дꙋемсѧ гдⷭ҇ви: *Сті́хъ:* ~Похвалѝ і҆ерⷭ҇ли́ме гдⷭ҇а: *Є҆ѵⷢ҇лїе і҆ѡа́нна,
зача́ло ѳ҃і:* ~Ви́дѣвше человѣ́цы зна́менїе: *Прича́стенъ.* ~Похвалѝ і҆ерⷭ҇ли́ме
гдⷭ҇а: *По семꙋ́ же воѡбраже́нїю пое́мъ по всѧ̑ сꙋббѡ̑ты до вознесе́нїѧ
хрⷭ҇то́ва.*
|
# frozen_string_literal: true
require 'spec_helper'
require 'webmock'
require 'webmock/rspec'
require 'uri'
require 'puppet/util/http_client'
require 'logger'
describe 'HttpClient' do
describe '#attempt_http_request' do
BODY_HTTP_METHODS = [:put, :post].freeze
HTTP_METHODS = [:get, :delete].concat(BODY_HTTP_METHODS).freeze
FATAL_RESPONSE_CODES = Set.new(%w(400 401 402 403 405 406 407 409 410 411 412 413 414
415 416 417 422 423 424 426 428 431 501 502 505 507 511)).freeze
let(:uri) { 'http://test.com' }
def call_attempt_http_request
parameters = { method: method }
parameters[:params] = params if defined?(params)
parameters[:body_data] = body_data if defined?(body_data)
parameters[:body_params] = body_params if defined?(body_params)
parameters[:content_type] = content_type if defined?(content_type)
parameters[:accept_type] = accept_type if defined?(accept_type)
parameters[:auth] = auth if defined?(auth)
Puppet::Util::HttpClient.attempt_http_request(URI(uri), parameters)
end
context 'fail to create request without method' do
it do
expect { Puppet::Util::HttpClient.attempt_http_request(URI(uri), {}) }
.to raise_error(ArgumentError, 'You must pass method in parameters')
end
end
context 'failing with' do
HTTP_METHODS.each do |method|
let(:method) { method }
FATAL_RESPONSE_CODES.each do |fatal_code|
context "'#{method}' method with fatal response code '#{fatal_code}'" do
before do
stub_request(:any, /.*test.com.*/).to_return(status: [fatal_code])
end
after do
WebMock.reset!
end
it do
expect { call_attempt_http_request }.to raise_error(Puppet::Error, /Unrecoverable response received/)
end
end
end
context "'#{method}' method to timeout" do
before do
stub_request(:any, /.*test.com.*/).to_timeout
end
after do
WebMock.reset!
end
it 'to retrun nil' do
response = call_attempt_http_request
expect(response).to be_nil
end
end
end
end
context 'successfully with' do
before do
stub_request(:any, /.*test.com.*/)
end
after do
WebMock.reset!
end
HTTP_METHODS.each do |method|
context "'#{method}' method" do
let(:method) { method }
it do
call_attempt_http_request
expect(WebMock).to have_requested(method, uri).once
end
end
context "'#{method}' method with auth" do
let(:method) { method }
let(:auth) { { user: 'test_user', password: 'test_password' } }
it do
call_attempt_http_request
expect(WebMock).to have_requested(method,
uri).with(basic_auth: [auth[:user], auth[:password]]).once
end
end
context "'#{method}' method with custom content_type" do
let(:method) { method }
let(:content_type) { 'test/test' }
it do
call_attempt_http_request
expect(WebMock).to have_requested(method,
uri).with(headers: { 'Content-Type' => content_type }).once
end
end
context "'#{method}' method with custom accept_type" do
let(:method) { method }
let(:accept_type) { 'test/test' }
it do
call_attempt_http_request
expect(WebMock).to have_requested(method,
uri).with(headers: { 'Accept' => accept_type }).once
end
end
context "'#{method}' method with url parameters" do
let(:method) { method }
let(:params) { { param1: 'test1', param2: 'test2' } }
it do
call_attempt_http_request
expect(WebMock).to have_requested(method, uri).with(query: params).once
end
end
next unless BODY_HTTP_METHODS.include? method
context "'#{method}' method with body_data" do
let(:method) { method }
let(:body_data) { 'test_data' }
it do
call_attempt_http_request
expect(WebMock).to have_requested(method, uri).with(body: body_data).once
end
end
context "'#{method}' method with body_params" do
let(:method) { method }
let(:body_params) { { param1: 'test1', param2: 'test2' } }
it do
call_attempt_http_request
expect(WebMock).to have_requested(method, uri)
.with(body: body_params.map { |key, value| "#{key}=#{value}" }.join('&')).once
end
end
end
end
end
end
|
# THIS FILE SHOULD BE RUN DAILY, via a cronjob
# IT RUNS THE BACKUP SCRIPT INSIDE THE DOCKER CONTAINER
# AND COPIES THE BACKUP TO A REMOTE LOCATION
#
# Content of the crontab (edit with `sudo crontab -e`):
# @reboot mount -a
# 0 20 * * * /bin/bash /srv/bullfrog/cron_daily.sh
#
# note that the container name 'bullfrog_web_1' could be different on other host systems
docker exec bullfrog_web_1 /bin/bash backup_database.sh
# use absolute path to bullfrog source
bash /srv/bullfrog/backup_copy_to_remote.sh
|
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs';
import { EntitySchema } from '../../../../../store/src/helpers/entity-schema';
import { CoreTestingModule } from '../../../../test-framework/core-test.modules';
import { createBasicStoreModule } from '../../../../test-framework/store-test-helper';
import { MDAppModule } from '../../../core/md.module';
import { EntityMonitorFactory } from '../../monitors/entity-monitor.factory.service';
import { SharedModule } from '../../shared.module';
import { LoadingPageComponent } from './loading-page.component';
class EntityMonitorFactoryMock {
monitor = {
isDeletingEntity$: of(false),
isFetchingEntity$: of(false),
};
create() {
return this.monitor;
}
}
describe('LoadingPageComponent', () => {
let component: LoadingPageComponent;
let fixture: ComponentFixture<LoadingPageComponent>;
let element: HTMLElement;
let entityFactory: EntityMonitorFactoryMock;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MDAppModule,
SharedModule,
CoreTestingModule,
BrowserAnimationsModule,
NoopAnimationsModule,
createBasicStoreModule()
],
providers: [
{ provide: EntityMonitorFactory, useClass: EntityMonitorFactoryMock }
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoadingPageComponent);
entityFactory = TestBed.get(EntityMonitorFactory);
component = fixture.componentInstance;
fixture.detectChanges();
element = fixture.nativeElement;
});
it('should be created', () => {
expect(component).toBeTruthy();
});
it('should show custom message', () => {
component.isLoading = of(true);
component.text = 'Custom message';
component.ngOnInit();
fixture.detectChanges();
expect(element.textContent).toContain('Custom message');
});
describe('when deleting', () => {
beforeEach(() => {
component.isLoading = null;
component.entityId = 'id';
component.entitySchema = new EntitySchema('schema', 'endpoint');
entityFactory.monitor.isDeletingEntity$ = of(true);
component.ngOnInit();
fixture.detectChanges();
});
it('should show default message', () => {
expect(element.textContent).toContain(component.deleteText);
});
it('should show progress bar until is done', () => {
const progressBar = element.querySelector('mat-progress-bar');
expect(progressBar).toBeTruthy();
});
it('should hide progress bar when is done', fakeAsync(() => {
let progressBar = element.querySelector('mat-progress-bar');
expect(progressBar).toBeTruthy();
component.isDeleting = of(false);
fixture.detectChanges();
tick(250);
progressBar = element.querySelector('mat-progress-bar');
expect(progressBar).toBeFalsy();
}));
});
describe('when loading', () => {
beforeEach(() => {
component.isLoading = of(true);
component.ngOnInit();
fixture.detectChanges();
});
it('should show default message', () => {
expect(element.textContent).toContain(component.text);
});
it('should show progress bar until is done', () => {
const progressBar = element.querySelector('mat-progress-bar');
expect(progressBar).toBeTruthy();
});
it('should hide progress bar when is done', fakeAsync(() => {
let progressBar = element.querySelector('mat-progress-bar');
expect(progressBar).toBeTruthy();
component.isLoading = of(false);
fixture.detectChanges();
tick(250);
progressBar = element.querySelector('mat-progress-bar');
expect(progressBar).toBeFalsy();
}));
});
});
|
package com.puntogris.blint.feature_store.presentation.sync
import androidx.fragment.app.viewModels
import androidx.lifecycle.Lifecycle
import androidx.navigation.fragment.findNavController
import com.puntogris.blint.R
import com.puntogris.blint.common.presentation.base.BaseFragment
import com.puntogris.blint.common.utils.launchAndRepeatWithViewLifecycle
import com.puntogris.blint.common.utils.navigateAndClearStack
import com.puntogris.blint.common.utils.playAnimationOnce
import com.puntogris.blint.common.utils.types.SyncAccount
import com.puntogris.blint.databinding.FragmentSyncAccountBinding
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class SyncAccountFragment :
BaseFragment<FragmentSyncAccountBinding>(R.layout.fragment_sync_account) {
private val viewModel: SyncViewModel by viewModels()
override fun initializeViews() {
binding.fragment = this
subscribeUi()
}
private fun subscribeUi() {
launchAndRepeatWithViewLifecycle(Lifecycle.State.CREATED) {
when (viewModel.syncAccount()) {
is SyncAccount.Error -> onErrorSync()
SyncAccount.Success.BusinessNotFound -> onSuccessSync(R.id.newUserFragment)
SyncAccount.Success.HasBusiness -> onSuccessSync(R.id.homeFragment)
}
}
}
private fun onErrorSync() {
with(binding) {
syncAccountAnimationView.playAnimationOnce(R.raw.error)
syncAccountTitle.setText(R.string.snack_an_error_occurred)
syncAccountSubtitle.setText(R.string.snack_sync_account_error)
syncAccountContinueButton.isEnabled = true
syncAccountContinueButton.setText(R.string.action_exit)
syncAccountContinueButton.setOnClickListener {
findNavController().navigateAndClearStack(R.id.loginFragment)
}
}
}
private fun onSuccessSync(destination: Int) {
with(binding) {
syncAccountAnimationView.playAnimationOnce(R.raw.done)
syncAccountTitle.setText(R.string.account_sync_success)
syncAccountSubtitle.setText(R.string.account_adventure_message)
syncAccountContinueButton.isEnabled = true
syncAccountContinueButton.setOnClickListener {
findNavController().navigateAndClearStack(destination)
}
}
}
}
|
// Copyright (C) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include "ie_api.h"
namespace InferenceEngine {
/**
* @brief Check if CPU is x86 with SSE4.2
*/
INFERENCE_ENGINE_API_CPP(bool) with_cpu_x86_sse42();
} // namespace InferenceEngine
|
#!/bin/bash
uninstall_module(){
# if module directory exists
if [ -d "../$1" ]; then
echo "Now uninstalling module " $1 " ... "
# go to that module
cd ../$1
# make and go to build directory
mkdir -p build && cd build
sudo make uninstall
cd ..
else
echo "ERROR: an error occurred during uninstalling. Try uninstalling manually."
exit 1
fi
}
## get current folder and make sure it is *ct*
curr_folder=${PWD##*/}
if [ $curr_folder != "ct" ]; then
echo "ERROR: you need to start the uninstaller from the control-toolbox/ct directory."
exit 1
fi
uninstall_module ct_doc
uninstall_module ct_models
uninstall_module ct_rbd
uninstall_module ct_optcon
uninstall_module ct_core
exit 0
|
#ifndef MOTIONFRAME_H
#define MOTIONFRAME_H
#include <iostream>
#include <opencv2/opencv.hpp>
#include <string>
// TODO: Re-implement pointers to use smart pointers
class MotionFrame
{
public:
MotionFrame(cv::UMat &frame, std::unique_ptr<cv::Rect> rectangle);
cv::UMat getFrame();
std::unique_ptr<cv::Rect> getRectangle();
private:
cv::UMat &frame_;
std::unique_ptr<cv::Rect> rectangle_;
};
#endif
|
_Meta-package containing a typescript preset for babel_
### Provides
- `@babel/plugin-proposal-class-properties`
- `@babel/plugin-proposal-decorators`
- `@babel/core`
### Usage
- Install: `yarn add -D @adaliszk/babel-typescript-preset`
- Add an `.babelrc.json` with the content of:
```json5
{"presets": ["@adaliszk/babel-typescript-preset"]}
```
or add it to your `package.json`:
```json5
"babel": {
"presets": [
"@adaliszk/babel-typescript-preset"
]
}
```
|
package cmd
import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/tools/git"
"github.com/rsteube/carapace-bin/pkg/util"
"github.com/spf13/cobra"
)
var logCmd = &cobra.Command{
Use: "log",
Short: "Show commit logs",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(logCmd).Standalone()
logCmd.Flags().StringS("L", "L", "", "Process line range n,m in file, counting from 1")
logCmd.Flags().String("decorate", "", "decorate options")
logCmd.Flags().String("decorate-refs", "", "only decorate refs that match <pattern>")
logCmd.Flags().String("decorate-refs-exclude", "", "do not decorate refs that match <pattern>")
logCmd.Flags().Bool("mailmap", false, "alias of --use-mailmap")
logCmd.Flags().BoolP("quiet", "q", false, "suppress diff output")
logCmd.Flags().Bool("source", false, "show source")
logCmd.Flags().Bool("use-mailmap", false, "Use mail map file")
rootCmd.AddCommand(logCmd)
logCmd.Flag("decorate").NoOptDefVal = "short"
carapace.Gen(logCmd).FlagCompletion(carapace.ActionMap{
"decorate": carapace.ActionValuesDescribed(
"short", "do not print ref prefixes",
"full", "print ref prefixes",
"auto", "short format when output to terminal",
"no", "no decoration",
),
})
carapace.Gen(logCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if util.HasPathPrefix(c.CallbackValue) {
return carapace.ActionFiles()
} else {
return carapace.ActionMultiParts("...", func(c carapace.Context) carapace.Action {
if len(c.Parts) < 2 {
return git.ActionRefs(git.RefOptionDefault)
} else {
return carapace.ActionValues()
}
})
}
}),
)
}
|
import { TestBed, waitForAsync } from '@angular/core/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { FormsModule } from '@angular/forms';
import { TableComponent } from './table.component';
import { Config } from '../../model/config';
import { Language } from '../../model/language';
import { Repository } from '../../model/repository';
describe('TableComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [TableComponent],
imports: [HttpClientTestingModule, FormsModule]
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(TableComponent);
const app: TableComponent = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should init', () => {
const fixture = TestBed.createComponent(TableComponent);
const app: TableComponent = fixture.debugElement.componentInstance;
app.ngOnInit();
app.config = getConfig();
app.updateRepositories();
app.clearFilters();
expect(app).toBeTruthy();
});
it('should get Repository language', waitForAsync(done => {
const fixture = TestBed.createComponent(TableComponent);
const app: TableComponent = fixture.debugElement.componentInstance;
app.config = getConfig();
app
.getRepoLanguage(getRepo())
.toPromise()
.finally(done);
expect(app).toBeTruthy();
}));
it('should get Repository language (null)', waitForAsync(done => {
const fixture = TestBed.createComponent(TableComponent);
const app: TableComponent = fixture.debugElement.componentInstance;
app.config = getConfig();
app
.getRepoLanguage(null)
.toPromise()
.finally(done);
expect(app).toBeTruthy();
}));
it('should get Repository description', waitForAsync(done => {
const fixture = TestBed.createComponent(TableComponent);
const app: TableComponent = fixture.debugElement.componentInstance;
app.config = getConfig();
app
.getRepoDescription(getRepo())
.toPromise()
.finally(done);
expect(app).toBeTruthy();
}));
it('should get Repository description', waitForAsync(done => {
const fixture = TestBed.createComponent(TableComponent);
const app: TableComponent = fixture.debugElement.componentInstance;
app.config = getConfig();
app
.getRepoDescription(null)
.toPromise()
.finally(done);
expect(app).toBeTruthy();
}));
it('should filter Repositories', () => {
const fixture = TestBed.createComponent(TableComponent);
const app: TableComponent = fixture.debugElement.componentInstance;
app.filterRepositories([getRepo()]);
expect(app).toBeTruthy();
});
});
function getConfig() {
const config = new Config();
const language = new Language();
language.name = 'C';
config.languages = [language];
return config;
}
function getRepo() {
const repo = new Repository();
repo.language = 'C';
repo.description = 'C on https://stackoverflow.com';
return repo;
}
|
using System;
using System.IO;
using System.Text;
using System.Linq;
using Google.Cloud.Storage.V1;
using Google.Apis.Auth.OAuth2;
using Microsoft.Extensions.Configuration;
using System.Security.Cryptography.X509Certificates;
namespace TwentyTwenty.Storage.Google.Test
{
public class StorageFixture : IDisposable
{
public const string ContainerPrefix = "storagetest-";
public readonly StorageClient _client;
public readonly GoogleCredential _credential;
public StorageFixture()
{
Config = new ConfigurationBuilder()
.SetBasePath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", ".."))
.AddEnvironmentVariables()
.AddUserSecrets<StorageFixture>()
.Build();
var credJsonBytes = Convert.FromBase64String(Config["GoogleCredJsonBase64"]);
var credJson = Encoding.UTF8.GetString(credJsonBytes);
_credential = GoogleCredential.FromJson(credJson);
_client = StorageClient.Create(_credential);
}
public IConfiguration Config { get; private set; }
public void Dispose()
{
var objectsToDelete = _client.ListObjects(Config["GoogleBucket"], ContainerPrefix);
foreach (var obj in objectsToDelete)
{
_client.DeleteObject(Config["GoogleBucket"], obj.Name);
}
}
}
}
|
package ru.otus.spring.dao.impl;
import lombok.RequiredArgsConstructor;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.stereotype.Repository;
import ru.otus.spring.dao.AuthorDao;
import ru.otus.spring.model.Author;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Repository
@RequiredArgsConstructor
public class AuthorDaoJdbc implements AuthorDao {
private final NamedParameterJdbcOperations jdbc;
@Override
public int count() {
return jdbc.getJdbcOperations().queryForObject("select count(*) from AUTHORS", Integer.class);
}
@Override
public Author create(Author author) {
GeneratedKeyHolder keyHolder = new GeneratedKeyHolder();
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValues(Map.of("name", author.getFullName()));
jdbc.update("insert into AUTHORS (FULLNAME) values (:name)", params, keyHolder);
return (keyHolder.getKey() != null) ? getById(keyHolder.getKey().longValue()).get() : null;
}
@Override
public boolean isExist(Author author) {
return jdbc.queryForObject(
"select count(ID)>0 from AUTHORS where FULLNAME = :fullName",
Map.of("fullName", author.getFullName()),
Boolean.class);
}
@Override
public Author update(Author author) {
GeneratedKeyHolder keyHolder = new GeneratedKeyHolder();
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValues(Map.of("id", author.getId(), "name", author.getFullName()));
jdbc.update("update AUTHORS set FULLNAME = :name where ID = :id", params, keyHolder);
return (keyHolder.getKey() != null) ? getById(keyHolder.getKey().longValue()).get() : null;
}
@Override
public void delete(long id) {
jdbc.update("delete from AUTHORS where ID = :id", Map.of("id", id));
}
@Override
public Optional<Author> getById(long id) {
return jdbc.query("select ID, FULLNAME from AUTHORS where ID = :id",
Map.of("id", id), new AuthorMapper())
.stream().findFirst();
}
@Override
public Optional<Author> getByName(String fullName) {
return jdbc.query("select ID, FULLNAME from AUTHORS where FULLNAME = :fullName",
Map.of("fullName", fullName), new AuthorMapper())
.stream().findFirst();
}
@Override
public List<Author> getAll() {
return jdbc.query("select ID, FULLNAME from AUTHORS", new AuthorMapper());
}
private static class AuthorMapper implements RowMapper<Author> {
@Override
public Author mapRow(ResultSet resultSet, int i) throws SQLException {
long id = resultSet.getLong("ID");
String fullname = resultSet.getString("FULLNAME");
return Author.builder()
.id(id)
.fullName(fullname)
.build();
}
}
}
|
# -*- coding: utf-8 -*-
#
# MIT License
# Copyright (c) 2020 Netcloud AG
"""AciClient Testing
"""
from requests import RequestException
from aciClient.aci import ACI
import pytest
import time
__BASE_URL = 'testing-apic.ncdev.ch'
def test_login_ok(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'asdafa'}}}
]})
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
assert aci.login()
def test_token_ok(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
token = aci.getToken()
assert token == 'tokenxyz'
def test_login_401(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'status_code': 401, 'text': 'not allowed'},
status_code=401)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
assert not aci.login()
def test_login_404_exception(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'status_code': 404, 'text': 'Not Found'},
status_code=404)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
with pytest.raises(RequestException):
resp = aci.login()
def test_login_refresh_ok(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'refreshTimeoutSeconds': '31', 'token':'tokenxyz'}}}
]})
requests_mock.post(f'https://{__BASE_URL}/api/aaaRefresh.json', json={
'imdata': [
{
'aaaLogin': {
'attributes': {
'refreshTimeoutSeconds': '300',
'token':'tokenabc'
}
}
}
]})
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogout.json', json={'imdata': []}, status_code=200)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown', refresh=True)
aci.login()
token = aci.getToken()
time.sleep(2)
aci.logout()
assert token != aci.getToken()
def test_login_refresh_nok(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'refreshTimeoutSeconds': '31', 'token':'tokenxyz'}}}
]})
requests_mock.post(f'https://{__BASE_URL}/api/aaaRefresh.json', json={
'imdata': []}, status_code=403)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown', refresh=True)
aci.login()
time.sleep(3)
token = aci.getToken()
assert not token
def test_renew_cookie_ok(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
requests_mock.post(f'https://{__BASE_URL}/api/aaaRefresh.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]},
status_code=200)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
assert aci.renewCookie()
def test_renew_cookie_exception(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
requests_mock.post(f'https://{__BASE_URL}/api/aaaRefresh.json', json={'status_code': 401, 'text': 'Not Allowed'},
status_code=401)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
with pytest.raises(RequestException):
aci.renewCookie()
def test_get_tenant_ok(requests_mock):
uri = 'mo/uni/tn-common.json'
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
requests_mock.get(f'https://{__BASE_URL}/api/{uri}',
json={'imdata': [{'fvTenant': {'attributes':
{'annotation': '',
'childAction': '',
'descr': '',
'dn': 'uni/tn-common',
'extMngdBy': '',
'lcOwn': 'local',
'modTs': '2020-11-23T15:53:52.014+00:00',
'monPolDn': 'uni/tn-common/monepg-default',
'name': 'common',
'nameAlias': '',
'ownerKey': '',
'ownerTag': '',
'status': '',
'uid': '0'}}}]
})
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
resp = aci.getJson(uri)
assert 'fvTenant' in resp[0]
def test_get_tenant_ok(requests_mock):
uri = 'mo/uni/tn-common.json'
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
requests_mock.get(f'https://{__BASE_URL}/api/{uri}',
json={'imdata': [{'fvTenant': {'attributes':
{'annotation': '',
'childAction': '',
'descr': '',
'dn': 'uni/tn-common',
'extMngdBy': '',
'lcOwn': 'local',
'modTs': '2020-11-23T15:53:52.014+00:00',
'monPolDn': 'uni/tn-common/monepg-default',
'name': 'common',
'nameAlias': '',
'ownerKey': '',
'ownerTag': '',
'status': '',
'uid': '0'}}}]
})
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
resp = aci.getJson(uri)
assert 'fvTenant' in resp[0]
def test_get_tenant_not_found(requests_mock):
uri = 'mo/uni/tn-commmmmon.json'
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
requests_mock.get(f'https://{__BASE_URL}/api/{uri}',
json={'error': 'Not found'}, status_code=404)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
resp = aci.getJson(uri)
assert 'error' in resp
def test_post_tenant_ok(requests_mock):
post_data = {'fvTenant': {'attributes':
{'descr': '',
'dn': 'uni/tn-test',
'status': 'modified,created'}}
}
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
requests_mock.post(f'https://{__BASE_URL}/api/mo.json',
json={'imdata': post_data})
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
resp = aci.postJson(post_data)
assert resp == 200
def test_post_tenant_bad_request(requests_mock):
post_data = {'fvTenFailFailant': {'attributes':
{'descr': '',
'dn': 'uni/tn-test',
'status': 'modified,created'}}
}
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
requests_mock.post(f'https://{__BASE_URL}/api/mo.json',
json={'imdata': [
{'error': {'attributes': {'text': 'tokenxyz'}}}]},
status_code=400)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
resp = aci.postJson(post_data)
assert resp.startswith('400: ')
def test_post_tenant_forbidden_exception(requests_mock):
post_data = {'fvTenFailFailant': {'attributes':
{'descr': '',
'dn': 'uni/tn-test',
'status': 'modified,created'}}
}
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
requests_mock.post(f'https://{__BASE_URL}/api/mo.json',
json={'imdata': [
{'error': {'attributes': {'text': 'tokenxyz'}}}]},
status_code=403)
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
with pytest.raises(RequestException):
aci.postJson(post_data)
def test_snapshot_ok(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/mo.json', json={"totalCount": "0", "imdata": []})
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
resp = aci.snapshot(description='unit_test')
assert resp
def test_snapshot_nok(requests_mock):
requests_mock.post(f'https://{__BASE_URL}/api/mo.json',
json={"totalCount": "0", "imdata": [{"error": {"attributes": {"text": "Error UnitTest"}}}]},
status_code=400)
requests_mock.post(f'https://{__BASE_URL}/api/aaaLogin.json', json={'imdata': [
{'aaaLogin': {'attributes': {'token': 'tokenxyz'}}}
]})
aci = ACI(apicIp=__BASE_URL, apicUser='admin', apicPasword='unkown')
aci.login()
resp = aci.snapshot(description='unit_test')
assert not resp
|
# Vulk-Bare
Vulk-Bare is a bare metal library for the Vulk 3D engine.
It provides a lot of tools.
[VULK 3D ENGINE](https://github.com/realitix/vulk)
## Provided functions
```python
def load_image(buf, request_components=0):
"""Load a png or jpeg image into a bitmap buffer.
Args:
buf (Buffer): Buffer to load
request_components (int): If you want to force number of components
Returns:
A tuple containing:
- Bitmap buffer
- width of bitmap
- height of bitmap
- number of components
"""
def resize_image(buf, width, height, num_channels, new_width, new_height):
"""Resize an image
Args:
buf (Buffer): Buffer coming from `load_image`
width (int): Width of `buf`
height (int): Height of `buf`
num_channels (int): Number of channels in `buf` (RGBA=4)
new_width (int): Desired width
new_height (int): Desired height
Returns:
Buffer: Resized image
Raises:
ResizeError: If an error occurs during resize
"""
```
|
jsonrpsee::rpc_api! {
Health {
/// Test
fn system_name() -> String;
/// Test2
fn system_name2() -> String;
}
System {
fn test_foo() -> String;
}
}
fn main() {
// Spawning a server in a background task.
async_std::task::spawn(async move {
let listen_addr = "127.0.0.1:8000".parse().unwrap();
let mut server1 = jsonrpsee::http_server(&listen_addr).await.unwrap();
while let Ok(request) = Health::next_request(&mut server1).await {
match request {
Health::SystemName { respond } => {
respond.ok("hello").await;
}
Health::SystemName2 { respond } => {
respond.ok("hello 2").await;
}
}
}
});
// Client demo.
let mut client = jsonrpsee::http_client("http://127.0.0.1:8000");
let v = async_std::task::block_on(Health::system_name(&mut client));
println!("{:?}", v);
}
|
var contentType = require('content-type')
var randombytes = require('randombytes')
var JSONStream = require('JSONStream')
var through = require('through2')
var pumpify = require('pumpify')
var version = require('../package.json').version
/**
* Converts objects from osm-p2p to objects compatible with the OSM JSON format
* @param {object} doc object from osm-p2p
* @return {object} object compatible with the OSM JSON format
*/
function refs2nodes (doc) {
var element = {}
for (var prop in doc) {
if (!doc.hasOwnProperty(prop)) continue
if (prop === 'refs') {
element.nodes = doc.refs
} else {
element[prop] = doc[prop]
}
}
return element
}
/**
* Converts objects from OSM JSON to objects compatible with osm-p2p
* @param {object} obj object from parsing OSM JSON
* @return {object} object compatible with osm-p2p
*/
function nodes2refs (obj) {
var doc = {}
for (var prop in obj) {
if (!obj.hasOwnProperty(prop)) continue
if (prop === 'nodes') {
doc.refs = obj.nodes
} else {
doc[prop] = obj[prop]
}
}
return doc
}
var TEMPLATE = {
version: 0.6,
generator: 'osm-p2p v' + version,
elements: []
}
var SEP = ',\n '
function OsmJSONStream (opts) {
var template = Object.assign({}, TEMPLATE, opts)
var openClose = JSON.stringify(template, null, 4).split('"elements": [')
var open = openClose[0] + '"elements": [\n '
var close = '\n ' + openClose[1]
var stream = pumpify.obj()
var stringify = JSONStream.stringify(open, SEP, close)
stream.setPipeline(convertObservationStream(), stringify)
return stream
}
function convertObservationStream () {
return through.obj(function (doc, enc, next) {
// observations need to be converted nodes for iD editor to draw
// them correctly.
if (doc.type === 'observation') {
// KM: this may not be necessary
doc = Object.assign({}, doc, { type: 'node' })
}
return next(null, doc)
})
}
/**
* Sort function to sort forks by most recent first, or by version id
* if no timestamps are set
*/
function cmpFork (a, b) {
if (a.timestamp && b.timestamp) {
if (a.timestamp > b.timestamp) return -1
if (a.timestamp < b.timestamp) return 1
return 0
}
if (a.timestamp) return -1
if (b.timestamp) return 1
// Ensure sorting is stable between requests
return a.version < b.version ? -1 : 1
}
/**
* Generate a unique 64-bit id string which can be parsed as a 64-bit integer
*/
function generateId () {
return hex2dec(randombytes(8).toString('hex'))
}
function hex2dec (hex) {
return parseInt(hex, 16).toString(10)
}
function isValidContentType (req) {
try {
if (/\/xml$/.test(contentType.parse(req).type)) {
return true
}
} catch (e) {}
}
module.exports = {
refs2nodes: refs2nodes,
nodes2refs: nodes2refs,
generateId: generateId,
isValidContentType: isValidContentType,
cmpFork: cmpFork,
OsmJSONStream: OsmJSONStream,
convertObservationStream: convertObservationStream
}
|
<?php
namespace Oro\Component\Config\Tests\Unit;
use Oro\Component\Config\CumulativeResourceInfo;
class CumulativeResourceInfoTest extends \PHPUnit\Framework\TestCase
{
public function testConfig()
{
$bundleClass = 'bundleClass';
$name = 'name';
$path = 'path';
$data = ['test' => 123];
$resource = new CumulativeResourceInfo($bundleClass, $name, $path, $data);
$this->assertEquals($bundleClass, $resource->bundleClass);
$this->assertEquals($name, $resource->name);
$this->assertEquals($path, $resource->path);
$this->assertEquals($data, $resource->data);
}
}
|
import styled from 'styled-components';
export default styled.nav`
margin: 40px 0;
@media screen and (max-width: 600px) {
visibility: hidden;
margin: 20px 0 0 0;
}
`;
|
export interface Course{
courseId:number;
courseName:string;
courseDuration:string;
courseStartDate:Date;
courseEndDate:Date;
courseFees:string;
}
|
package perfSONAR_PS::RegularTesting::Parsers::Owamp;
use strict;
use warnings;
our $VERSION = 3.1;
=head1 NAME
perfSONAR_PS::RegularTesting::Parsers::Owamp;
=head1 DESCRIPTION
A module that provides simple functions for parsing owamp output
=head1 API
=cut
use base 'Exporter';
use Params::Validate qw(:all);
use Log::Log4perl qw(get_logger);
use Config::General;
use perfSONAR_PS::RegularTesting::Utils qw(owpdelay);
our @EXPORT_OK = qw( parse_owamp_raw_output parse_owamp_summary_file parse_owamp_raw_file );
my $logger = get_logger(__PACKAGE__);
=head2 parse_owamp_raw_output()
=cut
sub parse_owamp_raw_output {
my $parameters = validate( @_, { stdout => 1, });
my $stdout = $parameters->{stdout};
my @packets = ();
for my $line (split('\n', $stdout)) {
# 76 15427415053766410295 0 2.32831e-10 00000000000000000000 1 0.000127792 255
if ($line =~ /^(\d+) (\d+) (\d) ([-.0-9e+]*) (\d+) (\d) ([-.0-9e+]*) (\d+)$/) {
my $sequence_number = $1;
my $source_timestamp = $2;
my $source_synchronized = $3;
my $source_error = $4;
my $destination_timestamp = $5;
my $destination_synchronized = $6;
my $destination_error = $7;
my $ttl = $8;
my %packet_desc = (
sequence_number => $sequence_number
);
# i.e. not a lost or duplicate packet
if ($destination_timestamp != 0) {
$packet_desc{delay} = owpdelay($source_timestamp, $destination_timestamp);
$packet_desc{ttl} = $ttl;
}
push @packets, \%packet_desc;
}
}
return {
pings => \@packets
};
}
sub parse_owamp_summary_file {
my $parameters = validate( @_, { summary_file => 1, });
my $summary_file = $parameters->{summary_file};
my $retval;
eval {
my $conf = Config::General->new($summary_file);
my %conf_hash = $conf->getall;
$retval = \%conf_hash;
};
if ($@) {
$logger->error("Problem reading summary file: ".$summary_file.": ".$@);
}
return $retval;
}
sub parse_owamp_raw_file {
my $parameters = validate( @_, { owstats => 1, raw_file => 1, });
my $owstats = $parameters->{owstats};
my $raw_file = $parameters->{raw_file};
my $retval;
eval {
my $output = `$owstats -R $raw_file`;
$retval = parse_owamp_raw_output({ stdout => $output });
};
if ($@) {
$logger->error("Problem reading summary file: ".$raw_file.": ".$@);
}
return $retval;
}
1;
__END__
=head1 SEE ALSO
To join the 'perfSONAR Users' mailing list, please visit:
https://mail.internet2.edu/wws/info/perfsonar-user
The perfSONAR-PS subversion repository is located at:
http://anonsvn.internet2.edu/svn/perfSONAR-PS/trunk
Questions and comments can be directed to the author, or the mailing list.
Bugs, feature requests, and improvements can be directed here:
http://code.google.com/p/perfsonar-ps/issues/list
=head1 VERSION
$Id: Host.pm 5139 2012-06-01 15:48:46Z aaron $
=head1 AUTHOR
Aaron Brown, aaron@internet2.edu
=head1 LICENSE
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=head1 COPYRIGHT
Copyright (c) 2008-2009, Internet2
All rights reserved.
=cut
# vim: expandtab shiftwidth=4 tabstop=4
|
package controllers
import javax.inject.{Singleton, Inject}
import akka.actor.ActorSystem
import akka.stream.Materializer
import controllers.crud.MongoCrud
import models.commons.{MongoCollectionNames => CN}
import play.api.Configuration
import play.api.mvc._
import play.modules.reactivemongo.{MongoController, ReactiveMongoApi, ReactiveMongoComponents}
import scala.concurrent.ExecutionContext
/**
* Created by wong on 03/12/2016.
*/
@Singleton
abstract class CommonController @Inject()(val reactiveMongoApi: ReactiveMongoApi)
(implicit executionContext: ExecutionContext,
configuration: Configuration,
system: ActorSystem,
materializer: Materializer)
extends Controller with MongoController with ReactiveMongoComponents with MongoCrud {
protected val errorLoginAccess = Unauthorized("You can't access without log in")
}
|
-- | Saving/loading to files, with serialization and compression.
module Game.LambdaHack.Common.HSFile
( encodeEOF, strictDecodeEOF
, tryCreateDir, doesFileExist, tryWriteFile, readFile, renameFile
#ifdef EXPOSE_INTERNAL
-- * Internal operations
, encodeData
#endif
) where
import Prelude ()
import Game.LambdaHack.Core.Prelude
import qualified Codec.Compression.Zlib as Z
import qualified Control.Exception as Ex
import Data.Binary
import qualified Data.ByteString.Lazy as LBS
import Data.Version
import System.Directory
import System.FilePath
import System.IO (IOMode (..), hClose, openBinaryFile, readFile,
withBinaryFile, writeFile)
-- | Serialize and save data.
-- Note that LBS.writeFile opens the file in binary mode.
encodeData :: Binary a => FilePath -> a -> IO ()
encodeData path a = do
let tmpPath = path <.> "tmp"
Ex.bracketOnError
(openBinaryFile tmpPath WriteMode)
(\h -> hClose h >> removeFile tmpPath)
(\h -> do
LBS.hPut h . encode $ a
hClose h
renameFile tmpPath path
)
-- | Serialize, compress and save data with an EOF marker.
-- The @OK@ is used as an EOF marker to ensure any apparent problems with
-- corrupted files are reported to the user ASAP.
encodeEOF :: Binary b => FilePath -> Version -> b -> IO ()
encodeEOF path v b =
encodeData path (v, (Z.compress $ encode b, "OK" :: String))
-- | Read, decompress and deserialize data with an EOF marker.
-- The @OK@ EOF marker ensures any easily detectable file corruption
-- is discovered and reported before any value is decoded from
-- the second component and before the file handle is closed.
-- OTOH, binary encoding corruption is not discovered until a version
-- check elswere ensures that binary formats are compatible.
strictDecodeEOF :: Binary b => FilePath -> IO (Version, b)
strictDecodeEOF path =
withBinaryFile path ReadMode $ \h -> do
c1 <- LBS.hGetContents h
let (v1, (c2, s)) = decode c1
return $! if s == ("OK" :: String)
then (v1, decode $ Z.decompress c2)
else error $ "Fatal error: corrupted file " ++ path
-- | Try to create a directory, if it doesn't exist. We catch exceptions
-- in case many clients try to do the same thing at the same time.
tryCreateDir :: FilePath -> IO ()
tryCreateDir dir = do
dirExists <- doesDirectoryExist dir
unless dirExists $
Ex.handle (\(_ :: Ex.IOException) -> return ())
(createDirectory dir)
-- | Try to write a file, given content, if the file not already there.
-- We catch exceptions in case many clients try to do the same thing
-- at the same time.
tryWriteFile :: FilePath -> String -> IO ()
tryWriteFile path content = do
fileExists <- doesFileExist path
unless fileExists $
Ex.handle (\(_ :: Ex.IOException) -> return ())
(writeFile path content)
|
package org.mulesoft.amfintegration.vocabularies.propertyterms.patched.oaslike.oas3
import org.mulesoft.amfintegration.dialect.dialects.oas.OAS30Dialect
import org.mulesoft.amfintegration.vocabularies.propertyterms.patched.PatchedKeyTerm
trait Oas3PatchedKeyTerm extends PatchedKeyTerm {
override lazy val dialectId: String = OAS30Dialect.dialect.id
}
|
//! An implementation of a byte buffer based on virtual memory.
//!
//! This implementation uses `mmap` on POSIX systems (and should use `VirtualAlloc` on windows).
//! There are possibilities to improve the performance for the reallocating case by reserving
//! memory up to maximum. This might be a problem for systems that don't have a lot of virtual
//! memory (i.e. 32-bit platforms).
use core::{
fmt,
fmt::{Debug, Display},
slice,
};
use region::{Allocation, Protection};
/// Dummy error for fallible `Vec`-based virtual memory operations.
#[derive(Debug)]
pub enum VirtualMemoryError {
Region(region::Error),
AllocationOutOfBounds,
}
impl From<region::Error> for VirtualMemoryError {
fn from(error: region::Error) -> Self {
Self::Region(error)
}
}
impl Display for VirtualMemoryError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::Region(error) => write!(
f,
"encountered failure while operating with virtual memory: {}",
error
),
Self::AllocationOutOfBounds => write!(f, "virtual memory allocation is too big"),
}
}
}
/// A virtual memory buffer.
pub struct VirtualMemory {
/// The virtual memory allocation.
allocation: Allocation,
}
impl Debug for VirtualMemory {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("VirtualMemory")
.field("len", &self.allocation.len())
.finish()
}
}
impl VirtualMemory {
/// The maximum allocation size for a `wasmi` virtual memory.
const MAX_ALLOCATION_SIZE: usize = u32::MAX as usize;
/// Create a new virtual memory allocation.
///
/// # Note
///
/// The allocated virtual memory allows for read and write operations.
///
/// # Errors
///
/// - If `len` should not exceed `isize::max_value()`
/// - If `len` should be greater than 0.
/// - If the operating system returns an error upon virtual memory allocation.
pub fn new(len: usize) -> Result<Self, VirtualMemoryError> {
assert_ne!(len, 0, "cannot allocate empty virtual memory");
if len > Self::MAX_ALLOCATION_SIZE {
return Err(VirtualMemoryError::AllocationOutOfBounds);
}
let allocation = region::alloc(len, Protection::READ_WRITE)?;
Ok(Self { allocation })
}
/// Returns a shared slice over the bytes of the virtual memory allocation.
pub fn data(&self) -> &[u8] {
// # SAFETY
//
// The operation is safe since we assume that the virtual memory allocation
// has been successful and allocated exactly `self.allocation.len()` bytes.
// Therefore creating a slice with `self.len` elements is valid.
// Aliasing guarantees are not violated since `self` is the only owner
// of the underlying virtual memory allocation.
unsafe { slice::from_raw_parts(self.allocation.as_ptr(), self.allocation.len()) }
}
/// Returns an exclusive slice over the bytes of the virtual memory allocation.
pub fn data_mut(&mut self) -> &mut [u8] {
// # SAFETY
//
// See safety proof of the `as_slice` method.
// Additionally, it is not possible to obtain two mutable references for the same memory area.
unsafe { slice::from_raw_parts_mut(self.allocation.as_mut_ptr(), self.allocation.len()) }
}
}
|
{!! Form::text($input, $value ?? null, $attributes) !!}
|
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string(255)
# description :text
# created_at :datetime
# updated_at :datetime
# location :text
# total_budget_cents :integer default(0)
# total_budget_currency :string(255) default("USD"), not null
# selected_total_amount_cents :integer default(0), not null
# selected_total_amount_currency :string(255) default("USD"), not null
# deadline_notification_sent_at :datetime
#
class Project < ActiveRecord::Base
has_many :areas, dependent: :destroy
has_many :attachments, class_name: ProjectAttachment, dependent: :destroy
has_many :budget_items, dependent: :destroy
has_many :categories, dependent: :destroy
has_many :deadlines, dependent: :destroy
has_many :finishes, dependent: :destroy
has_many :project_organizations, dependent: :destroy
has_many :organizations, through: :project_organizations
has_many :project_users, dependent: :destroy
has_many :users, through: :project_users
# monetize :total_budget_cents
# monetize :selected_total_amount_cents
def total_budget=
end
def total_budget
end
validates :name, presence: true, length: { maximum: 255 }
def self.with_notifiable_deadlines
# how long before a due date should we notify
notification_range = 1.week
# how often to notify
notification_window = 3.days
due_date_start = Date.today
due_date_end = due_date_start + notification_range
notified_at = Time.now - notification_window
joins(:deadlines).where(deadlines: { complete: false })
.where("deadlines.due_date > ?", due_date_start)
.where("deadlines.due_date < ?", due_date_end)
.where("projects.deadline_notification_sent_at IS NULL OR projects.deadline_notification_sent_at < ?", notified_at)
end
def owners
users.where(project_users: { role: "owner" })
end
alias :finish_selectors :owners
def collaborators
users.where(project_users: { role: "collaborator" })
end
def selected_finishes
finishes.selected
end
def calculate_selected_total_amount
selected_finishes.inject(Money.new 0) do |total, finish|
finish.quantity * finish.price + total
end
end
def set_selected_total_amount!
self.selected_total_amount = calculate_selected_total_amount
save!
end
def budget_for_category(category_id)
Money.new budget_items.filter_by_category(category_id).sum(:amount_cents)
end
def calculate_total_budget
Money.new budget_items.sum(:amount_cents)
end
def set_total_budget!
self.total_budget = calculate_total_budget
save!
end
def set_deadline_notification_sent_at!
self.deadline_notification_sent_at = Time.now
save!
end
end
|
package pongo2echo
import (
`bytes`
`embed`
`io`
`path`
`github.com/flosch/pongo2`
)
func NewLoader(prefix string, fs *embed.FS) pongo2.TemplateLoader {
return &Loader{
prefix: prefix,
fs: fs,
}
}
type Loader struct {
prefix string
fs *embed.FS
}
func (l *Loader) Abs(_, name string) string {
return path.Join(l.prefix, name)
}
func (l *Loader) Get(path string) (io.Reader, error) {
b, err := l.fs.ReadFile(path)
if err != nil {
return nil, err
}
return bytes.NewReader(b), nil
}
|
const {text} = require('./output.js');
/**
* Sugar.Combinators.ServerErrors
* written by Joel Dentici
* on 6/18/2017
*
* Combinators for serving 5xx status HTTP responses
*/
/**
* INTERNAL_ERROR :: string -> WebPart
*
* HTTP 500 Status Internal Service Error
* response. Used when an unexpected error
* occurs and no more information exists to
* give a better error.
*/
exports.INTERNAL_ERROR = text(500);
/**
* NOT_IMPLEMENTED :: string -> WebPart
*
* HTTP 501 Not Implemented Error. The
* requested service is not yet available,
* but is likely to be implemented in the
* future.
*/
exports.NOT_IMPLEMENTED = text(501);
/**
* BAD_GATEWAY :: string -> WebPart
*
* HTTP 502 Bad Gateway. An upstream server
* returned an invalid response when this
* server was acting as a gateway.
*/
exports.BAD_GATEWAY = text(502);
/**
* SERVICE_UNAVAILABLE :: string -> WebPart
*
* HTTP 503 Service Unavailable. The server is
* not currently available.
*/
exports.SERVICE_UNAVAILABLE = text(503);
/**
* GATEWAY_TIMEOUT :: string -> WebPart
*
* HTTP 504 Gateway Timeout. An upstream server
* did not respond in a timely manner when this
* server was acting as a gateway.
*/
exports.GATEWAY_TIMEOUT = text(504);
/**
* INVALID_HTTP_VERSION :: string -> WebPart
*
* 505 HTTP Version Not Supported. The server
* does not support the version of the HTTP
* protocol used in the request.
*/
exports.INVALID_HTTP_VERSION = text(505);
|
void main(){
int num1=2;
int num2=3;
// if(num1==num2){
// print("Equal");
// }
// else if(num1<num2){
// print("$num2 is greater than $num1");
// }
// else{
// print("$num1 is greater than $num2");
// }
bool isEven=true;
// if(isEven){
// print("True");
// }
// else{
// print("false");
// }
if(num1<num2 && isEven){
print(num1>num2 && isEven);
print(num1>num2 || isEven);
}
}
|
import { parseSize } from '../utils'
const data = {
flexauto: {
'flex': '1 1 auto',
},
flexinitial: {
'flex': '0 1 auto',
},
flexnone: {
'flex': 'none',
},
}
/**
* flex
* flexAuto flex: 1 1 auto;
* flexInitial flex: 0 1 auto;
* flexNone flex: 'none';
* flex-1-2-auto flex: 1-2-auto;
*/
export default {
name: 'flex',
match: (k, config) => {
if (data[k]) {
return true
} else if (k.startsWith('flex-')) {
return true
}
return false
},
translate: (k, config, obj) => {
if (data[k]) {
return {
display: 'flex',
...data[k],
}
} else if (k.startsWith('flex-')) {
// flex 为2个值时,不判断
// flex 为3个值,且basis不为0时,替换basis单位: flex-grow | flex-shrink | flex-basis
const str = k.replace('flex-', '')
const values = str.split('-')
if (values.length === 3 && values[2] !== '0') {
values[2] = parseSize(values[2], config.unit)
}
const val = values.join(' ')
return {
display: 'flex',
'flex': val
}
}
}
}
|
! Create the righthand side to the elliptic equation that is solved in
! the MAC project step, \beta0 * (S - \bar{S}). For the MAC projection,
! this quantity is cell-centered.
!
! Note, we include the delta_gamma1_term here, to (possibly) account for
! the effect of replacing \Gamma_1 by {\Gamma_1}_0 in the constraint
! equation (see paper III).
module macrhs_module
use bl_types
use multifab_module
implicit none
private
public :: make_macrhs
contains
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine make_macrhs(macrhs,rho0,S_cc,delta_gamma1_term,Sbar,beta0,dx, &
gamma1bar,p0,delta_p_term,dt,delta_chi,is_predictor)
use bl_prof_module
use bl_constants_module
use geometry, only: spherical
type(multifab) , intent(inout) :: macrhs(:)
real(kind=dp_t), intent(in ) :: rho0(:,0:)
type(multifab) , intent(in ) :: S_cc(:)
type(multifab) , intent(in ) :: delta_gamma1_term(:)
real(kind=dp_t), intent(in ) :: Sbar(:,0:)
real(kind=dp_t), intent(in ) :: beta0(:,0:)
real(kind=dp_t), intent(in ) :: dx(:,:), dt
real(kind=dp_t), intent(in ) :: gamma1bar(:,0:)
real(kind=dp_t), intent(in ) :: p0(:,0:)
type(multifab) , intent(in ) :: delta_p_term(:)
type(multifab) , intent(inout) :: delta_chi(:)
logical , intent(in ) :: is_predictor
real(kind=dp_t), pointer:: mp(:,:,:,:),sp(:,:,:,:),gp(:,:,:,:)
real(kind=dp_t), pointer:: pop(:,:,:,:),dp(:,:,:,:)
integer :: lo(get_dim(macrhs(1))),hi(get_dim(macrhs(1))),dm,nlevs
integer :: i,n,ng_rh,ng_sr,ng_dg,ng_dp,ng_d
type(bl_prof_timer), save :: bpt
call build(bpt, "make_macrhs")
dm = get_dim(macrhs(1))
nlevs = size(macrhs)
ng_rh = nghost(macrhs(1))
ng_sr = nghost(S_cc(1))
ng_dg = nghost(delta_gamma1_term(1))
ng_dp = nghost(delta_p_term(1))
ng_d = nghost(delta_chi(1))
do n = 1, nlevs
do i = 1, nfabs(S_cc(n))
mp => dataptr(macrhs(n), i)
sp => dataptr(S_cc(n), i)
gp => dataptr(delta_gamma1_term(n), i)
dp => dataptr(delta_chi(n), i)
pop => dataptr(delta_p_term(n), i)
lo = lwb(get_box(S_cc(n), i))
hi = upb(get_box(S_cc(n), i))
select case (dm)
case (1)
call make_macrhs_1d(n,lo,hi,mp(:,1,1,1),ng_rh,sp(:,1,1,1),ng_sr, &
gp(:,1,1,1),ng_dg,Sbar(n,:),beta0(n,:), &
gamma1bar(n,:),p0(n,:), &
pop(:,1,1,1),ng_dp, &
dp(:,1,1,1),ng_d,dt,is_predictor)
case (2)
call make_macrhs_2d(n,lo,hi,mp(:,:,1,1),ng_rh,sp(:,:,1,1),ng_sr, &
gp(:,:,1,1),ng_dg,Sbar(n,:),beta0(n,:), &
gamma1bar(n,:),p0(n,:), &
pop(:,:,1,1),ng_dp,dp(:,:,1,1),ng_d, &
dt,is_predictor)
case (3)
if (spherical .eq. 1) then
call make_macrhs_3d_sphr(lo,hi,rho0(1,:),mp(:,:,:,1),ng_rh,sp(:,:,:,1), &
ng_sr,gp(:,:,:,1),ng_dg,Sbar(1,:),beta0(1,:), &
dx(n,:),gamma1bar(1,:), &
p0(1,:),pop(:,:,:,1),ng_dp, &
dp(:,:,:,1),ng_d,dt,is_predictor)
else
call make_macrhs_3d(n,lo,hi,mp(:,:,:,1),ng_rh,sp(:,:,:,1),ng_sr, &
gp(:,:,:,1),ng_dg,Sbar(n,:),beta0(n,:), &
gamma1bar(n,:), &
p0(n,:),pop(:,:,:,1),ng_dp, &
dp(:,:,:,1),ng_d,dt,is_predictor)
end if
end select
end do
enddo
call destroy(bpt)
end subroutine make_macrhs
subroutine make_macrhs_1d(n,lo,hi,rhs,ng_rh,S_cc,ng_sr,delta_gamma1_term,ng_dg, &
Sbar,beta0,gamma1bar,p0, &
delta_p_term,ng_dp,delta_chi,ng_d,dt,is_predictor)
use probin_module, only: dpdt_factor
use geometry, only: base_cutoff_density_coord
integer , intent(in ) :: n, lo(:), hi(:), ng_rh, ng_sr, ng_dg, ng_dp, ng_d
real (kind=dp_t), intent( out) :: rhs(lo(1)-ng_rh:)
real (kind=dp_t), intent(in ) :: S_cc(lo(1)-ng_sr:)
real (kind=dp_t), intent(in ) :: delta_gamma1_term(lo(1)-ng_dg:)
real (kind=dp_t), intent(in ) :: Sbar(0:)
real (kind=dp_t), intent(in ) :: beta0(0:)
real (kind=dp_t), intent(in ) :: gamma1bar(0:)
real (kind=dp_t), intent(in ) :: p0(0:)
real (kind=dp_t), intent(in ) :: delta_p_term(lo(1)-ng_dp:)
real (kind=dp_t), intent(inout) :: delta_chi(lo(1)-ng_d :)
real (kind=dp_t), intent(in ) :: dt
logical , intent(in ) :: is_predictor
! Local variables
integer :: i
do i = lo(1),hi(1)
rhs(i) = beta0(i) * (S_cc(i) - Sbar(i) + delta_gamma1_term(i))
end do
if (dpdt_factor .gt. 0.0d0) then
if (is_predictor) &
delta_chi = 0.d0
do i = lo(1),hi(1)
if (i .lt. base_cutoff_density_coord(n)) then
delta_chi(i) = delta_chi(i) + dpdt_factor * delta_p_term(i) / (dt*gamma1bar(i)*p0(i))
rhs(i) = rhs(i) + beta0(i) * delta_chi(i)
end if
end do
end if
end subroutine make_macrhs_1d
subroutine make_macrhs_2d(n,lo,hi,rhs,ng_rh,S_cc,ng_sr,delta_gamma1_term,ng_dg, &
Sbar,beta0,gamma1bar,p0, &
delta_p_term,ng_dp,delta_chi,ng_d,dt,is_predictor)
use probin_module, only: dpdt_factor
use geometry, only: base_cutoff_density_coord
integer , intent(in ) :: n, lo(:), hi(:), ng_rh, ng_sr, ng_dg, ng_dp, ng_d
real (kind=dp_t), intent( out) :: rhs(lo(1)-ng_rh:,lo(2)-ng_rh:)
real (kind=dp_t), intent(in ) :: S_cc(lo(1)-ng_sr:,lo(2)-ng_sr:)
real (kind=dp_t), intent(in ) :: delta_gamma1_term(lo(1)-ng_dg:,lo(2)-ng_dg:)
real (kind=dp_t), intent(in ) :: Sbar(0:)
real (kind=dp_t), intent(in ) :: beta0(0:)
real (kind=dp_t), intent(in ) :: gamma1bar(0:)
real (kind=dp_t), intent(in ) :: p0(0:)
real (kind=dp_t), intent(in ) :: delta_p_term(lo(1)-ng_dp:,lo(2)-ng_dp:)
real (kind=dp_t), intent(inout) :: delta_chi(lo(1)-ng_d :,lo(2)-ng_d :)
real (kind=dp_t), intent(in ) :: dt
logical , intent(in ) :: is_predictor
! Local variables
integer :: i, j
do j = lo(2),hi(2)
do i = lo(1),hi(1)
rhs(i,j) = beta0(j) * (S_cc(i,j) - Sbar(j) + delta_gamma1_term(i,j))
end do
end do
if (dpdt_factor .gt. 0.0d0) then
if (is_predictor) &
delta_chi = 0.d0
do j = lo(2),hi(2)
if (j .lt. base_cutoff_density_coord(n)) then
do i = lo(1),hi(1)
delta_chi(i,j) = delta_chi(i,j) + dpdt_factor * delta_p_term(i,j) / (dt*gamma1bar(j)*p0(j))
rhs(i,j) = rhs(i,j) + beta0(j) * delta_chi(i,j)
end do
end if
end do
end if
end subroutine make_macrhs_2d
subroutine make_macrhs_3d(n,lo,hi,rhs,ng_rh,S_cc,ng_sr,delta_gamma1_term,ng_dg, &
Sbar,beta0,gamma1bar,p0, &
delta_p_term,ng_dp,delta_chi,ng_d,dt,is_predictor)
use geometry, only: base_cutoff_density_coord
use probin_module, only: dpdt_factor
use fill_3d_module
integer , intent(in ) :: n,lo(:),hi(:),ng_rh,ng_sr,ng_dg,ng_dp,ng_d
real (kind=dp_t), intent( out) :: rhs(lo(1)-ng_rh:,lo(2)-ng_rh:,lo(3)-ng_rh:)
real (kind=dp_t), intent(in ) :: S_cc(lo(1)-ng_sr:,lo(2)-ng_sr:,lo(3)-ng_sr:)
real (kind=dp_t), intent(in) :: delta_gamma1_term(lo(1)-ng_dg:,lo(2)-ng_dg:,lo(3)-ng_dg:)
real (kind=dp_t), intent(in ) :: Sbar(0:)
real (kind=dp_t), intent(in ) :: beta0(0:)
real (kind=dp_t), intent(in ) :: gamma1bar(0:)
real (kind=dp_t), intent(in ) :: p0(0:)
real (kind=dp_t), intent(in ) :: delta_p_term(lo(1)-ng_dp:,lo(2)-ng_dp:,lo(3)-ng_dp:)
real (kind=dp_t), intent(inout) :: delta_chi(lo(1)-ng_d :,lo(2)-ng_d :,lo(3)-ng_d: )
real (kind=dp_t), intent(in ) :: dt
logical , intent(in ) :: is_predictor
! Local variables
integer :: i, j, k
!$OMP PARALLEL DO PRIVATE(i,j,k)
do k = lo(3),hi(3)
do j = lo(2),hi(2)
do i = lo(1),hi(1)
rhs(i,j,k) = beta0(k) * &
(S_cc(i,j,k) - Sbar(k) + delta_gamma1_term(i,j,k))
end do
end do
end do
!$OMP END PARALLEL DO
if (dpdt_factor .gt. 0.0d0) then
if (is_predictor) &
delta_chi = 0.d0
!$OMP PARALLEL DO PRIVATE(i,j,k)
do k = lo(3),hi(3)
if (k .lt. base_cutoff_density_coord(n)) then
do j = lo(2),hi(2)
do i = lo(1),hi(1)
delta_chi(i,j,k) = delta_chi(i,j,k) + dpdt_factor * delta_p_term(i,j,k) / &
(dt*gamma1bar(k)*p0(k))
rhs(i,j,k) = rhs(i,j,k) + beta0(k) * delta_chi(i,j,k)
end do
end do
end if
end do
!$OMP END PARALLEL DO
end if
end subroutine make_macrhs_3d
subroutine make_macrhs_3d_sphr(lo,hi,rho0,rhs,ng_rh,S_cc,ng_sr,delta_gamma1_term,ng_dg, &
Sbar,beta0,dx,gamma1bar,p0, &
delta_p_term,ng_dp,delta_chi,ng_d,dt,is_predictor)
use probin_module, only: dpdt_factor, base_cutoff_density
use fill_3d_module
integer , intent(in ) :: lo(:),hi(:),ng_rh,ng_sr,ng_dg,ng_dp,ng_d
real (kind=dp_t), intent(in ) :: rho0(0:)
real (kind=dp_t), intent( out) :: rhs(lo(1)-ng_rh:,lo(2)-ng_rh:,lo(3)-ng_rh:)
real (kind=dp_t), intent(in ) :: S_cc(lo(1)-ng_sr:,lo(2)-ng_sr:,lo(3)-ng_sr:)
real (kind=dp_t), intent(in) :: delta_gamma1_term(lo(1)-ng_dg:,lo(2)-ng_dg:,lo(3)-ng_dg:)
real (kind=dp_t), intent(in ) :: Sbar(0:)
real (kind=dp_t), intent(in ) :: beta0(0:)
real (kind=dp_t), intent(in ) :: dx(:)
real (kind=dp_t), intent(in ) :: gamma1bar(0:)
real (kind=dp_t), intent(in ) :: p0(0:)
real (kind=dp_t), intent(in ) :: delta_p_term(lo(1)-ng_dp:,lo(2)-ng_dp:,lo(3)-ng_dp:)
real (kind=dp_t), intent(inout) :: delta_chi(lo(1)-ng_d :,lo(2)-ng_d :,lo(3)-ng_d: )
real (kind=dp_t), intent(in ) :: dt
logical , intent(in ) :: is_predictor
! Local variables
integer :: i, j, k
real(kind=dp_t), allocatable :: div_cart(:,:,:,:)
real(kind=dp_t), allocatable :: Sbar_cart(:,:,:,:)
real(kind=dp_t), allocatable :: gamma1bar_cart(:,:,:,:)
real(kind=dp_t), allocatable :: p0_cart(:,:,:,:)
real(kind=dp_t), allocatable :: rho0_cart(:,:,:,:)
allocate(div_cart(lo(1):hi(1),lo(2):hi(2),lo(3):hi(3),1))
call put_1d_array_on_cart_3d_sphr(.false.,.false.,beta0,div_cart,lo,hi,dx,0)
allocate(Sbar_cart(lo(1):hi(1),lo(2):hi(2),lo(3):hi(3),1))
call put_1d_array_on_cart_3d_sphr(.false.,.false.,Sbar,Sbar_cart,lo,hi,dx,0)
do k = lo(3),hi(3)
do j = lo(2),hi(2)
do i = lo(1),hi(1)
rhs(i,j,k) = div_cart(i,j,k,1) * (S_cc(i,j,k) - Sbar_cart(i,j,k,1) + &
delta_gamma1_term(i,j,k))
end do
end do
end do
deallocate(Sbar_cart)
if (dpdt_factor .ge. 0.0d0) then
allocate(gamma1bar_cart(lo(1):hi(1),lo(2):hi(2),lo(3):hi(3),1))
call put_1d_array_on_cart_3d_sphr(.false.,.false.,gamma1bar, &
gamma1bar_cart,lo,hi,dx,0)
allocate(p0_cart(lo(1):hi(1),lo(2):hi(2),lo(3):hi(3),1))
call put_1d_array_on_cart_3d_sphr(.false.,.false.,p0,p0_cart,lo,hi,dx,0)
allocate(rho0_cart(lo(1):hi(1),lo(2):hi(2),lo(3):hi(3),1))
call put_1d_array_on_cart_3d_sphr(.false.,.false.,rho0,rho0_cart,lo,hi,dx,0)
if (is_predictor) &
delta_chi = 0.d0
!$OMP PARALLEL DO PRIVATE(i,j,k)
do k = lo(3),hi(3)
do j = lo(2),hi(2)
do i = lo(1),hi(1)
if (rho0_cart(i,j,k,1) .gt. base_cutoff_density) then
delta_chi(i,j,k) = delta_chi(i,j,k) + dpdt_factor * delta_p_term(i,j,k) / &
(dt*gamma1bar_cart(i,j,k,1)*p0_cart(i,j,k,1))
rhs(i,j,k) = rhs(i,j,k) + div_cart(i,j,k,1) * delta_chi(i,j,k)
end if
end do
end do
end do
!$OMP END PARALLEL DO
deallocate(gamma1bar_cart,p0_cart,rho0_cart)
end if
deallocate(div_cart)
end subroutine make_macrhs_3d_sphr
end module macrhs_module
|
import { config } from './fragments.config';
export const WHITE = config.colors.white;
export const GREY_100 = config.colors['grey-100'];
export const GREY_200 = config.colors['grey-200'];
export const GREY_300 = config.colors['grey-300'];
export const GREY_400 = config.colors['grey-400'];
export const GREY_500 = config.colors['grey-500'];
export const GREY_600 = config.colors['grey-600'];
export const GREY_700 = config.colors['grey-700'];
export const GREY_800 = config.colors['grey-800'];
export const GREY_900 = config.colors['grey-900'];
export const ORANGE_100 = config.colors['orange-100'];
export const ORANGE_200 = config.colors['orange-200'];
export const ORANGE_300 = config.colors['orange-300'];
export const ORANGE_400 = config.colors['orange-400'];
export const ORANGE_500 = config.colors['orange-500'];
export const ORANGE_600 = config.colors['orange-600'];
export const ORANGE_700 = config.colors['orange-700'];
export const ORANGE_800 = config.colors['orange-800'];
export const ORANGE_900 = config.colors['orange-900'];
export const NEBULA_100 = config.colors['nebula-100'];
export const NEBULA_200 = config.colors['nebula-200'];
export const NEBULA_300 = config.colors['nebula-300'];
export const NEBULA_400 = config.colors['nebula-400'];
export const NEBULA_500 = config.colors['nebula-500'];
export const NEBULA_600 = config.colors['nebula-600'];
export const NEBULA_700 = config.colors['nebula-700'];
export const NEBULA_800 = config.colors['nebula-800'];
export const NEBULA_900 = config.colors['nebula-900'];
export const PINK_100 = config.colors['pink-100'];
export const PINK_200 = config.colors['pink-200'];
export const PINK_300 = config.colors['pink-300'];
export const PINK_400 = config.colors['pink-400'];
export const PINK_500 = config.colors['pink-500'];
export const PINK_600 = config.colors['pink-600'];
export const PINK_700 = config.colors['pink-700'];
export const PINK_800 = config.colors['pink-800'];
export const PINK_900 = config.colors['pink-900'];
export const RED_100 = config.colors['red-100'];
export const RED_200 = config.colors['red-200'];
export const RED_300 = config.colors['red-300'];
export const RED_400 = config.colors['red-400'];
export const RED_500 = config.colors['red-500'];
export const RED_600 = config.colors['red-600'];
export const RED_700 = config.colors['red-700'];
export const RED_800 = config.colors['red-800'];
export const RED_900 = config.colors['red-900'];
export const CYAN_100 = config.colors['cyan-100'];
export const CYAN_200 = config.colors['cyan-200'];
export const CYAN_300 = config.colors['cyan-300'];
export const CYAN_400 = config.colors['cyan-400'];
export const CYAN_500 = config.colors['cyan-500'];
export const CYAN_600 = config.colors['cyan-600'];
export const CYAN_700 = config.colors['cyan-700'];
export const CYAN_800 = config.colors['cyan-800'];
export const CYAN_900 = config.colors['cyan-900'];
export const GREEN_100 = config.colors['green-100'];
export const GREEN_200 = config.colors['green-200'];
export const GREEN_300 = config.colors['green-300'];
export const GREEN_400 = config.colors['green-400'];
export const GREEN_500 = config.colors['green-500'];
export const GREEN_600 = config.colors['green-600'];
export const GREEN_700 = config.colors['green-700'];
export const GREEN_800 = config.colors['green-800'];
export const GREEN_900 = config.colors['green-900'];
export const COLOR_SEARCH = config.colors.search;
export const COLOR_ANSWERS = config.colors.answers;
export const COLOR_RECOMMEND = config.colors.recommend;
|
CREATE TABLE IF NOT EXISTS rdm.application (
code VARCHAR PRIMARY KEY,
name VARCHAR,
system_code VARCHAR,
CONSTRAINT application_system_fk FOREIGN KEY (system_code) REFERENCES rdm.system(code)
);
COMMENT ON TABLE rdm.application IS 'Приложения';
COMMENT ON COLUMN rdm.application.code IS 'Код приложения';
COMMENT ON COLUMN rdm.application.name IS 'Наименование приложения';
COMMENT ON COLUMN rdm.application.system_code IS 'Код прикладной системы';
|
import Pmw
from Tkinter import *
from tkSimpleDialog import Dialog
import os,string
from tv import readCT
class viewCT(Dialog):
"ColorTable(Dialog) - dialog to preview color table"
def body(self,master):
self.cwidth = 256
self.cheight = 40
self.title("Color Table Dialog...")
self.canvas = Canvas(master,width=self.cwidth,height=self.cheight)
self.canvas.create_rectangle(0,0,self.cwidth,self.cheight)
self.canvas.pack()
self.CT = readCT()
dname=('0 B-W LINEAR','1 BLUE/WHITE','2 GRN-RED-BLU-WHT',
'3 RED TEMPERATURE','4 BLUE/GREEN/RED/YELLOW','5 STD GAMMA-II',
'6 PRISM','7 RED-PURPLE','8 GREEN/WHITE LINEAR',
'9 GRN/WHT EXPONENTIAL','10 GREEN-PINK','11 BLUE-RED',
'12 16-LEVEL','13 RAINBOW','14 STEPS',
'15 STERN SPECIAL','16 Haze','17 Blue-Pastel-Red',
'18 Pastels','19 Hue Sat Lightness1','20 Hue Sat Lightness2',
'21 Hue Sat Value 1','22 Hue Sat Value 2','23 Purple-Red + Stripes',
'24 Beach','25 Mac Style','26 Eos A',
'27 Eos B','28 Hardcandy','29 Nature',
'30 Ocean','31 Peppermint','32 Plasma',
'33 Blue-Red','34 Rainbow',
'35 Blue Waves','36 Volcano','37 Waves',
'38 Rainbow18','39 Rainbow + white','40 Rainbow + black')
self.dialog = Pmw.ScrolledListBox(master,
labelpos=NW, label_text='Pick color table',
selectioncommand=self.apply,
items=dname,listbox_width=40)
self.dialog.pack(fill=BOTH,expand=1,padx=5,pady=5)
return self.dialog.curselection()
def apply(self):
rts = self.dialog.curselection()
index = string.atoi(rts[0])
from Numeric import reshape
rgb = reshape(self.CT[index],(256,3))
for i in range(256):
pp = rgb[i]
col = '#%02x%02x%02x' % (int(pp[0]),int(pp[1]),int(pp[2]))
self.canvas.create_line(i,0,i,self.cheight,fill=col)
fo = open('1.txt','w')
fo.write(str(index))
fo.close
def getCTI(root):
dialog=viewCT(root)
fi = open('1.txt','r')
x = fi.read()
fi.close
return int(x)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.