text:
@InProceedings{bogojeska12,
  title = {History-alignment models for bias-aware prediction of virological response to HIV combination therapy},
  author = {Jasmina Bogojeska and Daniel Stockel and Maurizio Zazzi and Rolf Kaiser and Francesca Incardona and Michal Rosen-Zvi and Thomas Lengauer},
  pages = {118--126},
  abstract = {The relevant HIV data sets used for predicting outcomes of HIV combination therapies suffer from several problems: uneven therapy representation, different treatment backgrounds of the samples and uneven representation with respect to the level of therapy experience. Also, they comprise only viral strain(s) that can be detected in the patients' blood serum. The approach presented in this paper tackles these issues by considering not only the most recent therapies but also the different treatment backgrounds of the samples making up the clinical data sets when predicting the outcomes of HIV therapies. For this purpose, we introduce a similarity measure for sequences of therapies and use it for training separate linear models for predicting therapy outcome for each target sample. Compared to the most commonly used approach that encodes all available treatment information only by specific input features our approach has the advantage of delivering significantly more accurate predictions for therapy-experienced patients and for rare therapies. Additionally, the sample-specific models are more interpretable which is very important in medical applications.},
  pdf = {http://jmlr.org/proceedings/papers/v22/bogojeska12/bogojeska12.pdf},
  supplementary = {Supplementary:http://jmlr.org/proceedings/papers/v22/bogojeska12/bogojeska12Supple.pdf},
}

repository: mreid/papersite

repo_name: mreid/papersite

gha_language: TeX


text:
@InProceedings{giesen14,
  title = {Robust and Efficient Kernel Hyperparameter Paths with Guarantees},
  author = {Joachim Giesen and Soeren Laue and Patrick Wieschollek},
  pages = {1296-1304},
  abstract = {Algorithmically, many machine learning tasks boil down to solving  parameterized optimization problems. Finding good values for the  parameters has significant influence on the statistical performance  of these methods. Thus supporting the choice of parameter values  algorithmically has received quite some attention recently,  especially algorithms for computing the whole solution path of  parameterized optimization problem. These algorithms can be used,  for instance, to track the solution of a regularized learning  problem along the regularization parameter path, or for tracking the  solution of kernelized problems along a kernel hyperparameter  path. Since exact path following algorithms can be numerically  unstable, robust and efficient approximate path tracking algorithms  became popular for regularized learning problems. By now algorithms  with optimal path complexity are known for many regularized learning  problems. That is not the case for kernel hyperparameter path  tracking algorithms, where the exact path tracking algorithms can  also suffer from numerical instabilities. The robust approximation  algorithms for regularization path tracking can not be used directly  for kernel hyperparameter path tracking problems since the latter  fall into a different problem class. Here we address this problem by  devising a robust and efficient path tracking algorithm that can  also handle kernel hyperparameter paths and has asymptotically  optimal complexity. We use this algorithm to compute approximate  kernel hyperparamter solution paths for support vector machines and  robust kernel regression. Experimental results for this problem  applied to various data sets confirms the theoretical complexity  analysis.},
  section = {cycle-2},
}

license: MIT

license_type: permissive

branch_name: refs/heads/master

gha_license_id: MIT

extension: bib


text:
@inproceedings{10.1145/6012.15399,
author = {Bancilhon, Francois and Maier, David and Sagiv, Yehoshua and Ullman, Jeffrey D},
title = {Magic Sets and Other Strange Ways to Implement Logic Programs (Extended Abstract)},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15399},
doi = {10.1145/6012.15399},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {1–15},
numpages = {15},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.6013,
author = {Sacc\`{a}, Domenico and Zaniolo, Carlo},
title = {On the Implementation of a Simple Class of Logic Queries for Databases},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.6013},
doi = {10.1145/6012.6013},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {16–23},
numpages = {8},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15400,
author = {Afrati, Foto and Papadimitriou, Christos and Papageorgiou, George and Roussou, Athena and Sagiv, Yehoshua and Ullman, Jeffrey D},
title = {Convergence of Sideways Query Evaluation},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15400},
doi = {10.1145/6012.15400},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {24–30},
numpages = {7},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15401,
author = {Weikum, Gerhard},
title = {A Theoretical Foundation of Multi-Level Concurrency Control},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15401},
doi = {10.1145/6012.15401},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {31–43},
numpages = {13},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15402,
author = {Hadzilacos, Thanasis and Yannakakis, Mihalis},
title = {Deleting Completed Transactions},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15402},
doi = {10.1145/6012.15402},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {43–46},
numpages = {4},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15403,
author = {Su, Jianwen},
title = {Safety of Non-Well-Locked Transaction Systems},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15403},
doi = {10.1145/6012.15403},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {47–52},
numpages = {6},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15404,
author = {Bancilhon, Francois and Khoshafian, Setrag},
title = {A Calculus for Complex Objects},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15404},
doi = {10.1145/6012.15404},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {53–60},
numpages = {8},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15405,
author = {Van Gucht, Dirk and Fischer, Patrick C},
title = {Some Classes of Multilevel Relational Structures},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15405},
doi = {10.1145/6012.15405},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {60–69},
numpages = {10},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15406,
author = {Gadia, Shashi K},
title = {Weak Temporal Relations},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15406},
doi = {10.1145/6012.15406},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {70–77},
numpages = {8},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15407,
author = {Olken, Frank and Rotem, Doron},
title = {Rearranging Data to Maximize the Efficiency of Compression},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15407},
doi = {10.1145/6012.15407},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {78–90},
numpages = {13},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.6014,
author = {Robinson, John T.},
title = {Order Preserving Linear Hashing Using Dynamic Key Statistics},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.6014},
doi = {10.1145/6012.6014},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {91–99},
numpages = {9},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.6015,
author = {Otoo, Ekow J.},
title = {Balanced Multidimensional Extendible Hash Tree},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.6015},
doi = {10.1145/6012.6015},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {100–113},
numpages = {14},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15408,
author = {Naqvi, Shamim A},
title = {Negation as Failure for First-Order Queries},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15408},
doi = {10.1145/6012.15408},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {114–122},
numpages = {9},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15409,
author = {Bidoit, Nicole and Hull, Richard},
title = {Positivism vs Minimalism in Deductive Databases},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15409},
doi = {10.1145/6012.15409},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {123–132},
numpages = {10},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15410,
author = {Gelfond, M and Przymusinska, H and Przymusinski, T},
title = {The Extended Closed World Assumption and Its Relationship to Parallel Circumscription},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15410},
doi = {10.1145/6012.15410},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {133–139},
numpages = {7},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15411,
author = {Chan, E P F and Atzeni, Paolo},
title = {On the Properties and Characterization of Connection-Trap-Free Schemes},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15411},
doi = {10.1145/6012.15411},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {140–147},
numpages = {8},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15412,
author = {Biskup, H and Schnetgoke, L},
title = {One Flavor Assumption and Gamma-Acyclicity for Universal Relation Views},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15412},
doi = {10.1145/6012.15412},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {148–159},
numpages = {12},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15413,
author = {Sagiv, Yehoshua and Shmueli, Oded},
title = {The Equivalence of Solving Queries and Producing Tree Projections (Extended Abstract)},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15413},
doi = {10.1145/6012.15413},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {160–172},
numpages = {13},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15422,
author = {Sagiv, Yehoshua},
title = {Sagiv,Y-On Finite FD-Acyclicity},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15422},
doi = {10.1145/6012.15422},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {173–182},
numpages = {10},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15414,
author = {Ozsoyoglu, Meral and Yuan, Li Yan},
title = {Unifying Functional and Multivalued Dependencies for Relational Database Design},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15414},
doi = {10.1145/6012.15414},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {183–190},
numpages = {8},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.6016,
author = {Ruland, Detlev and Seipel, Dietmar},
title = {Alpha-Acyclic Decompositions of Relational Database Schemes},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.6016},
doi = {10.1145/6012.6016},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {191–201},
numpages = {11},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.6017,
author = {Graham, Marc H. and Wang, Ke},
title = {Constant Time Maintenance or the Triumph of the FD.},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.6017},
doi = {10.1145/6012.6017},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {202–216},
numpages = {15},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15415,
author = {Mannila, Heikki and Raiha, Kari Jouko},
title = {Test Data for Relational Queries},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15415},
doi = {10.1145/6012.15415},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {217–223},
numpages = {7},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15416,
author = {Wilkins, Marianne Winslett},
title = {A Model-Theoretic Approach to Updating Logical Databases},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15416},
doi = {10.1145/6012.15416},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {224–234},
numpages = {11},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15417,
author = {Abiteboul, Serge and Vianu, Victor},
title = {Deciding Properties of Transactional Schemas},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15417},
doi = {10.1145/6012.15417},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {235–239},
numpages = {5},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15418,
author = {El Abbadi, Amr and Toueg, Sam},
title = {Availability in Partitioned Replicated Databases},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15418},
doi = {10.1145/6012.15418},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {240–251},
numpages = {12},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15419,
author = {Vardi, Moshe},
title = {On the Integrity of Databases with Incomplete Information},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15419},
doi = {10.1145/6012.15419},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {252–266},
numpages = {15},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15420,
author = {Naughton, Jeff},
title = {Data Independent Recursion in Deductive Databases},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15420},
doi = {10.1145/6012.15420},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {267–279},
numpages = {13},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

@inproceedings{10.1145/6012.15421,
author = {Cosmadakis, S and Kanellakis, P},
title = {Parallel Evaluation of Recursive Rule Queries},
year = {1985},
isbn = {0897911792},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/6012.15421},
doi = {10.1145/6012.15421},
booktitle = {Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems},
pages = {280–293},
numpages = {14},
location = {Cambridge, Massachusetts, USA},
series = {PODS '86}
}

license: Unlicense

repository: goyalkaraniit/acm-cr

repo_name: goyalkaraniit/acm-cr

branch_name: refs/heads/main


text:
try_run(RUN_RESULT COMPILE_RESULT
  ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c
  RUN_OUTPUT_VARIABLE
  )

extension: cmake


text:
SECTION = "console/utils"
DESCRIPTION = "Tools for performance analysis."
LICENSE = "GPL"
RDEPENDS_${PN} = "debianutils"

PR = "r4"

inherit autotools

SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
	   file://debian.patch \
	   file://exe.patch \
	   file://gnu-os-rundir.patch \
	   file://lmbench-run"
S = "${WORKDIR}/lmbench-${PV}"

EXTRA_OEMAKE = '"CC=${CC}" "AR=${AR}" "CFLAGS=$CFLAGS" \
		"LDFLAGS=${LDFLAGS}" "LD=${LD}" "OS=${TARGET_SYS}" \
		"TARGET=${TARGET_OS}" "O=${S}/bin/${TARGET_SYS}"'

python do_unpack () {
	bb.build.exec_func('base_do_unpack', d)
	bb.build.exec_func('byebk_do_unpack', d)
}

byebk_do_unpack () {
	find ${S}/.. -name BitKeeper -o -name SCCS | xargs rm -rf
}

do_configure() {
	:
}

do_compile () {
	. ${CONFIG_SITE}
	if [ X"$ac_cv_uint" = X"yes" ]; then
		CFLAGS="${CFLAGS} -DHAVE_uint"
	fi
	install -d ${S}/bin/${TARGET_SYS}
	oe_runmake -C src exe
	sed -i -e 's,^SHAREDIR=.*$,SHAREDIR=${datadir}/${PN},;' \
	       -e 's,^BINDIR=.*$,BINDIR=${libdir}/${PN},;' ${WORKDIR}/lmbench-run
}

do_install () {
	oe_runmake 'PREFIX=${D}${prefix}' \
		   'SHAREDIR=${D}${datadir}/${PN}' \
		   'BINDIR=${D}${libdir}/lmbench' install
	install -d ${D}${localstatedir}/lib/lmbench/config \
		   ${D}${localstatedir}/run/lmbench \
		   ${D}${bindir}
	install -m 0755 ${WORKDIR}/lmbench-run ${D}${bindir}/
}

SRC_URI[md5sum] = "eddf56af6f248812e3016a9e34b42bbd"
SRC_URI[sha256sum] = "5a729a49ce591a58d241ac39979cb496ab30687556633782557196d2b262921e"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty

branch_name: HEAD

extension: bb


text:
SUMMARY = "Python package for providing Mozilla's CA Bundle."
HOMEPAGE = "https://certifiio.readthedocs.io/en/latest/"
AUTHOR = "Kenneth Reitz <me@kennethreitz.com>"
LICENSE = "MPL-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=67da0714c3f9471067b729eca6c9fbe8"

SRC_URI = "https://files.pythonhosted.org/packages/6c/ae/d26450834f0acc9e3d1f74508da6df1551ceab6c2ce0766a593362d6d57f/certifi-2021.10.8.tar.gz"
SRC_URI[md5sum] = "880ed9e5d04aff8f46f5ff82a3a3e395"
SRC_URI[sha256sum] = "78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"

S = "${WORKDIR}/certifi-2021.10.8"

RDEPENDS:${PN} = ""

inherit setuptools3


text:
package main

import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"math/rand"
	"net"
	"os"
	"os/exec"
	"path/filepath"
	"runtime"
	"sort"
	"strconv"
	"strings"
	"time"

	"github.com/rit-k8s-rdma/rit-k8s-rdma-common/knapsack_pod_placement"
	"github.com/rit-k8s-rdma/rit-k8s-rdma-common/rdma_hardware_info"
	types040 "github.com/rit-k8s-rdma/rit-k8s-rdma-sriov-cni/sriov/cni/types"
	"github.com/rit-k8s-rdma/rit-k8s-rdma-sriov-cni/sriov/cni/types/current"
	"github.com/rit-k8s-rdma/rit-k8s-rdma-sriov-cni/sriov/cni/types/types020"
	sriovnet "github.com/rit-k8s-rdma/rit-k8s-rdma-sriovnet"

	"github.com/containernetworking/cni/pkg/ipam"
	"github.com/containernetworking/cni/pkg/ns"
	"github.com/containernetworking/cni/pkg/skel"
	"github.com/containernetworking/cni/pkg/types"
	"github.com/fabiokung/shm"
	"github.com/vishvananda/netlink"
	vishNetns "github.com/vishvananda/netns"

	//	errors2 "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/tools/clientcmd"
)

const defaultCNIDir = "/var/lib/cni/sriov"
const maxSharedVf = 2

type dpdkConf struct {
	PCIaddr    string `json:"pci_addr"`
	Ifname     string `json:"ifname"`
	KDriver    string `json:"kernel_driver"`
	DPDKDriver string `json:"dpdk_driver"`
	DPDKtool   string `json:"dpdk_tool"`
	VFID       int    `json:"vfid"`
}

type NetConf struct {
	types.NetConf
	DPDKMode bool
	Sharedvf bool
	DPDKConf dpdkConf `json:"dpdk,omitempty"`
	CNIDir   string   `json:"cniDir"`
	IF0NAME  string   `json:"if0name"`
	L2Mode   bool     `json:"l2enable"`
	Vlan     int      `json:"vlan"`
}

type pfInfo struct {
	PFNdevName string
	NumVfs     int
}

type pfList []*pfInfo

func (s pfList) Len() int {
	return len(s)
}

func (s pfList) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s pfList) Less(i, j int) bool {
	return s[i].NumVfs > s[j].NumVfs
}

// Link names given as os.FileInfo need to be sorted by their Index

type LinksByIndex []os.FileInfo

// LinksByIndex implements sort.Inteface
func (l LinksByIndex) Len() int { return len(l) }

func (l LinksByIndex) Swap(i, j int) { l[i], l[j] = l[j], l[i] }

func (l LinksByIndex) Less(i, j int) bool {
	link_a, _ := netlink.LinkByName(l[i].Name())
	link_b, _ := netlink.LinkByName(l[j].Name())

	return link_a.Attrs().Index < link_b.Attrs().Index
}

func init() {
	// this ensures that main runs only on main thread (thread group leader).
	// since namespace ops (unshare, setns) are done for a single thread, we
	// must ensure that the goroutine does not jump from OS thread to thread
	runtime.LockOSThread()
}

func setVfBandwidthLimits(pfName string, vfNumber string, minTxRate string, maxTxRate string) error {
	cmnd := exec.Command("/sbin/ip", "link", "set", "dev", pfName, "vf", vfNumber, "max_tx_rate", maxTxRate, "min_tx_rate", minTxRate)
	err := cmnd.Start()
	if err != nil {
		return fmt.Errorf("Iproute2 command failed with message: %s", err)
	}

	return nil
}

func checkIf0name(ifname string) bool {
	op := []string{"eth0", "eth1", "lo", ""}
	for _, if0name := range op {
		if strings.Compare(if0name, ifname) == 0 {
			return false
		}
	}

	return true
}

func loadConf(bytes []byte) (*NetConf, error) {
	n := &NetConf{}
	if err := json.Unmarshal(bytes, n); err != nil {
		return nil, fmt.Errorf("failed to load netconf: %v", err)
	}

	if n.IF0NAME != "" {
		err := checkIf0name(n.IF0NAME)
		if err != true {
			return nil, fmt.Errorf(`"if0name" field should not be  equal to (eth0 | eth1 | lo | ""). It specifies the virtualized interface name in the pod`)
		}
	}

	if n.CNIDir == "" {
		n.CNIDir = defaultCNIDir
	}

	if (dpdkConf{}) != n.DPDKConf {
		n.DPDKMode = true
	}

	return n, nil
}

func saveScratchNetConf(containerID, dataDir string, netconf []byte) error {
	if err := os.MkdirAll(dataDir, 0700); err != nil {
		return fmt.Errorf("failed to create the sriov data directory(%q): %v", dataDir, err)
	}

	path := filepath.Join(dataDir, containerID)

	err := ioutil.WriteFile(path, netconf, 0600)
	if err != nil {
		return fmt.Errorf("failed to write container data in the path(%q): %v", path, err)
	}

	return err
}

func consumeScratchNetConf(containerID, dataDir string) ([]byte, error) {
	path := filepath.Join(dataDir, containerID)
	defer os.Remove(path)

	data, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, fmt.Errorf("failed to read container data in the path(%q): %v", path, err)
	}

	return data, err
}

func saveNetConf(cid, dataDir string, conf *NetConf) error {
	confBytes, err := json.Marshal(conf)
	if err != nil {
		return fmt.Errorf("error serializing delegate netconf: %v", err)
	}

	s := []string{cid, conf.DPDKConf.Ifname}
	cRef := strings.Join(s, "-")

	// save the rendered netconf for cmdDel
	if err = saveScratchNetConf(cRef, dataDir, confBytes); err != nil {
		return err
	}

	return nil
}

func (nc *NetConf) getNetConf(cid, podIfName, dataDir string, conf *NetConf) error {
	s := []string{cid, podIfName}
	cRef := strings.Join(s, "-")

	confBytes, err := consumeScratchNetConf(cRef, dataDir)
	if err != nil {
		return err
	}

	if err = json.Unmarshal(confBytes, nc); err != nil {
		return fmt.Errorf("failed to parse netconf: %v", err)
	}

	return nil
}

// Devices is ordered by its number of VFs, device that has the
// most number of vfs will be first in the list.
func getOrderedPF(devices []string) ([]string, error) {
	//check pf devices
	var pfs pfList
	for _, pfName := range devices {
		vfDir := fmt.Sprintf("/sys/class/net/%s/device/virtfn*/net/*", pfName) /* */
		vfs, err := filepath.Glob(vfDir)
		if err != nil {
			return nil, err
		}
		pfs = append(pfs, &pfInfo{pfName, len(vfs)})
	}

	sort.Sort(pfs)

	var result []string
	for _, pf := range pfs {
		result = append(result, pf.PFNdevName)
	}
	return result, nil
}

func enabledpdkmode(conf *dpdkConf, ifname string, dpdkmode bool) error {
	stdout := &bytes.Buffer{}
	var driver string
	var device string

	if dpdkmode != false {
		driver = conf.DPDKDriver
		device = ifname
	} else {
		driver = conf.KDriver
		device = conf.PCIaddr
	}

	cmd := exec.Command(conf.DPDKtool, "-b", driver, device)
	cmd.Stdout = stdout
	err := cmd.Run()
	if err != nil {
		return fmt.Errorf("DPDK binding failed with err msg %q:", stdout.String())
	}

	stdout.Reset()
	return nil
}

func getpciaddress(ifName string, vf int) (string, error) {
	var pciaddr string
	vfDir := fmt.Sprintf("/sys/class/net/%s/device/virtfn%d", ifName, vf)
	dirInfo, err := os.Lstat(vfDir)
	if err != nil {
		return pciaddr, fmt.Errorf("can't get the symbolic link of virtfn%d dir of the device %q: %v", vf, ifName, err)
	}

	if (dirInfo.Mode() & os.ModeSymlink) == 0 {
		return pciaddr, fmt.Errorf("No symbolic link for the virtfn%d dir of the device %q", vf, ifName)
	}

	pciinfo, err := os.Readlink(vfDir)
	if err != nil {
		return pciaddr, fmt.Errorf("can't read the symbolic link of virtfn%d dir of the device %q: %v", vf, ifName, err)
	}

	pciaddr = pciinfo[len("../"):]
	return pciaddr, nil
}

func getSharedPF(ifName string) (string, error) {
	pfName := ""
	pfDir := fmt.Sprintf("/sys/class/net/%s", ifName)
	dirInfo, err := os.Lstat(pfDir)
	if err != nil {
		return pfName, fmt.Errorf("can't get the symbolic link of the device %q: %v", ifName, err)
	}

	if (dirInfo.Mode() & os.ModeSymlink) == 0 {
		return pfName, fmt.Errorf("No symbolic link for dir of the device %q", ifName)
	}

	fullpath, err := filepath.EvalSymlinks(pfDir)
	parentDir := fullpath[:len(fullpath)-len(ifName)]
	dirList, err := ioutil.ReadDir(parentDir)

	for _, file := range dirList {
		if file.Name() != ifName {
			pfName = file.Name()
			return pfName, nil
		}
	}

	return pfName, fmt.Errorf("Shared PF not found")
}

func getsriovNumfs(ifName string) (int, error) {
	var vfTotal int

	sriovFile := fmt.Sprintf("/sys/class/net/%s/device/sriov_numvfs", ifName)
	if _, err := os.Lstat(sriovFile); err != nil {
		return vfTotal, fmt.Errorf("failed to open the sriov_numfs of device %q: %v", ifName, err)
	}

	data, err := ioutil.ReadFile(sriovFile)
	if err != nil {
		return vfTotal, fmt.Errorf("failed to read the sriov_numfs of device %q: %v", ifName, err)
	}

	if len(data) == 0 {
		return vfTotal, fmt.Errorf("no data in the file %q", sriovFile)
	}

	sriovNumfs := strings.TrimSpace(string(data))
	i64, err := strconv.ParseInt(sriovNumfs, 10, 0)
	if err != nil {
		return vfTotal, fmt.Errorf("failed to convert sriov_numfs(byte value) to int of device %q: %v", ifName, err)
	}

	return int(i64), nil
}

func setSharedVfVlan(ifName string, vfIdx int, vlan int) error {
	var err error
	var sharedifName string

	vfDir := fmt.Sprintf("/sys/class/net/%s/device/net", ifName)
	if _, err := os.Lstat(vfDir); err != nil {
		return fmt.Errorf("failed to open the net dir of the device %q: %v", ifName, err)
	}

	infos, err := ioutil.ReadDir(vfDir)
	if err != nil {
		return fmt.Errorf("failed to read the net dir of the device %q: %v", ifName, err)
	}

	if len(infos) != maxSharedVf {
		return fmt.Errorf("Given PF - %q is not having shared VF", ifName)
	}

	for _, dir := range infos {
		if strings.Compare(ifName, dir.Name()) != 0 {
			sharedifName = dir.Name()
		}
	}

	if sharedifName == "" {
		return fmt.Errorf("Shared ifname can't be empty")
	}

	iflink, err := netlink.LinkByName(sharedifName)
	if err != nil {
		return fmt.Errorf("failed to lookup the shared ifname %q: %v", sharedifName, err)
	}

	if err := netlink.LinkSetVfVlan(iflink, vfIdx, vlan); err != nil {
		return fmt.Errorf("failed to set vf %d vlan: %v for shared ifname %q", vfIdx, err, sharedifName)
	}

	return nil
}

func configSriov(master string) error {
	err := sriovnet.EnableSriov(master)
	if err != nil {
		return err
	}

	handle, err2 := sriovnet.GetPfNetdevHandle(master)
	if err2 != nil {
		return err2
	}
	// configure privilege VFs
	err2 = sriovnet.ConfigVfs(handle, true)
	if err2 != nil {
		return err2
	}
	return nil
}

func setupVF(conf *NetConf, ifName string, podifName string, cid string, netns ns.NetNS, pod_interfaces_required knapsack_pod_placement.RdmaInterfaceRequest) (*int, error) {
	log.Println("RIT-CNI: ENTERING setupVF")

	var vfIdx int
	var infos []os.FileInfo
	var pciAddr string

	m, err := netlink.LinkByName(ifName)
	if err != nil {
		return nil, fmt.Errorf("failed to lookup master %q: %v", ifName, err)
	}

	// get the ifname sriov vf num
	vfTotal, err := getsriovNumfs(ifName)
	if err != nil {
		return nil, err
	}

	for vf := 0; vf <= (vfTotal - 1); vf++ {
		vfDir := fmt.Sprintf("/sys/class/net/%s/device/virtfn%d/net", ifName, vf)
		if _, err := os.Lstat(vfDir); err != nil {
			if vf == (vfTotal - 1) {
				return nil, fmt.Errorf("failed to open the virtfn%d dir of the device %q: %v", vf, ifName, err)
			}
			continue
		}

		infos, err = ioutil.ReadDir(vfDir)
		if err != nil {
			return nil, fmt.Errorf("failed to read the virtfn%d dir of the device %q: %v", vf, ifName, err)
		}

		if (len(infos) == 0) && (vf == (vfTotal - 1)) {
			return nil, fmt.Errorf("no Virtual function exist in directory %s, last vf is virtfn%d", vfDir, vf)
		}

		if (len(infos) == 0) && (vf != (vfTotal - 1)) {
			continue
		}

		if len(infos) == maxSharedVf {
			conf.Sharedvf = true
		}

		if len(infos) <= maxSharedVf {
			vfIdx = vf
			pciAddr, err = getpciaddress(ifName, vfIdx)
			if err != nil {
				return nil, fmt.Errorf("err in getting pci address - %q", err)
			}

			err := setVfBandwidthLimits(
				ifName,
				fmt.Sprintf("%d", vfIdx),
				fmt.Sprintf("%d", pod_interfaces_required.MinTxRate),
				fmt.Sprintf("%d", pod_interfaces_required.MaxTxRate))
			if err != nil {
				return &vfIdx, fmt.Errorf("Failed setting the min and max tx rates on PF[%s] VF[%d]: %s", ifName, vf, err)
			}

			break
		} else {
			return nil, fmt.Errorf("mutiple network devices in directory %s", vfDir)
		}
	}

	// VF NIC name
	if len(infos) != 1 && len(infos) != maxSharedVf {
		return &vfIdx, fmt.Errorf("no virutal network resources avaiable for the %q", ifName)
	}

	if conf.Sharedvf != false && conf.L2Mode != true {
		return &vfIdx, fmt.Errorf("l2enable mode must be true to use shared net interface %q", ifName)
	}

	if conf.Vlan != 0 {
		if err = netlink.LinkSetVfVlan(m, vfIdx, conf.Vlan); err != nil {
			return &vfIdx, fmt.Errorf("failed to set vf %d vlan: %v", vfIdx, err)
		}

		if conf.Sharedvf {
			if err = setSharedVfVlan(ifName, vfIdx, conf.Vlan); err != nil {
				return &vfIdx, fmt.Errorf("failed to set shared vf %d vlan: %v", vfIdx, err)
			}
		}
	}

	conf.DPDKConf.PCIaddr = pciAddr
	conf.DPDKConf.Ifname = podifName
	conf.DPDKConf.VFID = vfIdx
	if conf.DPDKMode != false {
		if err = saveNetConf(cid, conf.CNIDir, conf); err != nil {
			return &vfIdx, err
		}
		return &vfIdx, enabledpdkmode(&conf.DPDKConf, infos[0].Name(), true)
	}

	// Sort links name if there are 2 or more PF links found for a VF;
	if len(infos) > 1 {
		// sort Links FileInfo by their Link indices
		sort.Sort(LinksByIndex(infos))
	}

	var vfName string
	for i := 1; i <= len(infos); i++ {
		log.Println("RIT-CNI: chose link name: ", infos[i-1].Name())
		vfDev, err := netlink.LinkByName(infos[i-1].Name())
		if err != nil {
			return &vfIdx, fmt.Errorf("failed to lookup vf device %q: %v", infos[i-1].Name(), err)
		}
		// change name if it is eth0
		if infos[i-1].Name() == "eth0" {
			log.Println("RIT-CNI: link name = 'etho0' for some reason... renaming link: ", infos[i-1].Name())
			netlink.LinkSetDown(vfDev)
			vfName = fmt.Sprintf("sriov%v", rand.Intn(9999))
			renameLink(infos[i-1].Name(), vfName)
		} else {
			vfName = infos[i-1].Name()
		}
		log.Println("RIT-CNI: setting up link: ", vfDev)
		if err = netlink.LinkSetUp(vfDev); err != nil {
			return &vfIdx, fmt.Errorf("failed to setup vf %d device: %v", vfIdx, err)
		} else {
			log.Println("RIT-CNI: succesfully setup link: ", vfDev)
		}

		// move VF device to ns
		if err = netlink.LinkSetNsFd(vfDev, int(netns.Fd())); err != nil {
			return &vfIdx, fmt.Errorf("failed to move vf %d to netns: %v", vfIdx, err)
		}
	}

	return &vfIdx, netns.Do(func(_ ns.NetNS) error {

		ifName := podifName
		for i := 1; i <= len(infos); i++ {
			if len(infos) == maxSharedVf && i == len(infos) {
				ifName = podifName + fmt.Sprintf("d%d", i-1)
			}

			err := renameLink(vfName, ifName)
			if err != nil {
				return fmt.Errorf("failed to rename %d vf of the device %q to %q: %v", vfIdx, infos[i-1].Name(), ifName, err)
			}

			// for L2 mode enable the pod net interface
			if conf.L2Mode != false {
				err = setUpLink(ifName)
				if err != nil {
					return fmt.Errorf("failed to set up the pod interface name %q: %v", ifName, err)
				}
			}
		}
		if err = saveNetConf(cid, conf.CNIDir, conf); err != nil {
			return fmt.Errorf("failed to save pod interface name %q: %v", ifName, err)
		}
		return nil
	})
}

func releaseVF(conf *NetConf, podifName string, cid string, netns ns.NetNS, pfName string, vfNumber *int) error {
	log.Println("RIT-CNI: RELEASEVF")

	nf := &NetConf{}
	// get the net conf in cniDir
	if err := nf.getNetConf(cid, podifName, conf.CNIDir, conf); err != nil {
		return err
	}

	// check for the DPDK mode and release the allocated DPDK resources
	if nf.DPDKMode != false {
		// bind the sriov vf to the kernel driver
		if err := enabledpdkmode(&nf.DPDKConf, nf.DPDKConf.Ifname, false); err != nil {
			return fmt.Errorf("DPDK: failed to bind %s to kernel space: %s", nf.DPDKConf.Ifname, err)
		}

		// reset vlan for DPDK code here
		pfLink, err := netlink.LinkByName(pfName)
		if err != nil {
			return fmt.Errorf("DPDK: master device %s not found: %v", pfName, err)
		}

		if err = netlink.LinkSetVfVlan(pfLink, nf.DPDKConf.VFID, 0); err != nil {
			return fmt.Errorf("DPDK: failed to reset vlan tag for vf %d: %v", nf.DPDKConf.VFID, err)
		}

		return nil
	}

	initns, err := ns.GetCurrentNS()
	if err != nil {
		return fmt.Errorf("failed to get init netns: %v", err)
	}

	if err = netns.Set(); err != nil {
		return fmt.Errorf("failed to enter netns %q: %v", netns, err)
	}

	if conf.L2Mode != false {
		//check for the shared vf net interface
		ifName := podifName + "d1"
		_, err := netlink.LinkByName(ifName)
		if err == nil {
			conf.Sharedvf = true
		}

	}

	if err != nil {
		fmt.Errorf("Enable to get shared PF device: %v", err)
	}

	for i := 1; i <= maxSharedVf; i++ {
		ifName := podifName
		pfName := pfName
		if i == maxSharedVf {
			ifName = podifName + fmt.Sprintf("d%d", i-1)
			pfName, err = getSharedPF(pfName)
			if err != nil {
				return fmt.Errorf("Failed to look up shared PF device: %v:", err)
			}
		}

		// get VF device
		vfDev, err := netlink.LinkByName(ifName)
		if err != nil {
			return fmt.Errorf("failed to lookup vf device %q: %v", ifName, err)
		}

		// device name in init netns
		index := vfDev.Attrs().Index
		devName := fmt.Sprintf("dev%d", index)

		// shutdown VF device
		if err = netlink.LinkSetDown(vfDev); err != nil {
			return fmt.Errorf("failed to down vf device %q: %v", ifName, err)
		}

		log.Printf("RIT-CNI: rename link: %s to %s\n", ifName, devName)
		// rename VF device
		err = renameLink(ifName, devName)
		if err != nil {
			return fmt.Errorf("failed to rename vf device %q to %q: %v", ifName, devName, err)
		}

		// move VF device to init netns
		if err = netlink.LinkSetNsFd(vfDev, int(initns.Fd())); err != nil {
			return fmt.Errorf("failed to move vf device %q to init netns: %v", ifName, err)
		}

		// reset vlan
		if conf.Vlan != 0 {
			err = initns.Do(func(_ ns.NetNS) error {
				return resetVfVlan(pfName, devName)
			})
			if err != nil {
				return fmt.Errorf("failed to reset vlan: %v", err)
			}
		}

		if vfNumber != nil {
			err = initns.Do(func(_ ns.NetNS) error {
				log.Println("RIT-CNI: doing initns stuff: ", *vfNumber)
				if err = setVfBandwidthLimits(pfName, fmt.Sprintf("%d", *vfNumber), "0", "0"); err != nil {
					return fmt.Errorf("Failed resetting bandwidth limits: %s", err)
				}
				// if err = netlink.LinkSetMinMaxVfTxRate(vfDev, int(foundVf.VFNumber), uint32(0), uint32(0)); err != nil {
				// 	log.Printf("Error setting mac address back to 0: %s\n", podInterface.HardwareAddr.String())
				// 	return fmt.Errorf("Error setting mac address back to 0: %s\n", podInterface.HardwareAddr.String())
				// }
				return nil
			})
			if err != nil {
				log.Println("RIT-CNI: ERROR setting the stuff")
				return fmt.Errorf("failed to reset min/max speed: %v", err)
			}
		}

		//break the loop, if the namespace has no shared vf net interface
		if conf.Sharedvf != true {
			break
		}
	}

	return nil
}

func releaseVFCustom(conf *NetConf, podInterface net.Interface, cid string, podNetNs string, pfs []rdma_hardware_info.PF) error {
	log.Println("RIT-CNI: RELEASEVF")
	// secure the thread for namespace operations
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	netns, err := ns.GetNS(podNetNs)
	if err != nil {
		return fmt.Errorf("failed to open pod netnamespace %q: %v", netns, err)
	}
	defer netns.Close()

	log.Println("RIT-CNI: starting up th netConf")
	nf := &NetConf{}
	// get the net conf in cniDir
	if err := nf.getNetConf(cid, podInterface.Name, conf.CNIDir, conf); err != nil {
		return err
	}
	var foundVf *rdma_hardware_info.VF
	var foundPfName string
	for _, pf := range pfs {
		foundVf = pf.FindAssociatedMac(podInterface.HardwareAddr.String())
		if foundVf != nil {
			foundPfName = pf.Name
			break
		}
	}
	if foundVf == nil {
		log.Printf("Error mac address never found: %s\n", podInterface.HardwareAddr.String())
		log.Println("Error never found pfName of device to release")
	}

	// check for the DPDK mode and release the allocated DPDK resources
	if nf.DPDKMode != false {
		// bind the sriov vf to the kernel driver
		if err := enabledpdkmode(&nf.DPDKConf, nf.DPDKConf.Ifname, false); err != nil {
			return fmt.Errorf("DPDK: failed to bind %s to kernel space: %s", nf.DPDKConf.Ifname, err)
		}

		// reset vlan for DPDK code here
		pfLink, err := netlink.LinkByName(foundPfName)
		if err != nil {
			return fmt.Errorf("DPDK: master device %s not found: %v", foundPfName, err)
		}

		if err = netlink.LinkSetVfVlan(pfLink, nf.DPDKConf.VFID, 0); err != nil {
			return fmt.Errorf("DPDK: failed to reset vlan tag for vf %d: %v", nf.DPDKConf.VFID, err)
		}

		return nil
	}

	log.Println("RIT-CNI: current ns")
	initns, err := ns.GetCurrentNS()
	if err != nil {
		return fmt.Errorf("failed to get init the current netns: %v", err)
	}
	defer initns.Close()

	log.Println("RIT-CNI: net ns set it up ")
	if err = netns.Set(); err != nil {
		return fmt.Errorf("failed to enter pod netns %q: %v", netns, err)
	}
	defer netns.Close()
	defer func() {
		log.Println("RIT-CNI: closing initns")
		if err = initns.Set(); err != nil {
			log.Printf("Error cleaning up: failed to setting back namespace %q: %v\n", initns, err)
		} else {
			log.Println("RIT-CNI: success!")
		}
	}()

	if conf.L2Mode != false {
		//check for the shared vf net interface
		ifName := podInterface.Name + "d1"
		_, err := netlink.LinkByName(ifName)
		if err == nil {
			conf.Sharedvf = true
		}

	}

	if err != nil {
		fmt.Errorf("Enable to get shared PF device: %v", err)
	}

	for i := 1; i <= maxSharedVf; i++ {

		log.Println("RIT-CNI: yasdfasdf ", podInterface.Name)
		ifName := podInterface.Name
		pfName := foundPfName
		if i == maxSharedVf {
			ifName = podInterface.Name + fmt.Sprintf("d%d", i-1)
			pfName, err = getSharedPF(foundPfName)
			if err != nil {
				return fmt.Errorf("failed to look up shared PF device: %v:", err)
			}
		}

		// get VF device
		vfDev, err := netlink.LinkByName(ifName)
		if err != nil {
			return fmt.Errorf("failed to lookup vf device %q: %v", ifName, err)
		}

		// device name in init netns
		index := vfDev.Attrs().Index
		devName := fmt.Sprintf("dev%d", index)

		// shutdown VF device
		if err = netlink.LinkSetDown(vfDev); err != nil {
			return fmt.Errorf("failed to down vf device %q: %v", ifName, err)
		}

		log.Printf("RIT-CNI: rename link: %s to %s\n", ifName, devName)
		// rename VF device
		err = renameLink(ifName, devName)
		if err != nil {
			return fmt.Errorf("failed to rename vf device %q to %q: %v", ifName, devName, err)
		}

		// move VF device to init netns
		if err = netlink.LinkSetNsFd(vfDev, int(initns.Fd())); err != nil {
			return fmt.Errorf("failed to move vf device %q to init netns: %v", ifName, err)
		}

		log.Println("RIT-CNI: vlan")
		// reset vlan
		if conf.Vlan != 0 {
			err = initns.Do(func(_ ns.NetNS) error {
				return resetVfVlan(pfName, devName)
			})
			if err != nil {
				return fmt.Errorf("failed to reset vlan: %v", err)
			}
		}

		err = initns.Do(func(_ ns.NetNS) error {
			log.Println("RIT-CNI: doing initns stuff ", foundVf.VFNumber, vfDev, foundVf)
			if err = setVfBandwidthLimits(foundPfName, fmt.Sprintf("%d", foundVf.VFNumber), "0", "0"); err != nil {
				return fmt.Errorf("Failed resetting bandwidth limits: %s", err)
			}
			// if err = netlink.LinkSetMinMaxVfTxRate(vfDev, int(foundVf.VFNumber), uint32(0), uint32(0)); err != nil {
			// 	log.Printf("Error setting mac address back to 0: %s\n", podInterface.HardwareAddr.String())
			// 	return fmt.Errorf("Error setting mac address back to 0: %s\n", podInterface.HardwareAddr.String())
			// }
			return nil
		})
		if err != nil {
			log.Println("RIT-CNI: ERROR setting the stuff")
			return fmt.Errorf("failed to reset min/max speed: %v", err)
		}

		//break the loop, if the namespace has no shared vf net interface
		if conf.Sharedvf != true {
			break
		}
	}

	log.Println("RIT-CNI: done")

	return nil
}

func resetVfVlan(pfName, vfName string) error {
	// get the ifname sriov vf num
	vfTotal, err := getsriovNumfs(pfName)
	if err != nil {
		return err
	}

	if vfTotal <= 0 {
		return fmt.Errorf("no virtual function in the device %q", pfName)
	}

	// Get VF id
	var vf int
	idFound := false
	for vf = 0; vf < vfTotal; vf++ {
		vfDir := fmt.Sprintf("/sys/class/net/%s/device/virtfn%d/net/%s", pfName, vf, vfName)
		if _, err := os.Stat(vfDir); !os.IsNotExist(err) {
			idFound = true
			break
		}
	}

	if !idFound {
		return fmt.Errorf("failed to get VF id for %s", vfName)
	}

	pfLink, err := netlink.LinkByName(pfName)
	if err != nil {
		return fmt.Errorf("Master device %s not found\n", pfName)
	}

	if err = netlink.LinkSetVfVlan(pfLink, vf, 0); err != nil {
		return fmt.Errorf("failed to reset vlan tag for vf %d: %v", vf, err)
	}
	return nil
}

func validateSriovEnabled(pfName string) error {
	vfTotal, err := getsriovNumfs(pfName)
	if err != nil {
		return err
	}

	if vfTotal == 0 {
		err = configSriov(pfName)
		if err != nil {
			return fmt.Errorf("no virtual function in the device %q", pfName)
		}
	}
	return nil
}

func getPFs(if0 string, devs []string) ([]string, error) {
	pfs := []string{}
	if if0 != "" {
		pfs = append(pfs, if0)
	}

	for _, pf := range devs {
		if pf != if0 {
			pfs = append(pfs, pf)
		}
	}

	for _, pf := range pfs {
		err := validateSriovEnabled(pf)
		if err != nil {
			return nil, err
		}
	}

	orderedPF, err := getOrderedPF(pfs)
	if err != nil {
		return nil, err
	}
	return orderedPF, nil
}

func acquireShmMutex() (*os.File, error) {
	log.Println("RIT-CNI: Attempting to acquire shared memory mutex.")
	for i := 0; i < (60 * 5); i++ {
		sharedMutex, err := shm.Open("rdma_sriov_cni", os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
		if err != nil {
			log.Println("RIT-CNI: Sleeping for 1 second to wait for mutex.")
			time.Sleep(1 * time.Second)
			continue
		} else {
			log.Println("RIT-CNI: Successfully acquired shared memory mutex.")
			return sharedMutex, nil
		}
	}

	log.Println("RIT-CNI: Reached timeout waiting for shared memory mutex to become available. Assuming existing file was left by crashed program.")
	//we reached the timeout, assume the file was left by a previous instance that crashed
	sharedMutex, err := shm.Open("rdma_sriov_cni", os.O_RDWR|os.O_EXCL, 0600)
	if err != nil {
		return nil, fmt.Errorf("Could not open shared mutex file after timeout: %s", err)
	}

	log.Println("RIT-CNI: Opened existing shared memory mutex file.")
	return sharedMutex, nil
}

func releaseShmMutex(mutexFile *os.File) error {
	log.Println("RIT-CNI: Attempting to release shared memory mutex.")
	defer mutexFile.Close()
	err := shm.Unlink(mutexFile.Name())
	if err != nil {
		log.Printf("RIT-CNI: Failed to release shared memory mutex: %s", err)
		return fmt.Errorf("Failed to release shared memory mutex: %s", err)
	}

	log.Println("RIT-CNI: Successfully released shared memory mutex.")
	return nil
}

func cmdAdd(args *skel.CmdArgs) error {
	log.Println("RIT-CNI: CMDADD")

	//acquire shared memory mutex
	shmMutexFile, err := acquireShmMutex()
	if err != nil {
		log.Println("RIT-CNI: %s", err)
		log.Fatal("Unable to acquire shared memory mutex.")
	}
	defer releaseShmMutex(shmMutexFile)

	pod_name := ""
	pod_ns := ""
	for _, arg_mapping := range strings.Split((*args).Args, ";") {
		key_value_pair := strings.Split(arg_mapping, "=")
		if len(key_value_pair) == 2 {
			if key_value_pair[0] == "K8S_POD_NAMESPACE" {
				pod_ns = key_value_pair[1]
			} else if key_value_pair[0] == "K8S_POD_NAME" {
				pod_name = key_value_pair[1]
			}
		}
	}

	pod_interfaces_required := getPodRequirements(pod_name, pod_ns)
	pfs_available, err := rdma_hardware_info.QueryNode("127.0.0.1", rdma_hardware_info.DefaultPort, 1500)
	if err != nil {
		log.Fatal("Could not determine what RDMA hardware resources are available.")
	}

	pod_interface_placements, placement_successful := knapsack_pod_placement.PlacePod(pod_interfaces_required, pfs_available, false)
	if !placement_successful {
		log.Fatal("Unable to fit pod into available RDMA resources on node.")
	}

	n, err := loadConf(args.StdinData)
	if err != nil {
		return fmt.Errorf("failed to load netconf: %v", err)
	}

	netns, err := ns.GetNS(args.Netns)
	if err != nil {
		return fmt.Errorf("failed to open netns %q: %v", netns, err)
	}
	defer netns.Close()

	old_ifname := os.Getenv("CNI_IFNAME")
	defer os.Setenv("CNI_IFNAME", old_ifname)
	if n.IF0NAME != "" {
		args.IfName = n.IF0NAME
		os.Setenv("CNI_IFNAME", args.IfName)
	}

	var finalResult *current.Result

	for iPodPlacement, podPlacement := range pod_interface_placements {
		pf := pfs_available[podPlacement]

		ifName := fmt.Sprintf("eth%d", iPodPlacement)
		var vfNum *int
		vfNum, err = setupVF(n, pf.Name, ifName, args.ContainerID, netns, pod_interfaces_required[iPodPlacement])
		//defer func is called when errors are encountered, will rollback any changes made
		defer func(internalIfName string) {
			if err != nil {
				err = netns.Do(func(_ ns.NetNS) error {
					_, err := netlink.LinkByName(internalIfName)
					return err
				})
				if err == nil {
					releaseVF(n, internalIfName, args.ContainerID, netns, pf.Name, vfNum)
				}
			}
		}(ifName)
		if err != nil {
			return fmt.Errorf("failed to set up pod interface %q from the device %s: %v", ifName, pf.Name, err)
		}

		// skip the IPAM allocation for the DPDK and L2 mode
		var result *types.Result
		if n.DPDKMode != false || n.L2Mode != false {
			return fmt.Errorf("error setting dpdk mode: %s", result.Print())
		}

		// run the IPAM plugin and get back the config to apply
		log.Println("RIT-CNI: starting ipam")
		result, err = ipam.ExecAdd(n.IPAM.Type, args.StdinData)
		if err != nil {
			log.Println("RIT-CNI: error getting ipam: ", err)
			return fmt.Errorf("failed to set up IPAM plugin type %q from the device %q: %v", n.IPAM.Type, ifName, err)
		}
		if result.IP4 == nil {
			log.Println("RIT-CNI: error getting ip4 from result")
			return errors.New("IPAM plugin returned missing IPv4 config")
		}
		defer func() {
			if err != nil {
				log.Println("RIT-CNI: ipam defer called")
				ipam.ExecDel(n.IPAM.Type, args.StdinData)
			}
		}()
		err = netns.Do(func(_ ns.NetNS) error {
			log.Printf("RIT-CNI: configuring interface[%s] with ip result: %+v\n", ifName, result)
			err := ipam.ConfigureIface(ifName, result)
			log.Println("RIT-CNI: finished ipam with err: ", err)
			return err
		})
		log.Println("RIT-CNI: finished configuring interface")
		if err != nil {
			log.Println("RIT-CNI: error configuring interface in device netnamespace: ", err)
			return err
		}

		result.DNS = n.DNS
		log.Printf("RIT-CNI: ipam successfully configured with: %+v\n", result)

		//must convert 0.2.0 spec that this to 0.4.0
		//need this b/c multiple interfaces are possible
		var result020 *types020.Result
		if result.IP4 != nil {
			var routes []types040.Route
			for _, route := range result.IP4.Routes {
				newRoute := types040.Route{
					Dst: route.Dst,
					GW:  route.GW,
				}
				routes = append(routes, newRoute)
			}
			result020 = &types020.Result{
				CNIVersion: types020.ImplementedSpecVersion,
				IP4: &types020.IPConfig{
					IP:      result.IP4.IP,
					Gateway: result.IP4.Gateway,
					Routes:  routes,
				},
				DNS: types040.DNS{
					Nameservers: result.DNS.Nameservers,
					Domain:      result.DNS.Domain,
					Search:      result.DNS.Search,
					Options:     result.DNS.Options,
				},
			}
		} else if result.IP6 != nil {
			//not implemented in ipam, so no need to implement it here
		}

		if result020 != nil {
			log.Printf("RIT-CNI: adding result020: %+v\n", result020)
			newResult, err := current.NewResultFromResult(result020)
			if err != nil {
				log.Println("RIT-CNI: Error converting to new result: ", err)
				continue
			}
			if finalResult == nil {
				log.Println("RIT-CNI: setting finalResult up the first time")
				finalResult = newResult
			} else {
				log.Println("RIT-CNI: setting up ip")
				if result020.IP4 != nil {
					log.Println("RIT-CNI: setting up ip4")
					log.Println("RIT-CNI: stuff", finalResult)
					finalResult.IPs = append(finalResult.IPs, &current.IPConfig{
						Version: "4",
						Address: result020.IP4.IP,
						Gateway: result020.IP4.Gateway,
					})
					log.Println("RIT-CNI: setting ip4 config")
					for _, route := range result020.IP4.Routes {
						finalResult.Routes = append(finalResult.Routes, &types040.Route{
							Dst: route.Dst,
							GW:  route.GW,
						})
					}
					log.Println("RIT-CNI: finish setting up ip4")
				}

				if result020.IP6 != nil {
					log.Println("RIT-CNI: setting up ip6")
					finalResult.IPs = append(finalResult.IPs, &current.IPConfig{
						Version: "6",
						Address: result020.IP6.IP,
						Gateway: result020.IP6.Gateway,
					})
					for _, route := range result020.IP6.Routes {
						finalResult.Routes = append(finalResult.Routes, &types040.Route{
							Dst: route.Dst,
							GW:  route.GW,
						})
					}
				}
				log.Println("RIT-CNI: finished setting up ip")
			}
			finalResult.Interfaces = append(finalResult.Interfaces, &current.Interface{
				Name: ifName,
			})
			log.Printf("RIT-CNI: finalResult current data: %+v\n", finalResult)
		}
	}
	if finalResult == nil {
		//if no interfaces were needed, than return initialized empty result
		finalResult = &current.Result{
			CNIVersion: current.ImplementedSpecVersion,
		}
	}
	log.Printf("RIT-CNI: finalResult struct: %+v\n", finalResult)
	return finalResult.Print()
}

func getNamespaceInterfaces(netnsName string) ([]net.Interface, error) {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	// get the current namespace
	origns, err := vishNetns.Get()
	if err != nil {
		return nil, fmt.Errorf("error getting origin namespace: %s", err)
	}
	defer origns.Close()

	// get the names from the path
	newns, err := vishNetns.GetFromPath(netnsName)
	if err != nil {
		return nil, fmt.Errorf("error getting netns namespace: %s", err)
	}
	defer newns.Close()

	err = vishNetns.Set(newns)
	if err != nil {
		return nil, fmt.Errorf("error setting to ns namespace: %s", err)
	}

	// get all interfaces
	ifaces, err := net.Interfaces()
	if err != nil {
		return nil, fmt.Errorf("error getting network interfaces: %s", err)
	}

	// set back to original interfaces
	err = vishNetns.Set(origns)
	if err != nil {
		return nil, fmt.Errorf("error setting back to origin namespace: %s", err)
	}
	return ifaces, nil
}

func cmdDel(args *skel.CmdArgs) error {
	n, err := loadConf(args.StdinData)
	if err != nil {
		return err
	}

	log.Println("RIT-CNI: CMDDEL starting")

	//acquire shared memory mutex
	shmMutexFile, err := acquireShmMutex()
	if err != nil {
		log.Println("RIT-CNI: %s", err)
		log.Fatal("Unable to acquire shared memory mutex.")
	}
	defer releaseShmMutex(shmMutexFile)

	// skip the IPAM release for the DPDK and L2 mode
	if n.IPAM.Type != "" {
		err = ipam.ExecDel(n.IPAM.Type, args.StdinData)
		if err != nil {
			return err
		}
	}

	if args.Netns == "" {
		return nil
	}

	log.Println("RIT-CNI: PREPARING NAMESPACE 6")
	log.Println("RIT-CNI: netns:", args.Netns)
	log.Printf("RIT-CNI: ARGS: %+v\n", args)
	interfaces, err := getNamespaceInterfaces(args.Netns)
	if err != nil {
		return fmt.Errorf("Error getting iterfaces: %s", err)
	}

	pfs_available, err := rdma_hardware_info.QueryNode("127.0.0.1", rdma_hardware_info.DefaultPort, 1500)
	if err != nil {
		log.Println("Error: could not determine what RDMA hardware resources are available")
	}

	for _, netIntf := range interfaces {
		log.Printf("RIT-CNI: Going through ifname: %s\n", netIntf.Name)
		if strings.HasPrefix(netIntf.Name, "eth") {
			_, err := strconv.Atoi(netIntf.Name[3:])
			if err != nil {
				continue
			}
			if err = releaseVFCustom(n, netIntf, args.ContainerID, args.Netns, pfs_available); err != nil {
				log.Printf("Error releasing vf %+v: %s", netIntf, err)
				continue
			}
		}
	}
	log.Println("RIT-CNI: CMDDEL ended")
	return nil
}

func renameLink(curName, newName string) error {
	link, err := netlink.LinkByName(curName)
	if err != nil {
		return fmt.Errorf("failed to lookup device %q: %v", curName, err)
	}

	return netlink.LinkSetName(link, newName)
}

func setUpLink(ifName string) error {
	link, err := netlink.LinkByName(ifName)
	if err != nil {
		return fmt.Errorf("failed to set up device %q: %v", ifName, err)
	}

	return netlink.LinkSetUp(link)
}

func getPodRequirements(pod_name string, pod_namespace string) []knapsack_pod_placement.RdmaInterfaceRequest {
	config, err := clientcmd.BuildConfigFromFlags("", "/etc/kubernetes/kubelet.conf")
	if err != nil {
		log.Fatal("RDMA CNI: Error building Kubernetes configuration from file /etc/kubernetes/kubelet.conf")
	}

	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		log.Fatal("RDMA CNI: Error building clientset from Kubernetes config file.")
	}

	pod, err := clientset.CoreV1().Pods(pod_namespace).Get(pod_name, metav1.GetOptions{})
	if err != nil {
		log.Fatal("RDMA CNI: Error retrieving pod information from Kubernetes API server.")
	}

	//if no annotation about required RDMA interfaces was present
	if pod.ObjectMeta.Annotations["rdma_interfaces_required"] == "" {
		//the pod does not need any RDMA interfaces
		return []knapsack_pod_placement.RdmaInterfaceRequest{}
	}

	var interfaces_needed []knapsack_pod_placement.RdmaInterfaceRequest
	err = json.Unmarshal([]byte(pod.ObjectMeta.Annotations["rdma_interfaces_required"]), &interfaces_needed)
	if err != nil {
		log.Fatal("RDMA CNI: Error unmarshalling JSON for RDMA interface requirements.")
	}

	return interfaces_needed
}

func main() {
	skel.PluginMain(cmdAdd, cmdDel)
}

extension: go


text:
@Article{campbell2017switchde,
  title = {switchde: inference of switch-like differential expression along single-cell trajectories},
  author = {Kieran R Campbell and Christopher Yau},
  journal = {Bioinformatics},
  volume = {33},
  number = {8},
  pages = {1241--1242},
  year = {2017},
  publisher = {Oxford University Press},
  date = {2017-01-01},
}


text:
SUMMARY = "Self-contained ISO 3166-1 country definitions"
HOMEPAGE = "https://pypi.org/project/iso3166/"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=5e2f4edc7e7408a82e4a1d05f229b695"

SRC_URI[md5sum] = "53c313c7ae8721e40ddd5e7a01bbcb7e"
SRC_URI[sha256sum] = "b1e58dbcf50fbb2c9c418ec7a6057f0cdb30b8f822ac852f72e71ba769dae8c5"

inherit pypi setuptools3

RDEPENDS_${PN} += "python3-numbers"

BBCLASSEXTEND = "native nativesdk"


text:
require recipes-kernel/linux/linux.inc

DESCRIPTION = "Linux kernel for OMAP processors - Real-time preemption patch"
KERNEL_IMAGETYPE = "uImage"

COMPATIBLE_MACHINE = "overo"

PV = "3.4"
PR = "r0"

S = "${WORKDIR}/git"

SRCREV = "${AUTOREV}"
SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git;branch=v3.4-rt;protocol=git \
	   file://defconfig \
           file://0001-board-overo.c-added-spidev-support.patch \
           "

repository: dimasad/meta-vant-finep

repo_name: dimasad/meta-vant-finep


text:
@article{ihrke2016principles,
  title={Principles of Light Field Imaging},
  author={Ihrke, Ivo and Restrepo, John and Mignard-Debise, Lo{\"\i}s},
  journal={IEEE Signal Processing Magazine},
  volume={1053},
  number={5888/16},
  year={2016},
  publisher={IEEE}
}

@inproceedings{levoy1996light,
  title={Light field rendering},
  author={Levoy, M. and Hanrahan, P.},
  booktitle={SIGGRAPH},
  pages={31--42},
  year={1996},
  organization={ACM}
}

@phdthesis{ng2006digital,
  title={Digital light field photography},
  author={Ng, R.},
  year={2006},
  school={Stanford University}
}

@PhdThesis{dansereau2014Thesis,
  title={Plenoptic Signal Processing for Robust Vision in Field Robotics},
  author={Dansereau, D. G.},
  year={2014},
  month={Jan.},
  school={Australian Centre for Field Robotics, School of Aerospace, Mechanical and Mechatronic Engineering, The University of Sydney},
  URL={http://www-personal.acfr.usyd.edu.au/ddan1654/Dansereau2014Plenoptic.pdf}
}

@inproceedings{lumsdaine2009focused,
  title={The focused plenoptic camera},
  author={Lumsdaine, A. and Georgiev, T.},
  booktitle={Computational Photography ({ICCP})},
  pages={1--8},
  year={2009},
  organization={IEEE}
}


text:
@InProceedings{wang09d,
  title = {Large-Margin Structured Prediction via Linear Programming},
  author = {Zhuoran Wang and John Shawe-Taylor},
  pages = {599--606},
  abstract = {This paper presents a novel learning algorithm for structured classification problems, where the task is to predict multiple and interacting labels (multilabel) for an input object. The maximum margin separation between the correct multilabels and the incorrect ones is formulated as a linear program.  Instead of explicitly writing out the entire problem with an exponentially large  constraint set, the linear program is solved iteratively via column generation. In this case, the process of generating most violated constraints is equivalent to searching for highest-scored misclassified incorrect multilabels, which can be easily achieved by decoding the structure based on current estimations.  In addition, we also explore the integration of the column generation and the extragradient method for linear programming to gain further efficiency. Compared to previous works on large-margin structured prediction, this framework has advantages in handling arbitrary structures and larger-scale  problems. Experimental results on part-of-speech tagging and statistical machine translation tasks are reported, demonstrating the competitiveness of the proposed approach.},
  pdf = {http://jmlr.org/proceedings/papers/v5/wang09d/wang09d.pdf},
}


text:
DESCRIPTION = "Provides enhanced HTTPS support for httplib and urllib2 using PyOpenSSL"
HOMEPAGE = "https://github.com/cedadev/ndg_httpsclient/"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://MANIFEST.in;md5=ce22c0cd986d2de3f7073cd6b5523ae0"

SRC_URI[md5sum] = "b0fc8ea38f87d2c1ab1ed79a95c078f9"
SRC_URI[sha256sum] = "d72faed0376ab039736c2ba12e30695e2788c4aa569c9c3e3d72131de2592210"

inherit pypi setuptools3 update-alternatives

PYPI_PACKAGE = "ndg_httpsclient"

DEPENDS += " \
    ${PYTHON_PN}-pyopenssl \
    ${PYTHON_PN}-pyasn1 \
"

RDEPENDS_${PN} += " \
    ${PYTHON_PN}-datetime \
    ${PYTHON_PN}-logging \
    ${PYTHON_PN}-pyopenssl \
    ${PYTHON_PN}-pyasn1 \
"

BBCLASSEXTEND = "native nativesdk"

UPSTREAM_CHECK_REGEX = ""

ALTERNATIVE_${PN} = "ndg_httpclient"
ALTERNATIVE_LINK_NAME[ndg_httpclient] = "${bindir}/ndg_httpclient"
ALTERNATIVE_PRIORITY = "30"

repository: ni/meta-openembedded

repo_name: ni/meta-openembedded

branch_name: refs/heads/nilrt/master/hardknott

gha_language: BitBake


text:
#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#

# grab the board name from the target name
# need to strip out the leading 'TI_' like in 'TI_CC3220SF_LAUNCHXL'

string(REPLACE "TI_" "" TARGET_NAME_SHORT "${TARGET_NAME}")

# includes for SimpleLink CC32xx SDK
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/SimpleLinkCC32xxSDK_Source")
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/drivers")
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/posix/gcc")
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/boards/${TARGET_NAME_SHORT}")
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/devices/cc32xx")
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/devices/cc32xx/driverlib")
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/net")
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/SimpleLinkCC32xxSDK_Source/ti/bsd")

# includes for nanoFramework SSL driver
list(APPEND TI_SimpleLink_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src/PAL/Com/sockets/ssl")

# source file for nanoFramework SSL driver
list(APPEND TI_SimpleLink_SOURCES ${CMAKE_SOURCE_DIR}/src/PAL/COM/sockets/ssl/ssl.cpp)

# the sources files are pulled into the build in the target CMakelists through the XDS tools command line

repository: nanoframework/nf-interpreter

repo_name: nanoframework/nf-interpreter

gha_language: C


text:
var test = require('tape');
var util = require('../lib/util');

var failing = [ { actual: 1,
    expected: 1,
    status: 'pass',
    message: 'length should be 1',
    current_test: 'should equal 1' },
  { actual: 2,
    expected: 1,
    message: 'num should equal 1',
    operator: '==',
    status: 'fail',
    current_test: 'should equal 1' } ];

var passing = [ { actual: 1,
    expected: 1,
    status: 'pass',
    message: 'length should be 1',
    current_test: 'should equal 1' },
  { actual: 1,
    expected: 1,
    message: 'num should equal 1',
    operator: '==',
    status: 'pass',
    current_test: 'should equal 1' } ];

test('all_passed() passes when correct', function (t) {
  t.plan(1);

  var status = util.all_passed(passing, 'should equal 1');

  t.equal(status, true, 'all_passed() returns true');
});

test('all_passed() fails when not correct', function (t) {
  t.plan(1);

  var status = util.all_passed(failing, 'should equal 1');

  t.equal(status, false, 'all_passed() returns false');
});

test('create_funcname() creates the correct function names', function (t) {
  t.plan(2);

  t.equal(util.create_funcname('foo.js'), 'foo_js', 'dots are replaced');
  t.equal(util.create_funcname('foo/bar.js'), 'foo_bar_js', 'slashes are replaced');
});

test('all_failed() returns the correct failed entries', function (t) {
  t.plan(1);

  var failed = util.all_failed(failing);

  t.equal(failed.length, 1, 'a single failure found');
});

repository: MLM-SOFT/equinox

repo_name: MLM-SOFT/equinox

gha_license_id: NOASSERTION

gha_language: JavaScript

extension: js


text:
inherit kernel
require recipes-kernel/linux/linux-yocto.inc

KMACHINE = "yocto/standard/base"
KMACHINE_qemux86  = "yocto/standard/common-pc/base"
KMACHINE_qemux86-64  = "yocto/standard/common-pc-64/base"
KMACHINE_qemuppc  = "yocto/standard/qemu-ppc32"
KMACHINE_qemumips = "yocto/standard/mti-malta32-be"
KMACHINE_qemuarm  = "yocto/standard/arm-versatile-926ejs"

KBRANCH = "${KMACHINE}"

LINUX_VERSION ?= "3.0.24"

SRCREV_machine_qemuarm ?= "62bbe1d7a0e5c1200a99dabca889a52c9417b96b"
SRCREV_machine_qemumips ?= "66de88919f24f1e590a48dae6de752a68fed2353"
SRCREV_machine_qemuppc ?= "7528f1d06ef5665eed8c1498f62d5403b82bbbd6"
SRCREV_machine_qemux86 ?= "f153b0eb8264dc1e69f59d4c9173619feb4d5bd9"
SRCREV_machine_qemux86-64 ?= "aac580659dc0ce083f250fb05abf82e58d7f4531"
SRCREV_machine ?= "da7c40006b08916ff3a3db104def82aaf9ac2716"
SRCREV_meta ?= "a4ac64fe873f08ef718e2849b88914725dc99c1c"

PR = "r4"
PV = "${LINUX_VERSION}+git${SRCPV}"

SRC_URI = "git://git.yoctoproject.org/linux-yocto-3.0;protocol=git;bareclone=1;branch=${KBRANCH},meta;name=machine,meta"

COMPATIBLE_MACHINE = "(qemuarm|qemux86|qemuppc|qemumips|qemux86-64)"

# Functionality flags
KERNEL_FEATURES = "features/netfilter"
KERNEL_FEATURES_append = " features/taskstats"
KERNEL_FEATURES_append_qemux86 = " cfg/sound"
KERNEL_FEATURES_append_qemux86-64 = " cfg/sound"

require linux-tools.inc


text:
SUMMARY = "ShellHub runtime support"

LICENSE = "MIT"

inherit packagegroup

PACKAGES += "${PN}-runtime"

RDEPENDS:${PN}-runtime += " \
    shellhub-agent \
"

repository: shellhub-io/meta-shellhub

repo_name: shellhub-io/meta-shellhub


text:
% Encoding: UTF-8

@Article{Doob1945,
  Title                    = {Markoff chains--denumerable case},
  Author                   = {Doob, Joseph L},
  Journal                  = {Transactions of the American Mathematical Society},
  Year                     = {1945},
  Number                   = {3},
  Pages                    = {455--473},
  Volume                   = {58},
  Publisher                = {JSTOR},
  doi                      = {10.2307/1990339},
  url                      = {http://www.jstor.org/stable/1990339}
}

@Online{GillespieJL,
  Title                    = {Gillespie.jl: Stochastic simulation in Julia},
  Author                   = {Simon D.W. Frost},
  URL                      = {https://github.com/sdwfrost/Gillespie.jl},
  Urldate                  = {2016-02-14},
  Year                     = {2016},
  doi                      = {10.5281/zenodo.59127}
}

@Article{Gillespie1977,
  Title                    = {Exact stochastic simulation of coupled chemical reactions},
  Author                   = {Gillespie, Daniel T},
  Journal                  = {The journal of physical chemistry},
  Year                     = {1977},
  Number                   = {25},
  Pages                    = {2340--2361},
  Volume                   = {81},
  Publisher                = {ACS Publications},
  doi                      = {10.1021/j100540a008},
  url                      = {http://pubs.acs.org/doi/pdf/10.1021/j100540a008}
}

@Article{Pineda-Krch2008,
  Title                    = {GillespieSSA: Stochastic Simulation Algorithm in R},
  Author                   = {Pineda-Krch, Mario},
  Journal                  = {Journal of Statistical Software},
  Year                     = {2008},
  Pages                    = {12},
  Volume                   = {25},
  doi                      = {10.18637/jss.v025.i12},
  url                      = {https://www.jstatsoft.org/article/view/v025i12}
}


text:
DESCRIPTION = "Simple dialpad keyboard"
SECTION = "x11"
LICENSE = "GPLv2"
DEPENDS = "ecore evas edje libfakekey"
PV = "0.1.4+svnr${SRCPV}"
PR = "r0"
SRCREV = "194"

SRC_URI = "svn://svn.om.vptt.ch/trunk/;proto=http;module=bubble-keyboard"
S = "${WORKDIR}/bubble-keyboard"

inherit autotools pkgconfig


text:
@InProceedings{hamid14,
  title = {Compact Random Feature Maps},
  author = {Raffay Hamid and Ying Xiao and Alex Gittens and Dennis Decoste},
  pages = {19-27},
  abstract = {Kernel approximation using randomized feature maps has recently gained a lot of interest. In this work, we identify that previous approaches for polynomial kernel approximation create maps that are rank deficient, and therefore do not utilize the capacity of the projected feature space effectively. To address this challenge, we propose compact random feature maps (CRAFTMaps) to approximate polynomial kernels more concisely and accurately. We prove the error bounds of CRAFTMaps demonstrating their superior kernel reconstruction performance compared to the previous approximation schemes. We show how structured random matrices can be used to efficiently generate CRAFTMaps, and present a single-pass algorithm using CRAFTMaps to learn non-linear multi-class classifiers. We present experiments on multiple standard data-sets with performance competitive with state-of-the-art results.},
  section = {cycle-2},
}


text:
SUMMARY = "Parser of the C language, written in pure Python"
HOMEPAGE = "https://github.com/eliben/pycparser"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=86f1cedb4e6410a88ce8e30b91079169"

SRC_URI[md5sum] = "b8f88de737db8c346ee8d31c07c7a25a"
SRC_URI[sha256sum] = "2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"

inherit pypi setuptools3

BBCLASSEXTEND = "native nativesdk"

RDEPENDS:${PN}:class-target += "\
    ${PYTHON_PN}-netclient \
    ${PYTHON_PN}-ply \
    ${PYTHON_PN}-pprint \
    cpp \
    cpp-symlinks \
    "

repository: Intel-BMC/openbmc

repo_name: Intel-BMC/openbmc

gha_language: Python


text:
import { _routeHandlersShorthandsBase as BaseShorthandRouteHandler } from "@lib";

describe("Unit | Route handlers | Shorthands | BaseShorthandRouteHandler", function () {
  let handler = null;
  let request = null;
  beforeEach(function () {
    handler = new BaseShorthandRouteHandler();
    request = { params: { id: "" } };
  });

  test("it returns a number if it's a number", () => {
    request.params.id = 2;
    expect(handler._getIdForRequest(request)).toEqual(2);
  });

  test("it returns a number if it's a string represented number", () => {
    request.params.id = "2";
    expect(handler._getIdForRequest(request)).toEqual("2");
  });

  test("it returns a string it's a dasherized number", () => {
    request.params.id = "2-1";
    expect(handler._getIdForRequest(request)).toEqual("2-1");
  });

  test("it returns a string if it's a string", () => {
    request.params.id = "someID";
    expect(handler._getIdForRequest(request)).toEqual("someID");
  });

  test("getModelClassFromPath works with various named route path variable", () => {
    let urlWithSlash = "/api/fancy-users";
    let urlWithIdAndSlash = "/api/fancy-users/:id";
    let urlWithTrailingSlash = "/api/fancy-users/";

    expect(handler.getModelClassFromPath(urlWithSlash)).toEqual("fancy-user");
    expect(handler.getModelClassFromPath(urlWithIdAndSlash, true)).toEqual(
      "fancy-user"
    );
    expect(handler.getModelClassFromPath(urlWithTrailingSlash)).toEqual(
      "fancy-user"
    );

    urlWithSlash = "/api/exquisite-users";
    urlWithIdAndSlash = "/api/exquisite-users/:objectId";

    expect(handler.getModelClassFromPath(urlWithSlash)).toEqual(
      "exquisite-user"
    );
    expect(handler.getModelClassFromPath(urlWithIdAndSlash, true)).toEqual(
      "exquisite-user"
    );

    urlWithSlash = "/api/elegant-users";
    urlWithIdAndSlash = "/api/elegant-users/:firstName/:lastName";

    expect(handler.getModelClassFromPath(urlWithSlash)).toEqual("elegant-user");
    expect(handler.getModelClassFromPath(urlWithIdAndSlash, true)).toEqual(
      "elegant-user"
    );
  });

  test("it can read the id from the url", () => {
    let request = { params: { id: "test-id" } };
    expect(handler._getIdForRequest(request)).toEqual("test-id");
  });

  test("it can read the id from the request body", () => {
    let request = { params: {} };
    let jsonApiDoc = { data: { id: "jsonapi-id" } };
    expect(handler._getIdForRequest(request, jsonApiDoc)).toEqual("jsonapi-id");
  });
});

repository: miragejs/miragejs

repo_name: miragejs/miragejs


text:
DESCRIPTION = "The Inline module allows you to put source code from other programming \
languages directly \"inline\" in a Perl script or module. The code is \
automatically compiled as needed, and then loaded for immediate access \
from \
Perl."

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

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

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/I/IN/INGY/Inline-0.80.tar.gz"

SRC_URI[md5sum] = "510bbac46e727bcaf240b7feac2646c9"
SRC_URI[sha256sum] = "7e2bd984b1ebd43e336b937896463f2c6cb682c956cbd2c311a464363d2ccef6"
DEPENDS += "test-warn-perl-native"

S = "${WORKDIR}/Inline-${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 internal

import (
	"math"
	"unsafe"
)

func f857(ctx *Context, l0 int32, l1 int32, l2 float32, l3 float32, l4 float32, l5 float32) {
	var l6 int32
	_ = l6
	var l7 int32
	_ = l7
	var l8 int32
	_ = l8
	var s0i32 int32
	_ = s0i32
	var s1i32 int32
	_ = s1i32
	var s2i32 int32
	_ = s2i32
	var s5i32 int32
	_ = s5i32
	var s6i32 int32
	_ = s6i32
	var s7i32 int32
	_ = s7i32
	var s0f32 float32
	_ = s0f32
	var s1f32 float32
	_ = s1f32
	var s2f32 float32
	_ = s2f32
	var s3f32 float32
	_ = s3f32
	var s4f32 float32
	_ = s4f32
	var s5f32 float32
	_ = s5f32
	var s6f32 float32
	_ = s6f32
	s0f32 = l3
	s1f32 = 0
	s0f32 = f15(ctx, s0f32, s1f32)
	s1i32 = l1
	s1i32 = *(*int32)(unsafe.Pointer(&ctx.Mem[int(s1i32+0)]))
	l6 = s1i32
	s1i32 = *(*int32)(unsafe.Pointer(&ctx.Mem[int(s1i32+12)]))
	s2i32 = -1
	s1i32 = s1i32 + s2i32
	s1f32 = math.Float32frombits(uint32(s1i32))
	s0f32 = f14(ctx, s0f32, s1f32)
	l3 = s0f32
	s1f32 = 4.2949673e+09
	if s0f32 < s1f32 {
		s0i32 = 1
	} else {
		s0i32 = 0
	}
	s1f32 = l3
	s2f32 = 0
	if s1f32 >= s2f32 {
		s1i32 = 1
	} else {
		s1i32 = 0
	}
	s0i32 = s0i32 & s1i32
	if s0i32 != 0 {
		s0f32 = l3
		s0i32 = int32(uint32(math.Trunc(float64(s0f32))))
		goto lbl0
	}
	s0i32 = 0
lbl0:
	s1i32 = l6
	s1i32 = *(*int32)(unsafe.Pointer(&ctx.Mem[int(s1i32+4)]))
	s0i32 = s0i32 * s1i32
	l7 = s0i32
	s0f32 = l2
	s1f32 = 0
	s0f32 = f15(ctx, s0f32, s1f32)
	s1i32 = l6
	s1i32 = *(*int32)(unsafe.Pointer(&ctx.Mem[int(s1i32+8)]))
	s2i32 = -1
	s1i32 = s1i32 + s2i32
	s1f32 = math.Float32frombits(uint32(s1i32))
	s0f32 = f14(ctx, s0f32, s1f32)
	l2 = s0f32
	s1f32 = 4.2949673e+09
	if s0f32 < s1f32 {
		s0i32 = 1
	} else {
		s0i32 = 0
	}
	s1f32 = l2
	s2f32 = 0
	if s1f32 >= s2f32 {
		s1i32 = 1
	} else {
		s1i32 = 0
	}
	s0i32 = s0i32 & s1i32
	if s0i32 != 0 {
		s0f32 = l2
		s0i32 = int32(uint32(math.Trunc(float64(s0f32))))
		goto lbl2
	}
	s0i32 = 0
lbl2:
	l8 = s0i32
	s0i32 = l0
	s1i32 = l1
	s2i32 = 8
	s1i32 = s1i32 + s2i32
	s2f32 = 0
	s3f32 = 0
	s4f32 = 0
	s5i32 = l6
	s5i32 = *(*int32)(unsafe.Pointer(&ctx.Mem[int(s5i32+0)]))
	s6i32 = l7
	s7i32 = l8
	s6i32 = s6i32 + s7i32
	s7i32 = 1
	s6i32 = s6i32 << (uint32(s7i32) & 31)
	s5i32 = s5i32 + s6i32
	s5i32 = int32(*(*uint16)(unsafe.Pointer(&ctx.Mem[int(s5i32+0)])))
	s5f32 = float32(uint32(s5i32))
	s6f32 = 1.5259022e-05
	s5f32 = s5f32 * s6f32
	s6i32 = l1
	s6i32 = *(*int32)(unsafe.Pointer(&ctx.Mem[int(s6i32+4)]))
	if int(s6i32) < 0 || int(s6i32) >= len(table) {
		panic("table entry out of bounds")
	}
	if table[s6i32].numParams == -1 {
		panic("table entry is nil")
	}
	if table[s6i32].numParams != 6 {
		panic("argument count mismatch")
	}
	(*(*func(*Context, int32, int32, float32, float32, float32, float32))(table[s6i32].f()))(ctx, s0i32, s1i32, s2f32, s3f32, s4f32, s5f32)
}

repository: chrsan/shadow

repo_name: chrsan/shadow


text:
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package testutil

import (
	"time"

	"github.com/uber-go/dosa"
)

// TestInt64Ptr create pointer for int64
func TestInt64Ptr(i int64) *int64 {
	return &i
}

// TestInt32Ptr create pointer for int32
func TestInt32Ptr(i int32) *int32 {
	return &i
}

// TestTimePtr create pointer for time.Time
func TestTimePtr(t time.Time) *time.Time {
	return &t
}

// TestFloat64Ptr create pointer for float64
func TestFloat64Ptr(f float64) *float64 {
	return &f
}

// TestStringPtr create pointer for string
func TestStringPtr(s string) *string {
	return &s
}

// TestBoolPtr create pointer for bool
func TestBoolPtr(b bool) *bool {
	return &b
}

// TestUUIDPtr create pointer for dosa.UUID
func TestUUIDPtr(b dosa.UUID) *dosa.UUID {
	return &b
}

// TestAssertFn is the interface of the test closure func
type TestAssertFn func(a, b interface{})

// AssertEqForPointer compares equal between interface of pointer
func AssertEqForPointer(fn TestAssertFn, expected interface{}, p interface{}) {
	switch v := p.(type) {
	case *int32:
		fn(*v, expected)
	case *int64:
		fn(*v, expected)
	case *float64:
		fn(*v, expected)
	case *string:
		fn(*v, expected)
	case *dosa.UUID:
		fn(*v, expected)
	case *time.Time:
		fn(*v, expected)
	case *bool:
		fn(*v, expected)
	case *[]byte:
		fn(*v, expected)
	default:
		panic("invalid type")
	}
}

repository: uber-go/dosa

repo_name: uber-go/dosa

gha_language: Go


text:
file(REMOVE_RECURSE
  "CMakeFiles/PRU.dir/lib/ctype.c.o"
  "CMakeFiles/PRU.dir/lib/malloc.c.o"
  "CMakeFiles/PRU.dir/lib/math.c.o"
  "CMakeFiles/PRU.dir/lib/prng.c.o"
  "CMakeFiles/PRU.dir/lib/stdio.c.o"
  "CMakeFiles/PRU.dir/lib/stdlib.c.o"
  "CMakeFiles/PRU.dir/lib/string.c.o"
  "CMakeFiles/PRU.dir/src/alu.c.o"
  "CMakeFiles/PRU.dir/src/fmt2.c.o"
  "CMakeFiles/PRU.dir/src/pru.c.o"
  "PRU.pdb"
  "PRU"
)

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

repository: siddk/driller-lite

repo_name: siddk/driller-lite


text:
@article{mazur:modular, title={Rational points on modular curves}, ISBN={9783540372912}, ISSN={1617-9692}, url={http://dx.doi.org/10.1007/bfb0063947}, DOI={10.1007/bfb0063947}, journal={Modular Functions of one Variable V}, publisher={Springer Berlin Heidelberg}, author={Mazur, B.}, year={1977}, pages={107–148}}

@article{ribet:galois_real_multiplication, title={Fields of definition of abelian varieties with real multiplication}, ISBN={9780821877654}, ISSN={0271-4132}, url={http://dx.doi.org/10.1090/conm/174/01854}, DOI={10.1090/conm/174/01854}, journal={Arithmetic Geometry}, publisher={American Mathematical Society}, author={Ribet, Kenneth A.}, year={1994}, pages={107–118}}

@article{mazur:modular:2000, title={Relative modular symbols and Rankin-Selberg convolutions}, volume={2000}, ISSN={1435-5345}, url={http://dx.doi.org/10.1515/crll.2000.019}, DOI={10.1515/crll.2000.019}, number={519}, journal={Journal für die reine und angewandte Mathematik (Crelles Journal)}, publisher={Walter de Gruyter GmbH}, author={Kazhdan, D. and Mazur, B. and Schmidt, C.-G.}, year={2000}, month={Jan}}

@article{mazur:eisenstein, title={Modular curves and the eisenstein ideal}, volume={47}, ISSN={1618-1913}, url={http://dx.doi.org/10.1007/bf02684339}, DOI={10.1007/bf02684339}, number={1}, journal={Publications mathématiques de l’IHÉS}, publisher={Springer Science and Business Media LLC}, author={Mazur, B.}, year={1977}, month={Dec}, pages={33–186}}

repository: kevinywlui/caleb

repo_name: kevinywlui/caleb


text:
body {
    margin: 20px;
    display: flex;
    flex-direction: column;
    background-color: black;
    color: lightgray;
    height: 100vh;
}

button {
    justify-content: space-around;
    margin-left: auto;
    margin-right: auto;
}

a {
    margin: auto;
}

img {
    width: 40%;
    margin: auto;
}

.descriptionWrapper {
    display: flex;
    justify-content: center;
}

.descriptionP {
    width: 50%;
    text-align: center;
}

.exampleDiv {
    color: #53A5F4;
}

.randomWordPara:first-letter {
    text-transform: capitalize;
}

.partOfSpeech {
    color: #53A5F4;
}

.partOfSpeech:first-letter {
    text-transform: capitalize;
}

footer {
    margin-bottom: 0px;
    margin-top: 10px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

repository: DavidNAspesi/Vocab-Builder-Client

repo_name: DavidNAspesi/Vocab-Builder-Client

extension: css


text:
@inproceedings {type-your-key-here,
  author = "Guilherme Cavalcanti and Paulo Borba and Paola Accioly",
  booktitle = "2017 IEEE/ACM 39th International Conference on Software Engineering Companion (ICSEC)",
  title = "Should We Replace Our Merge Tools?",
  year = "2017",
  pages = "325-327"
}

repository: pauloborba/academic-kickstart

repo_name: pauloborba/academic-kickstart


text:
#==================================================
# Automatically generated, but not overwritten
#
# Adapted from: https://github.com/bast/cmake-example/tree/master/cmake
#==================================================
#
find_program(
    GIT_EXECUTABLE
    NAMES git
    DOC "git command line client"
    )
mark_as_advanced(GIT_EXECUTABLE)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)

repository: championbarca/CPPCMakeProject

repo_name: championbarca/CPPCMakeProject


text:
SECTION = "devel/chicken"
DESCRIPTION = "Heavyweight alternative to strings"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://rope.meta;md5=7df0484e0a05898387666c23ce8bf99f"

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

SRC_URI[md5sum] = "ae78c6257216f4e8fad5a3af9c458ebe"
SRC_URI[sha256sum] = "78b9867badaa9a8ab74ebeee62a99fee8a90544048c30f2e4a89f5cf279f5d39"

S = "${WORKDIR}/rope-${PV}"

inherit chicken_install

BBCLASSEXTEND = "cross crosssdk nativesdk"

repository: OSSystems/meta-chicken

repo_name: OSSystems/meta-chicken


text:
@inproceedings{real_time_market_sgc_2017,
  title     = {Real-time market-based coordination mechanism for transmission and distribution networks},
  author    = {S. Wang and B. Sun and T. Liu and X. Tan and {D.H.K. Tsang}},
  booktitle = {2017 IEEE International Conference on Smart Grid Communications (SmartGridComm)},
  year      = {2017},
  pages     = {411-416},
  month     = {Oct},
}


text:
function(create_symlinks)
  # Do nothing if building in-source
  if (${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
    return()
  endif ()

  foreach (path_file ${ARGN})
    get_filename_component(folder ${path_file} PATH)

    # Create REAL folder
    file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${folder}")

    # Delete symlink if it exists
    file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/${path_file}")

    # Get OS dependent path to use in `execute_process`
    file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${path_file}" link)
    file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${path_file}" target)

    if (UNIX)
      set(command ln -s ${target} ${link})
    else ()
      set(command cmd.exe /c mklink ${link} ${target})
    endif ()

    execute_process(COMMAND ${command}
            RESULT_VARIABLE result
            ERROR_VARIABLE output)

    if (NOT ${result} EQUAL 0)
      message(FATAL_ERROR "Could not create symbolic link for: ${target} --> ${output}")
    endif ()

  endforeach (path_file)
endfunction(create_symlinks)

# Find if a Python module is installed
# Found at http://www.cmake.org/pipermail/cmake/2011-January/041666.html
# To use do: find_python_module(PyQt4 REQUIRED)
function(find_python_module module)
  string(TOUPPER ${module} module_upper)
  if (NOT PY_${module_upper})
    if (ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")
      set(${module}_FIND_REQUIRED TRUE)
    endif ()
    # A module's location is usually a directory, but for binary modules
    # it's a .so file.
    execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
            "import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))"
            RESULT_VARIABLE _${module}_status
            OUTPUT_VARIABLE _${module}_location
            ERROR_QUIET
            OUTPUT_STRIP_TRAILING_WHITESPACE)
    if (NOT _${module}_status)
      set(PY_${module_upper} ${_${module}_location} CACHE STRING
              "Location of Python module ${module}")
    endif (NOT _${module}_status)
  endif (NOT PY_${module_upper})
  find_package_handle_standard_args(${module} DEFAULT_MSG PY_${module_upper})
endfunction(find_python_module)

function(CheckHasModule Module)
  find_package(${Module} QUIET)
  if(NOT DEFINED ${Module}_DIR)
    set(HAS_MODULE_${Module} TRUE PARENT_SCOPE)
  elseif(${Module}_DIR)
    set(HAS_MODULE_${Module} TRUE PARENT_SCOPE)
  else()
    set(HAS_MODULE_${Module} FALSE PARENT_SCOPE)
  endif()
endfunction()

if(NOT WIN32)
  string(ASCII 27 Esc)
  set(ColorReset "${Esc}[m")
  set(ColorBold  "${Esc}[1m")
  set(Red         "${Esc}[31m")
  set(Green       "${Esc}[32m")
  set(Yellow      "${Esc}[33m")
  set(Blue        "${Esc}[34m")
  set(Magenta     "${Esc}[35m")
  set(Cyan        "${Esc}[36m")
  set(White       "${Esc}[37m")
  set(BoldRed     "${Esc}[1;31m")
  set(BoldGreen   "${Esc}[1;32m")
  set(BoldYellow  "${Esc}[1;33m")
  set(BoldBlue    "${Esc}[1;34m")
  set(BoldMagenta "${Esc}[1;35m")
  set(BoldCyan    "${Esc}[1;36m")
  set(BoldWhite   "${Esc}[1;37m")
endif()

repository: hesuyouren/jiffy

repo_name: hesuyouren/jiffy


text:
require jamvm.inc

SRC_URI += "file://debian-jni.patch;striplevel=0"

PR = "r7"

do_configure_prepend() {
  # Replaces the placeholder OE_LIBDIR_JNI with the JNI library directory
  # configured in OE.
  sed -i -e "s|OE_LIBDIR_JNI|${libdir_jni}|" src/dll.c
}

SRC_URI[md5sum] = "a965452442cdbfc94caba57d0dd25a8f"
SRC_URI[sha256sum] = "18b269b1bfad7230384681e89189c6af18584e19cddbf92208c0acef814046ab"

repository: overo/overo-oe-natty

repo_name: overo/overo-oe-natty


text:
DESCRIPTION = "Packagegroup for common Tegra demo test applications"

LICENSE = "MIT"

inherit packagegroup

RDEPENDS:${PN} = " \
    cuda-samples \
    gpu-burn \
"


text:
body {
  background-color: whitesmoke;
  padding-top: 50px;
  padding-bottom: 100px;
}

.track {
  background-color: white;
  border-radius: 3px;
  padding: 10px;
  margin: 10px;
  display: none;
  box-shadow: 1px 1px 10px #D3D3D3;
}

.resource {
  background-color: white;
  border-radius: 3px;
  padding: 10px;
  margin: 10px;
  display: none;
  box-shadow: 1px 1px 10px #D3D3D3;
}

form {
  border: .5px solid lightgray;
  padding: 10px;
  box-shadow: 1px 1px 10px #D3D3D3;
}

#resource-survey {
  display: none;
}

#age-message {
  display: none;
}


text:
@inproceedings{javed2014racs,
	author = {Javed, Sajid and Oh, Seon Ho and Heo, Junkyeok and Jung, Soon Ki},
	title = {Robust Background Subtraction via Online Robust PCA using Image Decomposition},
	booktitle = {Proceedings of the 2014 Research in Adaptive and Convergent Systems},
	series = {RACS '14},
	year = {2014},
	isbn = {978-1-4503-2348-2},
	location = {Baltimore, MD, USA},
	pages = {To appear},
	month = {Oct},
	numpages = {6},
	url = {},
	doi = {},
	acmid = {},
	publisher = {ACM},
	address = {New York, NY, USA},
	keywords = {},
	note = {To appear}
}


text:
SUMMARY = "Mininet based Python Library for component & feature tests."
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"

BRANCH ?= "${OPS_REPO_BRANCH}"

SRC_URI = "${OPS_REPO_BASE_URL}/ops-vsi;protocol=${OPS_REPO_PROTOCOL};branch=${BRANCH}"

SRCREV = "${AUTOREV}"

# When using AUTOREV, we need to force the package version
# to the revision of git in order to avoid stale shared states.
PV = "git${SRCPV}"

S = "${WORKDIR}/git"

inherit setuptools

RDEPENDS_${PN} = "mininet python-pytest bash"
DEPENDS_class-native = "mininet-native python-pytest-native python-pytest-timeout-native \
                        python-pyyaml-native util-linux-native python-smartpm-native"

do_install_append () {
    cp ${S}/opsvsiutils/restutils/server.crt ${D}/${PYTHON_SITEPACKAGES_DIR}/opsvsiutils/restutils/
}

BBCLASSEXTEND = "native"

repository: billyjbryant/ops-build

repo_name: billyjbryant/ops-build


text:
DESCRIPTION = "Cross-platform network interface and IP address enumeration \
library"
HOMEPAGE = "https://pypi.org/project/ifaddr/"
LICENSE = "MIT"

LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8debe8d42320ec0ff24665319b625a5e"

SRC_URI[sha256sum] = "cc0cbfcaabf765d44595825fb96a99bb12c79716b73b44330ea38ee2b0c4aed4"

inherit pypi setuptools3

RDEPENDS:${PN} += " \
    ${PYTHON_PN}-ctypes \
"

repository: openembedded/meta-openembedded

repo_name: openembedded/meta-openembedded


text:
DESCRIPTION = "Linux Kernel for the QNAP TurboStation platform"
SECTION = "kernel"
LICENSE = "GPLv2"
DEPENDS = "u-boot-utils-native"
PR = "r2"

COMPATIBLE_MACHINE = "turbostation"

RDEPENDS_kernel-module-zd1211rw += "zd1211-firmware"

SRC_URI = "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-${PV}.tar.bz2 \
	file://001_r1000.diff \
	file://linux-2.6.16_arch_ppc_platforms_sandpoint.h;apply=yes \
	file://002_qnap-pic.diff \
	file://linux-2.6.16_arch_ppc_syslib_Makefile;apply=yes \
	file://linux-2.6.16_drivers_mtd_maps_physmap.c;apply=yes \
	file://linux-2.6.16_arch_ppc_syslib_mpc10x_common.c;apply=yes \
	file://linux-2.6.16_arch_ppc_platforms_Makefile;apply=yes \
	file://linux-2.6.16_include_asm-ppc_mpc10x.h;apply=yes \
	file://linux-2.6.16_arch_ppc_platforms_sandpoint.c;apply=yes \
	file://defconfig"

S = "${WORKDIR}/linux-${PV}"

inherit kernel

KERNEL_IMAGETYPE = "uImage"
KERNEL_OUTPUT = "arch/${ARCH}/boot/images/${KERNEL_IMAGETYPE}"
# Override arch. The kernel stuff is in arch/ppc, not arch/powerpc in our case
ARCH = ppc

do_configure() {
		install -m 644 ${WORKDIR}/defconfig ${S}/.config
		make ARCH=ppc oldconfig
}

#ppc build leaves the kernel in a different place
#do_movekernel() {
#
#}

SRC_URI[md5sum] = "bc33bd163130df9c59b165a1d31ccfdc"
SRC_URI[sha256sum] = "56c46e51429530665970c53c9a99d8ad3843bb5c0fa713fb752b2724ff4eb872"


text:
DESCRIPTION = "TI KEYSTONE MMAP driver test binaries "
include mmap-lld.inc

PR = "${INC_PR}.1"

PACKAGE_ARCH = "${MACHINE_ARCH}"

DEPENDS="common-csl-ip mmap-lld"
RDEPENDS_${PN}="uio-module-drv"

DEVICELIST_k2hk-evm = "k2h k2k"
DEVICELIST_k2e-evm  = "k2e"

CHOICELIST = " yes \
               no \
"

do_compile () {
	for device in ${DEVICELIST}
	do
		make -f makefile_armv7 clean \
			PDK_INSTALL_PATH="${STAGING_INCDIR}" \
			DEVICE="$device" MPAX_SRC_DIR="${S}"
		for choice in ${CHOICELIST}
		do
			make -f makefile_armv7 tests examples \
				PDK_INSTALL_PATH=${STAGING_INCDIR} \
				DEVICE="$device" MPAX_SRC_DIR="${S}" \
				USEDYNAMIC_LIB="$choice"
		done
	done
}

do_install () {
	for device in ${DEVICELIST}
	do
		make -f makefile_armv7 installbin \
		PDK_INSTALL_PATH=${STAGING_INCDIR} \
		DEVICE="$device" MPAX_SRC_DIR="${S}" \
		INSTALL_BIN_BASE_DIR="${D}/${bindir}"
	done
}

repository: joelagnel/meta-ti

repo_name: joelagnel/meta-ti


text:
.search{
    padding-top: 40px;
}
.jumbotron {
    /* border: solid black 5px; */
    padding: 0.5em 0.6em;
    padding-top: 20px;
    color: coral;

}
.fill{
    height: 100%;
    width: 100%;
    background-color: teal;
    color: white;
}
#avatar{
  border-radius: 50%;
  /* background: #73AD21; */
  padding: 20px;
  width: 300px;
  height: 250px;
}

repository: ephantuskaranja/Github-search-angular

repo_name: ephantuskaranja/Github-search-angular


text:
@inproceedings{liuPDGANPerceptualDetailsGAN2021,
	title = {{PD}-{GAN}: {Perceptual}-{Details} {GAN} for extremely noisy low light image enhancement},
	booktitle = {{IEEE} {International} {Conference} on {Acoustics}, {Speech} and {Signal} {Processing} ({ICASSP})},
	author = {Liu, Yijun and Wang, Zhengning and Zeng, Yi and Zeng, Hao and Zhao, Deming},
	year = {2021},
	file = {Full Text:E\:\\zotero\\storage\\88E9CTZV\\Dantas 等。 - 2021 - Safe screening for sparse regression with the Kull.pdf:application/pdf;Snapshot:E\:\\zotero\\storage\\YWVRJB3N\\hal-03147345.html:text/html}
}

repository: boomboomluo/yijun-academic

repo_name: boomboomluo/yijun-academic


text:
SECTION = "devel/chicken"
DESCRIPTION = "Conversion of units of measurement"
LICENSE = "GPL-3"
LIC_FILES_CHKSUM = "file://unitconv.meta;md5=744c40bd6ea09fe9ee7b5f75dbd21bf5"
DEPENDS_append_class-cross = " chicken-egg-datatype-cross chicken-egg-matchable-cross chicken-egg-numbers-cross"
DEPENDS_append_class-crosssdk = " chicken-egg-datatype-crosssdk chicken-egg-matchable-crosssdk chicken-egg-numbers-crosssdk"
DEPENDS_append_class-nativesdk = " nativesdk-chicken-egg-datatype nativesdk-chicken-egg-matchable nativesdk-chicken-egg-numbers chicken-egg-datatype-crosssdk chicken-egg-matchable-crosssdk chicken-egg-numbers-crosssdk"
DEPENDS = " chicken-egg-datatype chicken-egg-matchable chicken-egg-numbers chicken-egg-datatype-cross chicken-egg-matchable-cross chicken-egg-numbers-cross chicken-egg-unitconv-cross"
RDEPENDS_${PN} = " chicken-egg-datatype chicken-egg-matchable chicken-egg-numbers"

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

SRC_URI[md5sum] = "330f9c9e5f8bde83ae8dec96ad3049b4"
SRC_URI[sha256sum] = "2685acebec5c0f79ba0ad0bdf08d265ee5f0860622bdf37ebd449a885dc286cc"

S = "${WORKDIR}/unitconv-${PV}"

inherit chicken_install

BBCLASSEXTEND = "cross crosssdk nativesdk"


text:
@incollection{dixit2016practical,
 author = {Dixit, M and Das, S and Mhashal, AR and Eitan, R and Major, DT},
 booktitle = {Methods in enzymology},
 pages = {251--286},
 publisher = {Academic Press},
 title = {Practical Aspects of Multiscale Classical and Quantum Simulations of Enzyme Reactions},
 volume = {577},
 year = {2016}
}

repository: dixitmuditk/MD

repo_name: dixitmuditk/MD


text:
SUMMARY = "Easy to use CLI and C library for communicating with Microsemi's Switchtec management interface"
HOMEPAGE = "https://github.com/Microsemi/switchtec-user"
SECTION = "console/utils"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3d6b07c89629cff2990d2e8e1f4c2382"

DEPENDS = "ncurses openssl"

SRCREV = "762ba441d2c02685f98e5f56e984db033bab279a"
SRC_URI = " \
    git://github.com/Microsemi/switchtec-user.git;protocol=https;branch=master \
    file://0001-cli-Fix-format-security-warning.patch \
"
SRC_URI[sha256sum] = "f98c1fe23e1d7a11fb23e8bcf9b563929fc805ea669191a7fd525ad16519f655"

S = "${WORKDIR}/git"

inherit autotools-brokensep pkgconfig

EXTRA_OEMAKE = "DESTDIR='${D}' PREFIX='${prefix}' LDCONFIG='true' LIBDIR='${D}${libdir}'"

do_install () {
     oe_runmake install
}