text:
// Copyright 2020 Adam Chalkley
//
// https://github.com/atc0005/bounce
//
// Licensed under the MIT License. See LICENSE file in the project root for
// full license information.

package main

import (
	"context"
	"net/http"
	"os"
	"time"

	"github.com/apex/log"
	"github.com/atc0005/bounce/internal/config"
)

// shutdownListener listens for an os.Signal on the provided quit channel.
// When this signal is received, the provided parent context cancel() function
// is used to cancel all child contexts. This is intended to be run as a
// goroutine.
func shutdownListener(_ context.Context, quit <-chan os.Signal, parentContextCancel context.CancelFunc) {

	// monitor for shutdown signal
	osSignal := <-quit

	log.Debugf("shutdownListener: Received shutdown signal: %v", osSignal)

	// Attempt to trigger a cancellation of the parent context
	log.Debug("shutdownListener: Cancelling context ...")
	parentContextCancel()
	log.Debug("shutdownListener: context canceled")

}

// gracefullShutdown listens for a context cancellation and then shuts down
// the running http server. Once the http server is shutdown, this function
// signals back that work is complete by closing the provided done channel.
// This function is intended to be run as a goroutine.
func gracefulShutdown(ctx context.Context, server *http.Server, timeout time.Duration, done chan<- struct{}) {

	log.Debug("gracefulShutdown: started; now waiting on <-ctx.Done()")

	// monitor for cancellation context
	<-ctx.Done()

	log.Debugf("gracefulShutdown: context is done: %v", ctx.Err())
	log.Warnf("%s is shutting down, please wait ...", config.MyAppName)

	// Disable HTTP keep-alives to prevent connections from persisting
	server.SetKeepAlivesEnabled(false)

	ctxShutdown, cancel := context.WithTimeout(ctx, timeout)
	defer cancel()

	// From the docs:
	// Shutdown returns the context's error, otherwise it returns any error
	// returned from closing the Server's underlying Listener(s).
	if err := server.Shutdown(ctxShutdown); err != nil {
		log.Errorf("gracefulShutdown: could not gracefully shutdown the server: %v", err)
	}
	close(done)
}

// TODO: Reevaluate later once I've had a chance to think over precompilation
// of templates and whether including that step here makes any logical sense
// func newHTTPServer(serveMux *http.ServeMux) *http.Server {

// 	mux := http.NewServeMux()

// 	// Apply "default" timeout settings provided by Simon Frey; override the
// 	// default "wait forever" configuration.
// 	// FIXME: Refine these settings to apply values more appropriate for a
// 	// small-to-medium on-premise API (e.g., not over a public Internet link
// 	// where clients are expected to be slow)
// 	httpServer := http.Server{
// 		ReadHeaderTimeout: config.HTTPServerReadHeaderTimeout,
// 		ReadTimeout:       config.HTTPServerReadTimeout,
// 		WriteTimeout:      config.HTTPServerWriteTimeout,
// 		Handler:           serveMux,
// 		Addr:              fmt.Sprintf("%s:%d", appConfig.LocalIPAddress, appConfig.LocalTCPPort),
// 	}

// 	return &httpServer

// }


text:
package handlers

import (
	"encoding/json"
	"fmt"
	entities "github.com/gost/core"
	"github.com/stretchr/testify/assert"
	"io/ioutil"
	"net/http"
	"testing"
)

func TestGetFeatureOfInterest(t *testing.T) {
	getAndAssertFeatureOfInterest("/v1.0/featuresofinterest(1)", t)
}

func TestGetFeatureOfInterestByObservation(t *testing.T) {
	getAndAssertFeatureOfInterest("/v1.0/observations(1)/featureofinterest", t)
}

func TestGetFeaturesOfInterest(t *testing.T) {
	getAndAssertFeaturesOfInterest("/v1.0/featuresofinterest", t)
}

func TestPostFeatureOfInterest(t *testing.T) {
	// arrange
	mockFeatureOfInterest := newMockFeatureOfInterest(1)

	// act
	r := request("POST", "/v1.0/featuresofinterest", mockFeatureOfInterest)

	// arrange
	parseAndAssertFeatureOfInterest(*mockFeatureOfInterest, r, http.StatusCreated, t)
}

func TestPutFeatureOfInterest(t *testing.T) {
	// arrange
	mockFeatureOfInterest := newMockFeatureOfInterest(1)
	mockFeatureOfInterest.Name = "patched"

	// act
	r := request("PUT", "/v1.0/featuresofinterest(1)", mockFeatureOfInterest)

	parseAndAssertFeatureOfInterest(*mockFeatureOfInterest, r, http.StatusOK, t)
}

func TestPatchFeatureOfInterest(t *testing.T) {
	// arrange
	mockFeatureOfInterest := newMockFeatureOfInterest(1)
	mockFeatureOfInterest.Name = "patched"

	// act
	r := request("PATCH", "/v1.0/featuresofinterest(1)", mockFeatureOfInterest)

	// assert
	parseAndAssertFeatureOfInterest(*mockFeatureOfInterest, r, http.StatusOK, t)
}

func TestDeleteFeatureOfInterest(t *testing.T) {
	r := request("DELETE", "/v1.0/featuresofinterest(1)", nil)

	// assert
	assertStatusCode(http.StatusOK, r, t)
}

func getAndAssertFeatureOfInterest(url string, t *testing.T) {
	r := request("GET", url, nil)
	parseAndAssertFeatureOfInterest(*newMockFeatureOfInterest(1), r, http.StatusOK, t)
}

func parseAndAssertFeatureOfInterest(created entities.FeatureOfInterest, r *http.Response, expectedStatusCode int, t *testing.T) {
	foi := entities.FeatureOfInterest{}
	body, err := ioutil.ReadAll(r.Body)
	err = json.Unmarshal(body, &foi)

	assert.Nil(t, err)
	assertStatusCode(expectedStatusCode, r, t)
	assertFeatureOfInterest(created, foi, t)
}

func assertFeatureOfInterest(created, returned entities.FeatureOfInterest, t *testing.T) {
	assert.Equal(t, fmt.Sprintf("%v", created.ID), fmt.Sprintf("%v", returned.ID))
	assert.Equal(t, created.Name, returned.Name)
	assert.Equal(t, created.Description, returned.Description)
	assert.Equal(t, created.EncodingType, returned.EncodingType)
}

func getAndAssertFeaturesOfInterest(url string, t *testing.T) {
	// act
	r, _ := http.Get(getServer().URL + url)
	ar := entities.ArrayResponseFeaturesOfInterest{}
	body, err := ioutil.ReadAll(r.Body)
	err = json.Unmarshal(body, &ar)

	// assert
	assert.Nil(t, err)
	assertStatusCode(http.StatusOK, r, t)
	assert.Equal(t, 2, ar.Count)

	for _, entity := range ar.Data {
		expected := newMockFeatureOfInterest(int(entity.ID.(float64)))
		assertFeatureOfInterest(*expected, *entity, t)
	}
}

license: MIT

repository: gost/server

license_type: permissive

repo_name: gost/server

branch_name: refs/heads/master

gha_license_id: MIT

gha_language: Go

extension: go


text:
include dbus.inc
PR = "${INC_PR}.0"

BBCLASSEXTEND = "native"

SRC_URI = "\
  http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
  \
  file://tmpdir.patch \
  file://add-configurable-reply-timeouts.patch \
  file://dbus-1.init \
"

SRC_URI_append_nios2 = "file://dbus-auth-nios2.patch"

SRC_URI[md5sum] = "99cb057700c0455fb68f8d57902f77ac"
SRC_URI[sha256sum] = "caa1a0ded2d0f2e95c1d4ec7e3c8bd44834928c5b0ed41a7189963f3593983bd"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD

extension: bb


text:
require xorg-app-common.inc
DEPENDS += " libxmu xbitmaps libxt"
PE = "1"
PR = "${INC_PR}.0"

SRC_URI[archive.md5sum] = "0b7ceb0ded994dac645bb81e86ce69cc"
SRC_URI[archive.sha256sum] = "aa51b522fb2579042b1a7f1a5cea8b5582f2f88ea19459469fc19d61714a031e"


text:
DESCRIPTION = "Simple Qt based stop watch"
AUTHOR = "Christof Musik"
SECTION = "x11/applications"
PRIORITY = "optional"
HOMEPAGE = "http://git.senfdax.de"
LICENSE = "GPL QPL"
DEFAULT_PREFERRENCE = "-1"
SRCREV = "89644b91e02151fc72989755f20c1ffb144ef5e2"
PV = "1.3.1+gitr${SRCPV}"
PR = "r0"

inherit qt4x11

SRC_URI = "git://git.senfdax.de/git/stopwatch;protocol=http"
S = "${WORKDIR}/git/"

do_configure() {
    ${OE_QMAKE_QMAKE}
}

do_compile() {
    oe_runmake
}

do_install() {
    install -d ${D}${bindir}
    install -m 0755 ${S}stopwatch ${D}${bindir}
    install -d ${D}${datadir}/applications
    install ${S}desktop/stopwatch.desktop ${D}${datadir}/applications/
    install -d ${D}${datadir}/pixmaps
    install ${S}desktop/stopwatch.png ${D}${datadir}/pixmaps/
    install -d ${D}${datadir}/${PN}
    install ${S}desktop/om.style ${D}${datadir}/${PN}/
}


text:
SUMMARY = "Python style guide checker"
HOMEPAGE = "https://github.com/dreamhost/cliff"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://README.rst;md5=d8ebbbe831259ce010179d2f310b0f3e"

SRC_URI[md5sum] = "603821d06db945c71d811b5a8d78423c"
SRC_URI[sha256sum] = "fe249b52e20498e59e0b5c5256aa52ee99fc295b26ec9eaa85776ffdb9fe6374"

inherit pypi setuptools

RDEPENDS:${PN} += " \
    python-prettytable \
    python-cmd2 \
    python-pyparsing"

BBCLASSEXTEND = "native nativesdk"

SKIP_RECIPE[python-pep8] ?= "${@bb.utils.contains('I_SWEAR_TO_MIGRATE_TO_PYTHON3', 'yes', '', 'python2 is out of support for long time, read https://www.python.org/doc/sunset-python-2/ https://python3statement.org/ and if you really have to temporarily use this, then set I_SWEAR_TO_MIGRATE_TO_PYTHON3 to "yes"', d)}"

branch_name: refs/heads/jansa/master

gha_language: BitBake


text:
package recipes

import (
	"sync"
	"time"

	"github.com/coreos/go-etcd/etcd"
	"gopkg.in/errgo.v1"
)

const (
	// ELECTED : the node just got leadership.
	ELECTED = iota
	// OUSTED : the node just lost leadership.
	OUSTED
)

// LeaderElection wraps all metadata for leader election.
type LeaderElection struct {
	Name     string
	Change   chan int
	isLeader bool
	client   *etcd.Client
	key      string
	timeout  uint64
	lock     *Lock
	stop     chan bool
	wg       sync.WaitGroup
}

// NewLeaderElection return a new candidate for leadership on the provided key.
func NewLeaderElection(name string, client *etcd.Client, key string, timeout uint64) *LeaderElection {
	return &LeaderElection{name, make(chan int, 10), false, client, key, timeout, nil, nil, sync.WaitGroup{}}
}

// Start participating in the leader election process.
func (l *LeaderElection) Start() error {
	if l.lock != nil {
		return errgo.New("leader election is already started")
	}

	l.stop = make(chan bool)
	l.wg.Add(1)

	go func() {
		defer l.wg.Done()

		for {
			select {
			case <-l.stop:
				return
			default:
				break
			}

			lock, err := acquire(l.Name, l.client, l.key, LockOptions{l.timeout, true, true, l.stop})

			if err != nil {
				time.Sleep(time.Duration(l.timeout) * time.Second)
				continue
			}

			l.lock = lock
			l.Change <- ELECTED
			l.isLeader = true

			select {
			case <-l.lock.Expired:
				l.Change <- OUSTED
				l.isLeader = false
			case <-l.stop:
				return
			}
		}
	}()

	return nil
}

// Stop participating in the leader election process.
func (l *LeaderElection) Stop() error {
	if l.lock != nil {
		close(l.stop)
		l.wg.Wait()

		if l.isLeader {
			l.Change <- OUSTED
			l.isLeader = false
		}

		err := l.lock.Release()
		l.lock = nil
		return err
	}

	return nil
}

// HasLeadership returns whether we have the leadership or not.
func (l *LeaderElection) HasLeadership() (bool, error) {
	if l.lock == nil {
		return false, nil
	}

	return l.lock.IsAcquired()
}

// GetLeader returns the name of the current leader.
func (l *LeaderElection) GetLeader() (string, error) {
	res, err := l.client.Get(l.key, true, false)
	if err != nil {
		if _err, ok := err.(*etcd.EtcdError); ok {
			if _err.ErrorCode == 100 {
				return "", nil
			}
		}

		return "", errgo.Mask(err)
	}

	if len(res.Node.Nodes) == 0 {
		return "", nil
	}

	return res.Node.Nodes[0].Value, nil
}

repository: usmanm/concierge

repo_name: usmanm/concierge


text:
LICENSE = "Apache-2.0 & BSD-3-Clause & MIT & Zlib"

LIC_FILES_CHKSUM = "file://LICENSE;md5=f87516e0b698007e9e75a1fe1012b390 \
                    file://buildtools/libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da3953 \
                    file://buildtools/libcxxabi/LICENSE.TXT;md5=7b9334635b542c56868400a46b272b1e \
                    file://buildtools/libunwind/LICENSE.TXT;md5=f66970035d12f196030658b11725e1a1 \
                    file://buildtools/protobuf/LICENSE;md5=37b5762e07f0af8c74ce80a8bda4266b \
                    file://buildtools/zlib/LICENSE;md5=f09575dbfb09420642318b413159496f \
                    file://debian/copyright;md5=4e08364c82141f181de69d0a2b89d612 \
                    file://python/LICENSE;md5=c602a632c34ade9c78a976734077bce7"

SRC_URI:append = " \
           git://github.com/protocolbuffers/protobuf.git;branch=3.9.x;protocol=https;destsuffix=git/buildtools/protobuf;name=protobuf \
           git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git;protocol=https;destsuffix=git/buildtools/libcxx;branch=main;name=libcxx \
           git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git;protocol=https;destsuffix=git/buildtools/libcxxabi;branch=main;name=libcxxabi \
           git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git;protocol=https;destsuffix=git/buildtools/libunwind;branch=main;name=libunwind \
           git://android.googlesource.com/platform/system/libbase.git;branch=master;protocol=https;destsuffix=git/buildtools/android-libbase;name=libbase \
           git://android.googlesource.com/platform/system/unwinding.git;branch=master;protocol=https;destsuffix=git/buildtools/android-unwinding;name=unwinding \
           git://android.googlesource.com/platform/system/logging.git;branch=master;protocol=https;destsuffix=git/buildtools/android-logging;name=logging \
           git://android.googlesource.com/platform/system/libprocinfo.git;branch=master;protocol=https;destsuffix=git/buildtools/android-libprocinfo;name=libprocinfo \
           git://android.googlesource.com/platform/system/core.git;branch=master;protocol=https;destsuffix=git/buildtools/android-core;name=core \
           git://android.googlesource.com/platform/bionic.git;branch=master;protocol=https;destsuffix=git/buildtools/bionic;name=bionic \
           git://android.googlesource.com/platform/external/zlib.git;branch=master;protocol=https;destsuffix=git/buildtools/zlib;name=zlib \
           git://android.googlesource.com/platform/external/lzma.git;branch=master;protocol=https;destsuffix=git/buildtools/lzma;name=lzma \
           https://storage.googleapis.com/perfetto/gn-linux64-1968-0725d782;subdir=git/buildtools/;name=gn \
           \
           file://0001-Remove-check_build_deps-build-steps.patch \
           file://0001-Add-missing-header-cstdint-for-uintXX_t-types.patch"

SRCREV_bionic = "4b0e16bc72a82a63c699977376a7d6eadca1b206"
SRCREV_core = "9e6cef7f07d8c11b3ea820938aeb7ff2e9dbaa52"
SRCREV_lzma = "7851dce6f4ca17f5caa1c93a4e0a45686b1d56c3"
SRCREV_libprocinfo = "fd214c13ededecae97a3b15b5fccc8925a749a84"
SRCREV_logging = "7b36b566c9113fc703d68f76e8f40c0c2432481c"
SRCREV_unwinding = "d66882575ebe3700d6a6b10185f3aee28acc1051"
SRCREV_protobuf = "6a59a2ad1f61d9696092f79b6d74368b4d7970a3"
SRCREV_libbase = "78f1c2f83e625bdf66d55b48bdb3a301c20d2fb3"
SRCREV_libcxx = "f8571eaba606bde2eb8cd34b30104ca33e7c207e"
SRCREV_libcxxabi = "8dd405113a4f3694e910b79785dd7fb7535a888a"
SRCREV_libunwind = "aabcd8753678f1536e15eb6385a948470debdae4"
SRCREV_zlib = "5c85a2da4c13eda07f69d81a1579a5afddd35f59"
SRC_URI[gn.sha256sum] = "f706aaa0676e3e22f5fc9ca482295d7caee8535d1869f99efa2358177b64f5cd"

require perfetto.inc

DEPENDS += " ninja-native"

COMPATIBLE_HOST = "(i.86|x86_64|aarch64|arm).*-linux*"

CCACHE_DISABLE = "1"

# Some musl hacks gets through compiling it for musl
# Nullifying -DTEMP_FAILURE_RETRY might be grossest of them
TUNE_CCARGS:append:libc-musl = " -D_LIBCPP_HAS_MUSL_LIBC -Dgetprogname\(\)=program_invocation_name -DTEMP_FAILURE_RETRY="
FILES:${PN}:append = " \
  ${bindir}/tracebox \
  "

B = "${WORKDIR}/build"

# Run the GN (Generate Ninja) script, and replace the compiler flags where applicable
do_configure () {
    # Configuration needs to be done from the source directory
    cd ${S}
    # Rename a few build tools if they have not been renamed
    cd buildtools
    x="gn-linux64-1968-0725d782"
    [ -f $x ] && mkdir linux64 && mv $x linux64/gn
    chmod +x linux64/gn
    cd ..

    CC_BIN=`echo $CC | awk '{print $1}'`
    CXX_BIN=`echo $CXX | awk '{print $1}'`
    STRIP_BIN=`echo $STRIP | awk '{print $1}'`

    ARGS="is_debug=false "  # Tell gn to use release mode

    if [ -z `echo ${TOOLCHAIN} | grep clang` ]; then
        ARGS=$ARGS" is_clang=false"
    else
        ARGS=$ARGS" is_clang=true"
    fi

    # Architecture parameter accepted by Perfetto
    arch=${TARGET_ARCH}
    if [ $arch = "i686" ]; then
        arch="x86"
    elif [ $arch = "x86_64" ]; then
        arch="x64"
    elif [ $arch = "aarch64" ]; then
        arch="arm64"
    fi

    ARGS=$ARGS" target_os=\"linux\""
    ARGS=$ARGS" target_cpu=\"$arch\""
    ARGS=$ARGS" target_cc=\"$CC_BIN ${TUNE_CCARGS}\""
    ARGS=$ARGS" target_cxx=\"$CXX_BIN -std=c++11 ${TUNE_CCARGS}\""
    ARGS=$ARGS" target_strip=\"$STRIP_BIN\"" #
    ARGS=$ARGS" target_sysroot=\"${RECIPE_SYSROOT}\""
    ARGS=$ARGS" target_linker=\"$CC_BIN ${TUNE_CCARGS} ${LDFLAGS}\""
    ARGS=$ARGS" target_ar=\"$AR\""
    ARGS="'$ARGS'"
    cmd="tools/gn gen --args=$ARGS ${B}"

    echo $cmd
    # Use eval, not just call $cmd, due to escaping of single quotation marks
    eval $cmd

    cd ${B}
    # Eliminate a few incompatible build flags
    REPLACES="s/-Wl,--icf=all//g"
    REPLACES=$REPLACES";s/-Werror//g"
    REPLACES=$REPLACES";s/-fcolor-diagnostics//g"
    REPLACES=$REPLACES";s/=format-security//g"
    REPLACES=$REPLACES";s/-fdiagnostics-show-template-tree//g"
    REPLACES=$REPLACES";s/-D_FORTIFY_SOURCE=2//g"
    REPLACES=$REPLACES";s/-fuse-ld=\S*//g"

    find . -name "*.ninja" | xargs sed $REPLACES -i

    # If using the clang toolchain: use the clang host-side binaries built by Bitbake
    if [ "${TOOLCHAIN}" = "clang" ]; then
        BB_CLANGXX="${BUILD_CXX} ${BUILD_LDFLAGS}"
        BB_CLANG="${BUILD_CC}"
        BB_LLVM_OBJCOPY="${RECIPE_SYSROOT_NATIVE}/usr/bin/llvm-objcopy"

        HOST_CLANGXX="${STAGING_DIR_NATIVE}/usr/bin/clang++ -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc"
        HOST_CLANG="${STAGING_DIR_NATIVE}/usr/bin/clang"
        HOST_LLVM_OBJCOPY="${STAGING_DIR_NATIVE}/usr/bin/llvm-objcopy"

        cd gcc_like_host
        REPLACES="s:\S*clang++ :$HOST_CLANGXX :g"
        REPLACES=$REPLACES";s:\S*clang :$HOST_CLANG :g"
        REPLACES=$REPLACES";s:\S*llvm-objcopy :$HOST_LLVM_OBJCOPY :g"
        find . -name "*.ninja" | xargs sed "$REPLACES" -i
        cd ..
    fi
    # Done processing the Ninja files
}

# Perfetto generates a few different binaries, such as traced and traced_probes and perfetto.
# The "tracebox" is a busybox that combines the 3 above and provides a single stop for trace capture, so we only build "tracebox" here.
do_compile () {
    cd ${B}
    ninja -C . tracebox
}

do_install () {
    BIN_DIR=${D}${bindir}

    install -d -m0755 $BIN_DIR
    install ${B}/tracebox $BIN_DIR/tracebox
}

repository: openembedded/meta-openembedded

repo_name: openembedded/meta-openembedded


text:
@article{korobeinikov2006,
	title = {Lyapunov Functions and Global Stability for {SIR} and {SIRS} Epidemiological Models with Non-linear Transmission},
	volume = {68},
	issn = {0092-8240, 1522-9602},
	doi = {10.1007/s11538-005-9037-9},
	abstract = {Lyapunov functions for two-dimension SIR and SIRS compartmental epidemic models with non-linear transmission rate of a very general form f(S,I) constrained by a few biologically feasible conditions are constructed. Global properties of these models including these with vertical and horizontal transmission, are thereby established. It is proved that, under the constant population size assumption, the concavity of the function f(S,I) with respect to the number of the infective hosts I ensures the uniqueness and the global stability of the positive endemic equilibrium state.},
	language = {en},
	number = {3},
	journal = {Bull. Math. Biol.},
	author = {Korobeinikov, Andrei},
	month = mar,
	year = {2006},
	pages = {615--626}
}

@book{vankampen2007,
  title = {Stochastic processes in physics and chemistry},
  author = {van Kampen, Nico G.},
  year = {2007},
  edition = {3},
  publisher = {North Holland}
}

@book{wiggins1990,
  title = {Introduction to applied nonlinear dynamical systems and chaos},
  author = {Stephen Wiggins},
  year = {1990},
  publisher = {Springer-Verlag},
  address = {New York, NY}
}

@article{kwon2005,
	title = {Structure of stochastic dynamics near fixed points},
	volume = {102},
	issn = {0027-8424, 1091-6490},
	doi = {10.1073/pnas.0506347102},
	abstract = {We analyze the structure of stochastic dynamics near either a stable or unstable fixed point, where the force can be approximated by linearization. We find that a cost function that determines a Boltzmann-like stationary distribution can always be defined near it. Such a stationary distribution does not need to satisfy the usual detailed balance condition but might have instead a divergence-free probability current. In the linear case, the force can be split into two parts, one of which gives detailed balance with the diffusive motion, whereas the other induces cyclic motion on surfaces of constant cost function. By using the Jordan transformation for the force matrix, we find an explicit construction of the cost function. We discuss singularities of the transformation and their consequences for the stationary distribution. This Boltzmann-like distribution may be not unique, and nonlinear effects and boundary conditions may change the distribution and induce additional currents even in the neighborhood of a fixed point.},
	language = {en},
	number = {37},
	journal = {PNAS},
	author = {Kwon, Chulan and Ao, Ping and Thouless, David J.},
	month = sep,
	year = {2005},
	pmid = {16141337},
	pages = {13029--13033},
	file = {Kwon et al_2005_Structure of stochastic dynamics near fixed points.pdf:/home/eamon/.mozilla/firefox/pm9nxuku.default/zotero/storage/8B7ERMAR/Kwon et al_2005_Structure of stochastic dynamics near fixed points.pdf:application/pdf}
}

@article{wissel1984,
	title = {A Universal Law of the Characteristic Return Time near Thresholds},
	volume = {65},
	issn = {0029-8549},
	abstract = {Dramatic changes at thresholds in multiple stable ecosystems may be irreversible if caused by man. The characteristic return time to an equilibrium increases when a threshold is approached. A universal law for this increase is found, which may be used to forecast the position of a threshold by extrapolation of empirical data. Harvesting experiments on populations are proposed that can be used to verify the method. Preliminary harvesting experiments on rotifer populations display a good agreement with the theory.},
	number = {1},
	journal = {Oecologia},
	author = {Wissel, C.},
	year = {1984},
	pages = {101--107}
}

@article{boettiger2013,
	title = {Early warning signals: the charted and uncharted territories},
	volume = {6},
	issn = {1874-1738, 1874-1746},
	shorttitle = {Early warning signals},
	doi = {10.1007/s12080-013-0192-6},
	abstract = {The realization that complex systems such as ecological communities can collapse or shift regimes suddenly and without rapid external forcing poses a serious challenge to our understanding and management of the natural world. The potential to identify early warning signals that would allow researchers and managers to predict such events before they happen has therefore been an invaluable discovery that offers a way forward in spite of such seemingly unpredictable behavior. Research into early warning signals has demonstrated that it is possible to define and detect such early warning signals in advance of a transition in certain contexts. Here, we describe the pattern emerging as research continues to explore just how far we can generalize these results. A core of examples emerges that shares three properties: the phenomenon of rapid regime shifts, a pattern of “critical slowing down” that can be used to detect the approaching shift, and a mechanism of bifurcation driving the sudden change. As research has expanded beyond these core examples, it is becoming clear that not all systems that show regime shifts exhibit critical slowing down, or vice versa. Even when systems exhibit critical slowing down, statistical detection is a challenge. We review the literature that explores these edge cases and highlight the need for (a) new early warning behaviors that can be used in cases where rapid shifts do not exhibit critical slowing down; (b) the development of methods to identify which behavior might be an appropriate signal when encountering a novel system, bearing in mind that a positive indication for some systems is a negative indication in others; and (c) statistical methods that can distinguish between signatures of early warning behaviors and noise.},
	language = {en},
	number = {3},
	journal = {Theor Ecol},
	author = {Boettiger, Carl and Ross, Noam and Hastings, Alan},
	month = jun,
	year = {2013},
	pages = {255--264}
}

@article{oregan2013,
	title = {Theory of early warning signals of disease emergence and leading indicators of elimination},
	volume = {6},
	issn = {1874-1738, 1874-1746},
	doi = {10.1007/s12080-013-0185-5},
	abstract = {Anticipating infectious disease emergence and
                  documenting progress in disease elimination are
                  important applications for the theory of critical
                  transitions. A key problem is the development of
                  theory relating the dynamical processes of
                  transmission to observable phenomena. In this paper,
                  we consider compartmental
                  susceptible–infectious–susceptible (SIS) and
                  susceptible–infectious–recovered (SIR) models that
                  are slowly forced through a critical transition. We
                  derive expressions for the behavior of several
                  candidate indicators, including the autocorrelation
                  coefficient, variance, coefficient of variation, and
                  power spectra of SIS and SIR epidemics during the
                  approach to emergence or elimination. We validated
                  these expressions using individual-based
                  simulations. We further showed that moving-window
                  estimates of these quantities may be used for
                  anticipating critical transitions in infectious
                  disease systems. Although leading indicators of
                  elimination were highly predictive, we found the
                  approach to emergence to be much more difficult to
                  detect. It is hoped that these results, which show
                  the anticipation of critical transitions in
                  infectious disease systems to be theoretically
                  possible, may be used to guide the construction of
                  online algorithms for processing surveillance data.},
	language = {en},
	number = {3},
	journal = {Theor Ecol},
	author = {O'Regan, Suzanne M. and Drake, John M.},
	month = aug,
	year = {2013},
	pages = {333--357}
}

@article{oregan2015,
	title = {Leading indicators of mosquito-borne disease elimination},
	doi = {10.1007/s12080-015-0285-5},
	journal = {Theor Ecol},
	author = {O'Regan, Suzanne M. and Lillie, Jonathan W. and Drake, John M.},
	month = dec,
	year = {2015},
	pages = {1--18}
}

@article{scheffer2009,
	title = {Early-warning signals for critical transitions},
	volume = {461},
	copyright = {© 2009 Nature Publishing Group},
	issn = {0028-0836},
	doi = {10.1038/nature08227},
	abstract = {Complex dynamical systems, ranging from ecosystems
                  to financial markets and the climate, can have
                  tipping points at which a sudden shift to a
                  contrasting dynamical regime may occur. Although
                  predicting such critical points before they are
                  reached is extremely difficult, work in different
                  scientific fields is now suggesting the existence of
                  generic early-warning signals that may indicate for
                  a wide class of systems if a critical threshold is
                  approaching.},
	language = {en},
	number = {7260},
	journal = {Nature},
	author = {Scheffer, Marten and Bascompte, Jordi and Brock, William A. and Brovkin, Victor and Carpenter, Stephen R. and Dakos, Vasilis and Held, Hermann and {van Nes}, Egbert H. and Rietkerk, Max and Sugihara, George},
	month = sep,
	year = {2009},
	pages = {53--59}
}

@article{kuehn2012,
	title = {A {Mathematical} {Framework} for {Critical} {Transitions}: {Normal} {Forms}, {Variance} and {Applications}},
	volume = {23},
	issn = {0938-8974, 1432-1467},
	shorttitle = {A {Mathematical} {Framework} for {Critical} {Transitions}},
	doi = {10.1007/s00332-012-9158-x},
	abstract = {Critical transitions occur in a wide variety of
                  applications including mathematical biology, climate
                  change, human physiology and economics. Therefore it
                  is highly desirable to find early-warning signs. We
                  show that it is possible to classify critical
                  transitions by using bifurcation theory and normal
                  forms in the singular limit. Based on this
                  elementary classification, we analyze stochastic
                  fluctuations and calculate scaling laws of the
                  variance of stochastic sample paths near critical
                  transitions for fast-subsystem bifurcations up to
                  codimension two. The theory is applied to several
                  models: the Stommel–Cessi box model for the
                  thermohaline circulation from geoscience, an
                  epidemic-spreading model on an adaptive network, an
                  activator–inhibitor switch from systems biology, a
                  predator–prey system from ecology and to the Euler
                  buckling problem from classical mechanics. For the
                  Stommel–Cessi model we compare different detrending
                  techniques to calculate early-warning signs. In the
                  epidemics model we show that link densities could be
                  better variables for prediction than population
                  densities. The activator–inhibitor switch
                  demonstrates effects in three time-scale systems and
                  points out that excitable cells and molecular units
                  have information for subthreshold prediction. In the
                  predator–prey model explosive population growth near
                  a codimension-two bifurcation is investigated and we
                  show that early-warnings from normal forms can be
                  misleading in this context. In the biomechanical
                  model we demonstrate that early-warning signs for
                  buckling depend crucially on the control strategy
                  near the instability which illustrates the effect of
                  multiplicative noise.},
	language = {en},
	number = {3},
	journal = {J Nonlinear Sci},
	author = {Kuehn, Christian},
	month = dec,
	year = {2012},
	pages = {457--510}
}

@article{boerlijst2013,
	title = {Catastrophic collapse can occur without early warning: examples of silent catastrophes in structured ecological models},
	volume = {8},
	issn = {1932-6203},
	shorttitle = {Catastrophic collapse can occur without early warning},
	doi = {10.1371/journal.pone.0062033},
	abstract = {Catastrophic and sudden collapses of ecosystems
                  are sometimes preceded by early warning signals that
                  potentially could be used to predict and prevent a
                  forthcoming catastrophe. Universality of these early
                  warning signals has been proposed, but no formal
                  proof has been provided. Here, we show that in
                  relatively simple ecological models the most
                  commonly used early warning signals for a
                  catastrophic collapse can be silent. We underpin the
                  mathematical reason for this phenomenon, which
                  involves the direction of the eigenvectors of the
                  system. Our results demonstrate that claims on the
                  universality of early warning signals are not
                  correct, and that catastrophic collapses can occur
                  without prior warning. In order to correctly predict
                  a collapse and determine whether early warning
                  signals precede the collapse, detailed knowledge of
                  the mathematical structure of the approaching
                  bifurcation is necessary. Unfortunately, such
                  knowledge is often only obtained after the collapse
                  has already occurred.},
	language = {eng},
	number = {4},
	journal = {PLoS One},
	author = {Boerlijst, Maarten C. and Oudman, Thomas and de Roos, André M.},
	year = {2013},
	pmid = {23593506},
	pmcid = {PMC3623932},
	pages = {e62033}
}

@Misc{minpacklm,
     title = {minpack.lm: {R} Interface to the {Levenberg-Marquardt} Nonlinear Least-Squares Algorithm Found in {MINPACK}, Plus Support for Bounds},
    author = {Timur V. Elzhov and Katharine M. Mullen and Andrej-Nikolai Spiess and Ben Bolker},
    year = {2015},
    note = {R package version 1.2-0},
    url = {https://CRAN.R-project.org/package=minpack.lm},
  }

@article{gillespie2007,
	title = {Stochastic simulation of chemical kinetics},
	volume = {58},
	issn = {0066-426X},
	doi = {10.1146/annurev.physchem.58.032806.104637},
	abstract = {Stochastic chemical kinetics describes the time
                  evolution of a well-stirred chemically reacting
                  system in a way that takes into account the fact
                  that molecules come in whole numbers and exhibit
                  some degree of randomness in their dynamical
                  behavior. Researchers are increasingly using this
                  approach to chemical kinetics in the analysis of
                  cellular systems in biology, where the small
                  molecular populations of only a few reactant species
                  can lead to deviations from the predictions of the
                  deterministic differential equations of classical
                  chemical kinetics. After reviewing the supporting
                  theory of stochastic chemical kinetics, I discuss
                  some recent advances in methods for using that
                  theory to make numerical simulations. These include
                  improvements to the exact stochastic simulation
                  algorithm (SSA) and the approximate explicit
                  tau-leaping procedure, as well as the development of
                  two approximate strategies for simulating systems
                  that are dynamically stiff: implicit tau-leaping and
                  the slow-scale SSA.},
	journal = {Annu Rev Phys Chem},
	author = {Gillespie, Daniel T},
	year = {2007},
	pmid = {17037977},
	keywords = {@netphylo, Algorithms, Computer Simulation, Kinetics, Models, Chemical, Stochastic Processes},
	pages = {35--55}
}

@manual{pomp1.15.3.1,
    title = {{pomp}: {S}tatistical Inference for Partially Observed {M}arkov Processes},
    author = {Aaron A. King and Edward L. Ionides and Carles Martinez Bret\'o and Stephen P. Ellner and Matthew J. Ferrari and Bruce E. Kendall and Michael Lavine and Dao Nguyen and Daniel C. Reuman and Helen Wearing and Simon N. Wood and Sebastian Funk and Steven G. Johnson and Eamon O'Dea},
    year = {2017},
    note = {R~package, version~1.15.3.1},
    url = {https://kingaa.github.io/pomp/},
  }

@Misc{pomp,
    title = {pomp: Statistical Inference for Partially Observed
  {M}arkov Processes},
    author = {A. A. King and E. L. Ionides and C. M. Breto and S. P. Ellner
    and M. J. Ferrari and B. E. Kendall and M. Lavine and D. Nguyen
    and D. C. Reuman and H. Wearing and S. N. Wood},
    year = {2016},
    note = {R package version 1.4.1.1},
    url = {http://kingaa.github.io/pomp}
}

@Manual{spaero,
    title = {spaero: Software for Project AERO},
    author = {Eamon O'Dea},
    year = {2016},
    note = {R package version 0.2.0},
    url = {https://CRAN.R-project.org/package=spaero},
}

@article{ferrari2011,
	title = {Pathogens, {Social} {Networks}, and the {Paradox} of  {Transmission} {Scaling}},
	volume = {2011},
	issn = {1687-708X},
	doi = {10.1155/2011/267049},
	abstract = {Understanding the scaling of transmission is critical to predicting how infectious diseases will affect populations of different sizes and densities. The two classic “mean-field” epidemic models—either assuming density-dependent or frequency-dependent transmission—make predictions that are discordant with patterns seen in either within-population dynamics or across-population comparisons.  In this paper, we propose that the source of this inconsistency lies in the greatly simplifying “mean-field” assumption of transmission within a fully-mixed population.  Mixing in real populations is more accurately represented by a network of contacts, with interactions and infectious contacts confined to the local social neighborhood. We use network models to show that density-dependent transmission on heterogeneous networks often leads to apparent frequency dependency in the scaling of transmission across populations of different sizes. Network-methodology allows us to reconcile seemingly conflicting patterns of within- and across-population epidemiology.},
	journal = {Interdiscip Perspect Infect Dis},
	author = {Ferrari, Matthew J. and Perkins, Sarah E. and Pomeroy, Laura W. and Bj{\o}rnstad, Ottar N.},
	year = {2011},
	pmid = {21436998},
	pmcid = {PMC3062980}
}

@article{king2016,
	title = {Statistical {Inference} for {Partially} {Observed} {Markov} {Processes} via the {R} {Package} pomp},
	volume = {69},
	doi = {10.18637/jss.v069.i12},
	journal = {J Stat Softw},
	number = {12},
	author = {King, Aaron A. and Nguyen, Dao and Ionides, Edward L.},
	month = mar,
	year = {2016}
}

@article{breto2011,
	title = {Compound {Markov} counting processes and their applications to modeling infinitesimally over-dispersed systems},
	volume = {121},
	issn = {03044149},
	doi = {10.1016/j.spa.2011.07.005},
	abstract = {We propose an infinitesimal dispersion index for Markov counting processes. We show that, under standard moment existence conditions, a process is infinitesimally (over-) equi-dispersed if, and only if, it is simple (compound), i.e. it increases in jumps of one (or more) unit(s), even though infinitesimally equi-dispersed processes might be under-, equi- or over-dispersed using previously studied indices. Compound processes arise, for example, when introducing continuous-time white noise to the rates of simple processes resulting in Levy-driven SDEs. We construct multivariate infinitesimally over-dispersed compartment models and queuing networks, suitable for applications where moment constraints inherent to simple processes do not hold.},
	number = {11},
	journal = {Stochastic Processes and their Applications},
	author = {Bret{\'o}, Carles and Ionides, Edward L.},
	month = nov,
	year = {2011},
	pages = {2571--2591}
}

@article{he2010,
	title = {Plug-and-play inference for disease dynamics: measles in large and small populations as a case study},
	volume = {7},
	shorttitle = {Plug-and-play inference for disease dynamics},
	doi = {10.1098/rsif.2009.0151},
	number = {43},
	journal = {J. Roy. Soc. Interface},
	author = {He, Daihai and Ionides, Edward L. and King, Aaron A.},
	month = feb,
	year = {2010},
	pages = {271--283}
}

@article{martinez-bakker2015,
	title = {Unraveling the Transmission Ecology of Polio},
	volume = {13},
	issn = {1545-7885},
	doi = {10.1371/journal.pbio.1002172},
	number = {6},
	journal = {PLoS Biol.},
	author = {Martinez-Bakker, Micaela and King, Aaron A. and Rohani, Pejman},
	month = jun,
	year = {2015},
	pages = {e1002172}
}

@article{breto2009,
	title = {Time series analysis via mechanistic models},
	volume = {3},
	doi = {10.1214/08-AOAS201},
	number = {1},
	journal = {Ann. Appl. Stat.},
	author = {Bret\'{o}, Carles and He, Daihai and Ionides, Edward L. and King, Aaron A.},
	month = mar,
	year = {2009},
	pages = {319--348}
}

@article{mandelshtam1997,
	title = {Harmonic inversion of time signals and its applications},
	volume = {107},
	doi = {10.1063/1.475324},
	number = {17},
	journal = {The Journal of Chemical Physics},
	author = {Mandelshtam, Vladimir A. and Taylor, Howard S.},
	month = nov,
	year = {1997},
	pages = {6756--6769},
}

@article{brett2017,
	title = {Anticipating the emergence of infectious diseases},
	volume = {14},
	doi = {10.1098/rsif.2017.0115},
	number = {132},
	journal = {J. Roy. Soc. Interface},
	author = {Brett, Tobias S. and Drake, John M. and Rohani, Pejman},
	month = jul,
	year = {2017},
	pages = {20170115},
}

@book{hopcraft2014,
  title = {The Dynamics of Discrete Populations and Series of Events},
  author = {Hopcraft, K.I. and Jakeman, E. and Ridley, K.},
  year = {2014},
  publisher = {Taylor \& Francis},
  address = {Boca Raton, FL}
}

@article{kleinman1973,
	title = {Proportions with Extraneous Variance: Single and Independent Samples},
	volume = {68},
	doi = {10.2307/2284137},
	number = {341},
	journal = {Journal of the American Statistical Association},
	author = {Kleinman, Joel C.},
	year = {1973},
	pages = {46--54},
}

@article{salmon2016,
  title = {Monitoring Count Time Series in {R}: Aberration Detection in Public Health Surveillance},
  author = {Ma\"{e}lle Salmon and Dirk Schumacher and Michael H\"{o}hle},
  journal = {J. Stat. Softw.},
  volume = {70},
  issue = {10},
  year = {2016},
  doi = {10.18637/jss.v070.i10}
}

@article{helfand2003,
  title = {Negative impact of clinical misdiagnosis of measles on health workers’ confidence in measles vaccine},
  author = {R. F. Helfand and T. Chibi and R. Biellik and A. Shearley and W. J. Bellini},
  journal = {Epidemiol. Infect.},
  volume = {132},
  year = {2003},
  doi = {10.1017/S0950268803001547},
  pages = {7--10}
}

@article{pace2017,
	title = {Reversal of a cyanobacterial bloom in response to early warnings},
	volume = {114},
	doi = {10.1073/pnas.1612424114},
	number = {2},
	journal = {PNAS},
	author = {Pace, Michael L. and Batt, Ryan D. and Buelo, Cal D. and Carpenter, Stephen R. and Cole, Jonathan J. and Kurtzweil, Jason T. and Wilkinson, Grace M.},
	month = jan,
	year = {2017},
	pages = {352--357},
}

@article{chen2014,
	title = {Dynamics of a producer-freeloader ecosystem on the brink of collapse},
	volume = {5},
	doi = {10.1038/ncomms4713},
	journal = {Nat. Commun.},
	author = {Chen, Andrew and Sanchez, Alvaro and Dai, Lei and Gore, Jeff},
	month = may,
	year = {2014},
	pages = {ncomms4713},
}

@article{scheffer2015,
	title = {Generic {Indicators} of {Ecological} {Resilience}: {Inferring} the {Chance} of a {Critical} {Transition}},
	volume = {46},
	shorttitle = {Generic {Indicators} of {Ecological} {Resilience}},
	doi = {10.1146/annurev-ecolsys-112414-054242},
	number = {1},
	journal = {Annu Rev Ecol Evol Syst},
	author = {Scheffer, Marten and Carpenter, Stephen R. and Dakos, Vasilis and {van Nes}, Egbert H.},
	year = {2015},
	pages = {145--167},
}

@article{kefi2013,
	title = {Early warning signals also precede non-catastrophic transitions},
	volume = {122},
	doi = {10.1111/j.1600-0706.2012.20838.x},
	number = {5},
	journal = {Oikos},
	author = {K\'{e}fi, Sonia and Dakos, Vasilis and Scheffer, Marten and {van Nes}, Egbert H. and Rietkerk, Max},
	month = may,
	year = {2013},
	pages = {641--648},
}

@article{kuehn2011,
	title = {A mathematical framework for critical transitions: {Bifurcations}, fast--slow systems and stochastic dynamics},
	volume = {240},
	shorttitle = {A mathematical framework for critical transitions},
	doi = {10.1016/j.physd.2011.02.012},
	number = {12},
	journal = {Physica D},
	author = {Kuehn, Christian},
	month = jun,
	year = {2011},
	pages = {1020--1035}
}

@article{miller2017,
	title = {Forecasting infectious disease emergence subject to seasonal forcing},
	volume = {14},
	doi = {10.1186/s12976-017-0063-8},
	journal = {Theor Biol Med Model},
	author = {Miller, Paige B. and O’Dea, Eamon B. and Rohani, Pejman and Drake, John M.},
	month = sep,
	year = {2017},
	pages = {17},
}

@article{drake2017,
	title = {Monitoring the {Path} to the {Elimination} of {Infectious} {Diseases}},
	volume = {2},
	doi = {10.3390/tropicalmed2030020},
	language = {en},
	number = {3},
	journal = {Trop Med Infect Dis},
	author = {Drake, John M. and Hay, Simon I.},
	month = jun,
	year = {2017},
	pages = {20},
}

@inproceedings{bartlett1956,
	address = {Berkeley, California},
	title = {Deterministic and {Stochastic} {Models} for {Recurrent} {Epidemics}},
	volume = {4},
	language = {EN},
	booktitle = {Contributions to {Biology} and {Problems} of {Health}},
	publisher = {University of California Press},
	author = {Bartlett, M. S.},
	year = {1956},
	pages = {81--109},
}

@article{kendall1948,
	title = {On the {Generalized} ``{Birth}-and-{Death}'' {Process}},
	volume = {19},
	doi = {10.1214/aoms/1177730285},
	number = {1},
	journal = {Ann. Math. Statist.},
	author = {Kendall, David G.},
	month = mar,
	year = {1948},
	pages = {1--15},
}

@article{emerson1937,
	title = {Measles and {Whooping} {Cough}: {Part} {I}},
	volume = {27},
	shorttitle = {Measles and {Whooping} {Cough}},
	doi = {10.2105/AJPH.27.6\_Suppl.1},
	language = {en},
	number = {6\_Suppl},
	journal = {Am J Public Health Nations Health},
	author = {Emerson, Haven},
	month = jun,
	year = {1937},
	pages = {1--58}
}

@article{mciver2014,
	title = {Wikipedia {Usage} {Estimates} {Prevalence} of {Influenza}-{Like} {Illness} in the {United} {States} in {Near} {Real}-{Time}},
	volume = {10},
	doi = {10.1371/journal.pcbi.1003581},
	number = {4},
	journal = {PLoS Comp. Biol.},
	author = {McIver, David J. and Brownstein, John S.},
	month = apr,
	year = {2014},
	pages = {e1003581}
}

@article{richter2015,
	title = {Profit fluctuations signal eroding resilience of natural resources},
	volume = {117},
	doi = {10.1016/j.ecolecon.2015.05.013},
	journal = {Ecol Econ},
	author = {Richter, Andries and Dakos, Vasilis},
	month = sep,
	year = {2015},
	pages = {12--21},
}

@article{pananos2017,
	title = {Critical dynamics in population vaccinating behavior},
	doi = {10.1073/pnas.1704093114},
        pages = {13762--13767},
        journal = {Proc. Natl. Acad. Sci. U.S.A},
	author = {Pananos, A. Demetri and Bury, Thomas M. and Wang, Clara and Schonfeld, Justin and Mohanty, Sharada P. and Nyhan, Brendan and Salathé, Marcel and Bauch, Chris T.},
	month = dec,
	year = {2017},
}

@article{donker2011,
	title = {Nowcasting pandemic influenza {A}/{H1N1} 2009 hospitalizations in the {Netherlands}},
	volume = {26},
	doi = {10.1007/s10654-011-9566-5},
	language = {en},
	number = {3},
	journal = {Eur J Epidemiol},
	author = {Donker, Tjibbe and van Boven, Michiel and van Ballegooijen, W. Marijn and van’t Klooster, Tessa M. and Wielders, Cornelia C. and Wallinga, Jacco},
	month = mar,
	year = {2011},
	pages = {195--201}
}

@article{magpantay2015,
	title = {Dynamics of {Pertussis} {Transmission} in the {United} {States}},
	volume = {181},
	doi = {10.1093/aje/kwv024},
	language = {en},
	number = {12},
	journal = {Am. J. of Epidemiol.},
	author = {Magpantay, F. M. G. and Rohani, P.},
	month = jun,
	year = {2015},
	pages = {921--931},
}

@article{lima2015,
	title = {Whooping cough dynamics in {Chile} (1932--2010): disease temporal fluctuations across a north-south gradient},
	volume = {15},
	issn = {1471-2334},
	shorttitle = {Whooping cough dynamics in {Chile} (1932--2010)},
	doi = {10.1186/s12879-015-1292-2},
	number = {1},
	urldate = {2018-11-27},
	journal = {BMC Infect. Dis.},
	author = {Lima, Mauricio and Estay, Sergio A. and Fuentes, Rodrigo and Rubilar, Paola and Broutin, Hélène and Chowell-Puente, Gerardo},
	month = dec,
	year = {2015},
	pages = {590},
}

@article{broutin2005,
	title = {Large-{Scale} {Comparative} {Analysis} of {Pertussis} {Population} {Dynamics}: {Periodicity}, {Synchrony}, and {Impact} of {Vaccination}},
	volume = {161},
	shorttitle = {Large-{Scale} {Comparative} {Analysis} of {Pertussis} {Population} {Dynamics}},
	doi = {10.1093/aje/kwi141},
	number = {12},
	journal = {Am J Epidemiol},
	author = {Broutin, Hélène and Guégan, Jean-François and Elguero, Eric and Simondon, François and Cazelles, Bernard},
	month = jun,
	year = {2005},
	pages = {1159--1167},
}

@misc{tychoPertussis,
author = "Wilbert Van Panhuis and Anne Cross and Donald Burke",
title = {Counts of {P}ertussis reported in {UNITED STATES OF AMERICA}: 1888-2017 (version 2.0, {A}pril 1, 2018)},
doi = "10.25337/T7/ptycho.v2.0/US.27836007",
howpublished= {\url{http://dx.doi.org/10.25337/T7/ptycho.v2.0/US.27836007}},
note = "Project Tycho data release"}

@article{lloyd2004,
	series = {Topics in {Biomathematics} and {Related} {Computatonal} {Problems}: selected papers},
	title = {Spatiotemporal dynamics of epidemics: synchrony in metapopulation models},
	volume = {188},
	shorttitle = {Spatiotemporal dynamics of epidemics},
	doi = {10.1016/j.mbs.2003.09.003},
	number = {1},
	journal = {Mathematical Biosciences},
	author = {Lloyd, Alun L and Jansen, Vincent A. A},
	month = mar,
	year = {2004},
	pages = {1--16},
}

@article{rohani1999,
	title = {Opposite {Patterns} of {Synchrony} in {Sympatric} {Disease} {Metapopulations}},
	volume = {286},
	url = {http://science.sciencemag.org/content/286/5441/968},
	doi = {10.1126/science.286.5441.968},
	number = {5441},
	journal = {Science},
	author = {Rohani, Pejman and Earn, David J. D. and Grenfell, Bryan T.},
	month = oct,
	year = {1999},
	pages = {968--971},
}

@article{keeling2001,
	title = {Seasonally forced disease dynamics explored as switching between attractors},
	volume = {148},
	doi = {10.1016/S0167-2789(00)00187-1},
	number = {3},
	journal = {Physica D: Nonlinear Phenomena},
	author = {Keeling, Matt J. and Rohani, Pejman and Grenfell, Bryan T.},
	month = jan,
	year = {2001},
	pages = {317--335},
}

@article{constable2013,
	title = {Stochastic dynamics on slow manifolds},
	volume = {46},
	issn = {1751-8121},
	doi = {10.1088/1751-8113/46/29/295002},
	number = {29},
	journal = {J. Phys. A: Math. Theor.},
	author = {Constable, George W. A. and McKane, Alan J. and Rogers, Tim},
	year = {2013},
	pages = {295002},
}

@article{guo2006,
	title = {Global stability of the endemic equilibrium of multigroup {SIR} epidemic models},
	volume = {14},
	number = {3},
	journal = {Canadian applied mathematics quarterly},
	author = {Guo, Hongbin and Li, Michael Y. and Shuai, Zhisheng},
	year = {2006},
	pages = {259--284},
}

repository: project-aero/transient-indicators

repo_name: project-aero/transient-indicators

extension: bib


text:
package spsw

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestURLParseActionRun(t *testing.T) {
	action := NewURLParseAction()

	urlStr := "http://localhost/dev?a=1&b=2"

	expectParams := map[string][]string{
		"a": []string{"1"},
		"b": []string{"2"},
	}

	urlStrIn := NewDataPipe()
	urlStrIn.Add(urlStr)

	err := action.AddInput(URLParseActionInputURL, urlStrIn)
	assert.Nil(t, err)

	schemeOut := NewDataPipe()
	err = action.AddOutput(URLParseActionOutputScheme, schemeOut)
	assert.Nil(t, err)

	hostOut := NewDataPipe()
	err = action.AddOutput(URLParseActionOutputHost, hostOut)
	assert.Nil(t, err)

	pathOut := NewDataPipe()
	err = action.AddOutput(URLParseActionOutputPath, pathOut)
	assert.Nil(t, err)

	paramsOut := NewDataPipe()
	err = action.AddOutput(URLParseActionOutputParams, paramsOut)
	assert.Nil(t, err)

	err = action.Run()
	assert.Nil(t, err)

	gotScheme, ok1 := schemeOut.Remove().(string)
	assert.True(t, ok1)
	assert.Equal(t, "http", gotScheme)

	gotHost, ok2 := hostOut.Remove().(string)
	assert.True(t, ok2)
	assert.Equal(t, "localhost", gotHost)

	gotPath, ok3 := pathOut.Remove().(string)
	assert.True(t, ok3)
	assert.Equal(t, "/dev", gotPath)

	gotParams, ok4 := paramsOut.Remove().(map[string][]string)
	assert.True(t, ok4)
	assert.Equal(t, expectParams, gotParams)
}

branch_name: refs/heads/main


text:
package main

import (
	"fmt"
	"log"
	"os"
	"strings"
	"time"

	"github.com/nevermosby/gic-cli-tool/config"
	gic "github.com/nevermosby/gic-cloud-sdk-go"
	"github.com/nevermosby/promptui"
	"github.com/urfave/cli/v2"
)

const (
	GICBaseUrl = "https://api2.capitalonline.net"
)

var (
	app = &cli.App{}
	p   = fmt.Println
)

func init() {
	// TODO:
	// help text
}
func info() {
	app.Name = "GIC CLI "
	app.Usage = "GIC CLI is designed for CDS Cloud Platform, manage your own cloud resource easily"
	app.Authors = []*cli.Author{
		&cli.Author{
			Name:  "Wen-Quan(David) Li",
			Email: "legendarily@gmail.com",
		},
	}
	app.Version = "v1.0.0"
	app.Copyright = "MIT (c) 2020 Wen-Quan Li"
}

func command() {
	app.Commands = []*cli.Command{
		{
			Name: "login",
			// Category: "login",
			Aliases: []string{"l"},
			Usage:   "login GIC platform to get the token and store it locally",
			Action: func(c *cli.Context) error {
				fmt.Println("Start to login: ", c.Args().First())
				if c.NArg() == 0 {
					// if there is no args provided, check the legacy config
					// load the config file first, check the token is created less than one hour
					token := config.CheckToken()
					if token != "" {
						// p("token is already valid: ",token)
						p("logged already")
					} else {
						p("Token is expired, pls login mannually")
						// do the interactive input
						usernameProm := promptui.Prompt{
							Label: "Username",
						}
						username, err := usernameProm.Run()
						if err != nil {
							fmt.Printf("username input failed %v\n", err)
						}

						pwdProm := promptui.Prompt{
							Label: "Password",
							// Validate: validate,
							Mask: ' ',
						}
						pwd, err := pwdProm.Run()
						if err != nil {
							fmt.Printf("Prompt failed %v\n", err)
						}

						// use sdk to login to get token
						// then store the info into config file
						gicLogin2Save(username, pwd)
					}
				} else {
					fmt.Println("list the command args:", c.Args())
					if c.Args().Get(0) == "help" {
						p("show the help text")
					} else {
						p("pls login without args")
					}
				}
				return nil
			},
		},
		{
			Name:    "os",
			Aliases: []string{"os"},
			Usage:   "manage the available os, you can `list` `search`",
			Subcommands: []*cli.Command{
				{
					Name:     "list",
					Category: "os",
					Usage:    "list all the availabe os",
					Action: func(c *cli.Context) error {
						token := config.CheckToken()
						if token != "" {
							// p("logged already")
							var client = &gic.Client{}
							client.Init(GICBaseUrl, "")
							client.LoginWithToken(token)
							osList, err := client.ListOS()
							if err != nil {
								log.Fatal(err)
							}
							for _, os := range osList {
								p("os display name: ", os.DisplayName)
							}

						} else {
							p("Pls login first.")
						}
						return nil
					},
				},
				{
					Name:      "search",
					Category:  "os",
					Usage:     "search for all the availabe os with keyword",
					ArgsUsage: "[keyword]",
					Action: func(c *cli.Context) error {
						keyword := c.Args().First()
						token := config.CheckToken()
						var matchedOS []string
						var displayName string
						if token != "" {
							// p("logged already")
							var client = &gic.Client{}
							client.Init(GICBaseUrl, "")
							client.LoginWithToken(token)
							osList, err := client.ListOS()
							if err != nil {
								log.Fatal(err)
							}
							for _, os := range osList {
								displayName = os.DisplayName
								if strings.Contains(strings.ToLower(displayName), keyword) {
									matchedOS = append(matchedOS, displayName)
								}
							}
							for _, mos := range matchedOS {
								p("Found:", mos)
							}

						} else {
							p("Pls login first.")
						}
						return nil
					},
				},
			},
		},
		{
			// TODO: add options to specifiy the datacenter resource
			Name:    "datacenter",
			Aliases: []string{"dc"},
			Usage:   "manage the gic datacenter instances, you can `list`,`create`,`delete`,`info`",
			Subcommands: []*cli.Command{
				{
					Name:     "list",
					Category: "dc",
					Usage:    "list all the datecenter instances",
					Action: func(c *cli.Context) error {
						p("start to list all the datecenter instace: ", c.Args().First())
						token := config.CheckToken()
						if token != "" {
							// p("token is already valid: ",token)
							// p("logged already")
							var client = &gic.Client{}
							client.Init(GICBaseUrl, "")
							client.LoginWithToken(token)
							datacenters, err := client.ListDataCenter()
							if err != nil {
								log.Fatal(err)
							}
							for _, d := range datacenters {
								p("datacenter name:", d.SiteName, ",datacenter resource name:", d.Resource.Name)
							}
						} else {
							p("Pls login first.")
						}
						return nil
					},
				},
				{
					Name:     "create",
					Category: "dc",
					Usage:    "create a datacenter instance",
					Action: func(c *cli.Context) error {
						fmt.Println("start to create a datecenter instace: ", c.Args().First())
						return nil
					},
				},
				{
					Name:     "delete",
					Category: "dc",
					Usage:    "delete an existing datacenter",
					Action: func(c *cli.Context) error {
						fmt.Println("start to delete an existing datecenter: ", c.Args().First())
						return nil
					},
				},
				{
					Name:     "info",
					Category: "dc",
					Usage:    "show the detail info for an existing datacenter",
					Action: func(c *cli.Context) error {
						fmt.Println("start to reset os for an existing datacenter: ", c.Args().First())
						return nil
					},
				},
			},
		},
		{
			// TODO: add options to specifiy the vm resource
			Name:    "virtualmachine",
			Aliases: []string{"vm"},
			Usage:   "manage the gic normal vm instances, you can `list`,`create`,`delete`,`resetos`",
			Subcommands: []*cli.Command{
				{
					Name:     "list",
					Category: "vm",
					Usage:    "list all the vm instances in a datacenter",
					Action: func(c *cli.Context) error {
						fmt.Println("start to list all the vm instace in a datacenter: ", c.Args().First())
						return nil
					},
				},
				{
					Name:     "create",
					Category: "vm",
					Usage:    "create a vm instance",
					Action: func(c *cli.Context) error {
						fmt.Println("start to create a vm instace: ", c.Args().First())
						return nil
					},
				},
				{
					Name:     "delete",
					Category: "vm",
					Usage:    "delete an existing vm",
					Action: func(c *cli.Context) error {
						fmt.Println("start to delete an existing vm: ", c.Args().First())
						return nil
					},
				},
				{
					Name:     "restart",
					Category: "vm",
					Usage:    "restart an existing vm",
					Action: func(c *cli.Context) error {
						fmt.Println("start to restart an existing vm: ", c.Args().First())
						return nil
					},
				},
				{
					Name:     "shutdown",
					Category: "vm",
					Usage:    "shutdown an existing vm",
					Action: func(c *cli.Context) error {
						fmt.Println("start to shutdown an existing vm: ", c.Args().First())
						return nil
					},
				},
				{
					Name:     "poweron",
					Category: "vm",
					Usage:    "poweron an existing vm",
					Action: func(c *cli.Context) error {
						fmt.Println("start to poweron an existing vm: ", c.Args().First())
						return nil
					},
				},
				{
					Name:     "resetos",
					Category: "vm",
					Usage:    "reset os for an existing vm",
					Action: func(c *cli.Context) error {
						fmt.Println("start to reset os for an existing vm: ", c.Args().First())
						return nil
					},
				},
			},
		},
	}
}

// the default behaviour for other commands
func noArgs(c *cli.Context) error {

	// cli.ShowAppHelp(c)
	return cli.NewExitError("No such commands provided: "+"'"+c.Args().First()+"'"+". Run 'gic help' for usage", 2)
}

// use sdk to login to get token
// then store the info into config file
func gicLogin2Save(username string, pwd string) {
	var client = &gic.Client{}
	client.Init(GICBaseUrl, "")
	client.Login(username, pwd)
	p("login token insider gicLogin2Save:", client.Token)
	configFile, err := config.Load("")
	if err != nil {
		log.Fatal(err)
	}
	configFile.Url = GICBaseUrl
	configFile.Username = username
	configFile.Cred = pwd
	configFile.Token.Val = client.Token
	configFile.Token.CreatedAt = time.Now().Format(time.RFC3339)

	// then store the info into config file
	configFile.Save()
}

func main() {
	info()
	command()

	// default action behaviour
	app.Action = noArgs

	err := app.Run(os.Args)
	// for debug
	// err := app.Run([]string{"login"})

	if err != nil {
		log.Fatal(err)
	}
}

repository: nevermosby/gic-cli-tool

repo_name: nevermosby/gic-cli-tool


text:
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks

import cmd "github.com/hyperledger/fabric/token/cmd"
import mock "github.com/stretchr/testify/mock"
import time "time"
import token "github.com/hyperledger/fabric/protos/token"

// Stub is an autogenerated mock type for the Stub type
type Stub struct {
	mock.Mock
}

// Issue provides a mock function with given fields: tokensToIssue, waitTimeout
func (_m *Stub) Issue(tokensToIssue []*token.Token, waitTimeout time.Duration) (cmd.StubResponse, error) {
	ret := _m.Called(tokensToIssue, waitTimeout)

	var r0 cmd.StubResponse
	if rf, ok := ret.Get(0).(func([]*token.Token, time.Duration) cmd.StubResponse); ok {
		r0 = rf(tokensToIssue, waitTimeout)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(cmd.StubResponse)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func([]*token.Token, time.Duration) error); ok {
		r1 = rf(tokensToIssue, waitTimeout)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// ListTokens provides a mock function with given fields:
func (_m *Stub) ListTokens() (cmd.StubResponse, error) {
	ret := _m.Called()

	var r0 cmd.StubResponse
	if rf, ok := ret.Get(0).(func() cmd.StubResponse); ok {
		r0 = rf()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(cmd.StubResponse)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func() error); ok {
		r1 = rf()
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// Redeem provides a mock function with given fields: tokenIDs, quantity, waitTimeout
func (_m *Stub) Redeem(tokenIDs []*token.TokenId, quantity string, waitTimeout time.Duration) (cmd.StubResponse, error) {
	ret := _m.Called(tokenIDs, quantity, waitTimeout)

	var r0 cmd.StubResponse
	if rf, ok := ret.Get(0).(func([]*token.TokenId, string, time.Duration) cmd.StubResponse); ok {
		r0 = rf(tokenIDs, quantity, waitTimeout)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(cmd.StubResponse)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func([]*token.TokenId, string, time.Duration) error); ok {
		r1 = rf(tokenIDs, quantity, waitTimeout)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// Setup provides a mock function with given fields: configFilePath, channel, mspPath, mspID
func (_m *Stub) Setup(configFilePath string, channel string, mspPath string, mspID string) error {
	ret := _m.Called(configFilePath, channel, mspPath, mspID)

	var r0 error
	if rf, ok := ret.Get(0).(func(string, string, string, string) error); ok {
		r0 = rf(configFilePath, channel, mspPath, mspID)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}

// Transfer provides a mock function with given fields: tokenIDs, shares, waitTimeout
func (_m *Stub) Transfer(tokenIDs []*token.TokenId, shares []*token.RecipientShare, waitTimeout time.Duration) (cmd.StubResponse, error) {
	ret := _m.Called(tokenIDs, shares, waitTimeout)

	var r0 cmd.StubResponse
	if rf, ok := ret.Get(0).(func([]*token.TokenId, []*token.RecipientShare, time.Duration) cmd.StubResponse); ok {
		r0 = rf(tokenIDs, shares, waitTimeout)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(cmd.StubResponse)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func([]*token.TokenId, []*token.RecipientShare, time.Duration) error); ok {
		r1 = rf(tokenIDs, shares, waitTimeout)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

repository: nekia/fabric-block-archiving

repo_name: nekia/fabric-block-archiving


text:
@inproceedings{Lichtenberg-2009-ID216,
 author = {Lichtenberg, Jens and Alam, Mohit and Bitterman, Thomas and Drews, Frank
and Ecker, Klaus and Elnitski, Laura and Evans, Susan and Geisler, Matt and
Grotewold, Erich and Gu, Dazhang and Jacox, Edwin and Kurz, Kyle and Lee,
Stephen S. and Liang, Xiaoyu and Majmudar, Pooja M. and Morris, Paul and
Nelson, Chase and Stockinger, Eric and Welch, Joshua D. and Wyatt, Sarah
and Yilmaz, Alper and Welch, Lonnie R.},
 booktitle = {2009 Ohio Collaborative Conference on Bioinformatics},
 doi = {10.1109/OCCBIO.2009.9},
 month = {Jun},
 pages = {65--70},
 title = {Construction of Genomic Regulatory Encyclopedias: Strategies and Case
Studies},
 year = {2009}
}

repository: alperyilmaz/blogdown

repo_name: alperyilmaz/blogdown

gha_language: HTML


text:
LINUX_VERSION = "4.8"

SRCREV = "560ef2cb450a27c17519eb09fd5b97226859605a"

include linux-altera.inc


text:
package item

import (
	"fmt"
	"github.com/julienmoumne/hotshell/formatter"
	"io"
)

type MenuActivator struct {
	item *Item
	Out  io.Writer
}

func (m *MenuActivator) Activate(item *Item) *Item {
	m.item = item
	m.printBreadcrumb()
	m.printItems()
	m.printHelp()
	return m.item
}

func (m *MenuActivator) printHelp() {
	m.printf(
		" %v back, %v bash, %v repeat, %v reload, %v quit",
		formatter.HelpFmt(PREVIOUS_MENU_KEY.String()),
		formatter.HelpFmt(BASH_KEY.String()),
		formatter.HelpFmt(REPEAT_KEY.String()),
		formatter.HelpFmt(RELOAD_KEY.String()),
		formatter.HelpFmt("^d or ^c"),
	)
	m.print("\n")
	m.print("\n")
}

func (m *MenuActivator) printItems() {
	if len(m.item.Items) == 0 {
		m.printf(" %s\n", "no items found")
	}
	for _, item := range m.item.Items {
		m.printf(" %s\n", item.GetInMenuDesc())
	}
	m.print("\n")
}

func (m *MenuActivator) printBreadcrumb() {
	var bc string
	for curMenu := m.item.Parent; curMenu != nil; curMenu = curMenu.Parent {
		bc = fmt.Sprintf(" %s\n%s", curMenu.GetDesc(), bc)
	}
	m.print(formatter.ParentMenuFmt("%s", bc))

	m.printf(" %s", formatter.ActiveMenuFmt("%s", m.item.GetDesc()))
	m.print("\n")
	m.print("\n")
}

func (m *MenuActivator) printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(m.Out, format, a...)
}

func (m *MenuActivator) print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(m.Out, a...)
}

repository: UrielSarrazin/hotshell

repo_name: UrielSarrazin/hotshell