text:
DESCRIPTION = "Samsung-Patched SDL-Library for Chelsea Platform"
HOMEPAGE = "http://www.samsung.com/global/opensource/files"
SECTION = "libs"
LICENSE = "GPL/Samsung/Yahoo"
PV ="1.2.11"
PR = "r03"

PROVIDES = "virtual/libsdl virtual/libx11"

SRC_URI = "${SAMSUNG_OS_MIRROR}/32B650.zip \
		file://sdl-config \
		file://sdl.m4 \
"
SRC_URI_sh4 = "${SAMSUNG_OS_MIRROR}/SDL-1.2.11.zip \
		file://sdl-config \
                file://sdl.m4 \
"

INHIBIT_PACKAGE_STRIP = "1"

LEAD_SONAME = "libSDL.so"

inherit pckgconfig autotools

S = "${WORKDIR}"

do_unpack2() {
	if [ ${TARGET_ARCH} == "arm" ] ; then
	unzip -o -q ${WORKDIR}/SDL-${PV}.zip -d ${WORKDIR}/
        cd ${WORKDIR}
        rm -rf "*.tgz" "*.zip" "SELP*" || true
        # Branding
	fi
}

addtask unpack2 before do_patch after do_unpack

do_stage_arm () {
	oe_libinstall -so -C Lib/CHELSEA libSDL ${STAGING_LIBDIR}/
	install -d ${STAGING_INCDIR}/SDL
	install -m 0644 include/*.h ${STAGING_INCDIR}/SDL
        install -m 0644 src/video/SDL_sysvideo.h ${STAGING_INCDIR}/SDL/
        install -m 0644 src/video/SDL_glfuncs.h ${STAGING_INCDIR}/SDL/

echo "#!/bin/sh

prefix=${STAGING_LIBDIR}/..
exec_prefix=${STAGING_LIBDIR}/..
exec_prefix_set=no
" >> sdl-config.tmp
	cat sdl-config >> sdl-config.tmp
	mv sdl-config.tmp sdl-config
	install sdl.m4 ${STAGING_DATADIR}/aclocal/
	install -m 755 sdl-config ${STAGING_BINDIR}/sdl-config-${HOST_SYS}
}

do_install_arm () {
	install -d ${D}/lib
        install Lib/CHELSEA/libSDL.so ${D}/lib/
}

do_configure_sh4 () {
	cp -fv Makefile.STI Makefile
	perl -pi -e "s/OP_Product\/Engine\/SDL\/SDL-1.2.11//" Makefile
	perl -pi -e "s/CROSS_COMPILE = .*/CROSS_COMPILE = ${TARGET_PREFIX}/" Makefile
	mkdir -p GEngine/Porting/Inc
	mkdir -p fake/AP_Yahoo/SDL_HWAcceleration/Chelsea/Inc
	echo "void VideoClose(void);" > GEngine/Porting/Inc/GPlayerPorting.h
	echo "/* Dummy */" > fake/AP_Yahoo/SDL_HWAcceleration/Chelsea/Inc/YahooSDLHWAcceleration.h
	echo "/* Dummy */" > YahooSDLHWAcceleration.h
	mkdir lib_STI
	rm -f src/*.o
	rm -f src/*/*.o
	rm -f src/*/*/*.o
}

do_compile_sh4 () {
        oe_runmake COMP_DIR=${S} OPENSOURCE_DIR=${S}
}

do_install_sh4(){
        install -d ${D}/lib
        install lib_STI/libSDL.so ${D}/lib/
}

do_stage_sh4 () {
        ls -l
        oe_libinstall -so -C lib_STI libSDL ${STAGING_LIBDIR}/
        mkdir -p ${STAGING_INCDIR}/SDL
        cp -a include/*.h ${STAGING_INCDIR}/SDL
	install src/video/SDL_sysvideo.h ${STAGING_INCDIR}/SDL/
        install src/video/SDL_glfuncs.h ${STAGING_INCDIR}/SDL/

echo "#!/bin/sh

prefix=${STAGING_LIBDIR}/..
exec_prefix=${STAGING_LIBDIR}/..
exec_prefix_set=no
" >> sdl-config.tmp
        cat sdl-config >> sdl-config.tmp
        mv sdl-config.tmp sdl-config
        install sdl.m4 ${STAGING_DATADIR}/aclocal/
        # install -m 755 sdl-config ${STAGING_BINDIR}/
        install -m 755 sdl-config ${STAGING_BINDIR}/sdl-config-${HOST_SYS}
}

do_configure () {
	:
}

do_compile () {
	:
}

do_install () {
	:
}

do_stage () {
	:
}

repository: metalsky/SamyGO

repo_name: metalsky/SamyGO


text:
/*
 * Sample API
 *
 * A short description of API.
 *
 * API version: 1.0.0
 * Contact: support@example.com
 * Generated by: OpenAPI Generator (https://openapi-generator.tech)
 */

package usersapi

type Country int32

// List of Country
const (
	UNKNOWN_COUNTRY Country = 0
	US Country = 1
	JP Country = 2
)

license: MIT

repository: xshoji/go-rest-openapi

license_type: permissive

repo_name: xshoji/go-rest-openapi

branch_name: refs/heads/master

extension: go


text:
DESCRIPTION = "Helper utilities for flatpak-based applications/services."
HOMEPAGE = "http://github.com/klihub/flatpak-utils"
LICENSE = "BSD-3-Clause"

LIC_FILES_CHKSUM = "file://LICENSE-BSD;md5=f9f435c1bd3a753365e799edf375fc42"

DEPENDS = "flatpak systemd"

SRC_URI = " \
    file://flatpak-utils \
  "

inherit autotools pkgconfig requires-systemd

AUTO_LIBNAME_PKGS = ""

S = "${WORKDIR}/flatpak-utils"

EXTRA_OECONF += "--with-systemdunitdir=${systemd_unitdir}"

FILES_${PN} = "\
    ${systemd_unitdir}/system-generators/flatpak-session-enable \
    ${bindir}/flatpak-session \
    ${libexecdir}/flatpak-utils \
    ${systemd_unitdir}/system/flatpak-sessions.target \
    ${systemd_unitdir}/system/flatpak-session@.service \
    ${systemd_unitdir}/system/flatpak-update.service \
"

FILES_${PN}-dbg =+ "${base_libdir}/systemd/system-generators/.debug"

SYSTEMD_PACKAGES      += "${PN}"
SYSTEMD_SERVICE_${PN}  = "flatpak-sessions.target flatpak-update.service"

repository: intel/intel-iot-refkit

repo_name: intel/intel-iot-refkit

gha_license_id: MIT

gha_language: Python

extension: bb


text:
inherit pypi setuptools
require python-azure-cli-vm.inc

RDEPENDS_${PN} += "\
    ${PYTHON_PN}-codecs \
"

RDEPENDS_${PN} += "\
    ${PYTHON_PN}-enum34 \
    ${PYTHON_PN}-futures \
"

repository: DasRoteSkelett/meta-iot-cloud

repo_name: DasRoteSkelett/meta-iot-cloud


text:
SECTION = "devel/chicken"
DESCRIPTION = "Sources of Random Bits"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://srfi-27.meta;md5=9692d3f0fdbe1851292211c0a71b6f04"
DEPENDS_append_class-cross = " chicken-egg-setup-helper-cross chicken-egg-check-errors-cross chicken-egg-timed-resource-cross chicken-egg-thread-utils-cross chicken-egg-miscmacros-cross chicken-egg-vector-lib-cross chicken-egg-numbers-cross chicken-egg-synch-cross"
DEPENDS_append_class-crosssdk = " chicken-egg-setup-helper-crosssdk chicken-egg-check-errors-crosssdk chicken-egg-timed-resource-crosssdk chicken-egg-thread-utils-crosssdk chicken-egg-miscmacros-crosssdk chicken-egg-vector-lib-crosssdk chicken-egg-numbers-crosssdk chicken-egg-synch-crosssdk"
DEPENDS_append_class-nativesdk = " nativesdk-chicken-egg-setup-helper nativesdk-chicken-egg-check-errors nativesdk-chicken-egg-timed-resource nativesdk-chicken-egg-thread-utils nativesdk-chicken-egg-miscmacros nativesdk-chicken-egg-vector-lib nativesdk-chicken-egg-numbers nativesdk-chicken-egg-synch chicken-egg-setup-helper-crosssdk chicken-egg-check-errors-crosssdk chicken-egg-timed-resource-crosssdk chicken-egg-thread-utils-crosssdk chicken-egg-miscmacros-crosssdk chicken-egg-vector-lib-crosssdk chicken-egg-numbers-crosssdk chicken-egg-synch-crosssdk"
DEPENDS = " chicken-egg-setup-helper chicken-egg-check-errors chicken-egg-timed-resource chicken-egg-thread-utils chicken-egg-miscmacros chicken-egg-vector-lib chicken-egg-numbers chicken-egg-synch chicken-egg-setup-helper-cross chicken-egg-check-errors-cross chicken-egg-timed-resource-cross chicken-egg-thread-utils-cross chicken-egg-miscmacros-cross chicken-egg-vector-lib-cross chicken-egg-numbers-cross chicken-egg-synch-cross chicken-egg-srfi-27-cross"
RDEPENDS_${PN} = " chicken-egg-setup-helper chicken-egg-check-errors chicken-egg-timed-resource chicken-egg-thread-utils chicken-egg-miscmacros chicken-egg-vector-lib chicken-egg-numbers chicken-egg-synch"

SRC_URI = "http://code.call-cc.org/egg-tarballs/4/srfi-27/srfi-27-${PV}.tar.gz"

SRC_URI[md5sum] = "5aa89b835027c08aa9b6eafeea8d57cf"
SRC_URI[sha256sum] = "72ab1527446df0c78dd64595e4274c1b29ca90647d3778ee4bd52dcdb561eedf"

S = "${WORKDIR}/srfi-27-${PV}"

inherit chicken_install

BBCLASSEXTEND = "cross crosssdk nativesdk"

repository: OSSystems/meta-chicken

repo_name: OSSystems/meta-chicken


text:
@inproceedings{messina-etal-2021-dissemination,
    title = "A dissemination workshop for introducing young {I}talian students to {NLP}",
    author = "Messina, Lucio  and
      Busso, Lucia  and
      Combei, Claudia Roberta  and
      Miaschi, Alessio  and
      Pannitto, Ludovica  and
      Sarti, Gabriele  and
      Nissim, Malvina",
    booktitle = "Proceedings of the Fifth Workshop on Teaching NLP",
    month = jun,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2021.teachingnlp-1.7",
    pages = "52--54",
    abstract = "We describe and make available the game-based material developed for a laboratory run at several Italian science festivals to popularize NLP among young students.",
}

repository: ellepannitto/my-website

repo_name: ellepannitto/my-website

extension: bib


text:
@article{mah2013evaluation,
 author = {Mah, Jean K and Warner, Janet and Hall, Ruth and Smith, Eric E and Steeves, Thomas and Donner, Elizabeth and Marriott, James and Johnston, Megan and Lowerison, Mark and De Robles, Paula and others},
 journal = {Canadian Journal of Neurological Sciences},
 number = {S2},
 pages = {S60--S61},
 publisher = {Cambridge University Press},
 title = {Evaluation of neurological patient registries},
 volume = {40},
 year = {2013}
}


text:
SUMMARY = "Widgets for Baloo"
LICENSE = "GPL-2.0-only & GPL-3.0-only & LGPL-2.0-only & LGPL-2.0-only & LGPL-2.0-or-later & LGPL-2.1-only & LGPL-2.1-or-later & LGPL-3.0-only"
LIC_FILES_CHKSUM = " \
    file://LICENSES/GPL-2.0-only.txt;md5=9e2385fe012386d34dcc5c9863070881 \
    file://LICENSES/GPL-3.0-only.txt;md5=49fc03046e56a282c0c743b5d3a55b7c \
    file://LICENSES/LGPL-2.0-only.txt;md5=da48810c4ddf8e49efa031294a26b98c \
    file://LICENSES/LGPL-2.0-or-later.txt;md5=da48810c4ddf8e49efa031294a26b98c \
    file://LICENSES/LGPL-2.1-only.txt;md5=147a320ed8b16b036829a0c71d424153 \
    file://LICENSES/LGPL-2.1-or-later.txt;md5=147a320ed8b16b036829a0c71d424153 \
    file://LICENSES/LGPL-3.0-only.txt;md5=8d51f5b5fd447f7a1040c3dc9f0a8de6 \
"

inherit kde-apps gettext

DEPENDS += "\
    kauth-native \
    kconfig-native \
    kcoreaddons-native \
    kio \
    ki18n \
    kservice \
    kfilemetadata \
    baloo \
"

PV = "${KDE_APP_VERSION}"
SRC_URI[sha256sum] = "0baabcbf277a56f4d7b1fb8f7aff2bddf77d1261bbabd6b717c0d26d2929db5a"

FILES:${PN} += " \
    ${datadir}/kservices5 \
    ${OE_QMAKE_PATH_PLUGINS} \
"


text:
require ${PN}.inc

PR = "r1"

SRC_URI = "http://sources.openembedded.org/opie-1.2.4-split_core_applets_volumeapplet.tar.bz2;name=split_core_applets_volumeapplet \
           http://sources.openembedded.org/opie-1.2.4-split_apps.tar.bz2;name=split_apps"
SRC_URI[split_core_applets_volumeapplet.md5sum] = "5aa2d73a3ec24ff3084ab9357c3374c9"
SRC_URI[split_core_applets_volumeapplet.sha256sum] = "52ca512ff13497506e53c3a551a662a679b6326c97da7f411f6f97645cb926a3"
SRC_URI[split_apps.md5sum] = "67a43e8e4bcd9e63b884ea25deea5b34"
SRC_URI[split_apps.sha256sum] = "a33a55efb4ae4c15a8c2c5d6faba6d671a5652da8e216ce35088896fe597215b"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD


text:
$(document).ready(function(){
  var imgheight = $('.imgarea').height();
  $('.textarea').css('margin-top', imgheight/4);

  $('.front-container').css("margin-top", ( $(window).height() - $('.front-container').height() ) / 2  + "px");

  $('img#snovimgodom').click(function(){
    $('#countdown').addClass('completed');
    $('#interactive-snow').hide();
    $('#fireworks').show();
    $('audio')[0].play();
    $('.gamelink').show('slow');
  });
});

repository: benjyring/snovimgodom

repo_name: benjyring/snovimgodom

extension: js


text:
MACRO(EXTRACT_CPP_AND_LIB_FILES)
  #recover cpp files to be compiled
  SET(object_files)
  SET(libstolinkwith)
  FOREACH(it ${ARGN})
    IF(${it} MATCHES ".*\\.cpp$")
      SET(object_files ${object_files} "${it}")
    ELSE(${it} MATCHES ".*\\.cpp$")
      SET(libstolinkwith ${libstolinkwith} "${it}")
    ENDIF(${it} MATCHES ".*\\.cpp$")
  ENDFOREACH(it)
ENDMACRO(EXTRACT_CPP_AND_LIB_FILES)

MACRO(ADD_SWIG_CGAL_LIBRARY libname)
  include_directories(${CMAKE_CURRENT_SOURCE_DIR})
  include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${COMMON_LIBRARIES_PATH}")
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${COMMON_LIBRARIES_PATH}")
  EXTRACT_CPP_AND_LIB_FILES(${ARGN})
  add_library(${libname} SHARED ${object_files})
  target_link_libraries(${libname} ${libstolinkwith})
  install (TARGETS ${libname} RUNTIME DESTINATION bin
                              LIBRARY DESTINATION lib${LIB_SUFFIX}
                              ARCHIVE DESTINATION lib${LIB_SUFFIX})
ENDMACRO()

MACRO(ADD_SWIG_CGAL_JAVA_MODULE packagename)

  if (BUILD_JAVA AND JAVA_INCLUDE_PATH)
    SET (MODULENAME "CGAL_${packagename}")
    SET (INTERFACE_FILES  "CGAL_${packagename}.i")
    SET (JAVAPACKAGENAME "CGAL.${packagename}")
    SET (JAVABUILDPATH "${JAVA_OUTDIR_PREFIX}/CGAL/${packagename}")
    SET (SWIGCGAL_NO_FINALIZE_FOR_${packagename} OFF
         CACHE BOOL "Indicates if finalize() method in generated class should be removed in package ${packagename}")
    if(SWIGCGAL_NO_FINALIZE_FOR_${packagename})
      message(STATUS "${packagename}: No `finalize()` method will be generated for this package. `delete()` must be called explicitely")
      SET(CMAKE_SWIG_EXTRA_FLAGS -DSWIG_CGAL_NO_FINALIZE)
    endif()

    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
    INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../include)

    #recover cpp files to be compiled
    EXTRACT_CPP_AND_LIB_FILES(${ARGN})

    SET_SOURCE_FILES_PROPERTIES(${INTERFACE_FILES} PROPERTIES CPLUSPLUS ON)

    #Build bindings for java
    INCLUDE_DIRECTORIES(BEFORE ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
    LINK_DIRECTORIES(${JAVALIBPATH})
    SET (CMAKE_SWIG_OUTDIR ${JAVABUILDPATH})
    if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../User_packages/${packagename}/extensions.i")
      SET(CMAKE_SWIG_FLAGS -package ${JAVAPACKAGENAME} -DSWIG_CGAL_${packagename}_MODULE -DSWIG_CGAL_HAS_${packagename}_USER_PACKAGE ${CMAKE_SWIG_EXTRA_FLAGS})
    else()
      SET(CMAKE_SWIG_FLAGS -package ${JAVAPACKAGENAME} -DSWIG_CGAL_${packagename}_MODULE ${CMAKE_SWIG_EXTRA_FLAGS})
    endif()
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${JAVALIBPATH})
    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${JAVALIBPATH})
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${JAVALIBPATH})
    if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
      SWIG_ADD_MODULE(${MODULENAME} java ${INTERFACE_FILES} ${object_files})
    else()
      SWIG_ADD_LIBRARY(${MODULENAME} LANGUAGE java SOURCES ${INTERFACE_FILES} ${object_files})
    endif()
    #link all modules with CGAL_Java_cpp as many if not all need it for the iterators for example
    SWIG_LINK_LIBRARIES(${MODULENAME} ${libstolinkwith} CGAL_Java_cpp)
  endif()
ENDMACRO(ADD_SWIG_CGAL_JAVA_MODULE)

MACRO(ADD_SWIG_CGAL_PYTHON_MODULE packagename)
  SET (MODULENAME "CGAL_${packagename}")
  SET (INTERFACE_FILES  "CGAL_${packagename}.i")

  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
  INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../include)

  #recover cpp files to be compiled
  EXTRACT_CPP_AND_LIB_FILES(${ARGN})

  SET_SOURCE_FILES_PROPERTIES(${INTERFACE_FILES} PROPERTIES CPLUSPLUS ON)

  #Build bindings for python
  if(PYTHONLIBS_FOUND)
    INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
    SET (CMAKE_SWIG_OUTDIR "${PYTHON_OUTDIR_PREFIX}/CGAL")
    if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../User_packages/${packagename}/extensions.i")
      SET(CMAKE_SWIG_FLAGS  -DSWIG_CGAL_${packagename}_MODULE -DSWIG_CGAL_HAS_${packagename}_USER_PACKAGE)
    else()
      SET(CMAKE_SWIG_FLAGS  -DSWIG_CGAL_${packagename}_MODULE)
    endif()
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PYTHON_OUTDIR_PREFIX}/CGAL")
    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PYTHON_OUTDIR_PREFIX}/CGAL")
    SET(CMAKE_MODULE_OUTPUT_DIRECTORY "${PYTHON_OUTDIR_PREFIX}/CGAL")
    if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
      SWIG_ADD_MODULE(${MODULENAME} python ${INTERFACE_FILES} ${object_files})
    else()
      SWIG_ADD_LIBRARY(${MODULENAME} LANGUAGE python SOURCES ${INTERFACE_FILES} ${object_files})
    endif()
    SWIG_LINK_LIBRARIES(${MODULENAME} ${libstolinkwith})
    if ( LINK_PYTHON_LIBRARY )
      swig_link_libraries ( ${MODULENAME} ${PYTHON_LIBRARIES} )
    endif ()
    install (FILES ${PYTHON_OUTDIR_PREFIX}/CGAL/${MODULENAME}.py DESTINATION ${PYTHON_MODULE_PATH}/CGAL)
    install (TARGETS ${SWIG_MODULE_${MODULENAME}_REAL_NAME} DESTINATION ${PYTHON_MODULE_PATH}/CGAL)
  endif()
ENDMACRO(ADD_SWIG_CGAL_PYTHON_MODULE)

MACRO(ADD_SWIG_CGAL_RUBY_MODULE packagename)
  SET (MODULENAME "CGAL_${packagename}")
  SET (INTERFACE_FILES  "CGAL_${packagename}.i")

  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
  INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../include)

  #recover cpp files to be compiled
  EXTRACT_CPP_AND_LIB_FILES(${ARGN})

  SET_SOURCE_FILES_PROPERTIES(${INTERFACE_FILES} PROPERTIES CPLUSPLUS ON)

  #Build bindings for ruby
  if(RUBY_FOUND)
    INCLUDE_DIRECTORIES(${RUBY_INCLUDE_PATH})
    SET (CMAKE_SWIG_OUTDIR "${RUBY_OUTDIR_PREFIX}/CGAL")
    if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../User_packages/${packagename}/extensions.i")
      SET(CMAKE_SWIG_FLAGS  -DSWIG_CGAL_${packagename}_MODULE -DSWIG_CGAL_HAS_${packagename}_USER_PACKAGE)
    else()
      SET(CMAKE_SWIG_FLAGS  -DSWIG_CGAL_${packagename}_MODULE)
    endif()
    SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${RUBY_OUTDIR_PREFIX}/CGAL")
    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${RUBY_OUTDIR_PREFIX}/CGAL")
    SET(CMAKE_MODULE_OUTPUT_DIRECTORY "${RUBY_OUTDIR_PREFIX}/CGAL")
    if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
      SWIG_ADD_MODULE(${MODULENAME} ruby ${INTERFACE_FILES} ${object_files})
    else()
      SWIG_ADD_LIBRARY(${MODULENAME} LANGUAGE ruby SOURCES ${INTERFACE_FILES} ${object_files})
    endif()
    SET_TARGET_PROPERTIES(${SWIG_MODULE_${MODULENAME}_REAL_NAME} PROPERTIES PREFIX "")

    SWIG_LINK_LIBRARIES(${MODULENAME} ${libstolinkwith} ${RUBY_LIBRARY})
  endif()
ENDMACRO(ADD_SWIG_CGAL_RUBY_MODULE)

repository: sciencectn/cgal-bindings

repo_name: sciencectn/cgal-bindings

extension: cmake


text:
/*
Copyright 2021 The Vitess 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 planbuilder

import (
	"vitess.io/vitess/go/vt/sqlparser"
	"vitess.io/vitess/go/vt/vterrors"
	"vitess.io/vitess/go/vt/vtgate/engine"
	"vitess.io/vitess/go/vt/vtgate/planbuilder/plancontext"
	"vitess.io/vitess/go/vt/vtgate/semantics"
)

type concatenate struct {
	sources []logicalPlan

	// These column offsets do not need to be typed checked - they usually contain weight_string()
	// columns that are not going to be returned to the user
	noNeedToTypeCheck []int
}

var _ logicalPlan = (*concatenate)(nil)

// WireupGen4 implements the logicalPlan interface
func (c *concatenate) Wireup(ctx *plancontext.PlanningContext) error {
	for _, source := range c.sources {
		err := source.Wireup(ctx)
		if err != nil {
			return err
		}
	}
	return nil
}

// Primitive implements the logicalPlan interface
func (c *concatenate) Primitive() engine.Primitive {
	var sources []engine.Primitive
	for _, source := range c.sources {
		sources = append(sources, source.Primitive())
	}

	return engine.NewConcatenate(sources, c.noNeedToTypeCheck)
}

// Rewrite implements the logicalPlan interface
func (c *concatenate) Rewrite(inputs ...logicalPlan) error {
	if len(inputs) != len(c.sources) {
		return vterrors.VT13001("concatenate: wrong number of inputs")
	}
	c.sources = inputs
	return nil
}

// ContainsTables implements the logicalPlan interface
func (c *concatenate) ContainsTables() semantics.TableSet {
	var tableSet semantics.TableSet
	for _, source := range c.sources {
		tableSet = tableSet.Merge(source.ContainsTables())
	}
	return tableSet
}

// Inputs implements the logicalPlan interface
func (c *concatenate) Inputs() []logicalPlan {
	return c.sources
}

// OutputColumns implements the logicalPlan interface
func (c *concatenate) OutputColumns() []sqlparser.SelectExpr {
	return c.sources[0].OutputColumns()
}

repository: vitessio/vitess

repo_name: vitessio/vitess

branch_name: refs/heads/main

gha_language: Go


text:
DESCRIPTION = "This module provide a few functions that traverse their argument and \
produces a string as its result. The string contains Perl code that, \
when \
\"eval\"ed, produces a deep copy of the original arguments."

SECTION = "libs"
LICENSE = "Artistic-1.0 | GPL-2.0"
PR = "r0"

MAINTAINER=	"Poky <poky@yoctoproject.org>"
HOMEPAGE=	"https://metacpan.org/release/Data-Dump"

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"

SRC_URI = "https://cpan.metacpan.org/authors/id/G/GA/GAAS/Data-Dump-1.23.tar.gz"

SRC_URI[md5sum] = "762c111e525c82ff23d62c90821b26e9"
SRC_URI[sha256sum] = "af53b05ef1387b4cab4427e6789179283e4f0da8cf036e8db516ddb344512b65"

S = "${WORKDIR}/Data-Dump-${PV}"

inherit cpan

do_compile() {
	export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')"
	cpan_do_compile
}

BBCLASSEXTEND = "native"

repository: CELLINKAB/meta-cpan

repo_name: CELLINKAB/meta-cpan


text:
package main

import (
	"os"
	"os/exec"

	"github.com/gonuts/commander"
	"github.com/gonuts/flag"
)

func hwaf_make_cmd_waf() *commander.Command {
	cmd := &commander.Command{
		Run:       hwaf_run_cmd_waf,
		UsageLine: "waf",
		Short:     "run waf itself",
		Long: `
waf runs the waf binary.

ex:
 $ hwaf waf
 $ hwaf waf --help
`,
		Flag:        *flag.NewFlagSet("hwaf-waf", flag.ExitOnError),
		CustomFlags: true,
	}
	return cmd
}

func hwaf_run_cmd_waf(cmd *commander.Command, args []string) {
	var err error
	//n := "hwaf-" + cmd.Name()

	waf, err := g_ctx.WafBin()
	handle_err(err)

	if len(args) == 1 && args[0] == "build+install" {
		sub := exec.Command(waf, "build", "--notests")
		sub.Stdin = os.Stdin
		sub.Stdout = os.Stdout
		sub.Stderr = os.Stderr
		err = sub.Run()
		handle_err(err)

		sub = exec.Command(waf, "install")
		sub.Stdin = os.Stdin
		sub.Stdout = os.Stdout
		sub.Stderr = os.Stderr
		err = sub.Run()
		handle_err(err)

		return
	}
	subargs := append([]string{}, args...)
	sub := exec.Command(waf, subargs...)
	sub.Stdin = os.Stdin
	sub.Stdout = os.Stdout
	sub.Stderr = os.Stderr
	err = sub.Run()
	handle_err(err)
}

// EOF

repository: ChrisArnault/hwaf

repo_name: ChrisArnault/hwaf


text:
DESCRIPTION = "Vala meets the Enlightenment Foundation Libraries"
AUTHOR = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>"
LICENSE = "LGPL"
SECTION = "devel"
DEPENDS = "vala-native glib-2.0 dbus dbus-glib eina eet evas ecore edje elementary"
PV = "0.5.0+svnr${SRCPV}"
PR = "r1"
PE = "1"
SRCREV = "${EFL_SRCREV}"
SRCNAME = "vala"

inherit e-base autotools pkgconfig vala

SRC_URI = "svn://svn.enlightenment.org/svn/e/trunk/BINDINGS;module=${SRCNAME};proto=http;scmdata=keep"

PACKAGES =+ "${PN}-examples"
FILES_${PN}-examples = "${datadir}/libeflvala ${bindir}/*"

repository: trini/openembedded

repo_name: trini/openembedded


text:
DESCRIPTION = "Simple helloworld application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://userprog.c \
		  file://ReadMe.Txt"

SRC_URI_append = " file://function.c"

S = "${WORKDIR}"

do_compile() {
	bbnote "compilation started"
	${CC} userprog.c function.c ${LDFLAGS} -o userprog
	bbnote "compilation ended"
}

do_install() {
	bbwarn "compilation started"
	install -d ${D}${bindir}
	install -m 0755 userprog ${D}${bindir}
	install -d ${D}${docdir}
	install -m 0755 ReadMe.Txt ${D}${docdir}
	bbwarn "compilation ended"
}

#FILES_${PN}-dbg += "${bindir}/userprog ${includedir}/ReadMe.Txt"
#FILES_${PN}-lwl += "${includedir}/ReadMe.Txt ${includedir}/ReadMe.Txt"

#PACKAGES = "${PN}-lwl"

repository: pajogdand/meta-learn-yacto

repo_name: pajogdand/meta-learn-yacto


text:
###############################################################################
# Copyright (c) 2016-22, Lawrence Livermore National Security, LLC
# and other RAJA project contributors. See the RAJA/LICENSE file for details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
###############################################################################

if (RAJA_ENABLE_OPENMP)
  if(OPENMP_FOUND)
    list(APPEND RAJA_EXTRA_NVCC_FLAGS -Xcompiler ${OpenMP_CXX_FLAGS})
    message(STATUS "OpenMP Enabled")
  else()
    message(WARNING "OpenMP NOT FOUND")
    set(RAJA_ENABLE_OPENMP Off)
  endif()
endif()

if (RAJA_ENABLE_TBB)
  find_package(TBB)
  if(TBB_FOUND)
    blt_register_library(
      NAME tbb
      INCLUDES ${TBB_INCLUDE_DIRS}
      LIBRARIES ${TBB_LIBRARIES})
    message(STATUS "TBB Enabled")
  else()
    message(WARNING "TBB NOT FOUND")
    set(RAJA_ENABLE_TBB Off CACHE BOOL "" FORCE)
  endif()
endif ()

if (RAJA_ENABLE_CUDA OR RAJA_ENABLE_EXTERNAL_CUB)
  find_package(CUB)
  if (CUB_FOUND)
    set(RAJA_ENABLE_EXTERNAL_CUB On)
    blt_import_library(
      NAME cub
      INCLUDES ${CUB_INCLUDE_DIRS}
      TREAT_INCLUDES_AS_SYSTEM ON
      EXPORTABLE ON)
  elseif(RAJA_ENABLE_EXTERNAL_CUB)
    message(FATAL_ERROR "External CUB not found, CUB_DIR=${CUB_DIR}.")
  else()
    message(STATUS "Using RAJA CUB submodule.")
  endif()
endif ()

if (RAJA_ENABLE_CUDA AND RAJA_ENABLE_NV_TOOLS_EXT)
  find_package(NvToolsExt)
  if (NVTOOLSEXT_FOUND)
    blt_import_library( NAME       nvtoolsext
                        TREAT_INCLUDES_AS_SYSTEM ON
                        INCLUDES   ${NVTOOLSEXT_INCLUDE_DIRS}
                        LIBRARIES  ${NVTOOLSEXT_LIBRARY}
                        EXPORTABLE ON
                      )
  else()
    message(FATAL_ERROR "NvToolsExt not found, NVTOOLSEXT_DIR=${NVTOOLSEXT_DIR}.")
  endif()
endif ()

if (RAJA_ENABLE_HIP OR RAJA_ENABLE_EXTERNAL_ROCPRIM)
  find_package(RocPRIM)
  if (ROCPRIM_FOUND)
    set(RAJA_ENABLE_EXTERNAL_ROCPRIM On)
    blt_import_library(
      NAME rocPRIM
      INCLUDES ${ROCPRIM_INCLUDE_DIRS}
      TREAT_INCLUDES_AS_SYSTEM ON
      EXPORTABLE ON)
  elseif (RAJA_ENABLE_EXTERNAL_ROCPRIM)
      message(FATAL_ERROR "External rocPRIM not found, ROCPRIM_DIR=${ROCPRIM_DIR}.")
  else()
    message(STATUS "Using RAJA rocPRIM submodule.")
  endif()
endif ()

if (ENABLE_HIP AND ENABLE_ROCTX)
  include(FindRoctracer)
  blt_import_library(NAME roctx
                     INCLUDES ${ROCTX_INCLUDE_DIRS}
                     LIBRARIES ${ROCTX_LIBRARIES})
endif ()

set(TPL_DEPS)
blt_list_append(TO TPL_DEPS ELEMENTS cuda cuda_runtime IF RAJA_ENABLE_CUDA)
blt_list_append(TO TPL_DEPS ELEMENTS nvtoolsext IF RAJA_ENABLE_NV_TOOLS_EXT)
blt_list_append(TO TPL_DEPS ELEMENTS cub IF RAJA_ENABLE_EXTERNAL_CUB)
blt_list_append(TO TPL_DEPS ELEMENTS hip hip_runtime IF RAJA_ENABLE_HIP)
blt_list_append(TO TPL_DEPS ELEMENTS rocPRIM IF RAJA_ENABLE_EXTERNAL_ROCPRIM)
blt_list_append(TO TPL_DEPS ELEMENTS openmp IF RAJA_ENABLE_OPENMP)
blt_list_append(TO TPL_DEPS ELEMENTS mpi IF RAJA_ENABLE_MPI)

foreach(dep ${TPL_DEPS})
    # If the target is EXPORTABLE, add it to the export set
    get_target_property(_is_imported ${dep} IMPORTED)
    if(NOT ${_is_imported})
        install(TARGETS              ${dep}
                EXPORT               RAJA
                DESTINATION          lib)
        # Namespace target to avoid conflicts
        set_target_properties(${dep} PROPERTIES EXPORT_NAME RAJA::${dep})
    endif()
endforeach()

repository: jeffhammond/RAJA

repo_name: jeffhammond/RAJA


text:
package gorm

import (
	"fmt"
	"reflect"
	"time"
)

type foundation struct {
	commonDialect
}

func (foundation) BinVar(i int) string {
	return fmt.Sprintf("$%v", i)
}

func (foundation) SupportLastInsertId() bool {
	return false
}

func (foundation) SqlTag(value reflect.Value, size int, autoIncrease bool) string {
	switch value.Kind() {
	case reflect.Bool:
		return "boolean"
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uintptr:
		if autoIncrease {
			return "serial"
		}
		return "int"
	case reflect.Int64, reflect.Uint64:
		if autoIncrease {
			return "bigserial"
		}
		return "bigint"
	case reflect.Float32, reflect.Float64:
		return "double"
	case reflect.String:
		if size > 0 && size < 65532 {
			return fmt.Sprintf("varchar(%d)", size)
		}
		return "clob"
	case reflect.Struct:
		if _, ok := value.Interface().(time.Time); ok {
			return "datetime"
		}
	default:
		if _, ok := value.Interface().([]byte); ok {
			return "blob"
		}
	}
	panic(fmt.Sprintf("invalid sql type %s (%s) for foundation", value.Type().Name(), value.Kind().String()))
}

func (s foundation) ReturningStr(tableName, key string) string {
	return fmt.Sprintf("RETURNING %v.%v", s.Quote(tableName), key)
}

func (s foundation) HasTable(scope *Scope, tableName string) bool {
	var count int
	s.RawScanInt(scope, &count, "SELECT count(*) FROM INFORMATION_SCHEMA.tables WHERE table_schema = current_schema AND table_type = 'TABLE' AND table_name = ?", tableName)
	return count > 0
}

func (s foundation) HasColumn(scope *Scope, tableName string, columnName string) bool {
	var count int
	s.RawScanInt(scope, &count, "SELECT count(*) FROM INFORMATION_SCHEMA.columns WHERE table_schema = current_schema AND table_name = ? AND column_name = ?", tableName, columnName)
	return count > 0
}

func (s foundation) RemoveIndex(scope *Scope, indexName string) {
	scope.NewDB().Exec(fmt.Sprintf("DROP INDEX %v", s.Quote(indexName)))
}

func (s foundation) HasIndex(scope *Scope, tableName string, indexName string) bool {
	var count int
	s.RawScanInt(scope, &count, "SELECT count(*) FROM INFORMATION_SCHEMA.indexes WHERE table_schema = current_schema AND table_name = ? AND index_name = ?", tableName, indexName)
	return count > 0
}

func (s foundation) CurrentDatabase(scope *Scope) (name string) {
	s.RawScanString(scope, &name, "SELECT CURRENT_SCHEMA")
	return
}


text:
EXTRA_OECONF = "STAGING_LIBDIR_NATIVE=\"${STAGING_LIBDIR_NATIVE}\""

require xorg-font-common.inc

SRC_URI += " file://configure-mapdir.patch;patch=1"

#DESCRIPTION = ""

#DEPENDS += " "


text:
@article{WaSpKo2016-EAI-parallelSimulation,
  author = {J{\"u}rgen Walter and Simon Spinner and Samuel Kounev},
  title = {{Parallel Simulation of Queueing Petri Nets}},
  journal = {EAI Endorsed Transactions on Industrial Networks and Intelligent Systems},
  volume = {16},
  number = {8},
  publisher = {ACM},
  journal_a = {INIS},
  year = {2015},
  month = {8},
  keywords = {parallel discrete event simulation, performance prediction, stochastic performance modeling, queueing petri nets},
  doi = {10.4108/eai.24-8-2015.2261102},
}

gha_language: Perl


text:
DESCRIPTION = "A Python Widget library based on python-curses."
SECTION = "devel/python"
PRIORITY = "optional"
MAINTAINER = "Michael 'Mickey' Lauer <mickey@Vanille.de>"
LICENSE = "LGPL"
RDEPENDS = "python-core python-curses"
SRCNAME = "urwid"

SRC_URI = "http://excess.org/urwid/urwid-${PV}.tar.gz"
S = "${WORKDIR}/${SRCNAME}-${PV}"

inherit distutils


text:
DESCRIPTION = "Filesys::Notify::Simple is a simple but unified interface to get \
notifications of changes to a given filesystem path. It utilizes inotify2 \
on Linux, fsevents on OS X, kqueue on FreeBSD and \
FindFirstChangeNotification on Windows if they're installed, with a \
fallback to the full directory scan if they're not available."

SECTION = "libs"
LICENSE = "Artistic-1.0 | GPL-1.0-or-later"
PR = "r0"

MAINTAINER=	"Poky <poky@yoctoproject.org>"
HOMEPAGE=	"https://metacpan.org/release/Filesys-Notify-Simple"

LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Artistic-1.0;md5=cda03bbdc3c1951996392b872397b798 \
file://${COMMON_LICENSE_DIR}/GPL-1.0-or-later;md5=30c0b8a5048cc2f4be5ff15ef0d8cf61"

SRC_URI = "https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Filesys-Notify-Simple-0.14.tar.gz"

SRC_URI[md5sum] = "4a3ca3098b2455346fe24a66c94d2151"
SRC_URI[sha256sum] = "1fda712d4ba5e1868159ed35f6f8efbfae9d435d6376f5606d533bcb080555a4"
RDEPENDS:${PN} += "linux-inotify2-perl"
DEPENDS += "test-sharedfork-perl-native"

S = "${WORKDIR}/Filesys-Notify-Simple-${PV}"

inherit cpan allarch

BBCLASSEXTEND = "native"

repository: rehsack/meta-cpan

repo_name: rehsack/meta-cpan

gha_language: BitBake


text:
SUMMARY = "Runtime support for the GTK+ interface builder"
HOMEPAGE = "http://library.gnome.org/devel/libglade/"
BUGTRACKER = "https://bugzilla.gnome.org/"

LICENSE = "LGPLv2 & LGPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=55ca817ccb7d5b5b66355690e9abc605 \
                    file://glade/glade.h;endline=22;md5=a04f461c964ba4b57a172d1fbcd8f8fc \
                    file://glade/glade-gtk.c;endline=22;md5=766f993433e2642fec87936d319990ff"

SECTION = "libs"
PR = "r5"
DEPENDS = "zlib gdk-pixbuf gtk+"

inherit autotools pkgconfig gnomebase gtk-doc distro_features_check
ANY_OF_DISTRO_FEATURES = "${GTK2DISTROFEATURES}"
GNOME_COMPRESS_TYPE="bz2"

SRC_URI += "file://glade-cruft.patch file://no-xml2.patch file://python_environment.patch"

SRC_URI[archive.md5sum] = "d1776b40f4e166b5e9c107f1c8fe4139"
SRC_URI[archive.sha256sum] = "64361e7647839d36ed8336d992fd210d3e8139882269bed47dc4674980165dec"

EXTRA_OECONF += "--without-libxml2 --disable-gtk-doc"

CFLAGS += "-lz"

PACKAGES += " ${PN}-data"
FILES_${PN} = "${libdir}/lib*.so.*"
FILES_${PN}-data = "${datadir}/xml/libglade/glade-2.0.dtd"
FILES_${PN}-dev += "${bindir}/libglade-convert"
#RDEPENDS_${PN} = "${PN}-data"


text:
/**
 * @author Virtuosi Media
 * @link http://www.virtuosimedia.com
 * @version 1.0
 * @copyright Copyright (c) 2010, Virtuosi Media
 * @license MIT License
 * @description A simple tabs class
 * @requirements: MooTools 1.4+ Core - See http://mootools.net
 */
var SimpleTabs = new Class({

	Implements: [Events, Options],

	options: {
		activeClass: 'active',
		startTabNumber: 1,
		triggerEvent: 'click',
		startClosed: false
	},

	initialize: function(tabs, options){
		this.setOptions(options);
		this.tabs = tabs;

		var self = this;
		this.tabs.addEvent(this.options.triggerEvent, function(e){
			var hash = this.get('href').split('#')[1];
			self.setTabs(this, hash);
			self.setHash(hash);
			return false;
		});

		this.initializeTabs();
		this.currentHash = window.location.hash;
		var changeHash = this.checkHash.periodical(120, this);
	},

	initializeTabs: function(){
		this.tabs.each(function(item){
			var hash = item.get('href').split('#')[1];
			if (this.options.startClosed){
				$(hash).setStyles({'display':'none', 'height':'0px'});
			} else if ((item.hasClass(this.options.activeClass))||(window.location.hash.substring(1) == hash)) {
				this.setTabs(item, hash);
			}
		}, this);
	},

	setTabs: function(currentTab, hash){
		this.tabs.removeClass(this.options.activeClass).each(function(item){
			$(item.get('href').split('#')[1]).setStyles({'display':'none', 'height':'0px'});
		});
		$(hash).setStyles({'display':'block', 'height':'100%'});
		currentTab.addClass(this.options.activeClass);
	},

	setHash: function(hash){
		$(hash).set('id', hash+'Temp');
		window.location.hash = '#'+hash;
		$(hash+'Temp').set('id', hash);
	},

	checkHash: function(){
		if (window.location.hash != this.currentHash){
			this.initializeTabs();
			this.currentHash = window.location.hash;
		}
	}
});

repository: VirtuosiMedia/VM-PHP-Framework

repo_name: VirtuosiMedia/VM-PHP-Framework


text:
J. Yi, X. Chen, C. Song, and Z. Wang, “Fiber-Reinforced Origamic Robotic Actuator,” Soft Robotics, vol. 5, no. 1, pp. 81–92, Feb. 2017.

@article{Yi2017a,
abstract = {Abstract A novel pneumatic soft linear actuator Fiber-reinforced Origamic Robotic Actuator (FORA) is proposed with significant improvements on the popular McKibben-type actuators, offering nearly doubled motion range, substantially improved force profile, and significantly lower actuation pressure. The desirable feature set is made possible by a novel soft origamic chamber that expands radially while contracts axially when pressurized. Combining this new origamic chamber with a reinforcing fiber mesh, FORA generates very high traction force (over 150N) and very large contractile motion (over 50{\%}) at very low input pressure (100?kPa). We developed quasi-static analytical models both to characterize the motion and forces and as guidelines for actuator design. Fabrication of FORA mostly involves consumer-grade three-dimensional (3D) printing. We provide a detailed list of materials and dimensions. Fabricated FORAs were tested on a dedicated platform against commercially available pneumatic artificial muscles from Shadow and Festo to showcase its superior performances and validate the analytical models with very good agreements. Finally, a robotic joint was developed driven by two antagonistic FORAs, to showcase the benefits of the performance improvements. With its simple structure, fully characterized mechanism, easy fabrication procedure, and highly desirable performance, FORA could be easily customized to application requirements and fabricated by anyone with access to a 3D printer. This will pave the way to the wider adaptation and application of soft robotic systems.},
author = {Yi, Juan and Chen, Xiaojiao and Song, Chaoyang and Wang, Zheng},
doi = {10.1089/soro.2016.0079},
issn = {2169-5172},
journal = {Soft Robotics},
keywords = {actuator modeling,origami,soft actuator,soft robots},
mendeley-groups = {OurLab},
month = {feb},
number = {1},
pages = {81--92},
title = {{Fiber-Reinforced Origamic Robotic Actuator}},
url = {http://online.liebertpub.com/doi/10.1089/soro.2016.0079 https://www.liebertpub.com/doi/10.1089/soro.2016.0079},
volume = {5},
year = {2018}
}

repository: XiaojiaoChen/academic-MyWebsite

path: /content/publication/journal-article/Fiber-Reinforced Origamic Robotic Actuator/cite.bib

repo_name: XiaojiaoChen/academic-MyWebsite


text:
inherit esw_examples features_check

REQUIRED_DISTRO_FEATURES = "mutex"

ESW_COMPONENT_SRC = "/XilinxProcessorIPLib/drivers/mutex/examples/"

repository: fullstackfpga/meta-xilinx

repo_name: fullstackfpga/meta-xilinx


text:
package model3d

import (
	"math"

	"github.com/unixpickle/model3d/model2d"
)

// Triangulate turns any simple polygon into a set of
// equivalent triangles.
//
// The polygon is passed as a series of points, in order.
// The first point is re-used as the ending point, so no
// ending should be explicitly specified.
func Triangulate(polygon []Coord2D) [][3]Coord2D {
	return model2d.Triangulate(polygon)
}

// TriangulateFace turns any simple polygon face into a
// set of triangles.
//
// If the points are not coplanar, the result is
// approximated.
func TriangulateFace(polygon []Coord3D) []*Triangle {
	if len(polygon) == 3 {
		return []*Triangle{{polygon[0], polygon[1], polygon[2]}}
	} else if len(polygon) < 3 {
		panic("polygon needs at least three points")
	}

	basis1 := polygon[1].Sub(polygon[0])
	basis1 = basis1.Normalize()

	// Find a point that is not co-linear with the first two.
	minDot := math.Inf(1)
	basis2, _ := basis1.OrthoBasis()
	for _, p := range polygon[2:] {
		v := p.Sub(polygon[0]).ProjectOut(basis1).Normalize()
		dot := math.Abs(v.Dot(basis1))
		if !math.IsNaN(dot) && !math.IsInf(dot, 0) && dot < minDot {
			minDot = dot
			basis2 = v
		}
	}

	coords2D := make([]Coord2D, len(polygon))
	for i, p := range polygon {
		p1 := p.Sub(polygon[0])
		coords2D[i] = Coord2D{X: basis1.Dot(p1), Y: basis2.Dot(p1)}
	}
	triangles2D := Triangulate(coords2D)

	triangles := make([]*Triangle, len(triangles2D))
	for i, tri := range triangles2D {
		triangles[i] = &Triangle{}
		for j, p := range tri {
			triangles[i][j] = basis1.Scale(p.X).Add(basis2.Scale(p.Y)).Add(polygon[0])
		}
	}
	return triangles
}


text:
//
// Copyright (c) SAS Institute Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package apk

import (
	"errors"
	"io"

	"github.com/sassoftware/relic/v7/lib/certloader"
	"github.com/sassoftware/relic/v7/lib/magic"
	"github.com/sassoftware/relic/v7/signers"
	"github.com/sassoftware/relic/v7/signers/zipbased"
)

// Sign Android packages

var ApkSigner = &signers.Signer{
	Name:      "apk",
	Magic:     magic.FileTypeAPK,
	CertTypes: signers.CertTypeX509,
	Transform: zipbased.Transform,
	Sign:      sign,
	Verify:    verify,
}

const (
	sigMagic = "APK Sig Block 42"
	sigApkV2 = 0x7109871a
)

var (
	errMalformed = errors.New("malformed APK signing block")
	errTruncated = errors.New("truncated APK signing block sequence")
)

func init() {
	signers.Register(ApkSigner)
}

func sign(r io.Reader, cert *certloader.Certificate, opts signers.SignOpts) ([]byte, error) {
	digest, err := digestApkStream(r, opts.Hash)
	if err != nil {
		return nil, err
	}
	patchset, err := digest.Sign(cert)
	if err != nil {
		return nil, err
	}
	return opts.SetBinPatch(patchset)
}

repository: sassoftware/relic

repo_name: sassoftware/relic


text:
@manual{anleitung201,
author = "TU Dortmund",
title = "Versuchsanleitung zu Versuch Nr. 201 Das Dulong-Petitsche Gesetz",
year = 2016,
url = "http://129.217.224.2/HOMEPAGE/PHYSIKER/BACHELOR/AP/SKRIPT/V201.pdf"
}

@book{lit_dichte,
author = "Wolfgang Schenk, Friedrich Kremer",
title = "Physikalisches Praktikum",
publisher="Springer-Verlag",
year = "2016",
edition="14"
}

gha_language: TeX


text:
@article{Maas19,
 abstract = {The aims of this study were to assess the discriminative performance of quantitative multiparametric magnetic resonance imaging (mpMRI) between prostate cancer and noncancer tissues and between tumor grade groups (GGs) in a multicenter, single-vendor study, and to investigate to what extent site-specific differences affect variations in mpMRI parameters. Fifty patients with biopsy-proven prostate cancer from 5 institutions underwent a standardized preoperative mpMRI protocol. Based on the evaluation of whole-mount histopathology sections, regions of interest were placed on axial T2-weighed MRI scans in cancer and noncancer peripheral zone (PZ) and transition zone (TZ) tissue. Regions of interest were transferred to functional parameter maps, and quantitative parameters were extracted. Across-center variations in noncancer tissues, differences between tissues, and the relation to cancer grade groups were assessed using linear mixed-effects models and receiver operating characteristic analyses. Variations in quantitative parameters were low across institutes (mean [maximum] proportion of total variance in PZ and TZ, 4% [14%] and 8% [46%], respectively). Cancer and noncancer tissues were best separated using the diffusion-weighted imaging-derived apparent diffusion coefficient, both in PZ and TZ (mean [95% confidence interval] areas under the receiver operating characteristic curve [AUCs]; 0.93 [0.89-0.96] and 0.86 [0.75-0.94]), followed by MR spectroscopic imaging and dynamic contrast-enhanced-derived parameters. Parameters from all imaging methods correlated significantly with tumor grade group in PZ tumors. In discriminating GG1 PZ tumors from higher GGs, the highest AUC was obtained with apparent diffusion coefficient (0.74 [0.57-0.90], P < 0.001). The best separation of GG1-2 from GG3-5 PZ tumors was with a logistic regression model of a combination of functional parameters (mean AUC, 0.89 [0.78-0.98]). Standardized data acquisition and postprocessing protocols in prostate mpMRI at 3 T produce equivalent quantitative results across patients from multiple institutions and achieve similar discrimination between cancer and noncancer tissues and cancer grade groups as in previously reported single-center studies.This is an open-access article distributed under the terms of the Creative Commons Attribution-Non Commercial-No Derivatives License 4.0 (CCBY-NC-ND), where it is permissible to download and share the work provided it is properly cited. The work cannot be changed in any way or used commercially without permission from the journal.},
 author = {Maas, Marnix C and Litjens, Geert J S and Wright, Alan J and Attenberger, Ulrike I and Haider, Masoom A and Helbich, Thomas H and Kiefer, Berthold and Macura, Katarzyna J and Margolis, Daniel J A and Padhani, Anwar R and Selnæs, Kirsten M and Villeirs, Geert M and Fütterer, Jurgen J and Scheenen, Tom W J},
 country = {United States},
 doi = {10.1097/RLI.0000000000000558},
 issn = {1536-0210},
 issn-linking = {0020-9996},
 journal = {Invest Radiol},
 nlm-id = {0045377},
 optmonth = {#apr#},
 optnote = {DIAG, RADIOLOGY},
 owner = {NLM},
 pmid = {30946180},
 pubmodel = {Print-Electronic},
 pubstatus = {aheadofprint},
 revised = {2019-04-04},
 title = {A Single-Arm, Multicenter Validation Study of Prostate Cancer Localization and Aggressiveness With a Quantitative Multiparametric Magnetic Resonance Imaging Approach.},
 year = {2019}
}


text:
#
# base recipe: meta/recipes-extended/tar/tar_1.30.bb
# base branch: master
# base commit: 63a4ff7cf5f7d1671ab85800bc2212dd9cd9748d
#

SUMMARY = "GNU file archiving program"
DESCRIPTION = "GNU tar saves many files together into a single tape \
or disk archive, and can restore individual files from the archive."
HOMEPAGE = "http://www.gnu.org/software/tar/"

inherit debian-package
require recipes-debian/sources/tar.inc

LICENSE = "GPLv3+"
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"

FILESPATH_append = ":${COREBASE}/meta/recipes-extended/tar/tar"
SRC_URI += "file://musl_dirent.patch"

inherit autotools gettext texinfo

PACKAGECONFIG ??= ""
PACKAGECONFIG_append_class-target = " ${@bb.utils.filter('DISTRO_FEATURES', 'acl', d)}"

PACKAGECONFIG[acl] = "--with-posix-acls, --without-posix-acls, acl,"

EXTRA_OECONF += "DEFAULT_RMT_DIR=${base_sbindir}"

# Let aclocal use the relative path for the m4 file rather than the
# absolute since tar has a lot of m4 files, otherwise there might
# be an "Argument list too long" error when it is built in a long/deep
# directory.
acpaths = "-I ./m4"

do_install_append () {
	ln -s tar ${D}${bindir}/gtar
}

do_install_append_class-target() {
	if [ "${base_bindir}" != "${bindir}" ]; then
		install -d ${D}${base_bindir}
		mv ${D}${bindir}/tar ${D}${base_bindir}/tar
		mv ${D}${bindir}/gtar ${D}${base_bindir}/gtar
		rmdir ${D}${bindir}/
	fi
}

do_install_append_libc-musl() {
	rm -f ${D}${libdir}/charset.alias
	rmdir ${D}${libdir}
}

PACKAGES =+ "${PN}-rmt"

FILES_${PN}-rmt = "${base_sbindir}/rmt*"

inherit update-alternatives

ALTERNATIVE_PRIORITY = "100"

ALTERNATIVE_${PN} = "tar"
ALTERNATIVE_${PN}-rmt = "rmt"
ALTERNATIVE_${PN}_class-nativesdk = ""
ALTERNATIVE_${PN}-rmt_class-nativesdk = ""

ALTERNATIVE_LINK_NAME[tar] = "${base_bindir}/tar"
ALTERNATIVE_LINK_NAME[rmt] = "${base_sbindir}/rmt"

PROVIDES_append_class-native = " tar-replacement-native"
NATIVE_PACKAGE_PATH_SUFFIX = "/${PN}"

BBCLASSEXTEND = "native nativesdk"

CVE_PRODUCT = "gnu:tar"

repository: meta-debian/meta-debian

repo_name: meta-debian/meta-debian

branch_name: refs/heads/warrior


text:
@Article{dimitrov:rsj:2014,
  author    = {Dimitrov, Dimitar and Wieber, Pierre-Brice and Escande, Adrien},
  title     = {Multi-objective control of robots},
  journal   = {Journal of the Robotics Society of Japan},
  year      = {2014},
  volume    = {32},
  number    = {6},
  pages     = {512--518},
  doi       = {https://doi.org/10.7210/jrsj.32.512},
  url       = {https://drdv.github.io/pdf/rsj14.pdf},
  keywords  = {Lexicographic Optimization, Task Prioritization, Hierarchical Problems, Inequality Constraints},
  abstract  = {Even though over 20 years old, the above quote still reflects well a common practice in the field of robotics. That is, not establishing a clear separation between: (i) what one wants to achieve, and (ii) how this must be done. Using high-level goals for posing real-world problems in mathematical terms can be advantageous since, at the level of modeling, one need not consider the particular technique for approaching their solution. In fact, being able to abstract the problem formulation can be viewed as a part of the revolutionary development that followed the birth of the field of linear programming [1], because practitioners could be trained to cast situations (of potentially great complexity) in terms of a set of general goals and rely on available solvers developed by specialists in the fields of numerical analysis and optimization. Such separation leads to a reliable solution process. In this note we argue that the ability to define typical robotic problems in terms of lucid goals is beneficial not only from the point of view of clarity of presentation, but also for efficiency of computations. Our main point is that this can be achieved through the explicit use of multi-objective formulations. By means of several examples, we illustrate the advantages of this modeling approach and suggest that, by leveraging standard tools from the field of multi-objective optimization, such formulations can be resolved reliably and efficiently. We summarize some recent developments of (the already classical in the field of robotics) task prioritization, among which the fact that hierarchical problems can be interpreted as a particular type of multi-objective models.},
  publisher = {The Robotics Society of Japan},
  address   = {Bunkyo-Ku Hongo 2-19-7 Blue Bulding 2F 1130033, Tokyo, Japan}
}


text:
SUMMARY = "Simple powerful testing with python"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=81eb9f71d006c6b268cf4388e3c98f7b"

SRC_URI[sha256sum] = "eb2b5e935f6a019317e455b6da83dd8650ac9ffd2ee73a7b657a30873d67a698"

SRC_URI_append = " file://0001-setup.py-remove-the-setup_requires-for-setuptools-scm.patch "

inherit update-alternatives pypi setuptools3

RDEPENDS_${PN}_class-target += " \
    ${PYTHON_PN}-attrs \
    ${PYTHON_PN}-debugger \
    ${PYTHON_PN}-doctest \
    ${PYTHON_PN}-json \
    ${PYTHON_PN}-pluggy \
    ${PYTHON_PN}-py \
    ${PYTHON_PN}-setuptools \
    ${PYTHON_PN}-six \
    ${PYTHON_PN}-atomicwrites \
    ${PYTHON_PN}-importlib-metadata \
    ${PYTHON_PN}-pathlib2 \
    ${PYTHON_PN}-wcwidth \
    ${PYTHON_PN}-more-itertools \
    ${PYTHON_PN}-packaging \
"

ALTERNATIVE_${PN} += "py.test pytest"

NATIVE_LINK_NAME[pytest] = "${bindir}/pytest"
ALTERNATIVE_TARGET[pytest] = "${bindir}/pytest"

ALTERNATIVE_LINK_NAME[py.test] = "${bindir}/py.test"
ALTERNATIVE_TARGET[py.test] = "${bindir}/py.test"

BBCLASSEXTEND = "native nativesdk"

repository: KangJianX/openbmc

repo_name: KangJianX/openbmc

gha_license_id: NOASSERTION


text:
package main

import (
	"encoding/xml"
	"fmt"
	"log"
	"net/http"
	"net/url"
	"time"

	"github.com/kylegrantlucas/nextcloud-exporter/serverinfo"
	"github.com/prometheus/client_golang/prometheus"
)

var (
	usersDesc = prometheus.NewDesc(
		"nextcloud_users_total",
		"Number of users of the instance.",
		nil, nil)
	filesDesc = prometheus.NewDesc(
		"nextcloud_files_total",
		"Number of files served by the instance.",
		nil, nil)
	sharesDesc = prometheus.NewDesc(
		"nextcloud_shares_total",
		"Number of shares by type.",
		[]string{"type"}, nil)
	federationsDesc = prometheus.NewDesc(
		"nextcloud_shares_federated_total",
		"Number of federated shares by direction.",
		[]string{"direction"}, nil)
	activeUsersDesc = prometheus.NewDesc(
		"nextcloud_active_users_total",
		"Number of active users for the last five minutes.",
		nil, nil)
)

type nextcloudCollector struct {
	infoURL            *url.URL
	username           string
	password           string
	client             *http.Client
	upMetric           prometheus.Gauge
	authErrorsMetric   prometheus.Counter
	scrapeErrorsMetric prometheus.Counter
}

func newCollector(infoURL *url.URL, username, password string, timeout time.Duration) *nextcloudCollector {
	return &nextcloudCollector{
		infoURL:  infoURL,
		username: username,
		password: password,
		client: &http.Client{
			Timeout: timeout,
		},
		upMetric: prometheus.NewGauge(prometheus.GaugeOpts{
			Name: "nextcloud_up",
			Help: "Shows if nextcloud is deemed up by the collector.",
		}),
		authErrorsMetric: prometheus.NewCounter(prometheus.CounterOpts{
			Name: "nextcloud_auth_errors_total",
			Help: "Counts number of authentication errors encountered by the collector.",
		}),
		scrapeErrorsMetric: prometheus.NewCounter(prometheus.CounterOpts{
			Name: "nextcloud_scrape_errors_total",
			Help: "Counts the number of scrape errors by this collector.",
		}),
	}
}

func (c *nextcloudCollector) Describe(ch chan<- *prometheus.Desc) {
	c.upMetric.Describe(ch)
	c.authErrorsMetric.Describe(ch)
	c.scrapeErrorsMetric.Describe(ch)
	ch <- usersDesc
	ch <- filesDesc
	ch <- sharesDesc
	ch <- federationsDesc
	ch <- activeUsersDesc
}

func (c *nextcloudCollector) Collect(ch chan<- prometheus.Metric) {
	if err := c.collectNextcloud(ch); err != nil {
		log.Printf("Error during scrape: %s", err)

		c.scrapeErrorsMetric.Inc()
		c.upMetric.Set(0)
	} else {
		c.upMetric.Set(1)
	}

	c.upMetric.Collect(ch)
	c.authErrorsMetric.Collect(ch)
	c.scrapeErrorsMetric.Collect(ch)
}

func (c *nextcloudCollector) collectNextcloud(ch chan<- prometheus.Metric) error {
	req, err := http.NewRequest(http.MethodGet, c.infoURL.String(), nil)
	if err != nil {
		return err
	}

	req.SetBasicAuth(c.username, c.password)

	res, err := c.client.Do(req)
	if err != nil {
		return err
	}
	defer res.Body.Close()

	if res.StatusCode == http.StatusUnauthorized {
		c.authErrorsMetric.Inc()
		return fmt.Errorf("wrong credentials")
	}

	if res.StatusCode != http.StatusOK {
		return fmt.Errorf("unexpected status code: %d", res.StatusCode)
	}

	var status serverinfo.ServerInfo
	if err := xml.NewDecoder(res.Body).Decode(&status); err != nil {
		return err
	}

	if err := collectSimpleMetrics(ch, status); err != nil {
		return err
	}

	if err := collectShares(ch, status.Data.Nextcloud.Shares); err != nil {
		return err
	}

	if err := collectFederatedShares(ch, status.Data.Nextcloud.Shares); err != nil {
		return err
	}

	return nil
}

func collectSimpleMetrics(ch chan<- prometheus.Metric, status serverinfo.ServerInfo) error {
	metrics := []struct {
		desc  *prometheus.Desc
		value float64
	}{
		{
			desc:  usersDesc,
			value: float64(status.Data.Nextcloud.Storage.Users),
		},
		{
			desc:  filesDesc,
			value: float64(status.Data.Nextcloud.Storage.Files),
		},
		{
			desc:  activeUsersDesc,
			value: float64(status.Data.ActiveUsers.Last5Minutes),
		},
	}
	for _, m := range metrics {
		metric, err := prometheus.NewConstMetric(m.desc, prometheus.GaugeValue, m.value)
		if err != nil {
			return fmt.Errorf("error creating metric for %s: %s", usersDesc.String(), err)
		}
		ch <- metric
	}

	return nil
}

func collectShares(ch chan<- prometheus.Metric, shares serverinfo.Shares) error {
	values := make(map[string]float64)
	values["user"] = float64(shares.SharesUser)
	values["group"] = float64(shares.SharesGroups)
	values["authlink"] = float64(shares.SharesLink - shares.SharesLinkNoPassword)
	values["link"] = float64(shares.SharesLink)

	return collectMap(ch, sharesDesc, values)
}

func collectFederatedShares(ch chan<- prometheus.Metric, shares serverinfo.Shares) error {
	values := make(map[string]float64)
	values["sent"] = float64(shares.FedSent)
	values["received"] = float64(shares.FedReceived)

	return collectMap(ch, federationsDesc, values)
}

func collectMap(ch chan<- prometheus.Metric, desc *prometheus.Desc, labelValueMap map[string]float64) error {
	for k, v := range labelValueMap {
		metric, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, v, k)
		if err != nil {
			return fmt.Errorf("error creating shares metric for %s: %s", k, err)
		}
		ch <- metric
	}

	return nil
}

repository: kylegrantlucas/nextcloud-exporter

repo_name: kylegrantlucas/nextcloud-exporter


text:
package main

import (
	"compress/gzip"
	"encoding/xml"
	"fmt"
	k "github.com/frapa/candle/kernel"
	"io/ioutil"
	"mime/multipart"
	"strings"
	"time"
)

type RootGnu struct {
	Book BookGnu `xml:"book"`
}

type BookGnu struct {
	Accounts     []AccountGnu     `xml:"account"`
	Transactions []TransactionGnu `xml:"transaction"`
}

type AccountGnu struct {
	Name        string      `xml:"name"`
	Type        string      `xml:"type"`
	Id          string      `xml:"id"`
	Description string      `xml:"description"`
	Parent      string      `xml:"parent"`
	Currency    CurrencyGnu `xml:"commodity"`
}

type CurrencyGnu struct {
	Iso4217 string `xml:"id"`
}

type TransactionGnu struct {
	Id           string      `xml:"id"`
	Currency     CurrencyGnu `xml:"currency"`
	Date         string      `xml:"date-posted>date"`
	CreationDate string      `xml:"date-entered>date"`
	Description  string      `xml:"description"`
	Splits       []SplitGnu  `xml:"splits>split"`
}

type SplitGnu struct {
	Id      string `xml:"id"`
	Value   string `xml:"value"`
	Account string `xml:"account"`
}

type importHelper struct {
	xmlData       []byte
	accountMap    map[string]*Account
	totalCacheMap map[string]int64
	monthCacheMap map[string]int64
	yearCacheMap  map[string]int64
	gnucashMap    map[string]AccountGnu
	root          *RootGnu
	group         *k.Group
}

func newImporter(file multipart.File, group *k.Group) (*importHelper, error) {
	importer := new(importHelper)
	importer.group = group
	data, err := loadGnuCashXml(file)
	importer.xmlData = data
	return importer, err
}

func loadGnuCashXml(file multipart.File) ([]byte, error) {
	// Assume it's gzipped, I think it's more than
	// ten years this is the default
	/*gzipfile, err := os.Open(filename)
	if err != nil {
		log.Println(err)
	}
	defer gzipfile.Close()*/

	xmlfile, err := gzip.NewReader(file)
	if err != nil {
		return []byte{}, err
	}
	defer xmlfile.Close()

	xmlData, err := ioutil.ReadAll(xmlfile)
	if err != nil {
		return []byte{}, err
	}

	return xmlData, err
}

// Returns the Split which should be imported as from account
func getFromSplit(t *TransactionGnu) *SplitGnu {
	if t.Splits[0].Value[0] == '-' {
		return &t.Splits[0]
	} else {
		return &t.Splits[1]
	}
}

func getToSplit(t *TransactionGnu) *SplitGnu {
	if t.Splits[0].Value[0] == '-' {
		return &t.Splits[1]
	} else {
		return &t.Splits[0]
	}
}

func (i *importHelper) parseGnuCash() error {
	i.root = new(RootGnu)
	return xml.Unmarshal(i.xmlData, i.root)
}

func (i *importHelper) getOrCreateRootAccount(type_ string) *Account {
	filter := k.And(k.F("Type", "=", type_), k.F("Father", "=", "1"))
	query := k.All("Account").ApplyReadPermissionsGroup(i.group).Filter(filter)

	var account *Account
	if query.Count() == 0 {
		// Must create
		account = NewAccount()
		account.Type = type_
		account.Father = 1
		account.Name = "Father '" + type_ + "' account"
		k.Save(account)
		account.Link("Groups", i.group)
	} else {
		// Get the existing one!
		tempAccount := NewAccount()
		query.Get(tempAccount)
		account = tempAccount
	}

	return account
}

func (i *importHelper) wasAccountAlreadyImported(id string) (bool, *Account) {
	query := k.All("Account").ApplyWritePermissionsGroup(i.group).Filter("ImportInfo", "=", id)
	if query.Count() != 0 {
		tempAccount := NewAccount()
		query.Get(tempAccount)
		return true, tempAccount
	} else {
		return false, nil
	}
}

func (i *importHelper) generateAccountStructure() error {
	rootAccounts := map[string]*Account{
		"asset":   i.getOrCreateRootAccount("asset"),
		"income":  i.getOrCreateRootAccount("income"),
		"expense": i.getOrCreateRootAccount("expense"),
		"equity":  i.getOrCreateRootAccount("equity")}

	i.accountMap = make(map[string]*Account)
	i.totalCacheMap = make(map[string]int64)
	i.monthCacheMap = make(map[string]int64)
	i.yearCacheMap = make(map[string]int64)
	i.gnucashMap = make(map[string]AccountGnu)

	var rootId string
	var currentAccount *Account
	for _, gnuCashAccount := range i.root.Book.Accounts {
		type_ := strings.ToLower(gnuCashAccount.Type)
		id := gnuCashAccount.Id

		// Do not import account twice if the import is
		// run twice, rather only update what wasn't imported yet
		var wasIt bool
		if wasIt, currentAccount = i.wasAccountAlreadyImported(id); !wasIt {
			switch type_ {
			case "root":
				rootId = id
				continue
			case "asset", "cash", "bank", "credit card":
				currentAccount = NewAccount()
				currentAccount.Type = "asset"
			case "expense":
				currentAccount = NewAccount()
				currentAccount.Type = "expense"
			case "income":
				currentAccount = NewAccount()
				currentAccount.Type = "income"
			case "equity":
				//currentAccount = rootAccounts["equity"]
				currentAccount = NewAccount()
				currentAccount.Type = "equity"
			default:
				fmt.Println("Unsupported account type '" + type_ + "'")
				continue
			}
		}

		// Map to find accounts later
		i.accountMap[id] = currentAccount
		i.totalCacheMap[id] = 0
		i.monthCacheMap[id] = 0
		i.yearCacheMap[id] = 0
		i.gnucashMap[id] = gnuCashAccount

		// fill in data
		currentAccount.Name = gnuCashAccount.Name
		currentAccount.Description = gnuCashAccount.Description
		currentAccount.ImportInfo = id

		k.Save(currentAccount)
		// Now link the parent account.
		// If it is the root, link with correct root account
		// (we have many, gnucash has only one)
		var parent *Account
		if gnuCashAccount.Parent != rootId {
			parent = i.accountMap[gnuCashAccount.Parent]
		} else {
			parent = rootAccounts[currentAccount.Type]
		}
		currentAccount.Link("Parent", parent)
		currentAccount.Link("Groups", i.group)
	}

	return nil
}

func wasTransactionAlreadyImported(id string) bool {
	query := k.All("Transaction").Filter("ImportInfo", "=", id)
	return query.Count() != 0
}

var now time.Time = time.Now()
var beginningOfMonth time.Time = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.UTC)
var beginningOfYear time.Time = time.Date(now.Year(), 1, 1, 0, 0, 0, 0, time.UTC)

func (i *importHelper) updateCache(id string, variation int64, date time.Time) {
	if account, ok := i.gnucashMap[id]; ok {
		i.totalCacheMap[id] += variation

		if date.After(beginningOfMonth) {
			i.monthCacheMap[id] += variation
		}

		if date.After(beginningOfYear) {
			i.yearCacheMap[id] += variation
		}

		parentId := account.Parent
		if parentId != "" {
			i.updateCache(parentId, variation, date)
		}
	}
}

func (i *importHelper) importTransactions() error {
	for _, gnuCashTransaction := range i.root.Book.Transactions {
		id := gnuCashTransaction.Id

		// Do not import transactions twice in case of a
		// second import
		if wasTransactionAlreadyImported(id) {
			continue
		}

		fromSplit := getFromSplit(&gnuCashTransaction)
		toSplit := getToSplit(&gnuCashTransaction)

		fromAccount := i.accountMap[fromSplit.Account]
		toAccount := i.accountMap[toSplit.Account]

		// Some accounts could not be imported due to
		// missing correponences between account types
		// In case this transaction involves one of such account,
		// abort the import of the transaction with no error
		if fromAccount == nil || toAccount == nil {
			continue
		}

		transaction := NewTransaction()
		transaction.Description = gnuCashTransaction.Description
		transaction.ImportInfo = id

		var amount, cents int64
		fmt.Sscanf(toSplit.Value, "%d/%d", &amount, &cents)
		transaction.Amount = amount

		referenceTime := "2006-01-02 15:04:05 -0700"
		transaction.Date, _ = time.Parse(referenceTime,
			gnuCashTransaction.Date)

		/*transaction.CreationDate, _ = time.Parse(referenceTime,
		gnuCashTransaction.CreationDate)*/

		k.Save(transaction)
		transaction.Link("From", fromAccount)
		transaction.Link("To", toAccount)
		transaction.Link("Groups", i.group)

		// Sum up transactions to initialize the caches correctly
		i.updateCache(fromSplit.Account, -amount, transaction.Date)
		i.updateCache(toSplit.Account, amount, transaction.Date)
	}

	// save caches
	for _, gnuCashAccount := range i.root.Book.Accounts {
		type_ := strings.ToLower(gnuCashAccount.Type)
		id := gnuCashAccount.Id

		if type_ != "root" {
			account := i.accountMap[id]

			// Can appen the current account wasn't imported
			// (some account types are not supported)
			// Therefore abort cache calculation if the account
			// was not imported, to avoid invalid pointer deference
			if account == nil {
				continue
			}

			account.TotalCache += i.totalCacheMap[id]
			account.MonthCache += i.monthCacheMap[id]
			account.YearCache += i.yearCacheMap[id]
			account.LastCacheUpdate = now

			k.Save(account)
		}
	}

	return nil
}

func (i *importHelper) importBook() error {
	err := i.parseGnuCash()
	if err != nil {
		return err
	}

	k.BeginTransaction()

	err = i.generateAccountStructure()
	if err != nil {
		return err
	}

	err = i.importTransactions()
	if err != nil {
		return err
	}

	k.CommitTransaction()

	return nil
}

func ImportBookFromGnuCash(file multipart.File, group *k.Group) error {
	importer, err := newImporter(file, group)
	if err != nil {
		return err
	}

	return importer.importBook()
}

repository: frapa/electrum

repo_name: frapa/electrum


text:
SUMMARY = "high-performance event loop library modelled after libevent"
DESCRIPTION = "libev provides a full-featured and high-performance event loop that is \
loosely modelled after libevent. It includes relative timers, absolute \
timers with customized rescheduling, synchronous signals, process status \
change events, event watchers dealing with the event loop itself, file \
watchers, and even limited support for fork events. It uses a priority \
queue to manage timers and uses arrays as fundamental data structure. It \
has no artificial limitations on the number of watchers waiting for the \
same event."
HOMEPAGE = "http://libev.schmorp.de/"

inherit debian-package
PV = "4.15"

LICENSE = "BSD-2-Clause | GPLv2+"
LIC_FILES_CHKSUM = "file://LICENSE;md5=a4460a29fc20be7a1a2e6c95660ec740"

inherit autotools

do_install_append() {
	# Remove event.h to avoid conflict with libevent
	rm -f ${D}${includedir}/event.h
}

repository: manut/meta-combo

repo_name: manut/meta-combo

branch_name: refs/heads/morty


text:
/***
Copyright 2014 Cisco Systems Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package drivers

import (
	"errors"
	"fmt"
	"reflect"
	"sync"
	"time"

	"github.com/contiv/libovsdb"
	"github.com/contiv/netplugin/core"

	log "github.com/Sirupsen/logrus"
)

// Max number of retries to get ofp port number
const maxOfportRetry = 10

// OvsdbDriver is responsible for programming OVS using ovsdb protocol. It also
// implements the libovsdb.Notifier interface to keep cache of ovs table state.
type OvsdbDriver struct {
	bridgeName string // Name of the bridge we are operating on
	ovs        *libovsdb.OvsdbClient
	cache      map[string]map[libovsdb.UUID]libovsdb.Row
	cacheLock  sync.RWMutex // lock to protect cache accesses
}

// NewOvsdbDriver creates a new OVSDB driver instance.
// Create one ovsdb driver instance per OVS bridge that needs to be managed
func NewOvsdbDriver(bridgeName string, failMode string) (*OvsdbDriver, error) {
	// Create a new driver instance
	d := new(OvsdbDriver)
	d.bridgeName = bridgeName

	// Connect to OVS
	ovs, err := libovsdb.ConnectUnix("")
	if err != nil {
		log.Fatalf("Error connecting to OVS. Err: %v", err)
		return nil, err
	}

	d.ovs = ovs

	// Initialize the cache
	d.cache = make(map[string]map[libovsdb.UUID]libovsdb.Row)
	d.ovs.Register(d)
	initial, _ := d.ovs.MonitorAll(ovsDataBase, "")
	d.populateCache(*initial)

	// Create a bridge after registering for events as we depend on ovsdb cache.
	// Since the same dirver is used as endpoint driver, only create the bridge
	// if it's not already created
	// XXX: revisit if the bridge-name needs to be configurable
	brCreated := false
	for _, row := range d.cache[bridgeTable] {
		if row.Fields["name"] == bridgeName {
			brCreated = true
			break
		}
	}

	if !brCreated {
		err = d.createDeleteBridge(bridgeName, failMode, operCreateBridge)
		if err != nil {
			log.Fatalf("Error creating bridge %s. Err: %v", bridgeName, err)
			return nil, err
		}
	}

	return d, nil
}

// Delete : Cleanup the ovsdb driver. delete the bridge we created.
func (d *OvsdbDriver) Delete() error {
	if d.ovs != nil {
		log.Infof("Deleting OVS bridge: %s", d.bridgeName)
		for i := 0; i < 3; i++ {
			err := d.createDeleteBridge(d.bridgeName, "", operDeleteBridge)
			if err != nil {
				log.Errorf("Error deleting the bridge %s. Err: %v", d.bridgeName, err)
				time.Sleep(300 * time.Millisecond)
			} else {
				break
			}
		}
		(*d.ovs).Disconnect()
	}

	return nil
}

func (d *OvsdbDriver) getRootUUID() libovsdb.UUID {
	d.cacheLock.RLock()
	defer d.cacheLock.RUnlock()

	for uuid := range d.cache[rootTable] {
		return uuid
	}
	return libovsdb.UUID{}
}

func (d *OvsdbDriver) populateCache(updates libovsdb.TableUpdates) {
	d.cacheLock.Lock()
	defer func() { d.cacheLock.Unlock() }()

	for table, tableUpdate := range updates.Updates {
		if _, ok := d.cache[table]; !ok {
			d.cache[table] = make(map[libovsdb.UUID]libovsdb.Row)
		}
		for uuid, row := range tableUpdate.Rows {
			empty := libovsdb.Row{}
			if !reflect.DeepEqual(row.New, empty) {
				d.cache[table][libovsdb.UUID{GoUuid: uuid}] = row.New
			} else {
				delete(d.cache[table], libovsdb.UUID{GoUuid: uuid})
			}
		}
	}
}

// Update updates the ovsdb with the libovsdb.TableUpdates.
func (d *OvsdbDriver) Update(context interface{}, tableUpdates libovsdb.TableUpdates) {
	d.populateCache(tableUpdates)
}

// Locked satisfies a libovsdb interface dependency.
func (d *OvsdbDriver) Locked([]interface{}) {
}

// Stolen satisfies a libovsdb interface dependency.
func (d *OvsdbDriver) Stolen([]interface{}) {
}

// Echo satisfies a libovsdb interface dependency.
func (d *OvsdbDriver) Echo([]interface{}) {
}

func (d *OvsdbDriver) performOvsdbOps(ops []libovsdb.Operation) error {
	reply, _ := d.ovs.Transact(ovsDataBase, ops...)
	if len(reply) < len(ops) {
		return core.Errorf("Unexpected number of replies. Expected: %d, Recvd: %d",
			len(ops), len(reply))
	}
	ok := true
	errors := []string{}
	for i, o := range reply {
		if o.Error != "" && i < len(ops) {
			errors = append(errors, fmt.Sprintf("%s(%s)", o.Error, o.Details))
			ok = false
		} else if o.Error != "" {
			errors = append(errors, fmt.Sprintf("%s(%s)", o.Error, o.Details))
			ok = false
		}
	}

	if ok {
		return nil
	}

	log.Errorf("OVS operation failed for op: %+v: Errors: %v", ops, errors)

	return core.Errorf("ovs operation failed. Error(s): %v", errors)
}

// Create or delete an OVS bridge instance
func (d *OvsdbDriver) createDeleteBridge(bridgeName, failMode string, op oper) error {
	namedUUIDStr := "netplugin"
	brUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: namedUUIDStr}}
	protocols := []string{"OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13"}
	opStr := "insert"
	if op != operCreateBridge {
		opStr = "delete"
	}

	// simple insert/delete operation
	brOp := libovsdb.Operation{}
	if op == operCreateBridge {
		bridge := make(map[string]interface{})
		bridge["name"] = bridgeName

		// Enable Openflow1.3
		bridge["protocols"], _ = libovsdb.NewOvsSet(protocols)

		// set fail-mode if required
		if failMode != "" {
			bridge["fail_mode"] = "secure"
		}

		brOp = libovsdb.Operation{
			Op:       opStr,
			Table:    bridgeTable,
			Row:      bridge,
			UUIDName: namedUUIDStr,
		}
	} else {
		condition := libovsdb.NewCondition("name", "==", bridgeName)
		brOp = libovsdb.Operation{
			Op:    opStr,
			Table: bridgeTable,
			Where: []interface{}{condition},
		}
		// also fetch the br-uuid from cache
		for uuid, row := range d.cache[bridgeTable] {
			name := row.Fields["name"].(string)
			if name == bridgeName {
				brUUID = []libovsdb.UUID{uuid}
				break
			}
		}
	}

	// Inserting/Deleting a Bridge row in Bridge table requires mutating
	// the open_vswitch table.
	mutateUUID := brUUID
	mutateSet, _ := libovsdb.NewOvsSet(mutateUUID)
	mutation := libovsdb.NewMutation("bridges", opStr, mutateSet)
	condition := libovsdb.NewCondition("_uuid", "==", d.getRootUUID())

	// simple mutate operation
	mutateOp := libovsdb.Operation{
		Op:        "mutate",
		Table:     rootTable,
		Mutations: []interface{}{mutation},
		Where:     []interface{}{condition},
	}

	operations := []libovsdb.Operation{brOp, mutateOp}
	return d.performOvsdbOps(operations)
}

// GetPortOrIntfNameFromID gets interface name from id
func (d *OvsdbDriver) GetPortOrIntfNameFromID(id string, isPort bool) (string, error) {
	table := portTable
	if !isPort {
		table = interfaceTable
	}

	d.cacheLock.RLock()
	defer d.cacheLock.RUnlock()

	// walk thru all ports
	for _, row := range d.cache[table] {
		if extIDs, ok := row.Fields["external_ids"]; ok {
			extIDMap := extIDs.(libovsdb.OvsMap).GoMap
			if portID, ok := extIDMap["endpoint-id"]; ok && portID == id {
				return row.Fields["name"].(string), nil
			}
		}
	}
	return "", core.Errorf("Ovs port/intf not found for id: %s", id)
}

// CreatePort creates an OVS port
func (d *OvsdbDriver) CreatePort(intfName, intfType, id string, tag, burst int, bandwidth int64) error {
	// intfName is assumed to be unique enough to become uuid
	portUUIDStr := intfName
	intfUUIDStr := fmt.Sprintf("Intf%s", intfName)
	portUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: portUUIDStr}}
	intfUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: intfUUIDStr}}
	opStr := "insert"

	var err error

	// insert/delete a row in Interface table
	idMap := make(map[string]string)
	intfOp := libovsdb.Operation{}
	intf := make(map[string]interface{})
	intf["name"] = intfName
	intf["type"] = intfType
	if bandwidth != 0 {
		intf["ingress_policing_rate"] = bandwidth
	}
	if burst != 0 {
		intf["ingress_policing_burst"] = burst
	}
	idMap["endpoint-id"] = id
	intf["external_ids"], err = libovsdb.NewOvsMap(idMap)
	if err != nil {
		return err
	}

	// interface table ops
	intfOp = libovsdb.Operation{
		Op:       opStr,
		Table:    interfaceTable,
		Row:      intf,
		UUIDName: intfUUIDStr,
	}

	// insert/delete a row in Port table
	portOp := libovsdb.Operation{}
	port := make(map[string]interface{})
	port["name"] = intfName
	if tag != 0 {
		port["vlan_mode"] = "access"
		port["tag"] = tag
	} else {
		port["vlan_mode"] = "trunk"
	}
	port["interfaces"], err = libovsdb.NewOvsSet(intfUUID)
	if err != nil {
		return err
	}
	port["external_ids"], err = libovsdb.NewOvsMap(idMap)
	if err != nil {
		return err
	}
	portOp = libovsdb.Operation{
		Op:       opStr,
		Table:    portTable,
		Row:      port,
		UUIDName: portUUIDStr,
	}

	// mutate the Ports column of the row in the Bridge table
	mutateSet, _ := libovsdb.NewOvsSet(portUUID)
	mutation := libovsdb.NewMutation("ports", opStr, mutateSet)
	condition := libovsdb.NewCondition("name", "==", d.bridgeName)
	mutateOp := libovsdb.Operation{
		Op:        "mutate",
		Table:     bridgeTable,
		Mutations: []interface{}{mutation},
		Where:     []interface{}{condition},
	}

	operations := []libovsdb.Operation{intfOp, portOp, mutateOp}
	return d.performOvsdbOps(operations)
}

//UpdatePolicingRate will update the ingress policing rate in interface table.
func (d *OvsdbDriver) UpdatePolicingRate(intfName string, burst int, bandwidth int64) error {
	bw := int(bandwidth)
	intf := make(map[string]interface{})
	intf["ingress_policing_rate"] = bw
	intf["ingress_policing_burst"] = burst

	condition := libovsdb.NewCondition("name", "==", intfName)
	if condition == nil {
		return errors.New("Error getting the new condition")
	}
	mutateOp := libovsdb.Operation{
		Op:    "update",
		Table: interfaceTable,
		Row:   intf,
		Where: []interface{}{condition},
	}

	operations := []libovsdb.Operation{mutateOp}
	return d.performOvsdbOps(operations)

}

// DeletePort deletes a port from OVS
func (d *OvsdbDriver) DeletePort(intfName string) error {
	portUUIDStr := intfName
	portUUID := []libovsdb.UUID{{portUUIDStr}}
	opStr := "delete"

	// insert/delete a row in Interface table
	condition := libovsdb.NewCondition("name", "==", intfName)
	intfOp := libovsdb.Operation{
		Op:    opStr,
		Table: interfaceTable,
		Where: []interface{}{condition},
	}

	// insert/delete a row in Port table
	condition = libovsdb.NewCondition("name", "==", intfName)
	portOp := libovsdb.Operation{
		Op:    opStr,
		Table: portTable,
		Where: []interface{}{condition},
	}

	// also fetch the port-uuid from cache
	d.cacheLock.RLock()
	for uuid, row := range d.cache["Port"] {
		name := row.Fields["name"].(string)
		if name == intfName {
			portUUID = []libovsdb.UUID{uuid}
			break
		}
	}
	d.cacheLock.RUnlock()

	// mutate the Ports column of the row in the Bridge table
	mutateSet, _ := libovsdb.NewOvsSet(portUUID)
	mutation := libovsdb.NewMutation("ports", opStr, mutateSet)
	condition = libovsdb.NewCondition("name", "==", d.bridgeName)
	mutateOp := libovsdb.Operation{
		Op:        "mutate",
		Table:     bridgeTable,
		Mutations: []interface{}{mutation},
		Where:     []interface{}{condition},
	}

	// Perform OVS transaction
	operations := []libovsdb.Operation{intfOp, portOp, mutateOp}
	return d.performOvsdbOps(operations)
}

// CreateVtep creates a VTEP port on the OVS
func (d *OvsdbDriver) CreateVtep(intfName string, vtepRemoteIP string) error {
	portUUIDStr := intfName
	intfUUIDStr := fmt.Sprintf("Intf%s", intfName)
	portUUID := []libovsdb.UUID{{portUUIDStr}}
	intfUUID := []libovsdb.UUID{{intfUUIDStr}}
	opStr := "insert"
	intfType := "vxlan"
	var err error

	// insert/delete a row in Interface table
	intf := make(map[string]interface{})
	intf["name"] = intfName
	intf["type"] = intfType

	// Special handling for VTEP ports
	intfOptions := make(map[string]interface{})
	intfOptions["remote_ip"] = vtepRemoteIP
	intfOptions["key"] = "flow"    // Insert VNI per flow
	intfOptions["tos"] = "inherit" // Copy DSCP from inner to outer IP header

	intf["options"], err = libovsdb.NewOvsMap(intfOptions)
	if err != nil {
		log.Errorf("error '%s' creating options from %v \n", err, intfOptions)
		return err
	}

	// Add an entry in Interface table
	intfOp := libovsdb.Operation{
		Op:       opStr,
		Table:    interfaceTable,
		Row:      intf,
		UUIDName: intfUUIDStr,
	}

	// insert/delete a row in Port table
	port := make(map[string]interface{})
	port["name"] = intfName
	port["vlan_mode"] = "trunk"

	port["interfaces"], err = libovsdb.NewOvsSet(intfUUID)
	if err != nil {
		return err
	}

	// Add an entry in Port table
	portOp := libovsdb.Operation{
		Op:       opStr,
		Table:    portTable,
		Row:      port,
		UUIDName: portUUIDStr,
	}

	// mutate the Ports column of the row in the Bridge table
	mutateSet, _ := libovsdb.NewOvsSet(portUUID)
	mutation := libovsdb.NewMutation("ports", opStr, mutateSet)
	condition := libovsdb.NewCondition("name", "==", d.bridgeName)
	mutateOp := libovsdb.Operation{
		Op:        "mutate",
		Table:     bridgeTable,
		Mutations: []interface{}{mutation},
		Where:     []interface{}{condition},
	}

	// Perform OVS transaction
	operations := []libovsdb.Operation{intfOp, portOp, mutateOp}
	return d.performOvsdbOps(operations)
}

// DeleteVtep deletes a VTEP port
func (d *OvsdbDriver) DeleteVtep(intfName string) error {
	return d.DeletePort(intfName)
}

// AddController : Add controller configuration to OVS
func (d *OvsdbDriver) AddController(ipAddr string, portNo uint16) error {
	// Format target string
	target := fmt.Sprintf("tcp:%s:%d", ipAddr, portNo)
	ctrlerUUIDStr := fmt.Sprintf("local")
	ctrlerUUID := []libovsdb.UUID{libovsdb.UUID{GoUuid: ctrlerUUIDStr}}

	// If controller already exists, nothing to do
	if d.IsControllerPresent(target) {
		return nil
	}

	// insert a row in Controller table
	controller := make(map[string]interface{})
	controller["target"] = target

	// Add an entry in Controller table
	ctrlerOp := libovsdb.Operation{
		Op:       "insert",
		Table:    "Controller",
		Row:      controller,
		UUIDName: ctrlerUUIDStr,
	}

	// mutate the Controller column of the row in the Bridge table
	mutateSet, _ := libovsdb.NewOvsSet(ctrlerUUID)
	mutation := libovsdb.NewMutation("controller", "insert", mutateSet)
	condition := libovsdb.NewCondition("name", "==", d.bridgeName)
	mutateOp := libovsdb.Operation{
		Op:        "mutate",
		Table:     "Bridge",
		Mutations: []interface{}{mutation},
		Where:     []interface{}{condition},
	}

	// Perform OVS transaction
	operations := []libovsdb.Operation{ctrlerOp, mutateOp}
	return d.performOvsdbOps(operations)
}

// RemoveController : Remove controller configuration
func (d *OvsdbDriver) RemoveController(target string) error {
	// FIXME:
	return nil
}

// IsControllerPresent : Check if Controller already exists
func (d *OvsdbDriver) IsControllerPresent(target string) bool {
	d.cacheLock.RLock()
	defer d.cacheLock.RUnlock()

	// walk the local cache
	for tName, table := range d.cache {
		if tName == "Controller" {
			for _, row := range table {
				for fieldName, value := range row.Fields {
					if fieldName == "target" {
						if value == target {
							// Controller exists.
							return true
						}
					}
				}
			}
		}
	}

	// We could not find the controller
	return false
}

// IsPortNamePresent checks if port already exists in OVS bridge
func (d *OvsdbDriver) IsPortNamePresent(intfName string) bool {
	d.cacheLock.RLock()
	defer d.cacheLock.RUnlock()

	// walk the local cache
	for tName, table := range d.cache {
		if tName == "Port" {
			for _, row := range table {
				for fieldName, value := range row.Fields {
					if fieldName == "name" {
						if value == intfName {
							// Interface name exists.
							return true
						}
					}
				}
			}
		}
	}

	// We could not find the interface name
	return false
}

// GetOfpPortNo returns OFP port number for an interface
func (d *OvsdbDriver) GetOfpPortNo(intfName string) (uint32, error) {
	retryNo := 0
	condition := libovsdb.NewCondition("name", "==", intfName)
	selectOp := libovsdb.Operation{
		Op:    "select",
		Table: "Interface",
		Where: []interface{}{condition},
	}

	for {
		row, err := d.ovs.Transact(ovsDataBase, selectOp)

		if err == nil && len(row) > 0 && len(row[0].Rows) > 0 {
			value := row[0].Rows[0]["ofport"]
			if reflect.TypeOf(value).Kind() == reflect.Float64 {
				//retry few more time. Due to asynchronous call between
				//port creation and populating ovsdb entry for the interface
				//may not be populated instantly.
				ofpPort := uint32(reflect.ValueOf(value).Float())
				return ofpPort, nil
			}
		}
		time.Sleep(300 * time.Millisecond)

		if retryNo == maxOfportRetry {
			return 0, errors.New("ofPort not found")
		}
		retryNo++
	}
}

// IsVtepPresent checks if VTEP already exists
func (d *OvsdbDriver) IsVtepPresent(remoteIP string) (bool, string) {
	d.cacheLock.RLock()
	defer d.cacheLock.RUnlock()

	// walk the local cache
	for tName, table := range d.cache {
		if tName == "Interface" {
			for _, row := range table {
				options := row.Fields["options"]
				switch optMap := options.(type) {
				case libovsdb.OvsMap:
					if optMap.GoMap["remote_ip"] == remoteIP {
						value := row.Fields["name"]
						switch t := value.(type) {
						case string:
							return true, t
						default:
							// return false, ""
						}
					}
				default:
					// return false, ""
				}
			}
		}
	}

	// We could not find the interface name
	return false, ""
}

repository: jainvipin/netplugin

repo_name: jainvipin/netplugin


text:
file(REMOVE_RECURSE
  "02_oop_01_main.exe"
  "02_oop_01_main.exe.manifest"
  "02_oop_01_main.pdb"
  "CMakeFiles/02_oop_01_main.dir/02_oop/01_main.cpp.obj"
  "lib02_oop_01_main.dll.a"
)

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


text:
PR = "${INC_PR}.2"

SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \
           file://gnutls.bzr.patch \
           file://CVE-2010-2252.patch;striplevel=0 \
"

SRC_URI[md5sum] = "141461b9c04e454dc8933c9d1f2abf83"
SRC_URI[sha256sum] = "7578ed0974e12caa71120581fa3962ee5a69f7175ddc3d6a6db0ecdcba65b572"

require wget.inc

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty


text:
require util-macros.inc
PR = "${INC_PR}.0"
SRC_URI[archive.md5sum] = "fe73a69d02bd0be6cdf7c773bfd72041"
SRC_URI[archive.sha256sum] = "2de6954271dbd43f073022c371c15d5f1102a3631eaa4f4053bfd173e148f7d7"


text:
DESCRIPTION = "Ace is a code editor written in JavaScript."
SUMMARY = "Ace is a code editor written in JavaScript. This repository has only generated files"

LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=794d11c5219c59c9efa2487c2b4066b2"

SRC_URI = "git://github.com/ajaxorg/ace-builds.git;protocol=https;branch=master"

PV = "02.07.17+git${SRCPV}"
SRCREV = "812e2c56aed246931a667f16c28b096e34597016"

FILES:${PN} = "${datadir}/ace-builds"

S = "${WORKDIR}/git"

DEPENDS += "rsync-native"

do_install () {
    install -d ${D}/${datadir}/ace-builds/src-noconflict
    rsync -r --exclude=".*" ${S}/src-noconflict/* ${D}/${datadir}/ace-builds/src-noconflict
}

repository: openembedded/meta-openembedded

repo_name: openembedded/meta-openembedded


text:
@article{Dobler2017-fm,
 abstract = {Project Euclid - mathematics and statistics online},
 author = {Döbler, Christian and Gaunt, Robert E and Vollmer, Sebastian
J},
 journal = {Electron. J. Probab.},
 keywords = {Stein's method; Stein equation; differential equation; Poisson
equation; variance-gamma distribution},
 language = {en},
 publisher = {The Institute of Mathematical Statistics and the Bernoulli
Society},
 title = {An iterative technique for bounding derivatives of solutions of
Stein equations},
 volume = {22},
 year = {2017}
}

repository: Selbosh/starter-hugo-research-group

repo_name: Selbosh/starter-hugo-research-group


text:
#########################################
#                                       #
#         RtAudio      Setting          #
#                                       #
#########################################

# Check for Jack (any OS)

# local variables

find_library(JACK_LIB jack)
find_package(PkgConfig)
pkg_check_modules(jack jack)
if(JACK_LIB OR jack_FOUND)
  set(HAVE_JACK TRUE)
endif()

# Check for Pulse (any OS)
pkg_check_modules(pulse libpulse-simple)

# Check for known non-Linux unix-likes
if (CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
  message(STATUS "NetBSD detected, using OSS")
  set(xBSD ON)
elseif(UNIX AND NOT APPLE)
  set(LINUX ON)
endif()

# Necessary for Windows
if(MINGW)
  set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()

# API Options
option(RTAUDIO_API_DS "Build DirectSound API" OFF)
option(RTAUDIO_API_ASIO "Build ASIO API" OFF)
option(RTAUDIO_API_WASAPI "Build WASAPI API" ${WIN32})
option(RTAUDIO_API_OSS "Build OSS4 API" ${xBSD})
option(RTAUDIO_API_ALSA "Build ALSA API" ${LINUX})
option(RTAUDIO_API_PULSE "Build PulseAudio API" ${pulse_FOUND})
option(RTAUDIO_API_JACK "Build JACK audio server API" ${HAVE_JACK})
option(RTAUDIO_API_CORE "Build CoreAudio API" ${APPLE})

# Check for functions
include(CheckFunctionExists)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
if (HAVE_GETTIMEOFDAY)
    add_definitions(-DHAVE_GETTIMEOFDAY)
endif ()

# input device
list(APPEND SRC
  ${CMAKE_CURRENT_LIST_DIR}/RtAudio/RtAudio.cpp
  ${CMAKE_CURRENT_LIST_DIR}/RtAudio/RtAudio.h
  ${CMAKE_CURRENT_LIST_DIR}/RtInput.h
  ${CMAKE_CURRENT_LIST_DIR}/RtOutput.h
  ${CMAKE_CURRENT_LIST_DIR}/RtBase.h
	)
list(APPEND INCL
	${CMAKE_CURRENT_LIST_DIR}
)

set(API_LIST)
set(PKGCONFIG_REQUIRES)

# Jack
if (RTAUDIO_API_JACK AND jack_FOUND)
  set(NEED_PTHREAD ON)
  list(APPEND PKGCONFIG_REQUIRES "jack")
  list(APPEND COMPILE_OPTION "-D__UNIX_JACK__")
  list(APPEND API_LIST "jack")
  if(jack_FOUND)
    list(APPEND LINKLIBS ${jack_LIBRARIES})
    list(APPEND INCL ${jack_INCLUDEDIR})
  else()
    list(APPEND LINKLIBS ${JACK_LIB})
  endif()
endif()

# ALSA
if (RTAUDIO_API_ALSA)
  set(NEED_PTHREAD ON)
  find_package(ALSA)
  if (NOT ALSA_FOUND)
    message(FATAL_ERROR "ALSA API requested but no ALSA dev libraries found")
  endif()
  list(APPEND INCL ${ALSA_INCLUDE_DIR})
  list(APPEND LINKLIBS ${ALSA_LIBRARY})
  list(APPEND PKGCONFIG_REQUIRES "alsa")
  list(APPEND COMPILE_OPTION "-D__LINUX_ALSA__")
  list(APPEND API_LIST "alsa")
endif()

# OSS
if (RTAUDIO_OSS)
  set(NEED_PTHREAD ON)
  find_library(OSSAUDIO_LIB ossaudio)
  if (OSSAUDIO_LIB)
    list(APPEND LINKLIBS ossaudio)
    # Note: not an error on some systems
  endif()
  list(APPEND COMPILE_OPTION "-D__LINUX_OSS__")
  list(APPEND API_LIST "oss")
endif()

# Pulse
if (RTAUDIO_API_PULSE)
  set(NEED_PTHREAD ON)
  find_library(PULSE_LIB pulse)
  find_library(PULSESIMPLE_LIB pulse-simple)
  list(APPEND LINKLIBS ${PULSE_LIB} ${PULSESIMPLE_LIB})
  list(APPEND PKGCONFIG_REQUIRES "libpulse-simple")
  list(APPEND COMPILE_OPTION "-D__LINUX_PULSE__")
  list(APPEND API_LIST "pulse")
endif()

# CoreAudio
if (RTAUDIO_API_CORE)
  find_library(COREAUDIO_LIB CoreAudio)
  find_library(COREFOUNDATION_LIB CoreFoundation)
  list(APPEND LINKLIBS ${COREAUDIO_LIB} ${COREFOUNDATION_LIB})
  list(APPEND COMPILE_OPTION "-D__MACOSX_CORE__")
  list(APPEND API_LIST "core")
endif()

# ASIO
if (RTAUDIO_API_ASIO)
  set(NEED_WIN32LIBS ON)
    list(APPEND SRC
      ${CMAKE_CURRENT_LIST_DIR}/RtAudio/asio.cpp
      ${CMAKE_CURRENT_LIST_DIR}/RtAudio/asiodrivers.cpp
      ${CMAKE_CURRENT_LIST_DIR}/RtAudio/asiolist.cpp
      ${CMAKE_CURRENT_LIST_DIR}/RtAudio/iasiothiscallresolver.cpp
  )
    list(APPEND COMPILE_OPTION "-D__WINDOWS_ASIO__")
  list(APPEND API_LIST "asio")
endif()

# DSound
if (RTAUDIO_API_DS)
  set(NEED_WIN32LIBS ON)
  list(APPEND LINKLIBS dsound)
  list(APPEND COMPILE_OPTION "-D__WINDOWS_DS__")
  list(APPEND API_LIST "ds")
endif()

# WASAPI
if (RTAUDIO_API_WASAPI)
  set(NEED_WIN32LIBS ON)
  list(APPEND LINKLIBS ksuser mfplat mfuuid wmcodecdspuuid)
  list(APPEND COMPILE_OPTION "-D__WINDOWS_WASAPI__")
  list(APPEND API_LIST "wasapi")
endif()

# Windows libs
if (NEED_WIN32LIBS)
  list(APPEND LINKLIBS winmm ole32)
endif()

# pthread
if (NEED_PTHREAD)
  find_package(Threads REQUIRED
    CMAKE_THREAD_PREFER_PTHREAD
    THREADS_PREFER_PTHREAD_FLAG)
  list(APPEND LINKLIBS Threads::Threads)
endif()

################################################

message(STATUS "Compiling with support for: ${API_LIST}")

repository: nonmetal/rtaudio-mldr

repo_name: nonmetal/rtaudio-mldr


text:
import React from 'react';
import { shallow } from 'enzyme';

import { ListVanilla } from '../index';

describe('<List />', () => {
  let ListComponent = '';
  beforeEach(() => {
    ListComponent = shallow(
      <ListVanilla>

This is list item

This is list item

      </ListVanilla>
    );
  });

  test('should render default view correctly', () => {
    expect(ListComponent).toMatchSnapshot();
  });
});

repository: pagesource/atomic-react-components

repo_name: pagesource/atomic-react-components

branch_name: refs/heads/develop

gha_language: JavaScript


text:
package main

import (
	"bytes"
	"fmt"
	"image"
	"image/color"
	"math"
	"strconv"
	"strings"

	"github.com/jfcg/butter"
	"github.com/wcharczuk/go-chart/v2"
	"github.com/wcharczuk/go-chart/v2/drawing"
)

func init() {
	chart.DefaultColors = []drawing.Color{chart.ColorBlack}
}

func BandPassFilter(vals []float64, signalHz, highPassHz, lowPassHz, timepointsToCompress float64) ([]float64, error) {

	wcBase := 2.0 * math.Pi * timepointsToCompress / signalHz

	filt := butter.NewHighPass1(highPassHz * wcBase)
	filtL := butter.NewLowPass1(lowPassHz * wcBase)

	if filt == nil {
		return nil, fmt.Errorf("Invalid high-pass filter (attempted wc=%f for highPassHz=%f, but expect .0001 < wc && wc < 3.1415)", wcBase*highPassHz, highPassHz)
	}

	if filtL == nil {
		return nil, fmt.Errorf("Invalid low-pass filter (attempted wc=%f for lowPassHz=%f, but expect .0001 < wc && wc < 3.1415)", wcBase*lowPassHz, lowPassHz)
	}

	valsFloat := make([]float64, 0, len(vals))
	compressor := make([]float64, 0)

	for _, vf := range vals {
		if timepointsToCompress < 2 {
			valsFloat = append(valsFloat, filt.Next(filtL.Next(vf)))
			continue
		}

		compressor = append(compressor, vf)
		if float64(len(compressor)) < timepointsToCompress {
			continue
		}

		vf = FloatAvg(compressor)
		compressor = nil

		valsFloat = append(valsFloat, filt.Next(filtL.Next(vf)))
	}

	return valsFloat, nil
}

func EstimateVoltageCorrection(value, units string) float64 {
	voltageCorrection := 1.0

	if units == "uVperLsb" {
		vc, err := strconv.ParseFloat(value, 64)
		if err == nil {
			voltageCorrection = 0.001 * vc
		}
	}

	return voltageCorrection
}

func FloatAvg(f []float64) float64 {
	out := 0.0
	for _, v := range f {
		out += v
	}

	if x := len(f); x > 0 {
		return out / float64(x)
	}

	return out
}

// PlotLeadFloat yields a grayscale image
func PlotLeadFloat(yMin, yMax float64, widthPx, heightPx int, floatVals []float64) (image.Image, error) {
	var chartRange *chart.ContinuousRange

	if yMin != yMax {
		chartRange = &chart.ContinuousRange{Min: yMin, Max: yMax}
	}

	graph := chart.Chart{
		Width:  widthPx,
		Height: heightPx,
		XAxis: chart.XAxis{
			Style: chart.Hidden(),
		},
		YAxis: chart.YAxis{
			Style: chart.Hidden(),
			Range: chartRange,
		},
		Series: []chart.Series{
			chart.ContinuousSeries{
				XValues: intSeq(len(floatVals)),
				YValues: floatVals,
			},
		},
	}

	// Render to a byte buffer
	buffer := bytes.NewBuffer([]byte{})
	if err := graph.Render(chart.PNG, buffer); err != nil {
		return nil, err
	}

	// Fetch the img representation of the graph
	src, _, err := image.Decode(buffer)
	if err != nil {
		return nil, err
	}

	// Create a new grayscale image
	bounds := src.Bounds()
	w, h := bounds.Max.X, bounds.Max.Y
	gray := image.NewGray(image.Rect(0, 0, w, h))
	for x := 0; x < w; x++ {
		for y := 0; y < h; y++ {
			oldColor := src.At(x, y)
			grayColor := color.GrayModel.Convert(oldColor)
			gray.Set(x, y, grayColor)
		}
	}

	return gray, nil
}

// This is very UK Biobank-specific, but the files are stored as
// sample_field_instance_arrayidx and so we can extract metadata from them.
func fileNameToSampleInstance(filename string) (string, string, error) {
	parts := strings.Split(filename, "_")
	if len(parts) < 3 {
		return "", "", fmt.Errorf("Expected at least two '_' characters in the filename, but found %d", len(parts)-1)
	}

	return parts[0], parts[2], nil
}

func stringSliceToFloatSlice(in []string) ([]float64, error) {
	output := make([]float64, len(in))
	for i, fv := range in {
		// output[i] = float64(fv)
		v, err := strconv.ParseFloat(fv, 64)
		if err != nil {
			return nil, err
		}
		output[i] = v
	}

	return output, nil
}

func intSeq(N int) []float64 {
	output := make([]float64, N)
	for i := 0; i < N; i++ {
		output[i] = float64(i)
	}

	return output
}

repository: carbocation/genomisc

repo_name: carbocation/genomisc


text:
const axios = require("axios");

const getRpcNodes = async () => {
  const res = await axios.get("https://gateway.swtc.top/rpcservice", { timeout: 30000 });
  if (res.status === 200 && res.data.count > 0) {
    return res.data.rpcpeers;
  } else {
    return [
      "https://srje115qd43qw2.swtc.top",
      "https://srje071qdew231.swtc.top"
    ]
  }
}

exports.getRpcNodes = getRpcNodes;
// module.exports = { getRpcNodes };

// const rpcNodes = [
//   "https://srje115qd43qw2.swtc.top",
//   "https://srje071qdew231.swtc.top"
// ];

// exports.rpcNodes = rpcNodes;


text:
---
---
@phdthesis{doherty2019robust,
  title={Robust {N}on-{G}aussian {S}emantic {S}imultaneous {L}ocalization and {M}apping},
  author={Doherty, Kevin},
  year={2019},
  school={Massachusetts Institute of Technology},
  note={S.M. Thesis},
  img={/assets/img/mit_seal.png},
  pdf={/assets/docs/kdoherty_thesis2019_latest.pdf}
}

@phdthesis{doherty2017learning,
  title={Learning-aided 3{D} {O}ccupancy {M}apping for {M}obile {R}obots},
  author={Doherty, Kevin},
  year={2017},
  school={Stevens Institute of Technology},
  note={B.E. Thesis},
  img={/assets/img/stevens_small.png},
  pdf={/assets/docs/stevensDissertation.pdf}
}