text
stringlengths
1
1.05M
def sum_even_numbers(num_list): try: even_sum = 0 for num in num_list: if isinstance(num, int) and num % 2 == 0: even_sum += num return even_sum except Exception as e: return "Error occurred"
function calculateProductPrices($products) { $calculatedPrices = []; foreach ($products as $product) { $finalPrice = $product['base_price']; switch ($product['category']) { case 'electronics': $finalPrice *= (1 - 0.10); // Apply 10% discount break; ...
<reponame>isomorfeus/isomorfeus-project require 'spec_helper' RSpec.describe 'LucidTranslation::Mixin' do context 'on server' do it 'can mixin' do result = on_server do class TestClass include LucidTranslation::Mixin end TestClass.ancestors end expect(result).t...
<gh_stars>0 'use strict'; // DB abstraction // For postgreSQL use sequalize, as it returns Promises const redis = require('redis'); const REDIS_URI = process.env.URI || require('../config').uri; const client = redis.createClient(REDIS_URI); class DB { constructor() { this.client = client; } getData() { ...
package com.partyrgame.socketservice.service.impl; import java.util.List; import com.partyrgame.blackhandservice.model.BlackHand; import com.partyrgame.chatservice.model.ChatMessage; import com.partyrgame.roomservice.model.Room; import com.partyrgame.socketservice.service.MessageService; import com.partyrgame.sockets...
<gh_stars>1-10 export {default as favoritesFilterSelector} from './favoritesFilterSelector'; export {default as flagsSelector} from './flagsSelector'; export {default as isAboutRouteSelector} from './isAboutRouteSelector'; export {default as locationSelector} from './locationSelector'; export {default as themeSelector}...
package cyclops.reactor.container.transformer; import cyclops.container.foldable.AbstractConvertableSequenceTest; import cyclops.container.immutable.impl.ConvertableSequence; import cyclops.monads.AnyMs; import cyclops.monads.Witness.list; import cyclops.reactor.stream.FluxReactiveSeq; public class StreamTSeqConver...
/******************************************************************/ /******** socket 接続系処理 ***********/ /******************************************************************/ var socket = { on: function(){} }; var url = "https://motion-share.herokuapp.com"; //websocketサーバのURL。 // 接続 var con...
<reponame>danhagen/NonlinearControl from pendulum_eqns.physiology.muscle_params_BIC_TRI import * from pendulum_eqns.state_equations import * from scipy.integrate import cumtrapz import matplotlib.pyplot as plt from danpy.sb import dsb Theta_i = np.pi/6 Theta_f = 2*np.pi/3 Omega = 1 T_end = (Theta_f-Theta_i)/Omega N = ...
<reponame>magma/fbc-js-core /** * Copyright 2020 The Magma Authors. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distri...
import torch import json import sys import ttach as tta from albumentations.augmentations.geometric.resize import Resize from sklearn.model_selection import train_test_split from torch.utils.data import DataLoader from tqdm import tqdm import missed_planes.engine as engine import missed_planes.metrics as metrics from ...
<reponame>izikaj/sunrise # frozen_string_literal: true require 'sunrise/config/base' require 'sunrise/config/has_fields' module Sunrise module Config class Form < Base include Sunrise::Config::HasFields include Sunrise::Config::HasGroups # List of permissible attributes register_instanc...
#!/usr/bin/env bash testdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $testdir/../../..) source $rootdir/test/common/autotest_common.sh source $rootdir/test/nvmf/common.sh if [ -z "${DEPENDENCY_DIR}" ]; then echo DEPENDENCY_DIR not defined! exit 1 fi spdk_nvme_cli="${DEPENDENCY_DIR}/nvme-cli...
const axios = require('axios'); const url = 'json data url'; const parseJSON = async url => { try { const response = await axios.get(url); const data = response.data; console.log(data); } catch (error) { console.error(error); } }; parseJSON(url);
#!./test/libs/bats/bin/bats DOTFILES_REPO=$HOME/Dotfiles load 'libs/bats-support/load' load 'libs/bats-assert/load' load 'test_helper' wads='./wads' @test "Should symlink file from home directory to ~/Dotfiles" { touch $HOME/.testrc run $wads add .testrc assert_success assert [ -e $DOTFILES_REPO/tes...
<gh_stars>0 package com.example.assets.model; import org.litepal.crud.DataSupport; import java.util.Date; /** * Created by Administrator on 2017/3/14. * 计划表 */ public class Plan extends DataSupport{ private int id; private String aim;//计划的目标 private double money;//计划存款金额 private Date endTime;//截止...
<filename>LineCharts/LineChartHeader.h // // LineChartHeader.h // UVLOOK // // Created by Hepburn on 2020/3/10. // Copyright © 2020 Hepburn. All rights reserved. // #ifndef LineChartHeader_h #define LineChartHeader_h // 线条类型 typedef NS_ENUM(NSInteger, LineType) { LineType_Straight, // 折线 LineType_Curve ...
# Write your solution here! class NumberStats: def __init__(self): self.numbers = 0 self.count = 0 self.avg = 0 def add_number(self, number:int): self.numbers += number self.count += 1 def count_numbers(self): return self.count def get_sum(self): ...
#!/usr/bin/env bash mkdir -p build # shellcheck disable=SC2164 cd build cmake -DCMAKE_BUILD_TYPE=Release .. sudo cmake --build . --target install
#!/usr/bin/env bash # Copy all relevant files into a given directory # Usage: ./scripts/package.sh "target_directory" # Create the application directory APP_DIR=$1 mkdir -p $APP_DIR # Copy built files cp "build/gui/Grabber" $APP_DIR 2> /dev/null cp "build/cli/Grabber-cli" $APP_DIR 2> /dev/null cp build/languages/*.qm...
#!/bin/bash # ---------------------------------------------------------------------------- # # Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. # # WSO2 Inc. licenses this file to you under the Apache License, # Version 2.0 (the "License"); you may not use this file except # in compliance with t...
<reponame>robchambers/hypothetical import { Injectable } from '@angular/core'; import * as hypothetical from './hypothetical'; import * as _ from 'lodash'; /** * Store input/output data corresonding to a single baseline and associated hypotheticals. * * Functionality should eventually include: * * Save/load for ...
let stars = []; fetch('https://api.solarsystemscope.com/stars') .then(res => res.json()) .then(data => { let starsData = data.filter(star => { return star.distance < 1000; }); stars = starsData; console.log(stars); });
<reponame>pcnate/redapp<filename>src/app/config.service.ts import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; import { catchError, retry } from 'rxjs/operators'; import { Observable, throwError } from 'rxjs'; const httpOptions = { headers: n...
source $SRCDIR/libtest.sh # Test DEVS= directive. Returns 0 on success and 1 on failure. test_devs() { local devs=$TEST_DEVS local test_status=1 local testname=`basename "$0"` local vg_name="css-test-foo" # Error out if any pre-existing volume group vg named css-test-foo if vg_exists "$vg_name"; then ...
/** * */ package net.abi.abisEngine.rendering.asset; import net.abi.abisEngine.util.Expendable; /** * @author abinash * */ public interface AssetI extends Expendable { /** * Increments the asset's reference count by one. */ public void incRef(); public int incAndGetRef(); /** * Decrements the asset...
def remove_duplicates(lst): seen = set() filtered_list = [] for item in lst: if item not in seen: seen.add(item) filtered_list.append(item) return filtered_list if __name__ == "__main__": lst = ['a', 'b', 'c', 'd', 'a', 'c'] print(remove_duplicates(lst))
class BinaryTree { int data; BinaryTree left; BinaryTree right; BinaryTree(int data) { this.data = data; } // convert an array of integers into a binary search tree static BinaryTree arrayToBST(int[] arr) { BinaryTree bt = null; for (int i : arr) bt = insert(bt, i); return bt;...
from random import randrange bolso = 100 resultado = 0 resposta = "s" while(resposta=="s"): numero_apostado = int(input("Escolha um número entre 1 e 6 para você apostar: ")) valor_aposta = float(input("Qual o valor da aposta? ")) bolso -= valor_aposta dado1 = randrange(1,6) dado2 = randrange(1,6) print("Sor...
#!/bin/bash -e DEMO_DROP=$HOME/drop DEMO_HOME=$HOME/guacamole-demo CERT_DIR=$DEMO_HOME/cert mkdir -p $CERT_DIR cd $DEMO_DROP tar -zxpf guacamole.soulwing.org.tar.gz cp guacamole.soulwing.org/fullchain1.pem $CERT_DIR/cert.pem cp guacamole.soulwing.org/privkey1.pem $CERT_DIR/key.pem
<reponame>munenelewis/whatsapp-v-email import firebase from 'firebase' const firebaseConfig = { apiKey: '<KEY>', authDomain: 'whatsapp1-49293.firebaseapp.com', projectId: 'whatsapp1-49293', storageBucket: 'whatsapp1-49293.appspot.com', messagingSenderId: '341210929144', appId: '1:341210929144:web:459b17deb...
#!/usr/bin/env sh # SPDX-License-Identifier: MIT debug () { create_s3_config while true do echo "Press [CTRL+C] to stop.." sleep 120 done } create_s3_config() { s3_config=$(cat <<-JSON { "identities": [ { "name": "pds", "credentials": [ ...
<filename>pages/home-page/SpeakersSection.js import React from "react"; import PageSection from "components/PageSection/index"; import Speakers from "components/Speakers/index"; const items = [ { image: "/static/image/people/pedram.jpg", name: "<NAME>", desc: "full-stack Javascr...
package zuul.gameState.maps; import zuul.GameText; import zuul.gameState.Item; import zuul.gameState.Room; import zuul.gameState.characters.Character; import zuul.gameState.characters.Player; import java.util.Arrays; /** * World of Zuul standard {@link Map}. * <p> * This map has five {@link Room Rooms} (outside, ...
#!/bin/bash echo '1' | ./ontology --enable-shard-rpc --config solo-config.json --enable-consensus --disable-broadcast-net-tx --disable-tx-pool-pre-exec echo $! > pid
package com.atjl.retry.mapper.gen; import com.atjl.retry.domain.gen.TsProcessLog; import com.atjl.retry.domain.gen.TsProcessLogExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface TsProcessLogMapper { int countByExample(TsProcessLogExample example); int delet...
/* * Copyright (c) 2004-2012, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of ...
<gh_stars>0 import { Component, OnInit, NgZone } from '@angular/core'; import { ContentService } from "../../services/content.service"; import { NavigationItem } from "../../classes/navigationItem"; @Component({ selector: 'nav-menu', templateUrl: './navmenu.component.html', styleUrls: ['../../scss/master...
#!/bin/sh # # Vivado(TM) # runme.sh: a Vivado-generated Runs Script for UNIX # Copyright 1986-2020 Xilinx, Inc. All Rights Reserved. # echo "This script was generated under a different operating system." echo "Please update the PATH and LD_LIBRARY_PATH variables below, before executing this script" exit if [ -z "$...
<gh_stars>1-10 export const AdminPanel = () => { return <div>AdminPanel</div>; };
#!/usr/bin/env bash here=$(pwd) cd "$1" num_file=$(find -type f | wc -l) #Find file types and count num_dir=$(find -type d | wc -l) #Find directory types and count echo "There were" "$num_dir" "directories." echo "There were" "$num_file" "regular files." cd "$here"
package net.haesleinhuepf.imagej.zoo.data; import fiji.util.gui.GenericDialogPlus; import ij.ImageJ; import ij.Prefs; import ij.plugin.PlugIn; public class ClearControlDataSetOpener implements PlugIn { private static String path = Prefs.getDefaultDirectory(); private static String datasetName = "C0opticsprefu...
<gh_stars>0 # frozen_string_literal: true require "sidekiq/web" Rails.application.routes.draw do mount Blacklight::Oembed::Engine, at: "oembed" mount Riiif::Engine => "/images", as: "riiif" root to: "spotlight/exhibits#index" mount Spotlight::Engine, at: "starlight" mount Blacklight::Engine => "/" # Dyna...
<filename>artifacts/maven-classpath-munger/munger/src/main/java/org/apache/maven/classpath/munger/AbstractMunger.java /* * Copyright 2013 <NAME> * * 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 Lice...
import { State } from "@aicacia/state"; import { RecordOf } from "immutable"; import { useState, useEffect, useRef } from "react"; import { shallowEqual } from "shallow-equal-object"; export function createHook<T>(state: State<T>) { return function useMapStateToProps<TProps>( mapStateToProps: (state: RecordOf<T>...
#!/bin/bash set -eu LIRASM=$1 TESTS_DIR=`dirname "$0"`/tests function runtest { local infile=$1 local options=${2-} # Catch a request for the random tests. if [[ $infile == --random* ]] then local outfile=$TESTS_DIR/random.out else local outfile=`echo $infile | sed 's/\.in/\...
#!/bin/bash # # Copyright (c) 2019-2020 P3TERX <https://p3terx.com> # # This is free software, licensed under the MIT License. # See /LICENSE for more information. # # https://github.com/P3TERX/Actions-OpenWrt # File name: diy-part2.sh # Description: OpenWrt DIY script part 2 (After Update feeds) # sed -i 's/192.168.1...
<?php $x = 5; $y = 8; $z = 3; $result = ($x + $y + $z) / 3; echo "Average of ".$x.", ".$y.", and ".$z." is ".$result; ?>
require("make-promises-safe") require("dotenv").config() const fs = require("fs") const { getSites } = require("../common/getSites") const feedReader = require("feed-reader") ;(async () => { const feedDb = JSON.parse( fs.readFileSync("tmp/webring-site-data/feed.json", "utf8") ) const sites = getSites() co...
def longest_consecutive_zeros(s: str) -> int: max_zeros = 0 current_zeros = 0 for c in s: if c == '0': current_zeros += 1 max_zeros = max(max_zeros, current_zeros) else: current_zeros = 0 return max_zeros
'use strict' const Article = ` type Article { topicId: String, text: String, author: Member } ` exports.schema = [Article] exports.resolvers = { Article: { topicId (article) { return article.topic.id }, }, }
/* eslint-disable no-restricted-globals */ self.addEventListener('install', () => { self.skipWaiting() }) self.addEventListener('activate', () => { self.registration .unregister() .then(() => { return self.clients.matchAll() }) .then(clients => { clients.forEach(client => client.navigat...
util/test.sh artifact/test.sh model/test.sh
package aufgabe10_8; public class Return extends Statement { private Expression expr; public Expression getExpression() { return expr; } public Return(Expression expr) { super(); this.expr = expr; } @Override public void accept(Visitor visitor) { visitor.visit(this); } }
<filename>modules/sink/reporter/api.go package reporter import ( "net/http" "github.com/blushft/strana/modules/sink/reporter/entity" "github.com/gofiber/fiber" "github.com/gofiber/websocket" ) func (mod *reporter) routes(rtr fiber.Router) { api := rtr.Group("/reporter") mod.liveRoutes(api) mod.reportRoutes(a...
import nltk import pandas as pd from nltk.sentiment.vader import SentimentIntensityAnalyzer # Create the sentiment analyzer analyzer = SentimentIntensityAnalyzer() # Create the classifer classifier = nltk.NaiveBayesClassifier.train([ ("Today was great!", "positive"), ("I am feeling sad.", "negative"), ("I'm not...
<gh_stars>10-100 /* * Copyright [2018] [<NAME>] * * 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 l...
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic...
import Hue from "/hue/hue.js"; import HueService from "/hue/hue.service.js"; const priv = Symbol("private"); export default class HueLight extends Object { constructor() { super(); this.init(-1); } set on(newValue) { this._setValue("on", newValue); } set bri(newValu...
# Clean up unneeded packages. yum -y clean all # solve network interface problems rm /etc/udev/rules.d/70-persistent-net.rules mkdir /etc/udev/rules.d/70-persistent-net.rules rm /lib/udev/rules.d/75-persistent-net-generator.rules rm -rf /dev/.udev/ sed -i "/^HWADDR/d" /etc/sysconfig/network-scripts/ifcfg-eth0
cp anura anura~ make clean && time nice -n 19 make "-j$(nproc)" kdialog --msgbox "make finished"
/** * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 <NAME>, Medical Physics * Department, University Hospital of Liege, Belgium * Copyright (C) 2017-2020 <NAME>., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser Gener...
/* * Copyright 2015 lixiaobo * * VersionUpgrade project licenses this file to you 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 requ...
#!/usr/bin/env sh # # This file invokes cmake and generates the build system for Gcc. # if [ $# -lt 5 ] then echo "Usage..." echo "gen-buildsys-gcc.sh <path to top level CMakeLists.txt> <GccMajorVersion> <GccMinorVersion> <Architecture> <ScriptDirectory> [build flavor] [coverage] [ninja] [cmakeargs]" echo "Speci...
# (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from .oracle import Oracle, OracleConfigError from .__about__ import __version__ __all__ = [ "__version__", 'Oracle', 'OracleConfigError' ]
kubectl create ns $1 status=$? if [ $status -eq 0 ]; then echo command succeeded else echo command failed fi echo status is $status
sudo apt-get install -y libxml2-dev sudo apt-get install -y swig sudo pip install Numberjack matplotlib bokeh
#!/bin/bash envsubst < exercises/frontend/ingress.yaml.in > exercises/frontend/ingress.yaml
import Logo from './logo.png'; import WatchVector from './watch_vector.jpeg'; import Background from './bg1.png'; export { Logo, WatchVector, Background };
#!/bin/bash set -e set -x # Script to run http://goreleaser.com # Removed from `build` stanza # binary: $module module=$1 shift # The following assumes git tags formatted like # "api/v1.2.3" and splits on the slash. # Goreleaser doesn't know what to do with this # tag format, and fails when creating an archive # wi...
#!/usr/bin/env bash export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 NGPUS=8 CFG_DIR=cfgs/kitti_models CFG_NAME=hh3d_rcnn_car python -m torch.distributed.launch --nproc_per_node=${NGPUS} train.py --launcher pytorch --cfg_file $CFG_DIR/$CFG_NAME.yaml --workers 8
module MultiSessionStore module DefaultUrlOptions def default_url_options options = params[:subsession_id] ? {subsession_id: params[:subsession_id]} : {} begin super.merge options rescue NoMethodError options end end end end
/* * Copyright © 2019 <NAME>. */ package filters import ( "errors" "github.com/hedzr/voxr-api/api/v10" "github.com/hedzr/voxr-api/models" "github.com/hedzr/voxr-common/dc" "github.com/hedzr/voxr-common/tool" "github.com/hedzr/voxr-lite/misc/impl/dao" "github.com/hedzr/voxr-lite/misc/impl/mq" "github.com/sir...
#!/bin/bash python3 -m http.server 1111
// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0 // protoc v3.13.0 // source: executor.proto package proto import ( proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/pr...
python transformers/examples/language-modeling/run_language_modeling.py --model_name_or_path train-outputs/0+1024+512/7-model --tokenizer_name model-configs/1536-config --eval_data_file ../data/wikitext-103-raw/wiki.valid.raw --output_dir eval-outputs/0+1024+512/7-512+512+512-FW-first-256 --do_eval --per_device_eval_ba...
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { PopoverHeader, PopoverBody, PopoverList, PopoverFooter, AvatarImg } from './styles'; import Filter from './Filter'; const propTypes = { items: PropTypes.arrayOf( PropTypes.shape({ _id: PropTypes.string.isRequir...
#!/usr/bin/env bash set -e git remote set-url origin https://${GH_TOKEN}@github.com/newsuk/times-components.git > /dev/null 2>&1 git checkout master TIP_COMMIT=$(git rev-parse HEAD) echo $(printf "CircleCI commit: %s, Head commit: %s" $CIRCLE_SHA1 $TIP_COMMIT) # make sure we only publish if we are at the head of mas...
source ../testsupport.sh run grep -q "It failed" test.out || err "Failed to find expected text 'It Failed' in output" bpipe override hello > test.out run grep -q "It failed" test.out && err "Found unexpected text 'It Failed' in output" true
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.grasea.grandroid.actions; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; /** * * @author Rovers */ public class AlertAction extends ContextAction ...
One of the simplest sorting algorithms that can be used to sort an array of integers in ascending order is the Bubble Sort algorithm. Bubble Sort works by iterating through the array and comparing two adjacent elements at a time and swapping them if necessary to ensure that the elements are in the correct order. This s...
CHANNEL_NAME="utilityemissionchannel" # CC_NAME="emissionscontract" LOG_FILE_NAME=chaincode${2}_log.txt CC_SUBDIR="one" NODE_SUBDIR="node-one" CC_NN=${2} if [ $CC_NN -eq 2 ]; then CC_SUBDIR="two" NODE_SUBDIR="node-two" fi export FABRIC_CFG_PATH=$PWD/fabric-config/ export PATH=${PWD}/bin:$PATH # import utils . sc...
#!/bin/bash LAUNCH_DIR=$PWD APPLEDOC_EXE=$(which appledoc) if [ -z "$APPLEDOC_EXE" ]; then APPLEDOC_EXE=/usr/local/bin/appledoc fi PROJECT_ROOT=$PWD DEPLOYMENT_DIR=${PROJECT_ROOT}/deployment SDK_LIBRARIES_ROOT=${PROJECT_ROOT}/ObjcScopedGuard/ObjcScopedGuard if [ -d "$DEPLOYMENT_DIR" ]; then rm -rf "$DEPLOYMEN...
import React, { useState, useEffect } from "react"; import { useSelector } from "react-redux"; import { getPosts } from "../api/posts"; import PostList from "../components/PostList"; import WelcomeJumbotron from "../components/WelcomeJumbotron"; function Home() { const isAuthenticated = useSelector((state) => state...
package ExerciciosExtras; import java.util.Scanner; public class ExercicioTresComplemento { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Digite a palavra oculta: "); String palavraOculta = scanner.next(); int tentativas = 5...
#include "precompiled.h" #pragma hdrstop #include "AnimationBlendPoseNode.h" AnimationBlendPoseNode::AnimationBlendPoseNode(std::shared_ptr<AnimationPoseNode> firstNode, std::shared_ptr<AnimationPoseNode> secondNode, SkeletalAnimationVariableId blendParameterVariableId, SkeletalAnimationBlendPoseType blendType...
package com.boria.borialearndemo.DayOneForAIDL; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import andr...
# Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
<reponame>dnmvisser/pyFF """ An abstraction layer for metadata fetchers. Supports both syncronous and asyncronous fetchers with cache. """ from .logs import get_log import os import requests from .constants import config from datetime import datetime from collections import deque from .parse import parse_resource fr...
def insertion_sort(lst): for i in range(1, len(lst)): key = lst[i] j = i-1 while j >=0 and key < lst[j] : lst[j+1] = lst[j] j -= 1 lst[j+1] = key lst = [8,5,6,4,7] insertion_sort(lst) print("Sorted Array: ", lst)
function drawShape(canvas, shapeType, x1, y1, x2, y2) { if (x1 < 0 || y1 < 0 || x2 < 0 || y2 < 0 || x1 >= canvas.length || y1 >= canvas[0].length || x2 >= canvas.length || y2 >= canvas[0].length) { return canvas; // Invalid coordinates, return original canvas } switch (shapeType) { case "rectangle": ...
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server...
import json def save_user_settings(username, settings): # Write settings to json file with open(username+'.json', 'w+') as f: json.dump(settings, f) def read_user_settings(username): # Read settings from json file with open(username+'.json', 'r') as f: settings = json.load(f) r...
#! /bin/bash # # Installation script for MVNC # # See CK LICENSE for licensing details. # See CK COPYRIGHT for copyright details. # # Developer(s): # - Grigori Fursin, 2017; # # PACKAGE_DIR # INSTALL_DIR echo "**************************************************************" echo "Executing make install ..." cd ${INS...
<reponame>tengxing/ObjectToJsonPressureTest<filename>src/main/java/cn/yjxxclub/ObjectToJsonPressureTest/entity/Book.java<gh_stars>0 package cn.yjxxclub.ObjectToJsonPressureTest.entity; import java.io.Serializable; import java.util.Date; /** * Author: 遇见小星 * Email: <EMAIL> * Date: 17-6-28 * Time: 上午9:53 * Describ...
<gh_stars>0 """Set up bmt-lite package.""" import json from pathlib import Path import re from setuptools import setup import sys stash = sys.path.pop(0) # avoid trying to import the local bmt from bmt import Toolkit sys.path = [stash] + sys.path # restore the path import httpx FILEPATH = Path(__file__).parent DAT...
package com.uber; import javax.annotation.Nullable; public class Super { @Nullable public IntSet getPredNodeNumbers(T node) throws UnimplementedError { Assertions.UNREACHABLE(); return null; } @Nullable OrdinalSet<Statement> computeResult( Statement s, Map<PointerKey, MutableIntSet> pointerKey...
from cached_property import cached_property from nudgebot.thirdparty.base import EndpointScope from nudgebot.thirdparty.irc.base import IRCendpoint from nudgebot.thirdparty.irc.server import Server class Channel(EndpointScope): Endpoint = IRCendpoint() Parents = [Server] primary_keys = ['server', 'channe...
fn calculate_remaining_time(total_size: u32, speeds: &Vec<u32>) -> u32 { let total_speed: u32 = speeds.iter().sum(); let remaining_size = total_size - (total_speed * speeds.len() as u32); let remaining_time = remaining_size / total_speed; remaining_time }
package elasta.pipeline.converter; import elasta.core.promise.intfs.Promise; /** * Created by Jango on 2016-11-20. */ public interface ConverterAsync<T, R> extends Converter<T, Promise<R>> { @Override Promise<R> convert(T t); }