text
stringlengths
1
1.05M
<reponame>ghackett/ProviderOne /* * This file has been auto-generated by ProviderOne * * Copyright (C) 2011 GroupMe, Inc. */ package com.groupme.providerone.sample.database.autogen.util; import android.content.ContentValues; import android.database.DatabaseUtils; import android.database.SQLException; import androi...
# Generated by "generate_commands.py" USE_HOROVOD=${1:-0} # Horovod flag. 0 --> not use horovod, 1 --> use horovod VERSION=${2:-2.0} # SQuAD Version DTYPE=${3:-float32} # Default training data type MODEL_NAME=google_albert_base_v2 BATCH_SIZE=4 NUM_ACCUMULATED=3 EPOCHS=3 LR=2e-05 WARMUP_RATIO=0.1 WD=0.01 MAX_SEQ_L...
<reponame>kdubiel/bh-events import { BaseController } from 'interfaces'; export interface Controller extends BaseController {}
/* * Copyright 2018 Realm Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in wr...
import { DeepPartial, Theme } from "@chakra-ui/react"; import { mode } from "@chakra-ui/theme-tools"; const Button: DeepPartial<Theme["components"]["Button"]> = { variants: { solid: (props: any) => ({ bg: mode("violet.300", "purple.500")(props), color: mode("purple.700", "violet.50")(props), bo...
#!/bin/bash PATH_NEMO_CONTEXTMENU=/usr/share/nemo/actions/ContextMenu.nemo_action PATH_APPLICATIONS_SECUREGATE=/usr/share/applications/SecureGate.desktop PATH_OPENNETLINK=/opt/hanssak/opennetlink function CheckToRemoveFileAndDirectory() { if [ $# -ne 1 ]; then echo "Need by 1 parameter" elif [ -f $1 ]; then ech...
import numpy as np import os import shutil import glob import JSONHelper import quaternion import argparse import os.path as osp import pickle import align_utils as utils def loadMesh(name ): vertices = [] faces = [] with open(name, 'r') as meshIn: lines = meshIn.readlines() lines = [x.strip()...
#!/usr/bin/env bash # shellcheck disable=SC1090,SC2154 # Copyright 2020 Istio 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 # # Un...
<filename>src/main/java/com/neusoft/mapper/ContactRecordMapper.java package com.neusoft.mapper; import com.neusoft.entity.ContactRecord; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> * 交往记录 交往记录 Mapper 接口 * </p> * * @author CDHong * @since 2018-11-22 */ public interface ContactRecordMapper ...
package com.ibm.socialcrm.notesintegration.files.dialogs; /**************************************************************** * IBM OpenSource * * (C) Copyright IBM Corp. 2012 * * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * ***********************************************...
import * as dynamoDbLib from '../libs/dynamodb-lib' import { success, failure } from '../libs/response-lib' import uuid from 'uuid' export async function main(event, context) { let data typeof event.body === 'string' ? (data = JSON.parse(event.body)) : (data = event.body) const params = { TableName:...
/** * Bolt * statements/UpdateSelect * * Copyright (c) 2017 <NAME> * * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php * * @author <NAME> */ package com.sopranoworks.bolt.statements import com.google.cloud.spanner.{Mutation, TransactionContext} impo...
window.addEventListener('load',function() { $(document).ready(function() { $('#livefilterdemo').liveFilter({ delay: 200, // how long between keystroke and filter analyticsLogging: false, // log to google analytics through foundationExtendEBI.js fitlerTargetCustomDiv: 'div.live-filter-target-gran...
module Payshares module Horizon class Problem include Contracts def initialize(attributes) @attributes = attributes.reverse_merge({ type: "about:blank", title: "Unknown Error", status: 500, }) @meta = @attributes.except!(:type, :title, :status, ...
#include <iostream> using namespace std; int main() { char userCh; cout<<"Please enter a character:"<<endl; cin>>userCh; if(userCh >= 'a' && userCh <= 'z') { cout<<userCh<<" is a lower case letter"<<endl; } else if(userCh >= 'A' && userCh <='Z') { cout<<userCh<<" is an upper c...
#!/bin/bash # # libjingle # Copyright 2013 Google Inc. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the...
import { clickTarget, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "jspsych"; import audioButtonResponse from "."; jest.useFakeTimers(); // skip this until we figure out how to mock the audio loading describe.skip("audio-button-response", () => { test("on_load event triggered after page ...
def process_trade_orders(trade_orders): total_trade_orders = len(trade_orders) sell_orders = [order for order in trade_orders if order["order_type"] == "sell"] total_sell_orders = len(sell_orders) total_sell_rate = sum(order["rate"] for order in sell_orders) average_sell_rate = total_sell_rate ...
#!/bin/bash # # A simple and minimal test for deploy.sh set -ex DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TMPDIR=$(mktemp -d /tmp/tmp.deploy-test-XXXX) export KUBEFLOW_DEPLOY=false cd ${TMPDIR} ${DIR}/deploy.sh EXPECTED_APP_DIR=${TMPDIR}/kubeflow_ks_app if [[ ! -d ${EXPECTED_APP_DIR} ]]; then echo ${...
class BankAccount { var numCuenta: String init(numCuenta: String){ self.numCuenta = numCuenta } func validateAccountNumber(accountNumber: String) -> Bool { if accountNumber.count != 10 { return false } let alphabeticRange = accountNumber.ind...
<filename>test/applications/draw.test.js /** * @fileOverview * Vows tests for the Draw example application. * * These are cluster tests using Express, Redis, and multiple Thywill * processes. */ var tools = require('../lib/tools'); // Obtain a test suit that launches Thywill instances in child processes. var su...
php artisan clear-compiled php artisan optimize:clear composer dump-autoload php artisan optimize #&EC@1%Fc34 //clave de registro #Soportapp&EC@1%Fc34 admin //clave y usuario de la base de datos #Soportapp&EC@1%Fc34 admin@soportapp.tk //clave y usuario admin Web CREATE USER 'usuario'@'localhost' IDENTIFIED BY 'pas...
#!/bin/bash app_name="landmark" # This should be sufficient to enable ML and BigQuery, along with GCS (Storage) service="storage-mike" # Additional configuration parameters: varies depending on which service # Ref. https://cloud.google.com/iam/docs/understanding-roles # # ML, BigQuery: -c '{"role": "viewer"}' # Sto...
<gh_stars>0 var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; ...
<gh_stars>0 import {UX} from '@salesforce/command'; import {Optional} from '@salesforce/ts-types'; import {DescribeSObjectResult} from 'jsforce/describe-result'; import {sfdx} from '../sfdx'; // username -> sobject -> describe const describeSObjectResultCache = new Map<string, Map<string, DescribeSObjectResult>>(); i...
from typing import TypedDict class UserActionSystemMessageContent(TypedDict): user_action: str message_content: str # Example usage user_action_message_map: UserActionSystemMessageContent = { "login": "Welcome back!", "logout": "You have been successfully logged out.", "purchase": "Thank you for y...
<filename>LeetCode/source/PlusOne.cpp // PlusOne // 2021.12.28 // Easy class Solution { public: vector<int> plusOne(vector<int>& digits) { int len = digits.size(); digits[len - 1] = digits[len - 1] + 1; if (digits[len - 1] < 10) { return digits; } f...
<reponame>adarshaacharya/csoverflow<gh_stars>10-100 // env variable config if (process.env.NODE_ENV !== 'production') { require('dotenv').config(); } import app from './app'; import { databaseGenerate } from './config/database.config'; //db databaseGenerate(); const hostname = 'localhost'; const PORT = process.env...
export type LogMode = 'live' | 'interactive' | 'grouped';
#!/sbin/sh # # /system/addon.d/50-cm.sh # During a CM14.0 upgrade, this script backs up /system/etc/hosts, # /system is formatted and reinstalled, then the file is restored. # . /tmp/backuptool.functions list_files() { cat <<EOF etc/hosts EOF } case "$1" in backup) list_files | while read FILE DUMMY; do ...
import { Component, ChangeDetectorRef, trigger, state, style, transition, animate} from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { MatButtonModule, MatCheckboxModule} from '@angular/material'; import { MatCardModule} from '@angular/material/card'; import { MatSidenavModule} from '...
'use strict'; jasmine.getFixtures().fixturesPath = "base/test/fixtures"; describe('jquery.filterjitsu.js not filterjitsu search query test suite', function () { var $fj; beforeEach(function () { loadFixtures('template-only-filter-params.html'); // HACK (marcus): the following line of code is needed to m...
CREATE OR REPLACE FUNCTION monthly_cost(price float, length int) RETURNS float AS $$ BEGIN RETURN price * length; END; $$ LANGUAGE plpgsql; SELECT monthly_cost(10, 6);
#!/usr/bin/env bash SOURCE_TAG_PREFIX="${TRAVIS_REPO_SLUG//\//_}_$TRAVIS_BUILD_NUMBER" TARGET_TAG_PREFIX="$TRAVIS_COMMIT" SOURCE_OPTIONS="--source-docker-repository-name '$BUILD_DOCKER_REPOSITORY' --source-docker-username '$BUILD_DOCKER_USERNAME' --source-docker-password '$BUILD_DOCKER_PASSWORD' --source-docker-tag-pre...
// Package nutriscore provides utilities for calculating nutritional score and // Nutri-Score. // More about-score: https://en.wikipedia.org/wiki/Nutri-Score package nutriscore // ScoreType is the type of the scored product type ScoreType int const ( // Food is used when calculating nutritional score for general foo...
#!/bin/bash -e . /etc/os-release print_usage() { echo "build_reloc.sh --clean --nodeps" echo " --clean clean build directory" echo " --nodeps skip installing dependencies" echo " --version V product-version-release string (overriding SCYLLA-VERSION-GEN)" exit 1 } CLEAN= NODEPS= VERSION_OVE...
fetch('/api/user/current', { method: 'GET', credentials: 'same-origin', headers: new Headers({ 'Content-Type': 'application/json', 'Accept': 'application/json' }) }) .then(response => { return response.json() }) .then(data => { console.log(data.username) console.log(data.first_name) console.log(data.last_name...
#!/bin/bash note=$1 #Comparaison int #-lt <, -gt >, -ge >=, -le <=, -eq ou ==, -ne ou != if [[ $note -lt 60 ]] #On ne peut pas coller du texte aux [[ ou aux ]] then echo "echec" elif test $note -eq 60 #test agit comme [[ ]], prendre au choix #On peut mettre le then sur la même ligne, #mais ça prend un '; '...
package com.acgist.snail.pojo.bean; import java.io.Serializable; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.acgist.snail.form...
package test; /** * @Class: InterfaceA * @Description: java类作用描述 * @Author: hubohua * @CreateDate: 2018/8/15 */ public interface InterfaceA { void a(); // Interface定义的默认方法,不用子类继续实现 // default String getName() { // return ""; // } }
package com.nortal.spring.cw.core.xml.jaxb; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.activation.DataHandler; import javax.xml.bind.attachment.AttachmentUnmarshaller; import org.apache.commons.lang3.StringUtils; import org.springframework.oxm.Un...
#!/bin/bash set -e # Define help message show_help() { echo """ Commands --------------------------------------------------------- bash : run bash eval : eval shell command build : build the app [arg: path to cmake folder] run : run the application [arg: path to progr...
public class StepsActivity extends WearableActivity implements SensorEventListener { private SensorManager mSensorManager; private Sensor mStepSensor; private int numSteps = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSensorManager = (SensorManager) ge...
/* * 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...
Model.Form.User = Model.Form.extend({ class_name: 'Model.Form.User', // Returns the form for editing a model or false for an embedded form. edit: function() { var m = this.model; var this2 = this; var div = $('<div/>'); $(m.attributes).each(function(i, a) { if (a.type == 'hi...
<gh_stars>0 /******************************************************************************* * Copyright 2017 Dell Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apac...
#!/bin/bash #SBATCH -J Act_sigmoid_1 #SBATCH --mail-user=eger@ukp.informatik.tu-darmstadt.de #SBATCH --mail-type=FAIL #SBATCH -e /work/scratch/se55gyhe/log/output.err.%j #SBATCH -o /work/scratch/se55gyhe/log/output.out.%j #SBATCH -n 1 # Number of cores #SBATCH --mem-per-cpu=6000 #SBATCH -t 23:59:00 # Hours, minutes ...
def replace(): steps = {1: 'Extracting content', 2: 'Starting edition', 3: 'Getting quantity'} actual = 1 try: file = get_path() print(steps[1]) content = open(file).read() line = [x for x in content.split('\n') if ' ' in x[:1]][0] actual = 2 # Additional st...
<filename>Android/app/src/main/java/eu/rasus/fer/rasus/chatsPreview/AllChatsPreviewFragment.java package eu.rasus.fer.rasus.chatsPreview; import android.app.Fragment; import android.app.FragmentTransaction; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view...
import os from datetime import timedelta from celery import Celery, platforms from kombu import Exchange, Queue from config import ( get_broker_and_backend, get_redis_master ) platforms.C_FORCE_ROOT = True # 日志 worker_log_path = os.path.join(os.path.dirname(os.path.dirname(__file__)) + '/logs', 'celery.log'...
vlib work
import tensorflow as tf from common.ops import shape_ops def mean_stddev_op(input_tensor, axis): # Calculate the mean and standard deviation of the input tensor along the specified axis mean = tf.reduce_mean(input_tensor, axis=axis) variance = tf.reduce_mean(tf.square(input_tensor - mean), axis=axis) s...
def removeSmallestNums(arr): # Sort the array in ascending order arr.sort() # Remove first 4 elements del arr[:4] return arr # Test array arr = [5, 3, 9, 15, 1, 20, 7] # Call the function removed_arr = removeSmallestNums(arr) # Print the modified array print(removed_arr) # [15, 20, 7]
// Event loop for a multithreaded programming language while (!isDone()) { if (!isQueueEmpty()) { // Get the next event in the queue Event event = getNextEvent(); // Execute the event executeEvent(event); } // Wait for the next event waitForNextEvent(); }
#!/usr/bin/env bash # # (C) Copyright IBM Corp. 2020 All Rights Reserved. # # Script install Redis Operator through the Operator Lifecycle Manager (OLM) or via command line (CLI) # application of kubernetes manifests in both an online and offline airgap environment. This script can be invoked using # `cloudctl`, a co...
<reponame>LiuFang07/bk-cmdb // Copyright 2012-2018 <NAME>. All rights reserved. // Use of this source code is governed by a MIT-license. // See http://olivere.mit-license.org/license.txt for details. package elastic import ( "context" "encoding/json" "fmt" "net/url" "github.com/olivere/elastic/uritemplates" ) ...
"use strict"; const parse5 = require('parse5'); const expect = require('chai').expect; const GeneratorContext = require('../../lib/generator-context'); module.exports = { element: function (fragment) { let documentFragment = parse5.parseFragment(fragment, {treeAdapter: parse5.treeAdapters.htmlparser2}); ret...
#!/usr/bin bash # -*- coding:utf-8 -*- # Author: Donny You(donnyyou@163.com) # Generate train & val data. export PYTHONPATH='/home/donny/Projects/PytorchCV' INPUT_SIZE=368 COCO_DIR='/home/donny/DataSet/MSCOCO/' COCO_TRAIN_IMG_DIR=${COCO_DIR}'train2017' COCO_VAL_IMG_DIR=${COCO_DIR}'/val2017' COCO_ANNO_DIR=${COCO_DI...
import {reactive} from "vue"; import {AddressForm} from "@/views/order/orderList/components/addAddress/interface"; export function useForm() { const formData = reactive({ form: {} as AddressForm }) const handleFormChange = (data: any) => { Object.assign(formData.form, data) } retu...
#pragma once #include <bond/core/bond_version.h> #if BOND_VERSION < 0x0800 #error This file was generated by a newer version of the Bond compiler and is incompatible with your version of the Bond library. #endif #if BOND_MIN_CODEGEN_VERSION > 0x0c01 #error This file was generated by an older version of the Bond com...
#!/bin/bash dieharder -d 3 -g 18 -S 3107955950
// there are n houses in a city connected by exactly n-1 roads there is exactly shortest path fromany house to any other house. // the houses are numbered from one to n. since chrimas is abo o come so santa decided to hide gifts in hese houses. // santa will come o the ciy for M consecutive days. Each day he wil come...
def delete_odd_numbers(arr): new_arr = [] for i in arr: if i % 2 != 0: continue else: new_arr.append(i) return new_arr arr = [1, 2, 3, 4, 5, 6] print(delete_odd_numbers(arr))
#!/usr/bin/env bash set -e docker-compose up --remove-orphans --build -d docker-compose exec --user root php rm -rf /var/www/html/var/cache/dev /var/www/html/var/cache/test docker-compose exec --user www-data php chmod -R 777 /var/www/html/var docker-compose exec --user www-data php bin/console doctrine:database:dr...
from __future__ import absolute_import, unicode_literals from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework.test import APITestCase from common.tests.mixins import UserMixin from permissions.classes import Permission from smart_settings.classes import Namespace from us...
<gh_stars>0 package oj; /** * date: 2017/02/04 14:01. * author: <NAME> */ /** * Given a sorted array, remove the duplicates in place such that each element appear only once * and return the new length. * Do not allocate extra space for another array, you must do this in place with constant memory. * * For exa...
package com.tweetapp.app.service; import com.tweetapp.app.dao.entity.User; import org.springframework.stereotype.Service; import java.util.List; @Service public interface UserService { List<User> getAllUsers(); List<User> getSearchedUsers(String username); User getUserDetails(String userId); }
<reponame>alailsonko/relay-nextjs /** @type {import('@docusaurus/types').DocusaurusConfig} */ module.exports = { title: 'relay-nextjs', tagline: 'Relay Hooks integration for Next.js apps', url: 'https://reverecre.github.io/relay-nextjs', baseUrl: '/relay-nextjs/', onBrokenLinks: 'throw', onBrokenMarkdownLin...
module HandlePolicyNotification # We need to consider three factors here to arrive out our decision: # - New Policy, or Continuation Policy? # - If a continuation policy exists, what has changed about it? # - What are the dispositions of the other interacting policies that would # affect the action we shoul...
<reponame>WeebHiroyuki/disgo package main import ( "fmt" "net/http" "os" "os/signal" "strconv" "syscall" "time" "github.com/PaesslerAG/gval" "github.com/sirupsen/logrus" "github.com/DisgoOrg/disgo" "github.com/DisgoOrg/disgo/api" "github.com/DisgoOrg/disgo/api/events" ) const red = 16711680 const orange...
#!/bin/bash # Copyright 2016 Daniel Nüst # # 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 # remove previous log file if running interactive co...
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'yearSpan' }) export class YearSpanPipe implements PipeTransform { transform(yearMin: number, yearMax: number): string { if (yearMax === 9999) { yearMax = new Date().getFullYear(); } if (yearMin === yearMax) { return String...
interface ICalculatePagingInputs { currentPage?: number | string; // user input perPage?: number | string; // user input perPageDefault?: number; perPageMaximum?: number; perPageMinimum?: number; totalItems: number; } export interface ICalculatePagingOutputs { currentPage: number; itemsPerPage: number;...
<filename>kindi/bitmap.go<gh_stars>1-10 // Copyright (c) 2011 <NAME>. 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 // n...
<gh_stars>1-10 package structure.adapter; public interface Cat { public void miao(); public void eat(); } class WildCat implements Cat{ @Override public void miao() { System.out.println("喵喵叫"); } @Override public void eat() { System.out.println("吃饭"); } }
; define(function (require) { var d3 = require('d3'); var $ = require('jquery'); function plotted(element, percents) { var el = d3.select(element); // el.classed('plot', true); //el.html(''); var t = 2 * Math.PI; // http://tauday.com/tau-manifesto var offsetWidth, ...
npm run start-prod --prefix parrot-manager-frontend
import twint # Set up configuration c = twint.Config() c.Search = "programming" # Replace with the desired search query c.Limit = 100 # Limit the number of tweets to fetch c.Store_object = True # Store the tweets in a list for filtering # Fetch tweets twint.run.Search(c) # Filter tweets based on likes and retweet...
SELECT * FROM employees WHERE address = 'Tampa' ORDER BY DeptID ASC;
class JobsController < ApplicationController before_filter :require_user def index @jobs = Job.paginate(:all, :page => params[:page], :order => "id DESC") end def show @job = Job.find(params[:id]) if @job.data["error"] @error_message = @job.data["error"]["message"] @error_exit_code...
package com.arduino.propertyofss.arduinolearning.draglistview.sample; import android.os.Bundle; import java.util.concurrent.TimeUnit; public class ActionList extends BoardFragment{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMe...
#!/usr/bin/env sh # Much of this is an adaptation of the corresponding script in swift-nio: # https://github.com/apple/swift-nio # ============================================================================ set -e MODULES=(Futures FuturesSync) REPO_SLUG=dfunckt/swift-futures REPO_URL=https://github.com/${REPO_SLUG...
using System; using System.Reflection; using UnityEngine; using Sisus.Vexe.FastReflection; public class UnityObjectPropertyAccessor { public static object GetPropertyValue(Object obj, string propertyName) { Type objectType = obj.GetType(); PropertyInfo property = objectType.GetProperty(property...
#!/bin/bash PROCESSOR_TYPE=$(uname -p) DISTRIBUTOR_ID=$(lsb_release -i -s|tr '[:upper:]' '[:lower:]') RELEASE=$(lsb_release -r -s) LIBRARIES_DIRECTORY="./spec/libzstd/${PROCESSOR_TYPE}/${DISTRIBUTOR_ID}/${RELEASE}" if [ -d "$LIBRARIES_DIRECTORY" ]; then for library in ${LIBRARIES_DIRECTORY}/* do bundle exec ...
#!/usr/bin/env bash POSTGRES_URLS=${PGBOUNCER_URLS:-DATABASE_URL} POOL_MODE=${PGBOUNCER_POOL_MODE:-transaction} SERVER_RESET_QUERY=${PGBOUNCER_SERVER_RESET_QUERY} n=1 # if the SERVER_RESET_QUERY and pool mode is session, pgbouncer recommends DISCARD ALL be the default # http://pgbouncer.projects.pgfoundry.org/doc/faq...
int[] myArray = {2, 4, 5, 6, 8} public int binarySearch(int[] array, int key) { int low = 0; int high = array.length - 1; while (low <= high) { int mid = (low + high) / 2; if (key == array[mid]) { return mid; } if (key < array[mid]) { high = m...
#!/bin/sh set -e set -u set -o pipefail function on_error { echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" } trap 'on_error $LINENO' ERR if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy # frameworks to, so exit 0 (signalling the...
#!/bin/sh # Download and install V2Ray echo "go here for test" mkdir /tmp/v2ray curl -L -H "Cache-Control: no-cache" -o /tmp/v2ray/v2ray.zip https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-64.zip unzip /tmp/v2ray/v2ray.zip -d /tmp/v2ray #rm before install rm -rf /usr/local/bin/v2ray rm -rf /u...
<gh_stars>1-10 /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "Li...
#!/bin/bash -e # shellcheck disable=SC2119,SC1091 run_sub_stage() { log "Begin ${SUB_STAGE_DIR}" pushd "${SUB_STAGE_DIR}" > /dev/null for i in {00..99}; do if [ -f "${i}-debconf" ]; then log "Begin ${SUB_STAGE_DIR}/${i}-debconf" on_chroot << EOF debconf-set-selections <<SELEOF $(cat "${i}-debconf") SELEOF EO...
import RPi.GPIO as GPIO import time # Set GPIO pin an output type def setupValve(): pin = 22 GPIO.setmode(GPIO.BOARD) GPIO.setup(pin, GPIO.OUT) GPIO.output(pin, GPIO.LOW) print("Valve initialized.") return pin # Perform valve functionality test # You should hear an audiable click # when the solenoid tri...
// // ZYCycleFlowLayout.h // Investank // // Created by 史泽东 on 2019/1/14. // Copyright © 2019 史泽东. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface ZYCycleFlowLayout : UICollectionViewFlowLayout @end NS_ASSUME_NONNULL_END
<filename>signalFile_test.go package main import ( "golang.org/x/exp/inotify" "os" "testing" "time" ) // Test file exists func TestExistsTrue(test *testing.T) { testFile := new(signalFile) testFile.File = os.NewFile(0, "./testFileExistsTrue.file") // Create testFile.Touch() if !testFile.Exists() { test.F...
<reponame>Skyhark-Projects/golang-bic-from-iban<filename>bic/banks.go package bic type Bank struct { Country string City string Start int End int Name string Swift string } var banks = []Bank{} func GetSwiftBank(swift string) *Bank { for _, bank := range banks { if bank.Swift == s...
<filename>src/scripts/drawables/ui/LevelName.ts import { UiDepths, UI_SCALE } from '../../helpers/constants'; import globalState from '../../worldstate/index'; const X_POSITION = 12; const Y_POSITION = 146; const isTileVisible = (tile: Phaser.Tilemaps.Tile) => { // tslint:disable-next-line: no-magic-numbers return ...
import java.util.Arrays; public class Videotest extends MiniJava { public static final String ANSI_RED = "\u001B[31m"; public static final String ANSI_GREEN = "\u001B[32m"; public static final String ANSI_RESET = "\u001B[0m"; public static void fehler(String meldung) { System.out.println(ANSI_RED ...
<reponame>scenarioo/scenarioo-js import fs from 'fs'; import assert from 'assert'; import isArray from 'lodash/isArray'; import Q from 'q'; function assertXmlContent(filePath, expectedContents) { return Q.nfcall(fs.readFile, filePath, 'utf-8') .then(xmlContent => { // Replace tabs in the beginning x...
def filter_data(data, criteria): filtered_data = [] for obj in data: if obj[criteria[0]] == criteria[1]: filtered_data.append(obj) return filtered_data people = [{'name':'John','age':23}, {'name':'Jane','age':27},{'name':'Adam','age':20}] filtered_people = filter_data(people, ['age', 2...
<filename>uva/00614.cc // https://uva.onlinejudge.org/external/6/614.pdf #include<bits/stdc++.h> using namespace std; using vi=vector<int>; using vvi=vector<vi>; int main(){ for(int t=0;;t++){ int n,m,a,b,c,d; cin>>n>>m>>a>>b>>c>>d; if(!n)break; a--;b--;c--;d--; vvi e(n,vi(m)),f(n,vi(m)); for(...
#!/usr/bin/env bash # # This file is part of PHP CS Fixer (https://github.com/FriendsOfPHP/PHP-CS-Fixer). # # Copyright (c) 2012-2019 Fabien Potencier # Dariusz Rumiński # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and # associated documentat...