text:
Automatically generated by Mendeley Desktop 1.19.8
Any changes to this file will be lost if it is regenerated by Mendeley.

BibTeX export options can be customized via Options -> BibTeX in Mendeley Desktop

@article{Markiewicz2016,
abstract = {In this technical note we propose a rapid and scalable software solution for the processing of PET list-mode data, which allows the efficient integration of list mode data processing into the workflow of image reconstruction and analysis. All processing is performed on the graphics processing unit (GPU), making use of streamed and concurrent kernel execution together with data transfers between disk and CPU memory as well as CPU and GPU memory. This approach leads to fast generation of multiple bootstrap realisations, and when combined with fast image reconstruction and analysis, it enables assessment of uncertainties of any image statistic and of any component of the image generation process (e.g. random correction, image processing) within reasonable time frames (e.g. within five minutes per realisation). This is of particular value when handling complex chains of image generation and processing. The software outputs the following: (1) estimate of expected random event data for noise reduction; (2) dynamic prompt and random sinograms of span-1 and span-11 and (3) variance estimates based on multiple bootstrap realisations of (1) and (2) assuming reasonable count levels for acceptable accuracy. In addition, the software produces statistics and visualisations for immediate quality control and crude motion detection, such as: (1) count rate curves; (2) centre of mass plots of the radiodistribution for motion detection; 3) video of dynamic projection views for fast visual list-mode skimming and inspection; (4) full normalisation factor sinograms. To demonstrate the software, we present an example of the above processing for fast uncertainty estimation of regional SUVR (standard uptake value ratio) calculation for a single PET scan of F-18-florbetapir using the Siemens Biograph mMR scanner.},
author = {Markiewicz, P J and Thielemans, K and Schott, J M and Atkinson, D and Arridge, S R and Hutton, B F and Ourselin, S},
doi = {10.1088/0031-9155/61/13/N322},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Markiewicz et al. - 2016 - Rapid processing of PET list-mode data for efficient uncertainty estimation and data analysis.pdf:pdf},
issn = {13616560},
journal = {Physics in Medicine and Biology},
keywords = {fast data processing,graphics processing unit,histogramming,list mode,motion detection,posistron emission tomography,projection views},
month = {jul},
number = {13},
pages = {N322--N336},
pmid = {27280456},
publisher = {IOP Publishing},
title = {{Rapid processing of PET list-mode data for efficient uncertainty estimation and data analysis}},
url = {http://stacks.iop.org/0031-9155/61/i=13/a=N322?key=crossref.817e85ee0602e878b69ace94c186e0cb},
volume = {61},
year = {2016}
}
@article{Keereman2010,
abstract = {One of the challenges in PET/MRI is the derivation of an attenu-ation map to correct the PET image for attenuation. Different methods have been suggested for deriving the attenuation map from an MR image. Because the low signal intensity of cor-tical bone on images acquired with conventional MRI sequences makes it difficult to detect this tissue type, these methods rely on some sort of anatomic precondition to predict the attenuation map, raising the question of whether these methods will be us-able in the clinic when patients may exhibit anatomic abnormal-ities. Methods: We propose the use of the transverse relaxation rate, derived from images acquired with an ultrashort echo time sequence to classify the voxels into 1 of 3 tissue classes (bone, soft tissue, or air), without making any assumptions on patient anatomy. Each voxel is assigned a linear attenuation coefficient corresponding to its tissue class. A reference CT scan is used to determine the voxel-by-voxel accuracy of the proposed method. The overall accuracy of the MRI-based attenuation correction is evaluated using a method that takes into account the nonlocal ef-fects of attenuation correction. Results: As a proof of concept, the head of a pig was used as a phantom for imaging. The new method yielded a correct tissue classification in 90% of the vox-els. Five human brain PET/CT and MRI datasets were also pro-cessed, yielding slightly worse voxel-by-voxel performance, compared to a CT-derived attenuation map. The PET datasets were reconstructed using the segmented MRI attenuation map derived with the new method, and the resulting images were compared with segmented CT-based attenuation correction. An average error of around 5% was found in the brain. Conclusion: The feasibility of using the transverse relaxation rate map derived from ultrashort echo time MR images for the estimation of the at-tenuation map was shown on phantom and clinical brain data. The results indicate that the new method, compared with CT-based attenuation correction, yields clinically acceptable errors. The proposed method does not make any assumptions about patient anatomy and could therefore also be used in cases in which anatomic abnormalities are present.},
author = {Keereman, Vincent and Fierens, Yves and Broux, Tom and {De Deene}, Yves and Lonneux, Max and Vandenberghe, Stefaan},
doi = {10.2967/jnumed.109.065425},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Keereman et al. - 2010 - MRI-Based Attenuation Correction for PETMRI Using Ultrashort Echo Time Sequences.pdf:pdf},
isbn = {1535-5667 (Electronic)\r0161-5505 (Linking)},
issn = {0161-5505},
journal = {Journal of Nuclear Medicine},
month = {may},
number = {5},
pages = {812--818},
pmid = {20439508},
publisher = {Society of Nuclear Medicine},
title = {{MRI-Based Attenuation Correction for PET/MRI Using Ultrashort Echo Time Sequences}},
url = {http://www.ncbi.nlm.nih.gov/pubmed/20439508 http://jnm.snmjournals.org/cgi/doi/10.2967/jnumed.109.065425},
volume = {51},
year = {2010}
}
@article{Markiewicz2021,
author = {Markiewicz, Pawel J. and Matthews, Julian C. and Ashburner, John and Cash, David M. and Thomas, David L. and {De Vita}, Enrico and Barnes, Anna and Cardoso, M. Jorge and Modat, Marc and Brown, Richard and Thielemans, Kris and da Costa-Luis, Casper and {Lopes Alves}, Isadora and Gispert, Juan Domingo and Schmidt, Mark E. and Marsden, Paul and Hammers, Alexander and Ourselin, Sebastien and Barkhof, Frederik},
doi = {10.1016/j.neuroimage.2021.117821},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Markiewicz et al. - 2021 - Uncertainty analysis of MR-PET image registration for precision neuro-PET imaging.pdf:pdf},
issn = {10538119},
journal = {NeuroImage},
month = {may},
pages = {117821},
publisher = {Elsevier BV},
title = {{Uncertainty analysis of MR-PET image registration for precision neuro-PET imaging}},
url = {https://linkinghub.elsevier.com/retrieve/pii/S1053811921000987},
volume = {232},
year = {2021}
}
@article{EuropeanSocietyofRadiologyESR2017,
abstract = {The European Society of Radiology (ESR) informs its membership and its associated Institutional Members about the new General Data Protection Regulation (GDPR) of the European Union (EU,) which will apply from 25 May 2018. Radiologists and radiology departments should be prepared to comply with several new rules for the protection of imaging data. Although the new GDPR applies to all domains of the public and private sectors, some specific derogations are defined for data concerning health, aiming at protecting the rights of data subjects and confidentiality of their personal health data, whilst preserving the benefits of processing data, including digital images for research and public health purposes. Specific new obligations which healthcare providers (including radiologists/radiology departments) should prepare for include data access for patients, rules for data processing including explicit consent of the data subject in the absence of derogations, or technical and organisational safeguards. National health authorities can define exceptions and derogations from certain obligations by means of national law. They will also define sanctions in the form of penalties or fines that may be applicable for organisations of the public and private sector that fail to comply with the rules of the GDPR. MAIN MESSAGES • Explicit consent prior to data processing will be necessary. • Explicit consent prior to communication of imaging data will be necessary. • Providing patient access to their personal data, including portability, will be required. • Certain derogations and exceptions exist for healthcare and research. • Additional specific rules may be defined by national law.},
author = {{European Society of Radiology (ESR)}, European Society of Radiology},
doi = {10.1007/s13244-017-0552-7},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/(ESR) - 2017 - The new EU General Data Protection Regulation what the radiologist should know.pdf:pdf},
issn = {1869-4101},
journal = {Insights into imaging},
keywords = {Data protection,EU regulation,Health data,Patient rights,Research},
month = {jun},
number = {3},
pages = {295--299},
pmid = {28439718},
publisher = {Springer},
title = {{The new EU General Data Protection Regulation: what the radiologist should know.}},
url = {http://www.ncbi.nlm.nih.gov/pubmed/28439718 http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=PMC5438318},
volume = {8},
year = {2017}
}
@article{Scott2018,
abstract = {Pharmacokinetic modelling on dynamic positron emission tomography (PET) data is a quantitative technique. However, the long acquisition time is prohibitive for routine clinical use. Instead, the semi-quantitative standardised uptake value ratio (SUVR) from a shorter static acquisition is used, despite its sensitivity to blood flow confounding longitudinal analysis. A method has been proposed to reduce the dynamic acquisition time for quantification by incorporating cerebral blood flow (CBF) information from arterial spin labelling (ASL) magnetic resonance imaging (MRI) into the pharmacokinetic modelling. In this work, we optimise and validate this framework for a study of ageing and preclinical Alzheimer's disease. This methodology adapts the simplified reference tissue model (SRTM) for a reduced acquisition time (RT-SRTM) and is applied to [18F]-florbetapir PET data for amyloid-$\beta$ quantification. Evaluation shows that the optimised RT-SRTM can achieve amyloid burden estimation from a 30-min PET/MR acquisi...},
author = {Scott, Catherine J and Jiao, Jieqing and Melbourne, Andrew and Burgos, Ninon and Cash, David M and {De Vita}, Enrico and Markiewicz, Pawel J and O'Connor, Antoinette and Thomas, David L and Weston, Philip Sj and Schott, Jonathan M and Hutton, Brian F and Ourselin, S{\'{e}}bastien},
doi = {10.1177/0271678X18797343},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Scott et al. - 2018 - Reduced acquisition time PET pharmacokinetic modelling using simultaneous ASL–MRI proof of concept.pdf:pdf},
issn = {0271-678X},
journal = {Journal of Cerebral Blood Flow & Metabolism},
keywords = {Positron emission tomography,arterial spin labelling,cerebral blood flow,pharmacokinetic modelling,reduced acquisition time},
pages = {0271678X1879734},
title = {{Reduced acquisition time PET pharmacokinetic modelling using simultaneous ASL–MRI: proof of concept}},
url = {https://journals.sagepub.com/doi/pdf/10.1177/0271678X18797343 http://journals.sagepub.com/doi/10.1177/0271678X18797343},
year = {2018}
}
@misc{Markiewicz2018c,
abstract = {This zipped dataset consists of a full dynamic list-mode PET data of 60 minutes of acquisition, using an amyloid tracer, florbetapir, provided by Eli Lilly. Also, the dataset includes normalisation files and the UTE mu-map, all needed for an independent image reconstruction using NiftyPET.},
address = {London},
author = {Markiewicz, Pawel J and Cash, David and Schott, Jonathan M},
doi = {10.5281/ZENODO.1472951},
keywords = {PET data,list mode,list-mode},
mendeley-tags = {PET data,list-mode},
month = {nov},
publisher = {Zenodo},
title = {{Single amyloid PET scan on the Siemens Biograph mMR}},
url = {https://zenodo.org/record/1472951#.XBbW49_njx0},
year = {2018}
}
@article{Markiewicz2018,
author = {Markiewicz, Pawel J. and Ehrhardt, Matthias J. and Erlandsson, Kjell and Noonan, Philip J. and Barnes, Anna and Schott, Jonathan M. and Atkinson, David and Arridge, Simon R. and Hutton, Brian F. and Ourselin, Sebastien},
doi = {10.1007/s12021-017-9352-y},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Markiewicz et al. - 2018 - NiftyPET a High-throughput Software Platform for High Quantitative Accuracy and Precision PET Imaging and Ana.pdf:pdf},
issn = {1539-2791},
journal = {Neuroinformatics},
month = {jan},
number = {1},
pages = {95--115},
publisher = {Springer US},
title = {{NiftyPET: a High-throughput Software Platform for High Quantitative Accuracy and Precision PET Imaging and Analysis}},
url = {http://link.springer.com/10.1007/s12021-017-9352-y},
volume = {16},
year = {2018}
}
@article{Ehrhardt2019,
abstract = {Uncompressed clinical data from modern positron emission tomography (PET) scanners are very large, exceeding 350 million data points (projection bins). The last decades have seen tremendous advancements in mathematical imaging tools many of which lead to non-smooth (i.e. non-differentiable) optimization problems which are much harder to solve than smooth optimization problems. Most of these tools have not been translated to clinical PET data, as the state-of-the-art algorithms for non-smooth problems do not scale well to large data. In this work, inspired by big data machine learning applications, we use advanced randomized optimization algorithms to solve the PET reconstruction problem for a very large class of non-smooth priors which includes for example total variation, total generalized variation, directional total variation and various different physical constraints. The proposed algorithm randomly uses subsets of the data and only updates the variables associated with these. While this idea often leads to divergent algorithms, we show that the proposed algorithm does indeed converge for any proper subset selection. Numerically, we show on real PET data (FDG and florbetapir) from a Siemens Biograph mMR that about ten projections and backprojections are sufficient to solve the MAP optimisation problem related to many popular non-smooth priors; thus showing that the proposed algorithm is fast enough to bring these models into routine clinical practice.},
archivePrefix = {arXiv},
arxivId = {1808.07150},
author = {Ehrhardt, Matthias J. and Markiewicz, Pawel and Sch{\"{o}}nlieb, Carola Bibiane},
doi = {10.1088/1361-6560/ab3d07},
eprint = {1808.07150},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Ehrhardt, Markiewicz, Sch{\"{o}}nlieb - 2019 - Faster PET reconstruction with non-smooth priors by randomization and preconditioning(2).pdf:pdf},
issn = {13616560},
journal = {Physics in Medicine and Biology},
keywords = {Positron emission tomography,anatomical priors,convex optimization,non-smooth optimization,randomized optimization,total variation},
number = {22},
title = {{Faster PET reconstruction with non-smooth priors by randomization and preconditioning}},
volume = {64},
year = {2019}
}
@article{Lane2017,
abstract = {Bone mineral density (BMD) is the major factor for determining bone strength, which is closely correlated to osteoporotic fracture risk and is largely determined by multiple genetic factors. The RANK (TNFRSF11A), receptor for RANKL, is a member of the tumor necrosis factor receptor (TNFR) superfamily and plays a central role in osteoclast development.},
author = {Lane, Christopher A. and Parker, Thomas D. and Cash, Dave M. and Macpherson, Kirsty and Donnachie, Elizabeth and Murray-Smith, Heidi and Barnes, Anna and Barker, Suzie and Beasley, Daniel G. and Bras, Jose and Brown, David and Burgos, Ninon and Byford, Michelle and {Jorge Cardoso}, M. and Carvalho, Ana and Collins, Jessica and {De Vita}, Enrico and Dickson, John C. and Epie, Norah and Espak, Miklos and Henley, Susie M.D. and Hoskote, Chandrashekar and Hutel, Michael and Klimova, Jana and Malone, Ian B. and Markiewicz, Pawel and Melbourne, Andrew and Modat, Marc and Schrag, Anette and Shah, Sachit and Sharma, Nikhil and Sudre, Carole H. and Thomas, David L. and Wong, Andrew and Zhang, Hui and Hardy, John and Zetterberg, Henrik and Ourselin, Sebastien and Crutch, Sebastian J. and Kuh, Diana and Richards, Marcus and Fox, Nick C. and Schott, Jonathan M.},
doi = {10.1186/s12883-017-0846-x},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Lane et al. - 2017 - Study protocol Insight 46 - a neuroscience sub-study of the MRC National Survey of Health and Development.pdf:pdf},
isbn = {14712377 (ISSN)},
issn = {14712377},
journal = {BMC Neurology},
keywords = {Ageing,Alzheimer's disease,Birth cohort,Cognition,Epidemiology,Genetics,Life course,Magnetic resonance imaging,Positron emission tomography,Vascular disease},
month = {dec},
number = {1},
pages = {75},
pmid = {17115234},
publisher = {BioMed Central},
title = {{Study protocol: Insight 46 - a neuroscience sub-study of the MRC National Survey of Health and Development}},
url = {http://bmcneurol.biomedcentral.com/articles/10.1186/s12883-017-0846-x},
volume = {17},
year = {2017}
}
@article{Markiewicz2021a,
author = {Markiewicz, Pawel J and Krokos, Georgios and MacKewn, Jane and Hammers, Alexander},
doi = {10.5281/ZENODO.5760092},
journal = {Zenodo},
keywords = {ACR PET data},
month = {dec},
title = {{ACR PET phantom raw data and templates for advanced analysis}},
url = {https://zenodo.org/record/5760092},
year = {2021}
}
@misc{Robson2003,
abstract = {The background underpinning the clinical use of ultra-short echo-time (UTE) pulse sequences for imaging tissues or tissue components with short T2s is reviewed. Tissues properties are discussed , and tissues are divided into those with a majority of short T2 relaxation components and those with a minority. Features of the basic physics relevant to UTE imaging are described including the fact that when the radiofrequency pulse duration is of the order T2, rotation of tissue magnetization into the transverse plane is incomplete. Consequences of the broad line-width of short T2 components are also discussed including their partial saturation by off-resonance fat suppression pulses as well as multislice and multiecho imaging. The need for rapid data acquisition of the order T2 is explained. The basic UTE pulse sequence with its half excitation pulse and radial imaging from the center of k-space is described together with options that suppress fat and/or long T2 components. Image interpretation is discussed. Clinical features of the imaging of cortical bone, tendons, ligaments, menisci, and periosteum as well as brain, liver, and spine are illustrated. Short T2 components in all of these tissues may show high signals. Possible future developments are outlined as are technical limitations.},
archivePrefix = {arXiv},
arxivId = {NIHMS150003},
author = {Robson, Matthew D and Gatehouse, Peter D and Bydder, Mark and Bydder, Graeme M},
doi = {10.1097/00004728-200311000-00001},
eprint = {NIHMS150003},
file = {:home/pawel/.local/share/data/Mendeley Ltd./Mendeley Desktop/Downloaded/Robson et al. - 2003 - Magnetic Resonance An Introduction to Ultrashort TE (UTE) Imaging.pdf:pdf},
isbn = {0363-8715 (Print)\r0363-8715 (Linking)},
issn = {0363-8715},
keywords = {27:825-846),magnetic resonance imaging,pulse sequences,short T2 tissues,ultrashort echo time (J Comput Assist Tomogr 2003},
pages = {1--2},
pmid = {14600447},
title = {{Magnetic Resonance: An Introduction to Ultrashort TE (UTE) Imaging}},
url = {https://insights.ovid.com/pubmed?pmid=14600447},
year = {2003}
}

repository: jjleewustledu/NiftyPET

repo_name: jjleewustledu/NiftyPET


text:
//go:build e2e
// +build e2e

package e2e

import (
	"context"
	"testing"

	. "github.com/onsi/gomega"
	e2eutil "github.com/openshift/hypershift/test/e2e/util"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	crclient "sigs.k8s.io/controller-runtime/pkg/client"

	hyperv1 "github.com/openshift/hypershift/api/v1alpha1"
)

// TestCreateCluster implements a test that mimics the operation described in the
// HyperShift quick start (creating a basic guest cluster).
//
// This test is meant to provide a first, fast signal to detect regression; it
// is recommended to use it as a PR blocker test.
func TestCreateCluster(t *testing.T) {
	t.Parallel()
	g := NewWithT(t)

	ctx, cancel := context.WithCancel(testContext)
	defer cancel()

	client := e2eutil.GetClientOrDie()

	clusterOpts := globalOpts.DefaultClusterOptions()

	hostedCluster := e2eutil.CreateCluster(t, ctx, client, clusterOpts, globalOpts.ArtifactDir)

	// Get the newly created nodepool
	nodepool := &hyperv1.NodePool{
		ObjectMeta: metav1.ObjectMeta{
			Namespace: hostedCluster.Namespace,
			Name:      hostedCluster.Name,
		},
	}
	err := client.Get(testContext, crclient.ObjectKeyFromObject(nodepool), nodepool)
	g.Expect(err).NotTo(HaveOccurred(), "failed to get nodepool")
	t.Logf("Created nodepool. Namespace: %s, name: %s", nodepool.Namespace, nodepool.Name)

	// Wait for nodes to report ready
	guestClient := e2eutil.WaitForGuestClient(t, testContext, client, hostedCluster)
	e2eutil.WaitForNReadyNodes(t, testContext, guestClient, *nodepool.Spec.NodeCount)

	// Wait for the rollout to be reported complete
	t.Logf("Waiting for cluster rollout. Image: %s", globalOpts.LatestReleaseImage)
	e2eutil.WaitForImageRollout(t, testContext, client, hostedCluster, globalOpts.LatestReleaseImage)

	e2eutil.EnsureNodeCountMatchesNodePoolReplicas(t, testContext, client, guestClient, crclient.ObjectKeyFromObject(nodepool))
	e2eutil.EnsureNoCrashingPods(t, ctx, client, hostedCluster)
}

repository: spaparaju/hypershift

license_type: permissive

repo_name: spaparaju/hypershift

branch_name: refs/heads/main

extension: go


text:
file(REMOVE_RECURSE
  "CMakeFiles/Week0.dir/R_Quaternion_update.cpp.o"
  "Week0"
  "Week0.pdb"
)

# Per-language clean rules from dependency scanning.
foreach(lang CXX)
  include(CMakeFiles/Week0.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()

license: MIT

branch_name: refs/heads/master

extension: cmake


text:
#
# Platform and architecture setup
#

# Get upper case system name
string(TOUPPER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME_UPPER)

# Determine architecture (32/64 bit)
set(X64 OFF)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    set(X64 ON)
endif()

#
# Project options
#

set(DEFAULT_PROJECT_OPTIONS
    DEBUG_POSTFIX             "d"
    CXX_STANDARD              14 # Not available before CMake 3.1; see below for manual command line argument addition
    LINKER_LANGUAGE           "CXX"
    POSITION_INDEPENDENT_CODE ON
    CXX_VISIBILITY_PRESET     "hidden"
)

#
# Include directories
#

set(DEFAULT_INCLUDE_DIRECTORIES)

#
# Libraries
#

set(DEFAULT_LIBRARIES)

#
# Compile definitions
#

set(DEFAULT_COMPILE_DEFINITIONS
    SYSTEM_${SYSTEM_NAME_UPPER}
)

# MSVC compiler options
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
    set(DEFAULT_COMPILE_DEFINITIONS ${DEFAULT_COMPILE_DEFINITIONS}
        _SCL_SECURE_NO_WARNINGS  # Calling any one of the potentially unsafe methods in the Standard C++ Library
        _CRT_SECURE_NO_WARNINGS  # Calling any one of the potentially unsafe methods in the CRT Library
    )
endif ()

#
# Compile options
#

set(DEFAULT_COMPILE_OPTIONS)

# MSVC compiler options
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
    set(DEFAULT_COMPILE_OPTIONS ${DEFAULT_COMPILE_OPTIONS}
        /MP           # -> build with multiple processes
        /W4           # -> warning level 4
        # /WX         # -> treat warnings as errors

        /wd4251       # -> disable warning: 'identifier': class 'type' needs to have dll-interface to be used by clients of class 'type2'
        /wd4592       # -> disable warning: 'identifier': symbol will be dynamically initialized (implementation limitation)
        # /wd4201     # -> disable warning: nonstandard extension used: nameless struct/union (caused by GLM)
        # /wd4127     # -> disable warning: conditional expression is constant (caused by Qt)

                      #  Jason Turner's best practices flags. https://lefticus.gitbooks.io/cpp-best-practices/content/02-Use_the_Tools_Available.html
        /w14242       # -> 'identfier': conversion from 'type1' to 'type1', possible loss of data
        /w14254       # -> 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
        /w14263       # -> 'function': member function does not override any base class virtual member function
        /w14265       # -> 'classname': class has virtual functions, but destructor is not virtual instances of this class may not be destructed correctly
        /w14287       # -> 'operator': unsigned/negative constant mismatch
        /we4289       # -> nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside the for-loop scope
        /w14296       # -> 'operator': expression is always 'boolean_value'
        /w14311       # -> 'variable': pointer truncation from 'type1' to 'type2'
        /w14545       # -> expression before comma evaluates to a function which is missing an argument list
        /w14546       # -> function call before comma missing argument list
        /w14547       # -> 'operator': operator before comma has no effect; expected operator with sideeffect
        /w14549       # -> 'operator': operator before comma has no effect; did you intend 'operator'?
        /w14555       # -> expression has no effect; expected expression with side-effect
        /w14619       # -> pragma warning: there is no warning number 'number'
        /w14640       # -> Enable warning on thread un-safe static member initialization
        /w14826       # -> Conversion from 'type1' to 'type_2' is sign-extended. This may cause unexpected runtime behavior.
        /w14905       # -> wide string literal cast to 'LPSTR'
        /w14906       # -> string literal cast to 'LPWSTR'
        /w14928       # -> illegal copy-initialization; more than one user-defined conversion has been implicitly applied

        #$<$<CONFIG:Debug>:
        #/RTCc         # -> value is assigned to a smaller data type and results in a data loss
        #>

        $<$<CONFIG:Release>:
        /Gw           # -> whole program global optimization
        /GS-          # -> buffer security check: no
        /GL           # -> whole program optimization: enable link-time code generation (disables Zi)
        /GF           # -> enable string pooling
        >

        # No manual c++11 enable for MSVC as all supported MSVC versions for cmake-init have C++11 implicitly enabled (MSVC >=2013)
    )
endif ()

# GCC and Clang compiler options
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    set(DEFAULT_COMPILE_OPTIONS ${DEFAULT_COMPILE_OPTIONS}
        -Wall
        -Wextra
        -Wunused

        -Wreorder
        -Wignored-qualifiers
        -Wmissing-braces
        -Wreturn-type
        -Wswitch
        -Wswitch-default
        -Wuninitialized
        -Wmissing-field-initializers

        #  Jason Turner's best practices flags. https://lefticus.gitbooks.io/cpp-best-practices/content/02-Use_the_Tools_Available.html
        -Wshadow
        -Wnon-virtual-dtor
        # -Wold-style-cast
        -Wcast-align
        -Woverloaded-virtual
        -Wconversion
        -Wsign-conversion
        # -Wmisleading-indentation

        # clang
        # -stdliblibc++
        # -stdlib=libstdc++
        $<$<CXX_COMPILER_ID:GNU>:
            -Wmaybe-uninitialized

            $<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.8>:
                -Wpedantic

                -Wreturn-local-addr
            >
        >

        $<$<CXX_COMPILER_ID:Clang>:
            -Wpedantic

            # -Wreturn-stack-address # gives false positives
        >

        $<$<PLATFORM_ID:Darwin>:
            -pthread
        >

        # Required for CMake < 3.1; should be removed if minimum required CMake version is raised.
        $<$<VERSION_LESS:${CMAKE_VERSION},3.1>:
            -std=c++11
        >
        # For debugging with lldb
        $<$<CONFIG:Debug>:
            -g
            # -v
        >

    )
endif ()

#
# Linker options
#

set(DEFAULT_LINKER_OPTIONS)

# Use pthreads on mingw and linux
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
    set(DEFAULT_LINKER_OPTIONS
        -pthread
    )
endif()

repository: kabasakalis/cpp-maze

repo_name: kabasakalis/cpp-maze


text:
# Copyright (c) Stanford University, The Regents of the University of
#               California, and others.
#
# All Rights Reserved.
#
# See Copyright-SimVascular.txt for additional details.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# - Find leslib Libraries
# This function provides the barebones for find leslib.
# It creates the variables required so the user can set them
# === Variables ===
#
#  LESLIB_LIBRARY, library search path
#  LESLIB_INCLUDE_DIR, include search path
#  LESLIB_FOUND, set if leslib was found

set(proj LESLIB)
include(FindPackageHandleStandardArgs)
include(GetPrerequisites)

find_library(${proj}_LIBRARY leslib libles)
find_path(${proj}_INCLUDE_DIR les.h)

#-----------------------------------------------------------------------------
# Handle Standard Args
find_package_handle_standard_args(${proj} DEFAULT_MSG
	${proj}_LIBRARY
	${proj}_INCLUDE_DIR)

repository: aslakbergersen/SimVascular

repo_name: aslakbergersen/SimVascular


text:
@article{DOI:10.1371/journal.pone.0196391,
	doi = {10.1371/journal.pone.0196391},
	url = {https://doi.org/10.1371%2Fjournal.pone.0196391},
	year = 2018,
	month = {may},
	publisher = {Public Library of Science ({PLoS})},
	volume = {13},
	number = {5},
	pages = {e0196391},
	author = {Steven R. Livingstone and Frank A. Russo},
	editor = {Joseph Najbauer},
	title = {The Ryerson Audio-Visual Database of Emotional Speech and Song ({RAVDESS}): A dynamic, multimodal set of facial and vocal expressions in North American English},
	journal = {{PLOS} {ONE}}
}

repository: ResearcherOne/researchpad-project

repo_name: ResearcherOne/researchpad-project

branch_name: refs/heads/develop

gha_license_id: MIT

gha_language: JavaScript

extension: bib


text:
@InProceedings{fazayeli16,
  title = {Generalized Direct Change Estimation in Ising Model Structure},
  author = {Farideh Fazayeli and Arindam Banerjee},
  pages = {2281-2290},
  abstract = {We consider the problem of estimating change in the dependency structure of two $p$-dimensional Ising models, based on respectively $n_1$ and $n_2$ samples drawn from the models. The change is assumed to be structured, e.g., sparse, block sparse, node-perturbed sparse, etc., such that it can be characterized by a suitable (atomic) norm. We present and analyze a norm-regularized estimator for directly estimating the change in structure, without having to estimate the structures of the individual Ising models. The estimator can work with any norm, and can be generalized to other graphical models under mild assumptions. We show that only one set of samples, say $n_2$, needs to satisfy the sample complexity requirement for the estimator to work, and the estimation error decreases as $\frac{c}{\sqrt{\min(n_1,n_2)}}$, where $c$ depends on the Gaussian width of the unit norm ball. For example, for $\ell_1$ norm applied to $s$-sparse change, the change can be accurately estimated with $\min(n_1,n_2)=O(s \log p)$ which is sharper than an existing result $n_1= O(s^2 \log p)$ and $n_2 = O(n_1^2)$. Experimental results illustrating the effectiveness of the proposed estimator are presented.},
}

repository: mreid/papersite

repo_name: mreid/papersite

gha_language: TeX


text:
// Copyright 2023 Iguazio
//
// 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 bufferpool

// SizedBytePool is a pool of byte buffers, with a max size
// based on "github.com/oxtoacart/bpool"
type SizedBytePool struct {
	bufferChan  chan []byte
	bufferSize  int
	poolSize    int
	currentSize int
}

// NewSizedBytePool creates a new byte buffer pool
func NewSizedBytePool(poolSize, bufferSize int) *SizedBytePool {
	return &SizedBytePool{
		bufferChan: make(chan []byte, poolSize),
		bufferSize: bufferSize,
		poolSize:   poolSize,
	}
}

// Get returns a byte buffer from the pool.
// If the pool is not full, a new buffer is created.
// If the pool is full, the call blocks until a buffer is available.
func (p *SizedBytePool) Get() []byte {
	for {
		select {
		case buf := <-p.bufferChan:
			return buf
		default:
			if p.currentSize < p.poolSize {
				p.currentSize++
				p.bufferChan <- make([]byte, p.bufferSize)
			}
		}
	}
}

// Put returns a byte buffer to the pool.
// If the buffer is too small, it is discarded.
func (p *SizedBytePool) Put(buf []byte) {
	if cap(buf) < p.bufferSize {
		return
	}

	// return the buffer to the pool
	p.bufferChan <- buf[:p.bufferSize]
}

// NumPooled returns the number of currently queued buffers in the pool.
func (p *SizedBytePool) NumPooled() int {
	return len(p.bufferChan)
}

// PoolSize returns the number of already allocated buffers in the pool.
func (p *SizedBytePool) PoolSize() int {
	return p.currentSize
}

repository: mlrun/mlrun

repo_name: mlrun/mlrun

branch_name: refs/heads/development

gha_language: Python


text:
package word1

import (
	"testing"

	"github.com/bmizerany/assert"
)

func TestIsPalindrome(t *testing.T) {
	t.Parallel()

	tests := []struct {
		input    string
		expected bool
	}{
		{
			input:    "detartrated",
			expected: true,
		},
		{
			input:    "palindrome",
			expected: false,
		},
		{
			input:    "été",
			expected: true,
		},
		{
			input:    "A man, a plan, a canal: Panama",
			expected: true,
		},
	}

	for _, tt := range tests {
		actual := IsPalindrome(tt.input)

		assert.Equal(t, tt.expected, actual)
	}
}


text:
// +build e2e

/*
Copyright 2019 The Knative 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 runtime

import (
	"testing"

	corev1 "k8s.io/api/core/v1"
	revisionresourcenames "knative.dev/serving/pkg/reconciler/revision/resources/names"
	v1opts "knative.dev/serving/pkg/testing/v1"
	"knative.dev/serving/test"
	"knative.dev/serving/test/conformance/api/shared"
	v1test "knative.dev/serving/test/v1"
)

func TestProbeRuntime(t *testing.T) {
	t.Parallel()
	clients := test.Setup(t)

	var testCases = []struct {
		// name of the test case, which will be inserted in names of routes, configurations, etc.
		// Use a short name here to avoid hitting the 63-character limit in names
		// (e.g., "service-to-service-call-svc-cluster-local-uagkdshh-frkml-service" is too long.)
		name string
		// handler to be used for readiness probe in user container.
		handler corev1.Handler
	}{{
		"httpGet",
		corev1.Handler{
			HTTPGet: &corev1.HTTPGetAction{
				Path: "/healthz",
			},
		},
	}, {
		"tcpSocket",
		corev1.Handler{
			TCPSocket: &corev1.TCPSocketAction{},
		},
	}, {
		"exec",
		corev1.Handler{
			Exec: &corev1.ExecAction{
				Command: []string{"/ko-app/runtime", "probe"},
			},
		},
	}}

	for _, tc := range testCases {
		tc := tc
		t.Run(tc.name, func(t *testing.T) {
			t.Parallel()
			names := test.ResourceNames{
				Service: test.ObjectNameForTest(t),
				Image:   test.Runtime,
			}

			test.EnsureTearDown(t, clients, &names)

			t.Log("Creating a new Service")
			resources, err := v1test.CreateServiceReady(t, clients, &names,
				v1opts.WithReadinessProbe(
					&corev1.Probe{
						Handler: tc.handler,
					}))
			if err != nil {
				t.Fatalf("Failed to create initial Service: %v: %v", names.Service, err)
			}
			// Check if scaling down works even if access from liveness probe exists.
			if err := shared.WaitForScaleToZero(t, revisionresourcenames.Deployment(resources.Revision), clients); err != nil {
				t.Fatal("Could not scale to zero:", err)
			}
		})
	}
}

repository: HarshCasper/serving

repo_name: HarshCasper/serving

gha_language: Go


text:
DESCRIPTION = "OpenCuberevo: madwifi Task for the OpenCuberevo Distribution"
SECTION = "opencuberevo/base"
LICENSE = "MIT"
PR = "r1"

inherit task

#
# task-opencuberevo-madwifi
#
DESCRIPTION_${PN} = "OpenCuberevo: madwifi Support"
DEPENDS_${PN} = "\
  madwifi-ng \
"

RDEPENDS_${PN} = "\
  madwifi-ng-modules \
"

repository: popazerty/openembedded-cuberevo

repo_name: popazerty/openembedded-cuberevo

extension: bb


text:
package org

import (
	"fmt"
)

func(s *OrgSetup) ChooseORG(org string) *OrgSetup {

	fmt.Println("Input  Org "+org)

	orgSetup, _ := s.InitializeOrg(org)

	fmt.Println(" ########### Org Details ################# ")
	fmt.Println(" OrgName - "+orgSetup.OrgName)

	return &orgSetup
}

repository: Deeptiman/multiorgledger

repo_name: Deeptiman/multiorgledger


text:
#include <iostream>
#include <stdexcept>
#include"FamilyTree.hpp"
using namespace std;

namespace family {
/*

    treenode *Tree::creatNode(string name) {
        treenode *n = new treenode;
        n->name = name;
        n->left = NULL;
        n->right = NULL;
        return n;
    }
*/

    treenode::treenode(std::string root)
    {
        name = root;
        right = NULL;
        left = NULL;
        rank ="";

    }
    treenode::~treenode()
    {
        delete right;
        delete left;
    }

    Tree::Tree(string Name) {
        root = new treenode(Name);
        root->rank = "me";
        counter = 1;
    }

    Tree::~Tree() {
        delete root;
    }

    bool Tree::equal(string a, string b) {
        if (a.length() != b.length())
            return false;
        for (int i = 0; i < a.length(); i++) {
            if (a[i] != b[i])
                return false;

        }
        return true;
    }

    int Tree::HighRecursive(string name, treenode *node, int level) {
        if (node == NULL)
            return 0;
        if (equal(node->name, name))
            return level;

        int downlevel = HighRecursive(name, node->left, level + 1);

        if (downlevel != 0)
            return downlevel;

        downlevel = HighRecursive(name, node->right, level + 1);

        return downlevel;
    }

    void Tree::addFatherRecursive(string child, string father, treenode *node) {

        if (node == NULL)
            return;
        if (node != NULL) {
            if (node->name != "" && equal(node->name, child)) {
                counter++;
                if (node->left == NULL) {
                    node->left = new treenode(father);
                    int level = 0;
                    int num = HighRecursive(father, root, level);
                    if (num == 1)
                        node->left->rank = "father";
                    if (num == 2)
                        node->left->rank = "grandfather";
                    if (num > 2) {

                        for (int i = 2; i < num; i++) {
                            node->left->rank = node->left->rank + "great-";
                        }
                        node->left->rank = node->left->rank + "grandfather";
                    }
                }else throw invalid_argument("wrong");
            }
        }

        addFatherRecursive(child, father, node->left);
        addFatherRecursive(child, father, node->right);

    }

    void Tree::addMotherRecursive(string child, string mother, treenode *node) {

        if (node == NULL)
            return;
        if (node != NULL) {
            if (node->name != "" && equal(node->name, child)) {
                counter++;
                if (node->right == NULL) {
                    node->right =  new treenode(mother);
                    int level = 0;
                    int num = HighRecursive(mother, root, level);

                    if (num == 1)
                        node->right->rank = "mother";
                    if (num == 2)
                        node->right->rank = "grandmother";
                    if (num > 2) {

                        for (int i = 2; i < num; i++) {
                            node->right->rank = node->right->rank + "great-";
                        }
                        node->right->rank = node->right->rank + "grandmother";
                    }

                }else throw invalid_argument("wrong");
            }
        }
        addMotherRecursive(child, mother, node->left);
        addMotherRecursive(child, mother, node->right);

    }

    treenode *Tree::findNodeName(string name, treenode *node) {
        if (node == NULL)
            return NULL;
        if (node != NULL && equal(node->name, name))
            return node;

        treenode *found = findNodeName(name, node->left);

        if (found != NULL)
            return found;

        return findNodeName(name, node->right);
    }

    treenode *Tree::findNodeRank(string name, treenode *node) {
        if (node == NULL)
            return NULL;

        if (equal(node->rank, name))
            return node;

        treenode *found = findNodeRank(name, node->left);

        if (found != NULL)
            return found;

        return findNodeRank(name, node->right);
    }

    void Tree::display() //help from geeksforgeeks
    {
        cout << "notice! the mothers is up and fathers is down!" << endl;
        // Root without spaces
        print(root, 0);
    }
    void Tree::print(treenode* root, int space) //Print (right,root,left)--> (mather,child,father)
    {
        if (root == NULL) // Nothing to print
            return;

        //  For know how much space to take (We want it be clear for show)
        space =space+ counter;

        // mother first
        print(root->right, space);

        cout<<endl;
        for (int i = counter; i < space; i++)
            cout<<" ";
        cout<<root->name<<"\n\n";

        // father
        print(root->left, space);
    }
    bool Tree:: cheakIfFatherExist(string child,treenode* node)
    {

        if (node == NULL)
            return false;

        if (equal(node->name,child))
        {
            if(node->left==NULL)
                return true;
        }

        bool ans1 = cheakIfFatherExist(child, node->left);

        if(ans1)
            return true;

        bool ans2 = cheakIfFatherExist(child, node->right);

        return ans2;
    }

    bool Tree:: cheakIfMotherExist(string child,treenode* node)
    {

        if (node == NULL)
            return false;

        if (equal(node->name,child))
        {
            if(node->right==NULL)
                return true;
        }

        bool ans1 = cheakIfMotherExist(child, node->left);

        if(ans1)
            return true;

        bool ans2 = cheakIfMotherExist(child, node->right);

        return ans2;
    }
    Tree &Tree::addFather(string child, string father) {

        if(cheakIfFatherExist(child,root))
            addFatherRecursive(child, father, root);
                else
        throw std::runtime_error("we have a father for this child");

        return *this;

    }

    Tree &Tree::addMother(string child, string mother) {

            if(cheakIfMotherExist(child,root))
        addMotherRecursive(child, mother, root);
            else
                throw std::runtime_error("we have a mother for this child");
        return *this;
    }

    string Tree::relation(string name) {

        string s = "unrelated";
        if (equal(root->name, name))
            return root->rank;

        treenode *node = findNodeName(name, root);
        if (node != NULL && equal(node->name, name))
            return node->rank;
        else
            return s;
    }

    void Tree::remove(string name) {
        if (root->name==name) throw invalid_argument("cant remove");
        treenode *node = findNodeName2(name, root);
if(node==NULL) throw invalid_argument("cant remove");

        if (node->left!=NULL&&node->left->name==name)
        {
            delete node->left;
            node->left = NULL;
            counter--;
        }
        if (node->right!=NULL&&node->right->name==name)
        {
            delete node->right;
            node->right = NULL;
            counter--;

        }
    }
    treenode *Tree::findNodeName2(string name, treenode *node) {
        if (node == NULL)
            return NULL;
        if ((node->left!= NULL && equal(node->left->name, name))||(node->right!= NULL && equal(node->right->name, name)))
            return node;

        treenode *found = findNodeName2(name, node->left);

        if (found != NULL)
            return found;

        return findNodeName2(name, node->right);
    }

    string Tree::find(string name) {
        treenode *node = findNodeRank(name, root);
        if (node==NULL) throw invalid_argument("no relation");
        return node->name;

    }

   /* void Tree::printpostorderprivate(treenode *ptr) {
        if (ptr != NULL) {
            if (ptr->left != NULL) {
                printpostorderprivate(ptr->left);
            }
            cout << ptr->name << " ";

            if (ptr->right != NULL) {
                printpostorderprivate(ptr->right);
            }

        } else
            cout << "emty" << " ";
    }
*/
   /* void Tree::printPostorder() {

        printpostorderprivate(root);

    }*/
};

extension: cpp


text:
package network

import (
	"io"
	"log"
)

type EVENT_TYPE int

const (
	EVENT_READ EVENT_TYPE = iota
	EVENT_WRITE
	EVENT_FLUSH
	EVENT_PANIC
	EVENT_USER
)

type ChannelRawSideHandler interface {
	Active(Channel)
	Inactive(Channel)
	OnRead(Channel, []byte)
	OnError(channel Channel, eventType EVENT_TYPE, err error)
	OnUserEvent(channel Channel, userEvent *UserEvent)

	OnWrite(Channel, WriteEvent) error
	OnFlush(Channel, FlushEvent) error

	// callback when following operations triggered
	OnRawReadOp(Channel, []byte, error)
	OnRawWriteOp(Channel, []byte)
	OnRawFlushOp(Channel)
}

type ChannelSideOutboundTrigger interface {
	Write(WriteEvent) (submitted bool, err error)
	Flush(FlushEvent) (submitted bool, err error)
	Close() error
	IsActive() bool
	IsInactive() bool
}

type Channel interface {
	ChannelSideOutboundTrigger

	SetAttachment(attachment interface{})
	GetAttachment() interface{}
}

type OutboundEvent interface {
	GetType() EVENT_TYPE
	Process(w io.Writer) (int, error)
}

type WriteEvent struct {
	Data     []byte
	Callback func(writeEvent WriteEvent, err error)
}

func (this WriteEvent) GetType() EVENT_TYPE {
	return EVENT_WRITE
}

func (this WriteEvent) Process(w io.Writer) (int, error) {
	return w.Write(this.Data)
}

type FlushEvent struct {
	Callback func(flushEvent FlushEvent, err error)
}

func (this FlushEvent) GetType() EVENT_TYPE {
	return EVENT_FLUSH
}

func (this FlushEvent) Process(w io.Writer) (int, error) {
	return 0, nil
}

type UserEvent struct {
}

func WrapWriteEvent(data []byte, cb func(writeEvent WriteEvent, err error)) WriteEvent {
	return WriteEvent{
		Data:     data,
		Callback: cb,
	}
}

func NewSimpleWriteEvent(data []byte) WriteEvent {
	return WriteEvent{
		Data:     data,
		Callback: func(writeEvent WriteEvent, err error) {},
	}
}

func WrapFlushEvent(cb func(flushEvent FlushEvent, err error)) FlushEvent {
	return FlushEvent{
		Callback: cb,
	}
}

var noopFlushEvent = FlushEvent{
	Callback: func(flushEvent FlushEvent, err error) {},
}

func NewNoopFlushEvent() FlushEvent {
	return noopFlushEvent
}

//================

type DefaultChannelRawSideHandler struct {
}

var _ ChannelRawSideHandler = DefaultChannelRawSideHandler{}

func (DefaultChannelRawSideHandler) Active(channel Channel) {
}

func (DefaultChannelRawSideHandler) Inactive(channel Channel) {
}

func (DefaultChannelRawSideHandler) OnRead(ch Channel, data []byte) {
}

func (DefaultChannelRawSideHandler) OnError(channel Channel, eventType EVENT_TYPE, err error) {
	switch eventType {
	case EVENT_READ:
		if channel.IsActive() {
			log.Println("default handler:", err)
			channel.Close()
		}
	}
}

func (DefaultChannelRawSideHandler) OnWrite(ch Channel, we WriteEvent) error {
	return nil
}

func (DefaultChannelRawSideHandler) OnFlush(Channel, FlushEvent) error {
	return nil
}

func (DefaultChannelRawSideHandler) OnClose(Channel) error {
	return nil
}

func (DefaultChannelRawSideHandler) OnUserEvent(channel Channel, userEvent *UserEvent) {
}

func (DefaultChannelRawSideHandler) OnRawReadOp(Channel, []byte, error) {
}

func (DefaultChannelRawSideHandler) OnRawWriteOp(Channel, []byte) {
}

func (DefaultChannelRawSideHandler) OnRawFlushOp(Channel) {
}

repository: meidoworks/nekoq-api

repo_name: meidoworks/nekoq-api


text:
package todo

import (
	"database/sql"
	"fmt"
	"time"

	"github.com/juju/errors"
	"github.com/youngkin/todoshaleapps/src/internal/platform/constants"
)

var (
	getAllToDosQuery = "SELECT id, note, duedate, repeat, completed FROM todo"
	getToDoQuery     = "SELECT id, note, duedate, repeat, completed FROM todo WHERE id = $1"
	insertToDoStmt   = "INSERT INTO todo (note, duedate, repeat, completed) VALUES ($1, $2, $3, $4) RETURNING id"
	updateToDoStmt   = "UPDATE todo SET note = $1, duedate = $2, repeat = $3, completed = $4 WHERE id = $5"
	deleteToDoStmt   = "DELETE FROM todo WHERE id = $1"
)

// Item represents the data about a To Do list item
type Item struct {
	ID        int64     `json:"id"`
	SelfRef   string    `json:"selfref"`
	Note      string    `json:"note"`
	DueDate   time.Time `json:"duedate"`
	Repeat    bool      `json:"repeat"`
	Completed bool      `json:"completed"`
}

// List is a collection ToDo items, i.e., a To Do List
type List struct {
	Items []*Item `json:"todolist"`
}

// GetToDoList will return all ToDo items
func GetToDoList(db *sql.DB) (List, error) {
	results, err := db.Query(getAllToDosQuery)
	if err != nil {
		return List{}, errors.Annotate(err, "error querying DB")
	}

	tdl := List{}
	for results.Next() {
		var td Item

		err = results.Scan(&td.ID,
			&td.Note,
			&td.DueDate,
			&td.Repeat,
			&td.Completed)
		if err != nil {
			return List{}, errors.Annotate(err, "error scanning result set")
		}

		tdl.Items = append(tdl.Items, &td)
	}

	return tdl, nil
}

// GetToDoItem will return the todo identified by 'id' or a nil todo if there
// wasn't a matching todo.
func GetToDoItem(db *sql.DB, id int) (*Item, error) {
	row := db.QueryRow(getToDoQuery, id)
	var td Item
	err := row.Scan(&td.ID,
		&td.Note,
		&td.DueDate,
		&td.Repeat,
		&td.Completed)
	if err != nil && err != sql.ErrNoRows {
		return nil, errors.Annotate(err, "error scanning todo row")
	}
	if err == sql.ErrNoRows {
		return nil, nil
	}

	return &td, nil
}

// InsertToDo takes the provided todo data, inserts it into the db, and returns the newly created todo ID.
func InsertToDo(db *sql.DB, td Item) (int64, error) {
	err := validateToDo(td)
	if err != nil {
		return 0, errors.Annotate(err, "ToDo validation failure")
	}

	var id int64
	err = db.QueryRow(insertToDoStmt, td.Note, td.DueDate, td.Repeat, td.Completed).Scan(&id)
	if err != nil {
		return 0, errors.Annotate(err, fmt.Sprintf("error inserting todo %+v into DB", td))
	}

	return id, nil
}

// UpdateToDo takes the provided todo data, inserts it into the db, and returns the newly created todo ID
func UpdateToDo(db *sql.DB, td Item) (constants.ErrCode, error) {
	err := validateToDo(td)
	if err != nil {
		return constants.DBUpSertErrorCode, errors.Annotate(err, "ToDo validation failure")
	}

	_, err = db.Exec(updateToDoStmt, td.Note, td.DueDate, td.Repeat, td.Completed, td.ID)
	if err != nil {
		return constants.DBUpSertErrorCode, errors.Annotate(err, fmt.Sprintf("error updating todo in the database: %+v", td))
	}

	return constants.NoErrorCode, nil
}

// DeleteToDo deletes the todo identified by td.id from the database
func DeleteToDo(db *sql.DB, id int) (constants.ErrCode, error) {
	_, err := db.Exec(deleteToDoStmt, id)
	if err != nil {
		return constants.DBDeleteErrorCode, errors.Annotate(err, fmt.Sprintf("ToDo delete error for ID %d", id))
	}

	return constants.NoErrorCode, nil
}

func validateToDo(td Item) error {
	errMsg := ""

	if len(td.Note) == 0 {
		errMsg = errMsg + "ToDo note must be populated"
	}

	if len(errMsg) > 0 {
		return errors.New(errMsg)
	}
	return nil
}

repository: youngkin/todo

repo_name: youngkin/todo


text:
// +build linux

/*
	Go Language Raspberry Pi Interface
	(c) Copyright David Thorpe 2018
	All Rights Reserved

	Documentation http://djthorpe.github.io/gopi/
	For Licensing and Usage information, please see LICENSE.md
*/

package linux

import (
	"fmt"
	"syscall"
	"time"

	"github.com/djthorpe/gopi"
)

////////////////////////////////////////////////////////////////////////////////
// TYPES

type Metrics struct{}

type metrics struct {
	log gopi.Logger
}

////////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES

var (
	// Timestamp for module creation
	ts = time.Now()
)

////////////////////////////////////////////////////////////////////////////////
// OPEN AND CLOSE

// Open creates a new metrics object, returns error if not possible
func (config Metrics) Open(log gopi.Logger) (gopi.Driver, error) {
	log.Debug("<sys.hw.linux.Metrics>Open{}")

	// create new driver
	this := new(metrics)
	this.log = log

	// return driver
	return this, nil
}

// Close connection
func (this *metrics) Close() error {
	this.log.Debug("<sys.hw.linux.Metrics>Close{}")
	return nil
}

////////////////////////////////////////////////////////////////////////////////
// RETURN UPTIME

func (this *metrics) UptimeHost() time.Duration {
	if info := this.sysinfo(); info != nil {
		return time.Second * time.Duration(info.Uptime)
	} else {
		return 0
	}
}

func (this *metrics) UptimeApp() time.Duration {
	return time.Since(ts)
}

////////////////////////////////////////////////////////////////////////////////
// RETURN LOAD AVERAGES

func (this *metrics) LoadAverage() (float64, float64, float64) {
	if info := this.sysinfo(); info != nil {
		return float64(info.Loads[0]) / float64(1<<16), float64(info.Loads[1]) / float64(1<<16), float64(info.Loads[2]) / float64(1<<16)
	} else {
		return 0, 0, 0
	}
}

////////////////////////////////////////////////////////////////////////////////
// GET SYSTEM INFO STRUCTURE

func (this *metrics) sysinfo() *syscall.Sysinfo_t {
	info := syscall.Sysinfo_t{}
	if err := syscall.Sysinfo(&info); err != nil {
		this.log.Error("<sys.hw.linux.Metrics>sysinfo: %v", err)
		return nil
	} else {
		return &info
	}
}

////////////////////////////////////////////////////////////////////////////////
// STRINGIFY

func (this *metrics) String() string {
	return fmt.Sprintf("<sys.hw.linux.Metrics>{}")
}


text:
@misc{website:projeto-cgt,
  author={CGT},
  year={2015},
  title={Ceará Game Tools: Sobre o Projeto},
  url={http://www.cgt.ifce.edu.br/sobre.php},
  urlaccessdate={15.11.2015}}

@misc{website:projeto-cgt-repo,
  author={CGT},
  year={2015},
  title={Repositório do código fonte do projeto Ceará Game Tools hospedado na plataforma Github},
  url={https://github.com/hexat/projetocgt},
  urlaccessdate={9.12.2015}}

@monography{monografia:aquino,
  address={Fortaleza},
  author={Vitor Gonçalves de Aquino},
  school={Instituto Federal de Educação, Ciência e Tecnologia do Ceará},
  title={Ceará Game Tools: Uma ferramenta de software livre para geração  automática de games},
  type={Bacharel em Engenharia de Computação},
  year={2015},
  pages={79}}

@article{klm-metodo,
   Author = {David Kieras},
	Title = {Using the Keystroke-Level Model to Estimate Execution Times},
   Journal = {University of Michigan},
   Volume = {1},
	Year = {2001}}

@article{klm-def,
   Title = {The Keystroke-Level Model for User Performance Time with Interactive Systems},
	Author = {Stuart K. Card and Thomas P. Moran},
   Journal = {Xerox Palo Alto Research Center},
   Volume = {23},
   Number = {7},
   Pages = {396-410},
   Year = {1980}}

@article{ind-bra-relatorio,
   Title = {RELATÓRIO FINAL Mapeamento da Indústria Brasileira e Global de Jogos Digitais},
   Author = {GEDIGames},
   Journal = {Núcleo de Política e Gestão Tecnológica},
   Year = {2014}}

repository: joelxr/monografia

repo_name: joelxr/monografia


text:
# This file sets up various platform specific directory paths including for Framework and lib/bins folders

# Set PROJECT_ARCH to either 32 or 64 (bits). Used to set the framework folders for Windows.
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
	set (PROJECT_ARCH 64)
else()
	set (PROJECT_ARCH 32)
endif()

if (WIN32)
#For Windows, the library paths are dependent on configuration(Debug/Release), so must depend on $<CONFIG>.
#But the Cmake files folder cannot be dependent on $<CONFIG> as the same project builds both debug and release
	set(FRAMEWORK_LIB_FOLDER "${SDK_ROOT}/framework/lib/Windows_x86_${PROJECT_ARCH}/$<CONFIG>" CACHE INTERNAL "")
	set(FRAMEWORK_CMAKE_FILES_FOLDER "${SDK_ROOT}/framework/lib/Windows_x86_${PROJECT_ARCH}/cmake" CACHE INTERNAL "")
	set(SCOPE_LIB_FOLDER "${SDK_ROOT}/lib/Windows_x86_${PROJECT_ARCH}" CACHE INTERNAL "")
	set(SCOPE_STATIC_LIBRARY_PREFIX "" CACHE INTERNAL "")
	set(SCOPE_STATIC_LIBRARY_SUFFIX ".lib" CACHE INTERNAL "")
	set(SCOPE_SHARED_LIBRARY_PREFIX "" CACHE INTERNAL "")
	set(SCOPE_SHARED_LIBRARY_SUFFIX ".dll" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER "${SDK_ROOT}/lib/Windows_x86_${PROJECT_ARCH}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_LIB_FOLDER "${SDK_ROOT}/lib/Windows_x86_${PROJECT_ARCH}" CACHE INTERNAL "")
	set(EXTERNAL_LIB_CONFIG_FOLDER "${EXTERNAL_LIB_FOLDER}/$<CONFIG>" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Release" CACHE INTERNAL "")
elseif (ANDROID)
	set(FRAMEWORK_LIB_FOLDER "${SDK_ROOT}/framework/lib/Android/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}" CACHE INTERNAL "")
	set(FRAMEWORK_CMAKE_FILES_FOLDER "${SDK_ROOT}/framework/lib/Android/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}/cmake" CACHE INTERNAL "")
	set(SCOPE_LIB_FOLDER "${SDK_ROOT}/lib/Android/${ANDROID_ABI}" CACHE INTERNAL "")
	set(SCOPE_STATIC_LIBRARY_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}" CACHE INTERNAL "")
	set(SCOPE_STATIC_LIBRARY_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE INTERNAL "")
	set(SCOPE_SHARED_LIBRARY_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}" CACHE INTERNAL "")
	set(SCOPE_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER "${SDK_ROOT}/lib/Android/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_LIB_FOLDER "${SDK_ROOT}/lib/Android" CACHE INTERNAL "")
	set(EXTERNAL_LIB_CONFIG_FOLDER "${EXTERNAL_LIB_FOLDER}/${CMAKE_BUILD_TYPE}/${ANDROID_ABI}" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Debug/${ANDROID_ABI}" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Release/${ANDROID_ABI}" CACHE INTERNAL "")
elseif (APPLE)
	if (IOS)
		set (PLATFORM_FOLDER iOS)
	else()
		set (PLATFORM_FOLDER macOS_x86)
	endif()
	set(FRAMEWORK_LIB_FOLDER "${SDK_ROOT}/framework/lib/${PLATFORM_FOLDER}/$<CONFIG>" CACHE INTERNAL "")
	set(FRAMEWORK_CMAKE_FILES_FOLDER "${SDK_ROOT}/framework/lib/${PLATFORM_FOLDER}/cmake" CACHE INTERNAL "")
	set(SCOPE_LIB_FOLDER "${SDK_ROOT}/lib/${PLATFORM_FOLDER}" CACHE INTERNAL "")
	set(SCOPE_STATIC_LIBRARY_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}" CACHE INTERNAL "")
	set(SCOPE_STATIC_LIBRARY_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE INTERNAL "")
	set(SCOPE_SHARED_LIBRARY_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}" CACHE INTERNAL "")
	set(SCOPE_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER "${SDK_ROOT}/lib/${PLATFORM_FOLDER}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_LIB_FOLDER "${SDK_ROOT}/lib/${PLATFORM_FOLDER}" CACHE INTERNAL "")
	set(EXTERNAL_LIB_CONFIG_FOLDER "${EXTERNAL_LIB_FOLDER}/$<CONFIG>" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Release" CACHE INTERNAL "")
elseif (UNIX)
	set(FRAMEWORK_LIB_FOLDER "${SDK_ROOT}/framework/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE}${WS}" CACHE INTERNAL "")
	set(FRAMEWORK_CMAKE_FILES_FOLDER "${SDK_ROOT}/framework/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE}${WS}/cmake" CACHE INTERNAL "")
	set(SCOPE_LIB_FOLDER "${SDK_ROOT}/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "")
	set(SCOPE_STATIC_LIBRARY_PREFIX "${CMAKE_STATIC_LIBRARY_PREFIX}" CACHE INTERNAL "")
	set(SCOPE_STATIC_LIBRARY_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE INTERNAL "")
	set(SCOPE_SHARED_LIBRARY_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}" CACHE INTERNAL "")
	set(SCOPE_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
	set(EXTERNAL_CMAKE_FILES_FOLDER "${SDK_ROOT}/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_BUILD_TYPE}${WS}/cmake" CACHE INTERNAL "")
	set(EXTERNAL_LIB_FOLDER "${SDK_ROOT}/lib/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "")
	set(EXTERNAL_LIB_CONFIG_FOLDER "${EXTERNAL_LIB_FOLDER}/${CMAKE_BUILD_TYPE}" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_LIB_FOLDER "${EXTERNAL_LIB_FOLDER}/Release" CACHE INTERNAL "")
else()
	message(FATAL_ERROR "UNKNOWN PLATFORM - Please set up this line with a path to where the Framework libraries must be set")
endif()

if(CMAKE_HOST_WIN32)
	set(EXTERNAL_BIN_FOLDER "${SDK_ROOT}/bin/Windows" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Release" CACHE INTERNAL "")
	set(HOST_EXECUTABLE_SUFFIX ".exe" CACHE INTERNAL "")
elseif(CMAKE_HOST_APPLE)
	set(EXTERNAL_BIN_FOLDER "${SDK_ROOT}/bin/${PLATFORM_FOLDER}" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Release" CACHE INTERNAL "")
	set(HOST_EXECUTABLE_SUFFIX "" CACHE INTERNAL "")
elseif(CMAKE_HOST_UNIX)
	set(EXTERNAL_BIN_FOLDER "${SDK_ROOT}/bin/${CMAKE_HOST_SYSTEM_NAME}_${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE INTERNAL "")
	set(EXTERNAL_DEBUG_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Debug" CACHE INTERNAL "")
	set(EXTERNAL_RELEASE_BIN_FOLDER "${EXTERNAL_BIN_FOLDER}/Release" CACHE INTERNAL "")
	set(HOST_EXECUTABLE_SUFFIX "" CACHE INTERNAL "")
endif()


text:
// Copyright (c) 2017-2018 The qitmeer developers

package leb128

import (
	"fmt"
	"reflect"
	"strings"
	"testing"
)

func TestInt64(t *testing.T) {
	tests := []struct {
		n    int64
		want []byte
	}{
		{0, []byte{0x00}},
		{1, []byte{0x01}},
		{2, []byte{0x02}},
		{3, []byte{0x03}},
		{4, []byte{0x04}},
		{5, []byte{0x05}},
		{63, []byte{0x3F}},
		{64, []byte{0x40}},
		{65, []byte{0x41}},
		{100, []byte{0x64}},
		{127, []byte{0x7F}},
		{128, []byte{0x80, 0x01}},
		{129, []byte{0x81, 0x01}},
		{2141192192, []byte{0x80, 0x80, 0x80, 0xFD, 0x07}},
		{^int64(0), []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01}},
	}
	for _, tt := range tests {
		t.Run("TestFromInt64", func(t *testing.T) {
			if got := Uleb128FromInt64(tt.n); !reflect.DeepEqual(got, tt.want) {
				t.Errorf("Uleb128FromInt64(%v) = %0x, want %0x", tt.n, got, tt.want)
			}
		})
		t.Run("TestToInt64", func(t *testing.T) {
			if got, _ := Uleb128ToUint64(tt.want); !reflect.DeepEqual(int64(got), tt.n) {
				t.Errorf("Uleb128ToUint64(%v) = %0x, want %0x", tt.want, got, tt.n)
			}
		})
	}
}

// Note
// The following test case copied & modified from
// https://github.com/Equim-chan/leb128/blob/master/leb128_test.go

var (
	uleb128Spec = map[uint64]string{
		0:                    "00000000",
		0x7f:                 "01111111",
		0x80:                 "00000001 10000000",
		0xff:                 "00000001 11111111",
		2333:                 "00010010 10011101",
		0xef17:               "00000011 11011110 10010111",
		624485:               "00100110 10001110 11100101",
		0xffff:               "00000011 11111111 11111111",
		18446744073709551615: "00000001 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111",
	}
	sleb128Spec = map[int64]string{
		-9223372036854775808: "01111111 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000",
		-624485:              "01011001 11110001 10011011",
		^0x40:                "01111111 10111111",
		^0x3f:                "01000000",
		-1:                   "01111111",
		0:                    "00000000",
		1:                    "00000001",
		0x3f:                 "00111111",
		0x40:                 "00000000 11000000",
		0xef17:               "00000011 11011110 10010111",
		9223372036854775807:  "00000000 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111",
	}
	errorSpec = map[string]uint8{
		"11111111":          0,
		"10000000 10000000": 0,
		"01111111 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 10000000 11111111": 0,
	}
)

// bytesToBinary encodes b into a base 2 string in MSB to LSB order.
func bytesToBinary(b []byte) string {
	l := len(b)
	parts := make([]string, l)

	for i, v := range b {
		parts[l-i-1] = fmt.Sprintf("%08b", v)
	}

	return strings.Join(parts, " ")
}

// binaryToBytes decodes base 2 string in MSB to LSB order into bytes.
func binaryToBytes(s string) []byte {
	parts := strings.Split(s, " ")
	l := len(parts)
	b := make([]byte, l)

	for i, v := range parts {
		fmt.Sscanf(v, "%b", &b[l-i-1])
	}

	return b
}

func TestEncodeUleb128(t *testing.T) {
	count := 0
	for input, expected := range uleb128Spec {
		var b []byte
		if count%2 == 0 {
			b = AppendUleb128([]byte("magic"), input)[5:]
		} else {
			b = AppendUleb128(nil, input)
		}

		if actual := bytesToBinary(b); actual != expected {
			t.Fatalf("\nInput: %v\nExpected: %v\n     Got: %v\n", input, expected, actual)
		}

		count++
	}
}

func TestEncodeSleb128(t *testing.T) {
	count := 0
	for input, expected := range sleb128Spec {
		var b []byte
		if count%2 == 0 {
			b = AppendSleb128([]byte("equim"), input)[5:]
		} else {
			b = AppendSleb128(nil, input)
		}

		if actual := bytesToBinary(b); actual != expected {
			t.Fatalf("\nInput: %v\nExpected: %v\n     Got: %v\n", input, expected, actual)
		}

		count++
	}
}

func TestDecodeUleb128(t *testing.T) {
	count := 0
	for expected, binStr := range uleb128Spec {
		input := binaryToBytes(binStr)

		var actual uint64
		var n uint8
		if count%2 == 0 {
			actual, n = Uleb128ToUint64(append(input, []byte("magic")...))
		} else {
			actual, n = Uleb128ToUint64(input)
		}

		if expectedN := len(input); int(n) != expectedN {
			t.Fatalf("\nInput: %v\nExpected: n == %v\n     Got: n == %v\n", input, expectedN, n)
		}

		if actual != expected {
			t.Fatalf("\nInput: %v\nExpected: %v\n     Got: %v\n", input, expected, actual)
		}

		count++
	}

	for binStr, expected := range errorSpec {
		input := binaryToBytes(binStr)

		_, actual := Uleb128ToUint64(input)

		if actual != expected {
			t.Fatalf("\nInput: %v\nExpected: %v\n     Got: %v\n", input, expected, actual)
		}
	}
}

func TestDecodeSleb128(t *testing.T) {
	count := 0
	for expected, binStr := range sleb128Spec {
		input := binaryToBytes(binStr)

		var actual int64
		var n uint8
		if count%2 == 0 {
			actual, n = Sleb128ToInt64(append(input, []byte("magic")...))
		} else {
			actual, n = Sleb128ToInt64(input)
		}

		if expectedN := len(input); int(n) != expectedN {
			t.Fatalf("\nInput: %v\nExpected: n == %v\n     Got: n == %v\n", input, expectedN, n)
		}

		if actual != expected {
			t.Fatalf("\nInput: %v\nExpected: %v\n     Got: %v\n", input, expected, actual)
		}

		count++
	}

	for binStr, expected := range errorSpec {
		input := binaryToBytes(binStr)

		_, actual := Sleb128ToInt64(input)

		if actual != expected {
			t.Fatalf("\nInput: %v\nExpected: %v\n     Got: %v\n", input, expected, actual)
		}
	}
}

license: ISC

repository: Qitmeer/qitmeer

repo_name: Qitmeer/qitmeer

gha_license_id: ISC


text:
SUMMARY = "Identity management for Flask applications"
SECTION = "devel/python"

HOMEPAGE = "http://pythonhosted.org/Flask-Principal/"

LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=946a71eddb833fc7ea0c0c175eb8440c"

SRC_URI = "git://github.com/mattupstate/flask-principal.git;protocol=https;nobranch=1"
SRCREV = "e676fef6b70ff0410911b444a323e604b6e575b0"

# SRCREV == tag, so no +git nonsense
PV = "0.4.0"

S = "${WORKDIR}/git"

inherit setuptools

export BUILD_SYS
export HOST_SYS
export STAGING_INCDIR
export STAGING_LIBDIR

BBCLASSEXTEND = "native"

repository: koenkooi/meta-maker

repo_name: koenkooi/meta-maker

gha_language: BitBake


text:
package socks

import (
	"reflect"
	"testing"
	"time"
)

func TestParse(t *testing.T) {
	t.Parallel()
	testcases := []struct {
		name string
		uri  string
		cfg  config
	}{
		{
			name: "full config",
			uri:  "socks5://u1:p1@127.0.0.1:8080?timeout=2s",
			cfg: config{
				Proto: SOCKS5,
				Auth: &auth{
					Username: "u1",
					Password: "p1",
				},
				Host:    "127.0.0.1:8080",
				Timeout: 2 * time.Second,
			},
		},
		{
			name: "simple socks5",
			uri:  "socks5://127.0.0.1:8080",
			cfg: config{
				Proto: SOCKS5,
				Host:  "127.0.0.1:8080",
			},
		},
	}
	for _, tc := range testcases {
		tc := tc
		t.Run(tc.name, func(t *testing.T) {
			t.Parallel()
			cfg, err := parse(tc.uri)
			if err != nil {
				t.Fatal(err)
			}
			if !reflect.DeepEqual(cfg, &tc.cfg) {
				t.Fatalf("expect %v got %v", tc.cfg, cfg)
			}
		})
	}
}


text:
# SPDX-License-Identifier: MIT

SUMMARY = "Barefoot SDE"

inherit packagegroup

PROVIDES = "${PACKAGES}"
PACKAGES = ' \
    packagegroup-sde-barefoot \
'

RDEPENDS_packagegroup-sde-barefoot = "\
  barefoot-bsp grpc bf-python bf-utils bf-syslibs bf-drivers procps bf-kdrv boost pi judy \
"

EXCLUDE_FROM_WORLD = "1"

repository: NetworkGradeLinux/meta-mion-sde

repo_name: NetworkGradeLinux/meta-mion-sde

branch_name: refs/heads/dunfell


text:
@misc{android:sqlite,
	author = {{Android}},
	title = {{Storage Options: Using Databases}},
	howpublished = {\url{https://developer.android.com/guide/topics/data/data-storage.html#db}},
	year = {2016},
	note = {Accessed 29.05.2016}
}

@misc{android:sharedprefs,
	author = {{Android}},
	title = {{Storage Options: Using Shared Preferences}},
	howpublished = {\url{https://developer.android.com/guide/topics/data/data-storage.html#pref}},
	year = {2016},
	note = {Accessed 29.05.2016}
}

@misc{google:console,
	author = {{Google, Inc.}},
	title = {{Google APIs}},
	howpublished = {\url{https://developers.google.com/maps/documentation/android-api/start#step_4_get_a_google_maps_api_key}},
	year = {2016},
	note = {Accessed 29.05.2016}
}

@misc{facebook:started,
	author = {{Facebook, Inc.}},
	title = {{Sharing on Android: Prerequisites}},
	howpublished = {\url{https://developers.facebook.com/docs/sharing/android#prereqs}},
	year = {2016},
	note = {Accessed 29.05.2016}
}

@misc{mpcharts,
	author = {Jahoda, Philipp},
	title = {{MPAndroidChart}},
	howpublished = {\url{https://github.com/PhilJay/MPAndroidChart}},
	year = {2016},
	note = {Accessed 29.05.2016}
}

repository: racketometer/smap-report

repo_name: racketometer/smap-report


text:
SUMMARY = "A GNSS signal generator"
AUTHOR = "Javier Arribas <jarribas@cttc.es>"
HOMEPAGE = "https://bitbucket.org/jarribas/gnss-simulator/"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://COPYING;md5=31f43bdb1ab7b19dae6e891241ca0568"
PR = "r0"

DEPENDS = "volk boost armadillo gflags glog "

PV = "1.0.git"

SRCREV = "86dafacb8b86ce51006b5ecf48e791f5c8a9ed38"

# Make it easy to test against branches
GIT_BRANCH = "master"

SRC_URI = "git://bitbucket.org/jarribas/gnss-simulator.git;branch=${GIT_BRANCH};protocol=https "

S = "${WORKDIR}/git"

inherit cmake

PACKAGES = "gnss-simulator gnss-simulator-dbg"

FILES_${PN} = "${bindir}/gnss_sim \
  /usr/share/gnss-sim/* \
"

FILES_${PN}-dbg = " \
  /usr/bin/.debug/gnss_sim \
  /usr/src/debug/gnss-simulator/* \
"

do_rm_work() {
}

repository: mfkiwl/meta-gnss-sdr

repo_name: mfkiwl/meta-gnss-sdr


text:
@inproceedings{QianyinlongLearningIcip2016,
 abstract = {The major challenge of machine learning based image steganalysis lies in obtaining powerful feature representations. Recently, Qian et al. have shown that Convolutional Neural Network (CNN) is effective for learning features automatically for steganalysis. In this paper, we follow up this new paradigm in steganalysis, and propose a framework based on transfer learning to help the training of CNN for steganalysis, hence to achieve a better performance. We show that feature representations learned with a pre-trained CNN for detecting a steganographic algorithm with a high payload can be efficiently transferred to improve the learning of features for detecting the same steganographic algorithm with a low pay-load. By detecting representative WOW and S-UNIWARD steganographic algorithms, we demonstrate that the proposed scheme is effective in improving the feature learning in CNN models for steganalysis.},
 author = {Qian, Yinlong and Dong, Jing and Wang, Wei and Tan, Tieniu},
 booktitle = {2016 IEEE International Conference on Image Processing (ICIP)},
 doi = {10.1109/ICIP.2016.7532860},
 isbn = {9781467399616},
 issn = {15224880},
 month = {sep},
 pages = {2752--2756},
 publisher = {IEEE},
 title = {Learning and transferring representations for image steganalysis using convolutional neural network},
 url = {http://ieeexplore.ieee.org/document/7532860/},
 volume = {2016-Augus},
 year = {2016}
}


text:
package main

import "fmt"
import "os/user"
import "log"

func main() {
	fmt.Println("vim-go")
	u, _ := user.Current()
	log.Printf("Username ", u.Username, u.HomeDir)
}

repository: wangxiaobai-dd/MyRep

repo_name: wangxiaobai-dd/MyRep


text:
package checker

import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
	"reflect"
	"sync"
	"time"

	log "github.com/Sirupsen/logrus"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/gogo/protobuf/proto"
	"github.com/nsqio/go-nsq"
	"github.com/opsee/basic/schema"
	opsee "github.com/opsee/basic/service"
	"github.com/opsee/bastion/auth"
	"github.com/opsee/bastion/config"
	"github.com/opsee/bastion/heart"
	"github.com/satori/go.uuid"
	"golang.org/x/net/context"
	"google.golang.org/grpc"
)

const (
	// MaxTestTargets is the maximum number of test-check targets returned
	// from the resolver that we use.
	MaxTestTargets      = 5
	NumCheckSyncRetries = 11

	// BastionProtoVersion is used for feature flagging fields in various Bastion
	// message types that specify a version number.
	BastionProtoVersion = 2

	// Time to allow requests to read a response body.
	BodyReadTimeout = 10 * time.Second

	// Maximum length of response bodies
	MaxContentLength = 128000
)

var (
	metricsRegistry = heart.MetricsRegistry
)

// This is admittedly janky, but at the very least it gives us some reasonable
// and fast insight into what's going on.
//
// TODO(greg): This should really be handled in a more elegant manner--the number
// of possible error scenarios explodes as the number of components increases.
// So why not strictly define a small set of error types and then categorize all
// errors accordingly? Probably some simple exception classes for the bastion
// that those interacting with the bastion can code around. Until then, just
// fucking slap some shit together.

func handleError(err error) string {
	errMap := map[string]string{}
	switch e := err.(type) {
	default:
		errMap["type"] = "error"
		errMap["error"] = err.Error()
	case awserr.Error:
		errMap["type"] = "aws"
		errMap["code"] = e.Code()
		errMap["error"] = e.Error()
	case awserr.RequestFailure:
		errMap["type"] = "aws"
		errMap["code"] = e.Code()
		errMap["error"] = e.Message()
		errMap["requestId"] = e.RequestID()
	}

	errStr, mErr := json.Marshal(errMap)
	if mErr != nil {
		return `{"type": "error", "error": "cannot determine error"}`
	}
	log.WithFields(log.Fields{"service": "checker", "event": "handleError() error", "error": err}).Warn(string(errStr))

	return string(errStr)
}

// Interval is the frequency of check execution.

type Interval time.Duration

// RemoteRunner allows you to control a Runner process via NSQ and behaves similarly to the Runner.

type RemoteRunner struct {
	consumer   *nsq.Consumer
	producer   *nsq.Producer
	config     *NSQRunnerConfig
	requestMap map[string]chan *schema.CheckResult // TODO(greg): I really want NBHM for Golang. :(
	sync.RWMutex
}

// NewRemoteRunner configures the Runner and sets up the NSQ message handler.

func NewRemoteRunner(cfg *NSQRunnerConfig) (*RemoteRunner, error) {
	consumer, err := nsq.NewConsumer(cfg.ConsumerQueueName, cfg.ConsumerChannelName, nsq.NewConfig())
	log.WithFields(log.Fields{"channel": cfg.ConsumerChannelName, "queue": cfg.ConsumerQueueName}).Debug("Creating RemoteRunner consumer")
	if err != nil {
		log.WithError(err).Error("couldn't create new producer")
		return nil, err
	}
	producer, err := nsq.NewProducer(cfg.ProducerNsqdHost, nsq.NewConfig())
	if err != nil {
		log.WithError(err).Error("couldn't create new producer")
		return nil, err
	}

	log.WithFields(log.Fields{"queue": cfg.ProducerQueueName}).Debug("Creating RemoteRunner producer")

	r := &RemoteRunner{
		requestMap: make(map[string]chan *schema.CheckResult),
		consumer:   consumer,
		producer:   producer,
		config:     cfg,
	}
	consumer.AddConcurrentHandlers(nsq.HandlerFunc(func(m *nsq.Message) error {
		chk := &schema.CheckResult{}
		err := proto.Unmarshal(m.Body, chk)
		if err != nil {
			return err
		}

		log.WithFields(log.Fields{"channel": cfg.ConsumerChannelName, "queue": cfg.ConsumerQueueName}).Debugf("Consumed check id %s", chk.CheckId)

		var respChan chan *schema.CheckResult

		r.withLock(func() {
			respChan = r.requestMap[chk.CheckId]
			log.Debugf("found response channel for check id %s", chk.CheckId)
		})

		if respChan == nil {
			log.Debugf("response channel for check id %s is nil", chk.CheckId)
			return nil
		}

		// There is a 1:1 mapping of TestCheck calls to CheckResults, so we close
		// the channel here after writing, making it safe to delete the channel
		// once we've returned from RunCheck. We will incur a GC penalty for doing
		// this if the result is never read, but I think we can manage. It might be
		// nice to really understand what the cost of this approach is, but I don't
		// think it's particularly important. -greg
		respChan <- chk
		close(respChan)
		return nil
	}), cfg.MaxHandlers)

	err = consumer.ConnectToNSQD(cfg.ConsumerNsqdHost)
	if err != nil {
		log.WithError(err).Error("checker's NewRemoteRunner consumer failed to connect to nsqd")
		return nil, err
	}

	return r, nil
}

func (r *RemoteRunner) withLock(f func()) {
	log.Debug("Acquiring lock on RemoteRunner.")
	r.Lock()
	f()
	r.Unlock()
	log.Debug("Releasing lock on RemoteRunner.")
}

// RunCheck asynchronously executes the check and blocks waiting on the result. It's important to set a
// context deadline unless you want this to block forever.

func (r *RemoteRunner) RunCheck(ctx context.Context, checkWithTargets *schema.CheckTargets) (*schema.CheckResult, error) {
	chk := checkWithTargets.Check
	log.Debugf("RemoteRunner Running check %s", chk.String())

	var (
		id  string
		err error
	)
	if chk.Id == "" {
		id = uuid.NewV4().String()
		chk.Id = id
	} else {
		id = chk.Id
	}

	respChan := make(chan *schema.CheckResult, 1)

	r.withLock(func() {
		r.requestMap[id] = respChan
		log.Debugf("Set response channel for request: %s", id)
	})

	defer func() {
		r.withLock(func() {
			delete(r.requestMap, id)
			log.Debugf("deleted response channel for request: %s", id)
		})
	}()

	msg, err := proto.Marshal(checkWithTargets)
	if err != nil {
		log.WithError(err).Error("Failed to marshal checkwithtargets")
		return nil, err
	}

	log.Debug("Publishing request to run check")
	r.producer.Publish(r.config.ProducerQueueName, msg)

	select {
	case result := <-respChan:
		log.Debugf("Got result from response channel: %s", result.String())
		return result, nil
	case <-ctx.Done():
		log.WithError(ctx.Err()).Error("context error")
		return nil, ctx.Err()
	}
}

// Stop blocks until the NSQ consumer and producer are stopped.

func (r *RemoteRunner) Stop() {
	r.consumer.Stop()
	<-r.consumer.StopChan
	r.producer.Stop()
}

// Checker must:
//    - Add a check
//    - Delete a check
//    - Test a check
//    - Inform the scheduler that things need to happen

type Checker struct {
	Port       int
	Scheduler  *Scheduler
	grpcServer *grpc.Server
	Runner     *RemoteRunner
	resolver   Resolver
}

// NewChecker sets up the GRPC server for a Checker.

func NewChecker(r Resolver) *Checker {
	return &Checker{
		grpcServer: grpc.NewServer(),
		resolver:   r,
	}
}

func (c *Checker) invoke(ctx context.Context, cmd string, req *opsee.CheckResourceRequest) (*opsee.ResourceResponse, error) {
	responses := make([]*opsee.CheckResourceResponse, len(req.Checks))
	response := &opsee.ResourceResponse{
		Responses: responses,
	}
	for i, check := range req.Checks {
		in := []reflect.Value{reflect.ValueOf(check)}
		out := reflect.ValueOf(c.Scheduler).MethodByName(cmd).Call(in)
		checkResponse, ok := out[0].Interface().(*schema.Check)
		if !ok {
			err, ok := out[1].Interface().(error)
			if ok {
				if err != nil {
					responses[i] = &opsee.CheckResourceResponse{
						Error: err.Error(),
					}
				}
			}
		} else {
			responses[i] = &opsee.CheckResourceResponse{
				Id:    check.Id,
				Check: checkResponse,
			}
		}
	}
	return response, nil
}

// CreateCheck creates a check within a request context. It will return an error if there is any difficulty
// creating the check.

func (c *Checker) CreateCheck(ctx context.Context, req *opsee.CheckResourceRequest) (*opsee.ResourceResponse, error) {
	return c.invoke(ctx, "CreateCheck", req)
}

// RetrieveCheck retrieves an existing check within a request context. It will return an error if the check
// does not exist.

func (c *Checker) RetrieveCheck(ctx context.Context, req *opsee.CheckResourceRequest) (*opsee.ResourceResponse, error) {
	return c.invoke(ctx, "RetrieveCheck", req)
}

// UpdateCheck deletes and then recreates a check within a request context. It will return an error if there is
// a problem deleting or creating a check.

func (c *Checker) UpdateCheck(ctx context.Context, req *opsee.CheckResourceRequest) (*opsee.ResourceResponse, error) {
	c.invoke(ctx, "DeleteCheck", req)
	return c.invoke(ctx, "CreateCheck", req)
}

// DeleteCheck deletes a check within a request context. It will return an error if there is a problem
// deleting the check.

func (c *Checker) DeleteCheck(ctx context.Context, req *opsee.CheckResourceRequest) (*opsee.ResourceResponse, error) {
	return c.invoke(ctx, "DeleteCheck", req)
}

// TestCheck will synchronously* execute a check.
//
// A TestCheckResponse is returned if there are no request errors. If there are
// request-specific errors, then an error will be returned with no
// TestCheckResponse.
//
// "Request-specific errors" are defined as: - An unresolvable Check target.  -
// An unidentifiable Check type or Spec.
//
// * Synchronously in this case means that TestCheck blocks until a runner has
// returned a response via NSQ or the context deadline is exceeded.
//
// TODO(greg): Get this into the invoke() fold so that we can do a "middleware"
// ish pattern. to logging, instrumentation, etc.

func (c *Checker) TestCheck(ctx context.Context, req *opsee.TestCheckRequest) (*opsee.TestCheckResponse, error) {
	log.WithFields(log.Fields{"service": "checker", "event": "TestCheck"}).Info("Handling request: %v", req)

	if req.Deadline == nil {
		err := fmt.Errorf("Deadline required but missing in request. %v", req)
		log.WithFields(log.Fields{"service": "checker", "event": "TestCheck", "error": err.Error()}).Error("Missing deadline in request!")
		return nil, err
	}

	dlval, err := req.Deadline.Value()
	dl, _ := dlval.(time.Time)

	// We add the request deadline here, and the Runner will adhere to that
	// deadline.
	ctx, _ = context.WithDeadline(ctx, dl)
	deadline, _ := ctx.Deadline()
	log.WithFields(log.Fields{"service": "checker", "event": "TestCheck"}).Debug("TestCheck deadline is " + deadline.Sub(time.Now()).String() + " from now.")

	testCheckResponse := &opsee.TestCheckResponse{}
	checkWithTargets, err := NewCheckTargets(c.resolver, req.Check)
	if err != nil {
		return nil, err
	}
	result, err := c.Runner.RunCheck(ctx, checkWithTargets)
	// I hate this hot garbage. We have to do this because the Java
	// GRPC client will throw exceptions if we return errors via GRPC.
	// So, rather than dealing with exceptions on the bartnet side, we
	// just do this nonsense.
	if err != nil {
		return nil, err
	}

	responses := result.GetResponses()

	maxHosts := int(req.MaxHosts)
	if maxHosts == 0 {
		maxHosts = len(responses)
	}
	if maxHosts > len(responses) {
		maxHosts = len(responses)
	}

	testCheckResponse.Responses = responses[:maxHosts]

	log.Debugf("Response: %v", testCheckResponse)
	return testCheckResponse, nil
}

// GetExistingChecks will query the backend to retrieve all of the checks for
// this customer's bastion. It authenticates before retrieving the
// configuration.

func (c *Checker) GetExistingChecks(tries int) ([]*schema.Check, error) {
	cache := &auth.BastionAuthCache{Tokens: make(map[string]*auth.BastionAuthToken)}

	var checks = &opsee.CheckResourceRequest{}

	tokenType, err := auth.GetTokenTypeByString(config.GetConfig().BastionAuthType)
	if err != nil {
		return nil, err
	}

	getChecksURL := config.GetConfig().BartnetHost + "/checks/exgid/"
	if exgid := config.GetConfig().ExecutionGroupId; exgid != "" {
		getChecksURL += exgid
	} else {
		getChecksURL += config.GetConfig().CustomerId
	}

	request := &auth.BastionAuthTokenRequest{
		TokenType:      tokenType,
		CustomerEmail:  config.GetConfig().CustomerEmail,
		CustomerID:     config.GetConfig().CustomerId,
		TargetEndpoint: getChecksURL,
		AuthEndpoint:   config.GetConfig().BastionAuthEndpoint,
	}

	if token, err := cache.GetToken(request); err != nil || token == nil {
		log.WithFields(log.Fields{"service": "checker", "Error": err.Error()}).Fatal("Error initializing BastionAuth")
		return nil, err
	} else {
		theauth, header := token.AuthHeader()
		log.WithFields(log.Fields{"service": "checker", "Auth header:": theauth + " " + header}).Info("Synchronizing checks")
		success := false

		for i := 0; i < tries; i++ {
			req, err := http.NewRequest("GET", request.TargetEndpoint, nil)
			if err != nil {
				log.WithFields(log.Fields{"service": "checker", "error": err}).Warn("Couldn't create request to fetch checks.")
			} else {
				req.Header.Set("Accept", "application/x-protobuf")
				req.Header.Set(theauth, header)

				timeout := time.Duration(10 * time.Second)
				client := &http.Client{
					Timeout: timeout,
				}
				resp, err := client.Do(req)
				if err != nil {
					if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
						log.WithError(netErr).Error("Couldn't fetch checks. Dial Timed out.")
					} else if opError, ok := err.(*net.OpError); ok {
						if opError.Op == "dial" {
							log.WithError(netErr).Error("Couldn't sync checks. %s is Unknown Host. Exiting.", request.TargetEndpoint)
							break
						} else if opError.Op == "read" {
							log.WithError(netErr).Errorf("Couldn't fetch checks. Connection to %s Refused.", request.TargetEndpoint)
						}
					} else {
						log.WithError(err).Errorf("Couldn't fetch checks. Failed to connect to %s.", request.TargetEndpoint)
					}
					goto SLEEP
				} else {
					defer resp.Body.Close()
					body, _ := ioutil.ReadAll(resp.Body)
					if err := proto.Unmarshal(body, checks); err != nil {
						log.WithFields(log.Fields{"service": "checker", "error": err, "response": resp}).Error("Couldn't fetch checks.")
						goto SLEEP
					}

					if resp.StatusCode != http.StatusOK {
						err = errors.New("Non-200 response while fetching checks.")
						log.WithFields(log.Fields{"service": "checker", "error": err, "response": resp}).Error("Couldn't sychronize checks.")
						goto SLEEP
					}

					log.Debug("Got existing checks ", checks)
					success = true
					break
				}
			}
		SLEEP:
			time.Sleep((1 << uint(i)) * time.Millisecond * 10)
		}
		if !success {
			return nil, fmt.Errorf("Couldn't fetch existing checks.")
		}
	}

	return checks.Checks, nil
}

func (c *Checker) synchronizeChecks() error {
	log.Debug("Synchronizing checks with Opsee.")
	// Now Get existing checks from bartnet
	existingChecks, err := c.GetExistingChecks(NumCheckSyncRetries)
	if err != nil {
		return err
	}
	for _, check := range existingChecks {
		c.Scheduler.CreateCheck(check)
	}
	return nil
}

// Start all of the checker loops, grpc server, etc.
func (c *Checker) Start() error {
	listen, err := net.Listen("tcp", fmt.Sprintf(":%d", c.Port))
	if err != nil {
		return err
	}

	// Start the scheduler so that we immediately begin consuming from the run chan
	// otherwise we could fill up that chan and block
	if err := c.Scheduler.Start(); err != nil {
		return err
	}

	log.Debug("Getting existing checks")
	err = c.synchronizeChecks()
	if err != nil {
		log.WithError(err).Fatal("Couldn't retrieve existing checks from server.")
	}

	// Now start and register the GRPC server and allow users to create/edit/etc checks
	go c.grpcServer.Serve(listen)
	opsee.RegisterCheckerServer(c.grpcServer, c)

	return nil
}

// Stop all of the checker loops, grpc server, etc.
func (c *Checker) Stop() {
	c.Runner.Stop()
	c.grpcServer.Stop()
	c.Scheduler.Stop()
}

repository: opsee/bastion

repo_name: opsee/bastion


text:
SUMMARY = "PROJ.4 - Cartographic Projections library"
HOMEPAGE = "http://trac.osgeo.org/proj/"
SECTION = "libs"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=74d9aaec5fa0cd734341e8c4dc91b608"

SRC_URI = "http://download.osgeo.org/${BPN}/${BP}.tar.gz"
SRC_URI[md5sum] = "5cde556545828beaffbe50b1bb038480"
SRC_URI[sha256sum] = "b300c0f872f632ad7f8eb60725edbf14f0f8f52db740a3ab23e7b94f1cd22a50"

DEPENDS = "sqlite3 sqlite3-native"

inherit autotools pkgconfig lib_package

FILES_${PN} += "${datadir}/proj"


text:
@Misc{quotation:web,
  author = "Norbert Slivka",
  title = "Porovnanie programovacích jazykov",
  howpublished = "online",
  cited = "!2014-04-16",
  url = "http://www.gjgt.sk/digitalna_studovna/informatika/2013/15.pdf",
}

@Misc{List:Wiki,
  author = "Wikipedia",
  title = "List of programming languages",
  howpublished = "online",
  revised = "rev. 11. apríla 2017",
  cited = "!2017-04-14",
  url = "https://en.wikipedia.org/wiki/List_of_programming_languages",
}

@Book{Generation:Book,
  author = "Kedar, S. and Thakare, S.",
  title = "Principles of Programming Languages",
  publisher = "Technical Publications",
  year = "2009",
  edition = "4",
  address = "Pune",
  isbn = "9788184315776",
}

@Inproceedings{Dynamic:Book,
  author = "Shields, Mark and Sheard, Tim and Peyton Jones, Simon",
  title = "Dynamic Typing As Staged Type Inference",
  booktitle = "Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages",
  pages = "289--302",
  series = "POPL '98",
  address = "New York, NY, USA",
  publisher = "ACM",
  year = "1998",
  isbn = "0-89791-979-3",
}

@Book{Introduction:Book,
  author= "Bansal, A.K.",
  title= "Introduction to Programming Languages",
  publisher= "Taylor \& Francis",
  year= "2013",
  address= "Boca Raton, Florida",
  edition= "ilustrované vydanie",
  isbn= "9781466565142",
}

@Article{C:Journal,
  author= "Ryan, R. R. and Spiller, H.",
  title= "The C Programming Language and a C Compiler",
  journal= "IBM Syst. J.",
  year= "1985",
  number= "1",
  volume= "24",
  pages= "37--48",
  issn= "0018-8670",
}

@Article{Motivation:article,
 author = "Curzon, Paul and Rix, Janet",
 title = "Why Do Students Take Programming Modules?",
 journal = "SIGCSE Bull.",
 volume = "30",
 number = "3",
 year = "1998",
 issn = "0097-8418",
 pages = "59--63",
}

@Misc{ANSI:web,
  author = "Vineet Choudhary",
  title = "C Programming Language Version History",
  howpublished = "online",
  cited = "!2014-04-15",
  url = "http://www.developerinsider.in/c-programming-language-version-history",
}

@MasterThesis{Master:tesis,
  author = "Patrick Camphuijsen",
  title = "Soft typing and analyses on PHP programs",
  school = "Universiteit Utrecht",
  address = "Utrecht",
  year = "2007",
}

@MasterThesis{Master1:tesis,
  author = "Frank Westland",
  title = "Teaching Strategies for Programming Languages",
  school = "Tilburg University",
  address = "Tilburg",
  year = "2013",
  url = "http://arno.uvt.nl/show.cgi?fid=132016",
}