text
stringlengths
1
1.05M
<gh_stars>1-10 """Used as an example of ring experiment. This example consists of 22 IDM cars on a ring creating shockwaves. """ from flow.controllers import IDMController, ContinuousRouter from flow.core.params import SumoParams, EnvParams, InitialConfig, NetParams from flow.core.params import VehicleParams from flow.envs.ring.accel import AccelEnv, ADDITIONAL_ENV_PARAMS from flow.networks.ring import RingNetwork, ADDITIONAL_NET_PARAMS vehicles = VehicleParams() vehicles.add( veh_id="idm", acceleration_controller=(IDMController, { 'noise':0.2 }), routing_controller=(ContinuousRouter, {}), num_vehicles=22) flow_params = dict( # name of the experiment exp_tag='ring', # name of the flow environment the experiment is running on env_name=AccelEnv, # name of the network class the experiment is running on network=RingNetwork, # simulator that is used by the experiment simulator='traci', # sumo-related parameters (see flow.core.params.SumoParams) sim=SumoParams( render=True, sim_step=0.1, ), # environment related parameters (see flow.core.params.EnvParams) env=EnvParams( horizon=1500, warmup_steps=750, additional_params=ADDITIONAL_ENV_PARAMS, ), # network-related parameters (see flow.core.params.NetParams and the # network's documentation or ADDITIONAL_NET_PARAMS component) net=NetParams( additional_params=ADDITIONAL_NET_PARAMS.copy(), ), # vehicles to be placed in the network at the start of a rollout (see # flow.core.params.VehicleParams) veh=vehicles, # parameters specifying the positioning of vehicles upon initialization/ # reset (see flow.core.params.InitialConfig) initial=InitialConfig( bunching=20, ), )
<reponame>syberflea/materials<filename>build-a-django-content-aggregator/source_code_step_7/podcasts/admin.py from django.contrib import admin from .models import Episode @admin.register(Episode) class EpisodeAdmin(admin.ModelAdmin): list_display = ("podcast_name", "title", "pub_date")
#!/bin/sh itShouldCheckThatAllInstalledSoftwareExists() { doesCommandExist node doesCommandExist npm } itShouldMatchTheDesiredVersions() { doesMatchVersion node v12.22.12 doesMatchVersion npm 6.14.16 } doesCommandExist() { if ! [ -x "$(command -v $1)" ]; then echo "Error: $1 is not installed." >&2 exit 1 fi } doesMatchVersion() { VERSION=$($1 -v|grep -i "$2") if [ -z "$VERSION" ]; then echo "Error: $1 version $2 is not found, found $($1 -v) instead." >&2 exit 1 fi } itShouldCheckThatAllInstalledSoftwareExists itShouldMatchTheDesiredVersions
/** * @module botframework-streaming */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { IReceiveResponse } from '../interfaces/IReceiveResponse'; /** * Orchestrates and manages pending streaming requests. */ export declare class RequestManager { private readonly _pendingRequests; /** * Gets the count of the pending requests. * @returns Number with the pending requests count. */ pendingRequestCount(): number; /** * Signal fired when all response tasks have completed. * @param requestId The ID of the StreamingRequest. * @param response The [IReceiveResponse](xref:botframework-streaming.IReceiveResponse) in response to the request. */ signalResponse(requestId: string, response: IReceiveResponse): Promise<boolean>; /** * Constructs and returns a response for this request. * @param requestId The ID of the StreamingRequest being responded to. * @returns The response to the specified request. */ getResponse(requestId: string): Promise<IReceiveResponse>; } //# sourceMappingURL=requestManager.d.ts.map
import React from 'react'; import ReactDOM from 'react-dom'; import {BrowserRouter} from 'react-router-dom' import App from './App'; import createStore from './store'; import { Provider } from 'react-redux'; import registerServiceWorker from './registerServiceWorker'; ReactDOM.render( <Provider store={createStore()}> <BrowserRouter> <App /> </BrowserRouter> </Provider>, document.getElementById('root')); registerServiceWorker();
# Author: Bela Ban #!/bin/bash JG=$HOME/JGroups jgroups.sh org.jgroups.util.DumpData $*
<reponame>EmanuelCampos/nft-contract-boilerplate<gh_stars>1-10 require("@nomiclabs/hardhat-waffle"); const fs = require("fs") const privateKey = fs.readFileSync(".secret").toString() const projectId = module.exports = { networks: { hardhat: { chainId: 1337 }, rinkeby: { url: `https://rinkeby.infura.io/v3/${projectId}`, accounts: [privateKey] }, }, solidity: "0.8.4", };
// Copyright 2020 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <gtest/gtest.h> #include <string> #include <utility> #include "ml/soda_proto_mojom_conversion.h" namespace ml { using speech::soda::chrome::SodaResponse; TEST(SodaProtoMojomConversionTest, AudioLevelsTest) { SodaResponse response; response.set_soda_type(SodaResponse::AUDIO_LEVEL); response.mutable_audio_level_info()->set_audio_level(0.1); response.mutable_audio_level_info()->set_rms(0.3); auto actual_audio_mojom = internal::AudioLevelEventFromProto(response); auto expected_audio_mojom = chromeos::machine_learning::mojom::AudioLevelEvent::New(); expected_audio_mojom->rms = 0.3; expected_audio_mojom->audio_level = 0.1; EXPECT_TRUE(actual_audio_mojom.Equals(expected_audio_mojom)); // now for the full mojom auto actual_mojom = SpeechRecognizerEventFromProto(response); chromeos::machine_learning::mojom::SpeechRecognizerEventPtr expected_mojom = chromeos::machine_learning::mojom::SpeechRecognizerEvent::New(); expected_mojom->set_audio_event(std::move(expected_audio_mojom)); EXPECT_TRUE(actual_mojom.Equals(expected_mojom)); // Let's check the other tests. EXPECT_FALSE(IsStopSodaResponse(response)); EXPECT_FALSE(IsStartSodaResponse(response)); EXPECT_FALSE(IsShutdownSodaResponse(response)); } TEST(SodaProtoMojomConversionTest, PartialResultsTest) { SodaResponse response; response.set_soda_type(SodaResponse::RECOGNITION); auto* rec = response.mutable_recognition_result(); rec->add_hypothesis("first hyp"); rec->add_hypothesis("second hyp"); rec->set_result_type(speech::soda::chrome::SodaRecognitionResult::PARTIAL); auto expected_rec_mojom = chromeos::machine_learning::mojom::PartialResult::New(); expected_rec_mojom->partial_text.push_back("first hyp"); expected_rec_mojom->partial_text.push_back("second hyp"); auto actual_rec_mojom = internal::PartialResultFromProto(response); EXPECT_TRUE(actual_rec_mojom.Equals(expected_rec_mojom)); // now for the full mojom auto actual_mojom = SpeechRecognizerEventFromProto(response); chromeos::machine_learning::mojom::SpeechRecognizerEventPtr expected_mojom = chromeos::machine_learning::mojom::SpeechRecognizerEvent::New(); expected_mojom->set_partial_result(std::move(actual_rec_mojom)); EXPECT_TRUE(actual_mojom.Equals(expected_mojom)); // Let's check the other tests. EXPECT_FALSE(IsStopSodaResponse(response)); EXPECT_FALSE(IsStartSodaResponse(response)); EXPECT_FALSE(IsShutdownSodaResponse(response)); } TEST(SodaProtoMojomConversionTest, FinalResultsTest) { SodaResponse response; response.set_soda_type(SodaResponse::RECOGNITION); auto* rec = response.mutable_recognition_result(); rec->add_hypothesis("first hypo"); rec->add_hypothesis("second hypo"); rec->set_result_type(speech::soda::chrome::SodaRecognitionResult::FINAL); auto expected_rec_mojom = chromeos::machine_learning::mojom::FinalResult::New(); expected_rec_mojom->final_hypotheses.push_back("first hypo"); expected_rec_mojom->final_hypotheses.push_back("second hypo"); auto actual_rec_mojom = internal::FinalResultFromProto(response); EXPECT_TRUE(actual_rec_mojom.Equals(expected_rec_mojom)); // now for the full mojom auto actual_mojom = SpeechRecognizerEventFromProto(response); chromeos::machine_learning::mojom::SpeechRecognizerEventPtr expected_mojom = chromeos::machine_learning::mojom::SpeechRecognizerEvent::New(); expected_mojom->set_final_result(std::move(actual_rec_mojom)); EXPECT_TRUE(actual_mojom.Equals(expected_mojom)); // Let's check the other tests. EXPECT_FALSE(IsStopSodaResponse(response)); EXPECT_FALSE(IsStartSodaResponse(response)); EXPECT_FALSE(IsShutdownSodaResponse(response)); } TEST(SodaProtoMojomConversionTest, EndpointTest) { SodaResponse response; response.set_soda_type(SodaResponse::ENDPOINT); auto* end = response.mutable_endpoint_event(); end->set_endpoint_type( speech::soda::chrome::SodaEndpointEvent::END_OF_SPEECH); auto expected_end_mojom = chromeos::machine_learning::mojom::EndpointerEvent::New(); expected_end_mojom->endpointer_type = chromeos::machine_learning::mojom::EndpointerType::END_OF_SPEECH; auto actual_end_mojom = internal::EndpointerEventFromProto(response); EXPECT_TRUE(actual_end_mojom.Equals(expected_end_mojom)); // now for the full mojom auto actual_mojom = SpeechRecognizerEventFromProto(response); chromeos::machine_learning::mojom::SpeechRecognizerEventPtr expected_mojom = chromeos::machine_learning::mojom::SpeechRecognizerEvent::New(); expected_mojom->set_endpointer_event(std::move(actual_end_mojom)); EXPECT_TRUE(actual_mojom.Equals(expected_mojom)); // Let's check the other tests. EXPECT_FALSE(IsStopSodaResponse(response)); EXPECT_FALSE(IsStartSodaResponse(response)); EXPECT_FALSE(IsShutdownSodaResponse(response)); } TEST(SodaProtoMojomConversionTest, BooleanFunctionTest) { SodaResponse response; response.set_soda_type(SodaResponse::STOP); EXPECT_TRUE(IsStopSodaResponse(response)); EXPECT_FALSE(IsStartSodaResponse(response)); EXPECT_FALSE(IsShutdownSodaResponse(response)); response.set_soda_type(SodaResponse::START); EXPECT_FALSE(IsStopSodaResponse(response)); EXPECT_TRUE(IsStartSodaResponse(response)); EXPECT_FALSE(IsShutdownSodaResponse(response)); response.set_soda_type(SodaResponse::SHUTDOWN); EXPECT_FALSE(IsStopSodaResponse(response)); EXPECT_FALSE(IsStartSodaResponse(response)); EXPECT_TRUE(IsShutdownSodaResponse(response)); } } // namespace ml
<filename>projetoBhaw/src/tis/bhaw/DataAccessObject/ConnectionFactory.java package tis.bhaw.DataAccessObject; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Connection; import javax.management.RuntimeErrorException; public class ConnectionFactory { public Connection getConnection() throws SQLException, ClassNotFoundException { try { Class.forName("com.mysql.jdbc.Driver"); return DriverManager.getConnection("jdbc:mysql://localhost:3306/bhaw", "root" , "<PASSWORD>"); }catch (Error e) { throw new RuntimeErrorException(e); } } }
# For build.sh mode_name="zen" package_base="linux-zen" mode_desc="Select and use the packages for the linux-zen kernel" # pkgrel for ZEN packages pkgrel="1" # pkgrel for GIT packages pkgrel_git="1" zfs_git_commit="" zfs_git_url="https://github.com/zfsonlinux/zfs.git" header="\ # Maintainer: Jan Houben <jan@nexttrex.de> # Contributor: Jesus Alvarez <jeezusjr at gmail dot com> # # This PKGBUILD was generated by the archzfs build scripts located at # # http://github.com/archzfs/archzfs # # ! WARNING ! # # The archzfs packages are kernel modules, so these PKGBUILDS will only work with the kernel package they target. In this # case, the archzfs-linux-zen packages will only work with the default linux-zen package! To have a single PKGBUILD target many # kernels would make for a cluttered PKGBUILD! # # If you have a custom kernel, you will need to change things in the PKGBUILDS. If you would like to have AUR or archzfs repo # packages for your favorite kernel package built using the archzfs build tools, submit a request in the Issue tracker on the # archzfs github page. #" get_kernel_options() { msg "Checking the online package database for the latest x86_64 linux-zen kernel version..." if ! get_webpage "https://www.archlinux.org/packages/extra/x86_64/linux-zen/" "(?<=<h2>linux-zen )[\d\w\.-]+(?=</h2>)"; then exit 1 fi kernel_version=${webpage_output} kernel_version_full=$(kernel_version_full ${kernel_version}) kernel_version_pkgver=$(kernel_version_no_hyphen ${kernel_version}) kernel_version_major=${kernel_version%-*} # convert 1.2.3.zen4-5 to 1.2.3-zen4-5-zen kernel_mod_path="\${_kernelver/.zen/-zen}-zen" linux_depends="\"linux-zen=\${_kernelver}\"" linux_headers_depends="\"linux-zen-headers=\${_kernelver}\"" } # update_linux_zen_pkgbuilds() { # get_kernel_options # pkg_list=("zfs-linux-zen") # archzfs_package_group="archzfs-linux-zen" # zfs_pkgver=${zol_version} # zfs_pkgrel=${pkgrel} # zfs_conflicts="'zfs-linux-zen-git' 'spl-linux-zen'" # zfs_pkgname="zfs-linux-zen" # zfs_utils_pkgname="zfs-utils=\${_zfsver}" # # Paths are relative to build.sh # zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" # zfs_src_target="https://github.com/zfsonlinux/zfs/releases/download/zfs-\${_zfsver}/zfs-\${_zfsver}.tar.gz" # zfs_workdir="\${srcdir}/zfs-\${_zfsver}" # zfs_replaces='replaces=("spl-linux-zen")' # } update_linux_zen_git_pkgbuilds() { get_kernel_options pkg_list=("zfs-linux-zen-git") archzfs_package_group="archzfs-linux-zen-git" zfs_pkgver="" # Set later by call to git_calc_pkgver zfs_pkgrel=${pkgrel_git} zfs_conflicts="'zfs-linux-zen' 'spl-linux-zen-git' 'spl-linux-zen'" zfs_pkgname="zfs-linux-zen-git" zfs_pkgbuild_path="packages/${kernel_name}/${zfs_pkgname}" zfs_replaces='replaces=("spl-linux-zen-git")' zfs_src_hash="SKIP" zfs_makedepends="\"git\"" zfs_workdir="\${srcdir}/zfs" if have_command "update"; then git_check_repo git_calc_pkgver fi zfs_utils_pkgname="zfs-utils-git=\${_zfsver}" zfs_set_commit="_commit='${latest_zfs_git_commit}'" zfs_src_target="git+${zfs_git_url}#commit=\${_commit}" }
<filename>jsx/imageEdit/editorLoader.tsx import uploadcare from 'uploadcare-widget/uploadcare' import config from '../uc-config'; import UcConfig from '../interfaces/UcConfig'; import WpMediaModel from '../interfaces/WpMediaModel'; import uploadcareTabEffects from 'uploadcare-widget-tab-effects' import UcUploader from '../UcUploader'; import FileInfoResponse from '../interfaces/FileInfoResponse'; export default class UcEditor { private panelPlaceholder: HTMLDivElement = document.createElement('div'); private readonly config: UcConfig; private readonly uploader: UcUploader; constructor() { this.config = config.config; this.config.imagesOnly = true; this.panelPlaceholder.setAttribute('id', 'uc-panel-placeholder'); this.uploader = new UcUploader(this.config); } public getCDN(): string { return this.config.cdnBase; } private static registerStyle(): void { const customStyle = document.createElement('style'); customStyle.innerHTML = '.media-modal * { box-sizing: border-box; } .uploadcare--panel { min-height: 88vh; }' document.head.appendChild(customStyle); } public async showPanel(wrapper: any, url: string) { if (!(wrapper instanceof HTMLDivElement)) return false; uploadcare.registerTab('preview', uploadcareTabEffects); UcEditor.registerStyle(); wrapper.innerHTML = ''; wrapper.style.padding = '1rem'; wrapper.appendChild(this.panelPlaceholder); const ucFile: FileInfoResponse = uploadcare.fileFrom('uploaded', url); const localConfig = this.config; localConfig.imagesOnly = true; localConfig.multiple = false; const data = await uploadcare.openPanel(this.panelPlaceholder, ucFile, localConfig).done(); return this.uploader.storeImage(data as FileInfoResponse); } }
sudo python3 train_xgboost.py --train_name train --val_name val --n_estimators 512 --max_depth 12 --learning_rate 0.1 --subsample 0.3 --colsample_bytree 0.5 --gamma 10 --scale_pos_weight 1 --min_child_weight 5 --gpu sudo python3 train_xgboost.py --train_name train --val_name val --n_estimators 512 --max_depth 12 --learning_rate 0.1 --subsample 0.3 --colsample_bytree 0.5 --gamma 100 --scale_pos_weight 1 --min_child_weight 5 --gpu sudo python3 train_xgboost.py --train_name train --val_name val --n_estimators 512 --max_depth 12 --learning_rate 0.1 --subsample 0.3 --colsample_bytree 0.5 --gamma 1000 --scale_pos_weight 1 --min_child_weight 5 --gpu sudo python3 train_xgboost.py --train_name train --val_name val --n_estimators 512 --max_depth 12 --learning_rate 0.1 --subsample 0.3 --colsample_bytree 0.5 --gamma 0 --scale_pos_weight 1 --min_child_weight 5 --reg_alpha 0.3 --gpu sudo python3 train_xgboost.py --train_name train --val_name val --n_estimators 512 --max_depth 12 --learning_rate 0.1 --subsample 0.3 --colsample_bytree 0.5 --gamma 0 --scale_pos_weight 1 --min_child_weight 5 --reg_alpha 0.5 --gpu sudo python3 train_xgboost.py --train_name train --val_name val --n_estimators 512 --max_depth 12 --learning_rate 0.1 --subsample 0.3 --colsample_bytree 0.5 --gamma 0 --scale_pos_weight 1 --min_child_weight 5 --reg_alpha 0.7 --gpu sudo python3 train_xgboost.py --train_name train --val_name val --n_estimators 512 --max_depth 12 --learning_rate 0.1 --subsample 0.3 --colsample_bytree 0.5 --gamma 0 --scale_pos_weight 1 --min_child_weight 5 --reg_alpha 1.0 --gpu
// Generated from Java8.g4 by ANTLR 4.7 package sarf.lexer.lang; import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.misc.*; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class Java8Lexer extends Lexer { static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int ABSTRACT=1, ASSERT=2, BOOLEAN=3, BREAK=4, BYTE=5, CASE=6, CATCH=7, CHAR=8, CLASS=9, CONST=10, CONTINUE=11, DEFAULT=12, DO=13, DOUBLE=14, ELSE=15, ENUM=16, EXTENDS=17, FINAL=18, FINALLY=19, FLOAT=20, FOR=21, IF=22, GOTO=23, IMPLEMENTS=24, IMPORT=25, INSTANCEOF=26, INT=27, INTERFACE=28, LONG=29, NATIVE=30, NEW=31, PACKAGE=32, PRIVATE=33, PROTECTED=34, PUBLIC=35, RETURN=36, SHORT=37, STATIC=38, STRICTFP=39, SUPER=40, SWITCH=41, SYNCHRONIZED=42, THIS=43, THROW=44, THROWS=45, TRANSIENT=46, TRY=47, VOID=48, VOLATILE=49, WHILE=50, IntegerLiteral=51, FloatingPointLiteral=52, BooleanLiteral=53, CharacterLiteral=54, StringLiteral=55, NullLiteral=56, LPAREN=57, RPAREN=58, LBRACE=59, RBRACE=60, LBRACK=61, RBRACK=62, SEMI=63, COMMA=64, DOT=65, ASSIGN=66, GT=67, LT=68, BANG=69, TILDE=70, QUESTION=71, COLON=72, EQUAL=73, LE=74, GE=75, NOTEQUAL=76, AND=77, OR=78, INC=79, DEC=80, ADD=81, SUB=82, MUL=83, DIV=84, BITAND=85, BITOR=86, CARET=87, MOD=88, ARROW=89, COLONCOLON=90, ADD_ASSIGN=91, SUB_ASSIGN=92, MUL_ASSIGN=93, DIV_ASSIGN=94, AND_ASSIGN=95, OR_ASSIGN=96, XOR_ASSIGN=97, MOD_ASSIGN=98, LSHIFT_ASSIGN=99, RSHIFT_ASSIGN=100, URSHIFT_ASSIGN=101, Identifier=102, AT=103, ELLIPSIS=104, WS=105, COMMENT=106, LINE_COMMENT=107, ErrorCharacter=108; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; public static String[] modeNames = { "DEFAULT_MODE" }; public static final String[] ruleNames = { "ABSTRACT", "ASSERT", "BOOLEAN", "BREAK", "BYTE", "CASE", "CATCH", "CHAR", "CLASS", "CONST", "CONTINUE", "DEFAULT", "DO", "DOUBLE", "ELSE", "ENUM", "EXTENDS", "FINAL", "FINALLY", "FLOAT", "FOR", "IF", "GOTO", "IMPLEMENTS", "IMPORT", "INSTANCEOF", "INT", "INTERFACE", "LONG", "NATIVE", "NEW", "PACKAGE", "PRIVATE", "PROTECTED", "PUBLIC", "RETURN", "SHORT", "STATIC", "STRICTFP", "SUPER", "SWITCH", "SYNCHRONIZED", "THIS", "THROW", "THROWS", "TRANSIENT", "TRY", "VOID", "VOLATILE", "WHILE", "IntegerLiteral", "DecimalIntegerLiteral", "HexIntegerLiteral", "OctalIntegerLiteral", "BinaryIntegerLiteral", "IntegerTypeSuffix", "DecimalNumeral", "Digits", "Digit", "NonZeroDigit", "DigitsAndUnderscores", "DigitOrUnderscore", "Underscores", "HexNumeral", "HexDigits", "HexDigit", "HexDigitsAndUnderscores", "HexDigitOrUnderscore", "OctalNumeral", "OctalDigits", "OctalDigit", "OctalDigitsAndUnderscores", "OctalDigitOrUnderscore", "BinaryNumeral", "BinaryDigits", "BinaryDigit", "BinaryDigitsAndUnderscores", "BinaryDigitOrUnderscore", "FloatingPointLiteral", "DecimalFloatingPointLiteral", "ExponentPart", "ExponentIndicator", "SignedInteger", "Sign", "FloatTypeSuffix", "HexadecimalFloatingPointLiteral", "HexSignificand", "BinaryExponent", "BinaryExponentIndicator", "BooleanLiteral", "CharacterLiteral", "SingleCharacter", "StringLiteral", "StringCharacters", "StringCharacter", "EscapeSequence", "OctalEscape", "ZeroToThree", "UnicodeEscape", "NullLiteral", "LPAREN", "RPAREN", "LBRACE", "RBRACE", "LBRACK", "RBRACK", "SEMI", "COMMA", "DOT", "ASSIGN", "GT", "LT", "BANG", "TILDE", "QUESTION", "COLON", "EQUAL", "LE", "GE", "NOTEQUAL", "AND", "OR", "INC", "DEC", "ADD", "SUB", "MUL", "DIV", "BITAND", "BITOR", "CARET", "MOD", "ARROW", "COLONCOLON", "ADD_ASSIGN", "SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN", "OR_ASSIGN", "XOR_ASSIGN", "MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN", "URSHIFT_ASSIGN", "Identifier", "JavaLetter", "JavaLetterOrDigit", "AT", "ELLIPSIS", "WS", "COMMENT", "LINE_COMMENT", "ErrorCharacter" }; private static final String[] _LITERAL_NAMES = { null, "'abstract'", "'assert'", "'boolean'", "'break'", "'byte'", "'case'", "'catch'", "'char'", "'class'", "'const'", "'continue'", "'default'", "'do'", "'double'", "'else'", "'enum'", "'extends'", "'final'", "'finally'", "'float'", "'for'", "'if'", "'goto'", "'implements'", "'import'", "'instanceof'", "'int'", "'interface'", "'long'", "'native'", "'new'", "'package'", "'private'", "'protected'", "'public'", "'return'", "'short'", "'static'", "'strictfp'", "'super'", "'switch'", "'synchronized'", "'this'", "'throw'", "'throws'", "'transient'", "'try'", "'void'", "'volatile'", "'while'", null, null, null, null, null, "'null'", "'('", "')'", "'{'", "'}'", "'['", "']'", "';'", "','", "'.'", "'='", "'>'", "'<'", "'!'", "'~'", "'?'", "':'", "'=='", "'<='", "'>='", "'!='", "'&&'", "'||'", "'++'", "'--'", "'+'", "'-'", "'*'", "'/'", "'&'", "'|'", "'^'", "'%'", "'->'", "'::'", "'+='", "'-='", "'*='", "'/='", "'&='", "'|='", "'^='", "'%='", "'<<='", "'>>='", "'>>>='", null, "'@'", "'...'" }; private static final String[] _SYMBOLIC_NAMES = { null, "ABSTRACT", "ASSERT", "BOOLEAN", "BREAK", "BYTE", "CASE", "CATCH", "CHAR", "CLASS", "CONST", "CONTINUE", "DEFAULT", "DO", "DOUBLE", "ELSE", "ENUM", "EXTENDS", "FINAL", "FINALLY", "FLOAT", "FOR", "IF", "GOTO", "IMPLEMENTS", "IMPORT", "INSTANCEOF", "INT", "INTERFACE", "LONG", "NATIVE", "NEW", "PACKAGE", "PRIVATE", "PROTECTED", "PUBLIC", "RETURN", "SHORT", "STATIC", "STRICTFP", "SUPER", "SWITCH", "SYNCHRONIZED", "THIS", "THROW", "THROWS", "TRANSIENT", "TRY", "VOID", "VOLATILE", "WHILE", "IntegerLiteral", "FloatingPointLiteral", "BooleanLiteral", "CharacterLiteral", "StringLiteral", "NullLiteral", "LPAREN", "RPAREN", "LBRACE", "RBRACE", "LBRACK", "RBRACK", "SEMI", "COMMA", "DOT", "ASSIGN", "GT", "LT", "BANG", "TILDE", "QUESTION", "COLON", "EQUAL", "LE", "GE", "NOTEQUAL", "AND", "OR", "INC", "DEC", "ADD", "SUB", "MUL", "DIV", "BITAND", "BITOR", "CARET", "MOD", "ARROW", "COLONCOLON", "ADD_ASSIGN", "SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN", "OR_ASSIGN", "XOR_ASSIGN", "MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN", "URSHIFT_ASSIGN", "Identifier", "AT", "ELLIPSIS", "WS", "COMMENT", "LINE_COMMENT", "ErrorCharacter" }; public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); /** * @deprecated Use {@link #VOCABULARY} instead. */ @Deprecated public static final String[] tokenNames; static { tokenNames = new String[_SYMBOLIC_NAMES.length]; for (int i = 0; i < tokenNames.length; i++) { tokenNames[i] = VOCABULARY.getLiteralName(i); if (tokenNames[i] == null) { tokenNames[i] = VOCABULARY.getSymbolicName(i); } if (tokenNames[i] == null) { tokenNames[i] = "<INVALID>"; } } } @Override @Deprecated public String[] getTokenNames() { return tokenNames; } @Override public Vocabulary getVocabulary() { return VOCABULARY; } public Java8Lexer(CharStream input) { super(input); _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); } @Override public String getGrammarFileName() { return "Java8.g4"; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public String[] getChannelNames() { return channelNames; } @Override public String[] getModeNames() { return modeNames; } @Override public ATN getATN() { return _ATN; } @Override public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { case 146: return JavaLetter_sempred((RuleContext)_localctx, predIndex); case 147: return JavaLetterOrDigit_sempred((RuleContext)_localctx, predIndex); } return true; } private boolean JavaLetter_sempred(RuleContext _localctx, int predIndex) { switch (predIndex) { case 0: return Character.isJavaIdentifierStart(_input.LA(-1)); case 1: return Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1))); } return true; } private boolean JavaLetterOrDigit_sempred(RuleContext _localctx, int predIndex) { switch (predIndex) { case 2: return Character.isJavaIdentifierPart(_input.LA(-1)); case 3: return Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1))); } return true; } public static final String _serializedATN = "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2n\u044c\b\1\4\2\t"+ "\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+ "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+ "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+ "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+ ",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t"+ "\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t="+ "\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I"+ "\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT"+ "\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4"+ "`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k\t"+ "k\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4"+ "w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t\u0080"+ "\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084\4\u0085"+ "\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088\4\u0089\t\u0089"+ "\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d\4\u008e"+ "\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092\t\u0092"+ "\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095\4\u0096\t\u0096\4\u0097"+ "\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a\t\u009a\4\u009b\t\u009b"+ "\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\4\3"+ "\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6"+ "\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3"+ "\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3"+ "\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\17\3\17"+ "\3\17\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21"+ "\3\21\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23"+ "\3\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\25"+ "\3\25\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\31"+ "\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3\32"+ "\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33"+ "\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35"+ "\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3 \3 \3 "+ "\3 \3!\3!\3!\3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3#\3#\3#\3"+ "#\3#\3#\3#\3#\3#\3#\3$\3$\3$\3$\3$\3$\3$\3%\3%\3%\3%\3%\3%\3%\3&\3&\3"+ "&\3&\3&\3&\3\'\3\'\3\'\3\'\3\'\3\'\3\'\3(\3(\3(\3(\3(\3(\3(\3(\3(\3)\3"+ ")\3)\3)\3)\3)\3*\3*\3*\3*\3*\3*\3*\3+\3+\3+\3+\3+\3+\3+\3+\3+\3+\3+\3"+ "+\3+\3,\3,\3,\3,\3,\3-\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3.\3.\3/\3/\3/\3"+ "/\3/\3/\3/\3/\3/\3/\3\60\3\60\3\60\3\60\3\61\3\61\3\61\3\61\3\61\3\62"+ "\3\62\3\62\3\62\3\62\3\62\3\62\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\63"+ "\3\64\3\64\3\64\3\64\5\64\u028f\n\64\3\65\3\65\5\65\u0293\n\65\3\66\3"+ "\66\5\66\u0297\n\66\3\67\3\67\5\67\u029b\n\67\38\38\58\u029f\n8\39\39"+ "\3:\3:\3:\5:\u02a6\n:\3:\3:\3:\5:\u02ab\n:\5:\u02ad\n:\3;\3;\5;\u02b1"+ "\n;\3;\5;\u02b4\n;\3<\3<\5<\u02b8\n<\3=\3=\3>\6>\u02bd\n>\r>\16>\u02be"+ "\3?\3?\5?\u02c3\n?\3@\6@\u02c6\n@\r@\16@\u02c7\3A\3A\3A\3A\3B\3B\5B\u02d0"+ "\nB\3B\5B\u02d3\nB\3C\3C\3D\6D\u02d8\nD\rD\16D\u02d9\3E\3E\5E\u02de\n"+ "E\3F\3F\5F\u02e2\nF\3F\3F\3G\3G\5G\u02e8\nG\3G\5G\u02eb\nG\3H\3H\3I\6"+ "I\u02f0\nI\rI\16I\u02f1\3J\3J\5J\u02f6\nJ\3K\3K\3K\3K\3L\3L\5L\u02fe\n"+ "L\3L\5L\u0301\nL\3M\3M\3N\6N\u0306\nN\rN\16N\u0307\3O\3O\5O\u030c\nO\3"+ "P\3P\5P\u0310\nP\3Q\3Q\3Q\5Q\u0315\nQ\3Q\5Q\u0318\nQ\3Q\5Q\u031b\nQ\3"+ "Q\3Q\3Q\5Q\u0320\nQ\3Q\5Q\u0323\nQ\3Q\3Q\3Q\5Q\u0328\nQ\3Q\3Q\3Q\5Q\u032d"+ "\nQ\3R\3R\3R\3S\3S\3T\5T\u0335\nT\3T\3T\3U\3U\3V\3V\3W\3W\3W\5W\u0340"+ "\nW\3X\3X\5X\u0344\nX\3X\3X\3X\5X\u0349\nX\3X\3X\5X\u034d\nX\3Y\3Y\3Y"+ "\3Z\3Z\3[\3[\3[\3[\3[\3[\3[\3[\3[\5[\u035d\n[\3\\\3\\\3\\\3\\\3\\\3\\"+ "\3\\\3\\\5\\\u0367\n\\\3]\3]\3^\3^\5^\u036d\n^\3^\3^\3_\6_\u0372\n_\r"+ "_\16_\u0373\3`\3`\5`\u0378\n`\3a\3a\3a\3a\5a\u037e\na\3b\3b\3b\3b\3b\3"+ "b\3b\3b\3b\3b\3b\5b\u038b\nb\3c\3c\3d\3d\3d\3d\3d\3d\3d\3e\3e\3e\3e\3"+ "e\3f\3f\3g\3g\3h\3h\3i\3i\3j\3j\3k\3k\3l\3l\3m\3m\3n\3n\3o\3o\3p\3p\3"+ "q\3q\3r\3r\3s\3s\3t\3t\3u\3u\3v\3v\3v\3w\3w\3w\3x\3x\3x\3y\3y\3y\3z\3"+ "z\3z\3{\3{\3{\3|\3|\3|\3}\3}\3}\3~\3~\3\177\3\177\3\u0080\3\u0080\3\u0081"+ "\3\u0081\3\u0082\3\u0082\3\u0083\3\u0083\3\u0084\3\u0084\3\u0085\3\u0085"+ "\3\u0086\3\u0086\3\u0086\3\u0087\3\u0087\3\u0087\3\u0088\3\u0088\3\u0088"+ "\3\u0089\3\u0089\3\u0089\3\u008a\3\u008a\3\u008a\3\u008b\3\u008b\3\u008b"+ "\3\u008c\3\u008c\3\u008c\3\u008d\3\u008d\3\u008d\3\u008e\3\u008e\3\u008e"+ "\3\u008f\3\u008f\3\u008f\3\u0090\3\u0090\3\u0090\3\u0090\3\u0091\3\u0091"+ "\3\u0091\3\u0091\3\u0092\3\u0092\3\u0092\3\u0092\3\u0092\3\u0093\3\u0093"+ "\7\u0093\u0410\n\u0093\f\u0093\16\u0093\u0413\13\u0093\3\u0094\3\u0094"+ "\3\u0094\3\u0094\3\u0094\3\u0094\5\u0094\u041b\n\u0094\3\u0095\3\u0095"+ "\3\u0095\3\u0095\3\u0095\3\u0095\5\u0095\u0423\n\u0095\3\u0096\3\u0096"+ "\3\u0097\3\u0097\3\u0097\3\u0097\3\u0098\6\u0098\u042c\n\u0098\r\u0098"+ "\16\u0098\u042d\3\u0098\3\u0098\3\u0099\3\u0099\3\u0099\3\u0099\7\u0099"+ "\u0436\n\u0099\f\u0099\16\u0099\u0439\13\u0099\3\u0099\3\u0099\3\u0099"+ "\3\u0099\3\u0099\3\u009a\3\u009a\3\u009a\3\u009a\7\u009a\u0444\n\u009a"+ "\f\u009a\16\u009a\u0447\13\u009a\3\u009a\3\u009a\3\u009b\3\u009b\3\u0437"+ "\2\u009c\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17"+ "\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\35"+ "9\36;\37= ?!A\"C#E$G%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\2"+ "k\2m\2o\2q\2s\2u\2w\2y\2{\2}\2\177\2\u0081\2\u0083\2\u0085\2\u0087\2\u0089"+ "\2\u008b\2\u008d\2\u008f\2\u0091\2\u0093\2\u0095\2\u0097\2\u0099\2\u009b"+ "\2\u009d\2\u009f\66\u00a1\2\u00a3\2\u00a5\2\u00a7\2\u00a9\2\u00ab\2\u00ad"+ "\2\u00af\2\u00b1\2\u00b3\2\u00b5\67\u00b78\u00b9\2\u00bb9\u00bd\2\u00bf"+ "\2\u00c1\2\u00c3\2\u00c5\2\u00c7\2\u00c9:\u00cb;\u00cd<\u00cf=\u00d1>"+ "\u00d3?\u00d5@\u00d7A\u00d9B\u00dbC\u00ddD\u00dfE\u00e1F\u00e3G\u00e5"+ "H\u00e7I\u00e9J\u00ebK\u00edL\u00efM\u00f1N\u00f3O\u00f5P\u00f7Q\u00f9"+ "R\u00fbS\u00fdT\u00ffU\u0101V\u0103W\u0105X\u0107Y\u0109Z\u010b[\u010d"+ "\\\u010f]\u0111^\u0113_\u0115`\u0117a\u0119b\u011bc\u011dd\u011fe\u0121"+ "f\u0123g\u0125h\u0127\2\u0129\2\u012bi\u012dj\u012fk\u0131l\u0133m\u0135"+ "n\3\2\30\4\2NNnn\3\2\63;\4\2ZZzz\5\2\62;CHch\3\2\629\4\2DDdd\3\2\62\63"+ "\4\2GGgg\4\2--//\6\2FFHHffhh\4\2RRrr\4\2))^^\4\2$$^^\n\2$$))^^ddhhppt"+ "tvv\3\2\62\65\6\2&&C\\aac|\4\2\2\u0081\ud802\udc01\3\2\ud802\udc01\3\2"+ "\udc02\ue001\7\2&&\62;C\\aac|\5\2\13\f\16\17\"\"\4\2\f\f\17\17\2\u045a"+ "\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2"+ "\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2"+ "\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2"+ "\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2"+ "\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3"+ "\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2"+ "\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2"+ "U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3"+ "\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\2\u009f\3\2\2\2\2\u00b5\3\2\2"+ "\2\2\u00b7\3\2\2\2\2\u00bb\3\2\2\2\2\u00c9\3\2\2\2\2\u00cb\3\2\2\2\2\u00cd"+ "\3\2\2\2\2\u00cf\3\2\2\2\2\u00d1\3\2\2\2\2\u00d3\3\2\2\2\2\u00d5\3\2\2"+ "\2\2\u00d7\3\2\2\2\2\u00d9\3\2\2\2\2\u00db\3\2\2\2\2\u00dd\3\2\2\2\2\u00df"+ "\3\2\2\2\2\u00e1\3\2\2\2\2\u00e3\3\2\2\2\2\u00e5\3\2\2\2\2\u00e7\3\2\2"+ "\2\2\u00e9\3\2\2\2\2\u00eb\3\2\2\2\2\u00ed\3\2\2\2\2\u00ef\3\2\2\2\2\u00f1"+ "\3\2\2\2\2\u00f3\3\2\2\2\2\u00f5\3\2\2\2\2\u00f7\3\2\2\2\2\u00f9\3\2\2"+ "\2\2\u00fb\3\2\2\2\2\u00fd\3\2\2\2\2\u00ff\3\2\2\2\2\u0101\3\2\2\2\2\u0103"+ "\3\2\2\2\2\u0105\3\2\2\2\2\u0107\3\2\2\2\2\u0109\3\2\2\2\2\u010b\3\2\2"+ "\2\2\u010d\3\2\2\2\2\u010f\3\2\2\2\2\u0111\3\2\2\2\2\u0113\3\2\2\2\2\u0115"+ "\3\2\2\2\2\u0117\3\2\2\2\2\u0119\3\2\2\2\2\u011b\3\2\2\2\2\u011d\3\2\2"+ "\2\2\u011f\3\2\2\2\2\u0121\3\2\2\2\2\u0123\3\2\2\2\2\u0125\3\2\2\2\2\u012b"+ "\3\2\2\2\2\u012d\3\2\2\2\2\u012f\3\2\2\2\2\u0131\3\2\2\2\2\u0133\3\2\2"+ "\2\2\u0135\3\2\2\2\3\u0137\3\2\2\2\5\u0140\3\2\2\2\7\u0147\3\2\2\2\t\u014f"+ "\3\2\2\2\13\u0155\3\2\2\2\r\u015a\3\2\2\2\17\u015f\3\2\2\2\21\u0165\3"+ "\2\2\2\23\u016a\3\2\2\2\25\u0170\3\2\2\2\27\u0176\3\2\2\2\31\u017f\3\2"+ "\2\2\33\u0187\3\2\2\2\35\u018a\3\2\2\2\37\u0191\3\2\2\2!\u0196\3\2\2\2"+ "#\u019b\3\2\2\2%\u01a3\3\2\2\2\'\u01a9\3\2\2\2)\u01b1\3\2\2\2+\u01b7\3"+ "\2\2\2-\u01bb\3\2\2\2/\u01be\3\2\2\2\61\u01c3\3\2\2\2\63\u01ce\3\2\2\2"+ "\65\u01d5\3\2\2\2\67\u01e0\3\2\2\29\u01e4\3\2\2\2;\u01ee\3\2\2\2=\u01f3"+ "\3\2\2\2?\u01fa\3\2\2\2A\u01fe\3\2\2\2C\u0206\3\2\2\2E\u020e\3\2\2\2G"+ "\u0218\3\2\2\2I\u021f\3\2\2\2K\u0226\3\2\2\2M\u022c\3\2\2\2O\u0233\3\2"+ "\2\2Q\u023c\3\2\2\2S\u0242\3\2\2\2U\u0249\3\2\2\2W\u0256\3\2\2\2Y\u025b"+ "\3\2\2\2[\u0261\3\2\2\2]\u0268\3\2\2\2_\u0272\3\2\2\2a\u0276\3\2\2\2c"+ "\u027b\3\2\2\2e\u0284\3\2\2\2g\u028e\3\2\2\2i\u0290\3\2\2\2k\u0294\3\2"+ "\2\2m\u0298\3\2\2\2o\u029c\3\2\2\2q\u02a0\3\2\2\2s\u02ac\3\2\2\2u\u02ae"+ "\3\2\2\2w\u02b7\3\2\2\2y\u02b9\3\2\2\2{\u02bc\3\2\2\2}\u02c2\3\2\2\2\177"+ "\u02c5\3\2\2\2\u0081\u02c9\3\2\2\2\u0083\u02cd\3\2\2\2\u0085\u02d4\3\2"+ "\2\2\u0087\u02d7\3\2\2\2\u0089\u02dd\3\2\2\2\u008b\u02df\3\2\2\2\u008d"+ "\u02e5\3\2\2\2\u008f\u02ec\3\2\2\2\u0091\u02ef\3\2\2\2\u0093\u02f5\3\2"+ "\2\2\u0095\u02f7\3\2\2\2\u0097\u02fb\3\2\2\2\u0099\u0302\3\2\2\2\u009b"+ "\u0305\3\2\2\2\u009d\u030b\3\2\2\2\u009f\u030f\3\2\2\2\u00a1\u032c\3\2"+ "\2\2\u00a3\u032e\3\2\2\2\u00a5\u0331\3\2\2\2\u00a7\u0334\3\2\2\2\u00a9"+ "\u0338\3\2\2\2\u00ab\u033a\3\2\2\2\u00ad\u033c\3\2\2\2\u00af\u034c\3\2"+ "\2\2\u00b1\u034e\3\2\2\2\u00b3\u0351\3\2\2\2\u00b5\u035c\3\2\2\2\u00b7"+ "\u0366\3\2\2\2\u00b9\u0368\3\2\2\2\u00bb\u036a\3\2\2\2\u00bd\u0371\3\2"+ "\2\2\u00bf\u0377\3\2\2\2\u00c1\u037d\3\2\2\2\u00c3\u038a\3\2\2\2\u00c5"+ "\u038c\3\2\2\2\u00c7\u038e\3\2\2\2\u00c9\u0395\3\2\2\2\u00cb\u039a\3\2"+ "\2\2\u00cd\u039c\3\2\2\2\u00cf\u039e\3\2\2\2\u00d1\u03a0\3\2\2\2\u00d3"+ "\u03a2\3\2\2\2\u00d5\u03a4\3\2\2\2\u00d7\u03a6\3\2\2\2\u00d9\u03a8\3\2"+ "\2\2\u00db\u03aa\3\2\2\2\u00dd\u03ac\3\2\2\2\u00df\u03ae\3\2\2\2\u00e1"+ "\u03b0\3\2\2\2\u00e3\u03b2\3\2\2\2\u00e5\u03b4\3\2\2\2\u00e7\u03b6\3\2"+ "\2\2\u00e9\u03b8\3\2\2\2\u00eb\u03ba\3\2\2\2\u00ed\u03bd\3\2\2\2\u00ef"+ "\u03c0\3\2\2\2\u00f1\u03c3\3\2\2\2\u00f3\u03c6\3\2\2\2\u00f5\u03c9\3\2"+ "\2\2\u00f7\u03cc\3\2\2\2\u00f9\u03cf\3\2\2\2\u00fb\u03d2\3\2\2\2\u00fd"+ "\u03d4\3\2\2\2\u00ff\u03d6\3\2\2\2\u0101\u03d8\3\2\2\2\u0103\u03da\3\2"+ "\2\2\u0105\u03dc\3\2\2\2\u0107\u03de\3\2\2\2\u0109\u03e0\3\2\2\2\u010b"+ "\u03e2\3\2\2\2\u010d\u03e5\3\2\2\2\u010f\u03e8\3\2\2\2\u0111\u03eb\3\2"+ "\2\2\u0113\u03ee\3\2\2\2\u0115\u03f1\3\2\2\2\u0117\u03f4\3\2\2\2\u0119"+ "\u03f7\3\2\2\2\u011b\u03fa\3\2\2\2\u011d\u03fd\3\2\2\2\u011f\u0400\3\2"+ "\2\2\u0121\u0404\3\2\2\2\u0123\u0408\3\2\2\2\u0125\u040d\3\2\2\2\u0127"+ "\u041a\3\2\2\2\u0129\u0422\3\2\2\2\u012b\u0424\3\2\2\2\u012d\u0426\3\2"+ "\2\2\u012f\u042b\3\2\2\2\u0131\u0431\3\2\2\2\u0133\u043f\3\2\2\2\u0135"+ "\u044a\3\2\2\2\u0137\u0138\7c\2\2\u0138\u0139\7d\2\2\u0139\u013a\7u\2"+ "\2\u013a\u013b\7v\2\2\u013b\u013c\7t\2\2\u013c\u013d\7c\2\2\u013d\u013e"+ "\7e\2\2\u013e\u013f\7v\2\2\u013f\4\3\2\2\2\u0140\u0141\7c\2\2\u0141\u0142"+ "\7u\2\2\u0142\u0143\7u\2\2\u0143\u0144\7g\2\2\u0144\u0145\7t\2\2\u0145"+ "\u0146\7v\2\2\u0146\6\3\2\2\2\u0147\u0148\7d\2\2\u0148\u0149\7q\2\2\u0149"+ "\u014a\7q\2\2\u014a\u014b\7n\2\2\u014b\u014c\7g\2\2\u014c\u014d\7c\2\2"+ "\u014d\u014e\7p\2\2\u014e\b\3\2\2\2\u014f\u0150\7d\2\2\u0150\u0151\7t"+ "\2\2\u0151\u0152\7g\2\2\u0152\u0153\7c\2\2\u0153\u0154\7m\2\2\u0154\n"+ "\3\2\2\2\u0155\u0156\7d\2\2\u0156\u0157\7{\2\2\u0157\u0158\7v\2\2\u0158"+ "\u0159\7g\2\2\u0159\f\3\2\2\2\u015a\u015b\7e\2\2\u015b\u015c\7c\2\2\u015c"+ "\u015d\7u\2\2\u015d\u015e\7g\2\2\u015e\16\3\2\2\2\u015f\u0160\7e\2\2\u0160"+ "\u0161\7c\2\2\u0161\u0162\7v\2\2\u0162\u0163\7e\2\2\u0163\u0164\7j\2\2"+ "\u0164\20\3\2\2\2\u0165\u0166\7e\2\2\u0166\u0167\7j\2\2\u0167\u0168\7"+ "c\2\2\u0168\u0169\7t\2\2\u0169\22\3\2\2\2\u016a\u016b\7e\2\2\u016b\u016c"+ "\7n\2\2\u016c\u016d\7c\2\2\u016d\u016e\7u\2\2\u016e\u016f\7u\2\2\u016f"+ "\24\3\2\2\2\u0170\u0171\7e\2\2\u0171\u0172\7q\2\2\u0172\u0173\7p\2\2\u0173"+ "\u0174\7u\2\2\u0174\u0175\7v\2\2\u0175\26\3\2\2\2\u0176\u0177\7e\2\2\u0177"+ "\u0178\7q\2\2\u0178\u0179\7p\2\2\u0179\u017a\7v\2\2\u017a\u017b\7k\2\2"+ "\u017b\u017c\7p\2\2\u017c\u017d\7w\2\2\u017d\u017e\7g\2\2\u017e\30\3\2"+ "\2\2\u017f\u0180\7f\2\2\u0180\u0181\7g\2\2\u0181\u0182\7h\2\2\u0182\u0183"+ "\7c\2\2\u0183\u0184\7w\2\2\u0184\u0185\7n\2\2\u0185\u0186\7v\2\2\u0186"+ "\32\3\2\2\2\u0187\u0188\7f\2\2\u0188\u0189\7q\2\2\u0189\34\3\2\2\2\u018a"+ "\u018b\7f\2\2\u018b\u018c\7q\2\2\u018c\u018d\7w\2\2\u018d\u018e\7d\2\2"+ "\u018e\u018f\7n\2\2\u018f\u0190\7g\2\2\u0190\36\3\2\2\2\u0191\u0192\7"+ "g\2\2\u0192\u0193\7n\2\2\u0193\u0194\7u\2\2\u0194\u0195\7g\2\2\u0195 "+ "\3\2\2\2\u0196\u0197\7g\2\2\u0197\u0198\7p\2\2\u0198\u0199\7w\2\2\u0199"+ "\u019a\7o\2\2\u019a\"\3\2\2\2\u019b\u019c\7g\2\2\u019c\u019d\7z\2\2\u019d"+ "\u019e\7v\2\2\u019e\u019f\7g\2\2\u019f\u01a0\7p\2\2\u01a0\u01a1\7f\2\2"+ "\u01a1\u01a2\7u\2\2\u01a2$\3\2\2\2\u01a3\u01a4\7h\2\2\u01a4\u01a5\7k\2"+ "\2\u01a5\u01a6\7p\2\2\u01a6\u01a7\7c\2\2\u01a7\u01a8\7n\2\2\u01a8&\3\2"+ "\2\2\u01a9\u01aa\7h\2\2\u01aa\u01ab\7k\2\2\u01ab\u01ac\7p\2\2\u01ac\u01ad"+ "\7c\2\2\u01ad\u01ae\7n\2\2\u01ae\u01af\7n\2\2\u01af\u01b0\7{\2\2\u01b0"+ "(\3\2\2\2\u01b1\u01b2\7h\2\2\u01b2\u01b3\7n\2\2\u01b3\u01b4\7q\2\2\u01b4"+ "\u01b5\7c\2\2\u01b5\u01b6\7v\2\2\u01b6*\3\2\2\2\u01b7\u01b8\7h\2\2\u01b8"+ "\u01b9\7q\2\2\u01b9\u01ba\7t\2\2\u01ba,\3\2\2\2\u01bb\u01bc\7k\2\2\u01bc"+ "\u01bd\7h\2\2\u01bd.\3\2\2\2\u01be\u01bf\7i\2\2\u01bf\u01c0\7q\2\2\u01c0"+ "\u01c1\7v\2\2\u01c1\u01c2\7q\2\2\u01c2\60\3\2\2\2\u01c3\u01c4\7k\2\2\u01c4"+ "\u01c5\7o\2\2\u01c5\u01c6\7r\2\2\u01c6\u01c7\7n\2\2\u01c7\u01c8\7g\2\2"+ "\u01c8\u01c9\7o\2\2\u01c9\u01ca\7g\2\2\u01ca\u01cb\7p\2\2\u01cb\u01cc"+ "\7v\2\2\u01cc\u01cd\7u\2\2\u01cd\62\3\2\2\2\u01ce\u01cf\7k\2\2\u01cf\u01d0"+ "\7o\2\2\u01d0\u01d1\7r\2\2\u01d1\u01d2\7q\2\2\u01d2\u01d3\7t\2\2\u01d3"+ "\u01d4\7v\2\2\u01d4\64\3\2\2\2\u01d5\u01d6\7k\2\2\u01d6\u01d7\7p\2\2\u01d7"+ "\u01d8\7u\2\2\u01d8\u01d9\7v\2\2\u01d9\u01da\7c\2\2\u01da\u01db\7p\2\2"+ "\u01db\u01dc\7e\2\2\u01dc\u01dd\7g\2\2\u01dd\u01de\7q\2\2\u01de\u01df"+ "\7h\2\2\u01df\66\3\2\2\2\u01e0\u01e1\7k\2\2\u01e1\u01e2\7p\2\2\u01e2\u01e3"+ "\7v\2\2\u01e38\3\2\2\2\u01e4\u01e5\7k\2\2\u01e5\u01e6\7p\2\2\u01e6\u01e7"+ "\7v\2\2\u01e7\u01e8\7g\2\2\u01e8\u01e9\7t\2\2\u01e9\u01ea\7h\2\2\u01ea"+ "\u01eb\7c\2\2\u01eb\u01ec\7e\2\2\u01ec\u01ed\7g\2\2\u01ed:\3\2\2\2\u01ee"+ "\u01ef\7n\2\2\u01ef\u01f0\7q\2\2\u01f0\u01f1\7p\2\2\u01f1\u01f2\7i\2\2"+ "\u01f2<\3\2\2\2\u01f3\u01f4\7p\2\2\u01f4\u01f5\7c\2\2\u01f5\u01f6\7v\2"+ "\2\u01f6\u01f7\7k\2\2\u01f7\u01f8\7x\2\2\u01f8\u01f9\7g\2\2\u01f9>\3\2"+ "\2\2\u01fa\u01fb\7p\2\2\u01fb\u01fc\7g\2\2\u01fc\u01fd\7y\2\2\u01fd@\3"+ "\2\2\2\u01fe\u01ff\7r\2\2\u01ff\u0200\7c\2\2\u0200\u0201\7e\2\2\u0201"+ "\u0202\7m\2\2\u0202\u0203\7c\2\2\u0203\u0204\7i\2\2\u0204\u0205\7g\2\2"+ "\u0205B\3\2\2\2\u0206\u0207\7r\2\2\u0207\u0208\7t\2\2\u0208\u0209\7k\2"+ "\2\u0209\u020a\7x\2\2\u020a\u020b\7c\2\2\u020b\u020c\7v\2\2\u020c\u020d"+ "\7g\2\2\u020dD\3\2\2\2\u020e\u020f\7r\2\2\u020f\u0210\7t\2\2\u0210\u0211"+ "\7q\2\2\u0211\u0212\7v\2\2\u0212\u0213\7g\2\2\u0213\u0214\7e\2\2\u0214"+ "\u0215\7v\2\2\u0215\u0216\7g\2\2\u0216\u0217\7f\2\2\u0217F\3\2\2\2\u0218"+ "\u0219\7r\2\2\u0219\u021a\7w\2\2\u021a\u021b\7d\2\2\u021b\u021c\7n\2\2"+ "\u021c\u021d\7k\2\2\u021d\u021e\7e\2\2\u021eH\3\2\2\2\u021f\u0220\7t\2"+ "\2\u0220\u0221\7g\2\2\u0221\u0222\7v\2\2\u0222\u0223\7w\2\2\u0223\u0224"+ "\7t\2\2\u0224\u0225\7p\2\2\u0225J\3\2\2\2\u0226\u0227\7u\2\2\u0227\u0228"+ "\7j\2\2\u0228\u0229\7q\2\2\u0229\u022a\7t\2\2\u022a\u022b\7v\2\2\u022b"+ "L\3\2\2\2\u022c\u022d\7u\2\2\u022d\u022e\7v\2\2\u022e\u022f\7c\2\2\u022f"+ "\u0230\7v\2\2\u0230\u0231\7k\2\2\u0231\u0232\7e\2\2\u0232N\3\2\2\2\u0233"+ "\u0234\7u\2\2\u0234\u0235\7v\2\2\u0235\u0236\7t\2\2\u0236\u0237\7k\2\2"+ "\u0237\u0238\7e\2\2\u0238\u0239\7v\2\2\u0239\u023a\7h\2\2\u023a\u023b"+ "\7r\2\2\u023bP\3\2\2\2\u023c\u023d\7u\2\2\u023d\u023e\7w\2\2\u023e\u023f"+ "\7r\2\2\u023f\u0240\7g\2\2\u0240\u0241\7t\2\2\u0241R\3\2\2\2\u0242\u0243"+ "\7u\2\2\u0243\u0244\7y\2\2\u0244\u0245\7k\2\2\u0245\u0246\7v\2\2\u0246"+ "\u0247\7e\2\2\u0247\u0248\7j\2\2\u0248T\3\2\2\2\u0249\u024a\7u\2\2\u024a"+ "\u024b\7{\2\2\u024b\u024c\7p\2\2\u024c\u024d\7e\2\2\u024d\u024e\7j\2\2"+ "\u024e\u024f\7t\2\2\u024f\u0250\7q\2\2\u0250\u0251\7p\2\2\u0251\u0252"+ "\7k\2\2\u0252\u0253\7|\2\2\u0253\u0254\7g\2\2\u0254\u0255\7f\2\2\u0255"+ "V\3\2\2\2\u0256\u0257\7v\2\2\u0257\u0258\7j\2\2\u0258\u0259\7k\2\2\u0259"+ "\u025a\7u\2\2\u025aX\3\2\2\2\u025b\u025c\7v\2\2\u025c\u025d\7j\2\2\u025d"+ "\u025e\7t\2\2\u025e\u025f\7q\2\2\u025f\u0260\7y\2\2\u0260Z\3\2\2\2\u0261"+ "\u0262\7v\2\2\u0262\u0263\7j\2\2\u0263\u0264\7t\2\2\u0264\u0265\7q\2\2"+ "\u0265\u0266\7y\2\2\u0266\u0267\7u\2\2\u0267\\\3\2\2\2\u0268\u0269\7v"+ "\2\2\u0269\u026a\7t\2\2\u026a\u026b\7c\2\2\u026b\u026c\7p\2\2\u026c\u026d"+ "\7u\2\2\u026d\u026e\7k\2\2\u026e\u026f\7g\2\2\u026f\u0270\7p\2\2\u0270"+ "\u0271\7v\2\2\u0271^\3\2\2\2\u0272\u0273\7v\2\2\u0273\u0274\7t\2\2\u0274"+ "\u0275\7{\2\2\u0275`\3\2\2\2\u0276\u0277\7x\2\2\u0277\u0278\7q\2\2\u0278"+ "\u0279\7k\2\2\u0279\u027a\7f\2\2\u027ab\3\2\2\2\u027b\u027c\7x\2\2\u027c"+ "\u027d\7q\2\2\u027d\u027e\7n\2\2\u027e\u027f\7c\2\2\u027f\u0280\7v\2\2"+ "\u0280\u0281\7k\2\2\u0281\u0282\7n\2\2\u0282\u0283\7g\2\2\u0283d\3\2\2"+ "\2\u0284\u0285\7y\2\2\u0285\u0286\7j\2\2\u0286\u0287\7k\2\2\u0287\u0288"+ "\7n\2\2\u0288\u0289\7g\2\2\u0289f\3\2\2\2\u028a\u028f\5i\65\2\u028b\u028f"+ "\5k\66\2\u028c\u028f\5m\67\2\u028d\u028f\5o8\2\u028e\u028a\3\2\2\2\u028e"+ "\u028b\3\2\2\2\u028e\u028c\3\2\2\2\u028e\u028d\3\2\2\2\u028fh\3\2\2\2"+ "\u0290\u0292\5s:\2\u0291\u0293\5q9\2\u0292\u0291\3\2\2\2\u0292\u0293\3"+ "\2\2\2\u0293j\3\2\2\2\u0294\u0296\5\u0081A\2\u0295\u0297\5q9\2\u0296\u0295"+ "\3\2\2\2\u0296\u0297\3\2\2\2\u0297l\3\2\2\2\u0298\u029a\5\u008bF\2\u0299"+ "\u029b\5q9\2\u029a\u0299\3\2\2\2\u029a\u029b\3\2\2\2\u029bn\3\2\2\2\u029c"+ "\u029e\5\u0095K\2\u029d\u029f\5q9\2\u029e\u029d\3\2\2\2\u029e\u029f\3"+ "\2\2\2\u029fp\3\2\2\2\u02a0\u02a1\t\2\2\2\u02a1r\3\2\2\2\u02a2\u02ad\7"+ "\62\2\2\u02a3\u02aa\5y=\2\u02a4\u02a6\5u;\2\u02a5\u02a4\3\2\2\2\u02a5"+ "\u02a6\3\2\2\2\u02a6\u02ab\3\2\2\2\u02a7\u02a8\5\177@\2\u02a8\u02a9\5"+ "u;\2\u02a9\u02ab\3\2\2\2\u02aa\u02a5\3\2\2\2\u02aa\u02a7\3\2\2\2\u02ab"+ "\u02ad\3\2\2\2\u02ac\u02a2\3\2\2\2\u02ac\u02a3\3\2\2\2\u02adt\3\2\2\2"+ "\u02ae\u02b3\5w<\2\u02af\u02b1\5{>\2\u02b0\u02af\3\2\2\2\u02b0\u02b1\3"+ "\2\2\2\u02b1\u02b2\3\2\2\2\u02b2\u02b4\5w<\2\u02b3\u02b0\3\2\2\2\u02b3"+ "\u02b4\3\2\2\2\u02b4v\3\2\2\2\u02b5\u02b8\7\62\2\2\u02b6\u02b8\5y=\2\u02b7"+ "\u02b5\3\2\2\2\u02b7\u02b6\3\2\2\2\u02b8x\3\2\2\2\u02b9\u02ba\t\3\2\2"+ "\u02baz\3\2\2\2\u02bb\u02bd\5}?\2\u02bc\u02bb\3\2\2\2\u02bd\u02be\3\2"+ "\2\2\u02be\u02bc\3\2\2\2\u02be\u02bf\3\2\2\2\u02bf|\3\2\2\2\u02c0\u02c3"+ "\5w<\2\u02c1\u02c3\7a\2\2\u02c2\u02c0\3\2\2\2\u02c2\u02c1\3\2\2\2\u02c3"+ "~\3\2\2\2\u02c4\u02c6\7a\2\2\u02c5\u02c4\3\2\2\2\u02c6\u02c7\3\2\2\2\u02c7"+ "\u02c5\3\2\2\2\u02c7\u02c8\3\2\2\2\u02c8\u0080\3\2\2\2\u02c9\u02ca\7\62"+ "\2\2\u02ca\u02cb\t\4\2\2\u02cb\u02cc\5\u0083B\2\u02cc\u0082\3\2\2\2\u02cd"+ "\u02d2\5\u0085C\2\u02ce\u02d0\5\u0087D\2\u02cf\u02ce\3\2\2\2\u02cf\u02d0"+ "\3\2\2\2\u02d0\u02d1\3\2\2\2\u02d1\u02d3\5\u0085C\2\u02d2\u02cf\3\2\2"+ "\2\u02d2\u02d3\3\2\2\2\u02d3\u0084\3\2\2\2\u02d4\u02d5\t\5\2\2\u02d5\u0086"+ "\3\2\2\2\u02d6\u02d8\5\u0089E\2\u02d7\u02d6\3\2\2\2\u02d8\u02d9\3\2\2"+ "\2\u02d9\u02d7\3\2\2\2\u02d9\u02da\3\2\2\2\u02da\u0088\3\2\2\2\u02db\u02de"+ "\5\u0085C\2\u02dc\u02de\7a\2\2\u02dd\u02db\3\2\2\2\u02dd\u02dc\3\2\2\2"+ "\u02de\u008a\3\2\2\2\u02df\u02e1\7\62\2\2\u02e0\u02e2\5\177@\2\u02e1\u02e0"+ "\3\2\2\2\u02e1\u02e2\3\2\2\2\u02e2\u02e3\3\2\2\2\u02e3\u02e4\5\u008dG"+ "\2\u02e4\u008c\3\2\2\2\u02e5\u02ea\5\u008fH\2\u02e6\u02e8\5\u0091I\2\u02e7"+ "\u02e6\3\2\2\2\u02e7\u02e8\3\2\2\2\u02e8\u02e9\3\2\2\2\u02e9\u02eb\5\u008f"+ "H\2\u02ea\u02e7\3\2\2\2\u02ea\u02eb\3\2\2\2\u02eb\u008e\3\2\2\2\u02ec"+ "\u02ed\t\6\2\2\u02ed\u0090\3\2\2\2\u02ee\u02f0\5\u0093J\2\u02ef\u02ee"+ "\3\2\2\2\u02f0\u02f1\3\2\2\2\u02f1\u02ef\3\2\2\2\u02f1\u02f2\3\2\2\2\u02f2"+ "\u0092\3\2\2\2\u02f3\u02f6\5\u008fH\2\u02f4\u02f6\7a\2\2\u02f5\u02f3\3"+ "\2\2\2\u02f5\u02f4\3\2\2\2\u02f6\u0094\3\2\2\2\u02f7\u02f8\7\62\2\2\u02f8"+ "\u02f9\t\7\2\2\u02f9\u02fa\5\u0097L\2\u02fa\u0096\3\2\2\2\u02fb\u0300"+ "\5\u0099M\2\u02fc\u02fe\5\u009bN\2\u02fd\u02fc\3\2\2\2\u02fd\u02fe\3\2"+ "\2\2\u02fe\u02ff\3\2\2\2\u02ff\u0301\5\u0099M\2\u0300\u02fd\3\2\2\2\u0300"+ "\u0301\3\2\2\2\u0301\u0098\3\2\2\2\u0302\u0303\t\b\2\2\u0303\u009a\3\2"+ "\2\2\u0304\u0306\5\u009dO\2\u0305\u0304\3\2\2\2\u0306\u0307\3\2\2\2\u0307"+ "\u0305\3\2\2\2\u0307\u0308\3\2\2\2\u0308\u009c\3\2\2\2\u0309\u030c\5\u0099"+ "M\2\u030a\u030c\7a\2\2\u030b\u0309\3\2\2\2\u030b\u030a\3\2\2\2\u030c\u009e"+ "\3\2\2\2\u030d\u0310\5\u00a1Q\2\u030e\u0310\5\u00adW\2\u030f\u030d\3\2"+ "\2\2\u030f\u030e\3\2\2\2\u0310\u00a0\3\2\2\2\u0311\u0312\5u;\2\u0312\u0314"+ "\7\60\2\2\u0313\u0315\5u;\2\u0314\u0313\3\2\2\2\u0314\u0315\3\2\2\2\u0315"+ "\u0317\3\2\2\2\u0316\u0318\5\u00a3R\2\u0317\u0316\3\2\2\2\u0317\u0318"+ "\3\2\2\2\u0318\u031a\3\2\2\2\u0319\u031b\5\u00abV\2\u031a\u0319\3\2\2"+ "\2\u031a\u031b\3\2\2\2\u031b\u032d\3\2\2\2\u031c\u031d\7\60\2\2\u031d"+ "\u031f\5u;\2\u031e\u0320\5\u00a3R\2\u031f\u031e\3\2\2\2\u031f\u0320\3"+ "\2\2\2\u0320\u0322\3\2\2\2\u0321\u0323\5\u00abV\2\u0322\u0321\3\2\2\2"+ "\u0322\u0323\3\2\2\2\u0323\u032d\3\2\2\2\u0324\u0325\5u;\2\u0325\u0327"+ "\5\u00a3R\2\u0326\u0328\5\u00abV\2\u0327\u0326\3\2\2\2\u0327\u0328\3\2"+ "\2\2\u0328\u032d\3\2\2\2\u0329\u032a\5u;\2\u032a\u032b\5\u00abV\2\u032b"+ "\u032d\3\2\2\2\u032c\u0311\3\2\2\2\u032c\u031c\3\2\2\2\u032c\u0324\3\2"+ "\2\2\u032c\u0329\3\2\2\2\u032d\u00a2\3\2\2\2\u032e\u032f\5\u00a5S\2\u032f"+ "\u0330\5\u00a7T\2\u0330\u00a4\3\2\2\2\u0331\u0332\t\t\2\2\u0332\u00a6"+ "\3\2\2\2\u0333\u0335\5\u00a9U\2\u0334\u0333\3\2\2\2\u0334\u0335\3\2\2"+ "\2\u0335\u0336\3\2\2\2\u0336\u0337\5u;\2\u0337\u00a8\3\2\2\2\u0338\u0339"+ "\t\n\2\2\u0339\u00aa\3\2\2\2\u033a\u033b\t\13\2\2\u033b\u00ac\3\2\2\2"+ "\u033c\u033d\5\u00afX\2\u033d\u033f\5\u00b1Y\2\u033e\u0340\5\u00abV\2"+ "\u033f\u033e\3\2\2\2\u033f\u0340\3\2\2\2\u0340\u00ae\3\2\2\2\u0341\u0343"+ "\5\u0081A\2\u0342\u0344\7\60\2\2\u0343\u0342\3\2\2\2\u0343\u0344\3\2\2"+ "\2\u0344\u034d\3\2\2\2\u0345\u0346\7\62\2\2\u0346\u0348\t\4\2\2\u0347"+ "\u0349\5\u0083B\2\u0348\u0347\3\2\2\2\u0348\u0349\3\2\2\2\u0349\u034a"+ "\3\2\2\2\u034a\u034b\7\60\2\2\u034b\u034d\5\u0083B\2\u034c\u0341\3\2\2"+ "\2\u034c\u0345\3\2\2\2\u034d\u00b0\3\2\2\2\u034e\u034f\5\u00b3Z\2\u034f"+ "\u0350\5\u00a7T\2\u0350\u00b2\3\2\2\2\u0351\u0352\t\f\2\2\u0352\u00b4"+ "\3\2\2\2\u0353\u0354\7v\2\2\u0354\u0355\7t\2\2\u0355\u0356\7w\2\2\u0356"+ "\u035d\7g\2\2\u0357\u0358\7h\2\2\u0358\u0359\7c\2\2\u0359\u035a\7n\2\2"+ "\u035a\u035b\7u\2\2\u035b\u035d\7g\2\2\u035c\u0353\3\2\2\2\u035c\u0357"+ "\3\2\2\2\u035d\u00b6\3\2\2\2\u035e\u035f\7)\2\2\u035f\u0360\5\u00b9]\2"+ "\u0360\u0361\7)\2\2\u0361\u0367\3\2\2\2\u0362\u0363\7)\2\2\u0363\u0364"+ "\5\u00c1a\2\u0364\u0365\7)\2\2\u0365\u0367\3\2\2\2\u0366\u035e\3\2\2\2"+ "\u0366\u0362\3\2\2\2\u0367\u00b8\3\2\2\2\u0368\u0369\n\r\2\2\u0369\u00ba"+ "\3\2\2\2\u036a\u036c\7$\2\2\u036b\u036d\5\u00bd_\2\u036c\u036b\3\2\2\2"+ "\u036c\u036d\3\2\2\2\u036d\u036e\3\2\2\2\u036e\u036f\7$\2\2\u036f\u00bc"+ "\3\2\2\2\u0370\u0372\5\u00bf`\2\u0371\u0370\3\2\2\2\u0372\u0373\3\2\2"+ "\2\u0373\u0371\3\2\2\2\u0373\u0374\3\2\2\2\u0374\u00be\3\2\2\2\u0375\u0378"+ "\n\16\2\2\u0376\u0378\5\u00c1a\2\u0377\u0375\3\2\2\2\u0377\u0376\3\2\2"+ "\2\u0378\u00c0\3\2\2\2\u0379\u037a\7^\2\2\u037a\u037e\t\17\2\2\u037b\u037e"+ "\5\u00c3b\2\u037c\u037e\5\u00c7d\2\u037d\u0379\3\2\2\2\u037d\u037b\3\2"+ "\2\2\u037d\u037c\3\2\2\2\u037e\u00c2\3\2\2\2\u037f\u0380\7^\2\2\u0380"+ "\u038b\5\u008fH\2\u0381\u0382\7^\2\2\u0382\u0383\5\u008fH\2\u0383\u0384"+ "\5\u008fH\2\u0384\u038b\3\2\2\2\u0385\u0386\7^\2\2\u0386\u0387\5\u00c5"+ "c\2\u0387\u0388\5\u008fH\2\u0388\u0389\5\u008fH\2\u0389\u038b\3\2\2\2"+ "\u038a\u037f\3\2\2\2\u038a\u0381\3\2\2\2\u038a\u0385\3\2\2\2\u038b\u00c4"+ "\3\2\2\2\u038c\u038d\t\20\2\2\u038d\u00c6\3\2\2\2\u038e\u038f\7^\2\2\u038f"+ "\u0390\7w\2\2\u0390\u0391\5\u0085C\2\u0391\u0392\5\u0085C\2\u0392\u0393"+ "\5\u0085C\2\u0393\u0394\5\u0085C\2\u0394\u00c8\3\2\2\2\u0395\u0396\7p"+ "\2\2\u0396\u0397\7w\2\2\u0397\u0398\7n\2\2\u0398\u0399\7n\2\2\u0399\u00ca"+ "\3\2\2\2\u039a\u039b\7*\2\2\u039b\u00cc\3\2\2\2\u039c\u039d\7+\2\2\u039d"+ "\u00ce\3\2\2\2\u039e\u039f\7}\2\2\u039f\u00d0\3\2\2\2\u03a0\u03a1\7\177"+ "\2\2\u03a1\u00d2\3\2\2\2\u03a2\u03a3\7]\2\2\u03a3\u00d4\3\2\2\2\u03a4"+ "\u03a5\7_\2\2\u03a5\u00d6\3\2\2\2\u03a6\u03a7\7=\2\2\u03a7\u00d8\3\2\2"+ "\2\u03a8\u03a9\7.\2\2\u03a9\u00da\3\2\2\2\u03aa\u03ab\7\60\2\2\u03ab\u00dc"+ "\3\2\2\2\u03ac\u03ad\7?\2\2\u03ad\u00de\3\2\2\2\u03ae\u03af\7@\2\2\u03af"+ "\u00e0\3\2\2\2\u03b0\u03b1\7>\2\2\u03b1\u00e2\3\2\2\2\u03b2\u03b3\7#\2"+ "\2\u03b3\u00e4\3\2\2\2\u03b4\u03b5\7\u0080\2\2\u03b5\u00e6\3\2\2\2\u03b6"+ "\u03b7\7A\2\2\u03b7\u00e8\3\2\2\2\u03b8\u03b9\7<\2\2\u03b9\u00ea\3\2\2"+ "\2\u03ba\u03bb\7?\2\2\u03bb\u03bc\7?\2\2\u03bc\u00ec\3\2\2\2\u03bd\u03be"+ "\7>\2\2\u03be\u03bf\7?\2\2\u03bf\u00ee\3\2\2\2\u03c0\u03c1\7@\2\2\u03c1"+ "\u03c2\7?\2\2\u03c2\u00f0\3\2\2\2\u03c3\u03c4\7#\2\2\u03c4\u03c5\7?\2"+ "\2\u03c5\u00f2\3\2\2\2\u03c6\u03c7\7(\2\2\u03c7\u03c8\7(\2\2\u03c8\u00f4"+ "\3\2\2\2\u03c9\u03ca\7~\2\2\u03ca\u03cb\7~\2\2\u03cb\u00f6\3\2\2\2\u03cc"+ "\u03cd\7-\2\2\u03cd\u03ce\7-\2\2\u03ce\u00f8\3\2\2\2\u03cf\u03d0\7/\2"+ "\2\u03d0\u03d1\7/\2\2\u03d1\u00fa\3\2\2\2\u03d2\u03d3\7-\2\2\u03d3\u00fc"+ "\3\2\2\2\u03d4\u03d5\7/\2\2\u03d5\u00fe\3\2\2\2\u03d6\u03d7\7,\2\2\u03d7"+ "\u0100\3\2\2\2\u03d8\u03d9\7\61\2\2\u03d9\u0102\3\2\2\2\u03da\u03db\7"+ "(\2\2\u03db\u0104\3\2\2\2\u03dc\u03dd\7~\2\2\u03dd\u0106\3\2\2\2\u03de"+ "\u03df\7`\2\2\u03df\u0108\3\2\2\2\u03e0\u03e1\7\'\2\2\u03e1\u010a\3\2"+ "\2\2\u03e2\u03e3\7/\2\2\u03e3\u03e4\7@\2\2\u03e4\u010c\3\2\2\2\u03e5\u03e6"+ "\7<\2\2\u03e6\u03e7\7<\2\2\u03e7\u010e\3\2\2\2\u03e8\u03e9\7-\2\2\u03e9"+ "\u03ea\7?\2\2\u03ea\u0110\3\2\2\2\u03eb\u03ec\7/\2\2\u03ec\u03ed\7?\2"+ "\2\u03ed\u0112\3\2\2\2\u03ee\u03ef\7,\2\2\u03ef\u03f0\7?\2\2\u03f0\u0114"+ "\3\2\2\2\u03f1\u03f2\7\61\2\2\u03f2\u03f3\7?\2\2\u03f3\u0116\3\2\2\2\u03f4"+ "\u03f5\7(\2\2\u03f5\u03f6\7?\2\2\u03f6\u0118\3\2\2\2\u03f7\u03f8\7~\2"+ "\2\u03f8\u03f9\7?\2\2\u03f9\u011a\3\2\2\2\u03fa\u03fb\7`\2\2\u03fb\u03fc"+ "\7?\2\2\u03fc\u011c\3\2\2\2\u03fd\u03fe\7\'\2\2\u03fe\u03ff\7?\2\2\u03ff"+ "\u011e\3\2\2\2\u0400\u0401\7>\2\2\u0401\u0402\7>\2\2\u0402\u0403\7?\2"+ "\2\u0403\u0120\3\2\2\2\u0404\u0405\7@\2\2\u0405\u0406\7@\2\2\u0406\u0407"+ "\7?\2\2\u0407\u0122\3\2\2\2\u0408\u0409\7@\2\2\u0409\u040a\7@\2\2\u040a"+ "\u040b\7@\2\2\u040b\u040c\7?\2\2\u040c\u0124\3\2\2\2\u040d\u0411\5\u0127"+ "\u0094\2\u040e\u0410\5\u0129\u0095\2\u040f\u040e\3\2\2\2\u0410\u0413\3"+ "\2\2\2\u0411\u040f\3\2\2\2\u0411\u0412\3\2\2\2\u0412\u0126\3\2\2\2\u0413"+ "\u0411\3\2\2\2\u0414\u041b\t\21\2\2\u0415\u0416\n\22\2\2\u0416\u041b\6"+ "\u0094\2\2\u0417\u0418\t\23\2\2\u0418\u0419\t\24\2\2\u0419\u041b\6\u0094"+ "\3\2\u041a\u0414\3\2\2\2\u041a\u0415\3\2\2\2\u041a\u0417\3\2\2\2\u041b"+ "\u0128\3\2\2\2\u041c\u0423\t\25\2\2\u041d\u041e\n\22\2\2\u041e\u0423\6"+ "\u0095\4\2\u041f\u0420\t\23\2\2\u0420\u0421\t\24\2\2\u0421\u0423\6\u0095"+ "\5\2\u0422\u041c\3\2\2\2\u0422\u041d\3\2\2\2\u0422\u041f\3\2\2\2\u0423"+ "\u012a\3\2\2\2\u0424\u0425\7B\2\2\u0425\u012c\3\2\2\2\u0426\u0427\7\60"+ "\2\2\u0427\u0428\7\60\2\2\u0428\u0429\7\60\2\2\u0429\u012e\3\2\2\2\u042a"+ "\u042c\t\26\2\2\u042b\u042a\3\2\2\2\u042c\u042d\3\2\2\2\u042d\u042b\3"+ "\2\2\2\u042d\u042e\3\2\2\2\u042e\u042f\3\2\2\2\u042f\u0430\b\u0098\2\2"+ "\u0430\u0130\3\2\2\2\u0431\u0432\7\61\2\2\u0432\u0433\7,\2\2\u0433\u0437"+ "\3\2\2\2\u0434\u0436\13\2\2\2\u0435\u0434\3\2\2\2\u0436\u0439\3\2\2\2"+ "\u0437\u0438\3\2\2\2\u0437\u0435\3\2\2\2\u0438\u043a\3\2\2\2\u0439\u0437"+ "\3\2\2\2\u043a\u043b\7,\2\2\u043b\u043c\7\61\2\2\u043c\u043d\3\2\2\2\u043d"+ "\u043e\b\u0099\2\2\u043e\u0132\3\2\2\2\u043f\u0440\7\61\2\2\u0440\u0441"+ "\7\61\2\2\u0441\u0445\3\2\2\2\u0442\u0444\n\27\2\2\u0443\u0442\3\2\2\2"+ "\u0444\u0447\3\2\2\2\u0445\u0443\3\2\2\2\u0445\u0446\3\2\2\2\u0446\u0448"+ "\3\2\2\2\u0447\u0445\3\2\2\2\u0448\u0449\b\u009a\2\2\u0449\u0134\3\2\2"+ "\2\u044a\u044b\13\2\2\2\u044b\u0136\3\2\2\28\2\u028e\u0292\u0296\u029a"+ "\u029e\u02a5\u02aa\u02ac\u02b0\u02b3\u02b7\u02be\u02c2\u02c7\u02cf\u02d2"+ "\u02d9\u02dd\u02e1\u02e7\u02ea\u02f1\u02f5\u02fd\u0300\u0307\u030b\u030f"+ "\u0314\u0317\u031a\u031f\u0322\u0327\u032c\u0334\u033f\u0343\u0348\u034c"+ "\u035c\u0366\u036c\u0373\u0377\u037d\u038a\u0411\u041a\u0422\u042d\u0437"+ "\u0445\3\b\2\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } }
<filename>node_modules/react-icons-kit/md/ic_perm_identity_twotone.js<gh_stars>0 "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ic_perm_identity_twotone = void 0; var ic_perm_identity_twotone = { "viewBox": "0 0 24 24", "children": [{ "name": "path", "attribs": { "d": "M0 0h24v24H0V0z", "fill": "none" }, "children": [] }, { "name": "circle", "attribs": { "cx": "12", "cy": "8", "opacity": ".3", "r": "2" }, "children": [] }, { "name": "path", "attribs": { "d": "M12 15c-2.7 0-5.8 1.29-6 2.01V18h12v-1c-.2-.71-3.3-2-6-2z", "opacity": ".3" }, "children": [] }, { "name": "path", "attribs": { "d": "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm0 7c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4zm6 5H6v-.99c.2-.72 3.3-2.01 6-2.01s5.8 1.29 6 2v1z" }, "children": [] }] }; exports.ic_perm_identity_twotone = ic_perm_identity_twotone;
<gh_stars>0 import React, {useState} from 'react'; import {divesParams} from '../../../functions/exec/process'; import {makeStyles} from '@material-ui/core/styles'; import DiveLength from './DiveLengthInput'; import DiveMaxDepth from './DiveMaxDepthInput'; import DiveRequiredDepth from './DiveRequiredDepthInput'; const useStyles = makeStyles({ root: { display: 'grid', gridTemplateColumns: '1fr 1fr', gridTemplateRows: '1fr 1fr', } }); interface diveParamErrors { [index: string]: boolean, minLength: boolean, requiredDepth: boolean, maxDepth: boolean, } interface DiveParamsProps { onParamsChange: Function, onErrorsChange: Function, divesParamsObj: divesParams, divesParamsErrors: diveParamErrors, }; export default function DiveParams(props: DiveParamsProps) { const classes = useStyles(); // # Inputs: // # calcFilePath, newFilePath, isExport // # minLength : type int or float, sets the minimum length of a dive in seconds before a dive is recorded (Default is 60 seconds) // # requiredDepth : type int or float, a dive must reach this depth (same units as file) in order to be recorded (Defualt is None) // # maxDepth : type int or float, dives over that reach a depth greater than this will not be recorded (Default is None) // # interestVars : tpye list of string, each string is the name of a variable to coloscale dives, creates a subplot for each const onDiveLengthChange = (e: any) => { changeParam(e, "minLength"); }; const onDiveRequiredDepthChange = (e: any) => { changeParam(e, "requiredDepth"); }; const onDiveMaxDepthChange = (e:any) => { changeParam(e, "maxDepth"); }; const changeParam = (e: any, param: string) => { const newVal = e.target.value ?? ""; props.onParamsChange({ ...props.divesParamsObj, [param]: newVal, }) } const changeLengthError = (error: boolean) => { changeInputError(error, "minLength"); }; const changeRequiredDepthError = (error: boolean) => { changeInputError(error, "requiredDepth"); }; const changeMaxDepthError = (error: boolean) => { changeInputError(error, "maxDepth"); }; const changeInputError = (error: boolean, param: string) => { props.onErrorsChange({ ...props.divesParamsErrors, [param]: error, }) } const getInputVal = (param: string) => { return props.divesParamsObj[param]; } const getErrorVal = (param: string) => { return props.divesParamsErrors[param]; } return ( <div className={classes.root} > <DiveLength key = {"<NAME>"} value = {getInputVal('minLength') ?? ""} onInputChange = {onDiveLengthChange} error = {getErrorVal('minLength') ?? false} onErrorChange = {changeLengthError} /> <DiveMaxDepth key = {"<NAME>"} value = {getInputVal('maxDepth') ?? ""} onInputChange = {onDiveMaxDepthChange} error = {getErrorVal('maxDepth') ?? false} onErrorChange = {changeMaxDepthError} /> <DiveRequiredDepth key = {"<NAME>"} value = {getInputVal('requiredDepth') ?? ""} onInputChange = {onDiveRequiredDepthChange} error = {getErrorVal('requiredDepth') ?? false} onErrorChange = {changeRequiredDepthError} /> </div> ) };
#!/usr/bin/env bats # # Copyright 2020 Appvia Ltd <info@appvia.io> # # 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. # load helper setup() { ${KORE} get cluster ${CLUSTER} -t ${TEAM} | grep EKS || skip && true } @test "We should be able to apply the EKS credentials" { runit "${KORE} apply -f ${BASE_DIR}/e2eci/eks-credentials.yml -t kore-admin 2>&1 >/dev/null" [[ "$status" -eq 0 ]] runit "${KORE} get ekscredentials aws -t kore-admin" [[ "$status" -eq 0 ]] } @test "We should be able to delete the EKS cluster" { runit "${KORE} delete cluster ${CLUSTER} -t ${TEAM} --no-wait" [[ "$status" -eq 0 ]] retry 30 "${KORE} get cluster ${CLUSTER} -t ${TEAM} -o json --no-wait | jq -r '.status.status' | grep -i deleting" [[ "$status" -eq 0 ]] } @test "We should see the kubernetes resource delete" { ${KORE} get kubernetes ${CLUSTER} -t ${TEAM} || skip retry 50 "${KORE} get kubernetes ${CLUSTER} -t ${TEAM} 2>&1 | grep 'not found$'" [[ "$status" -eq 0 ]] } @test "We should see the eksnodegroup resource delete" { ${KORE} get eksnodegroup ${CLUSTER}-default -t ${TEAM} || skip retry 30 "${KORE} get eksnodegroup ${CLUSTER}-default -t ${TEAM} -o json | jq -r '.status.status' | grep -i deleting" [[ "$status" -eq 0 ]] retry 180 "${KORE} get eksnodegroup ${CLUSTER}-default -t ${TEAM} 2>&1 | grep 'not exist$'" [[ "$status" -eq 0 ]] } @test "We should see the eks cluster deleted" { retry 300 "${KORE} get cluster ${CLUSTER} -t ${TEAM} 2>&1 | grep 'not exist$'" [[ "$status" -eq 0 ]] } @test "We should see the eks nodegroup iam role disappear" { runit "aws --profile ${AWS_KORE_PROFILE} iam list-roles | jq '.Roles[].RoleName' -r | grep ${CLUSTER} || true" [[ "$status" -eq 0 ]] } @test "We should able to delete the ${TEAM} eks credentials" { runit "${KORE} delete -f ${BASE_DIR}/${E2E_DIR}/eks-credentials.yml -t kore-admin" [[ "$status" -eq 0 ]] }
<reponame>haedaal/locutus // Execute: test:module // To test this in a local terminal var effectiveness = 'futile' var location = '../../src' var locutus = require(location) var php = require(location + '/php') var strings = require(location + '/php/strings') var sprintf = require(location + '/php/strings/sprintf') var ruby = require(location + '/ruby') var math = require(location + '/ruby/Math') var preg_match = require(location + '/php/pcre/preg_match') var preg_replace = require(location + '/php/pcre/preg_replace') console.log(preg_replace('/xmas/i', 'Christmas', 'It was the night before Xmas.')) // Should report It was the night before Christmas. console.log(preg_replace('/xmas/ig', 'Christmas', 'xMas: It was the night before Xmas.')) // Should report Christmas: It was the night before Christmas. console.log(preg_replace('/(\\w+) (\\d+), (\\d+)/i', '$11,$3', 'April 15, 2003')) // Should report April1,2003 console.log(preg_replace('/[^a-zA-Z0-9]+/', '', 'The Development of code . http://www.')) // Should report TheDevelopmentofcodehttpwww console.log(preg_replace('/[^A-Za-z0-9_\\s]/', '', 'D"usseldorfer H"auptstrasse')) // Should report Dusseldorfer Hauptstrasse console.log(preg_match('^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$', '<EMAIL>')) // Should report true console.log(preg_match('^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$', '<EMAIL>')) // Should report flase console.log(preg_match('^[0-9-+s()]*$', '021827495')) // Should report true console.log(preg_match('^[0-9-+s()]*$', 'phone23no')) // Should report flase console.log(locutus.php.strings.sprintf('Resistance is %s', effectiveness)) console.log(php.strings.sprintf('Resistance is %s', effectiveness)) console.log(strings.sprintf('Resistance is %s', effectiveness)) console.log(sprintf('Resistance is %s', effectiveness)) console.log(ruby.Math.acos(0.3)) console.log(math.acos(0.3)) strings.echo(php.url.parse_url('mysql://kevin:abcd1234@example.com/databasename')['pass']) strings.echo(php.datetime.strtotime('2 januari 2012, 11:12:13 GMT'))
package de.saxsys.mvvmfx.examples.jigsaw.circle; import de.saxsys.mvvmfx.ViewModel; import javafx.beans.property.ReadOnlyStringWrapper; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import java.util.regex.Pattern; public class CircleViewModel implements ViewModel { private static final Pattern VALID_DOUBLE_PATTERN = Pattern.compile("((\\d*)|(\\d+\\.\\d*))"); private final StringProperty radius = new SimpleStringProperty(); private final ReadOnlyStringWrapper circularArea = new ReadOnlyStringWrapper(""); public void initialize() { radius.addListener(observable -> calculateCircleArea()); } private void calculateCircleArea() { if (radius.get() != null && !radius.get().isEmpty()) { double radiusAsDouble = Double.valueOf(radius.get()); double roundedResult = Math.round(Math.pow(radiusAsDouble, 2) * Math.PI); circularArea.set(Double.toString(roundedResult)); } else { circularArea.set(""); } } boolean validateDouble(String newText) { return VALID_DOUBLE_PATTERN.matcher(newText).matches(); } StringProperty radiusProperty() { return radius; } ReadOnlyStringWrapper circularAreaProperty() { return circularArea; } }
The best sorting algorithm to use in this case is the Bubble Sort algorithm. The basic idea behind the Bubble Sort algorithm is to traverse through the array, compare adjacent elements and swap them if the element on the left is greater than the one on the right. This will continue until the whole array is sorted. To apply it to the given array, we start by comparing 8 and 5 and swapping them. The resulting array is [5, 8, 1, 7, 3]. We then compare 5 and 1 and swap them, giving [1, 8, 5, 7, 3]. We complete this process until the whole array is in sorted order [1, 3, 5, 7, 8].
import requests from flask import Flask, Blueprint, request, jsonify from utils.utils import Utils from utils.constants import URL_OPENBUS, URL_OPENGEO, ENDPOINTS_BUS, ENDPOINTS_GEO from utils.config import PARAMS OPEN_BUS_EMT_MAD = Blueprint('open_bus_emt_mad', __name__) class OpenBusEmtMad(object): @OPEN_BUS_EMT_MAD.route('/geo/stop/<int:idStop>', methods=['GET']) def get_times_lines(idStop = None): request_params = {'idStop': idStop} return jsonify(OpenBusEmtMad.wrapper('get_arrive_stop', **request_params)) @staticmethod def wrapper(endpoint, **kwargs): req = requests.Session() url = URL_OPENGEO + ENDPOINTS_GEO[endpoint] kwargs['idClient'] = PARAMS['USERNAME'] kwargs['passKey'] = PARAMS['SECRET_KEY'] return req.post(url, data=kwargs, verify=True).json()
SELECT category, COUNT(name) as total FROM products WHERE category IN ('food', 'electronics', 'clothing') GROUP BY category;
<gh_stars>0 package owlmoney.logic.command.bond; import static owlmoney.commons.log.LogsCenter.getLogger; import java.util.logging.Logger; import owlmoney.logic.command.Command; import owlmoney.model.bank.exception.BankException; import owlmoney.model.bond.exception.BondException; import owlmoney.model.profile.Profile; import owlmoney.ui.Ui; /** * Executes ListBondCommand and prints the results. */ public class ListBondCommand extends Command { private final String bankName; private final int displayNum; private static final Logger logger = getLogger(ListBondCommand.class); /** * Constructor to create an instance of ListBondCommand. * * @param bankName Bank account name. * @param displayNum Number of expenditures to display. */ public ListBondCommand(String bankName, int displayNum) { this.bankName = bankName; this.displayNum = displayNum; } /** * Executes the function to list the bonds in the investment account from the profile. * * @param profile Profile of the user. * @param ui Ui of OwlMoney. * @return false so OwlMoney will not terminate yet. * @throws BankException If used on savings or bank does not exist. * @throws BondException If there are no bonds. */ public boolean execute(Profile profile, Ui ui) throws BankException, BondException { profile.profileListBonds(bankName, ui, displayNum); logger.info("Successful execution of ListBondCommand"); return this.isExit; } }
import unittest from unittest.mock import patch from tmc import points from tmc.utils import load, load_module, reload_module, get_stdout, check_source from functools import reduce import os import textwrap from random import choice, randint exercise = 'src.transpose_matrix' function = 'transpose' def get_correct(test_case: list) -> int: pass @points('5.transpose_matrix') class MatrixTest(unittest.TestCase): @classmethod def setUpClass(cls): with patch('builtins.input', side_effect=[AssertionError("Asking input from the user was not expected")]): cls.module = load_module(exercise, 'en') def test_0_main_program_ok(self): ok, line = check_source(self.module) message = """The code for testing the functions should be placed inside if __name__ == "__main__": block. The following row should be moved: """ self.assertTrue(ok, message+line) def test_1_function_exists(self): try: from src.transpose_matrix import transpose except: self.assertTrue(False, 'Your code should contain function named as transpose(matrix: list)') try: transpose = load(exercise, function, 'en') transpose([[1,2],[1,2]]) except: self.assertTrue(False, 'Make sure, that function can be called as follows:\ntranspose([[1,2],[1,2]])') def test_2_type_of_return_value(self): transpose = load(exercise, function, 'en') val = transpose([[1,2],[1,2]]) self.assertTrue(val == None, f"Function {function} should not return a value.") def test_3_matrices_1(self): test_cases = (([[1,2],[1,2]], [[1,1],[2,2]]), ([[0,1,2],[0,1,2],[0,1,2]], [[0,0,0],[1,1,1],[2,2,2]])) for test_case in test_cases: with patch('builtins.input', side_effect=[AssertionError("Asking input from the user was not expected")]): reload_module(self.module) output_at_start = get_stdout() transpose = load(exercise, function, 'en') test_matrix = test_case[0] test_matrix2 = [r[:] for r in test_case[0]] try: transpose(test_matrix) except: self.assertTrue(False, f"Make sure, that the function works when the input is \n{test_matrix2}") correct = test_case[1] self.assertEqual(test_matrix, correct, f"The result \n{test_matrix} does not match with the model solution \n{correct} when the parameter is \n{test_matrix2}") def test_4_matrices_2(self): test_cases = (([[10,100],[10,100]], [[10,10],[100,100]]), ([[2,3,4,5],[6,7,8,9],[9,8,7,6],[5,4,3,2]], [[2,6,9,5],[3,7,8,4],[4,8,7,3],[5,9,6,2]])) for test_case in test_cases: with patch('builtins.input', side_effect=[AssertionError("Asking input from the user was not expected")]): reload_module(self.module) output_at_start = get_stdout() transpose = load(exercise, function, 'en') test_matrix = test_case[0] test_matrix2 = [r[:] for r in test_case[0]] try: transpose(test_matrix) except: self.assertTrue(False, f"Make sure, that the function works when the input is \n{test_matrix2}") correct = test_case[1] self.assertEqual(test_matrix, correct, f"The result \n{test_matrix} does not match with the model solution \n{correct} when the parameter is \n{test_matrix2}") if __name__ == '__main__': unittest.main()
<filename>open-sphere-base/mantle/src/main/java/io/opensphere/mantle/crust/MetaDataProviderAdapter.java<gh_stars>10-100 package io.opensphere.mantle.crust; import java.io.Serializable; import java.util.LinkedList; import java.util.List; import java.util.Set; import io.opensphere.core.util.collections.New; import io.opensphere.mantle.data.element.MetaDataProvider; /** * Completely generic MetaDataProvider base class; concrete subclasses must * override the getValue method to return field values. */ public abstract class MetaDataProviderAdapter implements MetaDataProvider { /** The set of supported field names. */ private Set<String> myFieldNames; /** * Copy constructor. * * @param source the object from which data is read. */ protected MetaDataProviderAdapter(MetaDataProviderAdapter source) { myFieldNames = New.set(source.myFieldNames); } /** Creates a new adapter. */ public MetaDataProviderAdapter() { /* intentionally blank */ } /** * Sets the value of the {@link #myFieldNames} field. * * @param fieldNames the value to store in the {@link #myFieldNames} field. */ public void setFieldNames(Set<String> fieldNames) { myFieldNames = fieldNames; } @Override public List<String> getKeys() { return new LinkedList<>(myFieldNames); } @Override public List<Object> getValues() { List<Object> ret = new LinkedList<>(); myFieldNames.stream().map(k -> getValue(k)).forEach(ret::add); return ret; } @Override public boolean hasKey(String key) { return myFieldNames.contains(key); } @Override public boolean keysMutable() { return false; } @Override public void removeKey(String key) { } @Override public boolean setValue(String key, Serializable value) { return false; } @Override public boolean valuesMutable() { return false; } }
#!/usr/bin/env sh # # Import the given feed file (in `snownews` format). # # Author: Alastair Hughes # Contact: hobbitalastair at yandex dot com [ -z "${FEED_DIR}" ] && FEED_DIR="${XDG_CONFIG_DIR:-${HOME}/.config}/feeds/" if [ "$#" -ne 1 ]; then printf 'usage: %s urls\n' "$0" exit 1 fi while IFS='|' read -r url name category filter; do printf "%s: exporting feed '%s'\n" "$0" "${name}" name="$(printf "%s" "${name}" | tr ' ' '_')" mkdir "${FEED_DIR}/${name}" if [ "$?" -ne 0 ]; then printf "%s: failed to create dir with name '%s'\n" "$0" "${name}" exit 1 fi if [ "$(printf "%s" "${url}" | cut -d ':' -f 1)" == "exec" ]; then fetch="$(printf "%s" "${url}" | cut -d ':' -f 2-)" else fetch="curl -L -o - '${url}'" fi if [ -n "${filter}" ]; then if printf "%s" "${filter}" | grep -e 'atom2rss' > /dev/null; then filter="" else filter=" | ${filter} | rss2atom" fi else filter=" | rss2atom" fi cat > "${FEED_DIR}/${name}/fetch" << EOF #!/usr/bin/env sh ${fetch} ${filter} EOF chmod +x "${FEED_DIR}/${name}/fetch" ln -s "../open" "${FEED_DIR}/${name}/open" done < "$1"
#!/bin/bash # Directorios de trabajo BASE_DIR="/backup" BACKUP_DIR=$BASE_DIR"/data" # Obtener el nombre del directorio/archivo a resguardar if [ $# -lt 1 ] then echo "uso: $0 DIR" exit -1 fi # Eliminar las barras (/) del nombre DIR=$1 DIR_C=$(echo $DIR | sed 's/\///g') # Obtener la fecha y hora actual DATE=$(date +%Y-%m-%d_%H%M%S) # Comprimir y resguardar tar cjf $BACKUP_DIR/${DIR_C}_$DATE.tar.bzip2 $DIR 2>/dev/null
<reponame>yunsean/yoga<filename>yoga-business/yoga-admin/src/main/java/com/yoga/admin/user/dto/UserSignatureSetDto.java package com.yoga.admin.user.dto; import com.yoga.core.base.BaseDto; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Getter @Setter @NoArgsConstructor public class UserSignatureSetDto extends BaseDto { @ApiModelProperty(value = "签名文件ID") private Long fileId; }
<reponame>brandcast/react-higher-event-built "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReactHigherEventProxy = exports.ReactHigherEventContainer = exports.ReactHigherEvent = undefined; var _ReactHigherEvent = require("./ReactHigherEvent"); var _ReactHigherEvent2 = _interopRequireDefault(_ReactHigherEvent); var _ReactHigherEventContainer = require("./ReactHigherEventContainer"); var _ReactHigherEventContainer2 = _interopRequireDefault(_ReactHigherEventContainer); var _ReactHigherEventProxy = require("./ReactHigherEventProxy"); var _ReactHigherEventProxy2 = _interopRequireDefault(_ReactHigherEventProxy); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.ReactHigherEvent = _ReactHigherEvent2.default; exports.ReactHigherEventContainer = _ReactHigherEventContainer2.default; exports.ReactHigherEventProxy = _ReactHigherEventProxy2.default;
// // LTFramerProperty.h // Pods // // Created by <NAME> on 07/09/16. // // #import "LTFramerProperty.h" typedef NS_ENUM(NSUInteger, LTFramerSize) { LTFramerSizeExact, LTFramerSizeScaleToFill, LTFramerSizeScaleToFit }; @interface LTFramerSizeProperty : LTFramerProperty @property (nonatomic, assign) LTFramerSize size; + (instancetype)propertyWithDirection:(LTFramerDirection)direction size:(LTFramerSize)size; @end
import { SimpleUINode } from 'fomir-simple-ui' import { type } from 'os' type CustomNode = SimpleUINode declare module 'fomir' { interface CustomTypes { Node: | CustomNode | { component: CustomNode['component'] | ({} & string) [key: string]: any } } interface Validators { isEmail?: 'string' } }
Scalr.regPage('Scalr.ui.farms.builder.addrole.dbmsr', function () { return { xtype: 'container', itemId: 'dbmsr', isExtraSettings: true, hidden: true, suspendUpdateEvent: 0, layout: 'anchor', isVisibleForRole: function(record) { return record.isDbMsr(); }, onSettingsUpdate: function(record, name, value) { var me = this, platform = record.get('platform'); me.suspendUpdateEvent++; if (name === 'instance_type' && Ext.Array.contains(['ec2', 'gce'], platform)) { me.refreshStorageEngine(record); me.refreshStorageDisks(record); me.refreshDisksCheckboxes(record, 'lvm_settings'); if (platform === 'ec2') { me.refreshEbsEncrypted(record, value); } } this.suspendUpdateEvent--; }, refreshEbsEncrypted: function(record, instType) { var me = this; record.loadInstanceTypeInfo(function(instanceTypeInfo){ var field = me.down('[name="db.msr.data_storage.ebs.encrypted"]'), readOnly = false, value = false, ebsEncryptionSupported = instanceTypeInfo ? instanceTypeInfo.ebsencryption || false : true; if (field) { readOnly = !ebsEncryptionSupported; value = !ebsEncryptionSupported ? false : field.getValue(); if (ebsEncryptionSupported && (Scalr.getGovernance('ec2', 'aws.storage') || {})['require_encryption']) { readOnly = true; value = true; field.toggleIcon('governance', true); } else { field.toggleIcon('governance', false); } field.encryptionSupported = ebsEncryptionSupported; field.setValue(value); field.setReadOnly(readOnly); } }, instType); }, refreshStorageEngine: function(record) { var field = this.down('[name="db.msr.data_storage.engine"]'), currentValue = field.getValue(); field.store.load({ data: record.getAvailableStorages() }); if (!field.findRecordByValue(currentValue)) { var currentValue = record.getDefaultStorageEngine(); if (!field.findRecordByValue(currentValue)) { currentValue = field.store.first(); } } field.setValue(currentValue); }, refreshStorageDisks: function(record) { var field = this.down('[name="db.msr.data_storage.eph.disk"]'), cont = this.down('#eph_checkboxes'); if (record.isMultiEphemeralDevicesEnabled()) { field.hide(); cont.show(); this.refreshDisksCheckboxes(record, 'eph_checkboxes'); } else { field.show(); cont.hide(); field.store.load({data: record.getAvailableStorageDisks()}); field.setValue(field.store.getAt(field.store.getCount() > 1 ? 1 : 0).get('device')); } }, getDisksCheckboxesValues: function(itemId) { var volumes = {}; Ext.each(this.down('#' + itemId).query('checkbox'), function() { if (this.getValue()) { volumes[this.getName()] = this.ephSize; } }); return Ext.Object.getSize(volumes) > 0 ? Ext.encode(volumes) : null; }, refreshDisksCheckboxes: function(record, itemId) { var ephemeralDevicesMap = record.getEphemeralDevicesMap() || {}; var platform = record.get('platform'), settings = record.get('settings'), cont = this.down('#' + itemId), instanceType; if (Ext.Array.contains(['ec2', 'gce'], platform)) { instanceType = settings['instance_type']; } cont.suspendLayouts(); cont.removeAll(); if (instanceType !== undefined && ephemeralDevicesMap[instanceType] !== undefined) { var devices = ephemeralDevicesMap[instanceType], size = 0; for (var d in devices) { cont.add({ xtype: 'checkbox', name: d, boxLabel: d + ' (' + devices[d]['size'] + 'Gb)', ephSize: devices[d]['size'], checked: false }); size += parseInt(devices[d]['size']); } } else { cont.add({ xtype: 'displayfield', value: 'LVM device' }); } cont.resumeLayouts(true); }, setRole: function(record) { var field, platform = record.get('platform'), instType, result = true; //fs field = this.down('[name="db.msr.data_storage.fstype"]'); field.suspendLayouts(); field.removeAll(); field.add(record.getAvailableStorageFs()); field.setValue('ext3'); field.resumeLayouts(true); //storage engine this.refreshStorageEngine(record); //disks this.refreshStorageDisks(record); //raid field = this.down('[name="db.msr.data_storage.raid.level"]'); field.store.load({ data: record.getAvailableStorageRaids() }); field.setValue('10'); //lvm this.refreshDisksCheckboxes(record, 'lvm_settings'); if (Ext.Array.contains(record.get('behaviors', true), 'redis')) { this.down('[name="db.msr.redis.persistence_type"]').setValue('snapshotting'); this.down('[name="db.msr.redis.use_password"]').setValue('1'); this.down('[name="db.msr.redis.num_processes"]').setValue(1); this.down('#redis_settings').show(); } else { this.down('#redis_settings').hide(); } this.down('[name="db.msr.redis.num_processes"]').setValue(1); this.down('[name="db.msr.data_storage.ebs.iops"]').setValue(100); this.down('[name="db.msr.data_storage.ebs.size"]').setValue(10); this.down('[name="db.msr.data_storage.ebs.encrypted"]').setValue(false); this.down('[name="db.msr.data_storage.cinder.size"]').setValue(100); this.down('[name="db.msr.data_storage.gced.size"]').setValue(100); this.down('[name="db.msr.data_storage.gced.type"]').setValue('pd-standard'); this.down('#disallowWarning').hide(); this.down('#dataStorageSettings').show(); if (record.getAvailableStorages().length === 0) { if (Scalr.isOpenstack(platform)) { var warningFieldset = this.down('#disallowWarning'); warningFieldset.show(); warningFieldset.down().setValue('Cinder and Swift are not available on your ' + Scalr.utils.getPlatformName(platform) + ' cloud. At least one of these is required to use database roles.'); this.down('#dataStorageSettings').hide(); result = false; } } if (platform === 'ec2') { if (instType = this.up('form').getForm().findField('instance_type').getValue()) { this.refreshEbsEncrypted(record, instType); } } return result; }, isValid: function(record) { var storageEngine = this.down('[name="db.msr.data_storage.engine"]').getValue(), res = true, field; if (Ext.Array.contains(['ebs', 'csvol'], storageEngine)) { field = this.down('[name="db.msr.data_storage.ebs.size"]'); res = field.validate() || {comp: field}; if (res === true && this.down('[name="db.msr.data_storage.ebs.type"]').getValue() === 'io1') { field = this.down('[name="db.msr.data_storage.ebs.iops"]'); res = field.validate() || {comp: field}; } } else if (storageEngine === 'lvm' && record.get('platform') === 'ec2') { var lvm = this.down('#lvm_settings').query('checkbox'); if (!this.getDisksCheckboxesValues('lvm_settings') && lvm.length > 0) { res = {comp: lvm[0], message: 'Please select ephemeral device'}; } } else if (storageEngine === 'cinder') { field = this.down('[name="db.msr.data_storage.cinder.size"]'); res = field.validate() || {comp: field}; } else if (storageEngine === 'raid.ebs') { field = this.down('[name="db.msr.data_storage.raid.volume_size"]'); res = field.validate() || {comp: field}; if (res === true && storageEngine === 'raid.ebs' && this.down('[name="db.msr.data_storage.raid.ebs.type"]').getValue() === 'io1') { field = this.down('[name="db.msr.data_storage.raid.ebs.iops"]'); res = field.validate() || {comp: field}; } } return res; }, getSettings: function(record) { var settings = { 'db.msr.data_storage.engine': this.down('[name="db.msr.data_storage.engine"]').getValue(), 'db.msr.data_storage.fstype': this.down('[name="db.msr.data_storage.fstype"]').getValue() }; if (settings['db.msr.data_storage.engine'] === 'eph') { if (record.isMultiEphemeralDevicesEnabled()) { settings['db.msr.data_storage.eph.disks'] = this.getDisksCheckboxesValues('eph_checkboxes'); } else { settings['db.msr.data_storage.eph.disk'] = this.down('[name="db.msr.data_storage.eph.disk"]').getValue(); } } else if (settings['db.msr.data_storage.engine'] === 'lvm') { settings['db.msr.storage.lvm.volumes'] = this.getDisksCheckboxesValues('lvm_settings'); } else if (settings['db.msr.data_storage.engine'] === 'raid.ebs') { settings['db.msr.data_storage.raid.level'] = this.down('[name="db.msr.data_storage.raid.level"]').getValue(); settings['db.msr.data_storage.raid.volume_size'] = this.down('[name="db.msr.data_storage.raid.volume_size"]').getValue(); settings['db.msr.data_storage.raid.volumes_count'] = this.down('[name="db.msr.data_storage.raid.volumes_count"]').getValue(); if (settings['db.msr.data_storage.engine'] === 'raid.ebs') { settings['db.msr.data_storage.raid.ebs.type'] = this.down('[name="db.msr.data_storage.raid.ebs.type"]').getValue(); settings['db.msr.data_storage.raid.ebs.iops'] = this.down('[name="db.msr.data_storage.raid.ebs.iops"]').getValue(); } } else if (settings['db.msr.data_storage.engine'] == 'cinder') { settings['db.msr.data_storage.cinder.size'] = this.down('[name="db.msr.data_storage.cinder.size"]').getValue(); } else if (settings['db.msr.data_storage.engine'] == 'gce_persistent') { settings['db.msr.data_storage.gced.size'] = this.down('[name="db.msr.data_storage.gced.size"]').getValue(); settings['db.msr.data_storage.gced.type'] = this.down('[name="db.msr.data_storage.gced.type"]').getValue(); } else if (Ext.Array.contains(['ebs', 'csvol'], settings['db.msr.data_storage.engine'])) { settings['db.msr.data_storage.ebs.size'] = this.down('[name="db.msr.data_storage.ebs.size"]').getValue(); settings['db.msr.data_storage.ebs.type'] = this.down('[name="db.msr.data_storage.ebs.type"]').getValue(); settings['db.msr.data_storage.ebs.iops'] = this.down('[name="db.msr.data_storage.ebs.iops"]').getValue(); settings['db.msr.data_storage.ebs.encrypted'] = this.down('[name="db.msr.data_storage.ebs.encrypted"]').getValue() ? 1 : 0; } if (Ext.Array.contains(record.get('behaviors', true), 'redis')) { settings['db.msr.redis.persistence_type'] = this.down('[name="db.msr.redis.persistence_type"]').getValue(); settings['db.msr.redis.use_password'] = this.down('[name="db.msr.redis.use_password"]').getValue(); settings['db.msr.redis.num_processes'] = this.down('[name="db.msr.redis.num_processes"]').getValue(); } return settings; }, items: [{ xtype: 'fieldset', itemId: 'redis_settings', title: 'Redis settings', hidden: true, layout: 'anchor', items: [{ xtype: 'fieldcontainer', layout: 'hbox', maxWidth: 760, items: [{ xtype: 'combo', name: 'db.msr.redis.persistence_type', fieldLabel: 'Persistence type', editable: false, store: Scalr.constants.redisPersistenceTypes, valueField: 'id', displayField: 'name', value: 'snapshotting', flex: 1, labelWidth: 125, queryMode: 'local', margin: '0 32 0 0' }, { xtype: 'buttongroupfield', name: 'db.msr.redis.use_password', fieldLabel: 'Password auth', labelWidth: 110, flex: 1, defaults: { width: 50 }, items: [{ text: 'On', value: '1' },{ text: 'Off', value: '0' }] }] }, { xtype: 'sliderfield', name: 'db.msr.redis.num_processes', fieldLabel: 'Num. of processes', minValue: 1, maxValue: 16, increment: 1, labelWidth: 128, anchor: '50%', maxWidth: 380, margin: '0 16 20 0', useTips: false, showValue: true }] },{ xtype: 'fieldset', itemId: 'disallowWarning', items: { xtype: 'displayfield', cls: 'x-form-field-warning', anchor: '100%' } },{ xtype: 'fieldset', itemId: 'dataStorageSettings', title: 'Data storage settings', items: [{ xtype: 'fieldcontainer', layout: 'hbox', maxWidth: 760, items: [{ xtype: 'combo', name: 'db.msr.data_storage.engine', flex: 1, margin: '0 32 0 0', fieldLabel: 'Storage engine', labelWidth: 120, allowChangeable: false, editable: false, queryMode: 'local', store: { fields: [ 'description', 'name' ], proxy: 'object' }, valueField: 'name', displayField: 'description', listeners:{ change: function(comp, value){ var tab = this.up('#dbmsr'), moduleTabParams = tab.up('#farmDesigner').moduleParams['tabParams'], isRaid = value === 'raid.ebs', field, xfsBtn; tab.suspendLayouts(); tab.down('#eph_settings').setVisible(value === 'eph'); tab.down('#lvm_settings').setVisible(value === 'lvm'); tab.down('#ebs_settings').setVisible(value === 'ebs' || value === 'csvol'); tab.down('[name="db.msr.data_storage.ebs.encrypted"]').setVisible(value === 'ebs'); tab.down('#ebs_settings_type').setVisible(value === 'ebs'); tab.down('#cinder_settings').setVisible(value === 'cinder'); tab.down('#gced_settings').setVisible(value === 'gce_persistent'); tab.down('#raid_settings').setVisible(isRaid); if (isRaid) { var raidEbsTypeField = tab.down('[name="db.msr.data_storage.raid.ebs.type"]'); raidEbsTypeField.setVisible(value === 'raid.ebs'); tab.down('[name="db.msr.data_storage.raid.ebs.iops"]').setVisible(value === 'raid.ebs' && raidEbsTypeField.getValue() === 'io'); } field = tab.down('[name="db.msr.data_storage.fstype"]'); xfsBtn = field.down('[value="xfs"]'); if (xfsBtn && !xfsBtn.unavailable) { if (isRaid && field.getValue() === 'xfs') { field.setValue('ext3'); } xfsBtn.setDisabled(isRaid); } tab.resumeLayouts(true); if (value && tab.suspendUpdateEvent === 0) { tab.up('form').updateRecordSettings(comp.name, value); } } } },{ xtype: 'buttongroupfield', name: 'db.msr.data_storage.fstype', flex: 1, minWidth: 200, fieldLabel: 'Filesystem', labelWidth: 80, layout: 'hbox', defaults: { minWidth: 50, maxWidth: 70, flex: 1 } }] },{ xtype: 'container', maxWidth: 760, layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', itemId: 'eph_settings', cls: 'inner-container', layout: 'anchor', hidden: true, items: [{ xtype: 'combo', name: 'db.msr.data_storage.eph.disk', allowChangeable: false, fieldLabel: 'Disk device', editable: false, store: { fields: [ 'device', 'description' ], proxy: 'object' }, valueField: 'device', displayField: 'description', anchor: '100%', labelWidth: 100, queryMode: 'local' },{ xtype: 'container', itemId: 'eph_checkboxes', hidden: true }] },{ xtype: 'container', itemId: 'lvm_settings', cls: 'inner-container', hidden: true, items: [{ xtype: 'displayfield', hideLabel: true, value: 'LVM device', width: 400 }] },{ xtype: 'container', itemId: 'ebs_settings', cls: 'inner-container', hidden: true, layout: 'anchor', items: [{ xtype: 'fieldcontainer', layout: { type: 'hbox' }, anchor: '100%', items: [{ xtype: 'container', itemId: 'ebs_settings_type', layout: 'hbox', flex: 1, //maxWidth: 362, margin: '0 20 0 0', items: [{ xtype: 'combo', store: Scalr.utils.getEbsTypes(), allowChangeable: false, fieldLabel: 'EBS type', labelWidth: 102, valueField: 'id', displayField: 'name', editable: false, queryMode: 'local', value: 'standard', name: 'db.msr.data_storage.ebs.type', flex: 1, maxWidth: 380, listeners: { change: function (comp, value) { var iopsField = comp.next(); iopsField.setVisible(value === 'io1'); if (value === 'io1') { iopsField.reset(); iopsField.setValue(100); } else { comp.up('container').next().isValid(); } } } },{ xtype: 'textfield', //itemId: 'db.msr.data_storage.ebs.iops', name: 'db.msr.data_storage.ebs.iops', allowChangeable: false, vtype: 'iops', allowBlank: false, hideLabel: true, hidden: true, margin: '0 0 0 2', width: 50, listeners: { change: function(comp, value){ var sizeField = comp.up('container').next(); if (comp.isValid() && comp.prev().getValue() === 'io1') { var minSize = Scalr.utils.getMinStorageSizeByIops(value); if (sizeField.getValue()*1 < minSize) { sizeField.setValue(minSize); } } } } }] },{ xtype: 'textfield', name: 'db.msr.data_storage.ebs.size', allowChangeable: false, fieldLabel: 'Storage size', width: 155, vtype: 'ebssize', getEbsType: function() { return this.up('container').down('[name="db.msr.data_storage.ebs.type"]').getValue(); }, getEbsIops: function() { return this.up('container').down('[name="db.msr.data_storage.ebs.iops"]').getValue(); }, labelWidth: 90, allowBlank: false, margin: '0 6 0 0' },{ xtype: 'label', cls: 'x-label-grey', text: 'GB', margin: '6 0 0 0' }] },{ xtype: 'checkbox', name: 'db.msr.data_storage.ebs.encrypted', boxLabel: 'Enable EBS encryption', defaults: { width: 90 }, value: '0', hidden: true, plugins: { ptype: 'fieldicons', icons: [ {id: 'question', tooltip: 'EBS encryption is not supported by selected instance type'}, 'governance' ] }, listeners: { writeablechange: function(comp, readOnly) { this.toggleIcon('question', readOnly && !comp.encryptionSupported); } } }] },{ xtype: 'container', itemId: 'cinder_settings', cls: 'inner-container', hidden: true, layout: 'anchor', items: [{ xtype: 'textfield', name: 'db.msr.data_storage.cinder.size', allowChangeable: false, fieldLabel: 'Disk size', vtype: 'num', allowBlank: false, labelWidth: 100, anchor: '100%', maxWidth: 200, value: 100 }] },{ xtype: 'container', itemId: 'gced_settings', cls: 'inner-container', hidden: true, layout: 'anchor', items: [{ xtype: 'fieldcontainer', layout: { type: 'hbox', align: 'middle' }, items: [{ xtype: 'textfield', name: 'db.msr.data_storage.gced.size', allowChangeable: false, fieldLabel: 'Disk size', vtype: 'num', allowBlank: false, width: 215, value: 100 },{ xtype: 'label', text: 'GB', margin: '0 0 0 6' }] }, { xtype: 'combo', store: Scalr.constants.gceDiskTypes, width: 215, valueField: 'id', displayField: 'name', allowChangeable: false, fieldLabel: 'Disk type', editable: false, queryMode: 'local', value: 'pd-standard', name: 'db.msr.data_storage.gced.type' }] },{ xtype: 'container', itemId: 'raid_settings', cls: 'inner-container', hidden: true, layout: 'anchor', items: [{ xtype: 'container', layout: 'hbox', items: [{ xtype: 'combo', name: 'db.msr.data_storage.raid.level', allowChangeable: false, fieldLabel: 'RAID level', editable: false, store: { fields: [ 'name', 'description' ], proxy: 'object' }, valueField: 'name', displayField: 'description', flex: 1, margin: '0 20 0 0', value: '', labelWidth: 80, queryMode: 'local', listeners:{ change:function(comp, value) { var data = []; if (value == '0') { data = {'2':'2', '3':'3', '4':'4', '5':'5', '6':'6', '7':'7', '8':'8'}; } else if (value == '1') { data = {'2':'2'}; } else if (value == '5') { data = {'3':'3', '4':'4', '5':'5', '6':'6', '7':'7', '8':'8'}; } else if (value == '10') { data = {'4':'4', '6':'6', '8':'8'}; } var field = comp.next(), val; field.store.load({data: data}); if (field.store.getCount()) { val = field.store.getAt(0).get('id') } field.setValue(val); } } },{ xtype: 'combo', name: 'db.msr.data_storage.raid.volumes_count', allowChangeable: false, fieldLabel: 'Number of volumes', editable: false, store: { fields: [ 'id', 'name'], proxy: 'object' }, valueField: 'id', displayField: 'name', flex: 1, labelWidth: 135, maxWidth: 210, queryMode: 'local' }] },{ xtype: 'container', layout: 'hbox', margin: '12 0', items: [{ xtype: 'container', flex: 1, layout: 'hbox', items: [{ xtype: 'combo', store: Scalr.utils.getEbsTypes(), allowChangeable: false, fieldLabel: 'EBS type', labelWidth: 80, valueField: 'id', displayField: 'name', editable: false, queryMode: 'local', name: 'db.msr.data_storage.raid.ebs.type', value: 'standard', flex: 1, listeners: { change: function (comp, value) { var iopsField = comp.next(); iopsField.setVisible(value === 'io1'); if (value === 'io1') { iopsField.reset(); iopsField.setValue(100); } else { comp.up('container').next().isValid(); } } } }, { xtype: 'textfield', //itemId: 'db.msr.data_storage.raid.ebs.iops', allowChangeable: false, name: 'db.msr.data_storage.raid.ebs.iops', vtype: 'iops', allowBlank: false, hidden: true, margin: '0 0 0 2', width: 50, listeners: { change: function(comp, value){ var sizeField = comp.up('container').next(); if (comp.isValid() && comp.prev().getValue() === 'io1') { var minSize = Scalr.utils.getMinStorageSizeByIops(value); if (sizeField.getValue()*1 < minSize) { sizeField.setValue(minSize); } } } } }] },{ xtype: 'textfield', name: 'db.msr.data_storage.raid.volume_size', allowChangeable: false, fieldLabel: 'Each volume size', allowBlank: false, labelWidth: 135, flex: 1, maxWidth: 186, margin: '0 6 0 20', value: 10, vtype: 'ebssize', getEbsType: function() { return this.up('container').down('[name="db.msr.data_storage.raid.ebs.type"]').getValue(); }, getEbsIops: function() { return this.up('container').down('[name="db.msr.data_storage.raid.ebs.iops"]').getValue(); } },{ xtype: 'label', cls: 'x-label-grey', text: 'GB', margin: '4 0 0 0' }] }] }] }] }] } });
<reponame>MccreeFei/jframe<gh_stars>10-100 /** * */ package jframe.activemq.service; import jframe.core.plugin.annotation.Service; /** * @author dzh * @date Jul 31, 2015 1:23:33 PM * @since 1.0 */ @Service(clazz = "jframe.activemq.service.ActivemqServiceImpl", id = "jframe.service.activemq") public interface ActivemqService { }
// Copyright (C) 2017, ccpaging <<EMAIL>>. All rights reserved. package file import ( "bytes" "fmt" "os" "path" "time" l4g "github.com/ccpaging/nxlog4go" "github.com/ccpaging/nxlog4go/driver" "github.com/ccpaging/nxlog4go/patt" "github.com/ccpaging/nxlog4go/rolling" ) var ( // EvaluateLineLength is the average line length when calculating lines by file size EvaluateLineLength int64 = 256 // DefaultRotateSize is the default log file rotate size DefaultRotateSize int64 = 1024 * 1024 ) // RotateFile represents the buffered writer with lock, header, footer and rotating. type RotateFile struct { file *rolling.Writer // The opened file buffer writer Header string // File header Footer string // File trailer Maxsize int64 // Rotate at size Maxlines int64 // Rotate at lines lines int64 // current lines } // NewRotateFile creates a new file writer which writes to the given file and // has rotation enabled if maxsize > 0. // // If size > maxsize, any time a new log file is opened, the old one is renamed // with a .0.log extension to preserve it. The various Set key-value pairs can be used // to configure log rotation based on lines, size. func NewRotateFile(filename string) *RotateFile { rf := &RotateFile{ file: rolling.NewWriter(filename, 0), Maxsize: DefaultRotateSize, } rf.lines = rf.file.Size() / EvaluateLineLength return rf } // Close active RotateFile. func (rf *RotateFile) Close() { if rf.file != nil { rf.file.Close() rf.file = nil } } func (rf *RotateFile) writeHeadFoot(format string) { buf := bytes.NewBuffer(make([]byte, 0, 64)) layout := patt.NewLayout(format) layout.Encode(buf, &driver.Recorder{Created: time.Now()}) rf.file.Write(buf.Bytes()) } // Write binaries to the file. // It will rotate files if necessary func (rf *RotateFile) Write(bb []byte) (n int, err error) { if len(rf.Header) > 0 && rf.file.Size() == 0 { rf.writeHeadFoot(rf.Header) } n, err = rf.file.Write(bb) if err == nil { rf.lines++ } return } func backupFiles(name string, temp string, backup int) { // May compress new log file here l4g.LogLogTrace("Backup %s", temp) ext := path.Ext(name) // like ".log" path := name[0 : len(name)-len(ext)] // include dir // May create backup directory here var ( n int err error slot string ) for n = 0; n < backup; n++ { slot = path + fmt.Sprintf(".%d", n) + ext _, err = os.Stat(slot) if err != nil { break } } if err == nil { // Full. Remove last os.Remove(slot) n-- } // May compress previous log file here for ; n > 0; n-- { prev := path + fmt.Sprintf(".%d", n-1) + ext l4g.LogLogTrace("Rename %s to %s", prev, slot) os.Rename(prev, slot) slot = prev } l4g.LogLogTrace("Rename %s to %s", temp, path+".0"+ext) os.Rename(temp, path+".0"+ext) } // Rotate current log file if necessary func (rf *RotateFile) Rotate(backup int) { // l4g.LogLogTrace("Size %d, Maxsize %d", rf.file.Size(), rf.Maxsize) if rf.Maxsize > 0 && rf.file.Size() >= rf.Maxsize { l4g.LogLogTrace("Size > %d", rf.Maxsize) } else if rf.Maxlines > 0 && rf.lines >= rf.Maxlines { l4g.LogLogTrace("lines %d > %d", rf.lines, rf.Maxlines) } else { return } // Write footer if len(rf.Footer) > 0 && rf.file.Size() > 0 { rf.writeHeadFoot(rf.Footer) } name := rf.file.Name l4g.LogLogTrace("Close %s", name) rf.file.Close() if backup <= 0 { os.Remove(name) return } // File existed. File size > maxsize. Rotate temp := name + time.Now().Format(".20060102-150405") l4g.LogLogTrace("Rename %s to %s", name, temp) err := os.Rename(name, temp) if err != nil { l4g.LogLogError(err) return } rf.lines = 0 backupFiles(name, temp, backup) }
#!/bin/sh if<caret>
<gh_stars>1-10 """ Global constants """ import os # Example list for immune system pathways IMMUNE_SYSTEM_PATHWAYS = { "04640": "Hematopoietic cell lineage", "04610": "Complement and coagulation cascades", "04611": "Platelet activation", "04620": "Toll-like receptor signaling pathway", "04621": "NOD-like receptor signaling pathway", "04622": "RIG-I-like receptor signaling pathway", "04623": "Cytosolic DNA-sensing pathway", "04625": "C-type lectin receptor signaling pathway", "04650": "Natural killer cell mediated cytotoxicity", "04612": "Antigen processing and presentation", "04660": "T cell receptor signaling pathway", "04658": "Th1 and Th2 cell differentiation", "04659": "Th17 cell differentiation", "04657": "IL-17 signaling pathway", "04662": "B cell receptor signaling pathway", "04664": "Fc epsilon RI signaling pathway", "04666": "Fc gamma R-mediated phagocytosis", "04670": "Leukocyte transendothelial migration", "04672": "Intestinal immune network for IgA production", "04062": "Chemokine signaling pathway" } # Constant element types in the KGML format RELATION_SUBTYPES = { "activation": "-->", "inhibition": "--|", "expression": "-->", "repression": "--|", "indirect effect": "..>" } RELATION_TYPES = { "ECrel": "enzyme-enzyme relation", "PPrel": "protein-protein interaction", "GErel": "gene expression interaction", "PCrel": "protein-compound interaction", "maplink": "link to another map" } GRAPHICS_TYPE = [ "rectangle", "circle", "roundrectangle", "line" ] ENTRY_TYPE = [ "ortholog", "enzyme", "reaction", "gene", "group", "compound", "map", "brite", "other" ] # KEGG cache folder name if os.environ.get("KEGG_DATA", None) is not None: # if KEGG_DATA is set, overwrite caching dir KEGG_DATA = os.environ["KEGG_DATA"] else: # fallback to default caching dir KEGG_DATA = os.path.join(os.path.dirname(__file__), ".cache")
#include <iostream> #include <unordered_map> using namespace std; int longestUniquePlaylist(int playlist[], int n) { unordered_map<int, int> songIndex; int maxLength = 0, start = 0; for (int end = 0; end < n; end++) { if (songIndex.find(playlist[end]) != songIndex.end()) { start = max(start, songIndex[playlist[end]] + 1); } songIndex[playlist[end]] = end; maxLength = max(maxLength, end - start + 1); } return maxLength; } int main() { int n = 6; int playlist[] = {1, 2, 3, 2, 5, 6}; cout << longestUniquePlaylist(playlist, n) << endl; // Output: 5 return 0; }
<reponame>wayveai/concourse<filename>atc/worker/volume.go package worker import ( "context" "io" "github.com/concourse/concourse/tracing" "code.cloudfoundry.org/lager" "github.com/concourse/concourse/atc/db" "github.com/concourse/concourse/worker/baggageclaim" ) //counterfeiter:generate . Volume type Volume interface { Handle() string Path() string SetProperty(key string, value string) error Properties() (baggageclaim.VolumeProperties, error) SetPrivileged(bool) error StreamIn(ctx context.Context, path string, encoding baggageclaim.Encoding, tarStream io.Reader) error StreamOut(ctx context.Context, path string, encoding baggageclaim.Encoding) (io.ReadCloser, error) GetStreamInP2pUrl(ctx context.Context, path string) (string, error) StreamP2pOut(ctx context.Context, path string, destUrl string, encoding baggageclaim.Encoding) error COWStrategy() baggageclaim.COWStrategy InitializeResourceCache(db.ResourceCache) error InitializeStreamedResourceCache(db.ResourceCache, string) error GetResourceCacheID() int InitializeTaskCache(logger lager.Logger, jobID int, stepName string, path string, privileged bool) error InitializeArtifact(name string, buildID int) (db.WorkerArtifact, error) CreateChildForContainer(db.CreatingContainer, string) (db.CreatingVolume, error) WorkerName() string Destroy() error } type VolumeMount struct { Volume Volume MountPath string } type volume struct { bcVolume baggageclaim.Volume dbVolume db.CreatedVolume volumeClient VolumeClient } type byMountPath []VolumeMount func (p byMountPath) Len() int { return len(p) } func (p byMountPath) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p byMountPath) Less(i, j int) bool { path1 := p[i].MountPath path2 := p[j].MountPath return path1 < path2 } func NewVolume( bcVolume baggageclaim.Volume, dbVolume db.CreatedVolume, volumeClient VolumeClient, ) Volume { return &volume{ bcVolume: bcVolume, dbVolume: dbVolume, volumeClient: volumeClient, } } func (v *volume) Handle() string { return v.bcVolume.Handle() } func (v *volume) Path() string { return v.bcVolume.Path() } func (v *volume) SetProperty(key string, value string) error { return v.bcVolume.SetProperty(key, value) } func (v *volume) SetPrivileged(privileged bool) error { return v.bcVolume.SetPrivileged(privileged) } func (v *volume) StreamIn(ctx context.Context, path string, encoding baggageclaim.Encoding, tarStream io.Reader) error { _, span := tracing.StartSpan(ctx, "volume.StreamIn", tracing.Attrs{ "destination-volume": v.Handle(), "destination-worker": v.WorkerName(), }) err := v.bcVolume.StreamIn(ctx, path, encoding, tarStream) tracing.End(span, err) return err } func (v *volume) StreamOut(ctx context.Context, path string, encoding baggageclaim.Encoding) (io.ReadCloser, error) { return v.bcVolume.StreamOut(ctx, path, encoding) } func (v *volume) GetStreamInP2pUrl(ctx context.Context, path string) (string, error) { return v.bcVolume.GetStreamInP2pUrl(ctx, path) } func (v *volume) StreamP2pOut(ctx context.Context, path string, destUrl string, encoding baggageclaim.Encoding) error { return v.bcVolume.StreamP2pOut(ctx, path, destUrl, encoding) } func (v *volume) Properties() (baggageclaim.VolumeProperties, error) { return v.bcVolume.Properties() } func (v *volume) WorkerName() string { return v.dbVolume.WorkerName() } func (v *volume) Destroy() error { return v.bcVolume.Destroy() } func (v *volume) COWStrategy() baggageclaim.COWStrategy { return baggageclaim.COWStrategy{ Parent: v.bcVolume, } } func (v *volume) InitializeResourceCache(urc db.ResourceCache) error { return v.dbVolume.InitializeResourceCache(urc) } func (v *volume) InitializeStreamedResourceCache(urc db.ResourceCache, sourceWorkerName string) error { return v.dbVolume.InitializeStreamedResourceCache(urc, sourceWorkerName) } func (v *volume) GetResourceCacheID() int { return v.dbVolume.GetResourceCacheID() } func (v *volume) InitializeArtifact(name string, buildID int) (db.WorkerArtifact, error) { return v.dbVolume.InitializeArtifact(name, buildID) } func (v *volume) InitializeTaskCache( logger lager.Logger, jobID int, stepName string, path string, privileged bool, ) error { if v.dbVolume.ParentHandle() == "" { return v.dbVolume.InitializeTaskCache(jobID, stepName, path) } logger.Debug("creating-an-import-volume", lager.Data{"path": v.bcVolume.Path()}) // always create, if there are any existing task cache volumes they will be gced // after initialization of the current one importVolume, err := v.volumeClient.CreateVolumeForTaskCache( logger, VolumeSpec{ Strategy: baggageclaim.ImportStrategy{Path: v.bcVolume.Path()}, Privileged: privileged, }, v.dbVolume.TeamID(), jobID, stepName, path, ) if err != nil { return err } return importVolume.InitializeTaskCache(logger, jobID, stepName, path, privileged) } func (v *volume) CreateChildForContainer(creatingContainer db.CreatingContainer, mountPath string) (db.CreatingVolume, error) { return v.dbVolume.CreateChildForContainer(creatingContainer, mountPath) }
#!/bin/bash # # Description: # Configure iptables firewall # # What to expect from this configuration: # - Default deny policy # - Only accepts outbound Tor traffic from the 'debian-tor' user # - UDP port 53 (DNS) for the root user is redirected to a Tor DNSPort, this is to allow outbound Apt and Git traffic # - UDP port 67 (DHCP) for the root user allowed for outbound DHCP traffic # - TCP port 80 (HTTP) for the root user is redirected to a Tor Transport, this is to allow outbound Apt traffic # # TODO: # - Nothing yet # # Bash options set -o errexit # exit script when a command fails set -o nounset # exit script when a variable is not set # Variables readonly IPTABLES=/sbin/iptables readonly ECHO=/bin/echo readonly TOR_UID=$(id -u debian-tor) readonly TOR_DNS_PORT=9053 readonly TOR_TRANSPORT1=9550 readonly TOR_TRANSPORT2=9650 # Not in use readonly TOR_TRANSPORT3=9750 # Not in use readonly LAN_INT=eth0 # Flush iptables chains "${ECHO}" "Flush iptables chains" "${IPTABLES}" -F "${IPTABLES}" -t nat -F "${ECHO}" "iptables flushed" # iptables default policies "${ECHO}" "Loading iptables DROP policies" "${IPTABLES}" -P INPUT DROP "${IPTABLES}" -P OUTPUT DROP "${IPTABLES}" -P FORWARD DROP "${ECHO}" "iptables DROP policies loaded" # INPUT chain "${ECHO}" "Loading INPUT chain" # Drop invalid packets "${IPTABLES}" -A INPUT -m state --state INVALID -j DROP # Drop invalid syn packets "${IPTABLES}" -A INPUT -p tcp --tcp-flags ALL ACK,RST,SYN,FIN -j DROP "${IPTABLES}" -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP "${IPTABLES}" -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP # Drop incoming fragments "${IPTABLES}" -A INPUT -f -j DROP # Drop incoming xmas packets "${IPTABLES}" -A INPUT -p tcp --tcp-flags ALL ALL -j DROP # Drop incoming null packets "${IPTABLES}" -A INPUT -p tcp --tcp-flags ALL NONE -j DROP # Normal INPUT rules "${IPTABLES}" -A INPUT -i lo -j ACCEPT "${IPTABLES}" -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT ### Logging is disabled to extend lifetime SD cards ### #"${IPTABLES}" -A INPUT -j LOG "${IPTABLES}" -A INPUT -j DROP "${ECHO}" "INPUT chain loaded" # OUTPUT chain "${ECHO}" "Loading OUTPUT chain" # Drop invalid packets "${IPTABLES}" -A OUTPUT -m state --state INVALID -j DROP # Prevent Tor transport data leaks "${IPTABLES}" -A OUTPUT ! -o lo ! -d 127.0.0.1 ! -s 127.0.0.1 -p tcp -m tcp --tcp-flags ACK,FIN ACK,FIN -j DROP "${IPTABLES}" -A OUTPUT ! -o lo ! -d 127.0.0.1 ! -s 127.0.0.1 -p tcp -m tcp --tcp-flags ACK,RST ACK,RST -j DROP # Normal OUTPUT rules "${IPTABLES}" -A OUTPUT -o lo -j ACCEPT "${IPTABLES}" -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT "${IPTABLES}" -A OUTPUT -o "${LAN_INT}" -d 127.0.0.1 -p udp --dport "${TOR_DNS_PORT}" -m state --state NEW -m owner --uid-owner 0 -j ACCEPT "${IPTABLES}" -A OUTPUT -o "${LAN_INT}" -d 127.0.0.1 -p tcp --dport "${TOR_TRANSPORT1}" --syn -m state --state NEW -m owner --uid-owner 0 -j ACCEPT "${IPTABLES}" -A OUTPUT -o "${LAN_INT}" -p tcp --syn -m state --state NEW -m owner --uid-owner "${TOR_UID}" -j ACCEPT "${IPTABLES}" -A OUTPUT -o "${LAN_INT}" -p udp --dport 67 -m state --state NEW -m owner --uid-owner 0 -j ACCEPT ### Logging is disabled to extend lifetime SD cards ### #"${IPTABLES}" -A OUTPUT -j LOG --log-uid "${IPTABLES}" -A OUTPUT -j DROP "${ECHO}" "OUTPUT chain loaded" # PREROUTING chain "${ECHO}" "Loading PREROUTING chain" # Redirect DNS traffic from root to TOR_DNS_PORT "${IPTABLES}" -t nat -A OUTPUT -o "${LAN_INT}" -p udp --dport 53 -m state --state NEW -m owner --uid-owner 0 -j REDIRECT --to-ports "${TOR_DNS_PORT}" # Redirect HTTP traffic from root to TOR_TRANSPORT "${IPTABLES}" -t nat -A OUTPUT -o "${LAN_INT}" -p tcp --dport 80 --syn -m state --state NEW -m owner --uid-owner 0 -j REDIRECT --to-ports "${TOR_TRANSPORT1}" "${ECHO}" "PREROUTING chain loaded" "${ECHO}" "iptables script loaded"
/** * Created by liguangyao on 2017/3/6 */ ;(function (factory) { if (typeof exports == "object" && typeof module == "object") // CommonJS factory(require("jquery")); else if (typeof define == "function" && define.amd) // AMD define(["jquery"], factory); else // 全局模式 factory(jQuery); })(function ($) { var strToJson = function (str) { var json = (new Function("return " + str))(); return json; } var methods = { init: function () { var self = methods; var $this = this; var defaults = { themes: 'simple',//黑色 direction: 'bottom', text: false, isResize:false }; $(window).resize(function(){ $this.each(function (){ $(this).data("tipsSettings").isResize = true; }) }) return $this.each(function () { var $this = $(this); var customOpts = $this.attr('tips-opts'); var opts = customOpts ? strToJson(customOpts) : {}, tipsSettings = $.extend({}, defaults, opts); $this.data("tipsSettings", tipsSettings); //如果没有设id,则设一个组件名 $this.attr('id') || $this.attr('id', function () { return 'olyTips' + ('00000' + (Math.random() * 16777216 << 0).toString(16)).substr(-6).toUpperCase(); }); self.bindHandlers($this, tipsSettings); }); }, bindHandlers: function (item, tipsSettings) { var self = this; var $this = item; var thisId = $this.attr('id'); // 由于箭头方向和tips所在方向刚好相反,所以转化下 var direction = { bottom: 'top', top: 'bottom', left: 'right', right: 'left' }[tipsSettings.direction]; var tipsId = 'tips-' + thisId; $this.bind('mouseenter.olyTips', function () { var $tips = $('#' + tipsId); var hasTips = $tips.length; var isResize = $(this).data('tipsSettings').isResize if (hasTips && !isResize) { $tips.show(); }else if(hasTips && isResize){ self.setOffset($(this),tipsSettings) $(this).data("tipsSettings").isResize = false; $tips.show(); } else { var text = tipsSettings.text || $(this).attr('title'); $tips = $('<div class="tips" id="' + tipsId + '">' + '<div class="tips-arrow tips-arrow-' + direction + '"></div>' + '<div class="tips-text">' + text + '</div>' + '</div>'); $('body').append($tips); self.setOffset($(this),tipsSettings) } $this.attr('title', '') }) .bind('mouseleave.olyTips', function () { $('#' + tipsId).hide(); }) }, setOffset:function(item,tipsSettings){ var tipsId = 'tips-' + item.attr('id'); var $tips = $('#' + tipsId); var width = item.outerWidth(); var height = item.outerHeight(); var offset = item.offset(); var tipsWidth = $tips.outerWidth(); var tipsHeight = $tips.outerHeight(); var arrowSize = 5; var tipsLeft, tipsTop; switch (tipsSettings.direction) { case 'bottom': tipsLeft = offset.left - (tipsWidth - width) / 2; tipsTop = offset.top + height + arrowSize; break; case 'top': tipsLeft = offset.left - (tipsWidth - width) / 2; tipsTop = offset.top - tipsHeight - arrowSize; break; case 'right': tipsLeft = offset.left + width; tipsTop = offset.top + ( height - tipsHeight ) / 2 + arrowSize; break; case 'left': tipsLeft = offset.left - tipsWidth - arrowSize; tipsTop = offset.top + ( height - tipsHeight ) / 2; break } $tips.css({left: tipsLeft, top: tipsTop}); } }; $.fn.olyTips = function () { var method = arguments[0]; if (methods[method]) { method = methods[method]; arguments = Array.prototype.slice.call(arguments, 1); } else if (typeof(method) == 'object' || !method) { method = methods.init; } else { $.error('Method ' + method + ' does not exist on jQuery.pluginName'); return this; } return method.apply(this, arguments); }; $(function () { $("[oly-widget *= 'tips']").olyTips(); }); });
<filename>2-resources/_External-learning-resources/00-Javascript/Node.js_Design_Patterns/Chapter11/05_fanout_fanin/worker.js "use strict"; const zmq = require('zmq'); const crypto = require('crypto'); const fromVentilator = zmq.socket('pull'); const toSink = zmq.socket('push'); fromVentilator.connect('tcp://localhost:5016'); toSink.connect('tcp://localhost:5017'); fromVentilator.on('message', buffer => { const msg = JSON.parse(buffer); const variations = msg.variations; variations.forEach( word => { console.log(`Processing: ${word}`); const shasum = crypto.createHash('sha1'); shasum.update(word); const digest = shasum.digest('hex'); if (digest === msg.searchHash) { console.log(`Found! => ${word}`); toSink.send(`Found! ${digest} => ${word}`); } }); });
#!/usr/bin/env bash cdrkit_version=1.1.11 cdrkit_download_path=http://distro.ibiblio.org/fatdog/source/600/c cdrkit_file_name=cdrkit-${cdrkit_version}.tar.bz2 cdrkit_sha256_hash=b50d64c214a65b1a79afe3a964c691931a4233e2ba605d793eb85d0ac3652564 cdrkit_patches=cdrkit-deterministic.patch genisoimage=genisoimage-$cdrkit_version libdmg_url=https://github.com/theuni/libdmg-hfsplus export LD_PRELOAD=$(locate libfaketime.so.1) export FAKETIME="2000-01-22 00:00:00" export PATH=$PATH:~/bin . $(dirname "$0")/base.sh if [ -z "$1" ]; then echo "Usage: $0 Electrum.app" exit -127 fi mkdir -p ~/bin if ! which ${genisoimage} > /dev/null 2>&1; then mkdir -p /tmp/electrum-macos cd /tmp/electrum-macos info "Downloading cdrkit $cdrkit_version" wget -nc ${cdrkit_download_path}/${cdrkit_file_name} tar xvf ${cdrkit_file_name} info "Patching genisoimage" cd cdrkit-${cdrkit_version} patch -p1 < ../cdrkit-deterministic.patch info "Building genisoimage" cmake . -Wno-dev make genisoimage cp genisoimage/genisoimage ~/bin/${genisoimage} fi if ! which dmg > /dev/null 2>&1; then mkdir -p /tmp/electrum-macos cd /tmp/electrum-macos info "Downloading libdmg" LD_PRELOAD= git clone ${libdmg_url} cd libdmg-hfsplus info "Building libdmg" cmake . make cp dmg/dmg ~/bin fi ${genisoimage} -version || fail "Unable to install genisoimage" dmg -|| fail "Unable to install libdmg" plist=$1/Contents/Info.plist test -f "$plist" || fail "Info.plist not found" VERSION=$(grep -1 ShortVersionString $plist |tail -1|gawk 'match($0, /<string>(.*)<\/string>/, a) {print a[1]}') echo $VERSION rm -rf /tmp/electrum-macos/image > /dev/null 2>&1 mkdir /tmp/electrum-macos/image/ cp -r $1 /tmp/electrum-macos/image/ build_dir=$(dirname "$1") test -n "$build_dir" -a -d "$build_dir" || exit cd $build_dir ${genisoimage} \ -no-cache-inodes \ -D \ -l \ -probe \ -V "ELCASH Wallet" \ -no-pad \ -r \ -dir-mode 0755 \ -apple \ -o Electrum_uncompressed.dmg \ /tmp/electrum-macos/image || fail "Unable to create uncompressed dmg" dmg dmg Electrum_uncompressed.dmg electrum-$VERSION.dmg || fail "Unable to create compressed dmg" rm Electrum_uncompressed.dmg echo "Done." sha256sum electrum-$VERSION.dmg
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var core = require('@ucast/core'); var js = require('@ucast/js'); var extra = require('@casl/ability/extra'); var ability = require('@casl/ability'); class ParsingQueryError extends Error { static invalidArgument(operatorName, value, expectValueType) { const valueType = `${typeof value}(${JSON.stringify(value, null, 2)})`; return new this(`"${operatorName}" expects to receive ${expectValueType} but instead got "${valueType}"`); } } const isPlainObject = value => { return value && (value.constructor === Object || !value.constructor); }; const equals = { type: 'field', validate(instruction, value) { if (Array.isArray(value) || isPlainObject(value)) { throw new ParsingQueryError(`"${instruction.name}" does not supports comparison of arrays and objects`); } } }; const not$1 = { type: 'field', parse(instruction, value, { hasOperators, field, parse }) { if (isPlainObject(value) && !hasOperators(value) || Array.isArray(value)) { throw new ParsingQueryError(`"${instruction.name}" does not supports comparison of arrays and objects`); } if (!isPlainObject(value)) { return new core.FieldCondition('notEquals', field, value); } return new core.CompoundCondition('NOT', [parse(value, { field })]); } }; const within = { type: 'field', validate(instruction, value) { if (!Array.isArray(value)) { throw ParsingQueryError.invalidArgument(instruction.name, value, 'an array'); } } }; const lt = { type: 'field', validate(instruction, value) { const type = typeof value; const isComparable = type === 'string' || type === 'number' && Number.isFinite(value) || value instanceof Date; if (!isComparable) { throw ParsingQueryError.invalidArgument(instruction.name, value, 'comparable value'); } } }; const POSSIBLE_MODES = new Set(['insensitive', 'default']); const mode = { type: 'field', validate(instruction, value) { if (!POSSIBLE_MODES.has(value)) { throw ParsingQueryError.invalidArgument(instruction.name, value, `one of ${Array.from(POSSIBLE_MODES).join(', ')}`); } }, parse: () => core.NULL_CONDITION }; const compareString = { type: 'field', validate(instruction, value) { if (typeof value !== 'string') { throw ParsingQueryError.invalidArgument(instruction.name, value, 'string'); } }, parse(instruction, value, { query, field }) { const name = query.mode === 'insensitive' ? `i${instruction.name}` : instruction.name; return new core.FieldCondition(name, field, value); } }; const compound = { type: 'compound', validate(instruction, value) { if (!value || typeof value !== 'object') { throw ParsingQueryError.invalidArgument(instruction.name, value, 'an array or object'); } }, parse(instruction, arrayOrObject, { parse }) { const value = Array.isArray(arrayOrObject) ? arrayOrObject : [arrayOrObject]; const conditions = value.map(v => parse(v)); return new core.CompoundCondition(instruction.name, conditions); } }; const isEmpty$1 = { type: 'field', validate(instruction, value) { if (typeof value !== 'boolean') { throw ParsingQueryError.invalidArgument(instruction.name, value, 'a boolean'); } } }; const has$1 = { type: 'field' }; const hasSome$1 = { type: 'field', validate(instruction, value) { if (!Array.isArray(value)) { throw ParsingQueryError.invalidArgument(instruction.name, value, 'an array'); } } }; const relation = { type: 'field', parse(instruction, value, { field, parse }) { if (!isPlainObject(value)) { throw ParsingQueryError.invalidArgument(instruction.name, value, 'a query for nested relation'); } return new core.FieldCondition(instruction.name, field, parse(value)); } }; const inverted = (name, baseInstruction) => { const parse = baseInstruction.parse; if (!parse) { return Object.assign({}, baseInstruction, { parse(_, value, ctx) { return new core.CompoundCondition('NOT', [new core.FieldCondition(name, ctx.field, value)]); } }); } return Object.assign({}, baseInstruction, { parse(instruction, value, ctx) { const condition = parse(instruction, value, ctx); if (condition.operator !== instruction.name) { throw new Error(`Cannot invert "${name}" operator parser because it returns a complex Condition`); } condition.operator = name; return new core.CompoundCondition('NOT', [condition]); } }); }; const instructions = { equals, not: not$1, in: within, notIn: inverted('in', within), lt, lte: lt, gt: lt, gte: lt, mode, startsWith: compareString, endsWith: compareString, contains: compareString, isEmpty: isEmpty$1, has: has$1, hasSome: hasSome$1, hasEvery: hasSome$1, NOT: compound, AND: compound, OR: compound, every: relation, some: relation, none: inverted('some', relation), is: relation, isNot: inverted('is', relation) }; class PrismaQueryParser extends core.ObjectQueryParser { constructor() { super(instructions, { defaultOperatorName: 'equals' }); } parse(query, options) { if (options && options.field) { return core.buildAnd(this.parseFieldOperators(options.field, query)); } return super.parse(query); } } const startsWith = (condition, object, { get }) => { return get(object, condition.field).startsWith(condition.value); }; const istartsWith = (condition, object, { get }) => { return get(object, condition.field).toLowerCase().startsWith(condition.value.toLowerCase()); }; const endsWith = (condition, object, { get }) => { return get(object, condition.field).endsWith(condition.value); }; const iendsWith = (condition, object, { get }) => { return get(object, condition.field).toLowerCase().endsWith(condition.value.toLowerCase()); }; const contains = (condition, object, { get }) => { return get(object, condition.field).includes(condition.value); }; const icontains = (condition, object, { get }) => { return get(object, condition.field).toLowerCase().includes(condition.value.toLowerCase()); }; const isEmpty = (condition, object, { get }) => { const value = get(object, condition.field); const empty = Array.isArray(value) && value.length === 0; return empty === condition.value; }; const has = (condition, object, { get }) => { const value = get(object, condition.field); return Array.isArray(value) && value.includes(condition.value); }; const hasSome = (condition, object, { get }) => { const value = get(object, condition.field); return Array.isArray(value) && condition.value.some(v => value.includes(v)); }; const hasEvery = (condition, object, { get }) => { const value = get(object, condition.field); return Array.isArray(value) && condition.value.every(v => value.includes(v)); }; const every = (condition, object, { get, interpret }) => { const items = get(object, condition.field); return Array.isArray(items) && items.length > 0 && items.every(item => interpret(condition.value, item)); }; const some = (condition, object, { get, interpret }) => { const items = get(object, condition.field); return Array.isArray(items) && items.some(item => interpret(condition.value, item)); }; const is = (condition, object, { get, interpret }) => { const item = get(object, condition.field); return item && typeof item === 'object' && interpret(condition.value, item); }; const not = (condition, object, { interpret }) => { return condition.value.every(subCondition => !interpret(subCondition, object)); }; function toComparable(value) { return value && typeof value === 'object' ? value.valueOf() : value; } const compareValues = (a, b) => js.compare(toComparable(a), toComparable(b)); const interpretPrismaQuery = js.createJsInterpreter({ // TODO: support arrays and objects comparison equals: js.eq, notEquals: js.ne, in: js.within, lt: js.lt, lte: js.lte, gt: js.gt, gte: js.gte, startsWith, istartsWith, endsWith, iendsWith, contains, icontains, isEmpty, has, hasSome, hasEvery, and: js.and, or: js.or, AND: js.and, OR: js.or, NOT: not, every, some, is }, { get: (object, field) => object[field], compare: compareValues }); const parser = new PrismaQueryParser(); const prismaQuery = core.createTranslatorFactory(parser.parse, interpretPrismaQuery); function convertToPrismaQuery(rule) { return rule.inverted ? { NOT: rule.conditions } : rule.conditions; } const proxyHandlers = { get(target, subjectType) { const query = extra.rulesToQuery(target._ability, target._action, subjectType, convertToPrismaQuery); if (query === null) { const error = ability.ForbiddenError.from(target._ability).setMessage(`It's not allowed to run "${target._action}" on "${subjectType}"`); error.action = target._action; error.subjectType = error.subject = subjectType; throw error; } const prismaQuery = Object.create(null); if (query.$or) { prismaQuery.OR = query.$or; } if (query.$and) { prismaQuery.AND = query.$and; } return prismaQuery; } }; function createQuery(ability, action) { return new Proxy({ _ability: ability, _action: action }, proxyHandlers); } function accessibleBy(ability, action = 'read') { return createQuery(ability, action); } class PrismaAbility extends ability.PureAbility { constructor(rules, options) { super(rules, Object.assign({ conditionsMatcher: prismaQuery, fieldMatcher: ability.fieldPatternMatcher }, options)); } } exports.ParsingQueryError = ParsingQueryError; exports.PrismaAbility = PrismaAbility; exports.accessibleBy = accessibleBy; exports.prismaQuery = prismaQuery; //# sourceMappingURL=index.js.map
#!/bin/bash # # Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # # # This script does everything required to run the fabric CA sample. # # By default, this test is run with the latest released docker images. # # To run against a specific fabric/fabric-ca version: # export FABRIC_TAG=1.4.0-rc1 # # To run with locally built images: # export FABRIC_TAG=local set -e SDIR=$(dirname "$0") source ${SDIR}/scripts/env.sh cd ${SDIR} # Delete docker containers dockerContainers=$(docker ps -a | awk '$2~/hyperledger/ {print $1}') if [ "$dockerContainers" != "" ]; then log "Deleting existing docker containers ..." docker rm -f $dockerContainers > /dev/null fi # Remove chaincode docker images chaincodeImages=`docker images | grep "^dev-peer" | awk '{print $3}'` if [ "$chaincodeImages" != "" ]; then log "Removing chaincode docker images ..." docker rmi -f $chaincodeImages > /dev/null fi # Start with a clean data directory DDIR=${SDIR}/${DATA} if [ -d ${DDIR} ]; then log "Cleaning up the data directory from previous run at $DDIR" rm -rf ${SDIR}/data fi mkdir -p ${DDIR}/logs # Create the docker-compose file ${SDIR}/makeDocker.sh # Create the docker containers log "Creating docker containers ..." docker-compose up -d # Wait for the setup container to complete dowait "the 'setup' container to finish registering identities, creating the genesis block and other artifacts" 90 $SDIR/$SETUP_LOGFILE $SDIR/$SETUP_SUCCESS_FILE # Wait for the run container to start and then tails it's summary log dowait "the docker 'run' container to start" 60 ${SDIR}/${SETUP_LOGFILE} ${SDIR}/${RUN_SUMFILE} tail -f ${SDIR}/${RUN_SUMFILE}& TAIL_PID=$! # Wait for the run container to complete while true; do if [ -f ${SDIR}/${RUN_SUCCESS_FILE} ]; then kill -9 $TAIL_PID exit 0 elif [ -f ${SDIR}/${RUN_FAIL_FILE} ]; then kill -9 $TAIL_PID exit 1 else sleep 1 fi done
package cache import ( "github.com/pip-services/pip-services-runtime-go" ) type AbstractCache struct { runtime.AbstractComponent } func NewAbstractCache(id string, config *runtime.DynamicMap) *AbstractCache { return &AbstractCache { AbstractComponent: *runtime.NewAbstractComponent(id, config) } }
$(document).ready(function() { $(document.body).dblclick(function() { fullScreen(); }); }); /* -- sidebar -- */ function toggleSidebar(direction, id){ if($("body").hasClass("acvs")) return; if(direction == null){ $(document.body).removeClass('toggle-left toggle-right'); }else{ if(direction == 'right'){ $(document.body).removeClass('toggle-left'); } $(document.body).toggleClass('toggle-'+direction); } } /* -- scrollX -- */ function scrollX(){ $('.scroll-x').each(function(){ var distance = $(this).width()+$(this).parent().width() + 10; if($(this).width()>$(this).parent().width()){ $(this).addClass('animation-scroll-x'); $(this).css({ '-webkit-animation-duration' : (distance/150)+'s', 'animation-duration' : (distance/150)+'s', 'padding-left' : '100%' }); }else{ $(this).css({ 'padding-left' : '100%' }); } }); } scrollX(); /* -- scrollY -- */ function scrollY(limit){ var elem = $('.scroll-y'); var elemHeight = elem.height(); var parentHeight = elem.parent().height(); var elemHeightRelative = elemHeight/parentHeight*100; if (elemHeightRelative>limit && limit < 100){ var distance = (elemHeight-(parentHeight/1.1))/$(window).height()*100; var time = distance/6+10; var delay = 5/time*100; $("<style type='text/css'> @keyframes scrollY{ 0%, "+delay+"%{ transform:translateY(0%); } "+(100-delay)+"%, 100%{ transform:translateY(-"+distance+"vh); } } </style>").appendTo("head"); $(elem).css({ 'animation' : 'scrollY '+time+'s linear infinite 0s' }); }else{ $(elem).css({ 'animation' : 'none' }); } } /* -- fullScreen -- */ function fullScreen(){ if( (document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitIsFullScreen)){ if(document.documentElement.requestFullScreen){ document.documentElement.requestFullScreen(); }else if(document.documentElement.mozRequestFullScreen){ document.documentElement.mozRequestFullScreen(); }else if(document.documentElement.webkitRequestFullScreen){ document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); } }else{ if(document.cancelFullScreen){ document.cancelFullScreen(); }else if(document.mozCancelFullScreen) { document.mozCancelFullScreen(); }else if(document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } } } /* -- clock -- */ function clock(){ date = new Date; date.setHours(date.getHours()+(date.getTimezoneOffset()/-60)); h = date.getUTCHours(); if(h<10){ h = '0'+h; } $('#clock-hours').html(h); m = date.getUTCMinutes(); if(m<10){ m = '0'+m; } $('#clock-minutes').html(m); s = date.getUTCSeconds(); if(s<10){ s = '0'+s; } $('#clock-seconds').html(s); setTimeout('clock("clock");','1000'); return true; } clock();
package rds import ( "encoding/json" ) // Config struct used to provide AWS Configuration Credentials type Config struct { ResourceArn string `json:"resource_arn"` SecretArn string `json:"secret_arn"` Database string `json:"database"` AWSRegion string `json:"aws_region"` ParseTime bool `json:"parse_time"` } // ToDSN converts the config to a DSN string func (o *Config) ToDSN() (string, error) { str, err := json.Marshal(o) return string(str), err } // NewConfigFromDSN assumes that the DSN is a JSON-encoded string func NewConfigFromDSN(dsn string) (conf *Config, err error) { conf = &Config{} err = json.Unmarshal([]byte(dsn), conf) return } // NewConfig with specific func NewConfig(resourceARN string, secretARN string, database string, awsRegion string) (conf *Config) { return &Config{ ResourceArn: resourceARN, SecretArn: secretARN, Database: database, AWSRegion: awsRegion, } }
const Vue = require('vue') Vue.config.devtools = false // Vue.prototype.$http = require('../../resources/js/http') require('jsdom-global')()
// https://cses.fi/problemset/task/1203/ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef tuple<ll,ll> ii; typedef tuple<ll,ll,ll> iii; typedef vector<bool> vb; typedef vector<ll> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<vi> vvi; typedef vector<vii> vvii; typedef priority_queue<iii,viii,greater<iii>> pq; typedef unordered_set<ll> si; int main() { ios::sync_with_stdio(0); cin.tie(0); ll n,m,u,v,w,x,y; cin>>n>>m; vvii g(n); for (int i=0;i<m;i++) { cin>>u>>v>>w; u--;v--; g[u].push_back({v,w}); } vi c(n),d(n); vvi p(n); pq q; q.push({0,0,-1}); while (!q.empty()) { tie(w,u,v)=q.top(); q.pop(); if(c[u]&&d[u]<w) continue; c[u]++; d[u]=w; if (v!=-1) p[u].push_back(v); if (c[u]>1) continue; for (auto z:g[u]) { tie(x,y)=z; q.push({w+y,x,u}); } } vb s(n); vvi h(n); vi o; o.push_back(n-1); while (!o.empty()) { u = o.back(); o.pop_back(); if (s[u]) continue; s[u]=true; for (int v:p[u]) { h[v].push_back(u); o.push_back(v); } } vb r(n); vi t; function<void(int)> dfs = [&](int u) { r[u]=true; for (int v:h[u]) if (!r[v]) dfs(v); t.push_back(u); }; dfs(0); reverse(t.begin(), t.end()); vi ti(n, -1); for (int i=0;i<t.size();i++) ti[t[i]]=i; vi e; ll z=0; for (int i=0;i<t.size();i++) { if(i==z) e.push_back(t[i]); for (int u:h[t[i]]) z=max(z,ti[u]); } sort(e.begin(),e.end()); cout<<e.size()<<endl; for (int i=0;i<e.size();i++) cout<<e[i]+1<<" \n"[i==e.size()-1]; }
<filename>src/cf/commands/organization/list_quotas.go package organization import ( "cf/api" "cf/configuration" "cf/formatters" "cf/requirements" "cf/terminal" "github.com/codegangsta/cli" ) type ListQuotas struct { ui terminal.UI config configuration.Reader quotaRepo api.QuotaRepository } func NewListQuotas(ui terminal.UI, config configuration.Reader, quotaRepo api.QuotaRepository) (cmd *ListQuotas) { cmd = new(ListQuotas) cmd.ui = ui cmd.config = config cmd.quotaRepo = quotaRepo return } func (cmd *ListQuotas) GetRequirements(reqFactory requirements.Factory, c *cli.Context) (reqs []requirements.Requirement, err error) { reqs = []requirements.Requirement{ reqFactory.NewLoginRequirement(), } return } func (cmd *ListQuotas) Run(c *cli.Context) { cmd.ui.Say("Getting quotas as %s...", terminal.EntityNameColor(cmd.config.Username())) quotas, apiResponse := cmd.quotaRepo.FindAll() if apiResponse.IsNotSuccessful() { cmd.ui.Failed(apiResponse.Message) return } cmd.ui.Ok() cmd.ui.Say("") table := [][]string{ []string{"name", "memory limit"}, } for _, quota := range quotas { table = append(table, []string{ quota.Name, formatters.ByteSize(quota.MemoryLimit * formatters.MEGABYTE), }) } cmd.ui.DisplayTable(table) }
def generate_postgresql_schema(columns): table_name = "table_name" # Replace with actual table name schema_script = f"CREATE TABLE {table_name} (\n" for column in columns: column_name = column["name"] column_type = column["type"] constraints = " ".join(column["constraints"]) schema_script += f" {column_name} {column_type} {constraints},\n" schema_script = schema_script.rstrip(",\n") # Remove trailing comma and newline schema_script += "\n);" return schema_script
<gh_stars>10-100 package github import ( "fmt" "os" "testing" ) func TestInitialize(t *testing.T) { l, err := Initialize(os.Getenv("GITHUB_TOKEN")) fmt.Println(err) l.LoveOrganization("kubernetes") }
package me.bxbc.interceptor; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * Author: <NAME> * Date 2021/2/20 */ @Configuration public class WebConfig implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginInterceptor()) .addPathPatterns("/admin/**") .excludePathPatterns("/admin") .excludePathPatterns("/admin/login") .excludePathPatterns("/admin/logout"); } }
<filename>node_modules/react-icons-kit/icomoon/history.js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.history = void 0; var history = { "viewBox": "0 0 17 16", "children": [{ "name": "path", "attribs": { "fill": "#000000", "d": "M10 1c3.866 0 7 3.134 7 7s-3.134 7-7 7v-1.5c1.469 0 2.85-0.572 3.889-1.611s1.611-2.42 1.611-3.889c0-1.469-0.572-2.85-1.611-3.889s-2.42-1.611-3.889-1.611c-1.469 0-2.85 0.572-3.889 1.611-0.799 0.799-1.322 1.801-1.52 2.889h2.909l-3.5 4-3.5-4h2.571c0.485-3.392 3.402-6 6.929-6zM13 7v2h-4v-5h2v3z" } }] }; exports.history = history;
public class ContactsActivity extends AppCompatActivity { ContactAdapter adapter; List<Contact> contactsList; RecyclerView recyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contacts); // Set up RecyclerView recyclerView = findViewById(R.id.rv_contacts); contactsList = new ArrayList<>(); adapter = new ContactAdapter(this, contactsList); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); // Get contacts from database getContactsFromDatabase(); FloatingActionButton fabAdd = findViewById(R.id.fab_add); fabAdd.setOnClickListener(addContactListener); } // Get contacts from database private void getContactsFromDatabase() { // TODO: query database and add contacts to contactsList } // Add contact listener View.OnClickListener addContactListener = new View.OnClickListener() { @Override public void onClick(View v) { showAddDialog(); } }; // Show add contact dialog private void showAddDialog() { // TODO: create add contact dialog and add contact to database } // Contact adapter public class ContactAdapter extends RecyclerView.Adapter<ContactAdapter.ViewHolder> { // ViewHolder public class ViewHolder extends RecyclerView.ViewHolder { TextView tvName; TextView tvPhone; public ViewHolder(View itemView) { super(itemView); tvName = itemView.findViewById(R.id.tv_name); tvPhone = itemView.findViewById(R.id.tv_phone); // Set up click listener itemView.setOnClickListener(onItemClickListener); itemView.setOnLongClickListener(onItemLongClickListener); } } List<Contact> contacts; public ContactAdapter(Context context, List<Contact> contacts) { this.contacts = contacts; } @Override public int getItemCount() { return contacts.size(); } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_contact, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder holder, int position) { Contact contact = contacts.get(position); holder.tvName.setText(contact.name); holder.tvPhone.setText(contact.phone); } // Item click listener View.OnClickListener onItemClickListener = new View.OnClickListener() { @Override public void onClick(View v) { showEditDialog(); } }; // Item long click listener View.OnLongClickListener onItemLongClickListener = new View.OnLongClickListener(){ @Override public boolean onLongClick(View v) { showDeleteDialog(); return true; } }; // Show edit contact dialog private void showEditDialog() { // TODO: create edit contact dialog and update contact in the database } // Show delete contact dialog private void showDeleteDialog() { // TODO: create delete contact dialog and remove contact from the database } } }
#!/bin/bash -x # Create Image sudo docker build -t $1 .. LOGIN=$(aws ecr get-login --no-include-email --region eu-west-1) echo $LOGIN LOGIN_RES=$(sudo $LOGIN) echo $LOGIN_RES # TAG sudo docker tag $1 944222683591.dkr.ecr.eu-west-1.amazonaws.com/d2d-backend-stage # PUSH sudo docker push 944222683591.dkr.ecr.eu-west-1.amazonaws.com/d2d-backend-stage
let array = [1, 2, 3, 4, 5]; let iterator = array[Symbol.iterator](); while(true) { let next = iterator.next(); if (next.done) { break; } console.log(next.value); }
package cyclops.stream.operator; import static org.junit.Assert.assertTrue; import cyclops.stream.type.PausableConnectable; import cyclops.reactive.ReactiveSeq; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; public class ConnectionTesst { static final Executor exec2 = Executors.newFixedThreadPool(5); static final Executor exec3 = Executors.newFixedThreadPool(5); volatile boolean active; volatile AtomicInteger value = new AtomicInteger(-1); @Test public void hotStreamConnectPausableConnect() throws InterruptedException { value.set(-1); active = true; CountDownLatch latch = new CountDownLatch(1); PausableConnectable<Integer> s = ReactiveSeq.range(0, Integer.MAX_VALUE) .takeWhile(i -> active) .peek(v -> value.set(v)) .peek(v -> latch.countDown()) .pausableHotStream(exec2); Integer oldValue = value.get(); s.connect() .limit(10000) .runFuture(exec3, t -> t.forEach(System.out::println, System.err::println)); s.pause(); s.unpause(); while (value.get() < 10_000) { Thread.sleep(1000); } s.pause(); assertTrue("value= " + value + " old value " + oldValue, value.get() != oldValue); s.unpause(); latch.await(); assertTrue(value != null); active = false; } }
<reponame>itchio/itchio.go<filename>hook_game_test.go package itchio import ( "encoding/json" "testing" "time" "github.com/mitchellh/mapstructure" "github.com/stretchr/testify/assert" ) func Test_GameHook(t *testing.T) { ref := Game{ ID: 123, InPressSystem: true, Platforms: Platforms{ Linux: ArchitecturesAll, Windows: ArchitecturesAll, }, } marshalledTraits := []byte(`{ "id": 123, "traits": ["in_press_system", "p_linux", "p_windows"] }`) marshalledSane := []byte(`{ "id": 123, "inPressSystem": true, "platforms": {"linux": "all", "windows": "all"} }`) { intermediateTraits := make(map[string]interface{}) err := json.Unmarshal(marshalledTraits, &intermediateTraits) assert.NoError(t, err) var decodedTraits Game dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ TagName: "json", DecodeHook: GameHookFunc, WeaklyTypedInput: true, Result: &decodedTraits, }) assert.NoError(t, err) err = dec.Decode(intermediateTraits) assert.NoError(t, err) assert.EqualValues(t, ref, decodedTraits) } { intermediateSane := make(map[string]interface{}) err := json.Unmarshal(marshalledSane, &intermediateSane) assert.NoError(t, err) var decodedSane Game dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ TagName: "json", DecodeHook: GameHookFunc, WeaklyTypedInput: true, Result: &decodedSane, }) assert.NoError(t, err) err = dec.Decode(intermediateSane) assert.NoError(t, err) assert.EqualValues(t, ref, decodedSane) } // ------------- bs, err := json.Marshal(ref) assert.NoError(t, err) var unmarshalled Game err = json.Unmarshal(bs, &unmarshalled) assert.NoError(t, err) assert.EqualValues(t, ref, unmarshalled) // ------------ } func Test_GameHookNested(t *testing.T) { type Res struct { Games []*Game `json:"games"` } marshalledSane := []byte(`{"games": [{ "id": 123, "inPressSystem": true, "platforms": {"linux": "all", "windows": "all"} }]}`) intermediate := make(map[string]interface{}) err := json.Unmarshal(marshalledSane, &intermediate) tmust(t, err) var res Res dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ Result: &res, DecodeHook: mapstructure.ComposeDecodeHookFunc( mapstructure.StringToTimeHookFunc(time.RFC3339Nano), GameHookFunc, ), WeaklyTypedInput: true, }) tmust(t, err) err = dec.Decode(intermediate) tmust(t, err) assert.EqualValues(t, Res{ Games: []*Game{ &Game{ ID: 123, InPressSystem: true, Platforms: Platforms{ Linux: "all", Windows: "all", }, }, }, }, res) } // tmust shows a complete error stack and fails a test immediately // if err is non-nil func tmust(t *testing.T, err error) { if err != nil { t.Helper() t.Errorf("%+v", err) t.FailNow() } }
<reponame>lananh265/social-network "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ic_offline_pin_outline = void 0; var ic_offline_pin_outline = { "viewBox": "0 0 24 24", "children": [{ "name": "path", "attribs": { "d": "M0 0h24v24H0z", "fill": "none" }, "children": [] }, { "name": "path", "attribs": { "d": "M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-5-5h10v2H7zm3.3-3.8L8.4 9.3 7 10.7l3.3 3.3L17 7.3l-1.4-1.4z" }, "children": [] }] }; exports.ic_offline_pin_outline = ic_offline_pin_outline;
#!/usr/bin/env bash oc new-build --strategy=docker https://github.com/buuhsmead/ocp-eap-base.git -e MY_BASE_VERSION=0.1.0 --name=eap-base
package org.rs2server.http; import java.net.InetSocketAddress; import java.util.concurrent.Executors; import java.util.logging.Logger; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; import org.rs2server.Server; public class HTTPServer { public static void start() { Logger log = Logger.getLogger(""); // Configure the server. ServerBootstrap bootstrap = new ServerBootstrap( new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool())); // Set up the event pipeline factory. bootstrap.setPipelineFactory(new HTTPServerFactory()); // Bind and start to accept incoming connections. bootstrap.bind(new InetSocketAddress(8080)); WorldList w1 = new WorldList(1, 33, "172.16.31.10", "Economy", 43594);//43594 WorldList w2 = new WorldList(2, 1029, "172.16.31.10", "PvP", 43595);//40002 WorldList w3 = new WorldList(3, 536870913, "127.0.0.1", "Deadman Mode", 5555); /*WorldList w4 = new WorldList(4, 33, "127.0.0.1", "Economy 4", 40004); WorldList w5 = new WorldList(5, 33, "127.0.0.1", "Economy 5", 40005); WorldList w6 = new WorldList(6, 33, "127.0.0.1", "Economy 6", 40006); WorldList w7 = new WorldList(7, 33, "127.0.0.1", "Economy 7", 40007); WorldList w8 = new WorldList(8, 1029, "127.0.0.1", "PvP", 40008); WorldList w9 = new WorldList(9, 536870913, "127.0.0.1", "Deadman Mode", 40009); WorldList w10 = new WorldList(10, 33554433, "127.0.0.1", "Tournament", 40010);*/ //w2.setPlayercount(-1); /*w3.setPlayercount(-1); w4.setPlayercount(-1); w5.setPlayercount(-1); w6.setPlayercount(-1); w7.setPlayercount(-1); w8.setPlayercount(-1); w9.setPlayercount(-1); w10.setPlayercount(-1);*/ WorldList.list.put(1, w1); WorldList.list.put(2, w2); WorldList.list.put(3, w3); /*WorldList.list.put(4, w4); WorldList.list.put(5, w5); WorldList.list.put(6, w6); WorldList.list.put(7, w7); WorldList.list.put(8, w8); WorldList.list.put(9, w9); WorldList.list.put(10, w10);*/ log.info("Kronos WebServer has loaded sucessfuly."); } }
<filename>src/xrGame/smart_cover_planner_target_provider.cpp<gh_stars>1-10 //////////////////////////////////////////////////////////////////////////// // Module : smart_cover_planner_target_provider.cpp // Created : 18.09.2007 // Author : <NAME> // Description : Target provider for target selector //////////////////////////////////////////////////////////////////////////// #include "pch_script.h" #include "smart_cover_planner_target_provider.h" #include "script_game_object.h" #include "smart_cover_animation_planner.h" #include "ai/stalker/ai_stalker.h" using smart_cover::animation_planner; using smart_cover::target_provider; using smart_cover::target_fire_no_lookout; target_provider::target_provider (animation_planner *object, LPCSTR name, StalkerDecisionSpace::EWorldProperties const &world_property, u32 const &loophole_value) : inherited (object, name), m_world_property (world_property), m_loophole_value (loophole_value) { } void target_provider::setup (animation_planner *object, CPropertyStorage *storage) { inherited::setup (object, storage); } void target_provider::initialize () { inherited::initialize (); m_object->target (m_world_property); m_storage->set_property (m_world_property, true); m_object->decrease_loophole_value (m_loophole_value); } void target_provider::finalize () { inherited::finalize (); } target_fire_no_lookout::target_fire_no_lookout (animation_planner *object, LPCSTR name, StalkerDecisionSpace::EWorldProperties const &world_property, u32 const &loophole_value) : inherited (object, name, world_property, loophole_value) { } void target_fire_no_lookout::initialize () { m_storage->set_property (StalkerDecisionSpace::eWorldPropertyLookedOut, false); inherited::initialize (); }
<gh_stars>0 package com.twitter.finatra.http.internal.exceptions import com.google.common.net.MediaType import com.twitter.finagle.http.{Request, Response} import com.twitter.finagle.{CancelledRequestException, Failure} import com.twitter.finatra.http.exceptions.{DefaultExceptionMapper, HttpException, HttpResponseException} import com.twitter.finatra.http.internal.exceptions.FinatraDefaultExceptionMapper._ import com.twitter.finatra.http.response.{ErrorsResponse, ResponseBuilder} import com.twitter.finatra.utils.DeadlineValues import com.twitter.inject.Logging import com.twitter.inject.utils.ExceptionUtils._ import javax.inject.{Inject, Singleton} import org.apache.thrift.TException private[http] object FinatraDefaultExceptionMapper { private val MaxDepth = 5 private val DefaultExceptionSource = "Internal" private def unwrapFailure(failure: Failure, depth: Int): Throwable = { if (depth == 0) failure else failure.cause match { case Some(inner: Failure) => unwrapFailure(inner, depth - 1) case Some(cause) => cause case None => failure } } } @Singleton private[http] class FinatraDefaultExceptionMapper @Inject()( response: ResponseBuilder) extends DefaultExceptionMapper with Logging { override def toResponse(request: Request, throwable: Throwable): Response = { throwable match { case e: HttpException => val builder = response.status(e.statusCode) if (e.mediaType.is(MediaType.JSON_UTF_8)) builder.json(ErrorsResponse(e.errors)) else builder.plain(e.errors.mkString(", ")) case e: HttpResponseException => response.create(e.response) case e: CancelledRequestException => val deadlineValues = DeadlineValues.current() response .clientClosed .failureClassifier( deadlineValues.exists(_.expired), request, source = DefaultExceptionSource, details = Seq("CancelledRequestException"), message = deadlineValues.map(_.elapsed).getOrElse("unknown") + " ms") case e: Failure => unwrapFailure(e, MaxDepth) match { case cause: Failure => unhandledResponse(request, e) case cause => toResponse(request, cause) } case e: TException => unhandledResponse(request, e, logStackTrace = false) case e => // Note: We don't use NonFatal(e) since ExceptionMappingFilter is protecting us unhandledResponse(request, e) } } private def unhandledResponse(request: Request, e: Throwable, logStackTrace: Boolean = true): Response = { if (logStackTrace) { error("Unhandled Exception", e) } else { error("Unhandled Exception: " + e) } response .internalServerError .failure( request, source = DefaultExceptionSource, details = Seq( "Unhandled", toExceptionDetails(e))) .jsonError } }
<reponame>exaxorg/filedups datasets = (['source'],) description=''' Convert a dataset list into a dataset chain. ''' def synthesis(job): assert len(datasets.source) >= 1, 'Needs at least one dataset!' source = datasets.source last = source.pop(-1) previous = None for ix, ds in enumerate(source): previous = ds.link_to_here(override_previous=previous, name=str(ix)) last.link_to_here(override_previous=previous, name='default')
public static void main(String[] args) { String str = "abc123"; int letters = 0; int digits = 0; for(int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if(Character.isLetter(ch)) { letters++; } else if(Character.isDigit(ch)) { digits++; } } System.out.println("Letters: " + letters + ", Digits: " + digits); // Output: Letters: 3, Digits: 3 }
<filename>lib/oci/container_engine/models/node_pool_node_config_details.rb # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. require 'date' # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength module OCI # The size and placement configuration of nodes in the node pool. class ContainerEngine::Models::NodePoolNodeConfigDetails # The number of nodes in the node pool. # # @return [Integer] attr_accessor :size # The OCIDs of the Network Security Group(s) to associate nodes for this node pool with. For more information about NSGs, see {NetworkSecurityGroup}. # # @return [Array<String>] attr_accessor :nsg_ids # The OCID of the Key Management Service key assigned to the boot volume. # @return [String] attr_accessor :kms_key_id # Whether to enable in-transit encryption for the data volume's paravirtualized attachment. This field applies to both block volumes and boot volumes. The default value is false. # @return [BOOLEAN] attr_accessor :is_pv_encryption_in_transit_enabled # Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. # For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm). # Example: `{\"Department\": \"Finance\"}` # # @return [Hash<String, String>] attr_accessor :freeform_tags # Defined tags for this resource. Each key is predefined and scoped to a namespace. # For more information, see [Resource Tags](https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm). # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` # # @return [Hash<String, Hash<String, Object>>] attr_accessor :defined_tags # The placement configurations for the node pool. Provide one placement # configuration for each availability domain in which you intend to launch a node. # # To use the node pool with a regional subnet, provide a placement configuration for # each availability domain, and include the regional subnet in each placement # configuration. # # @return [Array<OCI::ContainerEngine::Models::NodePoolPlacementConfigDetails>] attr_accessor :placement_configs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'size': :'size', 'nsg_ids': :'nsgIds', 'kms_key_id': :'kmsKeyId', 'is_pv_encryption_in_transit_enabled': :'isPvEncryptionInTransitEnabled', 'freeform_tags': :'freeformTags', 'defined_tags': :'definedTags', 'placement_configs': :'placementConfigs' # rubocop:enable Style/SymbolLiteral } end # Attribute type mapping. def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'size': :'Integer', 'nsg_ids': :'Array<String>', 'kms_key_id': :'String', 'is_pv_encryption_in_transit_enabled': :'BOOLEAN', 'freeform_tags': :'Hash<String, String>', 'defined_tags': :'Hash<String, Hash<String, Object>>', 'placement_configs': :'Array<OCI::ContainerEngine::Models::NodePoolPlacementConfigDetails>' # rubocop:enable Style/SymbolLiteral } end # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral # Initializes the object # @param [Hash] attributes Model attributes in the form of hash # @option attributes [Integer] :size The value to assign to the {#size} property # @option attributes [Array<String>] :nsg_ids The value to assign to the {#nsg_ids} property # @option attributes [String] :kms_key_id The value to assign to the {#kms_key_id} property # @option attributes [BOOLEAN] :is_pv_encryption_in_transit_enabled The value to assign to the {#is_pv_encryption_in_transit_enabled} property # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property # @option attributes [Array<OCI::ContainerEngine::Models::NodePoolPlacementConfigDetails>] :placement_configs The value to assign to the {#placement_configs} property def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.size = attributes[:'size'] if attributes[:'size'] self.nsg_ids = attributes[:'nsgIds'] if attributes[:'nsgIds'] raise 'You cannot provide both :nsgIds and :nsg_ids' if attributes.key?(:'nsgIds') && attributes.key?(:'nsg_ids') self.nsg_ids = attributes[:'nsg_ids'] if attributes[:'nsg_ids'] self.kms_key_id = attributes[:'kmsKeyId'] if attributes[:'kmsKeyId'] raise 'You cannot provide both :kmsKeyId and :kms_key_id' if attributes.key?(:'kmsKeyId') && attributes.key?(:'kms_key_id') self.kms_key_id = attributes[:'kms_key_id'] if attributes[:'kms_key_id'] self.is_pv_encryption_in_transit_enabled = attributes[:'isPvEncryptionInTransitEnabled'] unless attributes[:'isPvEncryptionInTransitEnabled'].nil? self.is_pv_encryption_in_transit_enabled = false if is_pv_encryption_in_transit_enabled.nil? && !attributes.key?(:'isPvEncryptionInTransitEnabled') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isPvEncryptionInTransitEnabled and :is_pv_encryption_in_transit_enabled' if attributes.key?(:'isPvEncryptionInTransitEnabled') && attributes.key?(:'is_pv_encryption_in_transit_enabled') self.is_pv_encryption_in_transit_enabled = attributes[:'is_pv_encryption_in_transit_enabled'] unless attributes[:'is_pv_encryption_in_transit_enabled'].nil? self.is_pv_encryption_in_transit_enabled = false if is_pv_encryption_in_transit_enabled.nil? && !attributes.key?(:'isPvEncryptionInTransitEnabled') && !attributes.key?(:'is_pv_encryption_in_transit_enabled') # rubocop:disable Style/StringLiterals self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags'] raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags') self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags'] self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags'] raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags') self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags'] self.placement_configs = attributes[:'placementConfigs'] if attributes[:'placementConfigs'] raise 'You cannot provide both :placementConfigs and :placement_configs' if attributes.key?(:'placementConfigs') && attributes.key?(:'placement_configs') self.placement_configs = attributes[:'placement_configs'] if attributes[:'placement_configs'] end # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines # Checks equality by comparing each attribute. # @param [Object] other the other object to be compared def ==(other) return true if equal?(other) self.class == other.class && size == other.size && nsg_ids == other.nsg_ids && kms_key_id == other.kms_key_id && is_pv_encryption_in_transit_enabled == other.is_pv_encryption_in_transit_enabled && freeform_tags == other.freeform_tags && defined_tags == other.defined_tags && placement_configs == other.placement_configs end # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines # @see the `==` method # @param [Object] other the other object to be compared def eql?(other) self == other end # rubocop:disable Metrics/AbcSize, Layout/EmptyLines # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash [size, nsg_ids, kms_key_id, is_pv_encryption_in_transit_enabled, freeform_tags, defined_tags, placement_configs].hash end # rubocop:enable Metrics/AbcSize, Layout/EmptyLines # rubocop:disable Metrics/AbcSize, Layout/EmptyLines # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end # rubocop:enable Metrics/AbcSize, Layout/EmptyLines # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end private # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
#!/bin/sh sh /usr/ccsp/mta/mta_overcurrentfault_status.sh &
<reponame>quan-vu/ProTasks import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { HttpClientModule } from '@angular/common/http'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HomeRoutingModule } from './home-routing.module'; // Material import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatNativeDateModule } from '@angular/material/core'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatChipsModule } from '@angular/material/chips'; import { MatDialogModule } from '@angular/material/dialog'; // components import { HomeComponent } from './home.component'; import { TaskListComponent } from './task-list/task-list.component'; import { ProjectListComponent } from './project-list/project-list.component'; @NgModule({ declarations: [ HomeComponent, TaskListComponent, ProjectListComponent, ], imports: [ HttpClientModule, CommonModule, HomeRoutingModule, FormsModule, ReactiveFormsModule, MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatSelectModule, MatButtonModule, MatIconModule, MatCheckboxModule, MatChipsModule, MatDialogModule, ] }) export class HomeModule { }
<gh_stars>1-10 #include "stdafx.h" #include "NativeVehicle.h" #define Validation(ret) if(GetVehicle() == 0) return ret float NativeVehicle::GetSpeed() { Validation(0.0f); auto vehicle = GetVehicle(); float x = 0.0f; float y = 0.0f; float z = 0.0f; x = *(float*)(vehicle + 0x44); y = *(float*)(vehicle + 0x48); z = *(float*)(vehicle + 0x4C); return pow((pow(x, 2.0f) + pow(y, 2.0f) + pow(z, 2.0f)), 0.5f) * 1.42f * 100.0f; } float NativeVehicle::GetHealth() { Validation(0.0f); auto vehicle = GetVehicle(); float health = *(float*)(vehicle + 0x4C0); return health; } int NativeVehicle::GetModelId() { Validation(0); auto vehicle = GetVehicle(); WORD modelId = *(WORD*)(vehicle + 0x22); return modelId; } bool NativeVehicle::IsLightActive() { Validation(false); auto vehicle = GetVehicle(); DWORD flags = *(DWORD*)(vehicle + 0x428); return flags & 64; } bool NativeVehicle::IsLocked() { Validation(false); auto vehicle = GetVehicle(); DWORD flags = *(DWORD*)(vehicle + 0x4F8); return flags & 2; } bool NativeVehicle::IsEngineRunning() { Validation(false); auto vehicle = GetVehicle(); DWORD flags = *(DWORD*)(vehicle + 0x428); return flags & 16; } bool NativeVehicle::UseHorn() { Validation(false); auto vehicle = GetVehicle(); DWORD flags = *(DWORD*)(vehicle + 0x514); return flags & 1; } bool NativeVehicle::UseSiren() { Validation(false); auto vehicle = GetVehicle(); BYTE flags = *(BYTE*)(vehicle + 0x42D); return flags & 128; } DWORD NativeVehicle::GetVehicle() { return *(DWORD*)0xBA18FC; }
<filename>src/pages/index.js import React from 'react' import { graphql } from 'gatsby' import get from 'lodash/get' import Hemlet from 'react-helmet' import Layout from '../components/Layout' import DisplayImage from './../assets/images/boston_mickey.jpg' import favicon16 from "../assets/favicon-16.png" class SiteIndex extends React.Component { render() { const siteTitle = get(this, 'props.data.site.siteMetadata.title') const siteDescription = get( this, 'props.data.site.siteMetadata.description' ) return ( <Layout> <Hemlet> <title>{siteTitle}</title> <meta name="description" content={siteDescription} /> <link rel="icon" type="image/png" href={favicon16} sizes="16x16"/> </Hemlet> <p> Billy is a passionate software developer who enjoys learning different technology. He earned master's degree in Management Information Systems from National Central University in Taiwan and was a software engineer building Android app for consumer electronic products at Asus. He came to the US this year and is fresh off the boat! </p> <img src={DisplayImage} alt={siteTitle} hight="600" width="400" /> <p>Fenway Park, Boston, Oct. 2018</p> </Layout> ) } } export default SiteIndex export const query = graphql` query { site { siteMetadata { title description } } } `
#!/bin/bash #SBATCH --account=rlmolecule #SBATCH --time=4:00:00 #SBATCH --job-name az_stability # --- Policy Trainer --- #SBATCH --nodes=1 #SBATCH --gres=gpu:2 # --- MCTS Rollouts --- #SBATCH hetjob #SBATCH -n 90 #SBATCH -c 4 export WORKING_DIR=/scratch/$USER/rlmolecule export START_POLICY_SCRIPT="$SLURM_SUBMIT_DIR/$JOB/.policy.sh" export START_ROLLOUT_SCRIPT="$SLURM_SUBMIT_DIR/$JOB/.rollout.sh" cat << "EOF" > "$START_POLICY_SCRIPT" #!/bin/bash source /nopt/nrel/apps/anaconda/5.3/etc/profile.d/conda.sh conda activate /projects/rlmolecule/pstjohn/envs/tf2_gpu python train_policy.py EOF cat << "EOF" > "$START_ROLLOUT_SCRIPT" #!/bin/bash source /nopt/nrel/apps/anaconda/5.3/etc/profile.d/conda.sh conda activate /projects/rlmolecule/pstjohn/envs/tf2_cpu python run_mcts.py EOF chmod +x "$START_POLICY_SCRIPT" "$START_ROLLOUT_SCRIPT" srun --pack-group=0 \ --job-name="az-policy" \ --output=$WORKING_DIR/gpu.%j.out \ "$START_POLICY_SCRIPT" & srun --pack-group=1 \ --job-name="az-rollout" \ --output=$WORKING_DIR/mcts.%j.out \ "$START_ROLLOUT_SCRIPT"
#ifndef CS_H_GUARD #define CS_H_GUARD //#include <string.h> //#include <stdlib.h> typedef struct cs_sparse /* matrix in compressed-column or triplet form */ { int nzmax ; /* maximum number of entries */ int m ; /* number of rows */ int n ; /* number of columns */ int *p ; /* column pointers (size n+1) or col indices (size nzmax) */ int *i ; /* row indices, size nzmax */ double *x ; /* numerical values, size nzmax */ int nz ; /* # of entries in triplet matrix, -1 for compressed-col */ } cs ; cs *cs_compress (const cs *T); cs *cs_done (cs *C, void *w, void *x, int ok); cs *cs_spalloc (int m, int n, int nzmax, int values, int triplet); cs *cs_spfree (cs *A); double cs_cumsum (int *p, int *c, int n); int *cs_pinv (int const *p, int n); cs *cs_symperm (const cs *A, const int *pinv, int values); #endif
<reponame>Simon-Bin/nestjs_template import * as path from 'path'; import * as dotenv from 'dotenv'; import * as fs from 'fs'; import { EnvConfig } from './config.interface'; export class ConfigService { private readonly envConfig: { [key: string]: string }; constructor() { const baseEnvFile = path.resolve(__dirname, '../../', '.env'); this.envConfig = dotenv.parse(fs.readFileSync(baseEnvFile)); const filePath = `.env.${process.env.NODE_ENV || 'development'}`; const envFile = path.resolve(__dirname, '../../', filePath); this.envConfig = Object.assign( {}, this.envConfig, dotenv.parse(fs.readFileSync(envFile)), ); } get(key: keyof EnvConfig): string { return this.envConfig[key]; } }
<?php function fibonacci($n) { if ($n < 0) return -1; if ($n == 0) return 0; if ($n == 1) return 1; else return fibonacci($n - 1) + fibonacci($n - 2); } $num = 10; echo fibonacci($num); // Output: 34 ?>
wget https://alice-open.oss-cn-zhangjiakou.aliyuncs.com/StructBERT/en_model mkdir ./models mv en_model ./models
import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { UserEntity } from '../models/user.entity'; import { Repository } from 'typeorm'; import { User } from '../models/user.interface'; import { from, Observable, throwError } from 'rxjs'; import { AuthService } from 'src/auth/auth/auth.service'; import {map, switchMap, catchError} from 'rxjs/operators'; @Injectable() export class UserService { constructor (@InjectRepository(UserEntity) private readonly userRepository: Repository<UserEntity>, private authService: AuthService){} create(user: User): Observable<User>{ return this.authService.hashPassword(user.password).pipe( switchMap((passwordHash: string) => { const newUser = new UserEntity(); newUser.username = user.username; newUser.firstName = user.firstName; newUser.lastName = user.lastName; newUser.password = <PASSWORD>; return from(this.userRepository.save(newUser)).pipe( map((user: User) => { const {password, ...result} = user; return result; }), catchError(err => throwError(err)) ) }) ) } login(user: User): Observable<string>{ return this.validateUser(user.username, user.password).pipe( switchMap((user: User) => { if(user){ return this.authService.generateJWT(user).pipe(map((jwt: string) => jwt)) }else{ return 'Wrong credentials!'; } }) ) } validateUser(username: string, password:string): Observable<User>{ return this.findByUsername(username).pipe( switchMap((user: User) => this.authService.comparePassword(password, user.password).pipe( map((match: boolean) => { if(match){ const { password, ...result} = user; return result; }else{ throw Error; } }) )) ); } findByUsername(username: string): Observable<User>{ return from(this.userRepository.findOne({username})) } }
<gh_stars>0 package employeet; import employeet.data.*; import employeet.data.entry.Entry; import employeet.data.entry.FloatEntry; import employeet.data.entry.IntEntry; import employeet.data.entry.LiteralEntry; import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.regex.Pattern; /** * EmployeeFile.java * * Purpose: Wrapper for an employee's information. * * void setFirstName - Sets the first name. * void setLastName - Sets the last name. * void setEmployeeNo - Sets the employee number. * void setAddress - Sets the address. * void setCity - Sets the city. * void setPayRate - Sets the pay rate. * void setPosition - Sets the position. * String serialize - Serializes the employee file. * void deserialize - Deserializes the employee file. * */ public class EmployeeFile implements ISerializable<String>, Serializable { private List<Entry<?>> entries = new ArrayList<>(); private LiteralEntry firstName = new LiteralEntry(); private LiteralEntry lastName = new LiteralEntry(); private IntEntry employeeNo = new IntEntry(); private LiteralEntry address = new LiteralEntry(); private LiteralEntry city = new LiteralEntry(); private FloatEntry payRate = new FloatEntry(14.0F); private LiteralEntry position = new LiteralEntry(); private String serializationCache = null; private boolean dirty = true; public EmployeeFile() { this.entries.add(this.firstName); this.entries.add(this.lastName); this.entries.add(this.employeeNo); this.entries.add(this.address); this.entries.add(this.city); this.entries.add(this.payRate); this.entries.add(this.position); } public void setFirstName(String firstName) { this.firstName.set(firstName); this.dirty = true; } public void setLastName(String lastName) { this.lastName.set(lastName); this.dirty = true; } public void setEmployeeNo(int employeeNo) { this.employeeNo.set(employeeNo); this.dirty = true; } public void setAddress(String address) { this.address.set(address); this.dirty = true; } public void setCity(String city) { this.city.set(city); this.dirty = true; } public void setPayRate(float payRate) { this.payRate.set(payRate); this.dirty = true; } public void setPosition(String jobDescription) { this.position.set(jobDescription); this.dirty = true; } @Override public String serialize() { if(!this.dirty && this.serializationCache != null)return this.serializationCache; StringBuilder sb = new StringBuilder(); Iterator<Entry<?>> iterator = this.entries.iterator(); while(iterator.hasNext()) { Entry<?> e = iterator.next(); sb.append(e.serialize()); if(iterator.hasNext()) { sb.append(","); } } this.dirty = false; this.serializationCache = sb.toString(); return this.serializationCache; } @Override public void deserialize(String raw) { String[] data = raw.split(Pattern.quote(",")); if(data.length != this.entries.size()) { System.err.format("Malformed line [%s]-- was expecting %d argument%s, found %d.\n", raw, data.length, data.length > 1 ? "s" : "", this.entries.size()); return; } for(int i = 0; i < data.length; i++) { this.entries.get(i).deserialize(data[i]); } } @Override public String toString() { return this.serialize(); } }
import React, { Component } from 'react'; import { observer } from 'mobx-react'; import Dialog, { DialogActions, DialogContent, DialogTitle, withMobileDialog, } from 'material-ui/Dialog'; import { Icon } from 'antd'; import Divider from 'material-ui/Divider'; import { withStyles } from 'material-ui/styles'; import Button from 'material-ui/Button'; import Snackbar from 'material-ui/Snackbar'; import IconButton from 'material-ui/IconButton'; import CloseIcon from '@material-ui/icons/Close'; import classnames from 'classnames'; import EditAgentPasswordForm from '../../containers/EditAgentPasswordForm'; import blockAgent from '../../effects/users/blockAgent'; const networkErrorMessage = "We're sorry. There was an error processing your request."; const styles = theme => ({ paper: { width: '600px', maxWidth: '800px', }, dialogActions: { margin: '8px 0', }, formTitle: { padding: 'theme.spacing.unit theme.spacing.unit * 3', textAlign: 'center', }, formSubheader: { paddingLeft: theme.spacing.unit * 4, paddingRight: theme.spacing.unit * 4, marginBottom: theme.spacing.unit * 6, marginTop: theme.spacing.unit * 2, textAlign: 'center', }, dialogContent: { position: 'relative', paddingTop: '32px', display: 'flex', flexDirection: 'column', alignItems: 'center', }, saveDraftBtn: { marginRight: 'auto', color: theme.custom.submitBlue.main, '&:hover': { backgroundColor: theme.custom.submitBlue.transparentLightBackground, }, }, snackBar: { position: 'absolute', bottom: 20, }, errorSnackbar: { '& > div': { backgroundColor: theme.palette.secondary.main, }, }, }); @observer class BlockAgentDialogBox extends Component { constructor(props) { super(props); this.state = { formApi: null, submittingForm: false, formSubmitted: false, snackbarOpen: false, snackbarText: 'Agent suspended successfully!', submittingRequestToServer: false, isErrorSnackbar: false, agent: props.agent, closeDialog: true }; } setFormSubmitted = (bool = true) => { this.setState({ formSubmitted: bool, submittingForm: !bool, }); }; toggleSnackbarOpen = text => { this.setState({ snackbarOpen: true, snackbarText: text, }); }; handleCloseSnackbar = () => { this.setState({ snackbarOpen: false, snackbarUndoFunction: null, isErrorSnackbar: false, snackbarText: '', }); }; blockAgent = (status) => { console.log("blocker called ", status); // this.props.setFormSubmitted(); // this.props.toggleSubmittingRequestToServer(true); const returnValues = { uuid: this.props.viewingAgentUUID, status, }; this.setState({ closeDialog: false, snackbarOpen: true, snackbarText: `Agent ${status} successfully`, isErrorSnackbar: true, }); blockAgent(returnValues) .then(res => { // this.props.setFormSubmitted(false); // this.props.toggleSubmittingRequestToServer(false); // if (res.error) { // this.props.openRequestErrorSnackbar(res.error); // return; // } console.log("check the final response ", res); // this.props.formSubmittedSuccessfully(); }) .catch(err => { this.props.toggleSubmittingRequestToServer(false); this.props.setFormSubmitted(false); this.props.openRequestErrorSnackbar(); }); } openRequestErrorSnackbar = (text = networkErrorMessage) => { this.setState({ snackbarOpen: true, snackbarText: text, isErrorSnackbar: true, }); }; toggleSubmittingRequestToServer = ( bool = !this.state.submittingRequestToServer ) => { this.setState({ submittingRequestToServer: bool, formSubmitted: bool, }); }; render() { const { fullScreen, classes, closeEditAgentDialogBox, closeBlockAgentDialogBox, closeEditAgentPasswordDialogBox, blockAgentFormSubmittedSuccessfully, open, agent, submitProfilePicEditForm, finishedSubmittingForm, submittingEditAgentPasswordForm, editProfilePicFormSubmitted, setFormSubmitted, setFinishedSubmittingForm, } = this.props; console.log("block this agent >>>>>>>>>>>>", agent); return ( <Dialog open={open && this.state.closeDialog} onClose={closeBlockAgentDialogBox} classes={{ paper: classes.paper }} fullScreen={fullScreen} > <DialogTitle id="form-dialog-title" classes={{ root: classes.formTitle }} > Edit Agent </DialogTitle> <Divider /> <DialogContent classes={{ root: classes.dialogContent }} id="formDialog" > Do you want to {agent.agent.status == "Active"? "block " : "unblock "} {agent.firstName + ' ' + agent.lastName } ? {/* <EditAgentPasswordForm viewingAgentUUID={this.props.viewingAgentUUID} getFormApi={formApi => this.setState({ formApi })} setFormSubmitted={this.setFormSubmitted} openRequestErrorSnackbar={this.openRequestErrorSnackbar} submittingRequestToServer={this.state.submittingRequestToServer} toggleSubmittingRequestToServer={ this.toggleSubmittingRequestToServer } formSubmittedSuccessfully={ this.props.blockAgentFormSubmittedSuccessfully } /> */} <Snackbar classes={{ root: classnames( classes.snackBar, this.state.isErrorSnackbar && classes.errorSnackbar ), }} anchorOrigin={{ vertical: 'bottom', horizontal: 'center', }} open={this.state.snackbarOpen} autoHideDuration={4000} onClose={this.handleCloseSnackbar} message={<span id="snackbar-id">{this.state.snackbarText}</span>} action={[ this.snackbarUndoFunction ? ( <Button key="undo" color="secondary" size="small" onClick={() => { this.handleCloseSnackbar(); if ( this.state.snackbarUndoFunction && typeof snackbarUndoFunction === 'function' ) { this.snackbarUndoFunction(); } }} > UNDO </Button> ) : ( undefined ), <IconButton key="close" aria-label="Close" color="inherit" className={classes.close} onClick={this.handleCloseSnackbar} > <CloseIcon /> </IconButton>, ]} /> </DialogContent> {!submittingEditAgentPasswordForm ? ( <DialogActions classes={{ root: classes.dialogActions }}> <Button onClick={closeBlockAgentDialogBox} color="primary"> Cancel </Button> {!editProfilePicFormSubmitted ? ( <Button onClick={() => { console.log("check the agenets status ", agent.agent); const status = agent.agent.status == "Active" ? "Suspended": "Active"; console.log("check the status status ", status); const response = this.blockAgent(status); console.log("check response ", response); // this.state.formApi.submitForm(); }} color="primary" > {agent.agent.status == "Active"? "Block " : "Unblock "} </Button> ) : null} </DialogActions> ) : null} </Dialog> ); } } export default withMobileDialog()( withStyles(styles)(BlockAgentDialogBox) );
#!/bin/bash sleep 20 echo "############################################################################" echo "############################################################################" echo "################################ CREATED DB ################################" echo "############################################################################" echo "############################################################################" python manage.py migrate echo "############################################################################" echo "############################################################################" echo "################################ CREATED DB ################################" echo "############################################################################" echo "############################################################################" python manage.py collectstatic echo "############################################################################" echo "############################################################################" echo "################################ IMPORT DB ################################" echo "############################################################################" echo "############################################################################" echo "nothing right now\n\n\n\n" echo "############################################################################" echo "############################################################################" echo "################################ Created Admin DB ##########################" echo "############################################################################" echo "############################################################################" python manage.py runscript create_admin echo "############################################################################" echo "############################################################################" echo "################################## RUN APP #################################" echo "############################################################################" echo "############################################################################" python manage.py runserver 0.0.0.0:8000
#!/usr/bin/env bash set -x set -e echo "Running Doc build script..." sudo -E apt-get -yq update sudo apt-get install libav-tools #sudo apt-get install build-essential python-dev python-setuptools #- sudo apt-get install python-numpy python-scipy python-dev python-matplotlib #- sudo apt-get install python-nose python-coverage #- sudo apt-get install python-sphinx #- sudo apt-get remove python-pip #- sudo pip install -U --ignore-installed setuptools virtualenv # deactivate circleci virtualenv and setup a miniconda env instead if [[ `type -t deactivate` ]]; then deactivate fi # Install dependencies with miniconda wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh \ -O miniconda.sh chmod +x miniconda.sh && ./miniconda.sh -b -p $MINICONDA_PATH export PATH="$MINICONDA_PATH/bin:$PATH" conda update --yes --quiet conda # Configure the conda environment and put it in the path using the # provided versions conda create -n $CONDA_ENV_NAME --yes --quiet python numpy scipy \ cython nose coverage matplotlib sphinx pillow setuptools source activate testenv python setup.py install set -o pipefail && cd doc && make html 2>&1 | tee ~/log.txt
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { Button, DropdownButton, MenuItem } from 'react-bootstrap'; import { GlobeIcon, LockIcon } from 'components/icons'; import './style.scss'; class PublicSwitch extends PureComponent { static propTypes = { callback: PropTypes.func, isPublic: PropTypes.bool, label: PropTypes.string }; setPrivate = () => this.props.callback(false); setPublic = () => this.props.callback(true); render() { const { isPublic, label } = this.props; const button = isPublic ? <span><GlobeIcon /><span className="hidden-xs"> Public</span></span> : <span className="is-private"><LockIcon /><span className="hidden-xs"> Private</span></span>; return ( <div className="wr-coll-visibility"> <DropdownButton noCaret id="visibility-menu" className={classNames('rounded', { 'is-public': isPublic })} title={button}> <MenuItem onClick={!isPublic ? this.setPublic : undefined} disabled={isPublic}><GlobeIcon /> Set {label} Public</MenuItem> <MenuItem onClick={isPublic ? this.setPrivate : undefined} disabled={!isPublic}><LockIcon /> Set {label} Private</MenuItem> </DropdownButton> </div> ); } } export default PublicSwitch;
#! /bin/sh -ex PROGRAM=restic-service dev_path=$PWD if test "x$1" = "x--systemd"; then systemd=1 fi target=`mktemp -d` cd $target cat > Gemfile <<GEMFILE source "https://rubygems.org" gem '${PROGRAM}', path: "$dev_path" GEMFILE bundler install --binstubs --without development --path vendor for i in vendor/ruby/*; do gem_home_relative=$i done GEM_HOME=$PWD/$gem_home_relative gem install bundler --no-document for stub in bin/*; do sed -i "/usr.bin.env/a ENV['GEM_HOME']='/opt/restic-service/$gem_home_relative'" $stub done if test -d /opt/${PROGRAM}; then sudo rm -rf /opt/${PROGRAM} fi sudo cp -r . /opt/${PROGRAM} sudo chmod go+rX /opt/${PROGRAM} if test "x$systemd" = "x1" && test -d /lib/systemd/system; then target_gem=`bundler show ${PROGRAM}` sudo cp $target_gem/${PROGRAM}.service /lib/systemd/system ( sudo systemctl stop ${PROGRAM}.service sudo systemctl enable ${PROGRAM}.service sudo systemctl start ${PROGRAM}.service ) fi rm -rf $target
<gh_stars>1-10 import os import sys muxpy_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../')) sys.path.insert(0, muxpy_dir) from muxpy import main main.run()
#!/usr/bin/env sh # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. SCRIPT_DIR=$(cd $(dirname $0); pwd) com=$1 target=current tmp_dir_base=/tmp/common tmp_dir=$tmp_dir_base/$USER/.tmp_mds_jar hdfs_mds_lib='/lib' if [ -f $SCRIPT_DIR/hdfs.sh ]; then . $SCRIPT_DIR/hdfs.sh; fi modules=( mds dp_config dp_schema ) function show_usage() { cat << EOS $0 com command: set: deploy jars in local to latest directories in HDFS deploy: copy latest directories to current directories revert: revert current directories from current.bak in HDFS EOS exit 0 } function com_hdfs() { if [ -z $hdfs_user ] then echo "hdfs dfs $*" hdfs dfs $* else echo "sudo -u $hdfs_user hdfs dfs $*" sudo -u $hdfs_user hdfs dfs $* fi } function set_to_latest() { local src_dir=$(cd $(dirname $0); pwd) # temporaly move jar files to /tmp/common/$USER/ to be able to access from $hdfs_user user local base_name=`basename $src_dir` local dir_name=`dirname $src_dir` mkdir -p $tmp_dir_base chmod 777 $tmp_dir_base mkdir -p $tmp_dir cp -r $src_dir $tmp_dir local module for module in ${modules[@]}; do local tdn=$tmp_dir/$base_name/$module local versions=`ls $tdn` local version for version in ${versions[@]}; do com_hdfs -rm -r -skipTrash $hdfs_mds_lib/$module/$version com_hdfs -put $tdn/$version $hdfs_mds_lib/$module/$version done done rm -r $tmp_dir } function deploy_to_current() { # back up current dir to .bak # move latest directory to current for fast changing local module for module in ${modules[@]}; do com_hdfs -rm -r -skipTrash $hdfs_mds_lib/$module/$target.bak done for module in ${modules[@]}; do com_hdfs -mv $hdfs_mds_lib/$module/$target $hdfs_mds_lib/$module/$target.bak done for module in ${modules[@]}; do com_hdfs -mv $hdfs_mds_lib/$module/latest $hdfs_mds_lib/$module/$target done for module in ${modules[@]}; do com_hdfs -cp $hdfs_mds_lib/$module/$target $hdfs_mds_lib/$module/latest done } function revert_deploy() { local module for module in ${modules[@]}; do com_hdfs -rm -r -skipTrash $hdfs_mds_lib/$module/$target done for module in ${modules[@]}; do com_hdfs -mv $hdfs_mds_lib/$module/$target.bak $hdfs_mds_lib/$module/$target done } case "$com" in "" ) show_usage ;; "set" ) set_to_latest ;; "deploy" ) deploy_to_current ;; "revert" ) revert_deploy ;; * ) echo "$com is not command"; show_usage ;; esac
<html> <head> <title>Hello World</title> </head> <body> <h1>Hello World</h1> </body> </html>
\b[a-zA-Z0-9_+&*-]+(?:.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}\b
def factorial(n): if n < 1: return 1 else: return n * factorial(n - 1)
const dbConfig = { dialect: 'postgres', host: 'localhost', port: 5432, username: 'postgres', password: '<PASSWORD>', database: 'pqr_system', user: 'postgres', }; module.exports.dbConfig = dbConfig;
bnc_name=`basename $(pwd)` ; lnk_name="$bnc_name.rbc" ; prf_name="$bnc_name.ibc" ; obj_name="$bnc_name.o" ; exe_name="$bnc_name.exe" ; source_files=($(ls *.c)) ; CXXFLAGS=" -lm " ; RUN_OPTIONS=" " ;
<reponame>starsoft35/quark import { produce } from 'immer'; import { AnyAction } from 'redux'; import { SectionStateEnum } from '@vdfor/util'; import { REFRESH_LIST_FAIL, REFRESH_LIST_REQUEST, REFRESH_LIST_SUCCESS, RESET_LIST_FAIL, RESET_LIST_REQUEST, RESET_LIST_SUCCESS, LOAD_MORE_LIST_SUCCESS, LOAD_MORE_LIST_REQUEST, LOAD_MORE_LIST_FAIL, } from './constant'; import { IQuxListState } from './type'; const INITIAL_STATE: IQuxListState = { pageNum: 1, pageSize: 15, hasMore: true, loadMoreLoading: false, refreshLoading: false, status: SectionStateEnum.CONTENT, data: [], }; export default (pageName: string) => (state: IQuxListState = INITIAL_STATE, action: AnyAction) => produce(state, draft => { const { type, payload = [], isPagination, pagination = {} } = action; switch (type) { case `${pageName}${RESET_LIST_REQUEST}`: Object.assign(draft, { ...INITIAL_STATE, status: SectionStateEnum.LOADING, }); break; case `${pageName}${RESET_LIST_SUCCESS}`: { const { data, pageSize, pageNum } = state; const newData = [...data, ...payload]; const hasMore = isPagination ? payload.length >= pageSize : false; Object.assign(draft, { data: newData, status: !hasMore && newData.length === 0 ? SectionStateEnum.EMPTY : SectionStateEnum.CONTENT, hasMore, pageNum: pageNum + 1, }); break; } case `${pageName}${RESET_LIST_FAIL}`: Object.assign(draft, { // ...pagination, status: SectionStateEnum.ERROR, }); break; case `${pageName}${LOAD_MORE_LIST_REQUEST}`: Object.assign(draft, { loadMoreLoading: true }); break; case `${pageName}${LOAD_MORE_LIST_SUCCESS}`: { const { data, pageSize, pageNum } = state; Object.assign(draft, { data: [...data, ...payload], loadMoreLoading: false, hasMore: payload.length >= pageSize, pageNum: pageNum + 1, }); break; } case `${pageName}${LOAD_MORE_LIST_FAIL}`: Object.assign(draft, { ...pagination, loadMoreLoading: false, }); break; case `${pageName}${REFRESH_LIST_REQUEST}`: Object.assign(draft, { refreshLoading: true, pageNum: 1, hasMore: true, }); break; case `${pageName}${REFRESH_LIST_SUCCESS}`: { const { pageSize, pageNum } = state; const newData = [...payload]; const hasMore = isPagination ? payload.length >= pageSize : false; Object.assign(draft, { data: newData, status: !hasMore && newData.length === 0 ? SectionStateEnum.EMPTY : SectionStateEnum.CONTENT, hasMore, pageNum: pageNum + 1, refreshLoading: false, }); break; } case `${pageName}${REFRESH_LIST_FAIL}`: Object.assign(draft, { ...pagination, refreshLoading: false, status: SectionStateEnum.CONTENT, }); break; default: Object.assign(draft, {}); } });
package com.meterware.httpunit; /******************************************************************************************************************** * $Id: EncodingTest.java 813 2007-12-30 17:33:18Z wolfgang_fahl $ * * Copyright (c) 2004, <NAME> * * 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. * *******************************************************************************************************************/ import junit.framework.TestSuite; import com.meterware.pseudoserver.PseudoServlet; import com.meterware.pseudoserver.WebResource; /** * Tests handling of non-Latin scripts. * * @author <a href="mailto:<EMAIL>"><NAME></a> * @author <a href="mailto:<EMAIL>"><NAME></a> **/ public class EncodingTest extends HttpUnitTest { public static void main( String args[] ) { junit.textui.TestRunner.run( suite() ); } public static TestSuite suite() { return new TestSuite( EncodingTest.class ); } public EncodingTest( String name ) { super( name ); } public void testDecodeWithCharacterSetAsArg() throws Exception { String expected = "newpage\u30b5\u30f3\u30d7\u30eb"; // "\u30b5\u30f3\u30d7\u30eb" means "SAMPLE" in Japanese EUC-JP characterSet String encodedString = "newpage%A5%B5%A5%F3%A5%D7%A5%EB"; String actual = HttpUnitUtils.decode( encodedString , "EUC-JP" ); assertEquals( "decoded string" , expected , actual); } /** * test parseContentHeader * @throws Exception */ public void testParseContentHeader() throws Exception { String headers[]={ "text/plain", "text/html; charset=Cp1252", "text/html; charset=iso-8859-8", "text/html; charset=EUC-JP" }; String expected[][]={ {"text/plain",null}, {"text/html","Cp1252"}, {"text/html","iso-8859-8"}, {"text/html","EUC-JP"} }; for (int i=0;i<headers.length;i++) { String result[]=HttpUnitUtils.parseContentTypeHeader(headers[i]); assertEquals( "header "+i , expected[i][0] , result[0]); assertEquals( "header "+i , expected[i][1] , result[1]); } // for } public void testSpecifiedEncoding() throws Exception { String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3"; String page = "<html><head><title>" + hebrewTitle + "</title></head>\n" + "<body>This has no data\n" + "</body></html>\n"; defineResource( "SimplePage.html", page ); setResourceCharSet( "SimplePage.html", "iso-8859-8", true ); WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); WebResponse simplePage = wc.getResponse( request ); assertEquals( "Title", hebrewTitle, simplePage.getTitle() ); assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() ); } public void testQuotedEncoding() throws Exception { String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3"; String page = "<html><head><title>" + hebrewTitle + "</title></head>\n" + "<body>This has no data\n" + "</body></html>\n"; defineResource( "SimplePage.html", page ); setResourceCharSet( "SimplePage.html", "\"iso-8859-8\"", true ); WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); WebResponse simplePage = wc.getResponse( request ); assertEquals( "Title", hebrewTitle, simplePage.getTitle() ); assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() ); } public void testUnspecifiedEncoding() throws Exception { String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3"; String page = "<html><head><title>" + hebrewTitle + "</title></head>\n" + "<body>This has no data\n" + "</body></html>\n"; defineResource( "SimplePage.html", page ); setResourceCharSet( "SimplePage.html", "iso-8859-8", false ); HttpUnitOptions.setDefaultCharacterSet( "iso-8859-8" ); WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); WebResponse simplePage = wc.getResponse( request ); assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() ); assertEquals( "Title", hebrewTitle, simplePage.getTitle() ); } public void testMetaEncoding() throws Exception { String hebrewTitle = "\u05d0\u05d1\u05d2\u05d3"; String page = "<html><head><title>" + hebrewTitle + "</title>" + "<meta Http_equiv=content-type content=\"text/html; charset=iso-8859-8\"></head>\n" + "<body>This has no data\n" + "</body></html>\n"; defineResource( "SimplePage.html", page ); setResourceCharSet( "SimplePage.html", "iso-8859-8", false ); WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); WebResponse simplePage = wc.getResponse( request ); assertEquals( "Character set", "iso-8859-8", simplePage.getCharacterSet() ); assertEquals( "Title", hebrewTitle, simplePage.getTitle() ); } public void testHebrewForm() throws Exception { String hebrewName = "\u05d0\u05d1\u05d2\u05d3"; defineResource( "HebrewForm.html", "<html><head></head>" + "<form method=POST action=\"SayHello\">" + "<input type=text name=name><input type=submit></form></body></html>" ); setResourceCharSet( "HebrewForm.html", "iso-8859-8", true ); defineResource( "SayHello", new PseudoServlet() { public WebResource getPostResponse() { try { String name = getParameter( "name" )[0]; WebResource result = new WebResource( "<html><body><table><tr><td>Hello, " + new String( name.getBytes( "iso-8859-1" ), "iso-8859-8" ) + "</td></tr></table></body></html>" ); result.setCharacterSet( "iso-8859-8" ); result.setSendCharacterSet( true ); return result; } catch (java.io.UnsupportedEncodingException e) { return null; } } } ); WebConversation wc = new WebConversation(); WebResponse formPage = wc.getResponse( getHostPath() + "/HebrewForm.html" ); WebForm form = formPage.getForms()[0]; WebRequest request = form.getRequest(); request.setParameter( "name", hebrewName ); WebResponse answer = wc.getResponse( request ); String[][] cells = answer.getTables()[0].asText(); assertEquals( "Message", "Hello, " + hebrewName, cells[0][0] ); assertEquals( "Character set", "iso-8859-8", answer.getCharacterSet() ); } public void testEncodedRequestWithoutForm() throws Exception { String hebrewName = "\u05d0\u05d1\u05d2\u05d3"; defineResource( "SayHello", new PseudoServlet() { public WebResource getPostResponse() { try { String name = getParameter( "name" )[0]; WebResource result = new WebResource( "<html><body><table><tr><td>Hello, " + new String( name.getBytes( "iso-8859-1" ), "iso-8859-8" ) + "</td></tr></table></body></html>" ); result.setCharacterSet( "iso-8859-8" ); result.setSendCharacterSet( true ); return result; } catch (java.io.UnsupportedEncodingException e) { return null; } } } ); WebConversation wc = new WebConversation(); HttpUnitOptions.setDefaultCharacterSet( "iso-8859-8" ); WebRequest request = new PostMethodWebRequest( getHostPath() + "/SayHello" ); request.setParameter( "name", hebrewName ); WebResponse answer = wc.getResponse( request ); String[][] cells = answer.getTables()[0].asText(); assertEquals( "Message", "Hello, " + hebrewName, cells[0][0] ); assertEquals( "Character set", "iso-8859-8", answer.getCharacterSet() ); } public void testUnsupportedEncoding() throws Exception { defineResource( "SimplePage.html", "not much here" ); addResourceHeader( "SimplePage.html", "Content-type: text/plain; charset=BOGUS"); WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" ); WebResponse simplePage = wc.getResponse( request ); assertEquals( "Text", "not much here", simplePage.getText() ); assertEquals( "Character set", WebResponse.getDefaultEncoding(), simplePage.getCharacterSet() ); } public void testJapaneseLinkParamNameWithValue() throws Exception { String japaneseUrl = "request?%A5%D8%A5%EB%A5%D7=2"; defineWebPage( "Linker", "<a id='link' href='" + japaneseUrl + "'>goThere</a>" ); setResourceCharSet( "Linker.html", "EUC-JP", true ); defineResource( japaneseUrl, "You made it!" ); WebConversation wc = new WebConversation(); WebResponse formPage = wc.getResponse( getHostPath() + "/Linker.html" ); WebResponse target = formPage.getLinkWithID( "link" ).click(); assertEquals( "Resultant page", "You made it!", target.getText() ); } public void testJapaneseLinkParamNameWithoutValue() throws Exception { String japaneseUrl = "request?%A5%D8%A5%EB%A5%D7"; defineWebPage( "Linker", "<a id='link' href='" + japaneseUrl + "'>goThere</a>" ); setResourceCharSet( "Linker.html", "EUC-JP", true ); defineResource( japaneseUrl, "You made it!" ); WebConversation wc = new WebConversation(); WebResponse formPage = wc.getResponse( getHostPath() + "/Linker.html" ); WebResponse target = formPage.getLinkWithID( "link" ).click(); assertEquals( "Resultant page", "You made it!", target.getText() ); } public void testSimpleEntityReplacement() throws Exception { String rawString = "Cox&amp;&amp;Forkum"; assertEquals( "After substitution", "Cox&&Forkum", HttpUnitUtils.replaceEntities( rawString ) ); } public void testSkipEntityReplacementOnBadString() throws Exception { String rawString = "Cox&Forkum"; assertEquals( "After substitution", "Cox&Forkum", HttpUnitUtils.replaceEntities( rawString ) ); } public void testSkipEntityReplacementOnUnhandledEntity() throws Exception { String rawString = "&lt;something&gt;"; assertEquals( "After substitution", "&lt;something&gt;", HttpUnitUtils.replaceEntities( rawString ) ); } }
<!DOCTYPE html> <html> <head> <title>Product Table</title> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script> $(document).ready(function(){ $("#filter").on("keyup", function() { var value = $(this).val().toLowerCase(); $("#table tr").filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) }); }); }); </script> </head> <body> <input id="filter" type="text" placeholder="Filter by product name..."> <table id="table"> <tr> <th>Product</th> <th>Price</th> <th>Description</th> </tr> <tr> <td>Apple</td> <td>$1.00</td> <td>Red fruit</td> </tr> <tr> <td>Banana</td> <td>$0.50</td> <td>Yellow fruit</td> </tr> <tr> <td>Orange</td> <td>$0.75</td> <td>Orange fruit</td> </tr> </table> </body> </html>
import "../App.css"; import "bootstrap"; import "react-bootstrap"; import data from "../data-objects/data"; import React from "react" const OfferProducts = () => { return data.map((product) => { const { identity, name, image, price } = product; return ( <div className="display-offer" key={identity}> <img src={image} alt="images"></img> <div className="product-info"> <span>{name}</span> <br></br> <span>{price}</span> <br></br> <button className="buy-btn">Buy</button> </div> </div> ); }); }; export default OfferProducts;
<gh_stars>1-10 import hslToHex from '../hslToHex'; import { HEX_TEAL, HEX_WHITE, HEX_BLACK, HSL_BLACK, HSL_RED, HSL_TEAL, HSL_WHITE, } from './data/colors'; /** * HSL to HEX */ describe('hslToHex', () => { test('hslToHex - color', () => { const teal = hslToHex(HSL_TEAL.hue, HSL_TEAL.saturation, HSL_TEAL.lightness); expect(teal).toBe(HEX_TEAL); }); test('hslToHex - white', () => { const white = hslToHex(HSL_WHITE.hue, HSL_WHITE.saturation, HSL_WHITE.lightness); expect(white).toBe(HEX_WHITE); }); test('hslToHex - black', () => { const black = hslToHex(HSL_BLACK.hue, HSL_BLACK.saturation, HSL_BLACK.lightness); expect(black).toBe(HEX_BLACK); }); // Bounds checks test('hslToHex - invalid hue, < 0', () => { expect(() => hslToHex(-1, HSL_RED.saturation, HSL_RED.lightness)).toThrow(Error); }); test('hslToHex - invalid hue, > 1', () => { expect(() => hslToHex(361, HSL_RED.saturation, HSL_RED.lightness)).toThrow(Error); }); test('hslToHex - invalid saturation, < 0', () => { expect(() => hslToHex(HSL_RED.hue, -1, HSL_RED.lightness)).toThrow(Error); }); test('hslToHex - invalid saturation, > 1', () => { expect(() => hslToHex(HSL_RED.hue, 1.1, HSL_RED.lightness)).toThrow(Error); }); test('hslToHex - invalid value, < 0', () => { expect(() => hslToHex(HSL_RED.hue, HSL_RED.saturation, -1)).toThrow(Error); }); test('hslToHex - invalid value, > 1', () => { expect(() => hslToHex(HSL_RED.hue, HSL_RED.saturation, 1.1)).toThrow(Error); }); });
<filename>Code Challenges/python/(not done)check_perfect_square_binsech.py Check if Number Is Perfect Square Given an integer n, return whether n = k * k for some integer k. This should be done without using built-in square root function. Constrainnts 0 ≤ n < 2 ** 31 Example 1 Input n = 25 Output True Explanation
<gh_stars>0 package com.lothrazar.cyclicmagic.block.batterycheat; import com.lothrazar.cyclicmagic.IContent; import com.lothrazar.cyclicmagic.block.core.BlockBaseHasTile; import com.lothrazar.cyclicmagic.data.IHasRecipe; import com.lothrazar.cyclicmagic.guide.GuideCategory; import com.lothrazar.cyclicmagic.registry.BlockRegistry; import com.lothrazar.cyclicmagic.registry.RecipeRegistry; import com.lothrazar.cyclicmagic.util.Const; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.registry.GameRegistry; public class BlockBatteryInfinite extends BlockBaseHasTile implements IHasRecipe, IContent { public BlockBatteryInfinite() { super(Material.ROCK); } @Override public void register() { BlockRegistry.registerBlock(this, "battery_infinite", GuideCategory.BLOCKMACHINE); GameRegistry.registerTileEntity(TileEntityBatteryInfinite.class, Const.MODID + "battery_infinite_te"); } private boolean enabled; @Override public boolean enabled() { return enabled; } @Override public void syncConfig(Configuration config) { enabled = config.getBoolean("battery_infinite", Const.ConfigCategory.content, true, Const.ConfigCategory.contentDefaultText); } @Override public IRecipe addRecipe() { return RecipeRegistry.addShapelessOreRecipe(new ItemStack(this), new ItemStack(Blocks.COMMAND_BLOCK), new ItemStack(Blocks.BARRIER)); } @Override public TileEntity createTileEntity(World worldIn, IBlockState state) { return new TileEntityBatteryInfinite(); } }
/* eslint-disable import/prefer-default-export */ export { default as UriUtil } from './uri-util';
<gh_stars>0 package com.irmansyah.kamusku.ui.translete; import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModelProvider; import android.arch.lifecycle.ViewModelProviders; import android.content.Context; import android.content.Intent; import android.support.annotation.Nullable; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.util.Log; import com.irmansyah.kamusku.BR; import com.irmansyah.kamusku.R; import com.irmansyah.kamusku.data.model.db.EnglishIndonesia; import com.irmansyah.kamusku.data.model.db.IndonesiaEnglish; import com.irmansyah.kamusku.databinding.ActivityTransleteBinding; import com.irmansyah.kamusku.ui.base.BaseActivity; import com.jakewharton.rxbinding2.widget.RxTextView; import java.util.List; import java.util.concurrent.TimeUnit; import javax.inject.Inject; import dagger.android.AndroidInjector; import dagger.android.DispatchingAndroidInjector; import dagger.android.support.HasSupportFragmentInjector; import io.reactivex.functions.Consumer; import io.reactivex.functions.Function; import io.reactivex.functions.Predicate; public class TransleteActivity extends BaseActivity<ActivityTransleteBinding, TransleteViewModel> implements TransleteNavigator, EngIndAdapter.ItemResultClickListener, IndEngAdapter.ItemResultClickListener { private static final String TAG = "TransleteActivity"; @Inject ViewModelProvider.Factory mViewModelFactory; @Inject LinearLayoutManager mLayoutManager; @Inject EngIndAdapter mEngIndAdapter; @Inject IndEngAdapter mIndEngAdapter; private TransleteViewModel mTransleteViewModel; ActivityTransleteBinding mActivityTransleteBinding; public static Intent getStartIntent(Context context) { Intent intent = new Intent(context, TransleteActivity.class); return intent; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivityTransleteBinding = getViewDataBinding(); mTransleteViewModel.setNavigator(this); setUp(); setupRx(); subscribeToLiveData(); mEngIndAdapter.setItemResultClickListener(this); mIndEngAdapter.setItemResultClickListener(this); } private void setupRx() { mTransleteViewModel.getCompositeDisposable().add( RxTextView.textChanges(mActivityTransleteBinding.inputWordEdt) .debounce(1, TimeUnit.SECONDS) .filter(charSequence -> charSequence.toString().trim().length() >= 1) .subscribeOn(mTransleteViewModel.getSchedulerProvider().io()) .observeOn(mTransleteViewModel.getSchedulerProvider().ui()) .subscribe(charSequence -> { mTransleteViewModel.setTypeWord(charSequence.toString()); }, throwable -> { Log.e(TAG, "onSearchClicked: ", throwable); })); } private void setUp() { mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); mActivityTransleteBinding.engIndRecyclerView.setLayoutManager(mLayoutManager); mActivityTransleteBinding.engIndRecyclerView.setItemAnimator(new DefaultItemAnimator()); mActivityTransleteBinding.engIndRecyclerView.setAdapter(mEngIndAdapter); LinearLayoutManager lm = new LinearLayoutManager(this); mActivityTransleteBinding.indEngRecyclerView.setLayoutManager(lm); mActivityTransleteBinding.indEngRecyclerView.setItemAnimator(new DefaultItemAnimator()); mActivityTransleteBinding.indEngRecyclerView.setAdapter(mIndEngAdapter); } private void subscribeToLiveData() { mTransleteViewModel.getEnglishIndonesiaListLiveData().observe(this, englishIndonesias -> mTransleteViewModel.addEnglishIndonesialistItemsToList(englishIndonesias)); mTransleteViewModel.getIndonesiaEnglishListLiveData().observe(this, indonesiaEnglishes -> mTransleteViewModel.addIndonesiaEnglishlistItemsToList(indonesiaEnglishes)); } @Override public TransleteViewModel getViewModel() { mTransleteViewModel = ViewModelProviders.of(this, mViewModelFactory).get(TransleteViewModel.class); return mTransleteViewModel; } @Override public int getBindingVariable() { return BR.viewModel; } @Override public int getLayoutId() { return R.layout.activity_translete; } @Override public void onItemResultEngIndClicked(List<EnglishIndonesia> englishIndonesias, int post) { String searchText = englishIndonesias.get(post).getEngSearch(); String resultText = englishIndonesias.get(post).getIndResult(); mTransleteViewModel.setResultText(searchText.toUpperCase() + " : \n" + resultText); mActivityTransleteBinding.inputWordEdt.setText(""); mEngIndAdapter.clearItems(); hideKeyboard(); } @Override public void onItemResultIndEngClicked(List<IndonesiaEnglish> indonesiaEnglishes, int post) { String searchText = indonesiaEnglishes.get(post).getIndSearch(); String resultText = indonesiaEnglishes.get(post).getEngResult(); mTransleteViewModel.setResultText(searchText + " : \n" + resultText); mActivityTransleteBinding.inputWordEdt.setText(""); mIndEngAdapter.clearItems(); hideKeyboard(); } @Override public void onSearchClicked() { String word = mActivityTransleteBinding.inputWordEdt.getText().toString().trim(); if (!word.isEmpty()) { mTransleteViewModel.setSingleSearch(word.toUpperCase()); mActivityTransleteBinding.inputWordEdt.setText(""); mIndEngAdapter.clearItems(); hideKeyboard(); } } @Override public void wipeText() { mActivityTransleteBinding.inputWordEdt.setText(""); mActivityTransleteBinding.resultEdt.setText(""); mEngIndAdapter.clearItems(); mIndEngAdapter.clearItems(); } }
#!/bin/bash # Copyright 2018 The Kubernetes 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. set -euo pipefail PKG_ROOT=$(git rev-parse --show-toplevel) ${PKG_ROOT}/hack/verify-gofmt.sh ${PKG_ROOT}/hack/verify-govet.sh ${PKG_ROOT}/hack/verify-golint.sh ${PKG_ROOT}/hack/verify-dep.sh ${PKG_ROOT}/hack/verify-boilerplate.sh ${PKG_ROOT}/hack/verify-spelling.sh ${PKG_ROOT}/hack/verify-helm-chart.sh
#!/bin/bash #===================================================== # This script outputs a pretty terse and fairly stable # reprentation of the security relevant configuration #===================================================== # AppliesTo: linux # RemoveExtension: True #===================================================== bash_pid=`ps -C bash -o pid= | tr -d ' '` #echo "#$bash_pid#" echo "Active processes on "`uname -n` #echo "ps -N --pid 2,$bash_pid,$$ --ppid 2,$bash_pid,$$ -o f,ruser,euser,cmd --sort=cmd,f | uniq -c" ps -N --pid 2,$bash_pid,$$ --ppid 2,$bash_pid,$$ -o f,ruser,euser,cmd --sort=cmd,f | uniq -c netstat -an