text stringlengths 1 1.05M |
|---|
package game.backend.level;
import game.backend.GameState;
public class Level1 extends Level {
private static int REQUIRED_SCORE = 5000;
private static int MAX_MOVES = 20;
@Override
protected GameState newState() {
return new Level1State(REQUIRED_SCORE, MAX_MOVES);
}
private class Level1State extends GameState {
private long requiredScore;
private int maxMoves;
public Level1State(long requiredScore, int maxMoves) {
this.requiredScore = requiredScore;
this.maxMoves = maxMoves;
}
public boolean gameOver() {
return playerWon() || getMoves() >= maxMoves;
}
public boolean playerWon() {
return getScore() > requiredScore;
}
}
}
|
import re
def extractElementNames(htmlCode, section):
start_tag = f"<{section}"
end_tag = f"</{section}>"
section_start = htmlCode.find(start_tag)
section_end = htmlCode.find(end_tag, section_start) + len(end_tag)
section_html = htmlCode[section_start:section_end]
element_names = re.findall(r'<\s*([a-zA-Z0-9]+)', section_html)
return list(set(element_names)) |
/*
* Copyright 2019 LinkedIn Corp. Licensed under the BSD 2-Clause License (the "License").
See License in the project root for license information.
*/
package com.linkedin.kafka.clients.producer;
import com.linkedin.kafka.clients.common.ClusterDescriptor;
import com.linkedin.kafka.clients.common.ClusterGroupDescriptor;
import com.linkedin.kafka.clients.common.LiKafkaFederatedClient;
import com.linkedin.kafka.clients.common.LiKafkaFederatedClientType;
import com.linkedin.kafka.clients.metadataservice.MetadataServiceClient;
import com.linkedin.kafka.clients.metadataservice.MetadataServiceClientException;
import com.linkedin.kafka.clients.utils.LiKafkaClientsUtils;
import com.linkedin.mario.common.websockets.MessageType;
import java.time.Duration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.clients.producer.Callback;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.apache.kafka.common.KafkaException;
import org.apache.kafka.common.Metric;
import org.apache.kafka.common.MetricName;
import org.apache.kafka.common.PartitionInfo;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.errors.ProducerFencedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This is a producer implementation that works with a federated Kafka cluster, which consists of one or more physical
* Kafka clusters.
*/
public class LiKafkaFederatedProducerImpl<K, V> implements LiKafkaProducer<K, V>, LiKafkaFederatedClient {
private static final Logger LOG = LoggerFactory.getLogger(LiKafkaFederatedProducerImpl.class);
private static final AtomicInteger FEDERATED_PRODUCER_CLIENT_ID_SEQUENCE = new AtomicInteger(1);
private static final Duration RELOAD_CONFIG_EXECUTION_TIME_OUT = Duration.ofMinutes(10);
// The cluster group this client is talking to
private ClusterGroupDescriptor _clusterGroup;
// The client for the metadata service which serves cluster and topic metadata
private MetadataServiceClient _mdsClient;
// Timeout in milliseconds for metadata service requests.
private int _mdsRequestTimeoutMs;
// Per cluster producers
private Map<ClusterDescriptor, LiKafkaProducer<K, V>> _producers;
// Producer builder for creating per-cluster LiKafkaProducer
private LiKafkaProducerBuilder<K, V> _producerBuilder;
// Producer configs common to all clusters
private LiKafkaProducerConfig _commonProducerConfigs;
// Consumer configs received from Conductor at boot up time
private Map<String, String> _bootupConfigsFromConductor;
// Number of producers that successfully applied configs at boot up time, used for testing only
private Set<LiKafkaProducer<K, V>> _numProducersWithBootupConfigs = new HashSet<>();
// The prefix of the client.id property to be used for individual producers. Since the client id is part of the
// producer metric keys, we need to use cluster-specific client ids to differentiate metrics from different clusters.
// Per-cluster client id is generated by appending the cluster name to this prefix.
//
// If user set the client.id property for the federated client, it will be used as the prefix. If not, a new prefix
// is generated.
private String _clientIdPrefix;
private volatile boolean _closed;
// Number of config reload operations executed
private volatile int _numConfigReloads;
public LiKafkaFederatedProducerImpl(Properties props) {
this(new LiKafkaProducerConfig(props), null, null);
}
public LiKafkaFederatedProducerImpl(Properties props, MetadataServiceClient mdsClient,
LiKafkaProducerBuilder<K, V> producerBuilder) {
this(new LiKafkaProducerConfig(props), mdsClient, producerBuilder);
}
public LiKafkaFederatedProducerImpl(Map<String, ?> configs) {
this(new LiKafkaProducerConfig(configs), null, null);
}
public LiKafkaFederatedProducerImpl(Map<String, ?> configs, MetadataServiceClient mdsClient,
LiKafkaProducerBuilder<K, V> producerBuilder) {
this(new LiKafkaProducerConfig(configs), mdsClient, producerBuilder);
}
@SuppressWarnings("unchecked")
private LiKafkaFederatedProducerImpl(LiKafkaProducerConfig configs, MetadataServiceClient mdsClient,
LiKafkaProducerBuilder<K, V> producerBuilder) {
_commonProducerConfigs = configs;
_clusterGroup = new ClusterGroupDescriptor(configs.getString(LiKafkaProducerConfig.CLUSTER_GROUP_CONFIG),
configs.getString(LiKafkaProducerConfig.CLUSTER_ENVIRONMENT_CONFIG));
// Each per-cluster producer and auditor will be intantiated by the passed-in producer builder when the client
// begins to produce to that cluster. If a null builder is passed, create a default one, which builds LiKafkaProducer.
_producers = new ConcurrentHashMap<ClusterDescriptor, LiKafkaProducer<K, V>>();
_producerBuilder = producerBuilder != null ? producerBuilder : new LiKafkaProducerBuilder<K, V>();
_mdsRequestTimeoutMs = configs.getInt(LiKafkaProducerConfig.METADATA_SERVICE_REQUEST_TIMEOUT_MS_CONFIG);
String clientIdPrefix = (String) configs.originals().get(ProducerConfig.CLIENT_ID_CONFIG);
if (clientIdPrefix == null || clientIdPrefix.length() == 0) {
clientIdPrefix = "producer-" + FEDERATED_PRODUCER_CLIENT_ID_SEQUENCE.getAndIncrement();
}
_clientIdPrefix = clientIdPrefix;
_closed = false;
_numConfigReloads = 0;
// Instantiate metadata service client if necessary.
_mdsClient = mdsClient != null ? mdsClient :
configs.getConfiguredInstance(LiKafkaProducerConfig.METADATA_SERVICE_CLIENT_CLASS_CONFIG, MetadataServiceClient.class);
// Register this federated client with the metadata service. The metadata service will assign a UUID to this
// client, which will be used for later interaction between the metadata service and the client.
//
// Registration may also return further information such as the metadata server version and any protocol settings.
// We assume that such information will be kept and used by the metadata service client itself.
//
_mdsClient.registerFederatedClient(this, _clusterGroup, configs.originals(), _mdsRequestTimeoutMs);
}
@Override
public LiKafkaFederatedClientType getClientType() {
return LiKafkaFederatedClientType.FEDERATED_PRODUCER;
}
@Override
public Future<RecordMetadata> send(ProducerRecord<K, V> producerRecord) {
return send(producerRecord, null);
}
@Override
synchronized public Future<RecordMetadata> send(ProducerRecord<K, V> producerRecord, Callback callback) {
return getOrCreateProducerForTopic(producerRecord.topic()).send(producerRecord, callback);
}
@Override
public void flush() {
flush(Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
}
@Override
synchronized public void flush(long timeout, TimeUnit timeUnit) {
flushNoLock(timeout, timeUnit);
}
void flushNoLock(long timeout, TimeUnit timeUnit) {
if (_producers.isEmpty()) {
LOG.info("no producers to flush for cluster group {}", _clusterGroup);
return;
}
ensureOpen();
LOG.info("flushing LiKafkaProducer for cluster group {} in {} {}...", _clusterGroup, timeout, timeUnit);
long startTimeMs = System.currentTimeMillis();
long deadlineTimeMs = startTimeMs + timeUnit.toMillis(timeout);
CountDownLatch countDownLatch = new CountDownLatch(_producers.entrySet().size());
Set<Thread> threads = new HashSet<>();
for (Map.Entry<ClusterDescriptor, LiKafkaProducer<K, V>> entry : _producers.entrySet()) {
ClusterDescriptor cluster = entry.getKey();
LiKafkaProducer<K, V> producer = entry.getValue();
Thread t = new Thread(() -> {
try {
producer.flush(deadlineTimeMs - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
} finally {
countDownLatch.countDown();
}
});
t.setDaemon(true);
t.setName("LiKafkaProducer-flush-" + cluster.getName());
t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
throw new KafkaException("Thread " + t.getName() + " throws exception", e);
}
});
t.start();
threads.add(t);
}
try {
if (!countDownLatch.await(deadlineTimeMs - System.currentTimeMillis(), TimeUnit.MILLISECONDS)) {
LiKafkaClientsUtils.dumpStacksForAllLiveThreads(threads);
throw new KafkaException("Fail to flush all producers for cluster group " + _clusterGroup + " in " +
timeout + " " + timeUnit);
}
} catch (InterruptedException e) {
throw new KafkaException("Fail to flush all producers for cluster group " + _clusterGroup, e);
}
LOG.info("LiKafkaProducer flush for cluster group {} complete in {} milliseconds", _clusterGroup,
(System.currentTimeMillis() - startTimeMs));
}
@Override
synchronized public List<PartitionInfo> partitionsFor(String topic) {
return getOrCreateProducerForTopic(topic).partitionsFor(topic);
}
@Override
synchronized public Map<MetricName, ? extends Metric> metrics() {
throw new UnsupportedOperationException("Not implemented yet");
}
@Override
public void close() {
close(Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
}
@Override
synchronized public void close(long timeout, TimeUnit timeUnit) {
closeNoLock(timeout, timeUnit);
}
void closeNoLock(long timeout, TimeUnit timeUnit) {
if (_producers.isEmpty()) {
LOG.debug("no producers to close for cluster group {}", _clusterGroup);
return;
}
if (_closed) {
return;
}
_closed = true;
LOG.info("closing LiKafkaProducer for cluster group {} in {} {}...", _clusterGroup, timeout, timeUnit);
long startTimeMs = System.currentTimeMillis();
long deadlineTimeMs = startTimeMs + timeUnit.toMillis(timeout);
CountDownLatch countDownLatch = new CountDownLatch(_producers.entrySet().size());
Set<Thread> threads = new HashSet<>();
for (Map.Entry<ClusterDescriptor, LiKafkaProducer<K, V>> entry : _producers.entrySet()) {
ClusterDescriptor cluster = entry.getKey();
LiKafkaProducer<K, V> producer = entry.getValue();
Thread t = new Thread(() -> {
try {
producer.close(deadlineTimeMs - System.currentTimeMillis(), TimeUnit.MILLISECONDS);
} finally {
countDownLatch.countDown();
}
});
t.setDaemon(true);
t.setName("LiKafkaProducer-close-" + cluster.getName());
t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
throw new KafkaException("Thread " + t.getName() + " throws exception", e);
}
});
t.start();
threads.add(t);
}
try {
if (!countDownLatch.await(deadlineTimeMs - System.currentTimeMillis(), TimeUnit.MILLISECONDS)) {
LiKafkaClientsUtils.dumpStacksForAllLiveThreads(threads);
throw new KafkaException("Fail to close all producers for cluster group " + _clusterGroup + " in " +
timeout + " " + timeUnit);
}
} catch (InterruptedException e) {
throw new KafkaException("Fail to close all producers for cluster group " + _clusterGroup, e);
}
LOG.info("LiKafkaProducer close for cluster group {} complete in {} milliseconds", _clusterGroup,
(System.currentTimeMillis() - startTimeMs));
}
// Transactions are not supported in federated clients.
@Override
public void initTransactions() {
throw new UnsupportedOperationException("Not supported");
}
@Override
public void beginTransaction() throws ProducerFencedException {
throw new UnsupportedOperationException("Not supported");
}
@Override
public void sendOffsetsToTransaction(Map<TopicPartition, OffsetAndMetadata> offsets,
String consumerGroupId) throws ProducerFencedException {
throw new UnsupportedOperationException("Not supported");
}
@Override
public void commitTransaction() throws ProducerFencedException {
throw new UnsupportedOperationException("Not supported");
}
@Override
public void abortTransaction() throws ProducerFencedException {
throw new UnsupportedOperationException("Not supported");
}
public LiKafkaProducerConfig getCommonProducerConfigs() {
return _commonProducerConfigs;
}
synchronized public void applyBootupConfigFromConductor(Map<String, String> configs) {
_bootupConfigsFromConductor = configs;
// Only try to recreate per-cluster consumers when _consumers are initialized, i.e. after subscribe/assign has
// been called, otherwise it's impossible to create per-cluster consumers without the topic-cluster information,
// just save the boot up configs
if (_producers != null && !_producers.isEmpty()) {
recreateProducers(configs, null);
}
}
int getNumProducersWithBootupConfigs() {
return _numProducersWithBootupConfigs.size();
}
int getNumConfigReloads() {
return _numConfigReloads;
}
public void reloadConfig(Map<String, String> newConfigs, UUID commandId) {
// Go over each producer, flush and close. Since each per-cluster producer will be instantiated when the client began
// producing to that cluster, we just need to clear the mappings and update the configs
// since this method is invoked by marioClient, it should be non-blocking, so we create another thread doing above
LOG.info("Starting reloadConfig for LiKafkaProducers in clusterGroup {} with new configs {}", _clusterGroup, newConfigs);
Thread t = new Thread(() -> {
recreateProducers(newConfigs, commandId);
});
t.setDaemon(true);
t.setName("LiKafkaProducer-reloadConfig-" + _clusterGroup.getName());
t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
LOG.error("Thread {} throws exception {}", t.getName(), e);
}
});
t.start();
}
// Do synchronization on the method that will be flushing and closing the producers since it will be handled by a different thread
synchronized void recreateProducers(Map<String, String> newConfigs, UUID commandId) {
ensureOpen();
flushNoLock(RELOAD_CONFIG_EXECUTION_TIME_OUT.toMillis(), TimeUnit.MILLISECONDS);
closeNoLock(RELOAD_CONFIG_EXECUTION_TIME_OUT.toMillis(), TimeUnit.MILLISECONDS);
_closed = false;
// save the original configs in case re-create producers with new configs failed, we need to re-create
// with the original configs
Map<String, Object> originalConfig = _commonProducerConfigs.originals();
// update existing configs with newConfigs
// originals() would return a copy of the internal producer configs, put in new configs and update existing configs
Map<String, Object> configMap = _commonProducerConfigs.originals();
configMap.putAll(newConfigs);
_commonProducerConfigs = new LiKafkaProducerConfig(configMap);
// re-create per-cluster producers with new set of configs
// if any error occurs, recreate all per-cluster producers with previous last-known-good configs and
// TODO : send an error back to Mario
// _producers should be filled when reload config happens
Map<ClusterDescriptor, LiKafkaProducer<K, V>> newProducers = new ConcurrentHashMap<>();
boolean recreateProducerSuccessful = false;
try {
for (Map.Entry<ClusterDescriptor, LiKafkaProducer<K, V>> entry : _producers.entrySet()) {
LiKafkaProducer<K, V> curProducer = createPerClusterProducer(entry.getKey());
newProducers.put(entry.getKey(), curProducer);
}
// replace _producers with newly created producers
_producers.clear();
_producers = newProducers;
recreateProducerSuccessful = true;
} catch (Exception e) {
LOG.error("Failed to recreate per-cluster producers with new configs with exception, restore to previous producers ", e);
// recreate failed, restore to previous configured producers
newProducers.clear();
_commonProducerConfigs = new LiKafkaProducerConfig(originalConfig);
for (Map.Entry<ClusterDescriptor, LiKafkaProducer<K, V>> entry : _producers.entrySet()) {
LiKafkaProducer<K, V> curProducer = createPerClusterProducer(entry.getKey());
newProducers.put(entry.getKey(), curProducer);
}
_producers = newProducers;
}
// Convert the updated configs from Map<String, Object> to Map<String, String> and send the new config to mario server
// report reload config execution complete to mario server
Map<String, String> convertedConfig = new HashMap<>();
for (Map.Entry<String, Object> entry : _commonProducerConfigs.originals().entrySet()) {
convertedConfig.put(entry.getKey(), String.valueOf(entry.getValue()));
}
_mdsClient.reportCommandExecutionComplete(commandId, convertedConfig, MessageType.RELOAD_CONFIG_RESPONSE, recreateProducerSuccessful);
// re-register federated client with updated configs
_mdsClient.reRegisterFederatedClient(newConfigs);
_numConfigReloads++;
LOG.info("Successfully recreated LiKafkaProducers in clusterGroup {} with new configs (diff) {}", _clusterGroup, newConfigs);
}
// For testing only, wait for reload config command to finish since it's being executed by a different thread
void waitForReloadConfigFinish() throws InterruptedException {
long endWaitTime = System.currentTimeMillis() + Duration.ofMinutes(1).toMillis();
while (_numConfigReloads == 0 && System.currentTimeMillis() < endWaitTime) {
TimeUnit.MILLISECONDS.sleep(200);
}
}
// Intended for testing only
LiKafkaProducer<K, V> getPerClusterProducer(ClusterDescriptor cluster) {
return _producers.get(cluster);
}
private LiKafkaProducer<K, V> getOrCreateProducerForTopic(String topic) {
if (topic == null || topic.isEmpty()) {
throw new IllegalArgumentException("Topic cannot be null or empty");
}
ensureOpen();
// TODO: Handle nonexistent topics more elegantly with auto topic creation option
ClusterDescriptor cluster = null;
try {
cluster = _mdsClient.getClusterForTopic(topic, _clusterGroup, _mdsRequestTimeoutMs);
} catch (MetadataServiceClientException e) {
throw new KafkaException("failed to get cluster for topic " + topic + ": ", e);
}
if (cluster == null) {
throw new IllegalStateException("Topic " + topic + " not found in the metadata service");
}
return getOrCreatePerClusterProducer(cluster);
}
private LiKafkaProducer<K, V> getOrCreatePerClusterProducer(ClusterDescriptor cluster) {
if (cluster == null) {
throw new IllegalArgumentException("Cluster cannot be null");
}
ensureOpen();
if (_producers.containsKey(cluster)) {
return _producers.get(cluster);
}
LiKafkaProducer<K, V> newProducer = createPerClusterProducer(cluster);
// always update _producers map to avoid creating multiple producers when calling this method
// multiple times
_producers.put(cluster, newProducer);
return newProducer;
}
private LiKafkaProducer<K, V> createPerClusterProducer(ClusterDescriptor cluster) {
if (cluster == null) {
throw new IllegalArgumentException("Cluster cannot be null");
}
ensureOpen();
// Create per-cluster producer config
Map<String, Object> configMap = _commonProducerConfigs.originals();
configMap.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.getBootstrapUrl());
configMap.put(ProducerConfig.CLIENT_ID_CONFIG, _clientIdPrefix + "-" + cluster.getName());
Map<String, Object> configMapWithBootupConfig = new HashMap<>(configMap);
// Apply the configs received from Conductor at boot up/registration time
if (_bootupConfigsFromConductor != null && !_bootupConfigsFromConductor.isEmpty()) {
configMapWithBootupConfig.putAll(_bootupConfigsFromConductor);
}
LiKafkaProducer<K, V> newProducer;
try {
newProducer = _producerBuilder.setProducerConfig(configMapWithBootupConfig).build();
_numProducersWithBootupConfigs.add(newProducer);
} catch (Exception e) {
LOG.error("Failed to create per-cluster producer with config {}, try creating with config {}", configMapWithBootupConfig, configMap);
newProducer = _producerBuilder.setProducerConfig(configMap).build();
}
return newProducer;
}
private void ensureOpen() {
if (_closed) {
throw new IllegalStateException("this federated producer has already been closed");
}
}
}
|
<gh_stars>1-10
#include <string.h>
#include "usb_common.h"
#include "usbd.h"
#include "usbd_hid.h"
struct uhid_t
{
struct usbd_t *h; /* usbd handle */
struct usbd_hid_callback_t *cb;
uint8_t out_buf[64];
uint8_t keyboard_in_buf[8];
uint8_t mouse_in_buf[4];
};
static struct uhid_t hid;
uint32_t hid_class_request_handler(struct usbd_t *h)
{
USBD_TRACE("class request:0x%X\r\n", h->setup.request);
if(h->setup.request == 0x0A)
{
/* HID:set idle, do nothing */
USBD_TRACE("reqeust to class: HID set idle\r\n");
usbd_status_in_stage();
}
return CH_OK;
}
uint32_t hid_standard_request_to_intf_handler(struct usbd_t *h)
{
desc_t d;
if(h->setup.request == USB_REQ_GET_DESCRIPTOR)
{
if((h->setup.value >> 8) == USB_DESC_TYPE_REPORT)
{
/* get hid report descriptor class index 0 */
if(h->setup.index == USBD_HID0_IF_IDX)
{
get_descriptor_data("report_descriptor_keyboard", &d);
USBD_TRACE("send key boarad report descrtipor size:%d\r\n", d.len);
begin_data_in_stage((uint8_t*)d.buf, d.len);
}
if(h->setup.index == USBD_HID1_IF_IDX)
{
get_descriptor_data("report_descriptor_mouse", &d);
USBD_TRACE("send mouse report descrtipor size:%d\r\n", d.len);
begin_data_in_stage((uint8_t*)d.buf, d.len);
}
if(h->setup.index == USBD_HID2_IF_IDX)
{
get_descriptor_data("report_descriptor_custom", &d);
USBD_TRACE("send custom report descrtipor size:%d\r\n", d.len);
begin_data_in_stage((uint8_t*)d.buf, d.len);
}
}
}
return CH_OK;
}
uint32_t hid_data_ep_handler(uint8_t ep, uint8_t dir)
{
uint32_t size;
switch(ep)
{
case USBD_HID1_EP_INTIN:
case USBD_HID0_EP_INTIN:
case USBD_HID2_EP_INTIN:
if(hid.cb)
{
if(dir == 1) /* in transfer */
{
hid.cb->data_send_notify(ep);
}
else
{
size = usbd_ep_read(ep, hid.out_buf);
hid.cb->data_received(ep, hid.out_buf, size);
}
}
break;
}
return CH_OK;
}
/*
* Get Mouse Input Report -> MouseInReport
* Parameters: report:
* Byte0.0: 1st Button (Left)
* Byte0.1: 2nd Button (Right)
* Byte0.2: 3rd Button
* Byte1: Relative X Pos
* Byte2: Relative Y Pos
* Byte3: Relative Wheel Pos
* size: report size
* Return Value: None
*/
uint32_t usbd_set_mouse(uint8_t btn, int8_t x, int8_t y, int8_t wheel)
{
uint8_t *p = hid.mouse_in_buf;
p[0] = btn;
p[1] = x;
p[2] = y;
p[3] = wheel;
usbd_ep_write(USBD_HID1_EP_INTIN, hid.mouse_in_buf, 4);
return CH_OK;
}
uint32_t usbd_set_keyboard(uint8_t fun_key, uint8_t key)
{
uint8_t *p = hid.keyboard_in_buf;
p[0] = fun_key;
p[1] = 0x00; /* reserved */
p[2] = key;
p[3] = 0;
p[4] = 0;
p[5] = 0;
p[6] = 0;
p[7] = 0;
usbd_ep_write(USBD_HID0_EP_INTIN, hid.keyboard_in_buf, 8);
return CH_OK;
}
void usbd_hid_set_cb(struct usbd_hid_callback_t *cb)
{
hid.cb = cb;
}
void usbd_hid_init(struct usbd_t *h, uint32_t intf_cnt)
{
hid.h = h;
uint8_t *p;
struct uconfig_descriptor *uconfiguration_descriptor;
desc_t d;
get_descriptor_data("configuration_descriptor", &d);
uconfiguration_descriptor = (struct uconfig_descriptor *)d.buf;
uconfiguration_descriptor->bLength = USB_DESC_LENGTH_CONFIG;
uconfiguration_descriptor->type = USB_DESC_TYPE_CONFIGURATION;
uconfiguration_descriptor->wTotalLength = USB_DESC_LENGTH_CONFIG;
uconfiguration_descriptor->bNumInterfaces = intf_cnt; /* hid interface num */
uconfiguration_descriptor->bConfigurationValue = 1;
uconfiguration_descriptor->iConfiguration = 0;
uconfiguration_descriptor->bmAttributes = 0x80;
uconfiguration_descriptor->MaxPower = 0x32;
p = uconfiguration_descriptor->data;
get_descriptor_data("hid0_descriptor", &d);
memcpy(p, d.buf, d.len);
p += d.len;
uconfiguration_descriptor->wTotalLength += d.len;
if(intf_cnt == 2)
{
get_descriptor_data("hid1_descriptor", &d);
memcpy(p, d.buf, d.len);
p += d.len;
uconfiguration_descriptor->wTotalLength += d.len;
}
if(intf_cnt == 3)
{
get_descriptor_data("hid2_descriptor", &d);
memcpy(p, d.buf, d.len);
p += d.len;
uconfiguration_descriptor->wTotalLength += d.len;
}
/* install class callback */
hid.h->class_request_handler = hid_class_request_handler;
hid.h->standard_request_to_intf_handler = hid_standard_request_to_intf_handler;
hid.h->data_ep_handler = hid_data_ep_handler;
hid.h->setup_out_data_received_handler = NULL;
hid.h->vender_request_handler = NULL;
}
|
<reponame>Decipher/druxt.js<gh_stars>10-100
export default () => ({
// Main menu items.
menu: [{
component: "NuxtLink",
text: "Home",
icon: "home",
props: { to: "/" },
children: [],
},
{
component: "NuxtLink",
text: "Modules",
icon: "modules",
props: { to: "/modules" },
children: [],
},
{
component: "NuxtLink",
text: "Guide",
icon: "guide",
props: { to: "/guide" },
children: [],
},
{
component: "NuxtLink",
text: "API",
icon: "api",
props: { to: "/api" },
children: [],
},
{
component: "a",
text: "GitHub",
icon: "external",
props: {
href: "https://github.com/druxt/druxt.js",
target: "_blank",
},
children: [],
},
{
component: "a",
text: "Discord",
icon: "external",
props: {
href: "https://discord.druxtjs.org",
target: "_blank",
},
children: [],
}],
// Druxt modules.
modules: [],
// Recently opened documents.
recent: [],
})
|
#include "../../crypto/symhacks.h"
|
#!/usr/bin/env bash
VERSION=$1
BUILD_DATE=$2
NAMESPACE=$3
PUSH_IMAGE="${4:-false}"
BROWSER=$5
TAG_VERSION=${VERSION}-${BUILD_DATE}
function short_version() {
local __long_version=$1
local __version_split=( ${__long_version//./ } )
echo "${__version_split[0]}.${__version_split[1]}"
}
echo "Tagging images for browser ${BROWSER}, version ${VERSION}, build date ${BUILD_DATE}, namespace ${NAMESPACE}"
case "${BROWSER}" in
chrome)
CHROME_VERSION=$(docker run --rm selenium/node-chrome:${TAG_VERSION} google-chrome --version | awk '{print $3}')
echo "Chrome version -> "${CHROME_VERSION}
CHROME_SHORT_VERSION="$(short_version ${CHROME_VERSION})"
echo "Short Chrome version -> "${CHROME_SHORT_VERSION}
CHROMEDRIVER_VERSION=$(docker run --rm selenium/node-chrome:${TAG_VERSION} chromedriver --version | awk '{print $2}')
echo "ChromeDriver version -> "${CHROMEDRIVER_VERSION}
CHROMEDRIVER_SHORT_VERSION="$(short_version ${CHROMEDRIVER_VERSION})"
echo "Short ChromeDriver version -> "${CHROMEDRIVER_SHORT_VERSION}
CHROME_TAGS=(
${CHROME_VERSION}-chromedriver-${CHROMEDRIVER_VERSION}-grid-${TAG_VERSION}
# Browser version and browser driver version plus build date
${CHROME_VERSION}-chromedriver-${CHROMEDRIVER_VERSION}-${BUILD_DATE}
# Browser version and browser driver version
${CHROME_VERSION}-chromedriver-${CHROMEDRIVER_VERSION}
# Browser version and build date
${CHROME_VERSION}-${BUILD_DATE}
# Browser version
${CHROME_VERSION}
## Short versions
${CHROME_SHORT_VERSION}-chromedriver-${CHROMEDRIVER_SHORT_VERSION}-grid-${TAG_VERSION}
# Browser version and browser driver version plus build date
${CHROME_SHORT_VERSION}-chromedriver-${CHROMEDRIVER_SHORT_VERSION}-${BUILD_DATE}
# Browser version and browser driver version
${CHROME_SHORT_VERSION}-chromedriver-${CHROMEDRIVER_SHORT_VERSION}
# Browser version and build date
${CHROME_SHORT_VERSION}-${BUILD_DATE}
# Browser version
${CHROME_SHORT_VERSION}
)
for chrome_tag in "${CHROME_TAGS[@]}"
do
docker tag ${NAMESPACE}/node-chrome:${TAG_VERSION} ${NAMESPACE}/node-chrome:${chrome_tag}
docker tag ${NAMESPACE}/standalone-chrome:${TAG_VERSION} ${NAMESPACE}/standalone-chrome:${chrome_tag}
if [ "${PUSH_IMAGE}" = true ]; then
docker push ${NAMESPACE}/node-chrome:${chrome_tag}
docker push ${NAMESPACE}/standalone-chrome:${chrome_tag}
fi
done
;;
firefox)
FIREFOX_VERSION=$(docker run --rm selenium/node-firefox:${TAG_VERSION} firefox --version | awk '{print $3}')
echo "Firefox version -> "${FIREFOX_VERSION}
FIREFOX_SHORT_VERSION="$(short_version ${FIREFOX_VERSION})"
echo "Short Firefox version -> "${FIREFOX_SHORT_VERSION}
GECKODRIVER_VERSION=$(docker run --rm selenium/node-firefox:${TAG_VERSION} geckodriver --version | awk 'NR==1{print $2}')
echo "GeckoDriver version -> "${GECKODRIVER_VERSION}
GECKODRIVER_SHORT_VERSION="$(short_version ${GECKODRIVER_VERSION})"
echo "Short GeckoDriver version -> "${GECKODRIVER_SHORT_VERSION}
FIREFOX_TAGS=(
${FIREFOX_VERSION}-geckodriver-${GECKODRIVER_VERSION}-grid-${TAG_VERSION}
# Browser version and browser driver version plus build date
${FIREFOX_VERSION}-geckodriver-${GECKODRIVER_VERSION}-${BUILD_DATE}
# Browser version and browser driver version
${FIREFOX_VERSION}-geckodriver-${GECKODRIVER_VERSION}
# Browser version and build date
${FIREFOX_VERSION}-${BUILD_DATE}
# Browser version
${FIREFOX_VERSION}
## Short versions
${FIREFOX_SHORT_VERSION}-geckodriver-${GECKODRIVER_SHORT_VERSION}-grid-${TAG_VERSION}
# Browser version and browser driver version plus build date
${FIREFOX_SHORT_VERSION}-geckodriver-${GECKODRIVER_SHORT_VERSION}-${BUILD_DATE}
# Browser version and browser driver version
${FIREFOX_SHORT_VERSION}-geckodriver-${GECKODRIVER_SHORT_VERSION}
# Browser version and build date
${FIREFOX_SHORT_VERSION}-${BUILD_DATE}
# Browser version
${FIREFOX_SHORT_VERSION}
)
for firefox_tag in "${FIREFOX_TAGS[@]}"
do
docker tag ${NAMESPACE}/node-firefox:${TAG_VERSION} ${NAMESPACE}/node-firefox:${firefox_tag}
docker tag ${NAMESPACE}/standalone-firefox:${TAG_VERSION} ${NAMESPACE}/standalone-firefox:${firefox_tag}
if [ "${PUSH_IMAGE}" = true ]; then
docker push ${NAMESPACE}/node-firefox:${firefox_tag}
docker push ${NAMESPACE}/standalone-firefox:${firefox_tag}
fi
done
;;
opera)
OPERA_VERSION=$(docker run --rm selenium/node-opera:${TAG_VERSION} opera --version)
echo "Opera version -> "${OPERA_VERSION}
OPERA_SHORT_VERSION="$(short_version ${OPERA_VERSION})"
echo "Short Opera version -> "${OPERA_SHORT_VERSION}
OPERADRIVER_VERSION=$(docker run --rm selenium/node-opera:${TAG_VERSION} operadriver --version | awk 'NR==1{print $2}')
echo "OperaDriver version -> "${OPERADRIVER_VERSION}
OPERADRIVER_SHORT_VERSION="$(short_version ${OPERADRIVER_VERSION})"
echo "Short OperaDriver version -> "${OPERADRIVER_SHORT_VERSION}
OPERA_TAGS=(
${OPERA_VERSION}-operadriver-${OPERADRIVER_VERSION}-grid-${TAG_VERSION}
# Browser version and browser driver version plus build date
${OPERA_VERSION}-operadriver-${OPERADRIVER_VERSION}-${BUILD_DATE}
# Browser version and browser driver version
${OPERA_VERSION}-operadriver-${OPERADRIVER_VERSION}
# Browser version and build date
${OPERA_VERSION}-${BUILD_DATE}
# Browser version
${OPERA_VERSION}
## Short versions
${OPERA_SHORT_VERSION}-operadriver-${OPERADRIVER_SHORT_VERSION}-grid-${TAG_VERSION}
# Browser version and browser driver version plus build date
${OPERA_SHORT_VERSION}-operadriver-${OPERADRIVER_SHORT_VERSION}-${BUILD_DATE}
# Browser version and browser driver version
${OPERA_SHORT_VERSION}-operadriver-${OPERADRIVER_SHORT_VERSION}
# Browser version and build date
${OPERA_SHORT_VERSION}-${BUILD_DATE}
# Browser version
${OPERA_SHORT_VERSION}
)
for opera_tag in "${OPERA_TAGS[@]}"
do
docker tag ${NAMESPACE}/node-opera:${TAG_VERSION} ${NAMESPACE}/node-opera:${opera_tag}
docker tag ${NAMESPACE}/standalone-opera:${TAG_VERSION} ${NAMESPACE}/standalone-opera:${opera_tag}
if [ "${PUSH_IMAGE}" = true ]; then
docker push ${NAMESPACE}/node-opera:${opera_tag}
docker push ${NAMESPACE}/standalone-opera:${opera_tag}
fi
done
;;
*)
echo "Unknown browser!"
;;
esac
|
<gh_stars>0
from rest_framework import serializers
from mysign_app.models import Company, DoorDevice, User
class CompanySerializer(serializers.ModelSerializer):
class Meta:
model = Company
fields = ['name', 'email', 'phone_number', 'id']
class DoorDeviceSerializer(serializers.ModelSerializer):
company = CompanySerializer()
class Meta:
model = DoorDevice
fields = ['id', 'company']
class UserSerializer(serializers.ModelSerializer):
company = CompanySerializer()
name = serializers.SerializerMethodField('get_full_name')
def get_full_name(self, obj):
return obj.get_full_name()
class Meta:
model = User
fields = ['id', 'name', 'first_name', 'last_name', 'email', 'company', 'is_admin']
|
import re
def count_syllables(word):
pattern = r'[aeiouy]+'
return len(re.findall(pattern, word))
print(count_syllables('syllable')) # 3
print(count_syllables('balloons')) # 2 |
#!/bin/sh
# SUMMARY: Check that a partition on a GPT partitioned disk can be extended
# LABELS:
# REPEAT:
set -ex
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME_CREATE=create-gpt
NAME_EXTEND=extend-gpt
DISK=disk.img
clean_up() {
rm -rf ${NAME_CREATE}-* ${NAME_EXTEND}-* ${DISK}
}
trap clean_up EXIT
# Test code goes here
linuxkit build -name "${NAME_CREATE}" -format kernel+initrd test-create.yml
linuxkit run -disk file="${DISK}",format=raw,size=256M "${NAME_CREATE}"
[ -f "${DISK}" ] || exit 1
# osx takes issue with bs=1M
dd if=/dev/zero bs=1048576 count=256 >> "${DISK}"
linuxkit build -format kernel+initrd -name ${NAME_EXTEND} test.yml
RESULT="$(linuxkit run -disk file=${DISK} ${NAME_EXTEND})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0
|
def capitalize_words(string):
words = string.split(' ')
capitalized_words = [word.capitalize() for word in words]
return ' '.join(capitalized_words)
print(capitalize_words('enter the dragon')) |
var db = require("./db_config");
db.connect(function(err) {
if (err) throw err;
let sql = `CREATE TABLE mahasiswa
(
id int NOT NULL AUTO_INCREMENT,
name VARCHAR(255),
nrp VARCHAR(255),
jurusan VARCHAR(255),
angkatan VARCHAR(255),
foto LONGBLOB,
PRIMARY KEY (id)
)`;
db.query(sql, function(err, result) {
if (err) throw err;
console.log("table created")
});
}); |
#!/usr/bin/env bats
@test "when the command is run without specifing a pod it returns an error" {
run ./kubectl-capture
[ "$status" -eq 1 ]
}
|
@app.route('/data', methods=['GET'])
def get_data():
data = {
'key1': 'value1',
'key2': 'value2',
'key3': 'value3'
}
return jsonify(data) |
#!/bin/bash
set -e
cd $(dirname $0)
if [[ "$1" = "" ]]
then
echo "Usage: update-all.sh tzdb-release-number"
echo "e.g. update-all.sh 2013h"
exit 1
fi
./update-master.sh $1
rm -rf tmp-gcs
rm -rf tmp-nuget
mkdir tmp-gcs
mkdir tmp-nuget
for version in 2.4 3.0
do
echo "Updating ${version}"
./update-${version}.sh $1
(cd tmp-$version/nodatime; git push origin ${version}.x; git push --tags origin)
cp tmp-$version/output/*.zip tmp-gcs
cp tmp-$version/output/*.nupkg tmp-nuget
done
echo "Copying files to storage"
(cd tmp-gcs; gsutil.cmd cp *.zip gs://nodatime/releases)
gsutil.cmd cp ../../src/NodaTime/TimeZones/Tzdb.nzd gs://nodatime/tzdb/tzdb$1.nzd
echo "Hashing files"
dotnet run -p ../HashStorageFiles
# Symbol packages appear to be ineffective at the moment; best to just
# remove them (if any are even created; we don't use them now).
rm -f tmp-nuget/*.symbols.nupkg
echo "Remaining task - push nuget files:"
echo "cd tmp-nupkg"
echo "for pkg in *.nupkg; do dotnet nuget push -s https://api.nuget.org/v3/index.json -k API_KEY_HERE \$pkg; done"
|
#!ic-repl -r http://localhost:8000
// service address
import S = "rwlgt-iiaaa-aaaaa-aaaaa-cai";
identity Alice;
call S.test ();
assert _ != (null : opt null);
|
# -*- encoding: binary -*-
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/urandom', __FILE__)
ruby_version_is "2.5" do
describe "Random.urandom" do
it_behaves_like :random_urandom, :urandom
end
end
|
package io.stargate.web.docsapi.service.query.condition.impl;
import static org.assertj.core.api.Assertions.assertThat;
import io.stargate.db.datastore.Row;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class ExistsConditionTest {
@Nested
class Constructor {
@Test
public void assertPropsTrue() {
ExistsCondition condition = ImmutableExistsCondition.of(true);
assertThat(condition.isPersistenceCondition()).isTrue();
assertThat(condition.isEvaluateOnMissingFields()).isFalse();
assertThat(condition.getBuiltCondition()).isEmpty();
}
@Test
public void assertPropsFalse() {
ExistsCondition condition = ImmutableExistsCondition.of(false);
assertThat(condition.isPersistenceCondition()).isFalse();
assertThat(condition.isEvaluateOnMissingFields()).isTrue();
assertThat(condition.getBuiltCondition()).isEmpty();
}
}
@Nested
class DoTest {
@Mock Row row;
@Test
public void existsTrue() {
ExistsCondition condition = ImmutableExistsCondition.of(true);
assertThat(condition.test(row)).isTrue();
}
@Test
public void assertPropsFalse() {
ExistsCondition condition = ImmutableExistsCondition.of(false);
assertThat(condition.test(row)).isFalse();
}
}
@Nested
class Negation {
@ParameterizedTest
@CsvSource({"true", "false"})
void simple(boolean queryValue) {
ExistsCondition condition = ImmutableExistsCondition.of(queryValue);
assertThat(condition.negate())
.isInstanceOfSatisfying(
ExistsCondition.class,
negated -> {
assertThat(negated.getQueryValue()).isEqualTo(!queryValue);
});
}
}
}
|
package org.usfirst.frc.team2706.robot.vision;
import java.util.function.Supplier;
import org.usfirst.frc.team2706.robot.JoystickMap;
import org.usfirst.frc.team2706.robot.LoggedCommand;
import org.usfirst.frc.team2706.robot.Robot;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj.PIDController;
import edu.wpi.first.wpilibj.PIDSource;
import edu.wpi.first.wpilibj.PIDSourceType;
/**
* Drives the robot in a straight line towards the target found by the camera. Used for lining up
* the peg at short distances
*/
public class FollowCamera extends LoggedCommand {
private final PIDController rotatePid;
private final double P = 0.75, I = 0.0, D = 0.0;
/**
* Drive at the speed of an axis on the driver joystick using the camera to control rotation
*/
public FollowCamera() {
this(() -> -Robot.oi.getDriverJoystick().getRawAxis(JoystickMap.XBOX_LEFT_AXIS_Y));
}
/**
* Drive at a constant speed using the camera to control rotation
*
* @param speed The speed to drive forward at
*/
public FollowCamera(double speed) {
this(() -> speed);
}
/**
* Drive at a supplied speed using the camera to control rotation
*
* @param speed The supplied speed to drive forward at
*/
public FollowCamera(Supplier<Double> forwardSpeed) {
requires(Robot.driveTrain);
rotatePid = new PIDController(P, I, D, new CameraPID(),
Robot.driveTrain.getDrivePIDOutput(false, true, forwardSpeed, false));
// SmartDashboard.putNumber("P", SmartDashboard.getNumber("P", P));
// SmartDashboard.putNumber("I", SmartDashboard.getNumber("I", I));
// SmartDashboard.putNumber("D", SmartDashboard.getNumber("D", D));
}
private class CameraPID implements PIDSource {
private PIDSourceType pidSource = PIDSourceType.kDisplacement;
private final NetworkTableEntry ctrX;
private final NetworkTableEntry numTargetsFound;
{
NetworkTable table = NetworkTableInstance.getDefault().getTable("vision");
ctrX = table.getEntry("ctrX");
numTargetsFound = table.getEntry("numTargetsFound");
}
@Override
public void setPIDSourceType(PIDSourceType pidSource) {
this.pidSource = pidSource;
}
@Override
public PIDSourceType getPIDSourceType() {
return pidSource;
}
@Override
public double pidGet() {
return numTargetsFound.getDouble(0) > 0 ? -ctrX.getDouble(0) : 0;
}
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
// rotatePid.setP(SmartDashboard.getNumber("P", P));
// rotatePid.setI(SmartDashboard.getNumber("I", I));
// rotatePid.setD(SmartDashboard.getNumber("D", D));
rotatePid.setOutputRange(-0.5, 0.5);
rotatePid.setSetpoint(0);
rotatePid.enable();
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}
// Called once after isFinished returns true
@Override
protected void end() {
rotatePid.disable();
// Robot.camera.enableRingLight(false);
Robot.driveTrain.brakeMode(false);
// Disable PID output and stop robot to be safe
Robot.driveTrain.drive(0, 0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
end();
}
}
|
<gh_stars>10-100
/**
* GDAL utilities.
*/
package io.opensphere.core.util.gdal;
|
<reponame>vconerd/unsplashit<filename>src/store/modules/SelectionData.js
export const namespaced = true;
export const state = {
selected: []
};
export const getters = {
getSelectedItemPosition: state => id => {
return state.selected.findIndex(elem => elem.id === id);
}
};
export const mutations = {
SELECT(state, payload) {
let posItem = payload.posItem;
let item = payload.seleccionado;
if (posItem >= 0) {
// deseleccionar: eliminar el item del arreglo
state.selected.splice(posItem, 1);
} else {
// seleccionar: agregar el item al arreglo
state.selected.push(item);
}
}
};
export const actions = {
seleccionar({ commit, getters }, itemToSelect) {
let posItem = getters.getSelectedItemPosition(itemToSelect.id);
let seleccionado = { ...itemToSelect };
let payload = { seleccionado, posItem };
commit("SELECT", payload);
}
};
|
<reponame>rzf45/98fmplayer
static const uint16_t window[8192] = {
5242, 5242, 5242, 5242, 5243, 5243, 5243, 5243,
5243, 5243, 5243, 5243, 5244, 5244, 5244, 5244,
5245, 5245, 5245, 5246, 5246, 5246, 5247, 5247,
5247, 5248, 5248, 5249, 5249, 5250, 5250, 5251,
5251, 5252, 5253, 5253, 5254, 5255, 5255, 5256,
5257, 5257, 5258, 5259, 5260, 5260, 5261, 5262,
5263, 5264, 5265, 5265, 5266, 5267, 5268, 5269,
5270, 5271, 5272, 5273, 5274, 5275, 5276, 5278,
5279, 5280, 5281, 5282, 5283, 5285, 5286, 5287,
5288, 5290, 5291, 5292, 5294, 5295, 5296, 5298,
5299, 5301, 5302, 5303, 5305, 5306, 5308, 5309,
5311, 5313, 5314, 5316, 5317, 5319, 5321, 5322,
5324, 5326, 5328, 5329, 5331, 5333, 5335, 5336,
5338, 5340, 5342, 5344, 5346, 5348, 5350, 5352,
5354, 5356, 5358, 5360, 5362, 5364, 5366, 5368,
5370, 5372, 5374, 5376, 5379, 5381, 5383, 5385,
5388, 5390, 5392, 5394, 5397, 5399, 5401, 5404,
5406, 5409, 5411, 5414, 5416, 5419, 5421, 5424,
5426, 5429, 5431, 5434, 5436, 5439, 5442, 5444,
5447, 5450, 5452, 5455, 5458, 5461, 5464, 5466,
5469, 5472, 5475, 5478, 5481, 5484, 5486, 5489,
5492, 5495, 5498, 5501, 5504, 5507, 5511, 5514,
5517, 5520, 5523, 5526, 5529, 5532, 5536, 5539,
5542, 5545, 5549, 5552, 5555, 5559, 5562, 5565,
5569, 5572, 5576, 5579, 5582, 5586, 5589, 5593,
5596, 5600, 5604, 5607, 5611, 5614, 5618, 5622,
5625, 5629, 5633, 5636, 5640, 5644, 5648, 5651,
5655, 5659, 5663, 5667, 5671, 5675, 5678, 5682,
5686, 5690, 5694, 5698, 5702, 5706, 5710, 5714,
5719, 5723, 5727, 5731, 5735, 5739, 5743, 5748,
5752, 5756, 5760, 5765, 5769, 5773, 5778, 5782,
5786, 5791, 5795, 5799, 5804, 5808, 5813, 5817,
5822, 5826, 5831, 5835, 5840, 5845, 5849, 5854,
5858, 5863, 5868, 5872, 5877, 5882, 5887, 5891,
5896, 5901, 5906, 5911, 5915, 5920, 5925, 5930,
5935, 5940, 5945, 5950, 5955, 5960, 5965, 5970,
5975, 5980, 5985, 5990, 5995, 6001, 6006, 6011,
6016, 6021, 6027, 6032, 6037, 6042, 6048, 6053,
6058, 6064, 6069, 6074, 6080, 6085, 6091, 6096,
6102, 6107, 6113, 6118, 6124, 6129, 6135, 6140,
6146, 6152, 6157, 6163, 6169, 6174, 6180, 6186,
6192, 6197, 6203, 6209, 6215, 6221, 6226, 6232,
6238, 6244, 6250, 6256, 6262, 6268, 6274, 6280,
6286, 6292, 6298, 6304, 6310, 6316, 6322, 6329,
6335, 6341, 6347, 6353, 6359, 6366, 6372, 6378,
6385, 6391, 6397, 6404, 6410, 6416, 6423, 6429,
6436, 6442, 6448, 6455, 6461, 6468, 6475, 6481,
6488, 6494, 6501, 6507, 6514, 6521, 6527, 6534,
6541, 6548, 6554, 6561, 6568, 6575, 6581, 6588,
6595, 6602, 6609, 6616, 6623, 6630, 6636, 6643,
6650, 6657, 6664, 6671, 6678, 6686, 6693, 6700,
6707, 6714, 6721, 6728, 6735, 6743, 6750, 6757,
6764, 6772, 6779, 6786, 6793, 6801, 6808, 6815,
6823, 6830, 6838, 6845, 6853, 6860, 6868, 6875,
6883, 6890, 6898, 6905, 6913, 6920, 6928, 6936,
6943, 6951, 6959, 6966, 6974, 6982, 6990, 6997,
7005, 7013, 7021, 7029, 7036, 7044, 7052, 7060,
7068, 7076, 7084, 7092, 7100, 7108, 7116, 7124,
7132, 7140, 7148, 7156, 7164, 7172, 7180, 7189,
7197, 7205, 7213, 7221, 7230, 7238, 7246, 7255,
7263, 7271, 7280, 7288, 7296, 7305, 7313, 7322,
7330, 7338, 7347, 7355, 7364, 7373, 7381, 7390,
7398, 7407, 7415, 7424, 7433, 7441, 7450, 7459,
7467, 7476, 7485, 7494, 7502, 7511, 7520, 7529,
7538, 7547, 7555, 7564, 7573, 7582, 7591, 7600,
7609, 7618, 7627, 7636, 7645, 7654, 7663, 7672,
7681, 7691, 7700, 7709, 7718, 7727, 7736, 7746,
7755, 7764, 7773, 7783, 7792, 7801, 7811, 7820,
7829, 7839, 7848, 7857, 7867, 7876, 7886, 7895,
7905, 7914, 7924, 7933, 7943, 7952, 7962, 7972,
7981, 7991, 8001, 8010, 8020, 8030, 8039, 8049,
8059, 8069, 8078, 8088, 8098, 8108, 8118, 8128,
8137, 8147, 8157, 8167, 8177, 8187, 8197, 8207,
8217, 8227, 8237, 8247, 8257, 8267, 8277, 8288,
8298, 8308, 8318, 8328, 8338, 8349, 8359, 8369,
8379, 8390, 8400, 8410, 8421, 8431, 8441, 8452,
8462, 8472, 8483, 8493, 8504, 8514, 8525, 8535,
8546, 8556, 8567, 8577, 8588, 8599, 8609, 8620,
8630, 8641, 8652, 8662, 8673, 8684, 8695, 8705,
8716, 8727, 8738, 8749, 8759, 8770, 8781, 8792,
8803, 8814, 8825, 8836, 8847, 8858, 8869, 8880,
8891, 8902, 8913, 8924, 8935, 8946, 8957, 8968,
8979, 8990, 9002, 9013, 9024, 9035, 9047, 9058,
9069, 9080, 9092, 9103, 9114, 9126, 9137, 9148,
9160, 9171, 9183, 9194, 9205, 9217, 9228, 9240,
9251, 9263, 9275, 9286, 9298, 9309, 9321, 9332,
9344, 9356, 9367, 9379, 9391, 9403, 9414, 9426,
9438, 9450, 9461, 9473, 9485, 9497, 9509, 9521,
9532, 9544, 9556, 9568, 9580, 9592, 9604, 9616,
9628, 9640, 9652, 9664, 9676, 9688, 9700, 9712,
9725, 9737, 9749, 9761, 9773, 9785, 9798, 9810,
9822, 9834, 9847, 9859, 9871, 9884, 9896, 9908,
9921, 9933, 9945, 9958, 9970, 9983, 9995, 10008,
10020, 10033, 10045, 10058, 10070, 10083, 10095, 10108,
10121, 10133, 10146, 10158, 10171, 10184, 10196, 10209,
10222, 10235, 10247, 10260, 10273, 10286, 10299, 10311,
10324, 10337, 10350, 10363, 10376, 10389, 10402, 10414,
10427, 10440, 10453, 10466, 10479, 10492, 10506, 10519,
10532, 10545, 10558, 10571, 10584, 10597, 10610, 10624,
10637, 10650, 10663, 10676, 10690, 10703, 10716, 10730,
10743, 10756, 10770, 10783, 10796, 10810, 10823, 10836,
10850, 10863, 10877, 10890, 10904, 10917, 10931, 10944,
10958, 10971, 10985, 10999, 11012, 11026, 11039, 11053,
11067, 11080, 11094, 11108, 11121, 11135, 11149, 11163,
11176, 11190, 11204, 11218, 11232, 11245, 11259, 11273,
11287, 11301, 11315, 11329, 11343, 11357, 11371, 11385,
11399, 11413, 11427, 11441, 11455, 11469, 11483, 11497,
11511, 11525, 11539, 11554, 11568, 11582, 11596, 11610,
11625, 11639, 11653, 11667, 11682, 11696, 11710, 11724,
11739, 11753, 11767, 11782, 11796, 11811, 11825, 11840,
11854, 11868, 11883, 11897, 11912, 11926, 11941, 11955,
11970, 11985, 11999, 12014, 12028, 12043, 12058, 12072,
12087, 12102, 12116, 12131, 12146, 12160, 12175, 12190,
12205, 12220, 12234, 12249, 12264, 12279, 12294, 12309,
12323, 12338, 12353, 12368, 12383, 12398, 12413, 12428,
12443, 12458, 12473, 12488, 12503, 12518, 12533, 12548,
12563, 12579, 12594, 12609, 12624, 12639, 12654, 12669,
12685, 12700, 12715, 12730, 12746, 12761, 12776, 12792,
12807, 12822, 12837, 12853, 12868, 12884, 12899, 12914,
12930, 12945, 12961, 12976, 12992, 13007, 13023, 13038,
13054, 13069, 13085, 13100, 13116, 13131, 13147, 13163,
13178, 13194, 13210, 13225, 13241, 13257, 13272, 13288,
13304, 13320, 13335, 13351, 13367, 13383, 13398, 13414,
13430, 13446, 13462, 13478, 13494, 13510, 13525, 13541,
13557, 13573, 13589, 13605, 13621, 13637, 13653, 13669,
13685, 13701, 13717, 13734, 13750, 13766, 13782, 13798,
13814, 13830, 13846, 13863, 13879, 13895, 13911, 13927,
13944, 13960, 13976, 13993, 14009, 14025, 14041, 14058,
14074, 14091, 14107, 14123, 14140, 14156, 14172, 14189,
14205, 14222, 14238, 14255, 14271, 14288, 14304, 14321,
14337, 14354, 14371, 14387, 14404, 14420, 14437, 14454,
14470, 14487, 14504, 14520, 14537, 14554, 14570, 14587,
14604, 14621, 14637, 14654, 14671, 14688, 14705, 14721,
14738, 14755, 14772, 14789, 14806, 14823, 14840, 14856,
14873, 14890, 14907, 14924, 14941, 14958, 14975, 14992,
15009, 15026, 15043, 15060, 15078, 15095, 15112, 15129,
15146, 15163, 15180, 15197, 15215, 15232, 15249, 15266,
15283, 15301, 15318, 15335, 15353, 15370, 15387, 15404,
15422, 15439, 15456, 15474, 15491, 15508, 15526, 15543,
15561, 15578, 15596, 15613, 15630, 15648, 15665, 15683,
15700, 15718, 15735, 15753, 15771, 15788, 15806, 15823,
15841, 15858, 15876, 15894, 15911, 15929, 15947, 15964,
15982, 16000, 16018, 16035, 16053, 16071, 16088, 16106,
16124, 16142, 16160, 16177, 16195, 16213, 16231, 16249,
16267, 16285, 16302, 16320, 16338, 16356, 16374, 16392,
16410, 16428, 16446, 16464, 16482, 16500, 16518, 16536,
16554, 16572, 16590, 16608, 16626, 16645, 16663, 16681,
16699, 16717, 16735, 16753, 16772, 16790, 16808, 16826,
16844, 16863, 16881, 16899, 16917, 16936, 16954, 16972,
16991, 17009, 17027, 17046, 17064, 17082, 17101, 17119,
17138, 17156, 17174, 17193, 17211, 17230, 17248, 17267,
17285, 17304, 17322, 17341, 17359, 17378, 17396, 17415,
17433, 17452, 17471, 17489, 17508, 17526, 17545, 17564,
17582, 17601, 17620, 17638, 17657, 17676, 17695, 17713,
17732, 17751, 17769, 17788, 17807, 17826, 17845, 17863,
17882, 17901, 17920, 17939, 17958, 17977, 17995, 18014,
18033, 18052, 18071, 18090, 18109, 18128, 18147, 18166,
18185, 18204, 18223, 18242, 18261, 18280, 18299, 18318,
18337, 18356, 18375, 18394, 18413, 18432, 18452, 18471,
18490, 18509, 18528, 18547, 18567, 18586, 18605, 18624,
18643, 18663, 18682, 18701, 18720, 18740, 18759, 18778,
18798, 18817, 18836, 18856, 18875, 18894, 18914, 18933,
18952, 18972, 18991, 19011, 19030, 19049, 19069, 19088,
19108, 19127, 19147, 19166, 19186, 19205, 19225, 19244,
19264, 19283, 19303, 19322, 19342, 19362, 19381, 19401,
19420, 19440, 19460, 19479, 19499, 19519, 19538, 19558,
19578, 19597, 19617, 19637, 19656, 19676, 19696, 19716,
19735, 19755, 19775, 19795, 19814, 19834, 19854, 19874,
19894, 19914, 19933, 19953, 19973, 19993, 20013, 20033,
20053, 20073, 20093, 20113, 20132, 20152, 20172, 20192,
20212, 20232, 20252, 20272, 20292, 20312, 20332, 20352,
20372, 20392, 20413, 20433, 20453, 20473, 20493, 20513,
20533, 20553, 20573, 20594, 20614, 20634, 20654, 20674,
20694, 20715, 20735, 20755, 20775, 20795, 20816, 20836,
20856, 20876, 20897, 20917, 20937, 20958, 20978, 20998,
21019, 21039, 21059, 21080, 21100, 21120, 21141, 21161,
21181, 21202, 21222, 21243, 21263, 21284, 21304, 21324,
21345, 21365, 21386, 21406, 21427, 21447, 21468, 21488,
21509, 21529, 21550, 21570, 21591, 21612, 21632, 21653,
21673, 21694, 21715, 21735, 21756, 21776, 21797, 21818,
21838, 21859, 21880, 21900, 21921, 21942, 21962, 21983,
22004, 22025, 22045, 22066, 22087, 22108, 22128, 22149,
22170, 22191, 22211, 22232, 22253, 22274, 22295, 22316,
22336, 22357, 22378, 22399, 22420, 22441, 22462, 22482,
22503, 22524, 22545, 22566, 22587, 22608, 22629, 22650,
22671, 22692, 22713, 22734, 22755, 22776, 22797, 22818,
22839, 22860, 22881, 22902, 22923, 22944, 22965, 22986,
23007, 23028, 23049, 23071, 23092, 23113, 23134, 23155,
23176, 23197, 23218, 23240, 23261, 23282, 23303, 23324,
23346, 23367, 23388, 23409, 23430, 23452, 23473, 23494,
23515, 23537, 23558, 23579, 23600, 23622, 23643, 23664,
23686, 23707, 23728, 23750, 23771, 23792, 23814, 23835,
23856, 23878, 23899, 23920, 23942, 23963, 23985, 24006,
24028, 24049, 24070, 24092, 24113, 24135, 24156, 24178,
24199, 24221, 24242, 24264, 24285, 24307, 24328, 24350,
24371, 24393, 24414, 24436, 24457, 24479, 24500, 24522,
24543, 24565, 24587, 24608, 24630, 24651, 24673, 24695,
24716, 24738, 24760, 24781, 24803, 24825, 24846, 24868,
24890, 24911, 24933, 24955, 24976, 24998, 25020, 25041,
25063, 25085, 25107, 25128, 25150, 25172, 25194, 25215,
25237, 25259, 25281, 25302, 25324, 25346, 25368, 25390,
25412, 25433, 25455, 25477, 25499, 25521, 25543, 25564,
25586, 25608, 25630, 25652, 25674, 25696, 25718, 25739,
25761, 25783, 25805, 25827, 25849, 25871, 25893, 25915,
25937, 25959, 25981, 26003, 26025, 26047, 26069, 26091,
26113, 26135, 26157, 26179, 26201, 26223, 26245, 26267,
26289, 26311, 26333, 26355, 26377, 26399, 26421, 26443,
26465, 26488, 26510, 26532, 26554, 26576, 26598, 26620,
26642, 26664, 26687, 26709, 26731, 26753, 26775, 26797,
26820, 26842, 26864, 26886, 26908, 26930, 26953, 26975,
26997, 27019, 27042, 27064, 27086, 27108, 27130, 27153,
27175, 27197, 27219, 27242, 27264, 27286, 27309, 27331,
27353, 27375, 27398, 27420, 27442, 27465, 27487, 27509,
27532, 27554, 27576, 27599, 27621, 27643, 27666, 27688,
27710, 27733, 27755, 27777, 27800, 27822, 27845, 27867,
27889, 27912, 27934, 27957, 27979, 28001, 28024, 28046,
28069, 28091, 28114, 28136, 28158, 28181, 28203, 28226,
28248, 28271, 28293, 28316, 28338, 28361, 28383, 28406,
28428, 28451, 28473, 28496, 28518, 28541, 28563, 28586,
28608, 28631, 28653, 28676, 28698, 28721, 28744, 28766,
28789, 28811, 28834, 28856, 28879, 28902, 28924, 28947,
28969, 28992, 29014, 29037, 29060, 29082, 29105, 29128,
29150, 29173, 29195, 29218, 29241, 29263, 29286, 29309,
29331, 29354, 29377, 29399, 29422, 29445, 29467, 29490,
29513, 29535, 29558, 29581, 29603, 29626, 29649, 29671,
29694, 29717, 29740, 29762, 29785, 29808, 29830, 29853,
29876, 29899, 29921, 29944, 29967, 29990, 30012, 30035,
30058, 30081, 30103, 30126, 30149, 30172, 30195, 30217,
30240, 30263, 30286, 30308, 30331, 30354, 30377, 30400,
30422, 30445, 30468, 30491, 30514, 30537, 30559, 30582,
30605, 30628, 30651, 30674, 30696, 30719, 30742, 30765,
30788, 30811, 30833, 30856, 30879, 30902, 30925, 30948,
30971, 30994, 31016, 31039, 31062, 31085, 31108, 31131,
31154, 31177, 31200, 31222, 31245, 31268, 31291, 31314,
31337, 31360, 31383, 31406, 31429, 31452, 31475, 31497,
31520, 31543, 31566, 31589, 31612, 31635, 31658, 31681,
31704, 31727, 31750, 31773, 31796, 31819, 31842, 31865,
31888, 31911, 31934, 31957, 31980, 32003, 32025, 32048,
32071, 32094, 32117, 32140, 32163, 32186, 32209, 32232,
32255, 32278, 32301, 32324, 32347, 32370, 32393, 32416,
32439, 32462, 32485, 32509, 32532, 32555, 32578, 32601,
32624, 32647, 32670, 32693, 32716, 32739, 32762, 32785,
32808, 32831, 32854, 32877, 32900, 32923, 32946, 32969,
32992, 33015, 33038, 33061, 33084, 33108, 33131, 33154,
33177, 33200, 33223, 33246, 33269, 33292, 33315, 33338,
33361, 33384, 33407, 33430, 33454, 33477, 33500, 33523,
33546, 33569, 33592, 33615, 33638, 33661, 33684, 33707,
33731, 33754, 33777, 33800, 33823, 33846, 33869, 33892,
33915, 33938, 33962, 33985, 34008, 34031, 34054, 34077,
34100, 34123, 34146, 34169, 34193, 34216, 34239, 34262,
34285, 34308, 34331, 34354, 34377, 34401, 34424, 34447,
34470, 34493, 34516, 34539, 34562, 34585, 34609, 34632,
34655, 34678, 34701, 34724, 34747, 34770, 34794, 34817,
34840, 34863, 34886, 34909, 34932, 34955, 34978, 35002,
35025, 35048, 35071, 35094, 35117, 35140, 35163, 35187,
35210, 35233, 35256, 35279, 35302, 35325, 35348, 35372,
35395, 35418, 35441, 35464, 35487, 35510, 35533, 35557,
35580, 35603, 35626, 35649, 35672, 35695, 35718, 35742,
35765, 35788, 35811, 35834, 35857, 35880, 35903, 35927,
35950, 35973, 35996, 36019, 36042, 36065, 36088, 36112,
36135, 36158, 36181, 36204, 36227, 36250, 36273, 36296,
36320, 36343, 36366, 36389, 36412, 36435, 36458, 36481,
36504, 36528, 36551, 36574, 36597, 36620, 36643, 36666,
36689, 36712, 36736, 36759, 36782, 36805, 36828, 36851,
36874, 36897, 36920, 36943, 36966, 36990, 37013, 37036,
37059, 37082, 37105, 37128, 37151, 37174, 37197, 37220,
37244, 37267, 37290, 37313, 37336, 37359, 37382, 37405,
37428, 37451, 37474, 37497, 37520, 37544, 37567, 37590,
37613, 37636, 37659, 37682, 37705, 37728, 37751, 37774,
37797, 37820, 37843, 37866, 37889, 37912, 37935, 37958,
37982, 38005, 38028, 38051, 38074, 38097, 38120, 38143,
38166, 38189, 38212, 38235, 38258, 38281, 38304, 38327,
38350, 38373, 38396, 38419, 38442, 38465, 38488, 38511,
38534, 38557, 38580, 38603, 38626, 38649, 38672, 38695,
38718, 38741, 38764, 38787, 38810, 38833, 38856, 38879,
38902, 38925, 38948, 38971, 38994, 39017, 39039, 39062,
39085, 39108, 39131, 39154, 39177, 39200, 39223, 39246,
39269, 39292, 39315, 39338, 39361, 39384, 39406, 39429,
39452, 39475, 39498, 39521, 39544, 39567, 39590, 39613,
39636, 39658, 39681, 39704, 39727, 39750, 39773, 39796,
39819, 39841, 39864, 39887, 39910, 39933, 39956, 39979,
40002, 40024, 40047, 40070, 40093, 40116, 40139, 40161,
40184, 40207, 40230, 40253, 40276, 40298, 40321, 40344,
40367, 40390, 40412, 40435, 40458, 40481, 40504, 40526,
40549, 40572, 40595, 40618, 40640, 40663, 40686, 40709,
40731, 40754, 40777, 40800, 40822, 40845, 40868, 40891,
40913, 40936, 40959, 40981, 41004, 41027, 41050, 41072,
41095, 41118, 41140, 41163, 41186, 41209, 41231, 41254,
41277, 41299, 41322, 41345, 41367, 41390, 41413, 41435,
41458, 41481, 41503, 41526, 41549, 41571, 41594, 41616,
41639, 41662, 41684, 41707, 41730, 41752, 41775, 41797,
41820, 41842, 41865, 41888, 41910, 41933, 41955, 41978,
42001, 42023, 42046, 42068, 42091, 42113, 42136, 42158,
42181, 42203, 42226, 42248, 42271, 42293, 42316, 42339,
42361, 42384, 42406, 42428, 42451, 42473, 42496, 42518,
42541, 42563, 42586, 42608, 42631, 42653, 42676, 42698,
42720, 42743, 42765, 42788, 42810, 42833, 42855, 42877,
42900, 42922, 42945, 42967, 42989, 43012, 43034, 43056,
43079, 43101, 43123, 43146, 43168, 43191, 43213, 43235,
43258, 43280, 43302, 43324, 43347, 43369, 43391, 43414,
43436, 43458, 43481, 43503, 43525, 43547, 43570, 43592,
43614, 43636, 43659, 43681, 43703, 43725, 43747, 43770,
43792, 43814, 43836, 43859, 43881, 43903, 43925, 43947,
43969, 43992, 44014, 44036, 44058, 44080, 44102, 44124,
44147, 44169, 44191, 44213, 44235, 44257, 44279, 44301,
44323, 44346, 44368, 44390, 44412, 44434, 44456, 44478,
44500, 44522, 44544, 44566, 44588, 44610, 44632, 44654,
44676, 44698, 44720, 44742, 44764, 44786, 44808, 44830,
44852, 44874, 44896, 44918, 44940, 44962, 44984, 45006,
45027, 45049, 45071, 45093, 45115, 45137, 45159, 45181,
45203, 45224, 45246, 45268, 45290, 45312, 45334, 45355,
45377, 45399, 45421, 45443, 45465, 45486, 45508, 45530,
45552, 45573, 45595, 45617, 45639, 45660, 45682, 45704,
45726, 45747, 45769, 45791, 45812, 45834, 45856, 45878,
45899, 45921, 45943, 45964, 45986, 46008, 46029, 46051,
46072, 46094, 46116, 46137, 46159, 46180, 46202, 46224,
46245, 46267, 46288, 46310, 46331, 46353, 46375, 46396,
46418, 46439, 46461, 46482, 46504, 46525, 46547, 46568,
46590, 46611, 46632, 46654, 46675, 46697, 46718, 46740,
46761, 46783, 46804, 46825, 46847, 46868, 46889, 46911,
46932, 46954, 46975, 46996, 47018, 47039, 47060, 47082,
47103, 47124, 47145, 47167, 47188, 47209, 47231, 47252,
47273, 47294, 47316, 47337, 47358, 47379, 47401, 47422,
47443, 47464, 47485, 47506, 47528, 47549, 47570, 47591,
47612, 47633, 47655, 47676, 47697, 47718, 47739, 47760,
47781, 47802, 47823, 47844, 47865, 47886, 47907, 47929,
47950, 47971, 47992, 48013, 48034, 48055, 48076, 48097,
48117, 48138, 48159, 48180, 48201, 48222, 48243, 48264,
48285, 48306, 48327, 48348, 48368, 48389, 48410, 48431,
48452, 48473, 48494, 48514, 48535, 48556, 48577, 48598,
48618, 48639, 48660, 48681, 48701, 48722, 48743, 48764,
48784, 48805, 48826, 48847, 48867, 48888, 48909, 48929,
48950, 48971, 48991, 49012, 49032, 49053, 49074, 49094,
49115, 49135, 49156, 49177, 49197, 49218, 49238, 49259,
49279, 49300, 49320, 49341, 49361, 49382, 49402, 49423,
49443, 49464, 49484, 49505, 49525, 49545, 49566, 49586,
49607, 49627, 49647, 49668, 49688, 49708, 49729, 49749,
49769, 49790, 49810, 49830, 49851, 49871, 49891, 49912,
49932, 49952, 49972, 49993, 50013, 50033, 50053, 50073,
50094, 50114, 50134, 50154, 50174, 50194, 50215, 50235,
50255, 50275, 50295, 50315, 50335, 50355, 50375, 50395,
50415, 50436, 50456, 50476, 50496, 50516, 50536, 50556,
50576, 50596, 50615, 50635, 50655, 50675, 50695, 50715,
50735, 50755, 50775, 50795, 50815, 50834, 50854, 50874,
50894, 50914, 50934, 50953, 50973, 50993, 51013, 51033,
51052, 51072, 51092, 51112, 51131, 51151, 51171, 51190,
51210, 51230, 51250, 51269, 51289, 51308, 51328, 51348,
51367, 51387, 51407, 51426, 51446, 51465, 51485, 51504,
51524, 51543, 51563, 51582, 51602, 51621, 51641, 51660,
51680, 51699, 51719, 51738, 51758, 51777, 51796, 51816,
51835, 51855, 51874, 51893, 51913, 51932, 51951, 51971,
51990, 52009, 52029, 52048, 52067, 52086, 52106, 52125,
52144, 52163, 52183, 52202, 52221, 52240, 52259, 52278,
52298, 52317, 52336, 52355, 52374, 52393, 52412, 52431,
52450, 52469, 52489, 52508, 52527, 52546, 52565, 52584,
52603, 52622, 52641, 52660, 52678, 52697, 52716, 52735,
52754, 52773, 52792, 52811, 52830, 52849, 52867, 52886,
52905, 52924, 52943, 52961, 52980, 52999, 53018, 53037,
53055, 53074, 53093, 53111, 53130, 53149, 53168, 53186,
53205, 53224, 53242, 53261, 53279, 53298, 53317, 53335,
53354, 53372, 53391, 53409, 53428, 53446, 53465, 53483,
53502, 53520, 53539, 53557, 53576, 53594, 53613, 53631,
53650, 53668, 53686, 53705, 53723, 53741, 53760, 53778,
53796, 53815, 53833, 53851, 53870, 53888, 53906, 53924,
53943, 53961, 53979, 53997, 54015, 54034, 54052, 54070,
54088, 54106, 54124, 54142, 54160, 54179, 54197, 54215,
54233, 54251, 54269, 54287, 54305, 54323, 54341, 54359,
54377, 54395, 54413, 54431, 54449, 54466, 54484, 54502,
54520, 54538, 54556, 54574, 54592, 54609, 54627, 54645,
54663, 54681, 54698, 54716, 54734, 54752, 54769, 54787,
54805, 54822, 54840, 54858, 54875, 54893, 54911, 54928,
54946, 54963, 54981, 54999, 55016, 55034, 55051, 55069,
55086, 55104, 55121, 55139, 55156, 55174, 55191, 55208,
55226, 55243, 55261, 55278, 55295, 55313, 55330, 55347,
55365, 55382, 55399, 55417, 55434, 55451, 55469, 55486,
55503, 55520, 55537, 55555, 55572, 55589, 55606, 55623,
55640, 55658, 55675, 55692, 55709, 55726, 55743, 55760,
55777, 55794, 55811, 55828, 55845, 55862, 55879, 55896,
55913, 55930, 55947, 55964, 55981, 55998, 56014, 56031,
56048, 56065, 56082, 56099, 56115, 56132, 56149, 56166,
56182, 56199, 56216, 56233, 56249, 56266, 56283, 56299,
56316, 56333, 56349, 56366, 56382, 56399, 56416, 56432,
56449, 56465, 56482, 56498, 56515, 56531, 56548, 56564,
56581, 56597, 56614, 56630, 56646, 56663, 56679, 56696,
56712, 56728, 56745, 56761, 56777, 56793, 56810, 56826,
56842, 56859, 56875, 56891, 56907, 56923, 56940, 56956,
56972, 56988, 57004, 57020, 57036, 57052, 57068, 57085,
57101, 57117, 57133, 57149, 57165, 57181, 57197, 57213,
57229, 57244, 57260, 57276, 57292, 57308, 57324, 57340,
57356, 57371, 57387, 57403, 57419, 57435, 57450, 57466,
57482, 57498, 57513, 57529, 57545, 57560, 57576, 57592,
57607, 57623, 57639, 57654, 57670, 57685, 57701, 57716,
57732, 57748, 57763, 57779, 57794, 57809, 57825, 57840,
57856, 57871, 57887, 57902, 57917, 57933, 57948, 57963,
57979, 57994, 58009, 58025, 58040, 58055, 58070, 58086,
58101, 58116, 58131, 58146, 58162, 58177, 58192, 58207,
58222, 58237, 58252, 58267, 58282, 58297, 58312, 58327,
58342, 58357, 58372, 58387, 58402, 58417, 58432, 58447,
58462, 58477, 58492, 58506, 58521, 58536, 58551, 58566,
58581, 58595, 58610, 58625, 58640, 58654, 58669, 58684,
58698, 58713, 58728, 58742, 58757, 58771, 58786, 58801,
58815, 58830, 58844, 58859, 58873, 58888, 58902, 58917,
58931, 58946, 58960, 58974, 58989, 59003, 59018, 59032,
59046, 59061, 59075, 59089, 59103, 59118, 59132, 59146,
59160, 59175, 59189, 59203, 59217, 59231, 59246, 59260,
59274, 59288, 59302, 59316, 59330, 59344, 59358, 59372,
59386, 59400, 59414, 59428, 59442, 59456, 59470, 59484,
59498, 59512, 59525, 59539, 59553, 59567, 59581, 59595,
59608, 59622, 59636, 59650, 59663, 59677, 59691, 59704,
59718, 59732, 59745, 59759, 59773, 59786, 59800, 59813,
59827, 59840, 59854, 59867, 59881, 59894, 59908, 59921,
59935, 59948, 59962, 59975, 59988, 60002, 60015, 60028,
60042, 60055, 60068, 60082, 60095, 60108, 60121, 60134,
60148, 60161, 60174, 60187, 60200, 60213, 60227, 60240,
60253, 60266, 60279, 60292, 60305, 60318, 60331, 60344,
60357, 60370, 60383, 60396, 60409, 60422, 60434, 60447,
60460, 60473, 60486, 60499, 60511, 60524, 60537, 60550,
60562, 60575, 60588, 60600, 60613, 60626, 60638, 60651,
60664, 60676, 60689, 60701, 60714, 60727, 60739, 60752,
60764, 60777, 60789, 60801, 60814, 60826, 60839, 60851,
60863, 60876, 60888, 60900, 60913, 60925, 60937, 60950,
60962, 60974, 60986, 60999, 61011, 61023, 61035, 61047,
61059, 61071, 61084, 61096, 61108, 61120, 61132, 61144,
61156, 61168, 61180, 61192, 61204, 61216, 61228, 61240,
61251, 61263, 61275, 61287, 61299, 61311, 61322, 61334,
61346, 61358, 61369, 61381, 61393, 61405, 61416, 61428,
61440, 61451, 61463, 61474, 61486, 61498, 61509, 61521,
61532, 61544, 61555, 61567, 61578, 61590, 61601, 61612,
61624, 61635, 61647, 61658, 61669, 61681, 61692, 61703,
61714, 61726, 61737, 61748, 61759, 61771, 61782, 61793,
61804, 61815, 61826, 61837, 61849, 61860, 61871, 61882,
61893, 61904, 61915, 61926, 61937, 61948, 61959, 61970,
61980, 61991, 62002, 62013, 62024, 62035, 62046, 62056,
62067, 62078, 62089, 62099, 62110, 62121, 62131, 62142,
62153, 62163, 62174, 62185, 62195, 62206, 62216, 62227,
62237, 62248, 62258, 62269, 62279, 62290, 62300, 62311,
62321, 62331, 62342, 62352, 62362, 62373, 62383, 62393,
62404, 62414, 62424, 62434, 62445, 62455, 62465, 62475,
62485, 62495, 62505, 62516, 62526, 62536, 62546, 62556,
62566, 62576, 62586, 62596, 62606, 62616, 62626, 62635,
62645, 62655, 62665, 62675, 62685, 62695, 62704, 62714,
62724, 62734, 62743, 62753, 62763, 62772, 62782, 62792,
62801, 62811, 62821, 62830, 62840, 62849, 62859, 62868,
62878, 62887, 62897, 62906, 62916, 62925, 62935, 62944,
62953, 62963, 62972, 62981, 62991, 63000, 63009, 63018,
63028, 63037, 63046, 63055, 63064, 63074, 63083, 63092,
63101, 63110, 63119, 63128, 63137, 63146, 63155, 63164,
63173, 63182, 63191, 63200, 63209, 63218, 63227, 63236,
63245, 63253, 63262, 63271, 63280, 63289, 63297, 63306,
63315, 63324, 63332, 63341, 63350, 63358, 63367, 63375,
63384, 63393, 63401, 63410, 63418, 63427, 63435, 63444,
63452, 63461, 63469, 63477, 63486, 63494, 63502, 63511,
63519, 63527, 63536, 63544, 63552, 63561, 63569, 63577,
63585, 63593, 63601, 63610, 63618, 63626, 63634, 63642,
63650, 63658, 63666, 63674, 63682, 63690, 63698, 63706,
63714, 63722, 63730, 63738, 63745, 63753, 63761, 63769,
63777, 63784, 63792, 63800, 63808, 63815, 63823, 63831,
63838, 63846, 63854, 63861, 63869, 63876, 63884, 63892,
63899, 63907, 63914, 63922, 63929, 63936, 63944, 63951,
63959, 63966, 63973, 63981, 63988, 63995, 64003, 64010,
64017, 64024, 64032, 64039, 64046, 64053, 64060, 64068,
64075, 64082, 64089, 64096, 64103, 64110, 64117, 64124,
64131, 64138, 64145, 64152, 64159, 64166, 64173, 64179,
64186, 64193, 64200, 64207, 64213, 64220, 64227, 64234,
64240, 64247, 64254, 64260, 64267, 64274, 64280, 64287,
64294, 64300, 64307, 64313, 64320, 64326, 64333, 64339,
64346, 64352, 64358, 64365, 64371, 64377, 64384, 64390,
64396, 64403, 64409, 64415, 64422, 64428, 64434, 64440,
64446, 64452, 64459, 64465, 64471, 64477, 64483, 64489,
64495, 64501, 64507, 64513, 64519, 64525, 64531, 64537,
64543, 64549, 64554, 64560, 64566, 64572, 64578, 64583,
64589, 64595, 64601, 64606, 64612, 64618, 64623, 64629,
64635, 64640, 64646, 64651, 64657, 64662, 64668, 64673,
64679, 64684, 64690, 64695, 64701, 64706, 64711, 64717,
64722, 64728, 64733, 64738, 64743, 64749, 64754, 64759,
64764, 64770, 64775, 64780, 64785, 64790, 64795, 64800,
64805, 64810, 64815, 64820, 64825, 64830, 64835, 64840,
64845, 64850, 64855, 64860, 64865, 64870, 64874, 64879,
64884, 64889, 64894, 64898, 64903, 64908, 64912, 64917,
64922, 64926, 64931, 64936, 64940, 64945, 64949, 64954,
64958, 64963, 64967, 64972, 64976, 64981, 64985, 64989,
64994, 64998, 65003, 65007, 65011, 65015, 65020, 65024,
65028, 65032, 65037, 65041, 65045, 65049, 65053, 65057,
65061, 65065, 65070, 65074, 65078, 65082, 65086, 65090,
65094, 65097, 65101, 65105, 65109, 65113, 65117, 65121,
65125, 65128, 65132, 65136, 65140, 65143, 65147, 65151,
65154, 65158, 65162, 65165, 65169, 65173, 65176, 65180,
65183, 65187, 65190, 65194, 65197, 65201, 65204, 65207,
65211, 65214, 65218, 65221, 65224, 65228, 65231, 65234,
65237, 65241, 65244, 65247, 65250, 65253, 65256, 65260,
65263, 65266, 65269, 65272, 65275, 65278, 65281, 65284,
65287, 65290, 65293, 65296, 65299, 65302, 65304, 65307,
65310, 65313, 65316, 65319, 65321, 65324, 65327, 65329,
65332, 65335, 65337, 65340, 65343, 65345, 65348, 65350,
65353, 65356, 65358, 65361, 65363, 65366, 65368, 65370,
65373, 65375, 65378, 65380, 65382, 65385, 65387, 65389,
65391, 65394, 65396, 65398, 65400, 65403, 65405, 65407,
65409, 65411, 65413, 65415, 65417, 65419, 65421, 65423,
65425, 65427, 65429, 65431, 65433, 65435, 65437, 65439,
65441, 65442, 65444, 65446, 65448, 65449, 65451, 65453,
65455, 65456, 65458, 65460, 65461, 65463, 65464, 65466,
65468, 65469, 65471, 65472, 65474, 65475, 65477, 65478,
65479, 65481, 65482, 65484, 65485, 65486, 65488, 65489,
65490, 65491, 65493, 65494, 65495, 65496, 65497, 65499,
65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507,
65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515,
65515, 65516, 65517, 65518, 65519, 65519, 65520, 65521,
65522, 65522, 65523, 65524, 65524, 65525, 65526, 65526,
65527, 65527, 65528, 65528, 65529, 65529, 65530, 65530,
65531, 65531, 65531, 65532, 65532, 65532, 65533, 65533,
65533, 65534, 65534, 65534, 65534, 65535, 65535, 65535,
65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535,
65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535,
65535, 65535, 65535, 65534, 65534, 65534, 65534, 65533,
65533, 65533, 65532, 65532, 65532, 65531, 65531, 65531,
65530, 65530, 65529, 65529, 65528, 65528, 65527, 65527,
65526, 65526, 65525, 65524, 65524, 65523, 65522, 65522,
65521, 65520, 65519, 65519, 65518, 65517, 65516, 65515,
65515, 65514, 65513, 65512, 65511, 65510, 65509, 65508,
65507, 65506, 65505, 65504, 65503, 65502, 65501, 65500,
65499, 65497, 65496, 65495, 65494, 65493, 65491, 65490,
65489, 65488, 65486, 65485, 65484, 65482, 65481, 65479,
65478, 65477, 65475, 65474, 65472, 65471, 65469, 65468,
65466, 65464, 65463, 65461, 65460, 65458, 65456, 65455,
65453, 65451, 65449, 65448, 65446, 65444, 65442, 65441,
65439, 65437, 65435, 65433, 65431, 65429, 65427, 65425,
65423, 65421, 65419, 65417, 65415, 65413, 65411, 65409,
65407, 65405, 65403, 65400, 65398, 65396, 65394, 65391,
65389, 65387, 65385, 65382, 65380, 65378, 65375, 65373,
65370, 65368, 65366, 65363, 65361, 65358, 65356, 65353,
65350, 65348, 65345, 65343, 65340, 65337, 65335, 65332,
65329, 65327, 65324, 65321, 65319, 65316, 65313, 65310,
65307, 65304, 65302, 65299, 65296, 65293, 65290, 65287,
65284, 65281, 65278, 65275, 65272, 65269, 65266, 65263,
65260, 65256, 65253, 65250, 65247, 65244, 65241, 65237,
65234, 65231, 65228, 65224, 65221, 65218, 65214, 65211,
65207, 65204, 65201, 65197, 65194, 65190, 65187, 65183,
65180, 65176, 65173, 65169, 65165, 65162, 65158, 65154,
65151, 65147, 65143, 65140, 65136, 65132, 65128, 65125,
65121, 65117, 65113, 65109, 65105, 65101, 65097, 65094,
65090, 65086, 65082, 65078, 65074, 65070, 65065, 65061,
65057, 65053, 65049, 65045, 65041, 65037, 65032, 65028,
65024, 65020, 65015, 65011, 65007, 65003, 64998, 64994,
64989, 64985, 64981, 64976, 64972, 64967, 64963, 64958,
64954, 64949, 64945, 64940, 64936, 64931, 64926, 64922,
64917, 64912, 64908, 64903, 64898, 64894, 64889, 64884,
64879, 64874, 64870, 64865, 64860, 64855, 64850, 64845,
64840, 64835, 64830, 64825, 64820, 64815, 64810, 64805,
64800, 64795, 64790, 64785, 64780, 64775, 64770, 64764,
64759, 64754, 64749, 64743, 64738, 64733, 64728, 64722,
64717, 64711, 64706, 64701, 64695, 64690, 64684, 64679,
64673, 64668, 64662, 64657, 64651, 64646, 64640, 64635,
64629, 64623, 64618, 64612, 64606, 64601, 64595, 64589,
64583, 64578, 64572, 64566, 64560, 64554, 64549, 64543,
64537, 64531, 64525, 64519, 64513, 64507, 64501, 64495,
64489, 64483, 64477, 64471, 64465, 64459, 64452, 64446,
64440, 64434, 64428, 64422, 64415, 64409, 64403, 64396,
64390, 64384, 64377, 64371, 64365, 64358, 64352, 64346,
64339, 64333, 64326, 64320, 64313, 64307, 64300, 64294,
64287, 64280, 64274, 64267, 64260, 64254, 64247, 64240,
64234, 64227, 64220, 64213, 64207, 64200, 64193, 64186,
64179, 64173, 64166, 64159, 64152, 64145, 64138, 64131,
64124, 64117, 64110, 64103, 64096, 64089, 64082, 64075,
64068, 64060, 64053, 64046, 64039, 64032, 64024, 64017,
64010, 64003, 63995, 63988, 63981, 63973, 63966, 63959,
63951, 63944, 63936, 63929, 63922, 63914, 63907, 63899,
63892, 63884, 63876, 63869, 63861, 63854, 63846, 63838,
63831, 63823, 63815, 63808, 63800, 63792, 63784, 63777,
63769, 63761, 63753, 63745, 63738, 63730, 63722, 63714,
63706, 63698, 63690, 63682, 63674, 63666, 63658, 63650,
63642, 63634, 63626, 63618, 63610, 63601, 63593, 63585,
63577, 63569, 63561, 63552, 63544, 63536, 63527, 63519,
63511, 63502, 63494, 63486, 63477, 63469, 63461, 63452,
63444, 63435, 63427, 63418, 63410, 63401, 63393, 63384,
63375, 63367, 63358, 63350, 63341, 63332, 63324, 63315,
63306, 63297, 63289, 63280, 63271, 63262, 63253, 63245,
63236, 63227, 63218, 63209, 63200, 63191, 63182, 63173,
63164, 63155, 63146, 63137, 63128, 63119, 63110, 63101,
63092, 63083, 63074, 63064, 63055, 63046, 63037, 63028,
63018, 63009, 63000, 62991, 62981, 62972, 62963, 62953,
62944, 62935, 62925, 62916, 62906, 62897, 62887, 62878,
62868, 62859, 62849, 62840, 62830, 62821, 62811, 62801,
62792, 62782, 62772, 62763, 62753, 62743, 62734, 62724,
62714, 62704, 62695, 62685, 62675, 62665, 62655, 62645,
62635, 62626, 62616, 62606, 62596, 62586, 62576, 62566,
62556, 62546, 62536, 62526, 62516, 62505, 62495, 62485,
62475, 62465, 62455, 62445, 62434, 62424, 62414, 62404,
62393, 62383, 62373, 62362, 62352, 62342, 62331, 62321,
62311, 62300, 62290, 62279, 62269, 62258, 62248, 62237,
62227, 62216, 62206, 62195, 62185, 62174, 62163, 62153,
62142, 62131, 62121, 62110, 62099, 62089, 62078, 62067,
62056, 62046, 62035, 62024, 62013, 62002, 61991, 61980,
61970, 61959, 61948, 61937, 61926, 61915, 61904, 61893,
61882, 61871, 61860, 61849, 61837, 61826, 61815, 61804,
61793, 61782, 61771, 61759, 61748, 61737, 61726, 61714,
61703, 61692, 61681, 61669, 61658, 61647, 61635, 61624,
61612, 61601, 61590, 61578, 61567, 61555, 61544, 61532,
61521, 61509, 61498, 61486, 61474, 61463, 61451, 61440,
61428, 61416, 61405, 61393, 61381, 61369, 61358, 61346,
61334, 61322, 61311, 61299, 61287, 61275, 61263, 61251,
61240, 61228, 61216, 61204, 61192, 61180, 61168, 61156,
61144, 61132, 61120, 61108, 61096, 61084, 61071, 61059,
61047, 61035, 61023, 61011, 60999, 60986, 60974, 60962,
60950, 60937, 60925, 60913, 60900, 60888, 60876, 60863,
60851, 60839, 60826, 60814, 60801, 60789, 60777, 60764,
60752, 60739, 60727, 60714, 60701, 60689, 60676, 60664,
60651, 60638, 60626, 60613, 60600, 60588, 60575, 60562,
60550, 60537, 60524, 60511, 60499, 60486, 60473, 60460,
60447, 60434, 60422, 60409, 60396, 60383, 60370, 60357,
60344, 60331, 60318, 60305, 60292, 60279, 60266, 60253,
60240, 60227, 60213, 60200, 60187, 60174, 60161, 60148,
60134, 60121, 60108, 60095, 60082, 60068, 60055, 60042,
60028, 60015, 60002, 59988, 59975, 59962, 59948, 59935,
59921, 59908, 59894, 59881, 59867, 59854, 59840, 59827,
59813, 59800, 59786, 59773, 59759, 59745, 59732, 59718,
59704, 59691, 59677, 59663, 59650, 59636, 59622, 59608,
59595, 59581, 59567, 59553, 59539, 59525, 59512, 59498,
59484, 59470, 59456, 59442, 59428, 59414, 59400, 59386,
59372, 59358, 59344, 59330, 59316, 59302, 59288, 59274,
59260, 59246, 59231, 59217, 59203, 59189, 59175, 59160,
59146, 59132, 59118, 59103, 59089, 59075, 59061, 59046,
59032, 59018, 59003, 58989, 58974, 58960, 58946, 58931,
58917, 58902, 58888, 58873, 58859, 58844, 58830, 58815,
58801, 58786, 58771, 58757, 58742, 58728, 58713, 58698,
58684, 58669, 58654, 58640, 58625, 58610, 58595, 58581,
58566, 58551, 58536, 58521, 58506, 58492, 58477, 58462,
58447, 58432, 58417, 58402, 58387, 58372, 58357, 58342,
58327, 58312, 58297, 58282, 58267, 58252, 58237, 58222,
58207, 58192, 58177, 58162, 58146, 58131, 58116, 58101,
58086, 58070, 58055, 58040, 58025, 58009, 57994, 57979,
57963, 57948, 57933, 57917, 57902, 57887, 57871, 57856,
57840, 57825, 57809, 57794, 57779, 57763, 57748, 57732,
57716, 57701, 57685, 57670, 57654, 57639, 57623, 57607,
57592, 57576, 57560, 57545, 57529, 57513, 57498, 57482,
57466, 57450, 57435, 57419, 57403, 57387, 57371, 57356,
57340, 57324, 57308, 57292, 57276, 57260, 57244, 57229,
57213, 57197, 57181, 57165, 57149, 57133, 57117, 57101,
57085, 57068, 57052, 57036, 57020, 57004, 56988, 56972,
56956, 56940, 56923, 56907, 56891, 56875, 56859, 56842,
56826, 56810, 56793, 56777, 56761, 56745, 56728, 56712,
56696, 56679, 56663, 56646, 56630, 56614, 56597, 56581,
56564, 56548, 56531, 56515, 56498, 56482, 56465, 56449,
56432, 56416, 56399, 56382, 56366, 56349, 56333, 56316,
56299, 56283, 56266, 56249, 56233, 56216, 56199, 56182,
56166, 56149, 56132, 56115, 56099, 56082, 56065, 56048,
56031, 56014, 55998, 55981, 55964, 55947, 55930, 55913,
55896, 55879, 55862, 55845, 55828, 55811, 55794, 55777,
55760, 55743, 55726, 55709, 55692, 55675, 55658, 55640,
55623, 55606, 55589, 55572, 55555, 55537, 55520, 55503,
55486, 55469, 55451, 55434, 55417, 55399, 55382, 55365,
55347, 55330, 55313, 55295, 55278, 55261, 55243, 55226,
55208, 55191, 55174, 55156, 55139, 55121, 55104, 55086,
55069, 55051, 55034, 55016, 54999, 54981, 54963, 54946,
54928, 54911, 54893, 54875, 54858, 54840, 54822, 54805,
54787, 54769, 54752, 54734, 54716, 54698, 54681, 54663,
54645, 54627, 54609, 54592, 54574, 54556, 54538, 54520,
54502, 54484, 54466, 54449, 54431, 54413, 54395, 54377,
54359, 54341, 54323, 54305, 54287, 54269, 54251, 54233,
54215, 54197, 54179, 54160, 54142, 54124, 54106, 54088,
54070, 54052, 54034, 54015, 53997, 53979, 53961, 53943,
53924, 53906, 53888, 53870, 53851, 53833, 53815, 53796,
53778, 53760, 53741, 53723, 53705, 53686, 53668, 53650,
53631, 53613, 53594, 53576, 53557, 53539, 53520, 53502,
53483, 53465, 53446, 53428, 53409, 53391, 53372, 53354,
53335, 53317, 53298, 53279, 53261, 53242, 53224, 53205,
53186, 53168, 53149, 53130, 53111, 53093, 53074, 53055,
53037, 53018, 52999, 52980, 52961, 52943, 52924, 52905,
52886, 52867, 52849, 52830, 52811, 52792, 52773, 52754,
52735, 52716, 52697, 52678, 52660, 52641, 52622, 52603,
52584, 52565, 52546, 52527, 52508, 52489, 52469, 52450,
52431, 52412, 52393, 52374, 52355, 52336, 52317, 52298,
52278, 52259, 52240, 52221, 52202, 52183, 52163, 52144,
52125, 52106, 52086, 52067, 52048, 52029, 52009, 51990,
51971, 51951, 51932, 51913, 51893, 51874, 51855, 51835,
51816, 51796, 51777, 51758, 51738, 51719, 51699, 51680,
51660, 51641, 51621, 51602, 51582, 51563, 51543, 51524,
51504, 51485, 51465, 51446, 51426, 51407, 51387, 51367,
51348, 51328, 51308, 51289, 51269, 51250, 51230, 51210,
51190, 51171, 51151, 51131, 51112, 51092, 51072, 51052,
51033, 51013, 50993, 50973, 50953, 50934, 50914, 50894,
50874, 50854, 50834, 50815, 50795, 50775, 50755, 50735,
50715, 50695, 50675, 50655, 50635, 50615, 50596, 50576,
50556, 50536, 50516, 50496, 50476, 50456, 50436, 50415,
50395, 50375, 50355, 50335, 50315, 50295, 50275, 50255,
50235, 50215, 50194, 50174, 50154, 50134, 50114, 50094,
50073, 50053, 50033, 50013, 49993, 49972, 49952, 49932,
49912, 49891, 49871, 49851, 49830, 49810, 49790, 49769,
49749, 49729, 49708, 49688, 49668, 49647, 49627, 49607,
49586, 49566, 49545, 49525, 49505, 49484, 49464, 49443,
49423, 49402, 49382, 49361, 49341, 49320, 49300, 49279,
49259, 49238, 49218, 49197, 49177, 49156, 49135, 49115,
49094, 49074, 49053, 49032, 49012, 48991, 48971, 48950,
48929, 48909, 48888, 48867, 48847, 48826, 48805, 48784,
48764, 48743, 48722, 48701, 48681, 48660, 48639, 48618,
48598, 48577, 48556, 48535, 48514, 48494, 48473, 48452,
48431, 48410, 48389, 48368, 48348, 48327, 48306, 48285,
48264, 48243, 48222, 48201, 48180, 48159, 48138, 48117,
48097, 48076, 48055, 48034, 48013, 47992, 47971, 47950,
47929, 47907, 47886, 47865, 47844, 47823, 47802, 47781,
47760, 47739, 47718, 47697, 47676, 47655, 47633, 47612,
47591, 47570, 47549, 47528, 47506, 47485, 47464, 47443,
47422, 47401, 47379, 47358, 47337, 47316, 47294, 47273,
47252, 47231, 47209, 47188, 47167, 47145, 47124, 47103,
47082, 47060, 47039, 47018, 46996, 46975, 46954, 46932,
46911, 46889, 46868, 46847, 46825, 46804, 46783, 46761,
46740, 46718, 46697, 46675, 46654, 46632, 46611, 46590,
46568, 46547, 46525, 46504, 46482, 46461, 46439, 46418,
46396, 46375, 46353, 46331, 46310, 46288, 46267, 46245,
46224, 46202, 46180, 46159, 46137, 46116, 46094, 46072,
46051, 46029, 46008, 45986, 45964, 45943, 45921, 45899,
45878, 45856, 45834, 45812, 45791, 45769, 45747, 45726,
45704, 45682, 45660, 45639, 45617, 45595, 45573, 45552,
45530, 45508, 45486, 45465, 45443, 45421, 45399, 45377,
45355, 45334, 45312, 45290, 45268, 45246, 45224, 45203,
45181, 45159, 45137, 45115, 45093, 45071, 45049, 45027,
45006, 44984, 44962, 44940, 44918, 44896, 44874, 44852,
44830, 44808, 44786, 44764, 44742, 44720, 44698, 44676,
44654, 44632, 44610, 44588, 44566, 44544, 44522, 44500,
44478, 44456, 44434, 44412, 44390, 44368, 44346, 44323,
44301, 44279, 44257, 44235, 44213, 44191, 44169, 44147,
44124, 44102, 44080, 44058, 44036, 44014, 43992, 43969,
43947, 43925, 43903, 43881, 43859, 43836, 43814, 43792,
43770, 43747, 43725, 43703, 43681, 43659, 43636, 43614,
43592, 43570, 43547, 43525, 43503, 43481, 43458, 43436,
43414, 43391, 43369, 43347, 43324, 43302, 43280, 43258,
43235, 43213, 43191, 43168, 43146, 43123, 43101, 43079,
43056, 43034, 43012, 42989, 42967, 42945, 42922, 42900,
42877, 42855, 42833, 42810, 42788, 42765, 42743, 42720,
42698, 42676, 42653, 42631, 42608, 42586, 42563, 42541,
42518, 42496, 42473, 42451, 42428, 42406, 42384, 42361,
42339, 42316, 42293, 42271, 42248, 42226, 42203, 42181,
42158, 42136, 42113, 42091, 42068, 42046, 42023, 42001,
41978, 41955, 41933, 41910, 41888, 41865, 41842, 41820,
41797, 41775, 41752, 41730, 41707, 41684, 41662, 41639,
41616, 41594, 41571, 41549, 41526, 41503, 41481, 41458,
41435, 41413, 41390, 41367, 41345, 41322, 41299, 41277,
41254, 41231, 41209, 41186, 41163, 41140, 41118, 41095,
41072, 41050, 41027, 41004, 40981, 40959, 40936, 40913,
40891, 40868, 40845, 40822, 40800, 40777, 40754, 40731,
40709, 40686, 40663, 40640, 40618, 40595, 40572, 40549,
40526, 40504, 40481, 40458, 40435, 40412, 40390, 40367,
40344, 40321, 40298, 40276, 40253, 40230, 40207, 40184,
40161, 40139, 40116, 40093, 40070, 40047, 40024, 40002,
39979, 39956, 39933, 39910, 39887, 39864, 39841, 39819,
39796, 39773, 39750, 39727, 39704, 39681, 39658, 39636,
39613, 39590, 39567, 39544, 39521, 39498, 39475, 39452,
39429, 39406, 39384, 39361, 39338, 39315, 39292, 39269,
39246, 39223, 39200, 39177, 39154, 39131, 39108, 39085,
39062, 39039, 39017, 38994, 38971, 38948, 38925, 38902,
38879, 38856, 38833, 38810, 38787, 38764, 38741, 38718,
38695, 38672, 38649, 38626, 38603, 38580, 38557, 38534,
38511, 38488, 38465, 38442, 38419, 38396, 38373, 38350,
38327, 38304, 38281, 38258, 38235, 38212, 38189, 38166,
38143, 38120, 38097, 38074, 38051, 38028, 38005, 37982,
37958, 37935, 37912, 37889, 37866, 37843, 37820, 37797,
37774, 37751, 37728, 37705, 37682, 37659, 37636, 37613,
37590, 37567, 37544, 37520, 37497, 37474, 37451, 37428,
37405, 37382, 37359, 37336, 37313, 37290, 37267, 37244,
37220, 37197, 37174, 37151, 37128, 37105, 37082, 37059,
37036, 37013, 36990, 36966, 36943, 36920, 36897, 36874,
36851, 36828, 36805, 36782, 36759, 36736, 36712, 36689,
36666, 36643, 36620, 36597, 36574, 36551, 36528, 36504,
36481, 36458, 36435, 36412, 36389, 36366, 36343, 36320,
36296, 36273, 36250, 36227, 36204, 36181, 36158, 36135,
36112, 36088, 36065, 36042, 36019, 35996, 35973, 35950,
35927, 35903, 35880, 35857, 35834, 35811, 35788, 35765,
35742, 35718, 35695, 35672, 35649, 35626, 35603, 35580,
35557, 35533, 35510, 35487, 35464, 35441, 35418, 35395,
35372, 35348, 35325, 35302, 35279, 35256, 35233, 35210,
35187, 35163, 35140, 35117, 35094, 35071, 35048, 35025,
35002, 34978, 34955, 34932, 34909, 34886, 34863, 34840,
34817, 34794, 34770, 34747, 34724, 34701, 34678, 34655,
34632, 34609, 34585, 34562, 34539, 34516, 34493, 34470,
34447, 34424, 34401, 34377, 34354, 34331, 34308, 34285,
34262, 34239, 34216, 34193, 34169, 34146, 34123, 34100,
34077, 34054, 34031, 34008, 33985, 33962, 33938, 33915,
33892, 33869, 33846, 33823, 33800, 33777, 33754, 33731,
33707, 33684, 33661, 33638, 33615, 33592, 33569, 33546,
33523, 33500, 33477, 33454, 33430, 33407, 33384, 33361,
33338, 33315, 33292, 33269, 33246, 33223, 33200, 33177,
33154, 33131, 33108, 33084, 33061, 33038, 33015, 32992,
32969, 32946, 32923, 32900, 32877, 32854, 32831, 32808,
32785, 32762, 32739, 32716, 32693, 32670, 32647, 32624,
32601, 32578, 32555, 32532, 32509, 32485, 32462, 32439,
32416, 32393, 32370, 32347, 32324, 32301, 32278, 32255,
32232, 32209, 32186, 32163, 32140, 32117, 32094, 32071,
32048, 32025, 32003, 31980, 31957, 31934, 31911, 31888,
31865, 31842, 31819, 31796, 31773, 31750, 31727, 31704,
31681, 31658, 31635, 31612, 31589, 31566, 31543, 31520,
31497, 31475, 31452, 31429, 31406, 31383, 31360, 31337,
31314, 31291, 31268, 31245, 31222, 31200, 31177, 31154,
31131, 31108, 31085, 31062, 31039, 31016, 30994, 30971,
30948, 30925, 30902, 30879, 30856, 30833, 30811, 30788,
30765, 30742, 30719, 30696, 30674, 30651, 30628, 30605,
30582, 30559, 30537, 30514, 30491, 30468, 30445, 30422,
30400, 30377, 30354, 30331, 30308, 30286, 30263, 30240,
30217, 30195, 30172, 30149, 30126, 30103, 30081, 30058,
30035, 30012, 29990, 29967, 29944, 29921, 29899, 29876,
29853, 29830, 29808, 29785, 29762, 29740, 29717, 29694,
29671, 29649, 29626, 29603, 29581, 29558, 29535, 29513,
29490, 29467, 29445, 29422, 29399, 29377, 29354, 29331,
29309, 29286, 29263, 29241, 29218, 29195, 29173, 29150,
29128, 29105, 29082, 29060, 29037, 29014, 28992, 28969,
28947, 28924, 28902, 28879, 28856, 28834, 28811, 28789,
28766, 28744, 28721, 28698, 28676, 28653, 28631, 28608,
28586, 28563, 28541, 28518, 28496, 28473, 28451, 28428,
28406, 28383, 28361, 28338, 28316, 28293, 28271, 28248,
28226, 28203, 28181, 28158, 28136, 28114, 28091, 28069,
28046, 28024, 28001, 27979, 27957, 27934, 27912, 27889,
27867, 27845, 27822, 27800, 27777, 27755, 27733, 27710,
27688, 27666, 27643, 27621, 27599, 27576, 27554, 27532,
27509, 27487, 27465, 27442, 27420, 27398, 27375, 27353,
27331, 27309, 27286, 27264, 27242, 27219, 27197, 27175,
27153, 27130, 27108, 27086, 27064, 27042, 27019, 26997,
26975, 26953, 26930, 26908, 26886, 26864, 26842, 26820,
26797, 26775, 26753, 26731, 26709, 26687, 26664, 26642,
26620, 26598, 26576, 26554, 26532, 26510, 26488, 26465,
26443, 26421, 26399, 26377, 26355, 26333, 26311, 26289,
26267, 26245, 26223, 26201, 26179, 26157, 26135, 26113,
26091, 26069, 26047, 26025, 26003, 25981, 25959, 25937,
25915, 25893, 25871, 25849, 25827, 25805, 25783, 25761,
25739, 25718, 25696, 25674, 25652, 25630, 25608, 25586,
25564, 25543, 25521, 25499, 25477, 25455, 25433, 25412,
25390, 25368, 25346, 25324, 25302, 25281, 25259, 25237,
25215, 25194, 25172, 25150, 25128, 25107, 25085, 25063,
25041, 25020, 24998, 24976, 24955, 24933, 24911, 24890,
24868, 24846, 24825, 24803, 24781, 24760, 24738, 24716,
24695, 24673, 24651, 24630, 24608, 24587, 24565, 24543,
24522, 24500, 24479, 24457, 24436, 24414, 24393, 24371,
24350, 24328, 24307, 24285, 24264, 24242, 24221, 24199,
24178, 24156, 24135, 24113, 24092, 24070, 24049, 24028,
24006, 23985, 23963, 23942, 23920, 23899, 23878, 23856,
23835, 23814, 23792, 23771, 23750, 23728, 23707, 23686,
23664, 23643, 23622, 23600, 23579, 23558, 23537, 23515,
23494, 23473, 23452, 23430, 23409, 23388, 23367, 23346,
23324, 23303, 23282, 23261, 23240, 23218, 23197, 23176,
23155, 23134, 23113, 23092, 23071, 23049, 23028, 23007,
22986, 22965, 22944, 22923, 22902, 22881, 22860, 22839,
22818, 22797, 22776, 22755, 22734, 22713, 22692, 22671,
22650, 22629, 22608, 22587, 22566, 22545, 22524, 22503,
22482, 22462, 22441, 22420, 22399, 22378, 22357, 22336,
22316, 22295, 22274, 22253, 22232, 22211, 22191, 22170,
22149, 22128, 22108, 22087, 22066, 22045, 22025, 22004,
21983, 21962, 21942, 21921, 21900, 21880, 21859, 21838,
21818, 21797, 21776, 21756, 21735, 21715, 21694, 21673,
21653, 21632, 21612, 21591, 21570, 21550, 21529, 21509,
21488, 21468, 21447, 21427, 21406, 21386, 21365, 21345,
21324, 21304, 21284, 21263, 21243, 21222, 21202, 21181,
21161, 21141, 21120, 21100, 21080, 21059, 21039, 21019,
20998, 20978, 20958, 20937, 20917, 20897, 20876, 20856,
20836, 20816, 20795, 20775, 20755, 20735, 20715, 20694,
20674, 20654, 20634, 20614, 20594, 20573, 20553, 20533,
20513, 20493, 20473, 20453, 20433, 20413, 20392, 20372,
20352, 20332, 20312, 20292, 20272, 20252, 20232, 20212,
20192, 20172, 20152, 20132, 20113, 20093, 20073, 20053,
20033, 20013, 19993, 19973, 19953, 19933, 19914, 19894,
19874, 19854, 19834, 19814, 19795, 19775, 19755, 19735,
19716, 19696, 19676, 19656, 19637, 19617, 19597, 19578,
19558, 19538, 19519, 19499, 19479, 19460, 19440, 19420,
19401, 19381, 19362, 19342, 19322, 19303, 19283, 19264,
19244, 19225, 19205, 19186, 19166, 19147, 19127, 19108,
19088, 19069, 19049, 19030, 19011, 18991, 18972, 18952,
18933, 18914, 18894, 18875, 18856, 18836, 18817, 18798,
18778, 18759, 18740, 18720, 18701, 18682, 18663, 18643,
18624, 18605, 18586, 18567, 18547, 18528, 18509, 18490,
18471, 18452, 18432, 18413, 18394, 18375, 18356, 18337,
18318, 18299, 18280, 18261, 18242, 18223, 18204, 18185,
18166, 18147, 18128, 18109, 18090, 18071, 18052, 18033,
18014, 17995, 17977, 17958, 17939, 17920, 17901, 17882,
17863, 17845, 17826, 17807, 17788, 17769, 17751, 17732,
17713, 17695, 17676, 17657, 17638, 17620, 17601, 17582,
17564, 17545, 17526, 17508, 17489, 17471, 17452, 17433,
17415, 17396, 17378, 17359, 17341, 17322, 17304, 17285,
17267, 17248, 17230, 17211, 17193, 17174, 17156, 17138,
17119, 17101, 17082, 17064, 17046, 17027, 17009, 16991,
16972, 16954, 16936, 16917, 16899, 16881, 16863, 16844,
16826, 16808, 16790, 16772, 16753, 16735, 16717, 16699,
16681, 16663, 16645, 16626, 16608, 16590, 16572, 16554,
16536, 16518, 16500, 16482, 16464, 16446, 16428, 16410,
16392, 16374, 16356, 16338, 16320, 16302, 16285, 16267,
16249, 16231, 16213, 16195, 16177, 16160, 16142, 16124,
16106, 16088, 16071, 16053, 16035, 16018, 16000, 15982,
15964, 15947, 15929, 15911, 15894, 15876, 15858, 15841,
15823, 15806, 15788, 15771, 15753, 15735, 15718, 15700,
15683, 15665, 15648, 15630, 15613, 15596, 15578, 15561,
15543, 15526, 15508, 15491, 15474, 15456, 15439, 15422,
15404, 15387, 15370, 15353, 15335, 15318, 15301, 15283,
15266, 15249, 15232, 15215, 15197, 15180, 15163, 15146,
15129, 15112, 15095, 15078, 15060, 15043, 15026, 15009,
14992, 14975, 14958, 14941, 14924, 14907, 14890, 14873,
14856, 14840, 14823, 14806, 14789, 14772, 14755, 14738,
14721, 14705, 14688, 14671, 14654, 14637, 14621, 14604,
14587, 14570, 14554, 14537, 14520, 14504, 14487, 14470,
14454, 14437, 14420, 14404, 14387, 14371, 14354, 14337,
14321, 14304, 14288, 14271, 14255, 14238, 14222, 14205,
14189, 14172, 14156, 14140, 14123, 14107, 14091, 14074,
14058, 14041, 14025, 14009, 13993, 13976, 13960, 13944,
13927, 13911, 13895, 13879, 13863, 13846, 13830, 13814,
13798, 13782, 13766, 13750, 13734, 13717, 13701, 13685,
13669, 13653, 13637, 13621, 13605, 13589, 13573, 13557,
13541, 13525, 13510, 13494, 13478, 13462, 13446, 13430,
13414, 13398, 13383, 13367, 13351, 13335, 13320, 13304,
13288, 13272, 13257, 13241, 13225, 13210, 13194, 13178,
13163, 13147, 13131, 13116, 13100, 13085, 13069, 13054,
13038, 13023, 13007, 12992, 12976, 12961, 12945, 12930,
12914, 12899, 12884, 12868, 12853, 12837, 12822, 12807,
12792, 12776, 12761, 12746, 12730, 12715, 12700, 12685,
12669, 12654, 12639, 12624, 12609, 12594, 12579, 12563,
12548, 12533, 12518, 12503, 12488, 12473, 12458, 12443,
12428, 12413, 12398, 12383, 12368, 12353, 12338, 12323,
12309, 12294, 12279, 12264, 12249, 12234, 12220, 12205,
12190, 12175, 12160, 12146, 12131, 12116, 12102, 12087,
12072, 12058, 12043, 12028, 12014, 11999, 11985, 11970,
11955, 11941, 11926, 11912, 11897, 11883, 11868, 11854,
11840, 11825, 11811, 11796, 11782, 11767, 11753, 11739,
11724, 11710, 11696, 11682, 11667, 11653, 11639, 11625,
11610, 11596, 11582, 11568, 11554, 11539, 11525, 11511,
11497, 11483, 11469, 11455, 11441, 11427, 11413, 11399,
11385, 11371, 11357, 11343, 11329, 11315, 11301, 11287,
11273, 11259, 11245, 11232, 11218, 11204, 11190, 11176,
11163, 11149, 11135, 11121, 11108, 11094, 11080, 11067,
11053, 11039, 11026, 11012, 10999, 10985, 10971, 10958,
10944, 10931, 10917, 10904, 10890, 10877, 10863, 10850,
10836, 10823, 10810, 10796, 10783, 10770, 10756, 10743,
10730, 10716, 10703, 10690, 10676, 10663, 10650, 10637,
10624, 10610, 10597, 10584, 10571, 10558, 10545, 10532,
10519, 10506, 10492, 10479, 10466, 10453, 10440, 10427,
10414, 10402, 10389, 10376, 10363, 10350, 10337, 10324,
10311, 10299, 10286, 10273, 10260, 10247, 10235, 10222,
10209, 10196, 10184, 10171, 10158, 10146, 10133, 10121,
10108, 10095, 10083, 10070, 10058, 10045, 10033, 10020,
10008, 9995, 9983, 9970, 9958, 9945, 9933, 9921,
9908, 9896, 9884, 9871, 9859, 9847, 9834, 9822,
9810, 9798, 9785, 9773, 9761, 9749, 9737, 9725,
9712, 9700, 9688, 9676, 9664, 9652, 9640, 9628,
9616, 9604, 9592, 9580, 9568, 9556, 9544, 9532,
9521, 9509, 9497, 9485, 9473, 9461, 9450, 9438,
9426, 9414, 9403, 9391, 9379, 9367, 9356, 9344,
9332, 9321, 9309, 9298, 9286, 9275, 9263, 9251,
9240, 9228, 9217, 9205, 9194, 9183, 9171, 9160,
9148, 9137, 9126, 9114, 9103, 9092, 9080, 9069,
9058, 9047, 9035, 9024, 9013, 9002, 8990, 8979,
8968, 8957, 8946, 8935, 8924, 8913, 8902, 8891,
8880, 8869, 8858, 8847, 8836, 8825, 8814, 8803,
8792, 8781, 8770, 8759, 8749, 8738, 8727, 8716,
8705, 8695, 8684, 8673, 8662, 8652, 8641, 8630,
8620, 8609, 8599, 8588, 8577, 8567, 8556, 8546,
8535, 8525, 8514, 8504, 8493, 8483, 8472, 8462,
8452, 8441, 8431, 8421, 8410, 8400, 8390, 8379,
8369, 8359, 8349, 8338, 8328, 8318, 8308, 8298,
8288, 8277, 8267, 8257, 8247, 8237, 8227, 8217,
8207, 8197, 8187, 8177, 8167, 8157, 8147, 8137,
8128, 8118, 8108, 8098, 8088, 8078, 8069, 8059,
8049, 8039, 8030, 8020, 8010, 8001, 7991, 7981,
7972, 7962, 7952, 7943, 7933, 7924, 7914, 7905,
7895, 7886, 7876, 7867, 7857, 7848, 7839, 7829,
7820, 7811, 7801, 7792, 7783, 7773, 7764, 7755,
7746, 7736, 7727, 7718, 7709, 7700, 7691, 7681,
7672, 7663, 7654, 7645, 7636, 7627, 7618, 7609,
7600, 7591, 7582, 7573, 7564, 7555, 7547, 7538,
7529, 7520, 7511, 7502, 7494, 7485, 7476, 7467,
7459, 7450, 7441, 7433, 7424, 7415, 7407, 7398,
7390, 7381, 7373, 7364, 7355, 7347, 7338, 7330,
7322, 7313, 7305, 7296, 7288, 7280, 7271, 7263,
7255, 7246, 7238, 7230, 7221, 7213, 7205, 7197,
7189, 7180, 7172, 7164, 7156, 7148, 7140, 7132,
7124, 7116, 7108, 7100, 7092, 7084, 7076, 7068,
7060, 7052, 7044, 7036, 7029, 7021, 7013, 7005,
6997, 6990, 6982, 6974, 6966, 6959, 6951, 6943,
6936, 6928, 6920, 6913, 6905, 6898, 6890, 6883,
6875, 6868, 6860, 6853, 6845, 6838, 6830, 6823,
6815, 6808, 6801, 6793, 6786, 6779, 6772, 6764,
6757, 6750, 6743, 6735, 6728, 6721, 6714, 6707,
6700, 6693, 6686, 6678, 6671, 6664, 6657, 6650,
6643, 6636, 6630, 6623, 6616, 6609, 6602, 6595,
6588, 6581, 6575, 6568, 6561, 6554, 6548, 6541,
6534, 6527, 6521, 6514, 6507, 6501, 6494, 6488,
6481, 6475, 6468, 6461, 6455, 6448, 6442, 6436,
6429, 6423, 6416, 6410, 6404, 6397, 6391, 6385,
6378, 6372, 6366, 6359, 6353, 6347, 6341, 6335,
6329, 6322, 6316, 6310, 6304, 6298, 6292, 6286,
6280, 6274, 6268, 6262, 6256, 6250, 6244, 6238,
6232, 6226, 6221, 6215, 6209, 6203, 6197, 6192,
6186, 6180, 6174, 6169, 6163, 6157, 6152, 6146,
6140, 6135, 6129, 6124, 6118, 6113, 6107, 6102,
6096, 6091, 6085, 6080, 6074, 6069, 6064, 6058,
6053, 6048, 6042, 6037, 6032, 6027, 6021, 6016,
6011, 6006, 6001, 5995, 5990, 5985, 5980, 5975,
5970, 5965, 5960, 5955, 5950, 5945, 5940, 5935,
5930, 5925, 5920, 5915, 5911, 5906, 5901, 5896,
5891, 5887, 5882, 5877, 5872, 5868, 5863, 5858,
5854, 5849, 5845, 5840, 5835, 5831, 5826, 5822,
5817, 5813, 5808, 5804, 5799, 5795, 5791, 5786,
5782, 5778, 5773, 5769, 5765, 5760, 5756, 5752,
5748, 5743, 5739, 5735, 5731, 5727, 5723, 5719,
5714, 5710, 5706, 5702, 5698, 5694, 5690, 5686,
5682, 5678, 5675, 5671, 5667, 5663, 5659, 5655,
5651, 5648, 5644, 5640, 5636, 5633, 5629, 5625,
5622, 5618, 5614, 5611, 5607, 5604, 5600, 5596,
5593, 5589, 5586, 5582, 5579, 5576, 5572, 5569,
5565, 5562, 5559, 5555, 5552, 5549, 5545, 5542,
5539, 5536, 5532, 5529, 5526, 5523, 5520, 5517,
5514, 5511, 5507, 5504, 5501, 5498, 5495, 5492,
5489, 5486, 5484, 5481, 5478, 5475, 5472, 5469,
5466, 5464, 5461, 5458, 5455, 5452, 5450, 5447,
5444, 5442, 5439, 5436, 5434, 5431, 5429, 5426,
5424, 5421, 5419, 5416, 5414, 5411, 5409, 5406,
5404, 5401, 5399, 5397, 5394, 5392, 5390, 5388,
5385, 5383, 5381, 5379, 5376, 5374, 5372, 5370,
5368, 5366, 5364, 5362, 5360, 5358, 5356, 5354,
5352, 5350, 5348, 5346, 5344, 5342, 5340, 5338,
5336, 5335, 5333, 5331, 5329, 5328, 5326, 5324,
5322, 5321, 5319, 5317, 5316, 5314, 5313, 5311,
5309, 5308, 5306, 5305, 5303, 5302, 5301, 5299,
5298, 5296, 5295, 5294, 5292, 5291, 5290, 5288,
5287, 5286, 5285, 5283, 5282, 5281, 5280, 5279,
5278, 5276, 5275, 5274, 5273, 5272, 5271, 5270,
5269, 5268, 5267, 5266, 5265, 5265, 5264, 5263,
5262, 5261, 5260, 5260, 5259, 5258, 5257, 5257,
5256, 5255, 5255, 5254, 5253, 5253, 5252, 5251,
5251, 5250, 5250, 5249, 5249, 5248, 5248, 5247,
5247, 5247, 5246, 5246, 5246, 5245, 5245, 5245,
5244, 5244, 5244, 5244, 5243, 5243, 5243, 5243,
5243, 5243, 5243, 5243, 5242, 5242, 5242, 5242,
};
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package minersinstrument.cryptographic;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author PKopychenko
*/
public class Functions {
//private static MessageDigest currentAlgorithm;
/* Вычисление дайджеста сообщения для байтового массива о отображение его
* в возвращаемом значении.
* b - есть байтовый массив, для которого вычисляется дайджест.*/
public static String computeDigest(byte[] b, String cr) {
try {
MessageDigest currentAlgorithm = MessageDigest.getInstance(cr);
currentAlgorithm.reset();
currentAlgorithm.update(b);
byte[] hash = currentAlgorithm.digest();
String d = "";
int i;
for (i = 0; i < hash.length; i++) {
int v = hash[i] & 0xFF;
if (v < 16) {
d += "0";
}
//d += Integer.toString( v , 16 ).toUpperCase() + " ";
d += Integer.toString(v, 16).toUpperCase();
}
return d;
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(Functions.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
// Перегрузка
public static String computeDigest(char[] c, String cr) {
try {
byte[] b = new byte[c.length];
for (int i = 0; i < c.length; ++i) {
b[i] = (byte) c[i];
}
MessageDigest currentAlgorithm = MessageDigest.getInstance(cr);
currentAlgorithm.reset();
currentAlgorithm.update(b);
byte[] hash = currentAlgorithm.digest();
String d = "";
for (byte aHash : hash) {
int v = aHash & 0xFF;
if (v < 16) {
d += "0";
}
d += Integer.toString(v, 16).toUpperCase();
}
return d;
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(Functions.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
// Перегрузка
public static String computeDigest(String s, String cr) {
try {
byte[] b = new byte[s.length()];
for (int i = 0; i < s.length(); ++i) {
b[i] = (byte) s.charAt(i);
}
MessageDigest currentAlgorithm = MessageDigest.getInstance(cr);
currentAlgorithm.reset();
currentAlgorithm.update(b);
byte[] hash = currentAlgorithm.digest();
String d = "";
for (byte aHash : hash) {
int v = aHash & 0xFF;
if (v < 16) {
d += "0";
}
//d += Integer.toString( v , 16 ).toUpperCase() + " ";
d += Integer.toString(v, 16).toUpperCase();
}
return d;
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(Functions.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
public static byte[] computeDigestAsBytes(String s, String cr) throws NoSuchAlgorithmException {
byte[] b = new byte[s.length()];
for (int i = 0; i < s.length(); ++i) {
b[i] = (byte) s.charAt(i);
}
MessageDigest currentAlgorithm = MessageDigest.getInstance(cr);
currentAlgorithm.reset();
currentAlgorithm.update(b);
byte[] hash = currentAlgorithm.digest();
return hash;
}
}
|
#!/bin/bash
if [ $PY3K -eq 1 ]; then
2to3 -w -n build/test/RBT_HOME/check_test.py
fi
export C_INCLUDE_PATH=${PREFIX}/include
export CPP_INCLUDE_PATH=${PREFIX}/include
export CPLUS_INCLUDE_PATH=${PREFIX}/include
export CXX_INCLUDE_PATH=${PREFIX}/include
export LIBRARY_PATH=${PREFIX}/lib
cd build/
make linux-g++-64
make test
cd ..
cp lib/libRbt.so.rDock_2013.1_src "${PREFIX}/lib/"
PERL_INSTALLSITELIB=$(perl -e 'use Config; print "$Config{installsitelib}"')
mkdir -p "${PERL_INSTALLSITELIB}" "${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/bin"
cp lib/*.pl lib/*.pm "${PERL_INSTALLSITELIB}"
mv data/ "${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/"
# Create wrappers for binaries that need RBT_ROOT to be in the environment
for f in rbcalcgrid rbcavity rbdock rblist rbmoegrid; do
mv "bin/$f" "${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}/bin/"
sed -e "s|CHANGEME|${PREFIX}/share/${PKG_NAME}-${PKG_VERSION}-${PKG_BUILDNUM}|" "$RECIPE_DIR/wrapper.sh" > "${PREFIX}/bin/$f"
chmod +x "${PREFIX}/bin/$f"
done
# Remove unused to_unix
rm bin/to_unix
cp bin/* "${PREFIX}/bin/"
|
import { Platform } from '@angular/cdk/platform';
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
Input,
OnChanges,
OnDestroy,
Output,
ViewEncapsulation
} from '@angular/core';
import { Subscription } from 'rxjs';
import { filter } from 'rxjs/operators';
import { AlainConfigService, AlainQRConfig } from '@delon/util/config';
import { InputNumber, NumberInput } from '@delon/util/decorator';
import { LazyService } from '@delon/util/other';
import { QR_DEFULAT_CONFIG } from './qr.config';
import { QROptions } from './qr.types';
@Component({
selector: 'qr',
exportAs: 'qr',
template: ` <img *ngIf="dataURL" style="max-width: 100%; max-height: 100%;" [src]="dataURL" /> `,
host: {
'[style.display]': `'inline-block'`,
'[style.height.px]': 'size',
'[style.width.px]': 'size'
},
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
})
export class QRComponent implements OnChanges, AfterViewInit, OnDestroy {
static ngAcceptInputType_padding: NumberInput;
static ngAcceptInputType_size: NumberInput;
static ngAcceptInputType_delay: NumberInput;
private lazy$: Subscription;
private qr: any;
private cog: AlainQRConfig;
private option: QROptions;
private inited = false;
dataURL: string;
@Input() background: string;
@Input() backgroundAlpha: number;
@Input() foreground: string;
@Input() foregroundAlpha: number;
@Input() level: string;
@Input() mime: string;
@Input() @InputNumber() padding: number;
@Input() @InputNumber() size: number;
@Input() value = '';
@Input() @InputNumber() delay: number;
@Output() readonly change = new EventEmitter<string>();
constructor(
private cdr: ChangeDetectorRef,
configSrv: AlainConfigService,
private lazySrv: LazyService,
private platform: Platform
) {
this.cog = configSrv.merge('qr', QR_DEFULAT_CONFIG)!;
Object.assign(this, this.cog);
}
private init(): void {
if (!this.inited) {
return;
}
if (this.qr == null) {
this.qr = new (window as any).QRious();
}
this.qr.set(this.option);
this.dataURL = this.qr.toDataURL();
this.change.emit(this.dataURL);
this.cdr.detectChanges();
}
private initDelay(): void {
this.inited = true;
setTimeout(() => this.init(), this.delay);
}
ngAfterViewInit(): void {
if (!this.platform.isBrowser) {
return;
}
if ((window as any).QRious) {
this.initDelay();
return;
}
const url = this.cog.lib!;
this.lazy$ = this.lazySrv.change
.pipe(filter(ls => ls.length === 1 && ls[0].path === url && ls[0].status === 'ok'))
.subscribe(() => this.initDelay());
this.lazySrv.load(url);
}
ngOnChanges(): void {
const option: QROptions = {
background: this.background,
backgroundAlpha: this.backgroundAlpha,
foreground: this.foreground,
foregroundAlpha: this.foregroundAlpha,
level: this.level as any,
mime: this.mime,
padding: this.padding,
size: this.size,
value: this.toUtf8ByteArray(this.value)
};
this.option = option;
this.init();
}
private toUtf8ByteArray(str: string): string {
str = encodeURI(str);
const result: number[] = [];
for (let i = 0; i < str.length; i++) {
if (str.charAt(i) !== '%') {
result.push(str.charCodeAt(i));
} else {
result.push(parseInt(str.substr(i + 1, 2), 16));
i += 2;
}
}
return result.map(v => String.fromCharCode(v)).join('');
}
ngOnDestroy(): void {
if (this.lazy$) {
this.lazy$.unsubscribe();
}
}
}
|
<script>
import axios from 'axios';
export default {
data() {
return {
city: 'London',
temperature: '',
description: ''
};
},
created() {
this.getWeatherInfo();
},
methods: {
async getWeatherInfo() {
const response = await axios({
method: 'get',
url: https://api.openweathermap.org/data/2.5/weather?q=${this.city}&units=metric&appid=YOUR_API_KEY,
timeout: 3000
});
this.temperature = response.data.main.temp;
this.description = response.data.weather[0].description;
}
}
};
</script> |
#!/bin/sh
for i in {10..14}
do
echo "Download Chapter ${i}"
mkdir "chapter${i}-contributors"
curl \
"http://www.climatechange2013.org/contributors/chapter/chapter-${i}" \
> "chapter${i}-contributors"/"chapter-${i}.html"
cat << EOF > "chapter0${i}-contributors"/meta.txt
Year: 2014
Title: Chapter ${i}
URL: http://www.climatechange2013.org/contributors/chapter/chapter-${i}
Tags: ipcc, ar5, wg1
EOF
sleep 1
done
|
<filename>delta/deltaModel.js
function DeltaModel(e, f, re, rf) {
// Calculates angle theta1 (for YZ-pane)
function calcAngleYZ(x0, y0, z0) {
var y1 = -0.5 * 0.57735 * f; // f/2 * tan(30 degrees)
y0 -= 0.5 * 0.57735 * e; // Shift center to edge of effector
// z = a + b*y
var a = (x0 * x0 + y0 * y0 + z0 * z0 + rf * rf - re * re - y1 * y1) / (2.0 * z0),
b = (y1 - y0) / z0;
// Discriminant
var d = -(a + b * y1) * (a + b * y1) + rf * (b * b * rf + rf);
if (d < 0) {
// Non-existing position. return early with error.
return [1, 0];
}
// Choose outer position of cicle
var yj = (y1 - a * b - Math.sqrt(d)) / (b * b + 1);
var zj = a + b * yj;
var theta = Math.atan(-zj / (y1 - yj)) * 180.0 / Math.PI + ((yj > y1) ? 180.0 : 0.0);
return [0, theta]; // Return error, theta
};
// Calculate theta for each arm
function inverse(x0, y0, z0) {
var theta1 = 0,
theta2 = 0,
theta3 = 0,
cos120 = Math.cos(Math.PI * (120/180)),
sin120 = Math.sin(Math.PI * (120/180)),
status = calcAngleYZ(x0, y0, z0);
if (status[0] === 0) {
theta1 = status[1];
status = calcAngleYZ(x0 * cos120 + y0 * sin120, y0 * cos120 - x0 * sin120, z0, theta2);
}
if (status[0] === 0) {
theta2 = status[1];
status = calcAngleYZ(x0 * cos120 - y0 * sin120, y0 * cos120 + x0 * sin120, z0, theta3);
theta3 = status[1];
}
return [status[0], theta1, theta2, theta3];
};
return {
inverse: inverse
};
}
module.exports = DeltaModel;
|
import styled from '@xstyled/styled-components'
import { shouldForwardProp } from '@welcome-ui/system'
export const Box = styled.box.withConfig({ shouldForwardProp })``
|
from typing import List
from importlib import import_module
from types import ModuleType
def import_modules(module_names: List[str]) -> List[ModuleType]:
base_package = 'package'
imported_modules = []
for module_name in module_names:
try:
module = import_module(f"{base_package}.{module_name}")
imported_modules.append(module)
except ModuleNotFoundError:
pass
return imported_modules |
<gh_stars>1-10
package com.darian.eurekaclosedsource;
import lombok.Data;
/***
*
*
* @author <a href="mailto:<EMAIL>">Darian</a>
* @date 2020/5/25 23:13
*/
@Data
public class User {
private String name = "darian";
}
|
#!/bin/sh
#==============================================================================
# ______ _ _ _
# | ____(_) | | |
# | |__ _| | ___ ___ _ _ ___| |_ ___ _ __ ___
# | __| | | |/ _ \ / __| | | / __| __/ _ \ '_ ` _ \
# | | | | | __/ \__ \ |_| \__ \ || __/ | | | | |
# |_| |_|_|\___| |___/\__, |___/\__\___|_| |_| |_|
# __/ |
#=========================|___/================================================
# FILE SYSTEM BASED ASSERTIONS
#==============================================================================
#==============================================================================
# File system based assertions can be executed at any time without any context
# as they are working on the given parameters only. They can be used to check
# file system related facts.
#==============================================================================
#==============================================================================
# File system based assertion that checks if the given path does name a file.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] file_path - Path that should name a file.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_file() {
___file_path="$1"
posix_test__debug 'assert_file' "asserting file existence: '${___file_path}'"
if [ -f "$___file_path" ]
then
posix_test__debug 'assert_file' '=> assertion succeeded'
else
posix_test__debug 'assert_file' '=> assertion failed'
___subject='Path does not name a file'
___reason="File does not exist at path: '${___file_path}'."
___assertion='assert_file'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does not name a
# file.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] file_path - Path that should not name a file.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_no_file() {
___file_path="$1"
posix_test__debug 'assert_no_file' \
"asserting file non existence: '${___file_path}'"
if [ ! -f "$___file_path" ]
then
posix_test__debug 'assert_no_file' '=> assertion succeeded'
else
posix_test__debug 'assert_no_file' '=> assertion failed'
___subject='File exists on path'
___reason="File should not exists at: '${___file_path}'."
___assertion='assert_no_file'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does name a file
# and that file has nonzero content.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] file_path - Path that should name a file and should have nonzero
# content.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_file_has_content() {
___file_path="$1"
posix_test__debug 'assert_file_has_content' \
"asserting file content: '${___file_path}'"
if [ -f "$___file_path" ]
then
if [ -s "$___file_path" ]
then
posix_test__debug 'assert_file_has_content' '=> assertion succeeded'
else
posix_test__debug 'assert_file_has_content' '=> assertion failed'
___subject='File exists but it is empty'
___reason="File should not be empty: '${___file_path}'."
___assertion='assert_file_has_content'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
else
posix_test__debug 'assert_file_has_content' '=> assertion failed'
___subject='Path does not name a file'
___reason="File does not exist at path: '${___file_path}'."
___assertion='assert_file_has_content'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does name a file
# and that file has no content.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] file_path - Path that should name a file but it should be empty.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_file_has_no_content() {
___file_path="$1"
posix_test__debug 'assert_file_has_no_content' \
"asserting file empty: '${___file_path}'"
if [ -f "$___file_path" ]
then
if [ ! -s "$___file_path" ]
then
posix_test__debug 'assert_file_has_no_content' '=> assertion succeeded'
else
posix_test__debug 'assert_file_has_no_content' '=> assertion failed'
___subject='File exists but it is not empty'
___reason="File should be empty: '${___file_path}'."
___assertion='assert_file_has_no_content'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
else
posix_test__debug 'assert_file_has_no_content' '=> assertion failed'
___subject='Path does not name a file'
___reason="File does not exist at path: '${___file_path}'."
___assertion='assert_file_has_no_content'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does name a
# directory.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] directory_path - Path that needs to name a directory.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_directory() {
___directory_path="$1"
posix_test__debug 'assert_directory' \
"asserting directory existence: '${___directory_path}'"
if [ -d "$___directory_path" ]
then
posix_test__debug 'assert_directory' '=> assertion succeeded'
else
posix_test__debug 'assert_directory' '=> assertion failed'
___subject='Path does not name a directory'
___reason="Directory does not exist at path: '${___directory_path}'."
___assertion='assert_directory'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does not name a
# directory.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] directory_path - Path that should not name a directory.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_no_directory() {
___directory_path="$1"
posix_test__debug 'assert_no_directory' \
"asserting lack of directory: '${___directory_path}'"
if [ ! -d "$___directory_path" ]
then
posix_test__debug 'assert_no_directory' '=> assertion succeeded'
else
posix_test__debug 'assert_no_directory' '=> assertion failed'
___subject='Path should not name a directory'
___reason="Directory should not exist at path: '${___directory_path}'."
___assertion='assert_no_directory'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does name a
# directory and the directory is empty.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] directory_path - Path that needs to name a directory that should be
# empty.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_directory_empty() {
___directory_path="$1"
posix_test__debug 'assert_directory_empty' \
"asserting directory is empty: '${___directory_path}'"
if [ -d "$___directory_path" ]
then
if [ -z "$(posix_adapter__ls --almost-all "$___directory_path")" ]
then
posix_test__debug 'assert_directory_empty' '=> assertion succeeded'
else
posix_test__debug 'assert_directory_empty' '=> assertion failed'
___subject='Directory is not empty'
___reason="Directory should be empty: '${___directory_path}'."
___assertion='assert_directory_empty'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
else
posix_test__debug 'assert_directory_empty' '=> assertion failed'
___subject='Path does not name a directory'
___reason="Directory does not exist at path: '${___directory_path}'."
___assertion='assert_directory_empty'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does name a
# directory and the directory is not empty.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] directory_path - Path that needs to name a directory that should not be
# empty.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_directory_not_empty() {
___directory_path="$1"
posix_test__debug 'assert_directory_not_empty' \
"asserting directory is not empty: '${___directory_path}'"
if [ -d "$___directory_path" ]
then
if [ -n "$(posix_adapter__ls --almost-all "$___directory_path")" ]
then
posix_test__debug 'assert_directory_not_empty' '=> assertion succeeded'
else
posix_test__debug 'assert_directory_not_empty' '=> assertion failed'
___subject='Directory is empty'
___reason="Directory should not be empty: '${___directory_path}'."
___assertion='assert_directory_not_empty'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
else
posix_test__debug 'assert_directory_not_empty' '=> assertion failed'
___subject='Path does not name a directory'
___reason="Directory does not exist at path: '${___directory_path}'."
___assertion='assert_directory_not_empty'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does name a
# symlink.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] link_path - Path that needs to name a symbolic link.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_symlink() {
___link_path="$1"
posix_test__debug 'assert_symlink' \
"asserting symlink existence: '${___link_path}'"
if [ -L "$___link_path" ]
then
posix_test__debug 'assert_symlink' '=> assertion succeeded'
else
posix_test__debug 'assert_symlink' '=> assertion failed'
___subject='Path does not name a symbolic link'
___reason="Symbolic link does not exist at path: '${___link_path}'."
___assertion='assert_symlink'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path does not name a
# symlink.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] link_path - Path that should not name a symbolic link.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_no_symlink() {
___link_path="$1"
posix_test__debug 'assert_no_symlink' \
"asserting symlink non existence: '${___link_path}'"
if [ ! -L "$___link_path" ]
then
posix_test__debug 'assert_no_symlink' '=> assertion succeeded'
else
posix_test__debug 'assert_no_symlink' '=> assertion failed'
___subject='Path should not name a symbolic link'
___reason="Symbolic link should not exist at path: '${___link_path}'."
___assertion='assert_no_symlink'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
#==============================================================================
# File system based assertion that checks if the given path names a symlink and
# the target is correct.
#------------------------------------------------------------------------------
# Globals:
# None
# Arguments:
# [1] link_path - Path that needs to name a symbolic link.
# [2] target_path - Path that is the target of the link.
# STDIN:
# None
#------------------------------------------------------------------------------
# Output variables:
# None
# STDOUT:
# None
# STDERR:
# None
# Status:
# 0 - Assertion succeeded.
# 1 - Assertion failed.
#==============================================================================
assert_symlink_target() {
___link_path="$1"
___target_path="$2"
posix_test__debug 'assert_symlink_target' \
"asserting symlink '${___link_path}' target '${___target_path}'"
if [ -L "$___link_path" ]
then
___actual_target="$(posix_adapter__readlink "$___link_path")"
if [ "$___target_path" = "$___actual_target" ]
then
posix_test__debug 'assert_symlink_target' '=> assertion succeeded'
else
posix_test__debug 'assert_symlink_target' '=> assertion failed'
___subject='Symbolic link target does not match'
___reason="$( \
echo "expected target: '${___target_path}'"; \
echo "actual target: '${___actual_target}'." \
)"
___assertion='assert_symlink_target'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
else
posix_test__debug 'assert_symlink_target' '=> assertion failed'
___subject='Path does not name a symbolic link'
___reason="Symbolic link does not exist at path: '${___link_path}'."
___assertion='assert_symlink_target'
_posix_test__assert__report_failure "$___subject" "$___reason" "$___assertion"
fi
}
|
#!/bin/bash
set -e
TARGET=$1
OUTPUT_PATH=$2
if [[ -z "$TARGET" ]] || [[ -z "$OUTPUT_PATH" ]]; then
echo "usage: compile.sh [target] [output path]"
exit 1
fi
if [[ -f $HOME/.cargo/env ]]; then
source $HOME/.cargo/env
fi
SCRIPT_DIR=$(dirname "$0")
SCRIPT_DIR=`cd $SCRIPT_DIR;pwd`
mkdir -p $(dirname $OUTPUT_PATH)
echo "Compiling tunshell-client for $TARGET..."
cd $SCRIPT_DIR/../../
rustup target add $TARGET
if [[ ! -z "$RUN_TESTS" ]];
then
cross test -p tunshell-client --target $TARGET
fi
cross build -p tunshell-client --release --target $TARGET
cp $SCRIPT_DIR/../../target/$TARGET/release/client $OUTPUT_PATH
if [[ $TARGET =~ "linux" ]] || [[ $TARGET =~ "freebsd" ]];
then
case $TARGET in
x86_64-unknown-linux-musl|i686-unknown-linux-musl|i586-unknown-linux-musl)
STRIP="strip"
;;
aarch64-unknown-linux-musl)
STRIP="aarch64-linux-musl-strip"
;;
arm-unknown-linux-musleabi)
STRIP="arm-linux-musleabi-strip"
;;
armv7-unknown-linux-musleabihf)
STRIP="arm-linux-musleabihf-strip"
;;
arm-linux-androideabi)
STRIP="arm-linux-androideabi-strip"
;;
aarch64-linux-android)
STRIP="aarch64-linux-android-strip"
;;
mips-unknown-linux-musl)
STRIP="mips-linux-muslsf-strip"
;;
x86_64-unknown-freebsd)
STRIP="x86_64-unknown-freebsd12-strip"
;;
*)
echo "Unknown linux target: $TARGET"
exit 1
;;
esac
echo "Stripping binary using cross docker image ($STRIP)..."
docker run --rm -v$(dirname $OUTPUT_PATH):/app/ rustembedded/cross:$TARGET $STRIP /app/$(basename $OUTPUT_PATH)
elif [[ -x "$(command -v strip)" && $TARGET =~ "apple" ]];
then
echo "Stripping binary..."
strip $OUTPUT_PATH
fi
echo "Binary saved to: $OUTPUT_PATH" |
#!/bin/bash
# Copyright (c) 2021 Red Hat, Inc.
# Copyright Contributors to the Open Cluster Management project
set -o errexit
set -o nounset
########################
# include the magic
########################
. ../../demo-magic.sh
# hide the evidence
clear
pe 'kubectl get managedclusters'
pe 'kubectl label managedcluster cluster7 env=production'
pe 'kubectl label managedcluster cluster8 env=production'
pe 'kubectl label managedcluster cluster9 env=production'
|
<reponame>AaltoIIC/OSEMA
"""Loop measurement and control often data is sent to server"""
def measure(i2c):
print("measure continuous")
measure_loop(i2c)
class Measure:
def __init__(self, i2c):
self.client = MQTTClient(str(SENSOR_ID), BROKER_URL, user=USER, password=<PASSWORD>, port=BROKER_PORT)
self.client.connect()
self.i2c = i2c
self.period_time_us = int(round((1/SAMPLE_RATE_HZ) * 1000000))
self.__alarm = Timer.Alarm(self._measurement, us=self.period_time_us, periodic=True)
#Called every period_time_us
def _measurement(self, alarm):
data = read_values(self.i2c)
data_string = format_data(convert_to_epoch(machine.RTC().now()), data)
try:
self.client.publish(topic=TOPIC, msg=data_string)
except:
print("Data couldn't be published, resetting board!")
machine.reset()
|
#!/bin/sh
# Directives
#PBS -N scf_fast_freq_diff_2.5e4
#PBS -W group_list=yetiastro
#PBS -l nodes=1:ppn=1,walltime=8:00:00,mem=8gb
#PBS -M amp2217@columbia.edu
#PBS -m abe
#PBS -V
# Set output and error directories
#PBS -o localhost:/vega/astro/users/amp2217/pbs_output
#PBS -e localhost:/vega/astro/users/amp2217/pbs_output
# print date and time to file
date
#Command to execute Python program
cd /vega/astro/users/amp2217/projects/morphology/simulations/runs/fast_freq_diff_2.5e4
make
./scf
/vega/astro/users/amp2217/projects/gary/bin/moviesnap --path=/vega/astro/users/amp2217/projects/morphology/simulations/runs/fast_freq_diff_2.5e4
date
#End of script
|
import { assert } from "chai";
import { utilsNull } from "";
describe("null : method is", () => {
it("is : true", () => {
assert.isTrue(utilsNull.is(null), "is(null) === true");
});
it("is : false", () => {
assert.isFalse(utilsNull.is([]), "is([]) === false");
assert.isFalse(utilsNull.is([1, 2, 3]), "is([1, 2, 3]) === false");
assert.isFalse(utilsNull.is(true), "is(true) === false");
assert.isFalse(utilsNull.is(false), "is(false) === false");
assert.isFalse(
utilsNull.is(new Date("1995-12-17T03:24:00")),
"is(new Date('1995-12-17T03:24:00')) === false"
);
assert.isFalse(
utilsNull.is(() => 1),
"is(() => 1) === false"
);
assert.isFalse(utilsNull.is(3), "is(3) === false");
assert.isFalse(utilsNull.is(NaN), "is(NaN) === false");
assert.isFalse(utilsNull.is({}), "is({}) === false");
assert.isFalse(utilsNull.is(/ab+c/), "is(/ab+c/) === false");
assert.isFalse(utilsNull.is("ABC"), "is('ABC') === false");
assert.isFalse(utilsNull.is("true"), "is('true') === false");
assert.isFalse(utilsNull.is(Symbol()), "is(Symbol()) === false");
assert.isFalse(utilsNull.is(Symbol(42)), "is(Symbol(42)) === false");
assert.isFalse(utilsNull.is(Symbol("foo")), "is(Symbol('foo')) === false");
assert.isFalse(utilsNull.is(undefined), "is(undefined) === false");
assert.isFalse(utilsNull.is(), "is() === false");
});
});
|
/*
* Amazon FreeRTOS MQTT Remote HVAC Demo V1.0.0
*/
/**
* @file aws_remote_hvac.c
* @brief
*
* ----
*
*/
/* Standard includes. */
#include "string.h"
#include "stdio.h"
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "message_buffer.h"
/* MQTT includes. */
#include "aws_mqtt_agent.h"
#include "jsmn.h"
/* Credentials includes. */
#include "aws_clientcredential.h"
/* Demo includes. */
#include "aws_demo_config.h"
#include "../aws_home_automation_demo.h"
#include "../module_common.h"
#include "module_sensor.h"
#include "module_display.h"
#include "aws_ota_agent.h"
#include "aws_application_version.h"
static void App_OTACompleteCallback( OTA_JobEvent_t eEvent );
void vOTAUpdateDemoTask( void * pvParameters );
static const char * pcStateStr[ eOTA_NumAgentStates ] =
{
"Not Ready",
"Ready",
"Active",
"Shutting down"
};
// --------------------------------------------------------------------- MACROS
// MQTT client ID. Note that it must be unique per MQTT broker.
#define mqttCLIENT_ID clientcredentialIOT_THING_NAME
// The topic that the MQTT client publishes to.
#define mqttSTATUS_TOPIC_NAME "thermostats/" mqttCLIENT_ID "/status"
// The topic that the MQTT client subscribes to.
#define mqttCONFIG_TOPIC_NAME "thermostats/" mqttCLIENT_ID "/config"
#define mqttSHADOW_GET "$aws/things/" mqttCLIENT_ID "/shadow/get"
#define mqttSHADOW_UPDATE "$aws/things/" mqttCLIENT_ID "/shadow/update"
#define mqttSHADOW_UPDATE_ACPT "$aws/things/" mqttCLIENT_ID "/shadow/update/accepted"
#define mqttSHADOW_UPDATE_REJT "$aws/things/" mqttCLIENT_ID "/shadow/update/rejected"
#define mqttSHADOW_UPDATE_DELTA "$aws/things/" mqttCLIENT_ID "/shadow/update/delta"
// ---------------------------------------------------------------------- TYPES
enum
{
DISCONNECTED,
CONNECTED,
};
typedef struct
{
MODULE_STATE state;
} CONNECTION_DATA;
// ------------------------------------------------------------------ VARIABLES
CONNECTION_DATA connectionData;
// The handle of the MQTT client object used by the MQTT echo demo.
static MQTTAgentHandle_t xMQTTHandle = NULL;
// Common connection parameters
static MQTTAgentConnectParams_t xConnectParameters;
// Common subscribe parameters
static MQTTAgentSubscribeParams_t xSubscribeParams;
// Common publish parameters
static MQTTAgentPublishParams_t xPublishParameters;
// Common error code used to print message via logger.
static MQTTAgentReturnCode_t xErrorCode;
// ---------------------------------------------- PRIVATE FUNCTION DECLARATIONS
static void connector_task ( void );
static MODULE_RETURN create_client ( void );
static MODULE_RETURN delete_client ( void );
static MODULE_RETURN connect_to_broker ( void );
static MODULE_RETURN disconnect_from_broker ( void );
static MODULE_RETURN subscribe_to_topic ( void );
static MODULE_RETURN publish_message ( char *message );
static MODULE_RETURN publish_shadow_update ( char *message );
static MQTTBool_t prvMQTTCallback ( void * pvUserData,
const MQTTPublishData_t * const pxPublishParameters );
// ----------------------------------------------------------- PUBLIC FUNCTIONS
void vStartRemoteHVACDemo ( void )
{
/* Initialize the Application */
#if AWS_WORKSHOP_SECTION_2_CONN_2 == 1
DISPLAY_Initialize();
#endif
#if AWS_WORKSHOP_SECTION_3_TELEMETRY == 1
SENSOR_Initialize();
HVAC_Initialize();
#endif
#if AWS_WORKSHOP_SECTION_4_SHADOW == 1
THERMOSTAT_Initialize();
#endif
configPRINTF( ( "Creating Connector Task...\r\n" ) );
connectionData.state = MODULE_STATE_INIT;
(void) xTaskCreate( (TaskFunction_t) connector_task,
"Connector Task",
CONNECTOR_TASK_STACK_SIZE,
NULL,
CONNECTOR_TASK_PRIORITY,
NULL
);
#if AWS_WORKSHOP_SECTION_5_OTA == 1
(void) xTaskCreate( vOTAUpdateDemoTask,
"OTA",
democonfigOTA_UPDATE_TASK_STACK_SIZE,
NULL,
democonfigOTA_UPDATE_TASK_TASK_PRIORITY,
NULL );
#endif
}
// -------------------------------------------- PRIVATE FUNCTION IMPLEMENTATION
static void connector_task ( void )
{
for ( ; ; )
{
switch ( connectionData.state )
{
case MODULE_STATE_INIT:
{
// Attempt to create client.
if ( create_client( ) == MODULE_OK )
{
connectionData.state = MODULE_STATE_PREACTIVE;
}
else
{
configPRINTF( ( "Failed to create client. [ERROR : %d]\r\n",
xErrorCode ) );
}
break;
}
case MODULE_STATE_PREACTIVE:
{
// Attempt to connect to broker.
if ( connect_to_broker( ) == MODULE_OK )
{
/*
If connection to broker was successful attempt
subscription to config topic.
*/
if ( subscribe_to_topic( ) == MODULE_OK )
{
connectionData.state = MODULE_STATE_ACTIVE;
}
else
{
configPRINTF( ( "Failed to subscribe. [ERROR : %d]\r\n",
xErrorCode ) );
}
}
else
{
configPRINTF( ( "Failed to connect. [ERROR : %d]\r\n",
xErrorCode ) );
}
break;
}
case MODULE_STATE_ACTIVE:
{
char cDataBuffer[ 256 ];
SENSOR_VALUE sensorv;
FAN_STATE fanv;
AIRCON_STATE airconv;
float targetv;
// New fan data received - publish it to status topic.
if ( xQueueReceive( qCONN_Fan, (FAN_STATE *) &fanv,
RTOS_NO_BLOCKING ) )
{
(void) sprintf( cDataBuffer, mqttFAN_DESIRED_PAYLOAD,
jsonFAN_REFERENCE,
FAN_STATE_STRING[ fanv ] );
if ( publish_shadow_update( cDataBuffer ) != MODULE_OK )
{
configPRINTF( ( "Failed to publish %s. [ERROR: %d]\r\n",
cDataBuffer, xErrorCode ) );
}
}
// New aircon data received - publish it to status topic.
if ( xQueueReceive( qCONN_Aircon, (AIRCON_STATE *) &airconv,
RTOS_NO_BLOCKING ) )
{
(void) sprintf( cDataBuffer, mqttAIRCON_DESIRED_PAYLOAD,
jsonAIRCON_REFERENCE,
AIRCON_STATE_STRING[ airconv ] );
if ( publish_shadow_update( cDataBuffer ) != MODULE_OK )
{
configPRINTF( ( "Failed to publish %s. [ERROR: %d]\r\n",
cDataBuffer, xErrorCode ) );
}
}
// New sensor data received - publish it to status topic.
if ( xQueueReceive( qCONN_Sensor, (SENSOR_VALUE *) &sensorv,
RTOS_NO_BLOCKING ) )
{
(void) sprintf( cDataBuffer, mqttSENSOR_PAYLOAD, clientcredentialIOT_THING_NAME, xTaskGetTickCount(),
jsonSENSOR_T_REFERENCE, sensorv.temperature,
jsonSENSOR_H_REFERENCE, sensorv.humidity );
if ( publish_message( cDataBuffer ) != MODULE_OK )
{
configPRINTF( ( "Failed to publish %s. [ERROR: %d]\r\n",
cDataBuffer, xErrorCode ) );
}
}
// New target data received - publish it to status topic.
if ( xQueueReceive( qCONN_TargetT, (float *) &targetv,
RTOS_NO_BLOCKING ) )
{
(void) sprintf( cDataBuffer, mqttTARGET_DESIRED_PAYLOAD,
jsonTARGET_T_REFERENCE, targetv );
if ( publish_shadow_update( cDataBuffer ) != MODULE_OK )
{
configPRINTF( ( "Failed to publish %s. [ERROR: %d]\r\n",
cDataBuffer, xErrorCode ) );
}
}
break;
}
case MODULE_STATE_POSTACTIVE:
{
// Attempt to disconnect from broker.
if ( disconnect_from_broker( ) == MODULE_OK )
{
connectionData.state = MODULE_STATE_INACTIVE;
}
else
{
configPRINTF( ( "Failed to disconnect. [ERROR : %d]\r\n",
xErrorCode ) );
}
}
case MODULE_STATE_INACTIVE:
default:
break;
}
vTaskDelay( CONNECTOR_TASK_DELAY / portTICK_PERIOD_MS );
}
}
static MODULE_RETURN create_client ( void )
{
MODULE_RETURN xReturn = MODULE_ERROR;
// Fill connection parameters according to default configuration.
xConnectParameters.pcURL = clientcredentialMQTT_BROKER_ENDPOINT;
xConnectParameters.xFlags = democonfigMQTT_AGENT_CONNECT_FLAGS;
xConnectParameters.xURLIsIPAddress = pdFALSE;
xConnectParameters.usPort = clientcredentialMQTT_BROKER_PORT;
xConnectParameters.pucClientId = mqttCLIENT_ID;
xConnectParameters.xSecuredConnection = pdFALSE;
xConnectParameters.pvUserData = NULL;
xConnectParameters.pxCallback = NULL;
xConnectParameters.pcCertificate = NULL;
xConnectParameters.ulCertificateSize = 0;
xConnectParameters.usClientIdLength =
(uint16_t) strlen( (const char *) mqttCLIENT_ID );
// Check this function has not already been executed.
configASSERT( xMQTTHandle == NULL );
/*
The MQTT client object must be created before it can be used. The
maximum number of MQTT client objects that can exist simultaneously
is set by mqttconfigMAX_BROKERS.
*/
xErrorCode = MQTT_AGENT_Create( &xMQTTHandle );
if ( xErrorCode == eMQTTAgentSuccess )
{
xReturn = MODULE_OK;
}
return xReturn;
}
static MODULE_RETURN delete_client ( void )
{
MODULE_RETURN xReturn = MODULE_ERROR;
if ( MQTT_AGENT_Delete( xMQTTHandle ) == eMQTTAgentSuccess )
{
xReturn = MODULE_OK;
}
return xReturn;
}
static MODULE_RETURN connect_to_broker ( void )
{
MODULE_RETURN xReturn = MODULE_ERROR;
configPRINTF( ( "Attempting connection to %s.\r\n",
clientcredentialMQTT_BROKER_ENDPOINT ) );
xErrorCode = MQTT_AGENT_Connect( xMQTTHandle, &xConnectParameters,
democonfigMQTT_ECHO_TLS_NEGOTIATION_TIMEOUT );
if ( xErrorCode == eMQTTAgentSuccess )
{
int tmp = CONNECTED;
if ( xQueueSend( qDISPLAY_Conn, &tmp, RTOS_NO_BLOCKING ) )
{
// TODO : Handle error.
}
configPRINTF( ( "Successfully connected to broker.\r\n" ) );
xReturn = MODULE_OK;
}
return xReturn;
}
static MODULE_RETURN disconnect_from_broker ( void )
{
MODULE_RETURN xReturn = MODULE_ERROR;
configPRINTF( ( "Attempting to disconnect from %s.\r\n",
clientcredentialMQTT_BROKER_ENDPOINT ) );
xErrorCode = MQTT_AGENT_Disconnect( xMQTTHandle, democonfigMQTT_TIMEOUT );
if ( xErrorCode == eMQTTAgentSuccess )
{
int tmp = DISCONNECTED;
if ( xQueueSend( qDISPLAY_Conn, &tmp, RTOS_NO_BLOCKING ) )
{
// TODO : Handle error.
}
configPRINTF( ( "Successfully disconnected.\r\n" ) );
xReturn = MODULE_OK;
}
return xReturn;
}
/* Subscribe to a topic with a named callback. At the time of writing we are
using this method to subscribe to shadow topics
*/
static MODULE_RETURN subscribe_to_topic ( void )
{
MODULE_RETURN xReturn = MODULE_ERROR;
// Setup subscribe parameters to subscribe to mqttTOPIC_NAME topic.
xSubscribeParams.pucTopic = mqttCONFIG_TOPIC_NAME;
xSubscribeParams.pvPublishCallbackContext = NULL;
xSubscribeParams.pxPublishCallback = prvMQTTCallback;
xSubscribeParams.xQoS = eMQTTQoS1;
xSubscribeParams.usTopicLength =
(uint16_t) strlen( (const char *) mqttCONFIG_TOPIC_NAME );
// Subscribe to the topic.
xErrorCode = MQTT_AGENT_Subscribe( xMQTTHandle, &xSubscribeParams,
democonfigMQTT_TIMEOUT );
if ( xErrorCode == eMQTTAgentSuccess )
{
configPRINTF( ( "Subscribed to %s\r\n", mqttCONFIG_TOPIC_NAME ) );
xReturn = MODULE_OK;
}
return xReturn;
}
static MODULE_RETURN publish_message ( char *message )
{
MODULE_RETURN xReturn = MODULE_ERROR;
/*
Check this function is not being called before the MQTT client object
has been created.
*/
configASSERT( xMQTTHandle != NULL );
// Setup the publish parameters.
memset( &xPublishParameters, 0x00, sizeof( xPublishParameters ) );
xPublishParameters.pucTopic = mqttSTATUS_TOPIC_NAME;
xPublishParameters.pvData = message;
xPublishParameters.xQoS = eMQTTQoS1;
xPublishParameters.ulDataLength = (uint32_t) strlen( message );
xPublishParameters.usTopicLength =
(uint16_t) strlen( (const char *) mqttSTATUS_TOPIC_NAME );
// Publish the message.
xErrorCode = MQTT_AGENT_Publish( xMQTTHandle, &(xPublishParameters),
democonfigMQTT_TIMEOUT );
if ( xErrorCode == eMQTTAgentSuccess )
{
configPRINTF( ( "Published %s\r\n", message ) );
xReturn = MODULE_OK;
}
return xReturn;
}
static MODULE_RETURN publish_shadow_update ( char *message )
{
MODULE_RETURN xReturn = MODULE_ERROR;
/*
Check this function is not being called before the MQTT client object
has been created.
*/
configASSERT( xMQTTHandle != NULL );
// Setup the publish parameters.
memset( &xPublishParameters, 0x00, sizeof( xPublishParameters ) );
xPublishParameters.pucTopic = mqttSHADOW_UPDATE;
xPublishParameters.pvData = message;
xPublishParameters.xQoS = eMQTTQoS1;
xPublishParameters.ulDataLength = (uint32_t) strlen( message );
xPublishParameters.usTopicLength =
(uint16_t) strlen( (const char *) mqttSHADOW_UPDATE );
// Publish the message.
xErrorCode = MQTT_AGENT_Publish( xMQTTHandle, &(xPublishParameters),
democonfigMQTT_TIMEOUT );
if ( xErrorCode == eMQTTAgentSuccess )
{
configPRINTF( ( "Published %s\r\n", message ) );
xReturn = MODULE_OK;
}
return xReturn;
}
static MQTTBool_t prvMQTTCallback ( void * pvUserData,
const MQTTPublishData_t * const pxPublishParameters )
{
char plBuffer[ 256 ] = { 0 };
// Remove warnings about the unused parameters.
(void) pvUserData;
//memset( plBuffer, 0, 256 );
if ( pxPublishParameters->ulDataLength < 256 )
{
char *tmp;
memcpy( plBuffer, pxPublishParameters->pvData,
(size_t) pxPublishParameters->ulDataLength );
/*
Parse message received and forward it to HVAC module. Only FAN and
Target temperature are configurable from the "outside" so only
that two references are searched through the received string.
*/
// Target temperature reference search.
if ( ( tmp = strstr( plBuffer, jsonTARGET_T_REFERENCE ) ) != NULL )
{
float tmpV;
char *valS;
char *valE;
char tmpS[ 32 ];
tmp += strlen( jsonTARGET_T_REFERENCE );
valS = strchr( tmp + 1, '\"' );
valE = strchr( valS + 1, '\"' );
memset( tmpS, 0, 32 );
memcpy( tmpS, valS + 1, valE - valS - 1 );
sscanf (tmpS, "%f", &tmpV );
// Forward new target value to HVAC module.
if ( xQueueSend( qHVAC_TargetT, &tmpV, RTOS_NO_BLOCKING ) )
{
// TODO : Handle error.
}
}
// Fan reference search.
if ( ( tmp = strstr( plBuffer, jsonFAN_REFERENCE ) ) != NULL )
{
int c;
char *valS;
char *valE;
char tmpS[32];
tmp += strlen( jsonFAN_REFERENCE );
valS = strchr( tmp + 1, '\"' );
valE = strchr( valS + 1, '\"' );
memset( tmpS, 0, 32 );
memcpy( tmpS, valS + 1, valE - valS - 1 );
for ( c = 0; c < 3; c++ )
{
// Now check wich predefined value is received.
if ( !strcmp( tmpS, FAN_STATE_STRING[ c ] ) )
{
// Forward new FAN value to HVAC module.
if ( xQueueSend( qHVAC_Fan, &c, RTOS_NO_BLOCKING ) )
{
// TODO : Handle error.
}
break;
}
}
}
configPRINTF( ( "Received %s\r\n", plBuffer ) );
}
else
{
configPRINTF( ( "Dropped message.\r\n" ) );
}
return eMQTTFalse;
}
static void App_OTACompleteCallback( OTA_JobEvent_t eEvent )
{
OTA_Err_t xErr = kOTA_Err_Uninitialized;
if( eEvent == eOTA_JobEvent_Activate )
{
configPRINTF( ( "Received eOTA_JobEvent_Activate callback from OTA Agent.\r\n" ) );
OTA_ActivateNewImage();
}
else if( eEvent == eOTA_JobEvent_Fail )
{
configPRINTF( ( "Received eOTA_JobEvent_Fail callback from OTA Agent.\r\n" ) );
/* Nothing special to do. The OTA agent handles it. */
}
else if( eEvent == eOTA_JobEvent_StartTest )
{
/* This demo just accepts the image since it was a good OTA update and networking
* and services are all working (or we wouldn't have made it this far). If this
* were some custom device that wants to test other things before calling it OK,
* this would be the place to kick off those tests before calling OTA_SetImageState()
* with the final result of either accepted or rejected. */
configPRINTF( ( "Received eOTA_JobEvent_StartTest callback from OTA Agent.\r\n" ) );
xErr = OTA_SetImageState( eOTA_ImageState_Accepted );
if( xErr != kOTA_Err_None )
{
OTA_LOG_L1( " Error! Failed to set image state as accepted.\r\n" );
}
}
}
void vOTAUpdateDemoTask( void * pvParameters )
{
OTA_State_t eState;
OTA_AgentInit( xMQTTHandle,
( const uint8_t * ) ( clientcredentialIOT_THING_NAME ),
App_OTACompleteCallback, ( TickType_t ) ~0 );
while( ( eState = OTA_GetAgentState() ) != eOTA_AgentState_NotReady )
{
/* Wait forever for OTA traffic but allow other tasks to run and output statistics only once per second. */
vTaskDelay( pdMS_TO_TICKS( 1000UL ) );
configPRINTF( ( "State: %s Received: %u Queued: %u Processed: %u Dropped: %u\r\n", pcStateStr[ eState ],
OTA_GetPacketsReceived(), OTA_GetPacketsQueued(), OTA_GetPacketsProcessed(), OTA_GetPacketsDropped() ) );
}
}
static int jsoneq(const char *json, jsmntok_t *tok, const char *s);
static int jsoneq(const char *json, jsmntok_t *tok, const char *s) {
if ( tok->type == JSMN_STRING &&
(int) strlen(s) == tok->end - tok->start &&
strncmp(json + tok->start, s, tok->end - tok->start) == 0) {
return 0;
}
return -1;
}
void jsonSimpleKeyValue(jsmn_parser p, char * payload, char * parent_key, char * target_key, char * result);
void jsonSimpleKeyValue(jsmn_parser p, char * payload, char * parent_key, char * target_key, char * result)
{
int idx;
int r;
int target_parent_found = 0;
int target_parent_end = 0; // where the token ends
jsmntok_t tokens[128];
#ifdef JSMN_PARSING_DEBUG
char debug_token[128];
int debug_idx;
#endif
r = jsmn_parse( &p, ( char *) payload, strlen(payload), tokens,
( sizeof( tokens ) / sizeof( tokens[0] ) ) );
for ( idx = 0; idx < r; idx++)
{
#ifdef JSMN_PARSING_DEBUG
for (debug_idx=0; debug_idx < 128; debug_idx++) debug_token[debug_idx] = '\0';
(void) strncpy(debug_token, (payload + tokens[idx].start), (tokens[idx].end - tokens[idx].start));
printf("type: %d, start: %d, end: %d, size: %d, token: %s\n",
tokens[ idx ].type,
tokens[ idx ].start,
tokens[ idx ].end,
tokens[ idx ].size,
debug_token
);
#endif
// if the current object has key we want, then following string(s) contain key
// we are searching for.
if ( target_parent_found == 0 )
{
if ( tokens[idx].type == JSMN_OBJECT &&
tokens[idx].size > 0 &&
jsoneq( payload, &tokens[ idx - 1 ], parent_key ) == 0)
{
target_parent_found = 1;
target_parent_end = tokens[ idx ].end;
}
continue;
}
if ( tokens[idx].end > target_parent_end ) return;
// if the current is JSMN_OBJECT, skip.
if ( tokens[ idx ].type == JSMN_OBJECT )
continue;
// if the current is JSMN_PRIMITIVE, then it is a value. skip.
if ( tokens[ idx ].type == JSMN_PRIMITIVE )
continue;
// if the current is JSMN_STRING but has NO SIZE, then it is a VALUE. skip.
if ( tokens[ idx ].type == JSMN_STRING &&
tokens[ idx ].size == 0 )
continue;
// if the current matches target_key, then retrieve value from idx+1 and return.
// if idx+1 is a primitive, then convert to string. we will only return char *.
if ( ! ( tokens[ idx ].type == JSMN_STRING &&
jsoneq( payload, &tokens[ idx ], target_key ) == 0 ) )
continue;
(void) strncpy(result, (payload + tokens[idx + 1].start), (tokens[idx + 1].end - tokens[idx + 1].start));
return;
}
}
static MQTTBool_t prvMqttShadowDeltaCb( void * pvUserData,
const MQTTPublishData_t * const pxPublishParameters )
{
jsmn_parser xJSMNParser;
xShadowProperties shadowProperties;
/* Silence compiler warnings about unused variables. */
( void ) pvUserData;
char cBuffer[ 128 ];
uint32_t ulBytesToCopy = ( 128 - 1 );
memset( cBuffer, 0x00, sizeof( cBuffer ) );
memcpy( cBuffer, pxPublishParameters->pvData, ( size_t ) ulBytesToCopy );
jsmn_init( &xJSMNParser );
memset( &shadowProperties, 0x00, sizeof( xShadowProperties ) );
uint8_t target_temp, fan, aircon;
char reading[4];
memset( reading, 0x00, sizeof( reading ) );
( void ) jsonSimpleKeyValue( xJSMNParser,
(char *) cBuffer,
"state", // TODO: remove magic string
"TARGET_T", // TODO: remove magic string
reading);
target_temp = atoi(reading);
shadowProperties.target_temp = target_temp;
// Brightness - if the thing does not handle brightness, this will be 0x00.
memset( reading, 0x00, sizeof( reading ) );
( void ) jsonSimpleKeyValue( xJSMNParser,
(char *) cBuffer,
"state", // TODO: remove magic string
"FAN", // TODO: remove magic string
reading);
fan = atoi(reading);
shadowProperties.fan = fan;
// Brightness - if the thing does not handle brightness, this will be 0x00.
memset( reading, 0x00, sizeof( reading ) );
( void ) jsonSimpleKeyValue( xJSMNParser,
(char *) cBuffer,
"state", // TODO: remove magic string
"AIRCON", // TODO: remove magic string
reading);
aircon = atoi(reading);
shadowProperties.aircon = aircon;
if( xQueueSendToBack( qCONN_ShadowReported, &shadowProperties, RTOS_NO_BLOCKING ) == pdTRUE )
{
configPRINTF( ( "Successfully added new reported state to update queue.\r\n" ) );
}
else
{
configPRINTF( ( "Update queue full, deferring reported state update.\r\n" ) );
}
return eMQTTFalse;
}
static void prvShadowHandlerTask( void * pvParameters );
static void prvShadowHandlerTask( void * pvParameters )
{
xShadowProperties shadow;
while(1)
{
if ( xQueueReceive( qCONN_ShadowReported,
&shadow, portMAX_DELAY) == pdFAIL) continue;
configPRINTF(("Received message from queue: [%d]\r\n", shadow.target_temp));
// Send the data out.
// Send Fan setting to the Fan queue for the HVAC.
xQueueSend( ( QueueHandle_t ) qHVAC_Fan, &( shadow.fan ), portMAX_DELAY);
// Send Target Temperature to the TARGET_T queue for the HVAC.
xQueueSend( ( QueueHandle_t ) qHVAC_TargetT, &( shadow.target_temp ), portMAX_DELAY);
vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
}
static MQTTBool_t prvMqttShadowAcceptedCb( void * pvUserData,
const MQTTPublishData_t * const pxPublishParameters );
static MQTTBool_t prvMqttShadowAcceptedCb( void * pvUserData,
const MQTTPublishData_t * const pxPublishParameters )
{
configPRINTF(("** Your update to the Device Shadow was accepted!\r\n"));
}
static MQTTBool_t prvMqttShadowRejectedCb( void * pvUserData,
const MQTTPublishData_t * const pxPublishParameters );
static MQTTBool_t prvMqttShadowRejectedCb( void * pvUserData,
const MQTTPublishData_t * const pxPublishParameters )
{
configPRINTF(("** Your update to the Device Shadow was rejected!\r\n"));
}
/*----------------------------------------------------------------------------*/ |
def sum_squares(a,b):
return a*a + b*b
result = sum_squares(3,7)
print(result) |
function pageCount(n, p) {
let point;
let ans = 0;
let temp = n - p;
if (n % 2 == 0) {
tempPt = Math.floor(n / 2);
if (tempPt % 2 == 0) {
point = tempPt - 0.5;
} else {
point = temp + 0.5;
}
} else {
point = n / 2;
}
if (point > p) {
ans = Math.floor(p / 2);
} else {
if (temp % 2 != 0) {
if (p % 2 == 0) {
ans = Math.floor(temp / 2);
} else {
ans = Math.ceil(temp / 2);
}
} else {
ans = Math.floor(temp / 2);
}
}
return ans;
}
let n = 19;
let p = 14;
pageCount(n, p); |
<filename>internal/oprf/oprf.go
// SPDX-License-Identifier: MIT
//
// Copyright (C) 2021 <NAME>. All Rights Reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree or at
// https://spdx.org/licenses/MIT.html
// Package oprf implements the Elliptic Curve Oblivious Pseudorandom Function (EC-OPRF) from https://tools.ietf.org/html/draft-irtf-cfrg-voprf.
package oprf
import (
"crypto"
"github.com/bytemare/crypto/group"
"github.com/bytemare/opaque/internal/encoding"
"github.com/bytemare/opaque/internal/tag"
)
// mode distinguishes between the OPRF base mode and the Verifiable mode.
type mode byte
// base identifies the OPRF non-verifiable, base mode.
const base mode = iota
// Ciphersuite identifies the OPRF compatible cipher suite to be used.
type Ciphersuite group.Group
const (
// RistrettoSha512 is the OPRF cipher suite of the Ristretto255 group and SHA-512.
RistrettoSha512 = Ciphersuite(group.Ristretto255Sha512)
// P256Sha256 is the OPRF cipher suite of the NIST P-256 group and SHA-256.
P256Sha256 = Ciphersuite(group.P256Sha256)
// P384Sha384 is the OPRF cipher suite of the NIST P-384 group and SHA-384.
P384Sha384 = Ciphersuite(group.P384Sha512)
// P521Sha512 is the OPRF cipher suite of the NIST P-512 group and SHA-512.
P521Sha512 = Ciphersuite(group.P521Sha512)
)
var suiteToHash = make(map[group.Group]crypto.Hash)
func (c Ciphersuite) register(h crypto.Hash) {
suiteToHash[c.Group()] = h
}
// Group returns the casted identifier for the cipher suite.
func (c Ciphersuite) Group() group.Group {
return group.Group(c)
}
// SerializePoint returns the byte encoding of the point padded accordingly.
func (c Ciphersuite) SerializePoint(p *group.Point) []byte {
return encoding.SerializePoint(p, c.Group())
}
func contextString(id Ciphersuite) []byte {
return encoding.Concat3([]byte(tag.OPRF), encoding.I2OSP(int(base), 1), encoding.I2OSP(int(id), 2))
}
func (c Ciphersuite) oprf() *oprf {
return &oprf{
Group: c.Group(),
contextString: contextString(c),
}
}
type oprf struct {
group.Group
contextString []byte
}
func (o *oprf) dst(prefix string) []byte {
return encoding.Concat([]byte(prefix), o.contextString)
}
// DeriveKey returns a scalar mapped from the input.
func (c Ciphersuite) DeriveKey(input, dst []byte) *group.Scalar {
return c.Group().HashToScalar(input, dst)
}
// Client returns an OPRF client.
func (c Ciphersuite) Client() *Client {
return &Client{oprf: c.oprf()}
}
func init() {
RistrettoSha512.register(crypto.SHA512)
P256Sha256.register(crypto.SHA256)
P384Sha384.register(crypto.SHA384)
P521Sha512.register(crypto.SHA512)
}
|
MATLAB="/usr/local/MATLAB/R2018b"
Arch=glnxa64
ENTRYPOINT=mexFunction
MAPFILE=$ENTRYPOINT'.map'
PREFDIR="/home/hadi/.matlab/R2018b"
OPTSFILE_NAME="./setEnv.sh"
. $OPTSFILE_NAME
COMPILER=$CC
. $OPTSFILE_NAME
echo "# Make settings for sprdmpF60" > sprdmpF60_mex.mki
echo "CC=$CC" >> sprdmpF60_mex.mki
echo "CFLAGS=$CFLAGS" >> sprdmpF60_mex.mki
echo "CLIBS=$CLIBS" >> sprdmpF60_mex.mki
echo "COPTIMFLAGS=$COPTIMFLAGS" >> sprdmpF60_mex.mki
echo "CDEBUGFLAGS=$CDEBUGFLAGS" >> sprdmpF60_mex.mki
echo "CXX=$CXX" >> sprdmpF60_mex.mki
echo "CXXFLAGS=$CXXFLAGS" >> sprdmpF60_mex.mki
echo "CXXLIBS=$CXXLIBS" >> sprdmpF60_mex.mki
echo "CXXOPTIMFLAGS=$CXXOPTIMFLAGS" >> sprdmpF60_mex.mki
echo "CXXDEBUGFLAGS=$CXXDEBUGFLAGS" >> sprdmpF60_mex.mki
echo "LDFLAGS=$LDFLAGS" >> sprdmpF60_mex.mki
echo "LDOPTIMFLAGS=$LDOPTIMFLAGS" >> sprdmpF60_mex.mki
echo "LDDEBUGFLAGS=$LDDEBUGFLAGS" >> sprdmpF60_mex.mki
echo "Arch=$Arch" >> sprdmpF60_mex.mki
echo "LD=$LD" >> sprdmpF60_mex.mki
echo OMPFLAGS= >> sprdmpF60_mex.mki
echo OMPLINKFLAGS= >> sprdmpF60_mex.mki
echo "EMC_COMPILER=gcc" >> sprdmpF60_mex.mki
echo "EMC_CONFIG=optim" >> sprdmpF60_mex.mki
"/usr/local/MATLAB/R2018b/bin/glnxa64/gmake" -j 1 -B -f sprdmpF60_mex.mk
|
/*
Copyright (C) 2004-2008 Grame
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "JackConnectionManager.h"
#include "JackClientControl.h"
#include "JackEngineControl.h"
#include "JackGlobals.h"
#include "JackError.h"
#include <set>
#include <iostream>
#include <assert.h>
namespace Jack
{
JackConnectionManager::JackConnectionManager()
{
int i;
jack_log("JackConnectionManager::InitConnections size = %ld ", sizeof(JackConnectionManager));
for (i = 0; i < PORT_NUM_MAX; i++) {
fConnection[i].Init();
}
fLoopFeedback.Init();
jack_log("JackConnectionManager::InitClients");
for (i = 0; i < CLIENT_NUM; i++) {
InitRefNum(i);
}
}
JackConnectionManager::~JackConnectionManager()
{}
//--------------
// Internal API
//--------------
bool JackConnectionManager::IsLoopPathAux(int ref1, int ref2) const
{
jack_log("JackConnectionManager::IsLoopPathAux ref1 = %ld ref2 = %ld", ref1, ref2);
if (ref1 < GetEngineControl()->fDriverNum || ref2 < GetEngineControl()->fDriverNum) {
return false;
} else if (ref1 == ref2) { // Same refnum
return true;
} else {
jack_int_t output[CLIENT_NUM];
fConnectionRef.GetOutputTable(ref1, output);
if (fConnectionRef.IsInsideTable(ref2, output)) { // If ref2 is contained in the outputs of ref1
return true;
} else {
for (int i = 0; i < CLIENT_NUM && output[i] != EMPTY; i++) { // Otherwise recurse for all ref1 outputs
if (IsLoopPathAux(output[i], ref2))
return true; // Stop when a path is found
}
return false;
}
}
}
//--------------
// External API
//--------------
/*!
\brief Connect port_src to port_dst.
*/
int JackConnectionManager::Connect(jack_port_id_t port_src, jack_port_id_t port_dst)
{
jack_log("JackConnectionManager::Connect port_src = %ld port_dst = %ld", port_src, port_dst);
if (fConnection[port_src].AddItem(port_dst)) {
return 0;
} else {
jack_error("Connection table is full !!");
return -1;
}
}
/*!
\brief Disconnect port_src from port_dst.
*/
int JackConnectionManager::Disconnect(jack_port_id_t port_src, jack_port_id_t port_dst)
{
jack_log("JackConnectionManager::Disconnect port_src = %ld port_dst = %ld", port_src, port_dst);
if (fConnection[port_src].RemoveItem(port_dst)) {
return 0;
} else {
jack_error("Connection not found !!");
return -1;
}
}
/*!
\brief Check if port_src and port_dst are connected.
*/
bool JackConnectionManager::IsConnected(jack_port_id_t port_src, jack_port_id_t port_dst) const
{
return fConnection[port_src].CheckItem(port_dst);
}
/*!
\brief Get the connection port array.
*/
const jack_int_t* JackConnectionManager::GetConnections(jack_port_id_t port_index) const
{
return fConnection[port_index].GetItems();
}
//------------------------
// Client port management
//------------------------
/*!
\brief Add an input port to a client.
*/
int JackConnectionManager::AddInputPort(int refnum, jack_port_id_t port_index)
{
if (fInputPort[refnum].AddItem(port_index)) {
jack_log("JackConnectionManager::AddInputPort ref = %ld port = %ld", refnum, port_index);
return 0;
} else {
jack_error("Maximum number of input ports is reached for application ref = %ld", refnum);
return -1;
}
}
/*!
\brief Add an output port to a client.
*/
int JackConnectionManager::AddOutputPort(int refnum, jack_port_id_t port_index)
{
if (fOutputPort[refnum].AddItem(port_index)) {
jack_log("JackConnectionManager::AddOutputPort ref = %ld port = %ld", refnum, port_index);
return 0;
} else {
jack_error("Maximum number of output ports is reached for application ref = %ld", refnum);
return -1;
}
}
/*!
\brief Remove an input port from a client.
*/
int JackConnectionManager::RemoveInputPort(int refnum, jack_port_id_t port_index)
{
jack_log("JackConnectionManager::RemoveInputPort ref = %ld port_index = %ld ", refnum, port_index);
if (fInputPort[refnum].RemoveItem(port_index)) {
return 0;
} else {
jack_error("Input port index = %ld not found for application ref = %ld", port_index, refnum);
return -1;
}
}
/*!
\brief Remove an output port from a client.
*/
int JackConnectionManager::RemoveOutputPort(int refnum, jack_port_id_t port_index)
{
jack_log("JackConnectionManager::RemoveOutputPort ref = %ld port_index = %ld ", refnum, port_index);
if (fOutputPort[refnum].RemoveItem(port_index)) {
return 0;
} else {
jack_error("Output port index = %ld not found for application ref = %ld", port_index, refnum);
return -1;
}
}
/*!
\brief Get the input port array of a given refnum.
*/
const jack_int_t* JackConnectionManager::GetInputPorts(int refnum)
{
return fInputPort[refnum].GetItems();
}
/*!
\brief Get the output port array of a given refnum.
*/
const jack_int_t* JackConnectionManager::GetOutputPorts(int refnum)
{
return fOutputPort[refnum].GetItems();
}
/*!
\brief Init the refnum.
*/
void JackConnectionManager::InitRefNum(int refnum)
{
fInputPort[refnum].Init();
fOutputPort[refnum].Init();
fConnectionRef.Init(refnum);
fInputCounter[refnum].SetValue(0);
}
/*!
\brief Reset all clients activation.
*/
void JackConnectionManager::ResetGraph(JackClientTiming* timing)
{
// Reset activation counter : must be done *before* starting to resume clients
for (int i = 0; i < CLIENT_NUM; i++) {
fInputCounter[i].Reset();
timing[i].fStatus = NotTriggered;
}
}
/*!
\brief Wait on the input synchro.
*/
int JackConnectionManager::SuspendRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing, long time_out_usec)
{
bool res;
if ((res = table[control->fRefNum].TimedWait(time_out_usec))) {
timing[control->fRefNum].fStatus = Running;
timing[control->fRefNum].fAwakeAt = GetMicroSeconds();
}
return (res) ? 0 : -1;
}
/*!
\brief Signal clients connected to the given client.
*/
int JackConnectionManager::ResumeRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing)
{
jack_time_t current_date = GetMicroSeconds();
const jack_int_t* output_ref = fConnectionRef.GetItems(control->fRefNum);
int res = 0;
// Update state and timestamp of current client
timing[control->fRefNum].fStatus = Finished;
timing[control->fRefNum].fFinishedAt = current_date;
for (int i = 0; i < CLIENT_NUM; i++) {
// Signal connected clients or drivers
if (output_ref[i] > 0) {
// Update state and timestamp of destination clients
timing[i].fStatus = Triggered;
timing[i].fSignaledAt = current_date;
if (!fInputCounter[i].Signal(table + i, control)) {
jack_log("JackConnectionManager::ResumeRefNum error: ref = %ld output = %ld ", control->fRefNum, i);
res = -1;
}
}
}
return res;
}
static bool HasNoConnection(jack_int_t* table)
{
for (int ref = 0; ref < CLIENT_NUM; ref++) {
if (table[ref] > 0) return false;
}
return true;
}
// Using http://en.wikipedia.org/wiki/Topological_sorting
void JackConnectionManager::TopologicalSort(std::vector<jack_int_t>& sorted)
{
JackFixedMatrix<CLIENT_NUM> tmp;
std::set<jack_int_t> level;
fConnectionRef.Copy(tmp);
// Inputs of the graph
level.insert(AUDIO_DRIVER_REFNUM);
level.insert(FREEWHEEL_DRIVER_REFNUM);
while (level.size() > 0) {
jack_int_t refnum = *level.begin();
sorted.push_back(refnum);
level.erase(level.begin());
const jack_int_t* output_ref1 = tmp.GetItems(refnum);
for (int dst = 0; dst < CLIENT_NUM; dst++) {
if (output_ref1[dst] > 0) {
tmp.ClearItem(refnum, dst);
jack_int_t output_ref2[CLIENT_NUM];
tmp.GetOutputTable1(dst, output_ref2);
if (HasNoConnection(output_ref2))
level.insert(dst);
}
}
}
}
/*!
\brief Increment the number of ports between 2 clients, if the 2 clients become connected, then the Activation counter is updated.
*/
void JackConnectionManager::IncDirectConnection(jack_port_id_t port_src, jack_port_id_t port_dst)
{
int ref1 = GetOutputRefNum(port_src);
int ref2 = GetInputRefNum(port_dst);
assert(ref1 >= 0 && ref2 >= 0);
DirectConnect(ref1, ref2);
jack_log("JackConnectionManager::IncConnectionRef: ref1 = %ld ref2 = %ld", ref1, ref2);
}
/*!
\brief Decrement the number of ports between 2 clients, if the 2 clients become disconnected, then the Activation counter is updated.
*/
void JackConnectionManager::DecDirectConnection(jack_port_id_t port_src, jack_port_id_t port_dst)
{
int ref1 = GetOutputRefNum(port_src);
int ref2 = GetInputRefNum(port_dst);
assert(ref1 >= 0 && ref2 >= 0);
DirectDisconnect(ref1, ref2);
jack_log("JackConnectionManager::DecConnectionRef: ref1 = %ld ref2 = %ld", ref1, ref2);
}
/*!
\brief Directly connect 2 reference numbers.
*/
void JackConnectionManager::DirectConnect(int ref1, int ref2)
{
assert(ref1 >= 0 && ref2 >= 0);
if (fConnectionRef.IncItem(ref1, ref2) == 1) { // First connection between client ref1 and client ref2
jack_log("JackConnectionManager::DirectConnect first: ref1 = %ld ref2 = %ld", ref1, ref2);
fInputCounter[ref2].IncValue();
}
}
/*!
\brief Directly disconnect 2 reference numbers.
*/
void JackConnectionManager::DirectDisconnect(int ref1, int ref2)
{
assert(ref1 >= 0 && ref2 >= 0);
if (fConnectionRef.DecItem(ref1, ref2) == 0) { // Last connection between client ref1 and client ref2
jack_log("JackConnectionManager::DirectDisconnect last: ref1 = %ld ref2 = %ld", ref1, ref2);
fInputCounter[ref2].DecValue();
}
}
/*!
\brief Returns the connections state between 2 refnum.
*/
bool JackConnectionManager::IsDirectConnection(int ref1, int ref2) const
{
assert(ref1 >= 0 && ref2 >= 0);
return (fConnectionRef.GetItemCount(ref1, ref2) > 0);
}
/*!
\brief Get the client refnum of a given input port.
*/
int JackConnectionManager::GetInputRefNum(jack_port_id_t port_index) const
{
for (int i = 0; i < CLIENT_NUM; i++) {
if (fInputPort[i].CheckItem(port_index))
return i;
}
return -1;
}
/*!
\brief Get the client refnum of a given ouput port.
*/
int JackConnectionManager::GetOutputRefNum(jack_port_id_t port_index) const
{
for (int i = 0; i < CLIENT_NUM; i++) {
if (fOutputPort[i].CheckItem(port_index))
return i;
}
return -1;
}
/*!
\brief Test is a connection path exists between port_src and port_dst.
*/
bool JackConnectionManager::IsLoopPath(jack_port_id_t port_src, jack_port_id_t port_dst) const
{
return IsLoopPathAux(GetInputRefNum(port_dst), GetOutputRefNum(port_src));
}
bool JackConnectionManager::IsFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst) const
{
return (fLoopFeedback.GetConnectionIndex(GetOutputRefNum(port_src), GetInputRefNum(port_dst)) >= 0);
}
bool JackConnectionManager::IncFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst)
{
int ref1 = GetOutputRefNum(port_src);
int ref2 = GetInputRefNum(port_dst);
// Add an activation connection in the other direction
jack_log("JackConnectionManager::IncFeedbackConnection ref1 = %ld ref2 = %ld", ref1, ref2);
assert(ref1 >= 0 && ref2 >= 0);
if (ref1 != ref2)
DirectConnect(ref2, ref1);
return fLoopFeedback.IncConnection(ref1, ref2); // Add the feedback connection
}
bool JackConnectionManager::DecFeedbackConnection(jack_port_id_t port_src, jack_port_id_t port_dst)
{
int ref1 = GetOutputRefNum(port_src);
int ref2 = GetInputRefNum(port_dst);
// Remove an activation connection in the other direction
jack_log("JackConnectionManager::DecFeedbackConnection ref1 = %ld ref2 = %ld", ref1, ref2);
assert(ref1 >= 0 && ref2 >= 0);
if (ref1 != ref2)
DirectDisconnect(ref2, ref1);
return fLoopFeedback.DecConnection(ref1, ref2); // Remove the feedback connection
}
} // end of namespace
|
rm -rf /home/sji15/public_html/blog /home/sji15/public_html/static /home/sji15/public_html/tags /home/sji15/public_html/_next
cd /home/sji15/public_html/
unzip out.zip |
<gh_stars>1-10
/*-------------------------------------------------------------------------
*
* erand48.c
*
* This file supplies versions of erand48(), lrand48(), and srand48()
* for machines that lack them. (These are all the members of the drand48
* family that Postgres currently requires. We name the file after erand48
* because that is the one that configure tests for.)
*
*
* Copyright (c) 1993 <NAME>
* All rights reserved.
*
* You may redistribute unmodified or modified versions of this source
* code provided that the above copyright notice and this and the
* following conditions are retained.
*
* This software is provided ``as is'', and comes with no warranties
* of any kind. I shall in no event be liable for anything that happens
* to anyone/anything when using this software.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/erand48.c,v 1.1 2009/07/16 17:43:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
//#include "c.h"
#include <math.h>
#define RAND48_SEED_0 (0x330e)
#define RAND48_SEED_1 (0xabcd)
#define RAND48_SEED_2 (0x1234)
#define RAND48_MULT_0 (0xe66d)
#define RAND48_MULT_1 (0xdeec)
#define RAND48_MULT_2 (0x0005)
#define RAND48_ADD (0x000b)
static unsigned short _rand48_seed[3] = {
RAND48_SEED_0,
RAND48_SEED_1,
RAND48_SEED_2
};
static unsigned short _rand48_mult[3] = {
RAND48_MULT_0,
RAND48_MULT_1,
RAND48_MULT_2
};
static unsigned short _rand48_add = RAND48_ADD;
__forceinline static void
_dorand48(unsigned short xseed[3])
{
unsigned long accu;
unsigned short temp[2];
accu = (unsigned long) _rand48_mult[0] * (unsigned long) xseed[0] +
(unsigned long) _rand48_add;
temp[0] = (unsigned short) accu; /* lower 16 bits */
accu >>= sizeof(unsigned short) * 8;
accu += (unsigned long) _rand48_mult[0] * (unsigned long) xseed[1] +
(unsigned long) _rand48_mult[1] * (unsigned long) xseed[0];
temp[1] = (unsigned short) accu; /* middle 16 bits */
accu >>= sizeof(unsigned short) * 8;
accu += _rand48_mult[0] * xseed[2] + _rand48_mult[1] * xseed[1] + _rand48_mult[2] * xseed[0];
xseed[0] = temp[0];
xseed[1] = temp[1];
xseed[2] = (unsigned short) accu;
}
__forceinline double
erand48(unsigned short xseed[3])
{
_dorand48(xseed);
return ldexp((double) xseed[0], -48) +
ldexp((double) xseed[1], -32) +
ldexp((double) xseed[2], -16);
}
__forceinline long
lrand48(void)
{
_dorand48(_rand48_seed);
return ((long) _rand48_seed[2] << 15) + ((long) _rand48_seed[1] >> 1);
}
__forceinline void
srand48(long seed)
{
_rand48_seed[0] = RAND48_SEED_0;
_rand48_seed[1] = (unsigned short) seed;
_rand48_seed[2] = (unsigned short) (seed > 16);
_rand48_mult[0] = RAND48_MULT_0;
_rand48_mult[1] = RAND48_MULT_1;
_rand48_mult[2] = RAND48_MULT_2;
_rand48_add = RAND48_ADD;
} |
package ml.littlebulb.presto.kudu.properties;
import java.util.List;
public class PartitionDesign {
private List<HashPartitionDefinition> hash;
private RangePartitionDefinition range;
public List<HashPartitionDefinition> getHash() {
return hash;
}
public void setHash(List<HashPartitionDefinition> hash) {
this.hash = hash;
}
public RangePartitionDefinition getRange() {
return range;
}
public void setRange(RangePartitionDefinition range) {
this.range = range;
}
}
|
#!/bin/sh
sudo pacman --noconfirm -S go go-tools
|
DELETE FROM table
WHERE number IN
(
SELECT number FROM
(
SELECT MIN(id) as id, number
FROM table
GROUP BY number
) as t1
)
AND
id NOT IN
(
SELECT MIN(id)
FROM table
GROUP BY number
) |
package io.opensphere.core.units.duration;
import java.math.BigDecimal;
import java.math.RoundingMode;
import io.opensphere.core.units.InconvertibleUnits;
/**
* Base class for durations the use months for their reference units.
*/
public abstract class AbstractMonthBasedDuration extends Duration
{
/** The common units for durations convertible to this type. */
protected static final Class<Months> REFERENCE_UNITS = Months.class;
/** Serial version UID. */
private static final long serialVersionUID = 1L;
/**
* Constructor.
*
* @param magnitude The magnitude of the duration. Precision beyond the
* width of a <tt>long</tt> will be lost.
*/
public AbstractMonthBasedDuration(BigDecimal magnitude)
{
super(magnitude);
}
/**
* Constructor.
*
* @param unscaled The unscaled magnitude of the duration.
* @param scale The scale of the duration.
*
* @see BigDecimal
*/
public AbstractMonthBasedDuration(long unscaled, int scale)
{
super(unscaled, scale);
}
@Override
public int compareTo(Duration o) throws InconvertibleUnits
{
if (o.getReferenceUnits() == Seconds.class)
{
int signCompare = Integer.compare(signum(), o.signum());
if (signCompare != 0)
{
return signCompare;
}
// If I am larger than the maximum that the other duration could
// be...
else if (Integer.signum(getMagnitude().compareTo(
o.inReferenceUnits().divide(getMinSecondsPerUnit(), DIVISION_SCALE, RoundingMode.UP))) == signum())
{
return signum();
}
// If I am smaller than the minimum that the other duration could
// be...
else if (Integer.signum(o.inReferenceUnits().divide(getMaxSecondsPerUnit(), DIVISION_SCALE, RoundingMode.DOWN)
.compareTo(getMagnitude())) == signum())
{
return -signum();
}
else
{
return super.compareTo(o);
}
}
return super.compareTo(o);
}
/**
* Get the maximum number of seconds in one of me.
*
* @return The seconds.
*/
protected abstract BigDecimal getMaxSecondsPerUnit();
/**
* Get the minimum number of seconds in one of me.
*
* @return The seconds.
*/
protected abstract BigDecimal getMinSecondsPerUnit();
@Override
public final Class<? extends Duration> getReferenceUnits()
{
return REFERENCE_UNITS;
}
@Override
public String toPrettyString()
{
return toShortLabelString();
}
@Override
protected final BigDecimal inReferenceUnits(Class<? extends Duration> expected) throws InconvertibleUnits
{
if (isZero())
{
return BigDecimal.ZERO;
}
checkExpectedUnits(expected, REFERENCE_UNITS);
return inReferenceUnits();
}
}
|
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import DevName from '../../../src/components/Search/Dev/DevName';
import { OPENSEA_DIRECT_LINK_PREFIX } from '../../../src/utils/DeveloperDaoConstants';
import testCommonLink from '../../utils/testCommons';
import {
ownedDeveloperNFT,
unownedDeveloperNFT,
} from '../../mocks/DeveloperNFT';
describe('Dev Name button with Owner', () => {
it('Renders the button with link', () => {
render(<DevName nft={ownedDeveloperNFT} developerId={'2669'} />);
const devName = screen.getByTitle(`${ownedDeveloperNFT.owner}`);
fireEvent.click(devName);
testCommonLink(devName, `${OPENSEA_DIRECT_LINK_PREFIX}/2669`);
expect(devName).toBeEnabled();
});
});
describe('Dev Name button without Owner', () => {
it('Renders the button with no link', () => {
render(<DevName nft={unownedDeveloperNFT} developerId={'7899'} />);
const devName = screen.getByTitle(`${unownedDeveloperNFT.owner}`);
expect(devName).toBeInTheDocument();
expect(devName).toBeDisabled();
});
});
|
#!/bin/bash
#====================================================================
# brew &zshrc setup
#====================================================================
# requirement: xcode
xcode-select --install
# brew install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "export PATH=/usr/local/Homebrew/bin:\$PATH" >> ~/.bashrc
echo "********** brew setup : Successful! **********"
|
#!/bin/bash
##############################
WORK_DIR=/usr/src/app
NOTEBOOKS_DIR=$WORK_DIR/notebooks
##############################
usage() {
cat <<-EOF
Usage: $0 {build|boot}
EOF
exit 1
}
case "$1" in
# コンテナの作成
build)
docker image build --no-cache -t py36-jupyter .
;;
# 立ち上げ
boot)
docker container run --rm -it \
--name py36-tips \
-v $PWD:$WORK_DIR \
-w $WORK_DIR \
-p 8888:8888 \
py36-jupyter bash -c "jupyter notebook \
--notebook-dir=$NOTEBOOKS_DIR \
--allow-root --no-browser --port=8888 --ip=*"
;;
*)
usage
;;
esac |
TERMUX_SUBPKG_DESCRIPTION="baz"
TERMUX_SUBPKG_INCLUDE="etc/baz"
|
#!/bin/sh
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
src_repo="$(pwd)"
if [ ! -d .git ]; then
echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
exit 1;
fi
ver="1.0.50"
basedir=$(pwd);
(mkdir -p rpmbuild && cd rpmbuild && mkdir -p SOURCES BUILD BUILDROOT i386 x86_64 SPECS)
if [ ! -d "$basedir/../freeswitch-sounds" ]; then
cd $basedir/..
git clone https://freeswitch.org/stash/scm/fs/freeswitch-sounds.git
else
cd $basedir/../freeswitch-sounds
git pull
fi
cd $basedir/../freeswitch-sounds/sounds/trunk
./dist.pl music
mv freeswitch-sounds-music-*.tar.gz $basedir/rpmbuild/SOURCES
cd $basedir
rpmbuild --define "VERSION_NUMBER $ver" \
--define "BUILD_NUMBER 1" \
--define "_topdir %(pwd)/rpmbuild" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
-ba freeswitch-sounds-music.spec
mkdir $src_repo/RPMS
mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
cat 1>&2 <<EOF
----------------------------------------------------------------------
The Sound RPMs have been rolled
----------------------------------------------------------------------
EOF
|
<filename>test/integration/playlist.api.tests.js
var assert = require('assert');
const util = require('util');
const request = require('request');
var { ADMIN_USER, cleanup, URL_PREFIX } = require('../fixtures.js');
var api = require('../api-client.js');
var { START_WITH_ENV_FILE } = process.env;
const { startOpenwhydServer } = require('../approval-tests-helpers');
const randomString = () => Math.random().toString(36).substring(2, 9);
describe(`playlist api`, function () {
let jar;
let context = {};
before(cleanup); // to prevent side effects between test suites
before(async () => {
if (START_WITH_ENV_FILE) {
context.serverProcess = await startOpenwhydServer({
startWithEnv: START_WITH_ENV_FILE,
});
}
});
after(async () => {
await context.serverProcess?.exit();
});
beforeEach(
async () => ({ jar } = await util.promisify(api.loginAs)(ADMIN_USER))
/* FIXME: We are forced to use the ADMIN_USER, since DUMMY_USER is mutated by user.api.tests.js and the db cleanup seems to not work for the users collection.
* May be initdb_testing.js is not up to date with the current schema?
*/
);
it('should create a playlist', async function () {
const playlistName = `playlist-${randomString()}`;
const res = await new Promise((resolve, reject) =>
request.post(
{
jar,
form: {
action: 'create',
name: playlistName,
},
url: `${URL_PREFIX}/api/playlist`,
},
(error, response, body) =>
error ? reject(error) : resolve({ response, body })
)
);
const { id, name } = JSON.parse(res.body);
assert.equal(name, playlistName);
assert.equal(id, 0);
});
});
|
def optimizeBST(root):
if (root == None):
return
optimizeBST(root.left)
optimizeBST(root.right)
if (root.left != None):
root.left.rightMost = findMax(root.left)
if (root.right != None):
root.right.leftMost = findMin(root.right)
def findMax(node):
if (node == None):
return
while (node.right):
node = node.right
return node
def findMin(node):
if (node == None):
return
while (node.left):
node = node.left
return node |
<gh_stars>10-100
import * as scoreLogController from '../controllers/scoreLogController';
import * as actionDefinitionController from '../controllers/actionDefinitionController';
import * as userController from '../controllers/user';
import config from '../config/index';
import * as stationModels from '../models/station';
export default (emitter, moduleEmitter) => {
stationWasCreated(emitter, moduleEmitter);
songWasAdded(emitter, moduleEmitter);
};
const stationWasCreated = (emitter, moduleEmitter) => {
moduleEmitter.on(
config.events.STATION_WAS_CREATED,
async (userId, actionKey) => {
let action = await actionDefinitionController.getActionDefinitionByKey(
actionKey,
);
await scoreLogController.createScoreLog(
userId,
action.score,
action.action_key,
);
let user = await userController.getUserById(userId);
user = await userController.updateUserReputation(user, action.score);
emitter.emit(config.events.SET_USER_SCORE_SUCCESS, {
...user._doc,
userId: user._id,
});
},
);
};
const songWasAdded = (emitter, moduleEmitter) => {
moduleEmitter.on(
config.events.SONG_WAS_ADDED,
async (userId, actionKey, stationId, songUrl) => {
let score_description = {
station_id: stationId,
song_url: songUrl,
};
let station = await stationModels.getStationById(stationId);
if (station && userId !== station.owner_id.toString()) {
let action = await actionDefinitionController.getActionDefinitionByKey(
actionKey,
);
await scoreLogController.createScoreLog(
userId,
action.score,
action.action_key,
score_description,
);
let user = await userController.getUserById(station.owner_id);
user = await userController.updateUserReputation(user, action.score);
emitter.emitToUser(user._id, config.events.SET_USER_SCORE_SUCCESS, {
...user._doc,
userId: user._id,
});
}
},
);
};
|
<filename>python-import/finders_and_loaders/ban_importer.py
# ban_importer.py
import sys
BANNED_MODULES = {"re"}
class BanFinder:
@classmethod
def find_spec(cls, name, path, target=None):
if name in BANNED_MODULES:
raise ModuleNotFoundError(f"{name!r} is banned")
sys.meta_path.insert(0, BanFinder)
|
<gh_stars>1-10
const validModel = (model) => {
for (let property in model) {
if (model[property] === "" ||
model[property] === null) {
return {
field: String(property),
status: false
}
}
}
return {
field: "",
status: true
};
}
export { validModel } |
class BooleanFlip:
def __init__(self, boolean_value):
self.boolean_value = boolean_value
def flip(self):
self.boolean_value = not self.boolean_value |
#!/usr/bin/env bash
# This script is inspired from **scikit-learn** implementation of continous test
# integration. This is meant to "install" all the packages required for installing
# trimpy.
# License: The MIT License (MIT)
set -e
sudo apt-get update -qq
sudo apt-get install build-essential -qq
if [[ "$DISTRIB" == "conda" ]]; then
# Deactivate the travis-provided virtual environment and setup a
# conda-based environment instead
deactivate
# Use the miniconda installer for faster download / install of conda
# itself
wget http://repo.continuum.io/miniconda/Miniconda3-3.7.3-Linux-x86_64.sh \
-O miniconda.sh
chmod +x miniconda.sh && ./miniconda.sh -b
export PATH=$HOME/miniconda3/bin:$PATH
conda config --set always_yes yes --set changeps1 no
conda update conda
conda info -a
conda create -n testenv python=$PYTHON_VERSION --file requirements-dev.txt
source activate testenv
fi
if [[ "$COVERAGE" == "true" ]]; then
pip install coverage coveralls
fi
# Build trimpy
python setup.py develop
|
import log
def error(exception):
log.error(exception)
return {
'status': 'error',
'message' : exception.message
}
def success(msg, result = None):
log.debug(msg)
return {
'status' : 'ok',
'message' : msg,
'result' : result
}
def warning(msg):
log.warn(msg)
return {
'status' : 'warn',
'message' : msg
}
|
#!/usr/bin/env bash
source scripts/npu_set_env.sh
device_id_list=0,1,2,3,4,5,6,7
currentDir=$(cd "$(dirname "$0")";pwd)/..
currtime=`date +%Y%m%d%H%M%S`
train_log_dir=${currentDir}/result/training_8p_job_${currtime}
mkdir -p ${train_log_dir}
cd ${train_log_dir}
echo "train log path is ${train_log_dir}"
python3.7 -u ${currentDir}/8p_main_med.py \
--data=/data/imagenet \
--evaluate \
--resume checkpoint.pth.tar \
--addr=$(hostname -I |awk '{print $1}') \
--seed=49 \
--workers=184 \
--learning-rate=4 \
--print-freq=1 \
--eval-freq=5 \
--arch=shufflenet_v2_x1_0 \
--dist-url='tcp://127.0.0.1:50000' \
--dist-backend='hccl' \
--multiprocessing-distributed \
--world-size=1 \
--batch-size=8192 \
--epochs=240 \
--warm_up_epochs=5 \
--device_num=8 \
--rank=0 \
--amp \
--momentum=0 \
--device-list=${device_id_list} \
--benchmark 0 > ./shufflenetv2_8p.log 2>&1 &
|
package options
import "github.com/pkg/term"
/* Term (original) */
func foo() {
t, err := term.Open("/dev/ttyUSB0")
// handle error
err = t.SetSpeed(115200)
// handle error
err = t.SetRaw()
// handle error
// ...
handle(err)
}
func handle(err error) {
}
/* Term (improved) */
func OpenTerm(dev string, options ...func(t *term.Term) error) (*term.Term, error) {
t, err := term.Open(dev)
// handle err
handle(err)
for _, opt := range options {
err = opt(t)
// handle err
}
return t, nil
}
func bar() {
// just open the terminal
t, _ := term.Open("/dev/ttyUSB0")
t.Flush()
// open at 115200 baud in raw mode
t2, _ := term.Open("/dev/ttyUSB0",
Speed(115200),
RewMode)
t2.Flush()
}
// RewMode places the terminal into raw mode.
func RewMode(t *term.Term) error {
return t.SetRaw()
}
// Speed sets the baud rate option for the terminal
// Speed自己需要一个参数,所以它返回了一个func
func Speed(baud int) func(tt *term.Term) error {
return func(t *term.Term) error {
return t.SetSpeed(baud)
}
}
|
package core.framework.internal.http;
import core.framework.util.Maps;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* @author neo
*/
public class CookieManager implements CookieJar {
final Map<String, Cookie> store = Maps.newConcurrentHashMap();
@Override
public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
for (Cookie cookie : cookies) {
String key = cookie.domain() + ":" + cookie.path() + ":" + cookie.name();
// refer to okhttp3.Cookie.parse(), with maxAge=0, it set expiresAt = Long.MIN_VALUE
if (cookie.expiresAt() == Long.MIN_VALUE && "".equals(cookie.value())) {
store.remove(key);
} else {
store.put(key, cookie);
}
}
}
@Override
public List<Cookie> loadForRequest(HttpUrl url) {
List<Cookie> matchingCookies = new ArrayList<>();
Iterator<Map.Entry<String, Cookie>> iterator = store.entrySet().iterator();
long now = System.currentTimeMillis();
while (iterator.hasNext()) {
Cookie cookie = iterator.next().getValue();
if (cookie.expiresAt() < now) {
iterator.remove();
} else if (cookie.matches(url)) {
matchingCookies.add(cookie);
}
}
return matchingCookies;
}
}
|
package technical
import (
"goalgotrade/core"
"goalgotrade/dataseries"
"sync"
"time"
)
type EventWindow interface {
OnNewValue(dateTime *time.Time, value interface{})
WindowSize() int
Values() []interface{}
IsWindowFull() bool
Value() interface{}
}
type baseEventWindow struct {
mu sync.Mutex
values []interface{}
windowSize int
skipNone bool
}
func NewEventWindow(windowSize int, skipNone bool) EventWindow {
return newEventWindow(windowSize, skipNone)
}
func newEventWindow(windowSize int, skipNone bool) *baseEventWindow {
res := &baseEventWindow{
windowSize: windowSize,
skipNone: skipNone,
}
return res
}
func (e *baseEventWindow) OnNewValue(dateTime *time.Time, value interface{}) {
e.mu.Lock()
defer e.mu.Unlock()
if value != nil || !e.skipNone {
e.values = append(e.values, value)
if len(e.values) > e.windowSize {
e.values = e.values[len(e.values)-e.windowSize:]
}
}
}
func (e *baseEventWindow) WindowSize() int {
return e.windowSize
}
func (e *baseEventWindow) Values() []interface{} {
return e.values
}
func (e *baseEventWindow) IsWindowFull() bool {
return len(e.values) == e.windowSize
}
func (e *baseEventWindow) Value() interface{} {
panic("not implemented")
}
type EventBasedFilter interface {
DataSeries() dataseries.SequenceDataSeries
EventWindow() EventWindow
}
type eventBasedFilter struct {
dataseries.SequenceDataSeries
mu sync.Mutex
dataSeries dataseries.SequenceDataSeries
eventWindow EventWindow
}
func NewEventBasedFilter(dataSeries dataseries.SequenceDataSeries, eventWindow EventWindow, maxLen int) EventBasedFilter {
return newEventBasedFilter(dataSeries, eventWindow, maxLen)
}
func newEventBasedFilter(dataSeries dataseries.SequenceDataSeries, eventWindow EventWindow, maxLen int) *eventBasedFilter {
res := &eventBasedFilter{
SequenceDataSeries: dataseries.NewSequenceDataSeries(maxLen),
dataSeries: dataSeries,
eventWindow: eventWindow,
}
res.dataSeries.NewValueChannel().Subscribe(func(event core.Event) error {
var d dataseries.SequenceDataSeries
var t *time.Time
var v interface{}
if tmp, ok := event.Get("dataseries"); ok {
d = tmp.(dataseries.SequenceDataSeries)
}
if tmp, ok := event.Get("time"); ok {
t = tmp.(*time.Time)
}
if tmp, ok := event.Get("value"); ok {
v = tmp
}
return res.onNewValue(d, t, v)
})
return res
}
func (f *eventBasedFilter) onNewValue(dataSeries dataseries.SequenceDataSeries, dateTime *time.Time, value interface{}) error {
f.eventWindow.OnNewValue(dateTime, value)
newValue := f.eventWindow.Value()
return f.AppendWithDateTime(dateTime, newValue)
}
func (f *eventBasedFilter) DataSeries() dataseries.SequenceDataSeries {
return f.dataSeries
}
func (f *eventBasedFilter) EventWindow() EventWindow {
return f.eventWindow
}
|
#! /bin/sh
if [ ! -d "$CC_APP_PATH" ] || [ ! -d "$CC_WEB_PATH" ]; then
echo "\n\nERROR: CC_APP_PATH or CC_WEB_PATH environment variable not properly set\n\n"
exit 1
fi
cp "$CC_APP_PATH/../MiscApps/TableEdit-Lite/TableEdit/faq.html" "$CC_WEB_PATH/corecode.io/tableedit_lite/faq.html"
cp "$CC_APP_PATH/../MiscApps/TableEdit-Lite/TableEdit/history.html" "$CC_WEB_PATH/corecode.io/tableedit_lite/history.html"
cp "$CC_APP_PATH/../MiscApps/TableEdit-Lite/TableEdit/readme.html" "$CC_WEB_PATH/corecode.io/tableedit_lite/readme.html"
websiteProcessReadMe.py "$CC_WEB_PATH/corecode.io/tableedit_lite/readme.html"
websiteProcessIndexHTML.py "$CC_WEB_PATH/corecode.io/tableedit_lite/readme.html" "$CC_WEB_PATH/corecode.io/tableedit_lite/index.html"
|
#!/bin/sh
cat <<EOF > service.rendered.json
{
"Name": "test-service",
"Tags": [
"Test Service"
],
"Address": "${POD_IP}",
"Port": 3002,
"Check": {
"Method": "GET",
"HTTP": "http://${POD_IP}:3002/apis/test/health",
"Interval": "1s"
}
}
EOF
curl \
--request PUT \
--data @service.rendered.json \
"http://$HOST_IP:8500/v1/agent/service/register"
|
<filename>simJoins/src/main/scala-2.11/SimJoins/DataStructure/Profile.scala
package SimJoins.DataStructure
import scala.collection.mutable
/**
* Represents a profile
* @author <NAME>
* @since 2016/07/12
*/
case class Profile(id: Long, attributes : mutable.MutableList[KeyValue] = new mutable.MutableList[KeyValue](), originalID : String = "") extends Serializable{
/**
* Add an attribute to the list of attributes
*
* @param a attribute to add
* */
def addAttribute(a: KeyValue): Unit = {
attributes += a
}
// todo If we have no attributes (e.g. a single doc), we have a single element in the list
}
|
# frozen_string_literal: true
require 'discourse_dev'
require 'rails'
require 'faker'
module DiscourseDev
class Record
DEFAULT_COUNT = 30.freeze
attr_reader :model, :type
def initialize(model, count = DEFAULT_COUNT)
@@initialized ||= begin
Faker::Discourse.unique.clear
RateLimiter.disable
true
end
@model = model
@type = model.to_s
@count = count
end
def create!
record = model.create!(data)
yield(record) if block_given?
end
def populate!
if current_count >= @count
puts "Already have #{current_count} #{type.downcase} records"
Rake.application.top_level_tasks.each do |task_name|
Rake::Task[task_name].reenable
end
Rake::Task['dev:repopulate'].invoke
return
elsif current_count > 0
@count -= current_count
puts "There are #{current_count} #{type.downcase} records. Creating #{@count} more."
else
puts "Creating #{@count} sample #{type.downcase} records"
end
@count.times do
create!
putc "."
end
puts
end
def current_count
model.count
end
def self.populate!
self.new.populate!
end
def self.random(model)
offset = Faker::Number.between(from: 0, to: model.count - 1)
model.offset(offset).first
end
end
end
|
import Promise from 'bluebird'
import exec from 'execa'
import path from 'path'
import { CLIEngine } from 'eslint'
import {
T,
assoc,
cond,
curry,
curryN,
endsWith,
evolve,
equals,
filter,
find,
length,
map,
merge,
objOf,
pipe,
pipeP,
pluck,
prop,
propEq,
split,
sum,
tap,
} from 'ramda'
import { getChangedLinesFromDiff } from './lib/git'
let linter;
if (process.env.CUSTOM_ESLINT_CONFIG_FILE) {
linter = new CLIEngine({ configFile: process.env.CUSTOM_ESLINT_CONFIG_FILE });
} else {
linter = new CLIEngine();
}
const formatter = linter.getFormatter()
const getChangedFiles = pipeP(
commitRange => exec('git', ['diff', commitRange, '--name-only', '--relative', '--diff-filter=ACM']),
prop('stdout'),
split('\n'),
filter(endsWith('.js')),
map(path.resolve)
)
const getDiff = curry((commitRange, filename) =>
exec('git', ['diff', commitRange, filename])
.then(prop('stdout')))
const getChangedFileLineMap = curry((commitRange, filePath) => pipeP(
getDiff(commitRange),
getChangedLinesFromDiff,
objOf('changedLines'),
assoc('filePath', filePath)
)(filePath))
const lintChangedLines = pipe(
map(prop('filePath')),
linter.executeOnFiles.bind(linter)
)
const filterLinterMessages = changedFileLineMap => (linterOutput) => {
const filterMessagesByFile = (result) => {
const fileLineMap = find(propEq('filePath', result.filePath), changedFileLineMap)
const changedLines = prop('changedLines', fileLineMap)
const filterMessages = evolve({
messages: filter(message => changedLines.includes(message.line)),
})
return filterMessages(result)
}
const countBySeverity = severity =>
pipe(
filter(propEq('severity', severity)),
length
)
const countWarningMessages = countBySeverity(1)
const countErrorMessages = countBySeverity(2)
const warningCount = (result) => {
const transform = {
warningCount: countWarningMessages(result.messages),
}
return merge(result, transform)
}
const errorCount = (result) => {
const transform = {
errorCount: countErrorMessages(result.messages),
}
return merge(result, transform)
}
return pipe(
prop('results'),
map(pipe(
filterMessagesByFile,
warningCount,
errorCount
)),
objOf('results')
)(linterOutput)
}
const applyLinter = changedFileLineMap => pipe(
lintChangedLines,
filterLinterMessages(changedFileLineMap)
)(changedFileLineMap)
const logResults = pipe(
prop('results'),
formatter,
console.log
)
const getErrorCountFromReport = pipe(
prop('results'),
pluck('errorCount'),
sum
)
const exitProcess = curryN(2, n => process.exit(n))
const reportResults = pipe(
tap(logResults),
getErrorCountFromReport,
cond([
[equals(0), exitProcess(0)],
[T, exitProcess(1)],
])
)
const run = (commitRange = 'HEAD') => Promise.resolve(commitRange)
.then(getChangedFiles)
.map(getChangedFileLineMap(commitRange))
.then(applyLinter)
.then(reportResults)
export default run
|
/*
* Copyright (C) 2017 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dagger.functional.spi;
import static com.google.common.io.Resources.getResource;
import static com.google.common.truth.Truth.assertThat;
import dagger.Component;
import dagger.Module;
import dagger.Provides;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class SpiTest {
@Component(modules = M.class)
interface C {
String string();
}
@Module
abstract static class M {
@Provides
static String string() {
return "string";
}
}
@Test
public void testPluginRuns() throws IOException {
Properties properties = new Properties();
try (InputStream stream = getResource(SpiTest.class, "SpiTest_C.properties").openStream()) {
properties.load(stream);
}
assertThat(properties).containsEntry("component[0]", C.class.getCanonicalName());
}
}
|
export { BaseCtrl } from './base';
export { WordCtrl } from './word';
|
perl main.pl -f samples.fqpath.tsv -c configure.cfg -p Run.all.sh -t kallisto -o result
|
<gh_stars>1000+
// Copyright 2013, <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//+build windows plan9
package logging
import (
"fmt"
)
type Priority int
type SyslogBackend struct {
}
func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) {
return nil, fmt.Errorf("Platform does not support syslog")
}
func NewSyslogBackendPriority(prefix string, priority Priority) (b *SyslogBackend, err error) {
return nil, fmt.Errorf("Platform does not support syslog")
}
func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error {
return fmt.Errorf("Platform does not support syslog")
}
|
<filename>simple-copier/src/main/java/com/jiekey/converter/ToStringConverter.java
package com.jiekey.converter;
import com.jiekey.core.BeanField;
public class ToStringConverter implements Converter {
@Override
public Object convert(Object value, String format, BeanField field) {
if (value != null) {
return value.toString();
}
return null;
}
@Override
public Object deconvert(Object value, String format, BeanField field) {
return null;
}
}
|
import React from "react";
import LabLayout from "../../layouts/LabLayout";
const MultiColumn = () => {
return (
<LabLayout
background=""
title="CSS Explorations: Multicolumn"
description="Just like in newspapers"
article={true}
>
<main className="min-h-screen flex items-center justify-center">
<div
className="w-11/12 md:w-7/12 mx-auto"
style={{
columnCount: "3",
columnGap: "30px",
columnRule: "1px solid lightblue",
}}
>
<p>
When in the Course of human events, it becomes necessary for one
people to dissolve the political bands which have connected them
with another, and to assume among the powers of the earth, the
separate and equal station to which the Laws of Nature and of
Nature's God entitle them, a decent respect to the opinions of
mankind requires that they should declare the causes which impel
them to the separation.
</p>
<p>
We hold these truths to be self-evident, that all men are created
equal, that they are endowed by their Creator with certain
unalienable Rights, that among these are Life, Liberty and the
pursuit of Happiness.--That to secure these rights, Governments are
instituted among Men, deriving their just powers from the consent of
the governed, --That whenever any Form of Government becomes
destructive of these ends, it is the Right of the People to alter or
to abolish it, and to institute new Government, laying its
foundation on such principles and organizing its powers in such
form, as to them shall seem most likely to effect their Safety and
Happiness. Prudence, indeed, will dictate that Governments long
established should not be changed for light and transient causes;
and accordingly all experience hath shewn, that mankind are more
disposed to suffer, while evils are sufferable, than to right
themselves by abolishing the forms to which they are accustomed. But
when a long train of abuses and usurpations, pursuing invariably the
same Object evinces a design to reduce them under absolute
Despotism, it is their right, it is their duty, to throw off such
Government, and to provide new Guards for their future
security.--Such has been the patient sufferance of these Colonies;
and such is now the necessity which constrains them to alter their
former Systems of Government. The history of the present King of
Great Britain is a history of repeated injuries and usurpations, all
having in direct object the establishment of an absolute Tyranny
over these States. To prove this, let Facts be submitted to a candid
world.
</p>
</div>
</main>
</LabLayout>
);
};
export default MultiColumn;
|
#!/bin/bash
# docker run -it --rm --name gpu0-bot -v /home/mhilmiasyrofi/Documents/Bag-of-Tricks-for-AT/:/workspace/Bag-of-Tricks-for-AT/ --gpus '"device=0"' mhilmiasyrofi/advtraining
# Declare an array of string with type
# declare -a adv=("autoattack" "autopgd" "bim" "cw" "deepfool" "fgsm" "newtonfool" "pgd" "pixelattack" "spatialtransformation" "squareattack")
# declare -a adv=("autoattack" "autopgd" "bim")
# declare -a adv=("cw" "deepfool" "fgsm")
# declare -a adv=("newtonfool" "pgd" "pixelattack")
# declare -a adv=("spatialtransformation" "squareattack")
# # Iterate the string array using for loop
# for a in ${adv[@]}; do
# python adversarial_training.py --model resnet18 \
# --attack $a \
# --lr-schedule piecewise \
# --norm l_inf \
# --epsilon 8 \
# --epochs 110 \
# --labelsmooth \
# --labelsmoothvalue 0.3 \
# --fname auto \
# --optimizer 'momentum' \
# --weight_decay 5e-4 \
# --batch-size 128 \
# --BNeval
# done
# Declare an array of string with type
declare -a adv=("autoattack" "autopgd" "bim" "cw" "deepfool" "fgsm" "newtonfool" "pgd" "pixelattack" "spatialtransformation" "squareattack")
# declare -a adv=("autoattack")
# # Iterate the string array using for loop
for a in ${adv[@]}; do
python adversarial_training.py --model resnet18 \
--attack $a \
--sample 75 \
--chkpt-iters 1 \
--lr-schedule piecewise \
--norm l_inf \
--epsilon 8 \
--epochs 10 \
--labelsmooth \
--labelsmoothvalue 0.3 \
--fname auto \
--optimizer 'momentum' \
--weight_decay 5e-4 \
--batch-size 128 \
--BNeval
done
# declare -a adv=("autoattack" "autopgd" "bim" "cw")
# # declare -a adv=("deepfool" "fgsm" "newtonfool" "pgd")
# # declare -a adv=("pixelattack" "spatialtransformation" "squareattack")
# Iterate the string array using for loop
# for a in ${adv[@]}; do
# python adversarial_training.py --model resnet18 \
# --attack $a \
# --sample 50 \
# --lr-schedule piecewise \
# --norm l_inf \
# --epsilon 8 \
# --epochs 30 \
# --labelsmooth \
# --labelsmoothvalue 0.3 \
# --fname auto \
# --optimizer 'momentum' \
# --weight_decay 5e-4 \
# --batch-size 128 \
# --BNeval
# done
# python adversarial_training.py --model resnet18 \
# --attack pgd \
# --lr-schedule piecewise \
# --norm l_inf \
# --epsilon 8 \
# --epochs 20 \
# --labelsmooth \
# --labelsmoothvalue 0.3 \
# --fname auto \
# --optimizer 'momentum' \
# --weight_decay 5e-4 \
# --batch-size 256 \
# --BNeval
# python adversarial_training.py --model resnet18 \
# --attack combine \
# --list pixelattack_spatialtransformation_autoatack_autopgd \
# --lr-schedule piecewise \
# --norm l_inf \
# --epsilon 8 \
# --epochs 110 \
# --labelsmooth \
# --labelsmoothvalue 0.3 \
# --fname auto \
# --optimizer 'momentum' \
# --weight_decay 5e-4 \
# --batch-size 128 \
# --BNeval
# python adversarial_training.py --model resnet18 \
# --attack combine \
# --list pixelattack_spatialtransformation_cw_autopgd \
# --lr-schedule piecewise \
# --norm l_inf \
# --epsilon 8 \
# --epochs 110 \
# --labelsmooth \
# --labelsmoothvalue 0.3 \
# --fname auto \
# --optimizer 'momentum' \
# --weight_decay 5e-4 \
# --batch-size 128 \
# --BNeval
# python adversarial_training.py --model resnet18 \
# --attack all \
# --lr-schedule piecewise \
# --norm l_inf \
# --epsilon 8 \
# --epochs 110 \
# --labelsmooth \
# --labelsmoothvalue 0.3 \
# --fname auto \
# --optimizer 'momentum' \
# --weight_decay 5e-4 \
# --batch-size 128 \
# --BNeval
|
package com.player.repo;
import com.player.db.model.Player;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface PlayerRepository extends CrudRepository<Player, String> {
}
|
/*******************************************************************************
* Copyright Searchbox - http://www.searchbox.com
*
* 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.searchbox.core.dm;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.searchbox.core.SearchAttribute;
public class FieldAttribute {
public enum USE {
MATCH, SEARCH, VALUE, TF, SORT, SPELL, MULTILANG, SUGGEST, DEFAULT
}
protected Field field;
@SearchAttribute
protected String label = "";
@SearchAttribute
protected Boolean searchable = false;
@SearchAttribute
List<String> lang = new ArrayList<String>();
@SearchAttribute
protected Boolean highlight = false;
@SearchAttribute
protected Boolean sortable = false;
@SearchAttribute
protected Boolean spelling = false;
@SearchAttribute
protected Boolean suggestion = false;
@SearchAttribute("1f")
protected Float boost = 1f;
public FieldAttribute() {
}
public FieldAttribute(Field field) {
this.field = field;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this,
ToStringStyle.SHORT_PREFIX_STYLE);
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Boolean getSearchable() {
return this.searchable;
}
public void setSearchable(Boolean searchable) {
this.searchable = searchable;
}
public Boolean getHighlight() {
return this.highlight;
}
public void setHighlight(Boolean highlight) {
this.highlight = highlight;
}
public Boolean getSortable() {
return this.sortable;
}
public void setSortable(Boolean sortable) {
this.sortable = sortable;
}
public Boolean getSpelling() {
return this.spelling;
}
public void setSpelling(Boolean spelling) {
this.spelling = spelling;
}
public Boolean getSuggestion() {
return this.suggestion;
}
public void setSuggestion(Boolean suggestion) {
this.suggestion = suggestion;
}
public Float getBoost() {
return this.boost;
}
public void setBoost(Float boost) {
this.boost = boost;
}
public void setField(Field field) {
this.field = field;
}
public Field getField() {
return this.field;
}
/**
* @return the lang
*/
public List<String> getLang() {
return lang;
}
/**
* @param lang
* the lang to set
*/
public void setLang(List<String> lang) {
this.lang = lang;
}
}
|
<gh_stars>0
class Morse:
_xlate = dict({
'a' : ['dit','dah'],
'b' : ['dah','dit','dit','dit'],
'c' : ['dah','dit','dah','dit'],
'd' : ['dah','dit','dit'],
'e' : ['dit'],
'f' : ['dit','dit','dah','dit'],
'g' : ['dah','dah','dit'],
'h' : ['dit','dit','dit','dit'],
'i' : ['dit','dit'],
'j' : ['dit','dah','dah','dah'],
'k' : ['dah','dit','dah'],
'l' : ['dit','dah','dit','dit'],
'm' : ['dah','dah'],
'n' : ['dah','dit'],
'o' : ['dah','dah','dah'],
'p' : ['dit','dah','dah','dit'],
'q' : ['dah','dah','dit','dah'],
'r' : ['dit','dah','dit'],
's' : ['dit','dit','dit'],
't' : ['dah'],
'u' : ['dit','dit','dah'],
'v' : ['dit','dit','dit','dah'],
'w' : ['dit','dah','dah'],
'x' : ['dah','dit','dit','dah'],
'y' : ['dah','dit','dah','dah'],
'z' : ['dah','dah','dit','dit'],
'1' : ['dit','dah','dah','dah','dah'],
'2' : ['dit','dit','dah','dah','dah'],
'3' : ['dit','dit','dit','dah','dah'],
'4' : ['dit','dit','dit','dit','dah'],
'5' : ['dit','dit','dit','dit','dit'],
'6' : ['dah','dit','dit','dit','dit'],
'7' : ['dah','dah','dit','dit','dit'],
'8' : ['dah','dah','dah','dit','dit'],
'9' : ['dah','dah','dah','dah','dit'],
'10': ['dah','dah','dah','dah','dah'],
})
def __init__(self,dit=0.3):
assert float(dit)
self.__time__ = dict()
self.dit(dit)
def dit(self,dit):
assert float(dit)
self.__time__['dit'] = dit
self.__time__['dah'] = 3 * dit
self.__time__['_interword'] = 3 * dit
self.__time__['_intraword'] = 7 * dit
def xlate(self,letter):
try:
return self._xlate[letter.lower()]
except:
return None
def translate(self,string):
"""Translate a string into a list of morse bits """
out = list()
for l in list(string):
if l == ' ':
if out[-1] == "_interword": out.pop()
out.append('_intraword')
else:
out.extend(self.xlate(l))
out.append('_interword')
if out and out[-1] == '_interword': out.pop() # pop off last interword
return out
def timing(self,message):
timelist = list()
for symbol in message:
if symbol == '_interword' or symbol == '_intraword':
timelist[-1] = [ 'off', self.__time__[symbol] ]
else:
timelist.append([ 'on', self.__time__[symbol] ])
timelist.append([ 'off', self.__time__['dit'] ])
return timelist
|
const xmlrpc = require ("davexmlrpc");
const utils = require ("daveutils");
const davehttp = require ("davehttp");
const mail = require ("davemail");
const persists = require ("persists");
const fs = require ("fs");
var config = {
port: 1417,
flPostEnabled: true,
flLogToConsole: true,
flAllowAccessFromAnywhere: true, //3/8/20 by DW
xmlRpcPath: "/rpc2",
archiveFolder: "data/archive/"
}
var stats;
function initStats (callback) {
const initialStats = {
fileSerialnum: 0
};
persists ("stats", initialStats, undefined, function (sharedObject) {
stats = sharedObject;
callback ();
});
}
function mailSend (params, callback) {
var recipient = params [0];
var title = params [1];
var mailtext = params [2];
var sender = params [3];
mail.send (recipient, title, mailtext, sender, function (err, data) {
callback (err, data);
var now = new Date ();
var obj = {
recipient, title, mailtext, sender,
when: now
};
if (err) {
obj.err = err;
}
var f = config.archiveFolder + utils.getDatePath (now) + utils.padWithZeros (stats.fileSerialnum++, 4) + ".json";
utils.sureFilePath (f, function () {
fs.writeFile (f, utils.jsonStringify (obj), function (err) {
});
});
});
}
initStats (function () {
xmlrpc.startServerOverHttp (config, function (xmlRpcRequest) {
switch (xmlRpcRequest.verb) {
case "mail.send":
mailSend (xmlRpcRequest.params, xmlRpcRequest.returnVal);
return (true); //we handled it
}
return (false); //we didn't handle it
});
});
|
package Code.Util;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class DBUtil {
private ArrayList<String> arrayList = new ArrayList<String>();
private ArrayList<String> brrayList = new ArrayList<String>();
private ArrayList<String> crrayList = new ArrayList<String>();
private HttpConnSoap Soap = new HttpConnSoap();
public static Connection getConnection() {
Connection con = null;
try {
// Class.forName("org.gjt.mm.mysql.Driver");
// con=DriverManager.getConnection("jdbc:mysql://192.168.0.106:3306/test?useUnicode=true&characterEncoding=UTF-8","root","initial");
} catch (Exception e) {
// e.printStackTrace();
}
return con;
}
/**
* 获取所有货物的信息
*
* @return
*/
public List<HashMap<String, String>> selectET_InWork() {
List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
arrayList.clear();
brrayList.clear();
crrayList.clear();
crrayList = Soap.GetWebServre("selectET_InWork", arrayList, brrayList);
HashMap<String, String> tempHash = new HashMap<String, String>();
tempHash.put("uInwId", "入库");
tempHash.put("cworkformid", "作业单号");
tempHash.put("compactid", "合同编号");
tempHash.put("client", "客户名称");
list.add(tempHash);
for (int j = 0; j < crrayList.size(); j += 4) {
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("uInwId", crrayList.get(j));
hashMap.put("cworkformid", crrayList.get(j + 1));
hashMap.put("compactid", crrayList.get(j + 2));
hashMap.put("client", crrayList.get(j + 3));
list.add(hashMap);
}
return list;
}
public List<HashMap<String, String>> selectET_OutWork() {
List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
arrayList.clear();
brrayList.clear();
crrayList.clear();
crrayList = Soap.GetWebServre("selectET_OutWork", arrayList, brrayList);
HashMap<String, String> tempHash = new HashMap<String, String>();
tempHash.put("uOutwId", "出库");
tempHash.put("cWorkFormId", "作业单号");
tempHash.put("compactid", "合同编号");
tempHash.put("Client", "客户名称");
list.add(tempHash);
for (int j = 0; j < crrayList.size(); j += 4) {
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("uOutwId", crrayList.get(j));
hashMap.put("cWorkFormId", crrayList.get(j + 1));
hashMap.put("compactid", crrayList.get(j + 2));
hashMap.put("Client", crrayList.get(j + 3));
list.add(hashMap);
}
return list;
}
/**
* 增加一条货物信息
*
* @return
*/
public void insertCargoInfo(String Cname, String Cnum) {
arrayList.clear();
brrayList.clear();
arrayList.add("Cname");
arrayList.add("Cnum");
brrayList.add(Cname);
brrayList.add(Cnum);
Soap.GetWebServre("insertCargoInfo", arrayList, brrayList);
}
/**
* 删除一条货物信息
*
* @return
*/
public void deleteCargoInfo(String Cno) {
arrayList.clear();
brrayList.clear();
arrayList.add("Cno");
brrayList.add(Cno);
Soap.GetWebServre("deleteCargoInfo", arrayList, brrayList);
}
}
|
module WOZLLA.jsonx {
function emptyCallback(root:WOZLLA.GameObject, done:Function) {
done();
}
// reference: @src#asGameObject
export class JSONXBuilder {
public static Factory:Function;
public static create():JSONXBuilder {
if(JSONXBuilder.Factory) {
return <JSONXBuilder>(new (<any>(JSONXBuilder.Factory))());
}
return new JSONXBuilder();
}
private src;
private data;
private err;
private root:WOZLLA.GameObject;
private newCallback:(root:WOZLLA.GameObject, done:Function) => void;
private doLoad:boolean = false;
private doInit:boolean = false;
private loadCallback:(root:WOZLLA.GameObject, done:Function) => void;
private async:boolean = true;
private uuidMap:any = {};
getByUUID(uuid) {
return this.uuidMap[uuid];
}
setSync():void {
this.async = false;
}
instantiateWithSrc(src, callback:(root:WOZLLA.GameObject, done:Function) => void = emptyCallback) {
this.src = src;
this.newCallback = callback;
return this;
}
instantiateWithJSON(data:any, callback:(root:WOZLLA.GameObject, done:Function) => void = emptyCallback) {
this.data = data;
this.newCallback = callback;
return this;
}
load(callback:(root:WOZLLA.GameObject, done:Function) => void = emptyCallback) {
this.doLoad = true;
this.loadCallback = callback;
return this;
}
init() {
if(this.doLoad) {
this.doInit = true;
} else {
this.err = 'JSONXBuilder: init must after load';
}
return this;
}
build(callback:(error:any, root:WOZLLA.GameObject) => void) {
this._loadJSONData(() => {
if(this._checkError(callback)) return;
this._newGameObjectTree(() => {
if(this._checkError(callback)) return;
if(!this.doLoad) {
callback(this.err, this.root);
return;
}
this.newCallback(this.root, () => {
this._loadAssets(() => {
if(this._checkError(callback)) return;
if(!this.doInit) {
callback(this.err, this.root);
return;
}
this._init();
callback(this.err, this.root);
});
});
});
});
}
protected _checkError(callback:(error:any, root:WOZLLA.GameObject) => void) {
if(this.err) {
callback(this.err, null);
return true;
}
return false;
}
protected _loadJSONData(callback:Function) {
if(this.src && !this.data) {
WOZLLA.utils.Ajax.request({
url: Director.getInstance().assetLoader.getBaseDir() + '/' + this.src,
dataType: 'json',
async: this.async,
withCredentials: true,
success: (data) => {
this.data = data;
callback && callback();
},
error: (err) => {
this.err = err;
callback && callback()
}
});
} else {
callback && callback();
}
}
protected _newGameObjectTree(callback:Function) {
this._newGameObject(this.data.root, (root:WOZLLA.GameObject) => {
this.root = root;
callback && callback();
});
}
protected _newGameObject(data:any, callback:(gameObj:WOZLLA.GameObject) => void) {
var gameObj = new WOZLLA.GameObject(data.rect);
gameObj._uuid = data.uuid;
this.uuidMap[data.uuid] = gameObj;
gameObj.id = data.id;
gameObj.name = data.name;
gameObj.active = data.active;
gameObj.visible = data.visible;
gameObj.touchable = data.touchable;
gameObj.transform.set(data.transform);
var components:Array<any> = data.components;
if(components && components.length > 0) {
components.forEach((compData:any) => {
gameObj.addComponent(this._newComponent(compData, gameObj));
});
}
var createdChildCount = 0;
var children:Array<any> = data.children;
if(!children || children.length === 0) {
callback(gameObj);
return;
}
children.forEach((childData:any) => {
if(childData.reference) {
this._newReferenceObject(childData, (child) => {
if(child) {
gameObj.addChild(child);
}
createdChildCount ++;
if(createdChildCount === children.length) {
callback(gameObj);
}
});
} else {
this._newGameObject(childData, (child) => {
gameObj.addChild(child);
createdChildCount ++;
if(createdChildCount === children.length) {
callback(gameObj);
}
});
}
});
}
protected _newReferenceObject(data:any, callback:(gameObj:WOZLLA.GameObject) => void) {
var builder = new JSONXBuilder();
builder.instantiateWithSrc(data.reference).build((err:any, root:WOZLLA.GameObject) => {
if(err) {
this.err = err;
}
else if(root) {
root._uuid = data.uuid;
this.uuidMap[data.uuid] = root;
root.name = data.name;
root.id = data.id;
root.active = data.active;
root.visible = data.visible;
root.touchable = data.touchable;
root.transform.set(data.transform);
}
callback(root);
});
}
protected _newComponent(compData:any, gameObj:WOZLLA.GameObject):WOZLLA.Component {
var component = WOZLLA.Component.create(compData.name);
var config = WOZLLA.Component.getConfig(compData.name);
component._uuid = compData.uuid;
this.uuidMap[compData.uuid] = component;
component.gameObject = gameObj;
this._applyComponentProperties(component, config.properties, compData);
return component;
}
protected _applyComponentProperties(component, properties:any, compData:any) {
if(properties && properties.length > 0) {
properties.forEach((prop) => {
if(prop.group) {
this._applyComponentProperties(component, prop.properties, compData);
} else if(prop.extend) {
var config = Component.getConfig(prop.extend);
if(config) {
this._applyComponentProperties(component, config.properties, compData);
}
} else {
var value = compData.properties[prop.name];
value = value == void 0 ? prop.defaultValue : value;
if (prop.convert && value) {
value = prop.convert(value);
}
component[prop.name] = value;
}
});
}
}
protected _loadAssets(callback:Function) {
this.root.loadAssets(callback);
}
protected _init() {
this.root.init();
}
}
} |
const { describe, it } = require('eslint/lib/testers/event-generator-tester');
const { before, after } = require('mocha');
const expect = require('expect.js');
const sinon = require('sinon');
const request = require('supertest-as-promised');
const httpStatus = require('http-status');
const DroneService = require('../../app/services/drone.service');
const app = require('../../server').app;
const loginHelpers = require('../helpers/login');
const USER = require('../fixtures/user.json');
describe('DroneController', () => {
let token = null;
before((done) => {
loginHelpers.createUser(USER)
.then(user => loginHelpers.getJWT(user.username))
.then(jwt => {
token = jwt;
done();
});
});
after((done) => {
loginHelpers.deleteUser(USER.username)
.then(() => {
token = null;
done();
});
});
describe('getDeploymentsCount()', () => {
it('should return unauthorized status', (done) => {
const stub = sinon.stub(DroneService, 'getDeploymentsCount').resolves(12);
request(app)
.get('/drone/deployments/total')
.expect(httpStatus.UNAUTHORIZED)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return 500 status', (done) => {
const stub = sinon.stub(DroneService, 'getDeploymentsCount').rejects('error');
request(app)
.get('/drone/deployments/total')
.set('token', token)
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return deployments count', (done) => {
const stub = sinon.stub(DroneService, 'getDeploymentsCount').resolves(12);
request(app)
.get('/drone/deployments/total')
.set('token', token)
.expect(httpStatus.OK)
.then((res) => {
expect(stub.getCall(0).args).to.eql([]);
expect(res.body.result).to.equal(true);
expect(res.body.data).to.eql(12);
stub.restore();
done();
})
.catch(done);
});
});
describe('getBuilds()', () => {
it('should return unauthorized status', (done) => {
const stub = sinon.stub(DroneService, 'getBuilds').resolves(['builds']);
request(app)
.get('/drone/builds/Owner/Name')
.expect(httpStatus.UNAUTHORIZED)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return 500 status', (done) => {
const stub = sinon.stub(DroneService, 'getBuilds').rejects('error');
request(app)
.get('/drone/builds/Owner/Name')
.set('token', token)
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return builds 100 latest builds', (done) => {
const THOUSAND_BUILDS = [];
for (let i = 1; i <= 1000; ++i) {
THOUSAND_BUILDS.push(`Build_#${i}`);
}
const stub = sinon.stub(DroneService, 'getBuilds').resolves(THOUSAND_BUILDS);
request(app)
.get('/drone/builds/Owner/Name')
.set('token', token)
.expect(httpStatus.OK)
.then((res) => {
expect(stub.getCall(0).args).to.eql(['Owner', 'Name']);
expect(res.body.result).to.equal(true);
expect(res.body.data.length).to.equal(100);
expect(res.body.data).to.eql(THOUSAND_BUILDS.slice(0, 100));
stub.restore();
done();
})
.catch(done);
});
});
describe('getContributors()', () => {
it('should return unauthorized status', (done) => {
const stub = sinon.stub(DroneService, 'getBuilds').resolves(['builds']);
request(app)
.get('/drone/builds/Owner/Name/contributors')
.expect(httpStatus.UNAUTHORIZED)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return 500 status', (done) => {
const stub = sinon.stub(DroneService, 'getBuilds').rejects('error');
request(app)
.get('/drone/builds/Owner/Name/contributors')
.set('token', token)
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return contributors, ordered by commitsCount', (done) => {
const BUILDS = require('../fixtures/drone/builds.json');
const stub = sinon.stub(DroneService, 'getBuilds').resolves(BUILDS);
const EXPECTED = [
{
name: '<NAME>',
avatar: 'https://www.gravatar.com/avatar/621c630593e999d380c63d70e7f56022.jpg',
commitsCount: 4
}, {
name: '<NAME>',
avatar: 'https://www.gravatar.com/avatar/2e332e1946e851142bfcc7bb74027f20.jpg',
commitsCount: 1
}
];
request(app)
.get('/drone/builds/Owner/Name/contributors')
.set('token', token)
.expect(httpStatus.OK)
.then((res) => {
expect(stub.getCall(0).args).to.eql(['Owner', 'Name']);
expect(res.body.result).to.equal(true);
expect(res.body.data).to.eql(EXPECTED);
stub.restore();
done();
})
.catch(done);
});
});
describe('getBuild()', () => {
it('should return unauthorized status', (done) => {
const stub = sinon.stub(DroneService, 'getBuild').resolves('build');
request(app)
.get('/drone/builds/Owner/Name/12')
.expect(httpStatus.UNAUTHORIZED)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return 500 status', (done) => {
const stub = sinon.stub(DroneService, 'getBuild').rejects('error');
request(app)
.get('/drone/builds/Owner/Name/12')
.set('token', token)
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return one build', (done) => {
const stub = sinon.stub(DroneService, 'getBuild').resolves('build');
request(app)
.get('/drone/builds/Owner/Name/12')
.set('token', token)
.expect(httpStatus.OK)
.then((res) => {
expect(stub.getCall(0).args).to.eql(['Owner', 'Name', 12]);
expect(res.body.result).to.equal(true);
expect(res.body.data).to.equal('build');
stub.restore();
done();
})
.catch(done);
});
});
describe('getLatestBuild()', () => {
it('should return unauthorized status', (done) => {
const stub = sinon.stub(DroneService, 'getLastBuild').resolves('build');
request(app)
.get('/drone/builds/Owner/Name/latest')
.expect(httpStatus.UNAUTHORIZED)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return 500 status', (done) => {
const stub = sinon.stub(DroneService, 'getLastBuild').rejects('error');
request(app)
.get('/drone/builds/Owner/Name/latest')
.set('token', token)
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return one build', (done) => {
const stub = sinon.stub(DroneService, 'getLastBuild').resolves('build');
request(app)
.get('/drone/builds/Owner/Name/latest?branch=develop')
.set('token', token)
.expect(httpStatus.OK)
.then((res) => {
expect(stub.getCall(0).args).to.eql(['Owner', 'Name', 'develop']);
expect(res.body.result).to.equal(true);
expect(res.body.data).to.equal('build');
stub.restore();
done();
})
.catch(done);
});
});
describe('restartBuild()', () => {
it('should return unauthorized status', (done) => {
const stub = sinon.stub(DroneService, 'restartBuild').resolves('build');
request(app)
.post('/drone/builds/Owner/Name/12')
.expect(httpStatus.UNAUTHORIZED)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return 500 status', (done) => {
const stub = sinon.stub(DroneService, 'restartBuild').rejects('error');
request(app)
.post('/drone/builds/Owner/Name/12')
.set('token', token)
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return one build', (done) => {
const stub = sinon.stub(DroneService, 'restartBuild').resolves('restarted');
request(app)
.post('/drone/builds/Owner/Name/12')
.set('token', token)
.expect(httpStatus.OK)
.then((res) => {
expect(stub.getCall(0).args).to.eql(['Owner', 'Name', '12']);
expect(res.body.result).to.equal(true);
expect(res.body.data).to.equal('restarted');
stub.restore();
done();
})
.catch(done);
});
});
describe('stopBuild()', () => {
it('should return unauthorized status', (done) => {
const stub = sinon.stub(DroneService, 'stopBuild').resolves('build');
request(app)
.delete('/drone/builds/Owner/Name/12/1')
.expect(httpStatus.UNAUTHORIZED)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return 500 status', (done) => {
const stub = sinon.stub(DroneService, 'stopBuild').rejects('error');
request(app)
.delete('/drone/builds/Owner/Name/12/1')
.set('token', token)
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return one build', (done) => {
const stub = sinon.stub(DroneService, 'stopBuild').resolves('stopped');
request(app)
.delete('/drone/builds/Owner/Name/12/1')
.set('token', token)
.expect(httpStatus.OK)
.then((res) => {
expect(stub.getCall(0).args).to.eql(['Owner', 'Name', '12', '1']);
expect(res.body.result).to.equal(true);
expect(res.body.data).to.equal('stopped');
stub.restore();
done();
})
.catch(done);
});
});
describe('getBuildLogs()', () => {
it('should return unauthorized status', (done) => {
const stub = sinon.stub(DroneService, 'getBuildLogs').resolves(['logs']);
request(app)
.get('/drone/builds/Owner/Name/logs/12/1')
.expect(httpStatus.UNAUTHORIZED)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return 500 status', (done) => {
const stub = sinon.stub(DroneService, 'getBuildLogs').rejects('error');
request(app)
.get('/drone/builds/Owner/Name/logs/12/1')
.set('token', token)
.expect(httpStatus.INTERNAL_SERVER_ERROR)
.then(() => {
stub.restore();
done();
})
.catch(done);
});
it('should return one build', (done) => {
const stub = sinon.stub(DroneService, 'getBuildLogs').resolves(['logs']);
request(app)
.get('/drone/builds/Owner/Name/logs/12/1')
.set('token', token)
.expect(httpStatus.OK)
.then((res) => {
expect(stub.getCall(0).args).to.eql(['Owner', 'Name', 12, 1]);
expect(res.body.result).to.equal(true);
expect(res.body.data).to.contain('logs');
stub.restore();
done();
})
.catch(done);
});
});
});
|
<filename>app/src/main/java/com/cjy/flb/manager/AppManager.java
package com.cjy.flb.manager;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.ComponentName;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import java.util.Vector;
/**
* 应用程序Activity管理类:用于Activity管理和应用程序退出
*/
public class AppManager {
private static final String TAG = AppManager.class.getSimpleName();
private static Stack<Activity> activityStack;
private static AppManager instance;
private AppManager() {
// ...
}
/**
* 单一实例
*/
public static AppManager getAppManager() {
if (instance == null) {
instance = new AppManager();
activityStack = new Stack<Activity>();
}
return instance;
}
/**
* 添加Activity到堆栈
*/
public void addActivity(Activity activity) {
if (!activityStack.contains(activity)) {
activityStack.add(activity);
}
}
/**
* 返回到指定的Activity并且清除Stack中其位置上的所有Activity
*
* @param clz 指定的Activity
* @return 该Activity 目前不返回,有需要再加
*/
public Activity getTopWith(Class<?> clz) {
Activity resAc = null;
int postion = 0;
if (null != clz) {
if (null != activityStack && activityStack.size() > 0) {
for (int i = 0; i < activityStack.size(); i++) {
if (activityStack.get(i).getClass().getName().contains(clz.getName())) {
postion = i;
}
}
int num = activityStack.size() - postion - 1;
if (num > 0) {
for (int i = 0; i < num; i++) {
if (!activityStack.empty()) {
finishActivity(activityStack.pop());
}
}
}
}
}
// TODO 目前不返回,有需要再加
return resAc;
}
/**
* 判断是否有该Activity
*
* @param clz Activiy
* @return true 则存在
*/
public static boolean hasActivity(Class<?> clz) {
if (null != clz) {
if (null != activityStack && activityStack.size() > 0) {
for (int i = 0; i < activityStack.size(); i++) {
if (activityStack.get(i).getClass().getName().contains(clz.getName())) {
return true;
}
}
}
}
return false;
}
/**
* 获取当前Activity(堆栈中最后一个压入的)
*/
public Activity currentActivity() {
Activity activity = activityStack.lastElement();
return activity;
}
/**
* 结束当前Activity(堆栈中最后一个压入的)
*/
public void finishActivity() {
Activity activity = activityStack.lastElement();
finishActivity(activity);
}
/**
* 结束指定的Activity
*/
public void finishActivity(Activity activity) {
if (activity != null) {
activityStack.remove(activity);
activity.finish();
activity = null;
}
}
/**
* 结束指定类名的Activity
*/
public void finishActivity(Class<?> cls) {
Vector<Activity> list = new Vector<>();
for (Activity activity : activityStack) {
if (activity.getClass().equals(cls)) {
list.add(activity);
}
}
for (Activity activity : list) {
finishActivity(activity);
}
list.clear();
}
public void finishExceptMe(Class<?> cls) {
Vector<Activity> list = new Vector<>();
for (Activity activity : activityStack) {
if (!activity.getClass().equals(cls)) {
list.add(activity);
}
}
for (Activity activity : list) {
finishActivity(activity);
}
list.clear();
}
/**
* 结束所有Activity
*/
public void finishAllActivity() {
for (int i = 0, size = activityStack.size(); i < size; i++) {
if (null != activityStack.get(i)) {
activityStack.get(i).finish();
}
}
activityStack.clear();
}
public void finishAllWaitRestart() {
while (!activityStack.isEmpty()) {
// Logger.d("Marco", "finish activity:" + activityStack.peek().getClass().getName());
if (activityStack.size() == 1) {
return;
}
activityStack.pop().finish();
}
}
/**
* 退出应用程序
*/
public void AppExit(Context context) {
try {
// Logger.d("小额信贷应用退出");
finishAllActivity();
ActivityManager activityMgr = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
activityMgr.killBackgroundProcesses(context.getPackageName());
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 判定程序是否处于后台
*
* @param context
* @return true if in backgroud
*/
public static boolean isAppInBackgroud(Context context) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> tasks = am.getRunningTasks(1);
if (!tasks.isEmpty()) {
ComponentName topActivity = tasks.get(0).topActivity;
if (!topActivity.getPackageName().equals(context.getPackageName())) {
// Logger.d(TAG, "在后台");
return true;
}
}
// Logger.d(TAG, "在前台");
return false;
}
} |
#!/bin/bash
#
# Copyright The Cryostat Authors
#
# The Universal Permissive License (UPL), Version 1.0
#
# Subject to the condition set forth below, permission is hereby granted to any
# person obtaining a copy of this software, associated documentation and/or data
# (collectively the "Software"), free of charge and under any and all copyright
# rights in the Software, and any and all patent rights owned or freely
# licensable by each licensor hereunder covering either (i) the unmodified
# Software as contributed to or provided by such licensor, or (ii) the Larger
# Works (as defined below), to deal in both
#
# (a) the Software, and
# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
# one is included with the Software (each a "Larger Work" to which the Software
# is contributed by such licensors),
#
# without restriction, including without limitation the rights to copy, create
# derivative works of, display, perform, and distribute the Software and make,
# use, sell, offer for sale, import, export, have made, and have sold the
# Software and the Larger Work(s), and to sublicense the foregoing rights on
# either these or other terms.
#
# This license is subject to the following condition:
# The above copyright notice and either this complete permission notice or at
# a minimum a reference to the UPL must 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.
#
# This script compares the differences between a JMC 7 source and the
# embedded JMC source files within this repo
if [ $# -ne 1 ]; then
echo "usage: $0 /path/to/jmc7" >&2
exit 1
fi
JMC_DIR=$1
ROOT_DIR="$(readlink -f "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/..")"
SUMMARIZE_MISSING="${SUMMARIZE_MISSING:-false}"
MISSING_FILES=""
diffBundle () {
local bundle_name="$1"
local src_dir="$2"
local exclude_dir="$3"
pushd "${JMC_DIR}/application/${bundle_name}" >/dev/null
if [ -n "$exclude_dir" ]; then
local srcFiles=$(find "${src_dir}" -type f -not -path "${exclude_dir}/*")
else
local srcFiles=$(find "${src_dir}" -type f)
fi
local diff_flags="-u"
if [ "${SUMMARIZE_MISSING}" != true ]; then
diff_flags="${diff_flags} -N"
fi
for i in ${srcFiles}; do
if [ "${SUMMARIZE_MISSING}" = true -a ! -f "${ROOT_DIR}/$i" ]; then
MISSING_FILES="${MISSING_FILES}\n$i"
else
diff ${diff_flags} --label="a/$i" --label="b/$i" "${JMC_DIR}/application/${bundle_name}/$i" "${ROOT_DIR}/$i"
fi
done
popd >/dev/null
}
diffBundle "org.openjdk.jmc.flightrecorder.configuration" "src/main/java/org/openjdk/jmc/flightrecorder/configuration/"
diffBundle "org.openjdk.jmc.flightrecorder.controlpanel.ui" "src/main/java/org/openjdk/jmc/flightrecorder/controlpanel/ui" "src/main/java/org/openjdk/jmc/flightrecorder/controlpanel/ui/configuration"
diffBundle "org.openjdk.jmc.flightrecorder.controlpanel.ui.configuration" "src/main/java/org/openjdk/jmc/flightrecorder/controlpanel/ui/configuration"
diffBundle "org.openjdk.jmc.rjmx" "src/main/java/org/openjdk/jmc/rjmx" "src/main/java/org/openjdk/jmc/rjmx/services/jfr"
diffBundle "org.openjdk.jmc.rjmx.services.jfr" "src/main/java/org/openjdk/jmc/rjmx/services/jfr"
diffBundle "org.openjdk.jmc.jdp" "src/main/java/org/openjdk/jmc/jdp"
diffBundle "org.openjdk.jmc.ui.common" "src/main/java/org/openjdk/jmc/ui/common"
if [ "${SUMMARIZE_MISSING}" = true ]; then
echo -e "\nRemoved files:${MISSING_FILES}"
fi
|
// code splitting - module bundeling - lazy loading
console.log("new file with module bundeling...");
|
#!/usr/bin/env bats
load "../helpers"
setup_file() {
start_network
}
teardown_file() {
teardown_network
}
teardown() {
stop_connector
stop_gateway
}
@test "Can list channel history" {
background ${lnctl} connector
retry 5 1 curl_connector GetStatus
background ${lnctl} server
open_channel lnd1 lnd2
chan_id=$(lnd_cmd lnd1 listchannels | jq -r '.channels[0].chan_id')
sleep 2
n_snapshots=$(${lnctl} channel-history ${chan_id} | jq -r '.snapshots | length')
[ "${n_snapshots}" -eq 1 ]
}
|
<filename>examples/dockercompose_project/microservice1/app.py
import os
from panini import app as panini_app
app = panini_app.App(
service_name="microservice1",
host="nats-server" if "HOSTNAME" in os.environ else "127.0.0.1",
port=4222,
app_strategy="asyncio",
)
log = app.logger
msg = {
"key1": "value1",
"key2": 2,
"key3": 3.0,
"key4": [1, 2, 3, 4],
"key5": {"1": 1, "2": 2, "3": 3, "4": 4, "5": 5},
"key6": {"subkey1": "1", "subkey2": 2, "3": 3, "4": 4, "5": 5},
"key7": None,
}
@app.timer_task(interval=1)
async def publish_periodically():
for _ in range(10):
await app.publish(subject="some.publish.subject", message=msg)
log.warning(f"send message from periodic task {msg}")
if __name__ == "__main__":
app.start()
|
<reponame>raghav-deepsource/realm-java
/*
* Copyright 2017 Realm Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.realm.entities.realmname;
import java.util.Arrays;
import java.util.List;
import io.realm.RealmList;
import io.realm.RealmObject;
import io.realm.annotations.RealmClass;
import io.realm.annotations.RealmField;
import io.realm.annotations.RealmNamingPolicy;
// Class will inherit RealmNamingPolicy.LOWER_CASE_WITH_UNDERSCORES from the module `CustomRealmNamesModule`
@RealmClass(name = "class-name-override", fieldNamingPolicy = RealmNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
public class ClassNameOverrideModulePolicy extends RealmObject {
// Expected internal names
public static final String CLASS_NAME = "class-name-override";
public static final String FIELD_CAMEL_CASE = "camel_case";
public static final String FIELD_PASCAL_CASE = "pascal_case";
public static final String FIELD_M_HUNGARIAN = "hungarian";
public static final String FIELD_ALLCAPS = "allcaps";
public static final String FIELD_ALLLOWER = "alllower";
public static final String FIELD_WITH_UNDERSCORES = "with_underscores";
public static final String FIELD_WITH_SPECIAL_CHARS = "internal_var";
public static final String FIELD_CUSTOM_NAME = "a different name";
public static final List<String> ALL_FIELDS = Arrays.asList(
FIELD_CAMEL_CASE,
FIELD_PASCAL_CASE,
FIELD_M_HUNGARIAN,
FIELD_ALLCAPS,
FIELD_ALLLOWER,
FIELD_WITH_UNDERSCORES,
FIELD_WITH_SPECIAL_CHARS,
FIELD_CUSTOM_NAME
);
public String camelCase;
public int PascalCase;
public boolean mHungarian;
public boolean ALLCAPS;
public boolean alllower;
public boolean with_underscores;
public RealmList<ClassWithPolicy> $_internalVar;
@RealmField(name = "a different name") // This will override the class policy
public String customName;
}
|
# 增加 luci-theme-argon
git clone https://github.com/jerrykuku/luci-theme-argon.git package/danxiaonuo/luci-theme-argon
# smartdns
svn co https://github.com/pymumu/smartdns/trunk/package/openwrt package/danxiaonuo/smartdns
svn co https://github.com/project-openwrt/openwrt/trunk/package/ntlf9t/luci-app-smartdns package/danxiaonuo/luci-app-smartdns
# Server酱
rm -rf package/ctcgfw/luci-app-serverchan
git clone https://github.com/tty228/luci-app-serverchan.git package/danxiaonuo/luci-app-serverchan
# 增加acl访问权限设置
curl -fsSL https://raw.githubusercontent.com/danxiaonuo/AutoBuild-OpenWrt/master/server/acl.d/luci-app-smartdns.json > package/base-files/files/usr/luci-app-smartdns.json
curl -fsSL https://raw.githubusercontent.com/danxiaonuo/AutoBuild-OpenWrt/master/server/acl.d/luci-app-serverchan.json > package/base-files/files/usr/luci-app-serverchan.json
curl -fsSL https://raw.githubusercontent.com/danxiaonuo/AutoBuild-OpenWrt/master/server/acl.d/luci-app-frpc.json > package/base-files/files/usr/luci-app-frpc.json
curl -fsSL https://raw.githubusercontent.com/danxiaonuo/AutoBuild-OpenWrt/master/server/acl.d/luci-app-webadmin.json > package/base-files/files/usr/luci-app-webadmin.json
sed -i '/exit 0/i\# 增加acl访问权限设置\nmv /usr/*.json /usr/share/rpcd/acl.d/' package/danxiaonuo/default-settings/files/zzz-default-settings
# 删除 r8168 driver
#rm -rf package/ctcgfw/r8168
# 删除 phicomm-k3screenctrl
#rm -rf package/zxlhhyccc/phicomm-k3screenctrl
# k3设置
git clone https://github.com/lwz322/luci-app-k3screenctrl.git package/k3/luci-app-k3screenctrl
git clone https://github.com/lwz322/k3screenctrl.git package/k3/k3screenctrl
git clone https://github.com/lwz322/k3screenctrl_build.git package/k3/k3screenctrl_build
# 删除默认配置
rm -rf package/lean/default-settings
rm -rf package/ntlf9t/smartdns
rm -rf package/ntlf9t/luci-app-smartdns
|
def sentiment_classification(word_list):
sentiment_words = {
'positive': ['happy', 'joyful'],
'negative': ['sad', 'angry']
}
result = []
for word in word_list:
if word in sentiment_words['positive']:
result.append(('positive', word))
elif word in sentiment_words['negative']:
result.append(('negative', word))
return result
word_list = ["happy", "sad", "angry", "joyful"]
sentiment_classification(word_list) |
#!/bin/bash
curl -s http://10.1.100.61:8000/api/v0.1/predictions \
-H "Content-Type: application/json" \
-d '{"data":{"ndarray":[[10.1, 0.37, 0.34, 2.4, 0.085, 5.0, 17.0, 0.99683, 3.17, 0.65, 10.6],[10.1, 0.37, 0.34, 2.4, 0.085, 5.0, 17.0, 0.99683, 3.17, 0.65, 10.6]]}}'
#curl -v "http://10.152.183.130/data-drift/bpk-broker" \
#-X POST \
#-H "Ce-Id: say-hello" \
#-H "Ce-Specversion: 1.0" \
#-H "Ce-Type: greeting" \
#-H "Ce-Source: not-sendoff" \
#-H "Content-Type: application/json" \
#-d '{"msg":"Hello Knative!"}' |
<gh_stars>0
#include "comms.h"
/* opens pipe in Write only mode,
* this should freeze the program
* until message has been read */
void send_message(const char *pipe_name, char *msg, bool do_unlink) {
mkfifo(pipe_name, 0666);
int fifod = open(pipe_name, O_WRONLY);
int pm_size = buffer_size("%0*d%s", 7, getpid(), msg);
char *processed_message = malloc(pm_size);
snprintf(processed_message, pm_size, "%0*d%s", 7, getpid(), msg);
write(fifod, processed_message, pm_size);
close(fifod);
free(processed_message);
if(do_unlink) unlink(pipe_name);
}
char **wait_message(const char *pipe_name, int tries) {
char *msg_buffer = malloc(1);
char byte = 0;
char **msg = malloc(sizeof(char*) * MAX_TOKENS);
int count = 0;
if(msg_buffer == NULL || msg == NULL) {
return NULL;
}
mkfifo(pipe_name, 0666);
int fifod = open(pipe_name, O_RDONLY);
int err = 0; // read return value
while((err = read(fifod, &byte, 1)) > 0) {
msg_buffer = realloc(msg_buffer, count + 1);
msg_buffer[count] = byte;
count++;
}
if(err == -1 && tries > 0) {
usleep(WAIT_TIME);
close(fifod);
return wait_message(pipe_name, tries - 1);
} else if(tries == 0){
msg[SIGNAL] = "TIME_OUT";
msg[SENDER] = "0";
close(fifod);
return msg;
}
msg[SENDER] = malloc(count);
msg[SIGNAL] = malloc(count);
snprintf(msg[SENDER], 8, "%s", msg_buffer);
snprintf(msg[SIGNAL], count - 7, "%s", msg_buffer + 7);
free(msg_buffer);
close(fifod);
return msg;
}
|
<gh_stars>10-100
package io.opensphere.controlpanels.about;
import io.opensphere.core.Toolbox;
import io.opensphere.core.api.adapter.AbstractHUDFrameMenuItemPlugin;
/**
* The plug-in for the about user interface.
*/
public class AboutPlugin extends AbstractHUDFrameMenuItemPlugin
{
/**
* Instantiates a new layer manager plugin.
*/
public AboutPlugin()
{
super(About.TITLE, false, false);
}
@Override
protected About createInternalFrame(Toolbox toolbox)
{
About options = new About(toolbox);
options.setVisible(false);
options.setLocation(200, 100);
return options;
}
}
|
require('./bootstrap');
import Vue from "vue";
import VModal from "vue-js-modal";
import VueGoodTablePlugin from "vue-good-table";
import "vue-good-table/dist/vue-good-table.css";
import router from "./router";
import VueRouter from "vue-router";
import Loading from "vue-loading-overlay";
import "vue-loading-overlay/dist/vue-loading.css";
import VueSweetalert2 from "vue-sweetalert2";
import vSelect from "vue-select";
import 'vue-select/dist/vue-select.css';
import VueFormWizard from 'vue-form-wizard'
import 'vue-form-wizard/dist/vue-form-wizard.min.css'
import Paintable from 'vue-paintable';
import VueHtml2Canvas from 'vue-html2canvas';
import RegeneratorRuntime from "regenerator-runtime";
import FlashMessage from '@smartweb/vue-flash-message';
import App from "./components/App";
import { funcionesGlobales } from "./funciones.js";
import swal from 'sweetalert2';
window.Swal = swal;
Vue.prototype.$funcionesGlobales = funcionesGlobales;
Vue.use(Loading);
Vue.use(VueRouter);
Vue.use(VueSweetalert2);
Vue.use(VueGoodTablePlugin);
Vue.use(VModal);
Vue.use(VueFormWizard);
Vue.use(VueHtml2Canvas);
Vue.use(RegeneratorRuntime);
Vue.use(Paintable, {
// optional methods
setItem(key, image) {
localStorage.setItem(key, image);
},
// you also can use async
getItem(key) {
return localStorage.getItem(key);
},
removeItem(key) {
localStorage.removeItem(key);
}
});
Vue.use(FlashMessage);
Vue.component("v-select", vSelect);
//*********COMPONENTES GENERALES*********\\
Vue.component(
"menuComponente",
require("./components/componentesGenerales/MenuComponent.vue").default
);
Vue.component(
"vuetable-component",
require("./components/componentesGenerales/VueTableComponent.vue").default
);
Vue.component(
"vue-painttable",
require("./components/componentesGenerales/VuePaintableComponent.vue").default
);
Vue.component(
"vue-confirmar-cancelar",
require("./components/componentesGenerales/VueConfirmarCancelarComponent.vue").default
);
Vue.component(
"vue-firma",
require("./components/componentesGenerales/VueFirmaComponent.vue").default
);
//*********FIN COMPONENTES GENERALES*********\\
/* Vue.component(
"prueba",
require("./components/Prueba.vue").default
); */
//Modulo de Parametrizacion
Vue.component(
"crear-modificar-modulo",
require("./components/Modulos/Parametrizacion/modulo/CrearModificarModulo.vue").default
);
Vue.component(
"crear-modificar-sub-modulo",
require("./components/Modulos/Parametrizacion/sub_modulo/CrearModificarSubModulo.vue").default
);
//*********MODULO CIRUGÍA*********\\
Vue.component(
"lista-cirugia-programa-paciente",
require("./components/Modulos/Cirugia/valoracionPreanestecia/ListaCirugiaProgramadaPaciente.vue").default
);
//Registro de Tiempo
//Valoracion Preanestesia
Vue.component(
"revision-sistema",
require("./components/Modulos/Cirugia/valoracionPreanestecia/componentsValoracionPreanestecia/RevisionSistema.vue").default
);
Vue.component(
"antecedente",
require("./components/Modulos/Cirugia/valoracionPreanestecia/componentsValoracionPreanestecia/Antecedente.vue").default
);
Vue.component(
"examen-fisico",
require("./components/Modulos/Cirugia/valoracionPreanestecia/componentsValoracionPreanestecia/ExamenFisico.vue").default
);
Vue.component(
"paraclinico",
require("./components/Modulos/Cirugia/valoracionPreanestecia/componentsValoracionPreanestecia/Paraclinico.vue").default
);
//Registro Anestesia
Vue.component(
"datos-paciente",
require("./components/Modulos/Cirugia/RegistroAnestesia/components/DatosPacienteComponet.vue").default
);
Vue.component(
"trans-anestesico",
require("./components/Modulos/Cirugia/RegistroAnestesia/components/TransAnestesicoComponet.vue").default
);
Vue.component(
"administracion-farmaco",
require("./components/Modulos/Cirugia/RegistroAnestesia/components/AdministracionFarmacoComponet.vue").default
);
Vue.component(
"registro-anestesico",
require("./components/Modulos/Cirugia/anestesia/components/registro-anestesico.vue").default
);
Vue.component(
"eliminar-agente",
require("./components/Modulos/Cirugia/anestesia/components/EliminarAgenteComponet.vue").default
);
//Listado Verificacion
Vue.component(
"lista-entrada",
require("./components/Modulos/Cirugia/lista_verificacion/componentsListaVerificacion/ListaEntrada.vue").default
);
Vue.component(
"lista-pausa",
require("./components/Modulos/Cirugia/lista_verificacion/componentsListaVerificacion/ListaPausa.vue").default
);
Vue.component(
"lista-salida",
require("./components/Modulos/Cirugia/lista_verificacion/componentsListaVerificacion/ListaSalida.vue").default
);
Vue.component(
"lista-visualizacion",
require("./components/Modulos/Cirugia/lista_verificacion/componentsListaVerificacion/VisualizacionLista.vue").default
);
Vue.component(
"lista-firma",
require("./components/Modulos/Cirugia/lista_verificacion/componentsListaVerificacion/ListaFirma.vue").default
);
//*********FIN MODULO CIRUGÍA*********\\
/*
Vue.component(
"crear-modificar-tipo-agente",
require("./components/Modulos/Cirugia/tipo_agente/CrearModificarTipoAgente.vue").default
);
Vue.component(
"crear-modificar-tipo-posiciones",
require("./components/Modulos/Cirugia/tipo_posiciones/CrearModificarTipoPosiciones.vue").default
);*/
new Vue({
el: "#app",
components: {
App
},
router
})
|
<reponame>and1985129/digitalofficemobile<filename>www/controller/Login.controller.js
sap.ui.define([
"sap/ui/core/mvc/Controller", "sap/ui/model/json/JSONModel"
], function(Controller, JSONModel) {
"use strict";
return Controller.extend("sap.dm.controller.Login", {
onInit: function() {
var oComponent = this.getOwnerComponent();
this._router = oComponent.getRouter();
this._setupFormVisible();
},
_setupFormVisible: function() {
this.oFormLoginModel = new JSONModel({
bPinCode: false,
bInital: true,
pinCode: ""
});
this.getView().setModel(this.oFormLoginModel, "oFormLoginModel");
},
onPressPinCode: function(oEvent) {
var oFormLoginData = this.oFormLoginModel.getData();
oFormLoginData.bPinCode = true;
oFormLoginData.bInital = false;
this.oFormLoginModel.refresh();
},
onPinCodeLogin: function() {
var oUserModel = new JSONModel("model/userProfile.json");
var sPin = this.oFormLoginModel.getData().pinCode;
this._router.navTo("appointment");
}
});
});
|
function aggregateServicesData(servicesData) {
const aggregatedData = {};
servicesData.forEach(service => {
if (aggregatedData[service.type]) {
aggregatedData[service.type] = { ...aggregatedData[service.type], ...service.data };
} else {
aggregatedData[service.type] = service.data;
}
});
return aggregatedData;
}
const servicesData = [
{ type: 'Personio', data: { employees: 50, departments: 5 } },
{ type: 'SafeConfig', data: { projects: 20, configurations: 100 } },
{ type: 'Runn', data: { tasks: 200, schedules: 50 } },
{ type: 'Harvest', data: { timeEntries: 500, expenses: 1000 } },
{ type: 'HarvestRunn', data: { timeEntries: 300, expenses: 800, tasks: 150 } }
];
console.log(aggregateServicesData(servicesData)); |
#!/bin/sh
set -e
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# use filter instead of exclude so missing patterns dont' throw errors
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\""
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods-BAFirstPod_Example/BAFirstPod.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "Pods-BAFirstPod_Example/BAFirstPod.framework"
fi
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.