text
stringlengths
1
1.05M
<reponame>Kartofle/Halitorus import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import Paper from '@material-ui/core/Paper'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; import Collapse from '@material-ui/core/Collapse'; import ExpandLess from '@material-ui/icons/ExpandLess'; import ExpandMore from '@material-ui/icons/ExpandMore'; import StarBorder from '@material-ui/icons/StarBorder'; import PeopleIcon from '@material-ui/icons/People'; import PersonIcon from '@material-ui/icons/Person'; import Avatar from '@material-ui/core/Avatar'; import Button from '@material-ui/core/Button'; const styles = theme => ({ root: { width: '99%', backgroundColor: theme.palette.background.paper, }, paper: { width: '20%', textAlign: 'center', color: theme.palette.text.secondary, }, nested: { paddingLeft: theme.spacing.unit * 2, }, margin: { margin: theme.spacing.unit, }, }); class CharacterList extends React.Component { state = { openPCs: false, openNPCs: false, }; handlePCsClick = () => { this.setState(state => ({ openPCs: !state.openPCs })); }; handleNPCsClick = () => { this.setState(state => ({ openNPCs: !state.openNPCs })); }; render() { const { classes } = this.props; return ( <Paper className={classes.paper}> <List component="nav" className={classes.root} > <Button variant="outlined" size="small" color="primary" className={classes.margin}> New Character </Button> <ListItem button onClick={this.handlePCsClick}> <ListItemIcon> <PersonIcon /> </ListItemIcon> <ListItemText inset primary="Player's" /> {this.state.openPCs ? <ExpandLess /> : <ExpandMore />} </ListItem> <Collapse in={this.state.openPCs} timeout="auto" unmountOnExit> <List component="div" disablePadding> <ListItem button className={classes.nested}> <ListItemIcon> <Avatar alt="PC" src=""/> </ListItemIcon> <ListItemText inset primary="Character.name" /> </ListItem> </List> </Collapse> <ListItem button onClick={this.handleNPCsClick}> <ListItemIcon> <PeopleIcon /> </ListItemIcon> <ListItemText inset primary="NPC's" /> {this.state.openNPCs ? <ExpandLess /> : <ExpandMore />} </ListItem> <Collapse in={this.state.openNPCs} timeout="auto" unmountOnExit> <List component="div" disablePadding> <ListItem button className={classes.nested}> <ListItemIcon> <StarBorder /> </ListItemIcon> <ListItemText inset primary="Starred" /> </ListItem> </List> </Collapse> </List> </Paper> ); } } CharacterList.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(CharacterList);
import logging class Retrievers(object): _visual_retriever = {} _retriever_object = {} np = None def __init__(self): try: from dvalib import indexer, retriever import numpy as np self.np = np except ImportError: logging.warning("Could not import indexer / clustering assuming running in front-end mode") def add_visual_retriever(self, name, retriever_obj): self._visual_retriever[name] = retriever_obj def get_visual_retriever(self, name): return self._visual_retriever.get(name, None)
<reponame>truong29082001/cms_WooCommerce2 /** * External dependencies */ import { doAction } from '@wordpress/hooks'; import { useCallback } from '@wordpress/element'; /** * Internal dependencies */ import { useStoreCart } from './cart/use-store-cart'; type StoreEvent = ( eventName: string, eventParams?: Partial< Record< string, unknown > > ) => void; /** * Abstraction on top of @wordpress/hooks for dispatching events via doAction for 3rd parties to hook into. */ export const useStoreEvents = (): { dispatchStoreEvent: StoreEvent; dispatchCheckoutEvent: StoreEvent; } => { const storeCart = useStoreCart(); const dispatchStoreEvent = useCallback( ( eventName, eventParams = {} ) => { try { doAction( `experimental__woocommerce_blocks-${ eventName }`, eventParams ); } catch ( e ) { // We don't handle thrown errors but just console.log for troubleshooting. // eslint-disable-next-line no-console console.error( e ); } }, [] ); const dispatchCheckoutEvent = useCallback( ( eventName, eventParams = {} ) => { try { doAction( `experimental__woocommerce_blocks-checkout-${ eventName }`, { ...eventParams, storeCart, } ); } catch ( e ) { // We don't handle thrown errors but just console.log for troubleshooting. // eslint-disable-next-line no-console console.error( e ); } }, [ storeCart ] ); return { dispatchStoreEvent, dispatchCheckoutEvent }; };
/** * * @param {import('../helpers/file').File} file * * @return {void} */ module.exports = function (file) { file.transform(/\[(.*?)\]/g, (_, g) => `[${g.trim()}]`).transform(/\[\]/g, ''); }
package com.cgfy.user.base.bean; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import io.swagger.annotations.ApiModelProperty; /** * 树形结构输出Bean * * @author liuyandeng */ public class TreeOutputBean{ /** * ID */ @ApiModelProperty(value = "ID") private String id; /** * 父ID */ @ApiModelProperty(value = "父ID") private String parent_id; /** * 名称 */ @ApiModelProperty(value = "名称") private String name; /** * 数据真实ID */ @ApiModelProperty(value = "数据真实ID,当多张表组成树形结构时,树形结构的ID不能重复,但是数据主见ID可能重复") private String data_id; /** * 数据真实父ID */ @ApiModelProperty(value = "数据真实父ID") private String data_parent_id; /** * 排序 */ @ApiModelProperty(value = "排序") private String sort; /** * 层级 */ @ApiModelProperty(value = "层级") private int level; /** * 其他信息 */ @ApiModelProperty(value = "其他信息") private Map<String, String> other = new HashMap<String, String>(); /** * 子结点 */ @ApiModelProperty(value = "子结点") private List<TreeOutputBean> children = new ArrayList<TreeOutputBean>(); public TreeOutputBean() { } public TreeOutputBean(TreeNodeBean treeNode) { this.id = treeNode.getId(); this.parent_id = treeNode.getParent_id(); this.data_id = treeNode.getData_id(); this.data_parent_id = treeNode.getData_parent_id(); this.name = treeNode.getName(); this.sort = treeNode.getSort(); this.other = treeNode.getOther(); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getParent_id() { return parent_id; } public void setParent_id(String parent_id) { this.parent_id = parent_id; } public String getData_id() { return data_id; } public void setData_id(String data_id) { this.data_id = data_id; } public String getData_parent_id() { return data_parent_id; } public void setData_parent_id(String data_parent_id) { this.data_parent_id = data_parent_id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSort() { return sort; } public void setSort(String sort) { this.sort = sort; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public Map<String, String> getOther() { return other; } public void setOther(Map<String, String> other) { this.other = other; } public List<TreeOutputBean> getChildren() { return children; } public void setChildren(List<TreeOutputBean> children) { this.children = children; } }
import random def generate_random_list(n): return random.sample(range(n), n)
#!/bin/bash set -e # git-lfs needed for working with dev container (not for prod) curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash DEBIAN_FRONTEND=noninteractive apt-get install git-lfs git lfs install USERNAME=baw_web # docker container now missing .bashrc by default. Useful for interactive situations /bin/cp /etc/skel/.bashrc "/home/$USERNAME/.bashrc" chown $USERNAME "/home/$USERNAME/.bashrc" SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \ && mkdir -p /commandhistory \ && chmod 777 /commandhistory \ && touch /commandhistory/.bash_history \ && chown -R $USERNAME /commandhistory \ && echo $SNIPPET >> "/home/$USERNAME/.bashrc" # we're generating some powershell scripts from the server, thus we need powershell to test them # currently this is dev time only dependency # https://docs.microsoft.com/en-us/powershell/scripting/install/install-debian?view=powershell-7.2 DEBIAN_FRONTEND=noninteractive apt-get install liblttng-ust0 -y PWSH_VERSION=7.2.0 cd ~ # https://github.com/PowerShell/PowerShell/releases/download/v7.2.0/powershell_7.2.0-1.deb_amd64.deb curl -LOJ https://github.com/PowerShell/PowerShell/releases/download/v$PWSH_VERSION/powershell_$PWSH_VERSION-1.deb_amd64.deb dpkg -i powershell_$PWSH_VERSION-1.deb_amd64.deb DEBIAN_FRONTEND=noninteractive apt-get install -f -y
#!/bin/bash # set -e # set -x cd $YARDSTICK_REPO_DIR echo '========================update code from local repo========================' # git pull lab master echo '========================update yardstick package========================' # pip install -U . # run the ansible yaml echo '========================run ansible========================' cd ansible # source /etc/yardstick/openstack.creds # ansible-playbook -i inventory.ini $1 ansible-playbook cmri_setup.yaml ansible-playbook -i inventory.ini cmri_test_5_1_2_10_1.yml -e network=ext-net ansible-playbook cmri_teardown.yaml
#!/bin/bash # timestamp: 1631108706414 npm dist-tag add @midwayjs/egg-layer@2.13.0 latest npm dist-tag add @midwayjs/egg-layer@2.13.1 beta npm dist-tag add @midwayjs/express-layer@2.13.0 latest npm dist-tag add @midwayjs/express-layer@2.13.1 beta npm dist-tag add @midwayjs/koa-layer@2.13.0 latest npm dist-tag add @midwayjs/koa-layer@2.13.1 beta npm dist-tag add @midwayjs/serverless-app@2.13.0 latest npm dist-tag add @midwayjs/serverless-app@2.13.1 beta npm dist-tag add @midwayjs/serverless-fc-starter@2.13.0 latest npm dist-tag add @midwayjs/serverless-fc-starter@2.13.1 beta npm dist-tag add @midwayjs/serverless-fc-trigger@2.13.0 latest npm dist-tag add @midwayjs/serverless-fc-trigger@2.13.1 beta npm dist-tag add @midwayjs/serverless-scf-trigger@2.13.0 latest npm dist-tag add @midwayjs/serverless-scf-trigger@2.13.1 beta npm dist-tag add @midwayjs/serverless-vercel-starter@2.13.0 latest npm dist-tag add @midwayjs/serverless-vercel-starter@2.13.1 beta npm dist-tag add @midwayjs/static-layer@2.13.0 latest npm dist-tag add @midwayjs/static-layer@2.13.1 beta npm dist-tag add @midwayjs/axios@2.13.0 latest npm dist-tag add @midwayjs/axios@2.13.1 beta npm dist-tag add @midwayjs/bootstrap@2.13.0 latest npm dist-tag add @midwayjs/bootstrap@2.13.1 beta npm dist-tag add @midwayjs/cache@2.13.0 latest npm dist-tag add @midwayjs/cache@2.13.1 beta npm dist-tag add @midwayjs/consul@2.13.0 latest npm dist-tag add @midwayjs/consul@2.13.1 beta npm dist-tag add @midwayjs/core@2.13.0 latest npm dist-tag add @midwayjs/core@2.13.1 beta npm dist-tag add @midwayjs/cos@2.13.0 latest npm dist-tag add @midwayjs/cos@2.13.1 beta npm dist-tag add @midwayjs/faas@2.13.0 latest npm dist-tag add @midwayjs/faas@2.13.1 beta npm dist-tag add @midwayjs/grpc@2.13.0 latest npm dist-tag add @midwayjs/grpc@2.13.1 beta npm dist-tag add midway-schedule@2.13.0 latest npm dist-tag add midway-schedule@2.13.1 beta npm dist-tag add midway@2.13.0 latest npm dist-tag add midway@2.13.1 beta npm dist-tag add @midwayjs/mock@2.13.0 latest npm dist-tag add @midwayjs/mock@2.13.1 beta npm dist-tag add @midwayjs/orm@2.13.0 latest npm dist-tag add @midwayjs/orm@2.13.1 beta npm dist-tag add @midwayjs/oss@2.13.0 latest npm dist-tag add @midwayjs/oss@2.13.1 beta npm dist-tag add @midwayjs/prometheus-socket-io@2.13.0 latest npm dist-tag add @midwayjs/prometheus-socket-io@2.13.1 beta npm dist-tag add @midwayjs/prometheus@2.13.0 latest npm dist-tag add @midwayjs/prometheus@2.13.1 beta npm dist-tag add @midwayjs/rabbitmq@2.13.0 latest npm dist-tag add @midwayjs/rabbitmq@2.13.1 beta npm dist-tag add @midwayjs/redis@2.13.0 latest npm dist-tag add @midwayjs/redis@2.13.1 beta npm dist-tag add @midwayjs/socketio@2.13.0 latest npm dist-tag add @midwayjs/socketio@2.13.1 beta npm dist-tag add @midwayjs/task@2.13.0 latest npm dist-tag add @midwayjs/task@2.13.1 beta npm dist-tag add @midwayjs/typegoose@2.13.0 latest npm dist-tag add @midwayjs/typegoose@2.13.1 beta npm dist-tag add @midwayjs/version@2.13.0 latest npm dist-tag add @midwayjs/version@2.13.1 beta npm dist-tag add @midwayjs/express@2.13.0 latest npm dist-tag add @midwayjs/express@2.13.1 beta npm dist-tag add @midwayjs/koa@2.13.0 latest npm dist-tag add @midwayjs/koa@2.13.1 beta npm dist-tag add @midwayjs/web@2.13.0 latest npm dist-tag add @midwayjs/web@2.13.1 beta npm dist-tag add @midwayjs/ws@2.13.0 latest npm dist-tag add @midwayjs/ws@2.13.1 beta tnpm dist-tag add @midwayjs/egg-layer@2.13.0 latest tnpm dist-tag add @midwayjs/egg-layer@2.13.1 beta tnpm dist-tag add @midwayjs/express-layer@2.13.0 latest tnpm dist-tag add @midwayjs/express-layer@2.13.1 beta tnpm dist-tag add @midwayjs/koa-layer@2.13.0 latest tnpm dist-tag add @midwayjs/koa-layer@2.13.1 beta tnpm dist-tag add @midwayjs/serverless-app@2.13.0 latest tnpm dist-tag add @midwayjs/serverless-app@2.13.1 beta tnpm dist-tag add @midwayjs/serverless-fc-starter@2.13.0 latest tnpm dist-tag add @midwayjs/serverless-fc-starter@2.13.1 beta tnpm dist-tag add @midwayjs/serverless-fc-trigger@2.13.0 latest tnpm dist-tag add @midwayjs/serverless-fc-trigger@2.13.1 beta tnpm dist-tag add @midwayjs/serverless-scf-trigger@2.13.0 latest tnpm dist-tag add @midwayjs/serverless-scf-trigger@2.13.1 beta tnpm dist-tag add @midwayjs/serverless-vercel-starter@2.13.0 latest tnpm dist-tag add @midwayjs/serverless-vercel-starter@2.13.1 beta tnpm dist-tag add @midwayjs/static-layer@2.13.0 latest tnpm dist-tag add @midwayjs/static-layer@2.13.1 beta tnpm dist-tag add @midwayjs/axios@2.13.0 latest tnpm dist-tag add @midwayjs/axios@2.13.1 beta tnpm dist-tag add @midwayjs/bootstrap@2.13.0 latest tnpm dist-tag add @midwayjs/bootstrap@2.13.1 beta tnpm dist-tag add @midwayjs/cache@2.13.0 latest tnpm dist-tag add @midwayjs/cache@2.13.1 beta tnpm dist-tag add @midwayjs/consul@2.13.0 latest tnpm dist-tag add @midwayjs/consul@2.13.1 beta tnpm dist-tag add @midwayjs/core@2.13.0 latest tnpm dist-tag add @midwayjs/core@2.13.1 beta tnpm dist-tag add @midwayjs/cos@2.13.0 latest tnpm dist-tag add @midwayjs/cos@2.13.1 beta tnpm dist-tag add @midwayjs/faas@2.13.0 latest tnpm dist-tag add @midwayjs/faas@2.13.1 beta tnpm dist-tag add @midwayjs/grpc@2.13.0 latest tnpm dist-tag add @midwayjs/grpc@2.13.1 beta tnpm dist-tag add midway-schedule@2.13.0 latest tnpm dist-tag add midway-schedule@2.13.1 beta tnpm dist-tag add midway@2.13.0 latest tnpm dist-tag add midway@2.13.1 beta tnpm dist-tag add @midwayjs/mock@2.13.0 latest tnpm dist-tag add @midwayjs/mock@2.13.1 beta tnpm dist-tag add @midwayjs/orm@2.13.0 latest tnpm dist-tag add @midwayjs/orm@2.13.1 beta tnpm dist-tag add @midwayjs/oss@2.13.0 latest tnpm dist-tag add @midwayjs/oss@2.13.1 beta tnpm dist-tag add @midwayjs/prometheus-socket-io@2.13.0 latest tnpm dist-tag add @midwayjs/prometheus-socket-io@2.13.1 beta tnpm dist-tag add @midwayjs/prometheus@2.13.0 latest tnpm dist-tag add @midwayjs/prometheus@2.13.1 beta tnpm dist-tag add @midwayjs/rabbitmq@2.13.0 latest tnpm dist-tag add @midwayjs/rabbitmq@2.13.1 beta tnpm dist-tag add @midwayjs/redis@2.13.0 latest tnpm dist-tag add @midwayjs/redis@2.13.1 beta tnpm dist-tag add @midwayjs/socketio@2.13.0 latest tnpm dist-tag add @midwayjs/socketio@2.13.1 beta tnpm dist-tag add @midwayjs/task@2.13.0 latest tnpm dist-tag add @midwayjs/task@2.13.1 beta tnpm dist-tag add @midwayjs/typegoose@2.13.0 latest tnpm dist-tag add @midwayjs/typegoose@2.13.1 beta tnpm dist-tag add @midwayjs/version@2.13.0 latest tnpm dist-tag add @midwayjs/version@2.13.1 beta tnpm dist-tag add @midwayjs/express@2.13.0 latest tnpm dist-tag add @midwayjs/express@2.13.1 beta tnpm dist-tag add @midwayjs/koa@2.13.0 latest tnpm dist-tag add @midwayjs/koa@2.13.1 beta tnpm dist-tag add @midwayjs/web@2.13.0 latest tnpm dist-tag add @midwayjs/web@2.13.1 beta tnpm dist-tag add @midwayjs/ws@2.13.0 latest tnpm dist-tag add @midwayjs/ws@2.13.1 beta # Changes: # - @midwayjs/egg-layer: 2.13.0 => 2.13.1 # - @midwayjs/express-layer: 2.13.0 => 2.13.1 # - @midwayjs/koa-layer: 2.13.0 => 2.13.1 # - @midwayjs/serverless-app: 2.13.0 => 2.13.1 # - @midwayjs/serverless-fc-starter: 2.13.0 => 2.13.1 # - @midwayjs/serverless-fc-trigger: 2.13.0 => 2.13.1 # - @midwayjs/serverless-scf-trigger: 2.13.0 => 2.13.1 # - @midwayjs/serverless-vercel-starter: 2.13.0 => 2.13.1 # - @midwayjs/static-layer: 2.13.0 => 2.13.1 # - @midwayjs/axios: 2.13.0 => 2.13.1 # - @midwayjs/bootstrap: 2.13.0 => 2.13.1 # - @midwayjs/cache: 2.13.0 => 2.13.1 # - @midwayjs/consul: 2.13.0 => 2.13.1 # - @midwayjs/core: 2.13.0 => 2.13.1 # - @midwayjs/cos: 2.13.0 => 2.13.1 # - @midwayjs/faas: 2.13.0 => 2.13.1 # - @midwayjs/grpc: 2.13.0 => 2.13.1 # - midway-schedule: 2.13.0 => 2.13.1 # - midway: 2.13.0 => 2.13.1 # - @midwayjs/mock: 2.13.0 => 2.13.1 # - @midwayjs/orm: 2.13.0 => 2.13.1 # - @midwayjs/oss: 2.13.0 => 2.13.1 # - @midwayjs/prometheus-socket-io: 2.13.0 => 2.13.1 # - @midwayjs/prometheus: 2.13.0 => 2.13.1 # - @midwayjs/rabbitmq: 2.13.0 => 2.13.1 # - @midwayjs/redis: 2.13.0 => 2.13.1 # - @midwayjs/socketio: 2.13.0 => 2.13.1 # - @midwayjs/task: 2.13.0 => 2.13.1 # - @midwayjs/typegoose: 2.13.0 => 2.13.1 # - @midwayjs/version: 2.13.0 => 2.13.1 # - @midwayjs/express: 2.13.0 => 2.13.1 # - @midwayjs/koa: 2.13.0 => 2.13.1 # - @midwayjs/web: 2.13.0 => 2.13.1 # - @midwayjs/ws: 2.13.0 => 2.13.1
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _ajaxClient = require('./ajaxClient'); var _ajaxClient2 = _interopRequireDefault(_ajaxClient); var _apiClient = require('./apiClient'); var _apiClient2 = _interopRequireDefault(_apiClient); var _webstoreClient = require('./webstoreClient'); var _webstoreClient2 = _interopRequireDefault(_webstoreClient); var _productCategories = require('./api/productCategories'); var _productCategories2 = _interopRequireDefault(_productCategories); var _products = require('./api/products/products'); var _products2 = _interopRequireDefault(_products); var _options = require('./api/products/options'); var _options2 = _interopRequireDefault(_options); var _optionValues = require('./api/products/optionValues'); var _optionValues2 = _interopRequireDefault(_optionValues); var _variants = require('./api/products/variants'); var _variants2 = _interopRequireDefault(_variants); var _images = require('./api/products/images'); var _images2 = _interopRequireDefault(_images); var _blogs = require('./api/blogs/blogs'); var _blogs2 = _interopRequireDefault(_blogs); var _images3 = require('./api/blogs/images'); var _images4 = _interopRequireDefault(_images3); var _pictures = require('./api/pictures/pictures'); var _pictures2 = _interopRequireDefault(_pictures); var _images5 = require('./api/pictures/images'); var _images6 = _interopRequireDefault(_images5); var _sitemap = require('./api/sitemap'); var _sitemap2 = _interopRequireDefault(_sitemap); var _theme = require('./api/theme/theme'); var _theme2 = _interopRequireDefault(_theme); var _settings = require('./api/theme/settings'); var _settings2 = _interopRequireDefault(_settings); var _assets = require('./api/theme/assets'); var _assets2 = _interopRequireDefault(_assets); var _placeholders = require('./api/theme/placeholders'); var _placeholders2 = _interopRequireDefault(_placeholders); var _customerGroups = require('./api/customerGroups'); var _customerGroups2 = _interopRequireDefault(_customerGroups); var _customers = require('./api/customers'); var _customers2 = _interopRequireDefault(_customers); var _ajaxCart = require('./api/ajaxCart'); var _ajaxCart2 = _interopRequireDefault(_ajaxCart); var _ajaxLogin = require('./api/ajaxLogin'); var _ajaxLogin2 = _interopRequireDefault(_ajaxLogin); var _ajaxRegister = require('./api/ajaxRegister'); var _ajaxRegister2 = _interopRequireDefault(_ajaxRegister); var _ajaxMessage = require('./api/ajaxMessage'); var _ajaxMessage2 = _interopRequireDefault(_ajaxMessage); var _ajaxUserRequest = require('./api/ajaxUserRequest'); var _ajaxUserRequest2 = _interopRequireDefault(_ajaxUserRequest); var _ajaxAccount = require('./api/ajaxAccount'); var _ajaxAccount2 = _interopRequireDefault(_ajaxAccount); var _ajaxForgotPassword = require('./api/ajaxForgotPassword'); var _ajaxForgotPassword2 = _interopRequireDefault(_ajaxForgotPassword); var _ajaxResetPassword = require('./api/ajaxResetPassword'); var _ajaxResetPassword2 = _interopRequireDefault(_ajaxResetPassword); var _orders = require('./api/orders/orders'); var _orders2 = _interopRequireDefault(_orders); var _discounts = require('./api/orders/discounts'); var _discounts2 = _interopRequireDefault(_discounts); var _transactions = require('./api/orders/transactions'); var _transactions2 = _interopRequireDefault(_transactions); var _items = require('./api/orders/items'); var _items2 = _interopRequireDefault(_items); var _statuses = require('./api/orders/statuses'); var _statuses2 = _interopRequireDefault(_statuses); var _shippingMethods = require('./api/shippingMethods'); var _shippingMethods2 = _interopRequireDefault(_shippingMethods); var _paymentMethods = require('./api/paymentMethods'); var _paymentMethods2 = _interopRequireDefault(_paymentMethods); var _paymentGateways = require('./api/paymentGateways'); var _paymentGateways2 = _interopRequireDefault(_paymentGateways); var _ajaxShippingMethods = require('./api/ajaxShippingMethods'); var _ajaxShippingMethods2 = _interopRequireDefault(_ajaxShippingMethods); var _ajaxPaymentMethods = require('./api/ajaxPaymentMethods'); var _ajaxPaymentMethods2 = _interopRequireDefault(_ajaxPaymentMethods); var _ajaxPaymentFormSettings = require('./api/ajaxPaymentFormSettings'); var _ajaxPaymentFormSettings2 = _interopRequireDefault(_ajaxPaymentFormSettings); var _countries = require('./api/countries'); var _countries2 = _interopRequireDefault(_countries); var _currencies = require('./api/currencies'); var _currencies2 = _interopRequireDefault(_currencies); var _text = require('./api/text'); var _text2 = _interopRequireDefault(_text); var _settings3 = require('./api/settings'); var _settings4 = _interopRequireDefault(_settings3); var _checkoutFields = require('./api/checkoutFields'); var _checkoutFields2 = _interopRequireDefault(_checkoutFields); var _pages = require('./api/pages'); var _pages2 = _interopRequireDefault(_pages); var _tokens = require('./api/tokens'); var _tokens2 = _interopRequireDefault(_tokens); var _redirects = require('./api/redirects'); var _redirects2 = _interopRequireDefault(_redirects); var _webhooks = require('./api/webhooks'); var _webhooks2 = _interopRequireDefault(_webhooks); var _files = require('./api/files'); var _files2 = _interopRequireDefault(_files); var _settings5 = require('./api/apps/settings'); var _settings6 = _interopRequireDefault(_settings5); var _account = require('./webstore/account'); var _account2 = _interopRequireDefault(_account); var _services = require('./webstore/services'); var _services2 = _interopRequireDefault(_services); var _serviceSettings = require('./webstore/serviceSettings'); var _serviceSettings2 = _interopRequireDefault(_serviceSettings); var _serviceActions = require('./webstore/serviceActions'); var _serviceActions2 = _interopRequireDefault(_serviceActions); var _serviceLogs = require('./webstore/serviceLogs'); var _serviceLogs2 = _interopRequireDefault(_serviceLogs); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Client = function Client() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, Client); this.apiBaseUrl = options.apiBaseUrl || '/api/v1'; this.apiToken = options.apiToken; this.ajaxBaseUrl = options.ajaxBaseUrl || '/ajax'; this.webstoreToken = options.webstoreToken; this.language = options.language || 'en-US,en;q=0.9,fa;q=0.8'; var apiClient = new _apiClient2.default({ baseUrl: this.apiBaseUrl, token: <PASSWORD>.apiToken, language: this.language }); var ajaxClient = new _ajaxClient2.default({ baseUrl: this.ajaxBaseUrl, language: this.language }); var webstoreClient = new _webstoreClient2.default({ token: this.webstoreToken }); this.products = new _products2.default(apiClient); this.products.options = new _options2.default(apiClient); this.products.options.values = new _optionValues2.default(apiClient); this.products.variants = new _variants2.default(apiClient); this.products.images = new _images2.default(apiClient); this.productCategories = new _productCategories2.default(apiClient); this.blogs = new _blogs2.default(apiClient); this.blogs.images = new _images4.default(apiClient); this.pictures = new _pictures2.default(apiClient); this.pictures.images = new _images6.default(apiClient); this.customers = new _customers2.default(apiClient); this.orders = new _orders2.default(apiClient); this.orders.discounts = new _discounts2.default(apiClient); this.orders.transactions = new _transactions2.default(apiClient); this.orders.items = new _items2.default(apiClient); this.orderStatuses = new _statuses2.default(apiClient); this.shippingMethods = new _shippingMethods2.default(apiClient); this.paymentMethods = new _paymentMethods2.default(apiClient); this.paymentGateways = new _paymentGateways2.default(apiClient); this.customerGroups = new _customerGroups2.default(apiClient); this.sitemap = new _sitemap2.default(apiClient); this.theme = new _theme2.default(apiClient); this.theme.settings = new _settings2.default(apiClient); this.theme.assets = new _assets2.default(apiClient); this.theme.placeholders = new _placeholders2.default(apiClient); this.countries = new _countries2.default(apiClient); this.currencies = new _currencies2.default(apiClient); this.text = new _text2.default(apiClient); this.settings = new _settings4.default(apiClient); this.checkoutFields = new _checkoutFields2.default(apiClient); this.pages = new _pages2.default(apiClient); this.tokens = new _tokens2.default(apiClient); this.redirects = new _redirects2.default(apiClient); this.webhooks = new _webhooks2.default(apiClient); this.files = new _files2.default(apiClient); this.apps = {}; this.apps.settings = new _settings6.default(apiClient); this.ajax = {}; this.ajax.blogs = new _blogs2.default(ajaxClient); this.ajax.pictures = new _pictures2.default(ajaxClient); this.ajax.products = new _products2.default(ajaxClient); this.ajax.sitemap = new _sitemap2.default(ajaxClient); this.ajax.cart = new _ajaxCart2.default(ajaxClient); this.ajax.login = new _ajaxLogin2.default(ajaxClient); this.ajax.register = new _ajaxRegister2.default(ajaxClient); this.ajax.message = new _ajaxMessage2.default(ajaxClient); this.ajax.userRequest = new _ajaxUserRequest2.default(ajaxClient); this.ajax.account = new _ajaxAccount2.default(ajaxClient); this.ajax.forgotPassword = new _ajaxForgotPassword2.default(ajaxClient); this.ajax.resetPassword = new _ajaxResetPassword2.default(ajaxClient); this.ajax.countries = new _countries2.default(ajaxClient); this.ajax.currencies = new _currencies2.default(ajaxClient); this.ajax.shippingMethods = new _ajaxShippingMethods2.default(ajaxClient); this.ajax.paymentMethods = new _ajaxPaymentMethods2.default(ajaxClient); this.ajax.paymentFormSettings = new _ajaxPaymentFormSettings2.default(ajaxClient); this.ajax.pages = new _pages2.default(ajaxClient); this.webstore = {}; this.webstore.account = new _account2.default(webstoreClient); this.webstore.services = new _services2.default(webstoreClient); this.webstore.services.settings = new _serviceSettings2.default(webstoreClient); this.webstore.services.actions = new _serviceActions2.default(webstoreClient); this.webstore.services.logs = new _serviceLogs2.default(webstoreClient); }; Client.authorize = function (baseUrl, email) { return _apiClient2.default.authorize(baseUrl, email); }; Client.authorizeInWebStore = function (email, adminUrl) { return _webstoreClient2.default.authorize(email, adminUrl); }; exports.default = Client;
<filename>javaSources/Miscellaneous/Quiz.java // public class Quiz { // public static void main(String[] args) { // Consider the following code snippet package com.greatlearning.oops; class Customer { private void getName() { System.out.println("Name of the customer is Harshit"); } private void getAge() { System.out.println("Age of the customer is 25 years"); } } class Main { public static void main(String args[]) { Customer customer = new Customer(); customer.getName(); customer.getAge(); } }
# wire bash completions to dstask completion engine. Some of the workarounds for # idiosyncrasies around separation with colons taken from /etc/bash_completion _dstask() { # reconstruct COMP_WORDS to re-join separations caused by colon (which is a default separator) # yes, this method ends up splitting by spaces, but that's not a problem for the dstask parser # see http://tiswww.case.edu/php/chet/bash/FAQ original_args=( $(echo "${COMP_WORDS[@]}" | sed 's/ : /:/g' | sed 's/ :$/:/g') ) # hand to dstask as canonical args COMPREPLY=( $(dstask _completions "${original_args[@]}") ) # convert dstask's suggestions to remove prefix before colon so complete can understand it local last_arg="${original_args[-1]}" local colon_word=${last_arg%"${last_arg##*:}"} local i=${#COMPREPLY[*]} while [[ $((--i)) -ge 0 ]]; do COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} done } complete -F _dstask dstask complete -F _dstask task #complete -F _dstask n #complete -F _dstask t
public enum PositionCornerTypes { BackSouthWest, BackSouthEast, BackNorthWest, BackNorthEast, FrontSouthWest, FrontSouthEast, FrontNorthWest, FrontNorthEast } public class StickerModelBase { // Implementation of StickerModelBase class } public class RubiksCubeStickerModel { public StickerModelBase StickerBack { get; set; } public StickerModelBase StickerSouth { get; set; } public PositionCornerTypes PositionCornerType { get; protected set; } = PositionCornerTypes.BackSouthWest; public void RotateCube(string direction) { if (direction == "clockwise") { PositionCornerType = (PositionCornerTypes)(((int)PositionCornerType + 1) % 8); } else if (direction == "counterclockwise") { PositionCornerType = (PositionCornerTypes)(((int)PositionCornerType + 7) % 8); } else { throw new ArgumentException("Invalid rotation direction. Please provide 'clockwise' or 'counterclockwise'."); } } }
#!/bin/bash # Run selected notebooks, on error show output and return with error code. # set environment export PYABC_MAX_POP_SIZE=20 # Notebooks to run nbs_1=( "adaptive_distances" "wasserstein" "conversion_reaction" "early_stopping" "model_selection" "noise" "parameter_inference" "resuming") nbs_2=( "external_simulators" "using_R" "aggregated_distances" "data_plots" "discrete_parameters") # All notebooks nbs_all=("${nbs_1[@]}" "${nbs_2[@]}") # Select which notebooks to run if [ $# -eq 0 ]; then nbs=("${nbs_all[@]}") elif [ $1 -eq 1 ]; then nbs=("${nbs_1[@]}") elif [ $1 -eq 2 ]; then nbs=("${nbs_2[@]}") else echo "Unexpected input: $1" fi # Notebooks repository dir="doc/examples" # Find uncovered notebooks for nb in `ls $dir | grep -E "ipynb"`; do missing=true for nb_cand in "${nbs_all[@]}"; do if [[ $nb == "${nb_cand}.ipynb" ]]; then missing=false continue fi done if $missing; then echo "Notebook $nb is not covered in tests." fi done run_notebook () { # Run a notebook and raise upon failure tempfile=$(tempfile) echo $@ jupyter nbconvert --ExecutePreprocessor.timeout=-1 --debug \ --stdout --execute --to markdown $@ &> $tempfile ret=$? if [[ $ret != 0 ]]; then cat $tempfile exit $ret fi rm $tempfile } # Run all notebooks in list echo "Run notebooks:" for notebook in "${nbs[@]}"; do time run_notebook $dir/$notebook done
#!/bin/bash #SBATCH --gres=gpu:2 #SBATCH --mail-type=ALL # required to send email notifcations #SBATCH --mail-user=aa8920@ic.ac.uk # required to send email notifcations - please replace <your_username> with your college login name or email address export PATH=/vol/bitbucket/aa8920/anaconda3/bin/:$PATH source activate source /vol/cuda/10.0.130/setup.sh TERM=vt100 # or TERM=xterm /usr/bin/nvidia-smi uptime conda activate a3c cd /vol/bitbucket/aa8920/OpenNMT-py onmt_train -config config/multi-gpu/opensubtitles_v2016_de_en_AC_transformer_actor_pretraining_2_GPU.yaml conda deactivate
python transformers/examples/language-modeling/run_language_modeling.py --model_name_or_path train-outputs/1024+0+512-shuffled-N/model --tokenizer_name model-configs/1536-config --eval_data_file ../data/wikitext-103-raw/wiki.valid.raw --output_dir eval-outputs/1024+0+512-shuffled-N/1024+0+512-shuffled-N-1 --do_eval --per_device_eval_batch_size 1 --dataloader_drop_last --augmented --augmentation_function shuffle_remove_all_but_nouns_first_two_thirds_full --eval_function last_element_eval
// MainActivity.java - in the onCreate method // Set up the location search LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); // Set up the adapter for the list view ArrayAdapter arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, restaurants); listView.setAdapter(arrayAdapter); // Fetch the restaurant list from an API public void getRestaurants() { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); // Read the response BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String response = ""; while((line = reader.readLine()) != null) { response += line; } // Parse the JSON JSONObject jsonObject = new JSONObject(response); JSONArray restaurantsArray = jsonObject.getJSONArray("restaurants"); // Add the restaurants to the array for (int i = 0; i < restaurantsArray.length(); i++) { restaurants.add(restaurantsArray.getString(i)); } }
import random import string def random_string(length): letters = string.ascii_letters return ''.join(random.choice(letters) for i in range(length)) random_str = random_string(10) print(random_str)
<gh_stars>1-10 import {html, render} from 'lit-html'; import ModalBase from './base'; export default class ModelDisclaimer extends ModalBase { constructor(depts){ super(depts); } template(){ return html` <div class="w3-modal-content"> ${this.header(this.t("disclaimerHeader"))} <div class="w3-container w3-padding"> ${this.t("disclaimerContent")} </div> </div> ` } }
<reponame>MateusTymoniuk/bootcamp-gostack-desafio-03 import * as Yup from 'yup'; import Delivery from '../models/Delivery'; import Recipient from '../models/Recipient'; import Deliveryman from '../models/Deliveryman'; import File from '../models/File'; import Queue from '../../lib/Queue'; import NewDeliveryMail from '../jobs/NewDeliveryMail'; class DeliveryController { async index(req, res) { const { page = 1 } = req.query; const deliveries = await Delivery.findAll({ include: [ { model: File, as: 'signature', attributes: ['name', 'path', 'url'], }, ], limit: 5, offset: (page - 1) * 5, }); return res.json(deliveries); } async store(req, res) { const schema = Yup.object().shape({ product: Yup.string().required(), recipient_id: Yup.number().required(), deliveryman_id: Yup.number().required(), }); if (!(await schema.isValid(req.body))) { return res.status(400).json({ error: 'Validation failed.' }); } const { recipient_id, deliveryman_id, product } = req.body; const recipient = await Recipient.findByPk(recipient_id); if (!recipient) { return res.status(400).json({ error: 'Recipient does not exist' }); } const deliveryman = await Deliveryman.findByPk(deliveryman_id); if (!deliveryman) { return res.status(400).json({ error: 'Deliveryman does not exist' }); } const delivery = await Delivery.create(req.body); await Queue.add(NewDeliveryMail.key, { deliveryman, recipient, product, }); return res.json(delivery); } async update(req, res) { const schema = Yup.object().shape({ product: Yup.string(), recipient_id: Yup.number(), deliveryman_id: Yup.number(), }); if (!(await schema.isValid(req.body))) { return res.status(400).json({ error: 'Validation failed.' }); } const { id } = req.params; const delivery = await Delivery.findByPk(id); if (!delivery) { return res.status(404).json({ error: 'Delivery not found' }); } const { recipient_id, deliveryman_id } = req.body; if (recipient_id) { const recipient = await Recipient.findByPk(recipient_id); if (!recipient) { return res.status(400).json({ error: 'Recipient does not exist' }); } } if (deliveryman_id) { const deliveryman = await Deliveryman.findByPk(deliveryman_id); if (!deliveryman) { return res.status(400).json({ error: 'Deliveryman does not exist' }); } } const updatedDelivery = await delivery.update(req.body); return res.json(updatedDelivery); } async delete(req, res) { const delivery = await Delivery.findByPk(req.params.id); if (!delivery) { return res.status(404).json({ error: 'Delivery not found.' }); } await delivery.destroy(); return res.json({ message: `Delivery ${delivery.id} deleted successfully`, }); } } export default new DeliveryController();
package com.decathlon.ara.service; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.mail.javamail.JavaMailSender; import org.thymeleaf.TemplateEngine; import static org.assertj.core.api.Assertions.assertThat; @RunWith(MockitoJUnitRunner.class) public class EmailServiceTest { @Mock private TemplateEngine templateEngine; @Mock private JavaMailSender emailSender; @InjectMocks private EmailService cut; @Test public void testCompressHtmlSpaces() { // GIVEN String html = "" + "<b>\n" + " \r\n" + " <i>html </i>\r\n" + " \r\n" + " \n\n\n" + " </b>"; // WHEN html = cut.compressHtmlSpaces(html); // THEN assertThat(html).isEqualTo("" + "<b>\n" + "<i>html </i>\n" + "</b>"); } }
#!/bin/bash sudo apt install -y gcc python3.6 python3.6-dev sudo apt-get install -y virtualenv python-dev libsasl2-dev libldap2-dev libssl-dev if [ ! -d "env36" ]; then virtualenv --python=/usr/bin/python3.6 env36 fi ROOT=$PWD env36/bin/pip install -r requirements.txt cd $ROOT/ava if [ ! -d "$ROOT/ava/dist-dev" ]; then ln -s $ROOT/../website-frontend/dist-dev $ROOT/ava/dist-dev fi mkdir dev-database mkdir dev-thumb $ROOT/env36/bin/python manage.py migrate $ROOT/env36/bin/python manage.py initialsetup $ROOT/env36/bin/python manage.py runserver 0.0.0.0:8000
<filename>AccessibilityInsightsForAndroidService/app/src/main/java/com/microsoft/accessibilityinsightsforandroidservice/AccessibilityInsightsForAndroidService.java<gh_stars>0 // Portions Copyright (c) Microsoft Corporation // Licensed under the MIT License. // // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.microsoft.accessibilityinsightsforandroidservice; import android.accessibilityservice.AccessibilityService; import android.accessibilityservice.AccessibilityServiceInfo; import android.content.Intent; import android.content.res.Configuration; import android.os.Handler; import android.os.HandlerThread; import android.util.DisplayMetrics; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import com.google.gson.GsonBuilder; public class AccessibilityInsightsForAndroidService extends AccessibilityService { private static final String TAG = "AccessibilityInsightsForAndroidService"; private final AxeScanner axeScanner; private final ATFAScanner atfaScanner; private final EventHelper eventHelper; private final DeviceConfigFactory deviceConfigFactory; private final OnScreenshotAvailableProvider onScreenshotAvailableProvider = new OnScreenshotAvailableProvider(); private final BitmapProvider bitmapProvider = new BitmapProvider(); private HandlerThread screenshotHandlerThread = null; private ScreenshotController screenshotController = null; private int activeWindowId = -1; // Set initial state to an invalid ID private FocusVisualizationStateManager focusVisualizationStateManager; private FocusVisualizer focusVisualizer; private FocusVisualizerController focusVisualizerController; private FocusVisualizationCanvas focusVisualizationCanvas; private AccessibilityEventDispatcher accessibilityEventDispatcher; private DeviceOrientationHandler deviceOrientationHandler; private TempFileProvider tempFileProvider; public AccessibilityInsightsForAndroidService() { deviceConfigFactory = new DeviceConfigFactory(); axeScanner = AxeScannerFactory.createAxeScanner(deviceConfigFactory, this::getRealDisplayMetrics); atfaScanner = ATFAScannerFactory.createATFAScanner(this); eventHelper = new EventHelper(new ThreadSafeSwapper<>()); } private DisplayMetrics getRealDisplayMetrics() { // Correct screen metrics are only accessible within the context of the running // service. They're not available when the service initializes, hence the callback return DisplayMetricsHelper.getRealDisplayMetrics(this); } private void stopScreenshotHandlerThread() { if (screenshotHandlerThread != null) { screenshotHandlerThread.quit(); screenshotHandlerThread = null; } screenshotController = null; } @Override protected void onServiceConnected() { Logger.logVerbose(TAG, "*** onServiceConnected"); AccessibilityServiceInfo info = new AccessibilityServiceInfo(); info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK; info.feedbackType = AccessibilityEvent.TYPES_ALL_MASK; info.notificationTimeout = 0; info.flags = AccessibilityServiceInfo.DEFAULT | AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS; setServiceInfo(info); stopScreenshotHandlerThread(); screenshotHandlerThread = new HandlerThread("ScreenshotHandlerThread"); screenshotHandlerThread.start(); Handler screenshotHandler = new Handler(screenshotHandlerThread.getLooper()); screenshotController = new ScreenshotController( this::getRealDisplayMetrics, screenshotHandler, onScreenshotAvailableProvider, bitmapProvider, MediaProjectionHolder::get); SynchronizedRequestDispatcher.SharedInstance.teardown(); tempFileProvider = new TempFileProvider(getApplicationContext()); tempFileProvider.cleanOldFilesBestEffort(); WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); focusVisualizationStateManager = new FocusVisualizationStateManager(); LayoutParamGenerator layoutParamGenerator = new LayoutParamGenerator(this::getRealDisplayMetrics); focusVisualizationCanvas = new FocusVisualizationCanvas(this); focusVisualizer = new FocusVisualizer(new FocusVisualizerStyles(), focusVisualizationCanvas); focusVisualizerController = new FocusVisualizerController(focusVisualizer, focusVisualizationStateManager, new UIThreadRunner(), windowManager, layoutParamGenerator, focusVisualizationCanvas, new DateProvider()); accessibilityEventDispatcher = new AccessibilityEventDispatcher(); deviceOrientationHandler = new DeviceOrientationHandler(getResources().getConfiguration().orientation); RootNodeFinder rootNodeFinder = new RootNodeFinder(); ResultsV2ContainerSerializer resultsV2ContainerSerializer = new ResultsV2ContainerSerializer( new ATFARulesSerializer(), new ATFAResultsSerializer(new GsonBuilder()), new GsonBuilder()); setupFocusVisualizationListeners(); RequestDispatcher requestDispatcher = new RequestDispatcher(rootNodeFinder, screenshotController, eventHelper, axeScanner, atfaScanner, deviceConfigFactory, focusVisualizationStateManager, resultsV2ContainerSerializer); SynchronizedRequestDispatcher.SharedInstance.setup(requestDispatcher); } private void setupFocusVisualizationListeners() { accessibilityEventDispatcher.addOnRedrawEventListener(focusVisualizerController::onRedrawEvent); accessibilityEventDispatcher.addOnFocusEventListener(focusVisualizerController::onFocusEvent); accessibilityEventDispatcher.addOnAppChangedListener(focusVisualizerController::onAppChanged); deviceOrientationHandler.subscribe(focusVisualizerController::onOrientationChanged); } @Override public boolean onUnbind(Intent intent) { Logger.logVerbose(TAG, "*** onUnbind"); SynchronizedRequestDispatcher.SharedInstance.teardown(); tempFileProvider.cleanOldFilesBestEffort(); stopScreenshotHandlerThread(); MediaProjectionHolder.cleanUp(); return false; } @Override public void onAccessibilityEvent(AccessibilityEvent event) { // debug for use //android.os.Debug.waitForDebugger(); accessibilityEventDispatcher.onAccessibilityEvent(event, getRootInActiveWindow()); // This logic ensures that we only track events from the active window, as // described under "Retrieving window content" of the Android service docs at // https://www.android-doc.com/reference/android/accessibilityservice/AccessibilityService.html int windowId = event.getWindowId(); int eventType = event.getEventType(); if (eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED || eventType == AccessibilityEvent.TYPE_VIEW_HOVER_ENTER || eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) { activeWindowId = windowId; } if (activeWindowId == windowId) { eventHelper.recordEvent(getRootInActiveWindow()); } if(event.getPackageName()!=null && event.getPackageName().toString().contains("twitter")) { Logger.logVerbose(TAG, "receive twitter event:" + event); this.startScreenshotActivity(); }else{ if(event.getPackageName()==null || (event.getPackageName().toString().contains("com.huawei.intelligent")|| (event.getPackageName().toString().contains("com.android.systemui")) ||(event.getPackageName().toString().contains("com.huawei.android.launcher") ))){ Logger.logVerbose(TAG, "not intercept event :" + event); }else { if(event.getPackageName().toString().contains("accessibilityinsightsforandroidservice")) { this.startScreenshotActivity(); Logger.logVerbose(TAG, "receive event:" + event); }else{ if(interceptCleanSettings(event)){ this.startScreenshotActivity(); Logger.logVerbose(TAG, "receive event:" + event); }else { Logger.logVerbose(TAG, "not intercept event:" + event); } } } } } /** * 当用户想要关闭 accessibility 的时候,需要拦截 * @param event * @return */ public boolean interceptCleanSettings(AccessibilityEvent event){ if(event.getPackageName()==null){ return false; } if(event.getClassName()==null){ return false; } if(event.getClassName().toString().contains("com.android.settings.CleanSubSettings")){ Logger.logVerbose(TAG,"needIntercept:"+event); if(event.getText()==null){ return false; } for(CharSequence charSequence:event.getText()){ if(charSequence.toString().contains("注意力守护神0.1")){ return true ; } } } return false; } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); this.deviceOrientationHandler.setOrientation(newConfig.orientation); } @Override public void onInterrupt() {} private void startScreenshotActivity() { Intent startScreenshot = new Intent(this, ScreenshotActivity.class); startScreenshot.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startScreenshot); } }
/* * Copyright 2016 Realm Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.realm; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import io.realm.entities.PrimaryKeyRequiredAsBoxedByte; import io.realm.entities.PrimaryKeyRequiredAsBoxedInteger; import io.realm.entities.PrimaryKeyRequiredAsBoxedLong; import io.realm.entities.PrimaryKeyRequiredAsBoxedShort; import io.realm.entities.PrimaryKeyRequiredAsString; import io.realm.objectid.NullPrimaryKey; import io.realm.rule.TestRealmConfigurationFactory; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @RunWith(Parameterized.class) public class RealmPrimaryKeyTests { @Rule public final TestRealmConfigurationFactory configFactory = new TestRealmConfigurationFactory(); protected Realm realm; @Before public void setUp() { RealmConfiguration realmConfig = configFactory.createConfiguration(); realm = Realm.getInstance(realmConfig); } @After public void tearDown() { if (realm != null) { realm.close(); } } /** * Base parameters for testing null/not-null primary key value. The parameters are aligned in an * order of 1) a test target class, 2) a primary key field class, 3) a primary Key value, 4) a * secondary field class, and 5) a secondary field value, accommodating {@interface NullPrimaryKey} * to condense unit tests. */ @Parameterized.Parameters public static Iterable<Object[]> data() { return Arrays.asList(new Object[][]{ // 1) Test target class 2) PK Class 3) PK value 4) 2nd Class 5) 2nd field value {PrimaryKeyRequiredAsString.class, String.class, "424123", String.class, "SomeSecondaryValue"}, {PrimaryKeyRequiredAsBoxedByte.class, Byte.class, Byte.valueOf("67"), String.class, "This-Is-Second-One"}, {PrimaryKeyRequiredAsBoxedShort.class, Short.class, Short.valueOf("1729"), String.class, "AnyValueIsAccepted"}, {PrimaryKeyRequiredAsBoxedInteger.class, Integer.class, Integer.valueOf("19"), String.class, "PlayWithSeondFied!"}, {PrimaryKeyRequiredAsBoxedLong.class, Long.class, Long.valueOf("62914"), String.class, "Let's name a value"} }); } final private Class<? extends RealmObject> testClazz; final private Class primaryKeyFieldType; final private Object primaryKeyFieldValue; final private Class secondaryFieldType; final private Object secondaryFieldValue; public RealmPrimaryKeyTests(Class<? extends RealmObject> testClazz, Class primaryKeyFieldType, Object primaryKeyFieldValue, Class secondaryFieldType, Object secondaryFieldValue) { this.testClazz = testClazz; this.primaryKeyFieldType = primaryKeyFieldType; this.primaryKeyFieldValue = primaryKeyFieldValue; this.secondaryFieldType = secondaryFieldType; this.secondaryFieldValue = secondaryFieldValue; } // @PrimaryKey + @Required annotation accept not-null value properly as a primary key value for Realm version 0.89.1+. @Test public void copyToRealmOrUpdate_requiredPrimaryKey() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { RealmObject obj = (RealmObject)testClazz.getConstructor(primaryKeyFieldType, secondaryFieldType).newInstance(primaryKeyFieldValue, secondaryFieldValue); realm.beginTransaction(); realm.copyToRealmOrUpdate(obj); realm.commitTransaction(); RealmResults results = realm.where(testClazz).findAll(); assertEquals(1, results.size()); assertEquals(primaryKeyFieldValue, ((NullPrimaryKey)results.first()).getId()); assertEquals(secondaryFieldValue, ((NullPrimaryKey)results.first()).getName()); } // @PrimaryKey + @Required annotation does accept null as a primary key value for Realm version 0.89.1+. @Test public void copyToRealmOrUpdate_requiredPrimaryKeyThrows() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { RealmObject obj = (RealmObject)testClazz.getConstructor(primaryKeyFieldType, secondaryFieldType).newInstance(null, null); realm.beginTransaction(); try { realm.copyToRealmOrUpdate(obj); fail("@PrimaryKey + @Required field cannot be null"); } catch (RuntimeException expected) { if (testClazz.equals(PrimaryKeyRequiredAsString.class)) { assertTrue(expected instanceof IllegalArgumentException); } else { assertTrue(expected instanceof NullPointerException); } } finally { realm.cancelTransaction(); } } // @PrimaryKey + @Required annotation does not accept null as a primary key value for Realm version 0.89.1+. @Test public void createObject_nullPrimaryKeyValueThrows() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { realm.beginTransaction(); try { realm.createObject(testClazz, null); fail("@PrimaryKey + @Required field cannot be null"); } catch (RuntimeException expected) { assertTrue(expected instanceof IllegalArgumentException); } finally { realm.cancelTransaction(); } } }
/** * Parse given time into a date in ms. * * @param {Date|Number|String} time * @return {Number} * @api private */ module.exports = time => { return typeof time === 'number' ? time : Date.parse(time) }
<reponame>antonjb/apple-news-format /** * Signature/interface for a `TableColumnSelector` object * @see https://developer.apple.com/documentation/apple_news/tablecolumnselector */ export interface TableColumnSelector { columnIndex?: number; // Integer descriptor?: string; odd?: boolean; even?: boolean; }
<gh_stars>0 import { NextPage } from "next"; import Head from "next/head"; import NavbarComponent from "../components/NavbarComponent"; const AboutPage: NextPage = () => { return ( <> <Head> <title>About | Simple Chatapp</title> </Head> <div className="flex flex-col"> <header> <NavbarComponent /> </header> <br /> <main className="flex-grow container px-2 lg:mx-auto"> <div> <p className="text-bold">This project was made with</p> <ul className="list-disc mx-5"> <li>Socket.io</li> <li>Express</li> <li>Typescript</li> <li>Tailwind</li> <li>Lerna</li> <li>Yarn Workspaces</li> </ul> <p>Simple-Chatapp October 2021</p> </div> </main> </div> </> ); }; export default AboutPage;
#!/bin/bash # Exit on error set -e cUsage="Usage: ${BASH_SOURCE[0]} <version>" if [ "$#" -lt 1 ] ; then echo $cUsage exit fi version=$1 echo "Checking for elevated privileges..." if [ ${EUID:-$(id -u)} -ne 0 ] ; then sudo echo "Script can elevate privileges." fi # Get number of cpu cores num_cpus=$(grep -c ^processor /proc/cpuinfo) package_name=cmake # Create temp dir for installation temp_dir=/tmp/${package_name}-installation mkdir -p $temp_dir cd $temp_dir # Download source tar_filename=cmake-${version}.tar.gz curl -fsSL https://github.com/Kitware/CMake/releases/download/v${version}/${tar_filename} -o ${tar_filename} tar xzf ${tar_filename} cd cmake-${version} # Build ./bootstrap make -j${num_cpus} # Install if [ ${EUID:-$(id -u)} -ne 0 ] ; then sudo make install else make install fi # Clean up rm -rf $temp_dir
<filename>src/main/java/com/qdynasty/model/User.java<gh_stars>0 /** * */ package com.qdynasty.model; import lombok.Data; /** * @author fei.qin * */ @Data public class User { private String username; private String password; private String code; }
package analytics import java.time.ZonedDateTime import java.time.format.DateTimeFormatter import spray.json._ trait Scaffolding { /** +--------------------------+------------------+--------------------------+----------------- |2016-01-01:01:01:26:source|..-01:01:01:26:...|2016-01-01:01:01:29:source|..-01:01:01:29:.. +-----------------------+--------------------------+------------------+--------------------------+----------------- |324234-34523:2016-01-01| | | | +-----------------------+--------------------------+------------------+--------------------------+----------------- +------+------+------+-- |offset|offset|offset| +----------+------+------+------+-- |readings:1| 135 | 245 | 442 | +----------+------+------+------+-- +------+------+------+-- |offset|offset|offset| +----------+------+------+------+-- |readings:2| 132 | 275 | 472 | +----------+------+------+------+-- */ val keySpace = "aggregates" val maTable = "moving_average" val createMaTable = s"""CREATE TABLE IF NOT EXISTS ${keySpace}.${maTable} ( | device_id varchar, | time_bucket varchar, | source varchar, | when timestamp, | startOffset bigint, | endOffset bigint, | value double, | PRIMARY KEY ((device_id, time_bucket), when)) WITH CLUSTERING ORDER BY (when DESC);""".stripMargin val offsetsTable = "kafka_offsets" val createOffsetsTable = s"""CREATE TABLE IF NOT EXISTS ${keySpace}.${offsetsTable} ( | topic varchar, | partition int, | offset bigint, | PRIMARY KEY ((topic, partition)));""".stripMargin val InsertOffset = s"UPDATE ${keySpace}.${offsetsTable} SET offset = ? where topic = ? and partition = ?" val InsertReading = s"INSERT INTO ${keySpace}.${maTable}(device_id, time_bucket, source, when, startOffset, endOffset, value) values (?,?,?,?,?,?,?)" val chDir = "checkpoint-ma" val timeBucketFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") def murmur2Partitioner(kafkaNumPartitions: Int) = new org.apache.spark.Partitioner { import org.apache.kafka.common.utils.Utils private def toPositive(number: Int) = number & 0x7fffffff override val numPartitions = kafkaNumPartitions override def getPartition(key: Any): Int = toPositive(Utils.murmur2(key.asInstanceOf[String].getBytes)) % numPartitions override val toString = "murmur2" } case class Reading(deviceId: String, current: Double, currentAlert: Double, when: ZonedDateTime, name: String, `type`: String, state: String) implicit object ReadingJsonReader extends JsonReader[Reading] with DefaultJsonProtocol { val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss Z") override def read(json: JsValue): Reading = json.asJsObject.getFields("device_id", "name", "timestamp", "state", "current_alert", "type", "current") match { case Seq(JsString(id), JsString(name), JsString(timestamp), JsString(state), JsNumber(currentAlert), JsString(type0), JsNumber(current)) => new Reading(id, current.toDouble, currentAlert.toDouble, ZonedDateTime.parse(timestamp, formatter), name, type0, state) case _ => deserializationError("Reading deserializationError") } } }
def least_common_ancestor(root, node1, node2): # Check if either node is the root if root is None or root == node1 or root == node2: return root # Traverse the tree recursively left_subtree = least_common_ancestor(root.left, node1, node2) right_subtree = least_common_ancestor(root.right, node1, node2) # If both nodes are in left subtree or right subtree, # return the non-null value if left_subtree is not None and right_subtree is not None: return root # Otherwise, return the non-null value if left_subtree is None: return right_subtree else: return left_subtree
#!/bin/sh # This script allows you to import ssm parameters through a json file (see ssm-parameters-dev.json for example). # Create a json file for each specific environment in which you need parameters. # NOTE: This script uses jq, make sure it is installed on your system env=$1 if [ -z "$env" ]; then echo "env required" exit fi script_dir=$( cd $(dirname $0) pwd ) parameters=$(cat $script_dir/ssm-parameters-$env.json) len=$(echo $parameters | jq length) for i in $(seq 0 $(($len - 1))); do parameter=$(echo $parameters | jq .[$i]) Type=$(echo $parameter | jq -r .Type) Name=$(echo $parameter | jq -r .Name) Value=$(echo $parameter | jq -r .Value) aws ssm put-parameter --type $Type --name $Name --value $Value done
def removeElementAtIndex(arr, index): new_arr = [] for i in range(len(arr)): if i != index: new_arr.append(arr[i]) return new_arr arr = [3, 6, 5] res = removeElementAtIndex(arr, 2) print(res)
// // MacroDef_App.h // UBallLive // // Created by Jobs on 2020/10/30. // #ifndef MacroDef_App_h #define MacroDef_App_h #define debug 1//是否显示debug控件 static NSString *userInfoKey = @"userinfoKey"; static NSString *PostDraftURLKey = @"PostDraftURL"; static NSString *authorizationKey = @"Authorization"; static NSString *userIdKey = @"userIdKey"; static CGFloat ActiveUserTime = 60 * 10;//10mins 活跃用户 #define AppVersion @"100010017" #define categoryTitleViewHeight 50 #define Margin_collectionView 12 #define Margin_itemX 15 #define Margin_itemY 12 #define JXTableHeaderViewHeight 290 #define MatchScheduleDetailTableHeaderViewHeight 250 /// 播放器view的tag,列表中UI控件唯一tag值 #define kPlayerViewTag 189 #define HQAPPSTRING @"itms-services://?action=download-manifest&url=https://bt.5li2v2.com/channel/ios/hqbetgame_201_6215472_202009132133_4712.plist" #define NODATA @"暂无数据" #define AppMainCor_01 RGB_COLOR(46, 51, 77) #define AppMainCor_02 RGB_SAMECOLOR(247) #define AppMainCor_03 HEXCOLOR(0xFAFAFA) #define AppMainCor_04 RGB_COLOR(132, 134, 140) #define AppMainCor_05 RGB_SAMECOLOR(153)// #define AppMainCor_06 HEXCOLOR(0xf8f8f8) #define AppMainCor_07 RGB_COLOR(247, 131, 97) #define AppMainCor_08 RGB_COLOR(245, 75, 100) #define AppMainCor_09 RGB_COLOR(92, 130, 178) #define AppMainCor_10 RGB_COLOR(149, 97, 19) #define AppMainCor_11 RGB_COLOR(255, 109, 44) #define AppMainCor_12 RGB_COLOR(131, 145, 175) #define AppMainCor_13 RGB_COLOR(245, 86, 100) #define AppMainCor_14 RGB_COLOR(143, 143, 148) #define AppMainCor_15 RGB_SAMECOLOR(58) #define AppMainCor_16 RGB_SAMECOLOR(130) #define AppMainCor_17 RGB_COLOR(132, 36, 23) #define AppMainCor_18 RGB_COLOR(62, 66, 101) #define AppMainCor_19 RGB_SAMECOLOR(155) #define AppMainCor_20 HEXCOLOR(0xF7F7F7) #define AppLightGrayCor HEXCOLOR(0xCCCCCC) //输入原型图上的宽和高,对外输出App对应的移动设备的真实宽高 #define KWidth(width) (MIN(SCREEN_WIDTH, SCREEN_HEIGHT) / 375) * (width) //375 对应原型图的宽 #define KHeight(height) (SCREEN_HEIGHT / 743) * (height) //743 对应原型图的高 #define isiPhoneX_seriesBottom 34 #define isiPhoneX_seriesTop 44 #define KDownChannelUrl @"https://www.doudong999.cn/" #define KDownChannelStr @"doudong" #endif /* MacroDef_App_h */
#!/bin/bash while getopts ":hs:v:i:d:p:f:" option do case "${option}" in h) echo ' Options: -v GEANT_VERSION. -i Docker image. Ex: test/geant4:10.06.p01 -d Install data [ON|OFF]. Default ON -f Dockerfile. Default: Dockerfile ' && exit;; v) GEANT_VERSION=${OPTARG};; i) DOCKER_IMAGE=${OPTARG};; p) PARALLEL=${OPTARG};; f) DOCKERFILE=${OPTARG};; esac done #Install data if not specified if [ -z $DOCKER_IMAGE ]; then echo "DOCKER_IMAGE param is required" exit 1 fi #Set latest version if not defined if [ -z $GEANT_VERSION ]; then GEANT_VERSION=10.06.p01 fi #Install data if not specified if [ -z $INSTALL_DATA ]; then INSTALL_DATA=ON fi if [ -z $DOCKERFILE ]; then DOCKERFILE=Dockerfile fi #GET number of CPU cores if [ -z $PARALLEL ]; then PARALLEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l) fi docker build -t $DOCKER_IMAGE \ --build-arg GEANT_VERSION=$GEANT_VERSION \ --build-arg PARALLEL=$PARALLEL \ --build-arg INSTALL_DATA=$INSTALL_DATA -f $DOCKERFILE .
#!/bin/sh INPUT_DIR=$1 OUTPUT_DIR=$2 STORM_HOME=/opt/storm/build/bin STORM_BIN=storm TASK_ID=`cat task.id` STORM_CONTAINER="storm$TASK_ID" if [ -e timedata.txt ] then exec_start_time=`date +"%Y-%m-%d %H:%M:%S.%3N"` sed -i "s/EXEC_START_TIME/$exec_start_time/" ./timedata.txt fi sh $INPUT_DIR/run.sh $INPUT_DIR $OUTPUT_DIR $STORM_HOME $STORM_BIN $STORM_CONTAINER if [ -e timedata.txt ] then exec_end_time=`date +"%Y-%m-%d %H:%M:%S.%3N"` sed -i "s/EXEC_END_TIME/$exec_end_time/" ./timedata.txt cp ./timedata.txt $OUTPUT_DIR/timedata.txt fi # --- EOF ---
class ApplicationController < ActionController::Base helper_method :current_user, :require_login def current_user if session[:user_id].present? user ||= User.find_by(id: session[:user_id]) end end def require_login unless current_user redirect_to root_url end end end
const custom = require('./custom-js/custom.js') const custom2 = require('./custom-js/custom2.js')
package me.batizhao.ims.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import me.batizhao.ims.api.domain.Menu; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.List; /** * @author batizhao * @since 2020-02-26 */ @Mapper public interface MenuMapper extends BaseMapper<Menu> { /** * 通过角色ID查询菜单 * @param roleId 角色ID * @return */ @Select("SELECT A.* FROM menu A LEFT JOIN role_menu B ON A.id = B.menuId WHERE B.roleId = #{id}") List<Menu> findMenusByRoleId(Long roleId); }
#! /bin/bash #=================================================================================== # Name: mk_ubunut_vm.sh # Created by: Mick Miller # Created on: 2020-11-17 #=================================================================================== # set -e clear # Read command line args if [[ "${#}" -ne 1 ]]; then echo echo =========================================================================== echo Usage: "${0}" the pass in a name for you VM on the command line. echo =========================================================================== echo exit 1 fi KVM_NAME="${1}" make_vm() { echo echo =========================================================================== echo Building VM... "${1}" echo =========================================================================== echo virt-install \ --name "${KVM_NAME}" \ --ram 4096 \ --disk path=/data-1/vm-images/"${KVM_NAME}".img,size=50 \ --vcpus 2 \ --virt-type kvm \ --os-type linux \ --os-variant rhel8.0 \ --graphics none \ --console pty,target_type=serial \ --location '/data-1/vm-images/iso/CentOS-8.2.2004-x86_64-dvd1.iso' \ --extra-args 'console=tty0 console=ttyS0,115200n8' \ --network bridge=br0 } # main make_vm
<gh_stars>0 'use strict'; const gulp = require('gulp'); const config = require('../config.js'); const mergeStream = require('merge-stream'); var plugins = require('gulp-load-plugins')(); gulp.task('images', function () { var streams = config.bundles.filter(function (b) { return b.images != null; }).map(function (b) { var ignores = b.ignorePlugins != null ? b.ignorePlugins : []; var useImagemin = ignores.indexOf("imagemin") == -1; return gulp.src(b.images) .pipe(plugins.plumber(config.errorHandler("images"))) .pipe(plugins.if(useImagemin, plugins.imagemin({ optimizationLevel: config.imagesOptimizationLevel, progressive: config.imagesProgressive, interlaced: config.imagesInterlaced }))) .pipe(gulp.dest(config.imagesDist)); }); return mergeStream(streams); });
#!/bin/bash # # Copyright (c) 2019-2020 P3TERX <https://p3terx.com> # # This is free software, licensed under the MIT License. # See /LICENSE for more information. # # https://github.com/P3TERX/Actions-OpenWrt # File name: diy-part2.sh # Description: OpenWrt DIY script part 2 (After Update feeds) # # Modify default IP sed -i 's/192.168.1.1/192.168.2.1/g' package/base-files/files/bin/config_generate # Add luci-app-ssr-plus pushd package/lean git clone --depth=1 https://github.com/fw876/helloworld popd # Clone community packages to package/community mkdir package/community pushd package/community # Add Lienol's Packages git clone --depth=1 https://github.com/Lienol/openwrt-package # Add luci-app-passwall git clone --depth=1 https://github.com/xiaorouji/openwrt-passwall # Add luci-app-vssr <M> git clone --depth=1 https://github.com/jerrykuku/lua-maxminddb.git git clone --depth=1 https://github.com/jerrykuku/luci-app-vssr # Add mentohust & luci-app-mentohust git clone --depth=1 https://github.com/BoringCat/luci-app-mentohust git clone --depth=1 https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk # Add minieap & luci-proto-minieap git clone --depth=1 https://github.com/ysc3839/luci-proto-minieap svn co https://github.com/immortalwrt/immortalwrt/branches/openwrt-18.06-k5.4/package/ntlf9t/minieap # Add ServerChan git clone --depth=1 https://github.com/tty228/luci-app-serverchan # Add OpenClash git clone --depth=1 -b master https://github.com/vernesong/OpenClash # Add luci-app-onliner (need luci-app-nlbwmon) git clone --depth=1 https://github.com/rufengsuixing/luci-app-onliner # Add luci-app-adguardhome git clone --depth=1 https://github.com/SuLingGG/luci-app-adguardhome # Add luci-app-diskman git clone --depth=1 https://github.com/SuLingGG/luci-app-diskman mkdir parted cp luci-app-diskman/Parted.Makefile parted/Makefile # Add luci-app-dockerman rm -rf ../lean/luci-app-docker git clone --depth=1 https://github.com/KFERMercer/luci-app-dockerman git clone --depth=1 https://github.com/lisaac/luci-lib-docker # Add luci-app-gowebdav svn co https://github.com/immortalwrt/luci/branches/openwrt-18.06/applications/luci-app-gowebdav svn co https://github.com/immortalwrt/packages/branches/openwrt-18.06/net/gowebdav # Add luci-theme-argon git clone --depth=1 -b 18.06 https://github.com/jerrykuku/luci-theme-argon git clone --depth=1 https://github.com/jerrykuku/luci-app-argon-config rm -rf ../lean/luci-theme-argon # Use immortalwrt's luci-app-netdata rm -rf ../lean/luci-app-netdata svn co https://github.com/immortalwrt/immortalwrt/branches/openwrt-18.06-k5.4/package/ntlf9t/luci-app-netdata # Add tmate svn co https://github.com/immortalwrt/packages/branches/openwrt-18.06/net/tmate svn co https://github.com/immortalwrt/packages/branches/openwrt-18.06/libs/msgpack-c # Add subconverter git clone --depth=1 https://github.com/tindy2013/openwrt-subconverter # Add gotop svn co https://github.com/immortalwrt/packages/branches/openwrt-18.06/admin/gotop # Add smartdns svn co https://github.com/pymumu/smartdns/trunk/package/openwrt ../smartdns svn co https://github.com/immortalwrt/immortalwrt/branches/openwrt-18.06-k5.4/package/ntlf9t/luci-app-smartdns ../luci-app-smartdns # Add luci-udptools git clone --depth=1 https://github.com/zcy85611/openwrt-luci-kcp-udp # Add OpenAppFilter git clone --depth=1 https://github.com/destan19/OpenAppFilter # Add luci-app-oled (R2S Only) git clone --depth=1 https://github.com/NateLol/luci-app-oled # Add driver for rtl8821cu & rtl8812au-ac svn co https://github.com/immortalwrt/immortalwrt/branches/openwrt-18.06/package/kernel/rtl8812au-ac svn co https://github.com/immortalwrt/immortalwrt/branches/openwrt-18.06/package/kernel/rtl8821cu svn co https://github.com/immortalwrt/immortalwrt/branches/openwrt-18.06/package/kernel/rtl88x2bu popd # Add netdata pushd feeds/packages/admin rm -rf netdata svn co https://github.com/immortalwrt/packages/branches/openwrt-18.06/admin/netdata popd # Mod zzz-default-settings pushd package/lean/default-settings/files sed -i '/http/d' zzz-default-settings export orig_version="$(cat "zzz-default-settings" | grep DISTRIB_REVISION= | awk -F "'" '{print $2}')" sed -i "s/${orig_version}/${orig_version} ($(date +"%Y-%m-%d"))/g" zzz-default-settings popd # Fix libssh pushd feeds/packages/libs rm -rf libssh svn co https://github.com/openwrt/packages/trunk/libs/libssh popd # Use Lienol's https-dns-proxy package pushd feeds/packages/net rm -rf https-dns-proxy svn co https://github.com/Lienol/openwrt-packages/trunk/net/https-dns-proxy popd # Use snapshots syncthing package pushd feeds/packages/utils rm -rf syncthing svn co https://github.com/openwrt/packages/trunk/utils/syncthing popd # Fix mt76 wireless driver pushd package/kernel/mt76 sed -i '/mt7662u_rom_patch.bin/a\\techo mt76-usb disable_usb_sg=1 > $\(1\)\/etc\/modules.d\/mt76-usb' Makefile popd # Change default shell to zsh sed -i 's/\/bin\/ash/\/usr\/bin\/zsh/g' package/base-files/files/etc/passwd # 修复核心及添加温度显示 sed -i 's|pcdata(boardinfo.system or "?")|luci.sys.exec("uname -m") or "?"|g' feeds/luci/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm sed -i 's/or "1"%>/or "1"%> ( <%=luci.sys.exec("expr `cat \/sys\/class\/thermal\/thermal_zone0\/temp` \/ 1000") or "?"%> \&#8451; ) /g' feeds/luci/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm # 加入 luci-app-freq pushd package/lean/ rm -rf luci-app-cpufreq svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/lean/luci-app-cpufreq package/lean/luci-app-cpufreq popd
#include <iostream> #include <string> #include <unordered_map> struct EmployeeInfo { std::string name; int employeeID; double salary; }; class EmployeeManager { private: std::unordered_map<int, EmployeeInfo> employeeMap; public: void addEmployee(const std::string& name, int employeeID, double salary) { EmployeeInfo newEmployee = {name, employeeID, salary}; employeeMap[employeeID] = newEmployee; } void updateSalary(int employeeID, double newSalary) { if (employeeMap.find(employeeID) != employeeMap.end()) { employeeMap[employeeID].salary = newSalary; } else { std::cout << "Employee with ID " << employeeID << " not found." << std::endl; } } void retrieveEmployeeInfo(int employeeID) { if (employeeMap.find(employeeID) != employeeMap.end()) { EmployeeInfo& employee = employeeMap[employeeID]; std::cout << "Name: " << employee.name << std::endl; std::cout << "Employee ID: " << employee.employeeID << std::endl; std::cout << "Salary: " << employee.salary << std::endl; } else { std::cout << "Employee with ID " << employeeID << " not found." << std::endl; } } }; int main() { EmployeeManager manager; // Adding new employees manager.addEmployee("John Doe", 1001, 50000.0); manager.addEmployee("Jane Smith", 1002, 60000.0); // Updating employee salary manager.updateSalary(1001, 55000.0); // Retrieving employee information manager.retrieveEmployeeInfo(1001); manager.retrieveEmployeeInfo(1003); // Non-existent employee return 0; }
<filename>v15.4/app/modules/DataRef/action.js export const changeData = () => ({type: 'changeData'});
<reponame>ibara/elvish package core import "sync" // State wraps RawState, providing methods for concurrency-safe access. The // getter methods also paper over nil values to make the empty State value more // usable. Direct field access is also allowed but must be explicitly // synchronized. type State struct { Raw RawState Mutex sync.RWMutex } // Returns a copy of the raw state, and set s.Raw.Notes = nil. Used for // retrieving the state for rendering. func (s *State) popForRedraw() *RawState { s.Mutex.Lock() defer s.Mutex.Unlock() raw := s.Raw s.Raw.Notes = nil return &raw } // Returns a finalized State, intended for use in the final redraw. func (s *State) finalize() *RawState { s.Mutex.RLock() defer s.Mutex.RUnlock() return &RawState{basicMode{}, s.Raw.Code, len(s.Raw.Code), nil, s.Raw.Notes} } // Mode returns the current mode. If the internal mode value is nil, it returns // a default Mode implementation. func (s *State) Mode() Mode { s.Mutex.RLock() defer s.Mutex.RUnlock() return getMode(s.Raw.Mode) } func getMode(m Mode) Mode { if m == nil { return basicMode{} } return m } // Code returns the code. func (s *State) Code() string { s.Mutex.RLock() defer s.Mutex.RUnlock() return s.Raw.Code } // CodeAndDot returns the code and dot of the state. func (s *State) CodeAndDot() (string, int) { s.Mutex.RLock() defer s.Mutex.RUnlock() return s.Raw.Code, s.Raw.Dot } // CodeBeforeDot returns the part of code before the dot. func (s *State) CodeBeforeDot() string { s.Mutex.RLock() defer s.Mutex.RUnlock() return s.Raw.Code[:s.Raw.Dot] } // CodeAfterDot returns the part of code after the dot. func (s *State) CodeAfterDot() string { s.Mutex.RLock() defer s.Mutex.RUnlock() return s.Raw.Code[s.Raw.Dot:] } // AddNote adds a note. func (s *State) AddNote(note string) { s.Mutex.Lock() defer s.Mutex.Unlock() s.Raw.Notes = append(s.Raw.Notes, note) } // Reset resets the internal state to an empty value. func (s *State) Reset() { s.Mutex.Lock() defer s.Mutex.Unlock() s.Raw = RawState{} } // RawState contains all the state of the editor. type RawState struct { // The current mode. Mode Mode // The current content of the input buffer. Code string // The position of the cursor, as a byte index into Code. Dot int // Pending code, if any, such as during completion. Pending *PendingCode // Notes that have been added since the last redraw. Notes []string } // PendingCode represents pending code, such as during completion. type PendingCode struct { // Beginning index of the text area that the pending code replaces, as a // byte index into RawState.Code. Begin int // End index of the text area that the pending code replaces, as a byte // index into RawState.Code. End int // The content of the pending code. Text string }
#!/bin/bash ################################################################################ # 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 # # https://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 "${BASH_SOURCE[0]}" )" && pwd )" # shellcheck source=sbin/common/constants.sh source "$SCRIPT_DIR/../../sbin/common/constants.sh" export ANT_HOME=/cygdrive/C/Projects/OpenJDK/apache-ant-1.10.1 export ALLOW_DOWNLOADS=true export LANG=C export OPENJ9_NASM_VERSION=2.13.03 TOOLCHAIN_VERSION="" # Any version above 8 (11 for now due to openjdk-build#1409 if [ "$JAVA_FEATURE_VERSION" -gt 11 ]; then BOOT_JDK_VERSION="$((JAVA_FEATURE_VERSION-1))" BOOT_JDK_VARIABLE="JDK$(echo $BOOT_JDK_VERSION)_BOOT_DIR" if [ ! -d "$(eval echo "\$$BOOT_JDK_VARIABLE")" ]; then bootDir="$PWD/jdk-$BOOT_JDK_VERSION" # Note we export $BOOT_JDK_VARIABLE (i.e. JDKXX_BOOT_DIR) here # instead of BOOT_JDK_VARIABLE (no '$'). export ${BOOT_JDK_VARIABLE}="$bootDir" if [ ! -d "$bootDir/bin" ]; then echo "Downloading GA release of boot JDK version ${BOOT_JDK_VERSION}..." releaseType="ga" # This is needed to convert x86-32 to x32 which is what the API uses case "$ARCHITECTURE" in "x86-32") downloadArch="x32";; *) downloadArch="$ARCHITECTURE";; esac apiUrlTemplate="https://api.adoptopenjdk.net/v3/binary/latest/\${BOOT_JDK_VERSION}/\${releaseType}/windows/\${downloadArch}/jdk/hotspot/normal/adoptopenjdk" apiURL=$(eval echo ${apiUrlTemplate}) # make-adopt-build-farm.sh has 'set -e'. We need to disable that # for the fallback mechanism, as downloading of the GA binary might # fail. set +e wget -q "${apiURL}" -O openjdk.zip retVal=$? set -e if [ $retVal -ne 0 ]; then # We must be a JDK HEAD build for which no boot JDK exists other than # nightlies? echo "Downloading GA release of boot JDK version ${BOOT_JDK_VERSION} failed." echo "Attempting to download EA release of boot JDK version ${BOOT_JDK_VERSION} ..." # shellcheck disable=SC2034 releaseType="ea" apiURL=$(eval echo ${apiUrlTemplate}) wget -q "${apiURL}" -O openjdk.zip fi unzip -q openjdk.zip mv $(ls -d jdk-${BOOT_JDK_VERSION}*) "$bootDir" fi fi export JDK_BOOT_DIR="$(eval echo "\$$BOOT_JDK_VARIABLE")" "$JDK_BOOT_DIR/bin/java" -version 2>&1 | sed 's/^/BOOT JDK: /' fi if [ "${ARCHITECTURE}" == "x86-32" ] then export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache --with-target-bits=32 --target=x86" if [ "${VARIANT}" == "${BUILD_VARIANT_OPENJ9}" ] then export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-openssl=/cygdrive/c/openjdk/OpenSSL-1.1.1g-x86_32-VS2013 --enable-openssl-bundling" if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ] then export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-freemarker-jar=/cygdrive/c/openjdk/freemarker.jar" # https://github.com/AdoptOpenJDK/openjdk-build/issues/243 export INCLUDE="C:\Program Files\Debugging Tools for Windows (x64)\sdk\inc;$INCLUDE" export PATH="/c/cygwin64/bin:/usr/bin:$PATH" elif [ "${JAVA_TO_BUILD}" == "${JDK11_VERSION}" ] then export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-freemarker-jar=/cygdrive/c/openjdk/freemarker.jar" # Next line a potentially tactical fix for https://github.com/AdoptOpenJDK/openjdk-build/issues/267 export PATH="/usr/bin:$PATH" fi # LLVM needs to be before cygwin as at least one machine has 64-bit clang in cygwin #813 # NASM required for OpenSSL support as per #604 export PATH="/cygdrive/c/Program Files (x86)/LLVM/bin:/cygdrive/c/openjdk/nasm-$OPENJ9_NASM_VERSION:$PATH" else if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ] then TOOLCHAIN_VERSION="2013" export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" export PATH="/cygdrive/c/openjdk/make-3.82/:$PATH" elif [ "${JAVA_TO_BUILD}" == "${JDK11_VERSION}" ] then TOOLCHAIN_VERSION="2013" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache" elif [ "$JAVA_FEATURE_VERSION" -gt 11 ] then TOOLCHAIN_VERSION="2017" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache" fi fi fi if [ "${ARCHITECTURE}" == "x64" ] then if [ "${VARIANT}" == "${BUILD_VARIANT_OPENJ9}" ] then export HAS_AUTOCONF=1 export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ] then export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" export INCLUDE="C:\Program Files\Debugging Tools for Windows (x64)\sdk\inc;$INCLUDE" export PATH="$PATH:/c/cygwin64/bin" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-freemarker-jar=/cygdrive/c/openjdk/freemarker.jar --disable-ccache" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-openssl=/cygdrive/c/openjdk/OpenSSL-1.1.1g-x86_64-VS2013 --enable-openssl-bundling" elif [ "${JAVA_TO_BUILD}" == "${JDK9_VERSION}" ] then TOOLCHAIN_VERSION="2013" export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-freemarker-jar=/cygdrive/c/openjdk/freemarker.jar" elif [ "${JAVA_TO_BUILD}" == "${JDK10_VERSION}" ] then export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-freemarker-jar=/cygdrive/c/openjdk/freemarker.jar" elif [ "$JAVA_FEATURE_VERSION" -ge 11 ] then TOOLCHAIN_VERSION="2017" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-freemarker-jar=/cygdrive/c/openjdk/freemarker.jar --with-openssl=/cygdrive/c/openjdk/OpenSSL-1.1.1g-x86_64-VS2017 --enable-openssl-bundling" fi CUDA_VERSION=9.0 CUDA_HOME="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v$CUDA_VERSION" # use cygpath to map to 'short' names (without spaces) CUDA_HOME=$(cygpath -ms "$CUDA_HOME") if [ -f "$(cygpath -u $CUDA_HOME/include/cuda.h)" ] then export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --enable-cuda --with-cuda=$CUDA_HOME" fi # LLVM needs to be before cygwin as at least one machine has clang in cygwin #813 # NASM required for OpenSSL support as per #604 export PATH="/cygdrive/c/Program Files/LLVM/bin:/usr/bin:/cygdrive/c/openjdk/nasm-$OPENJ9_NASM_VERSION:$PATH" else TOOLCHAIN_VERSION="2013" if [ "${JAVA_TO_BUILD}" == "${JDK8_VERSION}" ] then export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" export PATH="/cygdrive/c/openjdk/make-3.82/:$PATH" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache" elif [ "${JAVA_TO_BUILD}" == "${JDK9_VERSION}" ] then export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache" elif [ "${JAVA_TO_BUILD}" == "${JDK10_VERSION}" ] then export BUILD_ARGS="${BUILD_ARGS} --freetype-version 2.5.3" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache" elif [ "$JAVA_FEATURE_VERSION" -ge 11 ] then TOOLCHAIN_VERSION="2017" export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --disable-ccache" fi fi fi if [ ! -z "${TOOLCHAIN_VERSION}" ]; then export CONFIGURE_ARGS_FOR_ANY_PLATFORM="${CONFIGURE_ARGS_FOR_ANY_PLATFORM} --with-toolchain-version=${TOOLCHAIN_VERSION}" fi
<gh_stars>1-10 package ch.usi.inf.mc.yapt.parc.util; import ch.usi.inf.mc.yapt.parc.R; public enum Gesture { /** Swipe up on the screen. */ SWIPE_UP(R.string.gesture_swipe_up), /** Swipe right on the screen. */ SWIPE_RIGHT(R.string.gesture_swipe_right), /** Swipe down on the screen. */ SWIPE_DOWN(R.string.gesture_swipe_down), /** Swipe left on the screen. */ SWIPE_LEFT(R.string.gesture_swipe_left), /** Long press on the screen. */ SINGLE_TAP(R.string.gesture_long_press), /** Hover (hold) over the phone */ HOVER_HOLD(R.string.gesture_hover_hold), /** Hover (swipe) over the phone */ HOVER_SWIPE(R.string.gesture_hover_swipe); public final int id; /** * All the available gestures * * @param id The preferences id to retrieve the action associated with the gesture. */ Gesture(int id) { this.id = id; } }
import {Component, OnDestroy, OnInit} from '@angular/core'; import {Alert, AlertLevel, AlertService} from '../../services/alert.service'; import {animate, keyframes, query, style, transition, trigger} from '@angular/animations'; import {Subscription} from 'rxjs/Subscription'; @Component({ selector: 'mc-alert-container', templateUrl: './alertContainer.component.html', styleUrls: ['./alertContainer.component.scss'], animations: [ trigger('alertAnimation', [ transition('* => *', [ query(':leave', animate('0.5s ease-in-out', keyframes([ style({transform: 'translateX(0)', offset: 0.0}), style({transform: 'translateX(calc(100vw))', offset: 1.0}), ])), {optional: true}), query(':enter', animate('0.5s ease-in-out', keyframes([ style({transform: 'translateY(calc(100vh))', offset: 0.0}), style({transform: 'translateY(0)', offset: 1.0}), ])), {optional: true}) ]) ]) ] }) export class AlertContainerComponent implements OnInit, OnDestroy { private alertSubscription: Subscription; private visibleAlerts: Alert[] = []; public AlertLevel: any = AlertLevel; constructor(private alertService: AlertService) { } ngOnInit() { this.alertSubscription = this.alertService.getAlerts().subscribe((alerts: Alert[]) => { this.visibleAlerts = alerts; }); } ngOnDestroy(): void { this.alertSubscription.unsubscribe(); } doShowDetails(details: String) { console.log(details); } }
<filename>pkg/apis/creator/v1/types.go package v1 import ( "github.com/atlassian/voyager" "github.com/atlassian/voyager/pkg/apis/creator" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) const ( ServiceResourceSingular = "service" ServiceResourcePlural = "services" ServiceResourceVersion = "v1" ServiceResourceKind = "Service" ServiceListResourceKind = "ServiceList" ServiceResourceAPIVersion = creator.GroupName + "/" + ServiceResourceVersion ServiceResourceName = ServiceResourcePlural + "." + creator.GroupName ) var ( ServiceGvk = SchemeGroupVersion.WithKind(ServiceResourceKind) ) // +genclient // +genclient:nonNamespaced // +genclient:noStatus // +k8s:deepcopy-gen=true // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type Service struct { meta_v1.TypeMeta `json:",inline"` meta_v1.ObjectMeta `json:"metadata,omitempty"` Spec ServiceSpec `json:"spec,omitempty"` Status ServiceStatus `json:"status,omitempty"` } // +k8s:deepcopy-gen=true type ServiceSpec struct { BusinessUnit string `json:"businessUnit,omitempty"` ResourceOwner string `json:"resourceOwner,omitempty"` SSAMContainerName string `json:"ssamContainerName,omitempty"` PagerDutyServiceID string `json:"pagerDutyServiceID,omitempty"` LoggingID string `json:"loggingID,omitempty"` Metadata ServiceMetadata `json:"metadata,omitempty"` ResourceTags map[voyager.Tag]string `json:"tags,omitempty"` } // +k8s:deepcopy-gen=true type ServiceStatus struct { Compliance Compliance `json:"compliance,omitempty"` } // EmailAddress gives the email address for the service func (ss *ServiceSpec) EmailAddress() string { return ss.ResourceOwner + "@atlassian.com" } // +k8s:deepcopy-gen=true type ServiceMetadata struct { PagerDuty *PagerDutyMetadata `json:"pagerDuty,omitempty"` Bamboo *BambooMetadata `json:"bamboo,omitempty"` } // +k8s:deepcopy-gen=true type BambooMetadata struct { Builds []BambooPlanRef `json:"builds,omitempty"` Deployments []BambooPlanRef `json:"deployments,omitempty"` } type BambooPlanRef struct { Server string `json:"server"` Plan string `json:"plan"` } type PagerDutyMetadata struct { Staging PagerDutyEnvMetadata `json:"staging,omitempty"` Production PagerDutyEnvMetadata `json:"production,omitempty"` } type PagerDutyEnvMetadata struct { Main PagerDutyServiceMetadata `json:"main,omitempty"` LowPriority PagerDutyServiceMetadata `json:"lowPriority,omitempty"` } type PagerDutyServiceMetadata struct { ServiceID string `json:"serviceID,omitempty"` PolicyID string `json:"policyID,omitempty"` Integrations PagerDutyIntegrations `json:"integrations,omitempty"` } type PagerDutyIntegrations struct { CloudWatch PagerDutyIntegrationMetadata `json:"cloudWatch,omitempty"` Generic PagerDutyIntegrationMetadata `json:"generic,omitempty"` Pingdom PagerDutyIntegrationMetadata `json:"pingdom,omitempty"` } type PagerDutyIntegrationMetadata struct { IntegrationID string `json:"integrationID,omitempty"` IntegrationKey string `json:"integrationKey,omitempty"` } // +k8s:deepcopy-gen=true type Compliance struct { PRGBControl *bool `json:"prgbControl,omitempty"` } // ServiceList is a list of Services. // +k8s:deepcopy-gen=true // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type ServiceList struct { meta_v1.TypeMeta `json:",inline"` meta_v1.ListMeta `json:"metadata,omitempty"` Items []Service `json:"items"` }
<reponame>indigo-dc/FG-portlets package it.infn.ct.indigo.portlet; import java.util.Iterator; import java.util.List; public class Parameter { private String type; private String value; private String name; public String getType() { return type; } public void setType(String type) { this.type = type; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getName() { return name; } public void setName(String name) { this.name = name; } public static class array implements Iterable<Parameter>{ public List<Parameter> parameters; public Iterator<Parameter> iterator() { return this.parameters.iterator(); } } }
#!/usr/bin/env bash source /root/venvs/ljx/bin/activate cd /root/apps/ljx d=`date +%y%m%d` tar_name='ljx-'${d}'.tar.gz' tar -cvzf ${tar_name} ./media ./db.sqlite3 mv ${tar_name} /tmp scp /tmp/${tar_name} backup@120.78.239.198:/home/backup echo tar_name > /tmp/backup.log exit 0
class Stack: """ In python, stack doesn't make any sense as list has all inbuilt methods for the same But algorithm works as demonstrated below """ def __init__(self, size): self.stack = [] self.size = size # fixed sized stack self.top = -1 # index of stack def push(self, ele) -> None: if not self.overflow(): self.top += 1 self.stack.append(ele) else: print("Stack Overflow") def pop(self) -> int: if not self.underflow(): self.top -= 1 return self.stack.pop() print("Stack Underflow") return -1 def underflow(self) -> bool: if self.top == -1: return True return False def overflow(self): if self.top == self.size - 1: return True return False def get_top(self): if self.underflow() or self.overflow(): return -1 return self.stack[self.top] def display(self): print("TOP <--", end=" ") top = self.top while top >= 0: print(f"{self.stack[top]} <--", end=" ") top -= 1 print("/") if __name__ == "__main__": print("=================") print("Stack Operations") print("=================") size = int(input("Enter the size of Stack: ")) stack = Stack(size) while True: print("Select the operation") print("1. Push into Stack") print("2. Pop out of stack") print("3. Check Underflow") print("4. Check Overflow") print("5. Get top of the stack") print("6. Display") print("7. Exit") print("Enter your choice : ", end="") choice = int(input()) print() print("-------------------") if choice == 1: element = input("Enter the element to push: ") stack.push(element) elif choice == 2: element = stack.pop() if element: pass else: print(f"Removed Element is: {element}") elif choice == 3: print(f"Underflow: {stack.underflow()}") elif choice == 4: print(f"Overflow: {stack.overflow()}") elif choice == 5: print(f"Element at the top of stack: {stack.get_top()}") elif choice == 6: stack.display() print("-------------------") continue elif choice == 7: quit() else: print("Invalid Choice") stack.display() print("-------------------")
<reponame>Hyddan/hls.js import Hls from '../../../src/hls'; import Event from '../../../src/events'; import { FragmentTracker, FragmentState } from '../../../src/controller/fragment-tracker'; import StreamController from '../../../src/controller/stream-controller'; import { State } from '../../../src/controller/base-stream-controller'; import { mockFragments } from '../../mocks/data'; import Fragment from '../../../src/loader/fragment'; import M3U8Parser from '../../../src/loader/m3u8-parser'; import sinon from 'sinon'; describe('StreamController', function () { let hls; let fragmentTracker; let streamController; beforeEach(function () { hls = new Hls({}); fragmentTracker = new FragmentTracker(hls); streamController = new StreamController(hls, fragmentTracker); streamController.startFragRequested = true; }); /** * Assert: streamController should be started * @param {StreamController} streamController */ const assertStreamControllerStarted = (streamController) => { expect(streamController.hasInterval()).to.be.true; expect(streamController.state).to.equal(State.IDLE, 'StreamController\'s state should not be STOPPED'); }; /** * Assert: streamController should be stopped * @param {StreamController} streamController */ const assertStreamControllerStopped = (streamController) => { expect(streamController.hasInterval()).to.be.false; expect(streamController.state).to.equal(State.STOPPED, 'StreamController\'s state should be STOPPED'); }; describe('StreamController', function () { it('should be STOPPED when it is initialized', function () { assertStreamControllerStopped(streamController); }); it('should trigger STREAM_STATE_TRANSITION when state is updated', function () { const spy = sinon.spy(); hls.on(Event.STREAM_STATE_TRANSITION, spy); streamController.state = State.ENDED; expect(spy.args[0][1]).to.deep.equal({ previousState: State.STOPPED, nextState: State.ENDED }); }); it('should not trigger STREAM_STATE_TRANSITION when state is not updated', function () { const spy = sinon.spy(); hls.on(Event.STREAM_STATE_TRANSITION, spy); // no update streamController.state = State.STOPPED; expect(spy.called).to.be.false; }); it('should not start when controller does not have level data', function () { streamController.startLoad(1); assertStreamControllerStopped(streamController); }); it('should start without levels data', function () { const manifest = `#EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=836280,RESOLUTION=848x360,NAME="480" http://proxy-62.dailymotion.com/sec(3ae40f708f79ca9471f52b86da76a3a8)/video/107/282/158282701_mp4_h264_aac_hq.m3u8#cell=core`; const levels = M3U8Parser.parseMasterPlaylist(manifest, 'http://www.dailymotion.com'); // load levels data streamController.onManifestParsed({ levels }); streamController.startLoad(1); assertStreamControllerStarted(streamController); streamController.stopLoad(); assertStreamControllerStopped(streamController); }); }); describe('SN Searching', function () { let fragPrevious = { programDateTime: 1505502671523, endProgramDateTime: 1505502676523, duration: 5.000, level: 1, start: 10.000, sn: 2, // Fragment with PDT 1505502671523 in level 1 does not have the same sn as in level 2 where cc is 1 cc: 0 }; let fragLen = mockFragments.length; let levelDetails = { startSN: mockFragments[0].sn, endSN: mockFragments[mockFragments.length - 1].sn }; let bufferEnd = fragPrevious.start + fragPrevious.duration; let end = mockFragments[mockFragments.length - 1].start + mockFragments[mockFragments.length - 1].duration; before(function () { levelDetails.hasProgramDateTime = false; }); it('PTS search choosing wrong fragment (3 instead of 2) after level loaded', function () { let foundFragment = streamController._findFragment(0, fragPrevious, fragLen, mockFragments, bufferEnd, end, levelDetails); let resultSN = foundFragment ? foundFragment.sn : -1; expect(foundFragment).to.equal(mockFragments[3], 'Expected sn 3, found sn segment ' + resultSN); }); // TODO: This test fails if using a real instance of Hls it('PTS search choosing the right segment if fragPrevious is not available', function () { let foundFragment = streamController._findFragment(0, null, fragLen, mockFragments, bufferEnd, end, levelDetails); let resultSN = foundFragment ? foundFragment.sn : -1; expect(foundFragment).to.equal(mockFragments[3], 'Expected sn 3, found sn segment ' + resultSN); }); it('returns the last fragment if the stream is fully buffered', function () { const actual = streamController._findFragment(0, null, mockFragments.length, mockFragments, end, end, levelDetails); expect(actual).to.equal(mockFragments[mockFragments.length - 1]); }); describe('PDT Searching during a live stream', function () { before(function () { levelDetails.hasProgramDateTime = true; }); it('PDT search choosing fragment after level loaded', function () { levelDetails.PTSKnown = false; levelDetails.live = true; let foundFragment = streamController._ensureFragmentAtLivePoint(levelDetails, bufferEnd, 0, end, fragPrevious, mockFragments, mockFragments.length); let resultSN = foundFragment ? foundFragment.sn : -1; expect(foundFragment).to.equal(mockFragments[2], 'Expected sn 2, found sn segment ' + resultSN); }); it('PDT search hitting empty discontinuity', function () { let discontinuityPDTHit = 6.00; let foundFragment = streamController._ensureFragmentAtLivePoint(levelDetails, discontinuityPDTHit, 0, end, fragPrevious, mockFragments, mockFragments.length); let resultSN = foundFragment ? foundFragment.sn : -1; expect(foundFragment).to.equal(mockFragments[2], 'Expected sn 2, found sn segment ' + resultSN); }); }); }); describe('fragment loading', function () { function fragStateStub (state) { return sinon.stub(fragmentTracker, 'getState').callsFake(() => state); } let triggerSpy; let frag; beforeEach(function () { triggerSpy = sinon.spy(hls, 'trigger'); frag = new Fragment(); }); function assertLoadingState (frag) { expect(triggerSpy).to.have.been.calledWith(Event.FRAG_LOADING, { frag }); expect(streamController.state).to.equal(State.FRAG_LOADING); } function assertNotLoadingState () { expect(triggerSpy).to.not.have.been.called; expect(hls.state).to.not.equal(State.FRAG_LOADING); } it('should load a complete fragment which has not been previously appended', function () { fragStateStub(FragmentState.NOT_LOADED); streamController._loadFragment(frag); assertLoadingState(frag); }); it('should load a partial fragment', function () { fragStateStub(FragmentState.PARTIAL); streamController._loadFragment(frag); assertLoadingState(frag); }); it('should load a frag which has backtracked', function () { fragStateStub(FragmentState.OK); frag.backtracked = true; streamController._loadFragment(frag); assertLoadingState(frag); }); it('should not load a fragment which has completely & successfully loaded', function () { fragStateStub(FragmentState.OK); streamController._loadFragment(frag); assertNotLoadingState(); }); it('should not load a fragment while it is appending', function () { fragStateStub(FragmentState.APPENDING); streamController._loadFragment(frag); assertNotLoadingState(); }); }); describe('checkBuffer', function () { const sandbox = sinon.createSandbox(); beforeEach(function () { streamController.gapController = { poll: function () {} }; streamController.media = { buffered: { length: 1 } }; }); afterEach(function () { sandbox.restore(); }); it('should not throw when media is undefined', function () { streamController.media = null; streamController._checkBuffer(); }); it('should seek to start pos when metadata has not yet been loaded', function () { const seekStub = sandbox.stub(streamController, '_seekToStartPos'); streamController.loadedmetadata = false; streamController._checkBuffer(); expect(seekStub).to.have.been.calledOnce; expect(streamController.loadedmetadata).to.be.true; }); it('should not seek to start pos when metadata has been loaded', function () { const seekStub = sandbox.stub(streamController, '_seekToStartPos'); streamController.loadedmetadata = true; streamController._checkBuffer(); expect(seekStub).to.have.not.been.called; expect(streamController.loadedmetadata).to.be.true; }); it('should not seek to start pos when nothing has been buffered', function () { const seekStub = sandbox.stub(streamController, '_seekToStartPos'); streamController.media.buffered.length = 0; streamController._checkBuffer(); expect(seekStub).to.have.not.been.called; expect(streamController.loadedmetadata).to.not.exist; }); it('should complete the immediate switch if signalled', function () { const levelSwitchStub = sandbox.stub(streamController, 'immediateLevelSwitchEnd'); streamController.loadedmetadata = true; streamController.immediateSwitch = true; streamController._checkBuffer(); expect(levelSwitchStub).to.have.been.calledOnce; }); describe('_seekToStartPos', function () { it('should seek to startPosition when startPosition is not buffered & the media is not seeking', function () { streamController.startPosition = 5; streamController._seekToStartPos(); expect(streamController.media.currentTime).to.equal(5); }); it('should not seek to startPosition when it is buffered', function () { streamController.startPosition = 5; streamController.media.currentTime = 5; streamController._seekToStartPos(); expect(streamController.media.currentTime).to.equal(5); }); }); describe('startLoad', function () { beforeEach(function () { streamController.levels = []; streamController.media = null; }); it('should not start when controller does not have level data', function () { streamController.levels = null; streamController.startLoad(); assertStreamControllerStopped(streamController); }); it('should start when controller has level data', function () { streamController.startLoad(5); assertStreamControllerStarted(streamController); expect(streamController.nextLoadPosition).to.equal(5); expect(streamController.startPosition).to.equal(5); expect(streamController.lastCurrentTime).to.equal(5); }); it('should set startPosition to lastCurrentTime if unset', function () { streamController.lastCurrentTime = 5; streamController.startLoad(-1); assertStreamControllerStarted(streamController); expect(streamController.nextLoadPosition).to.equal(5); expect(streamController.startPosition).to.equal(5); expect(streamController.lastCurrentTime).to.equal(5); }); it('sets up for a bandwidth test if starting at auto', function () { streamController.startFragRequested = false; hls.startLevel = -1; streamController.startLoad(); expect(streamController.level).to.equal(0); expect(streamController.bitrateTest).to.be.true; }); it('should not signal a bandwidth test if config.testBandwidth is false', function () { streamController.startFragRequested = false; hls.startLevel = -1; hls.nextAutoLevel = 3; hls.config.testBandwidth = false; streamController.startLoad(); expect(streamController.level).to.equal(hls.nextAutoLevel); expect(streamController.bitrateTest).to.be.false; }); }); }); });
<reponame>mothguib/pytrol # -*- coding: utf-8 -*- class Data: Cycle = 0 # The agents' position Agts_pos = 1 # Real idlenesses Idls = 2
package ipcserver import ( "fmt" "net" "github.com/iotaledger/giota" "github.com/muxxer/diverdriver/common" "github.com/muxxer/diverdriver/common/ipccommon" "github.com/muxxer/diverdriver/logs" "github.com/sigurn/crc8" "github.com/spf13/viper" ) /* Interprocess communication protocol =================================== [0] START_BYTE | [1] FRAME_VERSION | [2..3] FRAME_LENGTH | [4..4+FRAME_LENGTH] FRAME_DATA | [4+FRAME_LENGTH] CRC8 START_BYTE: Start of the IPC frame ENQ Byte (0x05) - Enquiry FRAME_VERSION: Version of the IPC frame, for future extensions of the protocol FRAME_LENGTH: Size of the FRAME_DATA FRAME_DATA: ----- FRAME_VERSION==0x01 ----- [4] REQ_ID | [5] IPC_CMD | [6..7] DATA_LENGTH | [8..8+DATA_LENGTH] DATA REQ_ID: ID of the message, set by the client. Server will respond to the client with the same ID. This way the client knows which response is assigned to which request. IPC_CMD: IpcCmdNotification = 0x01 // S => C: Text messages to the client IpcCmdResponse = 0x02 // S => C: Response to a IPC_CMD IpcCmdError = 0x03 // S => C: Exceptions that should be raised in the client IpcCmdGetServerVersion = 0x04 // C => S: Get the version of this application IpcCmdGetPowType = 0x05 // C => S: Get the name of the used POW implementation (e.g. PiDiver) IpcCmdGetPowVersion = 0x06 // C => S: Get the version of the used POW implementation (e.g. PiDiver FPGA Core Version) IpcCmdPowFunc = 0x07 // C => S: Do POW DATA_LENGTH: Size of the DATA DATA: Data with variable length ----- IPC_CMD==IpcCmdNotification ----- [8..8+DATA_LENGTH] String Notification ----- IPC_CMD==IpcCmdResponse ----- [8..8+DATA_LENGTH] ReponseData ----- IPC_CMD==IpcCmdError ----- [8..8+DATA_LENGTH] ExceptionMessage ----- IPC_CMD==IpcCmdGetServerVersion ----- [8..8+DATA_LENGTH] String ServerVersion ----- IPC_CMD==IpcCmdGetPowType ----- [8..8+DATA_LENGTH] String PowType ----- IPC_CMD==IpcCmdGetPowVersion ----- [8..8+DATA_LENGTH] String PowVersion ----- IPC_CMD==IpcCmdPowFunc ---- [8..8+DATA_LENGTH] Trytes POW result CRC8: Checksum of the whole FRAME_DATA */ // sendToClient sends an IpcMessage to a client func sendToClient(c net.Conn, responseMsg *ipccommon.IpcMessage) (err error) { response, err := responseMsg.ToBytes() if err != nil { return err } _, err = c.Write(response) return err } // HandleClientConnection handles the communication to the client until the socket is closed func HandleClientConnection(c net.Conn, config *viper.Viper, powType string, powVersion string) { frameState := ipccommon.FrameStateSearchEnq frameLength := 0 var frameData []byte defer c.Close() for { buf := make([]byte, 3072) // ((8019 is the TransactionTrinarySize) / 3) + Overhead) => 3072 bufLength, err := c.Read(buf) if err != nil { break } bufferIdx := -1 for { bufferIdx++ if bufLength > bufferIdx { switch frameState { case ipccommon.FrameStateSearchEnq: if buf[bufferIdx] == 0x05 { // Init variables for new message frameLength = -1 frameData = nil frameState = ipccommon.FrameStateSearchVersion } case ipccommon.FrameStateSearchVersion: if buf[bufferIdx] == 0x01 { frameState = ipccommon.FrameStateSearchLength } else { frameState = ipccommon.FrameStateSearchEnq } case ipccommon.FrameStateSearchLength: if frameLength == -1 { // Receive first byte frameLength = int(buf[bufferIdx]) << 8 } else { // Receive second byte and go on frameLength |= int(buf[bufferIdx]) frameState = ipccommon.FrameStateSearchData } case ipccommon.FrameStateSearchData: missingByteCount := frameLength - len(frameData) if (bufLength - bufferIdx) >= missingByteCount { // Frame completely received frameData = append(frameData, buf[bufferIdx:(bufferIdx+missingByteCount)]...) bufferIdx += missingByteCount - 1 frameState = ipccommon.FrameStateSearchCRC } else { // Frame not completed in this read => Copy the remaining bytes frameData = append(frameData, buf[bufferIdx:bufLength]...) bufferIdx = bufLength } case ipccommon.FrameStateSearchCRC: frame, err := ipccommon.BytesToIpcFrameV1(frameData) if err != nil { logs.Log.Debug(err.Error()) responseMsg, _ := ipccommon.NewIpcMessageV1(0, ipccommon.IpcCmdError, []byte(err.Error())) sendToClient(c, responseMsg) frameState = ipccommon.FrameStateSearchEnq break } crc := crc8.Checksum(frameData, ipccommon.Crc8Table) if buf[bufferIdx] != crc { logs.Log.Debugf("Wrong Checksum! CRC: %X, Expected: %X", crc, buf[bufferIdx]) responseMsg, _ := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdError, []byte(fmt.Sprintf("Wrong Checksum! CRC: %X, Expected: %X", crc, buf[bufferIdx]))) sendToClient(c, responseMsg) frameState = ipccommon.FrameStateSearchEnq break } switch frame.Command { case ipccommon.IpcCmdGetServerVersion: logs.Log.Debug("Received Command GetServerVersion") responseMsg, _ := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdResponse, []byte(common.DiverDriverVersion)) sendToClient(c, responseMsg) case ipccommon.IpcCmdGetPowType: logs.Log.Debug("Received Command GetPowType") responseMsg, _ := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdResponse, []byte(powType)) sendToClient(c, responseMsg) case ipccommon.IpcCmdGetPowVersion: logs.Log.Debug("Received Command GetPowVersion") responseMsg, _ := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdResponse, []byte(powVersion)) sendToClient(c, responseMsg) case ipccommon.IpcCmdPowFunc: logs.Log.Debug("Received Command PowFunc") mwm := int(frame.Data[0]) if mwm > config.GetInt("pow.maxMinWeightMagnitude") { logs.Log.Debugf("MinWeightMagnitude too high. MWM: %v Allowed: %v", mwm, config.GetInt("pow.maxMinWeightMagnitude")) responseMsg, _ := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdError, []byte(fmt.Sprintf("MinWeightMagnitude too high. MWM: %v Allowed: %v", mwm, config.GetInt("pow.maxMinWeightMagnitude")))) sendToClient(c, responseMsg) frameState = ipccommon.FrameStateSearchEnq break } trytes, err := giota.ToTrytes(string(frame.Data[1:])) if err != nil { logs.Log.Debug(err.Error()) responseMsg, _ := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdError, []byte(err.Error())) sendToClient(c, responseMsg) frameState = ipccommon.FrameStateSearchEnq break } result, err := powFunc(trytes, mwm) if err != nil { logs.Log.Debug(err.Error()) responseMsg, _ := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdError, []byte(err.Error())) sendToClient(c, responseMsg) frameState = ipccommon.FrameStateSearchEnq break } else { responseMsg, err := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdResponse, []byte(result)) if err != nil { frameState = ipccommon.FrameStateSearchEnq break } sendToClient(c, responseMsg) } default: // IpcCmdNotification, IpcCmdResponse, IpcCmdError logs.Log.Debugf("Unknown command! Cmd: %X", frame.Command) responseMsg, _ := ipccommon.NewIpcMessageV1(frame.ReqID, ipccommon.IpcCmdError, []byte(fmt.Sprintf("Unknown command! Cmd: %X", frame.Command))) sendToClient(c, responseMsg) } // Search for the next message frameState = ipccommon.FrameStateSearchEnq } } else { // Received Buffer completely handled, break the loop to receive the next message break } } } }
def evaluateExpression(expr): return eval(expr) result = evaluateExpression("2 * 3 + 5") print(result) #11
echo "marhaban lijamie altulaabi! hadhih 'awal tahiat li."
package lab2; public enum States { Q0, Q1, Q2, Q3, ERROR }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.u1F351 = void 0; var u1F351 = { "viewBox": "0 0 2600 2760.837", "children": [{ "name": "path", "attribs": { "d": "M2210 2071q17 40 30.5 85.5t13.5 75.5q0 36-21 39.5t-100.5 10-159.5 6.5q-225 0-394.5-71T1355 1998q-26-4-52-7t-54-3q-49 153-221 226.5T627 2288q-88 0-163.5-8.5T383 2271q-20 0-28.5-8.5T346 2230q0-68 62-194t181-211q-87-83-136-201.5T404 1384q0-217 147.5-429T929 608l168-97q4-2 45-27t68-25q77 0 323.5 129.5t414 338.5 167.5 449q0 134-38 235t-115 182q77 50 135.5 109.5T2197 2043zM1763.5 872.5Q1510 638 1210 558q-55 31-113 65l-119 70q-210 124-342.5 312.5T503 1384q0 129 64 250t181.5 188 274.5 67q25 0 38.5-7t13.5-24q0-22-31.5-62T964 1640t-48-258q0-77 17-159l5-17q7-26 17.5-42.5T977 1147q17 0 17 23l-1 21q0 363 133 537t362 174q181 0 355-135t174-391q0-269-253.5-503.5z" }, "children": [] }] }; exports.u1F351 = u1F351;
<filename>work/jspc/java/org/jivesoftware/openfire/admin/server_002dconnectiontest_jsp.java /* * Generated by the Jasper component of Apache Tomcat * Version: JspC/ApacheTomcat8 * Generated at: 2018-09-18 19:34:49 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.jivesoftware.openfire.admin; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.*; import org.jivesoftware.util.*; public final class server_002dconnectiontest_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; static { _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2); _jspx_dependants.put("/META-INF/tags/admin/infoBox.tagx", Long.valueOf(1537299280577L)); _jspx_dependants.put("/META-INF/tags/admin/contentBox.tagx", Long.valueOf(1537299280573L)); } private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fif_0026_005ftest; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fvar_005fkey_005fnobody; private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody; private javax.el.ExpressionFactory _el_expressionfactory; private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public void _jspInit() { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fc_005fif_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fvar_005fkey_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } public void _jspDestroy() { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.release(); _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.release(); _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fvar_005fkey_005fnobody.release(); _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.release(); } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, "error.jsp", true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\n\n\n\n\n\n\n\n\n"); org.jivesoftware.util.WebManager webManager = null; webManager = (org.jivesoftware.util.WebManager) _jspx_page_context.getAttribute("webManager", javax.servlet.jsp.PageContext.PAGE_SCOPE); if (webManager == null){ webManager = new org.jivesoftware.util.WebManager(); _jspx_page_context.setAttribute("webManager", webManager, javax.servlet.jsp.PageContext.PAGE_SCOPE); } out.write('\n'); webManager.init(request, response, session, application, out ); out.write('\n'); out.write('\n'); Map<String, String> errors = new HashMap<>(); Cookie csrfCookie = CookieUtils.getCookie(request, "csrf"); String csrfParam = ParamUtils.getParameter(request, "csrf"); String s2sTestingDomain = ParamUtils.getParameter( request, "server2server-testing-domain" ); boolean s2sTest = request.getParameter("s2s-test") != null && s2sTestingDomain != null; if (s2sTest) { if (csrfCookie == null || csrfParam == null || !csrfCookie.getValue().equals(csrfParam)) { s2sTest = false; errors.put("csrf", "CSRF Failure!"); } } csrfParam = StringUtils.randomString(15); CookieUtils.setCookie(request, response, "csrf", csrfParam, -1); pageContext.setAttribute("csrf", csrfParam); if (errors.isEmpty() && s2sTest) { final Map<String, String> results = new S2STestService(s2sTestingDomain).run(); pageContext.setAttribute("s2sDomain", s2sTestingDomain); pageContext.setAttribute("s2sTest", true); pageContext.setAttribute("stanzas", results.get("stanzas")); pageContext.setAttribute("logs", results.get("logs")); pageContext.setAttribute("certs", results.get("certs")); } pageContext.setAttribute("errors", errors); out.write("\n\n<html>\n<head>\n <title>"); if (_jspx_meth_fmt_005fmessage_005f0(_jspx_page_context)) return; out.write("</title>\n <meta name=\"pageID\" content=\"server-connectiontest\"/>\n</head>\n<body>\n "); if (_jspx_meth_c_005fif_005f0(_jspx_page_context)) return; out.write("\n <p>\n "); if (_jspx_meth_fmt_005fmessage_005f2(_jspx_page_context)) return; out.write("\n </p>\n\n <!-- BEGIN 'S2S Testing' -->\n "); if (_jspx_meth_fmt_005fmessage_005f3(_jspx_page_context)) return; out.write("\n "); if (_jspx_meth_admin_005fcontentBox_005f0(_jspx_page_context)) return; out.write("\n\n</body>\n</html>\n\n"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } private boolean _jspx_meth_fmt_005fmessage_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f0 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f0.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f0.setParent(null); // /server-connectiontest.jsp(66,11) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f0.setKey("server2server.settings.testing.title"); int _jspx_eval_fmt_005fmessage_005f0 = _jspx_th_fmt_005fmessage_005f0.doStartTag(); if (_jspx_th_fmt_005fmessage_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f0); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f0); return false; } private boolean _jspx_meth_c_005fif_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // c:if org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.get(org.apache.taglibs.standard.tag.rt.core.IfTag.class); _jspx_th_c_005fif_005f0.setPageContext(_jspx_page_context); _jspx_th_c_005fif_005f0.setParent(null); // /server-connectiontest.jsp(70,4) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fif_005f0.setTest(((java.lang.Boolean) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${not empty errors}", boolean.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)).booleanValue()); int _jspx_eval_c_005fif_005f0 = _jspx_th_c_005fif_005f0.doStartTag(); if (_jspx_eval_c_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n "); if (_jspx_meth_admin_005finfobox_005f0(_jspx_th_c_005fif_005f0, _jspx_page_context)) return true; out.write("\n "); int evalDoAfterBody = _jspx_th_c_005fif_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_c_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0); return true; } _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0); return false; } private boolean _jspx_meth_admin_005finfobox_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // admin:infobox org.apache.jsp.tag.meta.admin.admin.infoBox_tagx _jspx_th_admin_005finfobox_005f0 = (new org.apache.jsp.tag.meta.admin.admin.infoBox_tagx()); _jsp_instancemanager.newInstance(_jspx_th_admin_005finfobox_005f0); _jspx_th_admin_005finfobox_005f0.setJspContext(_jspx_page_context); _jspx_th_admin_005finfobox_005f0.setParent(_jspx_th_c_005fif_005f0); // /server-connectiontest.jsp(71,8) name = type type = java.lang.String reqTime = true required = true fragment = false deferredValue = false expectedTypeName = java.lang.String deferredMethod = false methodSignature = null _jspx_th_admin_005finfobox_005f0.setType("error"); _jspx_th_admin_005finfobox_005f0.setJspBody(new Helper( 0, _jspx_page_context, _jspx_th_admin_005finfobox_005f0, null)); _jspx_th_admin_005finfobox_005f0.doTag(); _jsp_instancemanager.destroyInstance(_jspx_th_admin_005finfobox_005f0); return false; } private boolean _jspx_meth_fmt_005fmessage_005f1(javax.servlet.jsp.tagext.JspTag _jspx_parent, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f1 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f1.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f1.setParent(new javax.servlet.jsp.tagext.TagAdapter((javax.servlet.jsp.tagext.SimpleTag) _jspx_parent)); // /server-connectiontest.jsp(72,12) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f1.setKey("server2server.settings.testing.error"); int _jspx_eval_fmt_005fmessage_005f1 = _jspx_th_fmt_005fmessage_005f1.doStartTag(); if (_jspx_th_fmt_005fmessage_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f1); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f1); return false; } private boolean _jspx_meth_fmt_005fmessage_005f2(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f2 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f2.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f2.setParent(null); // /server-connectiontest.jsp(76,8) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f2.setKey("server2server.settings.testing.info"); int _jspx_eval_fmt_005fmessage_005f2 = _jspx_th_fmt_005fmessage_005f2.doStartTag(); if (_jspx_th_fmt_005fmessage_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f2); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f2); return false; } private boolean _jspx_meth_fmt_005fmessage_005f3(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f3 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fvar_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f3.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f3.setParent(null); // /server-connectiontest.jsp(80,4) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f3.setKey("server2server.settings.testing.boxtitle"); // /server-connectiontest.jsp(80,4) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f3.setVar("s2sTitle"); int _jspx_eval_fmt_005fmessage_005f3 = _jspx_th_fmt_005fmessage_005f3.doStartTag(); if (_jspx_th_fmt_005fmessage_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fvar_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f3); return true; } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fvar_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f3); return false; } private boolean _jspx_meth_admin_005fcontentBox_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // admin:contentBox org.apache.jsp.tag.meta.admin.admin.contentBox_tagx _jspx_th_admin_005fcontentBox_005f0 = (new org.apache.jsp.tag.meta.admin.admin.contentBox_tagx()); _jsp_instancemanager.newInstance(_jspx_th_admin_005fcontentBox_005f0); _jspx_th_admin_005fcontentBox_005f0.setJspContext(_jspx_page_context); // /server-connectiontest.jsp(81,4) name = title type = java.lang.String reqTime = true required = true fragment = false deferredValue = false expectedTypeName = java.lang.String deferredMethod = false methodSignature = null _jspx_th_admin_005fcontentBox_005f0.setTitle((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${s2sTitle}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); _jspx_th_admin_005fcontentBox_005f0.setJspBody(new Helper( 1, _jspx_page_context, _jspx_th_admin_005fcontentBox_005f0, null)); _jspx_th_admin_005fcontentBox_005f0.doTag(); _jsp_instancemanager.destroyInstance(_jspx_th_admin_005fcontentBox_005f0); return false; } private boolean _jspx_meth_fmt_005fmessage_005f4(javax.servlet.jsp.tagext.JspTag _jspx_parent, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f4 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f4.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f4.setParent(new javax.servlet.jsp.tagext.TagAdapter((javax.servlet.jsp.tagext.SimpleTag) _jspx_parent)); // /server-connectiontest.jsp(85,84) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f4.setKey("server2server.settings.testing.domain"); int _jspx_eval_fmt_005fmessage_005f4 = _jspx_th_fmt_005fmessage_005f4.doStartTag(); if (_jspx_th_fmt_005fmessage_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f4); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f4); return false; } private boolean _jspx_meth_fmt_005fmessage_005f5(javax.servlet.jsp.tagext.JspTag _jspx_parent, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f5 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f5.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f5.setParent(new javax.servlet.jsp.tagext.TagAdapter((javax.servlet.jsp.tagext.SimpleTag) _jspx_parent)); // /server-connectiontest.jsp(89,68) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f5.setKey("global.test"); int _jspx_eval_fmt_005fmessage_005f5 = _jspx_th_fmt_005fmessage_005f5.doStartTag(); if (_jspx_th_fmt_005fmessage_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f5); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f5); return false; } private boolean _jspx_meth_c_005fif_005f1(javax.servlet.jsp.tagext.JspTag _jspx_parent, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // c:if org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f1 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.get(org.apache.taglibs.standard.tag.rt.core.IfTag.class); _jspx_th_c_005fif_005f1.setPageContext(_jspx_page_context); _jspx_th_c_005fif_005f1.setParent(new javax.servlet.jsp.tagext.TagAdapter((javax.servlet.jsp.tagext.SimpleTag) _jspx_parent)); // /server-connectiontest.jsp(93,16) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fif_005f1.setTest(((java.lang.Boolean) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${s2sTest}", boolean.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)).booleanValue()); int _jspx_eval_c_005fif_005f1 = _jspx_th_c_005fif_005f1.doStartTag(); if (_jspx_eval_c_005fif_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n <tr valign=\"middle\">\n <td width=\"1%\" nowrap><label for=\"server2server-testing-stanzas\">"); if (_jspx_meth_fmt_005fmessage_005f6(_jspx_th_c_005fif_005f1, _jspx_page_context)) return true; out.write("</label></td>\n <td width=\"99%\">\n <textarea name=\"server2server-testing-stanzas\" id=\"server2server-testing-stanzas\" style=\"width: 100%\" rows=\"12\">"); if (_jspx_meth_c_005fout_005f0(_jspx_th_c_005fif_005f1, _jspx_page_context)) return true; out.write("</textarea>\n </td>\n </tr>\n <tr valign=\"middle\">\n <td width=\"1%\" nowrap><label for=\"server2server-testing-certs\">"); if (_jspx_meth_fmt_005fmessage_005f7(_jspx_th_c_005fif_005f1, _jspx_page_context)) return true; out.write("</label></td>\n <td width=\"99%\">\n <textarea name=\"server2server-testing-certs\" id=\"server2server-testing-certs\" style=\"width: 100%\" rows=\"12\">"); if (_jspx_meth_c_005fout_005f1(_jspx_th_c_005fif_005f1, _jspx_page_context)) return true; out.write("</textarea>\n </td>\n </tr>\n <tr valign=\"middle\">\n <td width=\"1%\" nowrap><label for=\"server2server-testing-logs\">"); if (_jspx_meth_fmt_005fmessage_005f8(_jspx_th_c_005fif_005f1, _jspx_page_context)) return true; out.write("</label></td>\n <td width=\"99%\">\n <textarea name=\"server2server-testing-logs\" id=\"server2server-testing-logs\" style=\"width: 100%\" rows=\"12\">"); if (_jspx_meth_c_005fout_005f2(_jspx_th_c_005fif_005f1, _jspx_page_context)) return true; out.write("</textarea>\n </td>\n </tr>\n "); int evalDoAfterBody = _jspx_th_c_005fif_005f1.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_c_005fif_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f1); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f1); return false; } private boolean _jspx_meth_fmt_005fmessage_005f6(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f6 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f6.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f1); // /server-connectiontest.jsp(95,89) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f6.setKey("server2server.settings.testing.xmpp"); int _jspx_eval_fmt_005fmessage_005f6 = _jspx_th_fmt_005fmessage_005f6.doStartTag(); if (_jspx_th_fmt_005fmessage_005f6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f6); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f6); return false; } private boolean _jspx_meth_c_005fout_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // c:out org.apache.taglibs.standard.tag.rt.core.OutTag _jspx_th_c_005fout_005f0 = (org.apache.taglibs.standard.tag.rt.core.OutTag) _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.OutTag.class); _jspx_th_c_005fout_005f0.setPageContext(_jspx_page_context); _jspx_th_c_005fout_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f1); // /server-connectiontest.jsp(97,140) name = value type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fout_005f0.setValue((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${stanzas}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); int _jspx_eval_c_005fout_005f0 = _jspx_th_c_005fout_005f0.doStartTag(); if (_jspx_th_c_005fout_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.reuse(_jspx_th_c_005fout_005f0); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.reuse(_jspx_th_c_005fout_005f0); return false; } private boolean _jspx_meth_fmt_005fmessage_005f7(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f7 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f7.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f7.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f1); // /server-connectiontest.jsp(101,87) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f7.setKey("server2server.settings.testing.certificates"); int _jspx_eval_fmt_005fmessage_005f7 = _jspx_th_fmt_005fmessage_005f7.doStartTag(); if (_jspx_th_fmt_005fmessage_005f7.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f7); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f7); return false; } private boolean _jspx_meth_c_005fout_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // c:out org.apache.taglibs.standard.tag.rt.core.OutTag _jspx_th_c_005fout_005f1 = (org.apache.taglibs.standard.tag.rt.core.OutTag) _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.OutTag.class); _jspx_th_c_005fout_005f1.setPageContext(_jspx_page_context); _jspx_th_c_005fout_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f1); // /server-connectiontest.jsp(103,136) name = value type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fout_005f1.setValue((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${certs}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); int _jspx_eval_c_005fout_005f1 = _jspx_th_c_005fout_005f1.doStartTag(); if (_jspx_th_c_005fout_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.reuse(_jspx_th_c_005fout_005f1); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.reuse(_jspx_th_c_005fout_005f1); return false; } private boolean _jspx_meth_fmt_005fmessage_005f8(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // fmt:message org.apache.taglibs.standard.tag.rt.fmt.MessageTag _jspx_th_fmt_005fmessage_005f8 = (org.apache.taglibs.standard.tag.rt.fmt.MessageTag) _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.MessageTag.class); _jspx_th_fmt_005fmessage_005f8.setPageContext(_jspx_page_context); _jspx_th_fmt_005fmessage_005f8.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f1); // /server-connectiontest.jsp(107,86) name = key type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_fmt_005fmessage_005f8.setKey("server2server.settings.testing.logs"); int _jspx_eval_fmt_005fmessage_005f8 = _jspx_th_fmt_005fmessage_005f8.doStartTag(); if (_jspx_th_fmt_005fmessage_005f8.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f8); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005ffmt_005fmessage_0026_005fkey_005fnobody.reuse(_jspx_th_fmt_005fmessage_005f8); return false; } private boolean _jspx_meth_c_005fout_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f1, javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // c:out org.apache.taglibs.standard.tag.rt.core.OutTag _jspx_th_c_005fout_005f2 = (org.apache.taglibs.standard.tag.rt.core.OutTag) _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.OutTag.class); _jspx_th_c_005fout_005f2.setPageContext(_jspx_page_context); _jspx_th_c_005fout_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f1); // /server-connectiontest.jsp(109,134) name = value type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fout_005f2.setValue((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${logs}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); int _jspx_eval_c_005fout_005f2 = _jspx_th_c_005fout_005f2.doStartTag(); if (_jspx_th_c_005fout_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.reuse(_jspx_th_c_005fout_005f2); throw new javax.servlet.jsp.SkipPageException(); } _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.reuse(_jspx_th_c_005fout_005f2); return false; } private class Helper extends org.apache.jasper.runtime.JspFragmentHelper { private javax.servlet.jsp.tagext.JspTag _jspx_parent; private int[] _jspx_push_body_count; public Helper( int discriminator, javax.servlet.jsp.JspContext jspContext, javax.servlet.jsp.tagext.JspTag _jspx_parent, int[] _jspx_push_body_count ) { super( discriminator, jspContext, _jspx_parent ); this._jspx_parent = _jspx_parent; this._jspx_push_body_count = _jspx_push_body_count; } public boolean invoke0( javax.servlet.jsp.JspWriter out ) throws java.lang.Throwable { out.write("\n "); if (_jspx_meth_fmt_005fmessage_005f1(_jspx_parent, _jspx_page_context)) return true; out.write("\n "); return false; } public boolean invoke1( javax.servlet.jsp.JspWriter out ) throws java.lang.Throwable { out.write("\n <form action=\"server-connectiontest.jsp\" method=\"post\">\n <table cellpadding=\"3\" cellspacing=\"0\" border=\"0\">\n <tr valign=\"middle\">\n <td width=\"1%\" nowrap><label for=\"server2server-testing-domain\">"); if (_jspx_meth_fmt_005fmessage_005f4(_jspx_parent, _jspx_page_context)) return true; out.write("</label></td>\n <td width=\"99%\">\n <input type=\"hidden\" name=\"csrf\" value=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${csrf}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); out.write("\"/>\n <input type=\"text\" name=\"server2server-testing-domain\" id=\"server2server-testing-domain\" value=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${s2sDomain}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); out.write("\">\n <input type=\"submit\" name=\"s2s-test\" value=\""); if (_jspx_meth_fmt_005fmessage_005f5(_jspx_parent, _jspx_page_context)) return true; out.write("\">\n </td>\n </tr>\n\n "); if (_jspx_meth_c_005fif_005f1(_jspx_parent, _jspx_page_context)) return true; out.write("\n\n </table>\n </form>\n "); return false; } public void invoke( java.io.Writer writer ) throws javax.servlet.jsp.JspException { javax.servlet.jsp.JspWriter out = null; if( writer != null ) { out = this.jspContext.pushBody(writer); } else { out = this.jspContext.getOut(); } try { Object _jspx_saved_JspContext = this.jspContext.getELContext().getContext(javax.servlet.jsp.JspContext.class); this.jspContext.getELContext().putContext(javax.servlet.jsp.JspContext.class,this.jspContext); switch( this.discriminator ) { case 0: invoke0( out ); break; case 1: invoke1( out ); break; } jspContext.getELContext().putContext(javax.servlet.jsp.JspContext.class,_jspx_saved_JspContext); } catch( java.lang.Throwable e ) { if (e instanceof javax.servlet.jsp.SkipPageException) throw (javax.servlet.jsp.SkipPageException) e; throw new javax.servlet.jsp.JspException( e ); } finally { if( writer != null ) { this.jspContext.popBody(); } } } } }
<reponame>rsuite/rsuite-icons // Generated by script, don't edit it please. import createSvgIcon from '../createSvgIcon'; import DoingRoundSvg from '@rsuite/icon-font/lib/status/DoingRound'; const DoingRound = createSvgIcon({ as: DoingRoundSvg, ariaLabel: 'doing round', category: 'status', displayName: 'DoingRound' }); export default DoingRound;
export * from './ChartBar';
import { IBookEntity, IItemEntity } from '../../rooms/entities' import { createLotteryPicker } from '../../tools/create-lottery-picker' import { BookTypes, AttributeTypes, ItemTypes } from '../../rooms/types' import { shuffleArray } from '../../tools/shuffle-array' import { priceUp } from '../../item-builder/price-up' const nextBook = createLotteryPicker( { common: { proportion: 1, possibilities: [ { skill: BookTypes.MagicMissile, cost: 1 }, { skill: BookTypes.Spirits, cost: 1 }, { skill: BookTypes.FrostNova, cost: 2 }, { skill: BookTypes.Charm, cost: 4 }, { skill: BookTypes.Shockwave, cost: 3 }, ], }, }, ) export function replaceYoelItems(itemPlaceholders: IItemEntity[]) { const placeholders = itemPlaceholders.map((x : IBookEntity) => { x.itemType = ItemTypes.Book x.skill = BookTypes.Blink return x }) placeholders.forEach((x) => { const book = nextBook() x.skill = book.skill priceUp(x, book.cost) }) }
<filename>docs/navtreeindex1.js var NAVTREEINDEX1 = { "globals_type.html":[2,1,1], "hierarchy.html":[1,2], "index.html":[], "namespace_chef_devr.html":[1,0,0], "namespace_chef_devr.html":[0,0,0], "namespacemembers.html":[0,1,0], "namespacemembers_func.html":[0,1,1], "namespacemembers_type.html":[0,1,3], "namespacemembers_vars.html":[0,1,2], "namespaces.html":[0,0], "pages.html":[], "types_8h.html":[2,0,23], "types_8h.html#aa7d9f787c24a42aca7a754a29f67bcac":[2,0,23,0], "types_8h.html#ab94fb10d249c6a83c367d13ef7598637":[2,0,23,2], "types_8h.html#af9ef85362f7720c992cba629ad782f92":[2,0,23,1], "types_8h_source.html":[2,0,23], "waitingspinnerwidget_8cpp.html":[2,0,26], "waitingspinnerwidget_8h.html":[2,0,27], "waitingspinnerwidget_8h_source.html":[2,0,27] };
<filename>lib/sunrise/version.rb # frozen_string_literal: true module Sunrise VERSION = '1.1.1'.freeze end
#! /bin/bash declare -i argc=0 declare -a argv=() analyzeopts() { while (( $# > 0 )) do case $1 in --long-n) nflag='-longn' shift ;; --) shift break ;; -*) if [[ "$1" =~ 'n' ]]; then nflag='-n' fi if [[ "$1" =~ 'l' ]]; then lflag='-l' fi if [[ "$1" =~ 'p' ]]; then pflag='-p' fi shift ;; *) ((++argc)) argv=("${argv[@]}" "$1") shift ;; esac done while (( $# > 0 )) do ((++argc)) argv=("${argv[@]}" "$1") shift done } analyzeopts "$@" if [ "$nflag" != "" ]; then echo "used $nflag" fi if [ "$lflag" != "" ]; then echo "used $lflag" fi if [ "$pflag" != "" ]; then echo "used $pflag" fi echo "$argc item(s)" for item in "${argv[@]}" do echo "$item" done
source /usr/share/lmod/lmod/init/bash source /etc/profile.d/00-modulepath.sh LBANN_DIR=$(git rev-parse --show-toplevel) ${LBANN_DIR}/scripts/build_lbann_lc.sh --with-conduit
test -n "$ARTIFACTS_PATH" || exit 1 test -d "$ARTIFACTS_PATH" || exit 1 . .gitlab-ci/helpers/git-clone.sh rm -rf $work_tree/* cp -a $ARTIFACTS_PATH/* $work_tree $git_work add . if $git_work diff --cached --stat --exit-code; then empty=" (no changes)" else empty="" fi $git_work commit . --allow-empty --message="New pipeline #$CI_PIPELINE_ID for $CI_COMMIT_SHORT_SHA$empty" $git_work push -o ci.skip origin $brach
const express = require('express') const { exec } = require('child_process') const app = express() const COMMAND = 'open /Applications/Dictionary.app' app.options('/', (req, res) => { res.set('Access-Control-Allow-Origin', 'http://attacker.com:4001') res.set('Access-Control-Allow-Methods', 'PUT') res.send('ok') }) app.put('/', (req, res) => { exec(COMMAND, err => { res.set('Access-Control-Allow-Origin', 'http://attacker.com:4001') if (err) res.status(500).send(err) else res.status(200).send('Success') }) }) app.listen(4000,'127.0.0.1')
# always load gems for ruby export RUBYOPT=rubygems # rubygems shortcuts (http://stephencelis.com/archive/2008/6/bashfully-yours-gem-shortcuts) alias gems='cd /opt/local/lib/ruby/gems/1.8/gems' export GEMDIR=`gem env gemdir` gemdoc() { open $GEMDIR/doc/`$(which ls) $GEMDIR/doc | grep $1 | sort | tail -1`/rdoc/index.html } _gemdocomplete() { COMPREPLY=($(compgen -W '$(`which ls` $GEMDIR/doc)' -- ${COMP_WORDS[COMP_CWORD]})) return 0 } complete -o default -o nospace -F _gemdocomplete gemdoc gemlite() { gem install $1 --no-rdoc --no-ri } # unit_record and autotest alias autou='autotest' alias autof='AUTOTEST=functional autotest' # run autotest locked to ZenTest 3.9.2 alias autou392='autotest _3.9.2_' alias autof392='AUTOTEST=functional autotest _3.9.2_' # shorten mongrel cluster commands # example: cluster_start myapp cluster_restart () { mongrel_rails cluster::restart -C /etc/mongrel_cluster/$1.yml;} cluster_start () { mongrel_rails cluster::start -C /etc/mongrel_cluster/$1.yml;} cluster_stop () { mongrel_rails cluster::stop -C /etc/mongrel_cluster/$1.yml;}
/* * omg: InCondition.java * * Copyright 2019 <NAME> <<EMAIL>> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.ninjacat.omg.conditions; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Collection; public class InCondition<T> extends ComparisonCondition<Collection<T>> { @JsonCreator public InCondition(@JsonProperty("property") final String property, @JsonProperty("value") final Collection<T> value) { super(property, value); } @Override protected String operatorRepr() { return "in"; } @Override public ConditionMethod getMethod() { return ConditionMethod.IN; } }
import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { IonicModule } from '@ionic/angular'; import { TranslateModule } from '@ngx-translate/core'; import { CrVotesComponent } from './crvotes/crvotes.component'; import { MileStoneOptionsComponent } from './milestone-options/milestone-options.component'; import { TitleOptionsComponent } from './title-options/title-options.component'; import { ProposalTitleBarComponent } from './titlebar/titlebar.component'; import { VoteResultComponent } from './vote-result/vote-result.component'; @NgModule({ declarations: [ CrVotesComponent, VoteResultComponent, MileStoneOptionsComponent, TitleOptionsComponent, ProposalTitleBarComponent, ], imports: [ CommonModule, IonicModule, TranslateModule ], exports: [ CrVotesComponent, VoteResultComponent, MileStoneOptionsComponent, TitleOptionsComponent, ProposalTitleBarComponent, ], providers: [ ], entryComponents: [ CrVotesComponent, VoteResultComponent, MileStoneOptionsComponent, TitleOptionsComponent, ProposalTitleBarComponent, ], }) export class ComponentsModule { }
<gh_stars>0 import React from "react" import Layout from "../components/layout" import Languages from "../components/links-languages.js" import { Button } from 'reactstrap'; export default () => { const pageName = 'envia'; const label =''; const input = 'form-control'; return ( <div> <Layout currentLanguage='es' pageName={pageName}> <article> <h2>Participa</h2> <Languages pageName={pageName}/> <p>Convocatoria de participaciones para el proyecto Mal de Ojo. Se necesita una cantidad suficiente de fotografías para describir una lucha social y un texto breve que la acompañe. Todos los medios fotográficos son válidos y se primará la calidad artística. Fecha límite 16 de noviembre.</p> <p>Utiliza servicios como WeTransfer o Firefox Send para enviarnos tus archivos y los textos necesarios. Si lo necesitas envía un email a <EMAIL></p> <form css="max-width: 500px;" action="//formspree.io/<EMAIL>" method="POST"> <div className="form-group"> <label className={label} htmlFor="name">Nombre</label> <input className={input} type="text" placeholder="<NAME>" name="name"/> </div> <div className="form-group"> <label className={label} htmlFor="_replyto">Email</label> <input className={input} type="email" placeholder="<EMAIL>" name="_replyto"/> </div> <div className="form-group"> <label className={label} htmlFor="message">Mensaje</label> <textarea className={input} name="message" rows="3" placeholder="Tu mensaje"/> </div> <Button outline color="primary" css="margin-bottom: 32px;" type="submit">Envía</Button> </form> </article> </Layout> </div> )}
#!/bin/bash mkdir -p "$PREFIX/bin" export MACHTYPE=x86_64 export BINDIR=$(pwd)/bin export L="${LDFLAGS}" mkdir -p "$BINDIR" (cd kent/src/lib && make) (cd kent/src/htslib && make) (cd kent/src/jkOwnLib && make) (cd kent/src/hg/lib && make) (cd kent/src/utils/raToLines && make) cp bin/raToLines "$PREFIX/bin" chmod +x "$PREFIX/bin/raToLines"
def decimal_to_binary(num): return bin(int(num))[2:]
from modules.const import Keys """ディスク一覧部分のデータ雛形""" RS_DISKLIST = { Keys.ID: None, # "(01)" "(02)" "(03)" Keys.MODEL: None, # "WDC WD30EFRX-68AX9N0" "commandType": None, # ここからしか取れない AtaSmart.h commandTypeString "ssdVendorString": None, # ここからしか取れない AtaSmart.h ssdVendorString } """ディスク詳細部分のデータ雛形""" RS_DISK_DETAIL = { Keys.ID: None, # "(01)" "(02)" "(03)" Keys.KEY: None, # SerialNo or (no serialNo) id + model Keys.MODEL: None, Keys.FIRMWARE: None, Keys.SERIAL_NUMBER: None, Keys.INTERFACE: None, Keys.DISK_SIZE: None, Keys.POWER_ON_HOURS: None, Keys.POWER_ON_COUNT: None, Keys.HOST_READS: None, Keys.HOST_WRITES: None, Keys.NAND_WRITES: None, Keys.WEAR_LEVEL_COUNT: None, Keys.TEMPERATURE: None, Keys.HEALTH_STATUS: None, Keys.LIFESPAN: None, Keys.SMART: [] } """SMART値部分のデータ雛形""" RS_DISK_SMART = { Keys.SMART_ID: None, Keys.SMART_NAME: None, Keys.SMART_VALUE: None, Keys.SMART_WORST: None, Keys.SMART_THRESH: None } """ commandTypeString をわかりやすい文字列にする AtaSmart.h """ def commandTypeStringToString(commandTypeString): if (commandTypeString.startswith("ns")): return "NVMe Samsung" + commandTypeString[3:] elif (commandTypeString.startswith("ni")): return "NVMe Intel" + commandTypeString[3:] elif (commandTypeString.startswith("sq")): return "NVMe Storage Query" + commandTypeString[3:] elif (commandTypeString.startswith("nj")): return "NVMe JMicron" + commandTypeString[3:] elif (commandTypeString.startswith("na")): return "NVMe ASMedia" + commandTypeString[3:] elif (commandTypeString.startswith("nr")): return "NVMe Realtek" + commandTypeString[3:] elif (commandTypeString.startswith("nt")): return "NVMe Intel RST" + commandTypeString[3:] elif (commandTypeString.startswith("mr")): return "MegaRAID SAS" + commandTypeString[3:] else: return commandTypeString """ ssdVendorString をわかりやすい文字列にする AtaSmart.h """ def ssdVendorStringToString(ssdVendorString): if (ssdVendorString.startswith("mt")): return "MTron" + ssdVendorString[3:] elif (ssdVendorString.startswith("ix")): return "Indilinx" + ssdVendorString[3:] elif (ssdVendorString.startswith("jm")): return "JMicron" + ssdVendorString[3:] elif (ssdVendorString.startswith("il")): return "Intel" + ssdVendorString[3:] elif (ssdVendorString.startswith("sg")): return "SAMSUNG" + ssdVendorString[3:] elif (ssdVendorString.startswith("sf")): return "SandForce" + ssdVendorString[3:] elif (ssdVendorString.startswith("mi")): return "Micron" + ssdVendorString[3:] elif (ssdVendorString.startswith("oz")): return "OCZ" + ssdVendorString[3:] elif (ssdVendorString.startswith("st")): return "SEAGATE" + ssdVendorString[3:] elif (ssdVendorString.startswith("wd")): return "WDC" + ssdVendorString[3:] elif (ssdVendorString.startswith("px")): return "PLEXTOR" + ssdVendorString[3:] elif (ssdVendorString.startswith("sd")): return "SanDisk" + ssdVendorString[3:] elif (ssdVendorString.startswith("oz")): return "OCZ Vector" + ssdVendorString[3:] elif (ssdVendorString.startswith("to")): return "TOSHIBA" + ssdVendorString[3:] elif (ssdVendorString.startswith("co")): return "Corsair" + ssdVendorString[3:] elif (ssdVendorString.startswith("ki")): return "Kingston" + ssdVendorString[3:] elif (ssdVendorString.startswith("m2")): return "Micron MU02" + ssdVendorString[3:] elif (ssdVendorString.startswith("nv")): return "NVMe" + ssdVendorString[3:] elif (ssdVendorString.startswith("re")): return "Realtek" + ssdVendorString[3:] elif (ssdVendorString.startswith("sk")): return "SKhynix" + ssdVendorString[3:] elif (ssdVendorString.startswith("ki")): return "KIOXIA" + ssdVendorString[3:] elif (ssdVendorString.startswith("ss")): return "SSSTC" + ssdVendorString[3:] elif (ssdVendorString.startswith("id")): return "Intel DC" + ssdVendorString[3:] elif (ssdVendorString.startswith("ap")): return "Apacer" + ssdVendorString[3:] elif (ssdVendorString.startswith("sm")): return "SiliconMotion" + ssdVendorString[3:] elif (ssdVendorString.startswith("ph")): return "Phison" + ssdVendorString[3:] elif (ssdVendorString.startswith("ma")): return "Marvell" + ssdVendorString[3:] elif (ssdVendorString.startswith("mk")): return "Maxiotek" + ssdVendorString[3:] elif (ssdVendorString.startswith("ym")): return "YMTC" + ssdVendorString[3:] else: return ssdVendorString
package org.dimdev.rift.mixin.hook; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.client.CPacketCustomPayload; import net.minecraft.util.ResourceLocation; import org.dimdev.rift.injectedmethods.RiftCPacketCustomPayload; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @Mixin(CPacketCustomPayload.class) public class MixinCPacketCustomPayload implements RiftCPacketCustomPayload { @Shadow private ResourceLocation channel; @Shadow private PacketBuffer data; @Override public ResourceLocation getChannelName() { return channel; } @Override public PacketBuffer getData() { return data; } }
#!/bin/sh echo echo "James Build System" echo "-------------------" export ANT_HOME=$ANT_HOME ANT_HOME=./tools export OLD_CLASSPATH=$CLASSPATH CLASSPATH=phoenix-bin/lib/xercesImpl-2.0.2.jar:phoenix-bin/lib/xml-apis.jar ## Setup the Anakia stuff if [ -d ../jakarta-site2/lib ] ; then for i in ../jakarta-site2/lib/velocity*.jar do CLASSPATH=${CLASSPATH}:$i done for i in ../jakarta-site2/lib/jdom*.jar do CLASSPATH=${CLASSPATH}:$i done for i in ../jakarta-site2/lib/xerces*.jar do CLASSPATH=${CLASSPATH}:$i done echo "Jakarta-Site2 Module Found" fi export CLASSPATH chmod u+x ${ANT_HOME}/bin/antRun chmod u+x ${ANT_HOME}/bin/ant export PROPOSAL="" ${ANT_HOME}/bin/ant -emacs $@ export CLASSPATH=$OLD_CLASSPATH export ANT_HOME=$OLD_ANT_HOME
#create a range from 1 to 11 my_range = range(1,11) #print the range print(list(my_range)) # Output: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
<html> <head> <title>Search for matching strings</title> </head> <body> <form action="" method="post"> <input type="text" name="search_term" /> <input type="submit" value="Submit" /> </form> <?php if (isset($_POST['search_term'])) { $words = array("hello", "goodbye", "hey", "hi"); $search_term = $_POST['search_term']; foreach ($words as $word) { if (strpos($word, $search_term) !== false) { echo $word; } } } ?> </body> </html>
#!/bin/bash case $1 in compile) echo "compiling..." fbc -x build/asteroid_field -w all -lang fb -gen gcc -fpu sse -Wc -O3 src/main.bas ;; build) case $2 in linux) echo "building for linux..." fbc -x build/asteroid_field_linux -w all -lang fb -gen gcc -fpu sse -Wc -O3 -target linux src/main.bas ./build/asteroid_field_linux ;; freebsd) echo "building for freebsd..." fbc -x build/asteroid_field_win64.exe -w all -lang fb -gen gcc -fpu sse -Wc -O3 -target freebsd src/main.bas ./build/asteroid_field_freebsd ;; openbsd) echo "building for freebsd..." fbc -x build/asteroid_field_win64.exe -w all -lang fb -gen gcc -fpu sse -Wc -O3 -target openbsd src/main.bas ./build/asteroid_field_openbsd ;; win) echo "building for windows..." fbc -x build/asteroid_field_win64.exe -w all -lang fb -gen gcc -fpu sse -Wc -O3 -prefix /usr/local/ -target x86_64-w64-mingw32 src/main.bas echo "done" echo "running wine..." wine build/asteroid_field_win64.exe ;; *) echo "building..." fbc -x build/game -w all -lang fb -gen gcc -fpu sse -Wc -O3 src/main.bas ./build/asteroid_field ;; esac ;; *) echo "compiling..." fbc -x build/asteroid_field -w all -lang fb -gen gcc -fpu sse -Wc -O3 src/main.bas ;; esac echo "done."
#!/bin/sh ORACLE_SID=DBADEV1 export ORACLE_SID /u01/app/oracle/product/8.1.7/bin/svrmgrl << EOF connect internal/oracle alter user system default tablespace TOOLS; alter user system temporary tablespace TEMP; EOF
#!/bin/bash set -ex cni_manifest="/tmp/cni.yaml" setenforce 0 sed -i "s/^SELINUX=.*/SELINUX=permissive/" /etc/selinux/config # Disable swap swapoff -a sed -i '/ swap / s/^/#/' /etc/fstab # Disable spectre and meltdown patches echo 'GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} spectre_v2=off nopti hugepagesz=2M hugepages=64"' >> /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg systemctl stop firewalld || : systemctl disable firewalld || : # Make sure the firewall is never enabled again # Enabling the firewall destroys the iptable rules yum -y remove firewalld # Required for iscsi demo to work. yum -y install iscsi-initiator-utils cat <<EOF >/etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg EOF yum install -y \ docker-1.13.1 \ python-docker-py-1.10.6 \ python3-pip pip3 install --default-timeout=100 docker-pycreds # Log to json files instead of journald sed -i 's/--log-driver=journald //g' /etc/sysconfig/docker echo '{ "insecure-registries" : ["registry:5000"] }' > /etc/docker/daemon.json # Enable the permanent logging # Required by the fluentd journald plugin # The default settings in recent distribution for systemd is set to auto, # when on auto journal is permament when /var/log/journal exists mkdir -p /var/log/journal # Omit pgp checks until https://github.com/kubernetes/kubeadm/issues/643 is resolved. yum install --nogpgcheck -y \ kubeadm-${version} \ kubelet-${version} \ kubectl-${version} \ kubernetes-cni-0.6.0 # TODO use config file! this is deprecated cat <<EOT >/etc/sysconfig/kubelet KUBELET_EXTRA_ARGS=--cgroup-driver=systemd --runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice --feature-gates="BlockVolume=true,CSIBlockVolume=true,VolumeSnapshotDataSource=true" EOT systemctl daemon-reload systemctl enable docker && systemctl start docker systemctl enable kubelet && systemctl start kubelet # Needed for kubernetes service routing and dns # https://github.com/kubernetes/kubernetes/issues/33798#issuecomment-250962627 modprobe bridge modprobe br_netfilter cat <<EOF > /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF sysctl --system echo bridge >> /etc/modules echo br_netfilter >> /etc/modules default_cidr="192.168.0.0/16" pod_cidr="10.244.0.0/16" kubeadm init --pod-network-cidr=$pod_cidr --kubernetes-version v${version} --token abcdef.1234567890123456 kubectl --kubeconfig=/etc/kubernetes/admin.conf create -f "$cni_manifest" # Wait at least for 7 pods while [[ "$(kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system --no-headers | wc -l)" -lt 7 ]]; do echo "Waiting for at least 7 pods to appear ..." kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system sleep 10 done # Wait until k8s pods are running while [ -n "$(kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system --no-headers | grep -v Running)" ]; do echo "Waiting for k8s pods to enter the Running state ..." kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system --no-headers | >&2 grep -v Running || true sleep 10 done # Make sure all containers are ready while [ -n "$(kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers | grep false)" ]; do echo "Waiting for all containers to become ready ..." kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system -o'custom-columns=status:status.containerStatuses[*].ready,metadata:metadata.name' --no-headers sleep 10 done kubectl --kubeconfig=/etc/kubernetes/admin.conf get pods -n kube-system reset_command="kubeadm reset" admission_flag="admission-control" # k8s 1.11 asks for confirmation on kubeadm reset, which can be suppressed by a new force flag reset_command="kubeadm reset --force" # k8s 1.11 uses new flags for admission plugins # old one is deprecated only, but can not be combined with new one, which is used in api server config created by kubeadm admission_flag="enable-admission-plugins" $reset_command # audit log configuration mkdir /etc/kubernetes/audit audit_api_version="audit.k8s.io/v1" cat > /etc/kubernetes/audit/adv-audit.yaml <<EOF apiVersion: ${audit_api_version} kind: Policy rules: - level: Request users: ["kubernetes-admin"] resources: - group: kubevirt.io resources: - virtualmachines - virtualmachineinstances - virtualmachineinstancereplicasets - virtualmachineinstancepresets - virtualmachineinstancemigrations omitStages: - RequestReceived - ResponseStarted - Panic EOF cat > /etc/kubernetes/kubeadm.conf <<EOF apiVersion: kubeadm.k8s.io/v1beta1 bootstrapTokens: - groups: - system:bootstrappers:kubeadm:default-node-token token: abcdef.1234567890123456 ttl: 24h0m0s usages: - signing - authentication kind: InitConfiguration --- apiServer: extraArgs: allow-privileged: "true" audit-log-format: json audit-log-path: /var/log/k8s-audit/k8s-audit.log audit-policy-file: /etc/kubernetes/audit/adv-audit.yaml enable-admission-plugins: NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota feature-gates: BlockVolume=true,CSIBlockVolume=true,VolumeSnapshotDataSource=true,AdvancedAuditing=true extraVolumes: - hostPath: /etc/kubernetes/audit mountPath: /etc/kubernetes/audit name: audit-conf readOnly: true - hostPath: /var/log/k8s-audit mountPath: /var/log/k8s-audit name: audit-log timeoutForControlPlane: 4m0s apiVersion: kubeadm.k8s.io/v1beta1 certificatesDir: /etc/kubernetes/pki clusterName: kubernetes controlPlaneEndpoint: "" controllerManager: extraArgs: feature-gates: BlockVolume=true,CSIBlockVolume=true,VolumeSnapshotDataSource=true dns: type: CoreDNS etcd: local: dataDir: /var/lib/etcd imageRepository: k8s.gcr.io kind: ClusterConfiguration kubernetesVersion: ${version} networking: dnsDomain: cluster.local podSubnet: 10.244.0.0/16 serviceSubnet: 10.96.0.0/12 EOF # Create local-volume directories for i in {1..10} do mkdir -p /var/local/kubevirt-storage/local-volume/disk${i} mkdir -p /mnt/local-storage/local/disk${i} echo "/var/local/kubevirt-storage/local-volume/disk${i} /mnt/local-storage/local/disk${i} none defaults,bind 0 0" >> /etc/fstab done chmod -R 777 /var/local/kubevirt-storage/local-volume # Setup selinux permissions to local volume directories. chcon -R unconfined_u:object_r:svirt_sandbox_file_t:s0 /mnt/local-storage/ # Pre pull fluentd image used in logging docker pull fluent/fluentd:v1.2-debian docker pull fluent/fluentd-kubernetes-daemonset:v1.2-debian-syslog # Pre pull images used in Ceph CSI docker pull quay.io/k8scsi/csi-attacher:v1.0.1 docker pull quay.io/k8scsi/csi-provisioner:v1.0.1 docker pull quay.io/k8scsi/csi-snapshotter:v1.0.1 docker pull quay.io/cephcsi/rbdplugin:v1.0.0 docker pull quay.io/k8scsi/csi-node-driver-registrar:v1.0.2 # Create a properly labelled tmp directory for testing mkdir -p /provision/kubevirt.io/tests chcon -t container_file_t /provision/kubevirt.io/tests echo "tmpfs /provision/kubevirt.io/tests tmpfs rw,context=system_u:object_r:container_file_t:s0 0 1" >> /etc/fstab
#pragma once #include "Player.h" class NetPlayer : public Player { };
<filename>src/main/java/cc/sfclub/events/message/direct/PrivateMessageDeletedEvent.java<gh_stars>10-100 package cc.sfclub.events.message.direct; import cc.sfclub.core.Core; import cc.sfclub.events.message.Message; import cc.sfclub.transform.Contact; import lombok.Getter; /** * When a private message was deleted */ public class PrivateMessageDeletedEvent extends Message { @Getter private final Contact contact; public PrivateMessageDeletedEvent(String userID, String message, String transform, long messageID) { super(userID, message, transform, messageID); this.contact = Core.get() .bot(getTransform()) .orElseThrow(() -> new NullPointerException("Bot with transform " + getTransform() + "not found!")) .asContact(userID).orElseThrow(() -> new NullPointerException("Unknown error happened.(Contact not found)")); } }
#!/bin/sh # Copyright (c) 2015 Marcus Downing <marcus.downing@gmail.com> # Released under the 2-clause BSD license. # Replicates Gentoo's functions.sh in a portable way # Obviously borrow heavily from the original rc script # written by Roy Marples eindent() { . "$EFUNCTIONS_DIR/eindent" } eoutdent() { . "$EFUNCTIONS_DIR/eoutdent" } # http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac abspath() { if readlink -f "$1" 2>&1 | grep -q 'readlink: illegal option -- f'; then TARGET_FILE="$1" cd `dirname "$TARGET_FILE"` TARGET_FILE=`basename "$TARGET_FILE"` # Iterate down a (possible) chain of symlinks while [ -L "$TARGET_FILE" ] do TARGET_FILE="`readlink "$TARGET_FILE"`" cd "`dirname "$TARGET_FILE"`" TARGET_FILE="`basename "$TARGET_FILE"`" done # Compute the canonicalized name by finding the physical path # for the directory we're in and appending the target file. PHYS_DIR="`pwd -P`" RESULT="$PHYS_DIR/$TARGET_FILE" else RESULT="$(readlink -f "$1")" fi echo $RESULT } if [ -x "/etc/init.d/functions.sh" ]; then HERE="$(abspath "/etc/init.d/functions.sh")" else HERE="$(abspath "$0")" fi DIR="$(dirname "$HERE")" export EFUNCTIONS_DIR="$DIR/efunctions" export PATH="$PATH:$EFUNCTIONS_DIR" if [ -n "$TERM" ] && [ "$TERM" = unknown ] ; then export TERM=dumb fi if [ -z "$TERMINFO" ]; then export TERMINFO=$(whereis terminfo | grep -o '^[^ ]* [^ ]*' | grep -o '[^ ]*$') fi export EFUNCTIONS_ECHO="$(which echo)" export EINFO_INDENT=0
def calculate_bbox_center(bbox): xmin = bbox[0][0] ymin = bbox[0][1] xmax = bbox[2][0] ymax = bbox[2][1] xwidth = xmax - xmin ywidth = ymax - ymin center_x = xmin + xwidth / 2 center_y = ymin + ywidth / 2 return {'type': 'Point', 'coordinates': [center_x, center_y]}
import os def check_file_existence(file_names, directory): for file_name in file_names: file_path = os.path.join(directory, file_name) if os.path.exists(file_path): print(f"File {file_name} exists") else: print(f"File {file_name} does not exist") # Example usage file_names = ["file1.txt", "file2.txt", "file3.txt"] directory = "/path/to/directory" check_file_existence(file_names, directory)
import logging # Create logutillogger logutillogger = logging.getLogger('logutil') logutillogger.setLevel(logging.ERROR) # Create a file handler file_handler = logging.FileHandler('app_error.log') file_handler.setLevel(logging.ERROR) # Create a formatter formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(name)s - %(message)s') file_handler.setFormatter(formatter) # Add the file handler to the logger logutillogger.addHandler(file_handler) # Log the errors try: # Code that may throw an error except Exception as e: logutillogger.exception(e)
#!/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. if [ -n "$DEBUG" ]; then set -x fi set -o errexit set -o nounset set -o pipefail DIR=$(cd $(dirname "${BASH_SOURCE}") && pwd -P) export TAG=1.0.0-dev export REGISTRY=${REGISTRY:-ingress-controller} DEV_IMAGE=${REGISTRY}/controller:${TAG} if ! command -v kind &> /dev/null; then echo "kind is not installed" echo "Use a package manager (i.e 'brew install kind') or visit the official site https://kind.sigs.k8s.io" exit 1 fi if ! command -v kubectl &> /dev/null; then echo "Please install kubectl 1.15 or higher" exit 1 fi if ! command -v helm &> /dev/null; then echo "Please install helm" exit 1 fi HELM_VERSION=$(helm version 2>&1 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+') || true if [[ ${HELM_VERSION} < "v3.0.0" ]]; then echo "Please upgrade helm to v3.0.0 or higher" exit 1 fi KUBE_CLIENT_VERSION=$(kubectl version --client --short | awk '{print $3}' | cut -d. -f2) || true if [[ ${KUBE_CLIENT_VERSION} -lt 14 ]]; then echo "Please update kubectl to 1.15 or higher" exit 1 fi echo "[dev-env] building image" make build image docker tag "${REGISTRY}/controller:${TAG}" "${DEV_IMAGE}" export K8S_VERSION=${K8S_VERSION:-v1.19.0@sha256:3b0289b2d1bab2cb9108645a006939d2f447a10ad2bb21919c332d06b548bbc6} KIND_CLUSTER_NAME="ingress-nginx-dev" if ! kind get clusters -q | grep -q ${KIND_CLUSTER_NAME}; then echo "[dev-env] creating Kubernetes cluster with kind" cat <<EOF | kind create cluster --name ${KIND_CLUSTER_NAME} --image "kindest/node:${K8S_VERSION}" --config=- kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane kubeadmConfigPatches: - | kind: InitConfiguration nodeRegistration: kubeletExtraArgs: node-labels: "ingress-ready=true" authorization-mode: "AlwaysAllow" extraPortMappings: - containerPort: 80 hostPort: 80 protocol: TCP - containerPort: 443 hostPort: 443 protocol: TCP EOF else echo "[dev-env] using existing Kubernetes kind cluster" fi echo "[dev-env] copying docker images to cluster..." kind load docker-image --name="${KIND_CLUSTER_NAME}" "${DEV_IMAGE}" echo "[dev-env] deploying NGINX Ingress controller..." kubectl create namespace ingress-nginx &> /dev/null || true cat << EOF | helm template ingress-nginx ${DIR}/../charts/ingress-nginx --namespace=ingress-nginx --values - | kubectl apply -n ingress-nginx -f - controller: image: repository: ${REGISTRY}/controller tag: ${TAG} digest: config: worker-processes: "1" podLabels: deploy-date: "$(date +%s)" updateStrategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 hostPort: enabled: true terminationGracePeriodSeconds: 0 service: type: NodePort EOF cat <<EOF Kubernetes cluster ready and ingress-nginx listening in localhost using ports 80 and 443 To delete the dev cluster execute: 'kind delete cluster --name ingress-nginx-dev' EOF
const http = require('http'); http.createServer((req, res) => { if (req.url === '/') { res.writeHead(200, { 'Content-Type': 'text/html' }); res.end('<h1>Hello World</h1>'); } }).listen(8080);
<reponame>ianlini/dagian<gh_stars>10-100 from __future__ import print_function, division, absolute_import, unicode_literals from os.path import join, exists import sys from importlib import import_module from mkdir_p import mkdir_p def init_config(): mkdir_p(".dagianrc") default_global_config = """\ generator_class: feature_generator.FeatureGenerator data_bundles_dir: data_bundles # The additional arguments that will be given when initiating the data generator # object. generator_kwargs: h5py_hdf_dir: h5py pandas_hdf_dir: pandas.h5 """ default_bundle_config = """\ # The name of this bundle. This will be the file name of the data bundle. # Another suggested usage is to comment out this line, so the name will be # obtained from the file name of this config, that is, the name will be the same # as the config file name without the extension. name: default # The structure of the data bundle. All the involved data will be generated and # put into the global data file first (if data not exist), and then be bundled # according to this structure, and then write to the data bundle file. structure: id: id label: label features: - feature_1 - feature_2 # Special configuration for the structure. Here we set concat=True for # 'features'. It means that the data list in 'features' will be concatenated # into a dataset. structure_config: features: concat: True """ default_global_config_path = join(".dagianrc", "config.yml") if exists(default_global_config_path): print("Warning: %s exists so it's not generated." % default_global_config_path) else: with open(default_global_config_path, "w") as fp: fp.write(default_global_config) default_bundle_config_path = join(".dagianrc", "bundle_config.yml") if exists(default_bundle_config_path): print("Warning: %s exists so it's not generated." % default_bundle_config_path) else: with open(default_bundle_config_path, "w") as fp: fp.write(default_bundle_config) def get_class_from_str(class_str): module_name, class_name = class_str.rsplit(".", 1) sys.path.insert(0, '') module = import_module(module_name) sys.path.pop(0) generator_class = getattr(module, class_name) return generator_class def get_data_generator_class_from_config(global_config): # TODO: check the config generator_class = get_class_from_str(global_config['generator_class']) return generator_class def get_data_generator_from_config(global_config): generator_class = get_data_generator_class_from_config(global_config) data_generator = generator_class(**global_config['generator_kwargs']) return data_generator
#!/bin/bash # # version 0.1 # retries=${3:-20} if [ -z "$1" ]; then echo "host not specified" exit 1 fi if [ -z "$2" ]; then echo "port not specified" exit 1 fi try=0 while ! echo 1 2>/dev/null > /dev/tcp/$1/$2; do if [ $try -ge $retries ]; then echo "max retries (${retries}) exceeded, aborting" break fi echo "waiting for ${1}:${2} to be ready..."; sleep 3; try=`expr $try + 1` done
<filename>client/components/Category.js import React, { Component } from 'react' import { connect } from 'react-redux' import { addFilter, removeFilter } from '../store/filters' class Category extends Component { constructor() { super() this.state = { category: { 'Milk Chocolate': true, 'Dark Chocolate': true, 'White Chocolate': true } } this.handleChange = this.handleChange.bind(this) } componentDidMount() { this.setState({ category: this.props.filters.category }) } handleChange(event) { const oldState = this.state.category this.setState( { category: { ...oldState, [event.target.name]: event.target.checked } }, () => { return this.props.addFilter('category', this.state.category) } ) } render() { return ( <form> <label className="side-cont"> <h5>Filter by Category</h5> </label> <div className="custom-control custom-checkbox side-cont"> <input className="form-check-input" type="checkbox" id="defaultCheck1" name="Milk Chocolate" checked={this.state.category['Milk Chocolate']} onChange={this.handleChange} /> <label className="form-check-label">Milk Chocolate</label> </div> <div className="custom-control custom-checkbox side-cont"> <input className="form-check-input" type="checkbox" id="defaultCheck2" name="Dark Chocolate" checked={this.state.category['Dark Chocolate']} onChange={this.handleChange} /> <label className="form-check-label">Dark Chocolate</label> </div> <div className="custom-control custom-checkbox side-cont"> <input className="form-check-input" type="checkbox" id="defaultCheck3" name="White Chocolate" checked={this.state.category['White Chocolate']} onChange={this.handleChange} /> <label className="form-check-label">White Chocolate</label> </div> </form> ) } } const mapStateToProps = ({ filters }) => ({ filters }) const mapDispatchToProps = dispatch => ({ addFilter: (filterType, filter) => dispatch(addFilter(filterType, filter)), removeFilter: filter => dispatch(removeFilter(filter)) }) const ConnectedCategory = connect(mapStateToProps, mapDispatchToProps)(Category) export default ConnectedCategory
#!/bin/sh filtrer() { f="$1" ; shift "$@" < "$f" > "$f.filtre" && cat "$f.filtre" > "$f" && rm "$f.filtre" } # Cet abruti commence par dégommer puis recréer son OUT_DIR. Sauf que (au moins dans le cas pseudocargo), OUT_DIR, c'est là où on a déjà compilé toutes les dépendances, et où on a téléchargé libgit2 lui-même, accessoirement. filtrer build.rs grep -v OUT_DIR if false then chemins="`echo "$PKG_CONFIG_PATH" | tr : '\012' | sed -e 's#/lib/pkgconfig##' -e 's/^/"/' -e 's/$/"/' | tr '\012' ' '`" filtrer libgit2/CMakeLists.txt sed -e '/INCLUDE/{ x s/.// x t h i\ SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} '"$chemins"') }' fi
#!/bin/bash -eu # Copyright 2019 The Wuffs 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 # # https://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. # ---------------- CC=${CC:-gcc} # You may need to run # go get github.com/google/wuffs/cmd/wuffs-c # beforehand, to install the wuffs-c compiler. wuffs-c gen -package_name demo < parse.wuffs > parse.c $CC main.c ./a.out echo -------- $CC main.c -DUSE_WUFFS ./a.out rm a.out parse.c
const express = require('express'); const bodyParser = require('body-parser'); const logErrors = require('./middlewares/logErrors'); const errorHandler = require('./middlewares/errorHandler'); const welcomeMessage = 'Server up and running!'; const user = require('./routes/user.js'); const app = express(); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.use('/api', user); app.get('/', (req, res) => { res.status(200).send(welcomeMessage); }); app.use(logErrors); app.use(errorHandler); module.exports = app;
// TODO: This file was created by bulk-decaffeinate. // Sanity-check the conversion and remove this comment. /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from * DS102: Remove unnecessary code created because of implicit returns * DS202: Simplify dynamic range loops * DS207: Consider shorter variations of null checks * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ import { BufferAttribute } from "three/src/core/BufferAttribute.js"; import { ClipGeometry } from "./clipgeometry.js"; /* Render points as quads +----+ +----+ +----+ +----+ | | | | | | | | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+ | | | | | | | | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+ | | | | | | | | +----+ +----+ +----+ +----+ */ export class SpriteGeometry extends ClipGeometry { constructor(options) { let depth, height, items, width; super(options); this._clipUniforms(); this.items = items = +options.items || 2; this.width = width = +options.width || 1; this.height = height = +options.height || 1; this.depth = depth = +options.depth || 1; const samples = items * width * height * depth; const points = samples * 4; const triangles = samples * 2; this.setIndex(new BufferAttribute(new Uint32Array(triangles * 3), 1)); this.setAttribute( "position4", new BufferAttribute(new Float32Array(points * 4), 4) ); this.setAttribute( "sprite", new BufferAttribute(new Float32Array(points * 2), 2) ); const index = this._emitter("index"); const position = this._emitter("position4"); const sprite = this._emitter("sprite"); const quad = [ [-1, -1], [-1, 1], [1, -1], [1, 1], ]; let base = 0; for ( let i = 0, end = samples, asc = 0 <= end; asc ? i < end : i > end; asc ? i++ : i-- ) { index(base); index(base + 1); index(base + 2); index(base + 1); index(base + 2); index(base + 3); base += 4; } for ( let z = 0, end1 = depth, asc1 = 0 <= end1; asc1 ? z < end1 : z > end1; asc1 ? z++ : z-- ) { for ( let y = 0, end2 = height, asc2 = 0 <= end2; asc2 ? y < end2 : y > end2; asc2 ? y++ : y-- ) { for ( let x = 0, end3 = width, asc3 = 0 <= end3; asc3 ? x < end3 : x > end3; asc3 ? x++ : x-- ) { for ( let l = 0, end4 = items, asc4 = 0 <= end4; asc4 ? l < end4 : l > end4; asc4 ? l++ : l-- ) { for (const v of Array.from(quad)) { position(x, y, z, l); sprite(v[0], v[1]); } } } } } this._finalize(); this.clip(); } clip(width, height, depth, items) { if (width == null) { ({ width } = this); } if (height == null) { ({ height } = this); } if (depth == null) { ({ depth } = this); } if (items == null) { ({ items } = this); } this._clipGeometry(width, height, depth, items); return this._clipOffsets( 6, width, height, depth, items, this.width, this.height, this.depth, this.items ); } }
<filename>assets/app/elements/tag/connects-arrow.js angular.module("wust.elements").directive("connectsArrow", connectsArrow); connectsArrow.$inject = ["Helpers"]; function connectsArrow(Helpers) { return { restrict: "E", templateUrl: "elements/tag/connects-arrow.html", replace: true, transclude: true, scope: { source: "=", target: "=", }, link }; function link(scope, elem) { let rawElem = elem[0]; scope.$watchCollection(() => scope.source.classifications, refreshColor); function refreshColor() { setColor(selectTag(scope.source, scope.target)); } function selectTag(source, target) { let connects = _.find(source.outRelations, h => h.endNode.id === target.id); scope.classifications = Helpers.sortedNodeTags(connects); return scope.classifications[0]; } function setColor(tag) { let svg = rawElem.children[2].children[0]; let arrowLine = svg.children[0]; let arrowHead = svg.children[1]; if (tag === undefined || tag.id === undefined) { arrowLine.style.stroke = ""; arrowHead.style.fill = ""; } else { arrowLine.style.fill = Helpers.classificationCircleBackgroundColor(tag); arrowLine.style.stroke = Helpers.classificationCircleBorderColor(tag); arrowHead.style.fill = Helpers.classificationCircleBackgroundColor(tag); arrowHead.style.stroke = Helpers.classificationCircleBorderColor(tag); } } } }
package com.shadowolfyt.zander.guis; import com.shadowolfyt.zander.ZanderMain; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Difficulty; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.util.Arrays; public class DifficultyGUI implements Listener { ZanderMain plugin; public DifficultyGUI(ZanderMain instance) { plugin = instance; } Inventory inv = Bukkit.createInventory(null, 9, "Difficulty Manager"); public DifficultyGUI(Player player) { if (player == null) { return; } ItemStack diffpeaceful = new ItemStack(Material.FEATHER); ItemMeta diffpeacefulMeta = diffpeaceful.getItemMeta(); diffpeacefulMeta.setDisplayName("Peaceful"); diffpeacefulMeta.setLore(Arrays.asList("Turn the server global difficulty to Peaceful.")); diffpeaceful.setItemMeta(diffpeacefulMeta); inv.setItem(1, diffpeaceful); ItemStack diffeasy = new ItemStack(Material.WOODEN_SWORD); ItemMeta diffeasyMeta = diffeasy.getItemMeta(); diffeasyMeta.setDisplayName("Easy"); diffeasyMeta.setLore(Arrays.asList("Turn the server global difficulty to Easy.")); diffeasy.setItemMeta(diffeasyMeta); inv.setItem(3, diffeasy); ItemStack diffnormal = new ItemStack(Material.IRON_SWORD); ItemMeta diffnormalMeta = diffnormal.getItemMeta(); diffnormalMeta.setDisplayName("Normal"); diffnormalMeta.setLore(Arrays.asList("Turn the server global difficulty to Normal.")); diffnormal.setItemMeta(diffnormalMeta); inv.setItem(5, diffnormal); ItemStack diffhard = new ItemStack(Material.DIAMOND_SWORD); ItemMeta diffhardMeta = diffhard.getItemMeta(); diffhardMeta.setDisplayName("Hard"); diffhardMeta.setLore(Arrays.asList("Turn the server global difficulty to Hard.")); diffhard.setItemMeta(diffhardMeta); inv.setItem(7, diffhard); player.openInventory(inv); } @EventHandler public void onClick(InventoryClickEvent event) { if (!event.getView().getTitle().equalsIgnoreCase("Difficulty Manager")) { return; } Player player = (Player) event.getWhoClicked(); event.setCancelled(true); if (event.getCurrentItem() == null || event.getCurrentItem().getType() == null || !event.getCurrentItem().hasItemMeta()) { player.closeInventory(); return; } switch (event.getCurrentItem().getType()) { // Peaceful case FEATHER: player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("prefix")) + " Server difficulty has been set to Peaceful."); player.getWorld().setDifficulty(Difficulty.PEACEFUL); player.closeInventory(); break; // Easy case WOODEN_SWORD: player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("prefix")) + " Server difficulty has been set to Easy."); player.getWorld().setDifficulty(Difficulty.EASY); player.closeInventory(); break; // Normal case IRON_SWORD: player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("prefix")) + " Server difficulty has been set to Normal."); player.getWorld().setDifficulty(Difficulty.NORMAL); player.closeInventory(); break; // Hard case DIAMOND_SWORD: player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("prefix")) + " Server difficulty has been set to Hard."); player.getWorld().setDifficulty(Difficulty.HARD); player.closeInventory(); break; default: break; } } }