text stringlengths 1 1.05M |
|---|
from flask import Flask, redirect, url_for, render_template, request, flash, session, jsonify
import decimal
import os
import uuid
from os.path import join, dirname
from dotenv import load_dotenv
import requests
app = Flask(__name__)
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
app.secret_key = os.environ.get('APP_SECRET_KEY')
API_URL = "https://sandbox.checkout.com/api2/v2"
auth_headers = {"Authorization": os.environ.get('SECRET_KEY')}
@app.route('/', methods=['GET'])
def index():
return redirect(url_for('new_checkout'))
@app.route('/checkouts/new', methods=['GET'])
def new_checkout():
return render_template('checkouts/new.html')
@app.route('/checkouts/<tx_id>', methods=['GET'])
def show_checkout(tx_id):
# url = API_URL + '/payments/{}'.format(tx_id)
# resp = requests.get(url, auth=auth_pair)
payment = session["payment"]
result = {}
if payment["status"] == 'Authorised':
result = {
'header': 'Sweet Success!',
'icon': 'success',
'message': ('Your test transaction has been successfully processed.'
'See the API response and try again.')
}
else:
result = {
'header': 'Transaction Failed',
'icon': 'fail',
'message': ('Your test transaction has a status of '
'{responseCode} ({responseMessage}): {responseAdvancedInfo}. See'
' API response and try again.').format(**payment)
}
return render_template('checkouts/show.html', payment=payment, result=result)
"""
curl https://sandbox.checkout.com/api2/v2/charges/card
-H "Authorization: sk_test_55aedccc-7f53-4ccc-b0a6-d943decc3c31"
-H "Content-Type:application/json;charset=UTF-8"
-X POST
-d '{
"autoCapTime": "24",
"autoCapture": "Y",
"chargeMode": 1,
"email": "<EMAIL>",
"customerName": "<NAME>",
"description": "charge description",
"value": "4298",
"currency": "GBP",
"trackId": "TRK12345",
"transactionIndicator": "1",
"customerIp":"192.168.127.12",
"card": {
"name": "<NAME>",
"number": "4242424242424242",
"expiryMonth": "06",
"expiryYear": "2018",
"cvv": "100",
"billingDetails": {
"addressLine1": "623 Slade Street",
"addressLine2": "Flat 9",
"postcode": "E149SR",
"country": "UK",
"city": "London",
"state": "Greater London",
"phone" : {
"countryCode" : "44",
"number" : "12345678"
}
}
},
"shippingDetails": {
"addressLine1": "623 Slade Street",
"addressLine2": "Flat 9",
"postcode": "E149SR",
"country": "UK",
"city": "London",
"state": "Greater London",
"phone" : {
"countryCode" : "44",
"number" : "12345678"
}
},
"products": [
{
"description": "Tablet 1 gold limited",
"image": null,
"name": "Tablet 1 gold limited",
"price": 100.0,
"quantity": 1,
"shippingCost": 10.0,
"sku": "1aab2aa",
"trackingUrl": "https://www.tracker.com"
},
{
"description": "Tablet 2 gold limited",
"image": null,
"name": "Tablet 2 gold limited",
"price": 200.0,
"quantity": 2,
"shippingCost": 10.0,
"sku": "1aab2aa",
"trackingUrl": "https://www.tracker.com"
}
],
"metadata": {
"key1": "value1"
},
"udf1": "udf 1 value",
"udf2": "udf 2 value",
"udf3": "udf 3 value",
"udf4": "udf 4 value",
"udf5": "udf 5 value"
} '
"""
@app.route('/checkouts', methods=['POST'])
def create_checkout():
curr = request.form['currency']
price_key = 'price_' + curr
price = decimal.Decimal(request.form[price_key])
tx_amount = int(request.form['amount']) * price * 100
tx_data = {
"email": '<EMAIL>',
"value": int(tx_amount),
"currency": curr,
"trackId": str(uuid.uuid4())[:8],
"card": {
"name": request.form['card_holder'],
"number": request.form['card_number'],
"expiryMonth": request.form['card_exp_month'],
"expiryYear": request.form['card_exp_year'],
"cvv": request.form['card_cvv'],
}}
resp = requests.post(API_URL + '/charges/card', json=tx_data, headers=auth_headers)
print("PUSHED::", tx_data)
print("RESP::", resp)
# return resp.content
payment = resp.json()
# s = payment["Status"]
session["payment"] = payment
if payment["status"] == "Authorised": # Transaction Approved
session["card_id"] = payment["card"]["id"]
print("ALLOK ")
return redirect(url_for('show_checkout', tx_id=payment["id"]))
else:
return redirect(url_for('show_checkout', tx_id=payment["id"] or 'xxx'))
@app.route('/checkouts/one_more', methods=['POST'])
def create_checkout_more():
price = decimal.Decimal(request.form["price"])
tx_amount = price * 100
tx_data = {
"email": '<EMAIL>',
"value": int(tx_amount),
"currency": "USD",
"trackId": str(uuid.uuid4())[:8],
# "cardId": session["card_id"],
}
resp = requests.post(API_URL + '/charges/customer', json=tx_data, headers=auth_headers)
print("PUSHED::", tx_data)
print("RESP::", resp.content)
print("RESP::", resp)
payment = resp.json()
session["payment"] = payment
if payment["status"] == "Authorised": # Transaction Approved
return redirect(url_for('show_checkout', tx_id=payment["id"]))
else:
return redirect(url_for('show_checkout', tx_id=payment["id"] or 'xxx'))
@app.route('/refund/partial', methods=['POST'])
def refund_partial():
data = {
"value": int(decimal.Decimal(request.form["amount"])) * 100
}
url = API_URL + '/charges/{}/refund'.format(request.form["payment_id"])
result = requests.post(url, json=data, headers=auth_headers)
print("PUSHED::", url, data)
return jsonify(result.json())
@app.route('/refund', methods=['POST'])
def refund():
url = API_URL + '/charges/{}/history'.format(request.form["payment_id"])
result = requests.get(url, headers=auth_headers)
for charge in result.json()["charges"]:
if charge["status"] == "Captured":
chargeId = charge["id"]
url = API_URL + '/charges/{}/refund'.format(chargeId)
result = requests.post(url, json={}, headers=auth_headers)
print("PUSHED::", url)
return jsonify(result.json())
if __name__ == '__main__':
app.run(host='0.0.0.0', port=4567, debug=True)
|
class AppInst:
def __init__(self):
self.logger = Logger() # Assume Logger class is provided
self.connection_established = False
self.session = None
def disconnect_client(self, session: str, connection_duration: int, connected_clients: dict):
if self.connection_established and session in connected_clients:
self.logger.info(f'Session <{session}> from host {connected_clients[session]} has disconnected. Connection duration: {connection_duration}')
self.connection_established = False
del connected_clients[session]
connected_clients['number'] -= 1
self.logger.info(f'Still connected clients: {connected_clients}')
else:
self.logger.error(f'Error: Session <{session}> not found or connection not established.')
# Usage
connected_clients = {'session1': 'host1', 'session2': 'host2', 'number': 2}
app_instance = AppInst()
app_instance.disconnect_client('session1', 120, connected_clients) |
#!/bin/sh
set -e
HOST=sehll.telent.net
(cd ../texticlj && lein install)
lein uberjar
DEST=yablog_`date +%s`.jar
scp target/uberjar/yablog-0.1.0-SNAPSHOT-standalone.jar sehll.telent.net:share/$DEST
cat <<EOF | ssh $HOST /bin/sh
set -ex
cd share
test -L yablog.jar && rm yablog.jar
ln -s \$(pwd)/$DEST yablog.jar
EOF
# have to do this as separate step because of password prompt
ssh -t $HOST sudo sv term telent-blog coruskate-blog
|
#!/bin/bash
set -e
# Download the sumo collector executable
sudo wget 'https://collectors.us2.sumologic.com/rest/download/linux/64' -O SumoCollector.sh && \
sudo chmod +x SumoCollector.sh
access_id=$(credstash -r us-east-1 get sumologic.access_id)
access_key=$(credstash -r us-east-1 get sumologic.access_key)
sudo ./SumoCollector.sh -q \
-VskipRegistration=true \
-Vephemeral=true \
-Vsources=/etc/sumologic/sources.json \
-Vsumo.accessid=$access_id \
-Vsumo.accesskey=$access_key |
#!/bin/bash
WORK=25
PAUSE=5
INTERACTIVE=true
MUTE=false
show_help() {
cat <<-END
usage: potato [-s] [-m] [-w m] [-b m] [-h]
-s: simple output. Intended for use in scripts
When enabled, potato outputs one line for each minute, and doesn't print the bell character
(ascii 007)
-m: mute -- don't play sounds when work/break is over
-w m: let work periods last m minutes (default is 25)
-b m: let break periods last m minutes (default is 5)
-h: print this message
END
}
while getopts :sw:b:m opt; do
case "$opt" in
s)
INTERACTIVE=false
;;
m)
MUTE=true
;;
w)
WORK=$OPTARG
;;
b)
PAUSE=$OPTARG
;;
h|\?)
show_help
exit 1
;;
esac
done
time_left="%im left of %s "
if $INTERACTIVE; then
time_left="\r$time_left"
else
time_left="$time_left\n"
fi
while true
do
for ((i=$WORK; i>0; i--))
do
printf "$time_left" $i "work"
sleep 1m
done
! $MUTE && cvlc --play-and-exit /usr/share/sounds/pomodoro/intro.mp3&>/dev/null
if $INTERACTIVE; then
read -d '' -t 0.001
echo -e "\a"
echo "Work over"
read
fi
for ((i=$PAUSE; i>0; i--))
do
printf "$time_left" $i "pause"
sleep 1m
done
! $MUTE && cvlc --play-and-exit /usr/share/sounds/pomodoro/intro.mp3&>/dev/null
if $INTERACTIVE; then
read -d '' -t 0.001
echo -e "\a"
echo "Pause over"
read
fi
done
|
<reponame>pstorch/RSWebsite
import $ from "jquery";
import { getAPIURI, getQueryParameter, scaleImage } from "./common";
import "bootstrap";
import { getI18n } from "./i18n";
window.$ = $;
$(document).ready(function () {
const vars = getQueryParameter();
const photographer = vars.photographer;
$("#title-form").html(
`${getI18n(s => s.photographer.photosBy)} ${photographer}`
);
$.ajax({
url: `${getAPIURI()}stations?photographer=${photographer}`,
type: "GET",
dataType: "json",
error: function () {
$("#stations").html(
`${getI18n(
s => s.photographer.errorLoadingStationsOfPhotographer
)} ${photographer}`
);
},
success: function (obj) {
if (Array.isArray(obj) && obj.length > 0) {
$("#photographer").attr("href", obj[0].photographerUrl);
for (let i = 0; i < obj.length; i++) {
let station = obj[i];
const photoURL = scaleImage(station.photoUrl, 301);
const detailLink = `station.php?countryCode=${station.country}&stationId=${station.idStr}`;
$("#stations").append(
`
<div class="col mb-4">
<div class="card" style="max-width: 302px;">
<div class="card-body"><h5 class="card-title"><a href="${detailLink}" data-ajax="false">${
station.title
}</a></h5>
<p class="card-text">
<small class="text-muted">
${getI18n(s => s.photographer.licence)}: <a href="${
station.licenseUrl
}">${station.license}</a>
</small>
</p>
</div>
<a href="${detailLink}" data-ajax="false">
<img src="${photoURL}" class="card-img-top" style="width:301px;" alt="${
station.title
}">
</a>
</div>
</div>
`
);
}
} else {
$("#stations").html(getI18n(s => s.photographer.noStationsFound));
}
},
});
});
|
package br.edu.ifpb.hefastos_android.listeners;
import android.view.View;
import android.widget.AdapterView;
import br.edu.ifpb.hefastos_android.activities.delete.DeleteAssuntoActivity;
/**
* Created by Gabriel on 09/04/2017.
*/
public class DisciplinaOnItemSelectedListener implements AdapterView.OnItemClickListener {
DeleteAssuntoActivity deleteAssuntoActivity;
public DisciplinaOnItemSelectedListener(DeleteAssuntoActivity deleteAssuntoActivity) {
this.deleteAssuntoActivity = deleteAssuntoActivity;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
deleteAssuntoActivity.setDisciplina(deleteAssuntoActivity.getDisciplinas().get(position));
deleteAssuntoActivity.listarAssuntos(deleteAssuntoActivity.getDisciplina().getId());
}
}
|
<filename>src/com/opengamma/analytics/financial/equity/variance/pricing/VarianceSwapStaticReplication.java
/**
* Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.analytics.financial.equity.variance.pricing;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang.Validate;
import com.opengamma.analytics.financial.equity.StaticReplicationDataBundle;
import com.opengamma.analytics.financial.model.volatility.surface.BlackVolatilitySurface;
import com.opengamma.analytics.financial.model.volatility.surface.BlackVolatilitySurfaceDelta;
import com.opengamma.analytics.financial.model.volatility.surface.BlackVolatilitySurfaceLogMoneyness;
import com.opengamma.analytics.financial.model.volatility.surface.BlackVolatilitySurfaceMoneyness;
import com.opengamma.analytics.financial.model.volatility.surface.BlackVolatilitySurfaceStrike;
import com.opengamma.analytics.financial.model.volatility.surface.BlackVolatilitySurfaceVisitor;
import com.opengamma.analytics.financial.varianceswap.VarianceSwap;
import com.opengamma.analytics.math.integration.Integrator1D;
import com.opengamma.util.tuple.DoublesPair;
/**
* We construct a model independent method to price variance as a static replication
* of an (in)finite sum of call and put option prices on the underlying.
* We assume the existence of a smooth function of these option prices / implied volatilities.
* The portfolio weighting is 1/k^2. As such, this method is especially sensitive to strike near zero.
* <p>
* Note: This is not intended to handle large payment delays between last observation date and payment. No convexity adjustment has been applied.<p>
* Note: Forward variance (forward starting observations) is intended to consider periods beginning more than A_FEW_WEEKS from trade inception
*/
public class VarianceSwapStaticReplication {
private final ExpectedVarianceStaticReplicationCalculator _cal;
public VarianceSwapStaticReplication() {
_cal = new ExpectedVarianceStaticReplicationCalculator();
}
public VarianceSwapStaticReplication(final double tolerance) {
_cal = new ExpectedVarianceStaticReplicationCalculator(tolerance);
}
public VarianceSwapStaticReplication(final Integrator1D<Double, Double> integrator) {
_cal = new ExpectedVarianceStaticReplicationCalculator(integrator);
}
public VarianceSwapStaticReplication(final Integrator1D<Double, Double> integrator, final double tolerance) {
_cal = new ExpectedVarianceStaticReplicationCalculator(integrator, tolerance);
}
public double presentValue(final VarianceSwap deriv, final StaticReplicationDataBundle market) {
Validate.notNull(deriv, "VarianceSwap deriv");
Validate.notNull(market, "EquityOptionDataBundle market");
if (deriv.getTimeToSettlement() < 0) {
return 0.0; // All payments have been settled
}
// Compute contribution from past realizations
final double realizedVar = new RealizedVariance().evaluate(deriv); // Realized variance of log returns already observed
// Compute contribution from future realizations
final double remainingVar = expectedVariance(deriv, market); // Remaining variance implied by option prices
// Compute weighting
final double nObsExpected = deriv.getObsExpected(); // Expected number as of trade inception
final double nObsDisrupted = deriv.getObsDisrupted(); // Number of observations missed due to market disruption
double nObsActual = 0;
if (deriv.getTimeToObsStart() <= 0) {
Validate.isTrue(deriv.getObservations().length > 0, "presentValue requested after first observation date, yet no observations have been provided.");
nObsActual = deriv.getObservations().length - 1; // From observation start until valuation
}
final double totalVar = realizedVar * (nObsActual / nObsExpected) + remainingVar * (nObsExpected - nObsActual - nObsDisrupted) / nObsExpected;
final double finalPayment = deriv.getVarNotional() * (totalVar - deriv.getVarStrike());
final double df = market.getDiscountCurve().getDiscountFactor(deriv.getTimeToSettlement());
return df * finalPayment;
}
/**
* Computes the fair value strike of a spot starting VarianceSwap parameterised in 'variance' terms,
* It is quoted as an annual variance value, hence 1/T * integral(0,T) {sigmaSquared dt} <p>
*
* @param deriv VarianceSwap derivative to be priced
* @param market EquityOptionDataBundle containing volatility surface, forward underlying, and funding curve
* @return presentValue of the *remaining* variance in the swap.
*/
public double expectedVariance(final VarianceSwap deriv, final StaticReplicationDataBundle market) {
validateData(deriv, market);
final double timeToLastObs = deriv.getTimeToObsEnd();
if (timeToLastObs <= 0) { //expired swap returns 0 variance
return 0.0;
}
final double timeToFirstObs = deriv.getTimeToObsStart();
// Compute Variance from spot until last observation
final double varianceSpotEnd = expectedVarianceFromSpot(timeToLastObs, market);
// If timeToFirstObs= 0.0, the pricer will consider the volatility to be from now until timeToLastObs
final boolean forwardStarting = timeToFirstObs > 0.0;
if (!forwardStarting) {
return varianceSpotEnd;
}
final double varianceSpotStart = expectedVarianceFromSpot(timeToFirstObs, market);
return (varianceSpotEnd * timeToLastObs - varianceSpotStart * timeToFirstObs) / (timeToLastObs - timeToFirstObs);
}
private void validateData(final VarianceSwap deriv, final StaticReplicationDataBundle market) {
Validate.notNull(deriv, "VarianceSwap deriv");
Validate.notNull(market, "EquityOptionDataBundle market");
final double timeToLastObs = deriv.getTimeToObsEnd();
final double timeToFirstObs = deriv.getTimeToObsStart();
Validate.isTrue(timeToFirstObs < timeToLastObs, "timeToLastObs is not sufficiently longer than timeToFirstObs");
}
/**
* Computes the fair value strike of a spot starting VarianceSwap parameterized in 'variance' terms,
* It is quoted as an annual variance value, hence 1/T * integral(0,T) {sigmaSquared dt} <p>
*
* @param expiry Time from spot until last observation
* @param market EquityOptionDataBundle containing volatility surface, forward underlying, and funding curve
* @return presentValue of the *remaining* variance in the swap.
*/
protected double expectedVarianceFromSpot(final double expiry, final StaticReplicationDataBundle market) {
// 1. Unpack Market data
final double fwd = market.getForwardCurve().getForward(expiry);
final BlackVolatilitySurface<?> volSurf = market.getVolatilitySurface();
final VarianceCalculator varCal = new VarianceCalculator(fwd, expiry);
return varCal.getVariance(volSurf);
}
/**
* Computes the fair value strike of a spot starting VarianceSwap parameterised in vol/vega terms.
* This is an estimate of annual Lognormal (Black) volatility
*
* @param deriv VarianceSwap derivative to be priced
* @param market EquityOptionDataBundle containing volatility surface, forward underlying, and funding curve
* @return presentValue of the *remaining* variance in the swap.
*/
public double expectedVolatility(final VarianceSwap deriv, final StaticReplicationDataBundle market) {
final double sigmaSquared = expectedVariance(deriv, market);
return Math.sqrt(sigmaSquared);
}
/**
* This is just a wrapper around ExpectedVarianceCalculator which uses a visitor pattern to farm out the calculation to the correct method of ExpectedVarianceCalculator
* depending on the type of BlackVolatilitySurface
*/
private class VarianceCalculator implements BlackVolatilitySurfaceVisitor<DoublesPair, Double> {
private final double _t;
private final double _f;
public VarianceCalculator(final double forward, final double expiry) {
_f = forward;
_t = expiry;
}
public double getVariance(final BlackVolatilitySurface<?> surf) {
return surf.accept(this);
}
//********************************************
// strike surfaces
//********************************************
@SuppressWarnings("synthetic-access")
@Override
public Double visitStrike(final BlackVolatilitySurfaceStrike surface, final DoublesPair data) {
throw new NotImplementedException();
}
@SuppressWarnings("synthetic-access")
@Override
public Double visitStrike(final BlackVolatilitySurfaceStrike surface) {
return _cal.getAnnualizedVariance(_f, _t, surface);
}
//********************************************
// delta surfaces
//********************************************
@SuppressWarnings("synthetic-access")
@Override
public Double visitDelta(final BlackVolatilitySurfaceDelta surface, final DoublesPair data) {
throw new NotImplementedException();
}
@SuppressWarnings("synthetic-access")
@Override
public Double visitDelta(final BlackVolatilitySurfaceDelta surface) {
return _cal.getAnnualizedVariance(_f, _t, surface);
}
//********************************************
// moneyness surfaces
//********************************************
@Override
public Double visitMoneyness(final BlackVolatilitySurfaceMoneyness surface, final DoublesPair data) {
throw new NotImplementedException();
}
@SuppressWarnings("synthetic-access")
@Override
public Double visitMoneyness(final BlackVolatilitySurfaceMoneyness surface) {
return _cal.getAnnualizedVariance(_t, surface);
}
//********************************************
// log-moneyness surfaces
//********************************************
/**
* Only use if the integral limits have been calculated elsewhere, or you need the contribution from a specific range
*/
@SuppressWarnings("synthetic-access")
@Override
public Double visitLogMoneyness(final BlackVolatilitySurfaceLogMoneyness surface, final DoublesPair data) {
throw new NotImplementedException();
}
/**
* General method when you wish to compute the expected variance from a log-moneyness parametrised surface to within a certain tolerance
* @param surface log-moneyness parametrised volatility surface
* @return expected variance
*/
@SuppressWarnings("synthetic-access")
@Override
public Double visitLogMoneyness(final BlackVolatilitySurfaceLogMoneyness surface) {
return _cal.getAnnualizedVariance(_t, surface);
}
}
}
|
import numpy as np
random_booleans = np.random.choice([True, False], size=10) |
<reponame>awoimbee/docs_versions_menu<filename>tests/test_docs_versions_menu.py
"""Tests for `docs_versions_menu` package."""
import pytest
from pkg_resources import parse_version
import docs_versions_menu
def test_valid_version():
"""Check that the package defines a valid ``__version__``."""
v_curr = parse_version(docs_versions_menu.__version__)
v_orig = parse_version("0.1.0-dev")
assert v_curr >= v_orig
|
"""
Create a new class in Java that compares two strings, and returns the longer one
"""
public class StringComparer {
public String compare(String a, String b) {
if (a.length() > b.length()) {
return a;
} else if (b.length() > a.length()) {
return b;
} else {
return "Strings are the same length";
}
}
} |
import * as fs from 'fs'
import * as glob from 'glob'
for (const filename of glob.sync('src/sql/**/*.ts')) {
const file_source = fs.readFileSync(filename, 'utf-8')
fs.writeFileSync(filename, file_source.replace(
`import * as __escape from 'escape-html';`,
`function __escape(v: string) { return v }`,
))
}
|
StartTest(function(t) {
var finder = new Ariadne.DomQueryFinder()
var body
t.beforeEach(function () {
body = document.body
body.className = ''
body.parentNode.clasName = ''
})
var unique = function (selector) { return body.querySelectorAll(selector)[ 0 ] }
t.it('basic query', function (t) {
t.isDeeply(finder.findQueries(body), [ 'body' ])
t.isDeeply(finder.findQueries(body.parentNode), [ 'html' ])
body.innerHTML =
'<a>' +
'<b>' +
'<c></c>' +
'</b>' +
'</a>'
t.isDeeply(finder.findQueries(unique('c')), [ 'c' ])
t.isDeeply(finder.findQueries(unique('b')), [ 'b' ])
t.isDeeply(finder.findQueries(unique('a')), [ 'a' ])
t.isDeeply(finder.findQueries(unique('b'), unique('a')), [ 'b' ])
})
t.it('basic query', function (t) {
body.innerHTML =
'<a>' +
'<b>' +
'<c></c>' +
'</b>' +
'</a>' +
'<b>' +
'<c></c>' +
'</b>'
t.isDeeply(finder.findQueries(unique('a c')), [ 'a c' ])
t.isDeeply(finder.findQueries(unique('a c'), unique('a')), [ 'c' ])
body.innerHTML =
'<a>' +
'<b>' +
'<c>' +
'<d></d>' +
'</c>' +
'<d></d>' +
'</b>' +
'<b></b>' +
'</a>' +
'<c>' +
'<d></d>' +
'</c>' +
'<b>' +
'<d></d>' +
'</b>'
t.isDeeply(finder.findQueries(unique('a c d')), [ 'a c d' ])
body.innerHTML =
'<a>' +
'<b>' +
'<c id="c1"></c>' +
'</b>' +
'</a>' +
'<b>' +
'<c></c>' +
'</b>'
t.isDeeply(finder.findQueries(unique('#c1')), [ '#c1' ])
})
t.it('Mandatory Id', function (t) {
body.innerHTML =
'<a>' +
'<b id="b1">' +
'<c></c>' +
'</b>' +
'</a>'
t.isDeeply(finder.findQueries(unique('c')), [ '#b1 c' ])
var finder2 = new Ariadne.DomQueryFinder({ enableMandatoryId : false })
t.isDeeply(finder2.findQueries(unique('c')), [ 'c' ])
})
t.it('Correct path weight even if some segment is re-used in the query because of the partial match', function (t) {
body.innerHTML =
'<a>' +
'<b>' +
'<c>' +
'<d></d>' +
'</c>' +
'<d></d>' +
'</b>' +
'<c></c>' +
'</a>' +
'<a></a>' +
'<b></b>' +
'<c></c>'
var queries = finder.findQueries(unique('c d'), null, { detailed : true })
t.isDeeply(queries, [ t.any() ], "One query")
t.isDeeply(queries[ 0 ].query, 'c d', "Correct query found")
t.isDeeply(queries[ 0 ].weight, 2000, "Correct path weight")
})
t.it('Non-unique results filtering', function (t) {
body.innerHTML =
'<c class="z">' +
'<d>' +
'<e class="z">' +
'<f target=true></f>' +
'</e>' +
'<e>' +
'<f></f>' +
'</e>' +
'<e>' +
'<f></f>' +
'</e>' +
'</d>' +
'</c>' +
'<d></d>' +
'<c></c>'
var queries = finder.findQueries(unique('[target=true]'))
// should not find naive ".z f" query
t.isDeeply(queries, [ 'e.z f' ], 'Correct queries found')
})
t.it('Non-unique results filtering', function (t) {
body.innerHTML =
'<e>' +
'<e>' +
'<f target=true></f>' +
'</e>' +
'<e>' +
'<f></f>' +
'</e>' +
'<e>' +
'<f></f>' +
'</e>' +
'</e>'
var queries = finder.findQueries(unique('[target=true]'))
t.isDeeply(queries, [ 'e e:nth-of-type(1) f' ], 'Correct queries found')
})
t.it('Non-unique results filtering', function (t) {
body.innerHTML =
'<e class="z">' +
'<e class="z">' +
'<f target=true></f>' +
'</e>' +
'<e>' +
'<f></f>' +
'</e>' +
'<e>' +
'<f></f>' +
'</e>' +
'</e>'
var queries = finder.findQueries(unique('[target=true]'))
t.isDeeply(queries, [ '.z .z f', 'e .z f' ], 'Correct queries found')
})
t.it('Should prefer just a tag name for <body> and <html>', function (t) {
body.innerHTML = ''
body.className = 'z'
var queries = finder.findQueries(document.body)
t.isDeeply(queries, [ 'body' ], 'Correct queries found')
})
t.it('Should prefer just a tag name for <body> and <html>', function (t) {
body.innerHTML = ''
body.parentNode.className = 'z'
var queries = finder.findQueries(document.documentElement)
t.isDeeply(queries, [ 'html' ], 'Correct queries found')
})
}) |
<gh_stars>0
#!/usr/bin/env python
from Bio import SeqIO
def makeprots(gbk, out):
"""
Makes protein files for all the genes in the genbank file
Parameters
----------
gbk: string
path to the input genbank file
out: string
path to the outfut fasta file
"""
with open(out, 'w') as fa:
for refseq in SeqIO.parse(gbk, 'genbank'):
for feats in [f for f in refseq.features if f.type == 'CDS']:
lt = feats.qualifiers['locus_tag'][0]
try:
seq = feats.qualifiers['translation'][0]
except KeyError:
seq = feats.extract(refseq.seq).translate()
if seq:
fa.write('>{}\n{}\n'.format(lt, seq))
if __name__ == '__main__':
import argparse
p = argparse.ArgumentParser(description='Generate protein fasta file from genbank files.')
p.add_argument('gbk', help='Paths to genbank file.', type=str)
p.add_argument('out', help='Path to fasta file where the protein seqs will be written.', type=str)
params = vars(p.parse_args())
makeprots(**params) |
<filename>tests/library/browsercontext-clearcookies.spec.ts<gh_stars>1-10
/**
* Copyright 2018 Google Inc. All rights reserved.
* Modifications copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { contextTest as it, expect } from '../config/browserTest';
it('should clear cookies', async ({ context, page, server }) => {
await page.goto(server.EMPTY_PAGE);
await context.addCookies([{
url: server.EMPTY_PAGE,
name: 'cookie1',
value: '1'
}]);
expect(await page.evaluate('document.cookie')).toBe('cookie1=1');
await context.clearCookies();
expect(await context.cookies()).toEqual([]);
await page.reload();
expect(await page.evaluate('document.cookie')).toBe('');
});
it('should isolate cookies when clearing', async ({ context, server, browser }) => {
const anotherContext = await browser.newContext();
await context.addCookies([{ url: server.EMPTY_PAGE, name: 'page1cookie', value: 'page1value' }]);
await anotherContext.addCookies([{ url: server.EMPTY_PAGE, name: 'page2cookie', value: 'page2value' }]);
expect((await context.cookies()).length).toBe(1);
expect((await anotherContext.cookies()).length).toBe(1);
await context.clearCookies();
expect((await context.cookies()).length).toBe(0);
expect((await anotherContext.cookies()).length).toBe(1);
await anotherContext.clearCookies();
expect((await context.cookies()).length).toBe(0);
expect((await anotherContext.cookies()).length).toBe(0);
await anotherContext.close();
});
|
package yimei.jss.ruleanalysis;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import ec.Fitness;
import ec.gp.koza.KozaFitness;
import ec.multiobjective.MultiObjectiveFitness;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import yimei.jss.jobshop.Objective;
import yimei.jss.jobshop.SchedulingSet;
import yimei.jss.rule.AbstractRule;
public class TestResult {
private List<AbstractRule[]> generationalRules;
private List<Fitness> generationalTrainFitnesses; //generational things is a list to contain informaiton related
private List<Fitness> generationalValidationFitnesses;
private List<Fitness> generationalTestFitnesses;
private AbstractRule[] bestRules;
private Fitness bestTrainingFitness;
private Fitness bestValidationFitness;
private Fitness bestTestFitness;
private DescriptiveStatistics generationalTimeStat;
//fzhang 24.8.2018 read badrun into CSV
private DescriptiveStatistics generationalBadRunStat;
//fzhang 31.5.2019 read average rule size into CSV
private DescriptiveStatistics generationalAveRoutingRuleSizeStat;
private DescriptiveStatistics generationalAveSequencingRuleSizeStat;
private DescriptiveStatistics generationalAveRuleSizeStat;
//fzhang 2019.1.14 read training fitness into CSV
private DescriptiveStatistics generationalTrainingFitnessStat0;
private DescriptiveStatistics generationalTrainingFitnessStat1;
public static final long validationSimSeed = 483561;
public TestResult() {
generationalRules = new ArrayList<>();
generationalTrainFitnesses = new ArrayList<>();
generationalValidationFitnesses = new ArrayList<>();
generationalTestFitnesses = new ArrayList<>();
}
public List<AbstractRule[]> getGenerationalRules() {
return generationalRules;
}
public AbstractRule[] getGenerationalRules(int idx) {
return generationalRules.get(idx);
}
public List<Fitness> getGenerationalTrainFitnesses() {
return generationalTrainFitnesses;
}
public Fitness getGenerationalTrainFitness(int idx) {
return generationalTrainFitnesses.get(idx);
}
public List<Fitness> getGenerationalValidationFitnesses() {
return generationalValidationFitnesses;
}
public Fitness getGenerationalValidationFitness(int idx) {
return generationalValidationFitnesses.get(idx);
}
public List<Fitness> getGenerationalTestFitnesses() {
return generationalTestFitnesses;
}
public Fitness getGenerationalTestFitness(int idx) {
return generationalTestFitnesses.get(idx);
}
public AbstractRule[] getBestRules() {
return bestRules;
}
public Fitness getBestTrainingFitness() {
return bestTrainingFitness;
}
public Fitness getBestValidationFitness() {
return bestValidationFitness;
}
public Fitness getBestTestFitness() {
return bestTestFitness;
}
public DescriptiveStatistics getGenerationalTimeStat() {
return generationalTimeStat;
}
public double getGenerationalTime(int gen) {
return generationalTimeStat.getElement(gen);
}
//fzhang 24.8.2018 get the badrun into CSV
public DescriptiveStatistics getGenerationalBadRunStat() {
return generationalBadRunStat;
}
public double getGenerationalBadRun(int gen) {
return generationalBadRunStat.getElement(gen);
}
//fzhang 2019.6.1 get the average routing rule size into CSV
//===========================start========================
public DescriptiveStatistics getGenerationalAveRoutingRuleSizeStatStat() {
return generationalAveRoutingRuleSizeStat;
}
public double getGenerationalAveRoutingRuleSizeStatStat(int gen) {
return generationalAveRoutingRuleSizeStat.getElement(gen);
}
//======================================end================================
//fzhang 2019.6.1 get the average routing rule size into CSV
//===================================start==================================
public DescriptiveStatistics getGenerationalAveSequencingRuleSizeStatStat() { return generationalAveSequencingRuleSizeStat; }
public double getGenerationalAveSequencingRuleSizeStatStat(int gen) {
return generationalAveSequencingRuleSizeStat.getElement(gen);
}
//====================================end===================================
//fzhang 2019.6.1 get the average rule size into CSV
//===================================start==================================
public DescriptiveStatistics getGenerationalAveRuleSizeStatStat() { return generationalAveRuleSizeStat;}
public double getGenerationalAveRuleSizeStatStat(int gen) {
return generationalAveRuleSizeStat.getElement(gen);
}
//====================================end===================================
// fzhang 2019.1.14 get the training fitness into CSV
public DescriptiveStatistics getGenerationalTrainingFitnessStat0() {
return generationalTrainingFitnessStat0;
}
public double getGenerationalTrainingFitness0(int gen) {
return generationalTrainingFitnessStat0.getElement(gen);
}
public DescriptiveStatistics getGenerationalTrainingFitnessStat1() {
return generationalTrainingFitnessStat1;
}
public double getGenerationalTrainingFitness1(int gen) {
return generationalTrainingFitnessStat1.getElement(gen);
}
//=========================================================================
public void setGenerationalRules(List<AbstractRule[]> generationalRules) {
this.generationalRules = generationalRules;
}
public void addGenerationalRules(AbstractRule[] rules) {
this.generationalRules.add(rules);
}
public void setGenerationalTrainFitnesses(List<Fitness> generationalTrainFitnesses) {
this.generationalTrainFitnesses = generationalTrainFitnesses;
}
public void addGenerationalTrainFitness(Fitness f) {
this.generationalTrainFitnesses.add(f);
}
public void setGenerationalValidationFitness(List<Fitness> generationalValidationFitnesses) {
this.generationalValidationFitnesses = generationalValidationFitnesses;
}
public void addGenerationalValidationFitnesses(Fitness f) {
this.generationalValidationFitnesses.add(f);
}
public void setGenerationalTestFitnesses(List<Fitness> generationalTestFitnesses) {
this.generationalTestFitnesses = generationalTestFitnesses;
}
public void addGenerationalTestFitnesses(Fitness f) {
this.generationalTestFitnesses.add(f);
}
public void setBestRules(AbstractRule[] bestRules) {
this.bestRules = bestRules;
}
public void setBestTrainingFitness(Fitness bestTrainingFitness) {
this.bestTrainingFitness = bestTrainingFitness;
}
public void setBestValidationFitness(Fitness bestValidationFitnesses) {
this.bestValidationFitness = bestValidationFitnesses;
}
public void setBestTestFitness(Fitness bestTestFitnesses) {
this.bestTestFitness = bestTestFitnesses;
}
public void setGenerationalTimeStat(DescriptiveStatistics generationalTimeStat) {
this.generationalTimeStat = generationalTimeStat;
}
//31.5.2019 fzhang read average routing rule size into CSV
public void setGenerationalAveRoutingRuleSizeStat(DescriptiveStatistics generationalAveRoutingRuleSizeStat) {
this.generationalAveRoutingRuleSizeStat = generationalAveRoutingRuleSizeStat;
}
//31.5.2019 fzhang read average sequencing rule size into CSV
public void setGenerationalAveSequencingRuleSizeStat(DescriptiveStatistics generationalAveSequencingRuleSizeStat) {
this.generationalAveSequencingRuleSizeStat = generationalAveSequencingRuleSizeStat;
}
//5.6.2019 fzhang read average rule size into CSV
public void setGenerationalAveRuleSizeStat(DescriptiveStatistics generationalAveRuleSizeStat) {
this.generationalAveRuleSizeStat = generationalAveRuleSizeStat;
}
//=======================================================================================
//24.8.2018 fzhang read badrun into CSV
public void setGenerationalBadRunStat(DescriptiveStatistics generationalBadRunStat) {
this.generationalBadRunStat = generationalBadRunStat;
}
//======================================================================================
// =======================================================================================
// 24.8.2018 fzhang read trainingfitness into CSV
public void setGenerationalTrainingFitnessStat0(DescriptiveStatistics generationalTrainingFitnessStat0) {
this.generationalTrainingFitnessStat0 = generationalTrainingFitnessStat0;
}
public void setGenerationalTrainingFitnessStat1(DescriptiveStatistics generationalTrainingFitnessStat1) {
this.generationalTrainingFitnessStat1 = generationalTrainingFitnessStat1;
}
// ======================================================================================
public static TestResult readFromFile(File file, RuleType ruleType, int numPopulations) {
return ResultFileReader.readTestResultFromFile(file, ruleType, ruleType.isMultiobjective(), numPopulations);
}
public void validate(List<Objective> objectives) {
SchedulingSet validationSet =
SchedulingSet.dynamicMissingSet(validationSimSeed, 0.95,
4.0, objectives, 50);
Fitness validationFitness;
if (objectives.size() == 1) {
validationFitness = new KozaFitness();
bestValidationFitness = new KozaFitness();
}
else {
validationFitness = new MultiObjectiveFitness();
bestValidationFitness = new MultiObjectiveFitness();
}
bestRules = generationalRules.get(0);
//bestRule.calcFitness(bestValidationFitness, null, validationSet, objectives);
generationalValidationFitnesses.add(bestValidationFitness);
// System.out.println("Generation 0: validation fitness = " + bestValidationFitness.fitness());
for (int i = 1; i < generationalRules.size(); i++) {
//generationalRules.get(i).calcFitness(validationFitness, null, validationSet, objectives);
generationalValidationFitnesses.add(validationFitness);
// System.out.println("Generation " + i + ": validation fitness = " + validationFitness.fitness());
if (validationFitness.betterThan(bestValidationFitness)) {
bestRules = generationalRules.get(i);
bestTrainingFitness = generationalTrainFitnesses.get(i);
bestValidationFitness = validationFitness;
}
}
}
}
|
package com.nio.select;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
import java.util.Set;
public class SelcSCDemo1 {
public static void main(String[] args) throws IOException {
//创建选择器
Selector selc = Selector.open();
//2.新建通道
SocketChannel sc = SocketChannel.open();
sc.configureBlocking(false);
//3.将通道注册到选择器上
sc.register(selc, SelectionKey.OP_CONNECT);
//4.通道连接服务
sc.connect(new InetSocketAddress("127.0.0.1",9999));
while(true){
//5.选择器 就绪的
selc.select();
//6.便利当前的所有的选择器
Set<SelectionKey> set = selc.selectedKeys();
Iterator<SelectionKey> it = set.iterator();
while(it.hasNext()){
//7.获取当前选择器的key
SelectionKey sk = it.next();
//8.如果是可连接的
if(sk.isConnectable()){
//9.完成连接
SocketChannel scx = (SocketChannel) sk.channel();
while(!scx.finishConnect()){}
//10.重新注册write
scx.register(selc, SelectionKey.OP_WRITE);
}
//8.注册写
if(sk.isWritable()){
//9.获取通道信息 向外写数据
SocketChannel scx = (SocketChannel) sk.channel();
byte [] body = "xxxyyy".getBytes();
byte [] head = (body.length+"\r\n").getBytes();
ByteBuffer head_buf = ByteBuffer.wrap(head);
ByteBuffer body_buf = ByteBuffer.wrap(body);
while(body_buf.hasRemaining()){
scx.write(new ByteBuffer[]{head_buf,body_buf});
}
//10.为了重复写出,需要已经注册的key中删除 key
scx.register(selc, sk.interestOps() & ~SelectionKey.OP_WRITE);
}
}
//1.移除当前的链接信息
it.remove();
}
}
}
|
#!/bin/bash
# Copyright © 2012, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is 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.
# Purpose: Env setup
# Date: 2013-05-04
##############################################################################
# START DO NOT MODIFY #
##############################################################################
SCRIPT_PATH="`dirname \"$0\"`"
SCRIPT_PATH="`( cd \"$SCRIPT_PATH\" && pwd )`"
##############################################################################
# END DO NOT MODIFY #
##############################################################################
# Add the relative path from this script to the helpers folder.
pushd "${SCRIPT_PATH}/helpers/" > /dev/null
##############################################################################
# START DO NOT MODIFY #
##############################################################################
if [ ! -f "helper_functions.sh" ]; then
echo "Could not find helper_functions.sh. Are we in the bash helpers folder?"
exit 1;
fi
# Import our common files
source "helper_functions.sh"
source "helper_paths.sh"
source "helper_definitions.sh"
# Get out of the bash helpers folder.
popd > /dev/null
##############################################################################
# END DO NOT MODIFY #
##############################################################################
function get_actual_user()
{
who am i | awk '{print $1}'
}
function get_primary_group()
{
id -g -n $1
}
create_directory_if_noexist "$ENV_DIR"
pushd "$ENV_DIR" > /dev/null
create_directory_if_noexist "$ENV_BIN_DIR"
create_directory_if_noexist "$ENV_BUILD_DIR"
create_directory_if_noexist "$DOWNLOADS_DIR"
create_directory_if_noexist "$INCLUDE_DIR"
create_directory_if_noexist "$LIB_DIR"
popd > /dev/null
create_exist_symlink `which g++` "${ENV_BIN_DIR}/g++"
|
import React from 'react';
import styled from '@emotion/styled';
const NotAvailable = () => {
return <Wrapper>{'\u2014'}</Wrapper>;
};
const Wrapper = styled('div')`
color: ${p => p.theme.gray400};
`;
export default NotAvailable;
|
#!/bin/bash
################################################################################
# [Fragment] Marathon in Development (Local) Cluster
# ------------------------------------------------------------------------------
# This script runs the scale tests on the cluster deployed in the previous steps
################################################################################
# Validate environment
if [ -z "$TESTS_DIR" ]; then
echo "ERROR: Required 'TESTS_DIR' environment variable"
exit 253
fi
if [ -z "$MESOS_VERSION" ]; then
echo "ERROR: Required 'MESOS_VERSION' environment variable"
exit 253
fi
if [ -z "$MARATHON_VERSION" ]; then
echo "ERROR: Required 'MARATHON_VERSION' environment variable"
exit 253
fi
if [ -z "$DATADOG_API_KEY" ]; then
echo "ERROR: Required 'DATADOG_API_KEY' environment variable"
exit 253
fi
if [ -z "$RUN_NAME" ]; then
echo "ERROR: Required 'RUN_NAME' environment variable"
exit 253
fi
if [ -z "$PERF_DRIVER_ENVIRONMENT" ]; then
PERF_DRIVER_ENVIRONMENT="env-ci.yml"
fi
# Execute all the tests in the configuration
EXITCODE=0
for TEST_CONFIG in $TESTS_DIR/test-*.yml; do
# Get test name by removing 'test-' prefix and '.yml' suffix
TEST_NAME=$(basename $TEST_CONFIG)
TRIM_END=${#TEST_NAME}
let TRIM_END-=9
TEST_NAME=${TEST_NAME:5:$TRIM_END}
# If we have partial tests configured, check if this test exists
# in the PARTIAL_TESTS, otherwise skip
if [[ ! -z "$PARTIAL_TESTS" && ! "$PARTIAL_TESTS" =~ "$TEST_NAME" ]]; then
echo "INFO: Skipping test '${TEST_NAME}' according to PARTIAL_TESTS env vaiable"
continue
fi
echo "INFO: Executing test '${TEST_NAME}'"
# Launch the performance test driver with the correct arguments
eval dcos-perf-test-driver \
$TESTS_DIR/environments/target-dcluster.yml \
$TESTS_DIR/environments/${PERF_DRIVER_ENVIRONMENT} \
$TESTS_DIR/environments/opt-jmx.yml \
$TEST_CONFIG \
-M "version=${MARATHON_VERSION}" \
-M "mesos=${MESOS_VERSION}" \
-D "jmx_port=9010" \
-D "datadog_api_key=${DATADOG_API_KEY}" \
-D "run_name=${RUN_NAME}" \
$*
EXITCODE=$?; [ $EXITCODE -ne 0 ] && break
done
# Expose EXITCODE to make it available to other tasks
export EXITCODE=$EXITCODE
|
package code401Challenges.graph;
import java.util.*;
public class Graph<T> {
private HashSet<Node> nodes;
int size;
public Graph() {
this.nodes = new HashSet<>();
this.size = 0;
}
public Node addNode( Node node) {
this.nodes.add(node);
this.size++;
return node;
}
public HashSet<Node> getNodes() {
return this.nodes;
}
public int size() {
return this.size;
}
}
|
/* City of Concourse Website - Landing Page View
Copyright 2019 <NAME>
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.
*/
import React, { useEffect } from 'react'
import { Link } from 'react-router-dom'
import l0 from '../../assets/starry-sky-bg.svg'
import logo from '../../assets/concourse-logo.svg'
import './LandingPageView.css'
function LandingPageView({set_title}){
useEffect(() => {
set_title("City of Concourse")
}, [set_title])
return <main className="main">
<div className="bg-parallax">
<img src={l0} className="layer-0" alt="background layer 0" />
</div>
<div className="title-box">
<h1>Welcome to</h1>
<img src={logo} className="concourse-title-logo" alt="Concourse, Florida: Gateway to the Sunshine State" />
</div>
<div className="top-blurb">
<p>Concourse is a small city in southern Florida, on the wooded shores of <Link to="/lake-yeehaw">Lake Yeehaw</Link>. Home to over 28,000 happy <Link to="/citizen-voices">citizens</Link>, Concourse is </p>
</div>
</main>
}
export default LandingPageView |
<filename>bin/test.js
#! /usr/bin/env node
/**
@module d3plus-test
@summary Runs linting and unit/browser tests on source files.
@desc Based on the .eslintrc file provided by the [d3plus-env](#module_d3plus-env) script, all source files will be linted and then passed to any browser/unit tests that have been written.
**/
const commonjs = require("@rollup/plugin-commonjs"),
// {getBabelOutputPlugin} = require("@rollup/plugin-babel"),
{nodeResolve} = require("@rollup/plugin-node-resolve"),
execAsync = require("./execAsync"),
json = require("@rollup/plugin-json"),
log = require("./log")("testing suite"),
rollup = require("rollup"),
shell = require("shelljs"),
{name} = JSON.parse(shell.cat("package.json"));
log.timer("linting code");
execAsync("eslint --color index.js \"?(src|test)/**/*.js\"", {silent: true})
.then(stdout => {
log.done();
shell.echo(stdout);
shell.config.silent = true;
const tests = shell.ls("-R", "test/**/*.js");
shell.config.silent = false;
if (tests.length) {
log.timer("compiling tests");
tests.reverse();
const testIndex = tests
.map((file, i) => `import test${i} from "./${ file.slice(5) }";\nconsole.log(test${i});`)
.join("\n");
new shell.ShellString(testIndex)
.to("test/.index.js");
const input = {
input: "test/.index.js",
onwarn: e => {
switch (e.code) {
case "CIRCULAR_DEPENDENCY":
return undefined;
case "ERROR":
case "FATAL":
log.fail();
shell.echo(`bundle error in '${e.error.id}':`);
return shell.echo(e.error);
default:
shell.echo(e);
return undefined;
}
},
plugins: [
json(),
nodeResolve({mainFields: ["jsnext:main", "module", "main"], preferBuiltins: false}),
commonjs()
// getBabelOutputPlugin({
// allowAllFormats: true,
// configFile: `${__dirname}/.babelrc`
// })
]
};
const output = {
amd: {id: name},
file: "test/.bundle.js",
format: "iife",
name: "d3plus"
};
rollup.rollup(input)
.then(bundle => bundle.write(output))
.then(() => {
log.done();
shell.echo("");
return execAsync("cat test/.bundle.js | tape-run --render='faucet'");
})
.then(() => {
shell.rm("test/.index.js");
shell.rm("test/.bundle.js");
shell.echo("");
shell.exit(0);
})
.catch(err => {
log.fail(err);
log.exit();
shell.exit(1);
});
}
else {
log.warn("no tests found");
log.exit();
shell.exit(0);
}
})
.catch((err, code) => {
log.fail(err);
log.exit();
shell.exit(code);
});
|
function validateForm(formDefinition, data) {
const inputs = formDefinition.form.input;
for (const input of inputs) {
const name = input.getAttribute('name');
const occurrences = input.occurrences;
const value = data[name];
if (occurrences) {
const min = parseInt(occurrences.getAttribute('minimum'));
const max = parseInt(occurrences.getAttribute('maximum'));
if (!value || value.length < min || value.length > max) {
return false;
}
} else {
if (!value) {
return false;
}
}
}
return true;
} |
<gh_stars>0
import * as redisStore from 'cache-manager-redis-store';
import { CacheModule as BaseCacheModule, Module } from "@nestjs/common";
import { CacheService } from './cache.service';
// registerAsync가 필요한가?
@Module({
imports: [
BaseCacheModule.register({
store: redisStore,
host: 'localhost',
port: 6379,
ttl: 604800,
}),
],
providers: [CacheService],
exports: [CacheService]
})
export class CacheModule {} |
<filename>packages/icons-svg/templates/helpers.ts
import { IconDefinition, AbstractNode } from './types';
const defaultColors = {
primaryColor: '#333',
secondaryColor: '#E6E6E6',
};
export interface HelperRenderOptions {
placeholders?: {
primaryColor: string;
secondaryColor: string;
};
extraSVGAttrs?: {
[key: string]: string;
};
}
export function renderIconDefinitionToSVGElement(
icond: IconDefinition,
options: HelperRenderOptions = {},
): string {
if (typeof icond.icon === 'function') {
// two-tone
const placeholders = options.placeholders || defaultColors;
return renderAbstractNodeToSVGElement(
icond.icon(placeholders.primaryColor, placeholders.secondaryColor),
options,
);
}
// fill, outline
return renderAbstractNodeToSVGElement(icond.icon, options);
}
function renderAbstractNodeToSVGElement(node: AbstractNode, options: HelperRenderOptions): string {
const targetAttrs =
node.tag === 'svg'
? {
...node.attrs,
...(options.extraSVGAttrs || {}),
}
: node.attrs;
const attrs = Object.keys(targetAttrs).reduce((acc: string[], nextKey) => {
const key = nextKey;
const value = targetAttrs[key];
const token = `${key}="${value}"`;
acc.push(token);
return acc;
}, []);
const attrsToken = attrs.length ? ' ' + attrs.join(' ') : '';
const children = (node.children || [])
.map((child) => renderAbstractNodeToSVGElement(child, options))
.join('');
if (children && children.length) {
return `<${node.tag}${attrsToken}>${children}</${node.tag}>`;
}
return `<${node.tag}${attrsToken} />`;
}
|
wkhtmltopdf page index.html --enable-forms index.pdf; open index.pdf
|
/*
Copyright 2021 Adevinta
*/
package endpoint
import (
"context"
"github.com/go-kit/kit/endpoint"
)
type HealthcheckResponse struct {
Status string `json:"status"`
}
// HealthChecker defines the services needed by the endpoint.
type HealthChecker interface {
Healthcheck(context.Context) error
}
func makeHealthcheckEndpoint(svc HealthChecker) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (response interface{}, err error) {
resp := HealthcheckResponse{}
err = svc.Healthcheck(ctx)
if err != nil {
resp.Status = "KO"
return ServerDown{resp}, nil
}
resp.Status = "OK"
return Ok{resp}, nil
}
}
|
/*
* Copyright 2015 <NAME>
*
* 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.unique.yyz.tilelistview.sample;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import com.unique.yyz.tilelistview.library.TileListView;
import java.lang.reflect.Array;
import java.util.Collections;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
((TileListView) findViewById(R.id.list)).setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new String[]{
"ItemA", "ItemB", "ItemC", "ItemD", "ItemE", "ItemF", "ItemG", "ItemH"}));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
function flatDeep(arr, d = 1) {
return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val, d - 1) : val), [])
: arr.slice();
}
const slugify = function(text) {
return text
.toString()
.toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, '') // Trim - from end of text
}
const getSiblings = function (elem) {
var siblings = [];
var sibling = elem.parentNode.firstChild;
while (sibling) {
if (sibling.nodeType === 1 && sibling !== elem) {
siblings.push(sibling);
}
sibling = sibling.nextSibling;
}
return siblings;
};
const getClosest = function (elem, selector) {
for (; elem && elem !== document; elem = elem.parentNode) {
if (elem.matches(selector)) return elem;
}
return null;
};
function slideUp(element, duration = 500) {
return new Promise(function (resolve) {
element.style.height = element.offsetHeight + "px";
element.style.transitionProperty = `height, margin, padding`;
element.style.transitionDuration = duration + "ms";
element.offsetHeight;
element.style.overflow = "hidden";
element.style.height = 0;
element.style.paddingTop = 0;
element.style.paddingBottom = 0;
element.style.marginTop = 0;
element.style.marginBottom = 0;
window.setTimeout(function () {
element.style.display = "none";
element.style.removeProperty("height");
element.style.removeProperty("padding-top");
element.style.removeProperty("padding-bottom");
element.style.removeProperty("margin-top");
element.style.removeProperty("margin-bottom");
element.style.removeProperty("overflow");
element.style.removeProperty("transition-duration");
element.style.removeProperty("transition-property");
resolve(false);
}, duration);
});
}
function slideDown(element, duration = 500) {
return new Promise(function () {
element.style.removeProperty("display");
let display = window.getComputedStyle(element).display;
if (display === "none") display = "block";
element.style.display = display;
let height = element.offsetHeight;
element.style.overflow = "hidden";
element.style.height = 0;
element.style.paddingTop = 0;
element.style.paddingBottom = 0;
element.style.marginTop = 0;
element.style.marginBottom = 0;
element.offsetHeight;
element.style.transitionProperty = `height, margin, padding`;
element.style.transitionDuration = duration + "ms";
element.style.height = height + "px";
element.style.removeProperty("padding-top");
element.style.removeProperty("padding-bottom");
element.style.removeProperty("margin-top");
element.style.removeProperty("margin-bottom");
window.setTimeout(function () {
element.style.removeProperty("height");
element.style.removeProperty("overflow");
element.style.removeProperty("transition-duration");
element.style.removeProperty("transition-property");
}, duration);
});
}
function slideToggle(element, duration = 500) {
if (window.getComputedStyle(element).display === "none") {
return slideDown(element, duration);
} else {
return slideUp(element, duration);
}
}
function containsObject(obj, list) {
var i;
for (i = 0; i < list.length; i++) {
console.log()
if (list[i].slug === obj.slug) {
return i;
}
}
return -1;
}
export {containsObject, flatDeep, slugify, getSiblings, getClosest, slideUp, slideDown, slideToggle} |
package map;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
//https://blog.csdn.net/weixin_30649641/article/details/95002030?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param
public class hashmapDead extends Thread {
static HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(2);
static AtomicInteger at = new AtomicInteger(0);
@Override
public void run() {
while (at.get() < 100000) {
map.put(at.get(), at.get());
at.incrementAndGet();
System.out.println(at.get());
}
}
public static void main(String[] args) {
hashmapDead t0 = new hashmapDead();
hashmapDead t1 = new hashmapDead();
hashmapDead t2 = new hashmapDead();
hashmapDead t3 = new hashmapDead();
hashmapDead t4 = new hashmapDead();
t0.start();
t1.start();
t2.start();
t3.start();
t4.start();
}
} |
import React, {useState} from 'react';
const App = () => {
const [message, setMessage] = useState('Welcome!');
return (
<div>
<h1>{message}</h1>
<input
type="text"
placeholder="Enter message"
value={message}
onChange={(e) => setMessage(e.target.value)}
/>
</div>
);
};
export default App; |
#!/bin/bash
# based on:
# https://unix.stackexchange.com/questions/249701/how-to-minify-javascript-and-css-with-command-line-using-minify-tool
# minification of js files
./scripts/minify_dev.sh
npx terser js/init.js -c -m -o js/init.js
find js/ -regex '.*[^(?:min[0-9+)|(init)]\.js' \
-delete
# minification of css files
find css/ -type f \
-name "*.css" ! -name "*.min.*" \
-exec echo {} \; \
-exec npx uglifycss --output {}.min {} \; \
-exec rm {} \; \
-exec mv -f {}.min {} \;
# Create file representing last update date
$ date +"%s000" | tee date.txt
|
package com.meterware.pseudoserver;
/********************************************************************************************************************
* $Id: PseudoServerTest.java 915 2008-04-14 19:39:44Z russgold $
*
* Copyright (c) 2000-2004, <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*******************************************************************************************************************/
import junit.framework.TestSuite;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.BufferedOutputStream;
import java.net.HttpURLConnection;
import java.net.Socket;
public class PseudoServerTest extends HttpUserAgentTest {
public static void main( String args[] ) {
junit.textui.TestRunner.run( suite() );
}
public static TestSuite suite() {
return new TestSuite( PseudoServerTest.class );
}
public PseudoServerTest( String name ) {
super( name );
}
public void testNotFoundStatus() throws Exception {
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse response = conn.getResponse( "GET", "/nothing.htm" );
assertEquals( "Response code", HttpURLConnection.HTTP_NOT_FOUND, response.getResponseCode() );
}
public void testStatusSpecification() throws Exception {
defineResource( "error.htm", "Not Modified", 304 );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse response = conn.getResponse( "GET", "/error.htm" );
assertEquals( "Response code", 304, response.getResponseCode() );
}
/**
* This tests simple access to the server without using any client classes.
*/
public void testGetViaSocket() throws Exception {
defineResource( "sample", "Get this", "text/plain" );
Socket socket = new Socket( "localhost", getHostPort() );
OutputStream os = socket.getOutputStream();
InputStream is = new BufferedInputStream( socket.getInputStream() );
sendHTTPLine( os, "GET /sample HTTP/1.0" );
sendHTTPLine( os, "Host: meterware.com" );
sendHTTPLine( os, "" );
StringBuffer sb = new StringBuffer();
int b;
while (-1 != (b = is.read())) sb.append( (char) b );
String result = sb.toString();
assertTrue( "Did not find matching protocol", result.startsWith( "HTTP/1.0" ) );
assertTrue( "Did not find expected text", result.indexOf( "Get this" ) > 0 );
}
/**
* This tests simple access to the server without using any client classes.
*/
public void testBadlyFormedMessageViaSocket() throws Exception {
defineResource( "sample", "Get this", "text/plain" );
Socket socket = new Socket( "localhost", getHostPort() );
OutputStream os = socket.getOutputStream();
InputStream is = new BufferedInputStream( socket.getInputStream() );
os.write( "GET /sample HTTP/1.0".getBytes() );
StringBuffer sb = new StringBuffer();
int b;
while (-1 != (b = is.read())) sb.append( (char) b );
String result = sb.toString();
assertTrue( "Did not find matching protocol", result.startsWith( "HTTP/1.0" ) );
assertTrue( "Did not find expected error message", result.indexOf( "400" ) > 0 );
}
/**
* This tests simple access to the server without using any client classes.
*/
public void testProxyGetViaSocket() throws Exception {
defineResource( "http://someserver.com/sample", "Get this", "text/plain" );
Socket socket = new Socket( "localhost", getHostPort() );
OutputStream os = socket.getOutputStream();
InputStream is = new BufferedInputStream( socket.getInputStream() );
sendHTTPLine( os, "GET http://someserver.com/sample HTTP/1.0" );
sendHTTPLine( os, "Host: someserver.com" );
sendHTTPLine( os, "" );
StringBuffer sb = new StringBuffer();
int b;
while (-1 != (b = is.read())) sb.append( (char) b );
String result = sb.toString();
assertTrue( "Did not find matching protocol", result.startsWith( "HTTP/1.0" ) );
assertTrue( "Did not find expected text", result.indexOf( "Get this" ) > 0 );
}
private void sendHTTPLine( OutputStream os, final String line ) throws IOException {
os.write( line.getBytes() );
os.write( 13 );
os.write( 10 );
}
/**
* This verifies that the PseudoServer detects and echoes its protocol.
*/
public void testProtocolMatching() throws Exception {
defineResource( "sample", "Get this", "text/plain" );
Socket socket = new Socket( "localhost", getHostPort() );
OutputStream os = socket.getOutputStream();
InputStream is = new BufferedInputStream( socket.getInputStream() );
sendHTTPLine( os, "GET /sample HTTP/1.1" );
sendHTTPLine( os, "Host: meterware.com" );
sendHTTPLine( os, "Connection: close" );
sendHTTPLine( os, "" );
StringBuffer sb = new StringBuffer();
int b;
while (-1 != (b = is.read())) sb.append( (char) b );
String result = sb.toString();
assertTrue( "Did not find matching protocol", result.startsWith( "HTTP/1.1" ) );
assertTrue( "Did not find expected text", result.indexOf( "Get this" ) > 0 );
}
/**
* This verifies that the PseudoServer can be restricted to a HTTP/1.0.
*/
public void testProtocolThrottling() throws Exception {
getServer().setMaxProtocolLevel( 1, 0 );
defineResource( "sample", "Get this", "text/plain" );
Socket socket = new Socket( "localhost", getHostPort() );
OutputStream os = socket.getOutputStream();
InputStream is = new BufferedInputStream( socket.getInputStream() );
sendHTTPLine( os, "GET /sample HTTP/1.1" );
sendHTTPLine( os, "Host: meterware.com" );
sendHTTPLine( os, "Connection: close" );
sendHTTPLine( os, "" );
StringBuffer sb = new StringBuffer();
int b;
while (-1 != (b = is.read())) sb.append( (char) b );
String result = sb.toString();
assertTrue( "Did not find matching protocol", result.startsWith( "HTTP/1.0" ) );
assertTrue( "Did not find expected text", result.indexOf( "Get this" ) > 0 );
}
public void testPseudoServlet() throws Exception {
String resourceName = "tellMe";
String name = "Charlie";
final String prefix = "Hello there, ";
String expectedResponse = prefix + name;
defineResource( resourceName, new PseudoServlet() {
public WebResource getPostResponse() {
return new WebResource( prefix + getParameter( "name" )[0], "text/plain" );
}
} );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse response = conn.getResponse( "POST", '/' + resourceName, "name=" + name );
assertEquals( "Content type", "text/plain", response.getHeader( "Content-Type" ) );
assertEquals( "Response", expectedResponse, new String( response.getBody() ) );
}
public void testPseudoServletWithGET() throws Exception {
String resourceName = "tellMe";
String name = "Charlie";
final String prefix = "Hello there, ";
String expectedResponse = prefix + name;
defineResource( resourceName, new PseudoServlet() {
public WebResource getGetResponse() {
return new WebResource( prefix + getParameter( "name" )[0], "text/plain" );
}
} );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse response = conn.getResponse( "GET", '/' + resourceName + "?name=" + name );
assertEquals( "Response code", 200, response.getResponseCode() );
assertEquals( "Content type", "text/plain", response.getHeader( "Content-Type" ) );
assertEquals( "Response", expectedResponse, new String( response.getBody() ) );
}
/**
* Verifies that it is possible to disable the content-type header.
* @throws Exception
*/
public void testDisableContentTypeHeader() throws Exception {
defineResource( "simple", new PseudoServlet() {
public WebResource getGetResponse() {
WebResource resource = new WebResource( "a string" );
resource.suppressAutomaticContentTypeHeader();
return resource;
}
} );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse response = conn.getResponse( "GET", "/simple" );
assertEquals( "Response code", 200, response.getResponseCode() );
assertEquals( "Response", "a string", new String( response.getBody() ) );
assertNull( "Found a content type header", response.getHeader( "Content-Type" ) );
}
public void testChunkedRequest() throws Exception {
super.defineResource( "/chunkedServlet", new PseudoServlet() {
public WebResource getPostResponse() {
return new WebResource( super.getBody(), "text/plain" );
}
} );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
conn.startChunkedResponse( "POST", "/chunkedServlet" );
conn.sendChunk( "This " );
conn.sendChunk( "is " );
conn.sendChunk( "chunked.");
SocketConnection.SocketResponse response = conn.getResponse();
assertEquals( "retrieved body", "This is chunked.", new String( response.getBody() ) );
}
// need test: respond with HTTP_BAD_REQUEST if header line is bad
public void testChunkedRequestFollowedByAnother() throws Exception {
super.defineResource( "/chunkedServlet", new PseudoServlet() {
public WebResource getPostResponse() {
return new WebResource( super.getBody(), "text/plain" );
}
} );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
conn.startChunkedResponse( "POST", "/chunkedServlet" );
conn.sendChunk( "This " );
conn.sendChunk( "is " );
conn.sendChunk( "chunked.");
SocketConnection.SocketResponse response = conn.getResponse();
assertEquals( "retrieved body", "This is chunked.", new String( response.getBody() ) );
// Make a second request to duplicate the problem...
conn.startChunkedResponse( "POST", "/chunkedServlet" );
conn.sendChunk( "This " );
conn.sendChunk( "is " );
conn.sendChunk( "also (and with a greater size) " );
conn.sendChunk( "chunked.");
SocketConnection.SocketResponse response2 = conn.getResponse();
assertEquals( "retrieved body", "This is also (and with a greater size) chunked.", new String( response2.getBody() ) );
}
public void testChunkedResponse() throws Exception {
defineResource( "/chunkedServlet", new PseudoServlet() {
public WebResource getGetResponse() {
WebResource webResource = new WebResource( "5\r\nSent \r\n3\r\nin \r\n07\r\nchunks.\r\n0\r\n\r\n", "text/plain" );
webResource.addHeader( "Transfer-Encoding: chunked" );
return webResource;
}
} );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse response = conn.getResponse( "GET", "/chunkedServlet" );
assertEquals( "retrieved body", "Sent in chunks.", new String( response.getBody() ) );
assertNull( "No Content-Length header should have been sent", response.getHeader( "Content-Length" ) );
}
public void testPersistentConnection() throws Exception {
super.defineResource( "/testServlet", new TestMethodServlet() );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse resp1 = conn.getResponse( "HEAD", "/testServlet" );
assertEquals( "test-header", "test-value1", resp1.getHeader( "test-header1") );
SocketConnection.SocketResponse resp2 = conn.getResponse( "GET", "/testServlet" );
assertEquals( "retrieved body", TestMethodServlet.GET_DATA, new String( resp2.getBody() ) );
SocketConnection.SocketResponse resp3 = conn.getResponse( "OPTIONS", "/testServlet" );
assertEquals( "allow header", "GET", resp3.getHeader( "Allow") );
}
private class TestMethodServlet extends PseudoServlet {
private static final String GET_DATA = "This is from the TestMethodServlet - GET";
public WebResource getResponse( String method ) throws IOException {
if (method.equals( "GET" )) {
return new WebResource( GET_DATA );
} else if (method.equals( "HEAD" )) {
WebResource headResource = new WebResource( "" );
headResource.addHeader( "test-header1:test-value1" );
return headResource;
} else if (method.equals( "OPTIONS" )) {
WebResource optionsResource = new WebResource( GET_DATA );
optionsResource.addHeader( "Allow:GET" );
optionsResource.addHeader( "test-header1:test-value1" );
return optionsResource;
} else {
return super.getResponse( method );
}
}
}
public void testBadMethodUsingPseudoServlet() throws Exception {
String resourceName = "tellMe";
defineResource( resourceName, new PseudoServlet() {} );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse response = conn.getResponse( "HEAD", '/' + resourceName );
assertEquals( "Status code returned", HttpURLConnection.HTTP_BAD_METHOD, response.getResponseCode() );
}
public void testClasspathDirectory() throws Exception {
mapToClasspath( "/some/classes" );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
conn.getResponse( "GET", "/some/classes/" + SocketConnection.SocketResponse.class.getName().replace('.','/') + ".class" );
}
public void testPseudoServletRequestAccess() throws Exception {
defineResource( "/properties", new PseudoServlet() {
public WebResource getGetResponse() {
return new WebResource( super.getRequest().getURI(), "text/plain" );
}
} );
SocketConnection conn = new SocketConnection( "localhost", getHostPort() );
SocketConnection.SocketResponse response = conn.getResponse( "GET", "/properties" );
assertEquals( "retrieved body", "/properties", new String( response.getBody() ) );
}
public void testLargeDelayedPseudoServletRequest() throws Exception {
defineResource( "/largeRequest", new PseudoServlet() {
public WebResource getPostResponse() {
return new WebResource( super.getBody(), super.getHeader( "CONTENT-TYPE" ) );
}
} );
Socket sock = new Socket( "localhost", getHostPort() );
sock.setKeepAlive( true );
sock.setTcpNoDelay( true );
sock.setSoTimeout( 5000 );
byte[] requestData = null;
requestData = generateLongMIMEPostData().getBytes();
String requestLine = "POST /largeRequest HTTP/1.1\r\n";
String hostHeader = "localhost:" + String.valueOf( getHostPort() ) + "\r\n";
String clHeader = "Content-Length: " + String.valueOf( requestData.length ) + "\r\n";
String conHeader = "Connection: Keep-Alive, TE\r\n";
String teHeader = "TE: trailers, deflate, gzip, compress\r\n";
String soapHeader = "SOAPAction: \"\"\r\n";
String accHeader = "Accept-Encoding: gzip, x-gzip, compress, x-compress\r\n";
String ctHeader = "Content-Type: multipart/related; type=\"text/xml\"; boundary=\"--MIME_Boundary\"\r\n";
String eoh = "\r\n";
BufferedOutputStream out = new BufferedOutputStream( sock.getOutputStream() );
out.write( requestLine.getBytes() );
out.write( hostHeader.getBytes() );
out.write( conHeader.getBytes() );
out.write( teHeader.getBytes() );
out.write( accHeader.getBytes() );
out.write( soapHeader.getBytes() );
out.write( ctHeader.getBytes() );
out.write( clHeader.getBytes() );
out.write( eoh.getBytes() );
// Send some of the request data
out.write( requestData, 0, 200 );
// Flush the stream and pause to simulate factors that would delay the request data
out.flush();
Thread.sleep( 500 );
// Write the remaining request data
out.write( requestData, 200, (requestData.length - 200) );
out.flush();
// Read the response
BufferedInputStream in = new BufferedInputStream( sock.getInputStream() );
int count = 0;
while ((in.read() != -1) && ++count < requestData.length) {
;
}
// Close the connection
sock.close();
}
/**
* This method generates a long MIME-encoded SOAP request message for use by testLargeDelayedPseudoServletRequest().
*
* @return
*/
private String generateLongMIMEPostData() {
StringBuffer buf = new StringBuffer();
buf.append( "--MIME_Boundary\r\n" );
buf.append( "Content-Type: text/xml\r\n" );
buf.append( "\r\n" );
buf.append( "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n" );
buf.append( "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"\r\n" );
buf.append( " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\r\n" );
buf.append( " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n" );
buf.append( " xmlns:ns0=\"http://www.ws-i.org/SampleApplications/SupplyChainManagement/2003-07/Catalog.xsd\">\r\n" );
buf.append( " <env:Body>\r\n" );
buf.append( " <ns0:ProductCatalog>\r\n" );
buf.append( " <ns0:Product>\r\n" );
buf.append( " <ns0:Name><product-name></ns0:Name>\r\n" );
buf.append( " <ns0:ProductNumber>123</ns0:ProductNumber>\r\n" );
buf.append( " <ns0:Thumbnail>cid:ID1@Thumbnail</ns0:Thumbnail>\r\n" );
buf.append( " </ns0:Product>\r\n" );
buf.append( " </ns0:ProductCatalog>\r\n" );
buf.append( " </env:Body>\r\n" );
buf.append( "</env:Envelope>\r\n" );
buf.append( "--MIME_Boundary\r\n" );
buf.append( "Content-Type: image/jpeg\r\n" );
buf.append( "Content-Transfer-Encoding: BASE64\r\n" );
buf.append( "Content-Id: <ID1@Thumbnail>\r\n" );
buf.append( "\r\n" );
buf.append( "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB\r\n" );
buf.append( "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB\r\n" );
buf.append( "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAEAARoDASIA\r\n" );
buf.append( "AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA\r\n" );
buf.append( "AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3\r\n" );
buf.append( "ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm\r\n" );
buf.append( "p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA\r\n" );
buf.append( "AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx\r\n" );
buf.append( "BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK\r\n" );
buf.append( "<KEY>" );
buf.append( "uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwCxRRRQ\r\n" );
buf.append( "AUUUUAFFFFABRRRQAUUUUAFFFFABRRRQn2f3B8r9138vmFfFH7c37W+mfsp/CldU0m70C7+Lficg\r\n" );
buf.append( "fC7wp4n0bxhqfhvxb/YeteAj44j1k6EypoEvhjw7rRWKP/hMfB7yONsUcsmEb3/xf8S9R03xFp/w\r\n" );
buf.append( "t+GXgLxl8cP2g/E/h0av4G+DHw40rWL/AMQ3mmHxhongj/hNPHOuDd4b+EPw8/t/VtHbxt8T/imn\r\n" );
buf.append( "hLwe7DxLHGjy+FYo34vWPA37CH/BI34taR4+/aM8B6t+2v8A8FXP2gdI8M+OvCHwU+FnwlOp/DLw\r\n" );
buf.append( "l8TvEXjnx23gjVf2d5vEPhqGDw+G+JHgnw/8MW+KMn/C2f2kU8a6AnjzwT4KjPjDxp4QbysZmuFo\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "ePxb4A8Pn4QeCdJ8feJvhb8KNA8Lto2u674ktfC9r4WvX8K28PimXwb4Mt5Jbe58O/uL8C/+CjH/\r\n" );
buf.append( "AAUd+NI07Xz/AME<KEY>U/HH7Sfw4+HXxC0/SyugjWdb8I/Cj47/Dv9n7XvHCvo\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>/<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "niRfCnhJUPh+Zl/4TPxN4P8AB3ixf2J/+Cpln+3J4f8AC/xA+Cf/AATx/aS8RfB/xP4rPhGy+J/i\r\n" );
buf.append( "Twn+y14C8L2j/wBpaPouv+K1XW/2h38Va/4D8JyxCy8Z+JvCXg/xdC11omv+D4ml8WeFX8Mm8l4n\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "K8dn4u6F4QOieBdH+J/xT0TwzceJPHXw6fGi+F/GfhvxTD4xePwe3m+AoR468J+ECvx9/wAEIvjb\r\n" );
buf.append( "8Zrj9gT4PaJ8WPBPxO8H/ET9n/VfHf7NHizQPij4Hl+HH9uaf8EPGJ8PaJo+jaGFtY5Yvhj4a/sT\r\n" );
buf.append( "4KjxJ4k8InxWPjF4H+I/gvxjKssPiyXxZ6WI4pqLBxx2Fu1GpGFanK6cVLZxad2k4yTvFSWknBpc\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "1dhRRRXonn7BRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFeQ/Fn4yaJ8LR4R0UQDx\r\n" );
buf.append( "H8R/id4j/wCEM+Fnw9tSq6p4t1MkLrms60NA8OeLToXw98J<KEY>" );
buf.append( "PXqKKKACis/WNZ0rQdL1DXNc1XTdD0fQbPVNa1jVtWvP7N0yw0vQv+Q7rWua5+Xv+ea8A8S/tDto\r\n" );
buf.append( "<KEY>4TeO/sP7Sfxc8NfA/wDZ18f+N7zwh4I+G3xi8d+ODoA0Lxh4L/4SLxCPjl4g/Z7c+ONB\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "b3YqFtbS5ko2/VP7QwqwmVYFWWV5QnyxpQvOcre9OV+W/O7XcpabLlfM3+Tnwh/4LDW3xj8CroPw\r\n" );
buf.append( "v+HHxD/ab+JcPxE8T/CzxdF+yNoni74ifCbwRqXgvS9b1vWAv7aXx++<KEY>" );
buf.append( "vi9vGHizxT4+8OnwB/wl9tJ4Q8ay/AHi3wv8WfgVe/GH/gsd/wAFKtU0STxr+z38OvE7/shfsgfD\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "eKviO2i+KjDr/<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "DeZ7EdAf930HFfHHxR/5HzXv+umn/wDpo0Kv58f2/v8Agp7+3h+z54u8I2P7Inwy1A/BrTfAvibx\r\n" );
buf.append( "T8dfiT8cv2Tv21tQ+FPwcTRNMj8aaJ40Hxn+AGuTeGde+H3inw5q7xuvhrwt4qm8GeMNH1288b+M\r\n" );
buf.append( "J7XxHOPCXvv7Evxd/wCCjX7UPhHwN+0D8VfjX/wTw174O+PIvBPifw/qX7Pfw7/aL8feIvGugbJB\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "6+KHhjwt8YvhH4k+CvxD0y68R+CPGvhrxt8P/GH<KEY>" );
buf.append( "bKfN0U1/Iv8AsfnXfDfg74n/AAC8Sa0/inUP2Pvj/wDF/wDZGsPH8ltD4efx1o/wU1ZdH8Pa02hw\r\n" );
buf.append( "/L4e3eGX0Lw0nhV/FnitjHoaSHxmgdQf6/e/tz/TH9a/kJ/Z0IPxi/4KU47f8FRv2vgfr/wlvhyv\r\n" );
buf.append( "p/<KEY>" );
buf.append( "V+nH86BRRRQAUUUUAFFFFABRRRQAUUUUAFFFFHl17f16oLre+ncKKKKNtHv2AKK8a+N/7QHwg/Zu\r\n" );
buf.append( "8O+HvFPxt8X2/grRvGet6loXhu9u9I1nxGuu6to2jf27rY0XRtB8N+LfEqf8Iqdb0P8A4TYswHgv\r\n" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "ZfEz9rv4xfEmXTvCni3TE+K01vptppF3rFx4H8YeBfAUlv4I8Nh9W0XxFJrklp4n8NeHNKlm1vwz\r\n" );
buf.append( "<KEY>+DbvwrF9iht/wCy3R9Z0rXtL0/XND1XTdc0fXrPS9a0fVtJvP7S0y/0vXf+QFrWh65+\r\n" );
buf.append( "fv8AlmgW5oVyXj7x94S+GPhHXPHXjrxBYeF/Cnhy2S51PXNSV5JLSSRgqRxogLu7sQqeE0BZmYKA\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "3wv+MHxo+DhPg06Pqz/E7wn4Y8Ta58UPC3wvk+HfgvwqfB9x4Tt1g8T3AZfGfxV+E03gz44+J/8A\r\n" );
buf.append( "wdDfDbwva3V18IPgx4o139nDTr/xR8PtK+L2t+M9M8FeOPHPxM0TUhrW74W/BMx/8LB1vwqnh7Xf\r\n" );
buf.append( "BHxFm8UeMPG3waSL<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "geFfBev6jqNnovmaENF8ZeMfEvibwj4d8ea8w8Pgz/FTwp4Qa18VeD/EfhUyy+KfG/hnxT4u8Y/p\r\n" );
buf.append( "<KEY>" );
buf.append( "WlaLwz4Z8W+KxNHbyywmSOKRl+OxWRcRZbJqMfaxTSi1FyvFNW0Wqi9FrazaSbW36Tl1Tw64mf1t\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "+zvp/beMdO+SM9u9eqeFZdE8YpcNpXizwvLAP9C+1S6sjaefpregsv068c5xX+dZ/wAFFf8AgoVZ\r\n" );
buf.append( "+JW8Axfsvft9fta/E/X7I6lrHi3W<KEY>" );
buf.append( "PhX7J4kluvBni/wrNF4k8M+I/Lvg5/wW/wD25vht470bxB8QvF/h34u+GbZ9MkvvC2ueDfCfhCaN\r\n" );
buf.append( "<KEY>h+<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "448R+NW8YrIr+D/F3sv/AATe+Dv/AATM+<KEY>" );
buf.append( "<KEY>" );
buf.append( "694dk8Rar4O8beL9Esfi7obeHQrTaDrPwyTxK3iPxH4iiGjqZQnhLxl/wmG8f8IL/wAJiG8GZp/8\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>8Mv4yU3D+LPBtu0Vn4Xtooub6tj8LgHLGqrCMJ042lJ8rUm+aKUr3cWotJLRczkm2jX\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "L/Bo8MDxVN4p+L2WWUMJmuIq4O917Oq24txUuVRdOzTUWuZXSakkm3a6Tj5GU1s44eyrMMbjlKKf\r\n" );
buf.append( "EeHpRVZXqKTcliG3KLl70XFOSa5pRbWjk5/1rfEf4geEfhR4C8b/ABT8eao3h3wD8MfCPifx9471\r\n" );
buf.append( "9bLWtUOi+GPA2ijXNb1ldD8PEeJvEGPD+jEbfCoZmOdoJFfx2f8ABOzxB42+JPwm+K/7RPjxPCcW\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "916XXLrdtP4n+0lFFFfcH4zuFFFFABRR<KEY>n" );
buf.append( "/wBnG/1Q6L/bo0XQ8c+IfEZOia2B4V8J58aZI7kCgDv6K/Ni0/a6/aC/aL1KGD9i74FWE3gS2uEe\r\n" );
buf.append( "f9or9o2PW/Dfw117+xv+E20ZJPBeh6GI/EniCCXWtH0h4fFcbu3g6RY/BHj3wL4MgkWVsyf/AIJ+\r\n" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "eEdS8S3smmaNpPiXUNN0rRGA13XX0LXPiL8J5PEK+EQf+EqbwrH4t8IyeNB4fOxGbCn3nx7+yT+0\r\n" );
buf.append( "<KEY>" );
buf.append( "R+GbnQvid4jPwxbwh8G/GVvMug+B/AfjLxn41MXlcnXO/CH46fGv/gnh8SfFXxx/Z48M6j8Ufgl8\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "sfDv4pTeINP8E+<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "/izwXqt345XwjodxD4I+NsfiDwAh+PPwg8Mf2P8ADDxR/wAIj4sC/wDFF6T4d8FeBfGfgnzfGHhE\r\n" );
buf.append( "/kT8fPgN8fPCnifwZ+wJ+3L4a0z4h/Cv9sH9oL9k39nb4a/tefs/6z4O8N6zfR+Of2r/AISM7+PP\r\n" );
buf.append( "hj45TxcPAnxg8RfBz4VfFPxPceKfCCeKPB/hPxXr3hrwQn/CUeBXY2/PRz/B4lfVMW2s0Su4yaUk\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "vEm7WdR8Kaf4k8daDoug+CNFZE1yXw3oniSTxP448X+IfF7eZF4z8XeDtGct/wAJlB4V8KyJ2ldO\r\n" );
buf.append( "QYh4vLHjLW5+aSX8q55Rtp25dLb790HHOF/szPP7KSVspjw81NfDPmhFyaatdNvVfzXV9Lv/AD+G\r\n" );
buf.append( "6n6n+dfYnwj/AG4v2o/gT4Uh8CfDH4sah4b8H2V9qd5Z+HLzw74H8UQ2Q1gNHrEeknxp4d8Sto6X\r\n" );
buf.append( "<KEY>" );
buf.append( "/<KEY>" );
buf.append( "9rW78GWfh34c6h5n3Sf7c+H+heFPEL2wfhdFaQ25ALGEngfIWsa5rHiPVtS1vWtTv9X1rWL2/wBW\r\n" );
buf.append( "1TVNSu31HUNQ1L<KEY>" );
buf.append( "fBdt431u8t/Dvh3S9A8EWcvh/Q9GuD4W8D6KrCf+wvBaT+D/AA9d3ztd634uuRLP<KEY>" );
buf.append( "<KEY>" );
buf.append( "HviBydWlu/<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>R/<KEY>AMP+KPCfgL4R+N/299K+NHg/SfA3xE1uw1H4BeA9V8Kx6NDomuOy6D8W\r\n" );
buf.append( "<KEY> <KEY>" );
buf.append( "7v0T5f5fK2217apL0/Bfx5/wSHuPBn7PN78XNY+Ll9oPjDwf8GNa+IH<KEY>" );
buf.append( "Yan4I0jX9F+I/wBlhS2H9k+GjLHD4oJGky+ODJCniiz8GWn4fMzg8ux99x5/Wv7Tv+CmHww/aq8J\r\n" );
buf.append( "/sTfFz/hIP2Z/wBo34Y65rujakzHR/D2k/FQWHgTwPq/gHX/AIrax428efsweI/i18M/h38P4/h5\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "PLSPSdJ1HwpZ6V8CPipoen2WleHPD+jar4M0TQNGaTRTovhrwj4e0Pw9J4dfwT8UB4c8Lqvg7wmn\r\n" );
buf.append( "<KEY>" );
buf.append( "NE02w/4WZoLpqvgd9Y1rUo/7cYXWiS+O/DHhHw74ce4fxd438Z+E7JvDU7m3k8P/ADfFGW/XcpqJ\r\n" );
buf.append( "fFFcyt/dspRe97xu1ZdLdz9R8KuI1kPFVLD4rTLc4SoVL2vFtr2cr7p87S0ktLve1v7av21/20vB\r\n" );
buf.append( "X7MXhLxTd/FG+uPBXw5s7rTvDfiXxvb+FPF/jI2Q8b6Nu0Ma1ongPw54q/sLQWH/ABS48R+KAWb+\r\n" );
buf.append( "3/DCxo3jvAr+Tb9nL4Fat8fPiz8a/wDguT8Ufhzpf7NX7L37Ol/bftDfD3wDL4w0Xw+f2kP2ivgn\r\n" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "M6Tpnw28L+Bl8HeGvA3h2H4LRa/oPwu+F/7P8S674f0c+MfC3g79nJPDPitPCOhxPfXfjTxW0vhL\r\n" );
buf.append( "43hzEYDB4KV5unVbanpKTlTXK+WEI2bbd+ZztGKUOWSvNx/WPEyjmkMVltsu5MkhTUnO/LbiCV4q\r\n" );
buf.append( "c5O7skuZKNubVOLaifwmeJvFPiHxx4i1/wAYeK9d1fxR4p8V6tqXiLxN4m8QanqWveINe8S6zqMu\r\n" );
buf.append( "razruuapqpkuNZ1zX9UkmuLy7uJJp7ud5Z7oy3Bmnf8Acf8A4In/AAhkfUPjB8d7mC+tba00/S/h\r\n" );
buf.append( "JoN1HqOjTabqU+r3OmeOfHMk2jKzeIWl8JjR/haYTb7YfsfiLXhmWYTXPhT94PiJ/wAEvf8Ag3C/\r\n" );
buf.append( "<KEY>" );
buf.append( "aY/hB4tvZvC+u/8ACZr42HglY/8AhE/zE/Y78Hf8E7/hn+178W<KEY>" );
buf.append( "iZ4/0jU/D0nhTTLbxj4f8NeOPhnqujeIPh98KZPEGsf8JL/whvxN/wCEstvBsdlN4O1tPAiyeFf+\r\n" );
buf.append( "EI8XeMfiz+gYDNKGPssNCUY6JSlCUYy0TVm1Z6O7s9F97/n7N+G8RgMKsdiszg+dc3xNVE+ZN3Ur\r\n" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "WqWc1+fEGjnV/<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "uPGHi+fUruC6vNM0Xw34d8PWf9peOfHnjzXOdD8GeCNDzjX/<KEY>" );
buf.append( "D4bt9K8MWDeLvjX8Qxqnhz4G/DK<KEY>" );
buf.append( "ZcFT4NFfMnhH/<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "MF8Z3H6mXYGoicamBqA1MYuxdD+0RfAY4UDIAGDjGMdq+dPh78Op/wBjr9hnw58HPCvibUfGP/CG\r\n" );
buf.append( "fEz44eJLHxV4ntNbv75h8Wfj544+KukO+ra34h8Ua94hl8LaH8ZW8Np4r8V+Kml8X+MNDPjYytvc\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "P8MNZh8TT+E/iz8R/CniMaIT4P8ACMnhL/<KEY>" );
buf.append( "5mruTs7JN3bW7dld6W0TP578Q89wmecQxjgowhlGSqNGmlypzhR92OqV2le0Ve8Yrpdn5dftV/sp\r\n" );
buf.append( "/Dr9rf4c3Xgfxvbrp3iDTF1W88CfEO1sQfE/gLVMhgyn72veH1YA+NfDCkHxryp/4rk+DvGfg7+T\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "BkhRrl4om/t01jWdK0HS9Q1zXNV03Q9H0Gz1TWtY1bVrz+zdMsNL0L/kO61rmufl7/nmvo34MfC3\r\n" );
buf.append( "w5rHgX/g3Z+NV5daonij4c/DXSPhZotjby6OdBu9A+KX/BL7xt401uPVpXja4h8QLrnwb8I/8IfF\r\n" );
buf.append( "JMsMi654kM8ctxDavD5Gb5v/AGbhW7bQnJdvdhKdrv4l7tum+reiPs+DOFv9ZsXCPNaEZQUrLVRl\r\n" );
buf.append( "Upwbuu3PdtrlSW<KEY>/AIJP6j8LPBP/AAUT8F+PfFN14x/ab/YesPgh4xl0T4a6npMfwU1H\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "2ifB+va9N4v+IT+LvGVz4q8R+HNJ8ReK/EviTW7mZklkmSPl4TzjE4uOYYiumvcocuvM054fDzqN\r\n" );
buf.append( "PS3NJzktG9Um3Zs+p8UeFMr4ewfDH9lvmebw4gUpP4rUs/zvDwve9+WnCEdH0SSS2/uL8PfCrwlo\r\n" );
buf.append( "SagDplhqgu72SZf7WsodQa0sG2bdMi80OCkYDbchg7MN0bgAV80ft2eOfDH7Nv7Hn7S/7RVp4C0H\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "iR8Cfh58BPFem+Jx4g0f4z+PPjfr2h2vwM0f4Xz+GDdDx8fGralo/i2EeFFvPDMHgmLxL451G4i8\r\n" );
buf.append( "DeF/FniW3+lWOxf1pYlzk7OLu5WbcWraK2mi0Ss3qfkW1tu339EeBfsefsN3X7OH7Nvwl+DXxM+P\r\n" );
buf.append( "fxn/AGg/Hngnw3HF44+Mfxc8Rpr/AI88deJtb1PVfEOuNdSa1/wlixeHrfWtdbw34P8ADM3iTxXd\r\n" );
buf.append( "eFfBuheHPB83jLxXDbS3l1+OX/BUz/g3c/Yz/bc1jxLrPwr8LN8Af2kpLvT9b1/48fDbwL/wka67\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "9Y1y28KaN451vwx4Ylt/HSDRte8/<KEY>" );
buf.append( "9rf4JfD/<KEY>" );
buf.append( "FptLg8R+Ek8Tgwx3WgxxxYd23f5av/Bd7/glb4P/AOCa3xw8E6/8IPEgn+AX7SH/AAneu/DTwTrF\r\n" );
buf.append( "1qmqeMvhZq/gUeCG8ceCbjWJ1MPiXwIH8d6F/wAIF4qmkHi9IBe+CvHNvJfeFz428c7VMEpYRY3D\r\n" );
buf.append( "Rbj9uCkm0rtXVtd03eyutbdUPT077a6afj3/ADPwIyeeTz19/rXoHgTxr4k+Hfjbwd4/8I6qdE8V\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "X8X674ntPDPibxp4VXwj4y8D+FDc/BA+NYX+LE/8SnwQ+M/xK/Zz+KPg/wCMnwe8Z6l4E+JXgDVI\r\n" );
buf.append( "tc8K+KdBnEd/pmoNHcW93CsRaW21vRPEGg3d14d8WeGfE1hc+GPF3hXWde8J+KbCewuXR/6tP2cv\r\n" );
buf.append( "+DqbW4Lqw0z9r39mDSLyzutZ1W5v/H/7OOv6lp1/pfhr+xX/ALA02z+F/wAXPEPika/r/wDwkSyw\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "8O/sy+LfiF+zn45h8fftE3XhTw5eeA/<KEY>/<KEY>" );
buf.append( "tA8K/FV7fxnJ4fHgfwN44x4pbxnH/Ht4M/4KAfET4LeDfEulfCGT7X8Ufip4sX4i/G39oP4oW2le\r\n" );
buf.append( "MviX4x8bavJofiGa30mLWBrsD6T4X11fF1vJr3xIuvild+NH8SeI/Gvl+B7nxbc+D7bo4VjxBXrV\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "yr/Zng/WvED+IovEX2nxgdAfwX4WWHxVD4rSEnxhaRyW3hmcx/1+V9ufkAV8Jftw/tw+Df2QvB32\r\n" );
buf.append( "eJtN8VfGbxRZ/wDFC+ATdkrpuQceNfHQGSPDZPDFQX8aDPgdEkYeMvGXg/wP9ur/AIKZ+Dfgfpni\r\n" );
buf.append( "j4VfAvWrHxd8eLe61fwvqeqLZjUPDPwomKBtZ1jJV/DO<KEY>" );
buf.append( "<KEY>FUevad+1Z+1zN4h8V/GPU10jWvAfhLx/Pq/<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "ltZ1jwleMsn7QPjzwzrmisv/AAhmtsjGP4BhThl/4RLxl40+Mb7V3eN/g944JVgDsPiB8btM8O3H\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>+Cvgfqs3xQuPjv8Z9c07xp8R7axGifDnw7pNof+EH+BXhjXdGDa7o3gj/hIMDxB\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "XPE/gZJfGHx5aX47fHX/AIRjw1PrqrHI3i5fBvg/<KEY>" );
buf.append( "ha11rUvC2saXrXg/xDaXeseHPHHgTUzrOg64dZ8E+NtAHhLxL4B8QN4i0TRFZfCvi8q66CysCpIP\r\n" );
buf.append( "z+YZAs0hKLzOb5k9PdtzJwa0cW5K61jzq7s7qyR+hcO8cf2Fjcqxr4c4fVk4uUalROzi4ttRnycy\r\n" );
buf.append( "5+eLVPRqOjS1/qNgnhvYraeCa3ube6P22zurXGb4/UHBwfT/AOtXg/xm8YeHrzwd4+8Kfbba21/S\r\n" );
buf.append( "/wDhGM6VdYH23/ic6DrwGi8/MGPTHQ4OO4/n40fVv2u/C82rWOm/tF+A/H2j3Osi90q6+NH7O3/C\r\n" );
buf.append( "Q+OdD0s6Vobtoo134S/EP9n3wzr3h4a+2s+Ioz/wh5C/23vdZXY18kfGL9oD/gof+yj8HfiX4l1L\r\n" );
buf.append( "xL4M/az0FPAniOK2+Iuj+AtK+Fvxa+DniTWtFxonjxvB2haH4r+Gvj/4SfC0aGviiSGOKHxW0mvv\r\n" );
buf.append( "J43ks/h94TS3h+AjwHmikmpwa5ldczu1deSV1o1r0trqj92peNPBcotOE1JxdmlF2l7ui1bs27XS\r\n" );
buf.append( "urq3Luv0F/4IM/8ABMf4A/En/god8bfjF4+/YMb4P6b+wlJ4J8K+EbnVf2gPGfxx+EGuftGeIki8\r\n" );
buf.append( "d+C/HfgPRvHPwatx4h8SeEvhyNJ8XyyeI/jBBdfBr/hNfglcyfBU+P8AxVF418F/t3/wW0/4Ke/G\r\n" );
buf.append( "j9mJfhv+xv8AsQ6FpPiz9uL9p7SfEq+HvEGq634VvvCX7NPwzj1TRvDmsftA/E3w19ou9fgVvEOu\r\n" );
buf.append( "/wDCM/BKHxR4SH<KEY>" );
buf.append( <KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "4yfDf42eK9P/AGrbXWPFPin4jfH3xQdG+Kmv/ErxZ470fXH8fa5448PePfEQ8Lxa/K2s655nia28\r\n" );
buf.append( "Y+KMZ8TJ43bxZ42RfF4+N/Fn7UH7cP7GH7Qtp8EvjpL4B/auvvibfroXwv0rQdc8F/CnxXZ6o/jS\r\n" );
buf.append( "TwPoT60ugeHYRoQ8UIm0r4pj8XeCQxQeBfHYbwv4wz/TB+1x4k+O3hX4EePtc/Z18K6J4t+I1r4c\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "b/4Jy+JPCHxo/Y0/Z48XL4A8C6Xo3wq8QfF7wB8FtK0zSNZvtN8CeF/gd8Svi1+zf8KtZ0PWviB4\r\n" );
buf.append( "j8X+J9C8Qf8ACmdDHhvxj4pPi/8A4TKRNe8SOTnxdg/xuV/VT/wRT+J/w68R/shv8GvCPiO41Xxn\r\n" );
buf.append( "+z58Q/HmnfEbTNU/srTtR0s/Gjxnr/7Rmh6no2i6H4j8WeJf+EDSP4oar4c8F+JvFD+Ex4w8W+Cv\r\n" );
buf.append( "iIQqDwxhPzvxXy36pw9lv1RapXm9Nkmmm13vs1rsfr/<KEY>" );
buf.append( "s4qLbaV2eLf8FKwD4r/4KMjuf+CUPw6H4f2t/wAFH8f1r/<KEY>" );
buf.append( "<KEY>" );
buf.append( "xpJPDFvZQReCNFjkuvCreM0aTxL+Wn/BJn/g3H/ah/4KAyeFPjv8ebfW/wBlP9i221vwxq3ifxx4\r\n" );
buf.append( "<KEY>" );
buf.append( "gCD5XgTDT5cwfK<KEY>" );
buf.append( "+807NWPwO+E3wF+NPx713UPBfwL+EPxN+<KEY>" );
buf.append( "8Q3i6Jbazrmj2j6ykSwPc6zZwlpJb23D8l4Q8X+KvAvinwt438HeJ9f8GeNvBWvWPibwh4s8Ma1q\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "z7iVZk8pyqebU8o+OUYyklaKcuZqNlFcsm29owk27RbPrjwl/wAFe/8Agqd4I8R+HfGOk/8ABR39\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "4d6B8VfiD4xfw34vt7fwXfeCYvgl9o/4TvxDc+CvBP8AEx8JPjz8afgH4hv/ABl8C/i98TPgt411\r\n" );
buf.append( "vSH8O6p4r+FPjzxZ8OvEt34ZfU9H1qbRv7c8Ga14eu20S51nRNGu20ZJmt0udHs5yEksrdk/tB/4\r\n" );
buf.append( "IyfCAeBv2CPhfeQeHdS8KeIPHSfEj4s+MrrXn1WxXW5G1XW9C8F6wp1tI4/Dy+KfAGjfDA+C1VT4\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "hz4b+G/2ov2gte8VeGvB1z+zv4x8G+Jtf0OHVPF+k23j3wR4i1zQZvAPibw18VUHiWfwGln8OfDv\r\n" );
buf.append( "jK38V3N3rkttaT+Erm3uIovwl/4KY/<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "eIfJ8QftJeJU+HOkAbB4E8EXuleI/<KEY>" );
buf.append( "TJ+5Hw0+C/wF/Zh8HaxD8PPCHhP4X+F7W0/tvxf4g+2AINL0Ia7rn9teNfGuvgeJddXwkms6yoXx\r\n" );
buf.append( "V4vRfBKKqjCooABx37Kn7Kfw6/ZI+HNr4H8EW66j4g1NdKvPHfxDurEDxP491TJYsx+9oPh9mJPg\r\n" );
buf.append( "rwwxJ8FcKP8AiuR4x8Z+MfyU/bm/4Kpak2p+Kfg3+y7rWkpoq2WpeGfEfxrtF87Vr7Unk8t5vhdq\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY> <KEY>" );
buf.append( "<KEY>" );
buf.append( "xphWTw6Wn0DW9b1628NfCvwb8XfFT3XgPxQknhCKKC7mtwD6m1jWdK0HS9Q1zXNV03Q9H0Gz1TWt\r\n" );
buf.append( "Y1bVrz+zdMsNL0L/AJDuta5rn5e/55r5Ui+PfxE+NNzNY/steD/Dmp+CYPEOq6PeftF/Ey7eP4RX\r\n" );
buf.append( "<KEY>/C7wRoXiD/hJfjCGB8a+HR4oj/4VB4JfxfoYH/Cd+LnOA7Sf2ab34garF43/a11vw78\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "X3f12RyH7RP/AAVR+L//AAUOX9lv9jX4z/Bvxp+zV8SfhFYap+1D+1/4Osb3Wo/ht8V/FXgLXPDu\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "L/wiMHxO8U+L/Fv9F/7fPx70v4IfB<KEY>" );
buf.append( "PEh/4RbCKzHHCliAf883WNc1fxJq+<KEY>" );
buf.append( "iZZHlLuWctIQzOZLznMHhZpRi73Wtr2StfVdFovLtbQVDWO+tt/P3f68z+jjx74Vg8K695Glarpu\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "udW<KEY>" );
buf.append( "<KEY>" );
buf.append( "hVvhdp3ivw74Oj8WwXOvjx94v+H3i74R+Hh4al/<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>xD/AGdwxmHEOCy+alKFecKbcZzfs7UaU5Wd/cjTim3quXmV4JI/oDMOAcLnfjZwV4VZ\r\n" );
buf.append( "<KEY>" );
buf.append( "AGqLHWk8B3HiSQeAfCWpa/rF3ongzwPous62vgv4NeB9c0RPCcg8I+EVzbeLviT4V8K2p8aeLn8V\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "RxE8PV97P+I8Q4x/t7OK0oRnT5JOlC0alGlUhGNOn/Cl8T/<KEY>" );
buf.append( "09vE9kvjFLe/1L+3bfS9Yv5PCPjLWLNtPi8SeG9e/wCERvh4ckj0JvDfh2TxBGJ/jPxh8BIUsby9\r\n" );
buf.append( "Z2tbtLa0MdxY27Lo/wAry6hfX0yIs8a+F9E0DS2gLSs/iTXvEkrSZu281R/Vt+<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "tSPNClHmvd1I2g5SXNJw5YxbUlK1lOHD9I7KvAjK/<KEY>" );
buf.append( "Ko8LNzr08PCUVKGbTqzWWU0oxScngMx/m0vv2TPG3hz9kHTv2uvGdxD4M8M+PvjdpPwi+BnhvXLf\r\n" );
buf.append( "<KEY>" );
buf.append( "GH/0LfhR8OPDn7Ln7CngnTfFPijQp9O8H/DrwN8NNX8f6kNI8EaVp3hj4V6Mf7c8ZayPEDE+H0Qe\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "BD4lv9fv9J0rw98OrHxy+jDRdAkU69ocnhiLw98Bfhvpcuut4hk8WW3jnwX4rt/hZ45uPEnia7kn\r\n" );
buf.append( "muvgz/gqZ+3Gn7ZPx1t5/BV+t98CvhPJqejfCQ3fhweHtS12TW49Fl8d+MNYWV116WHxTrujxReG\r\n" );
buf.append( "Fnt/CwtvBmh+G<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "u1S51TXdSVne0kdgqJGigs7uxCr4TQFmY4AJr+Sz9uP9trxh+1v4yktIDf8AhT4QeGZJU8DfD77Y\r\n" );
buf.append( "sy3krMVTxj4ukil8ifxNdRCUJ89xB4QsZF8JWrT3U3ivxd4p/qw+L3/BGP<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "pc6prupKzvaSOwVEjRQWd3YhV8JoCzMcAE14l4t0v9u/9ne60Sx8afDzwH+074XuU8MaPL42+H1z\r\n" );
buf.append( "/wAKY8cPIH1w654vl0bx94l8V/DLWw0Wh6P4pTw2niv4QgziKN/Akfw+lkuIH/CLxL4c+NXiC4+I\r\n" );
buf.append( "OtahHF4m8GhT4a+DWoWxsPEXwO0nxDHrOjaBrHxS8Ea+3/CTeHfjJ4p8NtrLf8JJIkfhWHwezeA/\r\n" );
buf.append( "ghF4s8E+LPGnxh+LvnYjC4vCWWL<KEY>" );
buf.append( "fgi0vNa8E+OfHnhf+xteOun4p65/yM3w/wDD3iz+3NEH/CrfCg8H+MyNB/4r0E+LvGXwY8GexeGP\r\n" );
buf.append( "DHhjwNolj4Z8F+H/AA74W8N6czPpWg+FtJ0bw74bs2Y/2+zaLougZZnZiWLE5JOSTW9RXKAUUUUA\r\n" );
buf.append( "FFFFABRRRQAUUUUAFFFFABRRRQAV+f0Pgn4kfsVaX8fPjN4a1LSPiv4C174v+PP2jfGPhXStKX4d\r\n" );
buf.append( "fEnwLpmu6x4f17xvrPgXxs3xH8VeGPHg+FO<KEY>" );
buf.append( "0GpXNv8AbNLssaTo+s6kf+J7rX9g8f8ACP8AX/kOD/iqf+ZL/wCR5PNdOExGLwuMisJ1a26K61/P\r\n" );
buf.append( "da9+4cxa/ECL4sabpHxKs9UPiKx8deHfDHiXSdfayOmG90zXNFI0TWDoJwQw8ODDAgEEEECvN/ix\r\n" );
buf.append( "DY3ng+fStV+D+o/HPR9fvtKstY8AWtn8NdSC8jXv7c13Q/i94j8JeGgF8R6HoZJUFsDgZ4r9T/hL\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "T+H/AIM8PeLPFyeHZbPxh4Q8G6x4s8Yx3UE8sd1bf0leNrHx/wDtgftFab+xb+wvpHgfS/GelJpe\r\n" );
buf.append( "qfGn48TeDtKv/AX7OHhLWZTHouta067D8QPiB4sZJR8FPgQJEHjMRTeNvHki/AzwePGdeef8HEH/\r\n" );
buf.append( "AASNuP2Pf2If2RfE37HGifFzWNK+AHiP49Wvx513wp4X8V+OvHXj8ftH/DRtZ+PH7Sf7RHxT8OyR\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "1HT/AIPaF4YjeLWta1Dw/wDBL4Rfs56FrHxK1PSdUle38QQyeIfF+kv4wFt4VjtfB/8Abnw8t7cy\r\n" );
buf.append( "+MYxdeNf1Ntv2KV+HmrfF34hfsDfHmx+EfiP4hfEHS/jD438B6ZeaV8Q/hr4t8TnRZBu8feA/EHi\r\n" );
buf.append( "HxN4f3/FCTRtCPjLxZ8K2/Z0+M3jOHw7EJPjevjCNfF6/kvDWeYPIqH+r2bRjL2bcbKS57uS96Cc\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "P+C8Xew/4JJfhpn7YX49fFte5VxvhBDFS+uKi5OV5RqUsLKpe8Xa86bnFX0Sv1fdM8/LYfSow+Dh\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY> <KEY>" );
buf.append( "h1Kz8CeBjrNpaeJfiBrsN1reg266R4UsppZFB8RWJ8TajJ4d8KWEo8V+IrKK597D5/kCy6T<KEY>n" );
buf.append( "NlXI2qiikpxg+W6mknZPS6vHdJ6n5bxfkPG8+IFHizM6mfcXZtJJQqcQS4hz6Ep8sowqe+3Bz5ru\r\n" );
buf.append( "DSlq03zJpf0T/wDBtj+z3o+kf8NE/t4eNfDFlqV74Baz+CvwB1bUD4P1SwPjzxHo6618VG0zRpom\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>/Df/AIJ5/s9rqserfEDwl42sb3+1PFOg6zqv\r\n" );
buf.append( "<KEY>" );
buf.append( "bqut2vhz4YeEZte/4Rb7XpzOJtW1tornxFreh6LoFtCfEWuXTaTo/h3xl4w8RXBuD4U8PeHfBwvL\r\n" );
buf.append( "<KEY>" );
buf.append( "MsqSz/iVtuSln7jHlpt6pqlCWqV1ZRT1sj5k8eeNfEnxF8beMPH3i7VTrfirxx4j17xf4s1RbHT7\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>YPE2r2f\r\n" );
buf.append( "gfTdD1e91W81X/hJdR1PQdI0HQPHWt63/bTP4i8QA/EUa4R4pid48fcZl2sf88VBk/nn8q/SL9hn\r\n" );
buf.append( "9vL4z/sl+K9G8OfDjRrjx74a1vxDd31p8NLG3t7DxDrfjzxDpOheHtI1bw5rcHhrxP4j/t2Z9G0f\r\n" );
buf.append( "Ro/Cs0XibwZ4lT/QbrwZcTSxznDJce8Ji07e69Fba10vlun973Curx0vfX8vXTf+rH+hJRX5y/Az\r\n" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "HYTQQXlrcQTwW1zb3f8AoV5aXfP2/wDDt/8AWxXw3+0z+zRpl9pMfxK+GEyeC/H3ghNUu9K1S3sV\r\n" );
buf.append( "1TS9P0vXGDa3pGs6IRu1z4f+K<KEY>0Hw3418CHwf438L+EfGHhD68/4WH4B/6Hnwj/4U\r\n" );
buf.append( "mj1w/wASPiR4Hh8EeKILfxHompXGqaPqmi2dppN5o2p6n/amu6L6f545784YrDxxSd+XReXrp/w2\r\n" );
buf.append( "mgeh8Pwy+fF58H4ZPXof84qxXy7+zF8UdA+K95+0R4k8G+MpfG/gnTvj8fDfhTVYJlvdK07TtE+D\r\n" );
buf.append( "vwJGt6J4dcSyNc+GD8QBq8nn+Fkg8GiV5PGQiaPxQk831FX5xiLfXF2u/usegFFFFcwBRR<KEY>" );
buf.append( "UAFFFFABRRRQAUUUUAFeWa3Y+KvFHx6+Bvgawn1nRPBF/Y+OvEfibxBpcOqSaZf+JfM+H/gjwP4N\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "3n2P/qBdOg78fT9K8o/4JJeBPCn7WPx9+I/7T154k1DxZN8C/il46/ZZ8MaVdeHld9C+MbaT4D1n\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "/g8hgtbS3toYIbe3jtibO1tLU4GDnjnknvx7mvxTiji+WSYvAcuXSqe2k+aSbaUEoxVkr9/W6bk2\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "UWcxoPOoVGqkKKvzwU+VuHPC1S0W7RUnK2jcW27/AN1+Dni3hcRwmsDlmbxyGoqcJpzUJxu1CzjC\r\n" );
buf.append( "qpQhK+lRWjN3cedaOP51r/wX4+EOian8d9A+JP7PnxR+Hvif4YLqNt8NvCt/qiP4l+IvifRNfHh+\r\n" );
buf.append( "TwT8R9EfQoIvgh4liVk8SeNSsniuDwtLofiZLOe68ZeFPBnhbxp5hZf8FvfiT8QfiT+zN4c/Z0+A\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "lNSan/KB8J/+CVP/AAUe/bE+FPwSsf2yvF2rfs4/s8/Bm08U+F/g1afF/wAGrqHx2tdM1c66dY0v\r\n" );
buf.append( "wt8LRD4S+IsmgeGfEfgrwR4XmHx38ZeDI/DPg3W/C9x8FIPF/hSNfC8v278WPGv7LX/BFr4KXvw1\r\n" );
buf.append( "/Z48M33jf9oD4w38l74M8PeLr8+JPib4xmbWtf0bRPF3xN1vQ/<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>/B<KEY>/Ez4hfF/4r622s3uu61eXw08Xmo+IJWfW9Yby4/FHiJvEgGuqv\r\n" );
buf.append( "jlofFPiqN3Uy/<KEY>" );
buf.append( "KeHeF048O3z3i5tt8UTb/<KEY>" );
buf.append( "xXe6BrOoPLrOoarksuk6ZpKrHF4hMIfRfCy+GLe2t/Bvg5AiyJL4HjjZeT1T9rH4i/ELxDa+CfgL\r\n" );
buf.append( "8OdV1rWNVtb6y0dTpGr+MfGuoLLoxZF0TwhoPmpFL4YjXXXiEsfi9BGWnZ/Ljw/6E/8ABWb9hT4M\r\n" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "Zp2txTHOsxaTpOtpa6NcaOravtl+zQNbIJEK/ZxI8Z6D4ofsv/Eb4S/An4F/HjxdpOr2fhz4/wAP\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "Bd14U0P/AIlXjgeDWfxzJLrP9veHx4SaSeDR08Qy+F/CnxWi8Yw+<KEY>" );
buf.append( "/W7Zf2H4J8OaPY6rquiaHb2v+hfa86N4b0y/1T+gx/hXpZJliwr+t4xdbJb9ldpfPtbpoTiH7tul\r\n" );
buf.append( "vv0Z83/HLwr8MvCujaPBB4cudN1i7s/sWj3fh68Om6Z/xIsf8hzP/Yc/XgdK/mm/4KSft3fFH4G/\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "Tv2hvGmm+Df2cfgn4J0b4afDr/<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "hz172dv5f1f6n0v/AMFHfjxD8Av2ZvHnjIXEFtqEGk6pe6U2qaPq2p6beeJB83grSdd/sOSHxEqe\r\n" );
buf.append( "J/iFrXgmV3lmhiREZ5Zoo1aRf6BP+CMX7L+qfsxfsXfAf4V+PZPFdx8U/Bvw20fxH8Ro/GviTRPF\r\n" );
buf.append( "niK2+Mvxv1bXPir8bftWveHmmOup4b+JPjXxt4a8J+KIxKZ/CLsjeNfHETyeLZv4hv23/jx4O+P/\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "qH4ifHj9oP4efDzWfHesWvjm68Hav8B/jvrniLwv4g11/<KEY>" );
buf.append( "TwX488HeJP6pf+<KEY>" );
buf.append( "pcN4i8L+KdG0DQdD+J0PiGLQvC9tczeMH0e58LyeNfhLCX8Xx/w6fscfskftVf8ABYH9uXUvHH7Q\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "4n8X654412R08H+FPD+hxQnXY9fmurnSfD9r4YtopP8AhKXuEFq0siRSN6v+0B/wTE/bD/ZM+Gnw\r\n" );
buf.append( "J+Ln7TPwp1r4YeCfjr4pbw74btdRY6n4m8ImPQPBfifRYvifo+jmay+<KEY>" );
buf.append( "/DPxfN18KfigvirwN4Ui8LLNdfrv/wAG9n7Un7P/AOyx+2vrfw7+MuleJrvxh8c7bwN+zV8DPi/b\r\n" );
buf.append( "ajrGo6b4J1n4oeIDrEnwz1vwPoEhU6J8XPEujeDPDkfxLCeKW8FeLfD/AIXVV8KeB/GHjLx14V/u\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "PBg1ybx14z1zwf4g8Py+Hfi74B8LeIvHI+FvwZ8TS+MvGXhnwMug/FK3vvB/hS4+E/wlHg7M+Cv/\r\n" );
buf.append( "AAbA/tb+L/HWkaH+07+0Z8D/AAr8JEbS5Ndi/Zzf4jeO/i541xq+hnWfBWkL48+Gng3wp4JfxDoD\r\n" );
buf.append( "azs8XSp4vg8LeMYvDJn+HXi2OY20f9aXx/8ACvg//gmV/wAE4/ihpP7OHw9+Hvg3/hnP9mT4v/E/\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "SUUtPdSlfZW/GvxT468Aftbf8FAviz8WPCvjLWtc0j9jy88V/sVWvhO5tPGJ8LaD468D/wDCAeOP\r\n" );
buf.append( "il8S9F0PxBD4O8MaD4m8UfEbxpo/<KEY>" );
buf.append( "gF8OPAPxF8VeK/FnxO0nwzHF8UtW+IHiTS<KEY>jTV9d+Kv7R2ka5430M7tfPhb9q34o/G93\r\n" );
buf.append( "<KEY>" );
buf.append( "fwy8DaJo2g+JvEPiHxJ4r8Qg7E8L+FvFgdivjYOvgTwmK/W5OOCwX1zGJJWuk9tLWum/L108j3Yp\r\n" );
buf.append( "zklG7baWmru2rPT1R/Oh8aprP4mf8FlPh7f+GPE/hnTb3Q/gD8XtaiPiHVdEEugeK28F/tAa/wCB\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>/<KEY>" );
buf.append( "DceIvFHiJR4U1/TNe8IoviW5TxVJH4bTxXdQqbtWf4OWYYXM8O<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "I/rF8b2X7fn7Mni34kXP7PH7M/7Pfxz+D3ibxit54Ej+H<KEY>" );
buf.append( "X4G698P/AIT+I9c8beF/BPiTwr8XPGXjE+Ch8NZPHng3xf48Pxj+MNfzx/8ABTL/AIKP/EzS/Avi\r\n" );
buf.append( "<KEY>+IvhR8dNa/tf4NfC74ba8vw3sNR8J3/h3Rcv44Xw9oHxJ+Ktw/hnwn4h1vXZHXxQPGEy\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "iiuYAooooAKKKKACiiigAooooAKKKKACiiigAr4f+AF/4j8F/ttf8FGJZ9N1LTofHPhD9mWx0fVL\r\n" );
buf.append( "yyOnPeeFm8G67oeuazoT<KEY>" );
buf.append( "fjT+zT49+E+<KEY>" );
buf.append( "f195+R2lat8QfC37ZP7X/wC1L4d8HX3xP8b/ALIPxY0742+CL/xDZeLvEnhvRvF3wx/aw+F58NaJ\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "C8LtNb+FvGXm+AvCXRT/ANrw2ZyvrCUZebs1ddXom3ppZK7S251XSxTWnW68nZ332urXS6ryP47P\r\n" );
buf.append( "+DpH4hftaeJ/+Chvwh8L/G/4K+NPhF8EPANprEf7P+p+Jb/wj4g8L/GTW9c8YaHbfFf4w+DNc8EX\r\n" );
buf.append( "HiV9D0jX/wCxPhl4bt/hl4i8X3XjXwp4M8N/Dvxz438EfCvxX8Xbnwgv6TQf8FC/+HM3/BK<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "THM3aThCaSuldy1u79LtJu97a3ve/wCQf/Btf/wS5+CP<KEY>" );
buf.append( "vGCxXvhnwn490X4deB/HLfGTXFSVhr/iPwvL410H/hBIZFhXwS2geJfHMEPi/wAcyeDJPhF/ol+H\r\n" );
buf.append( "9CsfDmkWGj6aJRZafGEiE7l32/MTl8KCNxyMDAPriv8ANT/4IQ/t7ftRfslfEfVvCuh/su/tE/HT\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "/dSg1JWSlzyabbS1tb4elnruks+Ha8sTkmXSmpKUlCXvJRfwws7JaR/lX8jWiei6Yg7s9FHvxjjI\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>wALPGfw0Pirwja+MvCnx417zYfF1v4U8YwD+ov9pP4r+GPAHhLXZdc8V+HfCfhv\r\n" );
buf.append( "R9A1fxL8SfEviHVU8P<KEY>" );
buf.append( "vHF9/wAFAv2j/gZ/wUB8feFPFXhb4Z/FD9qr9nX9nT9m34JfE7RfA8hj/ZSWTxHrD+LvGn9hRhNf\r\n" );
buf.append( "/wCFq/ET/hOPFsfhzxBc3o8Iw+IfEPhAeOvi74JHhHxVae5g8NLDUFN+682Xs6SlukpR5p21au4p\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "A+LPxi1/Qfht8W/j74o/aLMGoDXPD3gqy8d+FvAcE7+Lf0d03xVpX/<KEY>" );
buf.append( "eztPtn/Ezv8AS/8AhC/7B13/AIkfp4TH9hc5x/xP/DFfCv7TXhz9qT9vT9v74VfsU/sj/Gzwv8Ct\r\n" );
buf.append( "W+AHwh1f9tT/<KEY>jD8KfibFoHwT8Ha3oA0DxRHr8fhf4waR4NiD+Lmk8G7tf8AFPjd\r\n" );
buf.append( "fAvi1vCXgrwp4t7uMcvlWymDxWaNJJLk1Tei93S109m2mrXS1Pd4PzBZZmtsNlsc421ltF<KEY>n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "t/wUe/4Jrax8dPhL4D+Ivg34/<KEY>" );
buf.append( "l8NpfDvizw/Honhl4fDHwo2N4P0HwztPixk8W+D/AIu/jmS8Q4LKM0hSxTlB5teFSjJpxjKNl7Sn\r\n" );
buf.append( "KLa5ZxUXFS3VuWVSDUo/sWZcG5nxPk+bVEnLNuWNTh2fxQmkoqUbu0uZWfOrytJTU1Gc1KX+dF8R\r\n" );
buf.append( "<KEY>" );
buf.append( "Vv8A2jP2UPDeheBreLRfiP4E0SP7FZ2OtXM1h400/wAPporLomi6Tr0kfi3w6uieG5RHbi18V+C/\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "P2mfhTrHhfwn4j8MaD/wkmmWHxgujrl3oGktLDokejWnhzX9AX+3P+EpTxLNJ4Wgk8INJJLGJRaz\r\n" );
buf.append( <KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "Zd/2Z/wt4/Fm/<KEY>" );
buf.append( "WNM+HugRtpvwy8E65cWxbRNJdbVNZ1Bo9DSWOPxD4xuhL4m8XTyy3cgUQ+Ez4q8RWvhLwxcP8WKF\r\n" );
buf.append( "7kE85yff3/nX0J8Lf2efjF8ZtM17xD4A8EXt/wCD/DGn6je+JPGGr6honhDwTokOhpoz602sePfH\r\n" );
buf.append( "OseGPCMF5HFqltq50CXxOk/+kRTLbG3V3UxOY4vM1HDW91X0S3tZ/on+Jbjy639PX5d9elraXW57\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "ItVt7DTPGvj600nxT4c1d5HiHiu38Fxa8dS8Ks58TN/pXh6PVj4t8Ix+F/B+Wif4h3XjS5vYvDPh\r\n" );
buf.append( "BbL+jQfFvXv+Cenxj8Pf8FBtLi8feLf2fLn4Wat4B/aP8D+ALXWvEfjXW/Amh6wNd+FmueBtBPxJ\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "PiBdS8PeKvDfiXwwlz4I8baF4j8CeM2g8X26W034efG3Q/2Hf+CyWrfs1fFnXP2ufFfib4QfGi68\r\n" );
buf.append( "dn4C/s7w+I/hx8J/A3x51L4UeNoU+LGt6P4J+MHwZ8MftNL4+8J6J4IHwx8a/FP4U+M/CHjbwb8H\r\n" );
buf.append( "ZvEv/CETeE/A3xb+L58Yfjlpf7Ln7UH/AAT6utZ1T/glh+0Zc/Dr4b+M/FvgTxlq37NPxu0X/hbf\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "7tJ9NLN7a2dtNtT/<KEY>BP<KEY>" );
buf.append( "<KEY>" );
buf.append( "f6R4b8OeEvC+gaO3iDXvEGtS635C2+ieG9AXVrqceIYYFW4Q8yMFmr+Q3xF/wW1/4KDXvh3X7bwh\r\n" );
buf.append( "/wAEm9B0HxheaJfWXhnxJ4i/bc+Hnibwr4f8WS6YE0XWPEOieHfDHhGTX/DF<KEY>" );
buf.append( "tht/GPhRWM6fK9l8FP8AgpD/AMFRJp/EP/BTL4x3vwT/AGc3Twxead+xn+zjdDwJ4I8WHRNW8E6u\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "4YaP8EfBXiKTwomvfDweGNdc20iK8s03iDwm3i8+DZdkvi/+tv8A4U/4Ah8J+D/AOl6HbeG/h/4D\r\n" );
buf.append( "szZ+G/BPh+z/AOEc8M2Gl6Fop0HQiT4fPXwn3Pr7V+dv/BVP4Q+D9Q/Y0+LdiPC+nR+H9M+EXxP1\r\n" );
buf.append( "djZMmlH/AISXwTov/CceCVLSkeItfV9f8Et4lbzT5bISJf3ZasK+IxWJxccVolG1rbJK2iVmkku2\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "oN8NvA3ww8KeDI4fCMnwn8MQeLpoBceLfFp/Mzw/4o1P42eKv+CTXxss7vUvEukab8NvHPwx8V+L\r\n" );
buf.append( "dcne81a++Jmifszx+CNam1mPWpW8Ra60uu/CvxqV8TMZrcwaI7RSMwhdvtnwtrf7UHwT+Ld9/wAM\r\n" );
buf.append( "U/FbwZ8MdF<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>n" );
buf.append( "Je+9Ekm0rn4PfEL9nPRj/wAFrvGPhLSm8aal4f0X4qf8NIa5qlkkd9qGgahqvg/RfjjA2vPFoKx6\r\n" );
buf.append( "Hoj/ABI1/SfC4int2vxHrfh7weX/AOExlV3+DPiJ+0b8ef2f/wBoX<KEY>" );
buf.append( "0zwf4B0m6Enw18O6Y3jbxFHJpWl/DHWIJPh8tsI<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "BniLwf8AH34TfD746Q+INH0vRtS1O5Eeg+IvEAGjf2F4hbx1PreheMP7di8SxJpTy+FvCsXg3wrx\r\n" );
buf.append( "rZW0Zbt3tuTsf29/2c/FGtWml+G/+CXnwM1LV9Y1hrTRvDugR+D9S1C9v9ZYro2k6TpC/BV/EWt/\r\n" );
buf.append( "vDHFEiNK80sscagNJF5n5OeE/Cnizxzr1h4W8GeHPEXizxRqRCaV4f8ACui6t4i8SXjANqTf2Nom\r\n" );
buf.append( "iQzTTkKDI0UUbsil5VVWBKf0X/8ABPr/AIJny/CjVYvjb+0boWnXHxC0rUZG+Gnw+N1o/iLTfAw0\r\n" );
buf.append( "<KEY>" );
buf.append( "d63Y23jX9jL9i3w34XL/APE31PwndaN418R2UYHD6Loev/soeEv7fkzgbP8AhLWGORISAD7B8Y/2\r\n" );
buf.append( "bvB/x0Gm6V8SvE/jzUfh3ZmwOsfCHSdX0fw74J8X6no0eupoOs+Odb0Lw6/<KEY>" );
buf.append( "TwikuieGpP8AhDCyQ+V9F0Vz/wBoYn0vvZWv9y8hmfo+jaVoOl6foeh6Vpuh6PoNnpei6PpOk2f9\r\n" );
buf.append( "m6ZYaXoX/IC0XQ9D/P3/ADxWhRRXMAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAH8qH\r\n" );
buf.append( "/BVH9nBPgr+0rL8RdHtY08EfHsaj8QLS3JjjFn44t5Ibj4raKyy+IJtd2vrur6V4oZ7iz8NWkcnj\r\n" );
buf.append( "o+DvClu8XhR5a+i/+CdH/BS<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "IoRxK1Wm630bemvS+t9N7WSP7k/2afil+xN4s0G2s/2UPip8OLrwDJ4R8Mre/BKC5X/hXXgHS9aj\r\n" );
buf.append( "1rxroMT+DGX/AIR74Q694m1/VfGkfjKB/CR8YeLPGisPHCeLj4V8I7/oHxV8H9c8S6fb/wDCAeP7\r\n" );
buf.append( "nUvB91/zCdW8SazqWmWH/YD9/Tt/xIM9a/l0+D37cX7L/wC2Hqfh7w/+0P8AAXUNH+OtpbaPP4f8\r\n" );
buf.append( "ZfDTwb4y8ceI7yX4ftovjlF+G3i74TJ/wvHwGyeI28QeJf8AhFvCsc8HgzwVozwf8J4zPLHX6p/C\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "+v8Agr46/F/4fNfeHxhdH/trwUPh1+0ENB1yTDTR7vFqvCHFq/n+UbubrLL4j/8ABQSzt7aC4/Zb\r\n" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "Mm0KcaBly7fNXq37XUHw68FfAzUJ/ib4j063+H91rGl6L4w1b4r+MP7T8M3+la5ouv6Ef7d/4T8/\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "q23jr4a66NL+B/xt8F698LPhh4z1nWvDyQ+ECF8e/G3/AISnxf4h8SoI4rXSPiLCqNP4P/4Q1vob\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "z4m8ck66uja5o02JX8ReE1GheF90gVj/AGByifdH1jRRX67hMMsJGMVZ2jF<KEY>" );
buf.append( "uUt5O7v3lr+LZ8CfALwxDe/tff8ABQfw1pet+IfCdlD/AMKI1DSofCurNp9pofiX4o/DJ9W8Z+Mt\r\n" );
buf.append( "D8GMz/C/X/HnijxBoOi+JI/E/ijwd4rdmRluI3j8T+JnDNc/4J/+PPjHqXheD9rT9qfxT8c/AXgy\r\n" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "z/ZXh+0/<KEY>" );
buf.append( "<KEY>UAFFFFABRRRQAUUU<KEY>" );
buf.append( "L8TaEkqaFFLHomueHj/wk+gxyxaNo0UkfhTKSRO0bhkYivXaKAP56PiN/wAEbPif4b+IVh4g/Zo+\r\n" );
buf.append( "LHh3TPDGmrp+teHdU+JfiLWvD3xJ8JeLNB+zyRyLrPgT4etGvnTQDxR4P8UeR4PVUaUKJE8Kw+L/\r\n" );
buf.append( "ABP/AEq/sEftJT/EWG9+Bfx10qDRf2yvhV4O0s/EW9vLPRP+L0+BVA0HR/j74J13w74b8I/8JB8P\r\n" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "tgCw8HqCD/Nr8c/D<KEY>" );
buf.append( "G8HaJov/AAjsvjr4hNJKt343mXxM3hH4O+DneDxY/inxv4nh8FWv0l8dvjr/AM<KEY>n" );
buf.append( "viL4X/am1v4m+IdU+H9taap8IfiR4N1W/wD+JP8A26p1z/hAfiRF8MB4dPhs60HY/wDCHK3hDQB4\r\n" );
buf.append( "3UeLz4W8X+MPBf5q/t9fEP8Abs8R/BpNM/agt/hB8APCVz4k06TR/hl4Y8TK/ij46ahHKGjSLSfD\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "veFfin4Rv79T4eurRvEOgWurRaPD418F/wBqQv4g8G62zySE2/iFIlRmjivJ/Dsn2fxTaJ9s8P20\r\n" );
buf.append( "<KEY>" );
buf.append( "qwIHBIIxkULRp9j2PYcyatv9+y12/PrfqfTf7XXxH+Hfxe/Zv/Z/+FXw503wD4g8MfHr48/CLRtY\r\n" );
buf.append( "0jVL1tQ8Ot8MPhcB+1PrmrjboHijw18Qf+Es8PfBgeGPBY3MvjSLx4++KaMPE34E+MPgZff8FI/+\r\n" );
buf.append( "CrHjn4PWmra1rfw2+FHgrWNO13UvDt7oHg7UPCHhf4a6RFFr2j6OfEHhWaTWZ2/aC8XHw3Aq+FPF\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "Vnf3p1pau8bpdmpecfG39nD/AIKofsf+<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( <KEY>" );
buf.append( "yS3tuuu/md6VgooornAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiii\r\n" );
buf.append( "gAooooA5Lx94B8I/E/whrngTx34esPFPhPxJapbapoWpMyPdyIwZHjdSGR0YBl8WIQysMgg1+Pnj\r\n" );
buf.append( "/wCCvjvS7E/8E5PiTfp8RPh18W/DXivxP+xF8ZNevtKi8S/C7xP8KdGHjb/hWPxOkm0GWSfw74XS\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "xZ4Ogfwg7RI/<KEY>" );
buf.append( "KYlXw+smleINY+JvxM8N6/<KEY>" );
buf.append( "+1Z8OfFPgm413Q9A+GOt6Z4u8f8AjTShF/Z+j6aVntY/BmpKdc8MQSQfFeTf8N5NAjkuGn8Kat4p\r\n" );
buf.append( "vZfC3inwr4Y8UBDcatdX2vr6H6z694Z0i8+OP/BY3xnNasfEmifsz+EfDWkXwu9UMdl4Y8afs0a9\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "4A8RWS6hIfAmueCvD+hf2P450LXQqKfFR0PavhVAAia6i+PC2P8AhDm8vA0MR/aOZebpOK3Vo0YR\r\n" );
buf.append( "k09tZX00tfyPseIcRleK4W4FwuFcXKMM95lrdOWezkr+kOVX2t7suiPqT9mLx/8ADLxn8M9J0/wB\r\n" );
buf.append( "b/A3wjPoNkt/4g+FHwL+Ivg34ieHfhtF4g1jXfEMOktrPw/fwp4YUSRNrLqF8Iuh8ZN4mKt41Ujx\r\n" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "D8MMPGwhl8axt6h8ac3/AMEV/ib/AG98Dfib8LL281+41D4c+O9M1q2bU9QZvDln4a8d6Q0uh6Np\r\n" );
buf.append( "EbMTFJF4h8GeNfEDKiRxN/bO5BIwklb9l6/mG/4Iu+Lk0n9pPxn4Ru9eh0vTvGHwi1NbLQLrWZNP\r\n" );
buf.append( "svFXirw54s8Na3pBXR9wTxFrfh/w+3je58t0dofCS+KxCYlkl+0f080AFFFFABRRRQAUUUUAFFFF\r\n" );
buf.append( "ABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABX8537Ynxhggsv27PiNa6mTqnxQ\r\n" );
buf.append( <KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "nwf8MyRP45+IItFmW7lZgz+DfCMcsfkT+JrqIRF8JPB4PspG8W3Sz3UvhTwj4p/rB+GXws+HXwa8\r\n" );
buf.append( "MW/gj4WeCPDfgrwxa8/<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "<KEY>" );
buf.append( "tZ/EbwX4xtvFnx4/4Jy/ECxXwfqdqNU0a/8AE3wm0zx3r+utoetaJoXiKNvD3gj4jeEvExPiSHxO\r\n" );
buf.append( "nhIfCDxj4xm8KyzTeEfG3iPwlJ4O+u/+COljaaZ+zj8SrHTdb07xBbab+0P41tLTxFpaaumna2ze\r\n" );
buf.append( "B/hDnVtEXXNE8N+JF25BUeKvCa4VlDwW7h4UAP1kooooAKKKKACiiigAooooAKKKKACiiigAoooo\r\n" );
buf.append( "AKKKKAP/2Q==\r\n" );
buf.append( "--MIME_Boundary--\r\n" );
return buf.toString();
}
}
|
<filename>Lectures_15_CSS_Part_1/spreadOperator.js
/**
* Spread operator in Javascript
*/
/*
const evenNumbers = [2,4,6,8];
const oddNumbers = [1,3,5,7,9];
*/
/*
const naturalNumbers = evenNumbers.concat(oddNumbers);
*/
/*
const naturalNumbers = [0, ...evenNumbers, ...oddNumbers];
naturalNumbers.sort(function(a,b) {
return a - b; // arranging elements in ascending order
});
console.log("naturalNumbers", naturalNumbers);
*/
/*
let numbers = [2,4,6,8];
let numbers2 = [...numbers];
console.log("numbers before splice", numbers);
console.log("numbers2 before splice", numbers2);
numbers.splice(0,2);
console.log("numbers after splice", numbers);
console.log("numbers2 after splice", numbers2);
*/
/*
const arr = ['a','b'];
const arr2 = ['z',...arr,'c','d'];
console.log(arr2);
*/
/*
let a,b,restOfTheNumbers;
const numbers = [10,20,30,40,50];
[a, b,c, ...restOfTheNumbers] = numbers;
console.log("elements of a", a);
console.log("elements of b", b);
console.log("elements of restOfTheNumbers", restOfTheNumbers);
*/
|
#!/usr/bin/env bash
echo "* Data from command line arguments"
../../cli.js find --array-json '[{"a":"b"},{"a":"c"}]' --qj '{"a":"b"}'
echo "* Data from files"
../../cli.js find --array-file ./array.json --qf ./query.json
echo "* Array from stdin, stdout to file"
rm ../temp/result.json
../../cli.js find --qf ./query.json < ./array.json > ../temp/result.json
cat ../temp/result.json
echo "* _crud._match true"
../../cli.js --array-json '{"a":"b"}' _crud._match --qj '{"a":"b"}'
echo "* _crud._match false"
../../cli.js --array-json '{"a":"b"}' _crud._match --qj '{"a":"c"}'
|
<reponame>Symphoomc1f/krexusj
package com.java110.things.service.parkingArea;
import com.java110.things.entity.parkingArea.ParkingAreaDto;
import com.java110.things.entity.parkingArea.ParkingBoxDto;
import com.java110.things.entity.response.ResultDto;
import java.util.List;
/**
* @ClassName IMappingService
* @Description TODO 停车场相关接口服务类
* @Author wuxw
* @Date 2020/5/14 14:48
* @Version 1.0
* add by wuxw 2020/5/14
**/
public interface IParkingAreaService {
/**
* 保存停车场信息
*
* @param parkingAreaDto 停车场信息
* @return
* @throws Exception
*/
ResultDto saveParkingArea(ParkingAreaDto parkingAreaDto) throws Exception;
/**
* 修改停车场信息
*
* @param parkingAreaDto 停车场信息
* @return
* @throws Exception
*/
ResultDto updateParkingArea(ParkingAreaDto parkingAreaDto) throws Exception;
/**
* 获取停车场信息
*
* @param parkingAreaDto 停车场信息
* @throws Exception
*/
ResultDto getParkingArea(ParkingAreaDto parkingAreaDto) throws Exception;
/**
* 获取停车场信息
*
* @param parkingAreaDto 停车场信息
* @return
* @throws Exception
*/
List<ParkingAreaDto> queryParkingAreas(ParkingAreaDto parkingAreaDto);
/**
* 删除停车场
*
* @param parkingAreaDto 停车场信息
* @return
* @throws Exception
*/
ResultDto deleteParkingArea(ParkingAreaDto parkingAreaDto) throws Exception;
/**
* 岗亭对应停车场信息
* @param parkingBoxDto
* @return
*/
List<ParkingAreaDto> queryParkingAreasByBox(ParkingBoxDto parkingBoxDto);
}
|
import { createTransport } from 'nodemailer';
import Mail from 'nodemailer/lib/mailer';
import { Sender } from '../algebra';
import { Address, Attachments, Recipients, RecipientType } from '../commons';
import { Content } from './generic';
/**
* Provides an encoding for simple SMTP configuration.
*/
export interface SimpleSMTPConfig {
host: string;
port?: number;
user?: string;
pass?: string;
}
/**
* Creates a transport agent which sends emails.
*
* @param config SMTP configuration.
* @returns A [[Mail]] instance as a transport agent to use send mails through.
*/
function makeTransport(config: SimpleSMTPConfig): Mail {
return createTransport(encodeURI(`smtp://${config.user}:${config.pass}@${config.host}:${config.port}`));
}
/**
* Creates an SMTP-based [[Sender]] implementation.
*
* @param config SMTP configuration.
* @returns A [[Sender]] implementation.
*/
export function makeSmtpSender(config: SimpleSMTPConfig): Sender<Content, string> {
return async (
subject: string,
from: Address,
recipients: Recipients,
content: Content,
attachments?: Attachments
): Promise<string> => {
// Attempt to send the mail:
const info = await makeTransport(config).sendMail({
from: from,
to: recipients.filter((x) => x.type == RecipientType.To).map((x) => x.addr),
cc: recipients.filter((x) => x.type == RecipientType.Cc).map((x) => x.addr),
bcc: recipients.filter((x) => x.type == RecipientType.Bcc).map((x) => x.addr),
subject: subject,
text: content.text,
html: content.html,
attachments: attachments,
});
// Return the message ID:
return info.messageId;
};
}
|
#!/bin/sh
set -ex
dockerd-entrypoint.sh &
sleep 1
docker run --rm -v $(pwd):/data -w /data hashicorp/terraform fmt --diff --check
#docker run --rm -v $(pwd):/data -w /data --entrypoint=/bin/sh wata727/tflint -c "tflint *.tf"
docker run --rm -v $(pwd):/data -w /data -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY quay.io/ukhomeofficedigital/tf-testrunner python -m unittest tests/*_test.py |
import React from 'react';
import ReactDOM from 'react-dom'
import Sszz from './module/sszz/Sszz'
ReactDOM.render(
<Sszz/>,
document.getElementById('sszz_wrapper')
); |
package imports.k8s;
/**
* A topology selector requirement is a selector that matches given label.
* <p>
* This is an alpha feature and may change in the future.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.14.1 (build 828de8a)", date = "2020-11-30T16:28:28.179Z")
@software.amazon.jsii.Jsii(module = imports.k8s.$Module.class, fqn = "k8s.TopologySelectorLabelRequirement")
@software.amazon.jsii.Jsii.Proxy(TopologySelectorLabelRequirement.Jsii$Proxy.class)
public interface TopologySelectorLabelRequirement extends software.amazon.jsii.JsiiSerializable {
/**
* The label key that the selector applies to.
*/
@org.jetbrains.annotations.NotNull java.lang.String getKey();
/**
* An array of string values.
* <p>
* One value must match the label to be selected. Each entry in Values is ORed.
*/
@org.jetbrains.annotations.NotNull java.util.List<java.lang.String> getValues();
/**
* @return a {@link Builder} of {@link TopologySelectorLabelRequirement}
*/
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link TopologySelectorLabelRequirement}
*/
public static final class Builder implements software.amazon.jsii.Builder<TopologySelectorLabelRequirement> {
private java.lang.String key;
private java.util.List<java.lang.String> values;
/**
* Sets the value of {@link TopologySelectorLabelRequirement#getKey}
* @param key The label key that the selector applies to. This parameter is required.
* @return {@code this}
*/
public Builder key(java.lang.String key) {
this.key = key;
return this;
}
/**
* Sets the value of {@link TopologySelectorLabelRequirement#getValues}
* @param values An array of string values. This parameter is required.
* One value must match the label to be selected. Each entry in Values is ORed.
* @return {@code this}
*/
public Builder values(java.util.List<java.lang.String> values) {
this.values = values;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link TopologySelectorLabelRequirement}
* @throws NullPointerException if any required attribute was not provided
*/
@Override
public TopologySelectorLabelRequirement build() {
return new Jsii$Proxy(key, values);
}
}
/**
* An implementation for {@link TopologySelectorLabelRequirement}
*/
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements TopologySelectorLabelRequirement {
private final java.lang.String key;
private final java.util.List<java.lang.String> values;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.key = software.amazon.jsii.Kernel.get(this, "key", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.values = software.amazon.jsii.Kernel.get(this, "values", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final java.lang.String key, final java.util.List<java.lang.String> values) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.key = java.util.Objects.requireNonNull(key, "key is required");
this.values = java.util.Objects.requireNonNull(values, "values is required");
}
@Override
public final java.lang.String getKey() {
return this.key;
}
@Override
public final java.util.List<java.lang.String> getValues() {
return this.values;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("key", om.valueToTree(this.getKey()));
data.set("values", om.valueToTree(this.getValues()));
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("k8s.TopologySelectorLabelRequirement"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TopologySelectorLabelRequirement.Jsii$Proxy that = (TopologySelectorLabelRequirement.Jsii$Proxy) o;
if (!key.equals(that.key)) return false;
return this.values.equals(that.values);
}
@Override
public final int hashCode() {
int result = this.key.hashCode();
result = 31 * result + (this.values.hashCode());
return result;
}
}
}
|
#!/bin/sh
set -v
for i in clang/8.0.1 gcc/9.2.0 ibm/xlc-16.1.1.3-xlf-16.1.1.3 pgi/19.7
do
module purge
module load cmake $i
cmake .
#cmake -DCMAKE_VECTOR_VERBOSE=1 .
make
./globalsums
make clean
make distclean
module purge
done
|
<filename>lib/car/obj/src/ctdn2.c
/* **** Notes
Count letters down to the specific symbol.
*/
# define CAR
# include "../../../incl/config.h"
signed(__cdecl ctdn2(signed char(sym),signed char(*argp))) {
auto signed r;
if(!sym) return(0x00);
if(!argp) return(0x00);
if(!(*argp)) return(0x00);
r = ct(argp);
return(ctdn2_r(r,sym,argp));
}
|
#!/bin/bash
#exit on error
set -e
echo "Starting init db script..."
USER='se_test_user'
PASS='se_test_user'
DB='searchengine_test'
HOST='localhost'
drop_db() {
echo "Dropping db $DB"
mysql --execute="drop database if exists $DB;"
}
drop_user() {
echo "dropping user $USER"
mysql --execute="drop user '$USER'@'$HOST';"
}
create_db() {
echo "Creating db $DB"
mysql --execute="create database $DB;"
}
create_user() {
echo "Creating user $USER"
mysql --execute="create user '$USER'@'$HOST' identified by '$PASS';"
}
grant_user_to_db() {
echo "Granting user $USER to $DB"
mysql --execute="grant all on $DB.* to '$USER'@'$HOST';"
}
cd "$SEARCH_ENGINE"
drop_db
drop_user
create_db
create_user
grant_user_to_db
cd -
|
#!/usr/bin/env bash
set -e
if cargo --version | grep -q "nightly"; then
CARGO_CMD="cargo"
else
CARGO_CMD="cargo +nightly"
fi
CARGO_INCREMENTAL=0 RUSTFLAGS="-C link-arg=--export-table" $CARGO_CMD build --target=wasm32-unknown-unknown --release
for i in nameservice_runtime_wasm
do
wasm-gc target/wasm32-unknown-unknown/release/$i.wasm target/wasm32-unknown-unknown/release/$i.compact.wasm
done
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function getImplicitRoleForTbody() {
return 'rowgroup';
}
exports.tbody = getImplicitRoleForTbody;
//# sourceMappingURL=tbody.js.map |
<gh_stars>0
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* filter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rle <<EMAIL>> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/05/03 15:03:52 by rle #+# #+# */
/* Updated: 2017/05/04 14:33:00 by rle ### ########.fr */
/* */
/* ************************************************************************** */
#include <ft_db.h>
int filter(struct s_header *header, struct s_command *cmd,
t_vec *entries, t_vec *db)
{
t_vec new_entries;
size_t i;
uint8_t *entry;
(void)(db);
vec_init(&new_entries, entries->elmnt_size);
i = 0;
while (i < entries->elmnt_count)
{
entry = *(uint8_t**)vec_get(entries, i);
if (0 == memcmp(entry + header->fields[cmd->field].offset,
cmd->value, header->fields[cmd->field].value_size))
{
vec_add(&new_entries, &entry);
}
i++;
}
vec_del(entries);
*entries = new_entries;
return (0);
}
|
#!/usr/bin/env sh
#
# This will build and export `CoconutLib.xcframework` to `build/CoconutLib.xcframework` including all supported slices.
# Use the `--static` flag to build static frameworks instead.
#
# Note: You may need to open the project and add a development team for code signing.
#
set -eou pipefail
rm -rf build/*
static=0
library=0
linkage=""
packaging=""
settings="SKIP_INSTALL=NO"
for arg in "$@"
do
case $arg in
-s|--static)
static=1
settings="$settings MACH_O_TYPE=staticlib"
linkage="static"
shift
;;
-l|--library|--libraries)
library=1
packaging="libraries"
shift
;;
-f|--framework|--frameworks)
library=0
packaging="frameworks"
shift
;;
-d|--dynamic)
static=0
linkage="dynamic"
settings="$settings MACH_O_TYPE=mh_dylib"
shift
;;
esac
done
echo "Building $linkage $packaging"
suffix=""
if [[ $library == 1 ]]; then
suffix="-Library"
fi
DSYM_FOLDER=build/CoconutLib.dSYMs
xcodebuild clean archive -project CoconutLib.xcodeproj -scheme "CoconutLib-iOS$suffix" -sdk iphoneos -archivePath "build/iOS" $settings
xcodebuild clean archive -project CoconutLib.xcodeproj -scheme "CoconutLib-iOS$suffix" -sdk iphonesimulator -archivePath "build/iOS-Simulator" $settings
xcodebuild clean archive -project CoconutLib.xcodeproj -scheme "CoconutLib-iOS$suffix" -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -archivePath "build/iOS-Catalyst" SKIP_INSTALL=NO
xcodebuild clean archive -project CoconutLib.xcodeproj -scheme "CoconutLib-watchOS$suffix" -sdk watchos -archivePath "build/watchOS" $settings
xcodebuild clean archive -project CoconutLib.xcodeproj -scheme "CoconutLib-watchOS$suffix" -sdk watchsimulator -archivePath "build/watchOS-Simulator" $settings
xcodebuild clean archive -project CoconutLib.xcodeproj -scheme "CoconutLib-tvOS$suffix" -sdk appletvos -archivePath "build/tvOS" $settings
xcodebuild clean archive -project CoconutLib.xcodeproj -scheme "CoconutLib-tvOS$suffix" -sdk appletvsimulator -archivePath "build/tvOS-Simulator" $settings
xcodebuild clean archive -project CoconutLib.xcodeproj -scheme "CoconutLib-macOS$suffix" -sdk macosx -archivePath "build/macOS" $settings
archives=(iOS iOS-Simulator iOS-Catalyst watchOS watchOS-Simulator tvOS tvOS-Simulator macOS)
args=""
dSYMs=""
if [[ $library == 1 ]]; then
for archive in "${archives[@]}"; do
args="$args -library build/${archive}.xcarchive/Products/usr/local/lib/libCoconutLib.a -headers build/${archive}.xcarchive/Products/usr/local/include"
dSYMs="$dSYMs ${archive}.xcarchive/dSYMs/"
done
else
for archive in "${archives[@]}"; do
args="$args -framework build/${archive}.xcarchive/Products/Library/Frameworks/CoconutLib.framework"
dSYMs="$dSYMs ${archive}.xcarchive/dSYMs/"
done
fi
echo "xcodebuild -create-xcframework $args -output build/CoconutLib.xcframework"
xcodebuild -create-xcframework $args -output build/CoconutLib.xcframework
if [[ $static == 0 ]]; then
echo "Gathering dSYMs to $DSYM_FOLDER..."
mkdir $DSYM_FOLDER
for archive in "${archives[@]}"; do
dsym_src="build/${archive}.xcarchive/dSYMs/CoconutLib.framework.dSYM"
if [[ -d "$dsym_src" ]]; then
# mkdir "${DSYM_FOLDER}/${archive}.dSYM"
rsync -av "${dsym_src}/" "${DSYM_FOLDER}/${archive}.dSYM"
else
echo "No dSYMs in archive ${archive}"
fi
done
else
echo "Skipping dSYM collection because static binaries do not produce dSYMs"
fi
echo "Done."
|
<filename>src/game/server/entities/projectile.h
/* (c) <NAME>. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef GAME_SERVER_ENTITIES_PROJECTILE_H
#define GAME_SERVER_ENTITIES_PROJECTILE_H
class CProjectile : public CEntity
{
public:
CProjectile(CGameWorld *pGameWorld, int Type, int Owner, vec2 Pos, vec2 Dir, int Span,
int Damage, bool Explosive, float Force, int SoundImpact, int Weapon);
vec2 GetPos(float Time);
vec2 GetDir() { return m_Direction; }
int GetLifespan() { return m_LifeSpan; }
bool GetExplosive() { return m_Explosive; }
int GetSoundImpact() { return m_SoundImpact; }
int GetStartTick() { return m_StartTick; }
int GetWeapon() { return m_Weapon; }
int GetOwner() { return m_Owner; }
void SetDir(vec2 Dir) { m_Direction = Dir; }
void SetPos(vec2 Pos) { m_Pos = Pos; }
void SetLifespan(int LifeSpan) { m_LifeSpan = LifeSpan; }
void SetExplosive(bool Explosive) { m_Explosive = Explosive; }
void SetSoundImpact(int SoundImpact) { m_SoundImpact = SoundImpact; }
void SetStartTick(int StartTick) { m_StartTick = StartTick; }
void SetWeapon(int Weapon) { m_Weapon = Weapon; }
void SetOwner(int Owner) { m_Owner = Owner; }
void FillInfo(CNetObj_Projectile *pProj);
virtual void Reset();
virtual void Tick();
virtual void Snap(int SnappingClient);
private:
vec2 m_Direction;
int m_LifeSpan;
int m_Owner;
int m_Type;
int m_Damage;
int m_SoundImpact;
int m_Weapon;
float m_Force;
int m_StartTick;
bool m_Explosive;
};
#endif
|
import os
import json
def process_json_files(sub, args):
try:
with open(os.path.join(args.log_d, 'combined_output.json'), 'w') as combined_file:
combined_file.write('[\n') # Start the JSON array
connect_loop(sub, args) # Process data from JSON files
except KeyboardInterrupt:
for key in SCHEMA_MAP:
with open(os.path.join(args.log_d, SCHEMA_MAP[key]) + '.json', 'a') as fout:
fout.write(']') # Close the JSON array in each individual file
# Combine data from individual JSON files into the combined output file
with open(os.path.join(args.log_d, 'combined_output.json'), 'a') as combined_file:
for key in SCHEMA_MAP:
with open(os.path.join(args.log_d, SCHEMA_MAP[key]) + '.json', 'r') as individual_file:
data = individual_file.read().strip()
if data:
if combined_file.tell() > 2: # Check if the combined file already contains data
combined_file.write(',\n') # Add a comma for JSON array separation
combined_file.write(data) # Write data from individual file to the combined file
combined_file.write('\n]') # Close the JSON array in the combined output file |
const conection = require('../helper/conection');
const PlayerRepository = require('../repository/PlayerRepository');
const AppErrors = require('../errors/AppErrors.js');
const Player = new PlayerRepository();
module.exports = {
async index(request,response){
const players = await Player.findAll();
return response.json(players);
},
async find(request,response){
const { id } = request.query;
const player = await Player.findPlayerById(id);
return response.json(player);
}
} |
def vertical_order_traversal(root):
dic = {}
# create a dictionary to store the horizontal distance from the root
def get_hd(node, hd, dic):
if node is None:
return
dic[node] = hd
get_hd(node.left, hd-1, dic)
get_hd(node.right, hd+1, dic)
get_hd(root, 0, dic)
# use a hash table to store the vertical order traversal
h = {}
min_hd = min(dic.values())
max_hd = max(dic.values())
for i in range(min_hd, max_hd+1):
h[i] = []
# traverse the tree using preorder
def preorder(node, hd):
if node is None:
return
h[hd].append(node.val)
preorder(node.left, hd-1)
preorder(node.right, hd+1)
preorder(root, 0)
# print the result
for i in range(min_hd, max_hd+1):
print(h[i]) |
import Vue from 'vue';
import VueClipboard from 'vue-clipboard2';
import Toasted from 'vue-toasted';
import App from './App.vue';
import router from './router';
import store from './store';
// import './registerServiceWorker';
// global component
import './components/index';
Vue.use(VueClipboard);
Vue.use(Toasted, {
theme: 'toasted-primary',
position: 'bottom-right',
duration: 2000,
});
Vue.config.productionTip = false;
new Vue({
router,
store,
render: h => h(App),
}).$mount('#app');
|
#!/usr/bin/env bash
# This script sanity-checks a source tarball, assuming a Debian-based Linux
# environment with a Go version capable of building CockroachDB. Source tarballs
# are expected to build and install a functional cockroach binary into the PATH,
# even when the tarball is extracted outside of GOPATH.
set -euo pipefail
apt-get update
apt-get install -y autoconf cmake
workdir=$(mktemp -d)
tar xzf cockroach.src.tgz -C "$workdir"
(cd "$workdir"/cockroach-* && make install)
cockroach start --insecure --store type=mem,size=1GiB --background
cockroach sql --insecure <<EOF
CREATE DATABASE bank;
CREATE TABLE bank.accounts (id INT PRIMARY KEY, balance DECIMAL);
INSERT INTO bank.accounts VALUES (1, 1000.50);
EOF
diff -u - <(cockroach sql --insecure -e 'SELECT * FROM bank.accounts') <<EOF
1 row
id balance
1 1000.50
EOF
cockroach quit --insecure
|
<reponame>sintefneodroid/droid
var structdroid_1_1_runtime_1_1_messaging_1_1_f_b_s_1_1_f_string =
[
[ "__assign", "structdroid_1_1_runtime_1_1_messaging_1_1_f_b_s_1_1_f_string.html#a99ab3ef544a76f054fd79e74b542c7d9", null ],
[ "__init", "structdroid_1_1_runtime_1_1_messaging_1_1_f_b_s_1_1_f_string.html#ab294b3e28f63a4fcc8c0700f4472535d", null ],
[ "GetStrArray", "structdroid_1_1_runtime_1_1_messaging_1_1_f_b_s_1_1_f_string.html#a717845766db17ab38a03ef9a92c20858", null ],
[ "GetStrBytes", "structdroid_1_1_runtime_1_1_messaging_1_1_f_b_s_1_1_f_string.html#a309f4428634a87b748425368c282bf89", null ],
[ "ByteBuffer", "structdroid_1_1_runtime_1_1_messaging_1_1_f_b_s_1_1_f_string.html#adaf2c1d78be2a177f52c26b2f3737373", null ],
[ "Str", "structdroid_1_1_runtime_1_1_messaging_1_1_f_b_s_1_1_f_string.html#a479c33a01d54e2d2d34043bd5d983e19", null ]
]; |
# frozen_string_literal: true
module Api
module V3
# Provides the ability to attach and download an esdl file to/from a scenario.
class EsdlFilesController < BaseController
respond_to :json
before_action :ensure_upload_is_file, only: :update
before_action :ensure_reasonable_file_size, only: :update
before_action :set_current_scenario
# Sends data on the current attached esdl file for the scenario, or an empty object if none is
# set. When the parameter download is set, also sends the file.
#
# GET /api/v3/scenarios/:scenario_id/esdl_file
def show
render json: {} and return unless esdl_file
render json: EsdlFileSerializer.new(esdl_file, params[:download] == 'true').as_json
end
# Creates or updates an attached esdl file for a scenario.
#
# PUT /api/v3/scenarios/:scenario_id/esdl_file
def update
upload = params.require(:file)
handler = setup_handler(upload)
if handler.valid?
handler.call
render json: {}, status: 202
else
render json: { errors: handler.errors }, status: 422
end
end
private
def esdl_file
@esdl_file ||= @scenario.attachment('esdl_file')
end
def setup_handler(upload)
FileUploadHandler.new(
upload,
'esdl_file',
@scenario
)
end
# Asserts that the user uploaded a file, and not a string or other object.
def ensure_upload_is_file
return if params.require(:file).respond_to?(:tempfile)
render(
json: {
errors: ['"file" was not a valid multipart/form-data file'],
error_keys: [:not_multipart_form_data]
},
status: 422
)
end
def ensure_reasonable_file_size
return unless params.require(:file).size > 5.megabyte
render(
json: {
errors: ['ESDL file should not be larger than 5MB'],
error_keys: [:file_too_large]
},
status: 422
)
end
end
end
end
|
SELECT d.name as Department_Name, avg(s.salary) as Average_Salary
FROM department d
INNER JOIN staff s
ON s.department_id = d.id
GROUP BY d.name |
<reponame>carcoor/amaze-us
package ca.antaki.www.cat.producer.handler;
import java.util.List;
import ca.antaki.www.cat.producer.model.Cat;
public interface CatMoodHandler {
void handle(List<Cat> cats);
}
|
# frozen_string_literal: true
require "rubocop"
module RuboCop
module Cop
module GitHub
class RailsRenderObjectCollection < Cop
MSG = "Avoid `render object:`"
def_node_matcher :render_with_options?, <<-PATTERN
(send nil? {:render :render_to_string} (hash $...) ...)
PATTERN
def_node_matcher :partial_key?, <<-PATTERN
(pair (sym :partial) $_)
PATTERN
def_node_matcher :object_key?, <<-PATTERN
(pair (sym ${:object :collection :spacer_template}) $_)
PATTERN
def on_send(node)
if option_pairs = render_with_options?(node)
partial_pair = option_pairs.detect { |pair| partial_key?(pair) }
object_pair = option_pairs.detect { |pair| object_key?(pair) }
if partial_pair && object_pair
partial_name = partial_key?(partial_pair)
object_sym, object_node = object_key?(object_pair)
case object_sym
when :object
if partial_name.children[0].is_a?(String)
suggestion = ", instead `render partial: #{partial_name.source}, locals: { #{File.basename(partial_name.children[0], '.html.erb')}: #{object_node.source} }`"
end
add_offense(node, location: :expression, message: "Avoid `render object:`#{suggestion}")
when :collection, :spacer_template
add_offense(node, location: :expression, message: "Avoid `render collection:`")
end
end
end
end
end
end
end
end
|
//
// Ryu
//
// Copyright (C) 2017 <NAME>
// All Rights Reserved.
//
// See the LICENSE file for details about the license covering
// this source code file.
//
#include "assembly_listing.h"
namespace ryu::core {
assembly_listing::assembly_listing() {
using format_options = core::data_table_column_t::format_options;
_table.line_spacing = 0;
_table.headers.push_back({
"Line",
4,
4,
alignment::horizontal::left,
1,
format_options::none
});
_table.headers.push_back({
"Addr",
8,
8,
alignment::horizontal::left,
1,
format_options::none
});
_table.headers.push_back({
"Opcodes/Data",
25,
25,
alignment::horizontal::left,
1,
format_options::none
});
_table.headers.push_back({
"Flags",
5,
5,
alignment::horizontal::left,
1,
format_options::none
});
_table.headers.push_back({
"Source",
75,
75,
alignment::horizontal::left,
1,
format_options::style_codes
});
_table.footers.push_back({"Line Count", 15, 20});
}
void assembly_listing::reset() {
while (!_scopes.empty())
_scopes.pop();
_table.rows.clear();
_current_line = 1;
_annotated_line_count = 0;
}
void assembly_listing::finalize() {
_table.rows.push_back({
{fmt::format("{} lines assembled", _annotated_line_count)}
});
}
void assembly_listing::end_assembly_scope() {
auto scope = current_scope();
for (; scope->line_number < scope->input.source_lines.size(); scope->line_number++) {
auto rows = format_rows(
scope->line_number,
0,
{},
assembly_listing::row_flags::none);
for (const auto& row : rows)
_table.rows.push_back(row);
}
if (!_scopes.empty())
_scopes.pop();
}
void assembly_listing::annotate_line(
uint32_t line_number,
uint32_t address,
const byte_list& opcodes,
assembly_listing::row_flags_t flags) {
auto scope = current_scope();
for (; scope->line_number < line_number; scope->line_number++) {
auto rows = format_rows(
scope->line_number,
0,
{},
assembly_listing::row_flags::none);
for (const auto& row : rows)
_table.rows.push_back(row);
}
auto rows = format_rows(
scope->line_number++,
address,
opcodes,
flags);
for (const auto& row : rows)
_table.rows.push_back(row);
_annotated_line_count += rows.size();
}
void assembly_listing::annotate_line_error(
uint32_t line_number,
const std::string& error) {
annotate_line(
line_number,
0,
{},
assembly_listing::row_flags::error);
core::data_table_row_t row {};
row.columns.push_back(fmt::format("{:04d}", line_number));
row.columns.emplace_back(std::string(8, ' '));
row.columns.emplace_back(std::string(25, ' '));
std::string flag_chars(5, ' ');
if (_scopes.size() > 1)
flag_chars[1] = 'i';
flag_chars[3] = 'e';
row.columns.emplace_back(flag_chars);
row.columns.emplace_back(fmt::format("<red>^ {}<>", error));
if (line_number < _table.rows.size() - 1) {
_table.rows.insert(
_table.rows.begin() + (line_number - 1),
row);
} else {
_table.rows.push_back(row);
}
}
std::vector<data_table_row_t> assembly_listing::format_rows(
uint32_t line_number,
uint32_t address,
const byte_list& opcodes,
assembly_listing::row_flags_t flags) {
std::vector<data_table_row_t> rows {};
core::data_table_row_t row {};
row.columns.push_back(fmt::format("{:04d}", _current_line++));
if ((flags & row_flags::address) == 0) {
row.columns.emplace_back(8, ' ');
} else {
row.columns.push_back(fmt::format("{:08x}", address));
}
if (opcodes.empty()) {
row.columns.emplace_back(25, ' ');
}
else {
std::stringstream stream;
auto data_count = std::min<size_t>(opcodes.size(), 8);
for (size_t i = 0; i < data_count; i++) {
stream << fmt::format("{:02x} ", opcodes[i]);
}
row.columns.push_back(stream.str());
}
std::string flag_chars(5, ' ');
if ((flags & row_flags::binary) != 0)
flag_chars[0] = 'b';
if ((flags & row_flags::include) != 0 || _scopes.size() > 1)
flag_chars[1] = 'i';
if ((flags & row_flags::macro) != 0)
flag_chars[2] = 'm';
if ((flags & row_flags::error) != 0)
flag_chars[3] = 'e';
row.columns.push_back(flag_chars);
auto scope = current_scope();
if (line_number < scope->input.source_lines.size())
row.columns.push_back(scope->input.source_lines[line_number - 1]);
else
row.columns.emplace_back(75, ' ');
rows.push_back(row);
auto create_overflow_row = [&](auto addr, auto data) -> data_table_row_t {
data_table_row_t overflow_row {};
overflow_row.columns.emplace_back(4, ' ');
overflow_row.columns.push_back(fmt::format("{:08x}", addr));
overflow_row.columns.emplace_back(data);
std::string overflow_flags(5, ' ');
if ((flags & row_flags::binary) != 0)
overflow_flags[0] = 'b';
if (_scopes.size() > 1)
overflow_flags[1] = 'i';
overflow_flags[4] = 'c';
overflow_row.columns.emplace_back(overflow_flags);
overflow_row.columns.emplace_back(75, ' ');
return overflow_row;
};
size_t index = 8;
std::stringstream stream;
address += 8;
while (index < opcodes.size()) {
stream << fmt::format("{:02x} ", opcodes[index]);
++index;
if (index % 8 == 0) {
rows.push_back(create_overflow_row(address, stream.str()));
stream.str(std::string());
address += 8;
}
}
auto stream_str = stream.str();
if (!stream_str.empty()) {
rows.push_back(create_overflow_row(address, stream.str()));
}
return rows;
}
core::data_table_t& assembly_listing::table() {
return _table;
}
assembly_listing_scope_t* assembly_listing::current_scope() {
if (_scopes.empty())
return nullptr;
return &_scopes.top();
}
void assembly_listing::begin_assembly_scope(const parser_input_t& source) {
assembly_listing_scope_t scope {1, source};
_scopes.push(scope);
}
} |
import { combineReducers } from 'redux';
import * as NS from '../../namespace';
import dataReducer from './data';
import editReducer from './edit';
import communicationsReducer from './communications';
import { ReducersMap } from 'shared/types/redux';
export default combineReducers<NS.IReduxState>({
data: dataReducer,
edit: editReducer,
communications: communicationsReducer,
} as ReducersMap<NS.IReduxState>);
|
<reponame>shiplu/sortlog
from distutils.core import setup
name = "sortlog"
setup(
name=name,
packages=[name],
version="1.0.0",
license="MIT",
description="Command Line tool to sort log files based on time",
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/shiplu/%s" % name,
entry_points={"console_scripts": ["sortlog=sortlog.cli:main"]},
keywords=["log", "sort", "merge"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Software Development :: Debuggers",
"Topic :: System :: Logging",
"Topic :: Utilities",
],
)
|
#!/usr/bin/env bash
src="pagerank-levelwise-adjust-tolerance-function"
out="/home/resources/Documents/subhajit/$src.log"
ulimit -s unlimited
printf "" > "$out"
# Download program
rm -rf $src
git clone https://github.com/puzzlef/$src
cd $src
# Run
g++ -O3 main.cxx
stdbuf --output=L ./a.out ~/data/min-1DeadEnd.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/min-2SCC.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/min-4SCC.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/min-NvgraphEx.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/web-Stanford.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/web-BerkStan.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/web-Google.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/web-NotreDame.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/soc-Slashdot0811.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/soc-Slashdot0902.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/soc-Epinions1.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/coAuthorsDBLP.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/coAuthorsCiteseer.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/soc-LiveJournal1.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/coPapersCiteseer.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/coPapersDBLP.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/indochina-2004.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/italy_osm.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/great-britain_osm.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/germany_osm.mtx 2>&1 | tee -a "$out"
stdbuf --output=L ./a.out ~/data/asia_osm.mtx 2>&1 | tee -a "$out"
|
<reponame>bozhyk2/web-food-mvc
package fr.iv.testdb;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class TestDbServlet.
* Class TestDbServlet validates the connection
* to a database web_calorie_tracker_ui with method toGet.
*/
@WebServlet("/TestDbServlet")
public class TestDbServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// connection url
String jdbcUrl = "jdbc:mysql://localhost:3306/web_calorie_tracker_ui?useSSL=false&serverTimezone=UTC";
// connection user name
String user = "healthybody";
// connection password
String password = "<PASSWORD>";
//connection driver
String driver = "com.mysql.cj.jdbc.Driver";
// connection object
Connection connection = null;
//Output stream object. It will write text response in browser for client.
try (PrintWriter out = response.getWriter()) {
Class.forName(driver);
//Create connection to the database
connection = DriverManager.getConnection(jdbcUrl, user, password);
out.println("Connection to database: " + jdbcUrl + " ... ");
out.println("success");
} catch (ClassNotFoundException e) {
e.getMessage();
} catch (SQLException e) {
e.getMessage();
} finally {
if (connection != null) {
try {
//close connection
connection.close();
} catch (SQLException e) {
e.getMessage();
}
}
}
}
}
|
/**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.company.warlock.core.beetl;
import com.company.warlock.core.util.KaptchaUtil;
import cn.stylefeng.roses.core.util.ToolUtil;
import com.company.warlock.core.common.constant.Const;
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* beetl拓展配置,绑定一些工具类,方便在模板中直接调用
*
* @author stylefeng
* @Date 2018/2/22 21:03
*/
public class BeetlConfiguration extends BeetlGroupUtilConfiguration {
@Override
public void initOther() {
//全局共享变量
Map<String, Object> shared = new HashMap<>();
shared.put("systemName", Const.DEFAULT_SYSTEM_NAME);
shared.put("welcomeTip", Const.DEFAULT_WELCOME_TIP);
groupTemplate.setSharedVars(shared);
//全局共享方法
groupTemplate.registerFunctionPackage("shiro", new ShiroExt());
groupTemplate.registerFunctionPackage("tool", new ToolUtil());
groupTemplate.registerFunctionPackage("kaptcha", new KaptchaUtil());
}
}
|
#!/bin/bash
# Copyright 2015 The Android Open Source Project
# Copyright (C) 2015 Valve Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd $dir
rm -rf generated
mkdir -p generated/include generated/common
LVL_SCRIPTS=../../../submodules/Vulkan-LoaderAndValidationLayers/scripts
VS_SCRIPTS=../../../scripts
REGISTRY=../../../submodules/Vulkan-LoaderAndValidationLayers/scripts/vk.xml
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_safe_struct.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_safe_struct.cpp )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_struct_size_helper.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_struct_size_helper.c )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_enum_string_helper.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_object_types.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_dispatch_table_helper.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} thread_check.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} parameter_validation.cpp )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} unique_objects_wrappers.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_loader_extensions.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_loader_extensions.c )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_layer_dispatch_table.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_extension_helper.h )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} object_tracker.cpp )
( cd generated/include; python3 ${LVL_SCRIPTS}/lvl_genvk.py -registry ${REGISTRY} vk_typemap_helper.h )
SPIRV_TOOLS_PATH=../../third_party/shaderc/third_party/spirv-tools
SPIRV_TOOLS_UUID=spirv_tools_uuid.txt
set -e
( cd generated/include;
if [[ -d $SPIRV_TOOLS_PATH ]]; then
echo Found spirv-tools, using git_dir for external_revision_generator.py
python3 ${LVL_SCRIPTS}/external_revision_generator.py \
--git_dir $SPIRV_TOOLS_PATH \
-s SPIRV_TOOLS_COMMIT_ID \
-o spirv_tools_commit_id.h
else
echo No spirv-tools git_dir found, generating UUID for external_revision_generator.py
# Ensure uuidgen is installed, this should error if not found
uuidgen --v
uuidgen > $SPIRV_TOOLS_UUID;
cat $SPIRV_TOOLS_UUID;
python3 ${LVL_SCRIPTS}/external_revision_generator.py \
--rev_file $SPIRV_TOOLS_UUID \
-s SPIRV_TOOLS_COMMIT_ID \
-o spirv_tools_commit_id.h
fi
)
exit 0
|
/*
* Copyright (c) 2007, Novell Inc.
*
* This program is licensed under the BSD license, read LICENSE.BSD
* for further information
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "pool.h"
#include "repo.h"
#include "repo_rpmmd.h"
#ifdef SUSE
#include "repo_autopattern.h"
#endif
#include "common_write.h"
#include "solv_xfopen.h"
static void
usage(int status)
{
fprintf(stderr, "\nUsage:\n"
"rpmmd2solv [-a][-h][-n <attrname>][-l <locale>]\n"
" reads 'primary' from a 'rpmmd' repository from <stdin> and writes a .solv file to <stdout>\n"
" -h : print help & exit\n"
" -n <name>: save attributes as <name>.attr\n"
" -l <locale>: parse localization data for <locale>\n"
);
exit(status);
}
int
main(int argc, char **argv)
{
int c, flags = 0;
const char *attrname = 0;
const char *basefile = 0;
const char *dir = 0;
const char *locale = 0;
#ifdef SUSE
int add_auto = 0;
#endif
Pool *pool = pool_create();
Repo *repo = repo_create(pool, "<stdin>");
while ((c = getopt (argc, argv, "hn:b:d:l:X")) >= 0)
{
switch(c)
{
case 'h':
usage(0);
break;
case 'n':
attrname = optarg;
break;
case 'b':
basefile = optarg;
break;
case 'd':
dir = optarg;
break;
case 'l':
locale = optarg;
break;
case 'X':
#ifdef SUSE
add_auto = 1;
#endif
break;
default:
usage(1);
break;
}
}
if (dir)
{
FILE *fp;
int l;
char *fnp;
l = strlen(dir) + 128;
fnp = solv_malloc(l+1);
snprintf(fnp, l, "%s/primary.xml.gz", dir);
if (!(fp = solv_xfopen(fnp, 0)))
{
perror(fnp);
exit(1);
}
if (repo_add_rpmmd(repo, fp, 0, flags))
{
fprintf(stderr, "rpmmd2solv: %s: %s\n", fnp, pool_errstr(pool));
exit(1);
}
fclose(fp);
snprintf(fnp, l, "%s/diskusagedata.xml.gz", dir);
if ((fp = solv_xfopen(fnp, 0)))
{
if (repo_add_rpmmd(repo, fp, 0, flags))
{
fprintf(stderr, "rpmmd2solv: %s: %s\n", fnp, pool_errstr(pool));
exit(1);
}
fclose(fp);
}
if (locale)
{
if (snprintf(fnp, l, "%s/translation-%s.xml.gz", dir, locale) >= l)
{
fprintf(stderr, "-l parameter too long\n");
exit(1);
}
while (!(fp = solv_xfopen(fnp, 0)))
{
fprintf(stderr, "not opened %s\n", fnp);
if (strlen(locale) > 2)
{
if (snprintf(fnp, l, "%s/translation-%.2s.xml.gz", dir, locale) >= l)
{
fprintf(stderr, "-l parameter too long\n");
exit(1);
}
if ((fp = solv_xfopen(fnp, 0)))
break;
}
perror(fnp);
exit(1);
}
fprintf(stderr, "opened %s\n", fnp);
if (repo_add_rpmmd(repo, fp, 0, flags))
{
fprintf(stderr, "rpmmd2solv: %s: %s\n", fnp, pool_errstr(pool));
exit(1);
}
fclose(fp);
}
solv_free(fnp);
}
else
{
if (repo_add_rpmmd(repo, stdin, 0, flags))
{
fprintf(stderr, "rpmmd2solv: %s\n", pool_errstr(pool));
exit(1);
}
}
#ifdef SUSE
if (add_auto)
repo_add_autopattern(repo, 0);
#endif
tool_write(repo, basefile, attrname);
pool_free(pool);
exit(0);
}
|
package core.checker.vo;
import lombok.Data;
import java.nio.file.Path;
@Data
public class Plot {
Path output;
int[] size;
String title;
String xLabel;
String yLabel;
Object chart;
String logScale;
boolean line;
}
|
<filename>11 new lesson STRING/11.3.py
#
string = '<NAME>'
check = string.split()
count = string.count(' ')
print(check)
print(count+1) |
public class LongestIncreasingSubsequence {
public static void printLIS(int[] arr) {
// array to store the lengths of the longest increasing subsequences
int [] lengths = new int[arr.length];
int[] res = new int[arr.length];
// initialize the lengths with 1
for (int i = 0; i < lengths.length; i++) {
lengths[i] = 1;
}
// traverse through the array to find the longest increasing subsequence
for (int i = 1; i < arr.length; i++) {
for (int j = 0; j < i; j++) {
if (arr[j]<arr[i] && lengths[i] < lengths[j] + 1) {
lengths[i] = lengths[j] + 1;
res[i] = j;
}
}
}
// find the index of the longest increasing subsequence
int maxIndex = 0;
for (int i = 0; i < lengths.length; i++) {
if (lengths[i] > lengths[maxIndex]) {
maxIndex = i;
}
}
// print the longest increasing subsequence
int k = maxIndex;
while (k >= 0) {
System.out.print(arr[k] + ", ");
k = res[k];
}
}
} |
<gh_stars>1-10
import { connect } from 'react-redux';
import { isPreviewing } from '../reducers/live';
import * as actions from '../actions/live';
import PreviewButton from '../components/PreviewButton';
const mapStateToProps = state => ({
isPreviewing: isPreviewing(state),
});
const PreviewControl = connect(
mapStateToProps,
actions
)(PreviewButton);
export default PreviewControl;
|
fn sum_numbers(x: u32, y: u32) -> u32 {
x + y
}
fn main() {
let x = 5;
let y = 10;
println!("The sum of {} and {} is {}", x, y, sum_numbers(x, y));
} |
<filename>index.ios.js<gh_stars>0
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import { AppRegistry } from 'react-native'
import App from './app/main'
AppRegistry.registerComponent('comicRN', () => App)
|
#!/bin/bash
CHECK=$(mount | grep /media/vmusb | cut -d ' ' -f 4)
if [ "$CHECK" != "type" ]
then
USBDRIVE=$(mount | grep /run/media | cut -d ' ' -f 1)
FS=$(mount | grep $USBDRIVE | cut -d ' ' -f 5)
if [[ $FS == 'ext2' || $FS == 'ext3' || $FS == 'ext4' || $FS == 'xfs' ]]
then
if [ -e /media/vmusb/ ]
then
umount $USBDRIVE && mount $USBDRIVE /media/vmusb
else
mkdir /media/vmusb && umount $USBDRIVE && mount $USBDRIVE /media/vmusb
fi
else
echo !!!!!"change USB FS type to xfs-ext4-ext3-ext2-other for >4G archives"!!!!!
fi
fi
CHECK2=$(mount | grep /media/vmusb | cut -d ' ' -f 2)
if [ "$CHECK2" == "on" ]
then
COUNTER=3
until [ $COUNTER -lt 3 ] ; do
eval COLUMN=$COUNTER
VMNAME=$(virsh list --all | awk '{print $2}' | sed -n "${COLUMN}p")
VMSTAT=$(virsh list --all | awk '{print $3}' | sed -n "${COLUMN}p")
LVM=$(virsh domblklist $VMNAME | grep vda | cut -d ' ' -f 9)
LVMNAME=$(virsh domblklist $VMNAME | grep vda | cut -d ' ' -f 9 | cut -d '/' -f 4)
LVMSIZE=$(lvdisplay $LVM | grep 'LV Size' | cut -d ' ' -f 20 | cut -d '.' -f 1)
LVMSIZEB=$(virsh domblkinfo $VMNAME $LVM | grep Capacity | cut -d ' ' -f 8)
if [ "$VMSTAT" == "shut" ]
then
if [ -e /media/vmusb/$VMNAME.bz2 ]
then
echo VMNAME "$VMNAME", LVM "$LVM", LVMSIZEB "$LVMSIZEB" > /media/vmusb/"$VMNAME"_$(date +%y%m%d).info
virsh dumpxml $VMNAME > /media/vmusb/"$VMNAME"_xmldump_$(date +%y%m%d).xml ; ls /media/vmusb
else
SNAPSIZE=$(( $LVMSIZE * 32 ))
lvcreate -s -n "$LVMNAME"_snap -L"$SNAPSIZE"M "$LVM" & echo !!!!!!!COPYING DATA PLEASE WAIT!!!!!!! && wait &&
dd if="$LVM"_snap bs=128M conv=notrunc,noerror | bzip2 -ck -3 > /media/vmusb/"$VMNAME".bz2 && wait &&
lvremove -f "$LVM"_snap
echo VMNAME "$VMNAME", LVM "$LVM", LVMSIZEB "$LVMSIZEB" > /media/vmusb/"$VMNAME"_$(date +%y%m%d).info
virsh dumpxml $VMNAME > /media/vmusb/"$VMNAME"_xmldump_$(date +%y%m%d).xml ; ls /media/vmusb
fi
elif [ "$VMSTAT" == "running" ]
then
if [ -e /media/vmusb/$VMNAME.bz2 ]
then
virsh save "$VMNAME" /media/vmusb/"$VMNAME"_$(date +%y%m%d).vmstate --running &&
virsh restore /media/vmusb/"$VMNAME"_$(date +%y%m%d).vmstate
echo VMNAME "$VMNAME", LVM "$LVM", LVMSIZEB "$LVMSIZEB" > /media/vmusb/"$VMNAME"_$(date +%y%m%d).info
virsh dumpxml $VMNAME > /media/vmusb/"$VMNAME"_xmldump_$(date +%y%m%d).xml ; ls /media/vmusb
else
SNAPSIZE=$(( $LVMSIZE * 32 ))
virsh save "$VMNAME" /media/vmusb/"$VMNAME"_$(date +%y%m%d).vmstate --running &&
lvcreate -s -n "$LVMNAME"_snap -L"$SNAPSIZE"M "$LVM" &&
virsh restore /media/vmusb/"$VMNAME"_$(date +%y%m%d).vmstate &
echo !!!!!!!COPYING DATA PLEASE WAIT!!!!!!! && wait &&
dd if="$LVM"_snap bs=128M conv=notrunc,noerror | bzip2 -ck -3 > /media/vmusb/"$VMNAME".bz2 && wait &&
lvremove -f "$LVM"_snap
echo VMNAME "$VMNAME", LVM "$LVM", LVMSIZEB "$LVMSIZEB" > /media/vmusb/"$VMNAME"_$(date +%y%m%d).info
virsh dumpxml $VMNAME > /media/vmusb/"$VMNAME"_xmldump_$(date +%y%m%d).xml ; ls /media/vmusb
fi
else
break
fi
let COUNTER+=1
done
fi
|
import io.cryptolens.internal.*;
import io.cryptolens.methods.*;
import io.cryptolens.models.*;
public class Main {
public static void main(String[] args) {
// note, if we ran Key Verification earlier, we can can set Key=license.KeyString
String auth = "<KEY>";
ListOfDataObjectsResult listResult = Data.ListDataObjects(auth, new ListDataObjectsToKeyModel(3941, "<KEY>", "usagecount"));
if (!Helpers.IsSuccessful(listResult)) {
System.out.println("Could not list the data objects.");
}
if (listResult.DataObjects == null) {
BasicResult addResult = Data.AddDataObject(auth,
new AddDataObjectToKeyModel(
3941,
"<KEY>",
"usagecount",
0,
""));
if (!Helpers.IsSuccessful(addResult)) {
System.out.println("Could not add a new data object. Maybe the limit was reached?");
}
} else {
// if you set enableBound=true and bound=50 (as an example)
// it won't be possible to increase to a value greater than 50.
BasicResult incrementResult = Data.IncrementIntValue(auth,
new IncrementIntValueToKeyModel(
3941,
"<KEY>",
listResult.DataObjects.get(0).Id,
1,
false,
0));
if(!Helpers.IsSuccessful(incrementResult)) {
System.out.println("Could not increment the data object");
}
}
}
public static void main2() {
String auth = "<KEY>";
ListOfDataObjectsResult listResult = Data.ListDataObjects(auth, new ListDataObjectsToKeyModel(3941, "<KEY>", "usagecount"));
if (!Helpers.IsSuccessful(listResult)) {
System.out.println("Could not list the data objects.");
}
BasicResult decrementResult = Data.DecrementIntValue(auth,
new DecrementIntValueToKeyModel(
3941,
"<KEY>",
listResult.DataObjects.get(0).Id,
1,
true,
0));
if(!Helpers.IsSuccessful(decrementResult)) {
System.out.println("Could not decrement the data object");
}
}
}
}
|
<form action="#" method="POST">
<label for="length">Length: </label>
<input type="text" name="length" id="length" />
<label for="breadth">Breadth: </label>
<input type="text" name="breadth" id="breadth" />
<label for="height">Height: </label>
<input type="text" name="height" id="height" />
<input type="submit" value="Calculate" />
</form> |
<reponame>learnforpractice/micropython-cpp<filename>tests/basics/python34.py
# tests that differ when running under Python 3.4 vs 3.5/3.6
# from basics/fun_kwvarargs.py
# test evaluation order of arguments (in 3.4 it's backwards, 3.5 it's fixed)
def f4(*vargs, **kwargs):
print(vargs, kwargs)
def print_ret(x):
print(x)
return x
f4(*print_ret(['a', 'b']), kw_arg=print_ret(None))
# test evaluation order of dictionary key/value pair (in 3.4 it's backwards)
{print_ret(1):print_ret(2)}
# from basics/syntaxerror.py
def test_syntax(code):
try:
exec(code)
except SyntaxError:
print("SyntaxError")
test_syntax("f(*a, *b)") # can't have multiple * (in 3.5 we can)
test_syntax("f(**a, **b)") # can't have multiple ** (in 3.5 we can)
test_syntax("f(*a, b)") # can't have positional after *
test_syntax("f(**a, b)") # can't have positional after **
test_syntax("() = []") # can't assign to empty tuple (in 3.6 we can)
test_syntax("del ()") # can't delete empty tuple (in 3.6 we can)
# from basics/sys1.py
# uPy prints version 3.4
import sys
print(sys.version[:3])
print(sys.version_info[0], sys.version_info[1])
|
function extractNavigationInfo(navigationItems) {
const uniqueIds = Array.from(new Set(navigationItems.map(item => item.id)));
const uniqueTexts = Array.from(new Set(navigationItems.map(item => item.text)));
const links = navigationItems.filter(item => item.type === 'link').map(({ id, href }) => ({ id, href }));
return { uniqueIds, uniqueTexts, links };
} |
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[4],{
/***/ "./node_modules/react-portal/es/LegacyPortal.js":
/*!******************************************************!*\
!*** ./node_modules/react-portal/es/LegacyPortal.js ***!
\******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
// This file is a fallback for a consumer who is not yet on React 16
// as createPortal was introduced in React 16
var Portal = function (_React$Component) {
_inherits(Portal, _React$Component);
function Portal() {
_classCallCheck(this, Portal);
return _possibleConstructorReturn(this, (Portal.__proto__ || Object.getPrototypeOf(Portal)).apply(this, arguments));
}
_createClass(Portal, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.renderPortal();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(props) {
this.renderPortal();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.unmountComponentAtNode(this.defaultNode || this.props.node);
if (this.defaultNode) {
document.body.removeChild(this.defaultNode);
}
this.defaultNode = null;
this.portal = null;
}
}, {
key: 'renderPortal',
value: function renderPortal(props) {
if (!this.props.node && !this.defaultNode) {
this.defaultNode = document.createElement('div');
document.body.appendChild(this.defaultNode);
}
var children = this.props.children;
// https://gist.github.com/jimfb/d99e0678e9da715ccf6454961ef04d1b
if (typeof this.props.children.type === 'function') {
children = react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(this.props.children);
}
this.portal = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.unstable_renderSubtreeIntoContainer(this, children, this.props.node || this.defaultNode);
}
}, {
key: 'render',
value: function render() {
return null;
}
}]);
return Portal;
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
/* harmony default export */ __webpack_exports__["default"] = (Portal);
Portal.propTypes = {
children: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.node.isRequired,
node: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.any
};
/***/ }),
/***/ "./node_modules/react-portal/es/Portal.js":
/*!************************************************!*\
!*** ./node_modules/react-portal/es/Portal.js ***!
\************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./node_modules/react-portal/es/utils.js");
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Portal = function (_React$Component) {
_inherits(Portal, _React$Component);
function Portal() {
_classCallCheck(this, Portal);
return _possibleConstructorReturn(this, (Portal.__proto__ || Object.getPrototypeOf(Portal)).apply(this, arguments));
}
_createClass(Portal, [{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
if (this.defaultNode) {
document.body.removeChild(this.defaultNode);
}
this.defaultNode = null;
}
}, {
key: 'render',
value: function render() {
if (!_utils__WEBPACK_IMPORTED_MODULE_3__["canUseDOM"]) {
return null;
}
if (!this.props.node && !this.defaultNode) {
this.defaultNode = document.createElement('div');
document.body.appendChild(this.defaultNode);
}
return react_dom__WEBPACK_IMPORTED_MODULE_2___default.a.createPortal(this.props.children, this.props.node || this.defaultNode);
}
}]);
return Portal;
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
Portal.propTypes = {
children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.node.isRequired,
node: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.any
};
/* harmony default export */ __webpack_exports__["default"] = (Portal);
/***/ }),
/***/ "./node_modules/react-portal/es/PortalCompat.js":
/*!******************************************************!*\
!*** ./node_modules/react-portal/es/PortalCompat.js ***!
\******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js");
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _Portal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Portal */ "./node_modules/react-portal/es/Portal.js");
/* harmony import */ var _LegacyPortal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LegacyPortal */ "./node_modules/react-portal/es/LegacyPortal.js");
var Portal = void 0;
if (react_dom__WEBPACK_IMPORTED_MODULE_0___default.a.createPortal) {
Portal = _Portal__WEBPACK_IMPORTED_MODULE_1__["default"];
} else {
Portal = _LegacyPortal__WEBPACK_IMPORTED_MODULE_2__["default"];
}
/* harmony default export */ __webpack_exports__["default"] = (Portal);
/***/ }),
/***/ "./node_modules/react-portal/es/PortalWithState.js":
/*!*********************************************************!*\
!*** ./node_modules/react-portal/es/PortalWithState.js ***!
\*********************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _PortalCompat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PortalCompat */ "./node_modules/react-portal/es/PortalCompat.js");
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var KEYCODES = {
ESCAPE: 27
};
var PortalWithState = function (_React$Component) {
_inherits(PortalWithState, _React$Component);
function PortalWithState(props) {
_classCallCheck(this, PortalWithState);
var _this = _possibleConstructorReturn(this, (PortalWithState.__proto__ || Object.getPrototypeOf(PortalWithState)).call(this, props));
_this.portalNode = null;
_this.state = { active: !!props.defaultOpen };
_this.openPortal = _this.openPortal.bind(_this);
_this.closePortal = _this.closePortal.bind(_this);
_this.wrapWithPortal = _this.wrapWithPortal.bind(_this);
_this.handleOutsideMouseClick = _this.handleOutsideMouseClick.bind(_this);
_this.handleKeydown = _this.handleKeydown.bind(_this);
return _this;
}
_createClass(PortalWithState, [{
key: 'componentDidMount',
value: function componentDidMount() {
if (this.props.closeOnEsc) {
document.addEventListener('keydown', this.handleKeydown);
}
if (this.props.closeOnOutsideClick) {
document.addEventListener('click', this.handleOutsideMouseClick);
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
if (this.props.closeOnEsc) {
document.removeEventListener('keydown', this.handleKeydown);
}
if (this.props.closeOnOutsideClick) {
document.removeEventListener('click', this.handleOutsideMouseClick);
}
}
}, {
key: 'openPortal',
value: function openPortal(e) {
if (this.state.active) {
return;
}
if (e && e.nativeEvent) {
e.nativeEvent.stopImmediatePropagation();
}
this.setState({ active: true }, this.props.onOpen);
}
}, {
key: 'closePortal',
value: function closePortal() {
if (!this.state.active) {
return;
}
this.setState({ active: false }, this.props.onClose);
}
}, {
key: 'wrapWithPortal',
value: function wrapWithPortal(children) {
var _this2 = this;
if (!this.state.active) {
return null;
}
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(
_PortalCompat__WEBPACK_IMPORTED_MODULE_2__["default"],
{
node: this.props.node,
key: 'react-portal',
ref: function ref(portalNode) {
return _this2.portalNode = portalNode;
}
},
children
);
}
}, {
key: 'handleOutsideMouseClick',
value: function handleOutsideMouseClick(e) {
if (!this.state.active) {
return;
}
var root = this.portalNode.props.node || this.portalNode.defaultNode;
if (!root || root.contains(e.target) || e.button && e.button !== 0) {
return;
}
this.closePortal();
}
}, {
key: 'handleKeydown',
value: function handleKeydown(e) {
if (e.keyCode === KEYCODES.ESCAPE && this.state.active) {
this.closePortal();
}
}
}, {
key: 'render',
value: function render() {
return this.props.children({
openPortal: this.openPortal,
closePortal: this.closePortal,
portal: this.wrapWithPortal,
isOpen: this.state.active
});
}
}]);
return PortalWithState;
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
PortalWithState.propTypes = {
children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func.isRequired,
defaultOpen: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
node: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.any,
openByClickOn: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.element,
closeOnEsc: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
closeOnOutsideClick: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
onOpen: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
onClose: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func
};
PortalWithState.defaultProps = {
onOpen: function onOpen() {},
onClose: function onClose() {}
};
/* harmony default export */ __webpack_exports__["default"] = (PortalWithState);
/***/ }),
/***/ "./node_modules/react-portal/es/index.js":
/*!***********************************************!*\
!*** ./node_modules/react-portal/es/index.js ***!
\***********************************************/
/*! exports provided: Portal, PortalWithState */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _PortalCompat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PortalCompat */ "./node_modules/react-portal/es/PortalCompat.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Portal", function() { return _PortalCompat__WEBPACK_IMPORTED_MODULE_0__["default"]; });
/* harmony import */ var _PortalWithState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PortalWithState */ "./node_modules/react-portal/es/PortalWithState.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PortalWithState", function() { return _PortalWithState__WEBPACK_IMPORTED_MODULE_1__["default"]; });
/***/ }),
/***/ "./node_modules/react-portal/es/utils.js":
/*!***********************************************!*\
!*** ./node_modules/react-portal/es/utils.js ***!
\***********************************************/
/*! exports provided: canUseDOM */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canUseDOM", function() { return canUseDOM; });
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/***/ })
}]); |
#!/usr/bin/env bash
SCRIPT_DIR=$(cd $(dirname $0); pwd -P)
CHART_DIR=$(cd "${SCRIPT_DIR}/../charts"; pwd -P)
NAMESPACE="$1"
VOLUME_CAPACITY="$2"
STORAGE_CLASS="$3"
if [[ -z "${TMP_DIR}" ]]; then
TMP_DIR=./tmp
fi
mkdir -p ${TMP_DIR}
YAML_OUTPUT=${TMP_DIR}/jenkins-config.yaml
echo "Creating jenkins-persistent instance"
oc new-app jenkins-ephemeral -n "${NAMESPACE}" \
-e VOLUME_CAPACITY="${VOLUME_CAPACITY}"
echo "Patching Jenkins deploymentconfig to increase timeout"
kubectl patch deploymentconfig/jenkins -n "${NAMESPACE}" --type=json -p='[{"op": "replace", "path": "/spec/strategy/recreateParams/timeoutSeconds", "value": 1200}]'
JENKINS_HOST=$(oc get route jenkins -n ${NAMESPACE} -o jsonpath='{ .spec.host }')
JENKINS_URL="https://${JENKINS_HOST}"
oc create secret generic jenkins-access -n ${NAMESPACE} --from-literal url=${JENKINS_URL}
helm template ${CHART_DIR}/jenkins-config \
--name "jenkins-config" \
--namespace "${NAMESPACE}" \
--set createJob=false \
--set jenkins.host=${JENKINS_HOST} \
--set jenkins.tls=true > ${YAML_OUTPUT}
kubectl apply --namespace ${NAMESPACE} -f ${YAML_OUTPUT}
echo "*** Waiting for Jenkins on ${JENKINS_URL}"
until curl --insecure -Isf "${JENKINS_URL}/login"; do
echo '>>> waiting for Jenkins'
sleep 300
done
echo '>>> Jenkins has started'
|
SELECT author_id, COUNT(*) AS num_articles
FROM articles
GROUP BY author_id
HAVING COUNT(*) >= 3; |
#!/usr/bin/env sh
set -ex
if [ -z "$1" ]; then
docker build --no-cache --pull -t gangefors/airdcpp-webclient:latest .
DOCKER_HOST=tcp://192.168.0.51:2376 docker build \
--no-cache --pull -t gangefors/arm32v7-airdcpp-webclient:latest \
--build-arg version=$1 --build-arg threads=1 --build-arg arch="arm32v7/" .
else
docker build --no-cache --pull -t gangefors/airdcpp-webclient:$1 --build-arg version=$1 .
docker tag gangefors/airdcpp-webclient:$1 gangefors/airdcpp-webclient:latest
DOCKER_HOST=tcp://192.168.0.51:2376 docker build \
--no-cache --pull -t gangefors/arm32v7-airdcpp-webclient:$1 \
--build-arg version=$1 --build-arg threads=1 --build-arg arch="arm32v7/" .
DOCKER_HOST=tcp://192.168.0.51:2376 docker tag \
gangefors/arm32v7-airdcpp-webclient:$1 gangefors/arm32v7-airdcpp-webclient:latest
fi
|
<reponame>andreapatri/cms_journal
//# sourceMappingURL=units-constants.js.map |
#!/bin/bash
echo "image parameter: " $1
echo "command parameter: " $2
# Image Name that should be build (options: dev r)
name=""
dir=""
case "$1" in
"dev") name="pinkgorillawb/notebook-dev"
dir="./notebook-dev"
;;
"r") name="pinkgorillawb/notebook-r"
dir="./notebook-r"
;;
esac
echo "docker image name: " $name
function build {
docker build \
$dir \
-t \
$name:latest
}
function rebuild {
docker build \
--no-cache \
$dir \
-t \
$name
}
function interactive {
docker run \
-p 3449:3449 \
--net "host" \
-t -i $name \
lein run -m clojure.main script/figwheel.clj
# /bin/bash
}
function start {
docker run \
-dit \
--restart unless-stopped \
-p 3449:3449 \
--net "host" \
$name
}
function shell {
image=`docker ps -f ancestor="$name" -q`
echo IMAGE is $image
echo now bashing into the running image..
docker exec -i -t $image /bin/bash
}
function push {
docker push $name
}
case "$2" in
build)
build
;;
rebuild)
rebuild
;;
interactive)
interactive
;;
start)
start
;;
shell)
shell
;;
push)
push
;;
*)
echo $"Usage: $0 {dev|r|spark|prod} {build|rebuild|interactive|start|shell|push}"
exit 1
esac
|
<reponame>kallsave/vue-router-cache
const hasOwnProperty = Object.prototype.hasOwnProperty
export function hasOwn(obj, key) {
return hasOwnProperty.call(obj, key)
}
const _toString = Object.prototype.toString
export function toRawType(value) {
return _toString.call(value).slice(8, -1)
}
export function deepClone(value) {
let ret
const type = toRawType(value)
if (type === 'Object') {
ret = {}
} else if (type === 'Array') {
ret = []
} else {
return value
}
Object.keys(value).forEach((key) => {
const copy = value[key]
ret[key] = deepClone(copy)
})
return ret
}
export function deepAssign(origin, mixin) {
for (const key in mixin) {
if (!origin[key] || typeof origin[key] !== 'object') {
origin[key] = mixin[key]
} else {
deepAssign(origin[key], mixin[key])
}
}
}
export function multiDeepClone(target, ...rest) {
for (let i = 0; i < rest.length; i++) {
const clone = deepClone(rest[i])
deepAssign(target, clone)
}
return target
}
export function camelize(str) {
str = String(str)
return str.replace(/-(\w)/g, function (m, c) {
return c ? c.toUpperCase() : ''
})
}
export function pxToNum(str) {
str = str + ''
return Number(str.replace(/px/g, ''))
}
export function padPx(num) {
return `${num}px`
}
export function styleTogglePx(style, mode = true) {
const list = [
'width',
'height',
'line-height',
'font-size',
'left',
'right',
'top',
'bottom',
'margin-left',
'margin-right',
'margin-top',
'margin-bottom',
'padding-left',
'padding-right',
'padding-top',
'padding-bottom',
]
const map = {}
for (const key in style) {
if (list.indexOf(key) !== -1) {
if (mode && !isNaN(style[key] - 0)) {
map[key] = padPx(style[key])
} else if (!mode) {
map[key] = pxToNum(style[key])
}
}
}
return multiDeepClone(style, map)
}
export function stylePadPx(style) {
return styleTogglePx(style, true)
}
export function styleRemovePx(style) {
return styleTogglePx(style, false)
}
export function assignArray() {
const arr = [].concat.apply([], arguments)
const ret = []
for (let i = 0, len = arr.length; i < len; i++) {
if (ret.indexOf(arr[i]) !== -1) {
ret.push(arr[i])
}
}
return ret
}
export function spliceArray() {
const arr = arguments[0]
const spliceList = [].concat.apply([], [].slice.call(arguments, 1))
return arr.filter((item) => {
return spliceList.indexOf(item) === -1
})
}
const DEFAULT_TIME_SLICE = 400
export class Debounce {
constructor(timeSlice = DEFAULT_TIME_SLICE) {
this.timeSlice = timeSlice
}
run(func) {
if (typeof func === 'function') {
if (this.timer) {
window.clearTimeout(this.timer)
}
this.timer = window.setTimeout(func, this.timeSlice)
}
}
destroy() {
window.clearTimeout(this.timer)
this.timer = null
this.timeSlice = null
}
}
export class Throttle {
constructor(timeSlice = DEFAULT_TIME_SLICE) {
this.timeSlice = timeSlice
}
run(func, overload) {
const currentTime = new Date().getTime()
if (!this.lastTime || currentTime - this.lastTime > this.timeSlice) {
this.lastTime = currentTime
if (typeof func === 'function') {
func()
}
} else {
if (typeof overload === 'function') {
overload()
}
}
}
destroy() {
this.timeSlice = null
this.lastTime = null
}
}
|
import { async, TestBed } from '@angular/core/testing';
import { Router } from '@angular/router';
import { Subject } from 'rxjs/Subject';
import { AppModule } from '../app.module';
import { LoginComponent } from './login.component';
import { UserService } from '../user.service';
describe('LoginComponent', () => {
const fakeRouter = jasmine.createSpyObj('Router', ['navigate']);
const fakeUserService = jasmine.createSpyObj('UserService', ['authenticate']);
beforeEach(() => TestBed.configureTestingModule({
imports: [AppModule],
providers: [
{ provide: UserService, useValue: fakeUserService },
{ provide: Router, useValue: fakeRouter }
]
}));
beforeEach(() => {
fakeRouter.navigate.calls.reset();
fakeUserService.authenticate.calls.reset();
});
it('should have a credentials field', () => {
const fixture = TestBed.createComponent(LoginComponent);
// when we trigger the change detection
fixture.detectChanges();
// then we should have a field credentials
const componentInstance = fixture.componentInstance;
expect(componentInstance.credentials)
.not.toBeNull('Your component should have a field `credentials` initialized with an object');
expect(componentInstance.credentials.login)
.toBe('', 'The `login` field of `credentials` should be initialized with an empty string');
expect(componentInstance.credentials.password)
.toBe('', 'The `password` field of `credentials` should be initialized with an empty string');
});
it('should have a title', () => {
const fixture = TestBed.createComponent(LoginComponent);
// when we trigger the change detection
fixture.detectChanges();
// then we should have a title
const element = fixture.nativeElement;
expect(element.querySelector('h1')).not.toBeNull('The template should have a `h1` tag');
expect(element.querySelector('h1').textContent).toContain('Log in', 'The title should be `Log in`');
});
it('should have a disabled button if the form is incomplete', async(() => {
const fixture = TestBed.createComponent(LoginComponent);
// when we trigger the change detection
fixture.detectChanges();
// then we should have a disabled button
const element = fixture.nativeElement;
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('button')).not.toBeNull('The template should have a button');
expect(element.querySelector('button').hasAttribute('disabled')).toBe(true, 'The button should be disabled if the form is invalid');
});
}));
it('should be possible to log in if the form is complete', async(() => {
const fixture = TestBed.createComponent(LoginComponent);
fixture.detectChanges();
const element = fixture.nativeElement;
fixture.whenStable().then(() => {
const loginInput = element.querySelector('input[name="login"]');
expect(loginInput).not.toBeNull('You should have an input with the name `login`');
loginInput.value = 'login';
loginInput.dispatchEvent(new Event('input'));
const passwordInput = element.querySelector('input[name="password"]');
expect(passwordInput).not.toBeNull('You should have an input with the name `password`');
passwordInput.value = 'password';
passwordInput.dispatchEvent(new Event('input'));
// when we trigger the change detection
fixture.detectChanges();
// then we should have a submit button enabled
expect(element.querySelector('button').hasAttribute('disabled'))
.toBe(false, 'The button should be enabled if the form is valid');
});
}));
it('should call the user service and redirect if success', () => {
const fixture = TestBed.createComponent(LoginComponent);
fixture.detectChanges();
const subject = new Subject();
fakeUserService.authenticate.and.returnValue(subject);
const componentInstance = fixture.componentInstance;
componentInstance.credentials.login = 'login';
componentInstance.credentials.password = 'password';
componentInstance.authenticate();
// then we should have called the user service method
expect(fakeUserService.authenticate).toHaveBeenCalledWith({
login: 'login',
password: 'password'
});
subject.next('');
// and redirect to the home
expect(componentInstance.authenticationFailed)
.toBe(false, 'You should have a field `authenticationFailed` set to false if registration succeeded');
expect(fakeRouter.navigate).toHaveBeenCalledWith(['/']);
});
it('should call the user service and display a message if failed', () => {
const fixture = TestBed.createComponent(LoginComponent);
fixture.detectChanges();
const subject = new Subject();
fakeUserService.authenticate.and.returnValue(subject);
const componentInstance = fixture.componentInstance;
componentInstance.credentials.login = 'login';
componentInstance.credentials.password = 'password';
componentInstance.authenticate();
// then we should have called the user service method
expect(fakeUserService.authenticate).toHaveBeenCalledWith({
login: 'login',
password: 'password'
});
subject.error(new Error());
// and not redirect to the home
expect(fakeRouter.navigate).not.toHaveBeenCalled();
expect(componentInstance.authenticationFailed)
.toBe(true, 'You should have a field `authenticationFailed` set to true if registration failed');
});
it('should display a message if auth failed', () => {
const fixture = TestBed.createComponent(LoginComponent);
const componentInstance = fixture.componentInstance;
componentInstance.authenticationFailed = true;
fixture.detectChanges();
const element = fixture.nativeElement;
expect(element.querySelector('.alert')).not.toBeNull('You should have a div with a class `alert` to display an error message');
expect(element.querySelector('.alert').textContent).toContain('Nope, try again');
});
});
|
<reponame>izelnakri/enber
export default function(code) {
return code.includes("window.socket = new WebSocket('ws://localhost:65511');") ||
code.includes('window.socket=');
}
|
# loads and executes the docker image
# to be run on the server
docker stop cycling-backend
docker rm cycling-backend
docker run -d --name cycling-backend -v /var/data/mapdata:/var/app/data -v /var/app/logs:/var/app/logs -p 5000:5000 anywaysopen/cycling-backend
|
import tensorflow as tf
from tensorflow.keras.layers import Embedding, Input, Dense
from tensorflow.keras.models import Model
# Define the input
input_sequence = Input(shape=(None,), dtype="int32")
# Word embedding layer
embedding = Embedding(input_dim=vocabulary, output_dim=256, input_length=max_length)(input_sequence)
# Forward pass
dense1 = Dense(200, activation="relu")(embedding)
dense2 = Dense(50, activation="relu")(dense1)
output = Dense(2, activation="softmax")(dense2)
# Create the model
model = Model(input_sequence, output)
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
# Fit the model
model.fit(x_train, y_train, batch_size=32, epochs=20) |
<gh_stars>1-10
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
/* This file has been modified by Open Source Strategies, Inc. */
package org.ofbiz.service.rmi.socket.ssl;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.net.ServerSocket;
import java.rmi.server.RMIServerSocketFactory;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import javax.net.ssl.SSLServerSocket;
import org.ofbiz.base.config.GenericConfigException;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.SSLUtil;
/**
* RMI SSL Server Socket Factory
*/
public class SSLServerSocketFactory implements RMIServerSocketFactory, Serializable {
public static final String module = SSLServerSocketFactory.class.getName();
protected boolean clientAuth = false;
protected String keystore = null;
protected String ksType = null;
protected String ksPass = null;
protected String alias = null;
public void setNeedClientAuth(boolean clientAuth) {
this.clientAuth = clientAuth;
}
public void setKeyStore(String location, String type, String password) {
this.keystore = location;
this.ksType = type;
this.ksPass = password;
}
public void setKeyStoreAlias(String alias) {
this.alias = alias;
}
public ServerSocket createServerSocket(int port) throws IOException {
char[] passphrase = null;
if (ksPass != null) {
passphrase = ksPass.toCharArray();
}
KeyStore ks = null;
if (keystore != null) {
try {
ks = KeyStore.getInstance(ksType);
ks.load(new FileInputStream(keystore), passphrase);
} catch (NoSuchAlgorithmException e) {
Debug.logError(e, module);
throw new IOException(e.getMessage());
} catch (CertificateException e) {
Debug.logError(e, module);
throw new IOException(e.getMessage());
} catch (KeyStoreException e) {
Debug.logError(e, module);
throw new IOException(e.getMessage());
}
}
if (alias == null) {
throw new IOException("SSL certificate alias cannot be null; MUST be set for SSLServerSocketFactory!");
}
javax.net.ssl.SSLServerSocketFactory factory = null;
try {
if (ks != null) {
factory = SSLUtil.getSSLServerSocketFactory(ks, ksPass, alias);
} else {
factory = SSLUtil.getSSLServerSocketFactory(alias);
}
} catch (GeneralSecurityException e) {
Debug.logError(e, "Error getting javax.net.ssl.SSLServerSocketFactory instance for Service Engine RMI calls: " + e.toString(), module);
throw new IOException(e.toString());
} catch (GenericConfigException e) {
Debug.logError(e, "Error getting javax.net.ssl.SSLServerSocketFactory instance for Service Engine RMI calls: " + e.toString(), module);
}
if (factory == null) {
throw new IOException("Unable to obtain SSLServerSocketFactory for provided KeyStore");
}
SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(port);
socket.setNeedClientAuth(clientAuth);
return socket;
}
}
|
function isValidEmailAddress(email) {
const regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return regex.test(email);
}
const result = isValidEmailAddress("example@example.com");
console.log(result); |
#!/bin/sh
# Jaroslav Langer
# 24/04/2019
# 1. Pomocí příkazu 'paste' spojte obsahy souborů 'jmena1' a 'jmena2', a výsledek zapište do souboru 'jmena'. Jako oddělovač jmen použijte dvojtečku. (1 bod)
#
# Ukázka souboru 'jmena1':
# Karel
# Bohdan
# Jaromir
#
# Ukázka souboru 'jmena2':
# Novotny
# Vymetal
# Nedusil
#
# Ukázka souboru 'jmena':
# Karel:Novotny
# Bohdan:Vymetal
# Jaromir:Nedusil
sed 'w jmena' jmena1 jmena2
# 2. Ze vstupního souboru vytvořte pomocí příkazu 'sed' varianty odpovědí pro vědomostní test, tzn. každé řádce ze vstupního souboru bude předcházet nová řádka s textem buď "a)", nebo "b)", nebo "c)", a to opakovaně ve stejném pořadí. (1 bod)
#
# Ukázka vstupního souboru:
# prvni odpoved
# druha odpoved
# treti odpoved
# prvni odpoved
# druha odpoved
# treti odpoved
# ... atd.
#
# Ukázka výstupu:
# a)
# prvni odpoved
# b)
# druha odpoved
# c)
# treti odpoved
# a)
# prvni odpoved
# b)
# druha odpoved
# c)
# treti odpoved
# ... atd.
sed '1~3i a)' input | sed '/a)/{N; s/\n/ /}' | sed '2~3i b)' | sed '/b)/{N; s/\n/ /}' | sed '3~3i c)' | sed '/c)/{N; s/\n/ /}'
# 3. Pomocí příkazu 'sed' odstraňte ze vstupního html souboru všechnny html tagy. Ve výstupu zůstanou jen textové informace, pokud je některé HTML tagy obsahují. Zároveň odstraňte všechny prázdné řádky, pokud po předchozí úpravě nějaké vzniknou. (1 bod)
#
# Ukázka vstupního souboru html:
# <html>
# <head>
# <title>Nazev stranky</title>
# </head>
# <body>
# <h1>Nadpis</h1>
# <div>
# <p>Tohle je <b>1.</b> odstavec</p>
# <p>Tohle je <b>2.</b> odstavec</p>
# </div>
# </body>
# </html>
#
# Ukázka výstupu:
# Nazev stranky
# Nadpis
# Tohle je 1. odstavec
# Tohle je 2. odstavec
sed -e '{s/<\/.*>//; s/<.*>//; /^[[:blank:]]*$/d}' /scratch/expressions/index.html
# 4. Najděte všechny skupiny uživatelů v systému, jejichž jméno začíná písmenem 's'. Vypište jejich GID (group id) a název oddělené mezerou (formát výstupu viz níže). Seznam všech skupin je uveden v souboru '/etc/group'. (1 bod)
#
# Ukázka výstupu:
# 3 sys
# 27 sudo
# 108 ssh
# ... atd.
egrep '^s' /etc/group | awk -F : '{print $3, $1}'
# 5. Uvažujte vstupní soubor, kde jsou na každém řádku dvě celá kladná čísla oddělená čárkou (viz ukázka vstupu). Pro každý řádek ze vstupního souboru proveďte rozdíl mezi uvedenými čísly a na výstup vypište výsledky ve formátu podle níže uvedeného vzoru. (1 bod)
#
# Ukázka vstupního souboru:
# 23,35
# 69,3
# 357,17
# ... atd.
#
# Ukázka výstupu:
# Vyhodnoceni prikladu
# 23 - 35 = -12
# 69 - 3 = 66
# 357 - 17 = 340
# ... atd.
awk -F , '{print $1 " - " $2 " = " $1-$2 }' input
|
#!/bin/bash -f
#*********************************************************************************************************
# Vivado (TM) v2018.2 (64-bit)
#
# Filename : RAM1.sh
# Simulator : Mentor Graphics ModelSim Simulator
# Description : Simulation script for compiling, elaborating and verifying the project source files.
# The script will automatically create the design libraries sub-directories in the run
# directory, add the library logical mappings in the simulator setup file, create default
# 'do/prj' file, execute compilation, elaboration and simulation steps.
#
# Generated by Vivado on Fri Apr 03 13:00:23 +0800 2020
# SW Build 2258646 on Thu Jun 14 20:03:12 MDT 2018
#
# Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
#
# usage: RAM1.sh [-help]
# usage: RAM1.sh [-lib_map_path]
# usage: RAM1.sh [-noclean_files]
# usage: RAM1.sh [-reset_run]
#
# Prerequisite:- To compile and run simulation, you must compile the Xilinx simulation libraries using the
# 'compile_simlib' TCL command. For more information about this command, run 'compile_simlib -help' in the
# Vivado Tcl Shell. Once the libraries have been compiled successfully, specify the -lib_map_path switch
# that points to these libraries and rerun export_simulation. For more information about this switch please
# type 'export_simulation -help' in the Tcl shell.
#
# You can also point to the simulation libraries by either replacing the <SPECIFY_COMPILED_LIB_PATH> in this
# script with the compiled library directory path or specify this path with the '-lib_map_path' switch when
# executing this script. Please type 'RAM1.sh -help' for more information.
#
# Additional references - 'Xilinx Vivado Design Suite User Guide:Logic simulation (UG900)'
#
#*********************************************************************************************************
# Script info
echo -e "RAM1.sh - Script generated by export_simulation (Vivado v2018.2 (64-bit)-id)\n"
# Main steps
run()
{
check_args $# $1
setup $1 $2
compile
simulate
}
# RUN_STEP: <compile>
compile()
{
# Compile design files
source compile.do 2>&1 | tee -a compile.log
}
# RUN_STEP: <simulate>
simulate()
{
vsim -64 -c -do "do {simulate.do}" -l simulate.log
}
# STEP: setup
setup()
{
case $1 in
"-lib_map_path" )
if [[ ($2 == "") ]]; then
echo -e "ERROR: Simulation library directory path not specified (type \"./RAM1.sh -help\" for more information)\n"
exit 1
fi
copy_setup_file $2
;;
"-reset_run" )
reset_run
echo -e "INFO: Simulation run files deleted.\n"
exit 0
;;
"-noclean_files" )
# do not remove previous data
;;
* )
copy_setup_file $2
esac
create_lib_dir
# Add any setup/initialization commands here:-
# <user specific commands>
}
# Copy modelsim.ini file
copy_setup_file()
{
file="modelsim.ini"
if [[ ($1 != "") ]]; then
lib_map_path="$1"
else
lib_map_path="E:/GIT/coa-design/cpu/cpu.cache/compile_simlib/modelsim"
fi
if [[ ($lib_map_path != "") ]]; then
src_file="$lib_map_path/$file"
cp $src_file .
fi
}
# Create design library directory
create_lib_dir()
{
lib_dir="modelsim_lib"
if [[ -e $lib_dir ]]; then
rm -rf $lib_dir
fi
mkdir $lib_dir
}
# Delete generated data from the previous run
reset_run()
{
files_to_remove=(compile.log elaborate.log simulate.log vsim.wlf modelsim_lib)
for (( i=0; i<${#files_to_remove[*]}; i++ )); do
file="${files_to_remove[i]}"
if [[ -e $file ]]; then
rm -rf $file
fi
done
create_lib_dir
}
# Check command line arguments
check_args()
{
if [[ ($1 == 1 ) && ($2 != "-lib_map_path" && $2 != "-noclean_files" && $2 != "-reset_run" && $2 != "-help" && $2 != "-h") ]]; then
echo -e "ERROR: Unknown option specified '$2' (type \"./RAM1.sh -help\" for more information)\n"
exit 1
fi
if [[ ($2 == "-help" || $2 == "-h") ]]; then
usage
fi
}
# Script usage
usage()
{
msg="Usage: RAM1.sh [-help]\n\
Usage: RAM1.sh [-lib_map_path]\n\
Usage: RAM1.sh [-reset_run]\n\
Usage: RAM1.sh [-noclean_files]\n\n\
[-help] -- Print help information for this script\n\n\
[-lib_map_path <path>] -- Compiled simulation library directory path. The simulation library is compiled\n\
using the compile_simlib tcl command. Please see 'compile_simlib -help' for more information.\n\n\
[-reset_run] -- Recreate simulator setup files and library mappings for a clean run. The generated files\n\
from the previous run will be removed. If you don't want to remove the simulator generated files, use the\n\
-noclean_files switch.\n\n\
[-noclean_files] -- Reset previous run, but do not remove simulator generated files from the previous run.\n\n"
echo -e $msg
exit 1
}
# Launch script
run $1 $2
|
import geopandas as gpd
def filter_basins(geodataframe):
"""
Filters the input geodataframe to include only basins with 0 or 1 basin at a lower level within their boundaries.
:param geodataframe: A geopandas geodataframe containing information about basins.
:return: A filtered geopandas geodataframe with basins meeting the specified criteria.
"""
# Create a copy of the input geodataframe to avoid modifying the original dataframe
filtered_geodataframe = geodataframe.copy()
# Iterate through each basin in the geodataframe
for index, basin in geodataframe.iterrows():
# Count the number of basins at a lower level within the boundaries of the current basin
lower_level_basins = geodataframe[geodataframe['elevation'] < basin['elevation']]
count_lower_level_basins = len(lower_level_basins)
# If the count is not 0 or 1, remove the current basin from the filtered geodataframe
if count_lower_level_basins not in [0, 1]:
filtered_geodataframe = filtered_geodataframe.drop(index)
return filtered_geodataframe |
import java.awt.*;
import javax.swing.*;
public class Calculator {
public static void main(String[] args) {
// Create and configure the frame
JFrame frame = new JFrame("Calculator");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 400);
// Create a panel to hold the calculator components
JPanel panel = new JPanel();
frame.add(panel);
// Create text fields for input and output
JTextField num1 = new JTextField(10);
JTextField num2 = new JTextField(10);
JTextField output = new JTextField(20);
// Create the buttons for operations
JButton addButton = new JButton("Add");
JButton subtractButton = new JButton("Subtract");
JButton multiplyButton = new JButton("Multiply");
JButton divideButton = new JButton("Divide");
addButton.addActionListener(e -> {
String result = String.valueOf(Integer.parseInt(num1.getText()) + Integer.parseInt(num2.getText()));
output.setText(result);
});
subtractButton.addActionListener(e -> {
String result = String.valueOf(Integer.parseInt(num1.getText()) - Integer.parseInt(num2.getText()));
output.setText(result);
});
multiplyButton.addActionListener(e -> {
String result = String.valueOf(Integer.parseInt(num1.getText()) * Integer.parseInt(num2.getText()));
output.setText(result);
});
divideButton.addActionListener(e -> {
String result = String.valueOf(Integer.parseInt(num1.getText()) / Integer.parseInt(num2.getText()));
output.setText(result);
});
// Assemble the GUI
panel.add(num1);
panel.add(num2);
panel.add(addButton);
panel.add(subtractButton);
panel.add(multiplyButton);
panel.add(divideButton);
panel.add(output);
// Show the calculator
frame.setVisible(true);
}
} |
total_spent = 0
cheapest_product_name = ''
cheapest_product_price = float('inf')
while True:
product_name = input('Enter the name of the product: ')
product_price = float(input('Enter the price of the product: '))
total_spent += product_price
if product_price < cheapest_product_price:
cheapest_product_name = product_name
cheapest_product_price = product_price
choice = input('Do you want to continue adding more products (Y/N): ').strip().upper()
if choice == 'N':
break
print('========= END OF PURCHASES ===========')
print(f'Total spent: ${total_spent:.2f}')
print(f'Cheapest product: {cheapest_product_name} (${cheapest_product_price:.2f})') |
# Get current positions for a book
# Create a new trade
# Save it to AMaaS
# Should receive a callback that there is a new position
|
import type { CSSProperties } from 'vue';
import classNames from '../../../_util/classNames';
import type { VueNode } from '../../../_util/type';
import warning from '../../../_util/warning';
const calcPoints = (
_vertical: boolean,
marks: Record<number, VueNode | { style?: CSSProperties; label?: string }>,
dots: boolean,
step: number,
min: number,
max: number,
) => {
warning(
dots ? step > 0 : true,
'Slider',
'`Slider[step]` should be a positive number in order to make Slider[dots] work.',
);
const points = Object.keys(marks)
.map(parseFloat)
.sort((a, b) => a - b);
if (dots && step) {
for (let i = min; i <= max; i += step) {
if (points.indexOf(i) === -1) {
points.push(i);
}
}
}
return points;
};
const Steps = (_: any, { attrs }) => {
const {
prefixCls,
vertical,
reverse,
marks,
dots,
step,
included,
lowerBound,
upperBound,
max,
min,
dotStyle,
activeDotStyle,
} = attrs;
const range = max - min;
const elements = calcPoints(vertical, marks, dots, step, min, max).map(point => {
const offset = `${(Math.abs(point - min) / range) * 100}%`;
const isActived =
(!included && point === upperBound) ||
(included && point <= upperBound && point >= lowerBound);
let style = vertical
? { ...dotStyle, [reverse ? 'top' : 'bottom']: offset }
: { ...dotStyle, [reverse ? 'right' : 'left']: offset };
if (isActived) {
style = { ...style, ...activeDotStyle };
}
const pointClassName = classNames({
[`${prefixCls}-dot`]: true,
[`${prefixCls}-dot-active`]: isActived,
[`${prefixCls}-dot-reverse`]: reverse,
});
return <span class={pointClassName} style={style} key={point} />;
});
return <div class={`${prefixCls}-step`}>{elements}</div>;
};
Steps.inheritAttrs = false;
export default Steps;
|
#!/bin/bash -eu
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# ==============================================================================
#
# Builds a devtoolset cross-compiler targeting manylinux 2010 (glibc 2.12 /
# libstdc++ 4.4).
VERSION="$1"
TARGET="$2"
case "${VERSION}" in
devtoolset-7)
LIBSTDCXX_VERSION="6.0.24"
;;
devtoolset-8)
LIBSTDCXX_VERSION="6.0.25"
;;
*)
echo "Usage: $0 {devtoolset-7|devtoolset-8} <target-directory>"
exit 1
;;
esac
mkdir -p "${TARGET}"
# Download binary glibc 2.12 release.
wget "http://old-releases.ubuntu.com/ubuntu/pool/main/e/eglibc/libc6_2.12.1-0ubuntu6_amd64.deb" && \
unar "libc6_2.12.1-0ubuntu6_amd64.deb" && \
tar -C "${TARGET}" -xvzf "libc6_2.12.1-0ubuntu6_amd64/data.tar.gz" && \
rm -rf "libc6_2.12.1-0ubuntu6_amd64.deb" "libc6_2.12.1-0ubuntu6_amd64"
wget "http://old-releases.ubuntu.com/ubuntu/pool/main/e/eglibc/libc6-dev_2.12.1-0ubuntu6_amd64.deb" && \
unar "libc6-dev_2.12.1-0ubuntu6_amd64.deb" && \
tar -C "${TARGET}" -xvzf "libc6-dev_2.12.1-0ubuntu6_amd64/data.tar.gz" && \
rm -rf "libc6-dev_2.12.1-0ubuntu6_amd64.deb" "libc6-dev_2.12.1-0ubuntu6_amd64"
# Put the current kernel headers from ubuntu in place.
ln -s "/usr/include/linux" "/${TARGET}/usr/include/linux"
ln -s "/usr/include/asm-generic" "/${TARGET}/usr/include/asm-generic"
ln -s "/usr/include/x86_64-linux-gnu/asm" "/${TARGET}/usr/include/asm"
# Symlinks in the binary distribution are set up for installation in /usr, we
# need to fix up all the links to stay within /${TARGET}.
/fixlinks.sh "/${TARGET}"
# Patch to allow non-glibc 2.12 compatible builds to work.
sed -i '54i#define TCP_USER_TIMEOUT 18' "/${TARGET}/usr/include/netinet/tcp.h"
# Download binary libstdc++ 4.4 release we are going to link against.
# We only need the shared library, as we're going to develop against the
# libstdc++ provided by devtoolset.
wget "http://old-releases.ubuntu.com/ubuntu/pool/main/g/gcc-4.4/libstdc++6_4.4.3-4ubuntu5_amd64.deb" && \
unar "libstdc++6_4.4.3-4ubuntu5_amd64.deb" && \
tar -C "/${TARGET}" -xvzf "libstdc++6_4.4.3-4ubuntu5_amd64/data.tar.gz" "./usr/lib/libstdc++.so.6.0.13" && \
rm -rf "libstdc++6_4.4.3-4ubuntu5_amd64.deb" "libstdc++6_4.4.3-4ubuntu5_amd64"
mkdir -p "${TARGET}-src"
cd "${TARGET}-src"
# Build a devtoolset cross-compiler based on our glibc 2.12 sysroot setup.
case "${VERSION}" in
devtoolset-7)
wget "http://vault.centos.org/centos/6/sclo/Source/rh/devtoolset-7/devtoolset-7-gcc-7.3.1-5.15.el6.src.rpm"
rpm2cpio "devtoolset-7-gcc-7.3.1-5.15.el6.src.rpm" |cpio -idmv
tar -xvjf "gcc-7.3.1-20180303.tar.bz2" --strip 1
;;
devtoolset-8)
wget "http://vault.centos.org/centos/6/sclo/Source/rh/devtoolset-8/devtoolset-8-gcc-8.2.1-3.el6.src.rpm"
rpm2cpio "devtoolset-8-gcc-8.2.1-3.el6.src.rpm" |cpio -idmv
tar -xvf "gcc-8.2.1-20180905.tar.xz" --strip 1
;;
esac
# Apply the devtoolset patches to gcc.
/rpm-patch.sh "gcc.spec"
./contrib/download_prerequisites
mkdir -p "${TARGET}-build"
cd "${TARGET}-build"
"${TARGET}-src/configure" \
--prefix=/"${TARGET}/usr" \
--with-sysroot="/${TARGET}" \
--disable-bootstrap \
--disable-libmpx \
--disable-libsanitizer \
--disable-libunwind-exceptions \
--disable-libunwind-exceptions \
--disable-lto \
--disable-multilib \
--enable-__cxa_atexit \
--enable-gnu-indirect-function \
--enable-gnu-unique-object \
--enable-initfini-array \
--enable-languages="c,c++" \
--enable-linker-build-id \
--enable-plugin \
--enable-shared \
--enable-threads=posix \
--with-default-libstdcxx-abi="gcc4-compatible" \
--with-gcc-major-version-only \
--with-linker-hash-style="gnu" \
--with-tune="generic" \
&& \
make -j 42 && \
make install
# Create the devtoolset libstdc++ linkerscript that links dynamically against
# the system libstdc++ 4.4 and provides all other symbols statically.
mv "/${TARGET}/usr/lib/libstdc++.so.${LIBSTDCXX_VERSION}" \
"/${TARGET}/usr/lib/libstdc++.so.${LIBSTDCXX_VERSION}.backup"
echo -e "OUTPUT_FORMAT(elf64-x86-64)\nINPUT ( libstdc++.so.6.0.13 -lstdc++_nonshared44 )" \
> "/${TARGET}/usr/lib/libstdc++.so.${LIBSTDCXX_VERSION}"
cp "./x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++_nonshared44.a" \
"/${TARGET}/usr/lib"
# Link in architecture specific includes from the system; note that we cannot
# link in the whole x86_64-linux-gnu folder, as otherwise we're overlaying
# system gcc paths that we do not want to find.
# TODO(klimek): Automate linking in all non-gcc / non-kernel include
# directories.
mkdir -p "/${TARGET}/usr/include/x86_64-linux-gnu"
PYTHON_VERSIONS=("python2.7" "python3.5m" "python3.6m" "python3.7m" "python3.8")
for v in "${PYTHON_VERSIONS[@]}"; do
ln -s "/usr/local/include/${v}" "/${TARGET}/usr/include/x86_64-linux-gnu/${v}"
done
|
function search(array, item) {
let startIndex = 0;
let endIndex = array.length;
while (startIndex < endIndex) {
let middleIndex = Math.floor((startIndex + endIndex) / 2);
if (array[middleIndex] == item) {
return middleIndex;
}
else if (array[middleIndex] < item) {
startIndex = middleIndex + 1;
}
else {
endIndex = middleIndex - 1;
}
}
return -1;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.