text stringlengths 1 1.05M |
|---|
<filename>lib/options.js
const path = require('path')
const metadata = require('read-metadata')
const exists = require('fs').existsSync
/**
* Read prompts metadata.
*
* @param {String} dir
* @return {Object}
*/
module.exports = function options (name, dir) {
const opts = getMetadata(name, dir)
return opts
}... |
import Foundation
struct Record {
var uid: String
var createdTime: Date
var recordId: String
var recordName: String
var recordRef: String
init() {
self.uid = ""
self.createdTime = Date()
self.recordId = ""
self.recordName = ""
self.recordRef = ""
... |
// Custom exception class
class UnknownReaderTypeException extends IllegalArgumentException {
public UnknownReaderTypeException(String unknownType) {
super(String.format("Unable to create a Reader: Unknown Reader type in Source specification: %s", unknownType));
}
}
// Reader class
class Reader {
p... |
#!/bin/bash
#params:
# - ref dpnd location
# - tested dpnd location
# - ref blockchain folder location
# - tested blockchain folder location
# - path to directory, where non-empty logs should be generated
# - stop replay at block
# - number of jobs (optional)
# - --dont-copy-config (optional), if passed config.init fil... |
<reponame>ilariom/wildcat<gh_stars>10-100
#ifndef _WKT_SCENE_GRAPH_H
#define _WKT_SCENE_GRAPH_H
#include "managers/ECSContext.h"
#include "components/Node.h"
#include "graphics/SurfaceCache.h"
#include "graphics/Camera.h"
#include "graphics/Director.h"
#include "systems/RenderSystem.h"
#include "systems/TransformUpdat... |
SELECT u.user_id, u.username, a.first_name, a.last_name
FROM user u
INNER JOIN address a ON u.user_id = a.user_id; |
import random
def coin_toss():
head = 0
tail = 0
print("Let's simulate a coin toss...")
for _ in range(5):
toss = random.randint(0,1)
if toss == 0:
head += 1
print("It's Heads")
else:
tail += 1
print("It's Tails")
print(f"Hea... |
#!/usr/bin/env bash
#
# Copyright (c) 2019-2020 The Beans Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
export LC_ALL=C.UTF-8
export HOST=s390x-linux-gnu
# The host arch is unknown, so we run the tests through q... |
const fs = require("fs");
const path = require("path");
const { promises: fsPromises } = fs;
const contactsPath = path.join(__dirname, "./db/contacts.json");
let currentId = 10;
async function listContacts() {
await fsPromises
.readFile(contactsPath, "utf-8")
.then((contacts) => {
console.t... |
import React from "react"
import renderer from "react-test-renderer"
import { SectionContent } from "./section"
describe("sectionContent", () => {
it("should not add mb2 className when children is only a text string", () => {
const tree = renderer.create(<SectionContent>aaaa</SectionContent>).toJSON()
expect... |
#!/usr/bin/env bash
#Build logos.json before commit
(cd ./source && ./buildLogos.js)
if [[ $? -eq 1 ]]; then
echo "Error build logos.json";
exit 1;
fi;
#Run directory.js before commit
node directory.js
if [[ $? -eq 1 ]]; then
echo "Error with run directory.js";
exit 1;
fi;
# Build buildInfo.json
... |
"""
Develop a code that takes a text string as input and returns the longest word in the text string
"""
def longest_word(text):
words = text.split()
longest_word = ""
max_length = 0
for word in words:
if len(word) > max_length:
max_length = len(word)
longest_word = word
return longest_word
... |
#!/bin/bash
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
# make sure node is installed
if ! command -v node;then
echo "Install node and npm ... |
from typing import List, Dict, Any
import instaloader
def download_instagram_posts(usernames: List[str]) -> Dict[str, List[Dict[str, Any]]]:
result = {}
L = instaloader.Instaloader(download_videos=False, download_video_thumbnails=False, download_geotags=False, download_comments=False, save_metadata=True, post_... |
sudo apt-get update -y
sudo apt-get install git python-pip python-dev -y
vagrant_pkg_url=https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.deb
wget ${vagrant_pkg_url}
sudo dpkg -i $(basename ${vagrant_pkg_url})
sudo apt-get install libxslt-dev libxml2-dev libvirt-dev build-essential qemu-utils qemu-kvm libv... |
#include <string>
#include <system_error>
namespace detail {
template<typename String>
struct string_traits {
static const char* c_str(const String& str) {
return str.c_str();
}
};
}
void binder(const char* host, unsigned port, std::error_code& ec) {
// Implementation of th... |
<gh_stars>1-10
import {
GET_ALL_EMPLOYEE_START,
GET_ALL_EMPLOYEE_SUCCESS,
GET_ALL_EMPLOYEE_FAIL,
GET_ALL_EMPLOYEE_RESOLVE,
GET_EMPLOYEE_START,
GET_EMPLOYEE_SUCCESS,
GET_EMPLOYEE_FAIL,
GET_EMPLOYEE_RESOLVE,
ADD_EMPLOYEE_START,
ADD_EMPLOYEE_SUCCESS,
ADD_EMPLOYEE_FAIL,
ADD_EMPLOYEE_RESOLVE,
EDIT_... |
import {_, Autowired, Component, PostConstruct} from "@ag-grid-community/core";
import {ChartMenu} from "./menu/chartMenu";
import {Chart} from "ag-charts-community";
import {ChartTranslator} from "./chartTranslator";
import {ChartProxy} from "./chartProxies/chartProxy";
type BBox = { x: number; y: number; width: num... |
#!/bin/bash
# Copyright 2018-2020 Daniel Povey
# 2018-2020 Yiming Wang
# This recipe uses E2E LF-MMI training which doesn't require GMM training to obtain alignments.
# Its performance is slightly better than those based on alignments (cross-entropy or regular LF-MMI)
# on this dataset.
stage=0
. ./cmd.... |
#!/bin/sh
docker-compose up -d
sleep 10
sensible-browser http://localhost:18080/zap
|
package ru.job4j.user;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Set;
import java.util.TreeSet;
import java.util.List;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* SortUserTest
*
* @author <NAME> (<EMAIL>)
* @version $Id$
* @since 0.1
*/
pub... |
cd
cd documents/github/striper-snake/run
open engine_run.command
open snake_run.command
open http://0.0.0.0:3010
|
package org.egovframe.rte.fdl.cmmn.aspectj;
import java.util.Date;
public class Order {
public int orderId;
public String orderStatus;
public String securityCode;
public String description;
public Date orderDate;
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.ord... |
package dbr.antoine.pixviewer.features.common;
/**
* Created by antoine on 7/7/17.
*/
public interface Presenter {
void register();
void unregister();
}
|
#!/bin/bash
set -e
export GTEST_COLOR=1
export CTEST_OUTPUT_ON_FAILURE=true
CMAKE_LINKER_OPTS="-DCMAKE_EXE_LINKER='-fuse-ld=gold'"
CMAKE_CONFIG_OPTS="-DHUNTER_CONFIGURATION_TYPES=Debug -DCMAKE_BUILD_TYPE=Debug"
CMAKE_TOOLCHAIN_OPTS="-DCMAKE_TOOLCHAIN_FILE='`pwd`/tools/polly/gcc-pic-cxx17.cmake'"
CMAKE_OPTS="$CMAKE_LI... |
package com.kafka.consumer.avro;
import java.io.ByteArrayInputStream;
import java.util.Map;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.DecoderFactory;
import org.apache.kafka.common.serialization.D... |
<gh_stars>1-10
document.addEventListener("DOMContentLoaded", function () {
$(".top-menu-tools-settingbutton").on("click", function () {
var req = new XMLHttpRequest();
req.onerror = function () {
};
req.onload = function () {
if (req.readyState === 4) {
w... |
/*
TITLE Rectangle and Polygone Chapter12Exercise1.cpp
Bjarne Stroustrup "Programming: Principles and Practice Using C++"
COMMENT
Objective: Draw a rectangle using class Rectangle (red lines)
and class Polygon (blue lines).
Input: -
Output: Graph on screen.
Author: <NAME>
... |
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AgenciesRoutingModule } from './agencies-routing.module';
import { AgenciesComponent } from './agencies.component';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { NgxPaginationModule } from '... |
Object.defineProperty(exports, "__esModule", { value: true });
var lie_ts_1 = require("lie-ts");
exports.Promise = (function () {
return typeof window !== "undefined" && window["Promise"] ? window["Promise"] : typeof global !== "undefined" && global["Promise"] ? global["Promise"] : lie_ts_1.Promise;
})();
/**
* Ob... |
#!/bin/bash -f
xv_path="/opt/Xilinx/Vivado/2015.3"
ExecStep()
{
"$@"
RETVAL=$?
if [ $RETVAL -ne 0 ]
then
exit $RETVAL
fi
}
ExecStep $xv_path/bin/xelab -wto e3a711b46ac549c798dc1c692e5c281e -m64 --debug typical --relax --mt 8 --maxdelay -L xil_defaultlib -L simprims_ver -L secureip --snapshot fourBitCLASim_time_impl -tr... |
<gh_stars>1-10
name "btsync"
maintainer "<NAME>"
maintainer_email "<EMAIL>"
license "GPL 3.0"
description "Installs/Configures Bittorrent P2P Synchronization Service"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1"
%w{ ubuntu debian }.ea... |
#!/usr/bin/env bats
load test_helper
@test "autoon: file with explicity entered env" {
rm -f ./.envirius
run nv autoon test_env1
assert_success
# file should be created
[ -e ./.envirius ]
# file should content environment name
assert_equal "test_env1" "`cat ./.envirius`"
rm ./.envir... |
//dependencies
const express = require("express");
const path = require("path");
const fs = require("fs");
//create express server
const app = express();
//sets initial port for listeners
const PORT = process.env.PORT || 8000;
const database = require("./db/db.json");
const { dirname } = require("path");
// Sets up th... |
# Runs prior to every test
setup() {
# Load our script file.
source ./src/scripts/install.sh
}
@test '1: test CPU detection' {
# Mock environment variables or functions by exporting them (after the script has been sourced)
# export PARAM_TO="World"
# Capture the output of our "Greet" function
r... |
# Stop and exit on error
set -e
VERSION="1.3.0"
cd ..
sed 's/$VERSION/'$VERSION'/g' tools/README.template.md > README.md
# Generate documentation
dub --build=docs
mkdir docs/$VERSION
mv docs/weather_forecast.html docs/$VERSION/index.html
git add docs/$VERSION/
# Create release
git commit -a -m "Release $VERSION"
g... |
#!/usr/bin/env bash
#
# Created by vcernomschi on 10/06/2015
#
path=$(cd $(dirname $0); pwd -P)
npm=`which npm`
eslint=`which eslint`
tslint=`which tslint`
if [ -z ${eslint} ]; then
${npm} -g install eslint
fi
if [ -z ${tslint} ]; then
${npm} -g install tslint
fi
if [ -f ${path}/../.git/hooks/pre-commit ]; ... |
/*
* Copyright (c) 2021 Target Brands, Inc. All rights reserved.
* Use of this source code is governed by the LICENSE file in this repository.
*/
context('Deployment', () => {
context('server returning deployment', () => {
beforeEach(() => {
cy.server();
cy.route(
'GET',
'*api/v1/s... |
<reponame>jloh02/valorant-chat-client
export const GAME_MODE: Map<string, string> = new Map([
["", "Custom"],
["ggteam", "Escalation"],
["onefa", "Replication"],
["Spikerush", "Spike Rush"],
]);
export const SCREEN_DEFAULTS = {
mainWidth: 1200,
mainHeight: 800,
minWidth: 750,
minHeight: 500,
};
export... |
<gh_stars>0
#include "GuildInfoManager.h"
#include <Core/Resource/Resource.h>
namespace Lunia {
namespace XRated {
namespace Database {
namespace Info {
void GuildInfoManager::Load(bool xml)
{
Resource::SerializerStreamReader reader;
if (xml == true) {
reader = Resource::ResourceSystemInst... |
<gh_stars>10-100
import { Injectable } from '@angular/core';
import { CrudService } from '../../../shared/services/crud.service';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class OptionValuesService {
constructor(
private crudService: CrudService
) {
}
getListOfOptio... |
<reponame>fourier11/interview<filename>javapractice/sort/MergeSortFromWiki.java
package sort;
import java.util.Arrays;
/**
* 归并排序,更加简洁的版本,就是临时变量有点多
*/
public class MergeSortFromWiki {
private static void mergeSortRecursive(int[] arr, int[] result, int start, int end) {
if (start >= end) {
re... |
TERMUX_PKG_HOMEPAGE=https://www.gnupg.org/related_software/libassuan/
TERMUX_PKG_DESCRIPTION="Library implementing the Assuan IPC protocol used between most newer GnuPG components"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_VERSION=2.5.4
TERMUX_PKG_SRCURL=https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-${TERMUX_PKG_V... |
# other imports
import numpy as np
import os
from tqdm import tqdm
from sklearn.metrics import confusion_matrix
import h5py
# torch imports
import torch
import torch.nn.functional as F
import torch.utils.data
from s3dis_dataset import DatasetTrainVal as Dataset
import lightconvpoint.utils.metrics as metrics
from ligh... |
import axios from 'axios';
const API_URL = 'http://localhost:8000/products';
const fetchData = async() => {
const response = await axios.get(API_URL);
return response.data;
};
const renderTable = (data) => {
const table = document.createElement('table');
const headerRow = document.createElement('tr');
const co... |
class RecordingDevice:
def __init__(self, can_record):
self._can_record = can_record
self._is_recording = False
self._recorded_audio = []
def record_audio(self, duration):
if self._can_record:
print(f"Recording audio for {duration} seconds")
self._is_reco... |
<filename>modules/caas/api/src/main/java/io/cattle/platform/api/instance/ContainerLogsActionHandler.java
package io.cattle.platform.api.instance;
import com.netflix.config.DynamicStringProperty;
import io.cattle.platform.archaius.util.ArchaiusUtil;
import io.cattle.platform.core.constants.InstanceConstants;
import io.... |
import random
rand_num = random.randint(10000, 99999)
print(rand_num) |
/**
* There are 4 different ways to call a function
* 1) fn()
* 2) fn.call()
* 3) fn.apply()
* 4) new fn()
*/
function add(a, b) {
return a + b;
}
var x = add(1,2); //-> 3
var y = add.call(null, 1, 2); //-> 3
var z = add.apply(null, [1,2]); //-> 3
var w = new add(1,2); //-> new object (discussed later)
|
<reponame>htruong/M5Paper_FactoryTest
#include <WiFi.h>
#include <ArduinoJson.h>
#include <HTTPClient.h>
#include <MD5Builder.h>
#include "frame_feedcontent.h"
#include "frame_urlreader.h"
#include "../utils/urlencoder.h"
#define MAX_BTN_NUM 12
void key_feedcontent_feed_cb(epdgui_args_vector_t &args)
{
Frame... |
#!/bin/bash
###################################################################################################
### Configuration
###################################################################################################
VBB_LIST=( 0.0 3.0 6.0 ) # in V
I_THR_LIST=( 51 100 ) # in DAC
V_CASN_LIST=( 50 105 135 )... |
from torch.optim import Optimizer
import math
import torch
import time
class AdamW(Optimizer):
"""Implements AdamW algorithm.
It has been proposed in `Fixing Weight Decay Regularization in Adam`_.
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining
paramet... |
<filename>C2CRIBuildDir/projects/C2C-RI/src/RIGUI/src/org/fhwa/c2cri/gui/wizard/testconfig/edit/page/SelectRequirementsPage.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
packag... |
<reponame>knofler/app<filename>app/containers/Delete/saga.js
/* eslint-disable comma-dangle */
/* eslint-disable no-console */
/*
*
* DELETE saga
*
*/
import { all, call, put, takeLatest } from "redux-saga/effects";
import { socket } from "utils/socketio-client";
import { DELETE_CONST_POST } from "./constants";
import... |
#!/bin/bash
COVER_PROFILE=coverage.txt
echo "mode: set" > $COVER_PROFILE
FAIL=0
go test -cover ./polly/cli || FAIL=1
if [ "$FAIL" -ne 0 ]; then
exit 1
fi
COVER_PKG="github.com/emccode/polly"
go test -coverpkg=$COVER_PKG -coverprofile=profile.out ./test || FAIL=1
if [ -f profile.out ]; then
cat profile.out... |
import * as azmaps from "azure-maps-control";
import { PieChartMarkerOptions } from './PieChartMarkerOptions';
import { ExtendedHtmlMarker } from './extentions/ExtendedHtmlMarker';
/**
* A class for creating Pie Charts as HTML Markers on a map.
*/
export class PieChartMarker extends azmaps.HtmlMarker implements Ext... |
def distinct_subsequences(s):
n = len(s)
dp = [[0 for i in range(n+1)] for i in range(n+1)]
for i in range(n+1):
dp[i][0] = 1
for i in range(1, n+1):
for j in range(1, n+1):
if s[i-1] == s[j-1] and i != j:
dp[i][j] = dp[i-1][j-1] + dp[i-1][j]
else:
... |
#!/bin/sh
if [ ! $# -ge 1 ] || [ ! $# -le 3 ]; then
echo "Usage: $0 NAME (SECURITY_PROFILE) (CERTFILE)"
exit 1
fi
CLIENT_NAME=$1
CLIENT_SECURITY_PROFILE=$2
[ -z "$CLIENT_SECURITY_PROFILE" ] && CLIENT_SECURITY_PROFILE="idsc:BASE_SECURITY_PROFILE"
CLIENT_CERT="keys/clients/$CLIENT_NAME.cert"
if [ -n "$3" ]; t... |
#!/bin/bash
QUALITY=$(pylint --rcfile=pylint.rc transport_proxy.py yandex_transport_core/*.py | grep -oP '(?<=Your code has been rated at).*?(?=/)')
echo "Quality : $QUALITY"
echo '"Code quality"' > code_quality.csv
echo $QUALITY >> code_quality.csv
SIZE_BYTES=$(docker image inspect owlsoul/ytproxy:dev... |
#!/bin/sh
remove_directory="/usr/local/foglamp/python/foglamp/plugins/north/omf/"
# Remove dir if exists
if [ -d "${remove_directory}" ]; then
echo "FogLAMP package update: removing 'omf' Python north plugin ..."
rm -rf "${remove_directory}"
# Check
if [ -d "${remove_directory}" ]; then
echo ... |
<filename>packages/web/src/components/Community/ModTools/RulesPane/RuleForm/RuleForm.test.tsx<gh_stars>0
import React from 'react';
import Modal from 'components/Modal/Modal';
import {
render,
fireEvent,
cleanup,
waitForElement,
} from '@testing-library/react';
import RuleForm from './RuleForm';
describe('<Rule... |
#!/bin/bash
#
# Copyright 2021 SkyAPM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
#!/bin/bash
rm dist/*
python setup.py sdist bdist_wheel
rm dist/*.egg
twine upload dist/*
|
#!/bin/bash
# Copyright (c) 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
#
export vol_name=u01
########### SIGINT handler ############
function _int() {
echo "Stopping container.."
echo "SIGINT received, shutting down... |
#!/usr/bin/bash
# Copyright (c) 2021. Huawei Technologies Co.,Ltd.ALL rights reserved.
# This program is licensed under Mulan PSL v2.
# You can use it according to the terms and conditions of the Mulan PSL v2.
# http://license.coscl.org.cn/MulanPSL2
# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARR... |
package no.mnemonic.commons.logging;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicReference;
public class Logging {
private static final String LOGGING_PROPERTY_FILE = "META-INF/no.mnemonic.commons.logging.Logging.properties";
priva... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 69